jojotaoo_components 0.0.1-beta.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.
Files changed (115) hide show
  1. package/dist/assets/maps/heilongjiang.json +25543 -0
  2. package/dist/components/charts/BackgroundCard.vue.d.ts +17 -0
  3. package/dist/components/charts/BackgroundCard.vue.d.ts.map +1 -0
  4. package/dist/components/charts/BackgroundCard.vue.js +140 -0
  5. package/dist/components/charts/BarChart.vue.d.ts +20 -0
  6. package/dist/components/charts/BarChart.vue.d.ts.map +1 -0
  7. package/dist/components/charts/BarChart.vue.js +109 -0
  8. package/dist/components/charts/CustomLegend.vue.d.ts +28 -0
  9. package/dist/components/charts/CustomLegend.vue.d.ts.map +1 -0
  10. package/dist/components/charts/CustomLegend.vue.js +198 -0
  11. package/dist/components/charts/DataFetchManager.vue.d.ts +10 -0
  12. package/dist/components/charts/DataFetchManager.vue.d.ts.map +1 -0
  13. package/dist/components/charts/DataFetchManager.vue.js +127 -0
  14. package/dist/components/charts/DateTimeDisplay.vue.d.ts +17 -0
  15. package/dist/components/charts/DateTimeDisplay.vue.d.ts.map +1 -0
  16. package/dist/components/charts/DateTimeDisplay.vue.js +112 -0
  17. package/dist/components/charts/GroupComponent.vue.d.ts +13 -0
  18. package/dist/components/charts/GroupComponent.vue.d.ts.map +1 -0
  19. package/dist/components/charts/GroupComponent.vue.js +106 -0
  20. package/dist/components/charts/GroupPreview.vue.d.ts +10 -0
  21. package/dist/components/charts/GroupPreview.vue.d.ts.map +1 -0
  22. package/dist/components/charts/GroupPreview.vue.js +76 -0
  23. package/dist/components/charts/HeaderLineChart.vue.d.ts +17 -0
  24. package/dist/components/charts/HeaderLineChart.vue.d.ts.map +1 -0
  25. package/dist/components/charts/HeaderLineChart.vue.js +62 -0
  26. package/dist/components/charts/ImageDisplay.vue.d.ts +17 -0
  27. package/dist/components/charts/ImageDisplay.vue.d.ts.map +1 -0
  28. package/dist/components/charts/ImageDisplay.vue.js +106 -0
  29. package/dist/components/charts/LineChart.vue.d.ts +20 -0
  30. package/dist/components/charts/LineChart.vue.d.ts.map +1 -0
  31. package/dist/components/charts/LineChart.vue.js +116 -0
  32. package/dist/components/charts/MapChart.vue.d.ts +22 -0
  33. package/dist/components/charts/MapChart.vue.d.ts.map +1 -0
  34. package/dist/components/charts/MapChart.vue.js +680 -0
  35. package/dist/components/charts/PieChart.vue.d.ts +20 -0
  36. package/dist/components/charts/PieChart.vue.d.ts.map +1 -0
  37. package/dist/components/charts/PieChart.vue.js +106 -0
  38. package/dist/components/charts/PieGridChart.vue.d.ts +20 -0
  39. package/dist/components/charts/PieGridChart.vue.d.ts.map +1 -0
  40. package/dist/components/charts/PieGridChart.vue.js +214 -0
  41. package/dist/components/charts/RiskScrollList.vue.d.ts +15 -0
  42. package/dist/components/charts/RiskScrollList.vue.d.ts.map +1 -0
  43. package/dist/components/charts/RiskScrollList.vue.js +294 -0
  44. package/dist/components/charts/ScrollList.vue.d.ts +15 -0
  45. package/dist/components/charts/ScrollList.vue.d.ts.map +1 -0
  46. package/dist/components/charts/ScrollList.vue.js +149 -0
  47. package/dist/components/charts/TextDisplay.vue.d.ts +17 -0
  48. package/dist/components/charts/TextDisplay.vue.d.ts.map +1 -0
  49. package/dist/components/charts/TextDisplay.vue.js +209 -0
  50. package/dist/composables/useChartDataFetch.d.ts +18 -0
  51. package/dist/composables/useChartDataFetch.d.ts.map +1 -0
  52. package/dist/composables/useChartDataFetch.js +131 -0
  53. package/dist/composables/useComponentRender.d.ts +20 -0
  54. package/dist/composables/useComponentRender.d.ts.map +1 -0
  55. package/dist/composables/useComponentRender.js +45 -0
  56. package/dist/composables/useDataPondManager.d.ts +20 -0
  57. package/dist/composables/useDataPondManager.d.ts.map +1 -0
  58. package/dist/composables/useDataPondManager.js +105 -0
  59. package/dist/composables/useECharts.d.ts +9 -0
  60. package/dist/composables/useECharts.d.ts.map +1 -0
  61. package/dist/composables/useECharts.js +118 -0
  62. package/dist/composables/useEventListener.d.ts +2 -0
  63. package/dist/composables/useEventListener.d.ts.map +1 -0
  64. package/dist/composables/useEventListener.js +5 -0
  65. package/dist/composables/useId.d.ts +3 -0
  66. package/dist/composables/useId.d.ts.map +1 -0
  67. package/dist/composables/useId.js +6 -0
  68. package/dist/composables/useInteractClear.d.ts +4 -0
  69. package/dist/composables/useInteractClear.d.ts.map +1 -0
  70. package/dist/composables/useInteractClear.js +26 -0
  71. package/dist/composables/useInteractDispatch.d.ts +5 -0
  72. package/dist/composables/useInteractDispatch.d.ts.map +1 -0
  73. package/dist/composables/useInteractDispatch.js +44 -0
  74. package/dist/composables/useInteractFilter.d.ts +5 -0
  75. package/dist/composables/useInteractFilter.d.ts.map +1 -0
  76. package/dist/composables/useInteractFilter.js +24 -0
  77. package/dist/composables/usePollingManager.d.ts +10 -0
  78. package/dist/composables/usePollingManager.d.ts.map +1 -0
  79. package/dist/composables/usePollingManager.js +42 -0
  80. package/dist/composables/useRequestMerge.d.ts +32 -0
  81. package/dist/composables/useRequestMerge.d.ts.map +1 -0
  82. package/dist/composables/useRequestMerge.js +131 -0
  83. package/dist/config/chartThemes.d.ts +26 -0
  84. package/dist/config/chartThemes.d.ts.map +1 -0
  85. package/dist/config/chartThemes.js +221 -0
  86. package/dist/config/componentDefinitions.d.ts +12 -0
  87. package/dist/config/componentDefinitions.d.ts.map +1 -0
  88. package/dist/config/componentDefinitions.js +503 -0
  89. package/dist/index.cjs +1 -0
  90. package/dist/index.css +2 -0
  91. package/dist/index.d.ts +33 -0
  92. package/dist/index.d.ts.map +1 -0
  93. package/dist/index.js +38 -0
  94. package/dist/stores/dashboard.d.ts +3240 -0
  95. package/dist/stores/dashboard.d.ts.map +1 -0
  96. package/dist/stores/dashboard.js +666 -0
  97. package/dist/stores/utils.d.ts +15 -0
  98. package/dist/stores/utils.d.ts.map +1 -0
  99. package/dist/stores/utils.js +28 -0
  100. package/dist/types/canvas.d.ts +36 -0
  101. package/dist/types/canvas.d.ts.map +1 -0
  102. package/dist/types/canvas.js +1 -0
  103. package/dist/types/component.d.ts +175 -0
  104. package/dist/types/component.d.ts.map +1 -0
  105. package/dist/types/component.js +63 -0
  106. package/dist/types/events.d.ts +43 -0
  107. package/dist/types/events.d.ts.map +1 -0
  108. package/dist/types/events.js +1 -0
  109. package/dist/types/index.d.ts +5 -0
  110. package/dist/types/index.d.ts.map +1 -0
  111. package/dist/types/index.js +4 -0
  112. package/dist/types/request.d.ts +43 -0
  113. package/dist/types/request.d.ts.map +1 -0
  114. package/dist/types/request.js +18 -0
  115. package/package.json +33 -0
