nuxt-ui-tools 1.0.1 → 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.
Files changed (226) hide show
  1. package/dist/module.d.mts +3 -0
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +37 -0
  4. package/dist/runtime/dashboard/components/block/dashboard-block-state.d.vue.ts +12 -0
  5. package/dist/runtime/dashboard/components/block/dashboard-block-state.vue +59 -0
  6. package/dist/runtime/dashboard/components/block/dashboard-block-state.vue.d.ts +12 -0
  7. package/dist/runtime/dashboard/components/block/dashboard-data-table.d.vue.ts +9 -0
  8. package/dist/runtime/dashboard/components/block/dashboard-data-table.vue +47 -0
  9. package/dist/runtime/dashboard/components/block/dashboard-data-table.vue.d.ts +9 -0
  10. package/dist/runtime/dashboard/components/block/dashboard-ring.d.vue.ts +34 -0
  11. package/dist/runtime/dashboard/components/block/dashboard-ring.vue +91 -0
  12. package/dist/runtime/dashboard/components/block/dashboard-ring.vue.d.ts +34 -0
  13. package/dist/runtime/dashboard/components/block/dashboard-row-actions.d.vue.ts +13 -0
  14. package/dist/runtime/dashboard/components/block/dashboard-row-actions.vue +49 -0
  15. package/dist/runtime/dashboard/components/block/dashboard-row-actions.vue.d.ts +13 -0
  16. package/dist/runtime/dashboard/components/block/dashboard-skeleton.d.vue.ts +34 -0
  17. package/dist/runtime/dashboard/components/block/dashboard-skeleton.vue +312 -0
  18. package/dist/runtime/dashboard/components/block/dashboard-skeleton.vue.d.ts +34 -0
  19. package/dist/runtime/dashboard/components/charts/renderer.d.ts +43 -0
  20. package/dist/runtime/dashboard/components/charts/renderer.js +34 -0
  21. package/dist/runtime/dashboard/components/charts/unovis/dashboard-donut-chart.d.vue.ts +18 -0
  22. package/dist/runtime/dashboard/components/charts/unovis/dashboard-donut-chart.vue +45 -0
  23. package/dist/runtime/dashboard/components/charts/unovis/dashboard-donut-chart.vue.d.ts +18 -0
  24. package/dist/runtime/dashboard/components/charts/unovis/dashboard-xy-chart.d.vue.ts +14 -0
  25. package/dist/runtime/dashboard/components/charts/unovis/dashboard-xy-chart.vue +190 -0
  26. package/dist/runtime/dashboard/components/charts/unovis/dashboard-xy-chart.vue.d.ts +14 -0
  27. package/dist/runtime/dashboard/components/charts/unovis/dashboard-xy-marks.d.vue.ts +13 -0
  28. package/dist/runtime/dashboard/components/charts/unovis/dashboard-xy-marks.vue +72 -0
  29. package/dist/runtime/dashboard/components/charts/unovis/dashboard-xy-marks.vue.d.ts +13 -0
  30. package/dist/runtime/dashboard/components/charts/unovis/xy-layers.d.ts +43 -0
  31. package/dist/runtime/dashboard/components/charts/unovis/xy-layers.js +60 -0
  32. package/dist/runtime/dashboard/components/dashboard-alerts.d.vue.ts +49 -0
  33. package/dist/runtime/dashboard/components/dashboard-alerts.vue +226 -0
  34. package/dist/runtime/dashboard/components/dashboard-alerts.vue.d.ts +49 -0
  35. package/dist/runtime/dashboard/components/dashboard-bar-chart.d.vue.ts +53 -0
  36. package/dist/runtime/dashboard/components/dashboard-bar-chart.vue +131 -0
  37. package/dist/runtime/dashboard/components/dashboard-bar-chart.vue.d.ts +53 -0
  38. package/dist/runtime/dashboard/components/dashboard-bars.d.vue.ts +49 -0
  39. package/dist/runtime/dashboard/components/dashboard-bars.vue +187 -0
  40. package/dist/runtime/dashboard/components/dashboard-bars.vue.d.ts +49 -0
  41. package/dist/runtime/dashboard/components/dashboard-card.d.vue.ts +47 -0
  42. package/dist/runtime/dashboard/components/dashboard-card.vue +316 -0
  43. package/dist/runtime/dashboard/components/dashboard-card.vue.d.ts +47 -0
  44. package/dist/runtime/dashboard/components/dashboard-combo-chart.d.vue.ts +52 -0
  45. package/dist/runtime/dashboard/components/dashboard-combo-chart.vue +128 -0
  46. package/dist/runtime/dashboard/components/dashboard-combo-chart.vue.d.ts +52 -0
  47. package/dist/runtime/dashboard/components/dashboard-donut-chart.d.vue.ts +48 -0
  48. package/dist/runtime/dashboard/components/dashboard-donut-chart.vue +216 -0
  49. package/dist/runtime/dashboard/components/dashboard-donut-chart.vue.d.ts +48 -0
  50. package/dist/runtime/dashboard/components/dashboard-feed.d.vue.ts +49 -0
  51. package/dist/runtime/dashboard/components/dashboard-feed.vue +238 -0
  52. package/dist/runtime/dashboard/components/dashboard-feed.vue.d.ts +49 -0
  53. package/dist/runtime/dashboard/components/dashboard-funnel.d.vue.ts +34 -0
  54. package/dist/runtime/dashboard/components/dashboard-funnel.vue +157 -0
  55. package/dist/runtime/dashboard/components/dashboard-funnel.vue.d.ts +34 -0
  56. package/dist/runtime/dashboard/components/dashboard-gauge.d.vue.ts +55 -0
  57. package/dist/runtime/dashboard/components/dashboard-gauge.vue +177 -0
  58. package/dist/runtime/dashboard/components/dashboard-gauge.vue.d.ts +55 -0
  59. package/dist/runtime/dashboard/components/dashboard-grid.d.vue.ts +38 -0
  60. package/dist/runtime/dashboard/components/dashboard-grid.vue +49 -0
  61. package/dist/runtime/dashboard/components/dashboard-grid.vue.d.ts +38 -0
  62. package/dist/runtime/dashboard/components/dashboard-legend.d.vue.ts +8 -0
  63. package/dist/runtime/dashboard/components/dashboard-legend.vue +37 -0
  64. package/dist/runtime/dashboard/components/dashboard-legend.vue.d.ts +8 -0
  65. package/dist/runtime/dashboard/components/dashboard-line-chart.d.vue.ts +46 -0
  66. package/dist/runtime/dashboard/components/dashboard-line-chart.vue +129 -0
  67. package/dist/runtime/dashboard/components/dashboard-line-chart.vue.d.ts +46 -0
  68. package/dist/runtime/dashboard/components/dashboard-list.d.vue.ts +63 -0
  69. package/dist/runtime/dashboard/components/dashboard-list.vue +239 -0
  70. package/dist/runtime/dashboard/components/dashboard-list.vue.d.ts +63 -0
  71. package/dist/runtime/dashboard/components/dashboard-paired-bars.d.vue.ts +43 -0
  72. package/dist/runtime/dashboard/components/dashboard-paired-bars.vue +194 -0
  73. package/dist/runtime/dashboard/components/dashboard-paired-bars.vue.d.ts +43 -0
  74. package/dist/runtime/dashboard/components/dashboard-refresh.d.vue.ts +29 -0
  75. package/dist/runtime/dashboard/components/dashboard-refresh.vue +86 -0
  76. package/dist/runtime/dashboard/components/dashboard-refresh.vue.d.ts +29 -0
  77. package/dist/runtime/dashboard/components/dashboard-relative-time.d.vue.ts +12 -0
  78. package/dist/runtime/dashboard/components/dashboard-relative-time.vue +23 -0
  79. package/dist/runtime/dashboard/components/dashboard-relative-time.vue.d.ts +12 -0
  80. package/dist/runtime/dashboard/components/dashboard-stack-bar.d.vue.ts +36 -0
  81. package/dist/runtime/dashboard/components/dashboard-stack-bar.vue +162 -0
  82. package/dist/runtime/dashboard/components/dashboard-stack-bar.vue.d.ts +36 -0
  83. package/dist/runtime/dashboard/components/dashboard-stat.d.vue.ts +69 -0
  84. package/dist/runtime/dashboard/components/dashboard-stat.vue +279 -0
  85. package/dist/runtime/dashboard/components/dashboard-stat.vue.d.ts +69 -0
  86. package/dist/runtime/dashboard/components/dashboard-stats.d.vue.ts +38 -0
  87. package/dist/runtime/dashboard/components/dashboard-stats.vue +202 -0
  88. package/dist/runtime/dashboard/components/dashboard-stats.vue.d.ts +38 -0
  89. package/dist/runtime/dashboard/components/dashboard-table.d.vue.ts +52 -0
  90. package/dist/runtime/dashboard/components/dashboard-table.vue +305 -0
  91. package/dist/runtime/dashboard/components/dashboard-table.vue.d.ts +52 -0
  92. package/dist/runtime/dashboard/components/dashboard-tabs.d.vue.ts +35 -0
  93. package/dist/runtime/dashboard/components/dashboard-tabs.vue +55 -0
  94. package/dist/runtime/dashboard/components/dashboard-tabs.vue.d.ts +35 -0
  95. package/dist/runtime/dashboard/components/dashboard-total.d.vue.ts +10 -0
  96. package/dist/runtime/dashboard/components/dashboard-total.vue +32 -0
  97. package/dist/runtime/dashboard/components/dashboard-total.vue.d.ts +10 -0
  98. package/dist/runtime/dashboard/components/dashboard-widget.d.vue.ts +46 -0
  99. package/dist/runtime/dashboard/components/dashboard-widget.vue +84 -0
  100. package/dist/runtime/dashboard/components/dashboard-widget.vue.d.ts +46 -0
  101. package/dist/runtime/dashboard/composables/use-dashboard-api.d.ts +15 -0
  102. package/dist/runtime/dashboard/composables/use-dashboard-api.js +91 -0
  103. package/dist/runtime/dashboard/composables/use-dashboard-block.d.ts +22 -0
  104. package/dist/runtime/dashboard/composables/use-dashboard-block.js +35 -0
  105. package/dist/runtime/dashboard/composables/use-dashboard-chart.d.ts +36 -0
  106. package/dist/runtime/dashboard/composables/use-dashboard-chart.js +118 -0
  107. package/dist/runtime/dashboard/composables/use-dashboard-derived.d.ts +12 -0
  108. package/dist/runtime/dashboard/composables/use-dashboard-derived.js +47 -0
  109. package/dist/runtime/dashboard/composables/use-dashboard-format.d.ts +6 -0
  110. package/dist/runtime/dashboard/composables/use-dashboard-format.js +12 -0
  111. package/dist/runtime/dashboard/composables/use-dashboard-options.d.ts +8 -0
  112. package/dist/runtime/dashboard/composables/use-dashboard-options.js +63 -0
  113. package/dist/runtime/dashboard/composables/use-dashboard-param-scope.d.ts +30 -0
  114. package/dist/runtime/dashboard/composables/use-dashboard-param-scope.js +71 -0
  115. package/dist/runtime/dashboard/composables/use-dashboard-remote-options.d.ts +12 -0
  116. package/dist/runtime/dashboard/composables/use-dashboard-remote-options.js +117 -0
  117. package/dist/runtime/dashboard/composables/use-dashboard-resource.d.ts +35 -0
  118. package/dist/runtime/dashboard/composables/use-dashboard-resource.js +80 -0
  119. package/dist/runtime/dashboard/composables/use-dashboard-scope.d.ts +46 -0
  120. package/dist/runtime/dashboard/composables/use-dashboard-scope.js +127 -0
  121. package/dist/runtime/dashboard/composables/use-dashboard-time.d.ts +13 -0
  122. package/dist/runtime/dashboard/composables/use-dashboard-time.js +40 -0
  123. package/dist/runtime/dashboard/composables/use-dashboard-ui.d.ts +22 -0
  124. package/dist/runtime/dashboard/composables/use-dashboard-ui.js +19 -0
  125. package/dist/runtime/dashboard/composables/use-dashboard-views.d.ts +46 -0
  126. package/dist/runtime/dashboard/composables/use-dashboard-views.js +49 -0
  127. package/dist/runtime/dashboard/composables/use-dashboard.d.ts +24 -0
  128. package/dist/runtime/dashboard/composables/use-dashboard.js +42 -0
  129. package/dist/runtime/dashboard/constants/query.d.ts +16 -0
  130. package/dist/runtime/dashboard/constants/query.js +15 -0
  131. package/dist/runtime/dashboard/index.d.ts +4 -0
  132. package/dist/runtime/dashboard/index.js +3 -0
  133. package/dist/runtime/dashboard/schema/index.d.ts +57 -0
  134. package/dist/runtime/dashboard/schema/index.js +3 -0
  135. package/dist/runtime/dashboard/types/blocks.d.ts +251 -0
  136. package/dist/runtime/dashboard/types/blocks.js +0 -0
  137. package/dist/runtime/dashboard/types/charts.d.ts +60 -0
  138. package/dist/runtime/dashboard/types/charts.js +0 -0
  139. package/dist/runtime/dashboard/types/index.d.ts +7 -0
  140. package/dist/runtime/dashboard/types/index.js +0 -0
  141. package/dist/runtime/dashboard/types/options.d.ts +46 -0
  142. package/dist/runtime/dashboard/types/options.js +0 -0
  143. package/dist/runtime/dashboard/types/params.d.ts +115 -0
  144. package/dist/runtime/dashboard/types/params.js +0 -0
  145. package/dist/runtime/dashboard/types/resource.d.ts +106 -0
  146. package/dist/runtime/dashboard/types/resource.js +0 -0
  147. package/dist/runtime/dashboard/types/runtime.d.ts +44 -0
  148. package/dist/runtime/dashboard/types/runtime.js +0 -0
  149. package/dist/runtime/dashboard/types/schema.d.ts +171 -0
  150. package/dist/runtime/dashboard/types/schema.js +0 -0
  151. package/dist/runtime/dashboard/types/ui.d.ts +201 -0
  152. package/dist/runtime/dashboard/types/ui.js +0 -0
  153. package/dist/runtime/dashboard/utils/builders/dashboard-params.d.ts +85 -0
  154. package/dist/runtime/dashboard/utils/builders/dashboard-params.js +87 -0
  155. package/dist/runtime/dashboard/utils/chart-frame.d.ts +5 -0
  156. package/dist/runtime/dashboard/utils/chart-frame.js +27 -0
  157. package/dist/runtime/dashboard/utils/charts.d.ts +61 -0
  158. package/dist/runtime/dashboard/utils/charts.js +142 -0
  159. package/dist/runtime/dashboard/utils/comparison.d.ts +15 -0
  160. package/dist/runtime/dashboard/utils/comparison.js +19 -0
  161. package/dist/runtime/dashboard/utils/export.d.ts +13 -0
  162. package/dist/runtime/dashboard/utils/export.js +45 -0
  163. package/dist/runtime/dashboard/utils/options.d.ts +12 -0
  164. package/dist/runtime/dashboard/utils/options.js +23 -0
  165. package/dist/runtime/dashboard/utils/params/codecs.d.ts +14 -0
  166. package/dist/runtime/dashboard/utils/params/codecs.js +69 -0
  167. package/dist/runtime/dashboard/utils/resource.d.ts +16 -0
  168. package/dist/runtime/dashboard/utils/resource.js +39 -0
  169. package/dist/runtime/dashboard/utils/schema.d.ts +9 -0
  170. package/dist/runtime/dashboard/utils/schema.js +31 -0
  171. package/dist/runtime/dashboard/utils/sparkline.d.ts +21 -0
  172. package/dist/runtime/dashboard/utils/sparkline.js +53 -0
  173. package/dist/runtime/dashboard/utils/state.d.ts +28 -0
  174. package/dist/runtime/dashboard/utils/state.js +32 -0
  175. package/dist/runtime/dashboard/utils/time.d.ts +17 -0
  176. package/dist/runtime/dashboard/utils/time.js +60 -0
  177. package/dist/runtime/dashboard/utils/tracker.d.ts +12 -0
  178. package/dist/runtime/dashboard/utils/tracker.js +31 -0
  179. package/dist/runtime/dashboard/utils/ui.d.ts +38 -0
  180. package/dist/runtime/dashboard/utils/ui.js +24 -0
  181. package/dist/runtime/dashboard/utils/visibility.d.ts +2 -0
  182. package/dist/runtime/dashboard/utils/visibility.js +25 -0
  183. package/dist/runtime/form/types/options.d.ts +15 -36
  184. package/dist/runtime/i18n/locales/en.js +62 -0
  185. package/dist/runtime/i18n/locales/fr.js +62 -0
  186. package/dist/runtime/i18n/types.d.ts +67 -0
  187. package/dist/runtime/shared/index.d.ts +2 -0
  188. package/dist/runtime/shared/styles/tokens.css +1 -1
  189. package/dist/runtime/shared/types/query.d.ts +10 -0
  190. package/dist/runtime/shared/types/query.js +0 -0
  191. package/dist/runtime/shared/types/remote-options.d.ts +37 -0
  192. package/dist/runtime/shared/types/remote-options.js +0 -0
  193. package/dist/runtime/spreadsheet/components/layout/spreadsheet-import-footer.d.vue.ts +2 -2
  194. package/dist/runtime/spreadsheet/components/layout/spreadsheet-import-footer.vue.d.ts +2 -2
  195. package/dist/runtime/spreadsheet/composables/use-spreadsheet-internals.d.ts +15 -15
  196. package/dist/runtime/spreadsheet/composables/use-spreadsheet-resolutions.d.ts +2 -2
  197. package/dist/runtime/spreadsheet/schema/normalize.d.ts +1 -1
  198. package/dist/runtime/spreadsheet/utils/references/sources.d.ts +1 -1
  199. package/dist/runtime/table/components/data-list/data-list-content.d.vue.ts +1 -1
  200. package/dist/runtime/table/components/data-list/data-list-content.vue.d.ts +1 -1
  201. package/dist/runtime/table/components/data-list/data-list-infinite-loader.d.vue.ts +1 -1
  202. package/dist/runtime/table/components/data-list/data-list-infinite-loader.vue.d.ts +1 -1
  203. package/dist/runtime/table/components/data-list/data-list-layout-switch.d.vue.ts +1 -1
  204. package/dist/runtime/table/components/data-list/data-list-layout-switch.vue.d.ts +1 -1
  205. package/dist/runtime/table/components/data-list/data-list-pagination.d.vue.ts +1 -1
  206. package/dist/runtime/table/components/data-list/data-list-pagination.vue.d.ts +1 -1
  207. package/dist/runtime/table/components/data-list/data-list-sort-menu.d.vue.ts +1 -1
  208. package/dist/runtime/table/components/data-list/data-list-sort-menu.vue.d.ts +1 -1
  209. package/dist/runtime/table/components/data-list/sort-menu-panel.d.vue.ts +2 -2
  210. package/dist/runtime/table/components/data-list/sort-menu-panel.vue.d.ts +2 -2
  211. package/dist/runtime/table/components/filters/shared/filter-match-mode-button.d.vue.ts +1 -1
  212. package/dist/runtime/table/components/filters/shared/filter-match-mode-button.vue.d.ts +1 -1
  213. package/dist/runtime/table/components/layout/table-footer.d.vue.ts +1 -1
  214. package/dist/runtime/table/components/layout/table-footer.vue.d.ts +1 -1
  215. package/dist/runtime/table/components/table/table-cell-ellipsis.d.ts +1 -1
  216. package/dist/runtime/table/composables/use-query-state.d.ts +3 -3
  217. package/dist/runtime/table/composables/use-table-columns.d.ts +3 -3
  218. package/dist/runtime/table/composables/use-table-internals.d.ts +27 -27
  219. package/dist/runtime/table/composables/use-table-pagination.d.ts +2 -2
  220. package/dist/runtime/table/composables/use-table-selection.d.ts +1 -1
  221. package/dist/runtime/table/composables/use-table-state.d.ts +3 -3
  222. package/dist/runtime/table/types/source.d.ts +4 -5
  223. package/dist/runtime/table/utils/columns/menu.d.ts +1 -1
  224. package/dist/runtime/table/utils/columns/state.d.ts +1 -1
  225. package/dist/runtime/table/utils/data-list-ui.d.ts +1 -1
  226. package/package.json +28 -1
