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,52 @@
|
|
|
1
|
+
import type { LazyTextValue } from '#ui-tools/shared/types/utils';
|
|
2
|
+
import type { DashboardAxisOptions, DashboardBlockBaseProps, DashboardHighlight, DashboardReferenceLine, DashboardSelected, DashboardSelectEvent, DashboardSeries, DashboardSourceLike, DashboardValueFormat } from '../types/index.js';
|
|
3
|
+
declare const __VLS_export: <TRow>(__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<{
|
|
4
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<DashboardBlockBaseProps & {
|
|
5
|
+
source: DashboardSourceLike<readonly TRow[] | undefined>;
|
|
6
|
+
x: (row: TRow, index: number) => string | number | Date;
|
|
7
|
+
xFormat?: (value: string | number | Date) => string;
|
|
8
|
+
/** Header of the category column in the table view and CSV export. */
|
|
9
|
+
xLabel?: LazyTextValue;
|
|
10
|
+
/**
|
|
11
|
+
* Mixed series: each one declares `type` (`'bar'` by default, `'line'`, `'area'`) and `axis`
|
|
12
|
+
* (`'left'` by default, `'right'` for the secondary value axis).
|
|
13
|
+
*/
|
|
14
|
+
series: readonly DashboardSeries<TRow>[];
|
|
15
|
+
yAxis?: DashboardAxisOptions;
|
|
16
|
+
/** Secondary (right) value axis. */
|
|
17
|
+
y2Axis?: DashboardAxisOptions;
|
|
18
|
+
format?: DashboardValueFormat;
|
|
19
|
+
reference?: DashboardReferenceLine | readonly DashboardReferenceLine[];
|
|
20
|
+
height?: number;
|
|
21
|
+
legend?: boolean;
|
|
22
|
+
/** Expected number of x positions, drawn by the loading skeleton before data arrives. */
|
|
23
|
+
points?: number;
|
|
24
|
+
/** Bars drawn at full strength (`max`, `min`, `last`, or an accessor); the others fade. */
|
|
25
|
+
highlight?: DashboardHighlight<TRow>;
|
|
26
|
+
/** Rows shown as selected: their bars stay, the others fade (wins over `highlight`). */
|
|
27
|
+
selected?: DashboardSelected<TRow>;
|
|
28
|
+
/** Prints each group's value above its bars (the stack total when `stacked`). */
|
|
29
|
+
labels?: boolean;
|
|
30
|
+
/** A click on the chart selects the x position under the pointer. */
|
|
31
|
+
onSelect?: (event: DashboardSelectEvent<TRow>) => void;
|
|
32
|
+
}> & (typeof globalThis extends {
|
|
33
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
34
|
+
} ? P : {});
|
|
35
|
+
expose: (exposed: {}) => void;
|
|
36
|
+
attrs: any;
|
|
37
|
+
slots: {
|
|
38
|
+
'header-right'?: () => unknown;
|
|
39
|
+
toolbar?: () => unknown;
|
|
40
|
+
footer?: () => unknown;
|
|
41
|
+
};
|
|
42
|
+
emit: {};
|
|
43
|
+
}>) => import("vue").VNode & {
|
|
44
|
+
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
45
|
+
};
|
|
46
|
+
declare const _default: typeof __VLS_export;
|
|
47
|
+
export default _default;
|
|
48
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
49
|
+
[K in keyof T]: T[K];
|
|
50
|
+
} : {
|
|
51
|
+
[K in keyof T as K]: T[K];
|
|
52
|
+
}) & {};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useMounted } from "@vueuse/core";
|
|
3
|
+
import { computed } from "vue";
|
|
4
|
+
import {
|
|
5
|
+
resolveDashboardExpandedHeight,
|
|
6
|
+
useDashboardChart
|
|
7
|
+
} from "../composables/use-dashboard-chart";
|
|
8
|
+
import DashboardSkeleton from "./block/dashboard-skeleton.vue";
|
|
9
|
+
import { dashboardChartRenderer } from "./charts/renderer";
|
|
10
|
+
import DashboardCard from "./dashboard-card.vue";
|
|
11
|
+
const {
|
|
12
|
+
source,
|
|
13
|
+
card = true,
|
|
14
|
+
menu = void 0,
|
|
15
|
+
freshness = void 0,
|
|
16
|
+
x,
|
|
17
|
+
xFormat,
|
|
18
|
+
xLabel,
|
|
19
|
+
series,
|
|
20
|
+
yAxis,
|
|
21
|
+
y2Axis,
|
|
22
|
+
format,
|
|
23
|
+
reference,
|
|
24
|
+
height = 250,
|
|
25
|
+
legend = true,
|
|
26
|
+
points = 12,
|
|
27
|
+
highlight,
|
|
28
|
+
selected,
|
|
29
|
+
labels = false,
|
|
30
|
+
onSelect,
|
|
31
|
+
...block
|
|
32
|
+
} = defineProps({
|
|
33
|
+
title: { type: [String, Number, Function], required: false },
|
|
34
|
+
subtitle: { type: [String, Number, Function], required: false },
|
|
35
|
+
size: { type: String, required: false },
|
|
36
|
+
rows: { type: String, required: false },
|
|
37
|
+
card: { type: Boolean, required: false },
|
|
38
|
+
activation: { type: String, required: false },
|
|
39
|
+
empty: { type: Object, required: false },
|
|
40
|
+
menu: { type: [Boolean, Array, Function], required: false },
|
|
41
|
+
actions: { type: Array, required: false },
|
|
42
|
+
freshness: { type: Boolean, required: false },
|
|
43
|
+
ui: { type: Object, required: false },
|
|
44
|
+
source: { type: Object, required: true },
|
|
45
|
+
x: { type: Function, required: true },
|
|
46
|
+
xFormat: { type: Function, required: false },
|
|
47
|
+
xLabel: { type: [String, Number, Function], required: false },
|
|
48
|
+
series: { type: Array, required: true },
|
|
49
|
+
yAxis: { type: Object, required: false },
|
|
50
|
+
y2Axis: { type: Object, required: false },
|
|
51
|
+
format: { type: Function, required: false },
|
|
52
|
+
reference: { type: [Object, Array], required: false },
|
|
53
|
+
height: { type: Number, required: false },
|
|
54
|
+
legend: { type: Boolean, required: false },
|
|
55
|
+
points: { type: Number, required: false },
|
|
56
|
+
highlight: { type: [String, Function], required: false },
|
|
57
|
+
selected: { type: Function, required: false },
|
|
58
|
+
labels: { type: Boolean, required: false },
|
|
59
|
+
onSelect: { type: Function, required: false }
|
|
60
|
+
});
|
|
61
|
+
defineSlots();
|
|
62
|
+
const mounted = useMounted();
|
|
63
|
+
const seed = computed(() => series.map((entry) => entry.key).join("|"));
|
|
64
|
+
const skeletonSeries = computed(
|
|
65
|
+
() => series.filter((entry) => (entry.type ?? "bar") === "bar").length
|
|
66
|
+
);
|
|
67
|
+
const skeletonPoints = computed(() => source.data?.length || points);
|
|
68
|
+
const chart = useDashboardChart({
|
|
69
|
+
defaultType: "bar",
|
|
70
|
+
format: () => format,
|
|
71
|
+
highlight: () => highlight,
|
|
72
|
+
labels: () => labels,
|
|
73
|
+
onSelect: () => onSelect,
|
|
74
|
+
references: () => reference,
|
|
75
|
+
rows: () => source.data ?? [],
|
|
76
|
+
selected: () => selected,
|
|
77
|
+
series: () => series,
|
|
78
|
+
x: () => x,
|
|
79
|
+
xFormat: () => xFormat,
|
|
80
|
+
xLabel: () => xLabel,
|
|
81
|
+
y2Axis: () => y2Axis,
|
|
82
|
+
yAxis: () => yAxis
|
|
83
|
+
});
|
|
84
|
+
</script>
|
|
85
|
+
|
|
86
|
+
<template>
|
|
87
|
+
<DashboardCard
|
|
88
|
+
v-bind="block"
|
|
89
|
+
:card
|
|
90
|
+
:menu
|
|
91
|
+
:freshness
|
|
92
|
+
:source
|
|
93
|
+
:legend="legend ? chart.legend.value : void 0"
|
|
94
|
+
:is-empty="chart.frame.value.data.length === 0 || chart.frame.value.series.length === 0"
|
|
95
|
+
:tabulate="chart.tabulate"
|
|
96
|
+
>
|
|
97
|
+
<template #skeleton>
|
|
98
|
+
<DashboardSkeleton
|
|
99
|
+
kind="bars"
|
|
100
|
+
:height
|
|
101
|
+
:series="skeletonSeries"
|
|
102
|
+
:count="skeletonPoints"
|
|
103
|
+
:seed
|
|
104
|
+
/>
|
|
105
|
+
</template>
|
|
106
|
+
<template v-if="$slots['header-right']" #header-right>
|
|
107
|
+
<slot name="header-right" />
|
|
108
|
+
</template>
|
|
109
|
+
<template v-if="$slots.toolbar" #toolbar>
|
|
110
|
+
<slot name="toolbar" />
|
|
111
|
+
</template>
|
|
112
|
+
<template v-if="$slots.footer" #footer>
|
|
113
|
+
<slot name="footer" />
|
|
114
|
+
</template>
|
|
115
|
+
|
|
116
|
+
<template #default="{ expanded }">
|
|
117
|
+
<component
|
|
118
|
+
:is="dashboardChartRenderer.xy"
|
|
119
|
+
v-if="mounted"
|
|
120
|
+
:frame="chart.frame.value"
|
|
121
|
+
:height="expanded ? resolveDashboardExpandedHeight(height) : height"
|
|
122
|
+
:selectable="chart.selectable.value"
|
|
123
|
+
@select="chart.select"
|
|
124
|
+
/>
|
|
125
|
+
<div v-else aria-hidden="true" :style="{ height: `${height}px` }" />
|
|
126
|
+
</template>
|
|
127
|
+
</DashboardCard>
|
|
128
|
+
</template>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { LazyTextValue } from '#ui-tools/shared/types/utils';
|
|
2
|
+
import type { DashboardAxisOptions, DashboardBlockBaseProps, DashboardHighlight, DashboardReferenceLine, DashboardSelected, DashboardSelectEvent, DashboardSeries, DashboardSourceLike, DashboardValueFormat } from '../types/index.js';
|
|
3
|
+
declare const __VLS_export: <TRow>(__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<{
|
|
4
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<DashboardBlockBaseProps & {
|
|
5
|
+
source: DashboardSourceLike<readonly TRow[] | undefined>;
|
|
6
|
+
x: (row: TRow, index: number) => string | number | Date;
|
|
7
|
+
xFormat?: (value: string | number | Date) => string;
|
|
8
|
+
/** Header of the category column in the table view and CSV export. */
|
|
9
|
+
xLabel?: LazyTextValue;
|
|
10
|
+
/**
|
|
11
|
+
* Mixed series: each one declares `type` (`'bar'` by default, `'line'`, `'area'`) and `axis`
|
|
12
|
+
* (`'left'` by default, `'right'` for the secondary value axis).
|
|
13
|
+
*/
|
|
14
|
+
series: readonly DashboardSeries<TRow>[];
|
|
15
|
+
yAxis?: DashboardAxisOptions;
|
|
16
|
+
/** Secondary (right) value axis. */
|
|
17
|
+
y2Axis?: DashboardAxisOptions;
|
|
18
|
+
format?: DashboardValueFormat;
|
|
19
|
+
reference?: DashboardReferenceLine | readonly DashboardReferenceLine[];
|
|
20
|
+
height?: number;
|
|
21
|
+
legend?: boolean;
|
|
22
|
+
/** Expected number of x positions, drawn by the loading skeleton before data arrives. */
|
|
23
|
+
points?: number;
|
|
24
|
+
/** Bars drawn at full strength (`max`, `min`, `last`, or an accessor); the others fade. */
|
|
25
|
+
highlight?: DashboardHighlight<TRow>;
|
|
26
|
+
/** Rows shown as selected: their bars stay, the others fade (wins over `highlight`). */
|
|
27
|
+
selected?: DashboardSelected<TRow>;
|
|
28
|
+
/** Prints each group's value above its bars (the stack total when `stacked`). */
|
|
29
|
+
labels?: boolean;
|
|
30
|
+
/** A click on the chart selects the x position under the pointer. */
|
|
31
|
+
onSelect?: (event: DashboardSelectEvent<TRow>) => void;
|
|
32
|
+
}> & (typeof globalThis extends {
|
|
33
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
34
|
+
} ? P : {});
|
|
35
|
+
expose: (exposed: {}) => void;
|
|
36
|
+
attrs: any;
|
|
37
|
+
slots: {
|
|
38
|
+
'header-right'?: () => unknown;
|
|
39
|
+
toolbar?: () => unknown;
|
|
40
|
+
footer?: () => unknown;
|
|
41
|
+
};
|
|
42
|
+
emit: {};
|
|
43
|
+
}>) => import("vue").VNode & {
|
|
44
|
+
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
45
|
+
};
|
|
46
|
+
declare const _default: typeof __VLS_export;
|
|
47
|
+
export default _default;
|
|
48
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
49
|
+
[K in keyof T]: T[K];
|
|
50
|
+
} : {
|
|
51
|
+
[K in keyof T as K]: T[K];
|
|
52
|
+
}) & {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { LazyTextValue } from '#ui-tools/shared/types/utils';
|
|
2
|
+
import type { DashboardBlockBaseProps, DashboardBlockUi, DashboardDonutUi, DashboardSelected, DashboardSelectEvent, DashboardSeriesColor, DashboardSourceLike } from '../types/index.js';
|
|
3
|
+
declare const __VLS_export: <TRow>(__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<{
|
|
4
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<Omit<DashboardBlockBaseProps, "ui"> & {
|
|
5
|
+
source: DashboardSourceLike<readonly TRow[] | undefined>;
|
|
6
|
+
label: (row: TRow) => LazyTextValue;
|
|
7
|
+
value: (row: TRow) => number;
|
|
8
|
+
color?: (row: TRow, index: number) => DashboardSeriesColor | undefined;
|
|
9
|
+
/** Legend value text. Defaults to the share in percent. */
|
|
10
|
+
text?: (row: TRow, share: number) => LazyTextValue;
|
|
11
|
+
/** Big value in the middle of the ring. Numbers go through the locale number format. */
|
|
12
|
+
center?: (rows: readonly TRow[]) => LazyTextValue;
|
|
13
|
+
centerLabel?: LazyTextValue;
|
|
14
|
+
/** `side`: legend next to the ring. `stacked`: ring centered above the legend. */
|
|
15
|
+
layout?: "side" | "stacked";
|
|
16
|
+
/** Legend columns of the `stacked` layout. */
|
|
17
|
+
legendColumns?: 1 | 2;
|
|
18
|
+
/** Ring diameter in pixels. */
|
|
19
|
+
diameter?: number;
|
|
20
|
+
thickness?: number;
|
|
21
|
+
/** Space between segments, in pixels along the ring. */
|
|
22
|
+
gap?: number;
|
|
23
|
+
/** Segments shown as selected: the others fade. */
|
|
24
|
+
selected?: DashboardSelected<TRow>;
|
|
25
|
+
/** Makes each segment and legend entry selectable. */
|
|
26
|
+
onSelect?: (event: DashboardSelectEvent<TRow>) => void;
|
|
27
|
+
ui?: DashboardBlockUi & DashboardDonutUi;
|
|
28
|
+
}> & (typeof globalThis extends {
|
|
29
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
30
|
+
} ? P : {});
|
|
31
|
+
expose: (exposed: {}) => void;
|
|
32
|
+
attrs: any;
|
|
33
|
+
slots: {
|
|
34
|
+
'header-right'?: () => unknown;
|
|
35
|
+
toolbar?: () => unknown;
|
|
36
|
+
footer?: () => unknown;
|
|
37
|
+
};
|
|
38
|
+
emit: {};
|
|
39
|
+
}>) => import("vue").VNode & {
|
|
40
|
+
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
41
|
+
};
|
|
42
|
+
declare const _default: typeof __VLS_export;
|
|
43
|
+
export default _default;
|
|
44
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
45
|
+
[K in keyof T]: T[K];
|
|
46
|
+
} : {
|
|
47
|
+
[K in keyof T as K]: T[K];
|
|
48
|
+
}) & {};
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useMounted } from "@vueuse/core";
|
|
3
|
+
import { computed } from "vue";
|
|
4
|
+
import { useUiToolsLocale } from "#ui-tools/i18n";
|
|
5
|
+
import { isNumber } from "#ui-tools/shared/utils/predicate";
|
|
6
|
+
import { resolveTextValue } from "#ui-tools/shared/utils/render";
|
|
7
|
+
import { useDashboardFormat } from "../composables/use-dashboard-format";
|
|
8
|
+
import { useDashboardUi } from "../composables/use-dashboard-ui";
|
|
9
|
+
import { fadeDashboardColor, resolveDashboardColor } from "../utils/charts";
|
|
10
|
+
import { toDashboardCell } from "../utils/export";
|
|
11
|
+
import {
|
|
12
|
+
DASHBOARD_ROW_BUTTON,
|
|
13
|
+
DASHBOARD_SELECTABLE_ROW,
|
|
14
|
+
resolveDashboardClasses
|
|
15
|
+
} from "../utils/ui";
|
|
16
|
+
import DashboardSkeleton from "./block/dashboard-skeleton.vue";
|
|
17
|
+
import { dashboardChartRenderer } from "./charts/renderer";
|
|
18
|
+
import DashboardCard from "./dashboard-card.vue";
|
|
19
|
+
const {
|
|
20
|
+
source,
|
|
21
|
+
card = true,
|
|
22
|
+
menu = void 0,
|
|
23
|
+
freshness = void 0,
|
|
24
|
+
label,
|
|
25
|
+
value,
|
|
26
|
+
color,
|
|
27
|
+
text,
|
|
28
|
+
center,
|
|
29
|
+
centerLabel,
|
|
30
|
+
layout = "side",
|
|
31
|
+
legendColumns = 1,
|
|
32
|
+
diameter = 150,
|
|
33
|
+
thickness = 14,
|
|
34
|
+
gap = 3,
|
|
35
|
+
selected,
|
|
36
|
+
onSelect,
|
|
37
|
+
ui,
|
|
38
|
+
...block
|
|
39
|
+
} = defineProps({
|
|
40
|
+
title: { type: [String, Number, Function], required: false },
|
|
41
|
+
subtitle: { type: [String, Number, Function], required: false },
|
|
42
|
+
size: { type: String, required: false },
|
|
43
|
+
rows: { type: String, required: false },
|
|
44
|
+
card: { type: Boolean, required: false },
|
|
45
|
+
activation: { type: String, required: false },
|
|
46
|
+
empty: { type: Object, required: false },
|
|
47
|
+
menu: { type: [Boolean, Array, Function], required: false },
|
|
48
|
+
actions: { type: Array, required: false },
|
|
49
|
+
freshness: { type: Boolean, required: false },
|
|
50
|
+
source: { type: Object, required: true },
|
|
51
|
+
label: { type: Function, required: true },
|
|
52
|
+
value: { type: Function, required: true },
|
|
53
|
+
color: { type: Function, required: false },
|
|
54
|
+
text: { type: Function, required: false },
|
|
55
|
+
center: { type: Function, required: false },
|
|
56
|
+
centerLabel: { type: [String, Number, Function], required: false },
|
|
57
|
+
layout: { type: String, required: false },
|
|
58
|
+
legendColumns: { type: Number, required: false },
|
|
59
|
+
diameter: { type: Number, required: false },
|
|
60
|
+
thickness: { type: Number, required: false },
|
|
61
|
+
gap: { type: Number, required: false },
|
|
62
|
+
selected: { type: Function, required: false },
|
|
63
|
+
onSelect: { type: Function, required: false },
|
|
64
|
+
ui: { type: Object, required: false }
|
|
65
|
+
});
|
|
66
|
+
defineSlots();
|
|
67
|
+
const { t } = useUiToolsLocale();
|
|
68
|
+
const mounted = useMounted();
|
|
69
|
+
const formats = useDashboardFormat();
|
|
70
|
+
const appUi = useDashboardUi();
|
|
71
|
+
const classes = computed(
|
|
72
|
+
() => resolveDashboardClasses(
|
|
73
|
+
{
|
|
74
|
+
center: "block text-[22px] leading-tight font-semibold tracking-[-0.02em] text-highlighted tabular-nums",
|
|
75
|
+
centerLabel: "text-[11.5px] text-muted",
|
|
76
|
+
item: "flex min-w-0 items-center gap-2",
|
|
77
|
+
legend: layout === "stacked" ? `grid w-full gap-x-4 gap-y-2 text-[13px] ${legendColumns === 2 ? "grid-cols-2" : "grid-cols-1"}` : "flex min-w-40 flex-1 flex-col gap-2 text-[13px]"
|
|
78
|
+
},
|
|
79
|
+
appUi.value.donut,
|
|
80
|
+
ui
|
|
81
|
+
)
|
|
82
|
+
);
|
|
83
|
+
const rows = computed(() => source.data ?? []);
|
|
84
|
+
const segments = computed(() => {
|
|
85
|
+
const values = rows.value.map((row) => value(row));
|
|
86
|
+
const total = values.reduce((sum, amount) => sum + amount, 0);
|
|
87
|
+
const picked = rows.value.map((row, index) => selected?.(row, index) ?? false);
|
|
88
|
+
const anyPicked = picked.includes(true);
|
|
89
|
+
return rows.value.map((row, index) => {
|
|
90
|
+
const amount = values[index] ?? 0;
|
|
91
|
+
const share = total > 0 ? amount / total * 100 : 0;
|
|
92
|
+
const base = resolveDashboardColor(color?.(row, index), index);
|
|
93
|
+
const faded = anyPicked && !picked[index];
|
|
94
|
+
return {
|
|
95
|
+
color: faded ? fadeDashboardColor(base) : base,
|
|
96
|
+
faded,
|
|
97
|
+
index,
|
|
98
|
+
label: resolveTextValue(label(row)),
|
|
99
|
+
row,
|
|
100
|
+
selected: picked[index] ?? false,
|
|
101
|
+
share,
|
|
102
|
+
swatch: base,
|
|
103
|
+
text: text ? resolveTextValue(text(row, share)) : formats.percent.value(share),
|
|
104
|
+
value: amount
|
|
105
|
+
};
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
const padAngle = computed(() => gap / Math.max(1, (diameter - thickness) / 2));
|
|
109
|
+
const centerText = computed(() => {
|
|
110
|
+
if (!center) return "";
|
|
111
|
+
const resolved = center(rows.value);
|
|
112
|
+
return isNumber(resolved) ? formats.number.value(resolved) : resolveTextValue(resolved);
|
|
113
|
+
});
|
|
114
|
+
function select(index) {
|
|
115
|
+
const segment = segments.value[index];
|
|
116
|
+
if (segment) onSelect?.({ index, row: segment.row });
|
|
117
|
+
}
|
|
118
|
+
function tabulate() {
|
|
119
|
+
return {
|
|
120
|
+
columns: [
|
|
121
|
+
{ key: "label", label: t("dashboard.table.label"), numeric: false },
|
|
122
|
+
{ key: "value", label: t("dashboard.table.value"), numeric: true },
|
|
123
|
+
{ key: "share", label: t("dashboard.table.share"), numeric: true }
|
|
124
|
+
],
|
|
125
|
+
rows: segments.value.map((segment) => [
|
|
126
|
+
toDashboardCell(segment.label),
|
|
127
|
+
toDashboardCell(segment.value, formats.number.value(segment.value)),
|
|
128
|
+
toDashboardCell(Math.round(segment.share * 10) / 10, formats.percent.value(segment.share))
|
|
129
|
+
])
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
</script>
|
|
133
|
+
|
|
134
|
+
<template>
|
|
135
|
+
<DashboardCard
|
|
136
|
+
v-bind="block"
|
|
137
|
+
:card
|
|
138
|
+
:menu
|
|
139
|
+
:freshness
|
|
140
|
+
:ui
|
|
141
|
+
:source
|
|
142
|
+
:is-empty="segments.length === 0"
|
|
143
|
+
:tabulate
|
|
144
|
+
>
|
|
145
|
+
<template #skeleton>
|
|
146
|
+
<DashboardSkeleton kind="donut" :layout :diameter />
|
|
147
|
+
</template>
|
|
148
|
+
<template v-if="$slots['header-right']" #header-right>
|
|
149
|
+
<slot name="header-right" />
|
|
150
|
+
</template>
|
|
151
|
+
<template v-if="$slots.toolbar" #toolbar>
|
|
152
|
+
<slot name="toolbar" />
|
|
153
|
+
</template>
|
|
154
|
+
<template v-if="$slots.footer" #footer>
|
|
155
|
+
<slot name="footer" />
|
|
156
|
+
</template>
|
|
157
|
+
|
|
158
|
+
<div
|
|
159
|
+
:class="
|
|
160
|
+
layout === 'stacked' ? 'flex flex-col items-center gap-[18px]' : 'flex flex-wrap items-center gap-[18px]'
|
|
161
|
+
"
|
|
162
|
+
>
|
|
163
|
+
<div class="relative shrink-0" :style="{ height: `${diameter}px`, width: `${diameter}px` }">
|
|
164
|
+
<component
|
|
165
|
+
:is="dashboardChartRenderer.donut"
|
|
166
|
+
v-if="mounted"
|
|
167
|
+
:segments
|
|
168
|
+
:size="diameter"
|
|
169
|
+
:thickness
|
|
170
|
+
:pad-angle="padAngle"
|
|
171
|
+
:selectable="Boolean(onSelect)"
|
|
172
|
+
@select="select"
|
|
173
|
+
/>
|
|
174
|
+
<div
|
|
175
|
+
v-if="centerText || centerLabel"
|
|
176
|
+
class="pointer-events-none absolute inset-0 grid place-items-center text-center"
|
|
177
|
+
>
|
|
178
|
+
<div>
|
|
179
|
+
<b :class="classes.center">{{ centerText }}</b>
|
|
180
|
+
<small v-if="centerLabel" :class="classes.centerLabel">
|
|
181
|
+
{{ resolveTextValue(centerLabel) }}
|
|
182
|
+
</small>
|
|
183
|
+
</div>
|
|
184
|
+
</div>
|
|
185
|
+
</div>
|
|
186
|
+
<ul :class="classes.legend">
|
|
187
|
+
<li
|
|
188
|
+
v-for="segment in segments"
|
|
189
|
+
:key="segment.index"
|
|
190
|
+
:data-selected="segment.selected || void 0"
|
|
191
|
+
:class="[
|
|
192
|
+
classes.item,
|
|
193
|
+
onSelect && DASHBOARD_SELECTABLE_ROW,
|
|
194
|
+
segment.faded && 'opacity-55'
|
|
195
|
+
]"
|
|
196
|
+
>
|
|
197
|
+
<span
|
|
198
|
+
aria-hidden="true"
|
|
199
|
+
class="size-[9px] shrink-0 rounded-[3px]"
|
|
200
|
+
:style="{ background: segment.swatch }"
|
|
201
|
+
/>
|
|
202
|
+
<span class="min-w-0 flex-1 truncate text-muted">{{ segment.label }}</span>
|
|
203
|
+
<b class="shrink-0 font-semibold text-highlighted tabular-nums">{{ segment.text }}</b>
|
|
204
|
+
<button
|
|
205
|
+
v-if="onSelect"
|
|
206
|
+
type="button"
|
|
207
|
+
:class="DASHBOARD_ROW_BUTTON"
|
|
208
|
+
:aria-label="segment.label"
|
|
209
|
+
:aria-pressed="selected ? segment.selected : void 0"
|
|
210
|
+
@click="select(segment.index)"
|
|
211
|
+
/>
|
|
212
|
+
</li>
|
|
213
|
+
</ul>
|
|
214
|
+
</div>
|
|
215
|
+
</DashboardCard>
|
|
216
|
+
</template>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { LazyTextValue } from '#ui-tools/shared/types/utils';
|
|
2
|
+
import type { DashboardBlockBaseProps, DashboardBlockUi, DashboardDonutUi, DashboardSelected, DashboardSelectEvent, DashboardSeriesColor, DashboardSourceLike } from '../types/index.js';
|
|
3
|
+
declare const __VLS_export: <TRow>(__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<{
|
|
4
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<Omit<DashboardBlockBaseProps, "ui"> & {
|
|
5
|
+
source: DashboardSourceLike<readonly TRow[] | undefined>;
|
|
6
|
+
label: (row: TRow) => LazyTextValue;
|
|
7
|
+
value: (row: TRow) => number;
|
|
8
|
+
color?: (row: TRow, index: number) => DashboardSeriesColor | undefined;
|
|
9
|
+
/** Legend value text. Defaults to the share in percent. */
|
|
10
|
+
text?: (row: TRow, share: number) => LazyTextValue;
|
|
11
|
+
/** Big value in the middle of the ring. Numbers go through the locale number format. */
|
|
12
|
+
center?: (rows: readonly TRow[]) => LazyTextValue;
|
|
13
|
+
centerLabel?: LazyTextValue;
|
|
14
|
+
/** `side`: legend next to the ring. `stacked`: ring centered above the legend. */
|
|
15
|
+
layout?: "side" | "stacked";
|
|
16
|
+
/** Legend columns of the `stacked` layout. */
|
|
17
|
+
legendColumns?: 1 | 2;
|
|
18
|
+
/** Ring diameter in pixels. */
|
|
19
|
+
diameter?: number;
|
|
20
|
+
thickness?: number;
|
|
21
|
+
/** Space between segments, in pixels along the ring. */
|
|
22
|
+
gap?: number;
|
|
23
|
+
/** Segments shown as selected: the others fade. */
|
|
24
|
+
selected?: DashboardSelected<TRow>;
|
|
25
|
+
/** Makes each segment and legend entry selectable. */
|
|
26
|
+
onSelect?: (event: DashboardSelectEvent<TRow>) => void;
|
|
27
|
+
ui?: DashboardBlockUi & DashboardDonutUi;
|
|
28
|
+
}> & (typeof globalThis extends {
|
|
29
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
30
|
+
} ? P : {});
|
|
31
|
+
expose: (exposed: {}) => void;
|
|
32
|
+
attrs: any;
|
|
33
|
+
slots: {
|
|
34
|
+
'header-right'?: () => unknown;
|
|
35
|
+
toolbar?: () => unknown;
|
|
36
|
+
footer?: () => unknown;
|
|
37
|
+
};
|
|
38
|
+
emit: {};
|
|
39
|
+
}>) => import("vue").VNode & {
|
|
40
|
+
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
41
|
+
};
|
|
42
|
+
declare const _default: typeof __VLS_export;
|
|
43
|
+
export default _default;
|
|
44
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
45
|
+
[K in keyof T]: T[K];
|
|
46
|
+
} : {
|
|
47
|
+
[K in keyof T as K]: T[K];
|
|
48
|
+
}) & {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { LazyTextValue } from '#ui-tools/shared/types/utils';
|
|
2
|
+
import type { DashboardBlockBaseProps, DashboardBlockUi, DashboardFeedUi, DashboardRowActions, DashboardSelected, DashboardSelectEvent, DashboardSeriesColor, DashboardSourceLike, DashboardTimeValue } from '../types/index.js';
|
|
3
|
+
declare const __VLS_export: <TRow>(__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<{
|
|
4
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<Omit<DashboardBlockBaseProps, "ui"> & {
|
|
5
|
+
source: DashboardSourceLike<readonly TRow[] | undefined>;
|
|
6
|
+
/** What happened. */
|
|
7
|
+
label: (row: TRow) => LazyTextValue;
|
|
8
|
+
description?: (row: TRow) => LazyTextValue | undefined;
|
|
9
|
+
/** When it happened: a `Date`, epoch milliseconds, or an ISO string. Shown relative to now. */
|
|
10
|
+
time: (row: TRow) => DashboardTimeValue;
|
|
11
|
+
/** Icon on the timeline rail. Without `icon` or `avatar`, the rail shows a dot. */
|
|
12
|
+
icon?: (row: TRow) => string | undefined;
|
|
13
|
+
/** Tint of the icon or dot: a palette slot, a Nuxt UI color, or any CSS color. */
|
|
14
|
+
color?: (row: TRow) => DashboardSeriesColor | undefined;
|
|
15
|
+
/** Image URL shown on the rail instead of the icon (who did it). */
|
|
16
|
+
avatar?: (row: TRow) => string | undefined;
|
|
17
|
+
/** `day`: a heading per day (`Today`, `Yesterday`, then the date). Rows keep source order. */
|
|
18
|
+
groupBy?: "day";
|
|
19
|
+
/** Events shown in the card. The expand dialog, table view, and CSV export show them all. */
|
|
20
|
+
limit?: number;
|
|
21
|
+
rowKey?: (row: TRow, index: number) => PropertyKey;
|
|
22
|
+
/** Events shown as selected (the value a `select` handler stored). */
|
|
23
|
+
selected?: DashboardSelected<TRow>;
|
|
24
|
+
/** Actions of each event: inline icon buttons and a `⋮` menu after its time. */
|
|
25
|
+
rowActions?: DashboardRowActions<TRow>;
|
|
26
|
+
/** Makes each event a button. */
|
|
27
|
+
onSelect?: (event: DashboardSelectEvent<TRow>) => void;
|
|
28
|
+
ui?: DashboardBlockUi & DashboardFeedUi;
|
|
29
|
+
}> & (typeof globalThis extends {
|
|
30
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
31
|
+
} ? P : {});
|
|
32
|
+
expose: (exposed: {}) => void;
|
|
33
|
+
attrs: any;
|
|
34
|
+
slots: {
|
|
35
|
+
'header-right'?: () => unknown;
|
|
36
|
+
toolbar?: () => unknown;
|
|
37
|
+
footer?: () => unknown;
|
|
38
|
+
};
|
|
39
|
+
emit: {};
|
|
40
|
+
}>) => import("vue").VNode & {
|
|
41
|
+
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
42
|
+
};
|
|
43
|
+
declare const _default: typeof __VLS_export;
|
|
44
|
+
export default _default;
|
|
45
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
46
|
+
[K in keyof T]: T[K];
|
|
47
|
+
} : {
|
|
48
|
+
[K in keyof T as K]: T[K];
|
|
49
|
+
}) & {};
|