@antify/ui 3.1.24 → 3.1.25
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.
|
@@ -16,9 +16,13 @@ import {
|
|
|
16
16
|
BaseInputType,
|
|
17
17
|
} from './Elements/__types';
|
|
18
18
|
import AntField from '../forms/AntField.vue';
|
|
19
|
+
import {
|
|
20
|
+
useVModel,
|
|
21
|
+
} from '@vueuse/core';
|
|
19
22
|
|
|
20
|
-
const
|
|
23
|
+
const emit = defineEmits([
|
|
21
24
|
'update:modelValue',
|
|
25
|
+
'update:inputRef',
|
|
22
26
|
]);
|
|
23
27
|
const props = withDefaults(defineProps<{
|
|
24
28
|
modelValue: string | null;
|
|
@@ -31,8 +35,10 @@ const props = withDefaults(defineProps<{
|
|
|
31
35
|
skeleton?: boolean;
|
|
32
36
|
inputTimeout?: number;
|
|
33
37
|
query?: string;
|
|
38
|
+
inputRef?: null | HTMLInputElement;
|
|
34
39
|
}>(), {
|
|
35
40
|
disabled: false,
|
|
41
|
+
inputRef: null,
|
|
36
42
|
skeleton: false,
|
|
37
43
|
readonly: false,
|
|
38
44
|
size: Size.md,
|
|
@@ -47,7 +53,7 @@ const _value = computed<string | null>({
|
|
|
47
53
|
get: () => props.modelValue,
|
|
48
54
|
set: (val: string | null) => {
|
|
49
55
|
if (val === null) {
|
|
50
|
-
return
|
|
56
|
+
return emit('update:modelValue', val);
|
|
51
57
|
}
|
|
52
58
|
|
|
53
59
|
if (timeout.value) {
|
|
@@ -55,10 +61,11 @@ const _value = computed<string | null>({
|
|
|
55
61
|
}
|
|
56
62
|
|
|
57
63
|
timeout.value = setTimeout(() => {
|
|
58
|
-
|
|
64
|
+
emit('update:modelValue', val);
|
|
59
65
|
}, props.inputTimeout);
|
|
60
66
|
},
|
|
61
67
|
});
|
|
68
|
+
const _inputRef = useVModel(props, 'inputRef', emit);
|
|
62
69
|
|
|
63
70
|
onMounted(() => handleEnumValidation(props.size, Size, 'size'));
|
|
64
71
|
</script>
|
|
@@ -73,6 +80,7 @@ onMounted(() => handleEnumValidation(props.size, Size, 'size'));
|
|
|
73
80
|
>
|
|
74
81
|
<AntBaseInput
|
|
75
82
|
v-model="_value"
|
|
83
|
+
v-model:input-ref="_inputRef"
|
|
76
84
|
:type="BaseInputType.search"
|
|
77
85
|
:size="size"
|
|
78
86
|
:skeleton="skeleton"
|
|
@@ -75,7 +75,7 @@ const props = withDefaults(defineProps<{
|
|
|
75
75
|
inputRef: null,
|
|
76
76
|
});
|
|
77
77
|
const slot = useSlots();
|
|
78
|
-
const hasInputState = computed(() => props.skeleton || props.
|
|
78
|
+
const hasInputState = computed(() => props.skeleton || props.disabled);
|
|
79
79
|
const icons = {
|
|
80
80
|
[InputState.info]: faCircleInfo,
|
|
81
81
|
[InputState.warning]: faExclamationTriangle,
|
|
@@ -96,6 +96,7 @@ const inputClasses = computed(() => {
|
|
|
96
96
|
'block transition-colors relative border-none outline w-full text-black font-regular': true,
|
|
97
97
|
'outline-offset-[-1px] outline-1 focus:outline-offset-[-1px] focus:outline-1': true,
|
|
98
98
|
'disabled:opacity-50 disabled:cursor-not-allowed': props.disabled,
|
|
99
|
+
'read-only:cursor-default': props.readonly,
|
|
99
100
|
'text-right': props.type === BaseInputType.number,
|
|
100
101
|
[variants[props.state]]: true,
|
|
101
102
|
// Size
|