2019-04-03 18:43:24 -07:00
|
|
|
<template>
|
2019-04-04 01:32:36 -07:00
|
|
|
<div class="selectable-list">
|
2019-04-04 10:35:49 -07:00
|
|
|
<div class="selectable-list-header" v-if="items.length > 0">
|
2019-04-04 01:32:36 -07:00
|
|
|
<div class="selectable-list-checkbox-wrapper">
|
2019-04-06 10:45:28 -07:00
|
|
|
<Checkbox :checked="allSelected" @change="toggleAll" :indeterminate="someSelected">{{ $t('selectable_list.select_all') }}</Checkbox>
|
2019-04-03 20:35:43 -07:00
|
|
|
</div>
|
2019-04-04 01:39:16 -07:00
|
|
|
<div class="selectable-list-header-actions">
|
2019-04-06 11:00:39 -07:00
|
|
|
<slot name="header" :selected="filteredSelected" />
|
2019-04-04 01:39:16 -07:00
|
|
|
</div>
|
2019-04-04 01:32:36 -07:00
|
|
|
</div>
|
|
|
|
<List :items="items" :getKey="getKey">
|
2019-04-11 19:15:58 -07:00
|
|
|
<template slot="item" slot-scope="{item}">
|
|
|
|
<div class="selectable-list-item-inner" :class="{ 'selectable-list-item-selected-inner': isSelected(item) }">
|
2019-04-04 01:32:36 -07:00
|
|
|
<div class="selectable-list-checkbox-wrapper">
|
2019-04-11 19:15:58 -07:00
|
|
|
<Checkbox :checked="isSelected(item)" @change="checked => toggle(checked, item)" />
|
2019-04-04 01:32:36 -07:00
|
|
|
</div>
|
2019-04-11 19:15:58 -07:00
|
|
|
<slot name="item" :item="item" />
|
2019-04-04 01:32:36 -07:00
|
|
|
</div>
|
|
|
|
</template>
|
2019-04-04 10:35:30 -07:00
|
|
|
<template slot="empty"><slot name="empty" /></template>
|
2019-04-04 01:32:36 -07:00
|
|
|
</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-29 10:20:03 -07:00
|
|
|
|
|
|
|
& > * {
|
|
|
|
min-width: 0;
|
|
|
|
}
|
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 10:31:20 -07:00
|
|
|
border-bottom: 2px solid;
|
2019-04-04 01:40:25 -07:00
|
|
|
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>
|