2019-04-04 01:43:24 +00:00
|
|
|
<template>
|
2019-04-04 08:32:36 +00:00
|
|
|
<div class="selectable-list">
|
2019-07-05 07:17:44 +00:00
|
|
|
<div
|
|
|
|
v-if="items.length > 0"
|
|
|
|
class="selectable-list-header"
|
|
|
|
>
|
2019-04-04 08:32:36 +00:00
|
|
|
<div class="selectable-list-checkbox-wrapper">
|
2019-07-05 07:17:44 +00:00
|
|
|
<Checkbox
|
2022-03-29 12:35:18 +00:00
|
|
|
:model-value="allSelected"
|
2019-07-05 07:17:44 +00:00
|
|
|
:indeterminate="someSelected"
|
2022-03-30 20:48:06 +00:00
|
|
|
@update:model-value="toggleAll"
|
2019-07-05 07:17:44 +00:00
|
|
|
>
|
|
|
|
{{ $t('selectable_list.select_all') }}
|
|
|
|
</Checkbox>
|
2019-04-04 03:35:43 +00:00
|
|
|
</div>
|
2019-04-04 08:39:16 +00:00
|
|
|
<div class="selectable-list-header-actions">
|
2019-07-05 07:17:44 +00:00
|
|
|
<slot
|
|
|
|
name="header"
|
|
|
|
:selected="filteredSelected"
|
|
|
|
/>
|
2019-04-04 08:39:16 +00:00
|
|
|
</div>
|
2019-04-04 08:32:36 +00:00
|
|
|
</div>
|
2019-07-05 07:17:44 +00:00
|
|
|
<List
|
|
|
|
:items="items"
|
|
|
|
:get-key="getKey"
|
|
|
|
>
|
2021-04-07 19:42:34 +00:00
|
|
|
<template v-slot:item="{item}">
|
2019-07-05 07:17:44 +00:00
|
|
|
<div
|
|
|
|
class="selectable-list-item-inner"
|
|
|
|
:class="{ 'selectable-list-item-selected-inner': isSelected(item) }"
|
|
|
|
>
|
2019-04-04 08:32:36 +00:00
|
|
|
<div class="selectable-list-checkbox-wrapper">
|
2019-07-05 07:17:44 +00:00
|
|
|
<Checkbox
|
2022-03-29 12:35:18 +00:00
|
|
|
:model-value="isSelected(item)"
|
2022-03-30 20:48:06 +00:00
|
|
|
@update:model-value="checked => toggle(checked, item)"
|
2019-07-05 07:17:44 +00:00
|
|
|
/>
|
2019-04-04 08:32:36 +00:00
|
|
|
</div>
|
2019-07-05 07:17:44 +00:00
|
|
|
<slot
|
|
|
|
name="item"
|
|
|
|
:item="item"
|
|
|
|
/>
|
2019-04-04 08:32:36 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
2021-04-07 19:42:34 +00:00
|
|
|
<template v-slot:empty>
|
2019-07-05 07:17:44 +00:00
|
|
|
<slot name="empty" />
|
|
|
|
</template>
|
2019-04-04 08:32:36 +00:00
|
|
|
</List>
|
|
|
|
</div>
|
2019-04-04 01:43:24 +00:00
|
|
|
</template>
|
|
|
|
|
2019-04-04 02:48:00 +00:00
|
|
|
<script src="./selectable_list.js"></script>
|
2019-04-04 01:43:24 +00:00
|
|
|
|
|
|
|
<style lang="scss">
|
2019-04-04 03:35:43 +00:00
|
|
|
@import '../../_variables.scss';
|
|
|
|
|
2019-04-04 02:48:00 +00:00
|
|
|
.selectable-list {
|
2019-04-04 03:54:14 +00:00
|
|
|
&-item-inner {
|
2019-04-04 03:35:43 +00:00
|
|
|
display: flex;
|
2019-04-04 08:32:36 +00:00
|
|
|
align-items: center;
|
2019-04-29 17:20:03 +00:00
|
|
|
|
2019-04-29 17:57:44 +00:00
|
|
|
> * {
|
2019-04-29 17:20:03 +00:00
|
|
|
min-width: 0;
|
|
|
|
}
|
2019-04-04 03:54:14 +00:00
|
|
|
}
|
2019-04-04 03:35:43 +00:00
|
|
|
|
2019-04-04 03:54:14 +00:00
|
|
|
&-item-selected-inner {
|
|
|
|
background-color: $fallback--lightBg;
|
2020-01-13 18:40:16 +00:00
|
|
|
background-color: var(--selectedMenu, $fallback--lightBg);
|
|
|
|
color: var(--selectedMenuText, $fallback--text);
|
|
|
|
--faint: var(--selectedMenuFaintText, $fallback--faint);
|
|
|
|
--faintLink: var(--selectedMenuFaintLink, $fallback--faint);
|
2020-01-23 22:36:32 +00:00
|
|
|
--lightText: var(--selectedMenuLightText, $fallback--lightText);
|
2020-01-13 18:40:16 +00:00
|
|
|
--icon: var(--selectedMenuIcon, $fallback--icon);
|
2019-04-04 03:35:43 +00:00
|
|
|
}
|
|
|
|
|
2019-04-04 08:32:36 +00:00
|
|
|
&-header {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
padding: 0.6em 0;
|
2019-04-04 17:31:20 +00:00
|
|
|
border-bottom: 2px solid;
|
2019-04-04 08:40:25 +00:00
|
|
|
border-bottom-color: $fallback--border;
|
|
|
|
border-bottom-color: var(--border, $fallback--border);
|
2019-04-04 08:39:16 +00:00
|
|
|
|
|
|
|
&-actions {
|
|
|
|
flex: 1;
|
|
|
|
}
|
2019-04-04 08:32:36 +00:00
|
|
|
}
|
|
|
|
|
2019-04-04 03:35:43 +00:00
|
|
|
&-checkbox-wrapper {
|
2019-04-04 08:32:36 +00:00
|
|
|
padding: 0 10px;
|
2019-04-04 03:35:43 +00:00
|
|
|
flex: none;
|
|
|
|
}
|
2019-04-04 02:48:00 +00:00
|
|
|
}
|
2019-04-04 01:43:24 +00:00
|
|
|
</style>
|