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.
Files changed (258) 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 +315 -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 +239 -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 +5 -0
  164. package/dist/runtime/dashboard/utils/options.js +18 -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 +65 -1
  185. package/dist/runtime/i18n/locales/fr.js +65 -1
  186. package/dist/runtime/i18n/types.d.ts +70 -0
  187. package/dist/runtime/shared/index.d.ts +2 -0
  188. package/dist/runtime/shared/styles/scrollbars.css +1 -1
  189. package/dist/runtime/shared/styles/tokens.css +1 -1
  190. package/dist/runtime/shared/types/query.d.ts +10 -0
  191. package/dist/runtime/shared/types/query.js +0 -0
  192. package/dist/runtime/shared/types/remote-options.d.ts +37 -0
  193. package/dist/runtime/shared/types/remote-options.js +0 -0
  194. package/dist/runtime/shared/utils/remote-options.d.ts +10 -0
  195. package/dist/runtime/shared/utils/remote-options.js +6 -0
  196. package/dist/runtime/spreadsheet/components/layout/spreadsheet-import-footer.d.vue.ts +2 -2
  197. package/dist/runtime/spreadsheet/components/layout/spreadsheet-import-footer.vue.d.ts +2 -2
  198. package/dist/runtime/spreadsheet/composables/use-spreadsheet-internals.d.ts +15 -15
  199. package/dist/runtime/spreadsheet/composables/use-spreadsheet-resolutions.d.ts +2 -2
  200. package/dist/runtime/spreadsheet/schema/normalize.d.ts +1 -1
  201. package/dist/runtime/spreadsheet/utils/references/sources.d.ts +1 -1
  202. package/dist/runtime/table/components/data-list/data-list-content.d.vue.ts +1 -1
  203. package/dist/runtime/table/components/data-list/data-list-content.vue.d.ts +1 -1
  204. package/dist/runtime/table/components/data-list/data-list-infinite-loader.d.vue.ts +1 -1
  205. package/dist/runtime/table/components/data-list/data-list-infinite-loader.vue.d.ts +1 -1
  206. package/dist/runtime/table/components/data-list/data-list-layout-switch.d.vue.ts +1 -1
  207. package/dist/runtime/table/components/data-list/data-list-layout-switch.vue.d.ts +1 -1
  208. package/dist/runtime/table/components/data-list/data-list-pagination.d.vue.ts +1 -1
  209. package/dist/runtime/table/components/data-list/data-list-pagination.vue.d.ts +1 -1
  210. package/dist/runtime/table/components/data-list/data-list-sort-menu.d.vue.ts +1 -1
  211. package/dist/runtime/table/components/data-list/data-list-sort-menu.vue.d.ts +1 -1
  212. package/dist/runtime/table/components/data-list/sort-menu-panel.d.vue.ts +2 -2
  213. package/dist/runtime/table/components/data-list/sort-menu-panel.vue.d.ts +2 -2
  214. package/dist/runtime/table/components/filters/shared/filter-match-mode-button.d.vue.ts +1 -1
  215. package/dist/runtime/table/components/filters/shared/filter-match-mode-button.vue.d.ts +1 -1
  216. package/dist/runtime/table/components/filters/shared/filter-option-list-end.d.vue.ts +11 -0
  217. package/dist/runtime/table/components/filters/shared/filter-option-list-end.vue +76 -0
  218. package/dist/runtime/table/components/filters/shared/filter-option-list-end.vue.d.ts +11 -0
  219. package/dist/runtime/table/components/filters/shared/filter-option-loading-list.d.vue.ts +3 -0
  220. package/dist/runtime/table/components/filters/shared/filter-option-loading-list.vue +2 -1
  221. package/dist/runtime/table/components/filters/shared/filter-option-loading-list.vue.d.ts +3 -0
  222. package/dist/runtime/table/components/filters/shared/filter-option-multiple-list.vue +1 -1
  223. package/dist/runtime/table/components/filters/shared/filter-option-picker-content.vue +13 -0
  224. package/dist/runtime/table/components/filters/shared/filter-option-single-list.d.vue.ts +2 -0
  225. package/dist/runtime/table/components/filters/shared/filter-option-single-list.vue +1 -1
  226. package/dist/runtime/table/components/filters/shared/filter-option-single-list.vue.d.ts +2 -0
  227. package/dist/runtime/table/components/filters/shared/filter-option-tree-content.d.vue.ts +3 -0
  228. package/dist/runtime/table/components/filters/shared/filter-option-tree-content.vue +2 -2
  229. package/dist/runtime/table/components/filters/shared/filter-option-tree-content.vue.d.ts +3 -0
  230. package/dist/runtime/table/components/filters/shared/filter-searchable-panel.vue +1 -0
  231. package/dist/runtime/table/components/layout/table-footer.d.vue.ts +1 -1
  232. package/dist/runtime/table/components/layout/table-footer.vue.d.ts +1 -1
  233. package/dist/runtime/table/components/table/table-cell-ellipsis.d.ts +1 -1
  234. package/dist/runtime/table/composables/use-option-filter-editor-state.d.ts +13 -1
  235. package/dist/runtime/table/composables/use-option-filter-editor-state.js +6 -2
  236. package/dist/runtime/table/composables/use-query-state.d.ts +3 -3
  237. package/dist/runtime/table/composables/use-table-columns.d.ts +3 -3
  238. package/dist/runtime/table/composables/use-table-filter-options.d.ts +11 -1
  239. package/dist/runtime/table/composables/use-table-filter-options.js +128 -17
  240. package/dist/runtime/table/composables/use-table-filter-selected-options.d.ts +20 -0
  241. package/dist/runtime/table/composables/use-table-filter-selected-options.js +99 -0
  242. package/dist/runtime/table/composables/use-table-filters.d.ts +5 -0
  243. package/dist/runtime/table/composables/use-table-filters.js +20 -1
  244. package/dist/runtime/table/composables/use-table-internals.d.ts +42 -27
  245. package/dist/runtime/table/composables/use-table-pagination.d.ts +2 -2
  246. package/dist/runtime/table/composables/use-table-remote-filter-options.d.ts +42 -0
  247. package/dist/runtime/table/composables/use-table-remote-filter-options.js +102 -0
  248. package/dist/runtime/table/composables/use-table-selection.d.ts +1 -1
  249. package/dist/runtime/table/composables/use-table-state.d.ts +3 -3
  250. package/dist/runtime/table/types/filters.d.ts +42 -0
  251. package/dist/runtime/table/types/source.d.ts +9 -5
  252. package/dist/runtime/table/utils/columns/menu.d.ts +1 -1
  253. package/dist/runtime/table/utils/columns/state.d.ts +1 -1
  254. package/dist/runtime/table/utils/data-list-ui.d.ts +1 -1
  255. package/dist/runtime/table/utils/filters/options.d.ts +2 -0
  256. package/dist/runtime/table/utils/filters/options.js +1 -1
  257. package/dist/runtime/table/utils/prefetch.js +21 -1
  258. package/package.json +28 -1
