nuxt-ui-tools 1.17.0 → 1.18.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 (122) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +1 -0
  3. package/dist/runtime/form/components/page/form-page-navigation.d.vue.ts +5 -3
  4. package/dist/runtime/form/components/page/form-page-navigation.vue +6 -3
  5. package/dist/runtime/form/components/page/form-page-navigation.vue.d.ts +5 -3
  6. package/dist/runtime/form/components/page/form-page-section.vue +6 -5
  7. package/dist/runtime/form/components/page/form-page-sections.d.vue.ts +4 -3
  8. package/dist/runtime/form/components/page/form-page-sections.vue +7 -2
  9. package/dist/runtime/form/components/page/form-page-sections.vue.d.ts +4 -3
  10. package/dist/runtime/form/components/page/form-page.d.vue.ts +2 -0
  11. package/dist/runtime/form/components/page/form-page.vue +10 -2
  12. package/dist/runtime/form/components/page/form-page.vue.d.ts +2 -0
  13. package/dist/runtime/form/components/renderer/form-field-renderer.vue +6 -4
  14. package/dist/runtime/form/components/renderer/form-field-shell.d.vue.ts +4 -4
  15. package/dist/runtime/form/components/renderer/form-field-shell.vue +28 -4
  16. package/dist/runtime/form/components/renderer/form-field-shell.vue.d.ts +4 -4
  17. package/dist/runtime/form/components/root/form.vue +2 -2
  18. package/dist/runtime/form/composables/use-field-control.d.ts +1 -1
  19. package/dist/runtime/form/composables/use-field-control.js +9 -21
  20. package/dist/runtime/form/composables/use-field-options.js +8 -4
  21. package/dist/runtime/form/composables/use-form-page.d.ts +11 -1
  22. package/dist/runtime/form/composables/use-form-page.js +12 -6
  23. package/dist/runtime/form/composables/use-form-runtime.js +1 -1
  24. package/dist/runtime/form/fields/array-primitive/types.d.ts +1 -1
  25. package/dist/runtime/form/fields/checkbox-card/component.vue +54 -28
  26. package/dist/runtime/form/fields/checkbox-card/config.d.ts +1 -0
  27. package/dist/runtime/form/fields/checkbox-card/config.js +1 -1
  28. package/dist/runtime/form/fields/checkbox-card/types.d.ts +3 -3
  29. package/dist/runtime/form/fields/choice-card/choice-card-label.d.vue.ts +7 -0
  30. package/dist/runtime/form/fields/choice-card/choice-card-label.vue +27 -1
  31. package/dist/runtime/form/fields/choice-card/choice-card-label.vue.d.ts +7 -0
  32. package/dist/runtime/form/fields/choice-card/types.d.ts +54 -1
  33. package/dist/runtime/form/fields/choice-card/use-choice-card.d.ts +7 -3
  34. package/dist/runtime/form/fields/choice-card/use-choice-card.js +37 -15
  35. package/dist/runtime/form/fields/choice-card/utils.d.ts +27 -0
  36. package/dist/runtime/form/fields/choice-card/utils.js +17 -0
  37. package/dist/runtime/form/fields/hierarchy/component.vue +3 -2
  38. package/dist/runtime/form/fields/index.d.ts +2 -0
  39. package/dist/runtime/form/fields/radio-card/component.vue +58 -28
  40. package/dist/runtime/form/fields/radio-card/config.d.ts +1 -0
  41. package/dist/runtime/form/fields/radio-card/config.js +1 -1
  42. package/dist/runtime/form/fields/radio-card/types.d.ts +3 -3
  43. package/dist/runtime/form/types/field-base.d.ts +6 -0
  44. package/dist/runtime/form/types/field-kind.d.ts +3 -1
  45. package/dist/runtime/form/types/field.d.ts +1 -0
  46. package/dist/runtime/form/types/page.d.ts +20 -8
  47. package/dist/runtime/form/types/ui.d.ts +24 -4
  48. package/dist/runtime/form/utils/disabled.d.ts +11 -0
  49. package/dist/runtime/form/utils/disabled.js +11 -0
  50. package/dist/runtime/form/utils/field-instance.js +3 -0
  51. package/dist/runtime/form/utils/options.d.ts +22 -1
  52. package/dist/runtime/form/utils/options.js +15 -0
  53. package/dist/runtime/form/utils/page-surface.d.ts +21 -0
  54. package/dist/runtime/form/utils/page-surface.js +27 -0
  55. package/dist/runtime/form/utils/page.d.ts +21 -1
  56. package/dist/runtime/form/utils/page.js +24 -2
  57. package/dist/runtime/i18n/locales/en.js +28 -8
  58. package/dist/runtime/i18n/locales/fr.js +28 -8
  59. package/dist/runtime/i18n/types.d.ts +46 -7
  60. package/dist/runtime/table/components/actions/row-actions.d.vue.ts +2 -0
  61. package/dist/runtime/table/components/actions/row-actions.vue +8 -3
  62. package/dist/runtime/table/components/actions/row-actions.vue.d.ts +2 -0
  63. package/dist/runtime/table/components/data-list/data-list-content.vue +7 -1
  64. package/dist/runtime/table/components/data-list/data-list-default.d.vue.ts +16 -16
  65. package/dist/runtime/table/components/data-list/data-list-default.vue +3 -0
  66. package/dist/runtime/table/components/data-list/data-list-default.vue.d.ts +16 -16
  67. package/dist/runtime/table/components/data-list/data-list-layout-switch.vue +7 -9
  68. package/dist/runtime/table/components/data-list/data-list-root.vue +5 -6
  69. package/dist/runtime/table/components/data-list/data-list-sort-menu.vue +3 -1
  70. package/dist/runtime/table/components/data-list/data-list-table.d.vue.ts +8 -1
  71. package/dist/runtime/table/components/data-list/data-list-table.vue +18 -1
  72. package/dist/runtime/table/components/data-list/data-list-table.vue.d.ts +8 -1
  73. package/dist/runtime/table/components/data-list/data-list-view-toggle.d.vue.ts +25 -0
  74. package/dist/runtime/table/components/data-list/data-list-view-toggle.vue +57 -0
  75. package/dist/runtime/table/components/data-list/data-list-view-toggle.vue.d.ts +25 -0
  76. package/dist/runtime/table/components/data-list/sort-menu-panel.vue +1 -1
  77. package/dist/runtime/table/components/layout/table-footer.d.vue.ts +6 -4
  78. package/dist/runtime/table/components/layout/table-footer.vue +80 -3
  79. package/dist/runtime/table/components/layout/table-footer.vue.d.ts +6 -4
  80. package/dist/runtime/table/components/summary/summary-content.d.ts +13 -0
  81. package/dist/runtime/table/components/summary/summary-content.js +5 -0
  82. package/dist/runtime/table/components/summary/summary-renderer.d.vue.ts +31 -0
  83. package/dist/runtime/table/components/summary/summary-renderer.vue +282 -0
  84. package/dist/runtime/table/components/summary/summary-renderer.vue.d.ts +31 -0
  85. package/dist/runtime/table/components/summary/summary-row.d.vue.ts +19 -0
  86. package/dist/runtime/table/components/summary/summary-row.vue +102 -0
  87. package/dist/runtime/table/components/summary/summary-row.vue.d.ts +19 -0
  88. package/dist/runtime/table/components/table/table-empty-state.vue +39 -9
  89. package/dist/runtime/table/components/table/table-renderer.vue +1 -1
  90. package/dist/runtime/table/components/table/table-row-actions-control.vue +10 -6
  91. package/dist/runtime/table/components/table/table-selection-control.d.vue.ts +5 -1
  92. package/dist/runtime/table/components/table/table-selection-control.vue +17 -4
  93. package/dist/runtime/table/components/table/table-selection-control.vue.d.ts +5 -1
  94. package/dist/runtime/table/components/table/table-tree-control.vue +2 -1
  95. package/dist/runtime/table/components/table/table-tree-header.vue +0 -1
  96. package/dist/runtime/table/composables/use-table-api.d.ts +2 -0
  97. package/dist/runtime/table/composables/use-table-api.js +8 -0
  98. package/dist/runtime/table/composables/use-table-columns.d.ts +2 -0
  99. package/dist/runtime/table/composables/use-table-controls.d.ts +6 -0
  100. package/dist/runtime/table/composables/use-table-controls.js +6 -3
  101. package/dist/runtime/table/composables/use-table-internals.d.ts +33 -0
  102. package/dist/runtime/table/composables/use-table-internals.js +9 -0
  103. package/dist/runtime/table/composables/use-table-row-labels.d.ts +16 -0
  104. package/dist/runtime/table/composables/use-table-row-labels.js +22 -0
  105. package/dist/runtime/table/composables/use-table-row-summary.d.ts +18 -0
  106. package/dist/runtime/table/composables/use-table-row-summary.js +41 -0
  107. package/dist/runtime/table/constants/mobile.d.ts +79 -0
  108. package/dist/runtime/table/constants/mobile.js +17 -0
  109. package/dist/runtime/table/constants/summary.d.ts +67 -0
  110. package/dist/runtime/table/constants/summary.js +31 -0
  111. package/dist/runtime/table/types/data-list.d.ts +58 -8
  112. package/dist/runtime/table/types/layout.d.ts +73 -0
  113. package/dist/runtime/table/types/schema.d.ts +9 -1
  114. package/dist/runtime/table/types/source.d.ts +6 -1
  115. package/dist/runtime/table/types/table-api.d.ts +12 -0
  116. package/dist/runtime/table/utils/columns/defs.js +3 -1
  117. package/dist/runtime/table/utils/columns/render.d.ts +2 -0
  118. package/dist/runtime/table/utils/columns/render.js +2 -2
  119. package/dist/runtime/table/utils/data-list-ui.js +3 -1
  120. package/dist/runtime/table/utils/mobile-defaults.d.ts +7 -0
  121. package/dist/runtime/table/utils/mobile-defaults.js +25 -0
  122. package/package.json +1 -1
