nuxt-ui-tools 1.1.0 → 1.3.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 (213) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +10 -1
  3. package/dist/runtime/dashboard/components/block/dashboard-block-state.d.vue.ts +2 -0
  4. package/dist/runtime/dashboard/components/block/dashboard-block-state.vue +4 -1
  5. package/dist/runtime/dashboard/components/block/dashboard-block-state.vue.d.ts +2 -0
  6. package/dist/runtime/dashboard/components/block/dashboard-chips.d.vue.ts +20 -0
  7. package/dist/runtime/dashboard/components/block/dashboard-chips.vue +42 -0
  8. package/dist/runtime/dashboard/components/block/dashboard-chips.vue.d.ts +20 -0
  9. package/dist/runtime/dashboard/components/block/dashboard-series-picker.d.vue.ts +8 -0
  10. package/dist/runtime/dashboard/components/block/dashboard-series-picker.vue +29 -0
  11. package/dist/runtime/dashboard/components/block/dashboard-series-picker.vue.d.ts +8 -0
  12. package/dist/runtime/dashboard/components/block/dashboard-skeleton.d.vue.ts +1 -1
  13. package/dist/runtime/dashboard/components/block/dashboard-skeleton.vue +6 -3
  14. package/dist/runtime/dashboard/components/block/dashboard-skeleton.vue.d.ts +1 -1
  15. package/dist/runtime/dashboard/components/block/dashboard-view-scope.d.vue.ts +21 -0
  16. package/dist/runtime/dashboard/components/block/dashboard-view-scope.vue +12 -0
  17. package/dist/runtime/dashboard/components/block/dashboard-view-scope.vue.d.ts +21 -0
  18. package/dist/runtime/dashboard/components/dashboard-alerts.vue +3 -3
  19. package/dist/runtime/dashboard/components/dashboard-bar-chart.d.vue.ts +14 -3
  20. package/dist/runtime/dashboard/components/dashboard-bar-chart.vue +30 -9
  21. package/dist/runtime/dashboard/components/dashboard-bar-chart.vue.d.ts +14 -3
  22. package/dist/runtime/dashboard/components/dashboard-bars.vue +4 -4
  23. package/dist/runtime/dashboard/components/dashboard-card.vue +28 -6
  24. package/dist/runtime/dashboard/components/dashboard-combo-chart.d.vue.ts +6 -1
  25. package/dist/runtime/dashboard/components/dashboard-combo-chart.vue +13 -3
  26. package/dist/runtime/dashboard/components/dashboard-combo-chart.vue.d.ts +6 -1
  27. package/dist/runtime/dashboard/components/dashboard-donut-chart.vue +5 -5
  28. package/dist/runtime/dashboard/components/dashboard-feed.vue +8 -7
  29. package/dist/runtime/dashboard/components/dashboard-filter.d.vue.ts +67 -0
  30. package/dist/runtime/dashboard/components/dashboard-filter.vue +134 -0
  31. package/dist/runtime/dashboard/components/dashboard-filter.vue.d.ts +67 -0
  32. package/dist/runtime/dashboard/components/dashboard-filters.d.vue.ts +49 -0
  33. package/dist/runtime/dashboard/components/dashboard-filters.vue +96 -0
  34. package/dist/runtime/dashboard/components/dashboard-filters.vue.d.ts +49 -0
  35. package/dist/runtime/dashboard/components/dashboard-funnel.vue +5 -5
  36. package/dist/runtime/dashboard/components/dashboard-gauge.vue +3 -3
  37. package/dist/runtime/dashboard/components/dashboard-grid.d.vue.ts +10 -3
  38. package/dist/runtime/dashboard/components/dashboard-grid.vue +24 -9
  39. package/dist/runtime/dashboard/components/dashboard-grid.vue.d.ts +10 -3
  40. package/dist/runtime/dashboard/components/dashboard-line-chart.d.vue.ts +14 -3
  41. package/dist/runtime/dashboard/components/dashboard-line-chart.vue +30 -9
  42. package/dist/runtime/dashboard/components/dashboard-line-chart.vue.d.ts +14 -3
  43. package/dist/runtime/dashboard/components/dashboard-list.d.vue.ts +3 -0
  44. package/dist/runtime/dashboard/components/dashboard-list.vue +18 -6
  45. package/dist/runtime/dashboard/components/dashboard-list.vue.d.ts +3 -0
  46. package/dist/runtime/dashboard/components/dashboard-page.d.vue.ts +53 -0
  47. package/dist/runtime/dashboard/components/dashboard-page.vue +156 -0
  48. package/dist/runtime/dashboard/components/dashboard-page.vue.d.ts +53 -0
  49. package/dist/runtime/dashboard/components/dashboard-paired-bars.vue +4 -4
  50. package/dist/runtime/dashboard/components/dashboard-refresh.d.vue.ts +1 -1
  51. package/dist/runtime/dashboard/components/dashboard-refresh.vue +1 -0
  52. package/dist/runtime/dashboard/components/dashboard-refresh.vue.d.ts +1 -1
  53. package/dist/runtime/dashboard/components/dashboard-stack-bar.vue +4 -4
  54. package/dist/runtime/dashboard/components/dashboard-stat.d.vue.ts +14 -2
  55. package/dist/runtime/dashboard/components/dashboard-stat.vue +28 -10
  56. package/dist/runtime/dashboard/components/dashboard-stat.vue.d.ts +14 -2
  57. package/dist/runtime/dashboard/components/dashboard-stats.vue +3 -3
  58. package/dist/runtime/dashboard/components/dashboard-table.d.vue.ts +1 -1
  59. package/dist/runtime/dashboard/components/dashboard-table.vue +3 -3
  60. package/dist/runtime/dashboard/components/dashboard-table.vue.d.ts +1 -1
  61. package/dist/runtime/dashboard/components/dashboard-tabs.d.vue.ts +1 -1
  62. package/dist/runtime/dashboard/components/dashboard-tabs.vue.d.ts +1 -1
  63. package/dist/runtime/dashboard/components/dashboard-total.d.vue.ts +7 -2
  64. package/dist/runtime/dashboard/components/dashboard-total.vue +10 -2
  65. package/dist/runtime/dashboard/components/dashboard-total.vue.d.ts +7 -2
  66. package/dist/runtime/dashboard/components/dashboard-view-tabs.d.vue.ts +33 -0
  67. package/dist/runtime/dashboard/components/dashboard-view-tabs.vue +66 -0
  68. package/dist/runtime/dashboard/components/dashboard-view-tabs.vue.d.ts +33 -0
  69. package/dist/runtime/dashboard/components/dashboard-widget.vue +1 -1
  70. package/dist/runtime/dashboard/components/filter/dashboard-filter-menu.d.vue.ts +44 -0
  71. package/dist/runtime/dashboard/components/filter/dashboard-filter-menu.vue +220 -0
  72. package/dist/runtime/dashboard/components/filter/dashboard-filter-menu.vue.d.ts +44 -0
  73. package/dist/runtime/dashboard/composables/use-dashboard-api.d.ts +6 -1
  74. package/dist/runtime/dashboard/composables/use-dashboard-api.js +29 -6
  75. package/dist/runtime/dashboard/composables/use-dashboard-block.d.ts +5 -4
  76. package/dist/runtime/dashboard/composables/use-dashboard-block.js +32 -15
  77. package/dist/runtime/dashboard/composables/use-dashboard-chart.d.ts +8 -1
  78. package/dist/runtime/dashboard/composables/use-dashboard-chart.js +16 -4
  79. package/dist/runtime/dashboard/composables/use-dashboard-context.d.ts +50 -0
  80. package/dist/runtime/dashboard/composables/use-dashboard-context.js +56 -0
  81. package/dist/runtime/dashboard/composables/use-dashboard-derived.js +6 -1
  82. package/dist/runtime/dashboard/composables/use-dashboard-filter-control.d.ts +16 -0
  83. package/dist/runtime/dashboard/composables/use-dashboard-filter-control.js +161 -0
  84. package/dist/runtime/dashboard/composables/use-dashboard-filter-scope.d.ts +37 -0
  85. package/dist/runtime/dashboard/composables/use-dashboard-filter-scope.js +107 -0
  86. package/dist/runtime/dashboard/composables/use-dashboard-format.d.ts +46 -6
  87. package/dist/runtime/dashboard/composables/use-dashboard-format.js +51 -8
  88. package/dist/runtime/dashboard/composables/use-dashboard-options.d.ts +11 -4
  89. package/dist/runtime/dashboard/composables/use-dashboard-options.js +33 -47
  90. package/dist/runtime/dashboard/composables/use-dashboard-remote-options.d.ts +8 -5
  91. package/dist/runtime/dashboard/composables/use-dashboard-remote-options.js +66 -77
  92. package/dist/runtime/dashboard/composables/use-dashboard-resource.d.ts +15 -4
  93. package/dist/runtime/dashboard/composables/use-dashboard-resource.js +52 -17
  94. package/dist/runtime/dashboard/composables/use-dashboard-scope.d.ts +10 -7
  95. package/dist/runtime/dashboard/composables/use-dashboard-scope.js +26 -16
  96. package/dist/runtime/dashboard/composables/use-dashboard-series-picker.d.ts +20 -0
  97. package/dist/runtime/dashboard/composables/use-dashboard-series-picker.js +30 -0
  98. package/dist/runtime/dashboard/composables/use-dashboard-time.d.ts +2 -0
  99. package/dist/runtime/dashboard/composables/use-dashboard-time.js +4 -1
  100. package/dist/runtime/dashboard/composables/use-dashboard-ui.d.ts +12 -2
  101. package/dist/runtime/dashboard/composables/use-dashboard-ui.js +3 -0
  102. package/dist/runtime/dashboard/composables/use-dashboard-views.d.ts +15 -3
  103. package/dist/runtime/dashboard/composables/use-dashboard-views.js +33 -10
  104. package/dist/runtime/dashboard/composables/use-dashboard.d.ts +18 -12
  105. package/dist/runtime/dashboard/composables/use-dashboard.js +98 -9
  106. package/dist/runtime/dashboard/index.d.ts +3 -1
  107. package/dist/runtime/dashboard/index.js +3 -1
  108. package/dist/runtime/dashboard/schema/index.d.ts +62 -30
  109. package/dist/runtime/dashboard/schema/index.js +3 -0
  110. package/dist/runtime/dashboard/types/blocks.d.ts +30 -4
  111. package/dist/runtime/dashboard/types/charts.d.ts +2 -2
  112. package/dist/runtime/dashboard/types/controls.d.ts +123 -0
  113. package/dist/runtime/dashboard/types/filters.d.ts +236 -0
  114. package/dist/runtime/dashboard/types/index.d.ts +3 -2
  115. package/dist/runtime/dashboard/types/page.d.ts +17 -0
  116. package/dist/runtime/dashboard/types/page.js +0 -0
  117. package/dist/runtime/dashboard/types/resource.d.ts +66 -28
  118. package/dist/runtime/dashboard/types/runtime.d.ts +39 -8
  119. package/dist/runtime/dashboard/types/schema.d.ts +94 -54
  120. package/dist/runtime/dashboard/types/ui.d.ts +78 -0
  121. package/dist/runtime/dashboard/utils/builders/dashboard-filters.d.ts +142 -0
  122. package/dist/runtime/dashboard/utils/builders/dashboard-filters.js +135 -0
  123. package/dist/runtime/dashboard/utils/charts.d.ts +4 -15
  124. package/dist/runtime/dashboard/utils/charts.js +26 -28
  125. package/dist/runtime/dashboard/utils/{params/codecs.d.ts → codecs.d.ts} +2 -2
  126. package/dist/runtime/dashboard/utils/{params/codecs.js → codecs.js} +1 -1
  127. package/dist/runtime/dashboard/utils/environment.d.ts +36 -0
  128. package/dist/runtime/dashboard/utils/environment.js +30 -0
  129. package/dist/runtime/dashboard/utils/filters.d.ts +44 -0
  130. package/dist/runtime/dashboard/utils/filters.js +62 -0
  131. package/dist/runtime/dashboard/utils/format.d.ts +25 -0
  132. package/dist/runtime/dashboard/utils/format.js +66 -0
  133. package/dist/runtime/dashboard/utils/grid.d.ts +17 -0
  134. package/dist/runtime/dashboard/utils/grid.js +14 -0
  135. package/dist/runtime/dashboard/utils/options.d.ts +3 -8
  136. package/dist/runtime/dashboard/utils/options.js +6 -5
  137. package/dist/runtime/dashboard/utils/remote.d.ts +7 -0
  138. package/dist/runtime/dashboard/utils/remote.js +14 -0
  139. package/dist/runtime/dashboard/utils/resource.d.ts +16 -7
  140. package/dist/runtime/dashboard/utils/resource.js +15 -9
  141. package/dist/runtime/dashboard/utils/schema.d.ts +8 -3
  142. package/dist/runtime/dashboard/utils/schema.js +9 -4
  143. package/dist/runtime/dashboard/utils/state.d.ts +11 -6
  144. package/dist/runtime/dashboard/utils/state.js +10 -5
  145. package/dist/runtime/dashboard/utils/time.d.ts +2 -0
  146. package/dist/runtime/dashboard/utils/time.js +11 -1
  147. package/dist/runtime/dashboard/utils/ui.d.ts +1 -1
  148. package/dist/runtime/dashboard/utils/ui.js +1 -1
  149. package/dist/runtime/form/components/root/form.vue +1 -1
  150. package/dist/runtime/form/fields/card-selection.d.ts +1 -0
  151. package/dist/runtime/form/fields/card-selection.js +1 -0
  152. package/dist/runtime/form/fields/checkbox-card/component.vue +3 -1
  153. package/dist/runtime/form/fields/checkbox-group/component.vue +5 -0
  154. package/dist/runtime/form/fields/radio/component.vue +10 -0
  155. package/dist/runtime/form/fields/radio-card/component.vue +3 -1
  156. package/dist/runtime/form/types/options.d.ts +1 -11
  157. package/dist/runtime/form/utils/focus.js +1 -1
  158. package/dist/runtime/i18n/locales/en.js +32 -1
  159. package/dist/runtime/i18n/locales/fr.js +32 -1
  160. package/dist/runtime/i18n/types.d.ts +44 -0
  161. package/dist/runtime/shared/styles/scrollbars.css +1 -1
  162. package/dist/runtime/shared/styles/tokens.css +1 -1
  163. package/dist/runtime/shared/types/query.d.ts +8 -0
  164. package/dist/runtime/shared/utils/remote-options.d.ts +10 -0
  165. package/dist/runtime/shared/utils/remote-options.js +6 -0
  166. package/dist/runtime/table/components/filters/shared/filter-option-list-end.d.vue.ts +11 -0
  167. package/dist/runtime/table/components/filters/shared/filter-option-list-end.vue +76 -0
  168. package/dist/runtime/table/components/filters/shared/filter-option-list-end.vue.d.ts +11 -0
  169. package/dist/runtime/table/components/filters/shared/filter-option-loading-list.d.vue.ts +3 -0
  170. package/dist/runtime/table/components/filters/shared/filter-option-loading-list.vue +2 -1
  171. package/dist/runtime/table/components/filters/shared/filter-option-loading-list.vue.d.ts +3 -0
  172. package/dist/runtime/table/components/filters/shared/filter-option-multiple-list.vue +1 -1
  173. package/dist/runtime/table/components/filters/shared/filter-option-picker-content.vue +13 -0
  174. package/dist/runtime/table/components/filters/shared/filter-option-single-list.d.vue.ts +2 -0
  175. package/dist/runtime/table/components/filters/shared/filter-option-single-list.vue +1 -1
  176. package/dist/runtime/table/components/filters/shared/filter-option-single-list.vue.d.ts +2 -0
  177. package/dist/runtime/table/components/filters/shared/filter-option-tree-content.d.vue.ts +3 -0
  178. package/dist/runtime/table/components/filters/shared/filter-option-tree-content.vue +2 -2
  179. package/dist/runtime/table/components/filters/shared/filter-option-tree-content.vue.d.ts +3 -0
  180. package/dist/runtime/table/components/filters/shared/filter-searchable-panel.vue +1 -0
  181. package/dist/runtime/table/composables/use-option-filter-editor-state.d.ts +13 -1
  182. package/dist/runtime/table/composables/use-option-filter-editor-state.js +6 -2
  183. package/dist/runtime/table/composables/use-table-filter-options.d.ts +11 -1
  184. package/dist/runtime/table/composables/use-table-filter-options.js +128 -17
  185. package/dist/runtime/table/composables/use-table-filter-selected-options.d.ts +20 -0
  186. package/dist/runtime/table/composables/use-table-filter-selected-options.js +99 -0
  187. package/dist/runtime/table/composables/use-table-filters.d.ts +5 -0
  188. package/dist/runtime/table/composables/use-table-filters.js +20 -1
  189. package/dist/runtime/table/composables/use-table-internals.d.ts +15 -0
  190. package/dist/runtime/table/composables/use-table-remote-filter-options.d.ts +42 -0
  191. package/dist/runtime/table/composables/use-table-remote-filter-options.js +102 -0
  192. package/dist/runtime/table/types/filters.d.ts +42 -0
  193. package/dist/runtime/table/types/index.d.ts +1 -0
  194. package/dist/runtime/table/types/remote-options.d.ts +64 -0
  195. package/dist/runtime/table/types/remote-options.js +0 -0
  196. package/dist/runtime/table/types/source.d.ts +15 -1
  197. package/dist/runtime/table/utils/builders/table-source.d.ts +2 -6
  198. package/dist/runtime/table/utils/filters/options.d.ts +2 -0
  199. package/dist/runtime/table/utils/filters/options.js +1 -1
  200. package/dist/runtime/table/utils/index.d.ts +1 -0
  201. package/dist/runtime/table/utils/index.js +1 -0
  202. package/dist/runtime/table/utils/prefetch.js +21 -1
  203. package/dist/runtime/table/utils/remote-table-options.d.ts +26 -0
  204. package/dist/runtime/table/utils/remote-table-options.js +88 -0
  205. package/package.json +4 -1
  206. package/dist/runtime/dashboard/composables/use-dashboard-param-scope.d.ts +0 -30
  207. package/dist/runtime/dashboard/composables/use-dashboard-param-scope.js +0 -71
  208. package/dist/runtime/dashboard/types/options.d.ts +0 -46
  209. package/dist/runtime/dashboard/types/params.d.ts +0 -115
  210. package/dist/runtime/dashboard/utils/builders/dashboard-params.d.ts +0 -85
  211. package/dist/runtime/dashboard/utils/builders/dashboard-params.js +0 -87
  212. /package/dist/runtime/dashboard/types/{options.js → controls.js} +0 -0
  213. /package/dist/runtime/dashboard/types/{params.js → filters.js} +0 -0
