sun-card-design 1.1.37 → 1.1.39

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 (162) hide show
  1. package/README.md +114 -112
  2. package/dist/mobile/sun-card-design-mobile.es11.js +3 -3
  3. package/dist/mobile/sun-card-design-mobile.es3.js +4 -4
  4. package/dist/mobile/sun-card-design-mobile.es4.js +5 -5
  5. package/dist/mobile/sun-card-design-mobile.es56.js +3 -4
  6. package/dist/mobile/sun-card-design-mobile.es6.js +2 -10
  7. package/dist/pc/sun-card-design-pc.es11.js +3 -3
  8. package/dist/pc/sun-card-design-pc.es3.js +4 -4
  9. package/dist/pc/sun-card-design-pc.es4.js +5 -5
  10. package/dist/pc/sun-card-design-pc.es56.js +3 -4
  11. package/dist/pc/sun-card-design-pc.es6.js +2 -10
  12. package/dist/public/sun-card-design.css +1 -1
  13. package/package.json +98 -96
  14. package/dist/public/sun-card-designer.css +0 -1
  15. package/dist/sun-card-designer.es.js +0 -25
  16. package/dist/sun-card-designer.es10.js +0 -167
  17. package/dist/sun-card-designer.es11.js +0 -197
  18. package/dist/sun-card-designer.es12.js +0 -203
  19. package/dist/sun-card-designer.es13.js +0 -130
  20. package/dist/sun-card-designer.es14.js +0 -120
  21. package/dist/sun-card-designer.es151.js +0 -4
  22. package/dist/sun-card-designer.es152.js +0 -4
  23. package/dist/sun-card-designer.es153.js +0 -4
  24. package/dist/sun-card-designer.es154.js +0 -4
  25. package/dist/sun-card-designer.es155.js +0 -82
  26. package/dist/sun-card-designer.es156.js +0 -91
  27. package/dist/sun-card-designer.es157.js +0 -92
  28. package/dist/sun-card-designer.es158.js +0 -191
  29. package/dist/sun-card-designer.es159.js +0 -86
  30. package/dist/sun-card-designer.es16.js +0 -10
  31. package/dist/sun-card-designer.es160.js +0 -238
  32. package/dist/sun-card-designer.es161.js +0 -113
  33. package/dist/sun-card-designer.es162.js +0 -49
  34. package/dist/sun-card-designer.es163.js +0 -43
  35. package/dist/sun-card-designer.es164.js +0 -39
  36. package/dist/sun-card-designer.es165.js +0 -46
  37. package/dist/sun-card-designer.es166.js +0 -58
  38. package/dist/sun-card-designer.es167.js +0 -56
  39. package/dist/sun-card-designer.es168.js +0 -58
  40. package/dist/sun-card-designer.es169.js +0 -73
  41. package/dist/sun-card-designer.es17.js +0 -333
  42. package/dist/sun-card-designer.es170.js +0 -59
  43. package/dist/sun-card-designer.es171.js +0 -69
  44. package/dist/sun-card-designer.es172.js +0 -182
  45. package/dist/sun-card-designer.es173.js +0 -176
  46. package/dist/sun-card-designer.es174.js +0 -184
  47. package/dist/sun-card-designer.es175.js +0 -409
  48. package/dist/sun-card-designer.es176.js +0 -365
  49. package/dist/sun-card-designer.es177.js +0 -70
  50. package/dist/sun-card-designer.es178.js +0 -68
  51. package/dist/sun-card-designer.es179.js +0 -184
  52. package/dist/sun-card-designer.es18.js +0 -68
  53. package/dist/sun-card-designer.es180.js +0 -193
  54. package/dist/sun-card-designer.es181.js +0 -193
  55. package/dist/sun-card-designer.es182.js +0 -193
  56. package/dist/sun-card-designer.es184.js +0 -228
  57. package/dist/sun-card-designer.es185.js +0 -71
  58. package/dist/sun-card-designer.es19.js +0 -611
  59. package/dist/sun-card-designer.es196.js +0 -4
  60. package/dist/sun-card-designer.es20.js +0 -225
  61. package/dist/sun-card-designer.es201.js +0 -125
  62. package/dist/sun-card-designer.es21.js +0 -69
  63. package/dist/sun-card-designer.es22.js +0 -719
  64. package/dist/sun-card-designer.es220.js +0 -63
  65. package/dist/sun-card-designer.es221.js +0 -80
  66. package/dist/sun-card-designer.es222.js +0 -82
  67. package/dist/sun-card-designer.es223.js +0 -94
  68. package/dist/sun-card-designer.es224.js +0 -87
  69. package/dist/sun-card-designer.es225.js +0 -226
  70. package/dist/sun-card-designer.es226.js +0 -105
  71. package/dist/sun-card-designer.es227.js +0 -45
  72. package/dist/sun-card-designer.es228.js +0 -31
  73. package/dist/sun-card-designer.es229.js +0 -29
  74. package/dist/sun-card-designer.es23.js +0 -211
  75. package/dist/sun-card-designer.es230.js +0 -32
  76. package/dist/sun-card-designer.es231.js +0 -46
  77. package/dist/sun-card-designer.es232.js +0 -42
  78. package/dist/sun-card-designer.es233.js +0 -44
  79. package/dist/sun-card-designer.es234.js +0 -61
  80. package/dist/sun-card-designer.es235.js +0 -46
  81. package/dist/sun-card-designer.es236.js +0 -54
  82. package/dist/sun-card-designer.es237.js +0 -130
  83. package/dist/sun-card-designer.es238.js +0 -127
  84. package/dist/sun-card-designer.es239.js +0 -132
  85. package/dist/sun-card-designer.es24.js +0 -265
  86. package/dist/sun-card-designer.es240.js +0 -375
  87. package/dist/sun-card-designer.es241.js +0 -348
  88. package/dist/sun-card-designer.es242.js +0 -69
  89. package/dist/sun-card-designer.es243.js +0 -65
  90. package/dist/sun-card-designer.es244.js +0 -87
  91. package/dist/sun-card-designer.es245.js +0 -98
  92. package/dist/sun-card-designer.es246.js +0 -98
  93. package/dist/sun-card-designer.es247.js +0 -98
  94. package/dist/sun-card-designer.es25.js +0 -857
  95. package/dist/sun-card-designer.es26.js +0 -768
  96. package/dist/sun-card-designer.es260.js +0 -125
  97. package/dist/sun-card-designer.es27.js +0 -264
  98. package/dist/sun-card-designer.es273.js +0 -192
  99. package/dist/sun-card-designer.es28.js +0 -809
  100. package/dist/sun-card-designer.es29.js +0 -220
  101. package/dist/sun-card-designer.es3.js +0 -506
  102. package/dist/sun-card-designer.es30.js +0 -809
  103. package/dist/sun-card-designer.es31.js +0 -220
  104. package/dist/sun-card-designer.es32.js +0 -820
  105. package/dist/sun-card-designer.es33.js +0 -225
  106. package/dist/sun-card-designer.es34.js +0 -69
  107. package/dist/sun-card-designer.es35.js +0 -375
  108. package/dist/sun-card-designer.es36.js +0 -186
  109. package/dist/sun-card-designer.es37.js +0 -119
  110. package/dist/sun-card-designer.es38.js +0 -354
  111. package/dist/sun-card-designer.es39.js +0 -127
  112. package/dist/sun-card-designer.es4.js +0 -365
  113. package/dist/sun-card-designer.es40.js +0 -100
  114. package/dist/sun-card-designer.es41.js +0 -214
  115. package/dist/sun-card-designer.es42.js +0 -119
  116. package/dist/sun-card-designer.es43.js +0 -250
  117. package/dist/sun-card-designer.es44.js +0 -118
  118. package/dist/sun-card-designer.es45.js +0 -64
  119. package/dist/sun-card-designer.es46.js +0 -223
  120. package/dist/sun-card-designer.es47.js +0 -196
  121. package/dist/sun-card-designer.es48.js +0 -77
  122. package/dist/sun-card-designer.es49.js +0 -85
  123. package/dist/sun-card-designer.es5.js +0 -317
  124. package/dist/sun-card-designer.es50.js +0 -85
  125. package/dist/sun-card-designer.es51.js +0 -64
  126. package/dist/sun-card-designer.es52.js +0 -283
  127. package/dist/sun-card-designer.es53.js +0 -64
  128. package/dist/sun-card-designer.es54.js +0 -142
  129. package/dist/sun-card-designer.es55.js +0 -52
  130. package/dist/sun-card-designer.es56.js +0 -85
  131. package/dist/sun-card-designer.es57.js +0 -258
  132. package/dist/sun-card-designer.es58.js +0 -226
  133. package/dist/sun-card-designer.es59.js +0 -169
  134. package/dist/sun-card-designer.es6.js +0 -190
  135. package/dist/sun-card-designer.es60.js +0 -280
  136. package/dist/sun-card-designer.es61.js +0 -168
  137. package/dist/sun-card-designer.es62.js +0 -219
  138. package/dist/sun-card-designer.es63.js +0 -168
  139. package/dist/sun-card-designer.es64.js +0 -275
  140. package/dist/sun-card-designer.es65.js +0 -760
  141. package/dist/sun-card-designer.es66.js +0 -272
  142. package/dist/sun-card-designer.es67.js +0 -559
  143. package/dist/sun-card-designer.es68.js +0 -124
  144. package/dist/sun-card-designer.es69.js +0 -528
  145. package/dist/sun-card-designer.es7.js +0 -65
  146. package/dist/sun-card-designer.es70.js +0 -185
  147. package/dist/sun-card-designer.es71.js +0 -107
  148. package/dist/sun-card-designer.es72.js +0 -153
  149. package/dist/sun-card-designer.es73.js +0 -315
  150. package/dist/sun-card-designer.es74.js +0 -114
  151. package/dist/sun-card-designer.es76.js +0 -4211
  152. package/dist/sun-card-designer.es79.js +0 -4
  153. package/dist/sun-card-designer.es8.js +0 -171
  154. package/dist/sun-card-designer.es80.js +0 -4
  155. package/dist/sun-card-designer.es81.js +0 -4
  156. package/dist/sun-card-designer.es84.js +0 -228
  157. package/dist/sun-card-designer.es87.js +0 -52
  158. package/dist/sun-card-designer.es88.js +0 -52
  159. package/dist/sun-card-designer.es9.js +0 -207
  160. package/dist/sun-card-designer.es91.js +0 -344
  161. package/dist/sun-card-designer.es92.js +0 -199
  162. package/dist/sun-card-designer.es95.js +0 -180
