xt-element-ui 2.0.3 → 2.0.5
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.
- package/docs/components/base/xt-bar.md +1 -1
- package/docs/components/base/xt-map-provider.md +2 -0
- package/docs/components/base/xt-map.md +21 -10
- package/docs/components/base/xt-page.md +4 -2
- package/docs/components/base/xt-scroll-arrow.md +5 -2
- package/docs/components/base/xt-step-price.md +2 -1
- package/docs/components/base/xt-upload.md +1 -1
- package/lib/index.common.js +15096 -12067
- package/lib/index.css +1 -1
- package/lib/index.umd.js +15101 -12072
- package/lib/index.umd.min.js +11 -11
- package/package.json +2 -2
- package/src/components/xt-badge/index.vue +19 -9
- package/src/components/xt-chart/XtBar.vue +33 -10
- package/src/components/xt-chart/XtLine.vue +33 -1
- package/src/components/xt-chart/XtMulti.vue +35 -1
- package/src/components/xt-chart/XtPie.vue +31 -1
- package/src/components/xt-chart/pieList.vue +0 -1
- package/src/components/xt-chart/theme/dark.js +26 -9
- package/src/components/xt-chart/theme/white.js +9 -0
- package/src/components/xt-chart/utils.js +59 -0
- package/src/components/xt-config-provider/index.vue +5 -1
- package/src/components/xt-date-picker/index.vue +8 -8
- package/src/components/xt-page/index.vue +1 -1
- package/src/components/xt-scroll-arrow/index.vue +72 -1
- package/src/components/xt-select-tree/index.vue +0 -7
- package/src/components/xt-step-price/index.vue +4 -2
- package/src/components/xt-step-price-item/index.vue +2 -1
- package/src/components/xt-upload/index.vue +5 -8
- package/src/index.js +23 -2
- package/src/components/xt-card-item/index copy.vue +0 -93
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xt-element-ui",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"description": "基于 Vue 2.7 + ElementUI 的企业级组件库,提供丰富的自定义组件和扩展组件",
|
|
5
5
|
"main": "lib/index.common.js",
|
|
6
6
|
"module": "lib/index.esm.js",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@vue/cli-service": "~4.5.19",
|
|
21
|
+
"sass": "^1.56.0",
|
|
21
22
|
"sass-loader": "^10.5.2",
|
|
22
23
|
"vue": "^2.6.10",
|
|
23
24
|
"vuepress": "^1.9.10",
|
|
@@ -35,7 +36,6 @@
|
|
|
35
36
|
"dependencies": {
|
|
36
37
|
"echarts": "^6.1.0",
|
|
37
38
|
"element-ui": "^2.15.14",
|
|
38
|
-
"sass": "^1.32.13",
|
|
39
39
|
"vue-server-renderer": "^2.7.14",
|
|
40
40
|
"xt-element-ui": "^2.0.2"
|
|
41
41
|
},
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<span class="
|
|
3
|
-
`xt-badge--${type}`,
|
|
4
|
-
{ 'xt-badge--dot': isDot },
|
|
5
|
-
{ 'xt-badge--hidden': hidden },
|
|
6
|
-
{ 'xt-badge--fixed': fixed }
|
|
7
|
-
]">
|
|
2
|
+
<span :class="rootClasses">
|
|
8
3
|
<span class="xt-badge__content">
|
|
9
4
|
<slot></slot>
|
|
10
5
|
</span>
|
|
@@ -13,9 +8,9 @@
|
|
|
13
8
|
class="xt-badge__badge"
|
|
14
9
|
:style="badgeStyle"
|
|
15
10
|
>
|
|
16
|
-
<
|
|
17
|
-
<
|
|
18
|
-
<
|
|
11
|
+
<span v-if="isDot"></span>
|
|
12
|
+
<span v-else-if="isOverflow">{{ overflowText }}</span>
|
|
13
|
+
<span v-else>{{ value }}</span>
|
|
19
14
|
</span>
|
|
20
15
|
</span>
|
|
21
16
|
</template>
|
|
@@ -59,12 +54,27 @@ export default {
|
|
|
59
54
|
}
|
|
60
55
|
},
|
|
61
56
|
computed: {
|
|
57
|
+
rootClasses() {
|
|
58
|
+
return [
|
|
59
|
+
'xt-badge',
|
|
60
|
+
`xt-badge--${this.type}`,
|
|
61
|
+
{ 'xt-badge--dot': this.isDot },
|
|
62
|
+
{ 'xt-badge--hidden': this.hidden },
|
|
63
|
+
{ 'xt-badge--fixed': this.fixed }
|
|
64
|
+
]
|
|
65
|
+
},
|
|
62
66
|
badgeStyle() {
|
|
63
67
|
const style = {}
|
|
64
68
|
if (this.color) {
|
|
65
69
|
style.backgroundColor = this.color
|
|
66
70
|
}
|
|
67
71
|
return style
|
|
72
|
+
},
|
|
73
|
+
overflowText() {
|
|
74
|
+
return this.max + '+'
|
|
75
|
+
},
|
|
76
|
+
isOverflow() {
|
|
77
|
+
return this.showOverflow && this.value > this.max
|
|
68
78
|
}
|
|
69
79
|
}
|
|
70
80
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div ref="barchart" class="bar-box"></div>
|
|
2
|
+
<div ref="barchart" class="bar-box" :style="chartStyle"></div>
|
|
3
3
|
</template>
|
|
4
4
|
<script>
|
|
5
5
|
import EchartsUtil from "./utils";
|
|
@@ -28,6 +28,18 @@ export default {
|
|
|
28
28
|
type: String,
|
|
29
29
|
default: "medium"
|
|
30
30
|
},
|
|
31
|
+
width: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: "100%"
|
|
34
|
+
},
|
|
35
|
+
height: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: "100%"
|
|
38
|
+
},
|
|
39
|
+
ratio: {
|
|
40
|
+
type: Number,
|
|
41
|
+
default: null
|
|
42
|
+
},
|
|
31
43
|
fieldKeys: {
|
|
32
44
|
type: Object,
|
|
33
45
|
default: () => ({ label: "label", value: "value", data: "data" })
|
|
@@ -75,6 +87,18 @@ export default {
|
|
|
75
87
|
name: "数量"
|
|
76
88
|
};
|
|
77
89
|
},
|
|
90
|
+
computed: {
|
|
91
|
+
chartStyle() {
|
|
92
|
+
const style = {};
|
|
93
|
+
if (this.width) style.width = this.width;
|
|
94
|
+
if (this.ratio) {
|
|
95
|
+
style.aspectRatio = this.ratio;
|
|
96
|
+
} else if (this.height) {
|
|
97
|
+
style.height = this.height;
|
|
98
|
+
}
|
|
99
|
+
return style;
|
|
100
|
+
}
|
|
101
|
+
},
|
|
78
102
|
watch: {
|
|
79
103
|
chartData: {
|
|
80
104
|
deep: true,
|
|
@@ -96,6 +120,13 @@ export default {
|
|
|
96
120
|
},
|
|
97
121
|
mounted() {
|
|
98
122
|
this.initChart();
|
|
123
|
+
EchartsUtil.bindResizeObserver(this.$refs.barchart, this.myChart);
|
|
124
|
+
},
|
|
125
|
+
beforeUnmount() {
|
|
126
|
+
EchartsUtil.unbindResizeObserver(this.$refs.barchart);
|
|
127
|
+
if (this.myChart) {
|
|
128
|
+
this.myChart.dispose();
|
|
129
|
+
}
|
|
99
130
|
},
|
|
100
131
|
methods: {
|
|
101
132
|
initChart() {
|
|
@@ -171,12 +202,6 @@ export default {
|
|
|
171
202
|
series: {
|
|
172
203
|
name: _self.unit,
|
|
173
204
|
type: "bar",
|
|
174
|
-
markPoint: {
|
|
175
|
-
data: [
|
|
176
|
-
{ type: "min", name: "Min" },
|
|
177
|
-
{ type: "max", name: "Max" }
|
|
178
|
-
]
|
|
179
|
-
},
|
|
180
205
|
avoidLabelOverlap: true,
|
|
181
206
|
data: _self.chartData.map((item, ind) => {
|
|
182
207
|
const label = item[keys.label];
|
|
@@ -192,9 +217,6 @@ export default {
|
|
|
192
217
|
},
|
|
193
218
|
dataZoom: _self.showZoom ? [{ height: 20, bottom: 0 }] : [],
|
|
194
219
|
};
|
|
195
|
-
if (!this.markPoint) {
|
|
196
|
-
this.$delete(option.series[0], "markPoint");
|
|
197
|
-
}
|
|
198
220
|
if (this.simpleMode) {
|
|
199
221
|
EchartsUtil.applySimpleMode(option, "bar");
|
|
200
222
|
}
|
|
@@ -208,5 +230,6 @@ export default {
|
|
|
208
230
|
position: relative;
|
|
209
231
|
height: 100%;
|
|
210
232
|
width: 100%;
|
|
233
|
+
min-height: 100px;
|
|
211
234
|
}
|
|
212
235
|
</style>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div ref="linechart" class="line-box"></div>
|
|
2
|
+
<div ref="linechart" class="line-box" :style="chartStyle"></div>
|
|
3
3
|
</template>
|
|
4
4
|
<script>
|
|
5
5
|
import EchartsUtil from "./utils";
|
|
@@ -11,6 +11,18 @@ export default {
|
|
|
11
11
|
type: String,
|
|
12
12
|
default: "medium"
|
|
13
13
|
},
|
|
14
|
+
width: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: "100%"
|
|
17
|
+
},
|
|
18
|
+
height: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: "100%"
|
|
21
|
+
},
|
|
22
|
+
ratio: {
|
|
23
|
+
type: Number,
|
|
24
|
+
default: null
|
|
25
|
+
},
|
|
14
26
|
chartData: {
|
|
15
27
|
type: Array,
|
|
16
28
|
default: () => {
|
|
@@ -47,6 +59,18 @@ export default {
|
|
|
47
59
|
myChart: null
|
|
48
60
|
};
|
|
49
61
|
},
|
|
62
|
+
computed: {
|
|
63
|
+
chartStyle() {
|
|
64
|
+
const style = {};
|
|
65
|
+
if (this.width) style.width = this.width;
|
|
66
|
+
if (this.ratio) {
|
|
67
|
+
style.aspectRatio = this.ratio;
|
|
68
|
+
} else if (this.height) {
|
|
69
|
+
style.height = this.height;
|
|
70
|
+
}
|
|
71
|
+
return style;
|
|
72
|
+
}
|
|
73
|
+
},
|
|
50
74
|
watch: {
|
|
51
75
|
chartData: {
|
|
52
76
|
deep: true,
|
|
@@ -68,6 +92,13 @@ export default {
|
|
|
68
92
|
},
|
|
69
93
|
mounted() {
|
|
70
94
|
this.initChart();
|
|
95
|
+
EchartsUtil.bindResizeObserver(this.$refs.linechart, this.myChart);
|
|
96
|
+
},
|
|
97
|
+
beforeUnmount() {
|
|
98
|
+
EchartsUtil.unbindResizeObserver(this.$refs.linechart);
|
|
99
|
+
if (this.myChart) {
|
|
100
|
+
this.myChart.dispose();
|
|
101
|
+
}
|
|
71
102
|
},
|
|
72
103
|
methods: {
|
|
73
104
|
initChart() {
|
|
@@ -154,5 +185,6 @@ export default {
|
|
|
154
185
|
position: relative;
|
|
155
186
|
height: 100%;
|
|
156
187
|
width: 100%;
|
|
188
|
+
min-height: 100px;
|
|
157
189
|
}
|
|
158
190
|
</style>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div ref="multilinechart" class="multiline-box"></div>
|
|
2
|
+
<div ref="multilinechart" class="multiline-box" :style="chartStyle"></div>
|
|
3
3
|
</template>
|
|
4
4
|
<script>
|
|
5
5
|
import EchartsUtil from "./utils";
|
|
@@ -11,6 +11,18 @@ export default {
|
|
|
11
11
|
type: String,
|
|
12
12
|
default: "medium"
|
|
13
13
|
},
|
|
14
|
+
width: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: "100%"
|
|
17
|
+
},
|
|
18
|
+
height: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: "100%"
|
|
21
|
+
},
|
|
22
|
+
ratio: {
|
|
23
|
+
type: Number,
|
|
24
|
+
default: null
|
|
25
|
+
},
|
|
14
26
|
fieldKeys: {
|
|
15
27
|
type: Object,
|
|
16
28
|
default: () => ({ label: "label", value: "value", data: "data" })
|
|
@@ -102,6 +114,18 @@ export default {
|
|
|
102
114
|
myChart: null
|
|
103
115
|
};
|
|
104
116
|
},
|
|
117
|
+
computed: {
|
|
118
|
+
chartStyle() {
|
|
119
|
+
const style = {};
|
|
120
|
+
if (this.width) style.width = this.width;
|
|
121
|
+
if (this.ratio) {
|
|
122
|
+
style.aspectRatio = this.ratio;
|
|
123
|
+
} else if (this.height) {
|
|
124
|
+
style.height = this.height;
|
|
125
|
+
}
|
|
126
|
+
return style;
|
|
127
|
+
}
|
|
128
|
+
},
|
|
105
129
|
watch: {
|
|
106
130
|
chartData: {
|
|
107
131
|
deep: true,
|
|
@@ -110,16 +134,25 @@ export default {
|
|
|
110
134
|
this.myChart && this.myChart.dispose();
|
|
111
135
|
this.myChart = null;
|
|
112
136
|
_self.initChart();
|
|
137
|
+
EchartsUtil.bindResizeObserver(this.$refs.multilinechart, this.myChart);
|
|
113
138
|
}
|
|
114
139
|
},
|
|
115
140
|
theme(newVal) {
|
|
116
141
|
this.myChart && this.myChart.dispose();
|
|
117
142
|
this.myChart = null;
|
|
118
143
|
this.initChart();
|
|
144
|
+
EchartsUtil.bindResizeObserver(this.$refs.multilinechart, this.myChart);
|
|
119
145
|
}
|
|
120
146
|
},
|
|
121
147
|
mounted() {
|
|
122
148
|
this.initChart();
|
|
149
|
+
EchartsUtil.bindResizeObserver(this.$refs.multilinechart, this.myChart);
|
|
150
|
+
},
|
|
151
|
+
beforeUnmount() {
|
|
152
|
+
EchartsUtil.unbindResizeObserver(this.$refs.multilinechart);
|
|
153
|
+
if (this.myChart) {
|
|
154
|
+
this.myChart.dispose();
|
|
155
|
+
}
|
|
123
156
|
},
|
|
124
157
|
methods: {
|
|
125
158
|
initChart() {
|
|
@@ -248,5 +281,6 @@ export default {
|
|
|
248
281
|
.multiline-box{
|
|
249
282
|
height: 100%;
|
|
250
283
|
width: 100%;
|
|
284
|
+
min-height: 100px;
|
|
251
285
|
}
|
|
252
286
|
</style>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div ref="piechart" class="pie-box"></div>
|
|
2
|
+
<div ref="piechart" class="pie-box" :style="chartStyle"></div>
|
|
3
3
|
</template>
|
|
4
4
|
<script>
|
|
5
5
|
import EchartsUtil from "./utils";
|
|
@@ -11,6 +11,18 @@ export default {
|
|
|
11
11
|
type: String,
|
|
12
12
|
default: "medium"
|
|
13
13
|
},
|
|
14
|
+
width: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: "100%"
|
|
17
|
+
},
|
|
18
|
+
height: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: "100%"
|
|
21
|
+
},
|
|
22
|
+
ratio: {
|
|
23
|
+
type: Number,
|
|
24
|
+
default: null
|
|
25
|
+
},
|
|
14
26
|
chartData: {
|
|
15
27
|
type: Array,
|
|
16
28
|
default: () => {
|
|
@@ -61,6 +73,16 @@ export default {
|
|
|
61
73
|
};
|
|
62
74
|
},
|
|
63
75
|
computed: {
|
|
76
|
+
chartStyle() {
|
|
77
|
+
const style = {};
|
|
78
|
+
if (this.width) style.width = this.width;
|
|
79
|
+
if (this.ratio) {
|
|
80
|
+
style.aspectRatio = this.ratio;
|
|
81
|
+
} else if (this.height) {
|
|
82
|
+
style.height = this.height;
|
|
83
|
+
}
|
|
84
|
+
return style;
|
|
85
|
+
},
|
|
64
86
|
totalNum() {
|
|
65
87
|
const keys = Object.assign(
|
|
66
88
|
{ label: "label", value: "value", data: "data" },
|
|
@@ -84,8 +106,15 @@ export default {
|
|
|
84
106
|
mounted() {
|
|
85
107
|
this.$nextTick(() => {
|
|
86
108
|
this.initChart();
|
|
109
|
+
EchartsUtil.bindResizeObserver(this.$refs.piechart, this.myChart);
|
|
87
110
|
});
|
|
88
111
|
},
|
|
112
|
+
beforeUnmount() {
|
|
113
|
+
EchartsUtil.unbindResizeObserver(this.$refs.piechart);
|
|
114
|
+
if (this.myChart) {
|
|
115
|
+
this.myChart.dispose();
|
|
116
|
+
}
|
|
117
|
+
},
|
|
89
118
|
methods: {
|
|
90
119
|
initChart() {
|
|
91
120
|
const _self = this;
|
|
@@ -163,5 +192,6 @@ export default {
|
|
|
163
192
|
position: relative;
|
|
164
193
|
height: 100%;
|
|
165
194
|
width: 100%;
|
|
195
|
+
min-height: 100px;
|
|
166
196
|
}
|
|
167
197
|
</style>
|
|
@@ -14,9 +14,6 @@ export default {
|
|
|
14
14
|
color: "#ffffff"
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
|
-
axisLabel: {
|
|
18
|
-
color: "#ffffff"
|
|
19
|
-
},
|
|
20
17
|
line: {
|
|
21
18
|
itemStyle: {
|
|
22
19
|
},
|
|
@@ -60,14 +57,34 @@ export default {
|
|
|
60
57
|
borderColor: "#ffffff"
|
|
61
58
|
}
|
|
62
59
|
},
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
xAxis: {
|
|
61
|
+
axisLine: {
|
|
62
|
+
lineStyle: {
|
|
63
|
+
color: "#DCDFE6"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
axisTick: {
|
|
67
|
+
lineStyle: {
|
|
68
|
+
color: "#DCDFE6"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
axisLabel: {
|
|
72
|
+
color: "#ffffff"
|
|
66
73
|
}
|
|
67
74
|
},
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
75
|
+
yAxis: {
|
|
76
|
+
axisLine: {
|
|
77
|
+
lineStyle: {
|
|
78
|
+
color: "#DCDFE6"
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
axisTick: {
|
|
82
|
+
lineStyle: {
|
|
83
|
+
color: "#DCDFE6"
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
axisLabel: {
|
|
87
|
+
color: "#ffffff"
|
|
71
88
|
}
|
|
72
89
|
},
|
|
73
90
|
splitLine: {
|
|
@@ -45,6 +45,9 @@ export default {
|
|
|
45
45
|
borderColor: "#fff"
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
|
+
axisLabel: {
|
|
49
|
+
color: "#666666"
|
|
50
|
+
},
|
|
48
51
|
gauge: {
|
|
49
52
|
axisLine: {
|
|
50
53
|
lineStyle: {
|
|
@@ -68,6 +71,9 @@ export default {
|
|
|
68
71
|
color: "#DFE9EE"
|
|
69
72
|
},
|
|
70
73
|
show: false
|
|
74
|
+
},
|
|
75
|
+
axisLabel: {
|
|
76
|
+
color: "#666666"
|
|
71
77
|
}
|
|
72
78
|
},
|
|
73
79
|
yAxis: {
|
|
@@ -87,6 +93,9 @@ export default {
|
|
|
87
93
|
type: "dashed",
|
|
88
94
|
color: "#DFE9EE"
|
|
89
95
|
}
|
|
96
|
+
},
|
|
97
|
+
axisLabel: {
|
|
98
|
+
color: "#666666"
|
|
90
99
|
}
|
|
91
100
|
},
|
|
92
101
|
splitArea: {
|
|
@@ -114,6 +114,7 @@ EchartsUtil.EchartsUtil = {
|
|
|
114
114
|
};
|
|
115
115
|
|
|
116
116
|
EchartsUtil.chartInstanceList = [];
|
|
117
|
+
EchartsUtil.resizeObserverList = [];
|
|
117
118
|
|
|
118
119
|
// === 极简模式(simpleMode)预设配置 ===
|
|
119
120
|
// 极简模式:隐藏图例、隐藏坐标轴/网格线、缩小内边距、简化 tooltip、去除动画装饰
|
|
@@ -311,6 +312,34 @@ EchartsUtil.applyFontSize = function(themeOption, size) {
|
|
|
311
312
|
}
|
|
312
313
|
}
|
|
313
314
|
|
|
315
|
+
// 调整坐标轴标签字体大小和颜色
|
|
316
|
+
const applyAxisLabel = function(axis) {
|
|
317
|
+
if (!axis) return;
|
|
318
|
+
if (!axis.axisLabel) {
|
|
319
|
+
axis.axisLabel = {};
|
|
320
|
+
}
|
|
321
|
+
if (result.axisLabel && result.axisLabel.color) {
|
|
322
|
+
axis.axisLabel.color = result.axisLabel.color;
|
|
323
|
+
}
|
|
324
|
+
axis.axisLabel.fontSize = fontSizeConfig.axisLabel;
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
if (result.xAxis) {
|
|
328
|
+
if (Array.isArray(result.xAxis)) {
|
|
329
|
+
result.xAxis.forEach(applyAxisLabel);
|
|
330
|
+
} else {
|
|
331
|
+
applyAxisLabel(result.xAxis);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
if (result.yAxis) {
|
|
336
|
+
if (Array.isArray(result.yAxis)) {
|
|
337
|
+
result.yAxis.forEach(applyAxisLabel);
|
|
338
|
+
} else {
|
|
339
|
+
applyAxisLabel(result.yAxis);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
314
343
|
return result;
|
|
315
344
|
};
|
|
316
345
|
|
|
@@ -417,6 +446,30 @@ EchartsUtil.bindResize = function(chartIns) {
|
|
|
417
446
|
chartIns._resizeLocked = true;
|
|
418
447
|
};
|
|
419
448
|
|
|
449
|
+
EchartsUtil.bindResizeObserver = function(dom, chartIns) {
|
|
450
|
+
if (!dom || !chartIns || typeof ResizeObserver === 'undefined') return;
|
|
451
|
+
|
|
452
|
+
const observer = new ResizeObserver(() => {
|
|
453
|
+
chartIns.resize();
|
|
454
|
+
});
|
|
455
|
+
|
|
456
|
+
observer.observe(dom);
|
|
457
|
+
|
|
458
|
+
EchartsUtil.resizeObserverList.push({
|
|
459
|
+
dom,
|
|
460
|
+
observer,
|
|
461
|
+
chartIns
|
|
462
|
+
});
|
|
463
|
+
};
|
|
464
|
+
|
|
465
|
+
EchartsUtil.unbindResizeObserver = function(dom) {
|
|
466
|
+
const index = EchartsUtil.resizeObserverList.findIndex(item => item.dom === dom);
|
|
467
|
+
if (index !== -1) {
|
|
468
|
+
EchartsUtil.resizeObserverList[index].observer.disconnect();
|
|
469
|
+
EchartsUtil.resizeObserverList.splice(index, 1);
|
|
470
|
+
}
|
|
471
|
+
};
|
|
472
|
+
|
|
420
473
|
EchartsUtil.destroy = function(chartIns) {
|
|
421
474
|
if (chartIns) {
|
|
422
475
|
chartIns.dispose();
|
|
@@ -435,6 +488,12 @@ EchartsUtil.destroyAll = function() {
|
|
|
435
488
|
});
|
|
436
489
|
|
|
437
490
|
this.chartInstanceList = [];
|
|
491
|
+
|
|
492
|
+
this.resizeObserverList.forEach(function(item) {
|
|
493
|
+
item.observer.disconnect();
|
|
494
|
+
});
|
|
495
|
+
|
|
496
|
+
this.resizeObserverList = [];
|
|
438
497
|
};
|
|
439
498
|
|
|
440
499
|
export default EchartsUtil;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import EchartsUtil from '../xt-chart/utils.js'
|
|
3
|
+
|
|
4
|
+
// SSR 兼容:Node.js 环境中 HTMLElement 不存在
|
|
5
|
+
const HTMLElementType = typeof HTMLElement !== 'undefined' ? HTMLElement : Object
|
|
6
|
+
|
|
3
7
|
export default {
|
|
4
8
|
name: 'XtConfigProvider',
|
|
5
9
|
inheritAttrs: false,
|
|
@@ -107,7 +111,7 @@ export default {
|
|
|
107
111
|
default: false
|
|
108
112
|
},
|
|
109
113
|
proxyElement: {
|
|
110
|
-
type: [
|
|
114
|
+
type: [HTMLElementType, String, Object],
|
|
111
115
|
default: null,
|
|
112
116
|
description: '代理元素,将样式应用到该元素上。支持 HTMLElement、CSS选择器字符串或 ref 对象'
|
|
113
117
|
},
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div style="display:inline-block">
|
|
3
|
-
<
|
|
3
|
+
<XtFlexBox v-if="dateType=='quarter'" type="inline-flex" class="xt-date-picker" :class="{focus: isfocus}" :style="width?{width: `${width}`}:{}">
|
|
4
4
|
<Quarter v-model="timeStart" :format="format" placeholder="开始时间" quarter-type="quarter-start" clearable></Quarter>
|
|
5
5
|
<span class="separator">{{ separator }}</span>
|
|
6
6
|
<Quarter v-model="timeEnd" :format="format" placeholder="结束时间" quarter-type="quarter-end" clearable></Quarter>
|
|
7
|
-
</
|
|
8
|
-
<
|
|
7
|
+
</XtFlexBox>
|
|
8
|
+
<XtFlexBox v-else type="inline-flex" class="xt-date" :class="{focus: isfocus}" :style="width?{width: `${width}px`}:{}">
|
|
9
9
|
<el-date-picker ref="timeStart" key="startSelect" v-model="timeStart" size="small" :disabled="disabled" append-to-body :picker-options="startTimeRange" :format="format" :type="dateType" placeholder="开始时间" clearable @blur="$emit('blur')" @focus="$emit('focus')"></el-date-picker>
|
|
10
10
|
<span class="separator">{{ separator }}</span>
|
|
11
11
|
<el-date-picker ref="timeEnd" key="endSelect" v-model="timeEnd" size="small" :disabled="disabled" append-to-body :picker-options="endTimeRange" :format="format" :type="dateType" placeholder="结束时间" clearable @blur="$emit('blur')" @focus="$emit('focus')"></el-date-picker>
|
|
12
|
-
</
|
|
12
|
+
</XtFlexBox>
|
|
13
13
|
</div>
|
|
14
14
|
</template>
|
|
15
15
|
<script>
|
|
@@ -17,12 +17,12 @@ const typeFormatEnum = {
|
|
|
17
17
|
datetime: "yyyy-MM-dd HH:mm", month: "yyyy-MM", year: "yyyy", date: "yyyy-MM-dd", quarter: "yyyy-Qq", week: "yyyy-WW"
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
import
|
|
20
|
+
import XtFlexBox from '../xt-flex-box/index.vue'
|
|
21
21
|
import Quarter from "./quarter.vue";
|
|
22
22
|
export default {
|
|
23
23
|
name: "XtDatePicker",
|
|
24
24
|
components: {
|
|
25
|
-
|
|
25
|
+
XtFlexBox,
|
|
26
26
|
Quarter
|
|
27
27
|
},
|
|
28
28
|
model: {
|
|
@@ -49,8 +49,8 @@ export default {
|
|
|
49
49
|
},
|
|
50
50
|
placeholder: {},
|
|
51
51
|
width: {
|
|
52
|
-
type:
|
|
53
|
-
default:
|
|
52
|
+
type: [String],
|
|
53
|
+
default: '100%'
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
56
|
data() {
|