@@ -198,6 +198,7 @@ export default defineUiToolsLocale({
198
198
  },
199
199
  actions: {
200
200
  cancelButton: "Cancel",
201
+ closeButton: "Close form",
201
202
  nextButton: "Next",
202
203
  prevButton: "Back",
203
204
  resetButton: "Reset",
@@ -208,14 +209,14 @@ export default defineUiToolsLocale({
208
209
  modifiedOne: "{count} modified.",
209
210
  modifiedOther: "{count} modified.",
210
211
  navigation: "Form sections",
211
- optional: "optional",
212
212
  remaining: "{count} left to complete.",
213
213
  resetSection: "Reset",
214
214
  sectionsOne: "{count} section",
215
215
  sectionsOther: "{count} sections",
216
216
  status: {
217
- complete: "Complete",
218
- invalid: "Has errors",
217
+ complete: "Completed",
218
+ invalid: "To fix",
219
+ optional: "Optional",
219
220
  pending: "To complete"
220
221
  },
221
222
  unmodified: "No unsaved changes.",
@@ -284,9 +285,13 @@ export default defineUiToolsLocale({
284
285
  rating: {
285
286
  value: "{value} of {max}"
286
287
  },
288
+ shell: {
289
+ collapse: "Collapse",
290
+ expand: "Expand",
291
+ reset: "Reset field"
292
+ },
287
293
  text: {
288
- clear: "Clear",
289
- defaultPlaceholder: "Enter a value"
294
+ clear: "Clear"
290
295
  },
291
296
  time: {
292
297
  clear: "Clear time",
@@ -294,6 +299,10 @@ export default defineUiToolsLocale({
294
299
  hour: "Hour",
295
300
  minute: "Minute"
296
301
  },
302
+ unsupported: {
303
+ description: 'The "{type}" field type cannot be displayed.',
304
+ title: "Unsupported field"
305
+ },
297
306
  upload: {
298
307
  cancel: "Cancel upload",
299
308
  failed: "Upload failed.",
@@ -314,6 +323,9 @@ export default defineUiToolsLocale({
314
323
  title: "Form data unavailable"
315
324
  }
316
325
  },
326
+ steps: {
327
+ fallback: "Step {number}"
328
+ },
317
329
  validation: {
318
330
  dateMax: "The date must be on or before {max}",
319
331
  dateMin: "The date must be on or after {min}",
@@ -692,8 +704,18 @@ export default defineUiToolsLocale({
692
704
  header: {
693
705
  gridView: "Grid view",
694
706
  refreshData: "Refresh data",
707
+ summaryView: "List view",
695
708
  tableView: "Table view"
696
709
  },
710
+ rowActions: {
711
+ label: "Actions for {label}",
712
+ labelAt: "Actions for row {position}"
713
+ },
714
+ selection: {
715
+ selectAll: "Select all rows",
716
+ selectRow: "Select {label}",
717
+ selectRowAt: "Select row {position}"
718
+ },
697
719
  selectionBar: {
698
720
  allResults: "All results",
699
721
  clear: "Clear selection",
@@ -732,9 +754,7 @@ export default defineUiToolsLocale({
732
754
  collapse: "Collapse row",
733
755
  collapseAll: "Collapse all rows",
734
756
  expand: "Expand row",
735
- expandAll: "Expand all rows",
736
- selectAll: "Select all rows",
737
- selectRow: "Select row"
757
+ expandAll: "Expand all rows"
738
758
  }
739
759
  }
740
760
  },
@@ -198,6 +198,7 @@ export default defineUiToolsLocale({
198
198
  },
199
199
  actions: {
200
200
  cancelButton: "Annuler",
201
+ closeButton: "Fermer le formulaire",
201
202
  nextButton: "Suivant",
202
203
  prevButton: "Pr\xE9c\xE9dent",
203
204
  resetButton: "R\xE9initialiser",
@@ -208,14 +209,14 @@ export default defineUiToolsLocale({
208
209
  modifiedOne: "{count} modifi\xE9e.",
209
210
  modifiedOther: "{count} modifi\xE9es.",
210
211
  navigation: "Sections du formulaire",
211
- optional: "optionnel",
212
212
  remaining: "{count} \xE0 compl\xE9ter.",
213
213
  resetSection: "R\xE9initialiser",
214
214
  sectionsOne: "{count} section",
215
215
  sectionsOther: "{count} sections",
216
216
  status: {
217
- complete: "Compl\xE8te",
218
- invalid: "Contient des erreurs",
217
+ complete: "Compl\xE9t\xE9",
218
+ invalid: "\xC0 corriger",
219
+ optional: "Facultatif",
219
220
  pending: "\xC0 compl\xE9ter"
220
221
  },
221
222
  unmodified: "Aucune modification en cours.",
@@ -284,9 +285,13 @@ export default defineUiToolsLocale({
284
285
  rating: {
285
286
  value: "{value} sur {max}"
286
287
  },
288
+ shell: {
289
+ collapse: "Replier",
290
+ expand: "D\xE9plier",
291
+ reset: "R\xE9initialiser le champ"
292
+ },
287
293
  text: {
288
- clear: "Effacer",
289
- defaultPlaceholder: "Saisissez une valeur"
294
+ clear: "Effacer"
290
295
  },
291
296
  time: {
292
297
  clear: "Effacer l\u2019heure",
@@ -294,6 +299,10 @@ export default defineUiToolsLocale({
294
299
  hour: "Heure",
295
300
  minute: "Minute"
296
301
  },
302
+ unsupported: {
303
+ description: "Le type de champ \xAB {type} \xBB ne peut pas \xEAtre affich\xE9.",
304
+ title: "Champ non pris en charge"
305
+ },
297
306
  upload: {
298
307
  cancel: "Annuler le t\xE9l\xE9versement",
299
308
  failed: "\xC9chec du t\xE9l\xE9versement.",
@@ -314,6 +323,9 @@ export default defineUiToolsLocale({
314
323
  title: "Donn\xE9es du formulaire indisponibles"
315
324
  }
316
325
  },
326
+ steps: {
327
+ fallback: "\xC9tape {number}"
328
+ },
317
329
  validation: {
318
330
  dateMax: "La date doit \xEAtre au plus tard le {max}",
319
331
  dateMin: "La date doit \xEAtre au plus t\xF4t le {min}",
@@ -692,8 +704,18 @@ export default defineUiToolsLocale({
692
704
  header: {
693
705
  gridView: "Vue grille",
694
706
  refreshData: "Actualiser les donn\xE9es",
707
+ summaryView: "Vue liste",
695
708
  tableView: "Vue tableau"
696
709
  },
710
+ rowActions: {
711
+ label: "Actions pour {label}",
712
+ labelAt: "Actions pour la ligne {position}"
713
+ },
714
+ selection: {
715
+ selectAll: "S\xE9lectionner toutes les lignes",
716
+ selectRow: "S\xE9lectionner {label}",
717
+ selectRowAt: "S\xE9lectionner la ligne {position}"
718
+ },
697
719
  selectionBar: {
698
720
  allResults: "Tous les r\xE9sultats",
699
721
  clear: "Effacer la s\xE9lection",
@@ -732,9 +754,7 @@ export default defineUiToolsLocale({
732
754
  collapse: "Replier la ligne",
733
755
  collapseAll: "Replier toutes les lignes",
734
756
  expand: "D\xE9plier la ligne",
735
- expandAll: "D\xE9plier toutes les lignes",
736
- selectAll: "S\xE9lectionner toutes les lignes",
737
- selectRow: "S\xE9lectionner la ligne"
757
+ expandAll: "D\xE9plier toutes les lignes"
738
758
  }
739
759
  }
740
760
  },
@@ -2,8 +2,11 @@ import type { DeepPartial } from '#ui-tools/shared/types/utils';
2
2
  export interface UiToolsTableMessages {
3
3
  header: {
4
4
  refreshData: string;
5
+ /** Names the table layout, and the toggle that leaves summary rows for the table. */
5
6
  tableView: string;
6
7
  gridView: string;
8
+ /** Toggle that brings summary rows back from the table. */
9
+ summaryView: string;
7
10
  };
8
11
  footer: {
9
12
  rowsSelected: string;
@@ -12,6 +15,7 @@ export interface UiToolsTableMessages {
12
15
  range: string;
13
16
  rangeEmpty: string;
14
17
  pageOf: string;
18
+ /** Accessible name of a page button: "Page {current} of {total}". */
15
19
  page: string;
16
20
  pageSizeOption: string;
17
21
  previousPage: string;
@@ -19,6 +23,21 @@ export interface UiToolsTableMessages {
19
23
  firstPage: string;
20
24
  lastPage: string;
21
25
  };
26
+ /** Accessible names of the selection checkboxes. */
27
+ selection: {
28
+ selectAll: string;
29
+ /** A record with a label: "Select {label}". */
30
+ selectRow: string;
31
+ /** A record without one, by its position on the page: "Select row {position}". */
32
+ selectRowAt: string;
33
+ };
34
+ /** Accessible names of a row's actions menu. */
35
+ rowActions: {
36
+ /** A record with a label: "Actions for {label}". */
37
+ label: string;
38
+ /** A record without one, by its position on the page: "Actions for row {position}". */
39
+ labelAt: string;
40
+ };
22
41
  controls: {
23
42
  addFilter: string;
24
43
  clearSearch: string;
@@ -55,8 +74,6 @@ export interface UiToolsTableMessages {
55
74
  collapse: string;
56
75
  expandAll: string;
57
76
  collapseAll: string;
58
- selectRow: string;
59
- selectAll: string;
60
77
  };
61
78
  columnsMenu: {
62
79
  sortAsc: string;
@@ -429,13 +446,13 @@ export interface UiToolsFormMessages {
429
446
  submitButton: string;
430
447
  cancelButton: string;
431
448
  resetButton: string;
449
+ /** Accessible name of the close button of a modal, drawer, or fullscreen form. */
450
+ closeButton: string;
432
451
  };
433
452
  /** Form page chrome. Counts use `Intl.PluralRules`: `One` for "one", `Other` otherwise. */
434
453
  page: {
435
454
  /** Accessible name of the section navigation when the schema gives it no title. */
436
455
  navigation: string;
437
- /** Marks an optional section, in the navigation and on its card. */
438
- optional: string;
439
456
  /** Badge under the page title and name of a section's dirty marker. */
440
457
  unsavedChanges: string;
441
458
  /** Button of a modified section that puts its values back. */
@@ -452,11 +469,19 @@ export interface UiToolsFormMessages {
452
469
  modifiedOther: string;
453
470
  /** Navigation summary of a form with dirty checking and no change. */
454
471
  unmodified: string;
455
- /** Accessible status of a navigation entry. */
472
+ /**
473
+ * Where a section stands: the accessible status of a navigation entry, and the tag that marks
474
+ * an optional section nothing was entered in (`optional`), in the navigation and on its card.
475
+ */
456
476
  status: {
477
+ /** Nothing required is missing and no field shows an error. */
457
478
  complete: string;
458
- pending: string;
479
+ /** A field shows an error, once the user left it or tried to submit. */
459
480
  invalid: string;
481
+ /** An optional section nobody entered a value in. */
482
+ optional: string;
483
+ /** A required field has no value yet. */
484
+ pending: string;
460
485
  };
461
486
  };
462
487
  states: {
@@ -466,6 +491,10 @@ export interface UiToolsFormMessages {
466
491
  action: string;
467
492
  };
468
493
  };
494
+ steps: {
495
+ /** Name of a step that declares no title: "Step {number}". */
496
+ fallback: string;
497
+ };
469
498
  validation: {
470
499
  required: string;
471
500
  dateMin: string;
@@ -473,7 +502,6 @@ export interface UiToolsFormMessages {
473
502
  };
474
503
  fields: {
475
504
  text: {
476
- defaultPlaceholder: string;
477
505
  clear: string;
478
506
  };
479
507
  description: {
@@ -562,6 +590,17 @@ export interface UiToolsFormMessages {
562
590
  number: string;
563
591
  clear: string;
564
592
  };
593
+ /** Chrome around a stateful field: its collapsible body and its dirty-reset button. */
594
+ shell: {
595
+ collapse: string;
596
+ expand: string;
597
+ reset: string;
598
+ };
599
+ /** Fallback for a field kind that has no renderer: "{type}" is the kind. */
600
+ unsupported: {
601
+ title: string;
602
+ description: string;
603
+ };
565
604
  };
566
605
  }
567
606
  export interface UiToolsDashboardMessages {
@@ -12,8 +12,10 @@ type __VLS_Props = {
12
12
  declare var __VLS_8: {
13
13
  items: DropdownMenuItem[][];
14
14
  open: boolean;
15
+ label: string | undefined;
15
16
  }, __VLS_24: {
16
17
  items: DropdownMenuItem[][];
18
+ label: string | undefined;
17
19
  open: boolean;
18
20
  };
19
21
  type __VLS_Slots = {} & {
@@ -6,6 +6,7 @@ import { computed, ref, useAttrs } from "vue";
6
6
  import { useDataListBreakpoint } from "../../composables/use-data-list-breakpoint";
7
7
  import { useTableInternals } from "../../composables/use-table-internals";
8
8
  import { useTableRowActionScope } from "../../composables/use-table-row-actions";
9
+ import { useTableRowLabels } from "../../composables/use-table-row-labels";
9
10
  import { createRowActionDropdownGroups, resolveVisibleTableRowActions } from "../../utils";
10
11
  defineOptions({
11
12
  inheritAttrs: false
@@ -40,6 +41,10 @@ function runSheetItem(item) {
40
41
  item.onSelect?.(new Event("select"));
41
42
  }
42
43
  const scope = useTableRowActionScope();
44
+ const labels = useTableRowLabels();
45
+ const label = computed(
46
+ () => scope ? labels.rowActions({ index: scope.value.index, row: scope.value.row }) : void 0
47
+ );
43
48
  const portal = computed(() => props.portal ?? true);
44
49
  const visibleActions = computed(() => {
45
50
  if (!scope?.value) {
@@ -66,7 +71,7 @@ const items = computed(() => {
66
71
  v-if="scope && visibleActions.length && items.length && isMobile"
67
72
  v-model:open="sheetOpen"
68
73
  direction="bottom"
69
- title="Actions"
74
+ :title="label"
70
75
  :ui="{
71
76
  header: 'sr-only',
72
77
  content: 'nut-dl-sheet rounded-t-[16px]',
@@ -74,7 +79,7 @@ const items = computed(() => {
74
79
  body: 'p-0 pb-4'
75
80
  }"
76
81
  >
77
- <slot :items="items" :open="sheetOpen" />
82
+ <slot :items="items" :open="sheetOpen" :label="label" />
78
83
  <template #body>
79
84
  <div class="px-[10px] pt-2">
80
85
  <template v-for="(item, index) in sheetItems" :key="index">
@@ -111,7 +116,7 @@ const items = computed(() => {
111
116
  v-bind="attrs"
112
117
  >
113
118
  <template #default="slotProps">
114
- <slot v-bind="slotProps" :items="items" />
119
+ <slot v-bind="slotProps" :items="items" :label="label" />
115
120
  </template>
116
121
  </UDropdownMenu>
117
122
  </template>
@@ -12,8 +12,10 @@ type __VLS_Props = {
12
12
  declare var __VLS_8: {
13
13
  items: DropdownMenuItem[][];
14
14
  open: boolean;
15
+ label: string | undefined;
15
16
  }, __VLS_24: {
16
17
  items: DropdownMenuItem[][];
18
+ label: string | undefined;
17
19
  open: boolean;
18
20
  };
19
21
  type __VLS_Slots = {} & {
@@ -44,6 +44,7 @@ const viewportStyle = computed(() => {
44
44
  }
45
45
  return void 0;
46
46
  });
47
+ const presentation = computed(() => internals.rowSummary.active.value ? "summary" : "table");
47
48
  const rootUi = computed(() => dataListUi.ui.value.content?.ui);
48
49
  const resolvedSize = computed(
49
50
  () => props.size ?? dataListUi.ui.value.content?.size ?? dataListUi.controlSize.value
@@ -136,7 +137,12 @@ watch(
136
137
  mode="out-in"
137
138
  >
138
139
  <slot v-if="internals.controls.tableLayout.value === 'table'" name="table" :rows="rows">
139
- <DataListTable :size="resolvedSize" :fill="fit !== 'content'" class="min-h-0 flex-1">
140
+ <DataListTable
141
+ :key="presentation"
142
+ :size="resolvedSize"
143
+ :fill="fit !== 'content'"
144
+ class="min-h-0 flex-1"
145
+ >
140
146
  <template v-if="$slots.error" #error="scope">
141
147
  <slot name="error" v-bind="scope" />
142
148
  </template>
@@ -5,21 +5,21 @@ type __VLS_Props = {
5
5
  height?: string | number;
6
6
  ui?: DataListDefaultUi;
7
7
  };
8
- declare var __VLS_1: {}, __VLS_18: {}, __VLS_52: {
8
+ declare var __VLS_1: {}, __VLS_18: {}, __VLS_57: {
9
9
  layout: import("../../types/index.js").TableLayout;
10
- }, __VLS_55: {
10
+ }, __VLS_60: {
11
11
  layout: import("../../types/index.js").TableLayout;
12
- }, __VLS_58: any, __VLS_61: {
12
+ }, __VLS_63: any, __VLS_66: {
13
13
  layout: string;
14
14
  refresh: () => void;
15
15
  hasActiveQuery: boolean;
16
16
  clearQuery: () => void;
17
- }, __VLS_64: {}, __VLS_67: {}, __VLS_70: {}, __VLS_80: {
17
+ }, __VLS_69: {}, __VLS_72: {}, __VLS_75: {}, __VLS_85: {
18
18
  loadedCount: number;
19
- }, __VLS_83: {
19
+ }, __VLS_88: {
20
20
  error: {};
21
21
  retry: () => Promise<import("@tanstack/vue-query").InfiniteQueryObserverRefetchErrorResult<unknown, unknown> | import("@tanstack/vue-query").InfiniteQueryObserverSuccessResult<unknown, unknown> | import("@tanstack/vue-query").InfiniteQueryObserverLoadingErrorResult<unknown, unknown> | import("@tanstack/vue-query").InfiniteQueryObserverPendingResult<unknown, unknown> | import("@tanstack/vue-query").InfiniteQueryObserverPlaceholderResult<unknown, unknown> | undefined>;
22
- }, __VLS_86: {
22
+ }, __VLS_91: {
23
23
  loadedCount: number;
24
24
  totalCount: number | null;
25
25
  };
@@ -28,25 +28,25 @@ type __VLS_Slots = {} & {
28
28
  } & {
29
29
  actions?: (props: typeof __VLS_18) => any;
30
30
  } & {
31
- 'initial-loading'?: (props: typeof __VLS_52) => any;
31
+ 'initial-loading'?: (props: typeof __VLS_57) => any;
32
32
  } & {
33
- loading?: (props: typeof __VLS_55) => any;
33
+ loading?: (props: typeof __VLS_60) => any;
34
34
  } & {
35
- error?: (props: typeof __VLS_58) => any;
35
+ error?: (props: typeof __VLS_63) => any;
36
36
  } & {
37
- empty?: (props: typeof __VLS_61) => any;
37
+ empty?: (props: typeof __VLS_66) => any;
38
38
  } & {
39
- 'empty-table'?: (props: typeof __VLS_64) => any;
39
+ 'empty-table'?: (props: typeof __VLS_69) => any;
40
40
  } & {
41
- 'empty-grid'?: (props: typeof __VLS_67) => any;
41
+ 'empty-grid'?: (props: typeof __VLS_72) => any;
42
42
  } & {
43
- refreshing?: (props: typeof __VLS_70) => any;
43
+ refreshing?: (props: typeof __VLS_75) => any;
44
44
  } & {
45
- 'loading-more'?: (props: typeof __VLS_80) => any;
45
+ 'loading-more'?: (props: typeof __VLS_85) => any;
46
46
  } & {
47
- 'load-more-error'?: (props: typeof __VLS_83) => any;
47
+ 'load-more-error'?: (props: typeof __VLS_88) => any;
48
48
  } & {
49
- end?: (props: typeof __VLS_86) => any;
49
+ end?: (props: typeof __VLS_91) => any;
50
50
  };
51
51
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
52
52
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -15,6 +15,7 @@ import DataListRefresh from "./data-list-refresh.vue";
15
15
  import DataListSearch from "./data-list-search.vue";
16
16
  import DataListSelectionActions from "./data-list-selection-actions.vue";
17
17
  import DataListSortMenu from "./data-list-sort-menu.vue";
18
+ import DataListViewToggle from "./data-list-view-toggle.vue";
18
19
  const props = defineProps({
19
20
  title: { type: String, required: false },
20
21
  description: { type: String, required: false },
@@ -98,6 +99,8 @@ function humanizeKey(value) {
98
99
  <DataListColumnPanel v-if="controls.columns" />
99
100
  <DataListRefresh v-if="controls.refresh" />
100
101
  <DataListLayoutSwitch v-if="controls.layout" />
102
+ <!-- Offset pagination carries the toggle in its footer; the other modes have none. -->
103
+ <DataListViewToggle v-if="internals.pagination.mode.value !== 'offset'" />
101
104
  </div>
102
105
  </div>
103
106
  </header>
@@ -5,21 +5,21 @@ type __VLS_Props = {
5
5
  height?: string | number;
6
6
  ui?: DataListDefaultUi;
7
7
  };
8
- declare var __VLS_1: {}, __VLS_18: {}, __VLS_52: {
8
+ declare var __VLS_1: {}, __VLS_18: {}, __VLS_57: {
9
9
  layout: import("../../types/index.js").TableLayout;
10
- }, __VLS_55: {
10
+ }, __VLS_60: {
11
11
  layout: import("../../types/index.js").TableLayout;
12
- }, __VLS_58: any, __VLS_61: {
12
+ }, __VLS_63: any, __VLS_66: {
13
13
  layout: string;
14
14
  refresh: () => void;
15
15
  hasActiveQuery: boolean;
16
16
  clearQuery: () => void;
17
- }, __VLS_64: {}, __VLS_67: {}, __VLS_70: {}, __VLS_80: {
17
+ }, __VLS_69: {}, __VLS_72: {}, __VLS_75: {}, __VLS_85: {
18
18
  loadedCount: number;
19
- }, __VLS_83: {
19
+ }, __VLS_88: {
20
20
  error: {};
21
21
  retry: () => Promise<import("@tanstack/vue-query").InfiniteQueryObserverRefetchErrorResult<unknown, unknown> | import("@tanstack/vue-query").InfiniteQueryObserverSuccessResult<unknown, unknown> | import("@tanstack/vue-query").InfiniteQueryObserverLoadingErrorResult<unknown, unknown> | import("@tanstack/vue-query").InfiniteQueryObserverPendingResult<unknown, unknown> | import("@tanstack/vue-query").InfiniteQueryObserverPlaceholderResult<unknown, unknown> | undefined>;
22
- }, __VLS_86: {
22
+ }, __VLS_91: {
23
23
  loadedCount: number;
24
24
  totalCount: number | null;
25
25
  };
@@ -28,25 +28,25 @@ type __VLS_Slots = {} & {
28
28
  } & {
29
29
  actions?: (props: typeof __VLS_18) => any;
30
30
  } & {
31
- 'initial-loading'?: (props: typeof __VLS_52) => any;
31
+ 'initial-loading'?: (props: typeof __VLS_57) => any;
32
32
  } & {
33
- loading?: (props: typeof __VLS_55) => any;
33
+ loading?: (props: typeof __VLS_60) => any;
34
34
  } & {
35
- error?: (props: typeof __VLS_58) => any;
35
+ error?: (props: typeof __VLS_63) => any;
36
36
  } & {
37
- empty?: (props: typeof __VLS_61) => any;
37
+ empty?: (props: typeof __VLS_66) => any;
38
38
  } & {
39
- 'empty-table'?: (props: typeof __VLS_64) => any;
39
+ 'empty-table'?: (props: typeof __VLS_69) => any;
40
40
  } & {
41
- 'empty-grid'?: (props: typeof __VLS_67) => any;
41
+ 'empty-grid'?: (props: typeof __VLS_72) => any;
42
42
  } & {
43
- refreshing?: (props: typeof __VLS_70) => any;
43
+ refreshing?: (props: typeof __VLS_75) => any;
44
44
  } & {
45
- 'loading-more'?: (props: typeof __VLS_80) => any;
45
+ 'loading-more'?: (props: typeof __VLS_85) => any;
46
46
  } & {
47
- 'load-more-error'?: (props: typeof __VLS_83) => any;
47
+ 'load-more-error'?: (props: typeof __VLS_88) => any;
48
48
  } & {
49
- end?: (props: typeof __VLS_86) => any;
49
+ end?: (props: typeof __VLS_91) => any;
50
50
  };
51
51
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
52
52
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -8,6 +8,10 @@ import { useDataListBreakpoint } from "../../composables/use-data-list-breakpoin
8
8
  import { useDataListUi } from "../../composables/use-data-list-ui";
9
9
  import { useTableInternals } from "../../composables/use-table-internals";
10
10
  import { mergeDataListProps, mergeDataListUiClass } from "../../utils";
11
+ const LAYOUT_LABEL_KEYS = {
12
+ grid: "table.header.gridView",
13
+ table: "table.header.tableView"
14
+ };
11
15
  const props = defineProps({
12
16
  size: { type: String, required: false },
13
17
  labels: { type: Boolean, required: false },
@@ -59,21 +63,15 @@ function setLayout(layout) {
59
63
  :size="resolvedSize"
60
64
  :class="mergeDataListUiClass('nut-dl-layout', void 0, resolvedUi.root)"
61
65
  >
62
- <UTooltip
63
- v-for="layout in order"
64
- :key="layout"
65
- :text="layout === 'table' ? t('table.header.tableView') : t('table.header.gridView')"
66
- >
66
+ <UTooltip v-for="layout in order" :key="layout" :text="t(LAYOUT_LABEL_KEYS[layout])">
67
67
  <UButton
68
68
  v-bind="buttonProps(internals.controls.tableLayout.value === layout)"
69
69
  :data-active="internals.controls.tableLayout.value === layout"
70
70
  :icon="
71
71
  controlProps.icons?.[layout] ?? (layout === 'table' ? 'i-lucide-menu' : 'i-lucide-box')
72
72
  "
73
- :label="labels ? layout === 'table' ? 'Table' : 'Grid' : void 0"
74
- :aria-label="
75
- layout === 'table' ? t('table.header.tableView') : t('table.header.gridView')
76
- "
73
+ :label="labels ? t(LAYOUT_LABEL_KEYS[layout]) : void 0"
74
+ :aria-label="t(LAYOUT_LABEL_KEYS[layout])"
77
75
  :ui="{
78
76
  base: mergeDataListUiClass('nut-dl-layout__btn', void 0, resolvedUi.trigger),
79
77
  label: resolvedUi.triggerLabel,
@@ -7,6 +7,7 @@ import { useDataListBreakpoint } from "../../composables/use-data-list-breakpoin
7
7
  import { provideDataListUi } from "../../composables/use-data-list-ui";
8
8
  import { provideTableInternals } from "../../composables/use-table-internals";
9
9
  import { mergeDataListUiConfig } from "../../utils";
10
+ import { layerDataListMobileDefaults } from "../../utils/mobile-defaults";
10
11
  const props = defineProps({
11
12
  table: { type: Object, required: true },
12
13
  locale: { type: Object, required: false },
@@ -26,14 +27,12 @@ provideDataListUi(
26
27
  props.density,
27
28
  props.size
28
29
  );
29
- if (!isMobile.value || !merged.mobile) {
30
+ if (!isMobile.value) {
30
31
  return merged;
31
32
  }
32
- return mergeDataListUiConfig(
33
- merged,
34
- merged.mobile,
35
- merged.mobile.density,
36
- merged.mobile.control?.size
33
+ const { mobile } = merged;
34
+ return layerDataListMobileDefaults(
35
+ mobile ? mergeDataListUiConfig(merged, mobile, mobile.density, mobile.control?.size) : merged
37
36
  );
38
37
  })
39
38
  );
@@ -39,7 +39,9 @@ const resolvedUi = computed(() => ({
39
39
  ...dataListUi.ui.value.sortMenu?.ui,
40
40
  ...props.ui
41
41
  }));
42
- const visible = computed(() => props.layouts.includes(internals.controls.tableLayout.value));
42
+ const visible = computed(
43
+ () => props.layouts.includes(internals.controls.tableLayout.value) || internals.rowSummary.active.value && sortKeys.value.length > 0
44
+ );
43
45
  const triggerControlProps = computed(
44
46
  () => mergeDataListProps(
45
47
  { color: "neutral", size: resolvedSize.value, variant: "outline" },
@@ -1,13 +1,20 @@
1
1
  import type { DataListControlSize, DataListTableUi } from '../../types/index.js';
2
+ /**
3
+ * The table layout. Summary rows are its compact presentation, so they share its states and slots.
4
+ * The template carries no comment on purpose: in development a root comment turns the root into a
5
+ * fragment, which a transition around this component cannot leave, so the next view never comes in.
6
+ */
2
7
  type __VLS_Props = {
3
8
  height?: string;
4
9
  size?: DataListControlSize;
5
10
  fill?: boolean;
6
11
  ui?: DataListTableUi;
7
12
  };
8
- declare var __VLS_10: string, __VLS_11: any;
13
+ declare var __VLS_10: string, __VLS_11: any, __VLS_22: string, __VLS_23: any;
9
14
  type __VLS_Slots = {} & {
10
15
  [K in NonNullable<typeof __VLS_10>]?: (props: typeof __VLS_11) => any;
16
+ } & {
17
+ [K in NonNullable<typeof __VLS_22>]?: (props: typeof __VLS_23) => any;
11
18
  };
12
19
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
20
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;