@@ -1,182 +0,0 @@
1
- import { ref, watch, onMounted, nextTick, onBeforeUnmount, createElementBlock, openBlock, normalizeClass, createElementVNode, normalizeStyle } from "vue";
2
- import { useCardManageStore } from "./sun-card-designer.es13.js";
3
- import * as echarts from "echarts";
4
- /* empty css */
5
- import _export_sfc from "./sun-card-designer.es16.js";
6
- const _sfc_main = {
7
- __name: "barChartComp",
8
- props: ["record"],
9
- setup(__props) {
10
- const cardManageStore = useCardManageStore();
11
- const props = __props;
12
- const currentUuid = ref(null);
13
- const chartDom = ref(null);
14
- const myChart = ref(null);
15
- let ro = null;
16
- watch(
17
- () => cardManageStore.currentSelectUuid,
18
- (val) => {
19
- currentUuid.value = val;
20
- }
21
- );
22
- onMounted(async () => {
23
- await nextTick();
24
- initRender();
25
- setupResizeObserver();
26
- });
27
- onBeforeUnmount(() => {
28
- if (myChart.value) {
29
- myChart.value.dispose();
30
- myChart.value = null;
31
- }
32
- if (ro) {
33
- ro.disconnect();
34
- ro = null;
35
- }
36
- });
37
- const parseJsonSafe = (str) => {
38
- try {
39
- return JSON.parse(str);
40
- } catch (_) {
41
- return null;
42
- }
43
- };
44
- const resolveArrayFromVariable = (name) => {
45
- if (!name) return [];
46
- const v = (cardManageStore.variableList || []).find((e) => e.name === name);
47
- if (!v || !v.defaultValue) return [];
48
- const data = typeof v.defaultValue === "string" ? parseJsonSafe(v.defaultValue) : v.defaultValue;
49
- if (!Array.isArray(data)) return [];
50
- if (!data.length) return [];
51
- if (typeof data[0] === "object" && data[0] !== null) {
52
- const firstKey = Object.keys(data[0])[0];
53
- return data.map((i) => i[firstKey]);
54
- }
55
- return data;
56
- };
57
- const deepClone = (obj) => {
58
- try {
59
- return JSON.parse(JSON.stringify(obj));
60
- } catch (_) {
61
- return obj;
62
- }
63
- };
64
- const buildOption = () => {
65
- const xAxisCfg = deepClone(props.record.options.xAxisConfig || []);
66
- xAxisCfg.forEach((ax) => {
67
- if (typeof ax.data === "string") {
68
- ax.data = resolveArrayFromVariable(ax.data);
69
- }
70
- });
71
- const seriesCfg = deepClone(props.record.options.seriesConfig || []);
72
- seriesCfg.forEach((s) => {
73
- if (typeof s.data === "string") {
74
- s.data = resolveArrayFromVariable(s.data);
75
- }
76
- });
77
- return {
78
- title: props.record.options.titleConfig,
79
- tooltip: props.record.options.tooltipConfig,
80
- legend: props.record.options.legendConfig,
81
- grid: props.record.options.gridConfig,
82
- xAxis: xAxisCfg,
83
- yAxis: props.record.options.yAxisConfig,
84
- series: seriesCfg
85
- };
86
- };
87
- const applyOption = () => {
88
- if (!myChart.value) return;
89
- try {
90
- const opt = buildOption();
91
- myChart.value.setOption(opt, true);
92
- } catch (e) {
93
- void reinitChart();
94
- }
95
- };
96
- const initRender = () => {
97
- if (!chartDom.value) return;
98
- try {
99
- myChart.value = echarts.init(chartDom.value);
100
- applyOption();
101
- } catch (e) {
102
- const t = setTimeout(() => {
103
- clearTimeout(t);
104
- try {
105
- myChart.value = echarts.init(chartDom.value);
106
- applyOption();
107
- } catch (_) {
108
- }
109
- }, 50);
110
- }
111
- };
112
- const reinitChart = async () => {
113
- if (!chartDom.value) return;
114
- if (myChart.value) {
115
- try {
116
- myChart.value.dispose();
117
- } catch (_) {
118
- }
119
- myChart.value = null;
120
- }
121
- await nextTick();
122
- initRender();
123
- };
124
- const setupResizeObserver = () => {
125
- if (!window.ResizeObserver || !chartDom.value) return;
126
- ro = new ResizeObserver(() => {
127
- if (myChart.value) {
128
- try {
129
- myChart.value.resize();
130
- } catch (_) {
131
- void reinitChart();
132
- }
133
- }
134
- });
135
- ro.observe(chartDom.value);
136
- };
137
- watch(
138
- () => [props.record.options.style.width, props.record.options.style.height],
139
- async () => {
140
- await nextTick();
141
- void reinitChart();
142
- }
143
- );
144
- watch(
145
- () => [
146
- props.record.options.titleConfig,
147
- props.record.options.tooltipConfig,
148
- props.record.options.legendConfig,
149
- props.record.options.gridConfig,
150
- props.record.options.xAxisConfig,
151
- props.record.options.yAxisConfig,
152
- props.record.options.seriesConfig,
153
- cardManageStore.variableList
154
- // 变量发生变化也要重算
155
- ],
156
- () => applyOption(),
157
- { deep: true }
158
- );
159
- return (_ctx, _cache) => {
160
- return openBlock(), createElementBlock("div", {
161
- class: normalizeClass(["barChart-table", { active: currentUuid.value === props.record.uuid }])
162
- }, [
163
- createElementVNode("div", {
164
- style: normalizeStyle({ padding: `${props.record.options?.style?.tbPadding || 0}px ${props.record.options?.style?.lrPadding || 0}px` })
165
- }, [
166
- createElementVNode("div", {
167
- ref_key: "chartDom",
168
- ref: chartDom,
169
- style: normalizeStyle({
170
- width: props.record.options.style.width,
171
- height: props.record.options.style.height
172
- })
173
- }, null, 4)
174
- ], 4)
175
- ], 2);
176
- };
177
- }
178
- };
179
- const BarChart = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-852f9811"]]);
180
- export {
181
- BarChart as default
182
- };
@@ -1,176 +0,0 @@
1
- import { ref, watch, onMounted, nextTick, onBeforeUnmount, createElementBlock, openBlock, normalizeClass, createElementVNode, normalizeStyle } from "vue";
2
- import { useCardManageStore } from "./sun-card-designer.es13.js";
3
- import * as echarts from "echarts";
4
- /* empty css */
5
- import _export_sfc from "./sun-card-designer.es16.js";
6
- const _sfc_main = {
7
- __name: "pieChartComp",
8
- props: ["record"],
9
- setup(__props) {
10
- const cardManageStore = useCardManageStore();
11
- const props = __props;
12
- const currentUuid = ref(null);
13
- const chartDom = ref(null);
14
- const myChart = ref(null);
15
- let ro = null;
16
- watch(
17
- () => cardManageStore.currentSelectUuid,
18
- (val) => {
19
- currentUuid.value = val;
20
- }
21
- );
22
- onMounted(async () => {
23
- await nextTick();
24
- initRender();
25
- setupResizeObserver();
26
- });
27
- onBeforeUnmount(() => {
28
- if (myChart.value) {
29
- myChart.value.dispose();
30
- myChart.value = null;
31
- }
32
- if (ro) {
33
- ro.disconnect();
34
- ro = null;
35
- }
36
- });
37
- const parseJsonSafe = (str) => {
38
- try {
39
- return JSON.parse(str);
40
- } catch (_) {
41
- return null;
42
- }
43
- };
44
- const resolveArrayFromVariable = (name) => {
45
- if (!name) return [];
46
- const v = (cardManageStore.variableList || []).find((e) => e.name === name);
47
- if (!v || !v.defaultValue) return [];
48
- const data = typeof v.defaultValue === "string" ? parseJsonSafe(v.defaultValue) : v.defaultValue;
49
- if (!Array.isArray(data)) return [];
50
- if (!data.length) return [];
51
- if (typeof data[0] === "object" && data[0] !== null) {
52
- const firstKey = Object.keys(data[0])[0];
53
- return data.map((i) => i[firstKey]);
54
- }
55
- return data;
56
- };
57
- const deepClone = (obj) => {
58
- try {
59
- return JSON.parse(JSON.stringify(obj));
60
- } catch (_) {
61
- return obj;
62
- }
63
- };
64
- const buildOption = () => {
65
- const xAxisCfg = deepClone(props.record.options.xAxisConfig || []);
66
- xAxisCfg.forEach((ax) => {
67
- if (typeof ax.data === "string") {
68
- ax.data = resolveArrayFromVariable(ax.data);
69
- }
70
- });
71
- const seriesCfg = deepClone(props.record.options.seriesConfig || []);
72
- seriesCfg.forEach((s) => {
73
- if (typeof s.data === "string") {
74
- s.data = resolveArrayFromVariable(s.data);
75
- }
76
- });
77
- return {
78
- title: props.record.options.titleConfig,
79
- tooltip: props.record.options.tooltipConfig,
80
- legend: props.record.options.legendConfig,
81
- series: seriesCfg
82
- };
83
- };
84
- const applyOption = () => {
85
- if (!myChart.value) return;
86
- try {
87
- const opt = buildOption();
88
- myChart.value.setOption(opt, true);
89
- } catch (e) {
90
- void reinitChart();
91
- }
92
- };
93
- const initRender = () => {
94
- if (!chartDom.value) return;
95
- try {
96
- myChart.value = echarts.init(chartDom.value);
97
- applyOption();
98
- } catch (e) {
99
- const t = setTimeout(() => {
100
- clearTimeout(t);
101
- try {
102
- myChart.value = echarts.init(chartDom.value);
103
- applyOption();
104
- } catch (_) {
105
- }
106
- }, 50);
107
- }
108
- };
109
- const reinitChart = async () => {
110
- if (!chartDom.value) return;
111
- if (myChart.value) {
112
- try {
113
- myChart.value.dispose();
114
- } catch (_) {
115
- }
116
- myChart.value = null;
117
- }
118
- await nextTick();
119
- initRender();
120
- };
121
- const setupResizeObserver = () => {
122
- if (!window.ResizeObserver || !chartDom.value) return;
123
- ro = new ResizeObserver(() => {
124
- if (myChart.value) {
125
- try {
126
- myChart.value.resize();
127
- } catch (_) {
128
- void reinitChart();
129
- }
130
- }
131
- });
132
- ro.observe(chartDom.value);
133
- };
134
- watch(
135
- () => [props.record.options.style.width, props.record.options.style.height],
136
- async () => {
137
- await nextTick();
138
- void reinitChart();
139
- }
140
- );
141
- watch(
142
- () => [
143
- props.record.options.titleConfig,
144
- props.record.options.tooltipConfig,
145
- props.record.options.legendConfig,
146
- props.record.options.seriesConfig,
147
- cardManageStore.variableList
148
- // 变量发生变化也要重算
149
- ],
150
- () => applyOption(),
151
- { deep: true }
152
- );
153
- return (_ctx, _cache) => {
154
- return openBlock(), createElementBlock("div", {
155
- class: normalizeClass(["pieChart-table", { active: currentUuid.value === props.record.uuid }])
156
- }, [
157
- createElementVNode("div", {
158
- style: normalizeStyle({ padding: `${props.record.options?.style?.tbPadding || 0}px ${props.record.options?.style?.lrPadding || 0}px` })
159
- }, [
160
- createElementVNode("div", {
161
- ref_key: "chartDom",
162
- ref: chartDom,
163
- style: normalizeStyle({
164
- width: props.record.options.style.width,
165
- height: props.record.options.style.height
166
- })
167
- }, null, 4)
168
- ], 4)
169
- ], 2);
170
- };
171
- }
172
- };
173
- const PieChart = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-cd42eb5c"]]);
174
- export {
175
- PieChart as default
176
- };
@@ -1,184 +0,0 @@
1
- import { ref, watch, onMounted, nextTick, onBeforeUnmount, createElementBlock, openBlock, normalizeClass, createElementVNode, normalizeStyle } from "vue";
2
- import { useCardManageStore } from "./sun-card-designer.es13.js";
3
- import * as echarts from "echarts";
4
- /* empty css */
5
- import _export_sfc from "./sun-card-designer.es16.js";
6
- const _sfc_main = {
7
- __name: "lineChartComp",
8
- props: ["record"],
9
- setup(__props) {
10
- const cardManageStore = useCardManageStore();
11
- const props = __props;
12
- const currentUuid = ref(null);
13
- const chartDom = ref(null);
14
- const myChart = ref(null);
15
- let ro = null;
16
- watch(
17
- () => cardManageStore.currentSelectUuid,
18
- (val) => {
19
- currentUuid.value = val;
20
- }
21
- );
22
- onMounted(async () => {
23
- await nextTick();
24
- initRender();
25
- setupResizeObserver();
26
- });
27
- onBeforeUnmount(() => {
28
- if (myChart.value) {
29
- myChart.value.dispose();
30
- myChart.value = null;
31
- }
32
- if (ro) {
33
- ro.disconnect();
34
- ro = null;
35
- }
36
- });
37
- const parseJsonSafe = (str) => {
38
- try {
39
- return JSON.parse(str);
40
- } catch (_) {
41
- return null;
42
- }
43
- };
44
- const resolveArrayFromVariable = (name) => {
45
- if (!name) return [];
46
- const v = (cardManageStore.variableList || []).find((e) => e.name === name);
47
- if (!v || !v.defaultValue) return [];
48
- const data = typeof v.defaultValue === "string" ? parseJsonSafe(v.defaultValue) : v.defaultValue;
49
- if (!Array.isArray(data)) return [];
50
- if (!data.length) return [];
51
- if (typeof data[0] === "object" && data[0] !== null) {
52
- const firstKey = Object.keys(data[0])[0];
53
- return data.map((i) => i[firstKey]);
54
- }
55
- return data;
56
- };
57
- const deepClone = (obj) => {
58
- try {
59
- return JSON.parse(JSON.stringify(obj));
60
- } catch (_) {
61
- return obj;
62
- }
63
- };
64
- const buildOption = () => {
65
- const xAxisCfg = deepClone(props.record.options.xAxisConfig || []);
66
- xAxisCfg.forEach((ax) => {
67
- if (typeof ax.data === "string") {
68
- ax.data = resolveArrayFromVariable(ax.data);
69
- }
70
- });
71
- const seriesCfg = deepClone(props.record.options.seriesConfig || []);
72
- seriesCfg.forEach((s) => {
73
- if (typeof s.data === "string") {
74
- s.data = resolveArrayFromVariable(s.data);
75
- }
76
- if (!s.type) s.type = "line";
77
- if (!s.showSymbol) s.showSymbol = true;
78
- });
79
- return {
80
- title: props.record.options.titleConfig,
81
- tooltip: props.record.options.tooltipConfig,
82
- legend: props.record.options.legendConfig,
83
- grid: props.record.options.gridConfig,
84
- xAxis: xAxisCfg,
85
- yAxis: props.record.options.yAxisConfig,
86
- series: seriesCfg
87
- };
88
- };
89
- const applyOption = () => {
90
- if (!myChart.value) return;
91
- try {
92
- const opt = buildOption();
93
- myChart.value.setOption(opt, true);
94
- } catch (e) {
95
- void reinitChart();
96
- }
97
- };
98
- const initRender = () => {
99
- if (!chartDom.value) return;
100
- try {
101
- myChart.value = echarts.init(chartDom.value);
102
- applyOption();
103
- } catch (e) {
104
- const t = setTimeout(() => {
105
- clearTimeout(t);
106
- try {
107
- myChart.value = echarts.init(chartDom.value);
108
- applyOption();
109
- } catch (_) {
110
- }
111
- }, 50);
112
- }
113
- };
114
- const reinitChart = async () => {
115
- if (!chartDom.value) return;
116
- if (myChart.value) {
117
- try {
118
- myChart.value.dispose();
119
- } catch (_) {
120
- }
121
- myChart.value = null;
122
- }
123
- await nextTick();
124
- initRender();
125
- };
126
- const setupResizeObserver = () => {
127
- if (!window.ResizeObserver || !chartDom.value) return;
128
- ro = new ResizeObserver(() => {
129
- if (myChart.value) {
130
- try {
131
- myChart.value.resize();
132
- } catch (_) {
133
- void reinitChart();
134
- }
135
- }
136
- });
137
- ro.observe(chartDom.value);
138
- };
139
- watch(
140
- () => [props.record.options.style.width, props.record.options.style.height],
141
- async () => {
142
- await nextTick();
143
- void reinitChart();
144
- }
145
- );
146
- watch(
147
- () => [
148
- props.record.options.titleConfig,
149
- props.record.options.tooltipConfig,
150
- props.record.options.legendConfig,
151
- props.record.options.gridConfig,
152
- props.record.options.xAxisConfig,
153
- props.record.options.yAxisConfig,
154
- props.record.options.seriesConfig,
155
- cardManageStore.variableList
156
- // 变量发生变化也要重算
157
- ],
158
- () => applyOption(),
159
- { deep: true }
160
- );
161
- return (_ctx, _cache) => {
162
- return openBlock(), createElementBlock("div", {
163
- class: normalizeClass(["lineChart-table", { active: currentUuid.value === props.record.uuid }])
164
- }, [
165
- createElementVNode("div", {
166
- style: normalizeStyle({ padding: `${props.record.options?.style?.tbPadding || 0}px ${props.record.options?.style?.lrPadding || 0}px` })
167
- }, [
168
- createElementVNode("div", {
169
- ref_key: "chartDom",
170
- ref: chartDom,
171
- style: normalizeStyle({
172
- width: props.record.options.style.width,
173
- height: props.record.options.style.height
174
- })
175
- }, null, 4)
176
- ], 4)
177
- ], 2);
178
- };
179
- }
180
- };
181
- const LineChart = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-5fb09e61"]]);
182
- export {
183
- LineChart as default
184
- };