vxe-pc-ui 4.17.0 → 4.17.2
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 +297 -152
- package/dist/style.css +1 -1
- package/dist/style.min.css +1 -1
- package/es/date-picker/src/date-picker.js +6 -2
- package/es/date-range-picker/src/date-range-picker.js +6 -2
- package/es/icon/style.css +1 -1
- package/es/input/src/input.js +79 -51
- package/es/number-input/src/number-input.js +31 -23
- package/es/password-input/src/password-input.js +133 -62
- package/es/password-input/style.css +5 -0
- package/es/password-input/style.min.css +1 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/textarea/src/textarea.js +43 -13
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/es/vxe-password-input/style.css +5 -0
- package/es/vxe-password-input/style.min.css +1 -1
- package/lib/date-picker/src/date-picker.js +6 -1
- package/lib/date-picker/src/date-picker.min.js +1 -1
- package/lib/date-range-picker/src/date-range-picker.js +6 -1
- package/lib/date-range-picker/src/date-range-picker.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 +321 -168
- package/lib/index.umd.min.js +1 -1
- package/lib/input/src/input.js +83 -53
- package/lib/input/src/input.min.js +1 -1
- package/lib/number-input/src/number-input.js +35 -25
- package/lib/number-input/src/number-input.min.js +1 -1
- package/lib/password-input/src/password-input.js +140 -71
- package/lib/password-input/src/password-input.min.js +1 -1
- package/lib/password-input/style/style.css +5 -0
- package/lib/password-input/style/style.min.css +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/textarea/src/textarea.js +46 -13
- package/lib/textarea/src/textarea.min.js +1 -1
- package/lib/ui/index.js +1 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/vxe-password-input/style/style.css +5 -0
- package/lib/vxe-password-input/style/style.min.css +1 -1
- package/package.json +1 -1
- package/packages/date-picker/src/date-picker.ts +6 -2
- package/packages/date-range-picker/src/date-range-picker.ts +6 -2
- package/packages/input/src/input.ts +85 -56
- package/packages/number-input/src/number-input.ts +32 -25
- package/packages/password-input/src/password-input.ts +145 -69
- package/packages/textarea/src/textarea.ts +49 -17
- package/styles/components/password-input.scss +4 -0
- package/types/components/date-picker.d.ts +2 -0
- package/types/components/date-range-picker.d.ts +2 -0
- package/types/components/input.d.ts +2 -0
- package/types/components/number-input.d.ts +2 -0
- package/types/components/password-input.d.ts +4 -0
- package/types/components/table-module/edit.d.ts +37 -4
- package/types/components/table.d.ts +9 -2
- package/types/components/textarea.d.ts +2 -0
- package/types/ui/renderer.d.ts +9 -3
- /package/es/icon/{iconfont.1786782471977.ttf → iconfont.1786868252000.ttf} +0 -0
- /package/es/icon/{iconfont.1786782471977.woff → iconfont.1786868252000.woff} +0 -0
- /package/es/icon/{iconfont.1786782471977.woff2 → iconfont.1786868252000.woff2} +0 -0
- /package/es/{iconfont.1786782471977.ttf → iconfont.1786868252000.ttf} +0 -0
- /package/es/{iconfont.1786782471977.woff → iconfont.1786868252000.woff} +0 -0
- /package/es/{iconfont.1786782471977.woff2 → iconfont.1786868252000.woff2} +0 -0
- /package/lib/icon/style/{iconfont.1786782471977.ttf → iconfont.1786868252000.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1786782471977.woff → iconfont.1786868252000.woff} +0 -0
- /package/lib/icon/style/{iconfont.1786782471977.woff2 → iconfont.1786868252000.woff2} +0 -0
- /package/lib/{iconfont.1786782471977.ttf → iconfont.1786868252000.ttf} +0 -0
- /package/lib/{iconfont.1786782471977.woff → iconfont.1786868252000.woff} +0 -0
- /package/lib/{iconfont.1786782471977.woff2 → iconfont.1786868252000.woff2} +0 -0
|
@@ -43,6 +43,10 @@ export default defineVxeComponent({
|
|
|
43
43
|
align: String,
|
|
44
44
|
form: String,
|
|
45
45
|
className: String,
|
|
46
|
+
inputClassName: {
|
|
47
|
+
type: String,
|
|
48
|
+
default: () => getConfig().numberInput.inputClassName
|
|
49
|
+
},
|
|
46
50
|
size: {
|
|
47
51
|
type: String,
|
|
48
52
|
default: () => getConfig().numberInput.size || getConfig().size
|
|
@@ -294,6 +298,10 @@ export default defineVxeComponent({
|
|
|
294
298
|
}
|
|
295
299
|
return false;
|
|
296
300
|
});
|
|
301
|
+
const computeInpClassNamevalue = computed(() => {
|
|
302
|
+
const { inputClassName } = props;
|
|
303
|
+
return 'vxe-number-input--input' + (inputClassName ? (' ' + inputClassName) : '');
|
|
304
|
+
});
|
|
297
305
|
const refMaps = {
|
|
298
306
|
refElem,
|
|
299
307
|
refInput: refInputTarget
|
|
@@ -310,7 +318,9 @@ export default defineVxeComponent({
|
|
|
310
318
|
getRefMaps: () => refMaps,
|
|
311
319
|
getComputeMaps: () => computeMaps
|
|
312
320
|
};
|
|
313
|
-
|
|
321
|
+
const dispatchEvent = (type, params, evnt) => {
|
|
322
|
+
emit(type, createEvent(evnt, { $numberInput: $xeNumberInput }, params));
|
|
323
|
+
};
|
|
314
324
|
const handleNumberString = (val) => {
|
|
315
325
|
if (XEUtils.eqNull(val)) {
|
|
316
326
|
return '';
|
|
@@ -339,7 +349,7 @@ export default defineVxeComponent({
|
|
|
339
349
|
};
|
|
340
350
|
const triggerEvent = (evnt) => {
|
|
341
351
|
const { inputValue } = reactData;
|
|
342
|
-
|
|
352
|
+
dispatchEvent(evnt.type, { value: inputValue }, evnt);
|
|
343
353
|
};
|
|
344
354
|
const handleChange = (val, inputValue, evnt) => {
|
|
345
355
|
const value = eqEmptyValue(val) ? null : Number(val);
|
|
@@ -353,9 +363,9 @@ export default defineVxeComponent({
|
|
|
353
363
|
reactData.inputValue = inputValue || '';
|
|
354
364
|
});
|
|
355
365
|
}
|
|
356
|
-
|
|
366
|
+
dispatchEvent('input', { value }, evnt);
|
|
357
367
|
if (isChange) {
|
|
358
|
-
|
|
368
|
+
dispatchEvent('change', { value }, evnt);
|
|
359
369
|
// 自动更新校验状态
|
|
360
370
|
if ($xeForm && formItemInfo) {
|
|
361
371
|
$xeForm.triggerItemEvent(evnt, formItemInfo.itemConfig.field, value);
|
|
@@ -370,7 +380,7 @@ export default defineVxeComponent({
|
|
|
370
380
|
handleChange(value, inputValue, evnt);
|
|
371
381
|
}
|
|
372
382
|
else {
|
|
373
|
-
|
|
383
|
+
dispatchEvent('input', { value }, evnt);
|
|
374
384
|
// 自动更新校验状态
|
|
375
385
|
if ($xeForm && formItemInfo) {
|
|
376
386
|
$xeForm.triggerItemEvent(evnt, formItemInfo.itemConfig.field, value);
|
|
@@ -387,7 +397,7 @@ export default defineVxeComponent({
|
|
|
387
397
|
if (!inpImmediate) {
|
|
388
398
|
triggerEvent(evnt);
|
|
389
399
|
}
|
|
390
|
-
|
|
400
|
+
dispatchEvent('lazy-change', { value: reactData.inputValue }, evnt);
|
|
391
401
|
};
|
|
392
402
|
const focusEvent = (evnt) => {
|
|
393
403
|
const inputReadonly = computeInputReadonly.value;
|
|
@@ -403,20 +413,20 @@ export default defineVxeComponent({
|
|
|
403
413
|
const isDisabled = computeIsDisabled.value;
|
|
404
414
|
if (!isDisabled) {
|
|
405
415
|
const { inputValue } = reactData;
|
|
406
|
-
|
|
416
|
+
dispatchEvent('prefix-click', { value: inputValue }, evnt);
|
|
407
417
|
}
|
|
408
418
|
};
|
|
409
419
|
const clearValueEvent = (evnt, value) => {
|
|
410
420
|
focus();
|
|
411
421
|
handleChange(null, '', evnt);
|
|
412
|
-
|
|
413
|
-
|
|
422
|
+
dispatchEvent('clear', { value }, evnt);
|
|
423
|
+
dispatchEvent('lazy-change', { value }, evnt);
|
|
414
424
|
};
|
|
415
425
|
const clickSuffixEvent = (evnt) => {
|
|
416
426
|
const isDisabled = computeIsDisabled.value;
|
|
417
427
|
if (!isDisabled) {
|
|
418
428
|
const { inputValue } = reactData;
|
|
419
|
-
|
|
429
|
+
dispatchEvent('suffix-click', { value: inputValue }, evnt);
|
|
420
430
|
}
|
|
421
431
|
};
|
|
422
432
|
const updateModel = (val) => {
|
|
@@ -518,7 +528,7 @@ export default defineVxeComponent({
|
|
|
518
528
|
afterCheckValue();
|
|
519
529
|
reactData.isFocus = false;
|
|
520
530
|
reactData.isActivated = false;
|
|
521
|
-
|
|
531
|
+
dispatchEvent('blur', { value }, evnt);
|
|
522
532
|
// 自动更新校验状态
|
|
523
533
|
if ($xeForm && formItemInfo) {
|
|
524
534
|
$xeForm.triggerItemEvent(evnt, formItemInfo.itemConfig.field, value);
|
|
@@ -551,10 +561,10 @@ export default defineVxeComponent({
|
|
|
551
561
|
numberChange(true, evnt);
|
|
552
562
|
}
|
|
553
563
|
reactData.isActivated = true;
|
|
554
|
-
|
|
555
|
-
|
|
564
|
+
dispatchEvent('plus-number', { value: reactData.inputValue }, evnt);
|
|
565
|
+
dispatchEvent('lazy-change', { value: reactData.inputValue }, evnt);
|
|
556
566
|
// 已废弃
|
|
557
|
-
|
|
567
|
+
dispatchEvent('next-number', { value: reactData.inputValue }, evnt);
|
|
558
568
|
};
|
|
559
569
|
const numberMinusEvent = (evnt) => {
|
|
560
570
|
const isDisabled = computeIsDisabled.value;
|
|
@@ -564,10 +574,10 @@ export default defineVxeComponent({
|
|
|
564
574
|
numberChange(false, evnt);
|
|
565
575
|
}
|
|
566
576
|
reactData.isActivated = true;
|
|
567
|
-
|
|
568
|
-
|
|
577
|
+
dispatchEvent('minus-number', { value: reactData.inputValue }, evnt);
|
|
578
|
+
dispatchEvent('lazy-change', { value: reactData.inputValue }, evnt);
|
|
569
579
|
// 已废弃
|
|
570
|
-
|
|
580
|
+
dispatchEvent('prev-number', { value: reactData.inputValue }, evnt);
|
|
571
581
|
};
|
|
572
582
|
const numberKeydownEvent = (evnt) => {
|
|
573
583
|
const isUpArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_UP);
|
|
@@ -754,10 +764,7 @@ export default defineVxeComponent({
|
|
|
754
764
|
afterCheckValue();
|
|
755
765
|
}
|
|
756
766
|
};
|
|
757
|
-
const
|
|
758
|
-
emit(type, createEvent(evnt, { $numberInput: $xeNumberInput }, params));
|
|
759
|
-
};
|
|
760
|
-
numberInputMethods = {
|
|
767
|
+
const numberInputMethods = {
|
|
761
768
|
dispatchEvent,
|
|
762
769
|
focus() {
|
|
763
770
|
const inputReadonly = computeInputReadonly.value;
|
|
@@ -865,6 +872,7 @@ export default defineVxeComponent({
|
|
|
865
872
|
const inputReadonly = computeInputReadonly.value;
|
|
866
873
|
const inpMaxLength = computeInpMaxLength.value;
|
|
867
874
|
const inpPlaceholder = computeInpPlaceholder.value;
|
|
875
|
+
const inpClassName = computeInpClassNamevalue.value;
|
|
868
876
|
return h('div', {
|
|
869
877
|
key: 'ni',
|
|
870
878
|
class: 'vxe-number-input--input-wrapper'
|
|
@@ -875,10 +883,10 @@ export default defineVxeComponent({
|
|
|
875
883
|
}, [
|
|
876
884
|
h('input', {
|
|
877
885
|
ref: refInputTarget,
|
|
878
|
-
class:
|
|
879
|
-
value: !isFocus && type === 'amount' ? numLabel : inputValue,
|
|
886
|
+
class: inpClassName,
|
|
880
887
|
name,
|
|
881
888
|
type: 'text',
|
|
889
|
+
value: !isFocus && type === 'amount' ? numLabel : inputValue,
|
|
882
890
|
placeholder: inpPlaceholder,
|
|
883
891
|
maxlength: inpMaxLength,
|
|
884
892
|
readonly: inputReadonly,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { h, ref, computed, reactive, inject, nextTick, watch } from 'vue';
|
|
1
|
+
import { h, ref, computed, reactive, inject, nextTick, watch, onMounted } from 'vue';
|
|
2
2
|
import { defineVxeComponent } from '../../ui/src/comp';
|
|
3
3
|
import XEUtils from 'xe-utils';
|
|
4
4
|
import { getConfig, getIcon, getI18n, createEvent, useSize, renderEmptyElement } from '../../ui';
|
|
5
|
-
import { getFuncText } from '../../ui/src/utils';
|
|
5
|
+
import { getFuncText, getText } from '../../ui/src/utils';
|
|
6
6
|
import { getSlotVNs } from '../../ui/src/vn';
|
|
7
7
|
export default defineVxeComponent({
|
|
8
8
|
name: 'VxePasswordInput',
|
|
@@ -26,6 +26,10 @@ export default defineVxeComponent({
|
|
|
26
26
|
default: 'off'
|
|
27
27
|
},
|
|
28
28
|
className: String,
|
|
29
|
+
inputClassName: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: () => getConfig().passwordInput.inputClassName
|
|
32
|
+
},
|
|
29
33
|
size: {
|
|
30
34
|
type: String,
|
|
31
35
|
default: () => getConfig().passwordInput.size || getConfig().size
|
|
@@ -36,6 +40,10 @@ export default defineVxeComponent({
|
|
|
36
40
|
type: Boolean,
|
|
37
41
|
default: () => getConfig().passwordInput.controls
|
|
38
42
|
},
|
|
43
|
+
editable: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
default: true
|
|
46
|
+
},
|
|
39
47
|
// 已废弃
|
|
40
48
|
autocomplete: String
|
|
41
49
|
},
|
|
@@ -76,14 +84,9 @@ export default defineVxeComponent({
|
|
|
76
84
|
reactData,
|
|
77
85
|
getRefMaps: () => refMaps
|
|
78
86
|
};
|
|
79
|
-
let passwordInputMethods = {};
|
|
80
87
|
const computeIsClearable = computed(() => {
|
|
81
88
|
return props.clearable;
|
|
82
89
|
});
|
|
83
|
-
const computeInpReadonly = computed(() => {
|
|
84
|
-
const { readonly } = props;
|
|
85
|
-
return readonly;
|
|
86
|
-
});
|
|
87
90
|
const computeInpPlaceholder = computed(() => {
|
|
88
91
|
const { placeholder } = props;
|
|
89
92
|
if (placeholder) {
|
|
@@ -95,6 +98,32 @@ export default defineVxeComponent({
|
|
|
95
98
|
}
|
|
96
99
|
return getI18n('vxe.base.pleaseInput');
|
|
97
100
|
});
|
|
101
|
+
const computeFormReadonly = computed(() => {
|
|
102
|
+
if (getConfig().inputReadonly === 'obsolete') {
|
|
103
|
+
if ($xeForm) {
|
|
104
|
+
return $xeForm.props.readonly;
|
|
105
|
+
}
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
const { readonly } = props;
|
|
109
|
+
if (readonly === null) {
|
|
110
|
+
if ($xeForm) {
|
|
111
|
+
return $xeForm.props.readonly;
|
|
112
|
+
}
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
return readonly;
|
|
116
|
+
});
|
|
117
|
+
const computeIsDisabled = computed(() => {
|
|
118
|
+
const { disabled } = props;
|
|
119
|
+
if (disabled === null) {
|
|
120
|
+
if ($xeForm) {
|
|
121
|
+
return $xeForm.props.disabled;
|
|
122
|
+
}
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
return disabled;
|
|
126
|
+
});
|
|
98
127
|
const computeInputType = computed(() => {
|
|
99
128
|
const { showPwd } = reactData;
|
|
100
129
|
if (showPwd) {
|
|
@@ -106,9 +135,28 @@ export default defineVxeComponent({
|
|
|
106
135
|
const { immediate } = props;
|
|
107
136
|
return immediate;
|
|
108
137
|
});
|
|
138
|
+
const computeInputReadonly = computed(() => {
|
|
139
|
+
const { editable } = props;
|
|
140
|
+
const formReadonly = computeFormReadonly.value;
|
|
141
|
+
return formReadonly || !editable;
|
|
142
|
+
});
|
|
143
|
+
const computeDomValue = computed(() => {
|
|
144
|
+
const { inputValue } = reactData;
|
|
145
|
+
return inputValue;
|
|
146
|
+
});
|
|
147
|
+
const dispatchEvent = (type, params, evnt) => {
|
|
148
|
+
emit(type, createEvent(evnt, { $passwordInput: $xePasswordInput }, params));
|
|
149
|
+
};
|
|
150
|
+
const updateDomValue = () => {
|
|
151
|
+
const domValue = computeDomValue.value;
|
|
152
|
+
const inputElem = refInputTarget.value;
|
|
153
|
+
if (inputElem) {
|
|
154
|
+
inputElem.value = XEUtils.eqNull(domValue) ? '' : ('' + domValue);
|
|
155
|
+
}
|
|
156
|
+
};
|
|
109
157
|
const triggerEvent = (evnt) => {
|
|
110
158
|
const { inputValue } = reactData;
|
|
111
|
-
|
|
159
|
+
dispatchEvent(evnt.type, { value: inputValue }, evnt);
|
|
112
160
|
};
|
|
113
161
|
const emitInputEvent = (value, evnt) => {
|
|
114
162
|
const inpImmediate = computeInpImmediate.value;
|
|
@@ -117,7 +165,7 @@ export default defineVxeComponent({
|
|
|
117
165
|
handleChange(value, evnt);
|
|
118
166
|
}
|
|
119
167
|
else {
|
|
120
|
-
|
|
168
|
+
dispatchEvent('input', { value }, evnt);
|
|
121
169
|
}
|
|
122
170
|
};
|
|
123
171
|
const inputEvent = (evnt) => {
|
|
@@ -128,9 +176,9 @@ export default defineVxeComponent({
|
|
|
128
176
|
const handleChange = (value, evnt) => {
|
|
129
177
|
reactData.inputValue = value;
|
|
130
178
|
emit('update:modelValue', value);
|
|
131
|
-
|
|
179
|
+
dispatchEvent('input', { value }, evnt);
|
|
132
180
|
if (XEUtils.toValueString(props.modelValue) !== value) {
|
|
133
|
-
|
|
181
|
+
dispatchEvent('change', { value }, evnt);
|
|
134
182
|
// 自动更新校验状态
|
|
135
183
|
if ($xeForm && formItemInfo) {
|
|
136
184
|
$xeForm.triggerItemEvent(evnt, formItemInfo.itemConfig.field, value);
|
|
@@ -139,7 +187,7 @@ export default defineVxeComponent({
|
|
|
139
187
|
};
|
|
140
188
|
const changeEvent = (evnt) => {
|
|
141
189
|
triggerEvent(evnt);
|
|
142
|
-
|
|
190
|
+
dispatchEvent('lazy-change', { value: reactData.inputValue }, evnt);
|
|
143
191
|
// 自动更新校验状态
|
|
144
192
|
if ($xeForm && formItemInfo) {
|
|
145
193
|
$xeForm.triggerItemEvent(evnt, formItemInfo.itemConfig.field, reactData.inputValue);
|
|
@@ -153,19 +201,20 @@ export default defineVxeComponent({
|
|
|
153
201
|
const { inputValue } = reactData;
|
|
154
202
|
const value = inputValue;
|
|
155
203
|
reactData.isActivated = false;
|
|
156
|
-
|
|
204
|
+
dispatchEvent('blur', { value }, evnt);
|
|
157
205
|
// 自动更新校验状态
|
|
158
206
|
if ($xeForm && formItemInfo) {
|
|
159
207
|
$xeForm.triggerItemEvent(evnt, formItemInfo.itemConfig.field, value);
|
|
160
208
|
}
|
|
161
209
|
};
|
|
162
210
|
const passwordToggleEvent = (evnt) => {
|
|
163
|
-
const { readonly, disabled } = props;
|
|
164
211
|
const { showPwd } = reactData;
|
|
165
|
-
|
|
212
|
+
const isDisabled = computeIsDisabled.value;
|
|
213
|
+
const formReadonly = computeFormReadonly.value;
|
|
214
|
+
if (!isDisabled && !formReadonly) {
|
|
166
215
|
reactData.showPwd = !showPwd;
|
|
167
216
|
}
|
|
168
|
-
|
|
217
|
+
dispatchEvent('toggle-visible', { visible: reactData.showPwd }, evnt);
|
|
169
218
|
};
|
|
170
219
|
const clickEvent = (evnt) => {
|
|
171
220
|
triggerEvent(evnt);
|
|
@@ -173,23 +222,45 @@ export default defineVxeComponent({
|
|
|
173
222
|
const clearValueEvent = (evnt, value) => {
|
|
174
223
|
focus();
|
|
175
224
|
handleChange('', evnt);
|
|
176
|
-
|
|
177
|
-
|
|
225
|
+
dispatchEvent('clear', { value }, evnt);
|
|
226
|
+
dispatchEvent('lazy-change', { value: reactData.inputValue }, evnt);
|
|
178
227
|
};
|
|
179
228
|
const clickSuffixEvent = (evnt) => {
|
|
180
|
-
const
|
|
181
|
-
if (!
|
|
229
|
+
const isDisabled = computeIsDisabled.value;
|
|
230
|
+
if (!isDisabled) {
|
|
182
231
|
const { inputValue } = reactData;
|
|
183
|
-
|
|
232
|
+
dispatchEvent('suffix-click', { value: inputValue }, evnt);
|
|
184
233
|
}
|
|
185
234
|
};
|
|
186
235
|
const clickPrefixEvent = (evnt) => {
|
|
187
|
-
const
|
|
188
|
-
if (!
|
|
236
|
+
const isDisabled = computeIsDisabled.value;
|
|
237
|
+
if (!isDisabled) {
|
|
189
238
|
const { inputValue } = reactData;
|
|
190
|
-
|
|
239
|
+
dispatchEvent('prefix-click', { value: inputValue }, evnt);
|
|
191
240
|
}
|
|
192
241
|
};
|
|
242
|
+
const passwordInputMethods = {
|
|
243
|
+
dispatchEvent,
|
|
244
|
+
focus() {
|
|
245
|
+
const inputElem = refInputTarget.value;
|
|
246
|
+
reactData.isActivated = true;
|
|
247
|
+
inputElem.focus();
|
|
248
|
+
return nextTick();
|
|
249
|
+
},
|
|
250
|
+
blur() {
|
|
251
|
+
const inputElem = refInputTarget.value;
|
|
252
|
+
inputElem.blur();
|
|
253
|
+
reactData.isActivated = false;
|
|
254
|
+
return nextTick();
|
|
255
|
+
},
|
|
256
|
+
select() {
|
|
257
|
+
const inputElem = refInputTarget.value;
|
|
258
|
+
inputElem.select();
|
|
259
|
+
reactData.isActivated = false;
|
|
260
|
+
return nextTick();
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
Object.assign($xePasswordInput, passwordInputMethods);
|
|
193
264
|
const renderPasswordIcon = () => {
|
|
194
265
|
const { showPwd } = reactData;
|
|
195
266
|
return h('div', {
|
|
@@ -222,14 +293,15 @@ export default defineVxeComponent({
|
|
|
222
293
|
: null;
|
|
223
294
|
};
|
|
224
295
|
const renderSuffixIcon = () => {
|
|
225
|
-
const {
|
|
296
|
+
const { suffixIcon, controls } = props;
|
|
226
297
|
const { inputValue } = reactData;
|
|
227
|
-
const
|
|
298
|
+
const isDisabled = computeIsDisabled.value;
|
|
228
299
|
const isClearable = computeIsClearable.value;
|
|
300
|
+
const suffixSlot = slots.suffix;
|
|
229
301
|
return isClearable || controls || suffixSlot || suffixIcon
|
|
230
302
|
? h('div', {
|
|
231
303
|
class: ['vxe-password-input--suffix', {
|
|
232
|
-
'is--clear': isClearable && !
|
|
304
|
+
'is--clear': isClearable && !isDisabled && !(inputValue === '' || XEUtils.eqNull(inputValue))
|
|
233
305
|
}]
|
|
234
306
|
}, [
|
|
235
307
|
isClearable
|
|
@@ -258,41 +330,22 @@ export default defineVxeComponent({
|
|
|
258
330
|
])
|
|
259
331
|
: null;
|
|
260
332
|
};
|
|
261
|
-
passwordInputMethods = {
|
|
262
|
-
dispatchEvent(type, params, evnt) {
|
|
263
|
-
emit(type, createEvent(evnt, { $passwordInput: $xePasswordInput }, params));
|
|
264
|
-
},
|
|
265
|
-
focus() {
|
|
266
|
-
const inputElem = refInputTarget.value;
|
|
267
|
-
reactData.isActivated = true;
|
|
268
|
-
inputElem.focus();
|
|
269
|
-
return nextTick();
|
|
270
|
-
},
|
|
271
|
-
blur() {
|
|
272
|
-
const inputElem = refInputTarget.value;
|
|
273
|
-
inputElem.blur();
|
|
274
|
-
reactData.isActivated = false;
|
|
275
|
-
return nextTick();
|
|
276
|
-
},
|
|
277
|
-
select() {
|
|
278
|
-
const inputElem = refInputTarget.value;
|
|
279
|
-
inputElem.select();
|
|
280
|
-
reactData.isActivated = false;
|
|
281
|
-
return nextTick();
|
|
282
|
-
}
|
|
283
|
-
};
|
|
284
|
-
Object.assign($xePasswordInput, passwordInputMethods);
|
|
285
|
-
watch(() => props.modelValue, (val) => {
|
|
286
|
-
reactData.inputValue = val;
|
|
287
|
-
});
|
|
288
333
|
const renderVN = () => {
|
|
289
|
-
const { className,
|
|
334
|
+
const { className, inputClassName, name, readonly, autocomplete, autoComplete, maxLength } = props;
|
|
290
335
|
const { inputValue, isActivated } = reactData;
|
|
336
|
+
const isDisabled = computeIsDisabled.value;
|
|
337
|
+
const formReadonly = computeFormReadonly.value;
|
|
338
|
+
if (formReadonly) {
|
|
339
|
+
return h('div', {
|
|
340
|
+
ref: refElem,
|
|
341
|
+
class: ['vxe-password-input--readonly', className]
|
|
342
|
+
}, getText(inputValue));
|
|
343
|
+
}
|
|
291
344
|
const vSize = computeSize.value;
|
|
292
|
-
const inpReadonly = computeInpReadonly.value;
|
|
293
345
|
const inputType = computeInputType.value;
|
|
294
346
|
const inpPlaceholder = computeInpPlaceholder.value;
|
|
295
347
|
const isClearable = computeIsClearable.value;
|
|
348
|
+
const inputReadonly = computeInputReadonly.value;
|
|
296
349
|
const prefix = renderPrefixIcon();
|
|
297
350
|
const suffix = renderSuffixIcon();
|
|
298
351
|
return h('div', {
|
|
@@ -302,9 +355,9 @@ export default defineVxeComponent({
|
|
|
302
355
|
'is--prefix': !!prefix,
|
|
303
356
|
'is--suffix': !!suffix,
|
|
304
357
|
'is--readonly': readonly,
|
|
305
|
-
'is--disabled':
|
|
358
|
+
'is--disabled': isDisabled,
|
|
306
359
|
'is--active': isActivated,
|
|
307
|
-
'show--clear': isClearable && !
|
|
360
|
+
'show--clear': isClearable && !isDisabled && !(inputValue === '' || XEUtils.eqNull(inputValue))
|
|
308
361
|
}],
|
|
309
362
|
spellcheck: false
|
|
310
363
|
}, [
|
|
@@ -314,13 +367,12 @@ export default defineVxeComponent({
|
|
|
314
367
|
}, [
|
|
315
368
|
h('input', {
|
|
316
369
|
ref: refInputTarget,
|
|
317
|
-
class: 'vxe-password-input--inner',
|
|
318
|
-
value: inputValue,
|
|
370
|
+
class: 'vxe-password-input--inner' + (inputClassName ? (' ' + inputClassName) : ''),
|
|
319
371
|
name,
|
|
320
372
|
type: inputType,
|
|
321
373
|
placeholder: inpPlaceholder,
|
|
322
|
-
readonly:
|
|
323
|
-
disabled,
|
|
374
|
+
readonly: inputReadonly,
|
|
375
|
+
disabled: isDisabled,
|
|
324
376
|
autocomplete: autocomplete || autoComplete,
|
|
325
377
|
maxlength: maxLength,
|
|
326
378
|
onClick: clickEvent,
|
|
@@ -333,6 +385,25 @@ export default defineVxeComponent({
|
|
|
333
385
|
suffix || renderEmptyElement($xePasswordInput)
|
|
334
386
|
]);
|
|
335
387
|
};
|
|
388
|
+
watch(() => props.modelValue, (val) => {
|
|
389
|
+
reactData.inputValue = val;
|
|
390
|
+
});
|
|
391
|
+
const rDvFlag = ref(0);
|
|
392
|
+
watch(computeFormReadonly, () => {
|
|
393
|
+
rDvFlag.value++;
|
|
394
|
+
});
|
|
395
|
+
watch(computeDomValue, () => {
|
|
396
|
+
rDvFlag.value++;
|
|
397
|
+
});
|
|
398
|
+
watch(rDvFlag, () => {
|
|
399
|
+
updateDomValue();
|
|
400
|
+
nextTick(() => {
|
|
401
|
+
updateDomValue();
|
|
402
|
+
});
|
|
403
|
+
});
|
|
404
|
+
onMounted(() => {
|
|
405
|
+
updateDomValue();
|
|
406
|
+
});
|
|
336
407
|
$xePasswordInput.renderVN = renderVN;
|
|
337
408
|
return $xePasswordInput;
|
|
338
409
|
},
|
|
@@ -23,6 +23,11 @@
|
|
|
23
23
|
--vxe-ui-password-input-current-height: var(--vxe-ui-input-height-mini);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
.vxe-password-input--readonly {
|
|
27
|
+
color: var(--vxe-ui-font-color);
|
|
28
|
+
display: inline-flex;
|
|
29
|
+
}
|
|
30
|
+
|
|
26
31
|
.vxe-password-input--wrapper {
|
|
27
32
|
flex-grow: 1;
|
|
28
33
|
overflow: hidden;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.vxe-password-input{--vxe-ui-password-input-current-font-size:var(--vxe-ui-font-size-default);--vxe-ui-password-input-current-height:var(--vxe-ui-input-height-default)}.vxe-password-input.size--xlarge{--vxe-ui-password-input-current-font-size:var(--vxe-ui-font-size-xlarge);--vxe-ui-password-input-current-height:var(--vxe-ui-input-height-xlarge)}.vxe-password-input.size--large{--vxe-ui-password-input-current-font-size:var(--vxe-ui-font-size-large);--vxe-ui-password-input-current-height:var(--vxe-ui-input-height-large)}.vxe-password-input.size--medium{--vxe-ui-password-input-current-font-size:var(--vxe-ui-font-size-medium);--vxe-ui-password-input-current-height:var(--vxe-ui-input-height-medium)}.vxe-password-input.size--small{--vxe-ui-password-input-current-font-size:var(--vxe-ui-font-size-small);--vxe-ui-password-input-current-height:var(--vxe-ui-input-height-small)}.vxe-password-input.size--mini{--vxe-ui-password-input-current-font-size:var(--vxe-ui-font-size-mini);--vxe-ui-password-input-current-height:var(--vxe-ui-input-height-mini)}.vxe-password-input--wrapper{flex-grow:1;overflow:hidden}.vxe-password-input--inner{display:block;width:100%;height:100%;outline:0;margin:0;font-size:inherit;font-family:inherit;line-height:inherit;padding:0 .5em;color:var(--vxe-ui-font-color);border:0;border-radius:var(--vxe-ui-base-border-radius);background-color:var(--vxe-ui-layout-background-color);box-shadow:none}.vxe-password-input--inner[disabled]{cursor:not-allowed;color:var(--vxe-ui-font-disabled-color);background-color:var(--vxe-ui-input-disabled-background-color)}.vxe-password-input--inner::-moz-placeholder{color:var(--vxe-ui-input-placeholder-color)}.vxe-password-input--inner::placeholder{color:var(--vxe-ui-input-placeholder-color)}.vxe-password-input--inner::-webkit-autofill{background-color:var(--vxe-ui-layout-background-color)}.vxe-password-input.is--disabled{background-color:var(--vxe-ui-input-disabled-background-color)}.vxe-password-input.is--disabled .vxe-password-input--clear-icon,.vxe-password-input.is--disabled .vxe-password-input--control-icon,.vxe-password-input.is--disabled .vxe-password-input--prefix,.vxe-password-input.is--disabled .vxe-password-input--suffix{cursor:not-allowed}.vxe-password-input.is--disabled .vxe-password-input--prefix,.vxe-password-input.is--disabled .vxe-password-input--suffix{background-color:var(--vxe-ui-input-disabled-background-color)}.vxe-password-input{display:inline-flex;flex-direction:row;position:relative;border-radius:var(--vxe-ui-base-border-radius);width:180px;border:1px solid var(--vxe-ui-input-border-color)}.vxe-password-input.is--active{border:1px solid var(--vxe-ui-font-primary-color)}.vxe-password-input.show--clear:hover .vxe-password-input--clear-icon{display:block}.vxe-password-input--prefix,.vxe-password-input--suffix{display:flex;flex-direction:row;align-items:center;flex-shrink:0;background-color:var(--vxe-ui-layout-background-color)}.vxe-password-input--prefix{border-radius:var(--vxe-ui-base-border-radius) 0 0 var(--vxe-ui-base-border-radius)}.vxe-password-input--suffix{border-radius:0 var(--vxe-ui-base-border-radius) var(--vxe-ui-base-border-radius) 0}.vxe-password-input--clear-icon,.vxe-password-input--control-icon,.vxe-password-input--prefix-icon,.vxe-password-input--suffix-icon{color:var(--vxe-ui-input-placeholder-color)}.vxe-password-input--prefix-icon{padding-left:.5em}.vxe-password-input--clear-icon,.vxe-password-input--control-icon,.vxe-password-input--suffix-icon{padding-right:.5em}.vxe-password-input--clear-icon,.vxe-password-input--control-icon{height:100%;cursor:pointer}.vxe-password-input--clear-icon{display:none}.vxe-password-input--clear-icon:hover{color:var(--vxe-ui-font-color)}.vxe-password-input--clear-icon:active{color:var(--vxe-ui-font-primary-color)}.vxe-password-input--number-btn{height:50%;display:flex;align-items:center;justify-content:center}.vxe-password-input--number-btn:hover{color:var(--vxe-ui-font-color)}.vxe-password-input--number-btn:active{color:var(--vxe-ui-font-primary-color)}.vxe-password-input--number-icon{display:flex;flex-direction:column;height:100%}.vxe-password-input--number-icon .vxe-password-input--number-btn.is--disabled{cursor:no-drop;color:var(--vxe-ui-font-disabled-color)}.vxe-password-input--count{flex-shrink:0;color:var(--vxe-ui-input-count-color);background-color:var(--vxe-ui-layout-background-color);padding-right:.6em}.vxe-password-input--count.is--error{color:var(--vxe-ui-input-count-error-color)}.vxe-password-input.is--left .vxe-password-input--inner{text-align:left}.vxe-password-input.is--center .vxe-password-input--inner{text-align:center}.vxe-password-input.is--right .vxe-password-input--inner{text-align:right}.vxe-password-input--panel{display:none;position:absolute;left:0;padding:4px 0;color:var(--vxe-ui-font-color);font-size:var(--vxe-ui-font-size-default);text-align:left}.vxe-password-input--panel:not(.is--transfer){min-width:100%}.vxe-password-input--panel.is--transfer{position:fixed}.vxe-password-input--panel.ani--leave{display:block;opacity:0;transform:scaleY(.5);transition:transform .3s cubic-bezier(.23,1,.32,1),opacity .3s cubic-bezier(.23,1,.32,1);transform-origin:center top;backface-visibility:hidden;transform-style:preserve-3d}.vxe-password-input--panel.ani--leave[placement=top]{transform-origin:center bottom}.vxe-password-input--panel.ani--enter{opacity:1;transform:scaleY(1)}.vxe-password-input{font-size:var(--vxe-ui-password-input-current-font-size);height:var(--vxe-ui-password-input-current-height);line-height:var(--vxe-ui-password-input-current-height)}
|
|
1
|
+
.vxe-password-input{--vxe-ui-password-input-current-font-size:var(--vxe-ui-font-size-default);--vxe-ui-password-input-current-height:var(--vxe-ui-input-height-default)}.vxe-password-input.size--xlarge{--vxe-ui-password-input-current-font-size:var(--vxe-ui-font-size-xlarge);--vxe-ui-password-input-current-height:var(--vxe-ui-input-height-xlarge)}.vxe-password-input.size--large{--vxe-ui-password-input-current-font-size:var(--vxe-ui-font-size-large);--vxe-ui-password-input-current-height:var(--vxe-ui-input-height-large)}.vxe-password-input.size--medium{--vxe-ui-password-input-current-font-size:var(--vxe-ui-font-size-medium);--vxe-ui-password-input-current-height:var(--vxe-ui-input-height-medium)}.vxe-password-input.size--small{--vxe-ui-password-input-current-font-size:var(--vxe-ui-font-size-small);--vxe-ui-password-input-current-height:var(--vxe-ui-input-height-small)}.vxe-password-input.size--mini{--vxe-ui-password-input-current-font-size:var(--vxe-ui-font-size-mini);--vxe-ui-password-input-current-height:var(--vxe-ui-input-height-mini)}.vxe-password-input--readonly{color:var(--vxe-ui-font-color);display:inline-flex}.vxe-password-input--wrapper{flex-grow:1;overflow:hidden}.vxe-password-input--inner{display:block;width:100%;height:100%;outline:0;margin:0;font-size:inherit;font-family:inherit;line-height:inherit;padding:0 .5em;color:var(--vxe-ui-font-color);border:0;border-radius:var(--vxe-ui-base-border-radius);background-color:var(--vxe-ui-layout-background-color);box-shadow:none}.vxe-password-input--inner[disabled]{cursor:not-allowed;color:var(--vxe-ui-font-disabled-color);background-color:var(--vxe-ui-input-disabled-background-color)}.vxe-password-input--inner::-moz-placeholder{color:var(--vxe-ui-input-placeholder-color)}.vxe-password-input--inner::placeholder{color:var(--vxe-ui-input-placeholder-color)}.vxe-password-input--inner::-webkit-autofill{background-color:var(--vxe-ui-layout-background-color)}.vxe-password-input.is--disabled{background-color:var(--vxe-ui-input-disabled-background-color)}.vxe-password-input.is--disabled .vxe-password-input--clear-icon,.vxe-password-input.is--disabled .vxe-password-input--control-icon,.vxe-password-input.is--disabled .vxe-password-input--prefix,.vxe-password-input.is--disabled .vxe-password-input--suffix{cursor:not-allowed}.vxe-password-input.is--disabled .vxe-password-input--prefix,.vxe-password-input.is--disabled .vxe-password-input--suffix{background-color:var(--vxe-ui-input-disabled-background-color)}.vxe-password-input{display:inline-flex;flex-direction:row;position:relative;border-radius:var(--vxe-ui-base-border-radius);width:180px;border:1px solid var(--vxe-ui-input-border-color)}.vxe-password-input.is--active{border:1px solid var(--vxe-ui-font-primary-color)}.vxe-password-input.show--clear:hover .vxe-password-input--clear-icon{display:block}.vxe-password-input--prefix,.vxe-password-input--suffix{display:flex;flex-direction:row;align-items:center;flex-shrink:0;background-color:var(--vxe-ui-layout-background-color)}.vxe-password-input--prefix{border-radius:var(--vxe-ui-base-border-radius) 0 0 var(--vxe-ui-base-border-radius)}.vxe-password-input--suffix{border-radius:0 var(--vxe-ui-base-border-radius) var(--vxe-ui-base-border-radius) 0}.vxe-password-input--clear-icon,.vxe-password-input--control-icon,.vxe-password-input--prefix-icon,.vxe-password-input--suffix-icon{color:var(--vxe-ui-input-placeholder-color)}.vxe-password-input--prefix-icon{padding-left:.5em}.vxe-password-input--clear-icon,.vxe-password-input--control-icon,.vxe-password-input--suffix-icon{padding-right:.5em}.vxe-password-input--clear-icon,.vxe-password-input--control-icon{height:100%;cursor:pointer}.vxe-password-input--clear-icon{display:none}.vxe-password-input--clear-icon:hover{color:var(--vxe-ui-font-color)}.vxe-password-input--clear-icon:active{color:var(--vxe-ui-font-primary-color)}.vxe-password-input--number-btn{height:50%;display:flex;align-items:center;justify-content:center}.vxe-password-input--number-btn:hover{color:var(--vxe-ui-font-color)}.vxe-password-input--number-btn:active{color:var(--vxe-ui-font-primary-color)}.vxe-password-input--number-icon{display:flex;flex-direction:column;height:100%}.vxe-password-input--number-icon .vxe-password-input--number-btn.is--disabled{cursor:no-drop;color:var(--vxe-ui-font-disabled-color)}.vxe-password-input--count{flex-shrink:0;color:var(--vxe-ui-input-count-color);background-color:var(--vxe-ui-layout-background-color);padding-right:.6em}.vxe-password-input--count.is--error{color:var(--vxe-ui-input-count-error-color)}.vxe-password-input.is--left .vxe-password-input--inner{text-align:left}.vxe-password-input.is--center .vxe-password-input--inner{text-align:center}.vxe-password-input.is--right .vxe-password-input--inner{text-align:right}.vxe-password-input--panel{display:none;position:absolute;left:0;padding:4px 0;color:var(--vxe-ui-font-color);font-size:var(--vxe-ui-font-size-default);text-align:left}.vxe-password-input--panel:not(.is--transfer){min-width:100%}.vxe-password-input--panel.is--transfer{position:fixed}.vxe-password-input--panel.ani--leave{display:block;opacity:0;transform:scaleY(.5);transition:transform .3s cubic-bezier(.23,1,.32,1),opacity .3s cubic-bezier(.23,1,.32,1);transform-origin:center top;backface-visibility:hidden;transform-style:preserve-3d}.vxe-password-input--panel.ani--leave[placement=top]{transform-origin:center bottom}.vxe-password-input--panel.ani--enter{opacity:1;transform:scaleY(1)}.vxe-password-input{font-size:var(--vxe-ui-password-input-current-font-size);height:var(--vxe-ui-password-input-current-height);line-height:var(--vxe-ui-password-input-current-height)}
|