vxe-pc-ui 4.1.19 → 4.1.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/README.md +83 -2
- package/es/anchor/src/anchor-link.js +1 -1
- package/es/anchor/src/anchor.js +1 -1
- package/es/breadcrumb/src/breadcrumb.js +1 -1
- package/es/button/src/button-group.js +4 -1
- package/es/button/src/button.js +2 -1
- package/es/calendar/src/calendar.js +64 -32
- package/es/card/src/card.js +4 -3
- package/es/carousel/src/carousel-item.js +13 -3
- package/es/carousel/src/carousel.js +16 -8
- package/es/checkbox/src/checkbox.js +30 -14
- package/es/checkbox/src/group.js +17 -8
- package/es/collapse-pane/index.js +1 -1
- package/es/countdown/src/countdown.js +17 -8
- package/es/date-picker/src/date-picker.js +148 -69
- package/es/drawer/src/drawer.js +86 -46
- package/es/form/render/index.js +1 -2
- package/es/form/src/form-config-item.js +4 -3
- package/es/form/src/form-gather.js +5 -3
- package/es/form/src/form-item.js +15 -10
- package/es/form/src/form.js +11 -8
- package/es/form/src/render.js +2 -1
- package/es/form/src/util.js +2 -1
- package/es/icon/src/icon.js +3 -0
- package/es/icon/style.css +1 -1
- package/es/icon-picker/src/icon-picker.js +24 -11
- package/es/image/src/group.js +4 -1
- package/es/image/src/preview.js +1 -1
- package/es/input/src/input.js +131 -66
- package/es/layout-aside/src/layout-aside.js +1 -1
- package/es/list/src/list.js +7 -5
- package/es/list-design/src/list-design.js +1 -1
- package/es/list-design/src/list-view.js +1 -1
- package/es/loading/src/loading.js +4 -1
- package/es/menu/src/menu.js +4 -3
- package/es/number-input/src/number-input.js +100 -77
- package/es/pager/src/pager.js +85 -45
- package/es/password-input/src/password-input.js +2 -2
- package/es/print/src/page-break.js +11 -2
- package/es/print/src/print.js +6 -4
- package/es/pulldown/src/pulldown.js +19 -13
- package/es/radio/src/button.js +2 -2
- package/es/radio/src/group.js +8 -4
- package/es/row/src/row.js +1 -1
- package/es/select/src/optgroup.js +19 -10
- package/es/select/src/option.js +17 -9
- package/es/select/src/select.js +64 -41
- package/es/select/src/util.js +2 -2
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/tabs/src/tab-pane.js +13 -3
- package/es/tabs/src/tabs.js +57 -47
- package/es/textarea/src/textarea.js +28 -10
- package/es/tooltip/src/tooltip.js +107 -78
- package/es/tree/src/tree.js +6 -3
- package/es/tree-select/src/tree-select.js +18 -10
- package/es/ui/index.js +1 -7
- package/es/ui/src/log.js +1 -1
- package/es/upload/src/upload.js +5 -5
- package/lib/anchor/src/anchor-link.js +1 -1
- package/lib/anchor/src/anchor-link.min.js +1 -1
- package/lib/anchor/src/anchor.js +1 -1
- package/lib/anchor/src/anchor.min.js +1 -1
- package/lib/breadcrumb/src/breadcrumb.js +1 -1
- package/lib/breadcrumb/src/breadcrumb.min.js +1 -1
- package/lib/button/src/button-group.js +4 -1
- package/lib/button/src/button-group.min.js +1 -1
- package/lib/button/src/button.js +2 -1
- package/lib/button/src/button.min.js +1 -1
- package/lib/calendar/src/calendar.js +42 -24
- package/lib/calendar/src/calendar.min.js +1 -1
- package/lib/card/src/card.js +6 -5
- package/lib/card/src/card.min.js +1 -1
- package/lib/carousel/src/carousel-item.js +16 -3
- package/lib/carousel/src/carousel-item.min.js +1 -1
- package/lib/carousel/src/carousel.js +18 -8
- package/lib/carousel/src/carousel.min.js +1 -1
- package/lib/checkbox/src/checkbox.js +16 -12
- package/lib/checkbox/src/checkbox.min.js +1 -1
- package/lib/checkbox/src/group.js +10 -7
- package/lib/checkbox/src/group.min.js +1 -1
- package/lib/collapse-pane/index.js +1 -1
- package/lib/collapse-pane/index.min.js +1 -1
- package/lib/countdown/src/countdown.js +15 -7
- package/lib/countdown/src/countdown.min.js +1 -1
- package/lib/date-picker/src/date-picker.js +124 -62
- package/lib/date-picker/src/date-picker.min.js +1 -1
- package/lib/drawer/src/drawer.js +15 -30
- package/lib/drawer/src/drawer.min.js +1 -1
- package/lib/form/render/index.js +1 -4
- package/lib/form/render/index.min.js +1 -1
- package/lib/form/src/form-config-item.js +4 -5
- package/lib/form/src/form-config-item.min.js +1 -1
- package/lib/form/src/form-gather.js +11 -9
- package/lib/form/src/form-gather.min.js +1 -1
- package/lib/form/src/form-item.js +11 -12
- package/lib/form/src/form-item.min.js +1 -1
- package/lib/form/src/form.js +7 -7
- package/lib/form/src/form.min.js +1 -1
- package/lib/form/src/render.js +2 -1
- package/lib/form/src/util.js +2 -1
- package/lib/icon/src/icon.js +3 -0
- package/lib/icon/src/icon.min.js +1 -1
- package/lib/icon/style/style.css +1 -1
- package/lib/icon/style/style.min.css +1 -1
- package/lib/icon-picker/src/icon-picker.js +22 -12
- package/lib/icon-picker/src/icon-picker.min.js +1 -1
- package/lib/image/src/group.js +4 -1
- package/lib/image/src/group.min.js +1 -1
- package/lib/image/src/preview.js +1 -1
- package/lib/image/src/preview.min.js +1 -1
- package/lib/index.umd.js +884 -649
- package/lib/index.umd.min.js +1 -1
- package/lib/input/src/input.js +79 -51
- package/lib/input/src/input.min.js +1 -1
- package/lib/layout-aside/src/layout-aside.js +1 -1
- package/lib/layout-aside/src/layout-aside.min.js +1 -1
- package/lib/list/src/list.js +9 -5
- package/lib/list/src/list.min.js +1 -1
- package/lib/list-design/src/list-design.js +1 -1
- package/lib/list-design/src/list-design.min.js +1 -1
- package/lib/list-design/src/list-view.js +1 -1
- package/lib/list-design/src/list-view.min.js +1 -1
- package/lib/loading/src/loading.js +4 -1
- package/lib/loading/src/loading.min.js +1 -1
- package/lib/menu/src/menu.js +4 -3
- package/lib/menu/src/menu.min.js +1 -1
- package/lib/number-input/src/number-input.js +67 -69
- package/lib/number-input/src/number-input.min.js +1 -1
- package/lib/pager/src/pager.js +40 -39
- package/lib/pager/src/pager.min.js +1 -1
- package/lib/password-input/src/password-input.js +2 -2
- package/lib/print/src/page-break.js +14 -2
- package/lib/print/src/page-break.min.js +1 -1
- package/lib/print/src/print.js +8 -6
- package/lib/print/src/print.min.js +1 -1
- package/lib/pulldown/src/pulldown.js +19 -13
- package/lib/pulldown/src/pulldown.min.js +1 -1
- package/lib/radio/src/button.js +2 -2
- package/lib/radio/src/group.js +8 -4
- package/lib/radio/src/group.min.js +1 -1
- package/lib/row/src/row.js +1 -1
- package/lib/row/src/row.min.js +1 -1
- package/lib/select/src/optgroup.js +12 -9
- package/lib/select/src/optgroup.min.js +1 -1
- package/lib/select/src/option.js +9 -7
- package/lib/select/src/option.min.js +1 -1
- package/lib/select/src/select.js +52 -41
- package/lib/select/src/select.min.js +1 -1
- package/lib/select/src/util.js +2 -2
- package/lib/select/src/util.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/tabs/src/tab-pane.js +16 -3
- package/lib/tabs/src/tab-pane.min.js +1 -1
- package/lib/tabs/src/tabs.js +62 -50
- package/lib/tabs/src/tabs.min.js +1 -1
- package/lib/textarea/src/textarea.js +4 -4
- package/lib/tooltip/src/tooltip.js +96 -88
- package/lib/tooltip/src/tooltip.min.js +1 -1
- package/lib/tree/src/tree.js +2 -2
- package/lib/tree/src/tree.min.js +1 -1
- package/lib/tree-select/src/tree-select.js +13 -8
- package/lib/tree-select/src/tree-select.min.js +1 -1
- package/lib/ui/index.js +3 -10
- 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/upload/src/upload.js +5 -5
- package/lib/upload/src/upload.min.js +1 -1
- package/package.json +2 -2
- package/packages/anchor/src/anchor-link.ts +2 -2
- package/packages/anchor/src/anchor.ts +2 -2
- package/packages/breadcrumb/src/breadcrumb.ts +2 -2
- package/packages/button/src/button-group.ts +4 -1
- package/packages/button/src/button.ts +6 -5
- package/packages/calendar/src/calendar.ts +67 -35
- package/packages/card/src/card.ts +6 -4
- package/packages/carousel/src/carousel-item.ts +19 -4
- package/packages/carousel/src/carousel.ts +19 -11
- package/packages/checkbox/src/checkbox.ts +34 -15
- package/packages/checkbox/src/group.ts +22 -10
- package/packages/collapse-pane/index.ts +1 -1
- package/packages/countdown/src/countdown.ts +20 -11
- package/packages/date-picker/src/date-picker.ts +160 -80
- package/packages/drawer/src/drawer.ts +91 -50
- package/packages/form/render/index.ts +1 -3
- package/packages/form/src/form-config-item.ts +4 -3
- package/packages/form/src/form-gather.ts +5 -3
- package/packages/form/src/form-item.ts +15 -10
- package/packages/form/src/form.ts +12 -10
- package/packages/form/src/render.ts +2 -1
- package/packages/form/src/util.ts +2 -1
- package/packages/icon/src/icon.ts +3 -0
- package/packages/icon-picker/src/icon-picker.ts +31 -17
- package/packages/image/src/group.ts +4 -1
- package/packages/image/src/preview.ts +2 -2
- package/packages/input/src/input.ts +138 -75
- package/packages/layout-aside/src/layout-aside.ts +2 -2
- package/packages/list/src/list.ts +12 -11
- package/packages/list-design/src/list-design.ts +2 -2
- package/packages/list-design/src/list-view.ts +2 -2
- package/packages/loading/src/loading.ts +5 -2
- package/packages/menu/src/menu.ts +5 -4
- package/packages/number-input/src/number-input.ts +102 -79
- package/packages/pager/src/pager.ts +91 -50
- package/packages/password-input/src/password-input.ts +2 -2
- package/packages/print/src/page-break.ts +18 -4
- package/packages/print/src/print.ts +10 -5
- package/packages/pulldown/src/pulldown.ts +28 -22
- package/packages/radio/src/button.ts +2 -2
- package/packages/radio/src/group.ts +9 -5
- package/packages/row/src/row.ts +2 -2
- package/packages/select/src/optgroup.ts +22 -13
- package/packages/select/src/option.ts +18 -10
- package/packages/select/src/select.ts +79 -52
- package/packages/select/src/util.ts +3 -3
- package/packages/tabs/src/tab-pane.ts +20 -5
- package/packages/tabs/src/tabs.ts +59 -49
- package/packages/textarea/src/textarea.ts +28 -10
- package/packages/tooltip/src/tooltip.ts +118 -84
- package/packages/tree/src/tree.ts +7 -4
- package/packages/tree-select/src/tree-select.ts +25 -16
- package/packages/ui/index.ts +0 -7
- package/packages/upload/src/upload.ts +6 -6
- package/types/components/calendar.d.ts +6 -0
- package/types/components/carousel.d.ts +5 -0
- package/types/components/countdown.d.ts +4 -0
- package/types/components/date-picker.d.ts +23 -5
- package/types/components/drawer.d.ts +0 -1
- package/types/components/form.d.ts +4 -2
- package/types/components/icon-picker.d.ts +4 -0
- package/types/components/input.d.ts +9 -1
- package/types/components/list.d.ts +1 -0
- package/types/components/number-input.d.ts +6 -2
- package/types/components/optgroup.d.ts +10 -4
- package/types/components/pulldown.d.ts +5 -1
- package/types/components/select.d.ts +4 -0
- package/types/components/tabs.d.ts +4 -0
- package/types/components/toolbar.d.ts +5 -0
- package/types/components/tooltip.d.ts +4 -0
- package/types/components/tree-select.d.ts +4 -0
- package/types/ui/index.d.ts +0 -22
- /package/es/{collapse-pane → collapse}/src/collapse-pane.js +0 -0
- /package/es/icon/style/{iconfont.1725597808239.ttf → iconfont.1725941866604.ttf} +0 -0
- /package/es/icon/style/{iconfont.1725597808239.woff → iconfont.1725941866604.woff} +0 -0
- /package/es/icon/style/{iconfont.1725597808239.woff2 → iconfont.1725941866604.woff2} +0 -0
- /package/es/{iconfont.1725597808239.ttf → iconfont.1725941866604.ttf} +0 -0
- /package/es/{iconfont.1725597808239.woff → iconfont.1725941866604.woff} +0 -0
- /package/es/{iconfont.1725597808239.woff2 → iconfont.1725941866604.woff2} +0 -0
- /package/lib/{collapse-pane → collapse}/src/collapse-pane.js +0 -0
- /package/lib/{collapse-pane → collapse}/src/collapse-pane.min.js +0 -0
- /package/lib/icon/style/{iconfont.1725597808239.ttf → iconfont.1725941866604.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1725597808239.woff → iconfont.1725941866604.woff} +0 -0
- /package/lib/icon/style/{iconfont.1725597808239.woff2 → iconfont.1725941866604.woff2} +0 -0
- /package/lib/{iconfont.1725597808239.ttf → iconfont.1725941866604.ttf} +0 -0
- /package/lib/{iconfont.1725597808239.woff → iconfont.1725941866604.woff} +0 -0
- /package/lib/{iconfont.1725597808239.woff2 → iconfont.1725941866604.woff2} +0 -0
- /package/packages/{collapse-pane → collapse}/src/collapse-pane.ts +0 -0
package/es/list/src/list.js
CHANGED
|
@@ -30,10 +30,8 @@ export default defineComponent({
|
|
|
30
30
|
topSpaceHeight: 0,
|
|
31
31
|
items: []
|
|
32
32
|
});
|
|
33
|
-
const refElem = ref();
|
|
34
|
-
const refVirtualWrapper = ref();
|
|
35
|
-
const refVirtualBody = ref();
|
|
36
33
|
const internalData = {
|
|
34
|
+
resizeObserver: undefined,
|
|
37
35
|
fullData: [],
|
|
38
36
|
lastScrollLeft: 0,
|
|
39
37
|
lastScrollTop: 0,
|
|
@@ -45,6 +43,9 @@ export default defineComponent({
|
|
|
45
43
|
rowHeight: 0
|
|
46
44
|
}
|
|
47
45
|
};
|
|
46
|
+
const refElem = ref();
|
|
47
|
+
const refVirtualWrapper = ref();
|
|
48
|
+
const refVirtualBody = ref();
|
|
48
49
|
const refMaps = {
|
|
49
50
|
refElem
|
|
50
51
|
};
|
|
@@ -269,19 +270,20 @@ export default defineComponent({
|
|
|
269
270
|
onActivated(() => {
|
|
270
271
|
recalculate().then(() => refreshScroll());
|
|
271
272
|
});
|
|
272
|
-
let resizeObserver;
|
|
273
273
|
nextTick(() => {
|
|
274
274
|
globalEvents.on($xeList, 'resize', () => {
|
|
275
275
|
recalculate();
|
|
276
276
|
});
|
|
277
277
|
if (props.autoResize) {
|
|
278
278
|
const el = refElem.value;
|
|
279
|
-
resizeObserver = globalResize.create(() => recalculate());
|
|
279
|
+
const resizeObserver = globalResize.create(() => recalculate());
|
|
280
280
|
resizeObserver.observe(el);
|
|
281
|
+
internalData.resizeObserver = resizeObserver;
|
|
281
282
|
}
|
|
282
283
|
listMethods.loadData(props.data || []);
|
|
283
284
|
});
|
|
284
285
|
onUnmounted(() => {
|
|
286
|
+
const { resizeObserver } = internalData;
|
|
285
287
|
if (resizeObserver) {
|
|
286
288
|
resizeObserver.disconnect();
|
|
287
289
|
}
|
|
@@ -296,7 +296,6 @@ export default defineComponent({
|
|
|
296
296
|
])
|
|
297
297
|
]);
|
|
298
298
|
};
|
|
299
|
-
$xeListDesign.renderVN = renderVN;
|
|
300
299
|
provide('$xeListDesign', $xeListDesign);
|
|
301
300
|
watch(() => props.config, (value) => {
|
|
302
301
|
loadConfig(value || {});
|
|
@@ -305,6 +304,7 @@ export default defineComponent({
|
|
|
305
304
|
if (props.config) {
|
|
306
305
|
loadConfig(props.config);
|
|
307
306
|
}
|
|
307
|
+
$xeListDesign.renderVN = renderVN;
|
|
308
308
|
return $xeListDesign;
|
|
309
309
|
},
|
|
310
310
|
render() {
|
|
@@ -414,7 +414,6 @@ export default defineComponent({
|
|
|
414
414
|
})
|
|
415
415
|
]);
|
|
416
416
|
};
|
|
417
|
-
$xeListView.renderVN = renderVN;
|
|
418
417
|
watch(() => props.config, (value) => {
|
|
419
418
|
loadConfig(value || {});
|
|
420
419
|
});
|
|
@@ -429,6 +428,7 @@ export default defineComponent({
|
|
|
429
428
|
}
|
|
430
429
|
});
|
|
431
430
|
}
|
|
431
|
+
$xeListView.renderVN = renderVN;
|
|
432
432
|
return $xeListView;
|
|
433
433
|
},
|
|
434
434
|
render() {
|
|
@@ -114,11 +114,14 @@ export default defineComponent({
|
|
|
114
114
|
])
|
|
115
115
|
]);
|
|
116
116
|
};
|
|
117
|
-
$xeLoading.renderVN = renderVN;
|
|
118
117
|
watch(() => props.modelValue, () => {
|
|
119
118
|
handleInit();
|
|
120
119
|
});
|
|
121
120
|
handleInit();
|
|
121
|
+
$xeLoading.renderVN = renderVN;
|
|
122
122
|
return $xeLoading;
|
|
123
|
+
},
|
|
124
|
+
render() {
|
|
125
|
+
return this.renderVN();
|
|
123
126
|
}
|
|
124
127
|
});
|
package/es/menu/src/menu.js
CHANGED
|
@@ -128,8 +128,9 @@ export default defineComponent({
|
|
|
128
128
|
const handleClickMenu = (evnt, item) => {
|
|
129
129
|
const { routerLink, hasChild } = item;
|
|
130
130
|
if (routerLink) {
|
|
131
|
-
|
|
132
|
-
|
|
131
|
+
const value = item.itemKey;
|
|
132
|
+
reactData.activeName = value;
|
|
133
|
+
emit('update:modelValue', value);
|
|
133
134
|
}
|
|
134
135
|
else {
|
|
135
136
|
if (hasChild) {
|
|
@@ -245,7 +246,6 @@ export default defineComponent({
|
|
|
245
246
|
})
|
|
246
247
|
]);
|
|
247
248
|
};
|
|
248
|
-
$xeMenu.renderVN = renderVN;
|
|
249
249
|
const optFlag = ref(0);
|
|
250
250
|
watch(() => props.options ? props.options.length : -1, () => {
|
|
251
251
|
optFlag.value++;
|
|
@@ -270,6 +270,7 @@ export default defineComponent({
|
|
|
270
270
|
});
|
|
271
271
|
updateMenuConfig();
|
|
272
272
|
updateActiveMenu(true);
|
|
273
|
+
$xeMenu.renderVN = renderVN;
|
|
273
274
|
return $xeMenu;
|
|
274
275
|
},
|
|
275
276
|
render() {
|
|
@@ -9,10 +9,19 @@ export default defineComponent({
|
|
|
9
9
|
name: 'VxeNumberInput',
|
|
10
10
|
props: {
|
|
11
11
|
modelValue: [String, Number],
|
|
12
|
-
immediate: {
|
|
12
|
+
immediate: {
|
|
13
|
+
type: Boolean,
|
|
14
|
+
default: true
|
|
15
|
+
},
|
|
13
16
|
name: String,
|
|
14
|
-
type: {
|
|
15
|
-
|
|
17
|
+
type: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: 'number'
|
|
20
|
+
},
|
|
21
|
+
clearable: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: () => getConfig().numberInput.clearable
|
|
24
|
+
},
|
|
16
25
|
readonly: {
|
|
17
26
|
type: Boolean,
|
|
18
27
|
default: null
|
|
@@ -30,17 +39,35 @@ export default defineComponent({
|
|
|
30
39
|
align: String,
|
|
31
40
|
form: String,
|
|
32
41
|
className: String,
|
|
33
|
-
size: {
|
|
42
|
+
size: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: () => getConfig().numberInput.size || getConfig().size
|
|
45
|
+
},
|
|
34
46
|
multiple: Boolean,
|
|
35
47
|
// number、integer、float
|
|
36
|
-
min: {
|
|
37
|
-
|
|
48
|
+
min: {
|
|
49
|
+
type: [String, Number],
|
|
50
|
+
default: null
|
|
51
|
+
},
|
|
52
|
+
max: {
|
|
53
|
+
type: [String, Number],
|
|
54
|
+
default: null
|
|
55
|
+
},
|
|
38
56
|
step: [String, Number],
|
|
39
|
-
exponential: {
|
|
57
|
+
exponential: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
default: () => getConfig().numberInput.exponential
|
|
60
|
+
},
|
|
40
61
|
// number、integer、float
|
|
41
|
-
controls: {
|
|
62
|
+
controls: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: () => getConfig().numberInput.controls
|
|
65
|
+
},
|
|
42
66
|
// float
|
|
43
|
-
digits: {
|
|
67
|
+
digits: {
|
|
68
|
+
type: [String, Number],
|
|
69
|
+
default: () => getConfig().numberInput.digits
|
|
70
|
+
},
|
|
44
71
|
prefixIcon: String,
|
|
45
72
|
suffixIcon: String,
|
|
46
73
|
// 已废弃
|
|
@@ -74,6 +101,9 @@ export default defineComponent({
|
|
|
74
101
|
isActivated: false,
|
|
75
102
|
inputValue: props.modelValue
|
|
76
103
|
});
|
|
104
|
+
const internalData = {
|
|
105
|
+
dnTimeout: undefined
|
|
106
|
+
};
|
|
77
107
|
const refElem = ref();
|
|
78
108
|
const refInputTarget = ref();
|
|
79
109
|
const refInputPanel = ref();
|
|
@@ -86,9 +116,10 @@ export default defineComponent({
|
|
|
86
116
|
props,
|
|
87
117
|
context,
|
|
88
118
|
reactData,
|
|
119
|
+
internalData,
|
|
89
120
|
getRefMaps: () => refMaps
|
|
90
121
|
};
|
|
91
|
-
let
|
|
122
|
+
let numberInputMethods = {};
|
|
92
123
|
const computeFormReadonly = computed(() => {
|
|
93
124
|
const { readonly } = props;
|
|
94
125
|
if (readonly === null) {
|
|
@@ -109,9 +140,6 @@ export default defineComponent({
|
|
|
109
140
|
}
|
|
110
141
|
return disabled;
|
|
111
142
|
});
|
|
112
|
-
const computeIsNumType = computed(() => {
|
|
113
|
-
return true;
|
|
114
|
-
});
|
|
115
143
|
const computeDigitsValue = computed(() => {
|
|
116
144
|
return XEUtils.toInteger(props.digits) || 1;
|
|
117
145
|
});
|
|
@@ -146,7 +174,7 @@ export default defineComponent({
|
|
|
146
174
|
}
|
|
147
175
|
return getI18n('vxe.base.pleaseInput');
|
|
148
176
|
});
|
|
149
|
-
const
|
|
177
|
+
const computeInpMaxLength = computed(() => {
|
|
150
178
|
const { maxLength, maxlength } = props;
|
|
151
179
|
// 数值最大长度限制 16 位,包含小数
|
|
152
180
|
return XEUtils.toNumber(maxLength || maxlength) || 16;
|
|
@@ -158,11 +186,7 @@ export default defineComponent({
|
|
|
158
186
|
const computeNumValue = computed(() => {
|
|
159
187
|
const { type } = props;
|
|
160
188
|
const { inputValue } = reactData;
|
|
161
|
-
|
|
162
|
-
if (isNumType) {
|
|
163
|
-
return type === 'integer' ? XEUtils.toInteger(handleNumber(inputValue)) : XEUtils.toNumber(handleNumber(inputValue));
|
|
164
|
-
}
|
|
165
|
-
return 0;
|
|
189
|
+
return type === 'integer' ? XEUtils.toInteger(handleNumber(inputValue)) : XEUtils.toNumber(handleNumber(inputValue));
|
|
166
190
|
});
|
|
167
191
|
const computeNumLabel = computed(() => {
|
|
168
192
|
const { inputValue } = reactData;
|
|
@@ -171,10 +195,9 @@ export default defineComponent({
|
|
|
171
195
|
const computeIsDisabledSubtractNumber = computed(() => {
|
|
172
196
|
const { min } = props;
|
|
173
197
|
const { inputValue } = reactData;
|
|
174
|
-
const isNumType = computeIsNumType.value;
|
|
175
198
|
const numValue = computeNumValue.value;
|
|
176
199
|
// 当有值时再进行判断
|
|
177
|
-
if ((inputValue || inputValue === 0) &&
|
|
200
|
+
if ((inputValue || inputValue === 0) && min !== null) {
|
|
178
201
|
return numValue <= XEUtils.toNumber(min);
|
|
179
202
|
}
|
|
180
203
|
return false;
|
|
@@ -182,37 +205,37 @@ export default defineComponent({
|
|
|
182
205
|
const computeIsDisabledAddNumber = computed(() => {
|
|
183
206
|
const { max } = props;
|
|
184
207
|
const { inputValue } = reactData;
|
|
185
|
-
const isNumType = computeIsNumType.value;
|
|
186
208
|
const numValue = computeNumValue.value;
|
|
187
209
|
// 当有值时再进行判断
|
|
188
|
-
if ((inputValue || inputValue === 0) &&
|
|
210
|
+
if ((inputValue || inputValue === 0) && max !== null) {
|
|
189
211
|
return numValue >= XEUtils.toNumber(max);
|
|
190
212
|
}
|
|
191
213
|
return false;
|
|
192
214
|
});
|
|
193
215
|
const getNumberValue = (val) => {
|
|
194
216
|
const { type, exponential } = props;
|
|
195
|
-
const
|
|
217
|
+
const inpMaxLength = computeInpMaxLength.value;
|
|
196
218
|
const digitsValue = computeDigitsValue.value;
|
|
197
219
|
const restVal = (type === 'float' ? toFloatValueFixed(val, digitsValue) : XEUtils.toValueString(val));
|
|
198
220
|
if (exponential && (val === restVal || XEUtils.toValueString(val).toLowerCase() === XEUtils.toNumber(restVal).toExponential())) {
|
|
199
221
|
return val;
|
|
200
222
|
}
|
|
201
|
-
return restVal.slice(0,
|
|
223
|
+
return restVal.slice(0, inpMaxLength);
|
|
202
224
|
};
|
|
203
225
|
const triggerEvent = (evnt) => {
|
|
204
226
|
const { inputValue } = reactData;
|
|
205
|
-
|
|
227
|
+
numberInputMethods.dispatchEvent(evnt.type, { value: inputValue }, evnt);
|
|
206
228
|
};
|
|
207
|
-
const
|
|
229
|
+
const handleChange = (val, inputValue, evnt) => {
|
|
230
|
+
const value = val ? Number(val) : null;
|
|
208
231
|
const isChange = Number(value) !== props.modelValue;
|
|
209
232
|
if (isChange) {
|
|
210
233
|
reactData.inputValue = inputValue || '';
|
|
211
|
-
emit('update:modelValue', value
|
|
234
|
+
emit('update:modelValue', value);
|
|
212
235
|
}
|
|
213
|
-
|
|
236
|
+
numberInputMethods.dispatchEvent('input', { value }, evnt);
|
|
214
237
|
if (isChange) {
|
|
215
|
-
|
|
238
|
+
numberInputMethods.dispatchEvent('change', { value }, evnt);
|
|
216
239
|
// 自动更新校验状态
|
|
217
240
|
if ($xeForm && formItemInfo) {
|
|
218
241
|
$xeForm.triggerItemEvent(evnt, formItemInfo.itemConfig.field, value);
|
|
@@ -224,10 +247,10 @@ export default defineComponent({
|
|
|
224
247
|
const value = inputValue ? XEUtils.toNumber(inputValue) : null;
|
|
225
248
|
reactData.inputValue = inputValue;
|
|
226
249
|
if (inpImmediate) {
|
|
227
|
-
|
|
250
|
+
handleChange(value, inputValue, evnt);
|
|
228
251
|
}
|
|
229
252
|
else {
|
|
230
|
-
|
|
253
|
+
numberInputMethods.dispatchEvent('input', { value }, evnt);
|
|
231
254
|
}
|
|
232
255
|
};
|
|
233
256
|
const inputEvent = (evnt) => {
|
|
@@ -249,19 +272,19 @@ export default defineComponent({
|
|
|
249
272
|
const isDisabled = computeIsDisabled.value;
|
|
250
273
|
if (!isDisabled) {
|
|
251
274
|
const { inputValue } = reactData;
|
|
252
|
-
|
|
275
|
+
numberInputMethods.dispatchEvent('prefix-click', { value: inputValue }, evnt);
|
|
253
276
|
}
|
|
254
277
|
};
|
|
255
278
|
const clearValueEvent = (evnt, value) => {
|
|
256
279
|
focus();
|
|
257
|
-
|
|
258
|
-
|
|
280
|
+
handleChange(null, '', evnt);
|
|
281
|
+
numberInputMethods.dispatchEvent('clear', { value }, evnt);
|
|
259
282
|
};
|
|
260
283
|
const clickSuffixEvent = (evnt) => {
|
|
261
284
|
const isDisabled = computeIsDisabled.value;
|
|
262
285
|
if (!isDisabled) {
|
|
263
286
|
const { inputValue } = reactData;
|
|
264
|
-
|
|
287
|
+
numberInputMethods.dispatchEvent('suffix-click', { value: inputValue }, evnt);
|
|
265
288
|
}
|
|
266
289
|
};
|
|
267
290
|
/**
|
|
@@ -280,7 +303,7 @@ export default defineComponent({
|
|
|
280
303
|
validValue = Number(textValue);
|
|
281
304
|
}
|
|
282
305
|
if (inputValue !== validValue) {
|
|
283
|
-
|
|
306
|
+
handleChange(validValue, textValue, { type: 'init' });
|
|
284
307
|
}
|
|
285
308
|
}
|
|
286
309
|
}
|
|
@@ -311,7 +334,7 @@ export default defineComponent({
|
|
|
311
334
|
}
|
|
312
335
|
}
|
|
313
336
|
const inpValue = getNumberValue(inpNumVal);
|
|
314
|
-
|
|
337
|
+
handleChange(inpValue === null ? null : Number(inpValue), inpValue, { type: 'check' });
|
|
315
338
|
}
|
|
316
339
|
}
|
|
317
340
|
};
|
|
@@ -320,11 +343,11 @@ export default defineComponent({
|
|
|
320
343
|
const inpImmediate = computeInpImmediate.value;
|
|
321
344
|
const value = inputValue ? Number(inputValue) : null;
|
|
322
345
|
if (!inpImmediate) {
|
|
323
|
-
|
|
346
|
+
handleChange(value, `${inputValue || ''}`, evnt);
|
|
324
347
|
}
|
|
325
348
|
afterCheckValue();
|
|
326
349
|
reactData.isActivated = false;
|
|
327
|
-
|
|
350
|
+
numberInputMethods.dispatchEvent('blur', { value }, evnt);
|
|
328
351
|
};
|
|
329
352
|
// 数值
|
|
330
353
|
const numberChange = (isPlus, evnt) => {
|
|
@@ -345,19 +368,18 @@ export default defineComponent({
|
|
|
345
368
|
}
|
|
346
369
|
emitInputEvent(getNumberValue(restNum), evnt);
|
|
347
370
|
};
|
|
348
|
-
let downbumTimeout;
|
|
349
371
|
const numberNextEvent = (evnt) => {
|
|
350
372
|
const isDisabled = computeIsDisabled.value;
|
|
351
373
|
const formReadonly = computeFormReadonly.value;
|
|
352
374
|
const isDisabledSubtractNumber = computeIsDisabledSubtractNumber.value;
|
|
353
|
-
|
|
375
|
+
numberStopDown();
|
|
354
376
|
if (!isDisabled && !formReadonly && !isDisabledSubtractNumber) {
|
|
355
377
|
numberChange(false, evnt);
|
|
356
378
|
}
|
|
357
|
-
|
|
379
|
+
numberInputMethods.dispatchEvent('next-number', {}, evnt);
|
|
358
380
|
};
|
|
359
381
|
const numberDownNextEvent = (evnt) => {
|
|
360
|
-
|
|
382
|
+
internalData.dnTimeout = window.setTimeout(() => {
|
|
361
383
|
numberNextEvent(evnt);
|
|
362
384
|
numberDownNextEvent(evnt);
|
|
363
385
|
}, 60);
|
|
@@ -366,11 +388,11 @@ export default defineComponent({
|
|
|
366
388
|
const isDisabled = computeIsDisabled.value;
|
|
367
389
|
const formReadonly = computeFormReadonly.value;
|
|
368
390
|
const isDisabledAddNumber = computeIsDisabledAddNumber.value;
|
|
369
|
-
|
|
391
|
+
numberStopDown();
|
|
370
392
|
if (!isDisabled && !formReadonly && !isDisabledAddNumber) {
|
|
371
393
|
numberChange(true, evnt);
|
|
372
394
|
}
|
|
373
|
-
|
|
395
|
+
numberInputMethods.dispatchEvent('prev-number', {}, evnt);
|
|
374
396
|
};
|
|
375
397
|
const numberKeydownEvent = (evnt) => {
|
|
376
398
|
const isUpArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_UP);
|
|
@@ -387,25 +409,22 @@ export default defineComponent({
|
|
|
387
409
|
};
|
|
388
410
|
const keydownEvent = (evnt) => {
|
|
389
411
|
const { exponential, controls } = props;
|
|
390
|
-
const
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
if (controls) {
|
|
407
|
-
numberKeydownEvent(evnt);
|
|
408
|
-
}
|
|
412
|
+
const isCtrlKey = evnt.ctrlKey;
|
|
413
|
+
const isShiftKey = evnt.shiftKey;
|
|
414
|
+
const isAltKey = evnt.altKey;
|
|
415
|
+
const keyCode = evnt.keyCode;
|
|
416
|
+
const isEsc = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ESCAPE);
|
|
417
|
+
const isUpArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_UP);
|
|
418
|
+
const isDwArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_DOWN);
|
|
419
|
+
if (!isCtrlKey && !isShiftKey && !isAltKey && (globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.SPACEBAR) || ((!exponential || keyCode !== 69) && (keyCode >= 65 && keyCode <= 90)) || (keyCode >= 186 && keyCode <= 188) || keyCode >= 191)) {
|
|
420
|
+
evnt.preventDefault();
|
|
421
|
+
}
|
|
422
|
+
if (isEsc) {
|
|
423
|
+
afterCheckValue();
|
|
424
|
+
}
|
|
425
|
+
else if (isUpArrow || isDwArrow) {
|
|
426
|
+
if (controls) {
|
|
427
|
+
numberKeydownEvent(evnt);
|
|
409
428
|
}
|
|
410
429
|
}
|
|
411
430
|
triggerEvent(evnt);
|
|
@@ -415,10 +434,14 @@ export default defineComponent({
|
|
|
415
434
|
};
|
|
416
435
|
// 数值
|
|
417
436
|
const numberStopDown = () => {
|
|
418
|
-
|
|
437
|
+
const { dnTimeout } = internalData;
|
|
438
|
+
if (dnTimeout) {
|
|
439
|
+
clearTimeout(dnTimeout);
|
|
440
|
+
internalData.dnTimeout = undefined;
|
|
441
|
+
}
|
|
419
442
|
};
|
|
420
443
|
const numberDownPrevEvent = (evnt) => {
|
|
421
|
-
|
|
444
|
+
internalData.dnTimeout = window.setTimeout(() => {
|
|
422
445
|
numberPrevEvent(evnt);
|
|
423
446
|
numberDownPrevEvent(evnt);
|
|
424
447
|
}, 60);
|
|
@@ -433,7 +456,7 @@ export default defineComponent({
|
|
|
433
456
|
else {
|
|
434
457
|
numberNextEvent(evnt);
|
|
435
458
|
}
|
|
436
|
-
|
|
459
|
+
internalData.dnTimeout = window.setTimeout(() => {
|
|
437
460
|
if (isPrevNumber) {
|
|
438
461
|
numberDownPrevEvent(evnt);
|
|
439
462
|
}
|
|
@@ -444,8 +467,7 @@ export default defineComponent({
|
|
|
444
467
|
}
|
|
445
468
|
};
|
|
446
469
|
const wheelEvent = (evnt) => {
|
|
447
|
-
|
|
448
|
-
if (isNumType && props.controls) {
|
|
470
|
+
if (props.controls) {
|
|
449
471
|
if (reactData.isActivated) {
|
|
450
472
|
const delta = evnt.deltaY;
|
|
451
473
|
if (delta > 0) {
|
|
@@ -601,10 +623,11 @@ export default defineComponent({
|
|
|
601
623
|
}
|
|
602
624
|
return createCommentVNode();
|
|
603
625
|
};
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
626
|
+
const dispatchEvent = (type, params, evnt) => {
|
|
627
|
+
emit(type, createEvent(evnt, { $numberInput: $xeNumberInput }, params));
|
|
628
|
+
};
|
|
629
|
+
numberInputMethods = {
|
|
630
|
+
dispatchEvent,
|
|
608
631
|
focus() {
|
|
609
632
|
const inputElem = refInputTarget.value;
|
|
610
633
|
reactData.isActivated = true;
|
|
@@ -624,7 +647,7 @@ export default defineComponent({
|
|
|
624
647
|
return nextTick();
|
|
625
648
|
}
|
|
626
649
|
};
|
|
627
|
-
Object.assign($xeNumberInput,
|
|
650
|
+
Object.assign($xeNumberInput, numberInputMethods);
|
|
628
651
|
const renderVN = () => {
|
|
629
652
|
const { className, controls, type, align, name, autocomplete, autoComplete } = props;
|
|
630
653
|
const { inputValue, isActivated } = reactData;
|
|
@@ -639,7 +662,7 @@ export default defineComponent({
|
|
|
639
662
|
}, numLabel);
|
|
640
663
|
}
|
|
641
664
|
const inputReadonly = computeInputReadonly.value;
|
|
642
|
-
const
|
|
665
|
+
const inpMaxLength = computeInpMaxLength.value;
|
|
643
666
|
const inpPlaceholder = computeInpPlaceholder.value;
|
|
644
667
|
const isClearable = computeIsClearable.value;
|
|
645
668
|
const prefix = renderPrefixIcon();
|
|
@@ -669,7 +692,7 @@ export default defineComponent({
|
|
|
669
692
|
name,
|
|
670
693
|
type: 'text',
|
|
671
694
|
placeholder: inpPlaceholder,
|
|
672
|
-
maxlength:
|
|
695
|
+
maxlength: inpMaxLength,
|
|
673
696
|
readonly: inputReadonly,
|
|
674
697
|
disabled: isDisabled,
|
|
675
698
|
autocomplete: autoComplete || autocomplete,
|