xt-element-ui 2.0.2 → 2.0.4
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/README.md +2 -1
- package/docs/components/base/xt-badge.md +2 -2
- 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 +158 -0
- package/docs/components/base/xt-step-price.md +2 -1
- package/lib/index.common.js +15213 -12059
- package/lib/index.css +1 -1
- package/lib/index.umd.js +15218 -12064
- package/lib/index.umd.min.js +11 -11
- package/package.json +4 -3
- package/src/components/index.scss +4 -1
- 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/utils.js +31 -0
- 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.js +8 -0
- package/src/components/xt-scroll-arrow/index.vue +261 -0
- package/src/components/xt-scroll-arrow/style/index.scss +89 -0
- 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 +26 -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.4",
|
|
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,8 +36,8 @@
|
|
|
35
36
|
"dependencies": {
|
|
36
37
|
"echarts": "^6.1.0",
|
|
37
38
|
"element-ui": "^2.15.14",
|
|
38
|
-
"
|
|
39
|
-
"
|
|
39
|
+
"vue-server-renderer": "^2.7.14",
|
|
40
|
+
"xt-element-ui": "^2.0.2"
|
|
40
41
|
},
|
|
41
42
|
"keywords": [
|
|
42
43
|
"vue",
|
|
@@ -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>
|
|
@@ -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、去除动画装饰
|
|
@@ -417,6 +418,30 @@ EchartsUtil.bindResize = function(chartIns) {
|
|
|
417
418
|
chartIns._resizeLocked = true;
|
|
418
419
|
};
|
|
419
420
|
|
|
421
|
+
EchartsUtil.bindResizeObserver = function(dom, chartIns) {
|
|
422
|
+
if (!dom || !chartIns || typeof ResizeObserver === 'undefined') return;
|
|
423
|
+
|
|
424
|
+
const observer = new ResizeObserver(() => {
|
|
425
|
+
chartIns.resize();
|
|
426
|
+
});
|
|
427
|
+
|
|
428
|
+
observer.observe(dom);
|
|
429
|
+
|
|
430
|
+
EchartsUtil.resizeObserverList.push({
|
|
431
|
+
dom,
|
|
432
|
+
observer,
|
|
433
|
+
chartIns
|
|
434
|
+
});
|
|
435
|
+
};
|
|
436
|
+
|
|
437
|
+
EchartsUtil.unbindResizeObserver = function(dom) {
|
|
438
|
+
const index = EchartsUtil.resizeObserverList.findIndex(item => item.dom === dom);
|
|
439
|
+
if (index !== -1) {
|
|
440
|
+
EchartsUtil.resizeObserverList[index].observer.disconnect();
|
|
441
|
+
EchartsUtil.resizeObserverList.splice(index, 1);
|
|
442
|
+
}
|
|
443
|
+
};
|
|
444
|
+
|
|
420
445
|
EchartsUtil.destroy = function(chartIns) {
|
|
421
446
|
if (chartIns) {
|
|
422
447
|
chartIns.dispose();
|
|
@@ -435,6 +460,12 @@ EchartsUtil.destroyAll = function() {
|
|
|
435
460
|
});
|
|
436
461
|
|
|
437
462
|
this.chartInstanceList = [];
|
|
463
|
+
|
|
464
|
+
this.resizeObserverList.forEach(function(item) {
|
|
465
|
+
item.observer.disconnect();
|
|
466
|
+
});
|
|
467
|
+
|
|
468
|
+
this.resizeObserverList = [];
|
|
438
469
|
};
|
|
439
470
|
|
|
440
471
|
export default EchartsUtil;
|
|
@@ -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() {
|