@@ -0,0 +1,305 @@
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, isString } 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_TABLE_CLASSES,
13
+ DASHBOARD_TABLE_ROW_BUTTON,
14
+ resolveDashboardClasses
15
+ } from "../utils/ui";
16
+ import DashboardRowActionsMenu from "./block/dashboard-row-actions.vue";
17
+ import DashboardSkeleton from "./block/dashboard-skeleton.vue";
18
+ import DashboardCard from "./dashboard-card.vue";
19
+ const {
20
+ source,
21
+ card = true,
22
+ menu = void 0,
23
+ freshness = void 0,
24
+ columns,
25
+ limit,
26
+ maxHeight,
27
+ rowKey,
28
+ selected,
29
+ rowActions,
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
+ columns: { type: Array, required: true },
46
+ limit: { type: Number, required: false },
47
+ maxHeight: { type: Number, required: false },
48
+ rowKey: { type: Function, required: false },
49
+ selected: { type: Function, required: false },
50
+ rowActions: { type: Function, required: false },
51
+ onSelect: { type: Function, required: false },
52
+ ui: { type: Object, required: false }
53
+ });
54
+ const sort = defineModel("sort", { type: null });
55
+ defineSlots();
56
+ const { t, code } = useUiToolsLocale();
57
+ const formats = useDashboardFormat();
58
+ const appUi = useDashboardUi();
59
+ const classes = computed(
60
+ () => resolveDashboardClasses(DASHBOARD_TABLE_CLASSES, appUi.value.table, ui)
61
+ );
62
+ const alignClasses = { center: "text-center", end: "text-end", start: "text-start" };
63
+ const resolvedColumns = computed(
64
+ () => columns.map((column) => {
65
+ const type = column.type ?? "text";
66
+ const numeric = type !== "text";
67
+ return {
68
+ align: alignClasses[column.align ?? (numeric ? "end" : "start")],
69
+ color: resolveDashboardColor(column.color, 0),
70
+ column,
71
+ key: column.key,
72
+ label: resolveTextValue(column.label),
73
+ numeric,
74
+ sortable: column.sortable ?? true,
75
+ type
76
+ };
77
+ })
78
+ );
79
+ const entries = computed(() => {
80
+ const rows = source.data ?? [];
81
+ const values = rows.map(
82
+ (row, index) => resolvedColumns.value.map(({ column }) => resolveCellValue(column.value(row, index)))
83
+ );
84
+ const maxima = resolvedColumns.value.map(
85
+ ({ column, type }, position) => type === "bar" ? column.max ?? Math.max(0, ...values.map((cells) => cellNumber(cells[position]))) : 0
86
+ );
87
+ return rows.map((row, index) => ({
88
+ cells: resolvedColumns.value.map((resolved, position) => {
89
+ const value = values[index]?.[position] ?? null;
90
+ if (value === null || !isNumber(value)) {
91
+ return { text: resolveTextValue(value), value };
92
+ }
93
+ const { column, type } = resolved;
94
+ if (type === "delta") {
95
+ const good = column.invert ? value <= 0 : value >= 0;
96
+ return { good, text: (column.format ?? formats.delta.value)(value), value };
97
+ }
98
+ const format = column.format ?? (type === "percent" ? formats.percent.value : formats.number.value);
99
+ const max = maxima[position] ?? 0;
100
+ const width = type === "bar" && max > 0 ? `${Math.max(0, Math.min(100, value / max * 100))}%` : void 0;
101
+ return { text: format(value), value, width };
102
+ }),
103
+ actions: rowActions?.(row, index) ?? [],
104
+ index,
105
+ key: rowKey?.(row, index) ?? index,
106
+ row,
107
+ selected: selected?.(row, index) ?? false
108
+ }));
109
+ });
110
+ const sorted = computed(() => {
111
+ const current = sort.value;
112
+ const position = current ? resolvedColumns.value.findIndex((c) => c.key === current.key) : -1;
113
+ if (!current || position < 0) return entries.value;
114
+ const direction = current.direction === "asc" ? 1 : -1;
115
+ return [...entries.value].sort(
116
+ (a, b) => compareCells(a.cells[position]?.value ?? null, b.cells[position]?.value ?? null, direction)
117
+ );
118
+ });
119
+ const visible = (expanded) => limit && !expanded ? sorted.value.slice(0, limit) : sorted.value;
120
+ function compareCells(a, b, direction) {
121
+ if (a === null || b === null) return a === b ? 0 : a === null ? 1 : -1;
122
+ if (isNumber(a) && isNumber(b)) return (a - b) * direction;
123
+ return String(a).localeCompare(String(b), code.value, { numeric: true }) * direction;
124
+ }
125
+ function resolveCellValue(raw) {
126
+ if (raw === null || raw === void 0) return null;
127
+ if (isString(raw) || isNumber(raw)) return raw;
128
+ return raw();
129
+ }
130
+ function cellNumber(value) {
131
+ return isNumber(value) && Number.isFinite(value) ? value : 0;
132
+ }
133
+ function toggleSort(key, numeric) {
134
+ const first = numeric ? "desc" : "asc";
135
+ const current = sort.value;
136
+ if (current?.key !== key) sort.value = { direction: first, key };
137
+ else if (current.direction === first)
138
+ sort.value = { direction: first === "asc" ? "desc" : "asc", key };
139
+ else sort.value = null;
140
+ }
141
+ function ariaSort(key) {
142
+ if (sort.value?.key !== key) return "none";
143
+ return sort.value.direction === "asc" ? "ascending" : "descending";
144
+ }
145
+ function tabulate() {
146
+ return {
147
+ columns: resolvedColumns.value.map((column) => ({
148
+ key: column.key,
149
+ label: column.label,
150
+ numeric: column.numeric
151
+ })),
152
+ rows: sorted.value.map(
153
+ (entry) => entry.cells.map((cell) => toDashboardCell(cell.value, cell.text))
154
+ )
155
+ };
156
+ }
157
+ </script>
158
+
159
+ <template>
160
+ <DashboardCard
161
+ v-bind="block"
162
+ :card
163
+ :menu
164
+ :freshness
165
+ :ui
166
+ :source
167
+ :is-empty="entries.length === 0"
168
+ :tabulate
169
+ :view-as-table="false"
170
+ >
171
+ <template #skeleton>
172
+ <DashboardSkeleton kind="table" :columns="Math.min(columns.length, 6)" :count="limit ?? 6" />
173
+ </template>
174
+ <template v-if="$slots['header-right']" #header-right>
175
+ <slot name="header-right" />
176
+ </template>
177
+ <template v-if="$slots.toolbar" #toolbar>
178
+ <slot name="toolbar" />
179
+ </template>
180
+ <template v-if="$slots.footer" #footer>
181
+ <slot name="footer" />
182
+ </template>
183
+
184
+ <template #default="{ expanded }">
185
+ <div
186
+ :class="classes.wrapper"
187
+ :style="maxHeight && !expanded ? { maxHeight: `${maxHeight}px` } : void 0"
188
+ >
189
+ <table :class="classes.table">
190
+ <colgroup>
191
+ <col
192
+ v-for="column in resolvedColumns"
193
+ :key="column.key"
194
+ :style="column.column.width ? { width: column.column.width } : void 0"
195
+ />
196
+ <col v-if="rowActions" class="w-0" />
197
+ </colgroup>
198
+ <thead :class="classes.head">
199
+ <tr>
200
+ <th
201
+ v-for="column in resolvedColumns"
202
+ :key="column.key"
203
+ scope="col"
204
+ :aria-sort="column.sortable ? ariaSort(column.key) : void 0"
205
+ :class="[classes.th, column.align]"
206
+ >
207
+ <button
208
+ v-if="column.sortable"
209
+ type="button"
210
+ class="inline-flex cursor-pointer items-center gap-1 hover:text-default"
211
+ :class="sort?.key === column.key && 'text-default'"
212
+ @click="toggleSort(column.key, column.numeric)"
213
+ >
214
+ {{ column.label }}
215
+ <UIcon
216
+ :name="
217
+ sort?.key !== column.key ? 'i-lucide-chevrons-up-down' : sort.direction === 'asc' ? 'i-lucide-arrow-up' : 'i-lucide-arrow-down'
218
+ "
219
+ class="size-3 shrink-0"
220
+ :class="sort?.key !== column.key && 'opacity-50'"
221
+ />
222
+ </button>
223
+ <template v-else>{{ column.label }}</template>
224
+ </th>
225
+ <th v-if="rowActions" scope="col" :class="classes.th">
226
+ <span class="sr-only">{{ t("dashboard.table.actions") }}</span>
227
+ </th>
228
+ </tr>
229
+ </thead>
230
+ <tbody>
231
+ <tr
232
+ v-for="entry in visible(expanded)"
233
+ :key="entry.key"
234
+ :data-selected="entry.selected || void 0"
235
+ :class="[
236
+ classes.row,
237
+ onSelect && 'relative transition-colors has-[>td>button:hover]:bg-elevated/60 has-[>td>button:focus-visible]:bg-elevated/60',
238
+ entry.selected && 'bg-elevated [&>td:first-child]:text-highlighted'
239
+ ]"
240
+ >
241
+ <td
242
+ v-for="(column, position) in resolvedColumns"
243
+ :key="column.key"
244
+ :class="[
245
+ classes.td,
246
+ column.align,
247
+ column.numeric && 'tabular-nums',
248
+ position === 0 && 'font-medium text-default',
249
+ column.column.class
250
+ ]"
251
+ >
252
+ <slot
253
+ :name="`cell-${column.key}`"
254
+ :row="entry.row"
255
+ :index="entry.index"
256
+ :value="entry.cells[position]?.text ?? ''"
257
+ >
258
+ <span
259
+ v-if="column.type === 'delta' && entry.cells[position]?.good !== void 0"
260
+ :data-trend="entry.cells[position]?.good ? 'up' : 'down'"
261
+ class="font-semibold"
262
+ :class="
263
+ entry.cells[position]?.good ? 'text-[var(--nut-dash-up)]' : 'text-[var(--nut-dash-down)]'
264
+ "
265
+ >
266
+ {{ entry.cells[position]?.text }}
267
+ </span>
268
+ <span
269
+ v-else-if="column.type === 'bar' && entry.cells[position]?.width"
270
+ class="flex items-center justify-end gap-2"
271
+ >
272
+ <span :class="classes.bar" class="w-16 shrink-0 max-sm:w-10">
273
+ <i
274
+ class="block h-full rounded-full transition-[width] duration-500 ease-out"
275
+ :style="{ background: column.color, width: entry.cells[position]?.width }"
276
+ />
277
+ </span>
278
+ <span class="min-w-10">{{ entry.cells[position]?.text }}</span>
279
+ </span>
280
+ <template v-else>{{ entry.cells[position]?.text }}</template>
281
+ </slot>
282
+ <button
283
+ v-if="onSelect && position === 0"
284
+ type="button"
285
+ :class="DASHBOARD_TABLE_ROW_BUTTON"
286
+ :aria-label="entry.cells[0]?.text"
287
+ :aria-pressed="selected ? entry.selected : void 0"
288
+ @click="onSelect({ index: entry.index, row: entry.row })"
289
+ />
290
+ </td>
291
+ <td v-if="rowActions" :class="[classes.td, 'py-0']">
292
+ <DashboardRowActionsMenu
293
+ v-if="entry.actions.length"
294
+ :actions="entry.actions"
295
+ :label="entry.cells[0]?.text ?? ''"
296
+ class="justify-end"
297
+ />
298
+ </td>
299
+ </tr>
300
+ </tbody>
301
+ </table>
302
+ </div>
303
+ </template>
304
+ </DashboardCard>
305
+ </template>
@@ -0,0 +1,52 @@
1
+ import type { DashboardBlockBaseProps, DashboardBlockUi, DashboardRowActions, DashboardSelected, DashboardSelectEvent, DashboardSourceLike, DashboardTableColumn, DashboardTableSort, DashboardTableUi } from '../types/index.js';
2
+ 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<{
3
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<(Omit<DashboardBlockBaseProps, "ui"> & {
4
+ source: DashboardSourceLike<readonly TRow[] | undefined>;
5
+ columns: readonly DashboardTableColumn<TRow>[];
6
+ /** Rows shown in the card, after sorting. The expand dialog and CSV export show them all. */
7
+ limit?: number;
8
+ /** Caps the table height in pixels; the header stays visible while the rows scroll. */
9
+ maxHeight?: number;
10
+ rowKey?: (row: TRow, index: number) => PropertyKey;
11
+ /** Rows shown as selected (the value a `select` handler stored). */
12
+ selected?: DashboardSelected<TRow>;
13
+ /** Actions of each row, in a last column: inline icon buttons and a `⋮` menu. */
14
+ rowActions?: DashboardRowActions<TRow>;
15
+ /** Makes each row a button. */
16
+ onSelect?: (event: DashboardSelectEvent<TRow>) => void;
17
+ ui?: DashboardBlockUi & DashboardTableUi;
18
+ } & {
19
+ /**
20
+ * Sort state. Header clicks cycle a column through its natural direction (numbers descending, text
21
+ * ascending), the opposite one, then source order. Bind it to keep the sort in a param.
22
+ */
23
+ sort?: DashboardTableSort | null | undefined;
24
+ }) & {
25
+ "onUpdate:sort"?: ((value: DashboardTableSort | null | undefined) => any) | undefined;
26
+ }> & (typeof globalThis extends {
27
+ __VLS_PROPS_FALLBACK: infer P;
28
+ } ? P : {});
29
+ expose: (exposed: {}) => void;
30
+ attrs: any;
31
+ slots: {
32
+ 'header-right'?: () => unknown;
33
+ toolbar?: () => unknown;
34
+ footer?: () => unknown;
35
+ } & {
36
+ [slot: `cell-${string}`]: ((props: {
37
+ row: TRow;
38
+ index: number;
39
+ value: string;
40
+ }) => unknown) | undefined;
41
+ };
42
+ emit: (event: "update:sort", value: DashboardTableSort | null | undefined) => void;
43
+ }>) => import("vue").VNode & {
44
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
45
+ };
46
+ declare const _default: typeof __VLS_export;
47
+ export default _default;
48
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
49
+ [K in keyof T]: T[K];
50
+ } : {
51
+ [K in keyof T as K]: T[K];
52
+ }) & {};
@@ -0,0 +1,35 @@
1
+ import type { DashboardTab } from '../types/index.js';
2
+ declare const __VLS_export: <TValue extends string | number>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
3
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<({
4
+ items: readonly DashboardTab<TValue>[];
5
+ /** `pill`: a segmented control. `link`: underlined tabs. */
6
+ variant?: "pill" | "link";
7
+ size?: "xs" | "sm" | "md";
8
+ /** Stretches the tabs over the full width. */
9
+ full?: boolean;
10
+ } & {
11
+ /**
12
+ * Tab strip for dashboard cards, bound with `v-model`. Bind it to a widget param to switch what a
13
+ * block fetches (the tab lands in the URL, and the block refreshes in place), or to a local ref to
14
+ * switch between blocks: render only the active one, so the others' deferred queries stay idle.
15
+ */
16
+ modelValue: TValue;
17
+ }) & {
18
+ "onUpdate:modelValue"?: ((value: TValue) => any) | undefined;
19
+ }> & (typeof globalThis extends {
20
+ __VLS_PROPS_FALLBACK: infer P;
21
+ } ? P : {});
22
+ expose: (exposed: {}) => void;
23
+ attrs: any;
24
+ slots: {};
25
+ emit: (event: "update:modelValue", value: TValue) => void;
26
+ }>) => import("vue").VNode & {
27
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
28
+ };
29
+ declare const _default: typeof __VLS_export;
30
+ export default _default;
31
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
32
+ [K in keyof T]: T[K];
33
+ } : {
34
+ [K in keyof T as K]: T[K];
35
+ }) & {};
@@ -0,0 +1,55 @@
1
+ <script setup>
2
+ import UTabs from "@nuxt/ui/components/Tabs.vue";
3
+ import { computed } from "vue";
4
+ import { resolveTextValue } from "#ui-tools/shared/utils/render";
5
+ const model = defineModel({ type: null, ...{ required: true } });
6
+ const {
7
+ items,
8
+ variant = "pill",
9
+ size = "xs",
10
+ full = false
11
+ } = defineProps({
12
+ items: { type: Array, required: true },
13
+ variant: { type: String, required: false },
14
+ size: { type: String, required: false },
15
+ full: { type: Boolean, required: false }
16
+ });
17
+ const tabs = computed(
18
+ () => items.map((item) => ({
19
+ badge: item.count === null || item.count === void 0 ? void 0 : { color: "neutral", label: item.count, size: "sm", variant: "soft" },
20
+ disabled: item.disabled,
21
+ icon: item.icon,
22
+ label: resolveTextValue(item.label),
23
+ value: item.value
24
+ }))
25
+ );
26
+ const ui = computed(() => ({
27
+ indicator: variant === "pill" ? "rounded-[5px] bg-default shadow-xs ring ring-default" : "",
28
+ list: [full ? "w-full" : "w-auto", variant === "pill" && "rounded-md p-0.5"],
29
+ trigger: [
30
+ full ? "flex-1" : "grow-0",
31
+ variant === "pill" && "text-muted data-[state=active]:text-highlighted"
32
+ ]
33
+ }));
34
+ const selected = computed({
35
+ get: () => model.value,
36
+ set(next) {
37
+ const item = items.find((entry) => entry.value === next);
38
+ if (item) model.value = item.value;
39
+ }
40
+ });
41
+ </script>
42
+
43
+ <template>
44
+ <UTabs
45
+ v-model="selected"
46
+ :items="tabs"
47
+ :content="false"
48
+ :variant
49
+ :size
50
+ color="neutral"
51
+ :class="full ? 'w-full' : 'w-auto'"
52
+ :ui
53
+ data-dashboard-tabs
54
+ />
55
+ </template>
@@ -0,0 +1,35 @@
1
+ import type { DashboardTab } from '../types/index.js';
2
+ declare const __VLS_export: <TValue extends string | number>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
3
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<({
4
+ items: readonly DashboardTab<TValue>[];
5
+ /** `pill`: a segmented control. `link`: underlined tabs. */
6
+ variant?: "pill" | "link";
7
+ size?: "xs" | "sm" | "md";
8
+ /** Stretches the tabs over the full width. */
9
+ full?: boolean;
10
+ } & {
11
+ /**
12
+ * Tab strip for dashboard cards, bound with `v-model`. Bind it to a widget param to switch what a
13
+ * block fetches (the tab lands in the URL, and the block refreshes in place), or to a local ref to
14
+ * switch between blocks: render only the active one, so the others' deferred queries stay idle.
15
+ */
16
+ modelValue: TValue;
17
+ }) & {
18
+ "onUpdate:modelValue"?: ((value: TValue) => any) | undefined;
19
+ }> & (typeof globalThis extends {
20
+ __VLS_PROPS_FALLBACK: infer P;
21
+ } ? P : {});
22
+ expose: (exposed: {}) => void;
23
+ attrs: any;
24
+ slots: {};
25
+ emit: (event: "update:modelValue", value: TValue) => void;
26
+ }>) => import("vue").VNode & {
27
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
28
+ };
29
+ declare const _default: typeof __VLS_export;
30
+ export default _default;
31
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
32
+ [K in keyof T]: T[K];
33
+ } : {
34
+ [K in keyof T as K]: T[K];
35
+ }) & {};
@@ -0,0 +1,10 @@
1
+ import type { LazyTextValue } from '#ui-tools/shared/types/utils';
2
+ import type { DashboardTotalUi } from '../types/index.js';
3
+ type __VLS_Props = {
4
+ label: LazyTextValue;
5
+ value: LazyTextValue;
6
+ ui?: DashboardTotalUi;
7
+ };
8
+ 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>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
@@ -0,0 +1,32 @@
1
+ <script setup>
2
+ import { computed } from "vue";
3
+ import { resolveTextValue } from "#ui-tools/shared/utils/render";
4
+ import { useDashboardUi } from "../composables/use-dashboard-ui";
5
+ import { resolveDashboardClasses } from "../utils/ui";
6
+ const props = defineProps({
7
+ label: { type: [String, Number, Function], required: true },
8
+ value: { type: [String, Number, Function], required: true },
9
+ ui: { type: Object, required: false }
10
+ });
11
+ const appUi = useDashboardUi();
12
+ const label = computed(() => resolveTextValue(props.label));
13
+ const value = computed(() => resolveTextValue(props.value));
14
+ const classes = computed(
15
+ () => resolveDashboardClasses(
16
+ {
17
+ label: "truncate text-[12.5px] text-muted",
18
+ root: "flex items-baseline justify-between gap-3 border-t border-[var(--nut-dash-grid)] pt-3 [&+&]:border-t-0 [&+&]:pt-1.5",
19
+ value: "shrink-0 text-sm font-semibold text-highlighted tabular-nums"
20
+ },
21
+ appUi.value.total,
22
+ props.ui
23
+ )
24
+ );
25
+ </script>
26
+
27
+ <template>
28
+ <div :class="classes.root">
29
+ <span :class="classes.label">{{ label }}</span>
30
+ <b :class="classes.value">{{ value }}</b>
31
+ </div>
32
+ </template>
@@ -0,0 +1,10 @@
1
+ import type { LazyTextValue } from '#ui-tools/shared/types/utils';
2
+ import type { DashboardTotalUi } from '../types/index.js';
3
+ type __VLS_Props = {
4
+ label: LazyTextValue;
5
+ value: LazyTextValue;
6
+ ui?: DashboardTotalUi;
7
+ };
8
+ 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>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
@@ -0,0 +1,46 @@
1
+ import type { DashboardBlockBaseProps, DashboardDataTable, DashboardLegendItem, DashboardSkeletonKind, DashboardSourceLike } from '../types/index.js';
2
+ declare const __VLS_export: <TData>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
3
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<DashboardBlockBaseProps & {
4
+ source: DashboardSourceLike<TData>;
5
+ /** Whether ready data has nothing to show. Defaults to `null` or an empty array. */
6
+ isEmpty?: (data: TData & ({} | null)) => boolean;
7
+ legend?: readonly DashboardLegendItem[];
8
+ /** Built-in skeleton drawn while the source loads, unless a `#skeleton` slot is given. */
9
+ skeleton?: DashboardSkeletonKind;
10
+ /** Tabular data behind the `table` and `csv` menu actions. */
11
+ tabulate?: (data: TData & ({} | null)) => DashboardDataTable;
12
+ /** Offers the `expand` menu action; the default slot receives `expanded`. */
13
+ expandable?: boolean;
14
+ }> & (typeof globalThis extends {
15
+ __VLS_PROPS_FALLBACK: infer P;
16
+ } ? P : {});
17
+ expose: (exposed: {}) => void;
18
+ attrs: any;
19
+ slots: {
20
+ default: (props: {
21
+ data: TData & ({} | null);
22
+ refreshing: boolean;
23
+ refresh: () => Promise<void>;
24
+ /** Rendered in the expand dialog. */
25
+ expanded: boolean;
26
+ }) => unknown;
27
+ skeleton?: () => unknown;
28
+ 'header-right'?: (props: {
29
+ data: (TData & ({} | null)) | undefined;
30
+ }) => unknown;
31
+ toolbar?: () => unknown;
32
+ footer?: (props: {
33
+ data: TData & ({} | null);
34
+ }) => unknown;
35
+ };
36
+ emit: {};
37
+ }>) => import("vue").VNode & {
38
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
39
+ };
40
+ declare const _default: typeof __VLS_export;
41
+ export default _default;
42
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
43
+ [K in keyof T]: T[K];
44
+ } : {
45
+ [K in keyof T as K]: T[K];
46
+ }) & {};
@@ -0,0 +1,84 @@
1
+ <script setup>
2
+ import { computed } from "vue";
3
+ import DashboardCard from "./dashboard-card.vue";
4
+ const {
5
+ source,
6
+ card = true,
7
+ menu = void 0,
8
+ freshness = void 0,
9
+ isEmpty,
10
+ skeleton = "rows",
11
+ tabulate,
12
+ expandable = true,
13
+ ...block
14
+ } = defineProps({
15
+ title: { type: [String, Number, Function], required: false },
16
+ subtitle: { type: [String, Number, Function], required: false },
17
+ size: { type: String, required: false },
18
+ rows: { type: String, required: false },
19
+ card: { type: Boolean, required: false },
20
+ activation: { type: String, required: false },
21
+ empty: { type: Object, required: false },
22
+ menu: { type: [Boolean, Array, Function], required: false },
23
+ actions: { type: Array, required: false },
24
+ freshness: { type: Boolean, required: false },
25
+ ui: { type: Object, required: false },
26
+ source: { type: Object, required: true },
27
+ isEmpty: { type: Function, required: false },
28
+ legend: { type: Array, required: false },
29
+ skeleton: { type: String, required: false },
30
+ tabulate: { type: Function, required: false },
31
+ expandable: { type: Boolean, required: false }
32
+ });
33
+ defineSlots();
34
+ const ready = computed(() => {
35
+ const data = source.data;
36
+ return data === void 0 ? null : { data };
37
+ });
38
+ const blank = computed(() => {
39
+ if (!ready.value) return false;
40
+ const { data } = ready.value;
41
+ if (isEmpty) return isEmpty(data);
42
+ return data === null || Array.isArray(data) && data.length === 0;
43
+ });
44
+ const tabulateReady = computed(() => {
45
+ const current = ready.value;
46
+ return tabulate && current ? () => tabulate(current.data) : void 0;
47
+ });
48
+ </script>
49
+
50
+ <template>
51
+ <DashboardCard
52
+ v-bind="block"
53
+ :card
54
+ :menu
55
+ :freshness
56
+ :source
57
+ :is-empty="blank"
58
+ :skeleton
59
+ :tabulate="tabulateReady"
60
+ :expandable
61
+ >
62
+ <template v-if="$slots.skeleton" #skeleton>
63
+ <slot name="skeleton" />
64
+ </template>
65
+ <template v-if="$slots['header-right']" #header-right>
66
+ <slot name="header-right" :data="ready?.data" />
67
+ </template>
68
+ <template v-if="$slots.toolbar" #toolbar>
69
+ <slot name="toolbar" />
70
+ </template>
71
+ <template v-if="$slots.footer" #footer>
72
+ <slot v-if="ready" name="footer" :data="ready.data" />
73
+ </template>
74
+ <template #default="{ expanded }">
75
+ <slot
76
+ v-if="ready"
77
+ :data="ready.data"
78
+ :refreshing="source.refreshing"
79
+ :refresh="source.refresh"
80
+ :expanded
81
+ />
82
+ </template>
83
+ </DashboardCard>
84
+ </template>