nuxt-ui-tools 1.2.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.
- package/dist/module.json +1 -1
- package/dist/module.mjs +10 -1
- package/dist/runtime/dashboard/components/block/dashboard-block-state.d.vue.ts +2 -0
- package/dist/runtime/dashboard/components/block/dashboard-block-state.vue +4 -1
- package/dist/runtime/dashboard/components/block/dashboard-block-state.vue.d.ts +2 -0
- package/dist/runtime/dashboard/components/block/dashboard-chips.d.vue.ts +20 -0
- package/dist/runtime/dashboard/components/block/dashboard-chips.vue +42 -0
- package/dist/runtime/dashboard/components/block/dashboard-chips.vue.d.ts +20 -0
- package/dist/runtime/dashboard/components/block/dashboard-series-picker.d.vue.ts +8 -0
- package/dist/runtime/dashboard/components/block/dashboard-series-picker.vue +29 -0
- package/dist/runtime/dashboard/components/block/dashboard-series-picker.vue.d.ts +8 -0
- package/dist/runtime/dashboard/components/block/dashboard-skeleton.d.vue.ts +1 -1
- package/dist/runtime/dashboard/components/block/dashboard-skeleton.vue.d.ts +1 -1
- package/dist/runtime/dashboard/components/block/dashboard-view-scope.d.vue.ts +21 -0
- package/dist/runtime/dashboard/components/block/dashboard-view-scope.vue +12 -0
- package/dist/runtime/dashboard/components/block/dashboard-view-scope.vue.d.ts +21 -0
- package/dist/runtime/dashboard/components/dashboard-alerts.vue +3 -3
- package/dist/runtime/dashboard/components/dashboard-bar-chart.d.vue.ts +14 -3
- package/dist/runtime/dashboard/components/dashboard-bar-chart.vue +30 -9
- package/dist/runtime/dashboard/components/dashboard-bar-chart.vue.d.ts +14 -3
- package/dist/runtime/dashboard/components/dashboard-bars.vue +4 -4
- package/dist/runtime/dashboard/components/dashboard-card.vue +28 -6
- package/dist/runtime/dashboard/components/dashboard-combo-chart.d.vue.ts +6 -1
- package/dist/runtime/dashboard/components/dashboard-combo-chart.vue +13 -3
- package/dist/runtime/dashboard/components/dashboard-combo-chart.vue.d.ts +6 -1
- package/dist/runtime/dashboard/components/dashboard-donut-chart.vue +5 -5
- package/dist/runtime/dashboard/components/dashboard-feed.vue +1 -1
- package/dist/runtime/dashboard/components/dashboard-filter.d.vue.ts +67 -0
- package/dist/runtime/dashboard/components/dashboard-filter.vue +134 -0
- package/dist/runtime/dashboard/components/dashboard-filter.vue.d.ts +67 -0
- package/dist/runtime/dashboard/components/dashboard-filters.d.vue.ts +49 -0
- package/dist/runtime/dashboard/components/dashboard-filters.vue +96 -0
- package/dist/runtime/dashboard/components/dashboard-filters.vue.d.ts +49 -0
- package/dist/runtime/dashboard/components/dashboard-funnel.vue +5 -5
- package/dist/runtime/dashboard/components/dashboard-gauge.vue +3 -3
- package/dist/runtime/dashboard/components/dashboard-grid.d.vue.ts +10 -3
- package/dist/runtime/dashboard/components/dashboard-grid.vue +24 -9
- package/dist/runtime/dashboard/components/dashboard-grid.vue.d.ts +10 -3
- package/dist/runtime/dashboard/components/dashboard-line-chart.d.vue.ts +14 -3
- package/dist/runtime/dashboard/components/dashboard-line-chart.vue +30 -9
- package/dist/runtime/dashboard/components/dashboard-line-chart.vue.d.ts +14 -3
- package/dist/runtime/dashboard/components/dashboard-list.d.vue.ts +3 -0
- package/dist/runtime/dashboard/components/dashboard-list.vue +18 -6
- package/dist/runtime/dashboard/components/dashboard-list.vue.d.ts +3 -0
- package/dist/runtime/dashboard/components/dashboard-page.d.vue.ts +53 -0
- package/dist/runtime/dashboard/components/dashboard-page.vue +156 -0
- package/dist/runtime/dashboard/components/dashboard-page.vue.d.ts +53 -0
- package/dist/runtime/dashboard/components/dashboard-paired-bars.vue +4 -4
- package/dist/runtime/dashboard/components/dashboard-refresh.d.vue.ts +1 -1
- package/dist/runtime/dashboard/components/dashboard-refresh.vue +1 -0
- package/dist/runtime/dashboard/components/dashboard-refresh.vue.d.ts +1 -1
- package/dist/runtime/dashboard/components/dashboard-stack-bar.vue +4 -4
- package/dist/runtime/dashboard/components/dashboard-stat.d.vue.ts +14 -2
- package/dist/runtime/dashboard/components/dashboard-stat.vue +28 -10
- package/dist/runtime/dashboard/components/dashboard-stat.vue.d.ts +14 -2
- package/dist/runtime/dashboard/components/dashboard-stats.vue +3 -3
- package/dist/runtime/dashboard/components/dashboard-table.d.vue.ts +1 -1
- package/dist/runtime/dashboard/components/dashboard-table.vue +3 -3
- package/dist/runtime/dashboard/components/dashboard-table.vue.d.ts +1 -1
- package/dist/runtime/dashboard/components/dashboard-tabs.d.vue.ts +1 -1
- package/dist/runtime/dashboard/components/dashboard-tabs.vue.d.ts +1 -1
- package/dist/runtime/dashboard/components/dashboard-total.d.vue.ts +7 -2
- package/dist/runtime/dashboard/components/dashboard-total.vue +10 -2
- package/dist/runtime/dashboard/components/dashboard-total.vue.d.ts +7 -2
- package/dist/runtime/dashboard/components/dashboard-view-tabs.d.vue.ts +33 -0
- package/dist/runtime/dashboard/components/dashboard-view-tabs.vue +66 -0
- package/dist/runtime/dashboard/components/dashboard-view-tabs.vue.d.ts +33 -0
- package/dist/runtime/dashboard/components/dashboard-widget.vue +1 -1
- package/dist/runtime/dashboard/components/filter/dashboard-filter-menu.d.vue.ts +44 -0
- package/dist/runtime/dashboard/components/filter/dashboard-filter-menu.vue +220 -0
- package/dist/runtime/dashboard/components/filter/dashboard-filter-menu.vue.d.ts +44 -0
- package/dist/runtime/dashboard/composables/use-dashboard-api.d.ts +6 -1
- package/dist/runtime/dashboard/composables/use-dashboard-api.js +29 -6
- package/dist/runtime/dashboard/composables/use-dashboard-block.d.ts +5 -4
- package/dist/runtime/dashboard/composables/use-dashboard-block.js +32 -15
- package/dist/runtime/dashboard/composables/use-dashboard-chart.d.ts +8 -1
- package/dist/runtime/dashboard/composables/use-dashboard-chart.js +16 -4
- package/dist/runtime/dashboard/composables/use-dashboard-context.d.ts +50 -0
- package/dist/runtime/dashboard/composables/use-dashboard-context.js +56 -0
- package/dist/runtime/dashboard/composables/use-dashboard-derived.js +6 -1
- package/dist/runtime/dashboard/composables/use-dashboard-filter-control.d.ts +16 -0
- package/dist/runtime/dashboard/composables/use-dashboard-filter-control.js +161 -0
- package/dist/runtime/dashboard/composables/use-dashboard-filter-scope.d.ts +37 -0
- package/dist/runtime/dashboard/composables/use-dashboard-filter-scope.js +107 -0
- package/dist/runtime/dashboard/composables/use-dashboard-format.d.ts +46 -6
- package/dist/runtime/dashboard/composables/use-dashboard-format.js +51 -8
- package/dist/runtime/dashboard/composables/use-dashboard-options.d.ts +11 -4
- package/dist/runtime/dashboard/composables/use-dashboard-options.js +33 -47
- package/dist/runtime/dashboard/composables/use-dashboard-remote-options.d.ts +8 -5
- package/dist/runtime/dashboard/composables/use-dashboard-remote-options.js +59 -70
- package/dist/runtime/dashboard/composables/use-dashboard-resource.d.ts +15 -4
- package/dist/runtime/dashboard/composables/use-dashboard-resource.js +52 -17
- package/dist/runtime/dashboard/composables/use-dashboard-scope.d.ts +10 -7
- package/dist/runtime/dashboard/composables/use-dashboard-scope.js +26 -16
- package/dist/runtime/dashboard/composables/use-dashboard-series-picker.d.ts +20 -0
- package/dist/runtime/dashboard/composables/use-dashboard-series-picker.js +30 -0
- package/dist/runtime/dashboard/composables/use-dashboard-time.d.ts +2 -0
- package/dist/runtime/dashboard/composables/use-dashboard-time.js +4 -1
- package/dist/runtime/dashboard/composables/use-dashboard-ui.d.ts +12 -2
- package/dist/runtime/dashboard/composables/use-dashboard-ui.js +3 -0
- package/dist/runtime/dashboard/composables/use-dashboard-views.d.ts +15 -3
- package/dist/runtime/dashboard/composables/use-dashboard-views.js +33 -10
- package/dist/runtime/dashboard/composables/use-dashboard.d.ts +18 -12
- package/dist/runtime/dashboard/composables/use-dashboard.js +98 -9
- package/dist/runtime/dashboard/index.d.ts +3 -1
- package/dist/runtime/dashboard/index.js +3 -1
- package/dist/runtime/dashboard/schema/index.d.ts +62 -30
- package/dist/runtime/dashboard/schema/index.js +3 -0
- package/dist/runtime/dashboard/types/blocks.d.ts +30 -4
- package/dist/runtime/dashboard/types/charts.d.ts +2 -2
- package/dist/runtime/dashboard/types/controls.d.ts +123 -0
- package/dist/runtime/dashboard/types/filters.d.ts +236 -0
- package/dist/runtime/dashboard/types/index.d.ts +3 -2
- package/dist/runtime/dashboard/types/page.d.ts +17 -0
- package/dist/runtime/dashboard/types/page.js +0 -0
- package/dist/runtime/dashboard/types/resource.d.ts +66 -28
- package/dist/runtime/dashboard/types/runtime.d.ts +39 -8
- package/dist/runtime/dashboard/types/schema.d.ts +94 -54
- package/dist/runtime/dashboard/types/ui.d.ts +78 -0
- package/dist/runtime/dashboard/utils/builders/dashboard-filters.d.ts +142 -0
- package/dist/runtime/dashboard/utils/builders/dashboard-filters.js +135 -0
- package/dist/runtime/dashboard/utils/charts.d.ts +4 -15
- package/dist/runtime/dashboard/utils/charts.js +26 -28
- package/dist/runtime/dashboard/utils/{params/codecs.d.ts → codecs.d.ts} +2 -2
- package/dist/runtime/dashboard/utils/{params/codecs.js → codecs.js} +1 -1
- package/dist/runtime/dashboard/utils/environment.d.ts +36 -0
- package/dist/runtime/dashboard/utils/environment.js +30 -0
- package/dist/runtime/dashboard/utils/filters.d.ts +44 -0
- package/dist/runtime/dashboard/utils/filters.js +62 -0
- package/dist/runtime/dashboard/utils/format.d.ts +25 -0
- package/dist/runtime/dashboard/utils/format.js +66 -0
- package/dist/runtime/dashboard/utils/grid.d.ts +17 -0
- package/dist/runtime/dashboard/utils/grid.js +14 -0
- package/dist/runtime/dashboard/utils/options.d.ts +3 -1
- package/dist/runtime/dashboard/utils/options.js +6 -0
- package/dist/runtime/dashboard/utils/remote.d.ts +7 -0
- package/dist/runtime/dashboard/utils/remote.js +14 -0
- package/dist/runtime/dashboard/utils/resource.d.ts +16 -7
- package/dist/runtime/dashboard/utils/resource.js +15 -9
- package/dist/runtime/dashboard/utils/schema.d.ts +8 -3
- package/dist/runtime/dashboard/utils/schema.js +9 -4
- package/dist/runtime/dashboard/utils/state.d.ts +11 -6
- package/dist/runtime/dashboard/utils/state.js +10 -5
- package/dist/runtime/dashboard/utils/time.d.ts +2 -0
- package/dist/runtime/dashboard/utils/time.js +11 -1
- package/dist/runtime/dashboard/utils/ui.d.ts +1 -1
- package/dist/runtime/dashboard/utils/ui.js +1 -1
- package/dist/runtime/form/components/root/form.vue +1 -1
- package/dist/runtime/form/fields/card-selection.d.ts +1 -0
- package/dist/runtime/form/fields/card-selection.js +1 -0
- package/dist/runtime/form/fields/checkbox-card/component.vue +3 -1
- package/dist/runtime/form/fields/checkbox-group/component.vue +5 -0
- package/dist/runtime/form/fields/radio/component.vue +10 -0
- package/dist/runtime/form/fields/radio-card/component.vue +3 -1
- package/dist/runtime/form/types/options.d.ts +1 -11
- package/dist/runtime/form/utils/focus.js +1 -1
- package/dist/runtime/i18n/locales/en.js +29 -0
- package/dist/runtime/i18n/locales/fr.js +29 -0
- package/dist/runtime/i18n/types.d.ts +41 -0
- package/dist/runtime/shared/styles/tokens.css +1 -1
- package/dist/runtime/shared/types/query.d.ts +8 -0
- package/dist/runtime/table/types/index.d.ts +1 -0
- package/dist/runtime/table/types/remote-options.d.ts +64 -0
- package/dist/runtime/table/types/remote-options.js +0 -0
- package/dist/runtime/table/types/source.d.ts +10 -1
- package/dist/runtime/table/utils/builders/table-source.d.ts +2 -6
- package/dist/runtime/table/utils/index.d.ts +1 -0
- package/dist/runtime/table/utils/index.js +1 -0
- package/dist/runtime/table/utils/remote-table-options.d.ts +26 -0
- package/dist/runtime/table/utils/remote-table-options.js +88 -0
- package/package.json +4 -1
- package/dist/runtime/dashboard/composables/use-dashboard-param-scope.d.ts +0 -30
- package/dist/runtime/dashboard/composables/use-dashboard-param-scope.js +0 -71
- package/dist/runtime/dashboard/types/options.d.ts +0 -46
- package/dist/runtime/dashboard/types/params.d.ts +0 -115
- package/dist/runtime/dashboard/utils/builders/dashboard-params.d.ts +0 -85
- package/dist/runtime/dashboard/utils/builders/dashboard-params.js +0 -87
- /package/dist/runtime/dashboard/types/{options.js → controls.js} +0 -0
- /package/dist/runtime/dashboard/types/{params.js → filters.js} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { QueryKey } from '@tanstack/vue-query';
|
|
2
|
-
import type {
|
|
3
|
-
import type { DashboardEmptyMap,
|
|
2
|
+
import type { DashboardFilterControls } from './controls.js';
|
|
3
|
+
import type { DashboardEmptyMap, DashboardFilterMap, DashboardFilterValues, DashboardFiltersInput } from './filters.js';
|
|
4
4
|
import type { DashboardKeyError } from './schema.js';
|
|
5
5
|
/**
|
|
6
6
|
* Fetch stage of a query.
|
|
@@ -11,7 +11,18 @@ import type { DashboardKeyError } from './schema.js';
|
|
|
11
11
|
* scroll into view).
|
|
12
12
|
*/
|
|
13
13
|
export type DashboardStage = 'essential' | 'background' | 'deferred';
|
|
14
|
-
|
|
14
|
+
/**
|
|
15
|
+
* - `idle`: not requested yet (a deferred query nobody activated, an unopened view).
|
|
16
|
+
* - `loading` / `ready` / `error`: the fetch lifecycle.
|
|
17
|
+
* - `disabled`: an `enabled` condition does not hold (its own, or its view's). The resource never
|
|
18
|
+
* fetches and holds its `defaultValue`; blocks bound to it render nothing.
|
|
19
|
+
*/
|
|
20
|
+
export type DashboardResourceState = 'idle' | 'loading' | 'ready' | 'error' | 'disabled';
|
|
21
|
+
/**
|
|
22
|
+
* Whether a view, query, or filter is part of the dashboard right now, read lazily and reactively:
|
|
23
|
+
* what the schema function knows (the audience), another filter, data.
|
|
24
|
+
*/
|
|
25
|
+
export type DashboardCondition = () => boolean;
|
|
15
26
|
/**
|
|
16
27
|
* Contract every block binds to through `:source`. Query resources and derived resources both
|
|
17
28
|
* satisfy it. Every member is a plain value read through a getter — there is no `.value`.
|
|
@@ -24,6 +35,13 @@ export interface DashboardSourceLike<TData = unknown> {
|
|
|
24
35
|
readonly error: unknown;
|
|
25
36
|
/** A background refetch is running while `state` is still `'ready'`. */
|
|
26
37
|
readonly refreshing: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* A request for this source is in flight, whatever its state: the first load, a refetch of shown
|
|
40
|
+
* data, or a retry after an error (TanStack keeps an errored query in `error` while it refetches).
|
|
41
|
+
* Blocks draw their progress bar from it. Optional so hand-written sources keep fitting; blocks
|
|
42
|
+
* fall back to `refreshing`.
|
|
43
|
+
*/
|
|
44
|
+
readonly fetching?: boolean;
|
|
27
45
|
/**
|
|
28
46
|
* When the data was last fetched successfully (epoch milliseconds). `undefined` until the first
|
|
29
47
|
* success. A derived value reports its oldest input.
|
|
@@ -34,19 +52,21 @@ export interface DashboardSourceLike<TData = unknown> {
|
|
|
34
52
|
refresh(): Promise<void>;
|
|
35
53
|
}
|
|
36
54
|
/** A declared query, as exposed on the dashboard facade. */
|
|
37
|
-
export interface DashboardResource<TData,
|
|
55
|
+
export interface DashboardResource<TData, TFilters extends DashboardFilterMap = DashboardEmptyMap, TStage extends DashboardStage = DashboardStage> extends DashboardSourceLike<TData> {
|
|
38
56
|
readonly kind: 'query';
|
|
57
|
+
readonly fetching: boolean;
|
|
39
58
|
readonly stage: TStage;
|
|
40
59
|
/** `false` while the owning view has never been opened or a `deferred` query was not activated. */
|
|
41
60
|
readonly active: boolean;
|
|
42
|
-
/**
|
|
43
|
-
readonly
|
|
44
|
-
/**
|
|
45
|
-
readonly
|
|
61
|
+
/** Values of the filters declared on this query, URL-synced under the query key. */
|
|
62
|
+
readonly filters: DashboardFilterValues<TFilters>;
|
|
63
|
+
/** Controls of the same filters: bind them to a chart's `series`, `UiDashboardFilter`, or any control. */
|
|
64
|
+
readonly controls: DashboardFilterControls<TFilters>;
|
|
46
65
|
}
|
|
47
66
|
/** A value declared in `derive`, exposed as a resource whose state follows the data it reads. */
|
|
48
67
|
export interface DashboardDerived<TData> extends DashboardSourceLike<TData> {
|
|
49
68
|
readonly kind: 'derived';
|
|
69
|
+
readonly fetching: boolean;
|
|
50
70
|
}
|
|
51
71
|
export type DashboardSourceMap = Record<string, DashboardSourceLike>;
|
|
52
72
|
/** Data of a source once it is `ready` (`undefined` is excluded, `null` is kept). */
|
|
@@ -62,25 +82,42 @@ export type DashboardQueryData<TQuery> = TQuery extends {
|
|
|
62
82
|
queryFn?: infer TFn;
|
|
63
83
|
} ? TFn extends (...args: never[]) => infer TResult ? Awaited<TResult> : never : never;
|
|
64
84
|
/** Scope handed to the configured query factory. */
|
|
65
|
-
export interface DashboardQueryScope<
|
|
66
|
-
/**
|
|
67
|
-
|
|
85
|
+
export interface DashboardQueryScope<TFilters extends DashboardFilterMap, TRequired> {
|
|
86
|
+
/** Values of the filters declared on this query. */
|
|
87
|
+
filters: Readonly<DashboardFilterValues<TFilters>>;
|
|
68
88
|
/** Non-nullish value returned by `requires`. */
|
|
69
89
|
required: NonNullable<TRequired>;
|
|
70
90
|
}
|
|
71
|
-
export interface DashboardQueryInput<TQuery extends DashboardQueryLike,
|
|
72
|
-
/**
|
|
73
|
-
|
|
91
|
+
export interface DashboardQueryInput<TQuery extends DashboardQueryLike, TFilters extends DashboardFilterMap, TRequired, TSelected> {
|
|
92
|
+
/**
|
|
93
|
+
* Filters of this query only, e.g. the products a chart tracks, URL-synced under
|
|
94
|
+
* `<queryKey>.<filter>`. Their controls drive the block bound to the query.
|
|
95
|
+
*/
|
|
96
|
+
filters?: DashboardFiltersInput<TFilters>;
|
|
74
97
|
/**
|
|
75
|
-
* Gate and narrow. While it returns `null` or `undefined
|
|
76
|
-
*
|
|
77
|
-
* `
|
|
98
|
+
* Gate and narrow. While it returns `null` or `undefined` the query does not fetch; once set,
|
|
99
|
+
* `scope.required` is the non-nullish value. Reading another resource's `data` here expresses a
|
|
100
|
+
* dependent query: the resource is `loading` while the resources it read load, and once they
|
|
101
|
+
* are ready without satisfying it, `ready` with its `defaultValue` (`idle` without one).
|
|
78
102
|
*/
|
|
79
103
|
requires?: () => TRequired;
|
|
80
|
-
/**
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
104
|
+
/**
|
|
105
|
+
* Whether the query exists for the current dashboard state, e.g. a section this workspace may
|
|
106
|
+
* not see. While it is `false` the query never fetches, its state is `disabled` and its data its
|
|
107
|
+
* `defaultValue`, and every block bound to it renders nothing (grids close the gap). To wait for
|
|
108
|
+
* data instead, use `requires`.
|
|
109
|
+
*/
|
|
110
|
+
enabled?: DashboardCondition;
|
|
111
|
+
/**
|
|
112
|
+
* Reactive query factory returning a TanStack query definition. Several resources may share one
|
|
113
|
+
* factory: they share its request and cache entry, and each `select`s its own part.
|
|
114
|
+
*/
|
|
115
|
+
query: (scope: DashboardQueryScope<NoInfer<TFilters>, NoInfer<TRequired>>) => TQuery;
|
|
116
|
+
/**
|
|
117
|
+
* Picks or reshapes the part of the query result this resource exposes. The cached result stays
|
|
118
|
+
* whole, so resources selecting from the same query never refetch it.
|
|
119
|
+
*/
|
|
120
|
+
select?: (data: DashboardQueryData<TQuery>) => TSelected;
|
|
84
121
|
/** Keep previous data while a new key loads. Defaults to `true`. */
|
|
85
122
|
keepPreviousData?: boolean;
|
|
86
123
|
staleTime?: number;
|
|
@@ -91,16 +128,17 @@ export interface DashboardQueryInput<TQuery extends DashboardQueryLike, TParams
|
|
|
91
128
|
export interface DashboardQueryStage<TStage extends DashboardStage> {
|
|
92
129
|
/** Plain query. `data` is `T | undefined`. */
|
|
93
130
|
query<TQuery extends DashboardQueryLike>(factory: () => TQuery): DashboardResource<DashboardQueryData<TQuery> | undefined, DashboardEmptyMap, TStage>;
|
|
94
|
-
/** Configured query without a default. `data` is `T | undefined
|
|
95
|
-
query<TQuery extends DashboardQueryLike, const
|
|
131
|
+
/** Configured query without a default. `data` is `T | undefined` (`T`: the `select` result). */
|
|
132
|
+
query<TQuery extends DashboardQueryLike, const TFilters extends DashboardFilterMap = DashboardEmptyMap, TRequired = undefined, TSelected = DashboardQueryData<TQuery>>(input: DashboardQueryInput<TQuery, TFilters, TRequired, TSelected> & {
|
|
96
133
|
defaultValue?: undefined;
|
|
97
|
-
}): DashboardResource<
|
|
134
|
+
}): DashboardResource<NoInfer<TSelected> | undefined, TFilters, TStage>;
|
|
98
135
|
/**
|
|
99
136
|
* Configured query with a default. `data` is always defined. The default is inferred on its own
|
|
100
|
-
* (so property order inside the object does not matter) and checked against the query result
|
|
101
|
-
* mismatching default turns the resource into a `DashboardKeyError`,
|
|
137
|
+
* (so property order inside the object does not matter) and checked against the query result (or
|
|
138
|
+
* the `select` result): a mismatching default turns the resource into a `DashboardKeyError`,
|
|
139
|
+
* rejected by `queries`.
|
|
102
140
|
*/
|
|
103
|
-
query<TQuery extends DashboardQueryLike, const
|
|
141
|
+
query<TQuery extends DashboardQueryLike, const TFilters extends DashboardFilterMap = DashboardEmptyMap, TRequired = undefined, TSelected = DashboardQueryData<TQuery>, TDefault = never>(input: DashboardQueryInput<TQuery, TFilters, TRequired, TSelected> & {
|
|
104
142
|
defaultValue: TDefault;
|
|
105
|
-
}): [TDefault] extends [
|
|
143
|
+
}): [TDefault] extends [NoInfer<TSelected>] ? DashboardResource<NoInfer<TSelected>, TFilters, TStage> : DashboardKeyError<'defaultValue is not assignable to the query data type.'>;
|
|
106
144
|
}
|
|
@@ -1,19 +1,23 @@
|
|
|
1
|
+
import type { ComputedRef, Ref } from 'vue';
|
|
1
2
|
import type { QueryDefinition } from '../../shared/types/query.js';
|
|
2
3
|
import type { LazyTextValue } from '../../shared/types/utils.js';
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
4
|
+
import type { DashboardOptionsMenuBindings } from './controls.js';
|
|
5
|
+
import type { DashboardFilterBuilder, DashboardFilterLike, DashboardOption } from './filters.js';
|
|
6
|
+
import type { DashboardCondition, DashboardSourceLike, DashboardStage } from './resource.js';
|
|
5
7
|
/**
|
|
6
8
|
* Runtime (type-erased) view of the schema. The public schema types carry precise generics; the
|
|
7
9
|
* runtime reads the same objects through these shapes after one normalization step.
|
|
8
10
|
*/
|
|
11
|
+
export type DashboardRuntimeFiltersInput = (f: DashboardFilterBuilder) => Record<string, DashboardFilterLike>;
|
|
9
12
|
export interface DashboardRuntimeQueryInput {
|
|
10
|
-
|
|
13
|
+
filters?: DashboardRuntimeFiltersInput;
|
|
11
14
|
requires?: () => unknown;
|
|
12
|
-
enabled?:
|
|
15
|
+
enabled?: DashboardCondition;
|
|
13
16
|
query: (scope: {
|
|
14
|
-
|
|
17
|
+
filters: object;
|
|
15
18
|
required: unknown;
|
|
16
19
|
}) => QueryDefinition;
|
|
20
|
+
select?: (data: unknown) => unknown;
|
|
17
21
|
defaultValue?: unknown;
|
|
18
22
|
keepPreviousData?: boolean;
|
|
19
23
|
staleTime?: number;
|
|
@@ -23,15 +27,17 @@ export interface DashboardRuntimeStage {
|
|
|
23
27
|
}
|
|
24
28
|
export type DashboardRuntimeStages = Record<DashboardStage, DashboardRuntimeStage>;
|
|
25
29
|
export interface DashboardRuntimeQueriesContext extends DashboardRuntimeStages {
|
|
26
|
-
|
|
30
|
+
filters: object;
|
|
27
31
|
}
|
|
28
32
|
export interface DashboardRuntimeDeriveContext {
|
|
29
33
|
data: object;
|
|
30
|
-
|
|
34
|
+
filters: object;
|
|
31
35
|
}
|
|
32
36
|
export interface DashboardRuntimeScopeInput {
|
|
33
37
|
label?: LazyTextValue;
|
|
34
|
-
|
|
38
|
+
/** Availability of a view. */
|
|
39
|
+
enabled?: DashboardCondition;
|
|
40
|
+
filters?: DashboardRuntimeFiltersInput;
|
|
35
41
|
queries?: (context: DashboardRuntimeQueriesContext) => Record<string, DashboardSourceLike>;
|
|
36
42
|
derive?: (context: DashboardRuntimeDeriveContext) => Record<string, () => unknown>;
|
|
37
43
|
}
|
|
@@ -40,5 +46,30 @@ export interface DashboardRuntimeSchema extends DashboardRuntimeScopeInput {
|
|
|
40
46
|
urlPrefix?: string;
|
|
41
47
|
autoRefresh?: number;
|
|
42
48
|
defaultView?: string;
|
|
49
|
+
/** Views in declaration order. Each input is the object the schema declared. */
|
|
43
50
|
views: [key: string, view: DashboardRuntimeScopeInput][];
|
|
44
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Option list behind one filter control, static or remote. Both option composables return this
|
|
54
|
+
* shape so the control composes either without branching.
|
|
55
|
+
*/
|
|
56
|
+
export interface DashboardRuntimeOptionList {
|
|
57
|
+
/** Options matching the current search. */
|
|
58
|
+
items: ComputedRef<readonly DashboardOption[]>;
|
|
59
|
+
/** Every option known so far (all static items; loaded pages and hydrated values), by value key. */
|
|
60
|
+
known: ComputedRef<ReadonlyMap<string, DashboardOption>>;
|
|
61
|
+
/** Position of each static option, used to keep multiple values in item order. */
|
|
62
|
+
order: ComputedRef<ReadonlyMap<string, number> | null>;
|
|
63
|
+
loading: ComputedRef<boolean>;
|
|
64
|
+
loadingMore: ComputedRef<boolean>;
|
|
65
|
+
hasMore: ComputedRef<boolean>;
|
|
66
|
+
error: ComputedRef<unknown>;
|
|
67
|
+
/** Labels of selected values are being fetched. */
|
|
68
|
+
resolving: ComputedRef<boolean>;
|
|
69
|
+
search: Ref<string>;
|
|
70
|
+
open: Ref<boolean>;
|
|
71
|
+
loadMore: () => void;
|
|
72
|
+
refresh: () => Promise<void>;
|
|
73
|
+
/** Menu bindings beyond items and keys (search wiring of remote lists). */
|
|
74
|
+
menu: ComputedRef<Partial<DashboardOptionsMenuBindings>>;
|
|
75
|
+
}
|
|
@@ -1,44 +1,47 @@
|
|
|
1
1
|
import type { LazyTextValue, Prettify } from '../../shared/types/utils.js';
|
|
2
|
-
import type {
|
|
3
|
-
import type { DashboardEmptyMap,
|
|
4
|
-
import type { DashboardDerived, DashboardQueryStage, DashboardResourceState, DashboardSourceLike, DashboardSourceMap } from './resource.js';
|
|
2
|
+
import type { DashboardFilterControls } from './controls.js';
|
|
3
|
+
import type { DashboardEmptyMap, DashboardFilterBuilder, DashboardFilterLike, DashboardFilterMap, DashboardFiltersInput, DashboardFilterValues } from './filters.js';
|
|
4
|
+
import type { DashboardCondition, DashboardDerived, DashboardQueryStage, DashboardResourceState, DashboardSourceLike, DashboardSourceMap } from './resource.js';
|
|
5
5
|
/** `derive` entries: each one is a function evaluated reactively into a derived resource. */
|
|
6
6
|
export type DashboardDeriveMap = Record<string, () => unknown>;
|
|
7
7
|
/** Context received by a scope's `queries` builder. */
|
|
8
|
-
export interface DashboardQueriesContext<
|
|
8
|
+
export interface DashboardQueriesContext<TFilters> {
|
|
9
9
|
essential: DashboardQueryStage<'essential'>;
|
|
10
10
|
background: DashboardQueryStage<'background'>;
|
|
11
11
|
deferred: DashboardQueryStage<'deferred'>;
|
|
12
|
-
/**
|
|
13
|
-
|
|
12
|
+
/** Values of the scope's filters. */
|
|
13
|
+
filters: Readonly<DashboardFilterValues<TFilters>>;
|
|
14
14
|
}
|
|
15
15
|
/** `data` of every source a `derive` builder can read. */
|
|
16
16
|
export type DashboardSourceData<TSources> = {
|
|
17
17
|
readonly [K in keyof TSources]: TSources[K] extends DashboardSourceLike<infer TData> ? TData : never;
|
|
18
18
|
};
|
|
19
19
|
/** Context received by a scope's `derive` builder. */
|
|
20
|
-
export interface DashboardDeriveContext<
|
|
20
|
+
export interface DashboardDeriveContext<TFilters, TSources> {
|
|
21
21
|
/**
|
|
22
|
-
* Current data of every query
|
|
23
|
-
*
|
|
22
|
+
* Current data of every query of this scope. Reads are tracked: a derived value's `state` follows
|
|
23
|
+
* the state of the queries it actually read during its last evaluation.
|
|
24
24
|
*/
|
|
25
25
|
data: DashboardSourceData<TSources>;
|
|
26
|
-
|
|
26
|
+
filters: Readonly<DashboardFilterValues<TFilters>>;
|
|
27
27
|
}
|
|
28
28
|
export type DashboardDerivedResources<TDerive> = {
|
|
29
29
|
readonly [K in keyof TDerive]: TDerive[K] extends () => infer TResult ? DashboardDerived<TResult> : never;
|
|
30
30
|
};
|
|
31
|
-
/**
|
|
32
|
-
export interface DashboardScopeInput<
|
|
33
|
-
/**
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
/** Filters, queries and derived values of one scope (the dashboard root or one view). */
|
|
32
|
+
export interface DashboardScopeInput<TFilters extends DashboardFilterMap, TQueries extends DashboardSourceMap, TDerive extends DashboardDeriveMap> {
|
|
33
|
+
/**
|
|
34
|
+
* Filters of this scope, declared inline with the `f` builder. A filter key names one state across
|
|
35
|
+
* the dashboard: two views declaring `year` share its value, so it survives a tab change.
|
|
36
|
+
*/
|
|
37
|
+
filters?: DashboardFiltersInput<TFilters>;
|
|
38
|
+
/** Staged queries of this scope. Declared once, when `useDashboard()` runs. */
|
|
39
|
+
queries?: (context: DashboardQueriesContext<TFilters>) => TQueries;
|
|
37
40
|
/** Derived values computed from query data, exposed as resources with automatic state. */
|
|
38
|
-
derive?: (context: DashboardDeriveContext<
|
|
41
|
+
derive?: (context: DashboardDeriveContext<TFilters, TQueries>) => TDerive;
|
|
39
42
|
}
|
|
40
43
|
/** Names owned by the runtime on the dashboard root and on every view handle. */
|
|
41
|
-
export type DashboardReservedKey = '
|
|
44
|
+
export type DashboardReservedKey = 'filters' | 'controls' | 'filtered' | 'resetFilters' | 'state' | 'refreshing' | 'refresh' | 'updatedAt' | 'autoRefresh' | 'view' | 'schema';
|
|
42
45
|
declare const DashboardKeyErrorBrand: unique symbol;
|
|
43
46
|
/** Unsatisfiable type. Its hover text is the error message the consumer reads. */
|
|
44
47
|
export interface DashboardKeyError<TMessage extends string> {
|
|
@@ -49,40 +52,31 @@ type Guard<TSlot extends string, TBad, TMessage extends string> = [TBad] extends
|
|
|
49
52
|
};
|
|
50
53
|
/** Compile-time collision checks for one scope's queries and derived values. */
|
|
51
54
|
export type DashboardScopeGuard<TQueries, TDerive, TTaken = never> = Guard<'queries', Extract<keyof TQueries, DashboardReservedKey | TTaken>, `Query key "${Extract<keyof TQueries, DashboardReservedKey | TTaken> & string}" is reserved or already used.`> & Guard<'derive', Extract<keyof TDerive, DashboardReservedKey | TTaken | keyof TQueries>, `Derived key "${Extract<keyof TDerive, DashboardReservedKey | TTaken | keyof TQueries> & string}" is reserved or already used.`>;
|
|
52
|
-
/** A view
|
|
53
|
-
export interface DashboardView<
|
|
55
|
+
/** A view (tab): its label, its own filters, queries and derived values. */
|
|
56
|
+
export interface DashboardView<TFilters extends DashboardFilterMap, TQueries extends DashboardSourceMap, TDerive extends DashboardDeriveMap> {
|
|
54
57
|
/** Tab label. The lazy form keeps it translation-friendly. */
|
|
55
58
|
readonly label?: LazyTextValue;
|
|
56
|
-
|
|
59
|
+
/** Availability of the view (see `defineDashboardView`). */
|
|
60
|
+
readonly enabled?: DashboardCondition;
|
|
61
|
+
readonly filters?: (f: DashboardFilterBuilder) => TFilters;
|
|
57
62
|
readonly queries?: (context: never) => TQueries;
|
|
58
63
|
readonly derive?: (context: never) => TDerive;
|
|
59
64
|
}
|
|
60
|
-
|
|
61
|
-
type
|
|
62
|
-
|
|
63
|
-
] ? [Extract<keyof TDerive, keyof TQueries>] extends [never] ? DashboardView<TParams, TQueries, TDerive> : DashboardKeyError<`Derived key "${Extract<keyof TDerive, keyof TQueries> & string}" collides with a query of the same view.`> : DashboardKeyError<`View member "${Extract<keyof TQueries | keyof TDerive, DashboardReservedKey | keyof TRootSources> & string}" is reserved or collides with a root query or derived value.`>;
|
|
64
|
-
/**
|
|
65
|
-
* Declares one view. Its queries see the shared params plus its own, and its `derive` can read root
|
|
66
|
-
* queries and derived values as well as its own queries.
|
|
67
|
-
*
|
|
68
|
-
* The result is `NoInfer`: otherwise the contextual `DashboardViewMap` would become an inference
|
|
69
|
-
* candidate, and a view without queries would infer `TQueries` as the open constraint.
|
|
70
|
-
*/
|
|
71
|
-
export type DashboardViewBuilder<TShared extends DashboardParamMap, TRootSources> = <const TParams extends DashboardParamMap = DashboardEmptyMap, const TQueries extends DashboardSourceMap = DashboardEmptyMap, const TDerive extends DashboardDeriveMap = DashboardEmptyMap>(view: {
|
|
72
|
-
label?: LazyTextValue;
|
|
73
|
-
} & DashboardScopeInput<TShared, TRootSources, TParams, TQueries, TDerive>) => DashboardViewResult<NoInfer<TParams>, NoInfer<TQueries>, NoInfer<TDerive>, TRootSources>;
|
|
65
|
+
/** Loosest filters input, for structural constraints. */
|
|
66
|
+
type DashboardFiltersLike = (f: DashboardFilterBuilder) => Record<string, DashboardFilterLike>;
|
|
67
|
+
export type DashboardViewMap = Record<string, DashboardView<DashboardFilterMap, DashboardSourceMap, DashboardDeriveMap>>;
|
|
74
68
|
/** Resolved dashboard schema returned by `defineDashboardSchema`. */
|
|
75
|
-
export interface DashboardSchema<
|
|
69
|
+
export interface DashboardSchema<TFilters extends DashboardFilterMap = DashboardEmptyMap, TQueries extends DashboardSourceMap = DashboardEmptyMap, TDerive extends DashboardDeriveMap = DashboardEmptyMap, TViews extends DashboardViewMap = DashboardEmptyMap> {
|
|
76
70
|
/** Stable identity, used in default query keys and devtools labels. */
|
|
77
71
|
readonly key: string;
|
|
78
72
|
/** Prefix prepended to every URL key this dashboard owns. Use it when two dashboards share a page. */
|
|
79
73
|
readonly urlPrefix?: string;
|
|
80
74
|
/** Default auto-refresh interval in seconds (`0`: off). */
|
|
81
75
|
readonly autoRefresh?: number;
|
|
82
|
-
readonly
|
|
76
|
+
readonly filters?: (f: DashboardFilterBuilder) => TFilters;
|
|
83
77
|
readonly queries?: (context: never) => TQueries;
|
|
84
78
|
readonly derive?: (context: never) => TDerive;
|
|
85
|
-
readonly views?:
|
|
79
|
+
readonly views?: TViews;
|
|
86
80
|
readonly defaultView?: keyof TViews & string;
|
|
87
81
|
}
|
|
88
82
|
/** Structural constraint every schema returned by `defineDashboardSchema` satisfies. */
|
|
@@ -90,15 +84,34 @@ export interface DashboardSchemaLike {
|
|
|
90
84
|
readonly key: string;
|
|
91
85
|
readonly urlPrefix?: string;
|
|
92
86
|
readonly autoRefresh?: number;
|
|
93
|
-
readonly
|
|
87
|
+
readonly filters?: DashboardFiltersLike;
|
|
94
88
|
readonly queries?: (context: never) => DashboardSourceMap;
|
|
95
89
|
readonly derive?: (context: never) => DashboardDeriveMap;
|
|
96
|
-
readonly views?:
|
|
90
|
+
readonly views?: DashboardViewMap;
|
|
97
91
|
readonly defaultView?: string;
|
|
98
92
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
93
|
+
/** Structural constraint every view returned by `defineDashboardView` satisfies. */
|
|
94
|
+
export interface DashboardViewLike {
|
|
95
|
+
readonly label?: LazyTextValue;
|
|
96
|
+
readonly enabled?: DashboardCondition;
|
|
97
|
+
readonly filters?: DashboardFiltersLike;
|
|
98
|
+
readonly queries?: (context: never) => DashboardSourceMap;
|
|
99
|
+
readonly derive?: (context: never) => DashboardDeriveMap;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* A schema, or a function returning one: `salesSchema`, `accountSchema` (which takes the account),
|
|
103
|
+
* `() => accountSchema({ accountId })`.
|
|
104
|
+
*/
|
|
105
|
+
export type DashboardSchemaInput = DashboardSchemaLike | ((...args: never[]) => DashboardSchemaLike);
|
|
106
|
+
/** The schema a `DashboardSchemaInput` describes: the object, or what the function returns. */
|
|
107
|
+
export type DashboardSchemaOf<TInput> = TInput extends (...args: never[]) => infer TSchema ? TSchema : TInput;
|
|
108
|
+
/** A view, or a function returning one: `consumptionView` (which takes the workspace). */
|
|
109
|
+
export type DashboardViewInput = DashboardViewLike | ((...args: never[]) => DashboardViewLike);
|
|
110
|
+
/** The view a `DashboardViewInput` describes: the object, or what the function returns. */
|
|
111
|
+
export type DashboardViewOf<TInput> = TInput extends (...args: never[]) => infer TView ? TView : TInput;
|
|
112
|
+
type InferFilters<T> = T extends {
|
|
113
|
+
filters?: (f: never) => infer TFilters;
|
|
114
|
+
} ? TFilters extends DashboardFilterMap ? TFilters : DashboardEmptyMap : DashboardEmptyMap;
|
|
102
115
|
type InferQueries<T> = T extends {
|
|
103
116
|
queries?: (context: never) => infer TQueries;
|
|
104
117
|
} ? TQueries extends DashboardSourceMap ? TQueries : DashboardEmptyMap : DashboardEmptyMap;
|
|
@@ -106,14 +119,24 @@ type InferDerive<T> = T extends {
|
|
|
106
119
|
derive?: (context: never) => infer TDerive;
|
|
107
120
|
} ? TDerive extends DashboardDeriveMap ? TDerive : DashboardEmptyMap : DashboardEmptyMap;
|
|
108
121
|
type InferViews<T> = T extends {
|
|
109
|
-
views?:
|
|
110
|
-
} ? TViews extends DashboardViewMap ? TViews : DashboardEmptyMap : DashboardEmptyMap;
|
|
122
|
+
views?: infer TViews;
|
|
123
|
+
} ? Exclude<TViews, undefined> extends DashboardViewMap ? Exclude<TViews, undefined> : DashboardEmptyMap : DashboardEmptyMap;
|
|
111
124
|
/** Runtime members shared by the dashboard root and every view handle. */
|
|
112
|
-
export interface DashboardScopeMembers<
|
|
113
|
-
/**
|
|
114
|
-
readonly
|
|
115
|
-
/**
|
|
116
|
-
|
|
125
|
+
export interface DashboardScopeMembers<TFilters> {
|
|
126
|
+
/** Values of the scope's filters. Writable, `v-model`-ready: `consumption.filters.year`. */
|
|
127
|
+
readonly filters: DashboardFilterValues<TFilters>;
|
|
128
|
+
/**
|
|
129
|
+
* Controls of the same filters: label, display text, option list, and the `toggle` / `reset`
|
|
130
|
+
* actions. Bind them to `UiDashboardFilter`, a chart's `series`, or any control.
|
|
131
|
+
*/
|
|
132
|
+
readonly controls: DashboardFilterControls<TFilters>;
|
|
133
|
+
/**
|
|
134
|
+
* A filter on screen differs from its default: the root's and the current view's for the
|
|
135
|
+
* dashboard, the view's own for a view handle. Headless filters are ignored.
|
|
136
|
+
*/
|
|
137
|
+
readonly filtered: boolean;
|
|
138
|
+
/** Restores the default of every filter `filtered` considers. */
|
|
139
|
+
resetFilters(): void;
|
|
117
140
|
/**
|
|
118
141
|
* `idle` while the scope has never been active, `error` if an active essential query failed,
|
|
119
142
|
* `loading` while essentials load, `ready` once they all succeeded.
|
|
@@ -134,19 +157,26 @@ export interface DashboardViewMeta<TKey extends string> {
|
|
|
134
157
|
readonly label: string;
|
|
135
158
|
/** The view is the current one. */
|
|
136
159
|
readonly active: boolean;
|
|
160
|
+
/** The view's `enabled` condition holds. A disabled view has no tab and cannot be current. */
|
|
161
|
+
readonly enabled: boolean;
|
|
137
162
|
/** The view has been opened at least once; its queries stay warm afterwards. */
|
|
138
163
|
readonly opened: boolean;
|
|
139
164
|
}
|
|
140
165
|
export interface DashboardViewController<TKey extends string> {
|
|
141
|
-
/**
|
|
166
|
+
/**
|
|
167
|
+
* Current view. Writable and URL-synced under `view`. Always an enabled view: a URL naming a
|
|
168
|
+
* disabled one reads as the default view (or the first enabled), and writing a disabled view is
|
|
169
|
+
* ignored.
|
|
170
|
+
*/
|
|
142
171
|
current: TKey;
|
|
143
|
-
/**
|
|
172
|
+
/** Enabled views in declaration order, ready for `UTabs` items. */
|
|
144
173
|
readonly items: readonly {
|
|
145
174
|
value: TKey;
|
|
146
175
|
label: string;
|
|
147
176
|
}[];
|
|
148
177
|
}
|
|
149
|
-
|
|
178
|
+
/** Handle of one view: its queries, derived values and filters (`consumption.filters.year`). */
|
|
179
|
+
export type DashboardViewHandle<TView, TKey extends string> = Prettify<InferQueries<TView> & DashboardDerivedResources<InferDerive<TView>> & DashboardScopeMembers<InferFilters<TView>> & {
|
|
150
180
|
readonly view: DashboardViewMeta<TKey>;
|
|
151
181
|
}>;
|
|
152
182
|
type DashboardViewHandles<TViews> = {
|
|
@@ -165,7 +195,17 @@ type DashboardRootViewMembers<TViews> = [keyof TViews] extends [never] ? unknown
|
|
|
165
195
|
readonly view: DashboardViewController<keyof TViews & string>;
|
|
166
196
|
};
|
|
167
197
|
/** Facade returned by `useDashboard(schema)`. */
|
|
168
|
-
export type DashboardApi<TSchema> = Prettify<InferQueries<TSchema> & DashboardDerivedResources<InferDerive<TSchema>> & DashboardViewHandles<InferViews<TSchema>> & DashboardScopeMembers<
|
|
198
|
+
export type DashboardApi<TSchema> = Prettify<InferQueries<TSchema> & DashboardDerivedResources<InferDerive<TSchema>> & DashboardViewHandles<InferViews<TSchema>> & DashboardScopeMembers<InferFilters<TSchema>> & DashboardRootMembers & DashboardRootViewMembers<InferViews<TSchema>> & {
|
|
169
199
|
readonly schema: TSchema;
|
|
170
200
|
}>;
|
|
201
|
+
/**
|
|
202
|
+
* Type of the dashboard `useDashboard` returns, for props and helpers:
|
|
203
|
+
* `InferDashboard<typeof accountSchema>` (a schema function) or `InferDashboard<typeof salesSchema>`.
|
|
204
|
+
*/
|
|
205
|
+
export type InferDashboard<TInput> = DashboardApi<DashboardSchemaOf<TInput>>;
|
|
206
|
+
/**
|
|
207
|
+
* Type of the handle `useDashboardView` returns: `InferDashboardView<typeof consumptionView>` (a
|
|
208
|
+
* view function) or the type of a view object.
|
|
209
|
+
*/
|
|
210
|
+
export type InferDashboardView<TInput> = DashboardViewHandle<DashboardViewOf<TInput>, string>;
|
|
171
211
|
export {};
|
|
@@ -165,6 +165,79 @@ export interface DashboardStateUi {
|
|
|
165
165
|
title?: string;
|
|
166
166
|
description?: string;
|
|
167
167
|
}
|
|
168
|
+
/** Classes of `UiDashboardFilter`: the pill, its menu, and the `button` variant. */
|
|
169
|
+
export interface DashboardFilterUi {
|
|
170
|
+
/** Pill around the trigger and the clear button. Carries `data-active` once the filter filters. */
|
|
171
|
+
root?: string;
|
|
172
|
+
trigger?: string;
|
|
173
|
+
/** Filter name, before the value. */
|
|
174
|
+
label?: string;
|
|
175
|
+
value?: string;
|
|
176
|
+
chevron?: string;
|
|
177
|
+
/** Clear button of an active pill. */
|
|
178
|
+
clear?: string;
|
|
179
|
+
/** Trigger of `variant="button"`. */
|
|
180
|
+
button?: string;
|
|
181
|
+
/** Popover panel. */
|
|
182
|
+
content?: string;
|
|
183
|
+
/** Heading of the panel (`variant="button"`). */
|
|
184
|
+
title?: string;
|
|
185
|
+
search?: string;
|
|
186
|
+
list?: string;
|
|
187
|
+
item?: string;
|
|
188
|
+
/** Checkbox of multiple filters. */
|
|
189
|
+
check?: string;
|
|
190
|
+
/** Check mark of the selected item of single filters. */
|
|
191
|
+
tick?: string;
|
|
192
|
+
/** Initials tile of items with an `avatar`. */
|
|
193
|
+
avatar?: string;
|
|
194
|
+
/** Trailing text of items with a `hint`. */
|
|
195
|
+
hint?: string;
|
|
196
|
+
separator?: string;
|
|
197
|
+
/** "No results", loading, and error rows. */
|
|
198
|
+
note?: string;
|
|
199
|
+
}
|
|
200
|
+
/** Classes of `UiDashboardFilters`. */
|
|
201
|
+
export interface DashboardFiltersUi {
|
|
202
|
+
/** The bar: a row that scrolls sideways on narrow screens and wraps on large ones. */
|
|
203
|
+
root?: string;
|
|
204
|
+
reset?: string;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Classes of the chips a block draws in its toolbar: the series a filter picks on a chart, and the
|
|
208
|
+
* drill-down filters (`filters`) a block is narrowed by.
|
|
209
|
+
*/
|
|
210
|
+
export interface DashboardChipsUi {
|
|
211
|
+
chip?: string;
|
|
212
|
+
/** Color square of a series chip. */
|
|
213
|
+
swatch?: string;
|
|
214
|
+
/** Filter name, before its value, on a filter chip. */
|
|
215
|
+
label?: string;
|
|
216
|
+
remove?: string;
|
|
217
|
+
}
|
|
218
|
+
/** Classes of `UiDashboardPage`. */
|
|
219
|
+
export interface DashboardPageUi {
|
|
220
|
+
/** The page, and its scroll container: the tabs and filters stick to its top. */
|
|
221
|
+
root?: string;
|
|
222
|
+
header?: string;
|
|
223
|
+
title?: string;
|
|
224
|
+
/** Today's date and when the data was fetched, under the title. */
|
|
225
|
+
description?: string;
|
|
226
|
+
/** Page actions and the refresh control. */
|
|
227
|
+
actions?: string;
|
|
228
|
+
/** Pinned band of the tabs and the filter bar. Carries `data-stuck` once content scrolls under it. */
|
|
229
|
+
toolbar?: string;
|
|
230
|
+
tabs?: string;
|
|
231
|
+
filters?: string;
|
|
232
|
+
/** Around the current view: its padding and the space between its grids. */
|
|
233
|
+
body?: string;
|
|
234
|
+
}
|
|
235
|
+
/** Classes of `UiDashboardViewTabs`. */
|
|
236
|
+
export interface DashboardViewTabsUi {
|
|
237
|
+
/** The strip: it scrolls sideways when the tabs overflow. */
|
|
238
|
+
root?: string;
|
|
239
|
+
tab?: string;
|
|
240
|
+
}
|
|
168
241
|
/**
|
|
169
242
|
* App-wide dashboard theming, read from `appConfig.nuxtUiTools.dashboard`.
|
|
170
243
|
*
|
|
@@ -198,4 +271,9 @@ export interface DashboardUiConfig {
|
|
|
198
271
|
feed?: DashboardFeedUi;
|
|
199
272
|
table?: DashboardTableUi;
|
|
200
273
|
state?: DashboardStateUi;
|
|
274
|
+
filter?: DashboardFilterUi;
|
|
275
|
+
filters?: DashboardFiltersUi;
|
|
276
|
+
viewTabs?: DashboardViewTabsUi;
|
|
277
|
+
page?: DashboardPageUi;
|
|
278
|
+
chips?: DashboardChipsUi;
|
|
201
279
|
}
|