vxe-pc-ui 4.5.31 → 4.5.33
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/form/style.css +12 -12
- package/es/form/style.min.css +1 -1
- package/es/icon/style.css +1 -1
- package/es/input/src/input.js +2 -2
- package/es/number-input/src/number-input.js +248 -165
- package/es/number-input/style.css +74 -770
- package/es/number-input/style.min.css +1 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/tooltip/style.css +1 -1
- package/es/tooltip/style.min.css +1 -1
- package/es/ui/index.js +11 -4
- package/es/ui/src/dom.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/es/vxe-form/style.css +12 -12
- package/es/vxe-form/style.min.css +1 -1
- package/es/vxe-number-input/style.css +74 -770
- package/es/vxe-number-input/style.min.css +1 -1
- package/es/vxe-tooltip/style.css +1 -1
- package/es/vxe-tooltip/style.min.css +1 -1
- package/lib/form/style/style.css +12 -12
- package/lib/form/style/style.min.css +1 -1
- package/lib/icon/style/style.css +1 -1
- package/lib/icon/style/style.min.css +1 -1
- package/lib/index.umd.js +255 -160
- package/lib/index.umd.min.js +1 -1
- package/lib/input/src/input.js +2 -2
- package/lib/input/src/input.min.js +1 -1
- package/lib/number-input/src/number-input.js +240 -152
- package/lib/number-input/src/number-input.min.js +1 -1
- package/lib/number-input/style/style.css +74 -770
- package/lib/number-input/style/style.min.css +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/tooltip/style/style.css +1 -1
- package/lib/tooltip/style/style.min.css +1 -1
- package/lib/ui/index.js +11 -4
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/dom.js +1 -1
- 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-form/style/style.css +12 -12
- package/lib/vxe-form/style/style.min.css +1 -1
- package/lib/vxe-number-input/style/style.css +74 -770
- package/lib/vxe-number-input/style/style.min.css +1 -1
- package/lib/vxe-tooltip/style/style.css +1 -1
- package/lib/vxe-tooltip/style/style.min.css +1 -1
- package/package.json +1 -1
- package/packages/input/src/input.ts +2 -2
- package/packages/number-input/src/number-input.ts +264 -177
- package/packages/ui/index.ts +10 -3
- package/packages/ui/src/dom.ts +1 -1
- package/styles/components/form.scss +12 -12
- package/styles/components/number-input.scss +73 -598
- package/styles/components/tooltip.scss +1 -1
- package/styles/theme/base.scss +4 -4
- package/styles/theme/dark.scss +3 -0
- package/styles/theme/light.scss +3 -0
- package/types/components/number-input.d.ts +80 -6
- package/types/components/table.d.ts +4 -1
- package/types/ui/global-icon.d.ts +4 -2
- /package/es/icon/{iconfont.1745654997780.ttf → iconfont.1745889662360.ttf} +0 -0
- /package/es/icon/{iconfont.1745654997780.woff → iconfont.1745889662360.woff} +0 -0
- /package/es/icon/{iconfont.1745654997780.woff2 → iconfont.1745889662360.woff2} +0 -0
- /package/es/{iconfont.1745654997780.ttf → iconfont.1745889662360.ttf} +0 -0
- /package/es/{iconfont.1745654997780.woff → iconfont.1745889662360.woff} +0 -0
- /package/es/{iconfont.1745654997780.woff2 → iconfont.1745889662360.woff2} +0 -0
- /package/lib/icon/style/{iconfont.1745654997780.ttf → iconfont.1745889662360.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1745654997780.woff → iconfont.1745889662360.woff} +0 -0
- /package/lib/icon/style/{iconfont.1745654997780.woff2 → iconfont.1745889662360.woff2} +0 -0
- /package/lib/{iconfont.1745654997780.ttf → iconfont.1745889662360.ttf} +0 -0
- /package/lib/{iconfont.1745654997780.woff → iconfont.1745889662360.woff} +0 -0
- /package/lib/{iconfont.1745654997780.woff2 → iconfont.1745889662360.woff2} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent, h, ref, computed, reactive, inject, nextTick, watch, onMounted,
|
|
1
|
+
import { defineComponent, h, ref, computed, reactive, inject, nextTick, watch, onMounted, onBeforeUnmount } from 'vue';
|
|
2
2
|
import XEUtils from 'xe-utils';
|
|
3
|
-
import { getConfig, getIcon, getI18n, globalEvents, GLOBAL_EVENT_KEYS, createEvent, useSize } from '../../ui';
|
|
4
|
-
import { getFuncText, eqEmptyValue } from '../../ui/src/utils';
|
|
3
|
+
import { getConfig, getIcon, getI18n, globalEvents, GLOBAL_EVENT_KEYS, createEvent, useSize, renderEmptyElement } from '../../ui';
|
|
4
|
+
import { getFuncText, eqEmptyValue, isEnableConf } from '../../ui/src/utils';
|
|
5
5
|
import { hasClass, getEventTargetNode, hasControlKey } from '../../ui/src/dom';
|
|
6
6
|
import { getSlotVNs } from '../../ui/src/vn';
|
|
7
7
|
import { handleNumber, toFloatValueFixed } from './util';
|
|
@@ -68,11 +68,7 @@ export default defineComponent({
|
|
|
68
68
|
type: String,
|
|
69
69
|
default: () => getConfig().numberInput.currencySymbol
|
|
70
70
|
},
|
|
71
|
-
|
|
72
|
-
controls: {
|
|
73
|
-
type: Boolean,
|
|
74
|
-
default: () => getConfig().numberInput.controls
|
|
75
|
-
},
|
|
71
|
+
controlConfig: Object,
|
|
76
72
|
// float
|
|
77
73
|
digits: {
|
|
78
74
|
type: [String, Number],
|
|
@@ -86,9 +82,16 @@ export default defineComponent({
|
|
|
86
82
|
type: Boolean,
|
|
87
83
|
default: true
|
|
88
84
|
},
|
|
85
|
+
plusIcon: String,
|
|
86
|
+
minusIcon: String,
|
|
89
87
|
prefixIcon: String,
|
|
90
88
|
suffixIcon: String,
|
|
91
89
|
// 已废弃
|
|
90
|
+
controls: {
|
|
91
|
+
type: Boolean,
|
|
92
|
+
default: null
|
|
93
|
+
},
|
|
94
|
+
// 已废弃
|
|
92
95
|
maxlength: [String, Number],
|
|
93
96
|
// 已废弃
|
|
94
97
|
autocomplete: String
|
|
@@ -104,10 +107,13 @@ export default defineComponent({
|
|
|
104
107
|
'focus',
|
|
105
108
|
'blur',
|
|
106
109
|
'clear',
|
|
107
|
-
'
|
|
108
|
-
'
|
|
110
|
+
'plus-number',
|
|
111
|
+
'minus-number',
|
|
109
112
|
'prefix-click',
|
|
110
|
-
'suffix-click'
|
|
113
|
+
'suffix-click',
|
|
114
|
+
// 已废弃
|
|
115
|
+
'prev-number',
|
|
116
|
+
'next-number'
|
|
111
117
|
],
|
|
112
118
|
setup(props, context) {
|
|
113
119
|
const { slots, emit } = context;
|
|
@@ -122,24 +128,13 @@ export default defineComponent({
|
|
|
122
128
|
});
|
|
123
129
|
const internalData = {
|
|
124
130
|
// dnTimeout: undefined,
|
|
131
|
+
// ainTimeout: undefined,
|
|
132
|
+
// isMouseDown: undefined,
|
|
125
133
|
// isUM: undefined
|
|
126
134
|
};
|
|
127
135
|
const refElem = ref();
|
|
128
136
|
const refInputTarget = ref();
|
|
129
137
|
const refInputPanel = ref();
|
|
130
|
-
const refMaps = {
|
|
131
|
-
refElem,
|
|
132
|
-
refInput: refInputTarget
|
|
133
|
-
};
|
|
134
|
-
const $xeNumberInput = {
|
|
135
|
-
xID,
|
|
136
|
-
props,
|
|
137
|
-
context,
|
|
138
|
-
reactData,
|
|
139
|
-
internalData,
|
|
140
|
-
getRefMaps: () => refMaps
|
|
141
|
-
};
|
|
142
|
-
let numberInputMethods = {};
|
|
143
138
|
const computeFormReadonly = computed(() => {
|
|
144
139
|
const { readonly } = props;
|
|
145
140
|
if (readonly === null) {
|
|
@@ -173,6 +168,9 @@ export default defineComponent({
|
|
|
173
168
|
}
|
|
174
169
|
return XEUtils.toInteger(defDigits) || 1;
|
|
175
170
|
});
|
|
171
|
+
const computeControlOpts = computed(() => {
|
|
172
|
+
return Object.assign({}, getConfig().numberInput.controlConfig, props.controlConfig);
|
|
173
|
+
});
|
|
176
174
|
const computeDecimalsType = computed(() => {
|
|
177
175
|
const { type } = props;
|
|
178
176
|
return type === 'float' || type === 'amount';
|
|
@@ -264,6 +262,23 @@ export default defineComponent({
|
|
|
264
262
|
}
|
|
265
263
|
return false;
|
|
266
264
|
});
|
|
265
|
+
const refMaps = {
|
|
266
|
+
refElem,
|
|
267
|
+
refInput: refInputTarget
|
|
268
|
+
};
|
|
269
|
+
const computeMaps = {
|
|
270
|
+
computeControlOpts
|
|
271
|
+
};
|
|
272
|
+
const $xeNumberInput = {
|
|
273
|
+
xID,
|
|
274
|
+
props,
|
|
275
|
+
context,
|
|
276
|
+
reactData,
|
|
277
|
+
internalData,
|
|
278
|
+
getRefMaps: () => refMaps,
|
|
279
|
+
getComputeMaps: () => computeMaps
|
|
280
|
+
};
|
|
281
|
+
let numberInputMethods = {};
|
|
267
282
|
const handleNumberString = (val) => {
|
|
268
283
|
if (XEUtils.eqNull(val)) {
|
|
269
284
|
return '';
|
|
@@ -490,32 +505,28 @@ export default defineComponent({
|
|
|
490
505
|
}
|
|
491
506
|
emitInputEvent(getNumberValue(restNum), evnt);
|
|
492
507
|
};
|
|
493
|
-
const
|
|
508
|
+
const numberPlusEvent = (evnt) => {
|
|
494
509
|
const isDisabled = computeIsDisabled.value;
|
|
495
510
|
const formReadonly = computeFormReadonly.value;
|
|
496
|
-
const
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
numberChange(false, evnt);
|
|
511
|
+
const isDisabledAddNumber = computeIsDisabledAddNumber.value;
|
|
512
|
+
if (!isDisabled && !formReadonly && !isDisabledAddNumber) {
|
|
513
|
+
numberChange(true, evnt);
|
|
500
514
|
}
|
|
501
515
|
reactData.isActivated = true;
|
|
516
|
+
numberInputMethods.dispatchEvent('plus-number', { value: reactData.inputValue }, evnt);
|
|
517
|
+
// 已废弃
|
|
502
518
|
numberInputMethods.dispatchEvent('next-number', { value: reactData.inputValue }, evnt);
|
|
503
519
|
};
|
|
504
|
-
const
|
|
505
|
-
internalData.dnTimeout = setTimeout(() => {
|
|
506
|
-
numberNextEvent(evnt);
|
|
507
|
-
numberDownNextEvent(evnt);
|
|
508
|
-
}, 60);
|
|
509
|
-
};
|
|
510
|
-
const numberPrevEvent = (evnt) => {
|
|
520
|
+
const numberMinusEvent = (evnt) => {
|
|
511
521
|
const isDisabled = computeIsDisabled.value;
|
|
512
522
|
const formReadonly = computeFormReadonly.value;
|
|
513
|
-
const
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
numberChange(true, evnt);
|
|
523
|
+
const isDisabledSubtractNumber = computeIsDisabledSubtractNumber.value;
|
|
524
|
+
if (!isDisabled && !formReadonly && !isDisabledSubtractNumber) {
|
|
525
|
+
numberChange(false, evnt);
|
|
517
526
|
}
|
|
518
527
|
reactData.isActivated = true;
|
|
528
|
+
numberInputMethods.dispatchEvent('minus-number', { value: reactData.inputValue }, evnt);
|
|
529
|
+
// 已废弃
|
|
519
530
|
numberInputMethods.dispatchEvent('prev-number', { value: reactData.inputValue }, evnt);
|
|
520
531
|
};
|
|
521
532
|
const numberKeydownEvent = (evnt) => {
|
|
@@ -524,15 +535,17 @@ export default defineComponent({
|
|
|
524
535
|
if (isUpArrow || isDwArrow) {
|
|
525
536
|
evnt.preventDefault();
|
|
526
537
|
if (isUpArrow) {
|
|
527
|
-
|
|
538
|
+
numberMinusEvent(evnt);
|
|
528
539
|
}
|
|
529
540
|
else {
|
|
530
|
-
|
|
541
|
+
numberPlusEvent(evnt);
|
|
531
542
|
}
|
|
532
543
|
}
|
|
533
544
|
};
|
|
534
545
|
const keydownEvent = (evnt) => {
|
|
535
546
|
const { type, exponential, controls } = props;
|
|
547
|
+
const controlOpts = computeControlOpts.value;
|
|
548
|
+
const { showButton } = controlOpts;
|
|
536
549
|
const inputReadonly = computeInputReadonly.value;
|
|
537
550
|
const isControlKey = hasControlKey(evnt);
|
|
538
551
|
const isShiftKey = evnt.shiftKey;
|
|
@@ -550,7 +563,7 @@ export default defineComponent({
|
|
|
550
563
|
afterCheckValue();
|
|
551
564
|
}
|
|
552
565
|
else if (isUpArrow || isDwArrow) {
|
|
553
|
-
if (controls && !inputReadonly) {
|
|
566
|
+
if (isEnableConf(controlOpts) && (controls === false ? controls : showButton) && !inputReadonly) {
|
|
554
567
|
numberKeydownEvent(evnt);
|
|
555
568
|
}
|
|
556
569
|
}
|
|
@@ -560,51 +573,89 @@ export default defineComponent({
|
|
|
560
573
|
triggerEvent(evnt);
|
|
561
574
|
};
|
|
562
575
|
// 数值
|
|
563
|
-
const
|
|
576
|
+
const stopDown = () => {
|
|
564
577
|
const { dnTimeout } = internalData;
|
|
565
578
|
if (dnTimeout) {
|
|
566
579
|
clearTimeout(dnTimeout);
|
|
567
580
|
internalData.dnTimeout = undefined;
|
|
568
581
|
}
|
|
569
582
|
};
|
|
570
|
-
const
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
583
|
+
const stopAutoIncrement = () => {
|
|
584
|
+
const { ainTimeout } = internalData;
|
|
585
|
+
if (ainTimeout) {
|
|
586
|
+
clearTimeout(ainTimeout);
|
|
587
|
+
internalData.ainTimeout = undefined;
|
|
588
|
+
}
|
|
589
|
+
};
|
|
590
|
+
const numberDownMinusEvent = (evnt) => {
|
|
591
|
+
numberStopAll();
|
|
592
|
+
internalData.ainTimeout = setTimeout(() => {
|
|
593
|
+
numberMinusEvent(evnt);
|
|
594
|
+
numberDownMinusEvent(evnt);
|
|
574
595
|
}, 60);
|
|
575
596
|
};
|
|
597
|
+
const numberDownPlusEvent = (evnt) => {
|
|
598
|
+
numberStopAll();
|
|
599
|
+
internalData.ainTimeout = setTimeout(() => {
|
|
600
|
+
numberPlusEvent(evnt);
|
|
601
|
+
numberDownPlusEvent(evnt);
|
|
602
|
+
}, 60);
|
|
603
|
+
};
|
|
604
|
+
const numberStopAll = () => {
|
|
605
|
+
stopDown();
|
|
606
|
+
stopAutoIncrement();
|
|
607
|
+
};
|
|
608
|
+
const numberClickEvent = (evnt) => {
|
|
609
|
+
if (internalData.isMouseDown) {
|
|
610
|
+
internalData.isMouseDown = false;
|
|
611
|
+
}
|
|
612
|
+
else {
|
|
613
|
+
numberStopAll();
|
|
614
|
+
const isAddNumber = hasClass(evnt.currentTarget, 'is--plus');
|
|
615
|
+
if (isAddNumber) {
|
|
616
|
+
numberPlusEvent(evnt);
|
|
617
|
+
}
|
|
618
|
+
else {
|
|
619
|
+
numberMinusEvent(evnt);
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
};
|
|
576
623
|
const numberMousedownEvent = (evnt) => {
|
|
577
|
-
|
|
624
|
+
numberStopAll();
|
|
625
|
+
internalData.isMouseDown = true;
|
|
578
626
|
if (evnt.button === 0) {
|
|
579
|
-
const
|
|
580
|
-
if (
|
|
581
|
-
|
|
627
|
+
const isAddNumber = hasClass(evnt.currentTarget, 'is--plus');
|
|
628
|
+
if (isAddNumber) {
|
|
629
|
+
numberPlusEvent(evnt);
|
|
582
630
|
}
|
|
583
631
|
else {
|
|
584
|
-
|
|
632
|
+
numberMinusEvent(evnt);
|
|
585
633
|
}
|
|
586
634
|
internalData.dnTimeout = setTimeout(() => {
|
|
587
|
-
if (
|
|
588
|
-
|
|
635
|
+
if (isAddNumber) {
|
|
636
|
+
numberDownPlusEvent(evnt);
|
|
589
637
|
}
|
|
590
638
|
else {
|
|
591
|
-
|
|
639
|
+
numberDownMinusEvent(evnt);
|
|
592
640
|
}
|
|
593
641
|
}, 500);
|
|
594
642
|
}
|
|
595
643
|
};
|
|
596
644
|
const wheelEvent = (evnt) => {
|
|
645
|
+
const { controls } = props;
|
|
646
|
+
const controlOpts = computeControlOpts.value;
|
|
647
|
+
const { isWheel } = controlOpts;
|
|
597
648
|
const inputReadonly = computeInputReadonly.value;
|
|
598
|
-
if (
|
|
649
|
+
if (isEnableConf(controlOpts) && (controls === false ? controls : isWheel) && !inputReadonly) {
|
|
599
650
|
if (reactData.isActivated) {
|
|
600
651
|
evnt.stopPropagation();
|
|
601
652
|
evnt.preventDefault();
|
|
602
653
|
const delta = evnt.deltaY;
|
|
603
654
|
if (delta > 0) {
|
|
604
|
-
|
|
655
|
+
numberPlusEvent(evnt);
|
|
605
656
|
}
|
|
606
657
|
else if (delta < 0) {
|
|
607
|
-
|
|
658
|
+
numberMinusEvent(evnt);
|
|
608
659
|
}
|
|
609
660
|
}
|
|
610
661
|
}
|
|
@@ -661,42 +712,34 @@ export default defineComponent({
|
|
|
661
712
|
afterCheckValue();
|
|
662
713
|
}
|
|
663
714
|
};
|
|
664
|
-
const
|
|
665
|
-
|
|
666
|
-
const isDisabledSubtractNumber = computeIsDisabledSubtractNumber.value;
|
|
667
|
-
return h('div', {
|
|
668
|
-
class: 'vxe-input--control-icon'
|
|
669
|
-
}, [
|
|
670
|
-
h('div', {
|
|
671
|
-
class: 'vxe-input--number-icon'
|
|
672
|
-
}, [
|
|
673
|
-
h('div', {
|
|
674
|
-
class: ['vxe-input--number-btn is--prev', {
|
|
675
|
-
'is--disabled': isDisabledAddNumber
|
|
676
|
-
}],
|
|
677
|
-
onMousedown: numberMousedownEvent,
|
|
678
|
-
onMouseup: numberStopDown,
|
|
679
|
-
onMouseleave: numberStopDown
|
|
680
|
-
}, [
|
|
681
|
-
h('i', {
|
|
682
|
-
class: getIcon().NUMBER_INPUT_PREV_NUM
|
|
683
|
-
})
|
|
684
|
-
]),
|
|
685
|
-
h('div', {
|
|
686
|
-
class: ['vxe-input--number-btn is--next', {
|
|
687
|
-
'is--disabled': isDisabledSubtractNumber
|
|
688
|
-
}],
|
|
689
|
-
onMousedown: numberMousedownEvent,
|
|
690
|
-
onMouseup: numberStopDown,
|
|
691
|
-
onMouseleave: numberStopDown
|
|
692
|
-
}, [
|
|
693
|
-
h('i', {
|
|
694
|
-
class: getIcon().NUMBER_INPUT_NEXT_NUM
|
|
695
|
-
})
|
|
696
|
-
])
|
|
697
|
-
])
|
|
698
|
-
]);
|
|
715
|
+
const dispatchEvent = (type, params, evnt) => {
|
|
716
|
+
emit(type, createEvent(evnt, { $numberInput: $xeNumberInput }, params));
|
|
699
717
|
};
|
|
718
|
+
numberInputMethods = {
|
|
719
|
+
dispatchEvent,
|
|
720
|
+
focus() {
|
|
721
|
+
const inputReadonly = computeInputReadonly.value;
|
|
722
|
+
if (!inputReadonly) {
|
|
723
|
+
const inputElem = refInputTarget.value;
|
|
724
|
+
reactData.isActivated = true;
|
|
725
|
+
inputElem.focus();
|
|
726
|
+
}
|
|
727
|
+
return nextTick();
|
|
728
|
+
},
|
|
729
|
+
blur() {
|
|
730
|
+
const inputElem = refInputTarget.value;
|
|
731
|
+
inputElem.blur();
|
|
732
|
+
reactData.isActivated = false;
|
|
733
|
+
return nextTick();
|
|
734
|
+
},
|
|
735
|
+
select() {
|
|
736
|
+
const inputElem = refInputTarget.value;
|
|
737
|
+
inputElem.select();
|
|
738
|
+
reactData.isActivated = false;
|
|
739
|
+
return nextTick();
|
|
740
|
+
}
|
|
741
|
+
};
|
|
742
|
+
Object.assign($xeNumberInput, numberInputMethods);
|
|
700
743
|
const renderPrefixIcon = () => {
|
|
701
744
|
const { prefixIcon } = props;
|
|
702
745
|
const prefixSlot = slots.prefix;
|
|
@@ -715,7 +758,7 @@ export default defineComponent({
|
|
|
715
758
|
})
|
|
716
759
|
])
|
|
717
760
|
])
|
|
718
|
-
:
|
|
761
|
+
: renderEmptyElement($xeNumberInput);
|
|
719
762
|
};
|
|
720
763
|
const renderSuffixIcon = () => {
|
|
721
764
|
const { suffixIcon } = props;
|
|
@@ -737,8 +780,7 @@ export default defineComponent({
|
|
|
737
780
|
class: getIcon().INPUT_CLEAR
|
|
738
781
|
})
|
|
739
782
|
])
|
|
740
|
-
:
|
|
741
|
-
renderExtraSuffixIcon(),
|
|
783
|
+
: renderEmptyElement($xeNumberInput),
|
|
742
784
|
suffixSlot || suffixIcon
|
|
743
785
|
? h('div', {
|
|
744
786
|
class: 'vxe-number-input--suffix-icon',
|
|
@@ -750,85 +792,28 @@ export default defineComponent({
|
|
|
750
792
|
class: suffixIcon
|
|
751
793
|
})
|
|
752
794
|
])
|
|
753
|
-
:
|
|
795
|
+
: renderEmptyElement($xeNumberInput)
|
|
754
796
|
]);
|
|
755
797
|
};
|
|
756
|
-
const
|
|
757
|
-
const {
|
|
758
|
-
const
|
|
759
|
-
if (controls && !inputReadonly) {
|
|
760
|
-
return renderNumberIcon();
|
|
761
|
-
}
|
|
762
|
-
return createCommentVNode();
|
|
763
|
-
};
|
|
764
|
-
const dispatchEvent = (type, params, evnt) => {
|
|
765
|
-
emit(type, createEvent(evnt, { $numberInput: $xeNumberInput }, params));
|
|
766
|
-
};
|
|
767
|
-
numberInputMethods = {
|
|
768
|
-
dispatchEvent,
|
|
769
|
-
focus() {
|
|
770
|
-
const inputReadonly = computeInputReadonly.value;
|
|
771
|
-
if (!inputReadonly) {
|
|
772
|
-
const inputElem = refInputTarget.value;
|
|
773
|
-
reactData.isActivated = true;
|
|
774
|
-
inputElem.focus();
|
|
775
|
-
}
|
|
776
|
-
return nextTick();
|
|
777
|
-
},
|
|
778
|
-
blur() {
|
|
779
|
-
const inputElem = refInputTarget.value;
|
|
780
|
-
inputElem.blur();
|
|
781
|
-
reactData.isActivated = false;
|
|
782
|
-
return nextTick();
|
|
783
|
-
},
|
|
784
|
-
select() {
|
|
785
|
-
const inputElem = refInputTarget.value;
|
|
786
|
-
inputElem.select();
|
|
787
|
-
reactData.isActivated = false;
|
|
788
|
-
return nextTick();
|
|
789
|
-
}
|
|
790
|
-
};
|
|
791
|
-
Object.assign($xeNumberInput, numberInputMethods);
|
|
792
|
-
const renderVN = () => {
|
|
793
|
-
const { className, controls, type, align, name, autocomplete, autoComplete } = props;
|
|
794
|
-
const { inputValue, isFocus, isActivated } = reactData;
|
|
795
|
-
const vSize = computeSize.value;
|
|
798
|
+
const renderInput = () => {
|
|
799
|
+
const { type, name, autocomplete, autoComplete } = props;
|
|
800
|
+
const { inputValue, isFocus } = reactData;
|
|
796
801
|
const isDisabled = computeIsDisabled.value;
|
|
797
|
-
const formReadonly = computeFormReadonly.value;
|
|
798
802
|
const numLabel = computeNumLabel.value;
|
|
799
|
-
if (formReadonly) {
|
|
800
|
-
return h('div', {
|
|
801
|
-
ref: refElem,
|
|
802
|
-
class: ['vxe-number-input--readonly', `type--${type}`, className]
|
|
803
|
-
}, numLabel);
|
|
804
|
-
}
|
|
805
803
|
const inputReadonly = computeInputReadonly.value;
|
|
806
804
|
const inpMaxLength = computeInpMaxLength.value;
|
|
807
805
|
const inpPlaceholder = computeInpPlaceholder.value;
|
|
808
|
-
const isClearable = computeIsClearable.value;
|
|
809
|
-
const prefix = renderPrefixIcon();
|
|
810
|
-
const suffix = renderSuffixIcon();
|
|
811
806
|
return h('div', {
|
|
812
|
-
|
|
813
|
-
class:
|
|
814
|
-
[`size--${vSize}`]: vSize,
|
|
815
|
-
[`is--${align}`]: align,
|
|
816
|
-
'is--controls': controls && !inputReadonly,
|
|
817
|
-
'is--prefix': !!prefix,
|
|
818
|
-
'is--suffix': !!suffix,
|
|
819
|
-
'is--disabled': isDisabled,
|
|
820
|
-
'is--active': isActivated,
|
|
821
|
-
'show--clear': isClearable && !isDisabled && !(inputValue === '' || XEUtils.eqNull(inputValue))
|
|
822
|
-
}],
|
|
823
|
-
spellcheck: false
|
|
807
|
+
key: 'ni',
|
|
808
|
+
class: 'vxe-number-input--input-wrapper'
|
|
824
809
|
}, [
|
|
825
|
-
|
|
810
|
+
renderPrefixIcon(),
|
|
826
811
|
h('div', {
|
|
827
|
-
class: 'vxe-number-input--
|
|
812
|
+
class: 'vxe-number-input--input-inner'
|
|
828
813
|
}, [
|
|
829
814
|
h('input', {
|
|
830
815
|
ref: refInputTarget,
|
|
831
|
-
class: 'vxe-number-input--
|
|
816
|
+
class: 'vxe-number-input--input',
|
|
832
817
|
value: !isFocus && type === 'amount' ? numLabel : inputValue,
|
|
833
818
|
name,
|
|
834
819
|
type: 'text',
|
|
@@ -847,9 +832,107 @@ export default defineComponent({
|
|
|
847
832
|
onBlur: blurEvent
|
|
848
833
|
})
|
|
849
834
|
]),
|
|
850
|
-
|
|
835
|
+
renderSuffixIcon()
|
|
851
836
|
]);
|
|
852
837
|
};
|
|
838
|
+
const renderMinusBtn = () => {
|
|
839
|
+
const { minusIcon } = props;
|
|
840
|
+
const isDisabledSubtractNumber = computeIsDisabledSubtractNumber.value;
|
|
841
|
+
return h('button', {
|
|
842
|
+
key: 'prev',
|
|
843
|
+
class: ['vxe-number-input--minus-btn is--minus', {
|
|
844
|
+
'is--disabled': isDisabledSubtractNumber
|
|
845
|
+
}],
|
|
846
|
+
onClick: numberClickEvent,
|
|
847
|
+
onMousedown: numberMousedownEvent,
|
|
848
|
+
onMouseup: numberStopAll,
|
|
849
|
+
onMouseleave: numberStopAll
|
|
850
|
+
}, [
|
|
851
|
+
h('i', {
|
|
852
|
+
class: minusIcon || getIcon().NUMBER_INPUT_MINUS_NUM
|
|
853
|
+
})
|
|
854
|
+
]);
|
|
855
|
+
};
|
|
856
|
+
const renderPlusBtn = () => {
|
|
857
|
+
const { plusIcon } = props;
|
|
858
|
+
const isDisabledAddNumber = computeIsDisabledAddNumber.value;
|
|
859
|
+
return h('button', {
|
|
860
|
+
key: 'next',
|
|
861
|
+
class: ['vxe-number-input--plus-btn is--plus', {
|
|
862
|
+
'is--disabled': isDisabledAddNumber
|
|
863
|
+
}],
|
|
864
|
+
onClick: numberClickEvent,
|
|
865
|
+
onMousedown: numberMousedownEvent,
|
|
866
|
+
onMouseup: numberStopAll,
|
|
867
|
+
onMouseleave: numberStopAll
|
|
868
|
+
}, [
|
|
869
|
+
h('i', {
|
|
870
|
+
class: plusIcon || getIcon().NUMBER_INPUT_PLUS_NUM
|
|
871
|
+
})
|
|
872
|
+
]);
|
|
873
|
+
};
|
|
874
|
+
const renderSideControl = () => {
|
|
875
|
+
return h('div', {
|
|
876
|
+
key: 'cplr',
|
|
877
|
+
class: 'vxe-number-input--side-control'
|
|
878
|
+
}, [
|
|
879
|
+
renderPlusBtn(),
|
|
880
|
+
renderMinusBtn()
|
|
881
|
+
]);
|
|
882
|
+
};
|
|
883
|
+
const renderVN = () => {
|
|
884
|
+
const { className, controls, type, align, prefixIcon, suffixIcon } = props;
|
|
885
|
+
const { inputValue, isActivated } = reactData;
|
|
886
|
+
const vSize = computeSize.value;
|
|
887
|
+
const controlOpts = computeControlOpts.value;
|
|
888
|
+
const { layout, showButton } = controlOpts;
|
|
889
|
+
const isDisabled = computeIsDisabled.value;
|
|
890
|
+
const formReadonly = computeFormReadonly.value;
|
|
891
|
+
const numLabel = computeNumLabel.value;
|
|
892
|
+
const prefixSlot = slots.prefix;
|
|
893
|
+
const suffixSlot = slots.suffix;
|
|
894
|
+
if (formReadonly) {
|
|
895
|
+
return h('div', {
|
|
896
|
+
ref: refElem,
|
|
897
|
+
class: ['vxe-number-input--readonly', `type--${type}`, className]
|
|
898
|
+
}, numLabel);
|
|
899
|
+
}
|
|
900
|
+
const inputReadonly = computeInputReadonly.value;
|
|
901
|
+
const isClearable = computeIsClearable.value;
|
|
902
|
+
const isControls = isEnableConf(controlOpts) && (controls === false ? controls : showButton);
|
|
903
|
+
return h('div', {
|
|
904
|
+
ref: refElem,
|
|
905
|
+
class: ['vxe-number-input', `type--${type}`, `control-${layout === 'right' || layout === 'left' ? layout : 'default'}`, className, {
|
|
906
|
+
[`size--${vSize}`]: vSize,
|
|
907
|
+
[`is--${align}`]: align,
|
|
908
|
+
'is--controls': isControls && !inputReadonly,
|
|
909
|
+
'is--prefix': !!prefixSlot || prefixIcon,
|
|
910
|
+
'is--suffix': !!suffixSlot || suffixIcon,
|
|
911
|
+
'is--disabled': isDisabled,
|
|
912
|
+
'is--active': isActivated,
|
|
913
|
+
'show--clear': isClearable && !isDisabled && !(inputValue === '' || XEUtils.eqNull(inputValue))
|
|
914
|
+
}],
|
|
915
|
+
spellcheck: false
|
|
916
|
+
}, isControls
|
|
917
|
+
? (layout === 'right'
|
|
918
|
+
? [
|
|
919
|
+
renderInput(),
|
|
920
|
+
renderSideControl()
|
|
921
|
+
]
|
|
922
|
+
: (layout === 'left'
|
|
923
|
+
? [
|
|
924
|
+
renderSideControl(),
|
|
925
|
+
renderInput()
|
|
926
|
+
]
|
|
927
|
+
: [
|
|
928
|
+
renderMinusBtn(),
|
|
929
|
+
renderInput(),
|
|
930
|
+
renderPlusBtn()
|
|
931
|
+
]))
|
|
932
|
+
: [
|
|
933
|
+
renderInput()
|
|
934
|
+
]);
|
|
935
|
+
};
|
|
853
936
|
$xeNumberInput.renderVN = renderVN;
|
|
854
937
|
watch(() => props.modelValue, (val) => {
|
|
855
938
|
if (!internalData.isUM) {
|
|
@@ -871,7 +954,7 @@ export default defineComponent({
|
|
|
871
954
|
});
|
|
872
955
|
onBeforeUnmount(() => {
|
|
873
956
|
reactData.isFocus = false;
|
|
874
|
-
|
|
957
|
+
numberStopAll();
|
|
875
958
|
afterCheckValue();
|
|
876
959
|
globalEvents.off($xeNumberInput, 'mousedown');
|
|
877
960
|
globalEvents.off($xeNumberInput, 'keydown');
|