yandere_fe/src/components/selectable_list/selectable_list.vue

60 lines
1.5 KiB
Vue
Raw Normal View History

2019-04-03 18:43:24 -07:00
<template>
<div class="selectable-list">
<div class="selectable-list-header" v-if="items.length > 0">
<div class="selectable-list-checkbox-wrapper">
2019-04-04 13:20:48 -07:00
<Checkbox :checked="allSelected" @change="toggleAll">Select All</Checkbox>
</div>
2019-04-04 01:39:16 -07:00
<div class="selectable-list-header-actions">
<slot name="header" :selected="selected" />
</div>
</div>
<List :items="items" :getKey="getKey">
2019-04-04 09:12:27 -07:00
<template slot="item" slot-scope="p">
<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>
2019-04-04 10:35:30 -07:00
<template slot="empty"><slot name="empty" /></template>
</List>
</div>
2019-04-03 18:43:24 -07:00
</template>
<script src="./selectable_list.js"></script>
2019-04-03 18:43:24 -07:00
<style lang="scss">
@import '../../_variables.scss';
.selectable-list {
&-item-inner {
display: flex;
align-items: center;
}
&-item-selected-inner {
background-color: $fallback--lightBg;
background-color: var(--lightBg, $fallback--lightBg);
}
&-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;
}
}
&-checkbox-wrapper {
padding: 0 10px;
flex: none;
}
}
2019-04-03 18:43:24 -07:00
</style>