vxe-pc-ui 4.17.19 → 4.17.21
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/dist/all.esm.js +492 -191
- package/dist/style.css +1 -1
- package/dist/style.min.css +1 -1
- package/es/avatar/src/avatar.js +3 -3
- package/es/badge/src/badge.js +3 -3
- package/es/components.js +31 -1
- package/es/empty/src/empty.js +3 -3
- package/es/icon/style.css +1 -1
- package/es/rate/src/rate.js +3 -3
- package/es/result/src/result.js +3 -3
- package/es/slider/src/slider.js +191 -71
- package/es/slider/style.css +8 -15
- package/es/slider/style.min.css +1 -1
- package/es/space/index.js +12 -0
- package/es/space/src/space.js +143 -0
- package/es/space/style.css +37 -0
- package/es/space/style.min.css +1 -0
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/ui/index.js +2 -1
- package/es/ui/src/dom.js +3 -0
- package/es/ui/src/log.js +1 -1
- package/es/vxe-slider/style.css +8 -15
- package/es/vxe-slider/style.min.css +1 -1
- package/es/vxe-space/index.js +3 -0
- package/es/vxe-space/style.css +37 -0
- package/es/vxe-space/style.min.css +1 -0
- package/es/watermark/src/watermark.js +3 -3
- package/lib/avatar/src/avatar.js +3 -3
- package/lib/badge/src/badge.js +3 -3
- package/lib/components.js +41 -2
- package/lib/components.min.js +1 -1
- package/lib/empty/src/empty.js +3 -3
- package/lib/icon/style/style.css +1 -1
- package/lib/icon/style/style.min.css +1 -1
- package/lib/index.umd.js +432 -99
- package/lib/index.umd.min.js +1 -1
- package/lib/rate/src/rate.js +3 -3
- package/lib/result/src/result.js +3 -3
- package/lib/slider/src/slider.js +196 -77
- package/lib/slider/src/slider.min.js +1 -1
- package/lib/slider/style/style.css +8 -15
- package/lib/slider/style/style.min.css +1 -1
- package/lib/space/index.js +19 -0
- package/lib/space/index.min.js +1 -0
- package/lib/space/src/space.js +167 -0
- package/lib/space/src/space.min.js +1 -0
- package/lib/space/style/index.js +1 -0
- package/lib/space/style/style.css +37 -0
- package/lib/space/style/style.min.css +1 -0
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/ui/index.js +2 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/dom.js +4 -0
- package/lib/ui/src/dom.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/vxe-slider/style/style.css +8 -15
- package/lib/vxe-slider/style/style.min.css +1 -1
- package/lib/vxe-space/index.js +21 -0
- package/lib/vxe-space/index.min.js +1 -0
- package/lib/vxe-space/style/index.js +1 -0
- package/lib/vxe-space/style/style.css +37 -0
- package/lib/vxe-space/style/style.min.css +1 -0
- package/lib/watermark/src/watermark.js +3 -3
- package/package.json +4 -3
- package/packages/avatar/src/avatar.ts +3 -3
- package/packages/badge/src/badge.ts +3 -3
- package/packages/components.ts +31 -1
- package/packages/empty/src/empty.ts +3 -3
- package/packages/rate/src/rate.ts +3 -3
- package/packages/result/src/result.ts +3 -3
- package/packages/slider/src/slider.ts +194 -73
- package/packages/space/index.ts +16 -0
- package/packages/space/src/space.ts +167 -0
- package/packages/ui/index.ts +1 -0
- package/packages/ui/src/dom.ts +4 -0
- package/packages/watermark/src/watermark.ts +3 -3
- package/styles/all.scss +1 -0
- package/styles/components/slider.scss +8 -13
- package/styles/components/space.scss +38 -0
- package/styles/theme/base.scss +20 -6
- package/types/all.d.ts +3 -0
- package/types/components/slider.d.ts +13 -0
- package/types/components/space.d.ts +112 -0
- package/types/ui/global-config.d.ts +2 -0
- /package/es/icon/{iconfont.1787739841308.ttf → iconfont.1787994747472.ttf} +0 -0
- /package/es/icon/{iconfont.1787739841308.woff → iconfont.1787994747472.woff} +0 -0
- /package/es/icon/{iconfont.1787739841308.woff2 → iconfont.1787994747472.woff2} +0 -0
- /package/es/{iconfont.1787739841308.ttf → iconfont.1787994747472.ttf} +0 -0
- /package/es/{iconfont.1787739841308.woff → iconfont.1787994747472.woff} +0 -0
- /package/es/{iconfont.1787739841308.woff2 → iconfont.1787994747472.woff2} +0 -0
- /package/lib/icon/style/{iconfont.1787739841308.ttf → iconfont.1787994747472.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1787739841308.woff → iconfont.1787994747472.woff} +0 -0
- /package/lib/icon/style/{iconfont.1787739841308.woff2 → iconfont.1787994747472.woff2} +0 -0
- /package/lib/{iconfont.1787739841308.ttf → iconfont.1787994747472.ttf} +0 -0
- /package/lib/{iconfont.1787739841308.woff → iconfont.1787994747472.woff} +0 -0
- /package/lib/{iconfont.1787739841308.woff2 → iconfont.1787994747472.woff2} +0 -0
package/es/slider/src/slider.js
CHANGED
|
@@ -1,11 +1,24 @@
|
|
|
1
|
-
import { ref, h, reactive, watch, computed, inject, onMounted } from 'vue';
|
|
1
|
+
import { ref, h, reactive, watch, computed, inject, onMounted, onBeforeUnmount } from 'vue';
|
|
2
2
|
import { defineVxeComponent } from '../../ui/src/comp';
|
|
3
3
|
import XEUtils from 'xe-utils';
|
|
4
4
|
import { getConfig, createEvent, renderEmptyElement, useSize } from '../../ui';
|
|
5
|
+
function createInternalData() {
|
|
6
|
+
return {
|
|
7
|
+
// _isUp: false,
|
|
8
|
+
currValue: 0,
|
|
9
|
+
startValue: 0,
|
|
10
|
+
endValue: 0
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
function createReactData() {
|
|
14
|
+
return {};
|
|
15
|
+
}
|
|
5
16
|
export default defineVxeComponent({
|
|
6
17
|
name: 'VxeSlider',
|
|
7
18
|
props: {
|
|
8
19
|
modelValue: [String, Number, Array],
|
|
20
|
+
startValue: [String, Number],
|
|
21
|
+
endValue: [String, Number],
|
|
9
22
|
vertical: Boolean,
|
|
10
23
|
max: {
|
|
11
24
|
type: [String, Number],
|
|
@@ -34,10 +47,16 @@ export default defineVxeComponent({
|
|
|
34
47
|
disabled: {
|
|
35
48
|
type: Boolean,
|
|
36
49
|
default: null
|
|
50
|
+
},
|
|
51
|
+
immediate: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: () => getConfig().slider.immediate
|
|
37
54
|
}
|
|
38
55
|
},
|
|
39
56
|
emits: [
|
|
40
57
|
'update:modelValue',
|
|
58
|
+
'update:startValue',
|
|
59
|
+
'update:endValue',
|
|
41
60
|
'change',
|
|
42
61
|
'track-dragstart',
|
|
43
62
|
'track-dragover',
|
|
@@ -54,10 +73,8 @@ export default defineVxeComponent({
|
|
|
54
73
|
const refTrackElem = ref();
|
|
55
74
|
const refStartBtnElem = ref();
|
|
56
75
|
const refEndBtnElem = ref();
|
|
57
|
-
const reactData = reactive(
|
|
58
|
-
|
|
59
|
-
endValue: 0
|
|
60
|
-
});
|
|
76
|
+
const reactData = reactive(createReactData());
|
|
77
|
+
const internalData = createInternalData();
|
|
61
78
|
const refMaps = {
|
|
62
79
|
refElem
|
|
63
80
|
};
|
|
@@ -87,6 +104,10 @@ export default defineVxeComponent({
|
|
|
87
104
|
const computeMinNum = computed(() => {
|
|
88
105
|
return XEUtils.toNumber(props.min || 0);
|
|
89
106
|
});
|
|
107
|
+
const computeMVal = computed(() => {
|
|
108
|
+
const { range, startValue, endValue } = props;
|
|
109
|
+
return range ? `${startValue || ''}${endValue || ''}` : '';
|
|
110
|
+
});
|
|
90
111
|
const computeMaps = {};
|
|
91
112
|
const $xeSlider = {
|
|
92
113
|
xID,
|
|
@@ -97,6 +118,7 @@ export default defineVxeComponent({
|
|
|
97
118
|
getComputeMaps: () => computeMaps
|
|
98
119
|
};
|
|
99
120
|
const emitModel = (value) => {
|
|
121
|
+
internalData._isUp = true;
|
|
100
122
|
emit('update:modelValue', value);
|
|
101
123
|
};
|
|
102
124
|
const dispatchEvent = (type, params, evnt) => {
|
|
@@ -105,72 +127,144 @@ export default defineVxeComponent({
|
|
|
105
127
|
const collapsePaneMethods = {
|
|
106
128
|
dispatchEvent
|
|
107
129
|
};
|
|
108
|
-
const
|
|
109
|
-
const { range } = props;
|
|
130
|
+
const getBarPercent = (currValue) => {
|
|
110
131
|
const maxNum = computeMaxNum.value;
|
|
111
132
|
const minNum = computeMinNum.value;
|
|
112
|
-
|
|
133
|
+
if (maxNum === minNum) {
|
|
134
|
+
return 0;
|
|
135
|
+
}
|
|
136
|
+
if (currValue < minNum) {
|
|
137
|
+
currValue = minNum;
|
|
138
|
+
}
|
|
139
|
+
if (currValue > maxNum) {
|
|
140
|
+
currValue = maxNum;
|
|
141
|
+
}
|
|
142
|
+
return ((currValue - minNum) / (maxNum - minNum)) * 100;
|
|
113
143
|
};
|
|
114
|
-
const
|
|
115
|
-
const
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
144
|
+
const parseFields = (startValue, endValue) => {
|
|
145
|
+
const [sVal, eVal] = XEUtils.orderBy([XEUtils.toNumber(startValue), XEUtils.toNumber(endValue)]);
|
|
146
|
+
const currValue = XEUtils.floor(XEUtils.toNumber(sVal || 0));
|
|
147
|
+
internalData.currValue = currValue;
|
|
148
|
+
internalData.startValue = currValue;
|
|
149
|
+
internalData.endValue = XEUtils.floor(XEUtils.toNumber(eVal || 0));
|
|
119
150
|
};
|
|
120
|
-
const
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
151
|
+
const parseArrs = (arrVals) => {
|
|
152
|
+
const [sVal, eVal] = XEUtils.orderBy(arrVals);
|
|
153
|
+
const currValue = XEUtils.floor(XEUtils.toNumber(sVal || 0));
|
|
154
|
+
internalData.currValue = currValue;
|
|
155
|
+
internalData.startValue = currValue;
|
|
156
|
+
internalData.endValue = XEUtils.floor(XEUtils.toNumber(eVal || 0));
|
|
157
|
+
};
|
|
158
|
+
const parseNum = (val) => {
|
|
159
|
+
const currValue = XEUtils.floor(XEUtils.toNumber(val || 0));
|
|
160
|
+
internalData.currValue = currValue;
|
|
161
|
+
internalData.startValue = 0;
|
|
162
|
+
internalData.endValue = currValue;
|
|
163
|
+
};
|
|
164
|
+
const updateModelValue = (umType) => {
|
|
165
|
+
const { range, modelValue, startValue, endValue } = props;
|
|
166
|
+
if (!umType) {
|
|
167
|
+
if (range) {
|
|
168
|
+
if (XEUtils.eqNull(modelValue)) {
|
|
169
|
+
if (startValue || endValue) {
|
|
170
|
+
parseFields(startValue, endValue);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
if (XEUtils.isArray(modelValue)) {
|
|
175
|
+
parseArrs(modelValue.map(num => XEUtils.toNumber(num)));
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
parseNum(modelValue);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
parseNum(modelValue);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
else if (range && umType === 2) {
|
|
187
|
+
parseFields(startValue, endValue);
|
|
126
188
|
}
|
|
127
189
|
else {
|
|
128
|
-
|
|
129
|
-
|
|
190
|
+
if (XEUtils.isArray(modelValue)) {
|
|
191
|
+
parseArrs(modelValue.map(num => XEUtils.toNumber(num)));
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
parseNum(modelValue);
|
|
195
|
+
}
|
|
130
196
|
}
|
|
197
|
+
updateBarStyle();
|
|
198
|
+
updateTrackStyle();
|
|
131
199
|
};
|
|
132
200
|
const updateBarStyle = () => {
|
|
133
|
-
const {
|
|
134
|
-
const
|
|
201
|
+
const { range } = props;
|
|
202
|
+
const { currValue, startValue, endValue } = internalData;
|
|
135
203
|
const startBtnElem = refStartBtnElem.value;
|
|
136
204
|
const endBtnElem = refEndBtnElem.value;
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
205
|
+
if (range) {
|
|
206
|
+
const [sVal, eVal] = XEUtils.orderBy([startValue, endValue]);
|
|
207
|
+
if (startBtnElem) {
|
|
208
|
+
startBtnElem.style.left = getBarPercent(sVal) + '%';
|
|
209
|
+
}
|
|
210
|
+
if (endBtnElem) {
|
|
211
|
+
endBtnElem.style.left = getBarPercent(eVal) + '%';
|
|
212
|
+
}
|
|
142
213
|
}
|
|
143
214
|
else {
|
|
144
|
-
|
|
145
|
-
|
|
215
|
+
if (endBtnElem) {
|
|
216
|
+
endBtnElem.style.left = getBarPercent(currValue) + '%';
|
|
217
|
+
}
|
|
146
218
|
}
|
|
219
|
+
};
|
|
220
|
+
const updateTrackStyle = () => {
|
|
221
|
+
const { range } = props;
|
|
222
|
+
const { currValue, startValue, endValue } = internalData;
|
|
223
|
+
const trackElem = refTrackElem.value;
|
|
147
224
|
if (trackElem) {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
225
|
+
if (range) {
|
|
226
|
+
const [sVal, eVal] = XEUtils.orderBy([startValue, endValue]);
|
|
227
|
+
trackElem.style.left = getBarPercent(sVal) + '%';
|
|
228
|
+
trackElem.style.width = getBarPercent(eVal - sVal) + '%';
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
trackElem.style.left = '0';
|
|
232
|
+
trackElem.style.width = getBarPercent(currValue) + '%';
|
|
233
|
+
}
|
|
156
234
|
}
|
|
157
235
|
};
|
|
158
236
|
const changeEvent = (evnt) => {
|
|
159
237
|
const { range } = props;
|
|
160
|
-
const { startValue, endValue } =
|
|
161
|
-
const
|
|
238
|
+
const { currValue, startValue, endValue } = internalData;
|
|
239
|
+
const vals = range ? XEUtils.orderBy([startValue, endValue]) : [];
|
|
240
|
+
const value = range ? vals : currValue;
|
|
162
241
|
emitModel(value);
|
|
242
|
+
if (range) {
|
|
243
|
+
emit('update:startValue', vals[0] || 0);
|
|
244
|
+
emit('update:endValue', vals[1] || 0);
|
|
245
|
+
}
|
|
163
246
|
dispatchEvent('change', { value }, evnt);
|
|
164
247
|
// 自动更新校验状态
|
|
165
248
|
if ($xeForm && formItemInfo) {
|
|
166
249
|
$xeForm.triggerItemEvent(evnt, formItemInfo.itemConfig.field, value);
|
|
167
250
|
}
|
|
168
251
|
};
|
|
169
|
-
const
|
|
170
|
-
const formReadonly = computeFormReadonly.value;
|
|
171
|
-
const isDisabled = computeIsDisabled.value;
|
|
252
|
+
const getValueByLeft = (offsetLeft, barWidth) => {
|
|
172
253
|
const maxNum = computeMaxNum.value;
|
|
173
254
|
const minNum = computeMinNum.value;
|
|
255
|
+
if (barWidth === 0) {
|
|
256
|
+
return minNum;
|
|
257
|
+
}
|
|
258
|
+
const clamped = Math.max(0, Math.min(barWidth, offsetLeft));
|
|
259
|
+
const ratio = clamped / barWidth;
|
|
260
|
+
const raw = minNum + ratio * (maxNum - minNum);
|
|
261
|
+
return Math.floor(raw);
|
|
262
|
+
};
|
|
263
|
+
const handleBtnMousedownEvent = (evnt) => {
|
|
264
|
+
const { range, immediate } = props;
|
|
265
|
+
const btnElem = evnt.currentTarget;
|
|
266
|
+
const formReadonly = computeFormReadonly.value;
|
|
267
|
+
const isDisabled = computeIsDisabled.value;
|
|
174
268
|
if (!(formReadonly || isDisabled)) {
|
|
175
269
|
evnt.preventDefault();
|
|
176
270
|
document.onmousemove = evnt => {
|
|
@@ -178,38 +272,50 @@ export default defineVxeComponent({
|
|
|
178
272
|
const el = refElem.value;
|
|
179
273
|
const barElem = refBarElem.value;
|
|
180
274
|
if (el && barElem) {
|
|
275
|
+
const btnType = btnElem.getAttribute('data-type');
|
|
181
276
|
const barRect = barElem.getBoundingClientRect();
|
|
182
|
-
const
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
277
|
+
const barWidth = barRect.width;
|
|
278
|
+
const offsetLeft = Math.min(barWidth, Math.max(0, evnt.clientX - barRect.left));
|
|
279
|
+
const currValue = getValueByLeft(offsetLeft, barWidth);
|
|
280
|
+
if (range) {
|
|
281
|
+
if (btnType === '1') {
|
|
282
|
+
internalData.startValue = currValue;
|
|
283
|
+
}
|
|
284
|
+
else {
|
|
285
|
+
internalData.endValue = currValue;
|
|
286
|
+
}
|
|
188
287
|
}
|
|
189
|
-
|
|
288
|
+
internalData.currValue = currValue;
|
|
289
|
+
btnElem.style.left = getBarPercent(currValue) + '%';
|
|
290
|
+
dispatchEvent('track-dragover', {
|
|
291
|
+
currentValue: internalData.currValue,
|
|
292
|
+
startValue: internalData.startValue,
|
|
293
|
+
endValue: internalData.endValue
|
|
294
|
+
}, evnt);
|
|
190
295
|
}
|
|
191
|
-
|
|
296
|
+
if (immediate) {
|
|
297
|
+
changeEvent(evnt);
|
|
298
|
+
}
|
|
299
|
+
updateTrackStyle();
|
|
192
300
|
};
|
|
193
301
|
document.onmouseup = (evnt) => {
|
|
194
302
|
document.onmousemove = null;
|
|
195
303
|
document.onmouseup = null;
|
|
196
|
-
dispatchEvent('track-dragend', {
|
|
304
|
+
dispatchEvent('track-dragend', {
|
|
305
|
+
currentValue: internalData.currValue,
|
|
306
|
+
startValue: internalData.startValue,
|
|
307
|
+
endValue: internalData.endValue
|
|
308
|
+
}, evnt);
|
|
197
309
|
changeEvent(evnt);
|
|
198
|
-
|
|
310
|
+
updateTrackStyle();
|
|
199
311
|
};
|
|
200
|
-
dispatchEvent('track-dragstart', {
|
|
312
|
+
dispatchEvent('track-dragstart', {
|
|
313
|
+
currentValue: internalData.currValue,
|
|
314
|
+
startValue: internalData.startValue,
|
|
315
|
+
endValue: internalData.endValue
|
|
316
|
+
}, evnt);
|
|
201
317
|
}
|
|
202
318
|
};
|
|
203
|
-
const handleStartMousedownEvent = (evnt) => {
|
|
204
|
-
const endBtnElem = refEndBtnElem.value;
|
|
205
|
-
const startBtnElem = evnt.currentTarget;
|
|
206
|
-
handleMousedownEvent(evnt, endBtnElem ? endBtnElem.offsetLeft < startBtnElem.offsetLeft : false);
|
|
207
|
-
};
|
|
208
|
-
const handleEndMousedownEvent = (evnt) => {
|
|
209
|
-
const startBtnElem = refStartBtnElem.value;
|
|
210
|
-
const endBtnElem = evnt.currentTarget;
|
|
211
|
-
handleMousedownEvent(evnt, startBtnElem ? endBtnElem.offsetLeft > startBtnElem.offsetLeft : true);
|
|
212
|
-
};
|
|
213
319
|
const collapsePanePrivateMethods = {};
|
|
214
320
|
Object.assign($xeSlider, collapsePaneMethods, collapsePanePrivateMethods);
|
|
215
321
|
const renderVN = () => {
|
|
@@ -241,26 +347,40 @@ export default defineVxeComponent({
|
|
|
241
347
|
? renderEmptyElement($xeSlider)
|
|
242
348
|
: h('div', {
|
|
243
349
|
ref: refStartBtnElem,
|
|
244
|
-
class: 'vxe-slider--bar-btn
|
|
245
|
-
|
|
350
|
+
class: 'vxe-slider--bar-btn',
|
|
351
|
+
'data-type': '1',
|
|
352
|
+
onMousedown: handleBtnMousedownEvent
|
|
246
353
|
}),
|
|
247
354
|
formReadonly
|
|
248
355
|
? renderEmptyElement($xeSlider)
|
|
249
356
|
: h('div', {
|
|
250
357
|
ref: refEndBtnElem,
|
|
251
|
-
class: 'vxe-slider--bar-btn
|
|
252
|
-
|
|
358
|
+
class: 'vxe-slider--bar-btn',
|
|
359
|
+
'data-type': '2',
|
|
360
|
+
onMousedown: handleBtnMousedownEvent
|
|
253
361
|
})
|
|
254
362
|
])
|
|
255
363
|
]);
|
|
256
364
|
};
|
|
257
365
|
watch(() => props.modelValue, () => {
|
|
258
|
-
|
|
366
|
+
if (!internalData._isUp) {
|
|
367
|
+
updateModelValue(1);
|
|
368
|
+
}
|
|
369
|
+
internalData._isUp = false;
|
|
370
|
+
});
|
|
371
|
+
watch(computeMVal, () => {
|
|
372
|
+
if (!internalData._isUp) {
|
|
373
|
+
updateModelValue(2);
|
|
374
|
+
}
|
|
375
|
+
internalData._isUp = false;
|
|
259
376
|
});
|
|
260
377
|
onMounted(() => {
|
|
261
|
-
|
|
378
|
+
updateModelValue();
|
|
379
|
+
});
|
|
380
|
+
onBeforeUnmount(() => {
|
|
381
|
+
XEUtils.assign(reactData, createReactData());
|
|
382
|
+
XEUtils.assign(internalData, createInternalData());
|
|
262
383
|
});
|
|
263
|
-
updateModel();
|
|
264
384
|
$xeSlider.renderVN = renderVN;
|
|
265
385
|
return $xeSlider;
|
|
266
386
|
},
|
package/es/slider/style.css
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
.vxe-slider {
|
|
2
2
|
position: relative;
|
|
3
3
|
display: block;
|
|
4
|
-
padding: 0.
|
|
4
|
+
padding: 0.8em;
|
|
5
5
|
}
|
|
6
6
|
.vxe-slider.theme--primary .vxe-slider--bar-track {
|
|
7
7
|
background-color: var(--vxe-ui-font-primary-color);
|
|
@@ -83,10 +83,10 @@
|
|
|
83
83
|
cursor: pointer;
|
|
84
84
|
}
|
|
85
85
|
.vxe-slider:not(.is--disabled) .vxe-slider--bar-btn:hover {
|
|
86
|
-
transform: scale(1.2);
|
|
86
|
+
transform: translate(-50%, -50%) scale(1.2);
|
|
87
87
|
}
|
|
88
88
|
.vxe-slider:not(.is--disabled) .vxe-slider--bar-btn:active {
|
|
89
|
-
transform: scale(1.1);
|
|
89
|
+
transform: translate(-50%, -50%) scale(1.1);
|
|
90
90
|
}
|
|
91
91
|
.vxe-slider.is--readonly .vxe-slider--bar-wrapper,
|
|
92
92
|
.vxe-slider.is--readonly .vxe-slider--inner {
|
|
@@ -123,21 +123,14 @@
|
|
|
123
123
|
|
|
124
124
|
.vxe-slider--bar-btn {
|
|
125
125
|
position: absolute;
|
|
126
|
-
width:
|
|
127
|
-
height:
|
|
128
|
-
top:
|
|
126
|
+
width: 1.2em;
|
|
127
|
+
height: 1.2em;
|
|
128
|
+
top: 50%;
|
|
129
|
+
transform: translate(-50%, -50%);
|
|
129
130
|
border-radius: 50%;
|
|
130
|
-
border:
|
|
131
|
+
border: 2px solid var(--vxe-ui-font-primary-color);
|
|
131
132
|
background-color: #fff;
|
|
132
133
|
cursor: pointer;
|
|
133
134
|
z-index: 1;
|
|
134
135
|
transition: transform 0.1s ease-in-out;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
.vxe-slider--start-btn {
|
|
138
|
-
left: -0.45em;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
.vxe-slider--end-btn {
|
|
142
|
-
right: -0.45em;
|
|
143
136
|
}
|
package/es/slider/style.min.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.vxe-slider{position:relative;display:block;padding:.
|
|
1
|
+
.vxe-slider{position:relative;display:block;padding:.8em}.vxe-slider.theme--primary .vxe-slider--bar-track{background-color:var(--vxe-ui-font-primary-color)}.vxe-slider.theme--primary .vxe-slider--bar-track:hover{background-color:var(--vxe-ui-font-primary-lighten-color)}.vxe-slider.theme--primary .vxe-slider--bar-track:hover{background-color:var(--vxe-ui-font-primary-darken-color)}.vxe-slider.theme--primary .vxe-slider--bar-btn{background-color:var(--vxe-ui-font-primary-color)}.vxe-slider.theme--success .vxe-slider--bar-track{background-color:var(--vxe-ui-status-success-color)}.vxe-slider.theme--success .vxe-slider--bar-track:hover{background-color:var(--vxe-ui-status-success-lighten-color)}.vxe-slider.theme--success .vxe-slider--bar-track:hover{background-color:var(--vxe-ui-status-success-darken-color)}.vxe-slider.theme--success .vxe-slider--bar-btn{background-color:var(--vxe-ui-status-success-color)}.vxe-slider.theme--info .vxe-slider--bar-track{background-color:var(--vxe-ui-status-info-color)}.vxe-slider.theme--info .vxe-slider--bar-track:hover{background-color:var(--vxe-ui-status-info-lighten-color)}.vxe-slider.theme--info .vxe-slider--bar-track:hover{background-color:var(--vxe-ui-status-info-darken-color)}.vxe-slider.theme--info .vxe-slider--bar-btn{background-color:var(--vxe-ui-status-info-color)}.vxe-slider.theme--warning .vxe-slider--bar-track{background-color:var(--vxe-ui-status-warning-color)}.vxe-slider.theme--warning .vxe-slider--bar-track:hover{background-color:var(--vxe-ui-status-warning-lighten-color)}.vxe-slider.theme--warning .vxe-slider--bar-track:hover{background-color:var(--vxe-ui-status-warning-darken-color)}.vxe-slider.theme--warning .vxe-slider--bar-btn{background-color:var(--vxe-ui-status-warning-color)}.vxe-slider.theme--danger .vxe-slider--bar-track{background-color:var(--vxe-ui-status-danger-color)}.vxe-slider.theme--danger .vxe-slider--bar-track:hover{background-color:var(--vxe-ui-status-danger-lighten-color)}.vxe-slider.theme--danger .vxe-slider--bar-track:hover{background-color:var(--vxe-ui-status-danger-darken-color)}.vxe-slider.theme--danger .vxe-slider--bar-btn{background-color:var(--vxe-ui-status-danger-color)}.vxe-slider.theme--error .vxe-slider--bar-track{background-color:var(--vxe-ui-status-error-color)}.vxe-slider.theme--error .vxe-slider--bar-track:hover{background-color:var(--vxe-ui-status-error-lighten-color)}.vxe-slider.theme--error .vxe-slider--bar-track:hover{background-color:var(--vxe-ui-status-error-darken-color)}.vxe-slider.theme--error .vxe-slider--bar-btn{background-color:var(--vxe-ui-status-error-color)}.vxe-slider.is--disabled .vxe-slider--bar-btn{cursor:not-allowed}.vxe-slider:not(.is--disabled) .vxe-slider--bar-wrapper,.vxe-slider:not(.is--disabled) .vxe-slider--inner{cursor:pointer}.vxe-slider:not(.is--disabled) .vxe-slider--bar-btn:hover{transform:translate(-50%,-50%) scale(1.2)}.vxe-slider:not(.is--disabled) .vxe-slider--bar-btn:active{transform:translate(-50%,-50%) scale(1.1)}.vxe-slider.is--readonly .vxe-slider--bar-wrapper,.vxe-slider.is--readonly .vxe-slider--inner{cursor:default}.vxe-slider--inner{position:relative}.vxe-slider--bar-wrapper{background-color:#e4e7ed}.vxe-slider--bar-track{position:absolute;left:0;top:0;z-index:1;background-color:var(--vxe-ui-font-primary-color)}.vxe-slider--bar-track:hover{background-color:var(--vxe-ui-font-primary-lighten-color)}.vxe-slider--bar-track:active{background-color:var(--vxe-ui-font-primary-darken-color)}.vxe-slider--bar-track,.vxe-slider--bar-wrapper{height:.3em;border-radius:var(--vxe-ui-base-border-radius)}.vxe-slider--bar-btn{position:absolute;width:1.2em;height:1.2em;top:50%;transform:translate(-50%,-50%);border-radius:50%;border:2px solid var(--vxe-ui-font-primary-color);background-color:#fff;cursor:pointer;z-index:1;transition:transform .1s ease-in-out}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { VxeUI } from '@vxe-ui/core';
|
|
2
|
+
import VxeSpaceComponent from './src/space';
|
|
3
|
+
import { dynamicApp } from '../dynamics';
|
|
4
|
+
export const VxeSpace = Object.assign({}, VxeSpaceComponent, {
|
|
5
|
+
install(app) {
|
|
6
|
+
app.component(VxeSpaceComponent.name, VxeSpaceComponent);
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
dynamicApp.use(VxeSpace);
|
|
10
|
+
VxeUI.component(VxeSpaceComponent);
|
|
11
|
+
export const Space = VxeSpace;
|
|
12
|
+
export default VxeSpace;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { ref, h, computed, reactive } from 'vue';
|
|
2
|
+
import { defineVxeComponent } from '../../ui/src/comp';
|
|
3
|
+
import XEUtils from 'xe-utils';
|
|
4
|
+
import { getConfig, createEvent, useSize } from '../../ui';
|
|
5
|
+
import { getPropClass, toCssUnit } from '../../ui/src/dom';
|
|
6
|
+
import { eqEmptyValue } from '../../ui/src/utils';
|
|
7
|
+
export default defineVxeComponent({
|
|
8
|
+
name: 'VxeSpace',
|
|
9
|
+
props: {
|
|
10
|
+
size: {
|
|
11
|
+
type: String,
|
|
12
|
+
default: () => getConfig().space.size || getConfig().size
|
|
13
|
+
},
|
|
14
|
+
wrap: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: () => getConfig().space.wrap
|
|
17
|
+
},
|
|
18
|
+
gap: {
|
|
19
|
+
type: [Number, String, Array, Object],
|
|
20
|
+
default: () => getConfig().space.gap
|
|
21
|
+
},
|
|
22
|
+
vertical: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
default: () => getConfig().space.vertical
|
|
25
|
+
},
|
|
26
|
+
className: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: () => getConfig().space.className
|
|
29
|
+
},
|
|
30
|
+
itemClassName: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: () => getConfig().space.itemClassName
|
|
33
|
+
},
|
|
34
|
+
separator: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: () => getConfig().space.separator
|
|
37
|
+
},
|
|
38
|
+
align: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: () => getConfig().space.align
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
emits: [],
|
|
44
|
+
setup(props, context) {
|
|
45
|
+
const { emit, slots } = context;
|
|
46
|
+
const xID = XEUtils.uniqueId();
|
|
47
|
+
const { computeSize } = useSize(props);
|
|
48
|
+
const refElem = ref();
|
|
49
|
+
const reactData = reactive({
|
|
50
|
+
activeValue: null
|
|
51
|
+
});
|
|
52
|
+
const refMaps = {
|
|
53
|
+
refElem
|
|
54
|
+
};
|
|
55
|
+
const computeWrapperStyle = computed(() => {
|
|
56
|
+
const { align, gap } = props;
|
|
57
|
+
const stys = {};
|
|
58
|
+
let rowGap = '';
|
|
59
|
+
let columGap = '';
|
|
60
|
+
if (XEUtils.isNumber(gap) || XEUtils.isString(gap)) {
|
|
61
|
+
rowGap = gap;
|
|
62
|
+
columGap = gap;
|
|
63
|
+
}
|
|
64
|
+
else if (gap) {
|
|
65
|
+
if (XEUtils.isArray(gap)) {
|
|
66
|
+
rowGap = gap[0];
|
|
67
|
+
columGap = gap[1];
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
rowGap = gap.rowGap || '';
|
|
71
|
+
columGap = gap.columGap || '';
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (align) {
|
|
75
|
+
stys['align-items'] = align;
|
|
76
|
+
}
|
|
77
|
+
if (!eqEmptyValue(rowGap)) {
|
|
78
|
+
stys['--vxe-ui-space-current-row-gap'] = toCssUnit(rowGap);
|
|
79
|
+
}
|
|
80
|
+
if (!eqEmptyValue(columGap)) {
|
|
81
|
+
stys['--vxe-ui-space-current-column-gap'] = toCssUnit(columGap);
|
|
82
|
+
}
|
|
83
|
+
return stys;
|
|
84
|
+
});
|
|
85
|
+
const computeMaps = {};
|
|
86
|
+
const $xeSpace = {
|
|
87
|
+
xID,
|
|
88
|
+
props,
|
|
89
|
+
context,
|
|
90
|
+
reactData,
|
|
91
|
+
getRefMaps: () => refMaps,
|
|
92
|
+
getComputeMaps: () => computeMaps
|
|
93
|
+
};
|
|
94
|
+
const dispatchEvent = (type, params, evnt) => {
|
|
95
|
+
emit(type, createEvent(evnt, { $space: $xeSpace }, params));
|
|
96
|
+
};
|
|
97
|
+
const spaceMethods = {
|
|
98
|
+
dispatchEvent
|
|
99
|
+
};
|
|
100
|
+
const spacePrivateMethods = {};
|
|
101
|
+
Object.assign($xeSpace, spaceMethods, spacePrivateMethods);
|
|
102
|
+
const renderItems = () => {
|
|
103
|
+
const { separator, itemClassName } = props;
|
|
104
|
+
const itemVNs = [];
|
|
105
|
+
const defaultSlot = slots.default;
|
|
106
|
+
const separatorSlot = slots.separator;
|
|
107
|
+
if (defaultSlot) {
|
|
108
|
+
XEUtils.each(defaultSlot({}), (itemVN, index, items) => {
|
|
109
|
+
itemVNs.push(h('div', {
|
|
110
|
+
key: 'i' + index,
|
|
111
|
+
class: ['vxe-space--item', getPropClass(itemClassName, { index })]
|
|
112
|
+
}, [itemVN]));
|
|
113
|
+
if ((separator || separatorSlot) && index < items.length - 1) {
|
|
114
|
+
itemVNs.push(h('div', {
|
|
115
|
+
key: 's' + index,
|
|
116
|
+
class: 'vxe-space--separator'
|
|
117
|
+
}, separatorSlot ? separatorSlot({}) : ('' + separator)));
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
return itemVNs;
|
|
122
|
+
};
|
|
123
|
+
const renderVN = () => {
|
|
124
|
+
const { vertical, wrap, className } = props;
|
|
125
|
+
const wrapperStyle = computeWrapperStyle.value;
|
|
126
|
+
const vSize = computeSize.value;
|
|
127
|
+
return h('div', {
|
|
128
|
+
ref: refElem,
|
|
129
|
+
class: ['vxe-space', getPropClass(className, {}), {
|
|
130
|
+
[`size--${vSize}`]: vSize,
|
|
131
|
+
'is--wrap': wrap,
|
|
132
|
+
'is--vertical': vertical
|
|
133
|
+
}],
|
|
134
|
+
style: wrapperStyle
|
|
135
|
+
}, renderItems());
|
|
136
|
+
};
|
|
137
|
+
$xeSpace.renderVN = renderVN;
|
|
138
|
+
return $xeSpace;
|
|
139
|
+
},
|
|
140
|
+
render() {
|
|
141
|
+
return this.renderVN();
|
|
142
|
+
}
|
|
143
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
.vxe-space {
|
|
2
|
+
--vxe-ui-space-current-row-gap: var(--vxe-ui-space-row-gap-default);
|
|
3
|
+
--vxe-ui-space-current-column-gap: var(--vxe-ui-space-column-gap-default);
|
|
4
|
+
}
|
|
5
|
+
.vxe-space.size--xlarge {
|
|
6
|
+
--vxe-ui-space-current-row-gap: var(--vxe-ui-space-row-gap-xlarge);
|
|
7
|
+
--vxe-ui-space-current-column-gap: var(--vxe-ui-space-column-gap-xlarge);
|
|
8
|
+
}
|
|
9
|
+
.vxe-space.size--large {
|
|
10
|
+
--vxe-ui-space-current-row-gap: var(--vxe-ui-space-row-gap-large);
|
|
11
|
+
--vxe-ui-space-current-column-gap: var(--vxe-ui-space-column-gap-large);
|
|
12
|
+
}
|
|
13
|
+
.vxe-space.size--medium {
|
|
14
|
+
--vxe-ui-space-current-row-gap: var(--vxe-ui-space-row-gap-medium);
|
|
15
|
+
--vxe-ui-space-current-column-gap: var(--vxe-ui-space-column-gap-medium);
|
|
16
|
+
}
|
|
17
|
+
.vxe-space.size--small {
|
|
18
|
+
--vxe-ui-space-current-row-gap: var(--vxe-ui-space-row-gap-small);
|
|
19
|
+
--vxe-ui-space-current-column-gap: var(--vxe-ui-space-column-gap-small);
|
|
20
|
+
}
|
|
21
|
+
.vxe-space.size--mini {
|
|
22
|
+
--vxe-ui-space-current-row-gap: var(--vxe-ui-space-row-gap-mini);
|
|
23
|
+
--vxe-ui-space-current-column-gap: var(--vxe-ui-space-column-gap-mini);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.vxe-space {
|
|
27
|
+
display: inline-flex;
|
|
28
|
+
flex-direction: row;
|
|
29
|
+
align-items: center;
|
|
30
|
+
gap: var(--vxe-ui-space-current-row-gap) var(--vxe-ui-space-current-column-gap);
|
|
31
|
+
}
|
|
32
|
+
.vxe-space.is--wrap {
|
|
33
|
+
flex-wrap: wrap;
|
|
34
|
+
}
|
|
35
|
+
.vxe-space.is--vertical {
|
|
36
|
+
flex-direction: column;
|
|
37
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.vxe-space{--vxe-ui-space-current-row-gap:var(--vxe-ui-space-row-gap-default);--vxe-ui-space-current-column-gap:var(--vxe-ui-space-column-gap-default)}.vxe-space.size--xlarge{--vxe-ui-space-current-row-gap:var(--vxe-ui-space-row-gap-xlarge);--vxe-ui-space-current-column-gap:var(--vxe-ui-space-column-gap-xlarge)}.vxe-space.size--large{--vxe-ui-space-current-row-gap:var(--vxe-ui-space-row-gap-large);--vxe-ui-space-current-column-gap:var(--vxe-ui-space-column-gap-large)}.vxe-space.size--medium{--vxe-ui-space-current-row-gap:var(--vxe-ui-space-row-gap-medium);--vxe-ui-space-current-column-gap:var(--vxe-ui-space-column-gap-medium)}.vxe-space.size--small{--vxe-ui-space-current-row-gap:var(--vxe-ui-space-row-gap-small);--vxe-ui-space-current-column-gap:var(--vxe-ui-space-column-gap-small)}.vxe-space.size--mini{--vxe-ui-space-current-row-gap:var(--vxe-ui-space-row-gap-mini);--vxe-ui-space-current-column-gap:var(--vxe-ui-space-column-gap-mini)}.vxe-space{display:inline-flex;flex-direction:row;align-items:center;gap:var(--vxe-ui-space-current-row-gap) var(--vxe-ui-space-current-column-gap)}.vxe-space.is--wrap{flex-wrap:wrap}.vxe-space.is--vertical{flex-direction:column}
|