nuxt-ui-tools 0.1.0 → 0.1.2

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 (186) hide show
  1. package/dist/module.d.mts +4 -0
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +30 -15
  4. package/dist/runtime/form/components/actions/FormActions.d.vue.ts +0 -2
  5. package/dist/runtime/form/components/actions/FormActions.vue +5 -8
  6. package/dist/runtime/form/components/actions/FormActions.vue.d.ts +0 -2
  7. package/dist/runtime/form/components/layout/DrawerLayout.vue +5 -1
  8. package/dist/runtime/form/components/layout/ModalLayout.vue +5 -1
  9. package/dist/runtime/form/components/renderer/FormCompositeControl.d.vue.ts +15 -0
  10. package/dist/runtime/form/components/renderer/FormCompositeControl.vue +13 -0
  11. package/dist/runtime/form/components/renderer/FormCompositeControl.vue.d.ts +15 -0
  12. package/dist/runtime/form/components/renderer/FormFieldRenderer.d.vue.ts +1 -0
  13. package/dist/runtime/form/components/renderer/FormFieldRenderer.vue +19 -3
  14. package/dist/runtime/form/components/renderer/FormFieldRenderer.vue.d.ts +1 -0
  15. package/dist/runtime/form/components/renderer/FormFieldShell.d.vue.ts +4 -4
  16. package/dist/runtime/form/components/renderer/FormFieldShell.vue +15 -1
  17. package/dist/runtime/form/components/renderer/FormFieldShell.vue.d.ts +4 -4
  18. package/dist/runtime/form/components/root/Form.d.vue.ts +2 -2
  19. package/dist/runtime/form/components/root/Form.vue +5 -3
  20. package/dist/runtime/form/components/root/Form.vue.d.ts +2 -2
  21. package/dist/runtime/form/composables/use-field-control.d.ts +1 -1
  22. package/dist/runtime/form/composables/use-field-control.js +4 -0
  23. package/dist/runtime/form/composables/use-field-options.d.ts +1 -1
  24. package/dist/runtime/form/composables/use-field-options.js +75 -31
  25. package/dist/runtime/form/composables/use-form-field-chrome.d.ts +3 -0
  26. package/dist/runtime/form/composables/use-form-field-chrome.js +9 -0
  27. package/dist/runtime/form/composables/use-form-runtime.js +17 -5
  28. package/dist/runtime/form/fields/array-list/component.vue +4 -1
  29. package/dist/runtime/form/fields/auto-complete/component.vue +23 -16
  30. package/dist/runtime/form/fields/checkbox-card/component.vue +28 -29
  31. package/dist/runtime/form/fields/checkbox-group/component.vue +28 -29
  32. package/dist/runtime/form/fields/color-picker/component.vue +4 -2
  33. package/dist/runtime/form/fields/date-family/component.vue +9 -4
  34. package/dist/runtime/form/fields/hierarchy/SelectionCheckbox.d.vue.ts +13 -0
  35. package/dist/runtime/form/fields/hierarchy/SelectionCheckbox.vue +24 -0
  36. package/dist/runtime/form/fields/hierarchy/SelectionCheckbox.vue.d.ts +13 -0
  37. package/dist/runtime/form/fields/hierarchy/SelectionRadio.d.vue.ts +14 -0
  38. package/dist/runtime/form/fields/hierarchy/SelectionRadio.vue +27 -0
  39. package/dist/runtime/form/fields/hierarchy/SelectionRadio.vue.d.ts +14 -0
  40. package/dist/runtime/form/fields/hierarchy/component.vue +257 -142
  41. package/dist/runtime/form/fields/hierarchy/utils.d.ts +9 -0
  42. package/dist/runtime/form/fields/hierarchy/utils.js +32 -0
  43. package/dist/runtime/form/fields/input-group/component.vue +7 -30
  44. package/dist/runtime/form/fields/matrix/component.vue +9 -3
  45. package/dist/runtime/form/fields/phone-number/component.vue +7 -2
  46. package/dist/runtime/form/fields/rating/component.vue +25 -2
  47. package/dist/runtime/form/fields/select/component.vue +29 -21
  48. package/dist/runtime/form/fields/switch-group/component.vue +8 -3
  49. package/dist/runtime/form/fields/time/component.vue +7 -5
  50. package/dist/runtime/form/fields/upload/component.vue +5 -3
  51. package/dist/runtime/form/types/api.d.ts +9 -3
  52. package/dist/runtime/form/types/field-base.d.ts +3 -1
  53. package/dist/runtime/form/types/runtime.d.ts +2 -0
  54. package/dist/runtime/form/types/ui.d.ts +1 -0
  55. package/dist/runtime/form/utils/api.js +3 -0
  56. package/dist/runtime/form/utils/options.d.ts +11 -2
  57. package/dist/runtime/form/utils/options.js +57 -9
  58. package/dist/runtime/form/utils/state.js +10 -2
  59. package/dist/runtime/i18n/locales/en.js +38 -0
  60. package/dist/runtime/i18n/locales/fr.js +38 -0
  61. package/dist/runtime/i18n/types.d.ts +38 -0
  62. package/dist/runtime/i18n/use-locale.d.ts +2 -2
  63. package/dist/runtime/i18n/use-locale.js +3 -3
  64. package/dist/runtime/spreadsheet/components/layout/SpreadsheetImportFooter.d.vue.ts +2 -2
  65. package/dist/runtime/spreadsheet/components/layout/SpreadsheetImportFooter.vue.d.ts +2 -2
  66. package/dist/runtime/spreadsheet/components/steps/review/SpreadsheetReviewInspection.d.vue.ts +2 -2
  67. package/dist/runtime/spreadsheet/components/steps/review/SpreadsheetReviewInspection.vue.d.ts +2 -2
  68. package/dist/runtime/spreadsheet/composables/use-spreadsheet-internals.d.ts +15 -15
  69. package/dist/runtime/spreadsheet/composables/use-spreadsheet-resolutions.d.ts +2 -2
  70. package/dist/runtime/spreadsheet/schema/normalize.d.ts +1 -1
  71. package/dist/runtime/spreadsheet/utils/references/sources.d.ts +1 -1
  72. package/dist/runtime/table/components/DataList.d.vue.ts +2 -0
  73. package/dist/runtime/table/components/DataList.vue.d.ts +2 -0
  74. package/dist/runtime/table/components/actions/RowActions.d.vue.ts +4 -2
  75. package/dist/runtime/table/components/actions/RowActions.vue +2 -0
  76. package/dist/runtime/table/components/actions/RowActions.vue.d.ts +4 -2
  77. package/dist/runtime/table/components/data-list/DataListAddFilter.d.vue.ts +5 -3
  78. package/dist/runtime/table/components/data-list/DataListAddFilter.vue +6 -1
  79. package/dist/runtime/table/components/data-list/DataListAddFilter.vue.d.ts +5 -3
  80. package/dist/runtime/table/components/data-list/DataListContent.d.vue.ts +24 -17
  81. package/dist/runtime/table/components/data-list/DataListContent.vue +70 -17
  82. package/dist/runtime/table/components/data-list/DataListContent.vue.d.ts +24 -17
  83. package/dist/runtime/table/components/data-list/DataListDefault.d.vue.ts +2 -0
  84. package/dist/runtime/table/components/data-list/DataListDefault.vue.d.ts +2 -0
  85. package/dist/runtime/table/components/data-list/DataListFilterTags.d.vue.ts +2 -0
  86. package/dist/runtime/table/components/data-list/DataListFilterTags.vue.d.ts +2 -0
  87. package/dist/runtime/table/components/data-list/DataListInfiniteLoader.d.vue.ts +1 -1
  88. package/dist/runtime/table/components/data-list/DataListInfiniteLoader.vue.d.ts +1 -1
  89. package/dist/runtime/table/components/data-list/DataListLayoutSwitch.vue +17 -11
  90. package/dist/runtime/table/components/data-list/DataListPagination.d.vue.ts +1 -1
  91. package/dist/runtime/table/components/data-list/DataListPagination.vue.d.ts +1 -1
  92. package/dist/runtime/table/components/data-list/DataListRoot.vue +2 -46
  93. package/dist/runtime/table/components/data-list/DataListSortMenu.d.vue.ts +1 -1
  94. package/dist/runtime/table/components/data-list/DataListSortMenu.vue +6 -0
  95. package/dist/runtime/table/components/data-list/DataListSortMenu.vue.d.ts +1 -1
  96. package/dist/runtime/table/components/filters/shared/DynamicFilterPicker.d.vue.ts +5 -0
  97. package/dist/runtime/table/components/filters/shared/DynamicFilterPicker.vue +182 -59
  98. package/dist/runtime/table/components/filters/shared/DynamicFilterPicker.vue.d.ts +5 -0
  99. package/dist/runtime/table/components/filters/shared/FilterMatchModeButton.d.vue.ts +3 -1
  100. package/dist/runtime/table/components/filters/shared/FilterMatchModeButton.vue +29 -5
  101. package/dist/runtime/table/components/filters/shared/FilterMatchModeButton.vue.d.ts +3 -1
  102. package/dist/runtime/table/components/filters/shared/FilterMatchModePanel.d.vue.ts +17 -0
  103. package/dist/runtime/table/components/filters/shared/FilterMatchModePanel.vue +47 -0
  104. package/dist/runtime/table/components/filters/shared/FilterMatchModePanel.vue.d.ts +17 -0
  105. package/dist/runtime/table/components/filters/shared/FilterOptionMultipleList.d.vue.ts +3 -1
  106. package/dist/runtime/table/components/filters/shared/FilterOptionMultipleList.vue +12 -3
  107. package/dist/runtime/table/components/filters/shared/FilterOptionMultipleList.vue.d.ts +3 -1
  108. package/dist/runtime/table/components/filters/shared/FilterOptionPickerContent.d.vue.ts +3 -0
  109. package/dist/runtime/table/components/filters/shared/FilterOptionPickerContent.vue +11 -1
  110. package/dist/runtime/table/components/filters/shared/FilterOptionPickerContent.vue.d.ts +3 -0
  111. package/dist/runtime/table/components/filters/shared/FilterOptionRow.d.vue.ts +3 -0
  112. package/dist/runtime/table/components/filters/shared/FilterOptionRow.vue +48 -9
  113. package/dist/runtime/table/components/filters/shared/FilterOptionRow.vue.d.ts +3 -0
  114. package/dist/runtime/table/components/filters/shared/FilterOptionSingleList.d.vue.ts +3 -0
  115. package/dist/runtime/table/components/filters/shared/FilterOptionSingleList.vue +35 -9
  116. package/dist/runtime/table/components/filters/shared/FilterOptionSingleList.vue.d.ts +3 -0
  117. package/dist/runtime/table/components/filters/shared/FilterOptionTreeContent.d.vue.ts +3 -0
  118. package/dist/runtime/table/components/filters/shared/FilterOptionTreeContent.vue +77 -20
  119. package/dist/runtime/table/components/filters/shared/FilterOptionTreeContent.vue.d.ts +3 -0
  120. package/dist/runtime/table/components/filters/shared/FilterPopoverShell.d.vue.ts +27 -0
  121. package/dist/runtime/table/components/filters/shared/FilterPopoverShell.vue +36 -0
  122. package/dist/runtime/table/components/filters/shared/FilterPopoverShell.vue.d.ts +27 -0
  123. package/dist/runtime/table/components/filters/shared/FilterSearchablePanel.d.vue.ts +3 -0
  124. package/dist/runtime/table/components/filters/shared/FilterSearchablePanel.vue +40 -10
  125. package/dist/runtime/table/components/filters/shared/FilterSearchablePanel.vue.d.ts +3 -0
  126. package/dist/runtime/table/components/filters/shared/FilterStageTransition.d.vue.ts +23 -0
  127. package/dist/runtime/table/components/filters/shared/FilterStageTransition.vue +21 -0
  128. package/dist/runtime/table/components/filters/shared/FilterStageTransition.vue.d.ts +23 -0
  129. package/dist/runtime/table/components/filters/shared/FilterTriggerTag.d.vue.ts +3 -2
  130. package/dist/runtime/table/components/filters/shared/FilterTriggerTag.vue +26 -25
  131. package/dist/runtime/table/components/filters/shared/FilterTriggerTag.vue.d.ts +3 -2
  132. package/dist/runtime/table/components/filters/tags/BooleanFilterTag.d.vue.ts +1 -1
  133. package/dist/runtime/table/components/filters/tags/BooleanFilterTag.vue +75 -22
  134. package/dist/runtime/table/components/filters/tags/BooleanFilterTag.vue.d.ts +1 -1
  135. package/dist/runtime/table/components/filters/tags/DateFilterTag.d.vue.ts +3 -1
  136. package/dist/runtime/table/components/filters/tags/DateFilterTag.vue +254 -160
  137. package/dist/runtime/table/components/filters/tags/DateFilterTag.vue.d.ts +3 -1
  138. package/dist/runtime/table/components/filters/tags/FilterTagsBar.d.vue.ts +7 -6
  139. package/dist/runtime/table/components/filters/tags/FilterTagsBar.vue +12 -27
  140. package/dist/runtime/table/components/filters/tags/FilterTagsBar.vue.d.ts +7 -6
  141. package/dist/runtime/table/components/filters/tags/NumberFilterTag.d.vue.ts +3 -2
  142. package/dist/runtime/table/components/filters/tags/NumberFilterTag.vue +192 -106
  143. package/dist/runtime/table/components/filters/tags/NumberFilterTag.vue.d.ts +3 -2
  144. package/dist/runtime/table/components/filters/tags/OptionFilterTag.d.vue.ts +3 -2
  145. package/dist/runtime/table/components/filters/tags/OptionFilterTag.vue +110 -48
  146. package/dist/runtime/table/components/filters/tags/OptionFilterTag.vue.d.ts +3 -2
  147. package/dist/runtime/table/components/filters/tags/TextFilterTag.d.vue.ts +3 -2
  148. package/dist/runtime/table/components/filters/tags/TextFilterTag.vue +120 -57
  149. package/dist/runtime/table/components/filters/tags/TextFilterTag.vue.d.ts +3 -2
  150. package/dist/runtime/table/components/grid/GridRenderer.vue +1 -1
  151. package/dist/runtime/table/components/layout/TableFooter.d.vue.ts +1 -1
  152. package/dist/runtime/table/components/layout/TableFooter.vue +1 -0
  153. package/dist/runtime/table/components/layout/TableFooter.vue.d.ts +1 -1
  154. package/dist/runtime/table/components/table/TableCellEllipsis.d.ts +1 -1
  155. package/dist/runtime/table/components/table/TableRenderer.vue +24 -12
  156. package/dist/runtime/table/composables/use-filter-tag-session.d.ts +3 -4
  157. package/dist/runtime/table/composables/use-filter-tag-session.js +12 -32
  158. package/dist/runtime/table/composables/use-query-state.d.ts +5 -5
  159. package/dist/runtime/table/composables/use-query-state.js +7 -32
  160. package/dist/runtime/table/composables/use-table-api.js +2 -2
  161. package/dist/runtime/table/composables/use-table-columns.d.ts +4 -14
  162. package/dist/runtime/table/composables/use-table-filter-presentation.d.ts +0 -3
  163. package/dist/runtime/table/composables/use-table-filter-presentation.js +0 -9
  164. package/dist/runtime/table/composables/use-table-filters.js +18 -7
  165. package/dist/runtime/table/composables/use-table-internals.d.ts +24 -63
  166. package/dist/runtime/table/composables/use-table-pagination.d.ts +2 -2
  167. package/dist/runtime/table/composables/use-table-state.d.ts +2 -2
  168. package/dist/runtime/table/types/actions.d.ts +1 -1
  169. package/dist/runtime/table/types/data-list.d.ts +41 -8
  170. package/dist/runtime/table/types/filters.d.ts +4 -0
  171. package/dist/runtime/table/utils/actions.d.ts +1 -1
  172. package/dist/runtime/table/utils/columns/menu.d.ts +2 -11
  173. package/dist/runtime/table/utils/columns/render.d.ts +2 -9
  174. package/dist/runtime/table/utils/columns/render.js +39 -30
  175. package/dist/runtime/table/utils/columns/state.d.ts +1 -1
  176. package/dist/runtime/table/utils/data-list-ui.d.ts +3 -1
  177. package/dist/runtime/table/utils/data-list-ui.js +45 -0
  178. package/dist/runtime/table/utils/filters/editor-size.d.ts +11 -0
  179. package/dist/runtime/table/utils/filters/editor-size.js +45 -0
  180. package/dist/runtime/table/utils/filters/index.d.ts +1 -1
  181. package/dist/runtime/table/utils/filters/index.js +1 -1
  182. package/dist/runtime/table/utils/query-state.d.ts +18 -1
  183. package/dist/runtime/table/utils/query-state.js +109 -0
  184. package/package.json +4 -2
  185. package/dist/runtime/table/utils/filters/operators.d.ts +0 -4
  186. package/dist/runtime/table/utils/filters/operators.js +0 -6
