vxe-pc-ui 3.17.19 → 3.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/es/components.js +31 -1
- package/es/icon/style.css +1 -1
- package/es/slider/src/slider.js +220 -82
- 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/lib/components.js +41 -2
- package/lib/components.min.js +1 -1
- package/lib/icon/style/style.css +1 -1
- package/lib/icon/style/style.min.css +1 -1
- package/lib/index.umd.js +462 -91
- package/lib/index.umd.min.js +1 -1
- package/lib/slider/src/slider.js +237 -87
- 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 +172 -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 +22 -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/package.json +2 -2
- package/packages/components.ts +31 -1
- package/packages/slider/src/slider.ts +226 -80
- package/packages/space/index.ts +16 -0
- package/packages/space/src/space.ts +159 -0
- package/packages/ui/index.ts +1 -0
- package/packages/ui/src/dom.ts +4 -0
- 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 +102 -0
- package/types/ui/global-config.d.ts +2 -0
- /package/es/icon/{iconfont.1787739873173.ttf → iconfont.1787994741699.ttf} +0 -0
- /package/es/icon/{iconfont.1787739873173.woff → iconfont.1787994741699.woff} +0 -0
- /package/es/icon/{iconfont.1787739873173.woff2 → iconfont.1787994741699.woff2} +0 -0
- /package/es/{iconfont.1787739873173.ttf → iconfont.1787994741699.ttf} +0 -0
- /package/es/{iconfont.1787739873173.woff → iconfont.1787994741699.woff} +0 -0
- /package/es/{iconfont.1787739873173.woff2 → iconfont.1787994741699.woff2} +0 -0
- /package/lib/icon/style/{iconfont.1787739873173.ttf → iconfont.1787994741699.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1787739873173.woff → iconfont.1787994741699.woff} +0 -0
- /package/lib/icon/style/{iconfont.1787739873173.woff2 → iconfont.1787994741699.woff2} +0 -0
- /package/lib/{iconfont.1787739873173.ttf → iconfont.1787994741699.ttf} +0 -0
- /package/lib/{iconfont.1787739873173.woff → iconfont.1787994741699.woff} +0 -0
- /package/lib/{iconfont.1787739873173.woff2 → iconfont.1787994741699.woff2} +0 -0
package/es/slider/src/slider.js
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import { defineVxeComponent } from '../../ui/src/comp';
|
|
2
2
|
import XEUtils from 'xe-utils';
|
|
3
3
|
import { getConfig, createEvent, renderEmptyElement } from '../../ui';
|
|
4
|
+
function createInternalData() {
|
|
5
|
+
return {
|
|
6
|
+
// _isUp: false,
|
|
7
|
+
currValue: 0,
|
|
8
|
+
startValue: 0,
|
|
9
|
+
endValue: 0
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function createReactData() {
|
|
13
|
+
return {};
|
|
14
|
+
}
|
|
4
15
|
export default {
|
|
5
16
|
name: 'VxeSlider',
|
|
6
17
|
model: {
|
|
@@ -9,6 +20,8 @@ export default {
|
|
|
9
20
|
},
|
|
10
21
|
props: {
|
|
11
22
|
value: [String, Number, Array],
|
|
23
|
+
startValue: [String, Number],
|
|
24
|
+
endValue: [String, Number],
|
|
12
25
|
vertical: Boolean,
|
|
13
26
|
max: {
|
|
14
27
|
type: [String, Number],
|
|
@@ -37,6 +50,10 @@ export default {
|
|
|
37
50
|
disabled: {
|
|
38
51
|
type: Boolean,
|
|
39
52
|
default: null
|
|
53
|
+
},
|
|
54
|
+
immediate: {
|
|
55
|
+
type: Boolean,
|
|
56
|
+
default: () => getConfig().slider.immediate
|
|
40
57
|
}
|
|
41
58
|
},
|
|
42
59
|
inject: {
|
|
@@ -50,14 +67,9 @@ export default {
|
|
|
50
67
|
},
|
|
51
68
|
data() {
|
|
52
69
|
const xID = XEUtils.uniqueId();
|
|
53
|
-
const reactData =
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
};
|
|
57
|
-
return {
|
|
58
|
-
xID,
|
|
59
|
-
reactData
|
|
60
|
-
};
|
|
70
|
+
const reactData = createReactData();
|
|
71
|
+
return Object.assign(Object.assign({}, {}), { xID,
|
|
72
|
+
reactData });
|
|
61
73
|
},
|
|
62
74
|
computed: Object.assign(Object.assign({}, {}), { computeFormReadonly() {
|
|
63
75
|
const $xeSlider = this;
|
|
@@ -94,6 +106,12 @@ export default {
|
|
|
94
106
|
const $xeSlider = this;
|
|
95
107
|
const props = $xeSlider;
|
|
96
108
|
return XEUtils.toNumber(props.min || 0);
|
|
109
|
+
},
|
|
110
|
+
computeMVal() {
|
|
111
|
+
const $xeSlider = this;
|
|
112
|
+
const props = $xeSlider;
|
|
113
|
+
const { range, startValue, endValue } = props;
|
|
114
|
+
return range ? `${startValue || ''}${endValue || ''}` : '';
|
|
97
115
|
} }),
|
|
98
116
|
methods: {
|
|
99
117
|
//
|
|
@@ -105,7 +123,9 @@ export default {
|
|
|
105
123
|
},
|
|
106
124
|
emitModel(value) {
|
|
107
125
|
const $xeSlider = this;
|
|
126
|
+
const internalData = $xeSlider.internalData;
|
|
108
127
|
const { _events } = $xeSlider;
|
|
128
|
+
internalData._isUp = true;
|
|
109
129
|
if (_events && _events.modelValue) {
|
|
110
130
|
$xeSlider.$emit('modelValue', value);
|
|
111
131
|
}
|
|
@@ -113,128 +133,219 @@ export default {
|
|
|
113
133
|
$xeSlider.$emit('model-value', value);
|
|
114
134
|
}
|
|
115
135
|
},
|
|
116
|
-
|
|
136
|
+
getBarPercent(currValue) {
|
|
117
137
|
const $xeSlider = this;
|
|
118
|
-
const props = $xeSlider;
|
|
119
|
-
const { range } = props;
|
|
120
138
|
const maxNum = $xeSlider.computeMaxNum;
|
|
121
139
|
const minNum = $xeSlider.computeMinNum;
|
|
122
|
-
|
|
140
|
+
if (maxNum === minNum) {
|
|
141
|
+
return 0;
|
|
142
|
+
}
|
|
143
|
+
if (currValue < minNum) {
|
|
144
|
+
currValue = minNum;
|
|
145
|
+
}
|
|
146
|
+
if (currValue > maxNum) {
|
|
147
|
+
currValue = maxNum;
|
|
148
|
+
}
|
|
149
|
+
return ((currValue - minNum) / (maxNum - minNum)) * 100;
|
|
123
150
|
},
|
|
124
|
-
|
|
151
|
+
parseFields(startValue, endValue) {
|
|
125
152
|
const $xeSlider = this;
|
|
126
|
-
const
|
|
127
|
-
const
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
|
|
153
|
+
const internalData = $xeSlider.internalData;
|
|
154
|
+
const [sVal, eVal] = XEUtils.orderBy([XEUtils.toNumber(startValue), XEUtils.toNumber(endValue)]);
|
|
155
|
+
const currValue = XEUtils.floor(XEUtils.toNumber(sVal || 0));
|
|
156
|
+
internalData.currValue = currValue;
|
|
157
|
+
internalData.startValue = currValue;
|
|
158
|
+
internalData.endValue = XEUtils.floor(XEUtils.toNumber(eVal || 0));
|
|
159
|
+
},
|
|
160
|
+
parseArrs(arrVals) {
|
|
161
|
+
const $xeSlider = this;
|
|
162
|
+
const internalData = $xeSlider.internalData;
|
|
163
|
+
const [sVal, eVal] = XEUtils.orderBy(arrVals);
|
|
164
|
+
const currValue = XEUtils.floor(XEUtils.toNumber(sVal || 0));
|
|
165
|
+
internalData.currValue = currValue;
|
|
166
|
+
internalData.startValue = currValue;
|
|
167
|
+
internalData.endValue = XEUtils.floor(XEUtils.toNumber(eVal || 0));
|
|
168
|
+
},
|
|
169
|
+
parseNum(val) {
|
|
170
|
+
const $xeSlider = this;
|
|
171
|
+
const internalData = $xeSlider.internalData;
|
|
172
|
+
const currValue = XEUtils.floor(XEUtils.toNumber(val || 0));
|
|
173
|
+
internalData.currValue = currValue;
|
|
174
|
+
internalData.startValue = 0;
|
|
175
|
+
internalData.endValue = currValue;
|
|
131
176
|
},
|
|
132
|
-
|
|
177
|
+
updateModelValue(umType) {
|
|
133
178
|
const $xeSlider = this;
|
|
134
179
|
const props = $xeSlider;
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
180
|
+
const { range, value: modelValue, startValue, endValue } = props;
|
|
181
|
+
if (!umType) {
|
|
182
|
+
if (range) {
|
|
183
|
+
if (XEUtils.eqNull(modelValue)) {
|
|
184
|
+
if (startValue || endValue) {
|
|
185
|
+
$xeSlider.parseFields(startValue, endValue);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
if (XEUtils.isArray(modelValue)) {
|
|
190
|
+
$xeSlider.parseArrs(modelValue.map(num => XEUtils.toNumber(num)));
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
$xeSlider.parseNum(modelValue);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
$xeSlider.parseNum(modelValue);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
else if (range && umType === 2) {
|
|
202
|
+
$xeSlider.parseFields(startValue, endValue);
|
|
141
203
|
}
|
|
142
204
|
else {
|
|
143
|
-
|
|
144
|
-
|
|
205
|
+
if (XEUtils.isArray(modelValue)) {
|
|
206
|
+
$xeSlider.parseArrs(modelValue.map(num => XEUtils.toNumber(num)));
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
$xeSlider.parseNum(modelValue);
|
|
210
|
+
}
|
|
145
211
|
}
|
|
212
|
+
$xeSlider.updateBarStyle();
|
|
213
|
+
$xeSlider.updateTrackStyle();
|
|
146
214
|
},
|
|
147
215
|
updateBarStyle() {
|
|
148
216
|
const $xeSlider = this;
|
|
149
|
-
const
|
|
150
|
-
const
|
|
151
|
-
const
|
|
217
|
+
const props = $xeSlider;
|
|
218
|
+
const internalData = $xeSlider.internalData;
|
|
219
|
+
const { range } = props;
|
|
220
|
+
const { currValue, startValue, endValue } = internalData;
|
|
152
221
|
const startBtnElem = $xeSlider.$refs.refStartBtnElem;
|
|
153
222
|
const endBtnElem = $xeSlider.$refs.refEndBtnElem;
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
223
|
+
if (range) {
|
|
224
|
+
const [sVal, eVal] = XEUtils.orderBy([startValue, endValue]);
|
|
225
|
+
if (startBtnElem) {
|
|
226
|
+
startBtnElem.style.left = $xeSlider.getBarPercent(sVal) + '%';
|
|
227
|
+
}
|
|
228
|
+
if (endBtnElem) {
|
|
229
|
+
endBtnElem.style.left = $xeSlider.getBarPercent(eVal) + '%';
|
|
230
|
+
}
|
|
159
231
|
}
|
|
160
232
|
else {
|
|
161
|
-
|
|
162
|
-
|
|
233
|
+
if (endBtnElem) {
|
|
234
|
+
endBtnElem.style.left = $xeSlider.getBarPercent(currValue) + '%';
|
|
235
|
+
}
|
|
163
236
|
}
|
|
237
|
+
},
|
|
238
|
+
updateTrackStyle() {
|
|
239
|
+
const $xeSlider = this;
|
|
240
|
+
const props = $xeSlider;
|
|
241
|
+
const internalData = $xeSlider.internalData;
|
|
242
|
+
const { range } = props;
|
|
243
|
+
const { currValue, startValue, endValue } = internalData;
|
|
244
|
+
const trackElem = $xeSlider.$refs.refTrackElem;
|
|
164
245
|
if (trackElem) {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
246
|
+
if (range) {
|
|
247
|
+
const [sVal, eVal] = XEUtils.orderBy([startValue, endValue]);
|
|
248
|
+
trackElem.style.left = $xeSlider.getBarPercent(sVal) + '%';
|
|
249
|
+
trackElem.style.width = $xeSlider.getBarPercent(eVal - sVal) + '%';
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
trackElem.style.left = '0';
|
|
253
|
+
trackElem.style.width = $xeSlider.getBarPercent(currValue) + '%';
|
|
254
|
+
}
|
|
173
255
|
}
|
|
174
256
|
},
|
|
175
257
|
changeEvent(evnt) {
|
|
176
258
|
const $xeSlider = this;
|
|
177
259
|
const props = $xeSlider;
|
|
178
|
-
const
|
|
260
|
+
const internalData = $xeSlider.internalData;
|
|
179
261
|
const $xeForm = $xeSlider.$xeForm;
|
|
180
262
|
const formItemInfo = $xeSlider.formItemInfo;
|
|
181
263
|
const { range } = props;
|
|
182
|
-
const { startValue, endValue } =
|
|
183
|
-
const
|
|
264
|
+
const { currValue, startValue, endValue } = internalData;
|
|
265
|
+
const vals = range ? XEUtils.orderBy([startValue, endValue]) : [];
|
|
266
|
+
const value = range ? vals : currValue;
|
|
184
267
|
$xeSlider.emitModel(value);
|
|
268
|
+
if (range) {
|
|
269
|
+
$xeSlider.$emit('update:startValue', vals[0] || 0);
|
|
270
|
+
$xeSlider.$emit('update:endValue', vals[1] || 0);
|
|
271
|
+
}
|
|
185
272
|
$xeSlider.dispatchEvent('change', { value }, evnt);
|
|
186
273
|
// 自动更新校验状态
|
|
187
274
|
if ($xeForm && formItemInfo) {
|
|
188
275
|
$xeForm.triggerItemEvent(evnt, formItemInfo.itemConfig.field, value);
|
|
189
276
|
}
|
|
190
277
|
},
|
|
191
|
-
|
|
278
|
+
getValueByLeft(offsetLeft, barWidth) {
|
|
192
279
|
const $xeSlider = this;
|
|
193
|
-
const reactData = $xeSlider.reactData;
|
|
194
|
-
const formReadonly = $xeSlider.computeFormReadonly;
|
|
195
|
-
const isDisabled = $xeSlider.computeIsDisabled;
|
|
196
280
|
const maxNum = $xeSlider.computeMaxNum;
|
|
197
281
|
const minNum = $xeSlider.computeMinNum;
|
|
282
|
+
if (barWidth === 0) {
|
|
283
|
+
return minNum;
|
|
284
|
+
}
|
|
285
|
+
const clamped = Math.max(0, Math.min(barWidth, offsetLeft));
|
|
286
|
+
const ratio = clamped / barWidth;
|
|
287
|
+
const raw = minNum + ratio * (maxNum - minNum);
|
|
288
|
+
return Math.floor(raw);
|
|
289
|
+
},
|
|
290
|
+
handleBtnMousedownEvent(evnt) {
|
|
291
|
+
const $xeSlider = this;
|
|
292
|
+
const props = $xeSlider;
|
|
293
|
+
const internalData = $xeSlider.internalData;
|
|
294
|
+
const { range, immediate } = props;
|
|
295
|
+
const btnElem = evnt.currentTarget;
|
|
296
|
+
const formReadonly = $xeSlider.computeFormReadonly;
|
|
297
|
+
const isDisabled = $xeSlider.computeIsDisabled;
|
|
198
298
|
if (!(formReadonly || isDisabled)) {
|
|
199
299
|
evnt.preventDefault();
|
|
200
300
|
document.onmousemove = evnt => {
|
|
201
301
|
evnt.preventDefault();
|
|
302
|
+
const el = $xeSlider.$refs.refElem;
|
|
202
303
|
const barElem = $xeSlider.$refs.refBarElem;
|
|
203
|
-
if (barElem) {
|
|
304
|
+
if (el && barElem) {
|
|
305
|
+
const btnType = btnElem.getAttribute('data-type');
|
|
204
306
|
const barRect = barElem.getBoundingClientRect();
|
|
205
|
-
const
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
307
|
+
const barWidth = barRect.width;
|
|
308
|
+
const offsetLeft = Math.min(barWidth, Math.max(0, evnt.clientX - barRect.left));
|
|
309
|
+
const currValue = $xeSlider.getValueByLeft(offsetLeft, barWidth);
|
|
310
|
+
if (range) {
|
|
311
|
+
if (btnType === '1') {
|
|
312
|
+
internalData.startValue = currValue;
|
|
313
|
+
}
|
|
314
|
+
else {
|
|
315
|
+
internalData.endValue = currValue;
|
|
316
|
+
}
|
|
211
317
|
}
|
|
212
|
-
|
|
318
|
+
internalData.currValue = currValue;
|
|
319
|
+
btnElem.style.left = $xeSlider.getBarPercent(currValue) + '%';
|
|
320
|
+
$xeSlider.dispatchEvent('track-dragover', {
|
|
321
|
+
currentValue: internalData.currValue,
|
|
322
|
+
startValue: internalData.startValue,
|
|
323
|
+
endValue: internalData.endValue
|
|
324
|
+
}, evnt);
|
|
325
|
+
}
|
|
326
|
+
if (immediate) {
|
|
327
|
+
$xeSlider.changeEvent(evnt);
|
|
213
328
|
}
|
|
214
|
-
$xeSlider.
|
|
329
|
+
$xeSlider.updateTrackStyle();
|
|
215
330
|
};
|
|
216
331
|
document.onmouseup = (evnt) => {
|
|
217
332
|
document.onmousemove = null;
|
|
218
333
|
document.onmouseup = null;
|
|
219
|
-
$xeSlider.dispatchEvent('track-dragend', {
|
|
334
|
+
$xeSlider.dispatchEvent('track-dragend', {
|
|
335
|
+
currentValue: internalData.currValue,
|
|
336
|
+
startValue: internalData.startValue,
|
|
337
|
+
endValue: internalData.endValue
|
|
338
|
+
}, evnt);
|
|
220
339
|
$xeSlider.changeEvent(evnt);
|
|
221
|
-
$xeSlider.
|
|
340
|
+
$xeSlider.updateTrackStyle();
|
|
222
341
|
};
|
|
223
|
-
$xeSlider.dispatchEvent('track-dragstart', {
|
|
342
|
+
$xeSlider.dispatchEvent('track-dragstart', {
|
|
343
|
+
currentValue: internalData.currValue,
|
|
344
|
+
startValue: internalData.startValue,
|
|
345
|
+
endValue: internalData.endValue
|
|
346
|
+
}, evnt);
|
|
224
347
|
}
|
|
225
348
|
},
|
|
226
|
-
handleStartMousedownEvent(evnt) {
|
|
227
|
-
const $xeSlider = this;
|
|
228
|
-
const endBtnElem = $xeSlider.$refs.refEndBtnElem;
|
|
229
|
-
const startBtnElem = evnt.currentTarget;
|
|
230
|
-
$xeSlider.handleMousedownEvent(evnt, endBtnElem ? endBtnElem.offsetLeft < startBtnElem.offsetLeft : false);
|
|
231
|
-
},
|
|
232
|
-
handleEndMousedownEvent(evnt) {
|
|
233
|
-
const $xeSlider = this;
|
|
234
|
-
const startBtnElem = $xeSlider.$refs.refStartBtnElem;
|
|
235
|
-
const endBtnElem = evnt.currentTarget;
|
|
236
|
-
$xeSlider.handleMousedownEvent(evnt, startBtnElem ? endBtnElem.offsetLeft > startBtnElem.offsetLeft : true);
|
|
237
|
-
},
|
|
238
349
|
//
|
|
239
350
|
// Render
|
|
240
351
|
//
|
|
@@ -269,18 +380,24 @@ export default {
|
|
|
269
380
|
? renderEmptyElement($xeSlider)
|
|
270
381
|
: h('div', {
|
|
271
382
|
ref: 'refStartBtnElem',
|
|
272
|
-
class: 'vxe-slider--bar-btn
|
|
383
|
+
class: 'vxe-slider--bar-btn',
|
|
384
|
+
attrs: {
|
|
385
|
+
'data-type': '1'
|
|
386
|
+
},
|
|
273
387
|
on: {
|
|
274
|
-
mousedown: $xeSlider.
|
|
388
|
+
mousedown: $xeSlider.handleBtnMousedownEvent
|
|
275
389
|
}
|
|
276
390
|
}),
|
|
277
391
|
formReadonly
|
|
278
392
|
? renderEmptyElement($xeSlider)
|
|
279
393
|
: h('div', {
|
|
280
394
|
ref: 'refEndBtnElem',
|
|
281
|
-
class: 'vxe-slider--bar-btn
|
|
395
|
+
class: 'vxe-slider--bar-btn',
|
|
396
|
+
attrs: {
|
|
397
|
+
'data-type': '2'
|
|
398
|
+
},
|
|
282
399
|
on: {
|
|
283
|
-
mousedown: $xeSlider.
|
|
400
|
+
mousedown: $xeSlider.handleBtnMousedownEvent
|
|
284
401
|
}
|
|
285
402
|
})
|
|
286
403
|
])
|
|
@@ -290,16 +407,37 @@ export default {
|
|
|
290
407
|
watch: {
|
|
291
408
|
value() {
|
|
292
409
|
const $xeSlider = this;
|
|
293
|
-
$xeSlider.
|
|
410
|
+
const internalData = $xeSlider.internalData;
|
|
411
|
+
if (!internalData._isUp) {
|
|
412
|
+
$xeSlider.updateModelValue(1);
|
|
413
|
+
}
|
|
414
|
+
internalData._isUp = false;
|
|
415
|
+
},
|
|
416
|
+
computeMVal() {
|
|
417
|
+
const $xeSlider = this;
|
|
418
|
+
const internalData = $xeSlider.internalData;
|
|
419
|
+
if (!internalData._isUp) {
|
|
420
|
+
$xeSlider.updateModelValue(2);
|
|
421
|
+
}
|
|
422
|
+
internalData._isUp = false;
|
|
294
423
|
}
|
|
295
424
|
},
|
|
296
425
|
created() {
|
|
297
426
|
const $xeSlider = this;
|
|
298
|
-
$xeSlider.
|
|
427
|
+
$xeSlider.internalData = createInternalData();
|
|
428
|
+
$xeSlider.updateModelValue();
|
|
299
429
|
},
|
|
300
430
|
mounted() {
|
|
301
431
|
const $xeSlider = this;
|
|
302
432
|
$xeSlider.updateBarStyle();
|
|
433
|
+
$xeSlider.updateTrackStyle();
|
|
434
|
+
},
|
|
435
|
+
beforeDestroy() {
|
|
436
|
+
const $xeSlider = this;
|
|
437
|
+
const reactData = $xeSlider.reactData;
|
|
438
|
+
const internalData = $xeSlider.internalData;
|
|
439
|
+
XEUtils.assign(reactData, createReactData());
|
|
440
|
+
XEUtils.assign(internalData, createInternalData());
|
|
303
441
|
},
|
|
304
442
|
render(h) {
|
|
305
443
|
return this.renderVN(h);
|
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 { defineVxeComponent } from '../../ui/src/comp';
|
|
2
|
+
import XEUtils from 'xe-utils';
|
|
3
|
+
import { getConfig, createEvent, globalMixins } from '../../ui';
|
|
4
|
+
import { getPropClass, toCssUnit } from '../../ui/src/dom';
|
|
5
|
+
import { eqEmptyValue } from '../../ui/src/utils';
|
|
6
|
+
export default {
|
|
7
|
+
name: 'VxeSpace',
|
|
8
|
+
mixins: [
|
|
9
|
+
globalMixins.sizeMixin,
|
|
10
|
+
globalMixins.permissionMixin
|
|
11
|
+
],
|
|
12
|
+
props: {
|
|
13
|
+
size: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: () => getConfig().space.size || getConfig().size
|
|
16
|
+
},
|
|
17
|
+
wrap: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
default: () => getConfig().space.wrap
|
|
20
|
+
},
|
|
21
|
+
gap: {
|
|
22
|
+
type: [Number, String, Array, Object],
|
|
23
|
+
default: () => getConfig().space.gap
|
|
24
|
+
},
|
|
25
|
+
vertical: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: () => getConfig().space.vertical
|
|
28
|
+
},
|
|
29
|
+
className: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: () => getConfig().space.className
|
|
32
|
+
},
|
|
33
|
+
itemClassName: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: () => getConfig().space.itemClassName
|
|
36
|
+
},
|
|
37
|
+
separator: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: () => getConfig().space.separator
|
|
40
|
+
},
|
|
41
|
+
align: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: () => getConfig().space.align
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
data() {
|
|
47
|
+
const xID = XEUtils.uniqueId();
|
|
48
|
+
const reactData = {
|
|
49
|
+
activeValue: null
|
|
50
|
+
};
|
|
51
|
+
return {
|
|
52
|
+
xID,
|
|
53
|
+
reactData
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
computed: Object.assign(Object.assign({}, {}), { computeWrapperStyle() {
|
|
57
|
+
const $xeSpace = this;
|
|
58
|
+
const props = $xeSpace;
|
|
59
|
+
const { align, gap } = props;
|
|
60
|
+
const stys = {};
|
|
61
|
+
let rowGap = '';
|
|
62
|
+
let columGap = '';
|
|
63
|
+
if (XEUtils.isNumber(gap) || XEUtils.isString(gap)) {
|
|
64
|
+
rowGap = gap;
|
|
65
|
+
columGap = gap;
|
|
66
|
+
}
|
|
67
|
+
else if (gap) {
|
|
68
|
+
if (XEUtils.isArray(gap)) {
|
|
69
|
+
rowGap = gap[0];
|
|
70
|
+
columGap = gap[1];
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
rowGap = gap.rowGap || '';
|
|
74
|
+
columGap = gap.columGap || '';
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (align) {
|
|
78
|
+
stys['align-items'] = align;
|
|
79
|
+
}
|
|
80
|
+
if (!eqEmptyValue(rowGap)) {
|
|
81
|
+
stys['--vxe-ui-space-current-row-gap'] = toCssUnit(rowGap);
|
|
82
|
+
}
|
|
83
|
+
if (!eqEmptyValue(columGap)) {
|
|
84
|
+
stys['--vxe-ui-space-current-column-gap'] = toCssUnit(columGap);
|
|
85
|
+
}
|
|
86
|
+
return stys;
|
|
87
|
+
} }),
|
|
88
|
+
methods: {
|
|
89
|
+
//
|
|
90
|
+
// Method
|
|
91
|
+
//
|
|
92
|
+
dispatchEvent(type, params, evnt) {
|
|
93
|
+
const $xeSpace = this;
|
|
94
|
+
$xeSpace.$emit(type, createEvent(evnt, { $space: $xeSpace }, params));
|
|
95
|
+
},
|
|
96
|
+
//
|
|
97
|
+
// Render
|
|
98
|
+
//
|
|
99
|
+
renderItems(h) {
|
|
100
|
+
const $xeSpace = this;
|
|
101
|
+
const props = $xeSpace;
|
|
102
|
+
const slots = $xeSpace.$scopedSlots;
|
|
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
|
+
renderVN(h) {
|
|
124
|
+
const $xeSpace = this;
|
|
125
|
+
const props = $xeSpace;
|
|
126
|
+
const { vertical, wrap, className } = props;
|
|
127
|
+
const wrapperStyle = $xeSpace.computeWrapperStyle;
|
|
128
|
+
const vSize = $xeSpace.computeSize;
|
|
129
|
+
return h('div', {
|
|
130
|
+
ref: 'refElem',
|
|
131
|
+
class: ['vxe-space', getPropClass(className, {}), {
|
|
132
|
+
[`size--${vSize}`]: vSize,
|
|
133
|
+
'is--wrap': wrap,
|
|
134
|
+
'is--vertical': vertical
|
|
135
|
+
}],
|
|
136
|
+
style: wrapperStyle
|
|
137
|
+
}, $xeSpace.renderItems(h));
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
render(h) {
|
|
141
|
+
return this.renderVN(h);
|
|
142
|
+
}
|
|
143
|
+
};
|