@varlet/ui 2.4.1 → 2.4.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/es/input/Input.js +12 -5
- package/es/snackbar/style/index.js +1 -1
- package/es/varlet.esm.js +1568 -1568
- package/highlight/web-types.json +1 -1
- package/lib/input/Input.js +11 -4
- package/package.json +5 -5
- package/umd/varlet.js +6 -6
package/es/input/Input.js
CHANGED
|
@@ -2,7 +2,7 @@ import VarFormDetails from '../form-details';
|
|
|
2
2
|
import VarIcon from '../icon';
|
|
3
3
|
import { defineComponent, getCurrentInstance, ref, computed, nextTick, onMounted } from 'vue';
|
|
4
4
|
import { props } from './props';
|
|
5
|
-
import { isEmpty } from '@varlet/shared';
|
|
5
|
+
import { isEmpty, toNumber } from '@varlet/shared';
|
|
6
6
|
import { useValidation, createNamespace, call } from '../utils/components';
|
|
7
7
|
import { useForm } from '../form/provide';
|
|
8
8
|
var {
|
|
@@ -235,20 +235,25 @@ export default defineComponent({
|
|
|
235
235
|
};
|
|
236
236
|
|
|
237
237
|
var handleInput = e => {
|
|
238
|
+
var target = e.target;
|
|
238
239
|
var {
|
|
239
240
|
value
|
|
240
|
-
} =
|
|
241
|
-
value = withTrim(value);
|
|
241
|
+
} = target;
|
|
242
|
+
value = withMaxlength(withTrim(value));
|
|
243
|
+
target.value = value;
|
|
242
244
|
call(props['onUpdate:modelValue'], value);
|
|
243
245
|
call(props.onInput, value, e);
|
|
244
246
|
validateWithTrigger('onInput');
|
|
245
247
|
};
|
|
246
248
|
|
|
247
249
|
var handleChange = e => {
|
|
250
|
+
var target = e.target;
|
|
248
251
|
var {
|
|
249
252
|
value
|
|
250
|
-
} =
|
|
251
|
-
|
|
253
|
+
} = target;
|
|
254
|
+
value = withMaxlength(withTrim(value));
|
|
255
|
+
target.value = value;
|
|
256
|
+
call(props.onChange, value, e);
|
|
252
257
|
validateWithTrigger('onChange');
|
|
253
258
|
};
|
|
254
259
|
|
|
@@ -285,6 +290,8 @@ export default defineComponent({
|
|
|
285
290
|
|
|
286
291
|
var withTrim = value => props.modelModifiers.trim ? value.trim() : value;
|
|
287
292
|
|
|
293
|
+
var withMaxlength = value => props.maxlength ? value.slice(0, toNumber(props.maxlength)) : value;
|
|
294
|
+
|
|
288
295
|
var handleTouchstart = e => {
|
|
289
296
|
var {
|
|
290
297
|
disabled,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import '../../styles/common.css'
|
|
2
|
-
import '../SnackbarSfc.css'
|
|
3
2
|
import '../../styles/elevation.css'
|
|
4
3
|
import '../../loading/loading.css'
|
|
5
4
|
import '../../button/button.css'
|
|
6
5
|
import '../../icon/icon.css'
|
|
7
6
|
import '../snackbar.css'
|
|
8
7
|
import '../coreSfc.css'
|
|
8
|
+
import '../SnackbarSfc.css'
|