nuxt-ui-tools 1.0.0 → 1.1.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.d.mts +3 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +37 -0
- package/dist/runtime/dashboard/components/block/dashboard-block-state.d.vue.ts +12 -0
- package/dist/runtime/dashboard/components/block/dashboard-block-state.vue +59 -0
- package/dist/runtime/dashboard/components/block/dashboard-block-state.vue.d.ts +12 -0
- package/dist/runtime/dashboard/components/block/dashboard-data-table.d.vue.ts +9 -0
- package/dist/runtime/dashboard/components/block/dashboard-data-table.vue +47 -0
- package/dist/runtime/dashboard/components/block/dashboard-data-table.vue.d.ts +9 -0
- package/dist/runtime/dashboard/components/block/dashboard-ring.d.vue.ts +34 -0
- package/dist/runtime/dashboard/components/block/dashboard-ring.vue +91 -0
- package/dist/runtime/dashboard/components/block/dashboard-ring.vue.d.ts +34 -0
- package/dist/runtime/dashboard/components/block/dashboard-row-actions.d.vue.ts +13 -0
- package/dist/runtime/dashboard/components/block/dashboard-row-actions.vue +49 -0
- package/dist/runtime/dashboard/components/block/dashboard-row-actions.vue.d.ts +13 -0
- package/dist/runtime/dashboard/components/block/dashboard-skeleton.d.vue.ts +34 -0
- package/dist/runtime/dashboard/components/block/dashboard-skeleton.vue +312 -0
- package/dist/runtime/dashboard/components/block/dashboard-skeleton.vue.d.ts +34 -0
- package/dist/runtime/dashboard/components/charts/renderer.d.ts +43 -0
- package/dist/runtime/dashboard/components/charts/renderer.js +34 -0
- package/dist/runtime/dashboard/components/charts/unovis/dashboard-donut-chart.d.vue.ts +18 -0
- package/dist/runtime/dashboard/components/charts/unovis/dashboard-donut-chart.vue +45 -0
- package/dist/runtime/dashboard/components/charts/unovis/dashboard-donut-chart.vue.d.ts +18 -0
- package/dist/runtime/dashboard/components/charts/unovis/dashboard-xy-chart.d.vue.ts +14 -0
- package/dist/runtime/dashboard/components/charts/unovis/dashboard-xy-chart.vue +190 -0
- package/dist/runtime/dashboard/components/charts/unovis/dashboard-xy-chart.vue.d.ts +14 -0
- package/dist/runtime/dashboard/components/charts/unovis/dashboard-xy-marks.d.vue.ts +13 -0
- package/dist/runtime/dashboard/components/charts/unovis/dashboard-xy-marks.vue +72 -0
- package/dist/runtime/dashboard/components/charts/unovis/dashboard-xy-marks.vue.d.ts +13 -0
- package/dist/runtime/dashboard/components/charts/unovis/xy-layers.d.ts +43 -0
- package/dist/runtime/dashboard/components/charts/unovis/xy-layers.js +60 -0
- package/dist/runtime/dashboard/components/dashboard-alerts.d.vue.ts +49 -0
- package/dist/runtime/dashboard/components/dashboard-alerts.vue +226 -0
- package/dist/runtime/dashboard/components/dashboard-alerts.vue.d.ts +49 -0
- package/dist/runtime/dashboard/components/dashboard-bar-chart.d.vue.ts +53 -0
- package/dist/runtime/dashboard/components/dashboard-bar-chart.vue +131 -0
- package/dist/runtime/dashboard/components/dashboard-bar-chart.vue.d.ts +53 -0
- package/dist/runtime/dashboard/components/dashboard-bars.d.vue.ts +49 -0
- package/dist/runtime/dashboard/components/dashboard-bars.vue +187 -0
- package/dist/runtime/dashboard/components/dashboard-bars.vue.d.ts +49 -0
- package/dist/runtime/dashboard/components/dashboard-card.d.vue.ts +47 -0
- package/dist/runtime/dashboard/components/dashboard-card.vue +316 -0
- package/dist/runtime/dashboard/components/dashboard-card.vue.d.ts +47 -0
- package/dist/runtime/dashboard/components/dashboard-combo-chart.d.vue.ts +52 -0
- package/dist/runtime/dashboard/components/dashboard-combo-chart.vue +128 -0
- package/dist/runtime/dashboard/components/dashboard-combo-chart.vue.d.ts +52 -0
- package/dist/runtime/dashboard/components/dashboard-donut-chart.d.vue.ts +48 -0
- package/dist/runtime/dashboard/components/dashboard-donut-chart.vue +216 -0
- package/dist/runtime/dashboard/components/dashboard-donut-chart.vue.d.ts +48 -0
- package/dist/runtime/dashboard/components/dashboard-feed.d.vue.ts +49 -0
- package/dist/runtime/dashboard/components/dashboard-feed.vue +238 -0
- package/dist/runtime/dashboard/components/dashboard-feed.vue.d.ts +49 -0
- package/dist/runtime/dashboard/components/dashboard-funnel.d.vue.ts +34 -0
- package/dist/runtime/dashboard/components/dashboard-funnel.vue +157 -0
- package/dist/runtime/dashboard/components/dashboard-funnel.vue.d.ts +34 -0
- package/dist/runtime/dashboard/components/dashboard-gauge.d.vue.ts +55 -0
- package/dist/runtime/dashboard/components/dashboard-gauge.vue +177 -0
- package/dist/runtime/dashboard/components/dashboard-gauge.vue.d.ts +55 -0
- package/dist/runtime/dashboard/components/dashboard-grid.d.vue.ts +38 -0
- package/dist/runtime/dashboard/components/dashboard-grid.vue +49 -0
- package/dist/runtime/dashboard/components/dashboard-grid.vue.d.ts +38 -0
- package/dist/runtime/dashboard/components/dashboard-legend.d.vue.ts +8 -0
- package/dist/runtime/dashboard/components/dashboard-legend.vue +37 -0
- package/dist/runtime/dashboard/components/dashboard-legend.vue.d.ts +8 -0
- package/dist/runtime/dashboard/components/dashboard-line-chart.d.vue.ts +46 -0
- package/dist/runtime/dashboard/components/dashboard-line-chart.vue +129 -0
- package/dist/runtime/dashboard/components/dashboard-line-chart.vue.d.ts +46 -0
- package/dist/runtime/dashboard/components/dashboard-list.d.vue.ts +63 -0
- package/dist/runtime/dashboard/components/dashboard-list.vue +239 -0
- package/dist/runtime/dashboard/components/dashboard-list.vue.d.ts +63 -0
- package/dist/runtime/dashboard/components/dashboard-paired-bars.d.vue.ts +43 -0
- package/dist/runtime/dashboard/components/dashboard-paired-bars.vue +194 -0
- package/dist/runtime/dashboard/components/dashboard-paired-bars.vue.d.ts +43 -0
- package/dist/runtime/dashboard/components/dashboard-refresh.d.vue.ts +29 -0
- package/dist/runtime/dashboard/components/dashboard-refresh.vue +86 -0
- package/dist/runtime/dashboard/components/dashboard-refresh.vue.d.ts +29 -0
- package/dist/runtime/dashboard/components/dashboard-relative-time.d.vue.ts +12 -0
- package/dist/runtime/dashboard/components/dashboard-relative-time.vue +23 -0
- package/dist/runtime/dashboard/components/dashboard-relative-time.vue.d.ts +12 -0
- package/dist/runtime/dashboard/components/dashboard-stack-bar.d.vue.ts +36 -0
- package/dist/runtime/dashboard/components/dashboard-stack-bar.vue +162 -0
- package/dist/runtime/dashboard/components/dashboard-stack-bar.vue.d.ts +36 -0
- package/dist/runtime/dashboard/components/dashboard-stat.d.vue.ts +69 -0
- package/dist/runtime/dashboard/components/dashboard-stat.vue +279 -0
- package/dist/runtime/dashboard/components/dashboard-stat.vue.d.ts +69 -0
- package/dist/runtime/dashboard/components/dashboard-stats.d.vue.ts +38 -0
- package/dist/runtime/dashboard/components/dashboard-stats.vue +202 -0
- package/dist/runtime/dashboard/components/dashboard-stats.vue.d.ts +38 -0
- package/dist/runtime/dashboard/components/dashboard-table.d.vue.ts +52 -0
- package/dist/runtime/dashboard/components/dashboard-table.vue +305 -0
- package/dist/runtime/dashboard/components/dashboard-table.vue.d.ts +52 -0
- package/dist/runtime/dashboard/components/dashboard-tabs.d.vue.ts +35 -0
- package/dist/runtime/dashboard/components/dashboard-tabs.vue +55 -0
- package/dist/runtime/dashboard/components/dashboard-tabs.vue.d.ts +35 -0
- package/dist/runtime/dashboard/components/dashboard-total.d.vue.ts +10 -0
- package/dist/runtime/dashboard/components/dashboard-total.vue +32 -0
- package/dist/runtime/dashboard/components/dashboard-total.vue.d.ts +10 -0
- package/dist/runtime/dashboard/components/dashboard-widget.d.vue.ts +46 -0
- package/dist/runtime/dashboard/components/dashboard-widget.vue +84 -0
- package/dist/runtime/dashboard/components/dashboard-widget.vue.d.ts +46 -0
- package/dist/runtime/dashboard/composables/use-dashboard-api.d.ts +15 -0
- package/dist/runtime/dashboard/composables/use-dashboard-api.js +91 -0
- package/dist/runtime/dashboard/composables/use-dashboard-block.d.ts +22 -0
- package/dist/runtime/dashboard/composables/use-dashboard-block.js +35 -0
- package/dist/runtime/dashboard/composables/use-dashboard-chart.d.ts +36 -0
- package/dist/runtime/dashboard/composables/use-dashboard-chart.js +118 -0
- package/dist/runtime/dashboard/composables/use-dashboard-derived.d.ts +12 -0
- package/dist/runtime/dashboard/composables/use-dashboard-derived.js +47 -0
- package/dist/runtime/dashboard/composables/use-dashboard-format.d.ts +6 -0
- package/dist/runtime/dashboard/composables/use-dashboard-format.js +12 -0
- package/dist/runtime/dashboard/composables/use-dashboard-options.d.ts +8 -0
- package/dist/runtime/dashboard/composables/use-dashboard-options.js +63 -0
- package/dist/runtime/dashboard/composables/use-dashboard-param-scope.d.ts +30 -0
- package/dist/runtime/dashboard/composables/use-dashboard-param-scope.js +71 -0
- package/dist/runtime/dashboard/composables/use-dashboard-remote-options.d.ts +12 -0
- package/dist/runtime/dashboard/composables/use-dashboard-remote-options.js +117 -0
- package/dist/runtime/dashboard/composables/use-dashboard-resource.d.ts +35 -0
- package/dist/runtime/dashboard/composables/use-dashboard-resource.js +80 -0
- package/dist/runtime/dashboard/composables/use-dashboard-scope.d.ts +46 -0
- package/dist/runtime/dashboard/composables/use-dashboard-scope.js +127 -0
- package/dist/runtime/dashboard/composables/use-dashboard-time.d.ts +13 -0
- package/dist/runtime/dashboard/composables/use-dashboard-time.js +40 -0
- package/dist/runtime/dashboard/composables/use-dashboard-ui.d.ts +22 -0
- package/dist/runtime/dashboard/composables/use-dashboard-ui.js +19 -0
- package/dist/runtime/dashboard/composables/use-dashboard-views.d.ts +46 -0
- package/dist/runtime/dashboard/composables/use-dashboard-views.js +49 -0
- package/dist/runtime/dashboard/composables/use-dashboard.d.ts +24 -0
- package/dist/runtime/dashboard/composables/use-dashboard.js +42 -0
- package/dist/runtime/dashboard/constants/query.d.ts +16 -0
- package/dist/runtime/dashboard/constants/query.js +15 -0
- package/dist/runtime/dashboard/index.d.ts +4 -0
- package/dist/runtime/dashboard/index.js +3 -0
- package/dist/runtime/dashboard/schema/index.d.ts +57 -0
- package/dist/runtime/dashboard/schema/index.js +3 -0
- package/dist/runtime/dashboard/types/blocks.d.ts +251 -0
- package/dist/runtime/dashboard/types/blocks.js +0 -0
- package/dist/runtime/dashboard/types/charts.d.ts +60 -0
- package/dist/runtime/dashboard/types/charts.js +0 -0
- package/dist/runtime/dashboard/types/index.d.ts +7 -0
- package/dist/runtime/dashboard/types/index.js +0 -0
- package/dist/runtime/dashboard/types/options.d.ts +46 -0
- package/dist/runtime/dashboard/types/options.js +0 -0
- package/dist/runtime/dashboard/types/params.d.ts +115 -0
- package/dist/runtime/dashboard/types/params.js +0 -0
- package/dist/runtime/dashboard/types/resource.d.ts +106 -0
- package/dist/runtime/dashboard/types/resource.js +0 -0
- package/dist/runtime/dashboard/types/runtime.d.ts +44 -0
- package/dist/runtime/dashboard/types/runtime.js +0 -0
- package/dist/runtime/dashboard/types/schema.d.ts +171 -0
- package/dist/runtime/dashboard/types/schema.js +0 -0
- package/dist/runtime/dashboard/types/ui.d.ts +201 -0
- package/dist/runtime/dashboard/types/ui.js +0 -0
- package/dist/runtime/dashboard/utils/builders/dashboard-params.d.ts +85 -0
- package/dist/runtime/dashboard/utils/builders/dashboard-params.js +87 -0
- package/dist/runtime/dashboard/utils/chart-frame.d.ts +5 -0
- package/dist/runtime/dashboard/utils/chart-frame.js +27 -0
- package/dist/runtime/dashboard/utils/charts.d.ts +61 -0
- package/dist/runtime/dashboard/utils/charts.js +142 -0
- package/dist/runtime/dashboard/utils/comparison.d.ts +15 -0
- package/dist/runtime/dashboard/utils/comparison.js +19 -0
- package/dist/runtime/dashboard/utils/export.d.ts +13 -0
- package/dist/runtime/dashboard/utils/export.js +45 -0
- package/dist/runtime/dashboard/utils/options.d.ts +12 -0
- package/dist/runtime/dashboard/utils/options.js +23 -0
- package/dist/runtime/dashboard/utils/params/codecs.d.ts +14 -0
- package/dist/runtime/dashboard/utils/params/codecs.js +69 -0
- package/dist/runtime/dashboard/utils/resource.d.ts +16 -0
- package/dist/runtime/dashboard/utils/resource.js +39 -0
- package/dist/runtime/dashboard/utils/schema.d.ts +9 -0
- package/dist/runtime/dashboard/utils/schema.js +31 -0
- package/dist/runtime/dashboard/utils/sparkline.d.ts +21 -0
- package/dist/runtime/dashboard/utils/sparkline.js +53 -0
- package/dist/runtime/dashboard/utils/state.d.ts +28 -0
- package/dist/runtime/dashboard/utils/state.js +32 -0
- package/dist/runtime/dashboard/utils/time.d.ts +17 -0
- package/dist/runtime/dashboard/utils/time.js +60 -0
- package/dist/runtime/dashboard/utils/tracker.d.ts +12 -0
- package/dist/runtime/dashboard/utils/tracker.js +31 -0
- package/dist/runtime/dashboard/utils/ui.d.ts +38 -0
- package/dist/runtime/dashboard/utils/ui.js +24 -0
- package/dist/runtime/dashboard/utils/visibility.d.ts +2 -0
- package/dist/runtime/dashboard/utils/visibility.js +25 -0
- package/dist/runtime/form/components/root/form.vue +1 -1
- package/dist/runtime/form/composables/use-form-validation.d.ts +2 -3
- package/dist/runtime/form/composables/use-form-validation.js +24 -112
- package/dist/runtime/form/composables/use-form.js +1 -1
- package/dist/runtime/form/fields/password/component.vue +132 -28
- package/dist/runtime/form/fields/password/types.d.ts +6 -0
- package/dist/runtime/form/fields/text/component.vue +7 -2
- package/dist/runtime/form/types/field.d.ts +1 -1
- package/dist/runtime/form/types/options.d.ts +15 -36
- package/dist/runtime/form/types/validation.d.ts +3 -20
- package/dist/runtime/form/utils/state.d.ts +1 -14
- package/dist/runtime/form/utils/state.js +0 -199
- package/dist/runtime/i18n/locales/en.js +63 -0
- package/dist/runtime/i18n/locales/fr.js +63 -0
- package/dist/runtime/i18n/types.d.ts +68 -0
- package/dist/runtime/shared/index.d.ts +2 -0
- package/dist/runtime/shared/styles/tokens.css +1 -1
- package/dist/runtime/shared/types/query.d.ts +10 -0
- package/dist/runtime/shared/types/query.js +0 -0
- package/dist/runtime/shared/types/remote-options.d.ts +37 -0
- package/dist/runtime/shared/types/remote-options.js +0 -0
- package/dist/runtime/spreadsheet/components/layout/spreadsheet-import-footer.d.vue.ts +2 -2
- package/dist/runtime/spreadsheet/components/layout/spreadsheet-import-footer.vue.d.ts +2 -2
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-internals.d.ts +15 -15
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-resolutions.d.ts +2 -2
- package/dist/runtime/spreadsheet/schema/normalize.d.ts +1 -1
- package/dist/runtime/spreadsheet/utils/references/sources.d.ts +1 -1
- package/dist/runtime/table/components/data-list/data-list-content.d.vue.ts +20 -18
- package/dist/runtime/table/components/data-list/data-list-content.vue +14 -87
- package/dist/runtime/table/components/data-list/data-list-content.vue.d.ts +20 -18
- package/dist/runtime/table/components/data-list/data-list-default.d.vue.ts +1 -4
- package/dist/runtime/table/components/data-list/data-list-default.vue.d.ts +1 -4
- package/dist/runtime/table/components/data-list/data-list-error-state.d.vue.ts +13 -0
- package/dist/runtime/table/components/data-list/data-list-error-state.vue +91 -0
- package/dist/runtime/table/components/data-list/data-list-error-state.vue.d.ts +13 -0
- package/dist/runtime/table/components/data-list/data-list-infinite-loader.d.vue.ts +1 -1
- package/dist/runtime/table/components/data-list/data-list-infinite-loader.vue.d.ts +1 -1
- package/dist/runtime/table/components/data-list/data-list-layout-switch.d.vue.ts +1 -1
- package/dist/runtime/table/components/data-list/data-list-layout-switch.vue +1 -1
- package/dist/runtime/table/components/data-list/data-list-layout-switch.vue.d.ts +1 -1
- package/dist/runtime/table/components/data-list/data-list-pagination.d.vue.ts +1 -1
- package/dist/runtime/table/components/data-list/data-list-pagination.vue.d.ts +1 -1
- package/dist/runtime/table/components/data-list/data-list-refresh.vue +42 -4
- package/dist/runtime/table/components/data-list/data-list-root.d.vue.ts +1 -9
- package/dist/runtime/table/components/data-list/data-list-root.vue.d.ts +1 -9
- package/dist/runtime/table/components/data-list/data-list-sort-menu.d.vue.ts +1 -1
- package/dist/runtime/table/components/data-list/data-list-sort-menu.vue +11 -5
- package/dist/runtime/table/components/data-list/data-list-sort-menu.vue.d.ts +1 -1
- package/dist/runtime/table/components/data-list/sort-menu-panel.d.vue.ts +2 -2
- package/dist/runtime/table/components/data-list/sort-menu-panel.vue.d.ts +2 -2
- package/dist/runtime/table/components/data-list.d.vue.ts +2 -13
- package/dist/runtime/table/components/data-list.vue.d.ts +2 -13
- package/dist/runtime/table/components/drawers/column-panel.vue +7 -2
- package/dist/runtime/table/components/filters/panel/filter-panel-chips.vue +2 -5
- package/dist/runtime/table/components/filters/panel/option-filter-panel-field.vue +1 -1
- package/dist/runtime/table/components/filters/shared/dynamic-filter-picker.d.vue.ts +2 -2
- package/dist/runtime/table/components/filters/shared/dynamic-filter-picker.vue +103 -101
- package/dist/runtime/table/components/filters/shared/dynamic-filter-picker.vue.d.ts +2 -2
- package/dist/runtime/table/components/filters/shared/filter-match-mode-button.d.vue.ts +1 -1
- package/dist/runtime/table/components/filters/shared/filter-match-mode-button.vue.d.ts +1 -1
- package/dist/runtime/table/components/filters/shared/filter-option-multiple-list.vue +2 -2
- package/dist/runtime/table/components/filters/shared/filter-option-picker-content.vue +3 -3
- package/dist/runtime/table/components/filters/shared/filter-option-single-list.vue +1 -1
- package/dist/runtime/table/components/filters/shared/filter-popover-shell.d.vue.ts +3 -3
- package/dist/runtime/table/components/filters/shared/filter-popover-shell.vue +17 -15
- package/dist/runtime/table/components/filters/shared/filter-popover-shell.vue.d.ts +3 -3
- package/dist/runtime/table/components/filters/shared/filter-searchable-panel.vue +10 -2
- package/dist/runtime/table/components/filters/sheet/filter-sheet.vue +4 -3
- package/dist/runtime/table/components/filters/tags/filter-tags-bar.vue +1 -1
- package/dist/runtime/table/components/grid/grid-renderer.vue +2 -4
- package/dist/runtime/table/components/layout/table-footer.d.vue.ts +1 -1
- package/dist/runtime/table/components/layout/table-footer.vue.d.ts +1 -1
- package/dist/runtime/table/components/table/table-cell-ellipsis.d.ts +1 -1
- package/dist/runtime/table/components/table/table-renderer.d.vue.ts +8 -2
- package/dist/runtime/table/components/table/table-renderer.vue +24 -6
- package/dist/runtime/table/components/table/table-renderer.vue.d.ts +8 -2
- package/dist/runtime/table/composables/use-option-filter-editor-state.d.ts +1 -0
- package/dist/runtime/table/composables/use-option-filter-editor-state.js +2 -2
- package/dist/runtime/table/composables/use-query-state.d.ts +3 -3
- package/dist/runtime/table/composables/use-table-actions.js +10 -5
- package/dist/runtime/table/composables/use-table-api.js +4 -1
- package/dist/runtime/table/composables/use-table-columns.d.ts +9 -5
- package/dist/runtime/table/composables/use-table-data.d.ts +2 -1
- package/dist/runtime/table/composables/use-table-data.js +19 -2
- package/dist/runtime/table/composables/use-table-filter-options.d.ts +1 -0
- package/dist/runtime/table/composables/use-table-filter-options.js +2 -1
- package/dist/runtime/table/composables/use-table-internals.d.ts +45 -33
- package/dist/runtime/table/composables/use-table-pagination.d.ts +2 -2
- package/dist/runtime/table/composables/use-table-selection.d.ts +1 -1
- package/dist/runtime/table/composables/use-table-state.d.ts +3 -3
- package/dist/runtime/table/types/actions.d.ts +3 -2
- package/dist/runtime/table/types/data-list.d.ts +8 -0
- package/dist/runtime/table/types/source.d.ts +14 -6
- package/dist/runtime/table/utils/builders/table-source.d.ts +14 -15
- package/dist/runtime/table/utils/client-query.d.ts +1 -1
- package/dist/runtime/table/utils/columns/menu.d.ts +1 -1
- package/dist/runtime/table/utils/columns/render.d.ts +13 -5
- package/dist/runtime/table/utils/columns/render.js +3 -2
- package/dist/runtime/table/utils/columns/state.d.ts +1 -1
- package/dist/runtime/table/utils/data-list-ui.d.ts +1 -1
- package/dist/runtime/table/utils/filters/editor-size.js +9 -9
- package/dist/runtime/table/utils/filters/options.js +6 -1
- package/dist/runtime/table/utils/index.d.ts +1 -0
- package/dist/runtime/table/utils/index.js +1 -0
- package/dist/runtime/table/utils/prefetch.js +5 -1
- package/dist/runtime/table/utils/source-request.d.ts +2 -0
- package/dist/runtime/table/utils/source-request.js +9 -0
- package/package.json +28 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { DashboardBlockBaseProps, DashboardDataTable, DashboardLegendItem, DashboardSkeletonKind, DashboardSourceLike } from '../types/index.js';
|
|
2
|
+
declare const __VLS_export: <TData>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
3
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<DashboardBlockBaseProps & {
|
|
4
|
+
source: DashboardSourceLike<TData>;
|
|
5
|
+
/** Whether ready data has nothing to show. Defaults to `null` or an empty array. */
|
|
6
|
+
isEmpty?: (data: TData & ({} | null)) => boolean;
|
|
7
|
+
legend?: readonly DashboardLegendItem[];
|
|
8
|
+
/** Built-in skeleton drawn while the source loads, unless a `#skeleton` slot is given. */
|
|
9
|
+
skeleton?: DashboardSkeletonKind;
|
|
10
|
+
/** Tabular data behind the `table` and `csv` menu actions. */
|
|
11
|
+
tabulate?: (data: TData & ({} | null)) => DashboardDataTable;
|
|
12
|
+
/** Offers the `expand` menu action; the default slot receives `expanded`. */
|
|
13
|
+
expandable?: boolean;
|
|
14
|
+
}> & (typeof globalThis extends {
|
|
15
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
16
|
+
} ? P : {});
|
|
17
|
+
expose: (exposed: {}) => void;
|
|
18
|
+
attrs: any;
|
|
19
|
+
slots: {
|
|
20
|
+
default: (props: {
|
|
21
|
+
data: TData & ({} | null);
|
|
22
|
+
refreshing: boolean;
|
|
23
|
+
refresh: () => Promise<void>;
|
|
24
|
+
/** Rendered in the expand dialog. */
|
|
25
|
+
expanded: boolean;
|
|
26
|
+
}) => unknown;
|
|
27
|
+
skeleton?: () => unknown;
|
|
28
|
+
'header-right'?: (props: {
|
|
29
|
+
data: (TData & ({} | null)) | undefined;
|
|
30
|
+
}) => unknown;
|
|
31
|
+
toolbar?: () => unknown;
|
|
32
|
+
footer?: (props: {
|
|
33
|
+
data: TData & ({} | null);
|
|
34
|
+
}) => unknown;
|
|
35
|
+
};
|
|
36
|
+
emit: {};
|
|
37
|
+
}>) => import("vue").VNode & {
|
|
38
|
+
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
39
|
+
};
|
|
40
|
+
declare const _default: typeof __VLS_export;
|
|
41
|
+
export default _default;
|
|
42
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
43
|
+
[K in keyof T]: T[K];
|
|
44
|
+
} : {
|
|
45
|
+
[K in keyof T as K]: T[K];
|
|
46
|
+
}) & {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { WritableComputedRef } from 'vue';
|
|
2
|
+
import type { DashboardSchemaLike } from '../types/index.js';
|
|
3
|
+
import type { useDashboardScope } from './use-dashboard-scope.js';
|
|
4
|
+
import type { useDashboardViews } from './use-dashboard-views.js';
|
|
5
|
+
/**
|
|
6
|
+
* Facade only: projects the owning scopes into the public dashboard object. Every runtime member is
|
|
7
|
+
* a getter over a ref owned elsewhere, so templates read plain values and `v-model` writes through.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useDashboardApi(params: {
|
|
10
|
+
schema: DashboardSchemaLike;
|
|
11
|
+
/** Auto-refresh interval in seconds (URL-synced). */
|
|
12
|
+
autoRefresh: WritableComputedRef<number>;
|
|
13
|
+
root: ReturnType<typeof useDashboardScope>;
|
|
14
|
+
views: ReturnType<typeof useDashboardViews> | null;
|
|
15
|
+
}): object;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { markRaw } from "vue";
|
|
2
|
+
import {
|
|
3
|
+
combineDashboardStates,
|
|
4
|
+
refreshDashboardSources,
|
|
5
|
+
resolveDashboardUpdatedAt
|
|
6
|
+
} from "../utils/state.js";
|
|
7
|
+
export function useDashboardApi(params) {
|
|
8
|
+
const { root, views } = params;
|
|
9
|
+
const api = Object.fromEntries(root.members);
|
|
10
|
+
for (const view of views?.views ?? []) {
|
|
11
|
+
const handle = Object.fromEntries(view.scope.members);
|
|
12
|
+
Object.defineProperties(handle, {
|
|
13
|
+
...scopeMembers(view.scope),
|
|
14
|
+
view: {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
value: markRaw({
|
|
17
|
+
get active() {
|
|
18
|
+
return views?.current.value === view.key;
|
|
19
|
+
},
|
|
20
|
+
key: view.key,
|
|
21
|
+
get label() {
|
|
22
|
+
return view.label();
|
|
23
|
+
},
|
|
24
|
+
get opened() {
|
|
25
|
+
return view.opened.value;
|
|
26
|
+
}
|
|
27
|
+
})
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
api[view.key] = markRaw(handle);
|
|
31
|
+
}
|
|
32
|
+
const openedScopes = () => [
|
|
33
|
+
root,
|
|
34
|
+
...views?.views.filter((view) => view.opened.value).map((view) => view.scope) ?? []
|
|
35
|
+
];
|
|
36
|
+
const visibleScopes = () => {
|
|
37
|
+
const current = views?.views.find((view) => view.key === views.current.value);
|
|
38
|
+
return current ? [root, current.scope] : [root];
|
|
39
|
+
};
|
|
40
|
+
Object.defineProperties(api, {
|
|
41
|
+
...scopeMembers(root),
|
|
42
|
+
autoRefresh: {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: () => params.autoRefresh.value,
|
|
45
|
+
set: (seconds) => {
|
|
46
|
+
params.autoRefresh.value = Number.isFinite(seconds) ? Math.max(0, Math.round(seconds)) : 0;
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
refresh: { enumerable: true, value: () => refreshDashboardSources(openedScopes()) },
|
|
50
|
+
refreshing: {
|
|
51
|
+
enumerable: true,
|
|
52
|
+
get: () => openedScopes().some((scope) => scope.refreshing.value)
|
|
53
|
+
},
|
|
54
|
+
schema: { enumerable: true, value: params.schema },
|
|
55
|
+
state: {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
get: () => combineDashboardStates(visibleScopes().map((scope) => scope.state.value))
|
|
58
|
+
},
|
|
59
|
+
updatedAt: {
|
|
60
|
+
enumerable: true,
|
|
61
|
+
get: () => resolveDashboardUpdatedAt(visibleScopes().map((scope) => scope.updatedAt.value))
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
if (views) {
|
|
65
|
+
Object.defineProperty(api, "view", {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
value: markRaw({
|
|
68
|
+
get current() {
|
|
69
|
+
return views.current.value;
|
|
70
|
+
},
|
|
71
|
+
set current(next) {
|
|
72
|
+
views.current.value = next;
|
|
73
|
+
},
|
|
74
|
+
get items() {
|
|
75
|
+
return views.views.map((view) => ({ label: view.label(), value: view.key }));
|
|
76
|
+
}
|
|
77
|
+
})
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
return markRaw(api);
|
|
81
|
+
}
|
|
82
|
+
function scopeMembers(scope) {
|
|
83
|
+
return {
|
|
84
|
+
options: { enumerable: true, value: scope.paramScope.options },
|
|
85
|
+
params: { enumerable: true, value: scope.paramScope.values },
|
|
86
|
+
refresh: { enumerable: true, value: scope.refresh },
|
|
87
|
+
refreshing: { enumerable: true, get: () => scope.refreshing.value },
|
|
88
|
+
state: { enumerable: true, get: () => scope.state.value },
|
|
89
|
+
updatedAt: { enumerable: true, get: () => scope.updatedAt.value }
|
|
90
|
+
};
|
|
91
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ShallowRef } from 'vue';
|
|
2
|
+
import type { DashboardBlockActivation, DashboardBlockPhase, DashboardSourceLike } from '../types/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Non-visual block behaviour: reduces the source into one render phase, activates deferred sources
|
|
5
|
+
* (on mount or when the block nears the viewport), and resolves the grid placement.
|
|
6
|
+
*
|
|
7
|
+
* The phase is a branch, not a mask: while a block is `idle` or `loading`, its real values are not
|
|
8
|
+
* in the DOM at all, so nothing can flash through.
|
|
9
|
+
*/
|
|
10
|
+
export declare function useDashboardBlock(params: {
|
|
11
|
+
source: () => DashboardSourceLike | undefined;
|
|
12
|
+
empty: () => boolean;
|
|
13
|
+
activation: () => DashboardBlockActivation | undefined;
|
|
14
|
+
size: () => string | undefined;
|
|
15
|
+
rows: () => string | undefined;
|
|
16
|
+
root: Readonly<ShallowRef<HTMLElement | null>>;
|
|
17
|
+
}): {
|
|
18
|
+
phase: import("vue").ComputedRef<DashboardBlockPhase>;
|
|
19
|
+
refreshing: import("vue").ComputedRef<boolean>;
|
|
20
|
+
retry: () => void;
|
|
21
|
+
style: import("vue").ComputedRef<string>;
|
|
22
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { computed, onBeforeUnmount, onMounted } from "vue";
|
|
2
|
+
import { useResponsiveValue } from "../../shared/composables/use-responsive-value.js";
|
|
3
|
+
import { observeDashboardVisibility } from "../utils/visibility.js";
|
|
4
|
+
export function useDashboardBlock(params) {
|
|
5
|
+
const phase = computed(() => {
|
|
6
|
+
const source = params.source();
|
|
7
|
+
if (!source) return "content";
|
|
8
|
+
if (source.state !== "ready") return source.state;
|
|
9
|
+
return params.empty() ? "empty" : "content";
|
|
10
|
+
});
|
|
11
|
+
const refreshing = computed(() => params.source()?.refreshing ?? false);
|
|
12
|
+
const span = useResponsiveValue(() => params.size() ?? "", "col");
|
|
13
|
+
const rowSpan = useResponsiveValue(() => params.rows() ?? "", "row");
|
|
14
|
+
const style = computed(
|
|
15
|
+
() => [span.value ?? "grid-column: 1 / -1", rowSpan.value].filter(Boolean).join("; ")
|
|
16
|
+
);
|
|
17
|
+
let stopObserving;
|
|
18
|
+
onMounted(() => {
|
|
19
|
+
const source = params.source();
|
|
20
|
+
const activation = params.activation() ?? "visible";
|
|
21
|
+
if (!source || activation === "manual" || !waitsForActivation(source)) return;
|
|
22
|
+
const element = params.root.value;
|
|
23
|
+
if (activation === "mount" || !element || typeof IntersectionObserver === "undefined")
|
|
24
|
+
return source.activate();
|
|
25
|
+
stopObserving = observeDashboardVisibility(element, () => params.source()?.activate());
|
|
26
|
+
});
|
|
27
|
+
onBeforeUnmount(() => stopObserving?.());
|
|
28
|
+
function retry() {
|
|
29
|
+
params.source()?.refresh().catch(() => void 0);
|
|
30
|
+
}
|
|
31
|
+
return { phase, refreshing, retry, style };
|
|
32
|
+
}
|
|
33
|
+
function waitsForActivation(source) {
|
|
34
|
+
return !("stage" in source) || source.stage === "deferred";
|
|
35
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { LazyTextValue } from '../../shared/types/utils.js';
|
|
2
|
+
import type { DashboardAxisOptions, DashboardChartFrame, DashboardHighlight, DashboardReferenceLine, DashboardSelected, DashboardSelectEvent, DashboardSeries, DashboardValueFormat } from '../types/index.js';
|
|
3
|
+
/** A chart drawn taller in the expand dialog. */
|
|
4
|
+
export declare function resolveDashboardExpandedHeight(height: number): number;
|
|
5
|
+
/**
|
|
6
|
+
* Resolves chart inputs into one plain frame: normalized datums (series values by index), x labels,
|
|
7
|
+
* value domains with their ticks, and formatters. Rows and accessors are read once per data change;
|
|
8
|
+
* the renderer only receives the frame. Also provides the chart's table (menu actions) and maps
|
|
9
|
+
* renderer selections back to rows.
|
|
10
|
+
*/
|
|
11
|
+
export declare function useDashboardChart<TRow>(params: {
|
|
12
|
+
rows: () => readonly TRow[];
|
|
13
|
+
x: () => (row: TRow, index: number) => string | number | Date;
|
|
14
|
+
xFormat: () => ((value: string | number | Date) => string) | undefined;
|
|
15
|
+
/** Header of the category column in the table view. */
|
|
16
|
+
xLabel: () => LazyTextValue | undefined;
|
|
17
|
+
series: () => readonly DashboardSeries<TRow>[];
|
|
18
|
+
defaultType: 'bar' | 'line' | 'area';
|
|
19
|
+
yAxis: () => DashboardAxisOptions | undefined;
|
|
20
|
+
y2Axis?: () => DashboardAxisOptions | undefined;
|
|
21
|
+
references: () => DashboardReferenceLine | readonly DashboardReferenceLine[] | undefined;
|
|
22
|
+
stacked?: () => boolean;
|
|
23
|
+
format: () => DashboardValueFormat | undefined;
|
|
24
|
+
onSelect: () => ((event: DashboardSelectEvent<TRow>) => void) | undefined;
|
|
25
|
+
/** Bar charts: bars drawn at full strength, the others faded. */
|
|
26
|
+
highlight?: () => DashboardHighlight<TRow> | undefined;
|
|
27
|
+
selected?: () => DashboardSelected<TRow> | undefined;
|
|
28
|
+
/** Bar charts: prints each group's value above its bars. */
|
|
29
|
+
labels?: () => boolean;
|
|
30
|
+
}): {
|
|
31
|
+
frame: import("vue").ComputedRef<DashboardChartFrame>;
|
|
32
|
+
legend: import("vue").ComputedRef<import("../types/index.js").DashboardLegendItem[]>;
|
|
33
|
+
select: (index: number) => void;
|
|
34
|
+
selectable: import("vue").ComputedRef<boolean>;
|
|
35
|
+
tabulate: () => import("../types/index.js").DashboardDataTable;
|
|
36
|
+
};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { computed } from "vue";
|
|
2
|
+
import { useUiToolsLocale } from "../../i18n/use-locale.js";
|
|
3
|
+
import { isDate } from "../../shared/utils/predicate.js";
|
|
4
|
+
import { resolveTextValue } from "../../shared/utils/render.js";
|
|
5
|
+
import { tabulateDashboardFrame } from "../utils/chart-frame.js";
|
|
6
|
+
import {
|
|
7
|
+
resolveDashboardAxis,
|
|
8
|
+
resolveDashboardEmphasis,
|
|
9
|
+
resolveDashboardSeries,
|
|
10
|
+
toDashboardLegend
|
|
11
|
+
} from "../utils/charts.js";
|
|
12
|
+
import { useDashboardFormat } from "./use-dashboard-format.js";
|
|
13
|
+
export function resolveDashboardExpandedHeight(height) {
|
|
14
|
+
return Math.max(420, Math.round(height * 1.6));
|
|
15
|
+
}
|
|
16
|
+
export function useDashboardChart(params) {
|
|
17
|
+
const { t } = useUiToolsLocale();
|
|
18
|
+
const formats = useDashboardFormat();
|
|
19
|
+
const series = computed(
|
|
20
|
+
() => resolveDashboardSeries(
|
|
21
|
+
params.series(),
|
|
22
|
+
params.defaultType,
|
|
23
|
+
(label) => t("dashboard.compare.series", { label })
|
|
24
|
+
)
|
|
25
|
+
);
|
|
26
|
+
const legend = computed(
|
|
27
|
+
() => toDashboardLegend([
|
|
28
|
+
...series.value.filter((entry) => !entry.dashed),
|
|
29
|
+
...series.value.filter((entry) => entry.dashed)
|
|
30
|
+
])
|
|
31
|
+
);
|
|
32
|
+
const frame = computed(() => {
|
|
33
|
+
const rows = params.rows();
|
|
34
|
+
const accessor = params.x();
|
|
35
|
+
const formatX = params.xFormat();
|
|
36
|
+
const resolved = series.value;
|
|
37
|
+
const data = rows.map((row, index) => ({
|
|
38
|
+
index,
|
|
39
|
+
values: resolved.map((entry) => entry.value(row, index) ?? void 0)
|
|
40
|
+
}));
|
|
41
|
+
const xLabels = rows.map((row, index) => {
|
|
42
|
+
const value = accessor(row, index);
|
|
43
|
+
if (formatX) return formatX(value);
|
|
44
|
+
return isDate(value) ? value.toLocaleDateString() : String(value);
|
|
45
|
+
});
|
|
46
|
+
const stacked = params.stacked?.() ?? false;
|
|
47
|
+
const hasBars = resolved.some((entry) => entry.type === "bar");
|
|
48
|
+
const labels = hasBars && (params.labels?.() ?? false);
|
|
49
|
+
const headroom = labels ? 1.16 : hasBars ? 1.05 : 1.08;
|
|
50
|
+
const references = [params.references() ?? []].flat().map((reference) => ({
|
|
51
|
+
axis: reference.axis ?? "left",
|
|
52
|
+
label: resolveTextValue(reference.label, ""),
|
|
53
|
+
position: reference.position ?? "end",
|
|
54
|
+
value: reference.value
|
|
55
|
+
}));
|
|
56
|
+
const axisValues = (axis) => {
|
|
57
|
+
const indexes = resolved.flatMap((entry, index) => entry.axis === axis ? [index] : []);
|
|
58
|
+
const values = stacked && axis === "left" ? data.map((datum) => indexes.reduce((sum, index) => sum + (datum.values[index] ?? 0), 0)) : data.flatMap((datum) => indexes.map((index) => datum.values[index]));
|
|
59
|
+
return [...values, ...references.filter((ref) => ref.axis === axis).map((ref) => ref.value)];
|
|
60
|
+
};
|
|
61
|
+
const format = params.format() ?? formats.number.value;
|
|
62
|
+
const yAxis = params.yAxis();
|
|
63
|
+
const y2Axis = params.y2Axis?.();
|
|
64
|
+
const hasRight = resolved.some((entry) => entry.axis === "right");
|
|
65
|
+
const last = Math.max(0, data.length - 1);
|
|
66
|
+
const barIndexes = resolved.flatMap((entry, index) => entry.type === "bar" ? [index] : []);
|
|
67
|
+
const barValues = data.map((datum) => barIndexes.map((index) => datum.values[index] ?? 0));
|
|
68
|
+
const barTotals = barValues.map(
|
|
69
|
+
(values) => stacked ? values.reduce((sum, value) => sum + value, 0) : Math.max(0, ...values)
|
|
70
|
+
);
|
|
71
|
+
const selected = params.selected?.();
|
|
72
|
+
const emphasis = hasBars ? resolveDashboardEmphasis(rows, barTotals, params.highlight?.(), selected) : null;
|
|
73
|
+
const leftFormat = yAxis?.format ?? format;
|
|
74
|
+
return {
|
|
75
|
+
data,
|
|
76
|
+
emphasis,
|
|
77
|
+
labels: xLabels,
|
|
78
|
+
left: {
|
|
79
|
+
...resolveDashboardAxis(axisValues("left"), yAxis, headroom),
|
|
80
|
+
format: leftFormat
|
|
81
|
+
},
|
|
82
|
+
references,
|
|
83
|
+
right: hasRight ? {
|
|
84
|
+
...resolveDashboardAxis(axisValues("right"), y2Axis, headroom),
|
|
85
|
+
format: y2Axis?.format ?? format
|
|
86
|
+
} : null,
|
|
87
|
+
series: resolved.map(({ axis, color, dashed, key, label, type }, index) => ({
|
|
88
|
+
axis,
|
|
89
|
+
color,
|
|
90
|
+
dashed,
|
|
91
|
+
index,
|
|
92
|
+
key,
|
|
93
|
+
label,
|
|
94
|
+
type
|
|
95
|
+
})),
|
|
96
|
+
selection: selected ? rows.flatMap((row, index) => selected(row, index) ? [index] : []) : [],
|
|
97
|
+
stacked,
|
|
98
|
+
valueLabels: labels ? barTotals.map((value, index) => ({
|
|
99
|
+
index,
|
|
100
|
+
strong: emphasis?.[index] ?? false,
|
|
101
|
+
text: leftFormat(value),
|
|
102
|
+
value
|
|
103
|
+
})) : [],
|
|
104
|
+
// A single point still needs a non-empty domain, so it is centered like a bar slot.
|
|
105
|
+
xDomain: hasBars || last === 0 ? [-0.5, last + 0.5] : [0, last]
|
|
106
|
+
};
|
|
107
|
+
});
|
|
108
|
+
const tabulate = () => tabulateDashboardFrame(
|
|
109
|
+
frame.value,
|
|
110
|
+
resolveTextValue(params.xLabel(), t("dashboard.table.category"))
|
|
111
|
+
);
|
|
112
|
+
const selectable = computed(() => params.onSelect() !== void 0);
|
|
113
|
+
function select(index) {
|
|
114
|
+
const row = params.rows()[index];
|
|
115
|
+
if (row !== void 0) params.onSelect()?.({ index, row });
|
|
116
|
+
}
|
|
117
|
+
return { frame, legend, select, selectable, tabulate };
|
|
118
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { DashboardDerived } from '../types/index.js';
|
|
2
|
+
import type { DashboardReadTracker } from '../utils/tracker.js';
|
|
3
|
+
/**
|
|
4
|
+
* One `derive` entry. A single computed evaluates the value and records the sources it read; the
|
|
5
|
+
* derived state is the combined state of those sources, so a card bound to a derived value gets the
|
|
6
|
+
* same skeleton / error / refresh behaviour as a card bound to a query.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useDashboardDerived(params: {
|
|
9
|
+
id: string;
|
|
10
|
+
evaluate: () => unknown;
|
|
11
|
+
tracker: DashboardReadTracker;
|
|
12
|
+
}): DashboardDerived<unknown>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { computed, markRaw } from "vue";
|
|
2
|
+
import {
|
|
3
|
+
combineDashboardStates,
|
|
4
|
+
refreshDashboardSources,
|
|
5
|
+
resolveDashboardUpdatedAt
|
|
6
|
+
} from "../utils/state.js";
|
|
7
|
+
export function useDashboardDerived(params) {
|
|
8
|
+
const evaluation = computed(() => {
|
|
9
|
+
const reads = /* @__PURE__ */ new Set();
|
|
10
|
+
try {
|
|
11
|
+
const value = params.tracker.run(reads, params.evaluate);
|
|
12
|
+
return { error: void 0, sources: [...reads], value };
|
|
13
|
+
} catch (error) {
|
|
14
|
+
return { error, sources: [...reads], value: void 0 };
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
const sourcesState = computed(
|
|
18
|
+
() => combineDashboardStates(evaluation.value.sources.map((source) => source.state))
|
|
19
|
+
);
|
|
20
|
+
const state = computed(() => {
|
|
21
|
+
if (sourcesState.value !== "ready") return sourcesState.value;
|
|
22
|
+
return evaluation.value.error === void 0 ? "ready" : "error";
|
|
23
|
+
});
|
|
24
|
+
return markRaw({
|
|
25
|
+
activate() {
|
|
26
|
+
for (const source of evaluation.value.sources) source.activate();
|
|
27
|
+
},
|
|
28
|
+
get data() {
|
|
29
|
+
return evaluation.value.value;
|
|
30
|
+
},
|
|
31
|
+
get error() {
|
|
32
|
+
return evaluation.value.error ?? evaluation.value.sources.find((source) => source.state === "error")?.error;
|
|
33
|
+
},
|
|
34
|
+
id: params.id,
|
|
35
|
+
kind: "derived",
|
|
36
|
+
refresh: () => refreshDashboardSources(evaluation.value.sources),
|
|
37
|
+
get refreshing() {
|
|
38
|
+
return evaluation.value.sources.some((source) => source.refreshing);
|
|
39
|
+
},
|
|
40
|
+
get state() {
|
|
41
|
+
return state.value;
|
|
42
|
+
},
|
|
43
|
+
get updatedAt() {
|
|
44
|
+
return resolveDashboardUpdatedAt(evaluation.value.sources.map((source) => source.updatedAt));
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Locale-aware default formatters used when a block receives no explicit `format`. */
|
|
2
|
+
export declare function useDashboardFormat(): {
|
|
3
|
+
delta: import("vue").ComputedRef<import("../types/index.js").DashboardValueFormat>;
|
|
4
|
+
number: import("vue").ComputedRef<import("../types/index.js").DashboardValueFormat>;
|
|
5
|
+
percent: import("vue").ComputedRef<import("../types/index.js").DashboardValueFormat>;
|
|
6
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { computed } from "vue";
|
|
2
|
+
import { useUiToolsLocale } from "../../i18n/use-locale.js";
|
|
3
|
+
import { resolveDashboardFormats } from "../utils/charts.js";
|
|
4
|
+
export function useDashboardFormat() {
|
|
5
|
+
const { code } = useUiToolsLocale();
|
|
6
|
+
const formats = computed(() => resolveDashboardFormats(code.value));
|
|
7
|
+
return {
|
|
8
|
+
delta: computed(() => formats.value.delta),
|
|
9
|
+
number: computed(() => formats.value.number),
|
|
10
|
+
percent: computed(() => formats.value.percent)
|
|
11
|
+
};
|
|
12
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { QueryKey } from '@tanstack/vue-query';
|
|
2
|
+
import type { DashboardOptionsHandle, DashboardRuntimeParam } from '../types/index.js';
|
|
3
|
+
/** Option handle of one option-backed param: static items, or a remote source. */
|
|
4
|
+
export declare function useDashboardOptions(params: {
|
|
5
|
+
definition: DashboardRuntimeParam;
|
|
6
|
+
queryKey: QueryKey;
|
|
7
|
+
value: () => unknown;
|
|
8
|
+
}): DashboardOptionsHandle;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { computed, markRaw, shallowRef } from "vue";
|
|
2
|
+
import { useUiToolsLocale } from "../../i18n/use-locale.js";
|
|
3
|
+
import { resolveDashboardOptionValues } from "../utils/options.js";
|
|
4
|
+
import { useDashboardRemoteOptions } from "./use-dashboard-remote-options.js";
|
|
5
|
+
export function useDashboardOptions(params) {
|
|
6
|
+
const { definition } = params;
|
|
7
|
+
if (definition.remote)
|
|
8
|
+
return useDashboardRemoteOptions({
|
|
9
|
+
config: definition.remote,
|
|
10
|
+
queryKey: params.queryKey,
|
|
11
|
+
value: params.value
|
|
12
|
+
});
|
|
13
|
+
const items = definition.items ?? [];
|
|
14
|
+
if (definition.kind !== "comparison") return createStaticOptionsHandle(() => items, params.value);
|
|
15
|
+
const { t } = useUiToolsLocale();
|
|
16
|
+
const localized = computed(
|
|
17
|
+
() => items.map((item) => ({ ...item, label: t(`dashboard.compare.${String(item.value)}`) }))
|
|
18
|
+
);
|
|
19
|
+
return createStaticOptionsHandle(() => localized.value, params.value);
|
|
20
|
+
}
|
|
21
|
+
function createStaticOptionsHandle(items, value) {
|
|
22
|
+
const search = shallowRef("");
|
|
23
|
+
const open = shallowRef(false);
|
|
24
|
+
const byValue = computed(() => new Map(items().map((item) => [String(item.value), item])));
|
|
25
|
+
const selected = computed(
|
|
26
|
+
() => resolveDashboardOptionValues(value()).flatMap((entry) => byValue.value.get(entry) ?? [])
|
|
27
|
+
);
|
|
28
|
+
const menu = computed(() => ({
|
|
29
|
+
items: [...items()],
|
|
30
|
+
labelKey: "label",
|
|
31
|
+
valueKey: "value"
|
|
32
|
+
}));
|
|
33
|
+
return markRaw({
|
|
34
|
+
error: void 0,
|
|
35
|
+
hasMore: false,
|
|
36
|
+
get items() {
|
|
37
|
+
return items();
|
|
38
|
+
},
|
|
39
|
+
loading: false,
|
|
40
|
+
loadingMore: false,
|
|
41
|
+
loadMore() {
|
|
42
|
+
},
|
|
43
|
+
get menu() {
|
|
44
|
+
return menu.value;
|
|
45
|
+
},
|
|
46
|
+
get open() {
|
|
47
|
+
return open.value;
|
|
48
|
+
},
|
|
49
|
+
set open(next) {
|
|
50
|
+
open.value = next;
|
|
51
|
+
},
|
|
52
|
+
refresh: () => Promise.resolve(),
|
|
53
|
+
get search() {
|
|
54
|
+
return search.value;
|
|
55
|
+
},
|
|
56
|
+
set search(next) {
|
|
57
|
+
search.value = next;
|
|
58
|
+
},
|
|
59
|
+
get selected() {
|
|
60
|
+
return selected.value;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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;
|
|
@@ -0,0 +1,71 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { QueryKey } from '@tanstack/vue-query';
|
|
2
|
+
import type { DashboardOptionsHandle, DashboardRemoteOptionsConfig } from '../types/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Remote option handle. Nothing loads until the picker opens or a search term is typed; pages are
|
|
5
|
+
* cached per search term by TanStack Query, and selected values missing from the loaded pages are
|
|
6
|
+
* hydrated through `resolveSelected` so URL-restored ids render their labels.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useDashboardRemoteOptions(params: {
|
|
9
|
+
config: DashboardRemoteOptionsConfig;
|
|
10
|
+
queryKey: QueryKey;
|
|
11
|
+
value: () => unknown;
|
|
12
|
+
}): DashboardOptionsHandle;
|