@liujitcn/kratos-admin-bi 0.0.0-stage → 0.1.11

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 (166) hide show
  1. package/README.md +43 -2
  2. package/dist/package/declarations/index.d.ts +1 -0
  3. package/dist/package/declarations/src/api/bi/admin/v1/bi_card.d.ts +18 -0
  4. package/dist/package/declarations/src/api/bi/admin/v1/bi_card.js +46 -0
  5. package/dist/package/declarations/src/api/bi/admin/v1/bi_dashboard.d.ts +17 -0
  6. package/dist/package/declarations/src/api/bi/admin/v1/bi_dashboard.js +30 -0
  7. package/dist/package/declarations/src/api/bi/admin/v1/bi_query.d.ts +11 -0
  8. package/dist/package/declarations/src/api/bi/admin/v1/bi_query.js +41 -0
  9. package/dist/package/declarations/src/api/bi/admin/v1/bi_query_record.d.ts +10 -0
  10. package/dist/package/declarations/src/api/bi/admin/v1/bi_query_record.js +14 -0
  11. package/dist/package/declarations/src/api/bi/admin/v1/bi_source.d.ts +26 -0
  12. package/dist/package/declarations/src/api/bi/admin/v1/bi_source.js +46 -0
  13. package/dist/package/declarations/src/bi-core.d.ts +17 -0
  14. package/dist/package/declarations/src/bi-core.js +22 -0
  15. package/dist/package/declarations/src/bi-dashboard-schema.d.ts +31 -0
  16. package/dist/package/declarations/src/bi-dashboard-schema.js +39 -0
  17. package/dist/package/declarations/src/bi-messages.d.ts +247 -0
  18. package/dist/package/declarations/src/bi-messages.js +247 -0
  19. package/dist/package/declarations/src/bi-response.d.ts +10 -0
  20. package/dist/package/declarations/src/bi-response.js +33 -0
  21. package/dist/package/declarations/src/bi-vue.d.ts +10 -0
  22. package/dist/package/declarations/src/bi-vue.js +10 -0
  23. package/dist/package/declarations/src/card-schema.d.ts +30 -0
  24. package/dist/package/declarations/src/card-schema.js +87 -0
  25. package/dist/package/declarations/src/components/BiCardChartEditor.vue.d.ts +17 -0
  26. package/dist/package/declarations/src/components/BiCardChartEditor.vue.js +527 -0
  27. package/dist/package/declarations/src/components/BiCardFormDialog.vue.d.ts +20 -0
  28. package/dist/package/declarations/src/components/BiCardFormDialog.vue.js +495 -0
  29. package/dist/package/declarations/src/components/BiCardLibrary.vue.d.ts +3 -0
  30. package/dist/package/declarations/src/components/BiCardLibrary.vue.js +807 -0
  31. package/dist/package/declarations/src/components/BiCardVisualization.vue.d.ts +10 -0
  32. package/dist/package/declarations/src/components/BiCardVisualization.vue.js +97 -0
  33. package/dist/package/declarations/src/components/BiChart.vue.d.ts +20 -0
  34. package/dist/package/declarations/src/components/BiChart.vue.js +112 -0
  35. package/dist/package/declarations/src/components/BiDashboard.vue.d.ts +9 -0
  36. package/dist/package/declarations/src/components/BiDashboard.vue.js +81 -0
  37. package/dist/package/declarations/src/components/BiDashboardMenuDialog.vue.d.ts +12 -0
  38. package/dist/package/declarations/src/components/BiDashboardMenuDialog.vue.js +252 -0
  39. package/dist/package/declarations/src/components/BiDataCard.vue.d.ts +36 -0
  40. package/dist/package/declarations/src/components/BiDataCard.vue.js +372 -0
  41. package/dist/package/declarations/src/components/BiDesigner.vue.d.ts +17 -0
  42. package/dist/package/declarations/src/components/BiDesigner.vue.js +666 -0
  43. package/dist/package/declarations/src/components/BiSourceModelDialog.vue.d.ts +17 -0
  44. package/dist/package/declarations/src/components/BiSourceModelDialog.vue.js +2118 -0
  45. package/dist/package/declarations/src/components/BiWorkbenchPreview.vue.d.ts +7 -0
  46. package/dist/package/declarations/src/components/BiWorkbenchPreview.vue.js +176 -0
  47. package/dist/package/declarations/src/components/source-model-layout.d.ts +3 -0
  48. package/dist/package/declarations/src/components/source-model-layout.js +66 -0
  49. package/dist/package/declarations/src/dataset/index.d.ts +7 -0
  50. package/dist/package/declarations/src/dataset/index.js +25 -0
  51. package/dist/package/declarations/src/dataset/labels.d.ts +2 -0
  52. package/dist/package/declarations/src/dataset/labels.js +21 -0
  53. package/dist/package/declarations/src/dataset/transform.d.ts +20 -0
  54. package/dist/package/declarations/src/dataset/transform.js +173 -0
  55. package/dist/package/declarations/src/engine/chart-types.d.ts +14 -0
  56. package/dist/package/declarations/src/engine/chart-types.js +37 -0
  57. package/dist/package/declarations/src/engine/echarts.d.ts +16 -0
  58. package/dist/package/declarations/src/engine/echarts.js +491 -0
  59. package/dist/package/declarations/src/engine/types.d.ts +36 -0
  60. package/dist/package/declarations/src/engine/types.js +20 -0
  61. package/dist/package/declarations/src/env.d.ts +17 -0
  62. package/dist/package/declarations/src/env.js +67 -0
  63. package/dist/package/declarations/src/index.d.ts +1 -0
  64. package/dist/package/declarations/src/index.js +1 -0
  65. package/dist/package/declarations/src/locales/en-US.json +254 -0
  66. package/dist/package/declarations/src/locales/generated.d.ts +1021 -0
  67. package/dist/package/declarations/src/locales/generated.js +13 -0
  68. package/dist/package/declarations/src/locales/ja-JP.json +254 -0
  69. package/dist/package/declarations/src/locales/zh-CN.json +254 -0
  70. package/dist/package/declarations/src/locales/zh-TW.json +254 -0
  71. package/dist/package/declarations/src/module.d.ts +2 -0
  72. package/dist/package/declarations/src/module.js +9 -0
  73. package/dist/package/declarations/src/rpc/bi/admin/v1/bi_card.d.ts +145 -0
  74. package/dist/package/declarations/src/rpc/bi/admin/v1/bi_card.js +6 -0
  75. package/dist/package/declarations/src/rpc/bi/admin/v1/bi_dashboard.d.ts +107 -0
  76. package/dist/package/declarations/src/rpc/bi/admin/v1/bi_dashboard.js +6 -0
  77. package/dist/package/declarations/src/rpc/bi/admin/v1/bi_query.d.ts +157 -0
  78. package/dist/package/declarations/src/rpc/bi/admin/v1/bi_query.js +6 -0
  79. package/dist/package/declarations/src/rpc/bi/admin/v1/bi_query_record.d.ts +83 -0
  80. package/dist/package/declarations/src/rpc/bi/admin/v1/bi_query_record.js +15 -0
  81. package/dist/package/declarations/src/rpc/bi/admin/v1/bi_source.d.ts +301 -0
  82. package/dist/package/declarations/src/rpc/bi/admin/v1/bi_source.js +6 -0
  83. package/dist/package/declarations/src/rpc/common/v1/types.d.ts +60 -0
  84. package/dist/package/declarations/src/rpc/common/v1/types.js +6 -0
  85. package/dist/package/declarations/src/schema/layout.d.ts +7 -0
  86. package/dist/package/declarations/src/schema/layout.js +52 -0
  87. package/dist/package/declarations/src/schema/types.d.ts +83 -0
  88. package/dist/package/declarations/src/schema/types.js +1 -0
  89. package/dist/package/declarations/src/theme/index.d.ts +29 -0
  90. package/dist/package/declarations/src/theme/index.js +83 -0
  91. package/dist/package/declarations/src/theme/palettes.d.ts +7 -0
  92. package/dist/package/declarations/src/theme/palettes.js +28 -0
  93. package/dist/package/declarations/src/theme/presets.d.ts +73 -0
  94. package/dist/package/declarations/src/theme/presets.js +235 -0
  95. package/dist/package/declarations/src/views/card/index.vue.d.ts +3 -0
  96. package/dist/package/declarations/src/views/card/index.vue.js +18 -0
  97. package/dist/package/declarations/src/views/dashboard/index.vue.d.ts +3 -0
  98. package/dist/package/declarations/src/views/dashboard/index.vue.js +107 -0
  99. package/dist/package/declarations/src/views/designer/index.vue.d.ts +3 -0
  100. package/dist/package/declarations/src/views/designer/index.vue.js +332 -0
  101. package/dist/package/declarations/src/views/manage/index.vue.d.ts +3 -0
  102. package/dist/package/declarations/src/views/manage/index.vue.js +325 -0
  103. package/dist/package/declarations/src/views/query/index.vue.d.ts +3 -0
  104. package/dist/package/declarations/src/views/query/index.vue.js +876 -0
  105. package/dist/package/declarations/src/views/source/index.vue.d.ts +3 -0
  106. package/dist/package/declarations/src/views/source/index.vue.js +343 -0
  107. package/dist/package/declarations/src/views/workbench/index.vue.d.ts +3 -0
  108. package/dist/package/declarations/src/views/workbench/index.vue.js +362 -0
  109. package/dist/package/src/api/bi/admin/v1/bi_card.ts +67 -0
  110. package/dist/package/src/api/bi/admin/v1/bi_dashboard.ts +51 -0
  111. package/dist/package/src/api/bi/admin/v1/bi_query.ts +55 -0
  112. package/dist/package/src/api/bi/admin/v1/bi_query_record.ts +25 -0
  113. package/dist/package/src/api/bi/admin/v1/bi_source.ts +80 -0
  114. package/dist/package/src/bi-core.ts +43 -0
  115. package/dist/package/src/bi-dashboard-schema.ts +69 -0
  116. package/dist/package/src/bi-messages.ts +249 -0
  117. package/dist/package/src/bi-response.ts +39 -0
  118. package/dist/package/src/bi-vue.ts +13 -0
  119. package/dist/package/src/card-schema.ts +111 -0
  120. package/dist/package/src/components/BiCardChartEditor.vue +139 -0
  121. package/dist/package/src/components/BiCardFormDialog.vue +289 -0
  122. package/dist/package/src/components/BiCardLibrary.vue +310 -0
  123. package/dist/package/src/components/BiCardVisualization.vue +95 -0
  124. package/dist/package/src/components/BiChart.vue +134 -0
  125. package/dist/package/src/components/BiDashboard.vue +53 -0
  126. package/dist/package/src/components/BiDashboardMenuDialog.vue +177 -0
  127. package/dist/package/src/components/BiDataCard.vue +231 -0
  128. package/dist/package/src/components/BiDesigner.vue +287 -0
  129. package/dist/package/src/components/BiSourceModelDialog.vue +846 -0
  130. package/dist/package/src/components/BiWorkbenchPreview.vue +131 -0
  131. package/dist/package/src/components/source-model-layout.ts +62 -0
  132. package/dist/package/src/dataset/index.ts +28 -0
  133. package/dist/package/src/dataset/labels.ts +19 -0
  134. package/dist/package/src/dataset/transform.ts +189 -0
  135. package/dist/package/src/engine/chart-types.ts +44 -0
  136. package/dist/package/src/engine/echarts.ts +568 -0
  137. package/dist/package/src/engine/types.ts +60 -0
  138. package/dist/package/src/env.ts +82 -0
  139. package/dist/package/src/index.ts +1 -0
  140. package/dist/package/src/locales/en-US.json +254 -0
  141. package/dist/package/src/locales/generated.ts +16 -0
  142. package/dist/package/src/locales/ja-JP.json +254 -0
  143. package/dist/package/src/locales/zh-CN.json +254 -0
  144. package/dist/package/src/locales/zh-TW.json +254 -0
  145. package/dist/package/src/module.ts +12 -0
  146. package/dist/package/src/rpc/bi/admin/v1/bi_card.ts +169 -0
  147. package/dist/package/src/rpc/bi/admin/v1/bi_dashboard.ts +126 -0
  148. package/dist/package/src/rpc/bi/admin/v1/bi_query.ts +187 -0
  149. package/dist/package/src/rpc/bi/admin/v1/bi_query_record.ts +98 -0
  150. package/dist/package/src/rpc/bi/admin/v1/bi_source.ts +338 -0
  151. package/dist/package/src/rpc/common/v1/types.ts +77 -0
  152. package/dist/package/src/schema/layout.ts +54 -0
  153. package/dist/package/src/schema/types.ts +103 -0
  154. package/dist/package/src/styles.scss +1 -0
  155. package/dist/package/src/theme/index.ts +108 -0
  156. package/dist/package/src/theme/palettes.ts +34 -0
  157. package/dist/package/src/theme/presets.ts +278 -0
  158. package/dist/package/src/views/card/index.vue +5 -0
  159. package/dist/package/src/views/dashboard/index.vue +58 -0
  160. package/dist/package/src/views/designer/index.vue +164 -0
  161. package/dist/package/src/views/manage/index.vue +276 -0
  162. package/dist/package/src/views/query/index.vue +593 -0
  163. package/dist/package/src/views/source/index.vue +214 -0
  164. package/dist/package/src/views/workbench/index.vue +208 -0
  165. package/package.json +67 -3
  166. package/tsconfig.json +12 -0
