@adminforth/dashboard 1.4.2 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom/api/dashboardApi.ts +137 -5
- package/custom/model/dashboard.types.ts +32 -22
- package/custom/runtime/DashboardRuntime.vue +2 -3
- package/custom/skills/adminforth-dashboard/SKILL.md +165 -179
- package/custom/widgets/KpiCardWidget.vue +172 -9
- package/custom/widgets/chart/ChartWidget.vue +5 -5
- package/custom/widgets/registry.ts +4 -4
- package/dist/custom/api/dashboardApi.d.ts +46 -2
- package/dist/custom/api/dashboardApi.js +90 -5
- package/dist/custom/api/dashboardApi.ts +137 -5
- package/dist/custom/model/dashboard.types.d.ts +30 -14
- package/dist/custom/model/dashboard.types.js +2 -2
- package/dist/custom/model/dashboard.types.ts +32 -22
- package/dist/custom/queries/useDashboardConfig.d.ts +106 -104
- package/dist/custom/queries/useWidgetData.d.ts +106 -104
- package/dist/custom/runtime/DashboardRuntime.vue +2 -3
- package/dist/custom/skills/adminforth-dashboard/SKILL.md +165 -179
- package/dist/custom/widgets/KpiCardWidget.vue +172 -9
- package/dist/custom/widgets/chart/ChartWidget.vue +5 -5
- package/dist/custom/widgets/registry.js +4 -4
- package/dist/custom/widgets/registry.ts +4 -4
- package/dist/endpoint/dashboard.d.ts +2 -4
- package/dist/endpoint/dashboard.js +1 -21
- package/dist/endpoint/groups.d.ts +1 -0
- package/dist/endpoint/groups.js +61 -48
- package/dist/endpoint/widgets.d.ts +1 -0
- package/dist/endpoint/widgets.js +167 -64
- package/dist/schema/api.d.ts +11710 -2785
- package/dist/schema/api.js +118 -26
- package/dist/schema/widget.d.ts +425 -1980
- package/dist/schema/widget.js +13 -374
- package/dist/schema/widgets/charts.d.ts +1689 -0
- package/dist/schema/widgets/charts.js +92 -0
- package/dist/schema/widgets/common.d.ts +275 -0
- package/dist/schema/widgets/common.js +171 -0
- package/dist/schema/widgets/gauge-card.d.ts +172 -0
- package/dist/schema/widgets/gauge-card.js +28 -0
- package/dist/schema/widgets/kpi-card.d.ts +212 -0
- package/dist/schema/widgets/kpi-card.js +43 -0
- package/dist/schema/widgets/pivot-table.d.ts +196 -0
- package/dist/schema/widgets/pivot-table.js +17 -0
- package/dist/schema/widgets/table.d.ts +130 -0
- package/dist/schema/widgets/table.js +12 -0
- package/dist/services/dashboardConfigService.d.ts +4 -0
- package/dist/services/dashboardConfigService.js +46 -0
- package/dist/services/widgetDataService.js +96 -2
- package/endpoint/dashboard.ts +2 -33
- package/endpoint/groups.ts +91 -72
- package/endpoint/widgets.ts +260 -87
- package/package.json +1 -1
- package/schema/api.ts +148 -28
- package/schema/widget.ts +43 -425
- package/schema/widgets/charts.ts +113 -0
- package/schema/widgets/common.ts +194 -0
- package/schema/widgets/gauge-card.ts +34 -0
- package/schema/widgets/kpi-card.ts +49 -0
- package/schema/widgets/pivot-table.ts +24 -0
- package/schema/widgets/table.ts +18 -0
- package/services/dashboardConfigService.ts +73 -0
- package/services/widgetDataService.ts +129 -3
package/dist/schema/api.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { toJSONSchema, z } from 'zod';
|
|
2
|
-
import {
|
|
3
|
-
function toAdminForthJsonSchema(schema) {
|
|
4
|
-
return toJSONSchema(schema, { target: 'draft-7' });
|
|
5
|
-
}
|
|
2
|
+
import { BarChartSchema, FunnelChartSchema, FunnelQueryConfigSchema, GaugeCardViewConfigSchema, HistogramChartSchema, KpiCardViewConfigSchema, LineChartSchema, PieChartSchema, PivotTableViewConfigSchema, QueryConfigSchema, StackedBarChartSchema, TableViewConfigSchema, WidgetEditableBaseSchema, WidgetConfigSchema, } from './widget.js';
|
|
6
3
|
export const DashboardErrorResponseZodSchema = z.object({
|
|
7
4
|
error: z.string(),
|
|
8
5
|
validationErrors: z.array(z.object({
|
|
@@ -18,7 +15,7 @@ export const DashboardGroupZodSchema = z.object({
|
|
|
18
15
|
export const DashboardConfigZodSchema = z.object({
|
|
19
16
|
version: z.number(),
|
|
20
17
|
groups: z.array(DashboardGroupZodSchema),
|
|
21
|
-
widgets: z.array(
|
|
18
|
+
widgets: z.array(WidgetConfigSchema),
|
|
22
19
|
}).strict();
|
|
23
20
|
export const DashboardResponseZodSchema = z.object({
|
|
24
21
|
id: z.string(),
|
|
@@ -33,7 +30,7 @@ export const DashboardApiResponseZodSchema = z.union([
|
|
|
33
30
|
]);
|
|
34
31
|
export const DashboardWidgetDataResponseZodSchema = z.union([
|
|
35
32
|
z.object({
|
|
36
|
-
widget:
|
|
33
|
+
widget: WidgetConfigSchema,
|
|
37
34
|
data: z.unknown(),
|
|
38
35
|
}),
|
|
39
36
|
DashboardErrorResponseZodSchema,
|
|
@@ -41,10 +38,6 @@ export const DashboardWidgetDataResponseZodSchema = z.union([
|
|
|
41
38
|
export const SlugRequestZodSchema = z.object({
|
|
42
39
|
slug: z.string(),
|
|
43
40
|
}).strict();
|
|
44
|
-
export const SetDashboardConfigRequestZodSchema = z.object({
|
|
45
|
-
slug: z.string(),
|
|
46
|
-
config: DashboardConfigZodSchema,
|
|
47
|
-
}).strict();
|
|
48
41
|
export const GroupIdRequestZodSchema = z.object({
|
|
49
42
|
slug: z.string(),
|
|
50
43
|
groupId: z.string(),
|
|
@@ -79,23 +72,122 @@ export const MoveWidgetRequestZodSchema = z.object({
|
|
|
79
72
|
widgetId: z.string(),
|
|
80
73
|
direction: z.enum(['up', 'down']),
|
|
81
74
|
}).strict();
|
|
75
|
+
const ConfigurableTableWidgetConfigSchema = WidgetEditableBaseSchema.extend({
|
|
76
|
+
target: z.literal('table'),
|
|
77
|
+
table: TableViewConfigSchema.optional(),
|
|
78
|
+
query: QueryConfigSchema,
|
|
79
|
+
});
|
|
80
|
+
const ConfigurableKpiCardWidgetConfigSchema = WidgetEditableBaseSchema.extend({
|
|
81
|
+
target: z.literal('kpi_card'),
|
|
82
|
+
card: KpiCardViewConfigSchema,
|
|
83
|
+
query: QueryConfigSchema,
|
|
84
|
+
});
|
|
85
|
+
const ConfigurableGaugeCardWidgetConfigSchema = WidgetEditableBaseSchema.extend({
|
|
86
|
+
target: z.literal('gauge_card'),
|
|
87
|
+
card: GaugeCardViewConfigSchema,
|
|
88
|
+
query: QueryConfigSchema,
|
|
89
|
+
});
|
|
90
|
+
const ConfigurableLineChartWidgetConfigSchema = WidgetEditableBaseSchema.extend({
|
|
91
|
+
target: z.literal('chart'),
|
|
92
|
+
chart: LineChartSchema,
|
|
93
|
+
query: QueryConfigSchema,
|
|
94
|
+
});
|
|
95
|
+
const ConfigurableBarChartWidgetConfigSchema = WidgetEditableBaseSchema.extend({
|
|
96
|
+
target: z.literal('chart'),
|
|
97
|
+
chart: BarChartSchema,
|
|
98
|
+
query: QueryConfigSchema,
|
|
99
|
+
});
|
|
100
|
+
const ConfigurableStackedBarChartWidgetConfigSchema = WidgetEditableBaseSchema.extend({
|
|
101
|
+
target: z.literal('chart'),
|
|
102
|
+
chart: StackedBarChartSchema,
|
|
103
|
+
query: QueryConfigSchema,
|
|
104
|
+
});
|
|
105
|
+
const ConfigurablePieChartWidgetConfigSchema = WidgetEditableBaseSchema.extend({
|
|
106
|
+
target: z.literal('chart'),
|
|
107
|
+
chart: PieChartSchema,
|
|
108
|
+
query: QueryConfigSchema,
|
|
109
|
+
});
|
|
110
|
+
const ConfigurableHistogramChartWidgetConfigSchema = WidgetEditableBaseSchema.extend({
|
|
111
|
+
target: z.literal('chart'),
|
|
112
|
+
chart: HistogramChartSchema,
|
|
113
|
+
query: QueryConfigSchema,
|
|
114
|
+
});
|
|
115
|
+
const ConfigurableFunnelChartWidgetConfigSchema = WidgetEditableBaseSchema.extend({
|
|
116
|
+
target: z.literal('chart'),
|
|
117
|
+
chart: FunnelChartSchema,
|
|
118
|
+
query: FunnelQueryConfigSchema,
|
|
119
|
+
});
|
|
120
|
+
const ConfigurablePivotTableWidgetConfigSchema = WidgetEditableBaseSchema.extend({
|
|
121
|
+
target: z.literal('pivot_table'),
|
|
122
|
+
pivot: PivotTableViewConfigSchema,
|
|
123
|
+
query: QueryConfigSchema,
|
|
124
|
+
});
|
|
125
|
+
const ConfigurableChartWidgetConfigSchema = z.union([
|
|
126
|
+
ConfigurableLineChartWidgetConfigSchema,
|
|
127
|
+
ConfigurableBarChartWidgetConfigSchema,
|
|
128
|
+
ConfigurableStackedBarChartWidgetConfigSchema,
|
|
129
|
+
ConfigurablePieChartWidgetConfigSchema,
|
|
130
|
+
ConfigurableHistogramChartWidgetConfigSchema,
|
|
131
|
+
ConfigurableFunnelChartWidgetConfigSchema,
|
|
132
|
+
]);
|
|
133
|
+
export const ConfigurableWidgetConfigSchema = z.union([
|
|
134
|
+
ConfigurableTableWidgetConfigSchema,
|
|
135
|
+
ConfigurableKpiCardWidgetConfigSchema,
|
|
136
|
+
ConfigurableGaugeCardWidgetConfigSchema,
|
|
137
|
+
ConfigurableChartWidgetConfigSchema,
|
|
138
|
+
ConfigurablePivotTableWidgetConfigSchema,
|
|
139
|
+
]);
|
|
82
140
|
export const SetWidgetConfigRequestZodSchema = z.object({
|
|
83
141
|
slug: z.string(),
|
|
84
142
|
widgetId: z.string(),
|
|
85
|
-
config:
|
|
143
|
+
config: ConfigurableWidgetConfigSchema,
|
|
86
144
|
}).strict();
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
export const
|
|
95
|
-
export const
|
|
96
|
-
export const
|
|
97
|
-
export const
|
|
98
|
-
export const
|
|
99
|
-
export const
|
|
100
|
-
export const
|
|
101
|
-
export const
|
|
145
|
+
function configureWidgetRequestSchema(configSchema) {
|
|
146
|
+
return z.object({
|
|
147
|
+
slug: z.string(),
|
|
148
|
+
widgetId: z.string(),
|
|
149
|
+
config: configSchema,
|
|
150
|
+
}).strict();
|
|
151
|
+
}
|
|
152
|
+
export const ConfigureTableWidgetRequestZodSchema = configureWidgetRequestSchema(ConfigurableTableWidgetConfigSchema);
|
|
153
|
+
export const ConfigureKpiCardWidgetRequestZodSchema = configureWidgetRequestSchema(ConfigurableKpiCardWidgetConfigSchema);
|
|
154
|
+
export const ConfigureGaugeCardWidgetRequestZodSchema = configureWidgetRequestSchema(ConfigurableGaugeCardWidgetConfigSchema);
|
|
155
|
+
export const ConfigureLineChartWidgetRequestZodSchema = configureWidgetRequestSchema(ConfigurableLineChartWidgetConfigSchema);
|
|
156
|
+
export const ConfigureBarChartWidgetRequestZodSchema = configureWidgetRequestSchema(ConfigurableBarChartWidgetConfigSchema);
|
|
157
|
+
export const ConfigureStackedBarChartWidgetRequestZodSchema = configureWidgetRequestSchema(ConfigurableStackedBarChartWidgetConfigSchema);
|
|
158
|
+
export const ConfigurePieChartWidgetRequestZodSchema = configureWidgetRequestSchema(ConfigurablePieChartWidgetConfigSchema);
|
|
159
|
+
export const ConfigureHistogramChartWidgetRequestZodSchema = configureWidgetRequestSchema(ConfigurableHistogramChartWidgetConfigSchema);
|
|
160
|
+
export const ConfigureFunnelChartWidgetRequestZodSchema = configureWidgetRequestSchema(ConfigurableFunnelChartWidgetConfigSchema);
|
|
161
|
+
export const ConfigurePivotTableWidgetRequestZodSchema = configureWidgetRequestSchema(ConfigurablePivotTableWidgetConfigSchema);
|
|
162
|
+
export const DashboardMutationResponseZodSchema = z.union([
|
|
163
|
+
z.object({
|
|
164
|
+
ok: z.literal(true),
|
|
165
|
+
slug: z.string(),
|
|
166
|
+
widgetId: z.string().optional(),
|
|
167
|
+
groupId: z.string().optional(),
|
|
168
|
+
target: z.string().optional(),
|
|
169
|
+
revision: z.number().optional(),
|
|
170
|
+
}).strict(),
|
|
171
|
+
DashboardErrorResponseZodSchema,
|
|
172
|
+
]);
|
|
173
|
+
export const DashboardApiResponseSchema = toJSONSchema(DashboardApiResponseZodSchema, { target: 'draft-07' });
|
|
174
|
+
export const DashboardWidgetDataResponseSchema = toJSONSchema(DashboardWidgetDataResponseZodSchema, { target: 'draft-07' });
|
|
175
|
+
export const SlugRequestSchema = toJSONSchema(SlugRequestZodSchema, { target: 'draft-07' });
|
|
176
|
+
export const GroupIdRequestSchema = toJSONSchema(GroupIdRequestZodSchema, { target: 'draft-07' });
|
|
177
|
+
export const MoveGroupRequestSchema = toJSONSchema(MoveGroupRequestZodSchema, { target: 'draft-07' });
|
|
178
|
+
export const SetGroupConfigRequestSchema = toJSONSchema(SetGroupConfigRequestZodSchema, { target: 'draft-07' });
|
|
179
|
+
export const WidgetIdRequestSchema = toJSONSchema(WidgetIdRequestZodSchema, { target: 'draft-07' });
|
|
180
|
+
export const WidgetDataRequestSchema = toJSONSchema(WidgetDataRequestZodSchema, { target: 'draft-07' });
|
|
181
|
+
export const MoveWidgetRequestSchema = toJSONSchema(MoveWidgetRequestZodSchema, { target: 'draft-07' });
|
|
182
|
+
export const DashboardMutationResponseSchema = toJSONSchema(DashboardMutationResponseZodSchema, { target: 'draft-07' });
|
|
183
|
+
export const SetWidgetConfigRequestSchema = toJSONSchema(SetWidgetConfigRequestZodSchema, { target: 'draft-07' });
|
|
184
|
+
export const ConfigureTableWidgetRequestSchema = toJSONSchema(ConfigureTableWidgetRequestZodSchema, { target: 'draft-07' });
|
|
185
|
+
export const ConfigureKpiCardWidgetRequestSchema = toJSONSchema(ConfigureKpiCardWidgetRequestZodSchema, { target: 'draft-07' });
|
|
186
|
+
export const ConfigureGaugeCardWidgetRequestSchema = toJSONSchema(ConfigureGaugeCardWidgetRequestZodSchema, { target: 'draft-07' });
|
|
187
|
+
export const ConfigureLineChartWidgetRequestSchema = toJSONSchema(ConfigureLineChartWidgetRequestZodSchema, { target: 'draft-07' });
|
|
188
|
+
export const ConfigureBarChartWidgetRequestSchema = toJSONSchema(ConfigureBarChartWidgetRequestZodSchema, { target: 'draft-07' });
|
|
189
|
+
export const ConfigureStackedBarChartWidgetRequestSchema = toJSONSchema(ConfigureStackedBarChartWidgetRequestZodSchema, { target: 'draft-07' });
|
|
190
|
+
export const ConfigurePieChartWidgetRequestSchema = toJSONSchema(ConfigurePieChartWidgetRequestZodSchema, { target: 'draft-07' });
|
|
191
|
+
export const ConfigureHistogramChartWidgetRequestSchema = toJSONSchema(ConfigureHistogramChartWidgetRequestZodSchema, { target: 'draft-07' });
|
|
192
|
+
export const ConfigureFunnelChartWidgetRequestSchema = toJSONSchema(ConfigureFunnelChartWidgetRequestZodSchema, { target: 'draft-07' });
|
|
193
|
+
export const ConfigurePivotTableWidgetRequestSchema = toJSONSchema(ConfigurePivotTableWidgetRequestZodSchema, { target: 'draft-07' });
|