@adminforth/dashboard 1.4.0 → 1.4.1

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 (78) hide show
  1. package/README.md +23 -4
  2. package/custom/api/dashboardApi.ts +6 -9
  3. package/custom/model/dashboard.types.ts +60 -275
  4. package/custom/model/dashboardTopics.ts +5 -0
  5. package/custom/runtime/DashboardGroup.vue +2 -2
  6. package/custom/runtime/DashboardPage.vue +17 -7
  7. package/custom/runtime/DashboardRuntime.vue +20 -8
  8. package/custom/runtime/WidgetRenderer.vue +1 -2
  9. package/custom/runtime/WidgetShell.vue +3 -3
  10. package/custom/skills/adminforth-dashboard/SKILL.md +2 -2
  11. package/custom/widgets/{gauge-card/GaugeCardWidget.vue → GaugeCardWidget.vue} +63 -61
  12. package/custom/widgets/{kpi-card/KpiCardWidget.vue → KpiCardWidget.vue} +35 -33
  13. package/custom/widgets/{pivot-table/PivotTableWidget.vue → PivotTableWidget.vue} +71 -68
  14. package/custom/widgets/{table/TableWidget.vue → TableWidget.vue} +5 -5
  15. package/custom/widgets/chart/{bar/BarChart.vue → BarChart.vue} +2 -2
  16. package/custom/widgets/chart/ChartWidget.vue +4 -15
  17. package/{dist/custom/widgets/chart/funnel → custom/widgets/chart}/FunnelChart.vue +80 -78
  18. package/{dist/custom/widgets/chart/line → custom/widgets/chart}/LineChart.vue +2 -2
  19. package/custom/widgets/chart/{pie/PieChart.vue → PieChart.vue} +2 -2
  20. package/{dist/custom/widgets/chart/stacked-bar → custom/widgets/chart}/StackedBarChart.vue +97 -95
  21. package/custom/widgets/chart/chart.types.ts +0 -28
  22. package/dist/custom/api/dashboardApi.d.ts +4 -8
  23. package/dist/custom/api/dashboardApi.ts +6 -9
  24. package/dist/custom/model/dashboard.types.d.ts +38 -32
  25. package/dist/custom/model/dashboard.types.js +2 -155
  26. package/dist/custom/model/dashboard.types.ts +60 -275
  27. package/dist/custom/model/dashboardTopics.d.ts +2 -0
  28. package/dist/custom/model/dashboardTopics.js +8 -0
  29. package/dist/custom/model/dashboardTopics.ts +5 -0
  30. package/dist/custom/queries/useDashboardConfig.d.ts +96 -96
  31. package/dist/custom/queries/useWidgetData.d.ts +96 -96
  32. package/dist/custom/runtime/DashboardGroup.vue +2 -2
  33. package/dist/custom/runtime/DashboardPage.vue +17 -7
  34. package/dist/custom/runtime/DashboardRuntime.vue +20 -8
  35. package/dist/custom/runtime/WidgetRenderer.vue +1 -2
  36. package/dist/custom/runtime/WidgetShell.vue +3 -3
  37. package/dist/custom/skills/adminforth-dashboard/SKILL.md +2 -2
  38. package/dist/custom/widgets/{gauge-card/GaugeCardWidget.vue → GaugeCardWidget.vue} +63 -61
  39. package/dist/custom/widgets/{kpi-card/KpiCardWidget.vue → KpiCardWidget.vue} +35 -33
  40. package/dist/custom/widgets/{pivot-table/PivotTableWidget.vue → PivotTableWidget.vue} +71 -68
  41. package/dist/custom/widgets/{table/TableWidget.vue → TableWidget.vue} +5 -5
  42. package/dist/custom/widgets/chart/{bar/BarChart.vue → BarChart.vue} +2 -2
  43. package/dist/custom/widgets/chart/ChartWidget.vue +4 -15
  44. package/{custom/widgets/chart/funnel → dist/custom/widgets/chart}/FunnelChart.vue +80 -78
  45. package/{custom/widgets/chart/line → dist/custom/widgets/chart}/LineChart.vue +2 -2
  46. package/dist/custom/widgets/chart/{pie/PieChart.vue → PieChart.vue} +2 -2
  47. package/{custom/widgets/chart/stacked-bar → dist/custom/widgets/chart}/StackedBarChart.vue +97 -95
  48. package/dist/custom/widgets/chart/chart.types.d.ts +0 -2
  49. package/dist/custom/widgets/chart/chart.types.js +0 -23
  50. package/dist/custom/widgets/chart/chart.types.ts +0 -28
  51. package/dist/endpoint/dashboard.d.ts +2 -3
  52. package/dist/endpoint/dashboard.js +12 -32
  53. package/dist/endpoint/groups.d.ts +2 -21
  54. package/dist/endpoint/groups.js +18 -16
  55. package/dist/endpoint/widgets.d.ts +0 -3
  56. package/dist/endpoint/widgets.js +27 -74
  57. package/dist/index.js +1 -3
  58. package/dist/schema/api.d.ts +2090 -511
  59. package/dist/schema/api.js +18 -15
  60. package/dist/schema/widget.d.ts +1003 -250
  61. package/dist/schema/widget.js +102 -46
  62. package/dist/services/dashboardConfigService.d.ts +0 -10
  63. package/dist/services/dashboardConfigService.js +6 -21
  64. package/dist/services/widgetDataService.js +226 -196
  65. package/endpoint/dashboard.ts +13 -46
  66. package/endpoint/groups.ts +25 -42
  67. package/endpoint/widgets.ts +36 -95
  68. package/index.ts +0 -3
  69. package/package.json +3 -3
  70. package/schema/api.ts +19 -15
  71. package/schema/widget.ts +113 -52
  72. package/services/dashboardConfigService.ts +6 -25
  73. package/services/widgetDataService.ts +304 -229
  74. package/custom/widgets/chart/histogram/HistogramChart.vue +0 -21
  75. package/dist/custom/widgets/chart/histogram/HistogramChart.vue +0 -21
  76. package/dist/services/widgetConfigValidator.d.ts +0 -8
  77. package/dist/services/widgetConfigValidator.js +0 -27
  78. package/services/widgetConfigValidator.ts +0 -61