@@ -5,6 +5,7 @@ export type * from './data-list';
5
5
  export type * from './filters';
6
6
  export type * from './layout';
7
7
  export type * from './query-state';
8
+ export type * from './remote-options';
8
9
  export type * from './schema';
9
10
  export type * from './source';
10
11
  export type * from './state';
@@ -0,0 +1,64 @@
1
+ import type { QueryKey } from '@tanstack/vue-query';
2
+ import type { QueryFnDefinition } from '../../shared/types/query.js';
3
+ import type { RemoteOptionsPageRequest, RemoteOptionsPagination, RemoteOptionsResult, RemoteOptionsSearch } from '../../shared/types/remote-options.js';
4
+ import type { TableResolvedFilterGroup } from './filters.js';
5
+ import type { TableCursorPageResult, TableOffsetPageResult, TableRemoteSourceRequest, TableSourceExecutionResult, TableSourceQueryResult, TableSourceRow } from './source.js';
6
+ import type { GenericObject, TableKnownFieldPath, TableSortingRule, TableSortKey } from './utils.js';
7
+ /** Response of an endpoint speaking the table request protocol. */
8
+ export type RemoteTableResult<TRow extends GenericObject> = TableOffsetPageResult<TRow, string> | TableCursorPageResult<TRow, string> | TableSourceExecutionResult<TRow, string>;
9
+ /** Option built from one row: a value and a label, plus any extra option fields. */
10
+ export interface RemoteTableOption {
11
+ value: string | number;
12
+ label: string;
13
+ }
14
+ /** A TanStack query definition: its key, and a `queryFn` or the options that carry one. */
15
+ export interface RemoteTableQueryDefinition {
16
+ queryKey: QueryKey;
17
+ }
18
+ /**
19
+ * Query definition of one table request, typically the endpoint a remote table already uses:
20
+ * `(request) => $api.accounts.query.queryOptions({ body: request })`. The row type is read from
21
+ * its result, as `tableSource` does.
22
+ */
23
+ export type RemoteTableQuery<TQuery extends RemoteTableQueryDefinition = RemoteTableQueryDefinition> = (request: TableRemoteSourceRequest) => TQuery;
24
+ /** Row type of the table response a `RemoteTableQuery` resolves to. */
25
+ export type RemoteTableQueryRow<TQuery> = TableSourceRow<TableSourceQueryResult<TQuery>>;
26
+ export interface RemoteTableOptionsConfig<TRow extends GenericObject, TOption extends RemoteTableOption> {
27
+ /** Option of one row. A method, so the typed callback fits the builder's erased signature. */
28
+ option(row: TRow): TOption;
29
+ /**
30
+ * Fields the search term looks in, or those fields with the debounce (default 250 ms) and
31
+ * minimum term length (default 0).
32
+ */
33
+ search?: readonly TableKnownFieldPath<TRow>[] | ({
34
+ fields: readonly TableKnownFieldPath<TRow>[];
35
+ } & RemoteOptionsSearch);
36
+ /** Order of the options: a field, ascending, or explicit sorting rules. */
37
+ sort?: TableSortKey<TRow> | readonly TableSortingRule<TableSortKey<TRow>>[];
38
+ /**
39
+ * Field holding the option value, matched with `isAnyOf` to resolve the labels of selected
40
+ * values the loaded pages do not contain. Defaults to `'id'`.
41
+ */
42
+ valueKey?: TableKnownFieldPath<TRow> | 'id';
43
+ /** Filters applied to every request, e.g. active accounts only. */
44
+ filters?: readonly TableResolvedFilterGroup<TableKnownFieldPath<TRow> | string>[];
45
+ /** Page type and size. Must match what the endpoint pages by. Defaults to cursor pages of 25. */
46
+ pagination?: RemoteOptionsPagination;
47
+ }
48
+ /**
49
+ * Remote option source built by `remoteTableOptions()`. It fits dashboard `p.remote()`, table
50
+ * option filters (`source.remote`), and form remote options (`source: options.load`).
51
+ */
52
+ export interface RemoteTableOptions<TOption> {
53
+ /** Query definition of one page of options for a search term. */
54
+ load: (request: {
55
+ search: string;
56
+ page: RemoteOptionsPageRequest;
57
+ }) => QueryFnDefinition<RemoteOptionsResult<TOption>>;
58
+ /** Query definition of the options of selected values. */
59
+ resolveSelected: (request: {
60
+ values: readonly (string | number | boolean)[];
61
+ }) => QueryFnDefinition<readonly TOption[]>;
62
+ pagination: RemoteOptionsPagination;
63
+ search?: RemoteOptionsSearch;
64
+ }
File without changes
@@ -1,9 +1,18 @@
1
- import type { InfiniteData, QueryFunction, QueryKey } from '@tanstack/vue-query';
1
+ import type { InfiniteData, QueryFunction, QueryKey, UseQueryOptions } from '@tanstack/vue-query';
2
2
  import type { QueryDefinition } from '../../shared/types/query.js';