@@ -0,0 +1,10 @@
1
+ import type { BiCard } from "../rpc/bi/admin/v1/bi_card";
2
+ import type { BiQueryResult } from "../rpc/bi/admin/v1/bi_query";
3
+ type __VLS_Props = {
4
+ card: BiCard;
5
+ result: BiQueryResult;
6
+ compact?: boolean;
7
+ };
8
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
@@ -0,0 +1,97 @@
1
+ /// <reference types="../../../../../node_modules/.pnpm/@vue+language-core@3.3.13/node_modules/@vue/language-core/types/template-helpers.d.ts" />
2
+ /// <reference types="../../../../../node_modules/.pnpm/@vue+language-core@3.3.13/node_modules/@vue/language-core/types/props-fallback.d.ts" />
3
+ import { computed } from "vue";
4
+ import { t } from "@liujitcn/kratos-admin-core";
5
+ import { buildCardChart, formatCardMetric } from "../card-schema";
6
+ import { useBiTheme } from "../env";
7
+ import BiChart from "./BiChart.vue";
8
+ const { defineProps, } = {};
9
+ const props = defineProps();
10
+ const theme = useBiTheme();
11
+ const data = computed(() => {
12
+ const value = buildCardChart(props.card, props.result);
13
+ if (props.compact) {
14
+ value.chart.style = { ...value.chart.style, showLegend: false, showLabel: false, dataZoom: false };
15
+ value.chart.options = { tooltip: { show: false }, visualMap: { show: false } };
16
+ if (["bar", "line", "area", "scatter", "heatmap"].includes(props.card.chart_type)) {
17
+ value.chart.options.grid = { left: 4, right: 4, top: 6, bottom: 4 };
18
+ value.chart.options.xAxis = { type: props.card.chart_type === "scatter" ? "value" : "category", show: false };
19
+ value.chart.options.yAxis = { type: props.card.chart_type === "heatmap" ? "category" : "value", show: false };
20
+ }
21
+ }
22
+ return value;
23
+ });
24
+ const __VLS_ctx = {
25
+ ...{},
26
+ ...{},
27
+ ...{},
28
+ };
29
+ let __VLS_components;
30
+ let __VLS_intrinsics;
31
+ let __VLS_directives;
32
+ void __VLS_ctx, __VLS_components, __VLS_intrinsics, __VLS_directives;
33
+ // @ts-ignore
34
+ __VLS_withDotValue(data, {});
35
+ void {};
36
+ /** @type {__VLS_StyleScopedClasses['bi-card-metrics__item']} */ ;
37
+ /** @type {__VLS_StyleScopedClasses['bi-card-metrics__item']} */ ;
38
+ /** @type {__VLS_StyleScopedClasses['bi-card-metrics']} */ ;
39
+ /** @type {__VLS_StyleScopedClasses['bi-card-metrics']} */ ;
40
+ /** @type {__VLS_StyleScopedClasses['is-multiple']} */ ;
41
+ /** @type {__VLS_StyleScopedClasses['bi-card-metrics__item']} */ ;
42
+ /** @type {__VLS_StyleScopedClasses['bi-card-metrics']} */ ;
43
+ /** @type {__VLS_StyleScopedClasses['is-multiple']} */ ;
44
+ /** @type {__VLS_StyleScopedClasses['bi-card-metrics']} */ ;
45
+ /** @type {__VLS_StyleScopedClasses['is-multiple']} */ ;
46
+ /** @type {__VLS_StyleScopedClasses['bi-card-metrics']} */ ;
47
+ /** @type {__VLS_StyleScopedClasses['bi-card-metrics__item']} */ ;
48
+ /** @type {__VLS_StyleScopedClasses['bi-card-plot']} */ ;
49
+ if (data.value.metricOnly) {
50
+ __VLS_asFunctionalElement1(__VLS_intrinsics.div, __VLS_intrinsics.div)({
51
+ ...{ class: "bi-card-metrics" },
52
+ ...{ class: ({ 'is-multiple': data.value.metrics.length > 1, 'is-compact': __VLS_ctx.compact }) },
53
+ });
54
+ /** @type {__VLS_StyleScopedClasses['bi-card-metrics']} */ ;
55
+ /** @type {__VLS_StyleScopedClasses['is-multiple']} */ ;
56
+ /** @type {__VLS_StyleScopedClasses['is-compact']} */ ;
57
+ const __VLS_0 = __VLS_tryAsConstant((data.value.metrics));
58
+ for (const [metric] of __VLS_vFor(__VLS_nonNull(__VLS_0))) {
59
+ __VLS_asFunctionalElement1(__VLS_intrinsics.div, __VLS_intrinsics.div)({
60
+ key: (metric.code),
61
+ ...{ class: "bi-card-metrics__item" },
62
+ });
63
+ /** @type {__VLS_StyleScopedClasses['bi-card-metrics__item']} */ ;
64
+ if (data.value.metrics.length > 1) {
65
+ __VLS_asFunctionalElement1(__VLS_intrinsics.span, __VLS_intrinsics.span)({});
66
+ (metric.name);
67
+ }
68
+ __VLS_asFunctionalElement1(__VLS_intrinsics.strong, __VLS_intrinsics.strong)({});
69
+ (__VLS_unwrap(formatCardMetric, {})(metric.value));
70
+ // @ts-ignore
71
+ [data, data, data, data, compact, formatCardMetric,];
72
+ }
73
+ }
74
+ else {
75
+ __VLS_asFunctionalElement1(__VLS_intrinsics.div, __VLS_intrinsics.div)({
76
+ ...{ class: "bi-card-plot" },
77
+ });
78
+ /** @type {__VLS_StyleScopedClasses['bi-card-plot']} */ ;
79
+ const __VLS_1 = BiChart;
80
+ // @ts-ignore
81
+ const __VLS_2 = __VLS_asFunctionalComponent1(__VLS_1, new __VLS_1({
82
+ // @ts-ignore
83
+ chart: (data.value.chart), rows: (data.value.rows), theme: (__VLS_unwrap(theme, {})), emptyText: (__VLS_unwrap(t, {})('common.message.no_data')),
84
+ }));
85
+ const __VLS_3 = __VLS_2({
86
+ chart: (data.value.chart),
87
+ rows: (data.value.rows),
88
+ theme: (__VLS_unwrap(theme, {})),
89
+ emptyText: (__VLS_unwrap(t, {})('common.message.no_data')),
90
+ }, ...__VLS_functionalComponentArgsRest(__VLS_2));
91
+ }
92
+ // @ts-ignore
93
+ [data, data, theme, t,];
94
+ const __VLS_export = (await import('vue')).defineComponent({
95
+ __typeProps: {},
96
+ });
97
+ export default {};
@@ -0,0 +1,20 @@
1
+ import type { BiChartEvent, BiChartSchema, BiResolvedTheme } from "../bi-core";
2
+ type __VLS_Props = {
3
+ chart: BiChartSchema;
4
+ rows: any[];
5
+ theme: BiResolvedTheme;
6
+ loading?: boolean;
7
+ error?: string | null;
8
+ emptyText?: string;
9
+ };
10
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
11
+ "chart-click": (event: BiChartEvent) => any;
12
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
13
+ "onChart-click"?: ((event: BiChartEvent) => any) | undefined;
14
+ }>, {
15
+ loading: boolean;
16
+ error: string | null;
17
+ emptyText: string;
18
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
+ declare const _default: typeof __VLS_export;
20
+ export default _default;
@@ -0,0 +1,112 @@
1
+ /// <reference types="../../../../../node_modules/.pnpm/@vue+language-core@3.3.13/node_modules/@vue/language-core/types/template-helpers.d.ts" />
2
+ /// <reference types="../../../../../node_modules/.pnpm/@vue+language-core@3.3.13/node_modules/@vue/language-core/types/props-fallback.d.ts" />
3
+ /**
4
+ * 单图表渲染:引擎挂载 + 行数据/主题变化重编译 + ResizeObserver 跟随。
5
+ * 空数据不挂引擎,只显示占位文案。
6
+ */
7
+ import { onBeforeUnmount, onMounted, ref, watch } from "vue";
8
+ import { getEngine, transformRows } from "../bi-core";
9
+ const { defineProps, defineEmits, withDefaults, } = {};
10
+ const props = withDefaults(defineProps(), { loading: false, error: null, emptyText: "" });
11
+ const emit = defineEmits();
12
+ const hostRef = ref(null);
13
+ const ready = ref(false);
14
+ let handle = null;
15
+ let observer = null;
16
+ let frame = 0;
17
+ /** 释放图表及尚未执行的尺寸更新。 */
18
+ function teardown() {
19
+ cancelAnimationFrame(frame);
20
+ observer?.disconnect();
21
+ observer = null;
22
+ handle?.dispose();
23
+ handle = null;
24
+ ready.value = false;
25
+ }
26
+ function compileAndApply() {
27
+ if (!handle)
28
+ return;
29
+ const engine = getEngine(props.chart.engine);
30
+ handle.update(engine.compile(props.chart, transformRows(props.chart, props.rows), props.theme));
31
+ }
32
+ /** 等弹窗或折叠区域实际显示后再挂载图表,避免以零尺寸初始化。 */
33
+ function setup() {
34
+ teardown();
35
+ if (!hostRef.value || !props.rows.length)
36
+ return;
37
+ observer = new ResizeObserver(() => {
38
+ cancelAnimationFrame(frame);
39
+ frame = requestAnimationFrame(() => {
40
+ const host = hostRef.value;
41
+ if (!host?.clientWidth || !host.clientHeight)
42
+ return;
43
+ if (handle) {
44
+ handle.resize();
45
+ return;
46
+ }
47
+ const engine = getEngine(props.chart.engine);
48
+ handle = engine.mount(host, engine.compile(props.chart, transformRows(props.chart, props.rows), props.theme));
49
+ engine.bindEvents(handle, (e) => emit("chart-click", { ...e, chartId: props.chart.id }));
50
+ ready.value = true;
51
+ });
52
+ });
53
+ observer.observe(hostRef.value);
54
+ }
55
+ onMounted(setup);
56
+ watch(() => [props.rows, props.theme, props.chart], () => {
57
+ // 数据从空到有 / 引擎未挂时重建;否则原地重编译
58
+ if (!handle || !props.rows.length) {
59
+ setup();
60
+ }
61
+ else {
62
+ compileAndApply();
63
+ }
64
+ }, { deep: true });
65
+ onBeforeUnmount(teardown);
66
+ const __VLS_defaults = { loading: false, error: null, emptyText: "" };
67
+ void __VLS_defaults;
68
+ const __VLS_ctx = {
69
+ ...{},
70
+ ...{},
71
+ ...{},
72
+ ...{},
73
+ };
74
+ let __VLS_components;
75
+ let __VLS_intrinsics;
76
+ let __VLS_directives;
77
+ void __VLS_ctx, __VLS_components, __VLS_intrinsics, __VLS_directives;
78
+ // @ts-ignore
79
+ __VLS_withDotValue(ready, {});
80
+ void {};
81
+ __VLS_asFunctionalElement1(__VLS_intrinsics.div, __VLS_intrinsics.div)({
82
+ ...{ class: "bi-chart" },
83
+ });
84
+ /** @type {__VLS_StyleScopedClasses['bi-chart']} */ ;
85
+ __VLS_asFunctionalElement1(__VLS_intrinsics.div)({
86
+ ref: "hostRef",
87
+ ...{ class: "bi-chart__host" },
88
+ ...{ style: ({ visibility: ready.value ? 'visible' : 'hidden' }) },
89
+ });
90
+ /** @type {__VLS_StyleScopedClasses['bi-chart__host']} */ ;
91
+ if (__VLS_ctx.error) {
92
+ __VLS_asFunctionalElement1(__VLS_intrinsics.div, __VLS_intrinsics.div)({
93
+ ...{ class: "bi-chart__error" },
94
+ title: (__VLS_ctx.error),
95
+ });
96
+ /** @type {__VLS_StyleScopedClasses['bi-chart__error']} */ ;
97
+ }
98
+ else if (!__VLS_ctx.rows.length) {
99
+ __VLS_asFunctionalElement1(__VLS_intrinsics.div, __VLS_intrinsics.div)({
100
+ ...{ class: "bi-chart__empty" },
101
+ });
102
+ /** @type {__VLS_StyleScopedClasses['bi-chart__empty']} */ ;
103
+ (__VLS_ctx.emptyText);
104
+ }
105
+ // @ts-ignore
106
+ [ready, error, error, rows, emptyText,];
107
+ const __VLS_export = (await import('vue')).defineComponent({
108
+ __typeEmits: {},
109
+ __typeProps: {},
110
+ props: {},
111
+ });
112
+ export default {};
@@ -0,0 +1,9 @@
1
+ import type { BiQueryResult } from "../rpc/bi/admin/v1/bi_query";
2
+ import type { DashboardLayout } from "../bi-dashboard-schema";
3
+ type __VLS_Props = {
4
+ schema: DashboardLayout;
5
+ results: Map<string, BiQueryResult | undefined>;
6
+ };
7
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
8
+ declare const _default: typeof __VLS_export;
9
+ export default _default;
@@ -0,0 +1,81 @@
1
+ /// <reference types="../../../../../node_modules/.pnpm/@vue+language-core@3.3.13/node_modules/@vue/language-core/types/template-helpers.d.ts" />
2
+ /// <reference types="../../../../../node_modules/.pnpm/@vue+language-core@3.3.13/node_modules/@vue/language-core/types/props-fallback.d.ts" />
3
+ import { t } from "@liujitcn/kratos-admin-core";
4
+ import { dashboardSnapshotCard } from "../bi-dashboard-schema";
5
+ import BiDataCard from "./BiDataCard.vue";
6
+ const { defineProps, } = {};
7
+ const __VLS_props = defineProps();
8
+ const __VLS_ctx = {
9
+ ...{},
10
+ ...{},
11
+ ...{},
12
+ };
13
+ let __VLS_components;
14
+ let __VLS_intrinsics;
15
+ let __VLS_directives;
16
+ void __VLS_ctx, __VLS_components, __VLS_intrinsics, __VLS_directives;
17
+ void {};
18
+ /** @type {__VLS_StyleScopedClasses['bi-dashboard-grid__item']} */ ;
19
+ /** @type {__VLS_StyleScopedClasses['bi-dashboard-grid__item']} */ ;
20
+ /** @type {__VLS_StyleScopedClasses['bi-dashboard-grid']} */ ;
21
+ /** @type {__VLS_StyleScopedClasses['bi-dashboard-grid__item']} */ ;
22
+ __VLS_asFunctionalElement1(__VLS_intrinsics.div, __VLS_intrinsics.div)({
23
+ ...{ class: "bi-dashboard-grid" },
24
+ });
25
+ /** @type {__VLS_StyleScopedClasses['bi-dashboard-grid']} */ ;
26
+ const __VLS_0 = __VLS_tryAsConstant((__VLS_ctx.schema.cards));
27
+ for (const [item] of __VLS_vFor(__VLS_nonNull(__VLS_0))) {
28
+ __VLS_asFunctionalElement1(__VLS_intrinsics.div, __VLS_intrinsics.div)({
29
+ key: (item.id),
30
+ ...{ class: "bi-dashboard-grid__item" },
31
+ ...{ style: ({ gridColumn: `${(item.x || 0) + 1} / span ${item.w}`, gridRow: `${(item.y || 0) + 1} / span ${item.h}` }) },
32
+ });
33
+ /** @type {__VLS_StyleScopedClasses['bi-dashboard-grid__item']} */ ;
34
+ if (__VLS_ctx.results.get(item.id)) {
35
+ const __VLS_1 = BiDataCard;
36
+ // @ts-ignore
37
+ const __VLS_2 = __VLS_asFunctionalComponent1(__VLS_1, new __VLS_1({
38
+ // @ts-ignore
39
+ card: (__VLS_unwrap(dashboardSnapshotCard, {})(item)), previewResult: (__VLS_ctx.results.get(item.id)), showCategory: (false),
40
+ }));
41
+ const __VLS_3 = __VLS_2({
42
+ card: (__VLS_unwrap(dashboardSnapshotCard, {})(item)),
43
+ previewResult: (__VLS_ctx.results.get(item.id)),
44
+ showCategory: (false),
45
+ }, ...__VLS_functionalComponentArgsRest(__VLS_2));
46
+ }
47
+ else {
48
+ let __VLS_6;
49
+ /** @ts-ignore @type { | typeof __VLS_components.elEmpty | typeof __VLS_components.ElEmpty | typeof __VLS_components['el-empty']} */
50
+ elEmpty;
51
+ // @ts-ignore
52
+ const __VLS_7 = __VLS_asFunctionalComponent1(__VLS_6, new __VLS_6({
53
+ // @ts-ignore
54
+ description: (__VLS_unwrap(t, {})('common.message.no_data')),
55
+ }));
56
+ const __VLS_8 = __VLS_7({
57
+ description: (__VLS_unwrap(t, {})('common.message.no_data')),
58
+ }, ...__VLS_functionalComponentArgsRest(__VLS_7));
59
+ }
60
+ // @ts-ignore
61
+ [schema, results, results, dashboardSnapshotCard, t,];
62
+ }
63
+ if (!__VLS_ctx.schema.cards.length) {
64
+ let __VLS_11;
65
+ /** @ts-ignore @type { | typeof __VLS_components.elEmpty | typeof __VLS_components.ElEmpty | typeof __VLS_components['el-empty']} */
66
+ elEmpty;
67
+ // @ts-ignore
68
+ const __VLS_12 = __VLS_asFunctionalComponent1(__VLS_11, new __VLS_11({
69
+ // @ts-ignore
70
+ description: (__VLS_unwrap(t, {})('bi.dashboard.empty')),
71
+ }));
72
+ const __VLS_13 = __VLS_12({
73
+ description: (__VLS_unwrap(t, {})('bi.dashboard.empty')),
74
+ }, ...__VLS_functionalComponentArgsRest(__VLS_12));
75
+ }
76
+ // @ts-ignore
77
+ [schema, t,];
78
+ const __VLS_export = (await import('vue')).defineComponent({
79
+ __typeProps: {},
80
+ });
81
+ export default {};
@@ -0,0 +1,12 @@
1
+ import type { BiDashboard } from "../rpc/bi/admin/v1/bi_dashboard";
2
+ type __VLS_Props = {
3
+ modelValue: boolean;
4
+ dashboard?: BiDashboard;
5
+ };
6
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
7
+ "update:modelValue": (value: boolean) => any;
8
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
9
+ "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
10
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
+ declare const _default: typeof __VLS_export;
12
+ export default _default;
@@ -0,0 +1,252 @@
1
+ /// <reference types="../../../../../node_modules/.pnpm/@vue+language-core@3.3.13/node_modules/@vue/language-core/types/template-helpers.d.ts" />
2
+ /// <reference types="../../../../../node_modules/.pnpm/@vue+language-core@3.3.13/node_modules/@vue/language-core/types/props-fallback.d.ts" />
3
+ import { computed, reactive, ref, watch } from "vue";
4
+ import { t } from "@liujitcn/kratos-admin-core";
5
+ import FormDialog from "@liujitcn/kratos-admin-core/components/Dialog/FormDialog.vue";
6
+ import SelectIcon from "@liujitcn/kratos-admin-core/components/SelectIcon/index.vue";
7
+ import { defBaseMenuService } from "@liujitcn/kratos-admin-system/api/system/admin/v1/base_menu";
8
+ import { loadEnabledBaseLanguages } from "@liujitcn/kratos-admin-system/api/system/admin/v1/base_language";
9
+ import DynamicI18nEditor from "@liujitcn/kratos-admin-system/components/i18n/DynamicI18nEditor.vue";
10
+ import { normalizeDynamicI18ns, serializeDynamicI18ns } from "@liujitcn/kratos-admin-system/components/i18n/dynamicI18n";
11
+ import { BaseMenuType } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/common";
12
+ import { Status } from "@liujitcn/kratos-admin-system/rpc/common/v1/enum";
13
+ const { defineProps, defineEmits, } = {};
14
+ const props = defineProps();
15
+ const emit = defineEmits();
16
+ const dialog = ref();
17
+ const form = reactive({ title: "", icon: "DataAnalysis", parent_id: undefined });
18
+ const options = ref([]);
19
+ const existing = ref();
20
+ const i18nValues = ref([]);
21
+ const loading = ref(false), saving = ref(false);
22
+ let request = 0;
23
+ const fields = computed(() => [
24
+ {
25
+ prop: "title",
26
+ label: t("system.base.menu.field.title"),
27
+ component: "input",
28
+ suffixSlotName: "i18ns",
29
+ props: { maxlength: 100 }
30
+ },
31
+ { prop: "icon", label: t("system.base.menu.field.icon"), component: "slot", slotName: "icon" },
32
+ {
33
+ prop: "parent_id",
34
+ label: t("bi.dashboard.menu_position"),
35
+ component: "tree-select",
36
+ options: options.value,
37
+ props: { nodeKey: "value", props: { label: "label", children: "children" }, checkStrictly: true, filterable: true }
38
+ }
39
+ ]);
40
+ const rules = computed(() => ({
41
+ title: [{ required: true, whitespace: true, message: t("system.base.menu.placeholder.title"), trigger: "blur" }],
42
+ icon: [{ required: true, message: t("system.base.menu.placeholder.icon"), trigger: "change" }],
43
+ parent_id: [{ required: true, message: t("system.base.menu.placeholder.parent"), trigger: "change" }]
44
+ }));
45
+ /** 加载可放置的管理端目录,并回填当前仪表盘已存在的菜单。 */
46
+ async function load() {
47
+ const current = ++request;
48
+ loading.value = true;
49
+ existing.value = undefined;
50
+ i18nValues.value = [];
51
+ Object.assign(form, { title: props.dashboard?.name || "", icon: "DataAnalysis", parent_id: undefined });
52
+ try {
53
+ await loadEnabledBaseLanguages();
54
+ if (current !== request)
55
+ return;
56
+ i18nValues.value = normalizeDynamicI18ns(undefined);
57
+ const data = await defBaseMenuService.TreeBaseMenu({ lazy: false });
58
+ if (current !== request)
59
+ return;
60
+ options.value = folderOptions(data.base_menus || []);
61
+ const queue = [...(data.base_menus || [])];
62
+ for (const item of queue) {
63
+ queue.push(...(item.children || []));
64
+ if (item.name !== `BiDashboard${props.dashboard?.id}` || item.component !== "bi/dashboard/index")
65
+ continue;
66
+ const value = await defBaseMenuService.GetBaseMenu({ id: item.id });
67
+ if (current !== request)
68
+ return;
69
+ existing.value = value;
70
+ i18nValues.value = normalizeDynamicI18ns(value.i18ns);
71
+ Object.assign(form, {
72
+ title: value.meta?.title || props.dashboard?.name || "",
73
+ icon: value.meta?.icon || "DataAnalysis",
74
+ parent_id: value.parent_id
75
+ });
76
+ break;
77
+ }
78
+ }
79
+ catch (cause) {
80
+ ElMessage.error(cause instanceof Error ? cause.message : t("bi.query.error"));
81
+ }
82
+ finally {
83
+ if (current === request)
84
+ loading.value = false;
85
+ }
86
+ }
87
+ /** 目录作为唯一可选父级,排除移动端分支和页面、按钮节点。 */
88
+ function folderOptions(items) {
89
+ return items
90
+ .filter(item => item.type === BaseMenuType.BASE_MENU_TYPE_FOLDER && item.id !== 99000000)
91
+ .map(item => ({ label: item.meta?.title || item.name, value: item.id, children: folderOptions(item.children || []) }));
92
+ }
93
+ /** 固定仪表盘路由与权限,保存菜单标题、译文、图标和父目录。 */
94
+ async function submit() {
95
+ if (!props.dashboard || loading.value || saving.value || !(await dialog.value?.validate()))
96
+ return;
97
+ saving.value = true;
98
+ try {
99
+ const payload = {
100
+ id: existing.value?.id || 0,
101
+ parent_id: form.parent_id,
102
+ type: BaseMenuType.BASE_MENU_TYPE_MENU,
103
+ path: `/reports/dashboard/${props.dashboard.id}`,
104
+ name: `BiDashboard${props.dashboard.id}`,
105
+ component: "bi/dashboard/index",
106
+ redirect: "",
107
+ meta: {
108
+ title: form.title,
109
+ icon: form.icon,
110
+ hidden: false,
111
+ always_show: false,
112
+ keep_alive: false,
113
+ full: false,
114
+ affix: false,
115
+ params: [],
116
+ app: undefined
117
+ },
118
+ api: ["/bi.admin.v1.BiDashboardService/GetBiDashboardData"],
119
+ i18ns: serializeDynamicI18ns(i18nValues.value, "base_menu.meta.title", existing.value?.id || 0, form.title),
120
+ sort: existing.value?.sort || 1,
121
+ status: Status.STATUS_ENABLE
122
+ };
123
+ if (payload.id)
124
+ await defBaseMenuService.UpdateBaseMenu({ base_menu: payload });
125
+ else
126
+ await defBaseMenuService.CreateBaseMenu({ base_menu: payload });
127
+ ElMessage.success(t("bi.dashboard.menu_saved"));
128
+ emit("update:modelValue", false);
129
+ }
130
+ catch (cause) {
131
+ ElMessage.error(cause instanceof Error ? cause.message : t("bi.query.error"));
132
+ }
133
+ finally {
134
+ saving.value = false;
135
+ }
136
+ }
137
+ /** 关闭时清空草稿与校验,并丢弃迟到的目录请求。 */
138
+ function reset() {
139
+ request++;
140
+ loading.value = false;
141
+ existing.value = undefined;
142
+ i18nValues.value = [];
143
+ options.value = [];
144
+ Object.assign(form, { title: "", icon: "DataAnalysis", parent_id: undefined });
145
+ dialog.value?.clearValidate();
146
+ }
147
+ watch(() => [props.modelValue, props.dashboard?.id], () => {
148
+ if (props.modelValue && props.dashboard)
149
+ void load();
150
+ });
151
+ const __VLS_ctx = {
152
+ ...{},
153
+ ...{},
154
+ ...{},
155
+ ...{},
156
+ };
157
+ let __VLS_components;
158
+ let __VLS_intrinsics;
159
+ let __VLS_directives;
160
+ void __VLS_ctx, __VLS_components, __VLS_intrinsics, __VLS_directives;
161
+ // @ts-ignore
162
+ __VLS_withDotValue(loading, {});
163
+ // @ts-ignore
164
+ __VLS_withDotValue(saving, {});
165
+ // @ts-ignore
166
+ __VLS_withDotValue(form, {});
167
+ const __VLS_0 = FormDialog || FormDialog;
168
+ // @ts-ignore
169
+ const __VLS_1 = __VLS_asFunctionalComponent1(__VLS_0, new __VLS_0({
170
+ // @ts-ignore
171
+ ...{ 'onUpdate:modelValue': {} }, ...{ 'onConfirm': {} }, ...{ 'onClosed': {} }, ref: "dialog", modelValue: (__VLS_ctx.modelValue), title: (__VLS_unwrap(t, {})('bi.dashboard.configure_menu')), model: (form.value), fields: (__VLS_unwrap(fields, {})), rules: (__VLS_unwrap(rules, {})), confirmLoading: (saving.value), formProps: ({ disabled: loading.value || saving.value }), closeOnClickModal: (!saving.value),
172
+ }));
173
+ const __VLS_2 = __VLS_1({
174
+ ...{ 'onUpdate:modelValue': {} },
175
+ ...{ 'onConfirm': {} },
176
+ ...{ 'onClosed': {} },
177
+ ref: "dialog",
178
+ modelValue: (__VLS_ctx.modelValue),
179
+ title: (__VLS_unwrap(t, {})('bi.dashboard.configure_menu')),
180
+ model: (form.value),
181
+ fields: (__VLS_unwrap(fields, {})),
182
+ rules: (__VLS_unwrap(rules, {})),
183
+ confirmLoading: (saving.value),
184
+ formProps: ({ disabled: loading.value || saving.value }),
185
+ closeOnClickModal: (!saving.value),
186
+ }, ...__VLS_functionalComponentArgsRest(__VLS_1));
187
+ let __VLS_5;
188
+ const __VLS_6 = {
189
+ /** @type {typeof __VLS_5.'update:modelValue'} */
190
+ 'onUpdate:modelValue': // @ts-ignore
191
+ (...[$event]) => {
192
+ void $event;
193
+ return (__VLS_unwrap(emit, {})('update:modelValue', $event));
194
+ // @ts-ignore
195
+ [modelValue, t, form, fields, rules, saving, saving, saving, loading, emit,];
196
+ },
197
+ };
198
+ void __VLS_6;
199
+ const __VLS_7 = {
200
+ /** @type {typeof __VLS_5.confirm} */
201
+ onConfirm: (submit),
202
+ };
203
+ void __VLS_7;
204
+ const __VLS_8 = {
205
+ /** @type {typeof __VLS_5.closed} */
206
+ onClosed: (reset),
207
+ };
208
+ void __VLS_8;
209
+ const { default: __VLS_9 } = __VLS_nonNull(__VLS_3.slots);
210
+ {
211
+ const { i18ns: __VLS_10 } = __VLS_nonNull(__VLS_3.slots);
212
+ const __VLS_11 = DynamicI18nEditor;
213
+ // @ts-ignore
214
+ const __VLS_12 = __VLS_asFunctionalComponent1(__VLS_11, new __VLS_11({
215
+ // @ts-ignore
216
+ modelValue: (__VLS_unwrap(i18nValues, {})), source: (form.value.title), maxlength: (100), disabled: (loading.value || saving.value),
217
+ }));
218
+ const __VLS_13 = __VLS_12({
219
+ modelValue: (__VLS_unwrap(i18nValues, {})),
220
+ source: (form.value.title),
221
+ maxlength: (100),
222
+ disabled: (loading.value || saving.value),
223
+ }, ...__VLS_functionalComponentArgsRest(__VLS_12));
224
+ // @ts-ignore
225
+ [form, saving, loading, i18nValues,];
226
+ }
227
+ {
228
+ const { icon: __VLS_16 } = __VLS_nonNull(__VLS_3.slots);
229
+ const __VLS_17 = SelectIcon;
230
+ // @ts-ignore
231
+ const __VLS_18 = __VLS_asFunctionalComponent1(__VLS_17, new __VLS_17({
232
+ // @ts-ignore
233
+ iconValue: (form.value.icon), placeholder: (__VLS_unwrap(t, {})('system.base.menu.placeholder.icon')),
234
+ }));
235
+ const __VLS_19 = __VLS_18({
236
+ iconValue: (form.value.icon),
237
+ placeholder: (__VLS_unwrap(t, {})('system.base.menu.placeholder.icon')),
238
+ }, ...__VLS_functionalComponentArgsRest(__VLS_18));
239
+ // @ts-ignore
240
+ [t, form,];
241
+ }
242
+ // @ts-ignore
243
+ [];
244
+ var __VLS_3;
245
+ var __VLS_4;
246
+ // @ts-ignore
247
+ [];
248
+ const __VLS_export = (await import('vue')).defineComponent({
249
+ __typeEmits: {},
250
+ __typeProps: {},
251
+ });
252
+ export default {};
@@ -0,0 +1,36 @@
1
+ import type { BiCard } from "../rpc/bi/admin/v1/bi_card";
2
+ import type { BiQueryResult } from "../rpc/bi/admin/v1/bi_query";
3
+ type __VLS_Props = {
4
+ card: BiCard;
5
+ sourceName?: string;
6
+ previewResult?: BiQueryResult;
7
+ refreshKey?: number;
8
+ rangeDays?: number;
9
+ showPeriodFilter?: boolean;
10
+ showCategory?: boolean;
11
+ };
12
+ declare var __VLS_43: {}, __VLS_74: {};
13
+ type __VLS_Slots = {} & {
14
+ actions?: (props: typeof __VLS_43) => any;
15
+ } & {
16
+ footer?: (props: typeof __VLS_74) => any;
17
+ };
18
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
19
+ "update:rangeDays": (value: number) => any;
20
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
21
+ "onUpdate:rangeDays"?: ((value: number) => any) | undefined;
22
+ }>, {
23
+ sourceName: string;
24
+ refreshKey: number;
25
+ rangeDays: number;
26
+ showPeriodFilter: boolean;
27
+ showCategory: boolean;
28
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
29
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
30
+ declare const _default: typeof __VLS_export;
31
+ export default _default;
32
+ type __VLS_WithSlots<T, S> = T & {
33
+ new (): {
34
+ $slots: S;
35
+ };
36
+ };