logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://hacktivis.me/git/pleroma-fe.git

selectable_list.vue (1996B)


  1. <template>
  2. <div class="selectable-list">
  3. <div
  4. v-if="items.length > 0"
  5. class="selectable-list-header"
  6. >
  7. <div class="selectable-list-checkbox-wrapper">
  8. <Checkbox
  9. :model-value="allSelected"
  10. :indeterminate="someSelected"
  11. @update:model-value="toggleAll"
  12. >
  13. {{ $t('selectable_list.select_all') }}
  14. </Checkbox>
  15. </div>
  16. <div class="selectable-list-header-actions">
  17. <slot
  18. name="header"
  19. :selected="filteredSelected"
  20. />
  21. </div>
  22. </div>
  23. <List
  24. :items="items"
  25. :get-key="getKey"
  26. :get-class="item => isSelected(item) ? '-active' : ''"
  27. >
  28. <template #item="{item}">
  29. <div
  30. class="selectable-list-item-inner"
  31. :class="{ 'selectable-list-item-selected-inner': isSelected(item) }"
  32. @click.stop="toggle(!isSelected(item), item)"
  33. >
  34. <div class="selectable-list-checkbox-wrapper">
  35. <Checkbox
  36. :model-value="isSelected(item)"
  37. @update:model-value="checked => toggle(checked, item)"
  38. @click.stop
  39. />
  40. </div>
  41. <slot
  42. name="item"
  43. :item="item"
  44. />
  45. </div>
  46. </template>
  47. <template #empty>
  48. <slot name="empty" />
  49. </template>
  50. </List>
  51. </div>
  52. </template>
  53. <script src="./selectable_list.js"></script>
  54. <style lang="scss">
  55. .selectable-list {
  56. --__line-height: 1.5em;
  57. --__horizontal-gap: 0.75em;
  58. --__vertical-gap: 0.5em;
  59. &-item-inner {
  60. display: flex;
  61. align-items: center;
  62. > * {
  63. min-width: 0;
  64. }
  65. }
  66. &-header {
  67. display: flex;
  68. align-items: center;
  69. padding: var(--__vertical-gap) var(--__horizontal-gap);
  70. border-bottom: 1px solid;
  71. border-bottom-color: var(--border);
  72. &-actions {
  73. flex: 1;
  74. }
  75. }
  76. &-checkbox-wrapper {
  77. padding-right: var(--__horizontal-gap);
  78. flex: none;
  79. }
  80. }
  81. </style>