xt-element-ui 1.1.9 → 1.1.91

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,1081 +0,0 @@
1
- ((typeof self !== 'undefined' ? self : this)["webpackJsonpxt_element_ui"] = (typeof self !== 'undefined' ? self : this)["webpackJsonpxt_element_ui"] || []).push([[2],{
2
-
3
- /***/ "04dd":
4
- /***/ (function(module, exports, __webpack_require__) {
5
-
6
- // extracted by mini-css-extract-plugin
7
-
8
- /***/ }),
9
-
10
- /***/ "1b46":
11
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
12
-
13
- "use strict";
14
- // ESM COMPAT FLAG
15
- __webpack_require__.r(__webpack_exports__);
16
-
17
- // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"3d759d14-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--5!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/ex-chart/ExBar.vue?vue&type=template&id=10acd2fc&scoped=true
18
- var render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{ref:"barchart",staticClass:"bar-box"})
19
- }
20
- var staticRenderFns = []
21
-
22
-
23
- // CONCATENATED MODULE: ./src/components/ex-chart/ExBar.vue?vue&type=template&id=10acd2fc&scoped=true
24
-
25
- // EXTERNAL MODULE: ./src/components/ex-chart/utils.js + 5 modules
26
- var utils = __webpack_require__("22f5");
27
-
28
- // CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/ex-chart/ExBar.vue?vue&type=script&lang=js
29
-
30
-
31
- /* harmony default export */ var ExBarvue_type_script_lang_js = ({
32
- name: "XtBar",
33
- props: {
34
- chartData: {
35
- type: Array,
36
- default: () => {
37
- return [
38
- { value: 65, name: "吴十" },
39
- { value: 70, name: "唐九" },
40
- { value: 73, name: "钱一" },
41
- { value: 78, name: "孙二" },
42
- { value: 88, name: "刘八" },
43
- { value: 93, name: "王七" },
44
- { value: 99, name: "赵六" },
45
- { value: 103, name: "宋五" },
46
- { value: 113, name: "李四" },
47
- { value: 125, name: "张三" }
48
- ];
49
- }
50
- },
51
- theme: {},
52
- size: {
53
- type: String,
54
- default: "medium"
55
- },
56
- // name: {
57
- // type: String,
58
- // default: ""
59
- // },
60
- markPoint: {
61
- type: Boolean,
62
- default: false
63
- },
64
- energyType: {
65
- type: String,
66
- default: ""
67
- },
68
- showZoom: {
69
- type: Boolean,
70
- default: false
71
- },
72
- reverse: {
73
- type: Boolean,
74
- default: false
75
- },
76
- longLable: { // 名称占50% 的 grid值
77
- type: Boolean,
78
- default: false
79
- },
80
- longLableSplitNum: {
81
- type: Number,
82
- default: 1
83
- },
84
- longLablePx: {
85
- type: Number,
86
- default: 150
87
- },
88
- splitNumber: {
89
- type: Number,
90
- default: 5
91
- }
92
- },
93
- data() {
94
- return {
95
- myChart: null,
96
- name: "数量"
97
- };
98
- },
99
- watch: {
100
- chartData: {
101
- deep: true,
102
- handler(newVal, oldVal) {
103
- const _self = this;
104
- _self.initChart();
105
- }
106
- },
107
- energyType: {
108
- deep: true,
109
- handler(newVal, oldVal) {
110
- const _self = this;
111
- if (newVal == "kW.h") {
112
- _self.name = "用电量";
113
- } else if (newVal == "m³") {
114
- _self.name = "用气量";
115
- }
116
- _self.initChart();
117
- }
118
- },
119
- theme(newVal) {
120
- this.initChart();
121
- }
122
- },
123
- mounted() {
124
- this.initChart();
125
- },
126
- methods: {
127
- initChart() {
128
- const _self = this;
129
- // 数据处理
130
- const _xAxis = {
131
- type: "category",
132
- inverse: this.reverse,
133
- axisLabel: {
134
- interval: 0,
135
- formatter: function(value) {
136
- return !_self.reverse && _self.longLable ? value.replace(new RegExp(`(.{${_self.longLableSplitNum}})`, 'g'), `$1\n`) : value;
137
- }
138
- },
139
- data: _self.chartData.map((item) => {
140
- return item.name;
141
- })
142
- };
143
- const _yAxis = {
144
- type: "value",
145
- splitLine: {
146
- lineStyle: {
147
- type: "dashed"
148
- }
149
- },
150
- name: _self.energyType,
151
- axisTick: {
152
- inside: true
153
- },
154
- min: 0,
155
- splitNumber: _self.splitNumber,
156
- max: function(value) {
157
- return Math.ceil(value.max / _self.splitNumber) * _self.splitNumber;
158
- },
159
- scale: true,
160
- axisLabel: {
161
- margin: 2,
162
- formatter: function(value, index) {
163
- if (value >= 10000 && value < 10000000) {
164
- value = value / 10000 + "万";
165
- } else if (value >= 10000000) {
166
- value = value / 10000000 + "千万";
167
- }
168
- return value;
169
- }
170
- }
171
- };
172
-
173
- const option = {
174
- legend: {
175
- right: 20,
176
- top: 0,
177
- textStyle: {
178
- fontSize: 12
179
- }
180
- },
181
- tooltip: {
182
- borderWidth: 1,
183
- trigger: "item"
184
- },
185
- grid: {
186
- top: "10",
187
- left: 40 + (this.reverse && this.longLable ? _self.longLablePx : 0),
188
- right: "10",
189
- bottom: (_self.showZoom ? 50 : 20) + (!_self.reverse && _self.longLable ? _self.longLablePx : 0),
190
- containLabel: true
191
- },
192
- xAxis: this.reverse ? _yAxis : _xAxis,
193
- yAxis: this.reverse ? _xAxis : _yAxis,
194
- series: [{
195
- name: _self.name,
196
- type: "bar",
197
- markPoint: {
198
- data: [
199
- { type: "min", name: "Min" },
200
- { type: "max", name: "Max" }
201
- ]
202
- },
203
- avoidLabelOverlap: true,
204
- data: _self.chartData.map((item, ind) => {
205
- const { name, value } = item;
206
- return {
207
- value,
208
- name,
209
- tooltip: {
210
- borderWidth: 1
211
- }
212
- };
213
- })
214
- }],
215
- dataZoom: _self.showZoom ? [{ height: 20, bottom: 0 }] : [],
216
- };
217
- if (!this.markPoint) {
218
- this.$delete(option.series[0], "markPoint");
219
- }
220
- this.myChart = utils["a" /* default */].init(_self.$refs.barchart, this.theme, option, this.size);
221
- }
222
- }
223
- });
224
-
225
- // CONCATENATED MODULE: ./src/components/ex-chart/ExBar.vue?vue&type=script&lang=js
226
- /* harmony default export */ var ex_chart_ExBarvue_type_script_lang_js = (ExBarvue_type_script_lang_js);
227
- // EXTERNAL MODULE: ./src/components/ex-chart/ExBar.vue?vue&type=style&index=0&id=10acd2fc&prod&lang=scss&scoped=true
228
- var ExBarvue_type_style_index_0_id_10acd2fc_prod_lang_scss_scoped_true = __webpack_require__("9ea1");
229
-
230
- // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
231
- var componentNormalizer = __webpack_require__("2877");
232
-
233
- // CONCATENATED MODULE: ./src/components/ex-chart/ExBar.vue
234
-
235
-
236
-
237
-
238
-
239
-
240
- /* normalize component */
241
-
242
- var component = Object(componentNormalizer["a" /* default */])(
243
- ex_chart_ExBarvue_type_script_lang_js,
244
- render,
245
- staticRenderFns,
246
- false,
247
- null,
248
- "10acd2fc",
249
- null
250
-
251
- )
252
-
253
- /* harmony default export */ var ExBar = __webpack_exports__["default"] = (component.exports);
254
-
255
- /***/ }),
256
-
257
- /***/ "22f5":
258
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
259
-
260
- "use strict";
261
-
262
- // UNUSED EXPORTS: getEcharts
263
-
264
- // CONCATENATED MODULE: ./src/components/ex-chart/theme/white.js
265
- /* harmony default export */ var white = ({
266
- color: ["#1890ff", "#37c3a4", "#29c0ce", "#6480D7", "#8cce6f", "#3a5dca", "#ffb74d"],
267
- backgroundColor: "#ffffff",
268
- textStyle: {
269
- fontFamily: "Microsoft YaHei, sans-serif"
270
- },
271
- title: {
272
- textStyle: {
273
- color: "#333",
274
- fontSize: 16
275
- },
276
- subtextStyle: {
277
- color: "#666666",
278
- fontSize: 12
279
- }
280
- },
281
- line: {
282
- itemStyle: {
283
- },
284
- lineStyle: {
285
- width: 2
286
- }
287
- },
288
- bar: {
289
- itemStyle: {
290
- borderRadius: 4
291
- }
292
- },
293
- pie: {
294
- roseType: "radius",
295
- label: {
296
- color: "#333"
297
- }
298
- },
299
- radar: {
300
- indicator: {
301
- color: "#666666"
302
- }
303
- },
304
- map: {
305
- label: {
306
- color: "#333"
307
- },
308
- itemStyle: {
309
- borderColor: "#fff"
310
- }
311
- },
312
- gauge: {
313
- axisLine: {
314
- lineStyle: {
315
- color: [[1, "#5470c6"]]
316
- }
317
- }
318
- },
319
- toolbox: {
320
- iconStyle: {
321
- borderColor: "#666666"
322
- }
323
- },
324
- xAxis: {
325
- axisLine: {
326
- lineStyle: {
327
- color: "#DFE9EE"
328
- }
329
- },
330
- axisTick: {
331
- lineStyle: {
332
- color: "#DFE9EE"
333
- },
334
- show: false
335
- }
336
- },
337
- yAxis: {
338
- axisLine: {
339
- lineStyle: {
340
- color: "#DFE9EE"
341
- }
342
- },
343
- axisTick: {
344
- lineStyle: {
345
- color: "#DFE9EE"
346
- }
347
- },
348
- splitLine: {
349
- show: true,
350
- lineStyle: {
351
- type: "dashed",
352
- color: "#DFE9EE"
353
- }
354
- }
355
- },
356
- splitArea: {
357
- areaStyle: {
358
- color: ["#f7f8fa", "#ffffff"]
359
- }
360
- },
361
- legend: {
362
- textStyle: {
363
- color: "#333333"
364
- }
365
- },
366
- tooltip: {
367
- borderWidth: 1,
368
- backgroundColor: "#ffffff",
369
- textStyle: {
370
- color: "#333333"
371
- },
372
- trigger: "axis"
373
- }
374
- });
375
-
376
- // CONCATENATED MODULE: ./src/components/ex-chart/theme/dark.js
377
- /* harmony default export */ var dark = ({
378
- color: ["#0de7ff", "#a782ff", "#fcdd60", "#0de7ff", "#ffc5a1", "#6291ae", "#13ce66"],
379
- backgroundColor: "transparent",
380
- textStyle: {
381
- fontFamily: "Microsoft YaHei, sans-serif"
382
- },
383
- title: {
384
- textStyle: {
385
- color: "#333"
386
- },
387
- subtextStyle: {
388
- color: "#666666"
389
- }
390
- },
391
- line: {
392
- itemStyle: {
393
- },
394
- lineStyle: {
395
- width: 2
396
- }
397
- },
398
- bar: {
399
- itemStyle: {
400
- borderRadius: 4
401
- }
402
- },
403
- pie: {
404
- roseType: "radius",
405
- label: {
406
- color: "#333"
407
- }
408
- },
409
- radar: {
410
- indicator: {
411
- color: "#666666"
412
- }
413
- },
414
- map: {
415
- label: {
416
- color: "#333"
417
- },
418
- itemStyle: {
419
- borderColor: "#fff"
420
- }
421
- },
422
- gauge: {
423
- axisLine: {
424
- lineStyle: {
425
- color: [[1, "#5470c6"]]
426
- }
427
- }
428
- },
429
- toolbox: {
430
- iconStyle: {
431
- borderColor: "#666666"
432
- }
433
- },
434
- axisLine: {
435
- lineStyle: {
436
- color: "#DCDFE6"
437
- }
438
- },
439
- axisTick: {
440
- lineStyle: {
441
- color: "#DCDFE6"
442
- }
443
- },
444
- splitLine: {
445
- lineStyle: {
446
- color: "#ebeef5"
447
- }
448
- },
449
- splitArea: {
450
- areaStyle: {
451
- color: ["#f7f8fa", "#ffffff"]
452
- }
453
- },
454
- legend: {
455
- textStyle: {
456
- color: "#666"
457
- }
458
- },
459
- tooltip: {
460
- backgroundColor: "rgba(255, 255, 255, 0.95)",
461
- borderColor: "#DCDFE6",
462
- borderWidth: 1,
463
- textStyle: {
464
- color: "#333"
465
- }
466
- }
467
- });
468
-
469
- // CONCATENATED MODULE: ./src/components/ex-chart/theme/blue.js
470
- /* harmony default export */ var blue = ({
471
- color: ["#2CDEB3", "#A17EE6", "#E57E40", "#409EFF"],
472
- backgroundColor: "#ffffff",
473
- textStyle: {
474
- fontFamily: "Microsoft YaHei, sans-serif"
475
- },
476
- title: {
477
- textStyle: {
478
- color: "#333"
479
- },
480
- subtextStyle: {
481
- color: "#666666"
482
- }
483
- },
484
- line: {
485
- itemStyle: {
486
- },
487
- lineStyle: {
488
- width: 2
489
- }
490
- },
491
- bar: {
492
- itemStyle: {
493
- borderRadius: 4
494
- }
495
- },
496
- pie: {
497
- roseType: "radius",
498
- label: {
499
- color: "#333"
500
- }
501
- },
502
- radar: {
503
- indicator: {
504
- color: "#666666"
505
- }
506
- },
507
- map: {
508
- label: {
509
- color: "#333"
510
- },
511
- itemStyle: {
512
- borderColor: "#fff"
513
- }
514
- },
515
- gauge: {
516
- axisLine: {
517
- lineStyle: {
518
- color: [[1, "#5470c6"]]
519
- }
520
- }
521
- },
522
- toolbox: {
523
- iconStyle: {
524
- borderColor: "#666666"
525
- }
526
- },
527
- axisLine: {
528
- lineStyle: {
529
- color: "#DCDFE6"
530
- }
531
- },
532
- axisTick: {
533
- lineStyle: {
534
- color: "#DCDFE6"
535
- }
536
- },
537
- splitLine: {
538
- lineStyle: {
539
- color: "#ebeef5"
540
- }
541
- },
542
- splitArea: {
543
- areaStyle: {
544
- color: ["#f7f8fa", "#ffffff"]
545
- }
546
- },
547
- legend: {
548
- textStyle: {
549
- color: "#666"
550
- }
551
- },
552
- tooltip: {
553
- backgroundColor: "rgba(255, 255, 255, 0.95)",
554
- borderColor: "#DCDFE6",
555
- borderWidth: 1,
556
- textStyle: {
557
- color: "#333"
558
- }
559
- }
560
- });
561
-
562
- // CONCATENATED MODULE: ./src/components/ex-chart/theme/starry.js
563
- /* harmony default export */ var starry = ({
564
- color: [
565
- "#1685a9", // 石青
566
- "#21a675", // 松柏绿
567
- "#1bd1a5", // 飞燕草蓝
568
- "#8c4356", // 绛紫
569
- "#0dafc6", // 孔雀蓝
570
- "#4b5cc4", // 宝蓝
571
- "#758a99", // 墨灰
572
- "#cca4e3", // 丁香色
573
- "#205277", // 靛青色
574
- "#d9b611", // 秋香色
575
- "#ff8c31", // 杏红
576
- "#9d2933", // 胭脂
577
- "#0288c5", // 浅靛青蓝
578
- "#44cef6" // 天蓝色
579
- ],
580
- backgroundColor: "#ffffff",
581
- textStyle: {
582
- fontFamily: "Microsoft YaHei, sans-serif"
583
- },
584
- title: {
585
- textStyle: {
586
- color: "#333"
587
- },
588
- subtextStyle: {
589
- color: "#666666"
590
- }
591
- },
592
- line: {
593
- itemStyle: {
594
- },
595
- lineStyle: {
596
- width: 2
597
- }
598
- },
599
- bar: {
600
- itemStyle: {
601
- borderRadius: 4
602
- }
603
- },
604
- pie: {
605
- roseType: "radius",
606
- label: {
607
- color: "#333"
608
- }
609
- },
610
- radar: {
611
- indicator: {
612
- color: "#666666"
613
- }
614
- },
615
- map: {
616
- label: {
617
- color: "#333"
618
- },
619
- itemStyle: {
620
- borderColor: "#fff"
621
- }
622
- },
623
- gauge: {
624
- axisLine: {
625
- lineStyle: {
626
- color: [[1, "#5470c6"]]
627
- }
628
- }
629
- },
630
- toolbox: {
631
- iconStyle: {
632
- borderColor: "#666666"
633
- }
634
- },
635
- axisLine: {
636
- lineStyle: {
637
- color: "#DCDFE6"
638
- }
639
- },
640
- axisTick: {
641
- lineStyle: {
642
- color: "#DCDFE6"
643
- }
644
- },
645
- splitLine: {
646
- lineStyle: {
647
- color: "#ebeef5"
648
- }
649
- },
650
- splitArea: {
651
- areaStyle: {
652
- color: ["#f7f8fa", "#ffffff"]
653
- }
654
- },
655
- legend: {
656
- textStyle: {
657
- color: "#666"
658
- }
659
- },
660
- tooltip: {
661
- backgroundColor: "rgba(255, 255, 255, 0.95)",
662
- borderColor: "#DCDFE6",
663
- borderWidth: 1,
664
- textStyle: {
665
- color: "#333"
666
- }
667
- }
668
- });
669
-
670
- // CONCATENATED MODULE: ./src/components/ex-chart/theme/orange.js
671
- /* harmony default export */ var orange = ({
672
- color: ["#e69419", "#A5b4da", "#F8792C", "#97bfb4", "#de747b", "#d6bac0", "#e62737", "#f35969", "#f1ccb0", "#b7394e", "#fe9c1c2"],
673
- backgroundColor: "#ffffff",
674
- textStyle: {
675
- fontFamily: "Microsoft YaHei, sans-serif"
676
- },
677
- title: {
678
- textStyle: {
679
- color: "#333"
680
- },
681
- subtextStyle: {
682
- color: "#666666"
683
- }
684
- },
685
- line: {
686
- itemStyle: {
687
- color: "#e69419"
688
- },
689
- lineStyle: {
690
- width: 2
691
- }
692
- },
693
- bar: {
694
- itemStyle: {
695
- borderRadius: 4
696
- }
697
- },
698
- pie: {
699
- roseType: "radius",
700
- label: {
701
- color: "#333"
702
- }
703
- },
704
- radar: {
705
- indicator: {
706
- color: "#666666"
707
- }
708
- },
709
- map: {
710
- label: {
711
- color: "#333"
712
- },
713
- itemStyle: {
714
- borderColor: "#fff"
715
- }
716
- },
717
- gauge: {
718
- axisLine: {
719
- lineStyle: {
720
- color: [[1, "#5470c6"]]
721
- }
722
- }
723
- },
724
- toolbox: {
725
- iconStyle: {
726
- borderColor: "#666666"
727
- }
728
- },
729
- axisLine: {
730
- lineStyle: {
731
- color: "#DCDFE6"
732
- }
733
- },
734
- axisTick: {
735
- lineStyle: {
736
- color: "#DCDFE6"
737
- }
738
- },
739
- splitLine: {
740
- lineStyle: {
741
- color: "#ebeef5"
742
- }
743
- },
744
- splitArea: {
745
- areaStyle: {
746
- color: ["#f7f8fa", "#ffffff"]
747
- }
748
- },
749
- legend: {
750
- textStyle: {
751
- color: "#666"
752
- }
753
- },
754
- tooltip: {
755
- backgroundColor: "rgba(255, 255, 255, 0.95)",
756
- borderColor: "#DCDFE6",
757
- borderWidth: 1,
758
- textStyle: {
759
- color: "#333"
760
- }
761
- }
762
- });
763
-
764
- // CONCATENATED MODULE: ./src/components/ex-chart/utils.js
765
-
766
-
767
-
768
-
769
-
770
-
771
- const themeKeys = {
772
- "default": white,
773
- "white": white,
774
- "dark": dark,
775
- "blue": blue,
776
- "starry": starry,
777
- "orange": orange
778
- };
779
-
780
- // echarts 仅在客户端加载,避免 SSR 编译/渲染报错
781
- let echarts = null;
782
-
783
- function getEcharts() {
784
- if (!echarts && typeof window !== 'undefined') {
785
- try {
786
- echarts = __webpack_require__("313e");
787
- // 注册所有主题
788
- for (const key in themeKeys) {
789
- echarts.registerTheme(key, themeKeys[key]);
790
- }
791
- } catch (e) {
792
- console.warn('[ExChart] echarts 加载失败:', e.message);
793
- }
794
- }
795
- return echarts;
796
- }
797
-
798
- // 字体大小配置
799
- const fontSizeMap = {
800
- small: {
801
- title: 14,
802
- subtitle: 11,
803
- legend: 11,
804
- axisLabel: 10,
805
- tooltip: 11,
806
- label: 11
807
- },
808
- medium: {
809
- title: 16,
810
- subtitle: 12,
811
- legend: 12,
812
- axisLabel: 12,
813
- tooltip: 12,
814
- label: 12
815
- },
816
- large: {
817
- title: 18,
818
- subtitle: 14,
819
- legend: 14,
820
- axisLabel: 14,
821
- tooltip: 14,
822
- label: 14
823
- }
824
- };
825
-
826
- function EchartsUtil() {}
827
-
828
- EchartsUtil.currentTheme = "default";
829
- EchartsUtil.currentSize = "medium";
830
- EchartsUtil.inverse = false;
831
-
832
- EchartsUtil.baseOption = {
833
- backgroundColor: "transparent",
834
- tooltip: {
835
- trigger: "axis",
836
- borderWidth: 1
837
- },
838
- legend: {
839
- right: 20,
840
- top: 0,
841
- show: true,
842
- textStyle: {
843
- fontSize: 12
844
- }
845
- },
846
- grid: {
847
- top: "25%",
848
- left: "40",
849
- right: "15",
850
- bottom: "40"
851
- },
852
- xAxis: {
853
- type: "category",
854
- boundaryGap: false,
855
- axisTick: {
856
- show: true,
857
- length: 4
858
- },
859
- axisLabel: {
860
- fontSize: 12,
861
- interval: 0,
862
- formatter: function(value) {
863
- return !this.reverse && this.longLable ? value.replace(new RegExp(`(.{${this.longLableSplitNum}})`, "g"), `$1\n`) : value;
864
- }
865
- }
866
- },
867
- yAxis: {
868
- type: "value",
869
- axisTick: {
870
- show: false
871
- },
872
- min: null,
873
- max: null,
874
- axisLabel: {
875
- show: false
876
- },
877
- splitLine: {
878
- lineStyle: {
879
- type: "dashed",
880
- width: 1
881
- }
882
- }
883
- }
884
- };
885
-
886
- EchartsUtil.chartInstanceList = [];
887
-
888
- EchartsUtil.mergeOptions = function(themeOption, customOption) {
889
- return Object.assign({}, this.baseOption, themeOption, customOption);
890
- };
891
-
892
- // 根据字体大小调整主题配置
893
- EchartsUtil.applyFontSize = function(themeOption, size) {
894
- const fontSizeConfig = fontSizeMap[size] || fontSizeMap.medium;
895
-
896
- const result = JSON.parse(JSON.stringify(themeOption));
897
-
898
- // 调整标题字体大小
899
- if (result.title && result.title.textStyle) {
900
- result.title.textStyle.fontSize = fontSizeConfig.title;
901
- }
902
- if (result.title && result.title.subtextStyle) {
903
- result.title.subtextStyle.fontSize = fontSizeConfig.subtitle;
904
- }
905
-
906
- // 调整图例字体大小
907
- if (result.legend && result.legend.textStyle) {
908
- result.legend.textStyle.fontSize = fontSizeConfig.legend;
909
- }
910
-
911
- // 调整提示框字体大小
912
- if (result.tooltip && result.tooltip.textStyle) {
913
- result.tooltip.textStyle.fontSize = fontSizeConfig.tooltip;
914
- }
915
-
916
- // 调整饼图标签字体大小
917
- if (result.pie && result.pie.label) {
918
- if (typeof result.pie.label === 'object') {
919
- result.pie.label.fontSize = fontSizeConfig.label;
920
- }
921
- }
922
-
923
- // 调整雷达图指示器字体大小
924
- if (result.radar && result.radar.indicator) {
925
- if (typeof result.radar.indicator === 'object' && result.radar.indicator.textStyle) {
926
- result.radar.indicator.textStyle.fontSize = fontSizeConfig.label;
927
- }
928
- }
929
-
930
- // 调整地图标签字体大小
931
- if (result.map && result.map.label) {
932
- if (typeof result.map.label === 'object') {
933
- result.map.label.fontSize = fontSizeConfig.label;
934
- }
935
- }
936
-
937
- return result;
938
- };
939
-
940
- EchartsUtil.init = function(dom, theme, customOption, size) {
941
- const ec = getEcharts();
942
- // SSR 环境下忽略初始化
943
- if (!ec || !dom) return null;
944
-
945
- theme = theme || "default";
946
- size = size || "medium";
947
- customOption = customOption || {};
948
-
949
- const useTheme = this.currentTheme || theme;
950
- const useSize = this.currentSize || size;
951
-
952
- this.currentTheme = useTheme;
953
- this.currentSize = useSize;
954
-
955
- let themeOption = themeKeys[useTheme];
956
- // 应用字体大小配置
957
- themeOption = this.applyFontSize(themeOption, useSize);
958
-
959
- const option = this.mergeOptions(themeOption, customOption);
960
-
961
- const chart = ec.init(dom, useTheme);
962
- chart.setOption(option, true);
963
-
964
- this.chartInstanceList.push({
965
- dom,
966
- chart,
967
- customOption,
968
- size: useSize
969
- });
970
-
971
- this.bindResize(chart);
972
- return chart;
973
- };
974
-
975
- EchartsUtil.changeSingleTheme = function(dom, chartIns, customOption, newTheme) {
976
- const ec = getEcharts();
977
- if (!ec || !dom || !chartIns) return;
978
-
979
- customOption = customOption || {};
980
- newTheme = newTheme || "default";
981
-
982
- this.currentTheme = newTheme;
983
- chartIns.dispose();
984
-
985
- const newChart = ec.init(dom, newTheme, customOption);
986
-
987
- const item = this.chartInstanceList.find(function(v) {
988
- return v.dom === dom;
989
- });
990
-
991
- if (item) {
992
- item.chart = newChart;
993
- }
994
-
995
- return newChart;
996
- };
997
-
998
- EchartsUtil.changeAllTheme = function(newTheme, newSize) {
999
- const ec = getEcharts();
1000
- if (!ec || !newTheme) return;
1001
-
1002
- this.currentTheme = newTheme;
1003
- // 如果传入了新的 size,则更新全局 size
1004
- if (newSize) {
1005
- this.currentSize = newSize;
1006
- }
1007
-
1008
- this.chartInstanceList.forEach(function(item) {
1009
- const dom = item.dom;
1010
- const chart = item.chart;
1011
- const customOption = item.customOption;
1012
- // 使用图表自己的 size,如果没有则使用全局 size
1013
- const useSize = item.size || EchartsUtil.currentSize;
1014
-
1015
- if (chart) {
1016
- chart.dispose();
1017
- }
1018
-
1019
- const newChart = ec.init(dom, newTheme);
1020
- let themeOption = themeKeys[newTheme];
1021
- // 应用字体大小配置
1022
- themeOption = EchartsUtil.applyFontSize(themeOption, useSize);
1023
- const option = EchartsUtil.mergeOptions(themeOption, customOption);
1024
-
1025
- newChart.setOption(option, true);
1026
- item.chart = newChart;
1027
- // 更新图表的 size 记录
1028
- item.size = useSize;
1029
- EchartsUtil.bindResize(newChart);
1030
- });
1031
- };
1032
-
1033
- EchartsUtil.bindResize = function(chartIns) {
1034
- if (!chartIns || chartIns.resizeLocked) return;
1035
-
1036
- window.addEventListener("resize", function() {
1037
- chartIns.resize();
1038
- });
1039
-
1040
- chartIns._resizeLocked = true;
1041
- };
1042
-
1043
- EchartsUtil.destroy = function(chartIns) {
1044
- if (chartIns) {
1045
- chartIns.dispose();
1046
- }
1047
-
1048
- this.chartInstanceList = this.chartInstanceList.filter(function(item) {
1049
- return item.chart !== chartIns;
1050
- });
1051
- };
1052
-
1053
- EchartsUtil.destroyAll = function() {
1054
- this.chartInstanceList.forEach(function(item) {
1055
- if (item.chart) {
1056
- item.chart.dispose();
1057
- }
1058
- });
1059
-
1060
- this.chartInstanceList = [];
1061
- };
1062
-
1063
- /* harmony default export */ var utils = __webpack_exports__["a"] = (EchartsUtil);
1064
-
1065
-
1066
-
1067
-
1068
- /***/ }),
1069
-
1070
- /***/ "9ea1":
1071
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
1072
-
1073
- "use strict";
1074
- /* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_9_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_9_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_9_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_9_oneOf_1_3_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_ExBar_vue_vue_type_style_index_0_id_10acd2fc_prod_lang_scss_scoped_true__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("04dd");
1075
- /* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_9_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_9_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_9_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_9_oneOf_1_3_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_ExBar_vue_vue_type_style_index_0_id_10acd2fc_prod_lang_scss_scoped_true__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_dist_loader_js_ref_9_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_9_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_9_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_9_oneOf_1_3_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_ExBar_vue_vue_type_style_index_0_id_10acd2fc_prod_lang_scss_scoped_true__WEBPACK_IMPORTED_MODULE_0__);
1076
- /* unused harmony reexport * */
1077
-
1078
-
1079
- /***/ })
1080
-
1081
- }]);