2019-04-04 01:43:24 +00:00
|
|
|
<template>
|
2019-04-04 02:48:00 +00:00
|
|
|
<div class="selectable-list">
|
2019-04-04 03:35:43 +00:00
|
|
|
<div v-for="item in items" :key="getKey(item)" class="selectable-list-item" :class="{ 'selectable-list-item-selected': isSelected(item) }">
|
|
|
|
<div class="selectable-list-checkbox-wrapper">
|
|
|
|
<Checkbox :checked="isSelected(item)" @change="checked => toggle(checked, item)" />
|
|
|
|
</div>
|
2019-04-04 02:48:00 +00:00
|
|
|
<slot name="item" :item="item" />
|
|
|
|
</div>
|
|
|
|
<div class="selectable-list-empty-content faint" v-if="items.length === 0">
|
|
|
|
<slot name="empty" />
|
|
|
|
</div>
|
2019-04-04 01:43:24 +00:00
|
|
|
</div>
|
|
|
|
</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:35:43 +00:00
|
|
|
&-item {
|
|
|
|
display: flex;
|
2019-04-04 03:42:24 +00:00
|
|
|
border-bottom: 1px solid;
|
|
|
|
border-bottom-color: $fallback--border;
|
|
|
|
border-bottom-color: var(--border, $fallback--border);
|
2019-04-04 03:35:43 +00:00
|
|
|
|
|
|
|
&-selected {
|
|
|
|
background-color: $fallback--lightBg;
|
|
|
|
background-color: var(--lightBg, $fallback--lightBg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
&-checkbox-wrapper {
|
|
|
|
padding: 10px;
|
|
|
|
flex: none;
|
|
|
|
}
|
|
|
|
|
2019-04-04 02:48:00 +00:00
|
|
|
&-empty-content {
|
|
|
|
text-align: center;
|
|
|
|
padding: 10px;
|
|
|
|
}
|
|
|
|
}
|
2019-04-04 01:43:24 +00:00
|
|
|
</style>
|