2019-04-03 18:43:24 -07:00
|
|
|
<template>
|
2019-04-03 19:48:00 -07:00
|
|
|
<div class="selectable-list">
|
2019-04-03 20:35:43 -07: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-03 19:48:00 -07: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-03 18:43:24 -07:00
|
|
|
</div>
|
|
|
|
</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:35:43 -07:00
|
|
|
&-item {
|
|
|
|
display: flex;
|
|
|
|
|
|
|
|
&-selected {
|
|
|
|
background-color: $fallback--lightBg;
|
|
|
|
background-color: var(--lightBg, $fallback--lightBg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
&-checkbox-wrapper {
|
|
|
|
padding: 10px;
|
|
|
|
flex: none;
|
|
|
|
}
|
|
|
|
|
2019-04-03 19:48:00 -07:00
|
|
|
&-empty-content {
|
|
|
|
text-align: center;
|
|
|
|
padding: 10px;
|
|
|
|
}
|
|
|
|
}
|
2019-04-03 18:43:24 -07:00
|
|
|
</style>
|