@@ -6,31 +6,38 @@ type __VLS_Props = {
6
6
  ui?: DataListContentUi;
7
7
  };
8
8
  declare function refresh(): void;
9
+ declare function clearQuery(): void;
9
10
  declare var __VLS_1: {}, __VLS_4: "loading" | "initial-loading", __VLS_5: {
10
11
  layout: "table" | "grid";
11
12
  }, __VLS_7: {
12
13
  error: {};
13
14
  retry: typeof refresh;
14
- }, __VLS_9: {
15
+ }, __VLS_22: {
15
16
  layout: "table" | "grid";
16
17
  refresh: typeof refresh;
17
- }, __VLS_11: {
18
+ hasActiveQuery: boolean;
19
+ clearQuery: typeof clearQuery;
20
+ }, __VLS_24: {
18
21
  layout: "table" | "grid";
19
22
  rows: object[];
20
23
  loading: boolean;
21
24
  empty: boolean;
22
25
  error: unknown;
23
- }, __VLS_19: {
26
+ }, __VLS_32: {
24
27
  rows: object[];
25
- }, __VLS_28: {}, __VLS_30: {
28
+ }, __VLS_41: {}, __VLS_43: {
26
29
  layout: string;
27
30
  refresh: typeof refresh;
28
- }, __VLS_32: {
31
+ hasActiveQuery: boolean;
32
+ clearQuery: typeof clearQuery;
33
+ }, __VLS_45: {
29
34
  rows: object[];
30
- }, __VLS_41: {}, __VLS_43: {
35
+ }, __VLS_54: {}, __VLS_56: {
31
36
  layout: string;
32
37
  refresh: typeof refresh;
33
- }, __VLS_45: {}, __VLS_47: {};
38
+ hasActiveQuery: boolean;
39
+ clearQuery: typeof clearQuery;
40
+ }, __VLS_58: {}, __VLS_60: {};
34
41
  type __VLS_Slots = {} & {
35
42
  [K in NonNullable<typeof __VLS_4>]?: (props: typeof __VLS_5) => any;
36
43
  } & {
@@ -38,25 +45,25 @@ type __VLS_Slots = {} & {
38
45
  } & {
39
46
  error?: (props: typeof __VLS_7) => any;
40
47
  } & {
41
- empty?: (props: typeof __VLS_9) => any;
48
+ empty?: (props: typeof __VLS_22) => any;
42
49
  } & {
43
- content?: (props: typeof __VLS_11) => any;
50
+ content?: (props: typeof __VLS_24) => any;
44
51
  } & {
45
- table?: (props: typeof __VLS_19) => any;
52
+ table?: (props: typeof __VLS_32) => any;
46
53
  } & {
47
- 'empty-table'?: (props: typeof __VLS_28) => any;
54
+ 'empty-table'?: (props: typeof __VLS_41) => any;
48
55
  } & {
49
- empty?: (props: typeof __VLS_30) => any;
56
+ empty?: (props: typeof __VLS_43) => any;
50
57
  } & {
51
- grid?: (props: typeof __VLS_32) => any;
58
+ grid?: (props: typeof __VLS_45) => any;
52
59
  } & {
53
- 'empty-grid'?: (props: typeof __VLS_41) => any;
60
+ 'empty-grid'?: (props: typeof __VLS_54) => any;
54
61
  } & {
55
- empty?: (props: typeof __VLS_43) => any;
62
+ empty?: (props: typeof __VLS_56) => any;
56
63
  } & {
57
- refreshing?: (props: typeof __VLS_45) => any;
64
+ refreshing?: (props: typeof __VLS_58) => any;
58
65
  } & {
59
- after?: (props: typeof __VLS_47) => any;
66
+ after?: (props: typeof __VLS_60) => any;
60
67
  };
61
68
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
62
69
  transition: boolean;
@@ -1,4 +1,6 @@
1
1
  <script setup>
2
+ import UButton from "@nuxt/ui/components/Button.vue";
3
+ import UIcon from "@nuxt/ui/components/Icon.vue";
2
4
  import { computed, nextTick, ref, watch } from "vue";
3
5
  import { useUiToolsLocale } from "#ui-tools/i18n";
4
6
  import { useDataListUi } from "../../composables/use-data-list-ui";
@@ -24,6 +26,9 @@ const loading = computed(
24
26
  );
25
27
  const error = computed(() => rows.value.length ? null : internals.queryContent.error.value);
26
28
  const empty = computed(() => !loading.value && !error.value && rows.value.length === 0);
29
+ const hasActiveQuery = computed(
30
+ () => internals.filters.hasActiveSearch.value || internals.filters.hasActiveUiFilters.value
31
+ );
27
32
  const refreshing = computed(
28
33
  () => rows.value.length > 0 && (internals.queryContent.status.value.isRefreshing || internals.queryContent.status.value.isRevalidating)
29
34
  );
@@ -42,6 +47,10 @@ const shellClass = computed(
42
47
  function refresh() {
43
48
  void internals.queryContent.refreshData()();
44
49
  }
50
+ function clearQuery() {
51
+ internals.filters.searchQuery.value = "";
52
+ internals.filters.clearAllFilters();
53
+ }
45
54
  watch(
46
55
  () => internals.controls.tableLayout.value,
47
56
  () => {
@@ -87,31 +96,61 @@ watch(
87
96
  )
88
97
  "
89
98
  >
90
- <div :class="mergeDataListUiClass('grid max-w-sm gap-3', rootUi?.errorBody, ui?.errorBody)">
91
- <div
99
+ <div
100
+ :class="
101
+ mergeDataListUiClass(
102
+ 'flex max-w-md items-start gap-3 text-left',
103
+ rootUi?.errorBody,
104
+ ui?.errorBody
105
+ )
106
+ "
107
+ >
108
+ <span
92
109
  :class="
110
+ mergeDataListUiClass(
111
+ 'grid size-9 shrink-0 place-items-center rounded-md bg-error/10 text-error',
112
+ rootUi?.errorIcon,
113
+ ui?.errorIcon
114
+ )
115
+ "
116
+ >
117
+ <UIcon name="i-lucide-cloud-alert" class="size-4" />
118
+ </span>
119
+ <div :class="mergeDataListUiClass('min-w-0 flex-1', rootUi?.errorCopy, ui?.errorCopy)">
120
+ <div
121
+ :class="
93
122
  mergeDataListUiClass(
94
123
  'font-medium text-highlighted',
95
124
  rootUi?.errorTitle,
96
125
  ui?.errorTitle
97
126
  )
98
127
  "
99
- >
100
- {{ t("table.states.gridError.title") }}
101
- </div>
102
- <button
103
- type="button"
104
- :class="
128
+ >
129
+ {{ t("table.states.gridError.title") }}
130
+ </div>
131
+ <p
132
+ :class="
105
133
  mergeDataListUiClass(
106
- 'mx-auto rounded-md border border-default px-3 py-1.5 text-sm text-default hover:bg-elevated',
107
- rootUi?.retry,
108
- ui?.retry
134
+ 'mt-0.5 text-sm leading-5 text-muted',
135
+ rootUi?.errorDescription,
136
+ ui?.errorDescription
109
137
  )
110
138
  "
111
- @click="refresh"
112
- >
113
- {{ t("table.states.gridError.action") }}
114
- </button>
139
+ >
140
+ {{ t("table.states.gridError.description") }}
141
+ </p>
142
+ <UButton
143
+ color="neutral"
144
+ variant="soft"
145
+ size="sm"
146
+ icon="i-lucide-refresh-cw"
147
+ class="mt-3"
148
+ :ui="{ base: mergeDataListUiClass(rootUi?.retry, ui?.retry) }"
149
+ @click="refresh"
150
+ >
151
+ {{ t("table.states.gridError.action") }}
152
+ </UButton>
153
+ </div>
115
154
  </div>
116
155
  </div>
117
156
  </slot>
@@ -120,6 +159,8 @@ watch(
120
159
  name="empty"
121
160
  :layout="internals.controls.tableLayout.value"
122
161
  :refresh="refresh"
162
+ :has-active-query="hasActiveQuery"
163
+ :clear-query="clearQuery"
123
164
  />
124
165
  <slot
125
166
  v-else
@@ -140,7 +181,13 @@ watch(
140
181
  <DataListTable>
141
182
  <template #empty>
142
183
  <slot name="empty-table">
143
- <slot name="empty" :layout="'table'" :refresh="refresh" />
184
+ <slot
185
+ name="empty"
186
+ :layout="'table'"
187
+ :refresh="refresh"
188
+ :has-active-query="hasActiveQuery"
189
+ :clear-query="clearQuery"
190
+ />
144
191
  </slot>
145
192
  </template>
146
193
  </DataListTable>
@@ -149,7 +196,13 @@ watch(
149
196
  <DataListGrid>
150
197
  <template #empty>
151
198
  <slot name="empty-grid">
152
- <slot name="empty" :layout="'grid'" :refresh="refresh" />
199
+ <slot
200
+ name="empty"
201
+ :layout="'grid'"
202
+ :refresh="refresh"
203
+ :has-active-query="hasActiveQuery"
204
+ :clear-query="clearQuery"
205
+ />
153
206
  </slot>
154
207
  </template>
155
208
  </DataListGrid>
@@ -6,31 +6,38 @@ type __VLS_Props = {
6
6
  ui?: DataListContentUi;
7
7
  };
8
8
  declare function refresh(): void;
9
+ declare function clearQuery(): void;
9
10
  declare var __VLS_1: {}, __VLS_4: "loading" | "initial-loading", __VLS_5: {
10
11
  layout: "table" | "grid";
11
12
  }, __VLS_7: {
12
13
  error: {};
13
14
  retry: typeof refresh;
14
- }, __VLS_9: {
15
+ }, __VLS_22: {
15
16
  layout: "table" | "grid";
16
17
  refresh: typeof refresh;
17
- }, __VLS_11: {
18
+ hasActiveQuery: boolean;
19
+ clearQuery: typeof clearQuery;
20
+ }, __VLS_24: {
18
21
  layout: "table" | "grid";
19
22
  rows: object[];
20
23
  loading: boolean;
21
24
  empty: boolean;
22
25
  error: unknown;
23
- }, __VLS_19: {
26
+ }, __VLS_32: {
24
27
  rows: object[];
25
- }, __VLS_28: {}, __VLS_30: {
28
+ }, __VLS_41: {}, __VLS_43: {
26
29
  layout: string;
27
30
  refresh: typeof refresh;
28
- }, __VLS_32: {
31
+ hasActiveQuery: boolean;
32
+ clearQuery: typeof clearQuery;
33
+ }, __VLS_45: {
29
34
  rows: object[];
30
- }, __VLS_41: {}, __VLS_43: {
35
+ }, __VLS_54: {}, __VLS_56: {
31
36
  layout: string;
32
37
  refresh: typeof refresh;
33
- }, __VLS_45: {}, __VLS_47: {};
38
+ hasActiveQuery: boolean;
39
+ clearQuery: typeof clearQuery;
40
+ }, __VLS_58: {}, __VLS_60: {};
34
41
  type __VLS_Slots = {} & {
35
42
  [K in NonNullable<typeof __VLS_4>]?: (props: typeof __VLS_5) => any;
36
43
  } & {
@@ -38,25 +45,25 @@ type __VLS_Slots = {} & {
38
45
  } & {
39
46
  error?: (props: typeof __VLS_7) => any;
40
47
  } & {
41
- empty?: (props: typeof __VLS_9) => any;
48
+ empty?: (props: typeof __VLS_22) => any;
42
49
  } & {
43
- content?: (props: typeof __VLS_11) => any;
50
+ content?: (props: typeof __VLS_24) => any;
44
51
  } & {
45
- table?: (props: typeof __VLS_19) => any;
52
+ table?: (props: typeof __VLS_32) => any;
46
53
  } & {
47
- 'empty-table'?: (props: typeof __VLS_28) => any;
54
+ 'empty-table'?: (props: typeof __VLS_41) => any;
48
55
  } & {
49
- empty?: (props: typeof __VLS_30) => any;
56
+ empty?: (props: typeof __VLS_43) => any;
50
57
  } & {
51
- grid?: (props: typeof __VLS_32) => any;
58
+ grid?: (props: typeof __VLS_45) => any;
52
59
  } & {
53
- 'empty-grid'?: (props: typeof __VLS_41) => any;
60
+ 'empty-grid'?: (props: typeof __VLS_54) => any;
54
61
  } & {
55
- empty?: (props: typeof __VLS_43) => any;
62
+ empty?: (props: typeof __VLS_56) => any;
56
63
  } & {
57
- refreshing?: (props: typeof __VLS_45) => any;
64
+ refreshing?: (props: typeof __VLS_58) => any;
58
65
  } & {
59
- after?: (props: typeof __VLS_47) => any;
66
+ after?: (props: typeof __VLS_60) => any;
60
67
  };
61
68
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
62
69
  transition: boolean;
@@ -15,6 +15,8 @@ declare var __VLS_1: {}, __VLS_13: {}, __VLS_42: {
15
15
  }, __VLS_51: {
16
16
  layout: string;
17
17
  refresh: () => void;
18
+ hasActiveQuery: boolean;
19
+ clearQuery: () => void;
18
20
  }, __VLS_54: {}, __VLS_57: {}, __VLS_60: {}, __VLS_70: {
19
21
  loadedCount: number;
20
22
  }, __VLS_73: {
@@ -15,6 +15,8 @@ declare var __VLS_1: {}, __VLS_13: {}, __VLS_42: {
15
15
  }, __VLS_51: {
16
16
  layout: string;
17
17
  refresh: () => void;
18
+ hasActiveQuery: boolean;
19
+ clearQuery: () => void;
18
20
  }, __VLS_54: {}, __VLS_57: {}, __VLS_60: {}, __VLS_70: {
19
21
  loadedCount: number;
20
22
  }, __VLS_73: {
@@ -14,6 +14,8 @@ declare var __VLS_1: {
14
14
  close: () => void;
15
15
  toggle: () => void;
16
16
  openState: boolean;
17
+ stage: "editor" | "match-mode" | "picker";
18
+ definition: import("../../types/index.js").TableUiFilterDefinition | undefined;
17
19
  triggerProps: {
18
20
  type: string;
19
21
  'aria-expanded': boolean;
@@ -14,6 +14,8 @@ declare var __VLS_1: {
14
14
  close: () => void;
15
15
  toggle: () => void;
16
16
  openState: boolean;
17
+ stage: "editor" | "match-mode" | "picker";
18
+ definition: import("../../types/index.js").TableUiFilterDefinition | undefined;
17
19
  triggerProps: {
18
20
  type: string;
19
21
  'aria-expanded': boolean;
@@ -17,7 +17,7 @@ declare var __VLS_1: {
17
17
  }, __VLS_14: {
18
18
  loadMore: () => 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>;
19
19
  state: {
20
- mode: "none" | "offset" | "cursor";
20
+ mode: "offset" | "cursor" | "none";
21
21
  pageIndex: number;
22
22
  pageSize: number;
23
23
  pageCount: number;
@@ -17,7 +17,7 @@ declare var __VLS_1: {
17
17
  }, __VLS_14: {
18
18
  loadMore: () => 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>;
19
19
  state: {
20
- mode: "none" | "offset" | "cursor";
20
+ mode: "offset" | "cursor" | "none";
21
21
  pageIndex: number;
22
22
  pageSize: number;
23
23
  pageCount: number;
@@ -1,6 +1,7 @@
1
1
  <script setup>
2
2
  import UButton from "@nuxt/ui/components/Button.vue";
3
3
  import UFieldGroup from "@nuxt/ui/components/FieldGroup.vue";
4
+ import UTooltip from "@nuxt/ui/components/Tooltip.vue";
4
5
  import { computed } from "vue";
5
6
  import { useUiToolsLocale } from "#ui-tools/i18n";
6
7
  import { useDataListUi } from "../../composables/use-data-list-ui";
@@ -37,24 +38,29 @@ function setLayout(layout) {
37
38
  :size="resolvedSize"
38
39
  :class="resolvedUi.root"
39
40
  >
40
- <UButton
41
+ <UTooltip
41
42
  v-for="layout in order"
42
43
  :key="layout"
43
- color="neutral"
44
- :variant="internals.controls.tableLayout.value === layout ? 'subtle' : 'outline'"
45
- :size="resolvedSize"
46
- :icon="layout === 'table' ? 'i-lucide-table-properties' : 'i-lucide-layout-grid'"
47
- :label="labels ? layout === 'table' ? 'Table' : 'Grid' : void 0"
48
- :aria-label="layout === 'table' ? t('table.header.tableView') : t('table.header.gridView')"
49
- :title="layout === 'table' ? t('table.header.tableView') : t('table.header.gridView')"
50
- :ui="{
44
+ :text="layout === 'table' ? t('table.header.tableView') : t('table.header.gridView')"
45
+ >
46
+ <UButton
47
+ color="neutral"
48
+ :variant="internals.controls.tableLayout.value === layout ? 'subtle' : 'outline'"
49
+ :size="resolvedSize"
50
+ :icon="layout === 'table' ? 'i-lucide-table-properties' : 'i-lucide-layout-grid'"
51
+ :label="labels ? layout === 'table' ? 'Table' : 'Grid' : void 0"
52
+ :aria-label="
53
+ layout === 'table' ? t('table.header.tableView') : t('table.header.gridView')
54
+ "
55
+ :ui="{
51
56
  base: resolvedUi.trigger,
52
57
  label: resolvedUi.triggerLabel,
53
58
  leadingIcon: resolvedUi.triggerLeadingIcon,
54
59
  trailingIcon: resolvedUi.triggerTrailingIcon
55
60
  }"
56
- @click="setLayout(layout)"
57
- />
61
+ @click="setLayout(layout)"
62
+ />
63
+ </UTooltip>
58
64
  </UFieldGroup>
59
65
  </slot>
60
66
  </template>
@@ -5,7 +5,7 @@ type __VLS_Props = {
5
5
  };
6
6
  declare var __VLS_1: {
7
7
  state: {
8
- mode: "none" | "offset" | "cursor";
8
+ mode: "offset" | "cursor" | "none";
9
9
  pageIndex: number;
10
10
  pageSize: number;
11
11
  pageCount: number;
@@ -5,7 +5,7 @@ type __VLS_Props = {
5
5
  };
6
6
  declare var __VLS_1: {
7
7
  state: {
8
- mode: "none" | "offset" | "cursor";
8
+ mode: "offset" | "cursor" | "none";
9
9
  pageIndex: number;
10
10
  pageSize: number;
11
11
  pageCount: number;
@@ -4,6 +4,7 @@ import { computed, onBeforeUnmount, onMounted } from "vue";
4
4
  import { provideUiToolsLocale, useUiToolsLocaleRef } from "#ui-tools/i18n";
5
5
  import { provideDataListUi } from "../../composables/use-data-list-ui";
6
6
  import { provideTableInternals } from "../../composables/use-table-internals";
7
+ import { mergeDataListUiConfig } from "../../utils";
7
8
  const props = defineProps({
8
9
  table: { type: Object, required: true },
9
10
  locale: { type: Object, required: false },
@@ -15,7 +16,7 @@ provideTableInternals(props.table.__internals);
15
16
  provideUiToolsLocale(useUiToolsLocaleRef(computed(() => props.locale)));
16
17
  provideDataListUi(
17
18
  computed(
18
- () => mergeDataListUi(resolveAppDataListUi(appConfig), props.ui, props.density)
19
+ () => mergeDataListUiConfig(resolveAppDataListUi(appConfig), props.ui, props.density)
19
20
  )
20
21
  );
21
22
  onMounted(() => props.table.__internals.startup.scheduleStart());
@@ -29,51 +30,6 @@ function resolveAppDataListUi(config) {
29
30
  function isDataListUiConfig(value) {
30
31
  return Boolean(value) && typeof value === "object";
31
32
  }
32
- function mergeDataListUi(appUi, componentUi, density) {
33
- return {
34
- ...appUi,
35
- ...componentUi,
36
- density: density ?? componentUi?.density ?? appUi?.density,
37
- control: { ...appUi?.control, ...componentUi?.control },
38
- default: mergeUiConfig(appUi?.default, componentUi?.default),
39
- search: mergeSearchConfig(appUi?.search, componentUi?.search),
40
- filterTags: mergePartConfig(appUi?.filterTags, componentUi?.filterTags),
41
- addFilter: mergePartConfig(appUi?.addFilter, componentUi?.addFilter),
42
- filterPanel: mergePartConfig(appUi?.filterPanel, componentUi?.filterPanel),
43
- clearFilters: mergePartConfig(appUi?.clearFilters, componentUi?.clearFilters),
44
- resultCount: mergeUiConfig(appUi?.resultCount, componentUi?.resultCount),
45
- columnPanel: mergePartConfig(appUi?.columnPanel, componentUi?.columnPanel),
46
- sortMenu: mergePartConfig(appUi?.sortMenu, componentUi?.sortMenu),
47
- layoutSwitch: mergePartConfig(appUi?.layoutSwitch, componentUi?.layoutSwitch),
48
- refresh: mergePartConfig(appUi?.refresh, componentUi?.refresh),
49
- content: mergeUiConfig(appUi?.content, componentUi?.content),
50
- table: mergeUiConfig(appUi?.table, componentUi?.table),
51
- grid: mergeUiConfig(appUi?.grid, componentUi?.grid),
52
- pagination: mergePartConfig(appUi?.pagination, componentUi?.pagination),
53
- infiniteLoader: mergePartConfig(appUi?.infiniteLoader, componentUi?.infiniteLoader)
54
- };
55
- }
56
- function mergeUiConfig(appDefaults, componentConfig) {
57
- return {
58
- ...appDefaults,
59
- ...componentConfig,
60
- ui: { ...appDefaults?.ui, ...componentConfig?.ui }
61
- };
62
- }
63
- function mergePartConfig(appDefaults, componentConfig) {
64
- return {
65
- ...appDefaults,
66
- ...componentConfig,
67
- ui: { ...appDefaults?.ui, ...componentConfig?.ui }
68
- };
69
- }
70
- function mergeSearchConfig(appDefaults, componentConfig) {
71
- return {
72
- ...appDefaults,
73
- ...componentConfig,
74
- ui: { ...appDefaults?.ui, ...componentConfig?.ui }
75
- };
76
- }
77
33
  </script>
78
34
 
79
35
  <template>
@@ -8,7 +8,7 @@ declare var __VLS_8: {
8
8
  label: string | null;
9
9
  sorting: {
10
10
  key: string | undefined;
11
- dir: "desc" | "asc" | undefined;
11
+ dir: "asc" | "desc" | undefined;
12
12
  active: boolean;
13
13
  };
14
14
  setSorting: (sorting: {
@@ -33,6 +33,10 @@ const sortLabels = computed(() => {
33
33
  return labels;
34
34
  });
35
35
  const activeKey = computed(() => internals.tableColumns.sortingState.value.key);
36
+ const activeDirection = computed(() => internals.tableColumns.sortingState.value.dir);
37
+ const directionIcon = computed(
38
+ () => activeDirection.value === "asc" ? "i-lucide-arrow-up-narrow-wide" : "i-lucide-arrow-down-wide-narrow"
39
+ );
36
40
  const sortKeys = computed(() => [
37
41
  .../* @__PURE__ */ new Set([
38
42
  ...internals.tableColumns.sortKeys.value,
@@ -68,6 +72,7 @@ function humanize(value) {
68
72
 
69
73
  <template>
70
74
  <UDropdownMenu
75
+ :size="resolvedSize"
71
76
  :items="items"
72
77
  :content="{ align: 'end', sideOffset: 8 }"
73
78
  :ui="{
@@ -91,6 +96,7 @@ function humanize(value) {
91
96
  variant="outline"
92
97
  :size="resolvedSize"
93
98
  :label="`${label ?? t('table.controls.sort')}${activeLabel ? `: ${activeLabel}` : ''}`"
99
+ :icon="directionIcon"
94
100
  trailing-icon="i-lucide-chevron-down"
95
101
  :ui="{
96
102
  base: resolvedUi.trigger,
@@ -8,7 +8,7 @@ declare var __VLS_8: {
8
8
  label: string | null;
9
9
  sorting: {
10
10
  key: string | undefined;
11
- dir: "desc" | "asc" | undefined;
11
+ dir: "asc" | "desc" | undefined;
12
12
  active: boolean;
13
13
  };
14
14
  setSorting: (sorting: {
@@ -1,6 +1,7 @@
1
1
  import type { DataListAddFilterUi, DataListControlSize, TableUiFilterDefinition } from '../../../types/index.js';
2
2
  type __VLS_Props = {
3
3
  definitions: TableUiFilterDefinition[];
4
+ sessionDefinition?: TableUiFilterDefinition;
4
5
  getLabel: (definition: TableUiFilterDefinition) => string;
5
6
  size?: DataListControlSize;
6
7
  ui?: DataListAddFilterUi;
@@ -13,6 +14,8 @@ declare var __VLS_10: {
13
14
  close: typeof close;
14
15
  toggle: typeof toggle;
15
16
  openState: boolean;
17
+ stage: "editor" | "match-mode" | "picker";
18
+ definition: TableUiFilterDefinition | undefined;
16
19
  triggerProps: {
17
20
  type: string;
18
21
  'aria-expanded': boolean;
@@ -23,8 +26,10 @@ type __VLS_Slots = {} & {
23
26
  };
24
27
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
25
28
  select: (key: string) => any;
29
+ release: (key: string) => any;
26
30
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
27
31
  onSelect?: ((key: string) => any) | undefined;
32
+ onRelease?: ((key: string) => any) | undefined;
28
33
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
29
34
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
30
35
  declare const _default: typeof __VLS_export;