nuxt-ui-tools 1.1.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module.json +1 -1
- package/dist/module.mjs +10 -1
- package/dist/runtime/dashboard/components/block/dashboard-block-state.d.vue.ts +2 -0
- package/dist/runtime/dashboard/components/block/dashboard-block-state.vue +4 -1
- package/dist/runtime/dashboard/components/block/dashboard-block-state.vue.d.ts +2 -0
- package/dist/runtime/dashboard/components/block/dashboard-chips.d.vue.ts +20 -0
- package/dist/runtime/dashboard/components/block/dashboard-chips.vue +42 -0
- package/dist/runtime/dashboard/components/block/dashboard-chips.vue.d.ts +20 -0
- package/dist/runtime/dashboard/components/block/dashboard-series-picker.d.vue.ts +8 -0
- package/dist/runtime/dashboard/components/block/dashboard-series-picker.vue +29 -0
- package/dist/runtime/dashboard/components/block/dashboard-series-picker.vue.d.ts +8 -0
- package/dist/runtime/dashboard/components/block/dashboard-skeleton.d.vue.ts +1 -1
- package/dist/runtime/dashboard/components/block/dashboard-skeleton.vue +6 -3
- package/dist/runtime/dashboard/components/block/dashboard-skeleton.vue.d.ts +1 -1
- package/dist/runtime/dashboard/components/block/dashboard-view-scope.d.vue.ts +21 -0
- package/dist/runtime/dashboard/components/block/dashboard-view-scope.vue +12 -0
- package/dist/runtime/dashboard/components/block/dashboard-view-scope.vue.d.ts +21 -0
- package/dist/runtime/dashboard/components/dashboard-alerts.vue +3 -3
- package/dist/runtime/dashboard/components/dashboard-bar-chart.d.vue.ts +14 -3
- package/dist/runtime/dashboard/components/dashboard-bar-chart.vue +30 -9
- package/dist/runtime/dashboard/components/dashboard-bar-chart.vue.d.ts +14 -3
- package/dist/runtime/dashboard/components/dashboard-bars.vue +4 -4
- package/dist/runtime/dashboard/components/dashboard-card.vue +28 -6
- package/dist/runtime/dashboard/components/dashboard-combo-chart.d.vue.ts +6 -1
- package/dist/runtime/dashboard/components/dashboard-combo-chart.vue +13 -3
- package/dist/runtime/dashboard/components/dashboard-combo-chart.vue.d.ts +6 -1
- package/dist/runtime/dashboard/components/dashboard-donut-chart.vue +5 -5
- package/dist/runtime/dashboard/components/dashboard-feed.vue +8 -7
- package/dist/runtime/dashboard/components/dashboard-filter.d.vue.ts +67 -0
- package/dist/runtime/dashboard/components/dashboard-filter.vue +134 -0
- package/dist/runtime/dashboard/components/dashboard-filter.vue.d.ts +67 -0
- package/dist/runtime/dashboard/components/dashboard-filters.d.vue.ts +49 -0
- package/dist/runtime/dashboard/components/dashboard-filters.vue +96 -0
- package/dist/runtime/dashboard/components/dashboard-filters.vue.d.ts +49 -0
- package/dist/runtime/dashboard/components/dashboard-funnel.vue +5 -5
- package/dist/runtime/dashboard/components/dashboard-gauge.vue +3 -3
- package/dist/runtime/dashboard/components/dashboard-grid.d.vue.ts +10 -3
- package/dist/runtime/dashboard/components/dashboard-grid.vue +24 -9
- package/dist/runtime/dashboard/components/dashboard-grid.vue.d.ts +10 -3
- package/dist/runtime/dashboard/components/dashboard-line-chart.d.vue.ts +14 -3
- package/dist/runtime/dashboard/components/dashboard-line-chart.vue +30 -9
- package/dist/runtime/dashboard/components/dashboard-line-chart.vue.d.ts +14 -3
- package/dist/runtime/dashboard/components/dashboard-list.d.vue.ts +3 -0
- package/dist/runtime/dashboard/components/dashboard-list.vue +18 -6
- package/dist/runtime/dashboard/components/dashboard-list.vue.d.ts +3 -0
- package/dist/runtime/dashboard/components/dashboard-page.d.vue.ts +53 -0
- package/dist/runtime/dashboard/components/dashboard-page.vue +156 -0
- package/dist/runtime/dashboard/components/dashboard-page.vue.d.ts +53 -0
- package/dist/runtime/dashboard/components/dashboard-paired-bars.vue +4 -4
- package/dist/runtime/dashboard/components/dashboard-refresh.d.vue.ts +1 -1
- package/dist/runtime/dashboard/components/dashboard-refresh.vue +1 -0
- package/dist/runtime/dashboard/components/dashboard-refresh.vue.d.ts +1 -1
- package/dist/runtime/dashboard/components/dashboard-stack-bar.vue +4 -4
- package/dist/runtime/dashboard/components/dashboard-stat.d.vue.ts +14 -2
- package/dist/runtime/dashboard/components/dashboard-stat.vue +28 -10
- package/dist/runtime/dashboard/components/dashboard-stat.vue.d.ts +14 -2
- package/dist/runtime/dashboard/components/dashboard-stats.vue +3 -3
- package/dist/runtime/dashboard/components/dashboard-table.d.vue.ts +1 -1
- package/dist/runtime/dashboard/components/dashboard-table.vue +3 -3
- package/dist/runtime/dashboard/components/dashboard-table.vue.d.ts +1 -1
- package/dist/runtime/dashboard/components/dashboard-tabs.d.vue.ts +1 -1
- package/dist/runtime/dashboard/components/dashboard-tabs.vue.d.ts +1 -1
- package/dist/runtime/dashboard/components/dashboard-total.d.vue.ts +7 -2
- package/dist/runtime/dashboard/components/dashboard-total.vue +10 -2
- package/dist/runtime/dashboard/components/dashboard-total.vue.d.ts +7 -2
- package/dist/runtime/dashboard/components/dashboard-view-tabs.d.vue.ts +33 -0
- package/dist/runtime/dashboard/components/dashboard-view-tabs.vue +66 -0
- package/dist/runtime/dashboard/components/dashboard-view-tabs.vue.d.ts +33 -0
- package/dist/runtime/dashboard/components/dashboard-widget.vue +1 -1
- package/dist/runtime/dashboard/components/filter/dashboard-filter-menu.d.vue.ts +44 -0
- package/dist/runtime/dashboard/components/filter/dashboard-filter-menu.vue +220 -0
- package/dist/runtime/dashboard/components/filter/dashboard-filter-menu.vue.d.ts +44 -0
- package/dist/runtime/dashboard/composables/use-dashboard-api.d.ts +6 -1
- package/dist/runtime/dashboard/composables/use-dashboard-api.js +29 -6
- package/dist/runtime/dashboard/composables/use-dashboard-block.d.ts +5 -4
- package/dist/runtime/dashboard/composables/use-dashboard-block.js +32 -15
- package/dist/runtime/dashboard/composables/use-dashboard-chart.d.ts +8 -1
- package/dist/runtime/dashboard/composables/use-dashboard-chart.js +16 -4
- package/dist/runtime/dashboard/composables/use-dashboard-context.d.ts +50 -0
- package/dist/runtime/dashboard/composables/use-dashboard-context.js +56 -0
- package/dist/runtime/dashboard/composables/use-dashboard-derived.js +6 -1
- package/dist/runtime/dashboard/composables/use-dashboard-filter-control.d.ts +16 -0
- package/dist/runtime/dashboard/composables/use-dashboard-filter-control.js +161 -0
- package/dist/runtime/dashboard/composables/use-dashboard-filter-scope.d.ts +37 -0
- package/dist/runtime/dashboard/composables/use-dashboard-filter-scope.js +107 -0
- package/dist/runtime/dashboard/composables/use-dashboard-format.d.ts +46 -6
- package/dist/runtime/dashboard/composables/use-dashboard-format.js +51 -8
- package/dist/runtime/dashboard/composables/use-dashboard-options.d.ts +11 -4
- package/dist/runtime/dashboard/composables/use-dashboard-options.js +33 -47
- package/dist/runtime/dashboard/composables/use-dashboard-remote-options.d.ts +8 -5
- package/dist/runtime/dashboard/composables/use-dashboard-remote-options.js +66 -77
- package/dist/runtime/dashboard/composables/use-dashboard-resource.d.ts +15 -4
- package/dist/runtime/dashboard/composables/use-dashboard-resource.js +52 -17
- package/dist/runtime/dashboard/composables/use-dashboard-scope.d.ts +10 -7
- package/dist/runtime/dashboard/composables/use-dashboard-scope.js +26 -16
- package/dist/runtime/dashboard/composables/use-dashboard-series-picker.d.ts +20 -0
- package/dist/runtime/dashboard/composables/use-dashboard-series-picker.js +30 -0
- package/dist/runtime/dashboard/composables/use-dashboard-time.d.ts +2 -0
- package/dist/runtime/dashboard/composables/use-dashboard-time.js +4 -1
- package/dist/runtime/dashboard/composables/use-dashboard-ui.d.ts +12 -2
- package/dist/runtime/dashboard/composables/use-dashboard-ui.js +3 -0
- package/dist/runtime/dashboard/composables/use-dashboard-views.d.ts +15 -3
- package/dist/runtime/dashboard/composables/use-dashboard-views.js +33 -10
- package/dist/runtime/dashboard/composables/use-dashboard.d.ts +18 -12
- package/dist/runtime/dashboard/composables/use-dashboard.js +98 -9
- package/dist/runtime/dashboard/index.d.ts +3 -1
- package/dist/runtime/dashboard/index.js +3 -1
- package/dist/runtime/dashboard/schema/index.d.ts +62 -30
- package/dist/runtime/dashboard/schema/index.js +3 -0
- package/dist/runtime/dashboard/types/blocks.d.ts +30 -4
- package/dist/runtime/dashboard/types/charts.d.ts +2 -2
- package/dist/runtime/dashboard/types/controls.d.ts +123 -0
- package/dist/runtime/dashboard/types/filters.d.ts +236 -0
- package/dist/runtime/dashboard/types/index.d.ts +3 -2
- package/dist/runtime/dashboard/types/page.d.ts +17 -0
- package/dist/runtime/dashboard/types/page.js +0 -0
- package/dist/runtime/dashboard/types/resource.d.ts +66 -28
- package/dist/runtime/dashboard/types/runtime.d.ts +39 -8
- package/dist/runtime/dashboard/types/schema.d.ts +94 -54
- package/dist/runtime/dashboard/types/ui.d.ts +78 -0
- package/dist/runtime/dashboard/utils/builders/dashboard-filters.d.ts +142 -0
- package/dist/runtime/dashboard/utils/builders/dashboard-filters.js +135 -0
- package/dist/runtime/dashboard/utils/charts.d.ts +4 -15
- package/dist/runtime/dashboard/utils/charts.js +26 -28
- package/dist/runtime/dashboard/utils/{params/codecs.d.ts → codecs.d.ts} +2 -2
- package/dist/runtime/dashboard/utils/{params/codecs.js → codecs.js} +1 -1
- package/dist/runtime/dashboard/utils/environment.d.ts +36 -0
- package/dist/runtime/dashboard/utils/environment.js +30 -0
- package/dist/runtime/dashboard/utils/filters.d.ts +44 -0
- package/dist/runtime/dashboard/utils/filters.js +62 -0
- package/dist/runtime/dashboard/utils/format.d.ts +25 -0
- package/dist/runtime/dashboard/utils/format.js +66 -0
- package/dist/runtime/dashboard/utils/grid.d.ts +17 -0
- package/dist/runtime/dashboard/utils/grid.js +14 -0
- package/dist/runtime/dashboard/utils/options.d.ts +3 -8
- package/dist/runtime/dashboard/utils/options.js +6 -5
- package/dist/runtime/dashboard/utils/remote.d.ts +7 -0
- package/dist/runtime/dashboard/utils/remote.js +14 -0
- package/dist/runtime/dashboard/utils/resource.d.ts +16 -7
- package/dist/runtime/dashboard/utils/resource.js +15 -9
- package/dist/runtime/dashboard/utils/schema.d.ts +8 -3
- package/dist/runtime/dashboard/utils/schema.js +9 -4
- package/dist/runtime/dashboard/utils/state.d.ts +11 -6
- package/dist/runtime/dashboard/utils/state.js +10 -5
- package/dist/runtime/dashboard/utils/time.d.ts +2 -0
- package/dist/runtime/dashboard/utils/time.js +11 -1
- package/dist/runtime/dashboard/utils/ui.d.ts +1 -1
- package/dist/runtime/dashboard/utils/ui.js +1 -1
- package/dist/runtime/form/components/root/form.vue +1 -1
- package/dist/runtime/form/fields/card-selection.d.ts +1 -0
- package/dist/runtime/form/fields/card-selection.js +1 -0
- package/dist/runtime/form/fields/checkbox-card/component.vue +3 -1
- package/dist/runtime/form/fields/checkbox-group/component.vue +5 -0
- package/dist/runtime/form/fields/radio/component.vue +10 -0
- package/dist/runtime/form/fields/radio-card/component.vue +3 -1
- package/dist/runtime/form/types/options.d.ts +1 -11
- package/dist/runtime/form/utils/focus.js +1 -1
- package/dist/runtime/i18n/locales/en.js +32 -1
- package/dist/runtime/i18n/locales/fr.js +32 -1
- package/dist/runtime/i18n/types.d.ts +44 -0
- package/dist/runtime/shared/styles/scrollbars.css +1 -1
- package/dist/runtime/shared/styles/tokens.css +1 -1
- package/dist/runtime/shared/types/query.d.ts +8 -0
- package/dist/runtime/shared/utils/remote-options.d.ts +10 -0
- package/dist/runtime/shared/utils/remote-options.js +6 -0
- package/dist/runtime/table/components/filters/shared/filter-option-list-end.d.vue.ts +11 -0
- package/dist/runtime/table/components/filters/shared/filter-option-list-end.vue +76 -0
- package/dist/runtime/table/components/filters/shared/filter-option-list-end.vue.d.ts +11 -0
- package/dist/runtime/table/components/filters/shared/filter-option-loading-list.d.vue.ts +3 -0
- package/dist/runtime/table/components/filters/shared/filter-option-loading-list.vue +2 -1
- package/dist/runtime/table/components/filters/shared/filter-option-loading-list.vue.d.ts +3 -0
- package/dist/runtime/table/components/filters/shared/filter-option-multiple-list.vue +1 -1
- package/dist/runtime/table/components/filters/shared/filter-option-picker-content.vue +13 -0
- package/dist/runtime/table/components/filters/shared/filter-option-single-list.d.vue.ts +2 -0
- package/dist/runtime/table/components/filters/shared/filter-option-single-list.vue +1 -1
- package/dist/runtime/table/components/filters/shared/filter-option-single-list.vue.d.ts +2 -0
- package/dist/runtime/table/components/filters/shared/filter-option-tree-content.d.vue.ts +3 -0
- package/dist/runtime/table/components/filters/shared/filter-option-tree-content.vue +2 -2
- package/dist/runtime/table/components/filters/shared/filter-option-tree-content.vue.d.ts +3 -0
- package/dist/runtime/table/components/filters/shared/filter-searchable-panel.vue +1 -0
- package/dist/runtime/table/composables/use-option-filter-editor-state.d.ts +13 -1
- package/dist/runtime/table/composables/use-option-filter-editor-state.js +6 -2
- package/dist/runtime/table/composables/use-table-filter-options.d.ts +11 -1
- package/dist/runtime/table/composables/use-table-filter-options.js +128 -17
- package/dist/runtime/table/composables/use-table-filter-selected-options.d.ts +20 -0
- package/dist/runtime/table/composables/use-table-filter-selected-options.js +99 -0
- package/dist/runtime/table/composables/use-table-filters.d.ts +5 -0
- package/dist/runtime/table/composables/use-table-filters.js +20 -1
- package/dist/runtime/table/composables/use-table-internals.d.ts +15 -0
- package/dist/runtime/table/composables/use-table-remote-filter-options.d.ts +42 -0
- package/dist/runtime/table/composables/use-table-remote-filter-options.js +102 -0
- package/dist/runtime/table/types/filters.d.ts +42 -0
- package/dist/runtime/table/types/index.d.ts +1 -0
- package/dist/runtime/table/types/remote-options.d.ts +64 -0
- package/dist/runtime/table/types/remote-options.js +0 -0
- package/dist/runtime/table/types/source.d.ts +15 -1
- package/dist/runtime/table/utils/builders/table-source.d.ts +2 -6
- package/dist/runtime/table/utils/filters/options.d.ts +2 -0
- package/dist/runtime/table/utils/filters/options.js +1 -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 +21 -1
- package/dist/runtime/table/utils/remote-table-options.d.ts +26 -0
- package/dist/runtime/table/utils/remote-table-options.js +88 -0
- package/package.json +4 -1
- package/dist/runtime/dashboard/composables/use-dashboard-param-scope.d.ts +0 -30
- package/dist/runtime/dashboard/composables/use-dashboard-param-scope.js +0 -71
- package/dist/runtime/dashboard/types/options.d.ts +0 -46
- package/dist/runtime/dashboard/types/params.d.ts +0 -115
- package/dist/runtime/dashboard/utils/builders/dashboard-params.d.ts +0 -85
- package/dist/runtime/dashboard/utils/builders/dashboard-params.js +0 -87
- /package/dist/runtime/dashboard/types/{options.js → controls.js} +0 -0
- /package/dist/runtime/dashboard/types/{params.js → filters.js} +0 -0
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -49,6 +49,9 @@ function getPublicComponents(runtimeDir, options) {
|
|
|
49
49
|
...[
|
|
50
50
|
"Grid",
|
|
51
51
|
"Card",
|
|
52
|
+
"Filter",
|
|
53
|
+
"Filters",
|
|
54
|
+
"ViewTabs",
|
|
52
55
|
"Stat",
|
|
53
56
|
"Stats",
|
|
54
57
|
"Gauge",
|
|
@@ -69,7 +72,8 @@ function getPublicComponents(runtimeDir, options) {
|
|
|
69
72
|
"Table",
|
|
70
73
|
"Legend",
|
|
71
74
|
"Total",
|
|
72
|
-
"RelativeTime"
|
|
75
|
+
"RelativeTime",
|
|
76
|
+
"Page"
|
|
73
77
|
].map((part) => ({
|
|
74
78
|
filePath: `${runtimeDir}/dashboard/components/dashboard-${toKebabCase(part)}.vue`,
|
|
75
79
|
global: options.global,
|
|
@@ -147,13 +151,18 @@ function setupImports(runtimeDir) {
|
|
|
147
151
|
{ from: "table", name: "createTableFilterBuilder" },
|
|
148
152
|
{ from: "table", name: "defineTableSchema" },
|
|
149
153
|
{ from: "table", name: "prefetchTable" },
|
|
154
|
+
{ from: "table", name: "remoteTableOptions" },
|
|
150
155
|
{ from: "table", name: "tableSource" },
|
|
151
156
|
{ from: "table", name: "useTable" }
|
|
152
157
|
]),
|
|
153
158
|
// Dashboard
|
|
154
159
|
...withRuntime(runtimeDir, [
|
|
155
160
|
{ from: "dashboard", name: "defineDashboardSchema" },
|
|
161
|
+
{ from: "dashboard", name: "defineDashboardView" },
|
|
162
|
+
{ from: "dashboard", name: "injectDashboard" },
|
|
156
163
|
{ from: "dashboard", name: "useDashboard" },
|
|
164
|
+
{ from: "dashboard", name: "useDashboardFormat" },
|
|
165
|
+
{ from: "dashboard", name: "useDashboardView" },
|
|
157
166
|
{ from: "dashboard", name: "resolveDashboardComparisonRange" }
|
|
158
167
|
]),
|
|
159
168
|
// Form
|
|
@@ -2,6 +2,8 @@ import type { DashboardEmptyContent } from '../../types/index.js';
|
|
|
2
2
|
type __VLS_Props = {
|
|
3
3
|
kind: 'error' | 'empty';
|
|
4
4
|
empty?: DashboardEmptyContent;
|
|
5
|
+
/** A retry is in flight: the button spins and waits for it. */
|
|
6
|
+
retrying?: boolean;
|
|
5
7
|
};
|
|
6
8
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
7
9
|
retry: () => any;
|
|
@@ -8,7 +8,8 @@ import { useDashboardUi } from "../../composables/use-dashboard-ui";
|
|
|
8
8
|
import { resolveDashboardClasses } from "../../utils/ui";
|
|
9
9
|
const props = defineProps({
|
|
10
10
|
kind: { type: String, required: true },
|
|
11
|
-
empty: { type: Object, required: false }
|
|
11
|
+
empty: { type: Object, required: false },
|
|
12
|
+
retrying: { type: Boolean, required: false }
|
|
12
13
|
});
|
|
13
14
|
const emit = defineEmits(["retry"]);
|
|
14
15
|
const { t } = useUiToolsLocale();
|
|
@@ -53,6 +54,8 @@ const classes = computed(
|
|
|
53
54
|
size="xs"
|
|
54
55
|
icon="i-lucide-rotate-cw"
|
|
55
56
|
:label="t('dashboard.states.retry')"
|
|
57
|
+
:loading="retrying"
|
|
58
|
+
data-retry
|
|
56
59
|
@click="emit('retry')"
|
|
57
60
|
/>
|
|
58
61
|
</div>
|
|
@@ -2,6 +2,8 @@ import type { DashboardEmptyContent } from '../../types/index.js';
|
|
|
2
2
|
type __VLS_Props = {
|
|
3
3
|
kind: 'error' | 'empty';
|
|
4
4
|
empty?: DashboardEmptyContent;
|
|
5
|
+
/** A retry is in flight: the button spins and waits for it. */
|
|
6
|
+
retrying?: boolean;
|
|
5
7
|
};
|
|
6
8
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
7
9
|
retry: () => any;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Removable chips in a block toolbar: the series a filter picks (with their color), or the
|
|
3
|
+
* drill-down filters narrowing the block (with their name).
|
|
4
|
+
*/
|
|
5
|
+
type __VLS_Props = {
|
|
6
|
+
chips: readonly {
|
|
7
|
+
key: string;
|
|
8
|
+
label: string;
|
|
9
|
+
/** Filter name shown before the value. */
|
|
10
|
+
prefix?: string;
|
|
11
|
+
/** CSS color of the series swatch. */
|
|
12
|
+
color?: string;
|
|
13
|
+
/** Accessible name of the remove button. */
|
|
14
|
+
removeLabel: string;
|
|
15
|
+
remove: () => void;
|
|
16
|
+
}[];
|
|
17
|
+
};
|
|
18
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
19
|
+
declare const _default: typeof __VLS_export;
|
|
20
|
+
export default _default;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import UIcon from "@nuxt/ui/components/Icon.vue";
|
|
3
|
+
import { computed } from "vue";
|
|
4
|
+
import { useDashboardUi } from "../../composables/use-dashboard-ui";
|
|
5
|
+
import { resolveDashboardClasses } from "../../utils/ui";
|
|
6
|
+
const { chips } = defineProps({
|
|
7
|
+
chips: { type: Array, required: true }
|
|
8
|
+
});
|
|
9
|
+
const appUi = useDashboardUi();
|
|
10
|
+
const classes = computed(
|
|
11
|
+
() => resolveDashboardClasses(
|
|
12
|
+
{
|
|
13
|
+
chip: "inline-flex h-7 max-w-full min-w-0 items-center gap-[7px] rounded-full bg-elevated pr-1.5 pl-2.5 text-[12.5px] font-medium text-default",
|
|
14
|
+
label: "text-muted",
|
|
15
|
+
remove: "grid size-[18px] flex-none place-items-center rounded-full text-dimmed transition-colors outline-none hover:bg-accented hover:text-default focus-visible:ring-2 focus-visible:ring-primary",
|
|
16
|
+
swatch: "size-2 flex-none rounded-[2px]"
|
|
17
|
+
},
|
|
18
|
+
appUi.value.chips
|
|
19
|
+
)
|
|
20
|
+
);
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<template>
|
|
24
|
+
<span v-for="chip in chips" :key="chip.key" :class="classes.chip" data-dashboard-chip>
|
|
25
|
+
<i
|
|
26
|
+
v-if="chip.color"
|
|
27
|
+
aria-hidden="true"
|
|
28
|
+
:class="classes.swatch"
|
|
29
|
+
:style="{ background: chip.color }"
|
|
30
|
+
/>
|
|
31
|
+
<span v-if="chip.prefix" :class="classes.label">{{ chip.prefix }}</span>
|
|
32
|
+
<span class="truncate">{{ chip.label }}</span>
|
|
33
|
+
<button
|
|
34
|
+
type="button"
|
|
35
|
+
:class="classes.remove"
|
|
36
|
+
:aria-label="chip.removeLabel"
|
|
37
|
+
@click="chip.remove()"
|
|
38
|
+
>
|
|
39
|
+
<UIcon name="i-lucide-x" class="size-2.5" />
|
|
40
|
+
</button>
|
|
41
|
+
</span>
|
|
42
|
+
</template>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Removable chips in a block toolbar: the series a filter picks (with their color), or the
|
|
3
|
+
* drill-down filters narrowing the block (with their name).
|
|
4
|
+
*/
|
|
5
|
+
type __VLS_Props = {
|
|
6
|
+
chips: readonly {
|
|
7
|
+
key: string;
|
|
8
|
+
label: string;
|
|
9
|
+
/** Filter name shown before the value. */
|
|
10
|
+
prefix?: string;
|
|
11
|
+
/** CSS color of the series swatch. */
|
|
12
|
+
color?: string;
|
|
13
|
+
/** Accessible name of the remove button. */
|
|
14
|
+
removeLabel: string;
|
|
15
|
+
remove: () => void;
|
|
16
|
+
}[];
|
|
17
|
+
};
|
|
18
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
19
|
+
declare const _default: typeof __VLS_export;
|
|
20
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DashboardFilterControl } from '../../types/index.js';
|
|
2
|
+
/** Header controls of a chart whose series a filter picks: add from the options, pick a preset. */
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
filter: DashboardFilterControl;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useUiToolsLocale } from "#ui-tools/i18n";
|
|
3
|
+
import DashboardFilter from "../dashboard-filter.vue";
|
|
4
|
+
defineProps({
|
|
5
|
+
filter: { type: Object, required: true }
|
|
6
|
+
});
|
|
7
|
+
const { t } = useUiToolsLocale();
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<div class="flex items-center gap-1.5" data-series-picker>
|
|
12
|
+
<DashboardFilter
|
|
13
|
+
v-if="filter.items.length"
|
|
14
|
+
:filter
|
|
15
|
+
variant="button"
|
|
16
|
+
icon="i-lucide-plus"
|
|
17
|
+
:label="t('dashboard.series.add')"
|
|
18
|
+
list="options"
|
|
19
|
+
/>
|
|
20
|
+
<DashboardFilter
|
|
21
|
+
v-if="filter.presets.length"
|
|
22
|
+
:filter
|
|
23
|
+
variant="button"
|
|
24
|
+
icon="i-lucide-layers"
|
|
25
|
+
:label="t('dashboard.filters.presets')"
|
|
26
|
+
list="presets"
|
|
27
|
+
/>
|
|
28
|
+
</div>
|
|
29
|
+
</template>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DashboardFilterControl } from '../../types/index.js';
|
|
2
|
+
/** Header controls of a chart whose series a filter picks: add from the options, pick a preset. */
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
filter: DashboardFilterControl;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|
|
@@ -21,12 +21,12 @@ type __VLS_Props = {
|
|
|
21
21
|
seed?: string;
|
|
22
22
|
};
|
|
23
23
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
24
|
+
columns: number;
|
|
24
25
|
kind: DashboardSkeletonKind;
|
|
25
26
|
layout: "side" | "stacked";
|
|
26
27
|
height: number;
|
|
27
28
|
count: number;
|
|
28
29
|
series: number;
|
|
29
|
-
columns: number;
|
|
30
30
|
diameter: number;
|
|
31
31
|
seed: string;
|
|
32
32
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -73,11 +73,14 @@ const funnelWidths = computed(
|
|
|
73
73
|
</div>
|
|
74
74
|
|
|
75
75
|
<!-- Feed: a rail of markers, two lines per event, and a time -->
|
|
76
|
-
<div v-else-if="kind === 'feed'" class="flex flex-col">
|
|
77
|
-
<div v-for="(width, index) in widths" :key="index" class="flex gap-3
|
|
76
|
+
<div v-else-if="kind === 'feed'" class="-my-2 flex flex-col">
|
|
77
|
+
<div v-for="(width, index) in widths" :key="index" class="flex gap-3 py-2">
|
|
78
78
|
<div class="flex w-7 shrink-0 flex-col items-center">
|
|
79
79
|
<div class="nut-dash-ghost size-7 rounded-full" />
|
|
80
|
-
<div
|
|
80
|
+
<div
|
|
81
|
+
v-if="index < widths.length - 1"
|
|
82
|
+
class="mt-1 -mb-4 w-px flex-1 bg-[var(--nut-dash-grid)]"
|
|
83
|
+
/>
|
|
81
84
|
</div>
|
|
82
85
|
<div class="flex min-w-0 flex-1 flex-col gap-1.5 pt-1">
|
|
83
86
|
<div class="flex items-center gap-3">
|
|
@@ -21,12 +21,12 @@ type __VLS_Props = {
|
|
|
21
21
|
seed?: string;
|
|
22
22
|
};
|
|
23
23
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
24
|
+
columns: number;
|
|
24
25
|
kind: DashboardSkeletonKind;
|
|
25
26
|
layout: "side" | "stacked";
|
|
26
27
|
height: number;
|
|
27
28
|
count: number;
|
|
28
29
|
series: number;
|
|
29
|
-
columns: number;
|
|
30
30
|
diameter: number;
|
|
31
31
|
seed: string;
|
|
32
32
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Renders the content of one view and tells the components inside which view it is, so a tab
|
|
3
|
+
* component resolves `useDashboardView(consumptionView)` to it. Keyed by view by its parent.
|
|
4
|
+
*/
|
|
5
|
+
type __VLS_Props = {
|
|
6
|
+
dashboard: object;
|
|
7
|
+
view: string;
|
|
8
|
+
};
|
|
9
|
+
declare var __VLS_1: {};
|
|
10
|
+
type __VLS_Slots = {} & {
|
|
11
|
+
default?: (props: typeof __VLS_1) => any;
|
|
12
|
+
};
|
|
13
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
15
|
+
declare const _default: typeof __VLS_export;
|
|
16
|
+
export default _default;
|
|
17
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
18
|
+
new (): {
|
|
19
|
+
$slots: S;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { provideDashboardView } from "../../composables/use-dashboard-context";
|
|
3
|
+
const { dashboard, view } = defineProps({
|
|
4
|
+
dashboard: { type: Object, required: true },
|
|
5
|
+
view: { type: String, required: true }
|
|
6
|
+
});
|
|
7
|
+
provideDashboardView(dashboard, view);
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<slot />
|
|
12
|
+
</template>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Renders the content of one view and tells the components inside which view it is, so a tab
|
|
3
|
+
* component resolves `useDashboardView(consumptionView)` to it. Keyed by view by its parent.
|
|
4
|
+
*/
|
|
5
|
+
type __VLS_Props = {
|
|
6
|
+
dashboard: object;
|
|
7
|
+
view: string;
|
|
8
|
+
};
|
|
9
|
+
declare var __VLS_1: {};
|
|
10
|
+
type __VLS_Slots = {} & {
|
|
11
|
+
default?: (props: typeof __VLS_1) => any;
|
|
12
|
+
};
|
|
13
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
15
|
+
declare const _default: typeof __VLS_export;
|
|
16
|
+
export default _default;
|
|
17
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
18
|
+
new (): {
|
|
19
|
+
$slots: S;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -42,19 +42,19 @@ const {
|
|
|
42
42
|
title: { type: [String, Number, Function], required: false },
|
|
43
43
|
subtitle: { type: [String, Number, Function], required: false },
|
|
44
44
|
size: { type: String, required: false },
|
|
45
|
-
rows: { type: String, required: false },
|
|
46
45
|
card: { type: Boolean, required: false },
|
|
47
46
|
activation: { type: String, required: false },
|
|
48
47
|
empty: { type: Object, required: false },
|
|
49
48
|
menu: { type: [Boolean, Array, Function], required: false },
|
|
50
49
|
actions: { type: Array, required: false },
|
|
50
|
+
filters: { type: Array, required: false },
|
|
51
51
|
freshness: { type: Boolean, required: false },
|
|
52
52
|
source: { type: Object, required: true },
|
|
53
53
|
severity: { type: Function, required: true },
|
|
54
54
|
label: { type: Function, required: true },
|
|
55
55
|
description: { type: Function, required: false },
|
|
56
56
|
value: { type: Function, required: false },
|
|
57
|
-
format: { type: Function, required: false },
|
|
57
|
+
format: { type: [String, Function], required: false, skipCheck: true },
|
|
58
58
|
icon: { type: Function, required: false },
|
|
59
59
|
action: { type: Function, required: false },
|
|
60
60
|
order: { type: String, required: false },
|
|
@@ -108,7 +108,7 @@ const entries = computed(() => {
|
|
|
108
108
|
raw,
|
|
109
109
|
row,
|
|
110
110
|
selected: selected?.(row, index) ?? false,
|
|
111
|
-
value: raw === null || raw === void 0 ? "" : isNumber(raw) ? (format
|
|
111
|
+
value: raw === null || raw === void 0 ? "" : isNumber(raw) ? formats.resolve(format)(raw) : resolveTextValue(raw)
|
|
112
112
|
};
|
|
113
113
|
});
|
|
114
114
|
return order === "severity" ? rows.sort((a, b) => rank[a.level] - rank[b.level]) : rows;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
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<{
|
|
2
|
+
import type { DashboardAxisOptions, DashboardBlockBaseProps, DashboardChartTotals, DashboardFilterControl, DashboardOptionValue, DashboardHighlight, DashboardReferenceLine, DashboardSelected, DashboardSelectEvent, DashboardSeries, DashboardSourceLike, DashboardValueFormat } from '../types/index.js';
|
|
3
|
+
declare const __VLS_export: <TRow, TItem extends DashboardOptionValue = DashboardOptionValue>(__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
4
|
props: import("vue").PublicProps & __VLS_PrettifyLocal<DashboardBlockBaseProps & {
|
|
5
5
|
source: DashboardSourceLike<readonly TRow[] | undefined>;
|
|
6
6
|
/** Category of each row (month, account…). Rows are plotted in order. */
|
|
@@ -8,7 +8,13 @@ declare const __VLS_export: <TRow>(__VLS_props: NonNullable<Awaited<typeof __VLS
|
|
|
8
8
|
xFormat?: (value: string | number | Date) => string;
|
|
9
9
|
/** Header of the category column in the table view and CSV export. */
|
|
10
10
|
xLabel?: LazyTextValue;
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* The series, or a multiple filter whose picks become the series (one per option, in pick
|
|
13
|
+
* order): the chart then draws the picker and one removable chip per series.
|
|
14
|
+
*/
|
|
15
|
+
series: readonly DashboardSeries<TRow>[] | DashboardFilterControl<unknown, TItem>;
|
|
16
|
+
/** With `series` bound to a filter: the value of one picked option's series in a row. */
|
|
17
|
+
seriesValue?: (row: TRow, item: TItem) => number | null | undefined;
|
|
12
18
|
/** Dashed line drawn over the bars, e.g. the previous period. */
|
|
13
19
|
comparison?: DashboardSeries<TRow>;
|
|
14
20
|
stacked?: boolean;
|
|
@@ -28,6 +34,11 @@ declare const __VLS_export: <TRow>(__VLS_props: NonNullable<Awaited<typeof __VLS
|
|
|
28
34
|
selected?: DashboardSelected<TRow>;
|
|
29
35
|
/** Prints each group's value above its bars (the stack total when `stacked`). */
|
|
30
36
|
labels?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Footer totals of the solid series, formatted like their axis: `true` / `'sum'` adds each
|
|
39
|
+
* series up, `'average'` averages it. Footer slot content follows them.
|
|
40
|
+
*/
|
|
41
|
+
totals?: DashboardChartTotals;
|
|
31
42
|
/** A click on the chart selects the x position under the pointer. */
|
|
32
43
|
onSelect?: (event: DashboardSelectEvent<TRow>) => void;
|
|
33
44
|
}> & (typeof globalThis extends {
|
|
@@ -5,9 +5,13 @@ import {
|
|
|
5
5
|
resolveDashboardExpandedHeight,
|
|
6
6
|
useDashboardChart
|
|
7
7
|
} from "../composables/use-dashboard-chart";
|
|
8
|
+
import { useDashboardSeriesPicker } from "../composables/use-dashboard-series-picker";
|
|
9
|
+
import DashboardChips from "./block/dashboard-chips.vue";
|
|
10
|
+
import DashboardSeriesPicker from "./block/dashboard-series-picker.vue";
|
|
8
11
|
import DashboardSkeleton from "./block/dashboard-skeleton.vue";
|
|
9
12
|
import { dashboardChartRenderer } from "./charts/renderer";
|
|
10
13
|
import DashboardCard from "./dashboard-card.vue";
|
|
14
|
+
import DashboardTotal from "./dashboard-total.vue";
|
|
11
15
|
const {
|
|
12
16
|
source,
|
|
13
17
|
card = true,
|
|
@@ -17,6 +21,7 @@ const {
|
|
|
17
21
|
xFormat,
|
|
18
22
|
xLabel,
|
|
19
23
|
series,
|
|
24
|
+
seriesValue,
|
|
20
25
|
comparison,
|
|
21
26
|
stacked = false,
|
|
22
27
|
yAxis,
|
|
@@ -28,29 +33,31 @@ const {
|
|
|
28
33
|
highlight,
|
|
29
34
|
selected,
|
|
30
35
|
labels = false,
|
|
36
|
+
totals,
|
|
31
37
|
onSelect,
|
|
32
38
|
...block
|
|
33
39
|
} = defineProps({
|
|
34
40
|
title: { type: [String, Number, Function], required: false },
|
|
35
41
|
subtitle: { type: [String, Number, Function], required: false },
|
|
36
42
|
size: { type: String, required: false },
|
|
37
|
-
rows: { type: String, required: false },
|
|
38
43
|
card: { type: Boolean, required: false },
|
|
39
44
|
activation: { type: String, required: false },
|
|
40
45
|
empty: { type: Object, required: false },
|
|
41
46
|
menu: { type: [Boolean, Array, Function], required: false },
|
|
42
47
|
actions: { type: Array, required: false },
|
|
48
|
+
filters: { type: Array, required: false },
|
|
43
49
|
freshness: { type: Boolean, required: false },
|
|
44
50
|
ui: { type: Object, required: false },
|
|
45
51
|
source: { type: Object, required: true },
|
|
46
52
|
x: { type: Function, required: true },
|
|
47
53
|
xFormat: { type: Function, required: false },
|
|
48
54
|
xLabel: { type: [String, Number, Function], required: false },
|
|
49
|
-
series: { type: Array, required: true },
|
|
55
|
+
series: { type: [Array, Object], required: true },
|
|
56
|
+
seriesValue: { type: Function, required: false },
|
|
50
57
|
comparison: { type: Object, required: false },
|
|
51
58
|
stacked: { type: Boolean, required: false },
|
|
52
59
|
yAxis: { type: Object, required: false },
|
|
53
|
-
format: { type: Function, required: false },
|
|
60
|
+
format: { type: [String, Function], required: false, skipCheck: true },
|
|
54
61
|
reference: { type: [Object, Array], required: false },
|
|
55
62
|
height: { type: Number, required: false },
|
|
56
63
|
legend: { type: Boolean, required: false },
|
|
@@ -58,17 +65,23 @@ const {
|
|
|
58
65
|
highlight: { type: [String, Function], required: false },
|
|
59
66
|
selected: { type: Function, required: false },
|
|
60
67
|
labels: { type: Boolean, required: false },
|
|
68
|
+
totals: { type: [Boolean, String], required: false },
|
|
61
69
|
onSelect: { type: Function, required: false }
|
|
62
70
|
});
|
|
63
71
|
defineSlots();
|
|
64
72
|
const mounted = useMounted();
|
|
73
|
+
const picked = useDashboardSeriesPicker({
|
|
74
|
+
series: () => series,
|
|
75
|
+
value: () => seriesValue
|
|
76
|
+
});
|
|
65
77
|
const allSeries = computed(
|
|
66
|
-
() => comparison ? [...series, { color: "series-2", ...comparison, dashed: true, type: "line" }] : series
|
|
78
|
+
() => comparison ? [...picked.series.value, { color: "series-2", ...comparison, dashed: true, type: "line" }] : picked.series.value
|
|
67
79
|
);
|
|
68
80
|
const seed = computed(() => allSeries.value.map((entry) => entry.key).join("|"));
|
|
69
|
-
const skeletonSeries = computed(() => series.length);
|
|
81
|
+
const skeletonSeries = computed(() => picked.series.value.length || 1);
|
|
70
82
|
const skeletonPoints = computed(() => source.data?.length || points);
|
|
71
83
|
const chart = useDashboardChart({
|
|
84
|
+
totals: () => totals,
|
|
72
85
|
defaultType: "bar",
|
|
73
86
|
format: () => format,
|
|
74
87
|
highlight: () => highlight,
|
|
@@ -93,7 +106,7 @@ const chart = useDashboardChart({
|
|
|
93
106
|
:menu
|
|
94
107
|
:freshness
|
|
95
108
|
:source
|
|
96
|
-
:legend="legend ? chart.legend.value : void 0"
|
|
109
|
+
:legend="legend && !picked.picker.value ? chart.legend.value : void 0"
|
|
97
110
|
:is-empty="chart.frame.value.data.length === 0 || chart.frame.value.series.length === 0"
|
|
98
111
|
:tabulate="chart.tabulate"
|
|
99
112
|
>
|
|
@@ -106,13 +119,21 @@ const chart = useDashboardChart({
|
|
|
106
119
|
:seed
|
|
107
120
|
/>
|
|
108
121
|
</template>
|
|
109
|
-
<template v-if="$slots['header-right']" #header-right>
|
|
122
|
+
<template v-if="$slots['header-right'] || picked.picker.value" #header-right>
|
|
123
|
+
<DashboardSeriesPicker v-if="picked.picker.value" :filter="picked.picker.value" />
|
|
110
124
|
<slot name="header-right" />
|
|
111
125
|
</template>
|
|
112
|
-
<template v-if="$slots.toolbar" #toolbar>
|
|
126
|
+
<template v-if="$slots.toolbar || picked.chips.value.length" #toolbar>
|
|
127
|
+
<DashboardChips v-if="picked.chips.value.length" :chips="picked.chips.value" />
|
|
113
128
|
<slot name="toolbar" />
|
|
114
129
|
</template>
|
|
115
|
-
<template v-if="$slots.footer" #footer>
|
|
130
|
+
<template v-if="$slots.footer || chart.totals.value.length" #footer>
|
|
131
|
+
<DashboardTotal
|
|
132
|
+
v-for="total in chart.totals.value"
|
|
133
|
+
:key="total.key"
|
|
134
|
+
:label="total.label"
|
|
135
|
+
:value="total.text"
|
|
136
|
+
/>
|
|
116
137
|
<slot name="footer" />
|
|
117
138
|
</template>
|
|
118
139
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
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<{
|
|
2
|
+
import type { DashboardAxisOptions, DashboardBlockBaseProps, DashboardChartTotals, DashboardFilterControl, DashboardOptionValue, DashboardHighlight, DashboardReferenceLine, DashboardSelected, DashboardSelectEvent, DashboardSeries, DashboardSourceLike, DashboardValueFormat } from '../types/index.js';
|
|
3
|
+
declare const __VLS_export: <TRow, TItem extends DashboardOptionValue = DashboardOptionValue>(__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
4
|
props: import("vue").PublicProps & __VLS_PrettifyLocal<DashboardBlockBaseProps & {
|
|
5
5
|
source: DashboardSourceLike<readonly TRow[] | undefined>;
|
|
6
6
|
/** Category of each row (month, account…). Rows are plotted in order. */
|
|
@@ -8,7 +8,13 @@ declare const __VLS_export: <TRow>(__VLS_props: NonNullable<Awaited<typeof __VLS
|
|
|
8
8
|
xFormat?: (value: string | number | Date) => string;
|
|
9
9
|
/** Header of the category column in the table view and CSV export. */
|
|
10
10
|
xLabel?: LazyTextValue;
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* The series, or a multiple filter whose picks become the series (one per option, in pick
|
|
13
|
+
* order): the chart then draws the picker and one removable chip per series.
|
|
14
|
+
*/
|
|
15
|
+
series: readonly DashboardSeries<TRow>[] | DashboardFilterControl<unknown, TItem>;
|
|
16
|
+
/** With `series` bound to a filter: the value of one picked option's series in a row. */
|
|
17
|
+
seriesValue?: (row: TRow, item: TItem) => number | null | undefined;
|
|
12
18
|
/** Dashed line drawn over the bars, e.g. the previous period. */
|
|
13
19
|
comparison?: DashboardSeries<TRow>;
|
|
14
20
|
stacked?: boolean;
|
|
@@ -28,6 +34,11 @@ declare const __VLS_export: <TRow>(__VLS_props: NonNullable<Awaited<typeof __VLS
|
|
|
28
34
|
selected?: DashboardSelected<TRow>;
|
|
29
35
|
/** Prints each group's value above its bars (the stack total when `stacked`). */
|
|
30
36
|
labels?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Footer totals of the solid series, formatted like their axis: `true` / `'sum'` adds each
|
|
39
|
+
* series up, `'average'` averages it. Footer slot content follows them.
|
|
40
|
+
*/
|
|
41
|
+
totals?: DashboardChartTotals;
|
|
31
42
|
/** A click on the chart selects the x position under the pointer. */
|
|
32
43
|
onSelect?: (event: DashboardSelectEvent<TRow>) => void;
|
|
33
44
|
}> & (typeof globalThis extends {
|
|
@@ -39,19 +39,19 @@ const {
|
|
|
39
39
|
title: { type: [String, Number, Function], required: false },
|
|
40
40
|
subtitle: { type: [String, Number, Function], required: false },
|
|
41
41
|
size: { type: String, required: false },
|
|
42
|
-
rows: { type: String, required: false },
|
|
43
42
|
card: { type: Boolean, required: false },
|
|
44
43
|
activation: { type: String, required: false },
|
|
45
44
|
empty: { type: Object, required: false },
|
|
46
45
|
menu: { type: [Boolean, Array, Function], required: false },
|
|
47
46
|
actions: { type: Array, required: false },
|
|
47
|
+
filters: { type: Array, required: false },
|
|
48
48
|
freshness: { type: Boolean, required: false },
|
|
49
49
|
source: { type: Object, required: true },
|
|
50
50
|
label: { type: Function, required: true },
|
|
51
51
|
tag: { type: Function, required: false },
|
|
52
52
|
value: { type: Function, required: true },
|
|
53
53
|
meta: { type: Function, required: false },
|
|
54
|
-
format: { type: Function, required: false },
|
|
54
|
+
format: { type: [String, Function], required: false, skipCheck: true },
|
|
55
55
|
max: { type: Number, required: false },
|
|
56
56
|
color: { type: String, required: false },
|
|
57
57
|
emphasis: { type: String, required: false },
|
|
@@ -90,7 +90,7 @@ const entries = computed(
|
|
|
90
90
|
index,
|
|
91
91
|
key: rowKey?.(row, index) ?? index,
|
|
92
92
|
label: resolveTextValue(label(row)),
|
|
93
|
-
meta: meta ? resolveTextValue(meta(row)) : (format
|
|
93
|
+
meta: meta ? resolveTextValue(meta(row)) : formats.resolve(format)(amount),
|
|
94
94
|
row,
|
|
95
95
|
selected: selected?.(row, index) ?? false,
|
|
96
96
|
tag: tag ? resolveTextValue(tag(row)) : ""
|
|
@@ -115,7 +115,7 @@ function tabulate() {
|
|
|
115
115
|
],
|
|
116
116
|
rows: entries.value.map((entry) => [
|
|
117
117
|
toDashboardCell(entry.tag ? `${entry.label} ${entry.tag}` : entry.label),
|
|
118
|
-
toDashboardCell(entry.amount, (format
|
|
118
|
+
toDashboardCell(entry.amount, formats.resolve(format)(entry.amount))
|
|
119
119
|
])
|
|
120
120
|
};
|
|
121
121
|
}
|