nuxt-ui-tools 1.0.1 → 1.2.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 +315 -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 +239 -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 +5 -0
- package/dist/runtime/dashboard/utils/options.js +18 -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/types/options.d.ts +15 -36
- package/dist/runtime/i18n/locales/en.js +65 -1
- package/dist/runtime/i18n/locales/fr.js +65 -1
- package/dist/runtime/i18n/types.d.ts +70 -0
- package/dist/runtime/shared/index.d.ts +2 -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 +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/shared/utils/remote-options.d.ts +10 -0
- package/dist/runtime/shared/utils/remote-options.js +6 -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 +1 -1
- package/dist/runtime/table/components/data-list/data-list-content.vue.d.ts +1 -1
- 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.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-sort-menu.d.vue.ts +1 -1
- 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/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-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/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/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-query-state.d.ts +3 -3
- package/dist/runtime/table/composables/use-table-columns.d.ts +3 -3
- 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 +42 -27
- package/dist/runtime/table/composables/use-table-pagination.d.ts +2 -2
- 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/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/filters.d.ts +42 -0
- package/dist/runtime/table/types/source.d.ts +9 -5
- package/dist/runtime/table/utils/columns/menu.d.ts +1 -1
- 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/options.d.ts +2 -0
- package/dist/runtime/table/utils/filters/options.js +1 -1
- package/dist/runtime/table/utils/prefetch.js +21 -1
- package/package.json +28 -1
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
import { createDashboardSeededRandom } from "../../utils/charts";
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
kind: { type: String, required: false, default: "rows" },
|
|
6
|
+
count: { type: Number, required: false, default: 0 },
|
|
7
|
+
series: { type: Number, required: false, default: 1 },
|
|
8
|
+
height: { type: Number, required: false, default: 250 },
|
|
9
|
+
leading: { type: String, required: false },
|
|
10
|
+
columns: { type: Number, required: false, default: 4 },
|
|
11
|
+
extra: { type: String, required: false },
|
|
12
|
+
layout: { type: String, required: false, default: "side" },
|
|
13
|
+
diameter: { type: Number, required: false, default: 150 },
|
|
14
|
+
seed: { type: String, required: false, default: "dashboard" }
|
|
15
|
+
});
|
|
16
|
+
const points = computed(
|
|
17
|
+
() => props.count || (props.kind === "bars" || props.kind === "lines" ? 12 : 5)
|
|
18
|
+
);
|
|
19
|
+
const random = computed(() => createDashboardSeededRandom(`${props.kind}:${props.seed}`));
|
|
20
|
+
const groups = computed(() => {
|
|
21
|
+
const next = random.value;
|
|
22
|
+
return Array.from(
|
|
23
|
+
{ length: points.value },
|
|
24
|
+
() => Array.from({ length: Math.max(1, props.series) }, () => 28 + Math.round(next() * 58))
|
|
25
|
+
);
|
|
26
|
+
});
|
|
27
|
+
const linePath = computed(() => {
|
|
28
|
+
const next = random.value;
|
|
29
|
+
const values = Array.from({ length: points.value }, (_, index) => 30 + index * 2.5 + next() * 22);
|
|
30
|
+
const step = 100 / Math.max(1, values.length - 1);
|
|
31
|
+
return values.map(
|
|
32
|
+
(value, index) => `${index === 0 ? "M" : "L"}${(index * step).toFixed(2)},${(100 - value).toFixed(2)}`
|
|
33
|
+
).join(" ");
|
|
34
|
+
});
|
|
35
|
+
const widths = computed(() => {
|
|
36
|
+
const next = random.value;
|
|
37
|
+
return Array.from({ length: points.value }, () => 38 + Math.round(next() * 40));
|
|
38
|
+
});
|
|
39
|
+
const funnelWidths = computed(
|
|
40
|
+
() => Array.from({ length: points.value }, (_, index) => Math.max(18, 100 - index * 19))
|
|
41
|
+
);
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<template>
|
|
45
|
+
<!-- KPI: value, then delta and caption, then a sparkline or a progress bar -->
|
|
46
|
+
<div v-if="kind === 'stat'" class="flex flex-col gap-2.5 pt-1.5">
|
|
47
|
+
<div class="nut-dash-ghost h-[26px] w-[58%] rounded-md" />
|
|
48
|
+
<div class="flex items-center gap-2">
|
|
49
|
+
<div class="nut-dash-ghost h-3 w-12 rounded-sm" />
|
|
50
|
+
<div class="nut-dash-ghost h-3 w-[40%] rounded-sm opacity-70" />
|
|
51
|
+
</div>
|
|
52
|
+
<svg
|
|
53
|
+
v-if="extra === 'trend'"
|
|
54
|
+
class="mt-1.5 h-8 w-full overflow-visible"
|
|
55
|
+
viewBox="0 0 100 100"
|
|
56
|
+
preserveAspectRatio="none"
|
|
57
|
+
>
|
|
58
|
+
<path
|
|
59
|
+
:d="linePath"
|
|
60
|
+
fill="none"
|
|
61
|
+
stroke="var(--nut-dash-ghost)"
|
|
62
|
+
stroke-width="2"
|
|
63
|
+
vector-effect="non-scaling-stroke"
|
|
64
|
+
stroke-linecap="round"
|
|
65
|
+
/>
|
|
66
|
+
</svg>
|
|
67
|
+
<div v-else-if="extra === 'goal'" class="mt-1.5 flex flex-col gap-1.5">
|
|
68
|
+
<div class="h-1.5 rounded-full bg-[var(--nut-dash-track)]">
|
|
69
|
+
<div class="nut-dash-ghost h-full w-3/5 rounded-full" />
|
|
70
|
+
</div>
|
|
71
|
+
<div class="nut-dash-ghost h-2 w-[45%] rounded-sm opacity-70" />
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
|
|
75
|
+
<!-- Feed: a rail of markers, two lines per event, and a time -->
|
|
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
|
+
<div class="flex w-7 shrink-0 flex-col items-center">
|
|
79
|
+
<div class="nut-dash-ghost size-7 rounded-full" />
|
|
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
|
+
/>
|
|
84
|
+
</div>
|
|
85
|
+
<div class="flex min-w-0 flex-1 flex-col gap-1.5 pt-1">
|
|
86
|
+
<div class="flex items-center gap-3">
|
|
87
|
+
<div class="nut-dash-ghost h-2.5 rounded-sm" :style="{ width: `${width}%` }" />
|
|
88
|
+
<div class="nut-dash-ghost ms-auto h-2 w-10 shrink-0 rounded-sm opacity-70" />
|
|
89
|
+
</div>
|
|
90
|
+
<div class="nut-dash-ghost h-2 w-[40%] rounded-sm opacity-70" />
|
|
91
|
+
</div>
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
|
|
95
|
+
<!-- Table: header labels, then rows of cells (first column wider, numbers to the end) -->
|
|
96
|
+
<div v-else-if="kind === 'table'" class="flex flex-col">
|
|
97
|
+
<div class="flex gap-5 pb-2.5">
|
|
98
|
+
<div
|
|
99
|
+
v-for="column in columns"
|
|
100
|
+
:key="column"
|
|
101
|
+
class="flex flex-1"
|
|
102
|
+
:class="column === 1 ? 'grow-[2]' : 'justify-end'"
|
|
103
|
+
>
|
|
104
|
+
<div class="nut-dash-ghost h-2 w-14 rounded-sm opacity-70" />
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
<div
|
|
108
|
+
v-for="(width, index) in widths"
|
|
109
|
+
:key="index"
|
|
110
|
+
class="flex items-center gap-5 border-t border-[var(--nut-dash-grid)] py-[11px]"
|
|
111
|
+
>
|
|
112
|
+
<div
|
|
113
|
+
v-for="column in columns"
|
|
114
|
+
:key="column"
|
|
115
|
+
class="flex flex-1"
|
|
116
|
+
:class="column === 1 ? 'grow-[2]' : 'justify-end'"
|
|
117
|
+
>
|
|
118
|
+
<div
|
|
119
|
+
class="nut-dash-ghost h-2.5 rounded-sm"
|
|
120
|
+
:style="{ width: column === 1 ? `${width}%` : `${36 + (index + column) % 3 * 14}%` }"
|
|
121
|
+
/>
|
|
122
|
+
</div>
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
125
|
+
|
|
126
|
+
<!-- XY charts: y labels, gridlines, grouped bars or a smooth line, x labels -->
|
|
127
|
+
<div
|
|
128
|
+
v-else-if="kind === 'bars' || kind === 'lines'"
|
|
129
|
+
class="flex flex-col"
|
|
130
|
+
:style="{ height: `${height}px` }"
|
|
131
|
+
>
|
|
132
|
+
<div class="flex min-h-0 flex-1 gap-2">
|
|
133
|
+
<div class="flex w-8 shrink-0 flex-col justify-between py-0.5">
|
|
134
|
+
<div
|
|
135
|
+
v-for="tick in 5"
|
|
136
|
+
:key="tick"
|
|
137
|
+
class="nut-dash-ghost ms-auto h-2 w-6 rounded-sm opacity-70"
|
|
138
|
+
/>
|
|
139
|
+
</div>
|
|
140
|
+
<div class="relative flex min-w-0 flex-1 items-end">
|
|
141
|
+
<div
|
|
142
|
+
v-for="line in 5"
|
|
143
|
+
:key="line"
|
|
144
|
+
class="absolute inset-x-0 border-t border-[var(--nut-dash-grid)]"
|
|
145
|
+
:style="{ top: `${(line - 1) / 4 * 100}%` }"
|
|
146
|
+
/>
|
|
147
|
+
<template v-if="kind === 'bars'">
|
|
148
|
+
<div
|
|
149
|
+
v-for="(group, index) in groups"
|
|
150
|
+
:key="index"
|
|
151
|
+
class="relative flex h-full flex-1 items-end justify-center gap-px"
|
|
152
|
+
>
|
|
153
|
+
<div
|
|
154
|
+
v-for="(bar, barIndex) in group"
|
|
155
|
+
:key="barIndex"
|
|
156
|
+
class="nut-dash-ghost w-[min(14px,22%)] rounded-t-[2px]"
|
|
157
|
+
:style="{ height: `${bar}%` }"
|
|
158
|
+
/>
|
|
159
|
+
</div>
|
|
160
|
+
</template>
|
|
161
|
+
<svg
|
|
162
|
+
v-else
|
|
163
|
+
class="absolute inset-0 size-full overflow-visible"
|
|
164
|
+
viewBox="0 0 100 100"
|
|
165
|
+
preserveAspectRatio="none"
|
|
166
|
+
>
|
|
167
|
+
<path
|
|
168
|
+
:d="linePath"
|
|
169
|
+
fill="none"
|
|
170
|
+
stroke="var(--nut-dash-ghost)"
|
|
171
|
+
stroke-width="2.5"
|
|
172
|
+
vector-effect="non-scaling-stroke"
|
|
173
|
+
stroke-linecap="round"
|
|
174
|
+
stroke-linejoin="round"
|
|
175
|
+
/>
|
|
176
|
+
</svg>
|
|
177
|
+
</div>
|
|
178
|
+
</div>
|
|
179
|
+
<div class="mt-2 flex ps-10">
|
|
180
|
+
<div v-for="index in points" :key="index" class="flex flex-1 justify-center">
|
|
181
|
+
<div class="nut-dash-ghost h-2 w-5 rounded-sm opacity-70" />
|
|
182
|
+
</div>
|
|
183
|
+
</div>
|
|
184
|
+
</div>
|
|
185
|
+
|
|
186
|
+
<!-- Stat group: label, value, and meta line per figure -->
|
|
187
|
+
<div v-else-if="kind === 'stats'" class="flex flex-wrap gap-x-6 gap-y-5">
|
|
188
|
+
<div
|
|
189
|
+
v-for="index in Math.max(1, count || 3)"
|
|
190
|
+
:key="index"
|
|
191
|
+
class="flex min-w-24 flex-1 flex-col gap-2"
|
|
192
|
+
>
|
|
193
|
+
<div class="nut-dash-ghost h-2.5 w-[55%] rounded-sm opacity-70" />
|
|
194
|
+
<div class="nut-dash-ghost h-5 w-[70%] rounded-md" />
|
|
195
|
+
<div class="nut-dash-ghost h-2 w-[40%] rounded-sm opacity-70" />
|
|
196
|
+
</div>
|
|
197
|
+
</div>
|
|
198
|
+
|
|
199
|
+
<!-- Gauge: an open arc and its scale -->
|
|
200
|
+
<div v-else-if="kind === 'gauge'" class="flex flex-col items-center gap-3 pt-1">
|
|
201
|
+
<div
|
|
202
|
+
class="rounded-full border-[12px] border-[var(--nut-dash-ghost)] border-b-transparent"
|
|
203
|
+
:style="{ height: `${diameter}px`, width: `${diameter}px` }"
|
|
204
|
+
/>
|
|
205
|
+
<div class="flex justify-between" :style="{ width: `${diameter}px` }">
|
|
206
|
+
<div class="nut-dash-ghost h-2 w-6 rounded-sm opacity-70" />
|
|
207
|
+
<div class="nut-dash-ghost h-2 w-8 rounded-sm opacity-70" />
|
|
208
|
+
</div>
|
|
209
|
+
</div>
|
|
210
|
+
|
|
211
|
+
<!-- Donut: ring and legend -->
|
|
212
|
+
<div
|
|
213
|
+
v-else-if="kind === 'donut'"
|
|
214
|
+
:class="
|
|
215
|
+
layout === 'stacked' ? 'flex flex-col items-center gap-[18px]' : 'flex flex-wrap items-center gap-5'
|
|
216
|
+
"
|
|
217
|
+
>
|
|
218
|
+
<div
|
|
219
|
+
class="shrink-0 rounded-full border-[14px] border-[var(--nut-dash-ghost)]"
|
|
220
|
+
:style="{ height: `${diameter}px`, width: `${diameter}px` }"
|
|
221
|
+
/>
|
|
222
|
+
<div class="flex w-full min-w-40 flex-1 flex-col gap-3">
|
|
223
|
+
<div
|
|
224
|
+
v-for="(width, index) in widths.slice(0, 4)"
|
|
225
|
+
:key="index"
|
|
226
|
+
class="flex items-center gap-2"
|
|
227
|
+
>
|
|
228
|
+
<div class="nut-dash-ghost size-[9px] shrink-0 rounded-[3px]" />
|
|
229
|
+
<div class="nut-dash-ghost h-2.5 rounded-sm" :style="{ width: `${width}%` }" />
|
|
230
|
+
<div class="nut-dash-ghost ms-auto h-2.5 w-8 rounded-sm" />
|
|
231
|
+
</div>
|
|
232
|
+
</div>
|
|
233
|
+
</div>
|
|
234
|
+
|
|
235
|
+
<!-- Horizontal bars: label + meta, then a thin track -->
|
|
236
|
+
<div v-else-if="kind === 'hbars'" class="flex flex-col gap-1">
|
|
237
|
+
<div v-for="(width, index) in widths" :key="index" class="flex flex-col gap-2 py-1.5">
|
|
238
|
+
<div class="flex items-center justify-between gap-3">
|
|
239
|
+
<div class="nut-dash-ghost h-2.5 rounded-sm" :style="{ width: `${width}%` }" />
|
|
240
|
+
<div class="nut-dash-ghost h-2.5 w-14 rounded-sm opacity-70" />
|
|
241
|
+
</div>
|
|
242
|
+
<div class="h-1.5 rounded-full bg-[var(--nut-dash-track)]">
|
|
243
|
+
<div
|
|
244
|
+
class="nut-dash-ghost h-full rounded-full"
|
|
245
|
+
:style="{ width: `${100 - index * 14}%` }"
|
|
246
|
+
/>
|
|
247
|
+
</div>
|
|
248
|
+
</div>
|
|
249
|
+
</div>
|
|
250
|
+
|
|
251
|
+
<!-- Funnel: label + value, then decreasing thick bars -->
|
|
252
|
+
<div v-else-if="kind === 'funnel'" class="flex flex-col gap-3.5 pt-1">
|
|
253
|
+
<div v-for="(width, index) in funnelWidths" :key="index" class="flex flex-col gap-1.5">
|
|
254
|
+
<div class="flex items-center gap-2.5">
|
|
255
|
+
<div class="nut-dash-ghost h-2.5 w-24 rounded-sm" />
|
|
256
|
+
<div class="nut-dash-ghost h-3 w-10 rounded-sm" />
|
|
257
|
+
<div class="nut-dash-ghost ms-auto h-2.5 w-28 rounded-sm opacity-70" />
|
|
258
|
+
</div>
|
|
259
|
+
<div class="h-[22px] rounded-[5px] bg-[var(--nut-dash-track)]">
|
|
260
|
+
<div class="nut-dash-ghost h-full rounded-[5px]" :style="{ width: `${width}%` }" />
|
|
261
|
+
</div>
|
|
262
|
+
</div>
|
|
263
|
+
</div>
|
|
264
|
+
|
|
265
|
+
<!-- Stacked bar: one bar, legend in two columns -->
|
|
266
|
+
<div v-else-if="kind === 'stack'" class="flex flex-col gap-4 pt-1.5">
|
|
267
|
+
<div class="nut-dash-ghost h-3.5 rounded-full" />
|
|
268
|
+
<div class="grid grid-cols-2 gap-x-[18px] gap-y-2">
|
|
269
|
+
<div
|
|
270
|
+
v-for="(width, index) in widths.slice(0, 4)"
|
|
271
|
+
:key="index"
|
|
272
|
+
class="flex items-center gap-2"
|
|
273
|
+
>
|
|
274
|
+
<div class="nut-dash-ghost size-[9px] shrink-0 rounded-[3px]" />
|
|
275
|
+
<div class="nut-dash-ghost h-2.5 rounded-sm" :style="{ width: `${width}%` }" />
|
|
276
|
+
</div>
|
|
277
|
+
</div>
|
|
278
|
+
</div>
|
|
279
|
+
|
|
280
|
+
<!-- Paired bars: label, track, numbers -->
|
|
281
|
+
<div v-else-if="kind === 'paired'" class="flex flex-col">
|
|
282
|
+
<div
|
|
283
|
+
v-for="(width, index) in widths"
|
|
284
|
+
:key="index"
|
|
285
|
+
class="grid grid-cols-[minmax(0,150px)_1fr_auto] items-center gap-3 py-1.5"
|
|
286
|
+
>
|
|
287
|
+
<div class="nut-dash-ghost h-2.5 rounded-sm" :style="{ width: `${width}%` }" />
|
|
288
|
+
<div class="h-3 rounded-full bg-[var(--nut-dash-track)]">
|
|
289
|
+
<div class="nut-dash-ghost h-full rounded-full" :style="{ width: `${100 - index * 5}%` }" />
|
|
290
|
+
</div>
|
|
291
|
+
<div class="nut-dash-ghost h-2.5 w-24 rounded-sm opacity-70" />
|
|
292
|
+
</div>
|
|
293
|
+
</div>
|
|
294
|
+
|
|
295
|
+
<!-- Ranked rows: leading, two text lines, value -->
|
|
296
|
+
<div v-else class="flex flex-col divide-y divide-[var(--nut-dash-grid)]">
|
|
297
|
+
<div v-for="(width, index) in widths" :key="index" class="flex items-center gap-3 py-[9px]">
|
|
298
|
+
<div
|
|
299
|
+
v-if="leading"
|
|
300
|
+
:class="
|
|
301
|
+
leading === 'code' ? 'h-[22px] w-8 rounded-[5px]' : leading === 'icon' ? 'size-8 rounded-lg' : 'size-[30px] rounded-[7px]'
|
|
302
|
+
"
|
|
303
|
+
class="nut-dash-ghost shrink-0"
|
|
304
|
+
/>
|
|
305
|
+
<div class="flex min-w-0 flex-1 flex-col gap-1.5">
|
|
306
|
+
<div class="nut-dash-ghost h-2.5 rounded-sm" :style="{ width: `${width}%` }" />
|
|
307
|
+
<div
|
|
308
|
+
v-if="leading === 'avatar' || leading === 'icon'"
|
|
309
|
+
class="nut-dash-ghost h-2 w-[30%] rounded-sm opacity-70"
|
|
310
|
+
/>
|
|
311
|
+
</div>
|
|
312
|
+
<div class="nut-dash-ghost h-3 w-10 shrink-0 rounded-sm" />
|
|
313
|
+
</div>
|
|
314
|
+
</div>
|
|
315
|
+
</template>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { DashboardSkeletonKind } from '../../types/index.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
kind?: DashboardSkeletonKind;
|
|
4
|
+
/** Rows for list-like kinds, x points for charts. */
|
|
5
|
+
count?: number;
|
|
6
|
+
/** Bars per group (`bars`), or lines (`lines`). */
|
|
7
|
+
series?: number;
|
|
8
|
+
/** Chart height in pixels, x labels included. */
|
|
9
|
+
height?: number;
|
|
10
|
+
/** Leading visual of `rows`. */
|
|
11
|
+
leading?: 'avatar' | 'code' | 'icon';
|
|
12
|
+
/** Columns of `table`. */
|
|
13
|
+
columns?: number;
|
|
14
|
+
/** Extra line of `stat`: a sparkline or a progress bar. */
|
|
15
|
+
extra?: 'trend' | 'goal';
|
|
16
|
+
/** `donut` legend placement. */
|
|
17
|
+
layout?: 'side' | 'stacked';
|
|
18
|
+
/** Diameter of the `donut` ring. */
|
|
19
|
+
diameter?: number;
|
|
20
|
+
/** Seed of the deterministic geometry: server and client paint the same ghost. */
|
|
21
|
+
seed?: string;
|
|
22
|
+
};
|
|
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
|
+
kind: DashboardSkeletonKind;
|
|
25
|
+
layout: "side" | "stacked";
|
|
26
|
+
height: number;
|
|
27
|
+
count: number;
|
|
28
|
+
series: number;
|
|
29
|
+
columns: number;
|
|
30
|
+
diameter: number;
|
|
31
|
+
seed: string;
|
|
32
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
33
|
+
declare const _default: typeof __VLS_export;
|
|
34
|
+
export default _default;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chart renderer seam. Blocks never import a chart library: they render these async components,
|
|
3
|
+
* which are the only modules allowed to import `@unovis/*`. A second backend only needs another
|
|
4
|
+
* entry with the same props.
|
|
5
|
+
*/
|
|
6
|
+
export declare const dashboardChartRenderer: {
|
|
7
|
+
donut: import("vue").DefineComponent<{
|
|
8
|
+
segments: readonly {
|
|
9
|
+
value: number;
|
|
10
|
+
color: string;
|
|
11
|
+
}[];
|
|
12
|
+
size: number;
|
|
13
|
+
thickness: number;
|
|
14
|
+
padAngle: number;
|
|
15
|
+
selectable?: boolean;
|
|
16
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
17
|
+
select: (index: number) => any;
|
|
18
|
+
}, string, import("vue").PublicProps, Readonly<{
|
|
19
|
+
segments: readonly {
|
|
20
|
+
value: number;
|
|
21
|
+
color: string;
|
|
22
|
+
}[];
|
|
23
|
+
size: number;
|
|
24
|
+
thickness: number;
|
|
25
|
+
padAngle: number;
|
|
26
|
+
selectable?: boolean;
|
|
27
|
+
}> & Readonly<{
|
|
28
|
+
onSelect?: ((index: number) => any) | undefined;
|
|
29
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
30
|
+
xy: import("vue").DefineComponent<{
|
|
31
|
+
frame: import("../../types/index.js").DashboardChartFrame;
|
|
32
|
+
height: number;
|
|
33
|
+
selectable?: boolean;
|
|
34
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
35
|
+
select: (index: number) => any;
|
|
36
|
+
}, string, import("vue").PublicProps, Readonly<{
|
|
37
|
+
frame: import("../../types/index.js").DashboardChartFrame;
|
|
38
|
+
height: number;
|
|
39
|
+
selectable?: boolean;
|
|
40
|
+
}> & Readonly<{
|
|
41
|
+
onSelect?: ((index: number) => any) | undefined;
|
|
42
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
43
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { defineAsyncComponent, defineComponent, h } from "vue";
|
|
2
|
+
const XyPlaceholder = defineComponent({
|
|
3
|
+
inheritAttrs: false,
|
|
4
|
+
props: { height: { default: 250, type: Number } },
|
|
5
|
+
setup: (props) => () => h("div", { "aria-hidden": "true", style: { height: `${props.height}px` } })
|
|
6
|
+
});
|
|
7
|
+
const DonutPlaceholder = defineComponent({
|
|
8
|
+
inheritAttrs: false,
|
|
9
|
+
props: {
|
|
10
|
+
size: { default: 150, type: Number },
|
|
11
|
+
thickness: { default: 14, type: Number }
|
|
12
|
+
},
|
|
13
|
+
setup: (props) => () => h("div", {
|
|
14
|
+
"aria-hidden": "true",
|
|
15
|
+
class: "rounded-full border-[var(--nut-dash-ghost)]",
|
|
16
|
+
style: {
|
|
17
|
+
borderWidth: `${props.thickness}px`,
|
|
18
|
+
height: `${props.size}px`,
|
|
19
|
+
width: `${props.size}px`
|
|
20
|
+
}
|
|
21
|
+
})
|
|
22
|
+
});
|
|
23
|
+
export const dashboardChartRenderer = {
|
|
24
|
+
donut: defineAsyncComponent({
|
|
25
|
+
delay: 0,
|
|
26
|
+
loader: () => import("./unovis/dashboard-donut-chart.vue"),
|
|
27
|
+
loadingComponent: DonutPlaceholder
|
|
28
|
+
}),
|
|
29
|
+
xy: defineAsyncComponent({
|
|
30
|
+
delay: 0,
|
|
31
|
+
loader: () => import("./unovis/dashboard-xy-chart.vue"),
|
|
32
|
+
loadingComponent: XyPlaceholder
|
|
33
|
+
})
|
|
34
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
segments: readonly {
|
|
3
|
+
value: number;
|
|
4
|
+
color: string;
|
|
5
|
+
}[];
|
|
6
|
+
size: number;
|
|
7
|
+
thickness: number;
|
|
8
|
+
padAngle: number;
|
|
9
|
+
/** A click on a segment selects it. */
|
|
10
|
+
selectable?: boolean;
|
|
11
|
+
};
|
|
12
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
13
|
+
select: (index: number) => any;
|
|
14
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
15
|
+
onSelect?: ((index: number) => any) | undefined;
|
|
16
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
17
|
+
declare const _default: typeof __VLS_export;
|
|
18
|
+
export default _default;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { Donut } from "@unovis/ts";
|
|
3
|
+
import VisDonut from "@unovis/vue/components/donut";
|
|
4
|
+
import VisSingleContainer from "@unovis/vue/containers/single-container";
|
|
5
|
+
import { usePreferredReducedMotion } from "@vueuse/core";
|
|
6
|
+
import { computed } from "vue";
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
segments: { type: Array, required: true },
|
|
9
|
+
size: { type: Number, required: true },
|
|
10
|
+
thickness: { type: Number, required: true },
|
|
11
|
+
padAngle: { type: Number, required: true },
|
|
12
|
+
selectable: { type: Boolean, required: false }
|
|
13
|
+
});
|
|
14
|
+
const emit = defineEmits(["select"]);
|
|
15
|
+
const reducedMotion = usePreferredReducedMotion();
|
|
16
|
+
const duration = computed(() => reducedMotion.value === "reduce" ? 0 : 500);
|
|
17
|
+
const value = (segment) => segment.value;
|
|
18
|
+
const color = (segment) => segment.color;
|
|
19
|
+
const events = computed(
|
|
20
|
+
() => props.selectable ? {
|
|
21
|
+
[Donut.selectors.segment]: {
|
|
22
|
+
click: (arc) => emit("select", arc.index)
|
|
23
|
+
}
|
|
24
|
+
} : {}
|
|
25
|
+
);
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<template>
|
|
29
|
+
<div
|
|
30
|
+
class="nut-dash-chart"
|
|
31
|
+
:class="selectable && '[&_path]:cursor-pointer'"
|
|
32
|
+
:style="{ height: `${size}px`, width: `${size}px` }"
|
|
33
|
+
>
|
|
34
|
+
<VisSingleContainer :data="props.segments" :height="size" :width="size" :duration="duration">
|
|
35
|
+
<VisDonut
|
|
36
|
+
:value="value"
|
|
37
|
+
:color="color"
|
|
38
|
+
:arc-width="thickness"
|
|
39
|
+
:pad-angle="padAngle"
|
|
40
|
+
:show-background="false"
|
|
41
|
+
:events="events"
|
|
42
|
+
/>
|
|
43
|
+
</VisSingleContainer>
|
|
44
|
+
</div>
|
|
45
|
+
</template>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
segments: readonly {
|
|
3
|
+
value: number;
|
|
4
|
+
color: string;
|
|
5
|
+
}[];
|
|
6
|
+
size: number;
|
|
7
|
+
thickness: number;
|
|
8
|
+
padAngle: number;
|
|
9
|
+
/** A click on a segment selects it. */
|
|
10
|
+
selectable?: boolean;
|
|
11
|
+
};
|
|
12
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
13
|
+
select: (index: number) => any;
|
|
14
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
15
|
+
onSelect?: ((index: number) => any) | undefined;
|
|
16
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
17
|
+
declare const _default: typeof __VLS_export;
|
|
18
|
+
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { DashboardChartFrame } from '../../../types/index.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
frame: DashboardChartFrame;
|
|
4
|
+
height: number;
|
|
5
|
+
/** A click selects the x position under the pointer. */
|
|
6
|
+
selectable?: boolean;
|
|
7
|
+
};
|
|
8
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
9
|
+
select: (index: number) => any;
|
|
10
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
11
|
+
onSelect?: ((index: number) => any) | undefined;
|
|
12
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
|
+
declare const _default: typeof __VLS_export;
|
|
14
|
+
export default _default;
|