@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
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const GaugeCardViewConfigSchema: z.ZodObject<{
|
|
3
|
+
title: z.ZodOptional<z.ZodString>;
|
|
4
|
+
value: z.ZodObject<{
|
|
5
|
+
field: z.ZodString;
|
|
6
|
+
format: z.ZodOptional<z.ZodEnum<{
|
|
7
|
+
number: "number";
|
|
8
|
+
integer: "integer";
|
|
9
|
+
compact_number: "compact_number";
|
|
10
|
+
currency: "currency";
|
|
11
|
+
percent: "percent";
|
|
12
|
+
percent_delta: "percent_delta";
|
|
13
|
+
number_delta: "number_delta";
|
|
14
|
+
currency_delta: "currency_delta";
|
|
15
|
+
}>>;
|
|
16
|
+
prefix: z.ZodOptional<z.ZodString>;
|
|
17
|
+
suffix: z.ZodOptional<z.ZodString>;
|
|
18
|
+
}, z.core.$strict>;
|
|
19
|
+
target: z.ZodOptional<z.ZodObject<{
|
|
20
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
21
|
+
field: z.ZodOptional<z.ZodString>;
|
|
22
|
+
label: z.ZodOptional<z.ZodString>;
|
|
23
|
+
}, z.core.$strict>>;
|
|
24
|
+
progress: z.ZodOptional<z.ZodObject<{
|
|
25
|
+
value_field: z.ZodString;
|
|
26
|
+
target_value: z.ZodOptional<z.ZodNumber>;
|
|
27
|
+
target_field: z.ZodOptional<z.ZodString>;
|
|
28
|
+
format: z.ZodOptional<z.ZodEnum<{
|
|
29
|
+
number: "number";
|
|
30
|
+
integer: "integer";
|
|
31
|
+
compact_number: "compact_number";
|
|
32
|
+
currency: "currency";
|
|
33
|
+
percent: "percent";
|
|
34
|
+
percent_delta: "percent_delta";
|
|
35
|
+
number_delta: "number_delta";
|
|
36
|
+
currency_delta: "currency_delta";
|
|
37
|
+
}>>;
|
|
38
|
+
}, z.core.$strict>>;
|
|
39
|
+
color: z.ZodOptional<z.ZodString>;
|
|
40
|
+
}, z.core.$strict>;
|
|
41
|
+
export declare const GaugeCardWidgetConfigSchema: z.ZodObject<{
|
|
42
|
+
id: z.ZodString;
|
|
43
|
+
group_id: z.ZodString;
|
|
44
|
+
order: z.ZodNumber;
|
|
45
|
+
label: z.ZodOptional<z.ZodString>;
|
|
46
|
+
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
47
|
+
size: z.ZodOptional<z.ZodEnum<{
|
|
48
|
+
small: "small";
|
|
49
|
+
medium: "medium";
|
|
50
|
+
large: "large";
|
|
51
|
+
wide: "wide";
|
|
52
|
+
full: "full";
|
|
53
|
+
}>>;
|
|
54
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
55
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
56
|
+
min_width: z.ZodOptional<z.ZodNumber>;
|
|
57
|
+
max_width: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
58
|
+
target: z.ZodLiteral<"gauge_card">;
|
|
59
|
+
card: z.ZodObject<{
|
|
60
|
+
title: z.ZodOptional<z.ZodString>;
|
|
61
|
+
value: z.ZodObject<{
|
|
62
|
+
field: z.ZodString;
|
|
63
|
+
format: z.ZodOptional<z.ZodEnum<{
|
|
64
|
+
number: "number";
|
|
65
|
+
integer: "integer";
|
|
66
|
+
compact_number: "compact_number";
|
|
67
|
+
currency: "currency";
|
|
68
|
+
percent: "percent";
|
|
69
|
+
percent_delta: "percent_delta";
|
|
70
|
+
number_delta: "number_delta";
|
|
71
|
+
currency_delta: "currency_delta";
|
|
72
|
+
}>>;
|
|
73
|
+
prefix: z.ZodOptional<z.ZodString>;
|
|
74
|
+
suffix: z.ZodOptional<z.ZodString>;
|
|
75
|
+
}, z.core.$strict>;
|
|
76
|
+
target: z.ZodOptional<z.ZodObject<{
|
|
77
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
78
|
+
field: z.ZodOptional<z.ZodString>;
|
|
79
|
+
label: z.ZodOptional<z.ZodString>;
|
|
80
|
+
}, z.core.$strict>>;
|
|
81
|
+
progress: z.ZodOptional<z.ZodObject<{
|
|
82
|
+
value_field: z.ZodString;
|
|
83
|
+
target_value: z.ZodOptional<z.ZodNumber>;
|
|
84
|
+
target_field: z.ZodOptional<z.ZodString>;
|
|
85
|
+
format: z.ZodOptional<z.ZodEnum<{
|
|
86
|
+
number: "number";
|
|
87
|
+
integer: "integer";
|
|
88
|
+
compact_number: "compact_number";
|
|
89
|
+
currency: "currency";
|
|
90
|
+
percent: "percent";
|
|
91
|
+
percent_delta: "percent_delta";
|
|
92
|
+
number_delta: "number_delta";
|
|
93
|
+
currency_delta: "currency_delta";
|
|
94
|
+
}>>;
|
|
95
|
+
}, z.core.$strict>>;
|
|
96
|
+
color: z.ZodOptional<z.ZodString>;
|
|
97
|
+
}, z.core.$strict>;
|
|
98
|
+
query: z.ZodObject<{
|
|
99
|
+
resource: z.ZodString;
|
|
100
|
+
select: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
101
|
+
field: z.ZodString;
|
|
102
|
+
as: z.ZodOptional<z.ZodString>;
|
|
103
|
+
grain: z.ZodOptional<z.ZodEnum<{
|
|
104
|
+
day: "day";
|
|
105
|
+
week: "week";
|
|
106
|
+
month: "month";
|
|
107
|
+
year: "year";
|
|
108
|
+
}>>;
|
|
109
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
110
|
+
agg: z.ZodEnum<{
|
|
111
|
+
sum: "sum";
|
|
112
|
+
count: "count";
|
|
113
|
+
count_distinct: "count_distinct";
|
|
114
|
+
avg: "avg";
|
|
115
|
+
min: "min";
|
|
116
|
+
max: "max";
|
|
117
|
+
median: "median";
|
|
118
|
+
}>;
|
|
119
|
+
field: z.ZodOptional<z.ZodString>;
|
|
120
|
+
as: z.ZodString;
|
|
121
|
+
filters: z.ZodOptional<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
122
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
123
|
+
calc: z.ZodString;
|
|
124
|
+
as: z.ZodString;
|
|
125
|
+
}, z.core.$strict>]>>>;
|
|
126
|
+
sparkline: z.ZodOptional<z.ZodObject<{
|
|
127
|
+
field: z.ZodString;
|
|
128
|
+
grain: z.ZodEnum<{
|
|
129
|
+
day: "day";
|
|
130
|
+
week: "week";
|
|
131
|
+
month: "month";
|
|
132
|
+
year: "year";
|
|
133
|
+
}>;
|
|
134
|
+
as: z.ZodString;
|
|
135
|
+
fill_missing: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
136
|
+
}, z.core.$strict>>;
|
|
137
|
+
filters: z.ZodOptional<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
138
|
+
group_by: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
139
|
+
field: z.ZodString;
|
|
140
|
+
as: z.ZodOptional<z.ZodString>;
|
|
141
|
+
grain: z.ZodOptional<z.ZodEnum<{
|
|
142
|
+
day: "day";
|
|
143
|
+
week: "week";
|
|
144
|
+
month: "month";
|
|
145
|
+
year: "year";
|
|
146
|
+
}>>;
|
|
147
|
+
timezone: z.ZodOptional<z.ZodString>;
|
|
148
|
+
}, z.core.$strict>]>>>;
|
|
149
|
+
order_by: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
150
|
+
field: z.ZodString;
|
|
151
|
+
direction: z.ZodOptional<z.ZodEnum<{
|
|
152
|
+
asc: "asc";
|
|
153
|
+
desc: "desc";
|
|
154
|
+
}>>;
|
|
155
|
+
}, z.core.$strict>>>;
|
|
156
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
157
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
158
|
+
bucket: z.ZodOptional<z.ZodObject<{
|
|
159
|
+
field: z.ZodString;
|
|
160
|
+
buckets: z.ZodArray<z.ZodObject<{
|
|
161
|
+
label: z.ZodString;
|
|
162
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
163
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
164
|
+
}, z.core.$strict>>;
|
|
165
|
+
}, z.core.$strict>>;
|
|
166
|
+
calcs: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
167
|
+
calc: z.ZodString;
|
|
168
|
+
as: z.ZodString;
|
|
169
|
+
}, z.core.$strict>>>;
|
|
170
|
+
formatting: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
171
|
+
}, z.core.$strict>;
|
|
172
|
+
}, z.core.$strict>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { QueryConfigSchema, ValueFormatSchema, WidgetBaseSchema, } from './common.js';
|
|
3
|
+
export const GaugeCardViewConfigSchema = z.object({
|
|
4
|
+
title: z.string().optional(),
|
|
5
|
+
value: z.object({
|
|
6
|
+
field: z.string(),
|
|
7
|
+
format: ValueFormatSchema,
|
|
8
|
+
prefix: z.string().optional(),
|
|
9
|
+
suffix: z.string().optional(),
|
|
10
|
+
}).strict(),
|
|
11
|
+
target: z.object({
|
|
12
|
+
value: z.number().optional(),
|
|
13
|
+
field: z.string().optional(),
|
|
14
|
+
label: z.string().optional(),
|
|
15
|
+
}).strict().optional(),
|
|
16
|
+
progress: z.object({
|
|
17
|
+
value_field: z.string(),
|
|
18
|
+
target_value: z.number().optional(),
|
|
19
|
+
target_field: z.string().optional(),
|
|
20
|
+
format: ValueFormatSchema,
|
|
21
|
+
}).strict().optional(),
|
|
22
|
+
color: z.string().optional(),
|
|
23
|
+
}).strict();
|
|
24
|
+
export const GaugeCardWidgetConfigSchema = WidgetBaseSchema.extend({
|
|
25
|
+
target: z.literal('gauge_card'),
|
|
26
|
+
card: GaugeCardViewConfigSchema,
|
|
27
|
+
query: QueryConfigSchema,
|
|
28
|
+
});
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const KpiCardViewConfigSchema: z.ZodObject<{
|
|
3
|
+
title: z.ZodOptional<z.ZodString>;
|
|
4
|
+
value: z.ZodObject<{
|
|
5
|
+
field: z.ZodString;
|
|
6
|
+
format: z.ZodOptional<z.ZodEnum<{
|
|
7
|
+
number: "number";
|
|
8
|
+
integer: "integer";
|
|
9
|
+
compact_number: "compact_number";
|
|
10
|
+
currency: "currency";
|
|
11
|
+
percent: "percent";
|
|
12
|
+
percent_delta: "percent_delta";
|
|
13
|
+
number_delta: "number_delta";
|
|
14
|
+
currency_delta: "currency_delta";
|
|
15
|
+
}>>;
|
|
16
|
+
prefix: z.ZodOptional<z.ZodString>;
|
|
17
|
+
suffix: z.ZodOptional<z.ZodString>;
|
|
18
|
+
}, z.core.$strict>;
|
|
19
|
+
subtitle: z.ZodOptional<z.ZodObject<{
|
|
20
|
+
text: z.ZodOptional<z.ZodString>;
|
|
21
|
+
field: z.ZodOptional<z.ZodString>;
|
|
22
|
+
}, z.core.$strict>>;
|
|
23
|
+
comparison: z.ZodOptional<z.ZodObject<{
|
|
24
|
+
field: z.ZodString;
|
|
25
|
+
format: z.ZodOptional<z.ZodEnum<{
|
|
26
|
+
number: "number";
|
|
27
|
+
integer: "integer";
|
|
28
|
+
compact_number: "compact_number";
|
|
29
|
+
currency: "currency";
|
|
30
|
+
percent: "percent";
|
|
31
|
+
percent_delta: "percent_delta";
|
|
32
|
+
number_delta: "number_delta";
|
|
33
|
+
currency_delta: "currency_delta";
|
|
34
|
+
}>>;
|
|
35
|
+
positive_is_good: z.ZodOptional<z.ZodBoolean>;
|
|
36
|
+
compact: z.ZodOptional<z.ZodObject<{
|
|
37
|
+
show: z.ZodOptional<z.ZodBoolean>;
|
|
38
|
+
template: z.ZodOptional<z.ZodString>;
|
|
39
|
+
}, z.core.$strict>>;
|
|
40
|
+
tooltip: z.ZodOptional<z.ZodObject<{
|
|
41
|
+
label: z.ZodOptional<z.ZodString>;
|
|
42
|
+
template: z.ZodOptional<z.ZodString>;
|
|
43
|
+
}, z.core.$strict>>;
|
|
44
|
+
}, z.core.$strict>>;
|
|
45
|
+
sparkline: z.ZodOptional<z.ZodObject<{
|
|
46
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
47
|
+
line: "line";
|
|
48
|
+
}>>;
|
|
49
|
+
field: z.ZodString;
|
|
50
|
+
x: z.ZodString;
|
|
51
|
+
show_axes: z.ZodOptional<z.ZodBoolean>;
|
|
52
|
+
show_labels: z.ZodOptional<z.ZodBoolean>;
|
|
53
|
+
fill: z.ZodOptional<z.ZodObject<{
|
|
54
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
55
|
+
gradient: "gradient";
|
|
56
|
+
solid: "solid";
|
|
57
|
+
}>>;
|
|
58
|
+
}, z.core.$strict>>;
|
|
59
|
+
}, z.core.$strict>>;
|
|
60
|
+
}, z.core.$strict>;
|
|
61
|
+
export declare const KpiCardWidgetConfigSchema: z.ZodObject<{
|
|
62
|
+
id: z.ZodString;
|
|
63
|
+
group_id: z.ZodString;
|
|
64
|
+
order: z.ZodNumber;
|
|
65
|
+
label: z.ZodOptional<z.ZodString>;
|
|
66
|
+
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
67
|
+
size: z.ZodOptional<z.ZodEnum<{
|
|
68
|
+
small: "small";
|
|
69
|
+
medium: "medium";
|
|
70
|
+
large: "large";
|
|
71
|
+
wide: "wide";
|
|
72
|
+
full: "full";
|
|
73
|
+
}>>;
|
|
74
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
75
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
76
|
+
min_width: z.ZodOptional<z.ZodNumber>;
|
|
77
|
+
max_width: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
78
|
+
target: z.ZodLiteral<"kpi_card">;
|
|
79
|
+
card: z.ZodObject<{
|
|
80
|
+
title: z.ZodOptional<z.ZodString>;
|
|
81
|
+
value: z.ZodObject<{
|
|
82
|
+
field: z.ZodString;
|
|
83
|
+
format: z.ZodOptional<z.ZodEnum<{
|
|
84
|
+
number: "number";
|
|
85
|
+
integer: "integer";
|
|
86
|
+
compact_number: "compact_number";
|
|
87
|
+
currency: "currency";
|
|
88
|
+
percent: "percent";
|
|
89
|
+
percent_delta: "percent_delta";
|
|
90
|
+
number_delta: "number_delta";
|
|
91
|
+
currency_delta: "currency_delta";
|
|
92
|
+
}>>;
|
|
93
|
+
prefix: z.ZodOptional<z.ZodString>;
|
|
94
|
+
suffix: z.ZodOptional<z.ZodString>;
|
|
95
|
+
}, z.core.$strict>;
|
|
96
|
+
subtitle: z.ZodOptional<z.ZodObject<{
|
|
97
|
+
text: z.ZodOptional<z.ZodString>;
|
|
98
|
+
field: z.ZodOptional<z.ZodString>;
|
|
99
|
+
}, z.core.$strict>>;
|
|
100
|
+
comparison: z.ZodOptional<z.ZodObject<{
|
|
101
|
+
field: z.ZodString;
|
|
102
|
+
format: z.ZodOptional<z.ZodEnum<{
|
|
103
|
+
number: "number";
|
|
104
|
+
integer: "integer";
|
|
105
|
+
compact_number: "compact_number";
|
|
106
|
+
currency: "currency";
|
|
107
|
+
percent: "percent";
|
|
108
|
+
percent_delta: "percent_delta";
|
|
109
|
+
number_delta: "number_delta";
|
|
110
|
+
currency_delta: "currency_delta";
|
|
111
|
+
}>>;
|
|
112
|
+
positive_is_good: z.ZodOptional<z.ZodBoolean>;
|
|
113
|
+
compact: z.ZodOptional<z.ZodObject<{
|
|
114
|
+
show: z.ZodOptional<z.ZodBoolean>;
|
|
115
|
+
template: z.ZodOptional<z.ZodString>;
|
|
116
|
+
}, z.core.$strict>>;
|
|
117
|
+
tooltip: z.ZodOptional<z.ZodObject<{
|
|
118
|
+
label: z.ZodOptional<z.ZodString>;
|
|
119
|
+
template: z.ZodOptional<z.ZodString>;
|
|
120
|
+
}, z.core.$strict>>;
|
|
121
|
+
}, z.core.$strict>>;
|
|
122
|
+
sparkline: z.ZodOptional<z.ZodObject<{
|
|
123
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
124
|
+
line: "line";
|
|
125
|
+
}>>;
|
|
126
|
+
field: z.ZodString;
|
|
127
|
+
x: z.ZodString;
|
|
128
|
+
show_axes: z.ZodOptional<z.ZodBoolean>;
|
|
129
|
+
show_labels: z.ZodOptional<z.ZodBoolean>;
|
|
130
|
+
fill: z.ZodOptional<z.ZodObject<{
|
|
131
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
132
|
+
gradient: "gradient";
|
|
133
|
+
solid: "solid";
|
|
134
|
+
}>>;
|
|
135
|
+
}, z.core.$strict>>;
|
|
136
|
+
}, z.core.$strict>>;
|
|
137
|
+
}, z.core.$strict>;
|
|
138
|
+
query: z.ZodObject<{
|
|
139
|
+
resource: z.ZodString;
|
|
140
|
+
select: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
141
|
+
field: z.ZodString;
|
|
142
|
+
as: z.ZodOptional<z.ZodString>;
|
|
143
|
+
grain: z.ZodOptional<z.ZodEnum<{
|
|
144
|
+
day: "day";
|
|
145
|
+
week: "week";
|
|
146
|
+
month: "month";
|
|
147
|
+
year: "year";
|
|
148
|
+
}>>;
|
|
149
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
150
|
+
agg: z.ZodEnum<{
|
|
151
|
+
sum: "sum";
|
|
152
|
+
count: "count";
|
|
153
|
+
count_distinct: "count_distinct";
|
|
154
|
+
avg: "avg";
|
|
155
|
+
min: "min";
|
|
156
|
+
max: "max";
|
|
157
|
+
median: "median";
|
|
158
|
+
}>;
|
|
159
|
+
field: z.ZodOptional<z.ZodString>;
|
|
160
|
+
as: z.ZodString;
|
|
161
|
+
filters: z.ZodOptional<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
162
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
163
|
+
calc: z.ZodString;
|
|
164
|
+
as: z.ZodString;
|
|
165
|
+
}, z.core.$strict>]>>>;
|
|
166
|
+
sparkline: z.ZodOptional<z.ZodObject<{
|
|
167
|
+
field: z.ZodString;
|
|
168
|
+
grain: z.ZodEnum<{
|
|
169
|
+
day: "day";
|
|
170
|
+
week: "week";
|
|
171
|
+
month: "month";
|
|
172
|
+
year: "year";
|
|
173
|
+
}>;
|
|
174
|
+
as: z.ZodString;
|
|
175
|
+
fill_missing: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
176
|
+
}, z.core.$strict>>;
|
|
177
|
+
filters: z.ZodOptional<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
178
|
+
group_by: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
179
|
+
field: z.ZodString;
|
|
180
|
+
as: z.ZodOptional<z.ZodString>;
|
|
181
|
+
grain: z.ZodOptional<z.ZodEnum<{
|
|
182
|
+
day: "day";
|
|
183
|
+
week: "week";
|
|
184
|
+
month: "month";
|
|
185
|
+
year: "year";
|
|
186
|
+
}>>;
|
|
187
|
+
timezone: z.ZodOptional<z.ZodString>;
|
|
188
|
+
}, z.core.$strict>]>>>;
|
|
189
|
+
order_by: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
190
|
+
field: z.ZodString;
|
|
191
|
+
direction: z.ZodOptional<z.ZodEnum<{
|
|
192
|
+
asc: "asc";
|
|
193
|
+
desc: "desc";
|
|
194
|
+
}>>;
|
|
195
|
+
}, z.core.$strict>>>;
|
|
196
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
197
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
198
|
+
bucket: z.ZodOptional<z.ZodObject<{
|
|
199
|
+
field: z.ZodString;
|
|
200
|
+
buckets: z.ZodArray<z.ZodObject<{
|
|
201
|
+
label: z.ZodString;
|
|
202
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
203
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
204
|
+
}, z.core.$strict>>;
|
|
205
|
+
}, z.core.$strict>>;
|
|
206
|
+
calcs: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
207
|
+
calc: z.ZodString;
|
|
208
|
+
as: z.ZodString;
|
|
209
|
+
}, z.core.$strict>>>;
|
|
210
|
+
formatting: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
211
|
+
}, z.core.$strict>;
|
|
212
|
+
}, z.core.$strict>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { QueryConfigSchema, ValueFormatSchema, WidgetBaseSchema, } from './common.js';
|
|
3
|
+
export const KpiCardViewConfigSchema = z.object({
|
|
4
|
+
title: z.string().optional(),
|
|
5
|
+
value: z.object({
|
|
6
|
+
field: z.string(),
|
|
7
|
+
format: ValueFormatSchema,
|
|
8
|
+
prefix: z.string().optional(),
|
|
9
|
+
suffix: z.string().optional(),
|
|
10
|
+
}).strict(),
|
|
11
|
+
subtitle: z.object({
|
|
12
|
+
text: z.string().optional(),
|
|
13
|
+
field: z.string().optional(),
|
|
14
|
+
}).strict().optional(),
|
|
15
|
+
comparison: z.object({
|
|
16
|
+
field: z.string(),
|
|
17
|
+
format: ValueFormatSchema,
|
|
18
|
+
positive_is_good: z.boolean().optional(),
|
|
19
|
+
compact: z.object({
|
|
20
|
+
show: z.boolean().optional(),
|
|
21
|
+
template: z.string().optional(),
|
|
22
|
+
}).strict().optional(),
|
|
23
|
+
tooltip: z.object({
|
|
24
|
+
label: z.string().optional(),
|
|
25
|
+
template: z.string().optional(),
|
|
26
|
+
}).strict().optional(),
|
|
27
|
+
}).strict().optional(),
|
|
28
|
+
sparkline: z.object({
|
|
29
|
+
type: z.enum(['line']).optional(),
|
|
30
|
+
field: z.string(),
|
|
31
|
+
x: z.string(),
|
|
32
|
+
show_axes: z.boolean().optional(),
|
|
33
|
+
show_labels: z.boolean().optional(),
|
|
34
|
+
fill: z.object({
|
|
35
|
+
type: z.enum(['gradient', 'solid']).optional(),
|
|
36
|
+
}).strict().optional(),
|
|
37
|
+
}).strict().optional(),
|
|
38
|
+
}).strict();
|
|
39
|
+
export const KpiCardWidgetConfigSchema = WidgetBaseSchema.extend({
|
|
40
|
+
target: z.literal('kpi_card'),
|
|
41
|
+
card: KpiCardViewConfigSchema,
|
|
42
|
+
query: QueryConfigSchema,
|
|
43
|
+
});
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const PivotTableViewConfigSchema: z.ZodObject<{
|
|
3
|
+
rows: z.ZodArray<z.ZodObject<{
|
|
4
|
+
field: z.ZodString;
|
|
5
|
+
label: z.ZodOptional<z.ZodString>;
|
|
6
|
+
format: z.ZodOptional<z.ZodEnum<{
|
|
7
|
+
number: "number";
|
|
8
|
+
integer: "integer";
|
|
9
|
+
compact_number: "compact_number";
|
|
10
|
+
currency: "currency";
|
|
11
|
+
percent: "percent";
|
|
12
|
+
percent_delta: "percent_delta";
|
|
13
|
+
number_delta: "number_delta";
|
|
14
|
+
currency_delta: "currency_delta";
|
|
15
|
+
}>>;
|
|
16
|
+
}, z.core.$strict>>;
|
|
17
|
+
columns: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
18
|
+
field: z.ZodString;
|
|
19
|
+
label: z.ZodOptional<z.ZodString>;
|
|
20
|
+
format: z.ZodOptional<z.ZodEnum<{
|
|
21
|
+
number: "number";
|
|
22
|
+
integer: "integer";
|
|
23
|
+
compact_number: "compact_number";
|
|
24
|
+
currency: "currency";
|
|
25
|
+
percent: "percent";
|
|
26
|
+
percent_delta: "percent_delta";
|
|
27
|
+
number_delta: "number_delta";
|
|
28
|
+
currency_delta: "currency_delta";
|
|
29
|
+
}>>;
|
|
30
|
+
}, z.core.$strict>>>;
|
|
31
|
+
values: z.ZodArray<z.ZodObject<{
|
|
32
|
+
field: z.ZodString;
|
|
33
|
+
label: z.ZodOptional<z.ZodString>;
|
|
34
|
+
format: z.ZodOptional<z.ZodEnum<{
|
|
35
|
+
number: "number";
|
|
36
|
+
integer: "integer";
|
|
37
|
+
compact_number: "compact_number";
|
|
38
|
+
currency: "currency";
|
|
39
|
+
percent: "percent";
|
|
40
|
+
percent_delta: "percent_delta";
|
|
41
|
+
number_delta: "number_delta";
|
|
42
|
+
currency_delta: "currency_delta";
|
|
43
|
+
}>>;
|
|
44
|
+
aggregation: z.ZodOptional<z.ZodEnum<{
|
|
45
|
+
sum: "sum";
|
|
46
|
+
count: "count";
|
|
47
|
+
avg: "avg";
|
|
48
|
+
min: "min";
|
|
49
|
+
max: "max";
|
|
50
|
+
}>>;
|
|
51
|
+
}, z.core.$strict>>;
|
|
52
|
+
}, z.core.$strict>;
|
|
53
|
+
export declare const PivotTableWidgetConfigSchema: z.ZodObject<{
|
|
54
|
+
id: z.ZodString;
|
|
55
|
+
group_id: z.ZodString;
|
|
56
|
+
order: z.ZodNumber;
|
|
57
|
+
label: z.ZodOptional<z.ZodString>;
|
|
58
|
+
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
59
|
+
size: z.ZodOptional<z.ZodEnum<{
|
|
60
|
+
small: "small";
|
|
61
|
+
medium: "medium";
|
|
62
|
+
large: "large";
|
|
63
|
+
wide: "wide";
|
|
64
|
+
full: "full";
|
|
65
|
+
}>>;
|
|
66
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
67
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
68
|
+
min_width: z.ZodOptional<z.ZodNumber>;
|
|
69
|
+
max_width: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
70
|
+
target: z.ZodLiteral<"pivot_table">;
|
|
71
|
+
pivot: z.ZodObject<{
|
|
72
|
+
rows: z.ZodArray<z.ZodObject<{
|
|
73
|
+
field: z.ZodString;
|
|
74
|
+
label: z.ZodOptional<z.ZodString>;
|
|
75
|
+
format: z.ZodOptional<z.ZodEnum<{
|
|
76
|
+
number: "number";
|
|
77
|
+
integer: "integer";
|
|
78
|
+
compact_number: "compact_number";
|
|
79
|
+
currency: "currency";
|
|
80
|
+
percent: "percent";
|
|
81
|
+
percent_delta: "percent_delta";
|
|
82
|
+
number_delta: "number_delta";
|
|
83
|
+
currency_delta: "currency_delta";
|
|
84
|
+
}>>;
|
|
85
|
+
}, z.core.$strict>>;
|
|
86
|
+
columns: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
87
|
+
field: z.ZodString;
|
|
88
|
+
label: z.ZodOptional<z.ZodString>;
|
|
89
|
+
format: z.ZodOptional<z.ZodEnum<{
|
|
90
|
+
number: "number";
|
|
91
|
+
integer: "integer";
|
|
92
|
+
compact_number: "compact_number";
|
|
93
|
+
currency: "currency";
|
|
94
|
+
percent: "percent";
|
|
95
|
+
percent_delta: "percent_delta";
|
|
96
|
+
number_delta: "number_delta";
|
|
97
|
+
currency_delta: "currency_delta";
|
|
98
|
+
}>>;
|
|
99
|
+
}, z.core.$strict>>>;
|
|
100
|
+
values: z.ZodArray<z.ZodObject<{
|
|
101
|
+
field: z.ZodString;
|
|
102
|
+
label: z.ZodOptional<z.ZodString>;
|
|
103
|
+
format: z.ZodOptional<z.ZodEnum<{
|
|
104
|
+
number: "number";
|
|
105
|
+
integer: "integer";
|
|
106
|
+
compact_number: "compact_number";
|
|
107
|
+
currency: "currency";
|
|
108
|
+
percent: "percent";
|
|
109
|
+
percent_delta: "percent_delta";
|
|
110
|
+
number_delta: "number_delta";
|
|
111
|
+
currency_delta: "currency_delta";
|
|
112
|
+
}>>;
|
|
113
|
+
aggregation: z.ZodOptional<z.ZodEnum<{
|
|
114
|
+
sum: "sum";
|
|
115
|
+
count: "count";
|
|
116
|
+
avg: "avg";
|
|
117
|
+
min: "min";
|
|
118
|
+
max: "max";
|
|
119
|
+
}>>;
|
|
120
|
+
}, z.core.$strict>>;
|
|
121
|
+
}, z.core.$strict>;
|
|
122
|
+
query: z.ZodObject<{
|
|
123
|
+
resource: z.ZodString;
|
|
124
|
+
select: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
125
|
+
field: z.ZodString;
|
|
126
|
+
as: z.ZodOptional<z.ZodString>;
|
|
127
|
+
grain: z.ZodOptional<z.ZodEnum<{
|
|
128
|
+
day: "day";
|
|
129
|
+
week: "week";
|
|
130
|
+
month: "month";
|
|
131
|
+
year: "year";
|
|
132
|
+
}>>;
|
|
133
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
134
|
+
agg: z.ZodEnum<{
|
|
135
|
+
sum: "sum";
|
|
136
|
+
count: "count";
|
|
137
|
+
count_distinct: "count_distinct";
|
|
138
|
+
avg: "avg";
|
|
139
|
+
min: "min";
|
|
140
|
+
max: "max";
|
|
141
|
+
median: "median";
|
|
142
|
+
}>;
|
|
143
|
+
field: z.ZodOptional<z.ZodString>;
|
|
144
|
+
as: z.ZodString;
|
|
145
|
+
filters: z.ZodOptional<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
146
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
147
|
+
calc: z.ZodString;
|
|
148
|
+
as: z.ZodString;
|
|
149
|
+
}, z.core.$strict>]>>>;
|
|
150
|
+
sparkline: z.ZodOptional<z.ZodObject<{
|
|
151
|
+
field: z.ZodString;
|
|
152
|
+
grain: z.ZodEnum<{
|
|
153
|
+
day: "day";
|
|
154
|
+
week: "week";
|
|
155
|
+
month: "month";
|
|
156
|
+
year: "year";
|
|
157
|
+
}>;
|
|
158
|
+
as: z.ZodString;
|
|
159
|
+
fill_missing: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
160
|
+
}, z.core.$strict>>;
|
|
161
|
+
filters: z.ZodOptional<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
162
|
+
group_by: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
163
|
+
field: z.ZodString;
|
|
164
|
+
as: z.ZodOptional<z.ZodString>;
|
|
165
|
+
grain: z.ZodOptional<z.ZodEnum<{
|
|
166
|
+
day: "day";
|
|
167
|
+
week: "week";
|
|
168
|
+
month: "month";
|
|
169
|
+
year: "year";
|
|
170
|
+
}>>;
|
|
171
|
+
timezone: z.ZodOptional<z.ZodString>;
|
|
172
|
+
}, z.core.$strict>]>>>;
|
|
173
|
+
order_by: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
174
|
+
field: z.ZodString;
|
|
175
|
+
direction: z.ZodOptional<z.ZodEnum<{
|
|
176
|
+
asc: "asc";
|
|
177
|
+
desc: "desc";
|
|
178
|
+
}>>;
|
|
179
|
+
}, z.core.$strict>>>;
|
|
180
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
181
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
182
|
+
bucket: z.ZodOptional<z.ZodObject<{
|
|
183
|
+
field: z.ZodString;
|
|
184
|
+
buckets: z.ZodArray<z.ZodObject<{
|
|
185
|
+
label: z.ZodString;
|
|
186
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
187
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
188
|
+
}, z.core.$strict>>;
|
|
189
|
+
}, z.core.$strict>>;
|
|
190
|
+
calcs: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
191
|
+
calc: z.ZodString;
|
|
192
|
+
as: z.ZodString;
|
|
193
|
+
}, z.core.$strict>>>;
|
|
194
|
+
formatting: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
195
|
+
}, z.core.$strict>;
|
|
196
|
+
}, z.core.$strict>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ChartFieldRefSchema, QueryConfigSchema, ValueFormatSchema, WidgetBaseSchema, } from './common.js';
|
|
3
|
+
export const PivotTableViewConfigSchema = z.object({
|
|
4
|
+
rows: z.array(ChartFieldRefSchema).min(1),
|
|
5
|
+
columns: z.array(ChartFieldRefSchema).optional(),
|
|
6
|
+
values: z.array(z.object({
|
|
7
|
+
field: z.string(),
|
|
8
|
+
label: z.string().optional(),
|
|
9
|
+
format: ValueFormatSchema,
|
|
10
|
+
aggregation: z.enum(['sum', 'count', 'avg', 'min', 'max']).optional(),
|
|
11
|
+
}).strict()).min(1),
|
|
12
|
+
}).strict();
|
|
13
|
+
export const PivotTableWidgetConfigSchema = WidgetBaseSchema.extend({
|
|
14
|
+
target: z.literal('pivot_table'),
|
|
15
|
+
pivot: PivotTableViewConfigSchema,
|
|
16
|
+
query: QueryConfigSchema,
|
|
17
|
+
});
|