@adminforth/dashboard 1.3.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 (80) hide show
  1. package/README.md +103 -15
  2. package/custom/api/dashboardApi.ts +9 -8
  3. package/custom/model/dashboard.types.ts +63 -270
  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 +110 -3
  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 +24 -18
  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 -7
  23. package/dist/custom/api/dashboardApi.js +5 -0
  24. package/dist/custom/api/dashboardApi.ts +9 -8
  25. package/dist/custom/model/dashboard.types.d.ts +40 -31
  26. package/dist/custom/model/dashboard.types.js +13 -152
  27. package/dist/custom/model/dashboard.types.ts +63 -270
  28. package/dist/custom/model/dashboardTopics.d.ts +2 -0
  29. package/dist/custom/model/dashboardTopics.js +8 -0
  30. package/dist/custom/model/dashboardTopics.ts +5 -0
  31. package/dist/custom/queries/useDashboardConfig.d.ts +116 -96
  32. package/dist/custom/queries/useWidgetData.d.ts +116 -96
  33. package/dist/custom/runtime/DashboardGroup.vue +2 -2
  34. package/dist/custom/runtime/DashboardPage.vue +17 -7
  35. package/dist/custom/runtime/DashboardRuntime.vue +20 -8
  36. package/dist/custom/runtime/WidgetRenderer.vue +1 -2
  37. package/dist/custom/runtime/WidgetShell.vue +3 -3
  38. package/dist/custom/skills/adminforth-dashboard/SKILL.md +110 -3
  39. package/dist/custom/widgets/{gauge-card/GaugeCardWidget.vue → GaugeCardWidget.vue} +63 -61
  40. package/dist/custom/widgets/{kpi-card/KpiCardWidget.vue → KpiCardWidget.vue} +35 -33
  41. package/dist/custom/widgets/{pivot-table/PivotTableWidget.vue → PivotTableWidget.vue} +71 -68
  42. package/dist/custom/widgets/{table/TableWidget.vue → TableWidget.vue} +5 -5
  43. package/dist/custom/widgets/chart/{bar/BarChart.vue → BarChart.vue} +2 -2
  44. package/dist/custom/widgets/chart/ChartWidget.vue +24 -18
  45. package/{custom/widgets/chart/funnel → dist/custom/widgets/chart}/FunnelChart.vue +80 -78
  46. package/{custom/widgets/chart/line → dist/custom/widgets/chart}/LineChart.vue +2 -2
  47. package/dist/custom/widgets/chart/{pie/PieChart.vue → PieChart.vue} +2 -2
  48. package/{custom/widgets/chart/stacked-bar → dist/custom/widgets/chart}/StackedBarChart.vue +97 -95
  49. package/dist/custom/widgets/chart/chart.types.d.ts +0 -2
  50. package/dist/custom/widgets/chart/chart.types.js +0 -23
  51. package/dist/custom/widgets/chart/chart.types.ts +0 -28
  52. package/dist/endpoint/dashboard.d.ts +6 -2
  53. package/dist/endpoint/dashboard.js +29 -5
  54. package/dist/endpoint/groups.d.ts +2 -21
  55. package/dist/endpoint/groups.js +18 -16
  56. package/dist/endpoint/widgets.d.ts +2 -4
  57. package/dist/endpoint/widgets.js +28 -74
  58. package/dist/index.js +1 -3
  59. package/dist/schema/api.d.ts +2172 -500
  60. package/dist/schema/api.js +21 -13
  61. package/dist/schema/widget.d.ts +1076 -263
  62. package/dist/schema/widget.js +108 -49
  63. package/dist/services/dashboardConfigService.d.ts +0 -10
  64. package/dist/services/dashboardConfigService.js +6 -21
  65. package/dist/services/widgetDataService.d.ts +2 -1
  66. package/dist/services/widgetDataService.js +266 -206
  67. package/endpoint/dashboard.ts +47 -7
  68. package/endpoint/groups.ts +25 -42
  69. package/endpoint/widgets.ts +41 -96
  70. package/index.ts +0 -3
  71. package/package.json +3 -3
  72. package/schema/api.ts +23 -13
  73. package/schema/widget.ts +119 -55
  74. package/services/dashboardConfigService.ts +6 -25
  75. package/services/widgetDataService.ts +350 -237
  76. package/custom/widgets/chart/histogram/HistogramChart.vue +0 -21
  77. package/dist/custom/widgets/chart/histogram/HistogramChart.vue +0 -21
  78. package/dist/services/widgetConfigValidator.d.ts +0 -8
  79. package/dist/services/widgetConfigValidator.js +0 -27
  80. 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
- }