vxe-pc-ui 4.2.13 → 4.2.15
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/es/avatar/style.css +0 -5
- package/es/avatar/style.min.css +1 -1
- package/es/icon/style.css +1 -1
- package/es/slider/src/slider.js +226 -7
- package/es/slider/style.css +143 -0
- package/es/slider/style.min.css +1 -0
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/tabs/src/tabs.js +25 -16
- package/es/ui/index.js +5 -2
- package/es/ui/src/log.js +1 -1
- package/es/vxe-avatar/style.css +0 -5
- package/es/vxe-avatar/style.min.css +1 -1
- package/es/vxe-slider/style.css +143 -0
- package/es/vxe-slider/style.min.css +1 -0
- package/lib/avatar/style/style.css +0 -5
- package/lib/avatar/style/style.min.css +1 -1
- package/lib/icon/style/style.css +1 -1
- package/lib/icon/style/style.min.css +1 -1
- package/lib/index.umd.js +290 -38
- package/lib/index.umd.min.js +1 -1
- package/lib/slider/src/slider.js +232 -5
- package/lib/slider/src/slider.min.js +1 -1
- package/lib/slider/style/style.css +143 -0
- package/lib/slider/style/style.min.css +1 -0
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/tabs/src/tabs.js +52 -30
- package/lib/tabs/src/tabs.min.js +1 -1
- package/lib/ui/index.js +5 -2
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/vxe-avatar/style/style.css +0 -5
- package/lib/vxe-avatar/style/style.min.css +1 -1
- package/lib/vxe-slider/style/style.css +143 -0
- package/lib/vxe-slider/style/style.min.css +1 -0
- package/package.json +1 -1
- package/packages/slider/src/slider.ts +236 -5
- package/packages/tabs/src/tabs.ts +27 -14
- package/packages/ui/index.ts +4 -1
- package/styles/components/avatar.scss +3 -8
- package/styles/components/slider.scss +138 -0
- package/types/components/slider.d.ts +27 -2
- package/types/components/switch.d.ts +1 -1
- package/types/components/tabs.d.ts +8 -2
- /package/es/icon/style/{iconfont.1728032207633.ttf → iconfont.1728223071861.ttf} +0 -0
- /package/es/icon/style/{iconfont.1728032207633.woff → iconfont.1728223071861.woff} +0 -0
- /package/es/icon/style/{iconfont.1728032207633.woff2 → iconfont.1728223071861.woff2} +0 -0
- /package/es/{iconfont.1728032207633.ttf → iconfont.1728223071861.ttf} +0 -0
- /package/es/{iconfont.1728032207633.woff → iconfont.1728223071861.woff} +0 -0
- /package/es/{iconfont.1728032207633.woff2 → iconfont.1728223071861.woff2} +0 -0
- /package/lib/icon/style/{iconfont.1728032207633.ttf → iconfont.1728223071861.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1728032207633.woff → iconfont.1728223071861.woff} +0 -0
- /package/lib/icon/style/{iconfont.1728032207633.woff2 → iconfont.1728223071861.woff2} +0 -0
- /package/lib/{iconfont.1728032207633.ttf → iconfont.1728223071861.ttf} +0 -0
- /package/lib/{iconfont.1728032207633.woff → iconfont.1728223071861.woff} +0 -0
- /package/lib/{iconfont.1728032207633.woff2 → iconfont.1728223071861.woff2} +0 -0
|
@@ -1,29 +1,102 @@
|
|
|
1
|
-
import { defineComponent, ref, h, reactive } from 'vue'
|
|
1
|
+
import { defineComponent, ref, h, reactive, PropType, watch, computed, inject, onMounted } from 'vue'
|
|
2
2
|
import XEUtils from 'xe-utils'
|
|
3
|
-
import { createEvent } from '../../ui'
|
|
3
|
+
import { getConfig, createEvent, renderEmptyElement, useSize } from '../../ui'
|
|
4
4
|
|
|
5
|
-
import type { SliderReactData, VxeSliderEmits, SliderMethods, SliderPrivateMethods, ValueOf, SliderPrivateRef, VxeSliderPrivateComputed, VxeSliderConstructor, VxeSliderPrivateMethods } from '../../../types'
|
|
5
|
+
import type { SliderReactData, VxeSliderEmits, VxeSliderPropTypes, SliderMethods, VxeFormDefines, VxeFormConstructor, VxeFormPrivateMethods, SliderPrivateMethods, ValueOf, SliderPrivateRef, VxeSliderPrivateComputed, VxeSliderConstructor, VxeSliderPrivateMethods } from '../../../types'
|
|
6
6
|
|
|
7
7
|
export default defineComponent({
|
|
8
8
|
name: 'VxeSlider',
|
|
9
9
|
props: {
|
|
10
|
+
modelValue: [String, Number, Array] as PropType<VxeSliderPropTypes.ModelValue>,
|
|
11
|
+
vertical: Boolean as PropType<VxeSliderPropTypes.Vertical>,
|
|
12
|
+
max: {
|
|
13
|
+
type: [String, Number] as PropType<VxeSliderPropTypes.Max>,
|
|
14
|
+
default: () => getConfig().slider.max
|
|
15
|
+
},
|
|
16
|
+
min: {
|
|
17
|
+
type: [String, Number] as PropType<VxeSliderPropTypes.Min>,
|
|
18
|
+
default: () => getConfig().slider.min
|
|
19
|
+
},
|
|
20
|
+
step: {
|
|
21
|
+
type: [String, Number] as PropType<VxeSliderPropTypes.Step>,
|
|
22
|
+
default: () => getConfig().slider.step
|
|
23
|
+
},
|
|
24
|
+
size: {
|
|
25
|
+
type: String as PropType<VxeSliderPropTypes.Size>,
|
|
26
|
+
default: () => getConfig().slider.size || getConfig().size
|
|
27
|
+
},
|
|
28
|
+
range: {
|
|
29
|
+
type: Boolean as PropType<VxeSliderPropTypes.Range>,
|
|
30
|
+
default: () => getConfig().slider.range
|
|
31
|
+
},
|
|
32
|
+
readonly: {
|
|
33
|
+
type: Boolean as PropType<VxeSliderPropTypes.Readonly>,
|
|
34
|
+
default: null
|
|
35
|
+
},
|
|
36
|
+
disabled: {
|
|
37
|
+
type: Boolean as PropType<VxeSliderPropTypes.Disabled>,
|
|
38
|
+
default: null
|
|
39
|
+
}
|
|
10
40
|
},
|
|
11
41
|
emits: [
|
|
42
|
+
'update:modelValue',
|
|
43
|
+
'change'
|
|
12
44
|
] as VxeSliderEmits,
|
|
13
45
|
setup (props, context) {
|
|
14
46
|
const { emit } = context
|
|
15
47
|
|
|
48
|
+
const $xeForm = inject<VxeFormConstructor & VxeFormPrivateMethods | null>('$xeForm', null)
|
|
49
|
+
const formItemInfo = inject<VxeFormDefines.ProvideItemInfo | null>('xeFormItemInfo', null)
|
|
50
|
+
|
|
16
51
|
const xID = XEUtils.uniqueId()
|
|
17
52
|
|
|
53
|
+
const { computeSize } = useSize(props)
|
|
54
|
+
|
|
18
55
|
const refElem = ref<HTMLDivElement>()
|
|
56
|
+
const refBarElem = ref<HTMLDivElement>()
|
|
57
|
+
const refTrackElem = ref<HTMLDivElement>()
|
|
58
|
+
const refStartBtnElem = ref<HTMLDivElement>()
|
|
59
|
+
const refEndBtnElem = ref<HTMLDivElement>()
|
|
19
60
|
|
|
20
61
|
const reactData = reactive<SliderReactData>({
|
|
62
|
+
startValue: 0,
|
|
63
|
+
endValue: 0
|
|
21
64
|
})
|
|
22
65
|
|
|
23
66
|
const refMaps: SliderPrivateRef = {
|
|
24
67
|
refElem
|
|
25
68
|
}
|
|
26
69
|
|
|
70
|
+
const computeFormReadonly = computed(() => {
|
|
71
|
+
const { readonly } = props
|
|
72
|
+
if (readonly === null) {
|
|
73
|
+
if ($xeForm) {
|
|
74
|
+
return $xeForm.props.readonly
|
|
75
|
+
}
|
|
76
|
+
return false
|
|
77
|
+
}
|
|
78
|
+
return readonly
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
const computeIsDisabled = computed(() => {
|
|
82
|
+
const { disabled } = props
|
|
83
|
+
if (disabled === null) {
|
|
84
|
+
if ($xeForm) {
|
|
85
|
+
return $xeForm.props.disabled
|
|
86
|
+
}
|
|
87
|
+
return false
|
|
88
|
+
}
|
|
89
|
+
return disabled
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
const computeMaxNum = computed(() => {
|
|
93
|
+
return XEUtils.toNumber(props.max || 0)
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
const computeMinNum = computed(() => {
|
|
97
|
+
return XEUtils.toNumber(props.min || 0)
|
|
98
|
+
})
|
|
99
|
+
|
|
27
100
|
const computeMaps: VxeSliderPrivateComputed = {
|
|
28
101
|
}
|
|
29
102
|
|
|
@@ -37,6 +110,10 @@ export default defineComponent({
|
|
|
37
110
|
getComputeMaps: () => computeMaps
|
|
38
111
|
} as unknown as VxeSliderConstructor & VxeSliderPrivateMethods
|
|
39
112
|
|
|
113
|
+
const emitModel = (value: any) => {
|
|
114
|
+
emit('update:modelValue', value)
|
|
115
|
+
}
|
|
116
|
+
|
|
40
117
|
const dispatchEvent = (type: ValueOf<VxeSliderEmits>, params: Record<string, any>, evnt: Event | null) => {
|
|
41
118
|
emit(type, createEvent(evnt, { $slider: $xeSlider }, params))
|
|
42
119
|
}
|
|
@@ -45,18 +122,172 @@ export default defineComponent({
|
|
|
45
122
|
dispatchEvent
|
|
46
123
|
}
|
|
47
124
|
|
|
125
|
+
const getStartPercent = (startValue: number) => {
|
|
126
|
+
const { range } = props
|
|
127
|
+
const maxNum = computeMaxNum.value
|
|
128
|
+
const minNum = computeMinNum.value
|
|
129
|
+
return range ? XEUtils.floor((startValue - minNum) / XEUtils.toNumber(maxNum - minNum) * 100) : 0
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const getEndPercent = (startValue: number, endValue: number) => {
|
|
133
|
+
const { range } = props
|
|
134
|
+
const maxNum = computeMaxNum.value
|
|
135
|
+
const minNum = computeMinNum.value
|
|
136
|
+
return XEUtils.floor((endValue - (range ? startValue : 0) - minNum) / XEUtils.toNumber(maxNum - minNum) * 100)
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const updateModel = () => {
|
|
140
|
+
const { modelValue } = props
|
|
141
|
+
if (XEUtils.isArray(modelValue)) {
|
|
142
|
+
const [sVal, eVal] = XEUtils.clone(modelValue, true).sort()
|
|
143
|
+
reactData.startValue = XEUtils.floor(XEUtils.toNumber(sVal || 0))
|
|
144
|
+
reactData.endValue = XEUtils.floor(XEUtils.toNumber(eVal || 0))
|
|
145
|
+
} else {
|
|
146
|
+
reactData.startValue = 0
|
|
147
|
+
reactData.endValue = XEUtils.floor(XEUtils.toNumber(modelValue || 0))
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const updateBarStyle = () => {
|
|
152
|
+
const { startValue, endValue } = reactData
|
|
153
|
+
const trackElem = refTrackElem.value
|
|
154
|
+
const startBtnElem = refStartBtnElem.value
|
|
155
|
+
const endBtnElem = refEndBtnElem.value
|
|
156
|
+
let startPercent = 0
|
|
157
|
+
let endPercent = 0
|
|
158
|
+
if (startValue > endValue) {
|
|
159
|
+
startPercent = getStartPercent(endValue)
|
|
160
|
+
endPercent = getEndPercent(endValue, startValue)
|
|
161
|
+
} else {
|
|
162
|
+
startPercent = getStartPercent(startValue)
|
|
163
|
+
endPercent = getEndPercent(startValue, endValue)
|
|
164
|
+
}
|
|
165
|
+
if (trackElem) {
|
|
166
|
+
trackElem.style.left = `${startPercent}%`
|
|
167
|
+
trackElem.style.width = `${endPercent}%`
|
|
168
|
+
}
|
|
169
|
+
if (startBtnElem) {
|
|
170
|
+
startBtnElem.style.left = `${startPercent}%`
|
|
171
|
+
}
|
|
172
|
+
if (endBtnElem) {
|
|
173
|
+
endBtnElem.style.left = `${XEUtils.floor(startPercent + endPercent)}%`
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const changeEvent = (evnt: MouseEvent) => {
|
|
178
|
+
const { range } = props
|
|
179
|
+
const { startValue, endValue } = reactData
|
|
180
|
+
const value = range ? [startValue, endValue].sort() : endValue
|
|
181
|
+
emitModel(value)
|
|
182
|
+
dispatchEvent('change', { value }, evnt)
|
|
183
|
+
// 自动更新校验状态
|
|
184
|
+
if ($xeForm && formItemInfo) {
|
|
185
|
+
$xeForm.triggerItemEvent(evnt, formItemInfo.itemConfig.field, value)
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const handleMousedownEvent = (evnt: MouseEvent, isEnd: boolean) => {
|
|
190
|
+
const formReadonly = computeFormReadonly.value
|
|
191
|
+
const isDisabled = computeIsDisabled.value
|
|
192
|
+
const maxNum = computeMaxNum.value
|
|
193
|
+
const minNum = computeMinNum.value
|
|
194
|
+
if (!(formReadonly || isDisabled)) {
|
|
195
|
+
evnt.preventDefault()
|
|
196
|
+
const domMousemove = document.onmousemove
|
|
197
|
+
const domMouseup = document.onmouseup
|
|
198
|
+
document.onmousemove = evnt => {
|
|
199
|
+
evnt.preventDefault()
|
|
200
|
+
const barElem = refBarElem.value
|
|
201
|
+
if (barElem) {
|
|
202
|
+
const barRect = barElem.getBoundingClientRect()
|
|
203
|
+
const trackWidth = (evnt.clientX - barRect.left) / 914
|
|
204
|
+
if (isEnd) {
|
|
205
|
+
reactData.endValue = XEUtils.floor(Math.max(minNum, Math.min(maxNum, trackWidth * (maxNum - minNum) + minNum)))
|
|
206
|
+
} else {
|
|
207
|
+
reactData.startValue = XEUtils.floor(Math.max(minNum, Math.min(maxNum, trackWidth * (maxNum - minNum))))
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
updateBarStyle()
|
|
211
|
+
}
|
|
212
|
+
document.onmouseup = (evnt: MouseEvent) => {
|
|
213
|
+
document.onmousemove = domMousemove
|
|
214
|
+
document.onmouseup = domMouseup
|
|
215
|
+
changeEvent(evnt)
|
|
216
|
+
updateBarStyle()
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
const handleStartMousedownEvent = (evnt: MouseEvent) => {
|
|
222
|
+
const endBtnElem = refEndBtnElem.value
|
|
223
|
+
const startBtnElem = evnt.currentTarget as HTMLDivElement
|
|
224
|
+
handleMousedownEvent(evnt, endBtnElem ? endBtnElem.offsetLeft < startBtnElem.offsetLeft : false)
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
const handleEndMousedownEvent = (evnt: MouseEvent) => {
|
|
228
|
+
const startBtnElem = refStartBtnElem.value
|
|
229
|
+
const endBtnElem = evnt.currentTarget as HTMLDivElement
|
|
230
|
+
handleMousedownEvent(evnt, startBtnElem ? endBtnElem.offsetLeft > startBtnElem.offsetLeft : true)
|
|
231
|
+
}
|
|
232
|
+
|
|
48
233
|
const collapsePanePrivateMethods: SliderPrivateMethods = {
|
|
49
234
|
}
|
|
50
235
|
|
|
51
236
|
Object.assign($xeSlider, collapsePaneMethods, collapsePanePrivateMethods)
|
|
52
237
|
|
|
53
238
|
const renderVN = () => {
|
|
239
|
+
const { vertical, range } = props
|
|
240
|
+
const vSize = computeSize.value
|
|
241
|
+
const formReadonly = computeFormReadonly.value
|
|
242
|
+
const isDisabled = computeIsDisabled.value
|
|
54
243
|
return h('div', {
|
|
55
244
|
ref: refElem,
|
|
56
|
-
class: 'vxe-slider'
|
|
57
|
-
|
|
245
|
+
class: ['vxe-slider', {
|
|
246
|
+
[`size--${vSize}`]: vSize,
|
|
247
|
+
'is--vertical': vertical,
|
|
248
|
+
'is--readonly': formReadonly,
|
|
249
|
+
'is--disabled': isDisabled
|
|
250
|
+
}]
|
|
251
|
+
}, [
|
|
252
|
+
h('div', {
|
|
253
|
+
class: 'vxe-slider--inner'
|
|
254
|
+
}, [
|
|
255
|
+
h('div', {
|
|
256
|
+
ref: refBarElem,
|
|
257
|
+
class: 'vxe-slider--bar-wrapper'
|
|
258
|
+
}),
|
|
259
|
+
h('div', {
|
|
260
|
+
ref: refTrackElem,
|
|
261
|
+
class: 'vxe-slider--bar-track'
|
|
262
|
+
}),
|
|
263
|
+
formReadonly || !range
|
|
264
|
+
? renderEmptyElement($xeSlider)
|
|
265
|
+
: h('div', {
|
|
266
|
+
ref: refStartBtnElem,
|
|
267
|
+
class: 'vxe-slider--bar-btn vxe-slider--start-btn',
|
|
268
|
+
onMousedown: handleStartMousedownEvent
|
|
269
|
+
}),
|
|
270
|
+
formReadonly
|
|
271
|
+
? renderEmptyElement($xeSlider)
|
|
272
|
+
: h('div', {
|
|
273
|
+
ref: refEndBtnElem,
|
|
274
|
+
class: 'vxe-slider--bar-btn vxe-slider--end-btn',
|
|
275
|
+
onMousedown: handleEndMousedownEvent
|
|
276
|
+
})
|
|
277
|
+
])
|
|
278
|
+
])
|
|
58
279
|
}
|
|
59
280
|
|
|
281
|
+
watch(() => props.modelValue, () => {
|
|
282
|
+
updateModel()
|
|
283
|
+
})
|
|
284
|
+
|
|
285
|
+
onMounted(() => {
|
|
286
|
+
updateBarStyle()
|
|
287
|
+
})
|
|
288
|
+
|
|
289
|
+
updateModel()
|
|
290
|
+
|
|
60
291
|
$xeSlider.renderVN = renderVN
|
|
61
292
|
|
|
62
293
|
return $xeSlider
|
|
@@ -33,6 +33,7 @@ export default defineComponent({
|
|
|
33
33
|
emits: [
|
|
34
34
|
'update:modelValue',
|
|
35
35
|
'change',
|
|
36
|
+
'tab-change',
|
|
36
37
|
'tab-change-fail',
|
|
37
38
|
'tab-close',
|
|
38
39
|
'tab-close-fail',
|
|
@@ -209,21 +210,27 @@ export default defineComponent({
|
|
|
209
210
|
const beforeMethod = props.beforeChangeMethod || getConfig().tabs.beforeChangeMethod
|
|
210
211
|
const { activeName } = reactData
|
|
211
212
|
const { name } = item
|
|
213
|
+
const value = name
|
|
214
|
+
dispatchEvent('tab-click', { name }, evnt)
|
|
212
215
|
if (trigger === 'manual') {
|
|
213
|
-
dispatchEvent('tab-click', { name }, evnt)
|
|
214
216
|
return
|
|
215
217
|
}
|
|
216
|
-
const value = name
|
|
217
|
-
reactData.activeName = name
|
|
218
|
-
emit('update:modelValue', value)
|
|
219
|
-
dispatchEvent('tab-click', { name }, evnt)
|
|
220
|
-
addInitName(name, evnt)
|
|
221
218
|
if (name !== activeName) {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
219
|
+
Promise.resolve(
|
|
220
|
+
!beforeMethod || beforeMethod({ $tabs: $xeTabs, name, oldName: activeName, newName: name, option: item })
|
|
221
|
+
).then((status) => {
|
|
222
|
+
if (status) {
|
|
223
|
+
reactData.activeName = name
|
|
224
|
+
emit('update:modelValue', value)
|
|
225
|
+
addInitName(name, evnt)
|
|
226
|
+
dispatchEvent('change', { value, name, oldName: activeName, newName: name, option: item }, evnt)
|
|
227
|
+
dispatchEvent('tab-change', { value, name, oldName: activeName, newName: name, option: item }, evnt)
|
|
228
|
+
} else {
|
|
229
|
+
dispatchEvent('tab-change-fail', { value, name, oldName: activeName, newName: name, option: item }, evnt)
|
|
230
|
+
}
|
|
231
|
+
}).catch(() => {
|
|
225
232
|
dispatchEvent('tab-change-fail', { value, name, oldName: activeName, newName: name, option: item }, evnt)
|
|
226
|
-
}
|
|
233
|
+
})
|
|
227
234
|
}
|
|
228
235
|
}
|
|
229
236
|
|
|
@@ -260,11 +267,17 @@ export default defineComponent({
|
|
|
260
267
|
const nextItem = index < list.length - 1 ? list[index + 1] : list[index - 1]
|
|
261
268
|
nextName = nextItem ? nextItem.name : null
|
|
262
269
|
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
270
|
+
Promise.resolve(
|
|
271
|
+
!beforeMethod || beforeMethod({ $tabs: $xeTabs, value, name, nextName, option: item })
|
|
272
|
+
).then(status => {
|
|
273
|
+
if (status) {
|
|
274
|
+
dispatchEvent('tab-close', { value, name, nextName }, evnt)
|
|
275
|
+
} else {
|
|
276
|
+
dispatchEvent('tab-close-fail', { value, name, nextName }, evnt)
|
|
277
|
+
}
|
|
278
|
+
}).catch(() => {
|
|
266
279
|
dispatchEvent('tab-close-fail', { value, name, nextName }, evnt)
|
|
267
|
-
}
|
|
280
|
+
})
|
|
268
281
|
}
|
|
269
282
|
|
|
270
283
|
const startScrollAnimation = (offsetPos: number, offsetSize: number) => {
|
package/packages/ui/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
$
|
|
1
|
+
$avatarThemeList: (
|
|
2
2
|
(
|
|
3
3
|
name: "primary",
|
|
4
4
|
textColor: var(--vxe-ui-font-primary-color),
|
|
@@ -28,11 +28,6 @@ $btnThemeList: (
|
|
|
28
28
|
name: "error",
|
|
29
29
|
textColor: var(--vxe-ui-status-error-color),
|
|
30
30
|
btnColor: #fff,
|
|
31
|
-
),
|
|
32
|
-
(
|
|
33
|
-
name: "perfect",
|
|
34
|
-
textColor: var(--vxe-ui-table-header-background-color),
|
|
35
|
-
btnColor: var(--vxe-ui-font-color),
|
|
36
31
|
)
|
|
37
32
|
);
|
|
38
33
|
|
|
@@ -64,8 +59,8 @@ $btnThemeList: (
|
|
|
64
59
|
z-index: 1;
|
|
65
60
|
}
|
|
66
61
|
}
|
|
67
|
-
@for $index from 0 to length($
|
|
68
|
-
$item: nth($
|
|
62
|
+
@for $index from 0 to length($avatarThemeList) {
|
|
63
|
+
$item: nth($avatarThemeList, $index + 1);
|
|
69
64
|
$textColor: map-get($item, textColor);
|
|
70
65
|
$btnColor: map-get($item, btnColor);
|
|
71
66
|
&.theme--#{map-get($item, name)} {
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
@import '../helpers/mixin.scss';
|
|
2
|
+
|
|
3
|
+
$sliderThemeList: (
|
|
4
|
+
(
|
|
5
|
+
name: "primary",
|
|
6
|
+
textColor: var(--vxe-ui-font-primary-color),
|
|
7
|
+
hoverColor: var(--vxe-ui-font-primary-lighten-color),
|
|
8
|
+
activeColor: var(--vxe-ui-font-primary-darken-color),
|
|
9
|
+
disabledColor: var(--vxe-ui-font-primary-disabled-color)
|
|
10
|
+
),
|
|
11
|
+
(
|
|
12
|
+
name: "success",
|
|
13
|
+
textColor: var(--vxe-ui-status-success-color),
|
|
14
|
+
hoverColor: var(--vxe-ui-status-success-lighten-color),
|
|
15
|
+
activeColor: var(--vxe-ui-status-success-darken-color),
|
|
16
|
+
disabledColor: var(--vxe-ui-status-success-disabled-color)
|
|
17
|
+
),
|
|
18
|
+
(
|
|
19
|
+
name: "info",
|
|
20
|
+
textColor: var(--vxe-ui-status-info-color),
|
|
21
|
+
hoverColor: var(--vxe-ui-status-info-lighten-color),
|
|
22
|
+
activeColor: var(--vxe-ui-status-info-darken-color),
|
|
23
|
+
disabledColor: var(--vxe-ui-status-info-disabled-color)
|
|
24
|
+
),
|
|
25
|
+
(
|
|
26
|
+
name: "warning",
|
|
27
|
+
textColor: var(--vxe-ui-status-warning-color),
|
|
28
|
+
hoverColor: var(--vxe-ui-status-warning-lighten-color),
|
|
29
|
+
activeColor: var(--vxe-ui-status-warning-darken-color),
|
|
30
|
+
disabledColor: var(--vxe-ui-status-warning-disabled-color)
|
|
31
|
+
),
|
|
32
|
+
(
|
|
33
|
+
name: "danger",
|
|
34
|
+
textColor: var(--vxe-ui-status-danger-color),
|
|
35
|
+
hoverColor: var(--vxe-ui-status-danger-lighten-color),
|
|
36
|
+
activeColor: var(--vxe-ui-status-danger-darken-color),
|
|
37
|
+
disabledColor: var(--vxe-ui-status-danger-disabled-color)
|
|
38
|
+
),
|
|
39
|
+
(
|
|
40
|
+
name: "error",
|
|
41
|
+
textColor: var(--vxe-ui-status-error-color),
|
|
42
|
+
hoverColor: var(--vxe-ui-status-error-lighten-color),
|
|
43
|
+
activeColor: var(--vxe-ui-status-error-darken-color),
|
|
44
|
+
disabledColor: var(--vxe-ui-status-error-disabled-color)
|
|
45
|
+
)
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
.vxe-slider {
|
|
49
|
+
position: relative;
|
|
50
|
+
display: block;
|
|
51
|
+
padding: 0.5em 1em;
|
|
52
|
+
@for $index from 0 to length($sliderThemeList) {
|
|
53
|
+
$item: nth($sliderThemeList, $index + 1);
|
|
54
|
+
&.theme--#{map-get($item, name)} {
|
|
55
|
+
.vxe-slider--bar-track {
|
|
56
|
+
background-color: map-get($item, textColor);
|
|
57
|
+
&:hover {
|
|
58
|
+
background-color: map-get($item, hoverColor);
|
|
59
|
+
}
|
|
60
|
+
&:hover {
|
|
61
|
+
background-color: map-get($item, activeColor);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
.vxe-slider--bar-btn {
|
|
65
|
+
background-color: map-get($item, textColor);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
&.is--disabled {
|
|
70
|
+
.vxe-slider--bar-btn {
|
|
71
|
+
cursor: not-allowed;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
&:not(.is--disabled) {
|
|
75
|
+
.vxe-slider--bar-wrapper,
|
|
76
|
+
.vxe-slider--inner {
|
|
77
|
+
cursor: pointer;
|
|
78
|
+
}
|
|
79
|
+
.vxe-slider--bar-btn {
|
|
80
|
+
&:hover {
|
|
81
|
+
transform: scale(1.2);
|
|
82
|
+
}
|
|
83
|
+
&:active {
|
|
84
|
+
transform: scale(1.1);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
&.is--readonly {
|
|
89
|
+
.vxe-slider--bar-wrapper,
|
|
90
|
+
.vxe-slider--inner {
|
|
91
|
+
cursor: default;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
.vxe-slider--inner {
|
|
96
|
+
position: relative;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.vxe-slider--bar-wrapper {
|
|
100
|
+
background-color: #e4e7ed;
|
|
101
|
+
}
|
|
102
|
+
.vxe-slider--bar-track {
|
|
103
|
+
position: absolute;
|
|
104
|
+
left: 0;
|
|
105
|
+
top: 0;
|
|
106
|
+
z-index: 1;
|
|
107
|
+
background-color: var(--vxe-ui-font-primary-color);
|
|
108
|
+
&:hover {
|
|
109
|
+
background-color: var(--vxe-ui-font-primary-lighten-color);
|
|
110
|
+
}
|
|
111
|
+
&:active {
|
|
112
|
+
background-color: var(--vxe-ui-font-primary-darken-color);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
.vxe-slider--bar-wrapper,
|
|
116
|
+
.vxe-slider--bar-track {
|
|
117
|
+
height: 0.3em;
|
|
118
|
+
border-radius: var(--vxe-ui-base-border-radius);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.vxe-slider--bar-btn {
|
|
122
|
+
position: absolute;
|
|
123
|
+
width: 0.9em;
|
|
124
|
+
height: 0.9em;
|
|
125
|
+
top: -0.3em;
|
|
126
|
+
border-radius: 50%;
|
|
127
|
+
border: 0.15em solid var(--vxe-ui-font-primary-color);
|
|
128
|
+
background-color: #fff;
|
|
129
|
+
cursor: pointer;
|
|
130
|
+
z-index: 1;
|
|
131
|
+
@include createAnimationTransition(transform, 0.1s);
|
|
132
|
+
}
|
|
133
|
+
.vxe-slider--start-btn {
|
|
134
|
+
left: -0.45em;
|
|
135
|
+
}
|
|
136
|
+
.vxe-slider--end-btn {
|
|
137
|
+
right: -0.45em;
|
|
138
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RenderFunction, SetupContext, Ref } from 'vue'
|
|
2
|
-
import { DefineVxeComponentApp, DefineVxeComponentOptions, DefineVxeComponentInstance, VxeComponentBaseOptions, VxeComponentEventParams } from '@vxe-ui/core'
|
|
2
|
+
import { DefineVxeComponentApp, DefineVxeComponentOptions, DefineVxeComponentInstance, VxeComponentStatusType, VxeComponentSizeType, VxeComponentBaseOptions, VxeComponentEventParams } from '@vxe-ui/core'
|
|
3
3
|
|
|
4
4
|
/* eslint-disable no-use-before-define,@typescript-eslint/ban-types */
|
|
5
5
|
|
|
@@ -23,9 +23,29 @@ export interface SliderPrivateRef {
|
|
|
23
23
|
export interface VxeSliderPrivateRef extends SliderPrivateRef { }
|
|
24
24
|
|
|
25
25
|
export namespace VxeSliderPropTypes {
|
|
26
|
+
export type Size = VxeComponentSizeType
|
|
27
|
+
export type ModelValue = number | string | null | (number | string | null)[]
|
|
28
|
+
export type Max = number | string
|
|
29
|
+
export type Min = number | string
|
|
30
|
+
export type Vertical = boolean
|
|
31
|
+
export type Range = boolean
|
|
32
|
+
export type Status = VxeComponentStatusType
|
|
33
|
+
export type Step = number | string
|
|
34
|
+
export type Readonly = boolean
|
|
35
|
+
export type Disabled = boolean
|
|
26
36
|
}
|
|
27
37
|
|
|
28
38
|
export interface VxeSliderProps {
|
|
39
|
+
size?: VxeSliderPropTypes.Size
|
|
40
|
+
modelValue?: VxeSliderPropTypes.ModelValue
|
|
41
|
+
max?: VxeSliderPropTypes.Max
|
|
42
|
+
min?: VxeSliderPropTypes.Min
|
|
43
|
+
vertical?: VxeSliderPropTypes.Vertical
|
|
44
|
+
range?: VxeSliderPropTypes.Range
|
|
45
|
+
status?: VxeSliderPropTypes.Status
|
|
46
|
+
step?: VxeSliderPropTypes.Step
|
|
47
|
+
readonly?: VxeSliderPropTypes.Readonly
|
|
48
|
+
disabled?: VxeSliderPropTypes.Disabled
|
|
29
49
|
}
|
|
30
50
|
|
|
31
51
|
export interface SliderPrivateComputed {
|
|
@@ -33,6 +53,8 @@ export interface SliderPrivateComputed {
|
|
|
33
53
|
export interface VxeSliderPrivateComputed extends SliderPrivateComputed { }
|
|
34
54
|
|
|
35
55
|
export interface SliderReactData {
|
|
56
|
+
startValue: number
|
|
57
|
+
endValue: number
|
|
36
58
|
}
|
|
37
59
|
|
|
38
60
|
export interface SliderMethods {
|
|
@@ -42,7 +64,10 @@ export interface VxeSliderMethods extends SliderMethods { }
|
|
|
42
64
|
export interface SliderPrivateMethods { }
|
|
43
65
|
export interface VxeSliderPrivateMethods extends SliderPrivateMethods { }
|
|
44
66
|
|
|
45
|
-
export type VxeSliderEmits = [
|
|
67
|
+
export type VxeSliderEmits = [
|
|
68
|
+
'update:modelValue',
|
|
69
|
+
'change'
|
|
70
|
+
]
|
|
46
71
|
|
|
47
72
|
export namespace VxeSliderDefines {
|
|
48
73
|
export interface SliderEventParams extends VxeComponentEventParams {
|
|
@@ -25,7 +25,7 @@ export interface VxeSwitchPrivateRef extends SwitchPrivateRef { }
|
|
|
25
25
|
|
|
26
26
|
export namespace VxeSwitchPropTypes {
|
|
27
27
|
export type Size = VxeComponentSizeType
|
|
28
|
-
export type ModelValue = string | number | boolean
|
|
28
|
+
export type ModelValue = string | number | boolean | null
|
|
29
29
|
export type Disabled = boolean
|
|
30
30
|
export type Readonly = boolean
|
|
31
31
|
export type OpenLabel = string
|
|
@@ -40,7 +40,7 @@ export namespace VxeTabsPropTypes {
|
|
|
40
40
|
oldName: VxeTabsPropTypes.ModelValue
|
|
41
41
|
newName: VxeTabsPropTypes.ModelValue
|
|
42
42
|
option: Omit<VxeTabPaneProps, 'slots'>
|
|
43
|
-
}) => boolean
|
|
43
|
+
}) => boolean | Promise<boolean>
|
|
44
44
|
/**
|
|
45
45
|
* 请使用 closeConfig.beforeMethod
|
|
46
46
|
* @deprecated
|
|
@@ -67,7 +67,7 @@ export namespace VxeTabsPropTypes {
|
|
|
67
67
|
name: VxeTabsPropTypes.ModelValue
|
|
68
68
|
nextName: VxeTabsPropTypes.ModelValue | null
|
|
69
69
|
option: Omit<VxeTabPaneProps, 'slots'>
|
|
70
|
-
}) => boolean
|
|
70
|
+
}) => boolean | Promise<boolean>
|
|
71
71
|
/**
|
|
72
72
|
* 显示关闭按钮方法,该方法的返回值用来决定当前页签的关闭按钮是否显示
|
|
73
73
|
* @returns boolean
|
|
@@ -188,6 +188,7 @@ export interface VxeTabsPrivateMethods extends TabsPrivateMethods { }
|
|
|
188
188
|
export type VxeTabsEmits = [
|
|
189
189
|
'update:modelValue',
|
|
190
190
|
'change',
|
|
191
|
+
'tab-change',
|
|
191
192
|
'tab-change-fail',
|
|
192
193
|
'tab-close',
|
|
193
194
|
'tab-close-fail',
|
|
@@ -207,6 +208,8 @@ export namespace VxeTabsDefines {
|
|
|
207
208
|
newName: VxeTabsPropTypes.ModelValue
|
|
208
209
|
}
|
|
209
210
|
|
|
211
|
+
export interface TabChangeEventParams extends ChangeEventParams {}
|
|
212
|
+
|
|
210
213
|
export interface TabChangeFailEventParams extends TabsEventParams {
|
|
211
214
|
value: VxeTabsPropTypes.ModelValue
|
|
212
215
|
name: VxeTabsPropTypes.ModelValue
|
|
@@ -234,6 +237,7 @@ export namespace VxeTabsDefines {
|
|
|
234
237
|
|
|
235
238
|
export type VxeTabsEventProps = {
|
|
236
239
|
onChange?: VxeTabsEvents.Change
|
|
240
|
+
onTabChange?: VxeTabsEvents.TabChange
|
|
237
241
|
onTabChangeFail?: VxeTabsEvents.TabChangeFail
|
|
238
242
|
onTabClose?: VxeTabsEvents.TabClose
|
|
239
243
|
onTabCloseFail?: VxeTabsEvents.TabCloseFail
|
|
@@ -243,6 +247,7 @@ export type VxeTabsEventProps = {
|
|
|
243
247
|
|
|
244
248
|
export interface VxeTabsListeners {
|
|
245
249
|
change?: VxeTabsEvents.Change
|
|
250
|
+
tabChange?: VxeTabsEvents.TabChange
|
|
246
251
|
tabChangeFail?: VxeTabsEvents.TabChangeFail
|
|
247
252
|
tabClose?: VxeTabsEvents.TabClose
|
|
248
253
|
tabCloseFail?: VxeTabsEvents.TabCloseFail
|
|
@@ -252,6 +257,7 @@ export interface VxeTabsListeners {
|
|
|
252
257
|
|
|
253
258
|
export namespace VxeTabsEvents {
|
|
254
259
|
export type Change = (params: VxeTabsDefines.ChangeEventParams) => void
|
|
260
|
+
export type TabChange = (params: VxeTabsDefines.TabChangeEventParams) => void
|
|
255
261
|
export type TabChangeFail = (params: VxeTabsDefines.TabChangeFailEventParams) => void
|
|
256
262
|
export type TabClose = (params: VxeTabsDefines.TabCloseEventParams) => void
|
|
257
263
|
export type TabCloseFail = (params: VxeTabsDefines.TabCloseFailEventParams) => void
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|