xt-element-ui 1.2.5 → 1.2.6

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.
@@ -1,16 +1,10 @@
1
1
  import themeWhite from "./theme/white";
2
2
  import themeDark from "./theme/dark";
3
- import themeBlue from "./theme/blue";
4
- import themeStarry from "./theme/starry";
5
- import themeOrange from "./theme/orange";
6
3
 
7
4
  const themeKeys = {
8
5
  "default": themeWhite,
9
6
  "white": themeWhite,
10
- "dark": themeDark,
11
- "blue": themeBlue,
12
- "starry": themeStarry,
13
- "orange": themeOrange
7
+ "dark": themeDark
14
8
  };
15
9
 
16
10
  // echarts 仅在客户端加载,避免 SSR 编译/渲染报错
@@ -121,6 +115,153 @@ EchartsUtil.EchartsUtil = {
121
115
 
122
116
  EchartsUtil.chartInstanceList = [];
123
117
 
118
+ // === 极简模式(simpleMode)预设配置 ===
119
+ // 极简模式:隐藏图例、隐藏坐标轴/网格线、缩小内边距、简化 tooltip、去除动画装饰
120
+
121
+ EchartsUtil.simpleModeOption = {
122
+ legend: { show: false },
123
+ tooltip: {
124
+ borderWidth: 0,
125
+ extraCssText: "box-shadow: 0 2px 8px rgba(0,0,0,0.12);"
126
+ },
127
+ grid: {
128
+ top: "5%",
129
+ left: "5%",
130
+ right: "5%",
131
+ bottom: "5%",
132
+ containLabel: true
133
+ },
134
+ xAxis: {
135
+ axisLine: { show: false },
136
+ axisTick: { show: false },
137
+ splitLine: { show: false }
138
+ },
139
+ yAxis: {
140
+ axisLine: { show: false },
141
+ axisTick: { show: false },
142
+ splitLine: { show: false },
143
+ axisLabel: { show: false }
144
+ },
145
+ animationDuration: 300,
146
+ animationEasing: "linear"
147
+ };
148
+
149
+ // 各类图表的极简模式特殊配置
150
+ EchartsUtil.simpleModeByType = {
151
+ bar: {
152
+ series: {
153
+ barWidth: "60%",
154
+ label: { show: false },
155
+ markPoint: null,
156
+ emphasis: {
157
+ itemStyle: {
158
+ shadowBlur: 6,
159
+ shadowOffsetX: 0,
160
+ shadowColor: "rgba(0,0,0,0.15)"
161
+ }
162
+ }
163
+ }
164
+ },
165
+ line: {
166
+ series: {
167
+ symbol: "none",
168
+ smooth: true,
169
+ symbolSize: 0,
170
+ label: { show: false },
171
+ areaStyle: null
172
+ }
173
+ },
174
+ pie: {
175
+ legend: { show: false },
176
+ title: { show: false },
177
+ series: {
178
+ radius: ["40%", "72%"],
179
+ label: { show: false },
180
+ labelLine: { show: false }
181
+ }
182
+ },
183
+ multi: {
184
+ legend: { show: false },
185
+ grid: {
186
+ top: "8%",
187
+ left: "5%",
188
+ right: "5%",
189
+ bottom: "5%",
190
+ containLabel: true
191
+ }
192
+ }
193
+ };
194
+
195
+ // 深拷贝 + 深合并工具
196
+ function deepMerge(target, source) {
197
+ if (source == null) return target;
198
+ if (Array.isArray(source)) return source.slice();
199
+ if (typeof source !== "object") return source;
200
+ if (target == null || typeof target !== "object") {
201
+ return JSON.parse(JSON.stringify(source));
202
+ }
203
+ const result = Array.isArray(target) ? target.slice() : Object.assign({}, target);
204
+ Object.keys(source).forEach(key => {
205
+ const src = source[key];
206
+ if (src === null || src === undefined) {
207
+ if (source.hasOwnProperty(key)) result[key] = src;
208
+ return;
209
+ }
210
+ if (typeof src === "object") {
211
+ result[key] = deepMerge(result[key], src);
212
+ } else {
213
+ result[key] = src;
214
+ }
215
+ });
216
+ return result;
217
+ }
218
+
219
+ // 对 option 应用极简模式(会保留调用方显式设置的值)
220
+ EchartsUtil.applySimpleMode = function(option, type) {
221
+ if (!option || typeof option !== "object") return option;
222
+
223
+ const base = JSON.parse(JSON.stringify(EchartsUtil.simpleModeOption));
224
+ const typeConfig = EchartsUtil.simpleModeByType[type] || {};
225
+ const merged = deepMerge(base, typeConfig);
226
+
227
+ // 合并 base 与 typeConfig 到当前 option
228
+ Object.keys(merged).forEach(key => {
229
+ if (key === "series") return; // series 单独处理
230
+ if (option[key] == null) {
231
+ option[key] = merged[key];
232
+ } else if (typeof option[key] === "object" && typeof merged[key] === "object" && !Array.isArray(option[key])) {
233
+ option[key] = deepMerge(merged[key], option[key]);
234
+ }
235
+ // 若调用方已有原始值则保留(不覆盖)
236
+ });
237
+
238
+ // series 处理:若存在则对每个 series 应用简化配置
239
+ if (option.series && Array.isArray(option.series)) {
240
+ const simpleSeries = (merged.series || {});
241
+ option.series = option.series.map(s => {
242
+ if (s == null || typeof s !== "object") return s;
243
+ return deepMerge(simpleSeries, s); // 调用方的值优先级更高
244
+ });
245
+ }
246
+
247
+ // 特殊:xAxis / yAxis 可能是数组
248
+ ["xAxis", "yAxis"].forEach(axisKey => {
249
+ if (option[axisKey] != null && typeof option[axisKey] === "object") {
250
+ const simpleAxis = merged[axisKey] || {};
251
+ if (Array.isArray(option[axisKey])) {
252
+ option[axisKey] = option[axisKey].map(axis => {
253
+ if (axis == null || typeof axis !== "object") return axis;
254
+ return deepMerge(simpleAxis, axis);
255
+ });
256
+ } else {
257
+ option[axisKey] = deepMerge(simpleAxis, option[axisKey]);
258
+ }
259
+ }
260
+ });
261
+
262
+ return option;
263
+ };
264
+
124
265
  EchartsUtil.mergeOptions = function(themeOption, customOption) {
125
266
  return Object.assign({}, themeOption, customOption);
126
267
  };
@@ -1,91 +0,0 @@
1
- export default {
2
- color: ["#2CDEB3", "#A17EE6", "#E57E40", "#409EFF"],
3
- backgroundColor: "#ffffff",
4
- textStyle: {
5
- fontFamily: "Microsoft YaHei, sans-serif"
6
- },
7
- title: {
8
- textStyle: {
9
- color: "#333"
10
- },
11
- subtextStyle: {
12
- color: "#666666"
13
- }
14
- },
15
- line: {
16
- itemStyle: {
17
- },
18
- lineStyle: {
19
- width: 2
20
- }
21
- },
22
- bar: {
23
- itemStyle: {
24
- borderRadius: 4
25
- }
26
- },
27
- pie: {
28
- roseType: "radius",
29
- label: {
30
- color: "#333"
31
- }
32
- },
33
- radar: {
34
- indicator: {
35
- color: "#666666"
36
- }
37
- },
38
- map: {
39
- label: {
40
- color: "#333"
41
- },
42
- itemStyle: {
43
- borderColor: "#fff"
44
- }
45
- },
46
- gauge: {
47
- axisLine: {
48
- lineStyle: {
49
- color: [[1, "#5470c6"]]
50
- }
51
- }
52
- },
53
- toolbox: {
54
- iconStyle: {
55
- borderColor: "#666666"
56
- }
57
- },
58
- axisLine: {
59
- lineStyle: {
60
- color: "#DCDFE6"
61
- }
62
- },
63
- axisTick: {
64
- lineStyle: {
65
- color: "#DCDFE6"
66
- }
67
- },
68
- splitLine: {
69
- lineStyle: {
70
- color: "#ebeef5"
71
- }
72
- },
73
- splitArea: {
74
- areaStyle: {
75
- color: ["#f7f8fa", "#ffffff"]
76
- }
77
- },
78
- legend: {
79
- textStyle: {
80
- color: "#666"
81
- }
82
- },
83
- tooltip: {
84
- backgroundColor: "rgba(255, 255, 255, 0.95)",
85
- borderColor: "#DCDFE6",
86
- borderWidth: 1,
87
- textStyle: {
88
- color: "#333"
89
- }
90
- }
91
- };
@@ -1,92 +0,0 @@
1
- export default {
2
- color: ["#e69419", "#A5b4da", "#F8792C", "#97bfb4", "#de747b", "#d6bac0", "#e62737", "#f35969", "#f1ccb0", "#b7394e", "#fe9c1c2"],
3
- backgroundColor: "#ffffff",
4
- textStyle: {
5
- fontFamily: "Microsoft YaHei, sans-serif"
6
- },
7
- title: {
8
- textStyle: {
9
- color: "#333"
10
- },
11
- subtextStyle: {
12
- color: "#666666"
13
- }
14
- },
15
- line: {
16
- itemStyle: {
17
- color: "#e69419"
18
- },
19
- lineStyle: {
20
- width: 2
21
- }
22
- },
23
- bar: {
24
- itemStyle: {
25
- borderRadius: 4
26
- }
27
- },
28
- pie: {
29
- roseType: "radius",
30
- label: {
31
- color: "#333"
32
- }
33
- },
34
- radar: {
35
- indicator: {
36
- color: "#666666"
37
- }
38
- },
39
- map: {
40
- label: {
41
- color: "#333"
42
- },
43
- itemStyle: {
44
- borderColor: "#fff"
45
- }
46
- },
47
- gauge: {
48
- axisLine: {
49
- lineStyle: {
50
- color: [[1, "#5470c6"]]
51
- }
52
- }
53
- },
54
- toolbox: {
55
- iconStyle: {
56
- borderColor: "#666666"
57
- }
58
- },
59
- axisLine: {
60
- lineStyle: {
61
- color: "#DCDFE6"
62
- }
63
- },
64
- axisTick: {
65
- lineStyle: {
66
- color: "#DCDFE6"
67
- }
68
- },
69
- splitLine: {
70
- lineStyle: {
71
- color: "#ebeef5"
72
- }
73
- },
74
- splitArea: {
75
- areaStyle: {
76
- color: ["#f7f8fa", "#ffffff"]
77
- }
78
- },
79
- legend: {
80
- textStyle: {
81
- color: "#666"
82
- }
83
- },
84
- tooltip: {
85
- backgroundColor: "rgba(255, 255, 255, 0.95)",
86
- borderColor: "#DCDFE6",
87
- borderWidth: 1,
88
- textStyle: {
89
- color: "#333"
90
- }
91
- }
92
- };
@@ -1,106 +0,0 @@
1
- export default {
2
- color: [
3
- "#1685a9", // 石青
4
- "#21a675", // 松柏绿
5
- "#1bd1a5", // 飞燕草蓝
6
- "#8c4356", // 绛紫
7
- "#0dafc6", // 孔雀蓝
8
- "#4b5cc4", // 宝蓝
9
- "#758a99", // 墨灰
10
- "#cca4e3", // 丁香色
11
- "#205277", // 靛青色
12
- "#d9b611", // 秋香色
13
- "#ff8c31", // 杏红
14
- "#9d2933", // 胭脂
15
- "#0288c5", // 浅靛青蓝
16
- "#44cef6" // 天蓝色
17
- ],
18
- backgroundColor: "#ffffff",
19
- textStyle: {
20
- fontFamily: "Microsoft YaHei, sans-serif"
21
- },
22
- title: {
23
- textStyle: {
24
- color: "#333"
25
- },
26
- subtextStyle: {
27
- color: "#666666"
28
- }
29
- },
30
- line: {
31
- itemStyle: {
32
- },
33
- lineStyle: {
34
- width: 2
35
- }
36
- },
37
- bar: {
38
- itemStyle: {
39
- borderRadius: 4
40
- }
41
- },
42
- pie: {
43
- roseType: "radius",
44
- label: {
45
- color: "#333"
46
- }
47
- },
48
- radar: {
49
- indicator: {
50
- color: "#666666"
51
- }
52
- },
53
- map: {
54
- label: {
55
- color: "#333"
56
- },
57
- itemStyle: {
58
- borderColor: "#fff"
59
- }
60
- },
61
- gauge: {
62
- axisLine: {
63
- lineStyle: {
64
- color: [[1, "#5470c6"]]
65
- }
66
- }
67
- },
68
- toolbox: {
69
- iconStyle: {
70
- borderColor: "#666666"
71
- }
72
- },
73
- axisLine: {
74
- lineStyle: {
75
- color: "#DCDFE6"
76
- }
77
- },
78
- axisTick: {
79
- lineStyle: {
80
- color: "#DCDFE6"
81
- }
82
- },
83
- splitLine: {
84
- lineStyle: {
85
- color: "#ebeef5"
86
- }
87
- },
88
- splitArea: {
89
- areaStyle: {
90
- color: ["#f7f8fa", "#ffffff"]
91
- }
92
- },
93
- legend: {
94
- textStyle: {
95
- color: "#666"
96
- }
97
- },
98
- tooltip: {
99
- backgroundColor: "rgba(255, 255, 255, 0.95)",
100
- borderColor: "#DCDFE6",
101
- borderWidth: 1,
102
- textStyle: {
103
- color: "#333"
104
- }
105
- }
106
- };