2019-04-03 18:43:24 -07:00
|
|
|
<template>
|
2019-04-04 01:32:36 -07:00
|
|
|
<div class="selectable-list">
|
|
|
|
<div class="selectable-list-header">
|
|
|
|
<div class="selectable-list-checkbox-wrapper">
|
|
|
|
<Checkbox :checked="allSelected" @change="toggleAll" />
|
2019-04-03 20:35:43 -07:00
|
|
|
</div>
|
2019-04-04 01:39:16 -07:00
|
|
|
<div class="selectable-list-header-actions">
|
|
|
|
<slot name="header" :selected="selected" />
|
|
|
|
</div>
|
2019-04-04 01:32:36 -07:00
|
|
|
</div>
|
|
|
|
<List :items="items" :getKey="getKey">
|
2019-04-04 09:12:27 -07:00
|
|
|
<template slot="item" slot-scope="p">
|
2019-04-04 01:32:36 -07:00
|
|
|
<div class="selectable-list-item-inner" :class="{ 'selectable-list-item-selected-inner': isSelected(p.item) }">
|
|
|
|
<div class="selectable-list-checkbox-wrapper">
|
|
|
|
<Checkbox :checked="isSelected(p.item)" @change="checked => toggle(checked, p.item)" />
|
|
|
|
</div>
|
|
|
|
<slot name="item" :item="p.item" />
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</List>
|
|
|
|
</div>
|
2019-04-03 18:43:24 -07:00
|
|
|
</template>
|
|
|
|
|
2019-04-03 19:48:00 -07:00
|
|
|
<script src="./selectable_list.js"></script>
|
2019-04-03 18:43:24 -07:00
|
|
|
|
|
|
|
<style lang="scss">
|
2019-04-03 20:35:43 -07:00
|
|
|
@import '../../_variables.scss';
|
|
|
|
|
2019-04-03 19:48:00 -07:00
|
|
|
.selectable-list {
|
2019-04-03 20:54:14 -07:00
|
|
|
&-item-inner {
|
2019-04-03 20:35:43 -07:00
|
|
|
display: flex;
|
2019-04-04 01:32:36 -07:00
|
|
|
align-items: center;
|
2019-04-03 20:54:14 -07:00
|
|
|
}
|
2019-04-03 20:35:43 -07:00
|
|
|
|
2019-04-03 20:54:14 -07:00
|
|
|
&-item-selected-inner {
|
|
|
|
background-color: $fallback--lightBg;
|
|
|
|
background-color: var(--lightBg, $fallback--lightBg);
|
2019-04-03 20:35:43 -07:00
|
|
|
}
|
|
|
|
|
2019-04-04 01:32:36 -07:00
|
|
|
&-header {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
padding: 0.6em 0;
|
2019-04-04 01:40:25 -07:00
|
|
|
border-bottom: 1px solid;
|
|
|
|
border-bottom-color: $fallback--border;
|
|
|
|
border-bottom-color: var(--border, $fallback--border);
|
2019-04-04 01:39:16 -07:00
|
|
|
|
|
|
|
&-actions {
|
|
|
|
flex: 1;
|
|
|
|
}
|
2019-04-04 01:32:36 -07:00
|
|
|
}
|
|
|
|
|
2019-04-03 20:35:43 -07:00
|
|
|
&-checkbox-wrapper {
|
2019-04-04 01:32:36 -07:00
|
|
|
padding: 0 10px;
|
2019-04-03 20:35:43 -07:00
|
|
|
flex: none;
|
|
|
|
}
|
2019-04-03 19:48:00 -07:00
|
|
|
}
|
2019-04-03 18:43:24 -07:00
|
|
|
</style>
|