3
3
  import type { TableResolvedFilterGroup } from './filters.js';
4
4
  import type { GenericObject, TableKnownFieldPath, TablePaginationState, TableSortKey, TableSortingRule, TableRowsFromSourceResult } from './utils.js';
5
5
  /** Table name of the shared `QueryDefinition`, kept for public type compatibility. */
6
6
  export type TableQueryDefinition<TData = unknown> = QueryDefinition<TData>;
7
+ /**
8
+ * Result of a query definition: what its `queryFn` resolves to, or the data type of TanStack
9
+ * options whose `queryFn` may be a ref or `skipToken` (Tuyau's `queryOptions()`).
10
+ */
11
+ export type TableSourceQueryResult<TQuery> = TQuery extends {
12
+ queryFn: (...args: never[]) => infer TResult;
13
+ } ? Awaited<TResult> : TQuery extends UseQueryOptions<infer _TQueryFnData, infer _TError, infer TResult, infer _TQueryData, infer _TQueryKey> ? Awaited<TResult> : never;
14
+ /** Row of a table query result: an array of rows, or a page (`{ rows }`). */
15
+ export type TableSourceRow<TResult> = TableRowsFromSourceResult<Awaited<TResult>> extends infer TRow ? TRow extends GenericObject ? TRow : GenericObject : GenericObject;
7
16
  export interface TableInfiniteQueryDefinition<TData = unknown> {
8
17
  queryKey: QueryKey;
9
18
  queryFn: QueryFunction<TData, QueryKey, string | null>;
@@ -62,6 +71,11 @@ export interface TableFacetRequestDescriptor<TKey extends string = string> {
62
71
  search?: string;
63
72
  limit?: number;
64
73
  cursor?: string | null;
74
+ /**
75
+ * Values to count, and only these. Filters loading options page by page (`source.remote`) send
76
+ * the values of one loaded page, since no single request can know every value.
77
+ */
78
+ values?: readonly (string | number | boolean)[];
65
79
  }
66
80
  export interface TableFacetOptionResult<TValue = unknown> {
67
81
  value: TValue;
@@ -1,6 +1,5 @@
1
- import type { QueryKey, UseQueryOptions } from '@tanstack/vue-query';
2
- import type { GenericObject, TableClientSource, TableCursorPageResult, TableGlobalFacetDescriptor, TableOffsetPageResult, TablePaginationState, TableRemoteSource, TableRemoteSourceRequest, TableResolvedFilterGroup, TableRowsFromSourceResult, TableSourceExecutionResult, TableSortingRule } from '../../types/index.js';
3
- type TableSourceRow<TResult> = TableRowsFromSourceResult<Awaited<TResult>> extends infer TRow ? TRow extends GenericObject ? TRow : GenericObject : GenericObject;
1
+ import type { QueryKey } from '@tanstack/vue-query';
2
+ import type { GenericObject, TableClientSource, TableCursorPageResult, TableGlobalFacetDescriptor, TableOffsetPageResult, TablePaginationState, TableRemoteSource, TableRemoteSourceRequest, TableResolvedFilterGroup, TableSourceExecutionResult, TableSourceQueryResult, TableSourceRow, TableSortingRule } from '../../types/index.js';
4
3
  type ClientTableSourceResult<TResult> = TResult extends readonly GenericObject[] ? TableSourceRow<TResult>[] : TableSourceExecutionResult<TableSourceRow<TResult>>;
5
4
  type RemoteTableSourceResult<TResult> = TResult extends {
6
5
  pageInfo: {
@@ -25,9 +24,6 @@ interface TableSourceInferenceContext {
25
24
  interface TableSourceQueryDefinition {
26
25
  queryKey: QueryKey;
27
26
  }
28
- type TableSourceQueryResult<TQuery> = TQuery extends {
29
- queryFn: (...args: never[]) => infer TResult;
30
- } ? Awaited<TResult> : TQuery extends UseQueryOptions<infer _TQueryFnData, infer _TError, infer TResult, infer _TQueryData, infer _TQueryKey> ? Awaited<TResult> : never;
31
27
  interface ClientTableSourceInput<TQuery extends TableSourceQueryDefinition> {
32
28
  mode?: 'client';
33
29
  query: (context: TableSourceInferenceContext) => TQuery;
@@ -10,6 +10,8 @@ export declare function resolveFilterOptionEntries(options: {
10
10
  count: number;
11
11
  }[];
12
12
  missingCountFallback?: number;
13
+ /** `options` is the complete answer (remote pages): an empty list stays empty instead of listing facet values. */
14
+ authoritative?: boolean;
13
15
  }): TableResolvedFilterOptionEntry<import("../../types/index.js").TableFilterPrimitiveValue>[] | {
14
16
  children: never[];
15
17
  count: number | undefined;
@@ -21,7 +21,7 @@ export function resolveFilterOptionEntries(options) {
21
21
  return [];
22
22
  }
23
23
  const configuredOptions = options.options ?? options.definition.source?.options ?? [];
24
- const sourceOptions = configuredOptions.length ? configuredOptions : (options.facetCounts ?? []).map((entry) => ({
24
+ const sourceOptions = configuredOptions.length || options.authoritative ? configuredOptions : (options.facetCounts ?? []).map((entry) => ({
25
25
  count: entry.count,
26
26
  label: String(entry.value),
27
27
  value: entry.value
@@ -8,6 +8,7 @@ export * from './filters/index.js';
8
8
  export * from './pagination.js';
9
9
  export * from './prefetch.js';
10
10
  export * from './query-state.js';
11
+ export * from './remote-table-options.js';
11
12
  export * from './resolved-filters.js';
12
13
  export * from './rows.js';
13
14
  export * from './schema.js';
@@ -8,6 +8,7 @@ export * from "./filters/index.js";
8
8
  export * from "./pagination.js";
9
9
  export * from "./prefetch.js";
10
10
  export * from "./query-state.js";
11
+ export * from "./remote-table-options.js";
11
12
  export * from "./resolved-filters.js";
12
13
  export * from "./rows.js";
13
14
  export * from "./schema.js";
@@ -40,7 +40,11 @@ export function prefetchTable(params) {
40
40
  route: params.route,
41
41
  schema
42
42
  });
43
- return resolveTableQueries({ request, schema });
43
+ return resolveTableQueries({
44
+ request,
45
+ rules: resolveFilterState(params.route, schema).ui,
46
+ schema
47
+ });
44
48
  }).stage((stageContext) => {
45
49
  const rows = resolvePrefetchedRows(stageContext.source);
46
50
  const context = resolveContextData(schema, stageContext);
@@ -93,6 +97,13 @@ function resolveTableQueries(options) {
93
97
  ]);
94
98
  }
95
99
  for (const definition of definitions) {
100
+ const selectedOptions = resolveRemoteSelectedQuery(definition, options.rules);
101
+ if (selectedOptions) {
102
+ entries.push([
103
+ `filter-selected-options:${definition.key}`,
104
+ withQueryDefaults(selectedOptions, QUERY_DEFAULTS.staleTime.filterOptions)
105
+ ]);
106
+ }
96
107
  if (definition.kind === "option" && isOptionQueryResolver(definition.source?.query)) {
97
108
  entries.push([
98
109
  `filter-options:${definition.key}`,
@@ -130,6 +141,15 @@ function resolveTableQueries(options) {
130
141
  }
131
142
  return Object.fromEntries(entries);
132
143
  }
144
+ function resolveRemoteSelectedQuery(definition, rules) {
145
+ const resolve = definition.kind === "option" ? definition.source?.remote?.resolveSelected : void 0;
146
+ if (!resolve) return;
147
+ const rule = rules.find((entry) => entry.key === definition.key);
148
+ const values = (Array.isArray(rule?.value) ? rule.value : isNullish(rule?.value) ? [] : [rule.value]).filter(
149
+ (value) => isString(value) || isNumber(value) || isBoolean(value)
150
+ );
151
+ return values.length ? resolve({ values }) : void 0;
152
+ }
133
153
  function resolveSourcePrefetchQuery(options) {
134
154
  const definition = options.schema.source.mode === "remote" ? options.schema.source.query(
135
155
  toTableRemoteSourceRequest(options.request),
@@ -0,0 +1,26 @@
1
+ import type { RemoteTableOption, RemoteTableOptions, RemoteTableOptionsConfig, RemoteTableQuery, RemoteTableQueryDefinition, RemoteTableQueryRow } from '../types/index.js';
2
+ /**
3
+ * Turns an endpoint that speaks the table request protocol into a remote option source: searchable,
4
+ * paged, with labels of selected values resolved by an `isAnyOf` filter on `valueKey`. Use it for
5
+ * dashboard filters (`p.remote(...)`), table option filters (`source.remote`), and form remote
6
+ * options (`source: options.load`).
7
+ *
8
+ * Each page is its own query, keyed after the endpoint's key, so pages are cached and shared by
9
+ * every picker using the same source.
10
+ *
11
+ * The query comes first: the row type is read from its result, so `option` and `search` are typed
12
+ * whatever order the options are written in.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const accounts = remoteTableOptions(
17
+ * (request) => $api.accounts.query.queryOptions({ body: request }),
18
+ * {
19
+ * search: ['name'],
20
+ * sort: 'name',
21
+ * option: (account) => ({ label: account.name, value: account.id }),
22
+ * },
23
+ * )
24
+ * ```
25
+ */
26
+ export declare function remoteTableOptions<TQuery extends RemoteTableQueryDefinition, const TOption extends RemoteTableOption>(query: RemoteTableQuery<TQuery>, config: RemoteTableOptionsConfig<RemoteTableQueryRow<TQuery>, TOption>): RemoteTableOptions<TOption>;
@@ -0,0 +1,88 @@
1
+ import { isArray, isFunction, isObject } from "../../shared/utils/predicate.js";
2
+ const DEFAULT_PAGINATION = { size: 25, type: "cursor" };
3
+ export function remoteTableOptions(query, config) {
4
+ const pagination = config.pagination ?? DEFAULT_PAGINATION;
5
+ const { fields, search } = resolveSearch(config.search);
6
+ const sorting = resolveSorting(config.sort);
7
+ function request(params) {
8
+ const { page } = params;
9
+ return {
10
+ filters: [...config.filters ?? [], ...params.filters ?? []],
11
+ pagination: pagination.type === "cursor" ? { count: "none", cursor: page.cursor, mode: "cursor", pageSize: page.size } : { count: "exact", mode: "offset", pageIndex: page.index - 1, pageSize: page.size },
12
+ search: { fields: [...fields], value: params.search },
13
+ sorting: params.filters ? [] : [...sorting]
14
+ };
15
+ }
16
+ return {
17
+ load: ({ page, search: term }) => mapQuery(query(request({ page, search: term })), (result) => ({
18
+ ...resolvePage(result),
19
+ options: result.rows.map(config.option)
20
+ })),
21
+ pagination,
22
+ resolveSelected: ({ values }) => mapQuery(
23
+ query(
24
+ request({
25
+ filters: [
26
+ {
27
+ children: [
28
+ {
29
+ key: config.valueKey ?? "id",
30
+ operator: "isAnyOf",
31
+ type: "condition",
32
+ value: [...values]
33
+ }
34
+ ],
35
+ combinator: "and",
36
+ type: "group"
37
+ }
38
+ ],
39
+ page: { cursor: null, index: 1, size: Math.max(1, values.length) },
40
+ search: ""
41
+ })
42
+ ),
43
+ (result) => result.rows.map(config.option)
44
+ ),
45
+ search
46
+ };
47
+ }
48
+ function mapQuery(definition, map) {
49
+ const { queryKey } = definition;
50
+ const queryFn = "queryFn" in definition ? definition.queryFn : void 0;
51
+ return {
52
+ async queryFn(context) {
53
+ if (!isQueryFn(queryFn))
54
+ throw new Error("[remoteTableOptions] `query` must return a query with a queryFn.");
55
+ const result = await queryFn({ ...context, queryKey });
56
+ if (!isTableResult(result))
57
+ throw new Error("[remoteTableOptions] the query must resolve to a table response (`rows`).");
58
+ return map(result);
59
+ },
60
+ queryKey: [...queryKey, "remote-options"]
61
+ };
62
+ }
63
+ function isQueryFn(value) {
64
+ return isFunction(value);
65
+ }
66
+ function isTableResult(value) {
67
+ return isObject(value) && isArray(value.rows);
68
+ }
69
+ function resolvePage(result) {
70
+ if (!("pageInfo" in result)) return { hasMore: false };
71
+ return result.pageInfo.mode === "cursor" ? { nextCursor: result.pageInfo.nextCursor } : { hasMore: result.pageInfo.hasNextPage };
72
+ }
73
+ function resolveSearch(search) {
74
+ if (!search) return { fields: [], search: void 0 };
75
+ if (isFieldList(search)) return { fields: search, search: void 0 };
76
+ const { fields, ...options } = search;
77
+ return { fields, search: options };
78
+ }
79
+ function isFieldList(value) {
80
+ return Array.isArray(value);
81
+ }
82
+ function resolveSorting(sort) {
83
+ if (sort === void 0) return [];
84
+ return isSortingRules(sort) ? sort : [{ dir: "asc", key: sort }];
85
+ }
86
+ function isSortingRules(sort) {
87
+ return Array.isArray(sort);
88
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-ui-tools",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "description": "Nuxt module and runtime toolkit for UI-heavy Nuxt applications",
5
5
  "homepage": "https://github.com/ChronicStone/nuxt-ui-tools#readme",
6
6
  "bugs": "https://github.com/ChronicStone/nuxt-ui-tools/issues",
@@ -182,18 +182,21 @@
182
182
  "@nuxt/module-builder": "^1.0.3",
183
183
  "@nuxt/schema": "^4.5.2",
184
184
  "@nuxt/ui": "^4.10.0",
185
+ "@tailwindcss/vite": "4.3.3",
185
186
  "@tiptap/y-tiptap": "3.0.9",
186
187
  "@types/node": "25.4.0",
187
188
  "@unovis/ts": "1.7.0",
188
189
  "@unovis/vue": "1.7.0",
189
190
  "@vitejs/plugin-vue": "^6.0.8",
190
191
  "@vitejs/plugin-vue-jsx": "^5.1.6",
192
+ "@vitest/browser-playwright": "4.1.11",
191
193
  "@vue/test-utils": "2.5.1",
192
194
  "changelogen": "^0.6.2",
193
195
  "happy-dom": "20.14.5",
194
196
  "nuxt": "^4.5.2",
195
197
  "oxfmt": "0.64.0",
196
198
  "oxlint": "^1.82.0",
199
+ "playwright": "1.63.0",
197
200
  "typescript": "~5.9.3",
198
201
  "ultracite": "7.12.0",
199
202
  "vitest": "^4.1.11",
@@ -1,30 +0,0 @@
1
- import type { QueryKey } from '@tanstack/vue-query';
2
- import type { DashboardOptionsHandle, DashboardParamMap } from '../types/index.js';
3
- /**
4
- * What one param scope exposes. Declared rather than inferred: the inferred type would carry Vue's
5
- * `Raw<…>` marker, which declaration files cannot name.
6
- */
7
- export interface DashboardParamScope {
8
- keys: readonly string[];
9
- /** Option handles of option-backed params, by param key. */
10
- options: Readonly<Record<string, DashboardOptionsHandle>>;
11
- /** URL segments of this scope's params, before the scope prefix. */
12
- urlKeys: readonly string[];
13
- /** Writable facade: one getter / setter per param. */
14
- values: object;
15
- }
16
- /**
17
- * Owns the params of one scope (dashboard root, a view, or a query's widget params): exactly one
18
- * `useQueryStates` instance, a writable values facade, and the option handles of option-backed
19
- * params. Scopes without params allocate nothing.
20
- */
21
- export declare function useDashboardParamScope(params: {
22
- definitions: DashboardParamMap;
23
- prefix: string;
24
- queryKey: QueryKey;
25
- }): DashboardParamScope;
26
- /**
27
- * Exposes several scopes' values through one object, e.g. shared params plus a view's own params
28
- * inside the view's query factories. Reads and writes go straight to the owning scope.
29
- */
30
- export declare function mergeDashboardParamValues(scopes: readonly DashboardParamScope[]): object;
@@ -1,71 +0,0 @@
1
- import { markRaw } from "vue";
2
- import { useQueryStates } from "../../query-state/index.js";
3
- import { hasProperty } from "../../shared/utils/predicate.js";
4
- import { useDashboardOptions } from "./use-dashboard-options.js";
5
- const emptyFacade = markRaw({});
6
- const noUrlKeys = [];
7
- export function useDashboardParamScope(params) {
8
- const entries = Object.entries(params.definitions).flatMap(
9
- ([key, definition]) => isRuntimeParam(definition) ? [[key, definition]] : []
10
- );
11
- if (entries.length === 0)
12
- return { keys: [], options: emptyFacade, urlKeys: noUrlKeys, values: emptyFacade };
13
- const schema = {};
14
- for (const [key, definition] of entries) {
15
- schema[key] = {
16
- codec: definition.codec,
17
- defaultValue: definition.defaultValue,
18
- historyMode: definition.historyMode,
19
- omitDefault: definition.omitDefault,
20
- urlKey: definition.urlKey
21
- };
22
- }
23
- const state = useQueryStates({ historyMode: "replace", prefix: params.prefix, schema });
24
- function read(key) {
25
- const current = state.value;
26
- return current[key];
27
- }
28
- function write(key, value) {
29
- state.value = { ...state.value, [key]: value ?? params.definitions[key]?.defaultValue };
30
- }
31
- const values = {};
32
- for (const [key] of entries) {
33
- Object.defineProperty(values, key, {
34
- enumerable: true,
35
- get: () => read(key),
36
- set: (value) => write(key, value)
37
- });
38
- }
39
- const options = {};
40
- for (const [key, definition] of entries) {
41
- if (!definition.items && !definition.remote) continue;
42
- options[key] = useDashboardOptions({
43
- definition,
44
- queryKey: [...params.queryKey, key],
45
- value: () => read(key)
46
- });
47
- }
48
- return {
49
- keys: entries.map(([key]) => key),
50
- options: markRaw(options),
51
- /** URL segments of this scope's params, before the scope prefix. */
52
- urlKeys: entries.map(([key, definition]) => definition.urlKey ?? key),
53
- values: markRaw(values)
54
- };
55
- }
56
- export function mergeDashboardParamValues(scopes) {
57
- const merged = {};
58
- for (const scope of scopes) {
59
- for (const key of scope.keys) {
60
- Object.defineProperty(merged, key, {
61
- enumerable: true,
62
- get: () => Reflect.get(scope.values, key),
63
- set: (value) => Reflect.set(scope.values, key, value)
64
- });
65
- }
66
- }
67
- return markRaw(merged);
68
- }
69
- function isRuntimeParam(definition) {
70
- return hasProperty(definition, "codec");
71
- }
@@ -1,46 +0,0 @@
1
- import type { DashboardOption, DashboardOptionParamKeys, DashboardOptionValue } from './params.js';
2
- /**
3
- * Props ready to spread onto a Nuxt UI `USelectMenu`:
4
- * `<USelectMenu v-model="dashboard.params.account" v-bind="dashboard.options.account.menu" />`.
5
- */
6
- export interface DashboardOptionsMenuBindings<TValue extends DashboardOptionValue = DashboardOptionValue> {
7
- items: DashboardOption<TValue>[];
8
- valueKey: 'value';
9
- labelKey: 'label';
10
- loading?: boolean;
11
- searchTerm?: string;
12
- ignoreFilter?: boolean;
13
- 'onUpdate:searchTerm'?: (value: string) => void;
14
- 'onUpdate:open'?: (value: boolean) => void;
15
- }
16
- /**
17
- * Option state of an option-backed param (`p.enum`, `p.options`, `p.remote`).
18
- *
19
- * Remote handles load nothing until `open` becomes `true` (or `search` is set), then page through
20
- * the source; selected values restored from the URL are hydrated through `resolveSelected`.
21
- */
22
- export interface DashboardOptionsHandle<TValue extends DashboardOptionValue = DashboardOptionValue> {
23
- /** Loaded options merged with the hydrated selected options. */
24
- readonly items: readonly DashboardOption<TValue>[];
25
- /** Options matching the current param value, in value order. */
26
- readonly selected: readonly DashboardOption<TValue>[];
27
- readonly loading: boolean;
28
- readonly loadingMore: boolean;
29
- readonly hasMore: boolean;
30
- readonly error: unknown;
31
- /** Search term. Writable; remote sources debounce it before loading. */
32
- search: string;
33
- /** Picker open state. Writable; opening a remote picker starts loading its first page. */
34
- open: boolean;
35
- loadMore(): void;
36
- refresh(): Promise<void>;
37
- readonly menu: DashboardOptionsMenuBindings<TValue>;
38
- }
39
- /** Option value type of a param: its value, or its element type for `multiple` params. */
40
- type DashboardParamOptionValue<TParam> = TParam extends {
41
- readonly defaultValue: infer TValue;
42
- } ? Extract<NonNullable<TValue> extends readonly (infer TItem)[] ? TItem : NonNullable<TValue>, DashboardOptionValue> : never;
43
- export type DashboardOptionsHandles<TParams> = {
44
- readonly [K in DashboardOptionParamKeys<TParams>]: DashboardOptionsHandle<DashboardParamOptionValue<TParams[K]>>;
45
- };
46
- export {};
@@ -1,115 +0,0 @@
1
- import type { QueryKey } from '@tanstack/vue-query';
2
- import type { HistoryMode, QueryCodec, StaticQueryStateOptions } from '../../query-state/index.js';
3
- import type { RemoteOptionsPageRequest, RemoteOptionsPagination, RemoteOptionsResult, RemoteOptionsSearch } from '../../shared/types/remote-options.js';
4
- import type { dashboardParamBuilder } from '../utils/builders/dashboard-params.js';
5
- export type DashboardParamKind = 'string' | 'number' | 'boolean' | 'date' | 'dateRange' | 'enum' | 'options' | 'remote' | 'comparison' | 'custom';
6
- /**
7
- * Period a dashboard compares against: the one right before the current range (`previous`), the
8
- * same dates a year earlier (`year`), or no comparison (`none`).
9
- */
10
- export type DashboardComparison = 'previous' | 'year' | 'none';
11
- /** Primitive value an option-backed param can hold. */
12
- export type DashboardOptionValue = string | number;
13
- /**
14
- * Option item shape. It matches Nuxt UI `USelect` / `USelectMenu` items, so option handles can be
15
- * bound to those components directly.
16
- */
17
- export interface DashboardOption<TValue extends DashboardOptionValue = DashboardOptionValue> {
18
- value: TValue;
19
- label: string;
20
- description?: string;
21
- icon?: string;
22
- avatar?: {
23
- src?: string;
24
- alt?: string;
25
- text?: string;
26
- };
27
- disabled?: boolean;
28
- }
29
- export interface DashboardDateRange {
30
- start: Date;
31
- end: Date;
32
- }
33
- /** Options shared by every `p.*` param builder. */
34
- export interface DashboardParamOptions<TDefault> {
35
- /**
36
- * Value used when the URL key is absent or cannot be parsed.
37
- * A non-`undefined` default narrows the param type: `p.string()` is `string | undefined`,
38
- * `p.string({ defaultValue: '' })` is `string`. Values equal to the default never reach the URL.
39
- */
40
- defaultValue?: TDefault;
41
- /** Override the URL segment. Defaults to the param name inside its scope prefix. */
42
- urlKey?: string;
43
- /** Remove the key from the URL when the value equals the default. Defaults to `true`. */
44
- omitDefault?: boolean;
45
- /** Router history mode for writes to this param. Params default to `'replace'`. */
46
- historyMode?: HistoryMode;
47
- }
48
- /** Request received by a remote option source. */
49
- export interface DashboardRemoteOptionsRequest {
50
- /** Current debounced search term. Empty when the menu lists unfiltered options. */
51
- search: string;
52
- /** Requested page. */
53
- page: RemoteOptionsPageRequest;
54
- }
55
- /**
56
- * Remote option source, following the same contract as the form engine's remote options:
57
- * server-side search, page or cursor pagination, and hydration of selected values that the loaded
58
- * pages do not contain (for example ids restored from the URL).
59
- */
60
- export interface DashboardRemoteOptionsConfig {
61
- /** Loads one page of options for the current search term. */
62
- load: (request: DashboardRemoteOptionsRequest) => Promise<RemoteOptionsResult<DashboardOption<string>>>;
63
- /** Resolves labels for selected values missing from the loaded pages. */
64
- resolveSelected?: (request: {
65
- values: readonly string[];
66
- }) => Promise<readonly DashboardOption<string>[]>;
67
- /** Defaults to `{ type: 'page', size: 25 }`. */
68
- pagination?: RemoteOptionsPagination;
69
- search?: RemoteOptionsSearch;
70
- /** Cache identity of the option source. Defaults to a key derived from the param location. */
71
- queryKey?: QueryKey;
72
- }
73
- /** Runtime view of a param definition, with its value type erased. */
74
- export interface DashboardRuntimeParam extends DashboardParamLike {
75
- /** Erased codec, in the shape `useQueryStates` accepts for heterogeneous schemas. */
76
- readonly codec: StaticQueryStateOptions['codec'];
77
- readonly urlKey?: string;
78
- readonly omitDefault?: boolean;
79
- readonly historyMode?: HistoryMode;
80
- /** Static option items for `p.enum` and `p.options`. */
81
- readonly items?: readonly DashboardOption[];
82
- /** Remote option source for `p.remote`. */
83
- readonly remote?: DashboardRemoteOptionsConfig;
84
- }
85
- /**
86
- * Param definition produced by the `p.*` builders. `defaultValue` carries the resolved value type:
87
- * it includes `undefined` only when no default was declared.
88
- */
89
- export type DashboardParamDefinition<TValue> = Omit<DashboardRuntimeParam, 'codec' | 'defaultValue'> & {
90
- readonly codec: QueryCodec<TValue | undefined>;
91
- readonly defaultValue: TValue;
92
- };
93
- /** Structural constraint every param definition satisfies, whatever its value type. */
94
- export interface DashboardParamLike {
95
- readonly kind: DashboardParamKind;
96
- readonly multiple: boolean;
97
- readonly defaultValue: unknown;
98
- }
99
- export type DashboardParamMap = Record<string, DashboardParamLike>;
100
- /** Empty map used when a scope declares no params, queries, or derived values. */
101
- export type DashboardEmptyMap = Record<never, never>;
102
- /** Writable, URL-synced values of a param map. Every property is a `v-model` target. */
103
- export type DashboardParamValues<TParams> = {
104
- -readonly [K in keyof TParams]: TParams[K] extends {
105
- readonly defaultValue: infer TValue;
106
- } ? TValue : never;
107
- };
108
- /** Keys of params that carry option items (`p.enum`, `p.options`, `p.remote`, `p.comparison`). */
109
- export type DashboardOptionParamKeys<TParams> = {
110
- [K in keyof TParams]: TParams[K] extends {
111
- readonly kind: 'enum' | 'options' | 'remote' | 'comparison';
112
- } ? K : never;
113
- }[keyof TParams];
114
- /** The `p` builder handed to every `params` callback. */
115
- export type DashboardParamBuilder = typeof dashboardParamBuilder;