picocrank 1.32.0 → 1.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/docs/filter-query-v1.md +5 -1
  2. package/docs/table.md +99 -0
  3. package/package.json +1 -1
  4. package/router.js +33 -0
  5. package/styles/picocrank-extensions.css +23 -2
  6. package/vue/components/Accordion.spec.js +48 -0
  7. package/vue/components/Accordion.vue +46 -0
  8. package/vue/components/AccordionItem.vue +103 -0
  9. package/vue/components/FieldValue.spec.js +88 -0
  10. package/vue/components/FieldValue.vue +222 -0
  11. package/vue/components/FormField.spec.js +1 -0
  12. package/vue/components/FormField.vue +38 -10
  13. package/vue/components/Header.vue +24 -2
  14. package/vue/components/NotificationBlock.vue +25 -0
  15. package/vue/components/ReorderList.spec.js +318 -0
  16. package/vue/components/ReorderList.vue +614 -0
  17. package/vue/components/Table.spec.js +490 -1
  18. package/vue/components/Table.vue +1038 -111
  19. package/vue/components/TableColumnFilterPopover.vue +63 -19
  20. package/vue/components/TableColumnOptionsPopover.vue +248 -273
  21. package/vue/components/TopBar.vue +6 -2
  22. package/vue/components/accordionContext.js +1 -0
  23. package/vue/composables/tableColumnPresets.js +33 -0
  24. package/vue/composables/tableFilters.js +6 -1
  25. package/vue/composables/tableGroupBy.js +173 -0
  26. package/vue/composables/tableGroupBy.spec.js +69 -0
  27. package/vue/composables/tableViewSettings.js +34 -0
  28. package/vue/composables/tableViewSettings.spec.js +21 -0
  29. package/vue/composables/useHeaderTopBarFit.js +91 -0
  30. package/vue/composables/useResponsiveNav.js +5 -3
  31. package/vue/data/navSectionHubs.js +16 -1
  32. package/vue/examples/AccordionExample.vue +33 -0
  33. package/vue/examples/FieldValueExample.vue +143 -0
  34. package/vue/examples/FormExample.vue +11 -6
  35. package/vue/examples/ReorderListExample.vue +236 -0
  36. package/vue/examples/TableExample.vue +5 -1
  37. package/vue/examples/TableRemoteExample.vue +28 -4
@@ -14,22 +14,42 @@
14
14
  <h4 :id="titleId" ref="titleRef" class="popover-title">
15
15
  {{ popoverTitle }}
16
16
  </h4>
17
- <button
18
- v-if="canHide"
19
- type="button"
20
- class="neutral inline-icon popover-hide-column"
21
- :aria-label="`Hide ${columnLabel || 'column'} column`"
22
- title="Hide column"
23
- @click="hideColumn"
24
- >
25
- <HugeiconsIcon
26
- :icon="ViewOffIcon"
27
- width="1em"
28
- height="1em"
29
- :strokeWidth="2.5"
30
- aria-hidden="true"
31
- />
32
- </button>
17
+ <div v-if="canGroupBy || canHide" class="popover-title-actions">
18
+ <button
19
+ v-if="canGroupBy"
20
+ type="button"
21
+ class="neutral inline-icon popover-title-action popover-title-action-toggle"
22
+ :class="{ active: isGroupedColumn }"
23
+ :aria-pressed="isGroupedColumn ? 'true' : 'false'"
24
+ :aria-label="isGroupedColumn ? `Ungroup ${columnLabel || 'column'}` : `Group by ${columnLabel || 'column'}`"
25
+ :title="isGroupedColumn ? 'Ungroup' : `Group by ${columnLabel}`"
26
+ @click="groupByColumn"
27
+ >
28
+ <HugeiconsIcon
29
+ :icon="Group01Icon"
30
+ width="1em"
31
+ height="1em"
32
+ :strokeWidth="2.5"
33
+ aria-hidden="true"
34
+ />
35
+ </button>
36
+ <button
37
+ v-if="canHide"
38
+ type="button"
39
+ class="neutral inline-icon popover-title-action"
40
+ :aria-label="`Hide ${columnLabel || 'column'} column`"
41
+ title="Hide column"
42
+ @click="hideColumn"
43
+ >
44
+ <HugeiconsIcon
45
+ :icon="EyeOffIcon"
46
+ width="1em"
47
+ height="1em"
48
+ :strokeWidth="2.5"
49
+ aria-hidden="true"
50
+ />
51
+ </button>
52
+ </div>
33
53
  </div>
34
54
 
35
55
  <div v-if="filterType === 'text'" class="filter-fields">
@@ -166,7 +186,7 @@
166
186
  <script setup>
167
187
  import { computed, nextTick, onBeforeUnmount, ref, useId, watch } from 'vue'
168
188
  import { HugeiconsIcon } from '@hugeicons/vue'
169
- import { Delete02Icon, ViewOffIcon } from '@hugeicons/core-free-icons'
189
+ import { Delete02Icon, EyeOffIcon, Group01Icon } from '@hugeicons/core-free-icons'
170
190
  import CheckGroup from './CheckGroup.vue'
171
191
  import RadioGroup from './RadioGroup.vue'
172
192
  import {
@@ -208,9 +228,17 @@ const props = defineProps({
208
228
  type: Boolean,
209
229
  default: false,
210
230
  },
231
+ canGroupBy: {
232
+ type: Boolean,
233
+ default: false,
234
+ },
235
+ isGroupedColumn: {
236
+ type: Boolean,
237
+ default: false,
238
+ },
211
239
  })
212
240
 
213
- const emit = defineEmits(['update:open', 'apply', 'clear', 'cancel', 'hide'])
241
+ const emit = defineEmits(['update:open', 'apply', 'clear', 'cancel', 'hide', 'group-by'])
214
242
 
215
243
  const MIN_VISIBLE_OPTIONS = 3
216
244
  const MAX_VISIBLE_OPTIONS = 20
@@ -471,6 +499,11 @@ function hideColumn() {
471
499
  emit('update:open', false)
472
500
  }
473
501
 
502
+ function groupByColumn() {
503
+ emit('group-by', props.isGroupedColumn ? null : props.header?.key)
504
+ emit('update:open', false)
505
+ }
506
+
474
507
  function detachDocumentListeners() {
475
508
  document.removeEventListener('pointerdown', onDocumentPointerDown)
476
509
  document.removeEventListener('keydown', onDocumentKeyDown)
@@ -559,12 +592,23 @@ onBeforeUnmount(() => {
559
592
  flex: 1 1 auto;
560
593
  }
561
594
 
562
- .popover-hide-column {
595
+ .popover-title-actions {
596
+ display: inline-flex;
597
+ align-items: center;
598
+ gap: 0.15rem;
563
599
  flex: 0 0 auto;
600
+ }
601
+
602
+ .popover-title-action {
564
603
  padding: 0.2em 0.45em;
565
604
  line-height: 1;
566
605
  }
567
606
 
607
+ .popover-title-action-toggle.active {
608
+ color: var(--table-header-active-fg);
609
+ background-color: var(--table-header-active-bg);
610
+ }
611
+
568
612
  .filter-fields {
569
613
  display: flex;
570
614
  flex-direction: column;