xt-element-ui 2.0.0 → 2.0.1
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-badge.md +138 -138
- package/docs/components/base/xt-bar.md +181 -181
- package/docs/components/base/xt-chart.md +182 -182
- package/docs/components/base/xt-date-picker.md +110 -110
- package/docs/components/base/xt-icon.md +153 -153
- package/docs/components/base/xt-line.md +144 -144
- package/docs/components/base/xt-multi.md +277 -277
- package/docs/components/base/xt-page.md +83 -83
- package/docs/components/base/xt-pie.md +174 -174
- package/docs/components/base/xt-progress.md +133 -133
- package/docs/components/base/xt-select-tree.md +140 -140
- package/docs/components/base/xt-table.md +343 -343
- package/docs/components/base/xt-tabs.md +196 -196
- package/docs/components/base/xt-upload.md +84 -84
- package/lib/index.common.js +187 -65
- package/lib/index.umd.js +187 -65
- package/lib/index.umd.min.js +4 -4
- package/package.json +1 -1
- package/src/components/xt-button/index.js +7 -7
- package/src/components/xt-card/index.js +6 -6
- package/src/components/xt-chart/index.js +7 -7
- package/src/components/xt-date-picker/index.js +7 -7
- package/src/components/xt-icon/index.js +7 -7
- package/src/components/xt-page/index.js +7 -7
- package/src/components/xt-select-tree/index.js +7 -7
- package/src/components/xt-step-price/index.vue +13 -3
- package/src/components/xt-step-price-item/index.vue +8 -3
- package/src/components/xt-table/index.js +7 -7
- package/src/components/xt-text/index.vue +130 -0
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import XtButton from './index.vue'
|
|
2
|
-
|
|
3
|
-
XtButton.install = function (Vue) {
|
|
4
|
-
Vue.component(XtButton.name, XtButton)
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export default XtButton
|
|
1
|
+
import XtButton from './index.vue'
|
|
2
|
+
|
|
3
|
+
XtButton.install = function (Vue) {
|
|
4
|
+
Vue.component(XtButton.name, XtButton)
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export default XtButton
|
|
8
8
|
export { XtButton }
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import XtCard from './index.vue'
|
|
2
|
-
|
|
3
|
-
XtCard.install = function (Vue) {
|
|
4
|
-
Vue.component(XtCard.name, XtCard)
|
|
5
|
-
}
|
|
6
|
-
|
|
1
|
+
import XtCard from './index.vue'
|
|
2
|
+
|
|
3
|
+
XtCard.install = function (Vue) {
|
|
4
|
+
Vue.component(XtCard.name, XtCard)
|
|
5
|
+
}
|
|
6
|
+
|
|
7
7
|
export default XtCard
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import XtChart from './index.vue'
|
|
2
|
-
|
|
3
|
-
XtChart.install = function (Vue) {
|
|
4
|
-
Vue.component(XtChart.name, XtChart)
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export default XtChart
|
|
1
|
+
import XtChart from './index.vue'
|
|
2
|
+
|
|
3
|
+
XtChart.install = function (Vue) {
|
|
4
|
+
Vue.component(XtChart.name, XtChart)
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export default XtChart
|
|
8
8
|
export { XtChart }
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import XtDatePicker from './index.vue'
|
|
2
|
-
|
|
3
|
-
XtDatePicker.install = function (Vue) {
|
|
4
|
-
Vue.component(XtDatePicker.name, XtDatePicker)
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export default XtDatePicker
|
|
1
|
+
import XtDatePicker from './index.vue'
|
|
2
|
+
|
|
3
|
+
XtDatePicker.install = function (Vue) {
|
|
4
|
+
Vue.component(XtDatePicker.name, XtDatePicker)
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export default XtDatePicker
|
|
8
8
|
export { XtDatePicker }
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import XtIcon from './index.vue'
|
|
2
|
-
|
|
3
|
-
XtIcon.install = function (Vue) {
|
|
4
|
-
Vue.component(XtIcon.name, XtIcon)
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export default XtIcon
|
|
1
|
+
import XtIcon from './index.vue'
|
|
2
|
+
|
|
3
|
+
XtIcon.install = function (Vue) {
|
|
4
|
+
Vue.component(XtIcon.name, XtIcon)
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export default XtIcon
|
|
8
8
|
export { XtIcon }
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import XtPage from './index.vue'
|
|
2
|
-
|
|
3
|
-
XtPage.install = function (Vue) {
|
|
4
|
-
Vue.component(XtPage.name, XtPage)
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export default XtPage
|
|
1
|
+
import XtPage from './index.vue'
|
|
2
|
+
|
|
3
|
+
XtPage.install = function (Vue) {
|
|
4
|
+
Vue.component(XtPage.name, XtPage)
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export default XtPage
|
|
8
8
|
export { XtPage }
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import XtSelectTree from './index.vue'
|
|
2
|
-
|
|
3
|
-
XtSelectTree.install = function (Vue) {
|
|
4
|
-
Vue.component(XtSelectTree.name, XtSelectTree)
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export default XtSelectTree
|
|
1
|
+
import XtSelectTree from './index.vue'
|
|
2
|
+
|
|
3
|
+
XtSelectTree.install = function (Vue) {
|
|
4
|
+
Vue.component(XtSelectTree.name, XtSelectTree)
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export default XtSelectTree
|
|
8
8
|
export { XtSelectTree }
|
|
@@ -154,6 +154,7 @@ export default {
|
|
|
154
154
|
if (next) {
|
|
155
155
|
let curMax = this.safeNumber(cur[this.keyMax], curMin + stepVal)
|
|
156
156
|
if (curMax <= curMin) curMax = curMin + stepVal
|
|
157
|
+
curMax = Number(curMax.toFixed(this.precision))
|
|
157
158
|
cur[this.keyMax] = curMax
|
|
158
159
|
next[this.keyMin] = curMax
|
|
159
160
|
} else {
|
|
@@ -173,13 +174,19 @@ export default {
|
|
|
173
174
|
onItemInput(val, idx) {
|
|
174
175
|
const cur = this.localItems[idx]
|
|
175
176
|
if (!cur) return
|
|
176
|
-
if (val && val[this.keyPrice] !== undefined)
|
|
177
|
+
if (val && val[this.keyPrice] !== undefined) {
|
|
178
|
+
let p = this.safeNumber(val[this.keyPrice], 0)
|
|
179
|
+
p = Number(p.toFixed(this.precision))
|
|
180
|
+
cur[this.keyPrice] = p
|
|
181
|
+
}
|
|
177
182
|
},
|
|
178
183
|
|
|
179
184
|
onMaxChange(val, idx) {
|
|
180
185
|
const cur = this.localItems[idx]
|
|
181
186
|
if (!cur) return
|
|
182
|
-
const
|
|
187
|
+
const stepVal = this.safeNumber(this.step, 1)
|
|
188
|
+
let n = this.safeNumber(val, this.safeNumber(cur[this.keyMin], 0) + stepVal)
|
|
189
|
+
n = Number(n.toFixed(this.precision))
|
|
183
190
|
cur[this.keyMax] = n
|
|
184
191
|
const next = this.localItems[idx + 1]
|
|
185
192
|
if (next) next[this.keyMin] = n
|
|
@@ -192,7 +199,10 @@ export default {
|
|
|
192
199
|
if (idx === 0) {
|
|
193
200
|
cur[this.keyMin] = 0
|
|
194
201
|
} else {
|
|
195
|
-
|
|
202
|
+
let n = this.safeNumber(val, this.safeNumber(cur[this.keyMin], 0))
|
|
203
|
+
if (n !== 0) {
|
|
204
|
+
n = Number(n.toFixed(this.precision))
|
|
205
|
+
}
|
|
196
206
|
cur[this.keyMin] = n
|
|
197
207
|
const prev = this.localItems[idx - 1]
|
|
198
208
|
if (prev) prev[this.keyMax] = n
|
|
@@ -155,7 +155,10 @@ export default {
|
|
|
155
155
|
},
|
|
156
156
|
|
|
157
157
|
onMinBlur() {
|
|
158
|
-
|
|
158
|
+
let v = this.safeNumber(this.minInput, 0)
|
|
159
|
+
if (v !== 0) {
|
|
160
|
+
v = Number(v.toFixed(this.precision))
|
|
161
|
+
}
|
|
159
162
|
this.minInput = v
|
|
160
163
|
this.$emit('min-change', v, this.index)
|
|
161
164
|
this.emitChange({ [this.keyMin]: v })
|
|
@@ -164,8 +167,10 @@ export default {
|
|
|
164
167
|
onMaxBlur() {
|
|
165
168
|
if (this.isLast) return
|
|
166
169
|
const minVal = this.safeNumber(this.minInput, 0)
|
|
167
|
-
|
|
168
|
-
|
|
170
|
+
const stepVal = this.safeNumber(this.step, 1)
|
|
171
|
+
let v = this.safeNumber(this.maxInput, minVal + stepVal)
|
|
172
|
+
if (v <= minVal) v = minVal + stepVal
|
|
173
|
+
v = Number(v.toFixed(this.precision))
|
|
169
174
|
this.maxInput = v
|
|
170
175
|
this.$emit('max-change', v, this.index)
|
|
171
176
|
this.emitChange({ [this.keyMax]: v })
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import XtTable from './index.vue'
|
|
2
|
-
|
|
3
|
-
XtTable.install = function (Vue) {
|
|
4
|
-
Vue.component(XtTable.name, XtTable)
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export default XtTable
|
|
1
|
+
import XtTable from './index.vue'
|
|
2
|
+
|
|
3
|
+
XtTable.install = function (Vue) {
|
|
4
|
+
Vue.component(XtTable.name, XtTable)
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export default XtTable
|
|
8
8
|
export { XtTable }
|
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
<template>
|
|
2
|
+
<el-tooltip
|
|
3
|
+
v-if="showTooltip && ellipsis"
|
|
4
|
+
:content="displayTooltipContent"
|
|
5
|
+
:placement="tooltipPlacement"
|
|
6
|
+
:disabled="!isOverflow"
|
|
7
|
+
effect="dark"
|
|
8
|
+
>
|
|
9
|
+
<span
|
|
10
|
+
ref="textRef"
|
|
11
|
+
class="xt-text"
|
|
12
|
+
:class="[
|
|
13
|
+
type ? 'xt-text--' + type : '',
|
|
14
|
+
'xt-text--' + size,
|
|
15
|
+
{ 'xt-text--bold': bold },
|
|
16
|
+
{ 'xt-text--money': format === 'money' },
|
|
17
|
+
{ 'xt-text--ellipsis': ellipsis },
|
|
18
|
+
{ 'xt-text--ellipsis-multiline': ellipsis && ellipsisRows > 1 }
|
|
19
|
+
]"
|
|
20
|
+
:style="customStyle"
|
|
21
|
+
@mouseenter="handleMouseEnter"
|
|
22
|
+
>
|
|
23
|
+
<slot name="prefix">{{ prefix }}</slot>
|
|
24
|
+
<slot>
|
|
25
|
+
<template v-if="formattedValue !== undefined">{{ formattedValue }}</template>
|
|
26
|
+
</slot>
|
|
27
|
+
<slot name="suffix">{{ suffix }}</slot>
|
|
28
|
+
</span>
|
|
29
|
+
</el-tooltip>
|
|
2
30
|
<span
|
|
31
|
+
v-else
|
|
32
|
+
ref="textRef"
|
|
3
33
|
class="xt-text"
|
|
4
34
|
:class="[
|
|
5
35
|
type ? 'xt-text--' + type : '',
|
|
@@ -54,6 +84,19 @@ export default {
|
|
|
54
84
|
default: 1,
|
|
55
85
|
validator: (val) => val >= 1 && val <= 10
|
|
56
86
|
},
|
|
87
|
+
showTooltip: {
|
|
88
|
+
type: Boolean,
|
|
89
|
+
default: true
|
|
90
|
+
},
|
|
91
|
+
tooltipPlacement: {
|
|
92
|
+
type: String,
|
|
93
|
+
default: 'top',
|
|
94
|
+
validator: (val) => ['top', 'bottom', 'left', 'right', 'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-start', 'left-end', 'right-start', 'right-end'].includes(val)
|
|
95
|
+
},
|
|
96
|
+
tooltipContent: {
|
|
97
|
+
type: String,
|
|
98
|
+
default: ''
|
|
99
|
+
},
|
|
57
100
|
|
|
58
101
|
// 格式化模式:normal 普通 | thousand 千分位 | money 金额
|
|
59
102
|
format: {
|
|
@@ -98,6 +141,11 @@ export default {
|
|
|
98
141
|
default: ''
|
|
99
142
|
}
|
|
100
143
|
},
|
|
144
|
+
data() {
|
|
145
|
+
return {
|
|
146
|
+
isOverflow: false
|
|
147
|
+
}
|
|
148
|
+
},
|
|
101
149
|
computed: {
|
|
102
150
|
// 兼容旧 money 属性:如果传了 money=true,自动切为金额模式
|
|
103
151
|
realFormat() {
|
|
@@ -115,6 +163,19 @@ export default {
|
|
|
115
163
|
return style
|
|
116
164
|
},
|
|
117
165
|
|
|
166
|
+
displayTooltipContent() {
|
|
167
|
+
if (this.tooltipContent) {
|
|
168
|
+
return this.tooltipContent
|
|
169
|
+
}
|
|
170
|
+
if (this.formattedValue !== undefined) {
|
|
171
|
+
return this.formattedValue
|
|
172
|
+
}
|
|
173
|
+
if (this.$slots.default && this.$slots.default.length > 0) {
|
|
174
|
+
return this.extractSlotText(this.$slots.default)
|
|
175
|
+
}
|
|
176
|
+
return this.value
|
|
177
|
+
},
|
|
178
|
+
|
|
118
179
|
formattedValue() {
|
|
119
180
|
const fmt = this.realFormat
|
|
120
181
|
const { value } = this
|
|
@@ -163,6 +224,75 @@ export default {
|
|
|
163
224
|
return value
|
|
164
225
|
}
|
|
165
226
|
}
|
|
227
|
+
},
|
|
228
|
+
methods: {
|
|
229
|
+
handleMouseEnter() {
|
|
230
|
+
this.checkOverflow()
|
|
231
|
+
},
|
|
232
|
+
checkOverflow() {
|
|
233
|
+
const el = this.$refs.textRef
|
|
234
|
+
if (!el) {
|
|
235
|
+
this.isOverflow = false
|
|
236
|
+
return
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
if (this.ellipsisRows > 1) {
|
|
240
|
+
this.isOverflow = el.scrollHeight > el.clientHeight
|
|
241
|
+
} else {
|
|
242
|
+
this.isOverflow = el.scrollWidth > el.clientWidth
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
extractSlotText(nodes) {
|
|
246
|
+
let text = ''
|
|
247
|
+
nodes.forEach(node => {
|
|
248
|
+
if (typeof node.children === 'string') {
|
|
249
|
+
text += node.children
|
|
250
|
+
} else if (typeof node.text === 'string') {
|
|
251
|
+
text += node.text
|
|
252
|
+
} else if (node.children && Array.isArray(node.children)) {
|
|
253
|
+
text += this.extractSlotText(node.children)
|
|
254
|
+
}
|
|
255
|
+
})
|
|
256
|
+
return text.trim()
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
mounted() {
|
|
260
|
+
if (this.ellipsis && this.showTooltip) {
|
|
261
|
+
this.$nextTick(() => {
|
|
262
|
+
this.checkOverflow()
|
|
263
|
+
})
|
|
264
|
+
}
|
|
265
|
+
this._resizeObserver = new ResizeObserver(() => {
|
|
266
|
+
if (this.ellipsis && this.showTooltip) {
|
|
267
|
+
this.checkOverflow()
|
|
268
|
+
}
|
|
269
|
+
})
|
|
270
|
+
this.$nextTick(() => {
|
|
271
|
+
if (this.$refs.textRef) {
|
|
272
|
+
this._resizeObserver.observe(this.$refs.textRef)
|
|
273
|
+
}
|
|
274
|
+
})
|
|
275
|
+
},
|
|
276
|
+
beforeDestroy() {
|
|
277
|
+
if (this._resizeObserver) {
|
|
278
|
+
this._resizeObserver.disconnect()
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
watch: {
|
|
282
|
+
value() {
|
|
283
|
+
if (this.ellipsis && this.showTooltip) {
|
|
284
|
+
this.$nextTick(() => {
|
|
285
|
+
this.checkOverflow()
|
|
286
|
+
})
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
ellipsis(newVal) {
|
|
290
|
+
if (newVal && this.showTooltip) {
|
|
291
|
+
this.$nextTick(() => {
|
|
292
|
+
this.checkOverflow()
|
|
293
|
+
})
|
|
294
|
+
}
|
|
295
|
+
}
|
|
166
296
|
}
|
|
167
297
|
}
|
|
168
298
|
</script>
|