@@ -1,21 +0,0 @@
1
- <script setup lang="ts">
2
- import BarChart from '../bar/BarChart.vue'
3
-
4
- defineProps<{
5
- rows: Record<string, unknown>[]
6
- labelField: string
7
- valueField: string
8
- color?: string
9
- height?: number
10
- }>()
11
- </script>
12
-
13
- <template>
14
- <BarChart
15
- :rows="rows"
16
- :label-field="labelField"
17
- :value-field="valueField"
18
- :color="color"
19
- :height="height"
20
- />
21
- </template>
@@ -1,21 +0,0 @@
1
- <script setup lang="ts">
2
- import BarChart from '../bar/BarChart.vue'
3
-
4
- defineProps<{
5
- rows: Record<string, unknown>[]
6
- labelField: string
7
- valueField: string
8
- color?: string
9
- height?: number
10
- }>()
11
- </script>
12
-
13
- <template>
14
- <BarChart
15
- :rows="rows"
16
- :label-field="labelField"
17
- :value-field="valueField"
18
- :color="color"
19
- :height="height"
20
- />
21
- </template>
@@ -1,8 +0,0 @@
1
- import type { IAdminForth } from 'adminforth';
2
- import type { DashboardWidgetConfig } from '../custom/model/dashboard.types.js';
3
- import type { DashboardWidgetConfigValidationError } from '../schema/widget.js';
4
- export type WidgetConfigValidatorService = {
5
- validateDashboardWidgetApiConfig: (widget: DashboardWidgetConfig) => DashboardWidgetConfigValidationError[];
6
- };
7
- export declare function validateDashboardWidgetApiConfig(adminforth: IAdminForth, widget: DashboardWidgetConfig): DashboardWidgetConfigValidationError[];
8
- export declare function createWidgetConfigValidatorService(adminforth: IAdminForth): WidgetConfigValidatorService;
@@ -1,27 +0,0 @@
1
- export function validateDashboardWidgetApiConfig(adminforth, widget) {
2
- if (!('query' in widget)) {
3
- return [];
4
- }
5
- if ('steps' in widget.query) {
6
- return widget.query.steps.flatMap((step, index) => validateResource(adminforth, step.resource, `query.steps.${index}.resource`));
7
- }
8
- return validateQueryConfig(adminforth, widget.query, 'query');
9
- }
10
- function validateQueryConfig(adminforth, query, fieldPrefix) {
11
- return validateResource(adminforth, query.resource, `${fieldPrefix}.resource`);
12
- }
13
- function validateResource(adminforth, resourceId, field) {
14
- const resource = adminforth.config.resources.find((item) => item.resourceId === resourceId);
15
- if (resource) {
16
- return [];
17
- }
18
- return [{
19
- field,
20
- message: `Resource "${resourceId}" is not registered`,
21
- }];
22
- }
23
- export function createWidgetConfigValidatorService(adminforth) {
24
- return {
25
- validateDashboardWidgetApiConfig: (widget) => validateDashboardWidgetApiConfig(adminforth, widget),
26
- };
27
- }
@@ -1,61 +0,0 @@
1
- import type { IAdminForth } from 'adminforth';
2
- import type { DashboardWidgetConfig, QueryConfig } from '../custom/model/dashboard.types.js';
3
- import type { DashboardWidgetConfigValidationError } from '../schema/widget.js';
4
-
5
- export type WidgetConfigValidatorService = {
6
- validateDashboardWidgetApiConfig: (
7
- widget: DashboardWidgetConfig,
8
- ) => DashboardWidgetConfigValidationError[];
9
- };
10
-
11
- export function validateDashboardWidgetApiConfig(
12
- adminforth: IAdminForth,
13
- widget: DashboardWidgetConfig,
14
- ): DashboardWidgetConfigValidationError[] {
15
- if (!('query' in widget)) {
16
- return [];
17
- }
18
-
19
- if ('steps' in widget.query) {
20
- return widget.query.steps.flatMap((step, index) => validateResource(
21
- adminforth,
22
- step.resource,
23
- `query.steps.${index}.resource`,
24
- ));
25
- }
26
-
27
- return validateQueryConfig(adminforth, widget.query, 'query');
28
- }
29
-
30
- function validateQueryConfig(
31
- adminforth: IAdminForth,
32
- query: QueryConfig,
33
- fieldPrefix: string,
34
- ): DashboardWidgetConfigValidationError[] {
35
- return validateResource(adminforth, query.resource, `${fieldPrefix}.resource`);
36
- }
37
-
38
- function validateResource(
39
- adminforth: IAdminForth,
40
- resourceId: string,
41
- field: string,
42
- ): DashboardWidgetConfigValidationError[] {
43
- const resource = adminforth.config.resources.find((item) => item.resourceId === resourceId);
44
-
45
- if (resource) {
46
- return [];
47
- }
48
-
49
- return [{
50
- field,
51
- message: `Resource "${resourceId}" is not registered`,
52
- }];
53
- }
54
-
55
- export function createWidgetConfigValidatorService(
56
- adminforth: IAdminForth,
57
- ): WidgetConfigValidatorService {
58
- return {
59
- validateDashboardWidgetApiConfig: (widget) => validateDashboardWidgetApiConfig(adminforth, widget),
60
- };
61
- }