@adminforth/dashboard 1.4.0 → 1.4.2
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/README.md +23 -4
- package/custom/api/dashboardApi.ts +6 -9
- package/custom/model/dashboard.types.ts +60 -275
- package/custom/model/dashboardTopics.ts +5 -0
- package/custom/package.json +1 -0
- package/custom/runtime/DashboardGroup.vue +2 -2
- package/custom/runtime/DashboardPage.vue +17 -7
- package/custom/runtime/DashboardRuntime.vue +20 -8
- package/custom/runtime/WidgetRenderer.vue +1 -2
- package/custom/runtime/WidgetShell.vue +3 -3
- package/custom/skills/adminforth-dashboard/SKILL.md +2 -2
- package/custom/widgets/{gauge-card/GaugeCardWidget.vue → GaugeCardWidget.vue} +63 -61
- package/custom/widgets/{kpi-card/KpiCardWidget.vue → KpiCardWidget.vue} +35 -33
- package/custom/widgets/{pivot-table/PivotTableWidget.vue → PivotTableWidget.vue} +71 -68
- package/custom/widgets/{table/TableWidget.vue → TableWidget.vue} +5 -5
- package/custom/widgets/chart/{bar/BarChart.vue → BarChart.vue} +2 -2
- package/custom/widgets/chart/ChartWidget.vue +4 -15
- package/{dist/custom/widgets/chart/funnel → custom/widgets/chart}/FunnelChart.vue +80 -78
- package/{dist/custom/widgets/chart/line → custom/widgets/chart}/LineChart.vue +2 -2
- package/custom/widgets/chart/{pie/PieChart.vue → PieChart.vue} +2 -2
- package/{dist/custom/widgets/chart/stacked-bar → custom/widgets/chart}/StackedBarChart.vue +97 -95
- package/custom/widgets/chart/chart.types.ts +0 -28
- package/dist/custom/api/dashboardApi.d.ts +4 -8
- package/dist/custom/api/dashboardApi.js +2 -6
- package/dist/custom/api/dashboardApi.ts +6 -9
- package/dist/custom/composables/useElementSize.js +7 -10
- package/dist/custom/model/dashboard.types.d.ts +38 -32
- package/dist/custom/model/dashboard.types.js +4 -161
- package/dist/custom/model/dashboard.types.ts +60 -275
- package/dist/custom/model/dashboardTopics.d.ts +2 -0
- package/dist/custom/model/dashboardTopics.js +4 -0
- package/dist/custom/model/dashboardTopics.ts +5 -0
- package/dist/custom/package.json +1 -0
- package/dist/custom/queries/useDashboardConfig.d.ts +96 -96
- package/dist/custom/queries/useDashboardConfig.js +9 -12
- package/dist/custom/queries/useWidgetData.d.ts +96 -96
- package/dist/custom/queries/useWidgetData.js +9 -12
- package/dist/custom/runtime/DashboardGroup.vue +2 -2
- package/dist/custom/runtime/DashboardPage.vue +17 -7
- package/dist/custom/runtime/DashboardRuntime.vue +20 -8
- package/dist/custom/runtime/WidgetRenderer.vue +1 -2
- package/dist/custom/runtime/WidgetShell.vue +3 -3
- package/dist/custom/skills/adminforth-dashboard/SKILL.md +2 -2
- package/dist/custom/widgets/{gauge-card/GaugeCardWidget.vue → GaugeCardWidget.vue} +63 -61
- package/dist/custom/widgets/{kpi-card/KpiCardWidget.vue → KpiCardWidget.vue} +35 -33
- package/dist/custom/widgets/{pivot-table/PivotTableWidget.vue → PivotTableWidget.vue} +71 -68
- package/dist/custom/widgets/{table/TableWidget.vue → TableWidget.vue} +5 -5
- package/dist/custom/widgets/chart/{bar/BarChart.vue → BarChart.vue} +2 -2
- package/dist/custom/widgets/chart/ChartWidget.vue +4 -15
- package/{custom/widgets/chart/funnel → dist/custom/widgets/chart}/FunnelChart.vue +80 -78
- package/{custom/widgets/chart/line → dist/custom/widgets/chart}/LineChart.vue +2 -2
- package/dist/custom/widgets/chart/{pie/PieChart.vue → PieChart.vue} +2 -2
- package/{custom/widgets/chart/stacked-bar → dist/custom/widgets/chart}/StackedBarChart.vue +97 -95
- package/dist/custom/widgets/chart/chart.types.d.ts +0 -2
- package/dist/custom/widgets/chart/chart.types.js +1 -25
- package/dist/custom/widgets/chart/chart.types.ts +0 -28
- package/dist/custom/widgets/chart/chart.utils.js +6 -14
- package/dist/custom/widgets/registry.js +14 -22
- package/dist/endpoint/dashboard.d.ts +2 -3
- package/dist/endpoint/dashboard.js +12 -32
- package/dist/endpoint/groups.d.ts +2 -21
- package/dist/endpoint/groups.js +18 -16
- package/dist/endpoint/widgets.d.ts +0 -3
- package/dist/endpoint/widgets.js +27 -74
- package/dist/index.js +1 -3
- package/dist/schema/api.d.ts +2090 -511
- package/dist/schema/api.js +18 -15
- package/dist/schema/widget.d.ts +1003 -250
- package/dist/schema/widget.js +102 -46
- package/dist/services/dashboardConfigService.d.ts +0 -10
- package/dist/services/dashboardConfigService.js +6 -21
- package/dist/services/widgetDataService.js +226 -196
- package/endpoint/dashboard.ts +13 -46
- package/endpoint/groups.ts +25 -42
- package/endpoint/widgets.ts +36 -95
- package/index.ts +0 -3
- package/package.json +3 -3
- package/schema/api.ts +19 -15
- package/schema/widget.ts +113 -52
- package/services/dashboardConfigService.ts +6 -25
- package/services/widgetDataService.ts +304 -229
- package/custom/widgets/chart/histogram/HistogramChart.vue +0 -21
- package/dist/custom/widgets/chart/histogram/HistogramChart.vue +0 -21
- package/dist/services/widgetConfigValidator.d.ts +0 -8
- package/dist/services/widgetConfigValidator.js +0 -27
- 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
|
-
}
|