@@ -0,0 +1,17 @@
1
+ type __VLS_Props = {
2
+ componentId?: string;
3
+ option?: Record<string, any>;
4
+ width?: number;
5
+ height?: number;
6
+ bgProps?: Record<string, any>;
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<{}>, {
9
+ height: number;
10
+ option: Record<string, any>;
11
+ width: number;
12
+ componentId: string;
13
+ bgProps: Record<string, any>;
14
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
15
+ declare const _default: typeof __VLS_export;
16
+ export default _default;
17
+ //# sourceMappingURL=BackgroundCard.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BackgroundCard.vue.d.ts","sourceRoot":"","sources":["../../../src/components/charts/BackgroundCard.vue"],"names":[],"mappings":"AAgJA,KAAK,WAAW,GAAG;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAC9B,CAAC;AA0KF,QAAA,MAAM,YAAY;YA5KP,MAAM;YAFN,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;WACpB,MAAM;iBAFA,MAAM;aAIV,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;6EA8K7B,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -0,0 +1,140 @@
1
+ import { computed } from 'vue';
2
+ const props = withDefaults(defineProps(), {
3
+ componentId: '',
4
+ option: () => ({}),
5
+ width: 900,
6
+ height: 900,
7
+ bgProps: () => ({}),
8
+ });
9
+ const bp = computed(() => props.bgProps ?? {});
10
+ const cardWidth = computed(() => bp.value.cardWidth ?? 900);
11
+ const cardHeight = computed(() => bp.value.cardHeight ?? 900);
12
+ const cardBgColor = computed(() => bp.value.cardBgColor ?? '#ffffff');
13
+ const cardBorderRadius = computed(() => bp.value.cardBorderRadius ?? 16);
14
+ const cardBorderColor = computed(() => bp.value.cardBorderColor ?? '#e8ecf1');
15
+ const cardBorderWidth = computed(() => bp.value.cardBorderWidth ?? 1);
16
+ const cardShadow = computed(() => bp.value.cardShadow ?? '0 2px 12px rgba(0,0,0,0.06)');
17
+ const cardPadding = computed(() => bp.value.cardPadding ?? '40px 48px');
18
+ const titleText = computed(() => bp.value.titleText ?? '标题');
19
+ const titleFontSize = computed(() => bp.value.titleFontSize ?? 32);
20
+ const titleFontWeight = computed(() => bp.value.titleFontWeight ?? 600);
21
+ const titleColor = computed(() => bp.value.titleColor ?? '#1d2a3a');
22
+ const titleLineHeight = computed(() => bp.value.titleLineHeight ?? 1.3);
23
+ const showDecorator = computed(() => bp.value.showDecorator ?? true);
24
+ const decoratorColor = computed(() => bp.value.decoratorColor ?? '#e34d59');
25
+ const decoratorWidth = computed(() => bp.value.decoratorWidth ?? 6);
26
+ const decoratorHeight = computed(() => bp.value.decoratorHeight ?? 32);
27
+ const decoratorRadius = computed(() => bp.value.decoratorRadius ?? 3);
28
+ const showSubtitle = computed(() => bp.value.showSubtitle ?? false);
29
+ const subText = computed(() => bp.value.subText ?? '');
30
+ const subFontSize = computed(() => bp.value.subFontSize ?? 16);
31
+ const subColor = computed(() => bp.value.subColor ?? '#8c9aa8');
32
+ const subMarginTop = computed(() => bp.value.subMarginTop ?? 8);
33
+ const subPaddingLeft = computed(() => bp.value.subPaddingLeft ?? 20);
34
+ const cardStyle = computed(() => ({
35
+ width: '100%',
36
+ height: '100%',
37
+ minWidth: '200px',
38
+ minHeight: '150px',
39
+ backgroundColor: cardBgColor.value,
40
+ borderRadius: `${cardBorderRadius.value}px`,
41
+ border: `${cardBorderWidth.value}px solid ${cardBorderColor.value}`,
42
+ boxShadow: cardShadow.value,
43
+ padding: cardPadding.value,
44
+ display: 'flex',
45
+ flexDirection: 'column',
46
+ justifyContent: 'flex-start',
47
+ boxSizing: 'border-box',
48
+ }));
49
+ const titleStyle = computed(() => ({
50
+ fontSize: `${titleFontSize.value}px`,
51
+ fontWeight: titleFontWeight.value,
52
+ color: titleColor.value,
53
+ display: 'flex',
54
+ alignItems: 'center',
55
+ gap: '14px',
56
+ lineHeight: titleLineHeight.value,
57
+ }));
58
+ const decoratorStyle = computed(() => ({
59
+ content: '""',
60
+ display: 'inline-block',
61
+ width: `${decoratorWidth.value}px`,
62
+ height: `${decoratorHeight.value}px`,
63
+ backgroundColor: decoratorColor.value,
64
+ borderRadius: `${decoratorRadius.value}px`,
65
+ flexShrink: 0,
66
+ }));
67
+ const subStyle = computed(() => ({
68
+ fontSize: `${subFontSize.value}px`,
69
+ color: subColor.value,
70
+ marginTop: `${subMarginTop.value}px`,
71
+ paddingLeft: `${subPaddingLeft.value}px`,
72
+ }));
73
+ const contentStyle = computed(() => ({
74
+ flex: 1,
75
+ display: 'flex',
76
+ alignItems: 'center',
77
+ justifyContent: 'center',
78
+ color: '#d0d5dd',
79
+ fontSize: '18px',
80
+ letterSpacing: '1px',
81
+ userSelect: 'none',
82
+ }));
83
+ const __VLS_defaults = {
84
+ componentId: '',
85
+ option: () => ({}),
86
+ width: 900,
87
+ height: 900,
88
+ bgProps: () => ({}),
89
+ };
90
+ const __VLS_ctx = {
91
+ ...{},
92
+ ...{},
93
+ ...{},
94
+ ...{},
95
+ };
96
+ let __VLS_components;
97
+ let __VLS_intrinsics;
98
+ let __VLS_directives;
99
+ __VLS_asFunctionalElement1(__VLS_intrinsics.div, __VLS_intrinsics.div)({
100
+ ...{ class: "bg-card" },
101
+ ...{ style: (__VLS_ctx.cardStyle) },
102
+ });
103
+ /** @type {__VLS_StyleScopedClasses['bg-card']} */ ;
104
+ __VLS_asFunctionalElement1(__VLS_intrinsics.div, __VLS_intrinsics.div)({
105
+ ...{ class: "title-area" },
106
+ });
107
+ /** @type {__VLS_StyleScopedClasses['title-area']} */ ;
108
+ __VLS_asFunctionalElement1(__VLS_intrinsics.div, __VLS_intrinsics.div)({
109
+ ...{ class: "page-title" },
110
+ ...{ style: (__VLS_ctx.titleStyle) },
111
+ });
112
+ /** @type {__VLS_StyleScopedClasses['page-title']} */ ;
113
+ if (__VLS_ctx.showDecorator) {
114
+ __VLS_asFunctionalElement1(__VLS_intrinsics.span, __VLS_intrinsics.span)({
115
+ ...{ class: "decorator" },
116
+ ...{ style: (__VLS_ctx.decoratorStyle) },
117
+ });
118
+ /** @type {__VLS_StyleScopedClasses['decorator']} */ ;
119
+ }
120
+ (__VLS_ctx.titleText);
121
+ if (__VLS_ctx.showSubtitle) {
122
+ __VLS_asFunctionalElement1(__VLS_intrinsics.div, __VLS_intrinsics.div)({
123
+ ...{ class: "page-sub" },
124
+ ...{ style: (__VLS_ctx.subStyle) },
125
+ });
126
+ /** @type {__VLS_StyleScopedClasses['page-sub']} */ ;
127
+ (__VLS_ctx.subText);
128
+ }
129
+ __VLS_asFunctionalElement1(__VLS_intrinsics.div, __VLS_intrinsics.div)({
130
+ ...{ class: "content-area" },
131
+ ...{ style: (__VLS_ctx.contentStyle) },
132
+ });
133
+ /** @type {__VLS_StyleScopedClasses['content-area']} */ ;
134
+ // @ts-ignore
135
+ [cardStyle, titleStyle, showDecorator, decoratorStyle, titleText, showSubtitle, subStyle, subText, contentStyle,];
136
+ const __VLS_export = (await import('vue')).defineComponent({
137
+ __typeProps: {},
138
+ props: {},
139
+ });
140
+ export default {};
@@ -0,0 +1,20 @@
1
+ import type { ChartStyleConfig } from '../../types';
2
+ type __VLS_Props = {
3
+ componentId?: string;
4
+ option?: Record<string, any>;
5
+ width?: number;
6
+ height?: number;
7
+ bgColor?: string;
8
+ chartStyle?: ChartStyleConfig;
9
+ };
10
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
11
+ bgColor: string;
12
+ height: number;
13
+ option: Record<string, any>;
14
+ chartStyle: ChartStyleConfig;
15
+ width: number;
16
+ componentId: string;
17
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
18
+ declare const _default: typeof __VLS_export;
19
+ export default _default;
20
+ //# sourceMappingURL=BarChart.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BarChart.vue.d.ts","sourceRoot":"","sources":["../../../src/components/charts/BarChart.vue"],"names":[],"mappings":"AAoHA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAGnD,KAAK,WAAW,GAAG;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,gBAAgB,CAAA;CAC9B,CAAC;AAwHF,QAAA,MAAM,YAAY;aA1HN,MAAM;YADP,MAAM;YAFN,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;gBAIf,gBAAgB;WAHrB,MAAM;iBAFA,MAAM;6EAiIpB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -0,0 +1,109 @@
1
+ import { computed, toRef } from 'vue';
2
+ import * as echarts from 'echarts';
3
+ import { useECharts } from '../../composables/useECharts';
4
+ import { useInteractFilter } from '../../composables/useInteractFilter';
5
+ import { DEFAULT_CHART_STYLE } from '../../types';
6
+ const props = withDefaults(defineProps(), {
7
+ componentId: '',
8
+ option: () => ({}),
9
+ width: 400,
10
+ height: 300,
11
+ bgColor: '#1e1e2e',
12
+ chartStyle: undefined,
13
+ });
14
+ const optionRef = toRef(props, 'option');
15
+ const widthRef = toRef(props, 'width');
16
+ const heightRef = toRef(props, 'height');
17
+ const chartStyleRef = computed(() => props.chartStyle ?? DEFAULT_CHART_STYLE);
18
+ const componentIdRef = toRef(props, 'componentId');
19
+ const dimensions = computed(() => optionRef.value.dataset?.dimensions ?? []);
20
+ const source = computed(() => optionRef.value.dataset?.source ?? []);
21
+ const { filteredSource } = useInteractFilter(componentIdRef, dimensions, source);
22
+ const filteredOption = computed(() => {
23
+ const ds = optionRef.value.dataset;
24
+ if (!ds)
25
+ return optionRef.value;
26
+ return {
27
+ ...optionRef.value,
28
+ dataset: { ...ds, source: filteredSource.value },
29
+ };
30
+ });
31
+ const seriesOption = computed(() => {
32
+ const s = chartStyleRef.value.series;
33
+ const dims = optionRef.value.dataset?.dimensions ?? [];
34
+ const useColorList = s.colorList.length > 0;
35
+ return dims.slice(1).map((dim, idx) => ({
36
+ type: 'bar',
37
+ name: dim,
38
+ encode: { x: 0, y: idx + 1 },
39
+ barWidth: s.barWidth,
40
+ barGap: s.barGap,
41
+ barCategoryGap: s.barCategoryGap,
42
+ itemStyle: {
43
+ borderRadius: [s.barBorderRadius, s.barBorderRadius, 0, 0],
44
+ ...(s.barColorByData && useColorList
45
+ ? {
46
+ color: (params) => s.colorList[params.dataIndex % s.colorList.length],
47
+ }
48
+ : useColorList
49
+ ? {}
50
+ : {
51
+ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
52
+ { offset: 0, color: s.color },
53
+ { offset: 1, color: s.colorEnd },
54
+ ]),
55
+ }),
56
+ },
57
+ label: s.showLabel
58
+ ? {
59
+ show: true,
60
+ position: 'top',
61
+ color: s.labelColor,
62
+ fontSize: s.labelFontSize,
63
+ formatter: (p) => (p.data?.[idx + 1] ?? p.value),
64
+ }
65
+ : { show: false },
66
+ }));
67
+ });
68
+ const containerBg = computed(() => {
69
+ const cs = chartStyleRef.value;
70
+ if (cs.backgroundOpacity < 1 && cs.backgroundColor !== 'transparent') {
71
+ const h = cs.backgroundColor.replace('#', '');
72
+ const r = parseInt(h.substring(0, 2), 16);
73
+ const g = parseInt(h.substring(2, 4), 16);
74
+ const b = parseInt(h.substring(4, 6), 16);
75
+ return `rgba(${r}, ${g}, ${b}, ${cs.backgroundOpacity})`;
76
+ }
77
+ return props.bgColor || cs.backgroundColor;
78
+ });
79
+ const { chartRef } = useECharts(filteredOption, widthRef, heightRef, chartStyleRef, seriesOption);
80
+ const __VLS_defaults = {
81
+ componentId: '',
82
+ option: () => ({}),
83
+ width: 400,
84
+ height: 300,
85
+ bgColor: '#1e1e2e',
86
+ chartStyle: undefined,
87
+ };
88
+ const __VLS_ctx = {
89
+ ...{},
90
+ ...{},
91
+ ...{},
92
+ ...{},
93
+ };
94
+ let __VLS_components;
95
+ let __VLS_intrinsics;
96
+ let __VLS_directives;
97
+ __VLS_asFunctionalElement1(__VLS_intrinsics.div, __VLS_intrinsics.div)({
98
+ ref: "chartRef",
99
+ ...{ class: "bar-chart" },
100
+ ...{ style: ({ backgroundColor: __VLS_ctx.containerBg }) },
101
+ });
102
+ /** @type {__VLS_StyleScopedClasses['bar-chart']} */ ;
103
+ // @ts-ignore
104
+ [containerBg,];
105
+ const __VLS_export = (await import('vue')).defineComponent({
106
+ __typeProps: {},
107
+ props: {},
108
+ });
109
+ export default {};
@@ -0,0 +1,28 @@
1
+ type __VLS_Props = {
2
+ data: Array<{
3
+ name: string;
4
+ value?: number | string;
5
+ percent?: string;
6
+ }>;
7
+ colorList: string[];
8
+ chartInstance: any;
9
+ icon?: 'circle' | 'rect' | 'roundRect' | 'triangle' | 'diamond';
10
+ fontSize?: number;
11
+ textColor?: string;
12
+ gridColumns?: number;
13
+ itemGap?: number;
14
+ position?: 'bottom' | 'left' | 'right' | 'top' | 'bottom-flow';
15
+ unit?: string;
16
+ };
17
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
18
+ fontSize: number;
19
+ textColor: string;
20
+ itemGap: number;
21
+ icon: "circle" | "rect" | "roundRect" | "triangle" | "diamond";
22
+ gridColumns: number;
23
+ unit: string;
24
+ position: "bottom" | "left" | "right" | "top" | "bottom-flow";
25
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
26
+ declare const _default: typeof __VLS_export;
27
+ export default _default;
28
+ //# sourceMappingURL=CustomLegend.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CustomLegend.vue.d.ts","sourceRoot":"","sources":["../../../src/components/charts/CustomLegend.vue"],"names":[],"mappings":"AAsOA,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IACxE,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,aAAa,EAAE,GAAG,CAAA;IAClB,IAAI,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,UAAU,GAAG,SAAS,CAAA;IAC/D,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,aAAa,CAAA;IAC9D,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAC;AAuOF,QAAA,MAAM,YAAY;cA7OL,MAAM;eACL,MAAM;aAER,MAAM;UAJT,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,UAAU,GAAG,SAAS;iBAGjD,MAAM;UAGb,MAAM;cADF,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,aAAa;6EA4O9D,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -0,0 +1,198 @@
1
+ import { ref, computed, onMounted, onUnmounted, watch } from 'vue';
2
+ const props = withDefaults(defineProps(), {
3
+ icon: 'circle',
4
+ fontSize: 11,
5
+ textColor: '#cdd6f4',
6
+ gridColumns: 3,
7
+ itemGap: 8,
8
+ position: 'bottom',
9
+ unit: '',
10
+ });
11
+ const hoveredName = ref(null);
12
+ const items = computed(() => props.data.map((d, i) => ({
13
+ name: d.name,
14
+ color: props.colorList[i % props.colorList.length] || '#89b4fa',
15
+ value: d.value ?? '',
16
+ percent: d.percent ?? '',
17
+ })));
18
+ const legendStyle = computed(() => {
19
+ const style = {
20
+ display: 'grid',
21
+ gridTemplateColumns: `repeat(${props.gridColumns}, 1fr)`,
22
+ gap: `${props.itemGap}px`,
23
+ };
24
+ if (props.position === 'bottom') {
25
+ style.position = 'absolute';
26
+ style.bottom = '8px';
27
+ style.left = '16px';
28
+ style.right = '16px';
29
+ style.zIndex = '10';
30
+ }
31
+ else if (props.position === 'top') {
32
+ style.position = 'absolute';
33
+ style.top = '8px';
34
+ style.left = '16px';
35
+ style.right = '16px';
36
+ style.zIndex = '10';
37
+ }
38
+ else if (props.position === 'left') {
39
+ style.position = 'absolute';
40
+ style.top = '50%';
41
+ style.left = '8px';
42
+ style.transform = 'translateY(-50%)';
43
+ style.gridTemplateColumns = '1fr';
44
+ style.zIndex = '10';
45
+ }
46
+ else if (props.position === 'right') {
47
+ style.position = 'absolute';
48
+ style.top = '50%';
49
+ style.right = '8px';
50
+ style.transform = 'translateY(-50%)';
51
+ style.gridTemplateColumns = '1fr';
52
+ style.zIndex = '10';
53
+ }
54
+ else if (props.position === 'bottom-flow') {
55
+ style.padding = '8px 16px';
56
+ }
57
+ return style;
58
+ });
59
+ function setSeriesDataOpacity(targetName) {
60
+ if (!props.chartInstance)
61
+ return;
62
+ const opt = props.chartInstance.getOption();
63
+ if (!opt.series?.[0]?.data)
64
+ return;
65
+ const newData = opt.series[0].data.map((d) => ({
66
+ name: d.name,
67
+ value: d.value,
68
+ itemStyle: {
69
+ ...(d.itemStyle || {}),
70
+ opacity: targetName !== null ? (d.name === targetName ? 1 : 0.3) : 1,
71
+ },
72
+ }));
73
+ props.chartInstance.setOption({ series: [{ data: newData }] });
74
+ }
75
+ function onLegendEnter(name) {
76
+ hoveredName.value = name;
77
+ setSeriesDataOpacity(name);
78
+ }
79
+ function onLegendLeave() {
80
+ hoveredName.value = null;
81
+ setSeriesDataOpacity(null);
82
+ }
83
+ function onChartMouseOver(params) {
84
+ if (params?.componentType === 'series' && params?.seriesType === 'pie') {
85
+ hoveredName.value = params.name;
86
+ }
87
+ }
88
+ function onChartMouseOut(params) {
89
+ if (params?.componentType === 'series' && params?.seriesType === 'pie') {
90
+ hoveredName.value = null;
91
+ }
92
+ }
93
+ function bindEvents() {
94
+ if (!props.chartInstance)
95
+ return;
96
+ props.chartInstance.on('mouseover', onChartMouseOver);
97
+ props.chartInstance.on('mouseout', onChartMouseOut);
98
+ }
99
+ function unbindEvents() {
100
+ if (!props.chartInstance)
101
+ return;
102
+ props.chartInstance.off('mouseover', onChartMouseOver);
103
+ props.chartInstance.off('mouseout', onChartMouseOut);
104
+ }
105
+ watch(() => props.chartInstance, (inst) => {
106
+ unbindEvents();
107
+ if (inst)
108
+ bindEvents();
109
+ });
110
+ onMounted(() => {
111
+ bindEvents();
112
+ });
113
+ onUnmounted(() => {
114
+ unbindEvents();
115
+ });
116
+ const __VLS_defaults = {
117
+ icon: 'circle',
118
+ fontSize: 11,
119
+ textColor: '#cdd6f4',
120
+ gridColumns: 3,
121
+ itemGap: 8,
122
+ position: 'bottom',
123
+ unit: '',
124
+ };
125
+ const __VLS_ctx = {
126
+ ...{},
127
+ ...{},
128
+ ...{},
129
+ ...{},
130
+ };
131
+ let __VLS_components;
132
+ let __VLS_intrinsics;
133
+ let __VLS_directives;
134
+ /** @type {__VLS_StyleScopedClasses['legend-item']} */ ;
135
+ /** @type {__VLS_StyleScopedClasses['legend-item']} */ ;
136
+ /** @type {__VLS_StyleScopedClasses['legend-icon']} */ ;
137
+ /** @type {__VLS_StyleScopedClasses['legend-icon']} */ ;
138
+ /** @type {__VLS_StyleScopedClasses['legend-icon']} */ ;
139
+ /** @type {__VLS_StyleScopedClasses['legend-icon']} */ ;
140
+ /** @type {__VLS_StyleScopedClasses['legend-icon']} */ ;
141
+ __VLS_asFunctionalElement1(__VLS_intrinsics.div, __VLS_intrinsics.div)({
142
+ ...{ class: "custom-legend" },
143
+ ...{ style: (__VLS_ctx.legendStyle) },
144
+ });
145
+ /** @type {__VLS_StyleScopedClasses['custom-legend']} */ ;
146
+ for (const [item] of __VLS_vFor((__VLS_ctx.items))) {
147
+ __VLS_asFunctionalElement1(__VLS_intrinsics.div, __VLS_intrinsics.div)({
148
+ ...{ onMouseenter: (...[$event]) => {
149
+ return __VLS_ctx.onLegendEnter(item.name);
150
+ // @ts-ignore
151
+ [legendStyle, items, onLegendEnter,];
152
+ } },
153
+ ...{ onMouseleave: (__VLS_ctx.onLegendLeave) },
154
+ key: (item.name),
155
+ ...{ class: "legend-item" },
156
+ ...{ class: ({ inactive: __VLS_ctx.hoveredName !== null && __VLS_ctx.hoveredName !== item.name }) },
157
+ });
158
+ /** @type {__VLS_StyleScopedClasses['legend-item']} */ ;
159
+ /** @type {__VLS_StyleScopedClasses['inactive']} */ ;
160
+ __VLS_asFunctionalElement1(__VLS_intrinsics.div, __VLS_intrinsics.div)({
161
+ ...{ class: "legend-left" },
162
+ });
163
+ /** @type {__VLS_StyleScopedClasses['legend-left']} */ ;
164
+ __VLS_asFunctionalElement1(__VLS_intrinsics.span, __VLS_intrinsics.span)({
165
+ ...{ class: "legend-icon" },
166
+ ...{ class: (`icon-${__VLS_ctx.icon}`) },
167
+ ...{ style: ({ backgroundColor: item.color }) },
168
+ });
169
+ /** @type {__VLS_StyleScopedClasses['legend-icon']} */ ;
170
+ __VLS_asFunctionalElement1(__VLS_intrinsics.span, __VLS_intrinsics.span)({
171
+ ...{ class: "legend-text" },
172
+ ...{ style: ({ fontSize: `${__VLS_ctx.fontSize}px`, color: __VLS_ctx.textColor }) },
173
+ });
174
+ /** @type {__VLS_StyleScopedClasses['legend-text']} */ ;
175
+ (item.name);
176
+ __VLS_asFunctionalElement1(__VLS_intrinsics.div, __VLS_intrinsics.div)({
177
+ ...{ class: "legend-right" },
178
+ ...{ style: ({ fontSize: `${__VLS_ctx.fontSize}px`, color: __VLS_ctx.textColor }) },
179
+ });
180
+ /** @type {__VLS_StyleScopedClasses['legend-right']} */ ;
181
+ __VLS_asFunctionalElement1(__VLS_intrinsics.span, __VLS_intrinsics.span)({});
182
+ (item.value);
183
+ (__VLS_ctx.unit);
184
+ __VLS_asFunctionalElement1(__VLS_intrinsics.span, __VLS_intrinsics.span)({
185
+ ...{ class: "legend-percent" },
186
+ });
187
+ /** @type {__VLS_StyleScopedClasses['legend-percent']} */ ;
188
+ (item.percent);
189
+ // @ts-ignore
190
+ [onLegendLeave, hoveredName, hoveredName, icon, fontSize, fontSize, textColor, textColor, unit,];
191
+ }
192
+ // @ts-ignore
193
+ [];
194
+ const __VLS_export = (await import('vue')).defineComponent({
195
+ __typeProps: {},
196
+ props: {},
197
+ });
198
+ export default {};
@@ -0,0 +1,10 @@
1
+ type __VLS_Props = {
2
+ componentId: string;
3
+ mode?: 'design' | 'preview';
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
6
+ mode: "design" | "preview";
7
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
8
+ declare const _default: typeof __VLS_export;
9
+ export default _default;
10
+ //# sourceMappingURL=DataFetchManager.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataFetchManager.vue.d.ts","sourceRoot":"","sources":["../../../src/components/charts/DataFetchManager.vue"],"names":[],"mappings":"AAqIA,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;CAC5B,CAAC;AAoIF,QAAA,MAAM,YAAY;UArIT,QAAQ,GAAG,SAAS;6EAwI3B,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -0,0 +1,127 @@
1
+ import { computed, onMounted, onUnmounted, watch } from 'vue';
2
+ import { useDashboardStore } from '../../stores/dashboard';
3
+ import { mergeRequestConfig, executeRequest, doFetch, getPondCache, setPondCache, clearPondCache } from '../../composables/useRequestMerge';
4
+ const props = withDefaults(defineProps(), {
5
+ mode: 'design',
6
+ });
7
+ const store = useDashboardStore();
8
+ const comp = computed(() => store.findComponent(props.componentId));
9
+ const request = computed(() => comp.value?.request);
10
+ const globalConfig = computed(() => store.requestGlobalConfig);
11
+ const interactOverrides = computed(() => comp.value?.interactOverrides);
12
+ let pollingTimer = null;
13
+ let fetchSeq = 0;
14
+ function getRequestSource() {
15
+ const config = request.value;
16
+ if (!config)
17
+ return null;
18
+ if (config.requestDataType === 1)
19
+ return config;
20
+ if (config.requestDataType === 2 && config.requestDataPondId) {
21
+ const pond = globalConfig.value.requestDataPond.find(p => p.dataPondId === config.requestDataPondId);
22
+ return pond?.dataPondRequestConfig ?? null;
23
+ }
24
+ return null;
25
+ }
26
+ function getPondId() {
27
+ return request.value?.requestDataType === 2 ? (request.value.requestDataPondId ?? null) : null;
28
+ }
29
+ async function fetchData(isPolling = false, forceFresh = false) {
30
+ const config = request.value;
31
+ if (!config || config.requestDataType === 0)
32
+ return;
33
+ const source = getRequestSource();
34
+ if (!source || source.requestDataType === 0)
35
+ return;
36
+ try {
37
+ const pondId = getPondId();
38
+ let result = null;
39
+ if (pondId) {
40
+ if (isPolling || forceFresh)
41
+ clearPondCache(pondId);
42
+ const cached = getPondCache(pondId);
43
+ if (cached !== undefined && !forceFresh) {
44
+ result = cached;
45
+ }
46
+ else {
47
+ const merged = mergeRequestConfig(source, globalConfig.value, interactOverrides.value);
48
+ if (merged) {
49
+ result = await doFetch(merged);
50
+ setPondCache(pondId, result);
51
+ }
52
+ }
53
+ }
54
+ else {
55
+ result = await executeRequest(source, globalConfig.value, interactOverrides.value);
56
+ }
57
+ if (result !== null) {
58
+ store.updateComponentOption(props.componentId, 'dataset', result);
59
+ }
60
+ }
61
+ catch (err) {
62
+ console.error('[DataFetch] Request failed:', err);
63
+ }
64
+ }
65
+ function startPolling() {
66
+ stopPolling();
67
+ const config = request.value;
68
+ if (!config || config.requestDataType === 0)
69
+ return;
70
+ const source = getRequestSource();
71
+ if (!source)
72
+ return;
73
+ const interval = source.requestInterval ?? globalConfig.value.requestInterval;
74
+ const unit = source.requestIntervalUnit ?? globalConfig.value.requestIntervalUnit ?? 'second';
75
+ if (!interval)
76
+ return;
77
+ const ms = toMilliseconds(interval, unit);
78
+ pollingTimer = setInterval(() => fetchData(true), ms);
79
+ }
80
+ function stopPolling() {
81
+ if (pollingTimer) {
82
+ clearInterval(pollingTimer);
83
+ pollingTimer = null;
84
+ }
85
+ }
86
+ function toMilliseconds(interval, unit) {
87
+ const map = {
88
+ second: 1000,
89
+ minute: 60 * 1000,
90
+ hour: 3600 * 1000,
91
+ day: 86400 * 1000,
92
+ };
93
+ return interval * (map[unit] ?? 1000);
94
+ }
95
+ async function handleConfigChange() {
96
+ stopPolling();
97
+ if (props.mode === 'preview' && request.value && request.value.requestDataType !== 0) {
98
+ const seq = ++fetchSeq;
99
+ await fetchData(false, true);
100
+ if (seq !== fetchSeq)
101
+ return;
102
+ startPolling();
103
+ }
104
+ }
105
+ if (props.mode === 'preview') {
106
+ onMounted(handleConfigChange);
107
+ watch(request, handleConfigChange, { deep: true });
108
+ watch(globalConfig, handleConfigChange, { deep: true });
109
+ watch(interactOverrides, handleConfigChange, { deep: true });
110
+ }
111
+ onUnmounted(stopPolling);
112
+ const __VLS_defaults = {
113
+ mode: 'design',
114
+ };
115
+ const __VLS_ctx = {
116
+ ...{},
117
+ ...{},
118
+ ...{},
119
+ };
120
+ let __VLS_components;
121
+ let __VLS_intrinsics;
122
+ let __VLS_directives;
123
+ const __VLS_export = (await import('vue')).defineComponent({
124
+ __typeProps: {},
125
+ props: {},
126
+ });
127
+ export default {};