@@ -0,0 +1,63 @@
1
+ import type { LazyTextValue } from '#ui-tools/shared/types/utils';
2
+ import type { DashboardBlockBaseProps, DashboardBlockUi, DashboardListUi, DashboardRowActions, DashboardSelected, DashboardSelectEvent, DashboardSeriesColor, 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<Omit<DashboardBlockBaseProps, "ui"> & {
5
+ source: DashboardSourceLike<readonly TRow[] | undefined>;
6
+ label: (row: TRow) => LazyTextValue;
7
+ description?: (row: TRow) => LazyTextValue | undefined;
8
+ /** Trailing value. Numbers go through `format`. */
9
+ value?: (row: TRow) => LazyTextValue;
10
+ format?: DashboardValueFormat;
11
+ /** Share in percent, shown before the value (inside the ring with `leading: 'ring'`). */
12
+ percent?: (row: TRow) => number | null | undefined;
13
+ /** Change in percent, colored by sign. */
14
+ delta?: (row: TRow) => number | null | undefined;
15
+ /**
16
+ * Leading visual: initials avatar, a short monospace code chip (country, currency…), or a
17
+ * progress ring filled to `percent`.
18
+ */
19
+ leading?: "avatar" | "code" | "ring";
20
+ /** Avatar initials or code text. Defaults to the label initials. */
21
+ leadingText?: (row: TRow) => string;
22
+ icon?: (row: TRow) => string | undefined;
23
+ /** Ring color of `leading: 'ring'`. Defaults to the palette order. */
24
+ color?: (row: TRow, index: number) => DashboardSeriesColor | undefined;
25
+ /** Rows shown in the card. The expand dialog, table view, and CSV export show them all. */
26
+ limit?: number;
27
+ rowKey?: (row: TRow, index: number) => PropertyKey;
28
+ /** Rows shown as selected (the value a `select` handler stored). */
29
+ selected?: DashboardSelected<TRow>;
30
+ /** Actions of each row: inline icon buttons and a `⋮` menu at the end of the row. */
31
+ rowActions?: DashboardRowActions<TRow>;
32
+ /** Makes each row a button. */
33
+ onSelect?: (event: DashboardSelectEvent<TRow>) => void;
34
+ ui?: DashboardBlockUi & DashboardListUi;
35
+ }> & (typeof globalThis extends {
36
+ __VLS_PROPS_FALLBACK: infer P;
37
+ } ? P : {});
38
+ expose: (exposed: {}) => void;
39
+ attrs: any;
40
+ slots: {
41
+ item?: (props: {
42
+ row: TRow;
43
+ index: number;
44
+ }) => unknown;
45
+ trailing?: (props: {
46
+ row: TRow;
47
+ index: number;
48
+ }) => unknown;
49
+ 'header-right'?: () => unknown;
50
+ toolbar?: () => unknown;
51
+ footer?: () => unknown;
52
+ };
53
+ emit: {};
54
+ }>) => import("vue").VNode & {
55
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
56
+ };
57
+ declare const _default: typeof __VLS_export;
58
+ export default _default;
59
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
60
+ [K in keyof T]: T[K];
61
+ } : {
62
+ [K in keyof T as K]: T[K];
63
+ }) & {};
@@ -0,0 +1,239 @@
1
+ <script setup>
2
+ import UIcon from "@nuxt/ui/components/Icon.vue";
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 { resolveDashboardColor } from "../utils/charts";
10
+ import { toDashboardCell } from "../utils/export";
11
+ import {
12
+ DASHBOARD_ROW_BUTTON,
13
+ DASHBOARD_SELECTABLE_ROW,
14
+ DASHBOARD_SELECTED_ROW,
15
+ resolveDashboardClasses
16
+ } from "../utils/ui";
17
+ import DashboardRing from "./block/dashboard-ring.vue";
18
+ import DashboardRowActionsMenu from "./block/dashboard-row-actions.vue";
19
+ import DashboardSkeleton from "./block/dashboard-skeleton.vue";
20
+ import DashboardCard from "./dashboard-card.vue";
21
+ const {
22
+ source,
23
+ card = true,
24
+ menu = void 0,
25
+ freshness = void 0,
26
+ label,
27
+ description,
28
+ value,
29
+ format,
30
+ percent,
31
+ delta,
32
+ leading,
33
+ leadingText,
34
+ icon,
35
+ color,
36
+ limit,
37
+ rowKey,
38
+ selected,
39
+ rowActions,
40
+ onSelect,
41
+ ui,
42
+ ...block
43
+ } = defineProps({
44
+ title: { type: [String, Number, Function], required: false },
45
+ subtitle: { type: [String, Number, Function], required: false },
46
+ size: { type: String, required: false },
47
+ rows: { type: String, required: false },
48
+ card: { type: Boolean, required: false },
49
+ activation: { type: String, required: false },
50
+ empty: { type: Object, required: false },
51
+ menu: { type: [Boolean, Array, Function], required: false },
52
+ actions: { type: Array, required: false },
53
+ freshness: { type: Boolean, required: false },
54
+ source: { type: Object, required: true },
55
+ label: { type: Function, required: true },
56
+ description: { type: Function, required: false },
57
+ value: { type: Function, required: false },
58
+ format: { type: Function, required: false },
59
+ percent: { type: Function, required: false },
60
+ delta: { type: Function, required: false },
61
+ leading: { type: String, required: false },
62
+ leadingText: { type: Function, required: false },
63
+ icon: { type: Function, required: false },
64
+ color: { type: Function, required: false },
65
+ limit: { type: Number, required: false },
66
+ rowKey: { type: Function, required: false },
67
+ selected: { type: Function, required: false },
68
+ rowActions: { type: Function, required: false },
69
+ onSelect: { type: Function, required: false },
70
+ ui: { type: Object, required: false }
71
+ });
72
+ defineSlots();
73
+ const { t } = useUiToolsLocale();
74
+ const formats = useDashboardFormat();
75
+ const appUi = useDashboardUi();
76
+ const classes = computed(
77
+ () => resolveDashboardClasses(
78
+ {
79
+ avatar: "grid size-[30px] shrink-0 place-items-center rounded-[7px] bg-elevated text-[11px] font-semibold text-muted",
80
+ code: "grid h-[22px] min-w-8 shrink-0 place-items-center rounded-[5px] bg-elevated px-1.5 font-mono text-[11px] font-semibold text-muted",
81
+ delta: "shrink-0 text-xs font-semibold tabular-nums",
82
+ description: "block truncate text-xs text-muted",
83
+ label: "block truncate font-medium text-default",
84
+ ring: "text-[9.5px] font-semibold tracking-tight whitespace-nowrap text-default tabular-nums",
85
+ row: "flex min-w-0 items-center gap-3 py-[9px] text-[13px]",
86
+ share: "shrink-0 text-xs text-muted tabular-nums",
87
+ value: "shrink-0 font-semibold text-highlighted tabular-nums"
88
+ },
89
+ appUi.value.list,
90
+ ui
91
+ )
92
+ );
93
+ const entries = computed(
94
+ () => (source.data ?? []).map((row, index) => {
95
+ const text = resolveTextValue(label(row));
96
+ const raw = value?.(row);
97
+ const change = delta?.(row);
98
+ const share = percent?.(row);
99
+ return {
100
+ actions: rowActions?.(row, index) ?? [],
101
+ change: isNumber(change) ? { good: change >= 0, label: formats.delta.value(change) } : null,
102
+ color: resolveDashboardColor(color?.(row, index), index),
103
+ delta: change,
104
+ description: description ? resolveTextValue(description(row)) : "",
105
+ icon: icon?.(row),
106
+ index,
107
+ key: rowKey?.(row, index) ?? index,
108
+ label: text,
109
+ leading: leading === "avatar" || leading === "code" ? leadingText?.(row) ?? initials(text) : "",
110
+ percent: share,
111
+ raw,
112
+ row,
113
+ selected: selected?.(row, index) ?? false,
114
+ share: isNumber(share) ? formats.percent.value(share) : "",
115
+ value: isNumber(raw) ? (format ?? formats.number.value)(raw) : resolveTextValue(raw)
116
+ };
117
+ })
118
+ );
119
+ const visible = (expanded) => limit && !expanded ? entries.value.slice(0, limit) : entries.value;
120
+ function tabulate() {
121
+ const columns = [
122
+ { key: "label", label: t("dashboard.table.label"), numeric: false },
123
+ description && { key: "description", label: t("dashboard.table.description"), numeric: false },
124
+ percent && { key: "share", label: t("dashboard.table.share"), numeric: true },
125
+ delta && { key: "change", label: t("dashboard.table.change"), numeric: true },
126
+ value && { key: "value", label: t("dashboard.table.value"), numeric: true }
127
+ ];
128
+ return {
129
+ columns: columns.filter((column) => column !== void 0),
130
+ rows: entries.value.map(
131
+ (entry) => [
132
+ toDashboardCell(entry.label),
133
+ description && toDashboardCell(entry.description),
134
+ percent && toDashboardCell(entry.percent, entry.share),
135
+ delta && toDashboardCell(entry.delta, entry.change?.label ?? ""),
136
+ value && toDashboardCell(isNumber(entry.raw) ? entry.raw : entry.value, entry.value)
137
+ ].filter((cell) => cell !== void 0)
138
+ )
139
+ };
140
+ }
141
+ function initials(text) {
142
+ return text.split(/\s+/u).slice(0, 2).map((word) => word.charAt(0).toUpperCase()).join("");
143
+ }
144
+ </script>
145
+
146
+ <template>
147
+ <DashboardCard
148
+ v-bind="block"
149
+ :card
150
+ :menu
151
+ :freshness
152
+ :ui
153
+ :source
154
+ :is-empty="entries.length === 0"
155
+ :tabulate
156
+ >
157
+ <template #skeleton>
158
+ <DashboardSkeleton
159
+ kind="rows"
160
+ :count="limit ?? 6"
161
+ :leading="leading === 'ring' ? 'icon' : leading"
162
+ />
163
+ </template>
164
+ <template v-if="$slots['header-right']" #header-right>
165
+ <slot name="header-right" />
166
+ </template>
167
+ <template v-if="$slots.toolbar" #toolbar>
168
+ <slot name="toolbar" />
169
+ </template>
170
+ <template v-if="$slots.footer" #footer>
171
+ <slot name="footer" />
172
+ </template>
173
+
174
+ <template #default="{ expanded }">
175
+ <ul class="flex flex-col divide-y divide-[var(--nut-dash-grid)]">
176
+ <li
177
+ v-for="entry in visible(expanded)"
178
+ :key="entry.key"
179
+ :data-selected="entry.selected || void 0"
180
+ :class="[
181
+ classes.row,
182
+ onSelect && DASHBOARD_SELECTABLE_ROW,
183
+ entry.selected && DASHBOARD_SELECTED_ROW
184
+ ]"
185
+ >
186
+ <slot name="item" :row="entry.row" :index="entry.index">
187
+ <span v-if="leading === 'avatar'" :class="classes.avatar">{{ entry.leading }}</span>
188
+ <span v-else-if="leading === 'code'" :class="classes.code">{{ entry.leading }}</span>
189
+ <DashboardRing
190
+ v-else-if="leading === 'ring'"
191
+ :ratio="(entry.percent ?? 0) / 100"
192
+ :color="entry.color"
193
+ :size="40"
194
+ :thickness="3"
195
+ >
196
+ <span :class="classes.ring">{{ entry.share }}</span>
197
+ </DashboardRing>
198
+ <UIcon v-else-if="entry.icon" :name="entry.icon" class="size-4 shrink-0 text-dimmed" />
199
+ <div class="min-w-0 flex-1">
200
+ <b :class="classes.label">{{ entry.label }}</b>
201
+ <small v-if="entry.description" :class="classes.description">
202
+ {{ entry.description }}
203
+ </small>
204
+ </div>
205
+ <span v-if="entry.share && leading !== 'ring'" :class="classes.share">
206
+ {{ entry.share }}
207
+ </span>
208
+ <span
209
+ v-if="entry.change"
210
+ :data-trend="entry.change.good ? 'up' : 'down'"
211
+ :class="[
212
+ classes.delta,
213
+ entry.change.good ? 'text-[var(--nut-dash-up)]' : 'text-[var(--nut-dash-down)]'
214
+ ]"
215
+ >
216
+ {{ entry.change.label }}
217
+ </span>
218
+ <span :class="classes.value">
219
+ <slot name="trailing" :row="entry.row" :index="entry.index">{{ entry.value }}</slot>
220
+ </span>
221
+ </slot>
222
+ <button
223
+ v-if="onSelect"
224
+ type="button"
225
+ :class="DASHBOARD_ROW_BUTTON"
226
+ :aria-label="entry.label"
227
+ :aria-pressed="selected ? entry.selected : void 0"
228
+ @click="onSelect({ index: entry.index, row: entry.row })"
229
+ />
230
+ <DashboardRowActionsMenu
231
+ v-if="entry.actions.length"
232
+ :actions="entry.actions"
233
+ :label="entry.label"
234
+ />
235
+ </li>
236
+ </ul>
237
+ </template>
238
+ </DashboardCard>
239
+ </template>
@@ -0,0 +1,63 @@
1
+ import type { LazyTextValue } from '#ui-tools/shared/types/utils';
2
+ import type { DashboardBlockBaseProps, DashboardBlockUi, DashboardListUi, DashboardRowActions, DashboardSelected, DashboardSelectEvent, DashboardSeriesColor, 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<Omit<DashboardBlockBaseProps, "ui"> & {
5
+ source: DashboardSourceLike<readonly TRow[] | undefined>;
6
+ label: (row: TRow) => LazyTextValue;
7
+ description?: (row: TRow) => LazyTextValue | undefined;
8
+ /** Trailing value. Numbers go through `format`. */
9
+ value?: (row: TRow) => LazyTextValue;
10
+ format?: DashboardValueFormat;
11
+ /** Share in percent, shown before the value (inside the ring with `leading: 'ring'`). */
12
+ percent?: (row: TRow) => number | null | undefined;
13
+ /** Change in percent, colored by sign. */
14
+ delta?: (row: TRow) => number | null | undefined;
15
+ /**
16
+ * Leading visual: initials avatar, a short monospace code chip (country, currency…), or a
17
+ * progress ring filled to `percent`.
18
+ */
19
+ leading?: "avatar" | "code" | "ring";
20
+ /** Avatar initials or code text. Defaults to the label initials. */
21
+ leadingText?: (row: TRow) => string;
22
+ icon?: (row: TRow) => string | undefined;
23
+ /** Ring color of `leading: 'ring'`. Defaults to the palette order. */
24
+ color?: (row: TRow, index: number) => DashboardSeriesColor | undefined;
25
+ /** Rows shown in the card. The expand dialog, table view, and CSV export show them all. */
26
+ limit?: number;
27
+ rowKey?: (row: TRow, index: number) => PropertyKey;
28
+ /** Rows shown as selected (the value a `select` handler stored). */
29
+ selected?: DashboardSelected<TRow>;
30
+ /** Actions of each row: inline icon buttons and a `⋮` menu at the end of the row. */
31
+ rowActions?: DashboardRowActions<TRow>;
32
+ /** Makes each row a button. */
33
+ onSelect?: (event: DashboardSelectEvent<TRow>) => void;
34
+ ui?: DashboardBlockUi & DashboardListUi;
35
+ }> & (typeof globalThis extends {
36
+ __VLS_PROPS_FALLBACK: infer P;
37
+ } ? P : {});
38
+ expose: (exposed: {}) => void;
39
+ attrs: any;
40
+ slots: {
41
+ item?: (props: {
42
+ row: TRow;
43
+ index: number;
44
+ }) => unknown;
45
+ trailing?: (props: {
46
+ row: TRow;
47
+ index: number;
48
+ }) => unknown;
49
+ 'header-right'?: () => unknown;
50
+ toolbar?: () => unknown;
51
+ footer?: () => unknown;
52
+ };
53
+ emit: {};
54
+ }>) => import("vue").VNode & {
55
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
56
+ };
57
+ declare const _default: typeof __VLS_export;
58
+ export default _default;
59
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
60
+ [K in keyof T]: T[K];
61
+ } : {
62
+ [K in keyof T as K]: T[K];
63
+ }) & {};
@@ -0,0 +1,43 @@
1
+ import type { LazyTextValue } from '#ui-tools/shared/types/utils';
2
+ import type { DashboardBlockBaseProps, DashboardBlockUi, DashboardPairedBarsUi, DashboardSelectEvent, DashboardSeriesColor, 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<Omit<DashboardBlockBaseProps, "ui"> & {
5
+ source: DashboardSourceLike<readonly TRow[] | undefined>;
6
+ label: (row: TRow) => LazyTextValue;
7
+ /** Outer bar (e.g. registered). Scaled against the largest total. */
8
+ total: (row: TRow) => number;
9
+ /** Inner bar, drawn inside the total (e.g. delivered). */
10
+ value: (row: TRow) => number;
11
+ /** Legend labels. When both are set, a legend renders in the header. */
12
+ totalLabel?: LazyTextValue;
13
+ valueLabel?: LazyTextValue;
14
+ format?: DashboardValueFormat;
15
+ /** `[total, value]` colors. */
16
+ colors?: readonly [DashboardSeriesColor, DashboardSeriesColor];
17
+ /** Rows shown in the card. The expand dialog, table view, and CSV export show them all. */
18
+ limit?: number;
19
+ rowKey?: (row: TRow, index: number) => PropertyKey;
20
+ /** Makes each row a button. */
21
+ onSelect?: (event: DashboardSelectEvent<TRow>) => void;
22
+ ui?: DashboardBlockUi & DashboardPairedBarsUi;
23
+ }> & (typeof globalThis extends {
24
+ __VLS_PROPS_FALLBACK: infer P;
25
+ } ? P : {});
26
+ expose: (exposed: {}) => void;
27
+ attrs: any;
28
+ slots: {
29
+ 'header-right'?: () => unknown;
30
+ toolbar?: () => unknown;
31
+ footer?: () => unknown;
32
+ };
33
+ emit: {};
34
+ }>) => import("vue").VNode & {
35
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
36
+ };
37
+ declare const _default: typeof __VLS_export;
38
+ export default _default;
39
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
40
+ [K in keyof T]: T[K];
41
+ } : {
42
+ [K in keyof T as K]: T[K];
43
+ }) & {};
@@ -0,0 +1,194 @@
1
+ <script setup>
2
+ import { computed } from "vue";
3
+ import { useUiToolsLocale } from "#ui-tools/i18n";
4
+ import { resolveTextValue } from "#ui-tools/shared/utils/render";
5
+ import { useDashboardFormat } from "../composables/use-dashboard-format";
6
+ import { useDashboardUi } from "../composables/use-dashboard-ui";
7
+ import { resolveDashboardColor } from "../utils/charts";
8
+ import { toDashboardCell } from "../utils/export";
9
+ import {
10
+ DASHBOARD_ROW_BUTTON,
11
+ DASHBOARD_SELECTABLE_ROW,
12
+ resolveDashboardClasses
13
+ } from "../utils/ui";
14
+ import DashboardSkeleton from "./block/dashboard-skeleton.vue";
15
+ import DashboardCard from "./dashboard-card.vue";
16
+ const {
17
+ source,
18
+ card = true,
19
+ menu = void 0,
20
+ freshness = void 0,
21
+ label,
22
+ total,
23
+ value,
24
+ totalLabel,
25
+ valueLabel,
26
+ format,
27
+ colors,
28
+ limit,
29
+ rowKey,
30
+ onSelect,
31
+ ui,
32
+ ...block
33
+ } = defineProps({
34
+ title: { type: [String, Number, Function], required: false },
35
+ subtitle: { type: [String, Number, Function], required: false },
36
+ size: { type: String, required: false },
37
+ rows: { type: String, required: false },
38
+ card: { type: Boolean, required: false },
39
+ activation: { type: String, required: false },
40
+ empty: { type: Object, required: false },
41
+ menu: { type: [Boolean, Array, Function], required: false },
42
+ actions: { type: Array, required: false },
43
+ freshness: { type: Boolean, required: false },
44
+ source: { type: Object, required: true },
45
+ label: { type: Function, required: true },
46
+ total: { type: Function, required: true },
47
+ value: { type: Function, required: true },
48
+ totalLabel: { type: [String, Number, Function], required: false },
49
+ valueLabel: { type: [String, Number, Function], required: false },
50
+ format: { type: Function, required: false },
51
+ colors: { type: Array, required: false },
52
+ limit: { type: Number, required: false },
53
+ rowKey: { type: Function, required: false },
54
+ onSelect: { type: Function, required: false },
55
+ ui: { type: Object, required: false }
56
+ });
57
+ defineSlots();
58
+ const { t } = useUiToolsLocale();
59
+ const formats = useDashboardFormat();
60
+ const appUi = useDashboardUi();
61
+ const classes = computed(
62
+ () => resolveDashboardClasses(
63
+ {
64
+ label: "truncate text-[13px] text-default",
65
+ row: "grid grid-cols-[minmax(0,150px)_1fr_auto] items-center gap-3 py-1.5 max-sm:grid-cols-[minmax(0,110px)_1fr_auto]",
66
+ track: "h-3 overflow-hidden rounded-full bg-[var(--nut-dash-track)]",
67
+ value: "flex min-w-[130px] items-baseline justify-end gap-[5px] tabular-nums max-sm:min-w-0"
68
+ },
69
+ appUi.value.pairedBars,
70
+ ui
71
+ )
72
+ );
73
+ const totalColor = computed(() => resolveDashboardColor(colors?.[0] ?? "series-4", 3));
74
+ const valueColor = computed(() => resolveDashboardColor(colors?.[1] ?? "series-1", 0));
75
+ const legend = computed(
76
+ () => totalLabel && valueLabel ? [
77
+ { color: totalColor.value, key: "total", label: resolveTextValue(totalLabel) },
78
+ { color: valueColor.value, key: "value", label: resolveTextValue(valueLabel) }
79
+ ] : void 0
80
+ );
81
+ const formatValue = computed(() => format ?? formats.number.value);
82
+ const entries = computed(
83
+ () => (source.data ?? []).map((row, index) => {
84
+ const outer = total(row);
85
+ const inner = value(row);
86
+ return {
87
+ index,
88
+ inner,
89
+ innerWidth: outer > 0 ? `${Math.min(100, inner / outer * 100)}%` : "0%",
90
+ key: rowKey?.(row, index) ?? index,
91
+ label: resolveTextValue(label(row)),
92
+ outer,
93
+ ratio: outer > 0 ? formats.percent.value(Math.round(inner / outer * 100)) : "",
94
+ row
95
+ };
96
+ })
97
+ );
98
+ function visible(expanded) {
99
+ const shown = limit && !expanded ? entries.value.slice(0, limit) : entries.value;
100
+ const largest = Math.max(0, ...shown.map((entry) => entry.outer));
101
+ return shown.map((entry) => ({
102
+ ...entry,
103
+ outerWidth: largest > 0 ? `${entry.outer / largest * 100}%` : "0%"
104
+ }));
105
+ }
106
+ function tabulate() {
107
+ return {
108
+ columns: [
109
+ { key: "label", label: t("dashboard.table.label"), numeric: false },
110
+ {
111
+ key: "value",
112
+ label: resolveTextValue(valueLabel, t("dashboard.table.value")),
113
+ numeric: true
114
+ },
115
+ {
116
+ key: "total",
117
+ label: resolveTextValue(totalLabel, t("dashboard.table.total")),
118
+ numeric: true
119
+ }
120
+ ],
121
+ rows: entries.value.map((entry) => [
122
+ toDashboardCell(entry.label),
123
+ toDashboardCell(entry.inner, formatValue.value(entry.inner)),
124
+ toDashboardCell(entry.outer, formatValue.value(entry.outer))
125
+ ])
126
+ };
127
+ }
128
+ </script>
129
+
130
+ <template>
131
+ <DashboardCard
132
+ v-bind="block"
133
+ :card
134
+ :menu
135
+ :freshness
136
+ :ui
137
+ :source
138
+ :legend
139
+ :is-empty="entries.length === 0"
140
+ :tabulate
141
+ >
142
+ <template #skeleton>
143
+ <DashboardSkeleton kind="paired" :count="limit ?? 8" />
144
+ </template>
145
+ <template v-if="$slots['header-right']" #header-right>
146
+ <slot name="header-right" />
147
+ </template>
148
+ <template v-if="$slots.toolbar" #toolbar>
149
+ <slot name="toolbar" />
150
+ </template>
151
+ <template v-if="$slots.footer" #footer>
152
+ <slot name="footer" />
153
+ </template>
154
+
155
+ <template #default="{ expanded }">
156
+ <ul class="flex flex-col">
157
+ <li
158
+ v-for="entry in visible(expanded)"
159
+ :key="entry.key"
160
+ :class="[classes.row, onSelect && DASHBOARD_SELECTABLE_ROW]"
161
+ >
162
+ <span :class="classes.label" :title="entry.label">{{ entry.label }}</span>
163
+ <div :class="classes.track">
164
+ <div
165
+ class="relative h-full rounded-full transition-[width] duration-500 ease-out"
166
+ :style="{ background: totalColor, width: entry.outerWidth }"
167
+ >
168
+ <div
169
+ class="absolute inset-y-0 start-0 rounded-full transition-[width] duration-500 ease-out"
170
+ :style="{ background: valueColor, width: entry.innerWidth }"
171
+ />
172
+ </div>
173
+ </div>
174
+ <span :class="classes.value">
175
+ <b class="text-[13.5px] font-semibold text-highlighted">
176
+ {{ formatValue(entry.inner) }}
177
+ </b>
178
+ <span class="text-xs text-muted">/ {{ formatValue(entry.outer) }}</span>
179
+ <small class="min-w-[34px] text-end text-[11.5px] text-dimmed max-sm:hidden">
180
+ {{ entry.ratio }}
181
+ </small>
182
+ </span>
183
+ <button
184
+ v-if="onSelect"
185
+ type="button"
186
+ :class="DASHBOARD_ROW_BUTTON"
187
+ :aria-label="entry.label"
188
+ @click="onSelect({ index: entry.index, row: entry.row })"
189
+ />
190
+ </li>
191
+ </ul>
192
+ </template>
193
+ </DashboardCard>
194
+ </template>
@@ -0,0 +1,43 @@
1
+ import type { LazyTextValue } from '#ui-tools/shared/types/utils';
2
+ import type { DashboardBlockBaseProps, DashboardBlockUi, DashboardPairedBarsUi, DashboardSelectEvent, DashboardSeriesColor, 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<Omit<DashboardBlockBaseProps, "ui"> & {
5
+ source: DashboardSourceLike<readonly TRow[] | undefined>;
6
+ label: (row: TRow) => LazyTextValue;
7
+ /** Outer bar (e.g. registered). Scaled against the largest total. */
8
+ total: (row: TRow) => number;
9
+ /** Inner bar, drawn inside the total (e.g. delivered). */
10
+ value: (row: TRow) => number;
11
+ /** Legend labels. When both are set, a legend renders in the header. */
12
+ totalLabel?: LazyTextValue;
13
+ valueLabel?: LazyTextValue;
14
+ format?: DashboardValueFormat;
15
+ /** `[total, value]` colors. */
16
+ colors?: readonly [DashboardSeriesColor, DashboardSeriesColor];
17
+ /** Rows shown in the card. The expand dialog, table view, and CSV export show them all. */
18
+ limit?: number;
19
+ rowKey?: (row: TRow, index: number) => PropertyKey;
20
+ /** Makes each row a button. */
21
+ onSelect?: (event: DashboardSelectEvent<TRow>) => void;
22
+ ui?: DashboardBlockUi & DashboardPairedBarsUi;
23
+ }> & (typeof globalThis extends {
24
+ __VLS_PROPS_FALLBACK: infer P;
25
+ } ? P : {});
26
+ expose: (exposed: {}) => void;
27
+ attrs: any;
28
+ slots: {
29
+ 'header-right'?: () => unknown;
30
+ toolbar?: () => unknown;
31
+ footer?: () => unknown;
32
+ };
33
+ emit: {};
34
+ }>) => import("vue").VNode & {
35
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
36
+ };
37
+ declare const _default: typeof __VLS_export;
38
+ export default _default;
39
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
40
+ [K in keyof T]: T[K];
41
+ } : {
42
+ [K in keyof T as K]: T[K];
43
+ }) & {};
@@ -0,0 +1,29 @@
1
+ /** What the control drives: the dashboard object returned by `useDashboard`. */
2
+ interface DashboardRefreshTarget {
3
+ refresh: () => Promise<void>;
4
+ readonly refreshing: boolean;
5
+ readonly updatedAt: number | undefined;
6
+ autoRefresh: number;
7
+ }
8
+ /**
9
+ * Refresh control for a dashboard header: a refresh button, an auto-refresh interval menu (kept in
10
+ * the URL by the dashboard), and "Updated 3 min ago".
11
+ *
12
+ * @example
13
+ * ```vue
14
+ * <UiDashboardRefresh :dashboard />
15
+ * ```
16
+ */
17
+ type __VLS_Props = {
18
+ dashboard: DashboardRefreshTarget;
19
+ /** Auto-refresh choices in seconds; `0` turns it off. */
20
+ intervals?: readonly number[];
21
+ /** Shows when the data on screen was last fetched. */
22
+ updated?: boolean;
23
+ /** Shows the "Refresh" label next to the icon. */
24
+ label?: boolean;
25
+ size?: 'xs' | 'sm' | 'md';
26
+ };
27
+ 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>;
28
+ declare const _default: typeof __VLS_export;
29
+ export default _default;