@antify/ui 4.1.17 → 4.1.18
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/components/inputs/AntColorInput/AntColorInput.stories.js +2 -1
- package/dist/components/inputs/AntColorInput/AntColorInput.stories.mjs +2 -1
- package/dist/components/inputs/AntColorInput/AntColorInput.vue +9 -3
- package/dist/components/inputs/AntDateInput.vue +7 -4
- package/dist/components/inputs/AntMultiSelect.vue +11 -5
- package/dist/components/inputs/AntNumberInput.vue +9 -2
- package/dist/components/inputs/AntSelect.vue +15 -7
- package/dist/components/inputs/AntTagInput.vue +6 -3
- package/dist/components/inputs/AntTextarea.vue +6 -3
- package/dist/components/inputs/AntUnitInput.vue +8 -0
- package/dist/components/inputs/Elements/AntSelectMenu.vue +2 -0
- package/dist/components/inputs/__stories/AntMultiSelect.stories.js +23 -46
- package/dist/components/inputs/__stories/AntMultiSelect.stories.mjs +32 -54
- package/package.json +1 -1
|
@@ -17,9 +17,13 @@ import ColorSelection from './ColorSelection.vue';
|
|
|
17
17
|
import {
|
|
18
18
|
ColorButtonSize,
|
|
19
19
|
} from './AntColorInput.types';
|
|
20
|
+
import {
|
|
21
|
+
useVModel,
|
|
22
|
+
} from '@vueuse/core';
|
|
20
23
|
|
|
21
24
|
const emit = defineEmits([
|
|
22
25
|
'update:modelValue',
|
|
26
|
+
'update:itemRef',
|
|
23
27
|
'validate',
|
|
24
28
|
'blur',
|
|
25
29
|
]);
|
|
@@ -38,6 +42,7 @@ const props = withDefaults(defineProps<{
|
|
|
38
42
|
nullable?: boolean;
|
|
39
43
|
colorsPerRow?: number;
|
|
40
44
|
dropdownWrapperClass?: string | Record<string, boolean>;
|
|
45
|
+
itemRef?: null | HTMLDivElement;
|
|
41
46
|
}>(), {
|
|
42
47
|
state: InputState.base,
|
|
43
48
|
size: Size.md,
|
|
@@ -45,6 +50,7 @@ const props = withDefaults(defineProps<{
|
|
|
45
50
|
messages: () => [],
|
|
46
51
|
nullable: false,
|
|
47
52
|
colorsPerRow: 4,
|
|
53
|
+
itemRef: null,
|
|
48
54
|
});
|
|
49
55
|
const _value = computed({
|
|
50
56
|
get() {
|
|
@@ -126,7 +132,7 @@ const inputButtonSize = computed(() => {
|
|
|
126
132
|
}
|
|
127
133
|
});
|
|
128
134
|
const showDropdown = ref<boolean>(false);
|
|
129
|
-
const
|
|
135
|
+
const _itemRef = useVModel(props, 'itemRef', emit);
|
|
130
136
|
|
|
131
137
|
/**
|
|
132
138
|
* Validate default value if given after delayed data fetching.
|
|
@@ -150,7 +156,7 @@ function onBlur(e: FocusEvent) {
|
|
|
150
156
|
function onColorSelect(val: string | null) {
|
|
151
157
|
emit('update:modelValue', val);
|
|
152
158
|
nextTick(() => showDropdown.value = false);
|
|
153
|
-
|
|
159
|
+
_itemRef.value?.focus();
|
|
154
160
|
}
|
|
155
161
|
|
|
156
162
|
function onClick() {
|
|
@@ -202,7 +208,7 @@ onMounted(() => {
|
|
|
202
208
|
rounded
|
|
203
209
|
>
|
|
204
210
|
<div
|
|
205
|
-
ref="
|
|
211
|
+
ref="_itemRef"
|
|
206
212
|
:class="itemClasses"
|
|
207
213
|
:tabindex="disabled || readonly ? -1 : 0"
|
|
208
214
|
@click="onClick"
|
|
@@ -49,6 +49,7 @@ const props = withDefaults(defineProps<{
|
|
|
49
49
|
min?: string;
|
|
50
50
|
max?: string;
|
|
51
51
|
nullable?: boolean;
|
|
52
|
+
inputRef?: HTMLInputElement | null;
|
|
52
53
|
}>(), {
|
|
53
54
|
state: InputState.base,
|
|
54
55
|
type: AntDateInputTypes.date,
|
|
@@ -58,13 +59,15 @@ const props = withDefaults(defineProps<{
|
|
|
58
59
|
size: Size.md,
|
|
59
60
|
messages: () => [],
|
|
60
61
|
nullable: false,
|
|
62
|
+
inputRef: null,
|
|
61
63
|
});
|
|
62
64
|
const emit = defineEmits([
|
|
63
65
|
'update:modelValue',
|
|
66
|
+
'update:inputRef',
|
|
64
67
|
'validate',
|
|
65
68
|
]);
|
|
66
69
|
const _modelValue = useVModel(props, 'modelValue', emit);
|
|
67
|
-
const
|
|
70
|
+
const _inputRef = useVModel(props, 'inputRef', emit);
|
|
68
71
|
const iconColor = computed(() => {
|
|
69
72
|
switch (props.state) {
|
|
70
73
|
case InputState.info:
|
|
@@ -90,7 +93,7 @@ onMounted(() => {
|
|
|
90
93
|
|
|
91
94
|
function onClickCalendar() {
|
|
92
95
|
if (!props.disabled && !props.readonly) {
|
|
93
|
-
|
|
96
|
+
_inputRef.value?.showPicker();
|
|
94
97
|
} else {
|
|
95
98
|
return;
|
|
96
99
|
}
|
|
@@ -110,7 +113,7 @@ function onClickCalendar() {
|
|
|
110
113
|
<div class="flex">
|
|
111
114
|
<AntBaseInput
|
|
112
115
|
v-model="_modelValue"
|
|
113
|
-
v-model:input-ref="
|
|
116
|
+
v-model:input-ref="_inputRef"
|
|
114
117
|
:type="type as unknown as BaseInputType"
|
|
115
118
|
:state="state"
|
|
116
119
|
:size="size"
|
|
@@ -143,8 +146,8 @@ function onClickCalendar() {
|
|
|
143
146
|
:state="state as unknown as State"
|
|
144
147
|
:skeleton="skeleton"
|
|
145
148
|
:size="size"
|
|
146
|
-
@click="_modelValue = null"
|
|
147
149
|
data-e2e="clear-button"
|
|
150
|
+
@click="_modelValue = null"
|
|
148
151
|
/>
|
|
149
152
|
</div>
|
|
150
153
|
</AntField>
|
|
@@ -32,6 +32,9 @@ import AntCheckboxGroup from './AntCheckboxGroup.vue';
|
|
|
32
32
|
import type {
|
|
33
33
|
AntCheckboxType,
|
|
34
34
|
} from './__types/AntCheckbox.types';
|
|
35
|
+
import {
|
|
36
|
+
useVModel,
|
|
37
|
+
} from '@vueuse/core';
|
|
35
38
|
|
|
36
39
|
defineOptions({
|
|
37
40
|
inheritAttrs: false,
|
|
@@ -56,6 +59,7 @@ const props = withDefaults(defineProps<{
|
|
|
56
59
|
wrapperClass?: string | Record<string, boolean>;
|
|
57
60
|
expanded?: boolean;
|
|
58
61
|
messages?: string[];
|
|
62
|
+
inputRef?: HTMLInputElement | null;
|
|
59
63
|
}>(), {
|
|
60
64
|
state: InputState.base,
|
|
61
65
|
grouped: Grouped.none,
|
|
@@ -68,9 +72,11 @@ const props = withDefaults(defineProps<{
|
|
|
68
72
|
singularValueLabel: 'item selected',
|
|
69
73
|
pluralValueLabel: 'items selected',
|
|
70
74
|
messages: () => [],
|
|
75
|
+
inputRef: null,
|
|
71
76
|
});
|
|
72
77
|
const emit = defineEmits([
|
|
73
78
|
'update:modelValue',
|
|
79
|
+
'update:inputRef',
|
|
74
80
|
'blur',
|
|
75
81
|
'validate',
|
|
76
82
|
]);
|
|
@@ -78,6 +84,7 @@ const isOpen = ref(false);
|
|
|
78
84
|
const _modelValue = computed<string[]>(() => [
|
|
79
85
|
...props.modelValue || [],
|
|
80
86
|
]);
|
|
87
|
+
const _inputRef = useVModel(props, 'inputRef', emit);
|
|
81
88
|
let actuallyValueLength = ref<number>(0);
|
|
82
89
|
|
|
83
90
|
const hasInputState = computed(() => props.skeleton || props.readonly || props.disabled);
|
|
@@ -170,7 +177,6 @@ const iconSize = computed(() => {
|
|
|
170
177
|
const selectedCheckboxes = ref<string[]>([
|
|
171
178
|
..._modelValue.value,
|
|
172
179
|
]);
|
|
173
|
-
const inputRef = ref<HTMLElement | null>(null);
|
|
174
180
|
|
|
175
181
|
watch(isOpen, (val) => {
|
|
176
182
|
if (!val) {
|
|
@@ -212,7 +218,7 @@ function onClickSelectInput(e: MouseEvent) {
|
|
|
212
218
|
}
|
|
213
219
|
|
|
214
220
|
if (isOpen.value) {
|
|
215
|
-
|
|
221
|
+
_inputRef.value?.focus();
|
|
216
222
|
}
|
|
217
223
|
|
|
218
224
|
isOpen.value = !isOpen.value;
|
|
@@ -261,7 +267,7 @@ onMounted(() => {
|
|
|
261
267
|
:messages="messages"
|
|
262
268
|
label-for="noop"
|
|
263
269
|
data-e2e="multi-select"
|
|
264
|
-
@click-label="() =>
|
|
270
|
+
@click-label="() => _inputRef?.focus()"
|
|
265
271
|
>
|
|
266
272
|
<AntDropdown
|
|
267
273
|
v-model:show-dropdown="isOpen"
|
|
@@ -277,12 +283,12 @@ onMounted(() => {
|
|
|
277
283
|
<!-- Input -->
|
|
278
284
|
<div class="flex">
|
|
279
285
|
<div
|
|
280
|
-
ref="
|
|
286
|
+
ref="_inputRef"
|
|
281
287
|
:class="inputClasses"
|
|
282
288
|
:tabindex="disabled || readonly ? -1 : 0"
|
|
283
289
|
v-bind="$attrs"
|
|
284
290
|
@mousedown="onClickSelectInput"
|
|
285
|
-
@click="() =>
|
|
291
|
+
@click="() => _inputRef?.focus()"
|
|
286
292
|
@blur="onBlur"
|
|
287
293
|
>
|
|
288
294
|
<slot name="icon" />
|
|
@@ -27,6 +27,9 @@ import Big from 'big.js';
|
|
|
27
27
|
import {
|
|
28
28
|
getDecimalPlaces,
|
|
29
29
|
} from '../../utils';
|
|
30
|
+
import {
|
|
31
|
+
useVModel,
|
|
32
|
+
} from '@vueuse/core';
|
|
30
33
|
|
|
31
34
|
Big.RM = Big.roundHalfEven;
|
|
32
35
|
|
|
@@ -54,6 +57,7 @@ const props = withDefaults(defineProps<{
|
|
|
54
57
|
limiter?: boolean;
|
|
55
58
|
messages?: string[];
|
|
56
59
|
indicators?: boolean;
|
|
60
|
+
inputRef?: HTMLInputElement | null;
|
|
57
61
|
}>(), {
|
|
58
62
|
state: InputState.base,
|
|
59
63
|
disabled: false,
|
|
@@ -64,6 +68,7 @@ const props = withDefaults(defineProps<{
|
|
|
64
68
|
limiter: false,
|
|
65
69
|
messages: () => [],
|
|
66
70
|
indicators: false,
|
|
71
|
+
inputRef: null,
|
|
67
72
|
});
|
|
68
73
|
const emit = defineEmits([
|
|
69
74
|
'update:modelValue',
|
|
@@ -86,6 +91,7 @@ const _modelValue = computed({
|
|
|
86
91
|
emit('update:modelValue', Number(val));
|
|
87
92
|
},
|
|
88
93
|
});
|
|
94
|
+
const _inputRef = useVModel(props, 'inputRef', emit);
|
|
89
95
|
|
|
90
96
|
const isPrevButtonDisabled = computed(() => {
|
|
91
97
|
if (props.disabled) {
|
|
@@ -172,13 +178,14 @@ function onButtonBlur() {
|
|
|
172
178
|
:skeleton="skeleton"
|
|
173
179
|
:disabled="isPrevButtonDisabled"
|
|
174
180
|
:readonly="readonly"
|
|
181
|
+
data-e2e="decrement-button"
|
|
175
182
|
@click="subtract"
|
|
176
183
|
@blur="onButtonBlur"
|
|
177
|
-
data-e2e="decrement-button"
|
|
178
184
|
/>
|
|
179
185
|
|
|
180
186
|
<AntBaseInput
|
|
181
187
|
v-model.number="_modelValue"
|
|
188
|
+
v-model:input-ref="_inputRef"
|
|
182
189
|
:type="BaseInputType.number"
|
|
183
190
|
:grouped="indicators ? Grouped.center : Grouped.none"
|
|
184
191
|
wrapper-class="grow"
|
|
@@ -204,9 +211,9 @@ function onButtonBlur() {
|
|
|
204
211
|
:skeleton="skeleton"
|
|
205
212
|
:disabled="isNextButtonDisabled"
|
|
206
213
|
:readonly="readonly"
|
|
214
|
+
data-e2e="increment-button"
|
|
207
215
|
@click="add"
|
|
208
216
|
@blur="onButtonBlur"
|
|
209
|
-
data-e2e="increment-button"
|
|
210
217
|
/>
|
|
211
218
|
</div>
|
|
212
219
|
</AntField>
|
|
@@ -44,6 +44,9 @@ import {
|
|
|
44
44
|
IconSize,
|
|
45
45
|
} from '../__types';
|
|
46
46
|
import AntSelectMenu from './Elements/AntSelectMenu.vue';
|
|
47
|
+
import {
|
|
48
|
+
useVModel,
|
|
49
|
+
} from '@vueuse/core';
|
|
47
50
|
|
|
48
51
|
defineOptions({
|
|
49
52
|
inheritAttrs: false,
|
|
@@ -66,6 +69,7 @@ const props = withDefaults(defineProps<{
|
|
|
66
69
|
wrapperClass?: string | Record<string, boolean>;
|
|
67
70
|
expanded?: boolean;
|
|
68
71
|
messages?: string[];
|
|
72
|
+
inputRef?: HTMLInputElement | null;
|
|
69
73
|
}>(), {
|
|
70
74
|
state: InputState.base,
|
|
71
75
|
grouped: Grouped.none,
|
|
@@ -76,9 +80,11 @@ const props = withDefaults(defineProps<{
|
|
|
76
80
|
nullable: false,
|
|
77
81
|
expanded: true,
|
|
78
82
|
messages: () => [],
|
|
83
|
+
inputRef: null,
|
|
79
84
|
});
|
|
80
85
|
const emit = defineEmits([
|
|
81
86
|
'update:modelValue',
|
|
87
|
+
'update:inputRef',
|
|
82
88
|
'blur',
|
|
83
89
|
'validate',
|
|
84
90
|
]);
|
|
@@ -174,7 +180,9 @@ const iconSize = computed(() => {
|
|
|
174
180
|
|
|
175
181
|
return IconSize.xs;
|
|
176
182
|
});
|
|
177
|
-
const
|
|
183
|
+
const _inputRef = defineModel('inputRef', {
|
|
184
|
+
default: null,
|
|
185
|
+
});
|
|
178
186
|
const dropDownRef = ref<HTMLElement | null>(null);
|
|
179
187
|
const focusedDropDownItem = ref<string | number | null>(null);
|
|
180
188
|
// TODO:: Hotfix to prevent missing required prop warning. Fix it with https://github.com/antify/ui-module/issues/52
|
|
@@ -221,7 +229,7 @@ function onClickOutside() {
|
|
|
221
229
|
}
|
|
222
230
|
|
|
223
231
|
isOpen.value = false;
|
|
224
|
-
|
|
232
|
+
_inputRef.value?.focus();
|
|
225
233
|
}
|
|
226
234
|
|
|
227
235
|
function onClickSelectInput(e: MouseEvent) {
|
|
@@ -232,14 +240,14 @@ function onClickSelectInput(e: MouseEvent) {
|
|
|
232
240
|
}
|
|
233
241
|
|
|
234
242
|
if (isOpen.value) {
|
|
235
|
-
|
|
243
|
+
_inputRef.value?.focus();
|
|
236
244
|
}
|
|
237
245
|
|
|
238
246
|
isOpen.value = !isOpen.value;
|
|
239
247
|
}
|
|
240
248
|
|
|
241
249
|
function onClickRemoveButton() {
|
|
242
|
-
|
|
250
|
+
_inputRef.value?.focus();
|
|
243
251
|
_modelValue.value = null;
|
|
244
252
|
}
|
|
245
253
|
</script>
|
|
@@ -256,7 +264,7 @@ function onClickRemoveButton() {
|
|
|
256
264
|
:expanded="expanded"
|
|
257
265
|
:messages="messages"
|
|
258
266
|
label-for="noop"
|
|
259
|
-
@click-label="() =>
|
|
267
|
+
@click-label="() => _inputRef?.focus()"
|
|
260
268
|
>
|
|
261
269
|
<div
|
|
262
270
|
class="h-fit flex flex-row w-full"
|
|
@@ -305,12 +313,12 @@ function onClickRemoveButton() {
|
|
|
305
313
|
>
|
|
306
314
|
<!-- Input -->
|
|
307
315
|
<div
|
|
308
|
-
ref="
|
|
316
|
+
ref="_inputRef"
|
|
309
317
|
:class="inputClasses"
|
|
310
318
|
:tabindex="disabled || readonly ? -1 : 0"
|
|
311
319
|
v-bind="$attrs"
|
|
312
320
|
@mousedown="onClickSelectInput"
|
|
313
|
-
@click="() =>
|
|
321
|
+
@click="() => _inputRef?.focus()"
|
|
314
322
|
@blur="onBlur"
|
|
315
323
|
>
|
|
316
324
|
<div
|
|
@@ -36,6 +36,7 @@ import type {
|
|
|
36
36
|
|
|
37
37
|
const emit = defineEmits([
|
|
38
38
|
'update:modelValue',
|
|
39
|
+
'update:inputRef',
|
|
39
40
|
'blur',
|
|
40
41
|
'validate',
|
|
41
42
|
]);
|
|
@@ -61,6 +62,7 @@ const props = withDefaults(defineProps<{
|
|
|
61
62
|
openOnFocus?: boolean;
|
|
62
63
|
autoCloseAfterSelection?: boolean;
|
|
63
64
|
createCallback?: (item: string) => Promise<SelectOption>;
|
|
65
|
+
inputRef: HTMLInputElement | null;
|
|
64
66
|
}>(), {
|
|
65
67
|
size: AntTagInputSize.md,
|
|
66
68
|
state: InputState.base,
|
|
@@ -75,6 +77,7 @@ const props = withDefaults(defineProps<{
|
|
|
75
77
|
skeleton: false,
|
|
76
78
|
autoCloseAfterSelection: false,
|
|
77
79
|
placeholder: 'Add new tag',
|
|
80
|
+
inputRef: null,
|
|
78
81
|
});
|
|
79
82
|
|
|
80
83
|
const _modelValue: Ref<(string | number)[] | null> = useVModel(props, 'modelValue', emit);
|
|
@@ -83,7 +86,7 @@ const dropDownOpen = ref(false);
|
|
|
83
86
|
const hasInputState = computed(() => props.skeleton || props.readonly || props.disabled);
|
|
84
87
|
const focusedDropDownItem: Ref<string | number | null> = ref(null);
|
|
85
88
|
const tagInput = ref('');
|
|
86
|
-
const
|
|
89
|
+
const _inputRef = useVModel(props, 'inputRef', emit);
|
|
87
90
|
const inputContainerClasses = computed(() => {
|
|
88
91
|
const variants: Record<InputState, string> = {
|
|
89
92
|
[InputState.base]: 'outline-base-300 focus-within:outline-base-300 focus-within:ring-primary-200 bg-white',
|
|
@@ -316,7 +319,7 @@ onMounted(() => {
|
|
|
316
319
|
/>
|
|
317
320
|
|
|
318
321
|
<input
|
|
319
|
-
ref="
|
|
322
|
+
ref="_inputRef"
|
|
320
323
|
v-model="tagInput"
|
|
321
324
|
type="text"
|
|
322
325
|
:placeholder="placeholder"
|
|
@@ -340,7 +343,7 @@ onMounted(() => {
|
|
|
340
343
|
:model-value="null"
|
|
341
344
|
:auto-select-first-on-open="!allowCreate"
|
|
342
345
|
:options="filteredOptions"
|
|
343
|
-
:input-ref="
|
|
346
|
+
:input-ref="_inputRef"
|
|
344
347
|
:size="size as unknown as Size"
|
|
345
348
|
:state="state"
|
|
346
349
|
:focus-on-open="false"
|
|
@@ -39,6 +39,7 @@ defineOptions({
|
|
|
39
39
|
|
|
40
40
|
const emit = defineEmits([
|
|
41
41
|
'update:modelValue',
|
|
42
|
+
'update:inputRef',
|
|
42
43
|
'validate',
|
|
43
44
|
'blur',
|
|
44
45
|
]);
|
|
@@ -59,6 +60,7 @@ const props = withDefaults(defineProps<{
|
|
|
59
60
|
max?: number;
|
|
60
61
|
messages?: string[];
|
|
61
62
|
resize?: boolean;
|
|
63
|
+
inputRef?: HTMLInputElement | null;
|
|
62
64
|
}>(), {
|
|
63
65
|
state: InputState.base,
|
|
64
66
|
disabled: false,
|
|
@@ -70,6 +72,7 @@ const props = withDefaults(defineProps<{
|
|
|
70
72
|
limiter: false,
|
|
71
73
|
resize: true,
|
|
72
74
|
messages: () => [],
|
|
75
|
+
inputRef: null,
|
|
73
76
|
});
|
|
74
77
|
|
|
75
78
|
const _modelValue = useVModel(props, 'modelValue', emit);
|
|
@@ -134,7 +137,7 @@ const iconColor = computed(() => {
|
|
|
134
137
|
});
|
|
135
138
|
const _wrapperClass = computed(() => classesToObjectSyntax(props.wrapperClass));
|
|
136
139
|
const icon = computed(() => icons[props.state]);
|
|
137
|
-
const
|
|
140
|
+
const _inputRef = useVModel(props, 'inputRef', emit);
|
|
138
141
|
const getIconSize = computed(() => {
|
|
139
142
|
if (props.size === Size.xs || props.size === Size.xs2) {
|
|
140
143
|
return IconSize.xs;
|
|
@@ -176,7 +179,7 @@ function onBlur(e: FocusEvent) {
|
|
|
176
179
|
}
|
|
177
180
|
|
|
178
181
|
defineExpose({
|
|
179
|
-
getTextAreaRef: () =>
|
|
182
|
+
getTextAreaRef: () => _inputRef.value,
|
|
180
183
|
});
|
|
181
184
|
|
|
182
185
|
</script>
|
|
@@ -202,7 +205,7 @@ defineExpose({
|
|
|
202
205
|
:class="{...{'-mr-px': grouped !== Grouped.none}, ..._wrapperClass}"
|
|
203
206
|
>
|
|
204
207
|
<textarea
|
|
205
|
-
ref="
|
|
208
|
+
ref="_inputRef"
|
|
206
209
|
v-model="_modelValue"
|
|
207
210
|
:class="inputClasses"
|
|
208
211
|
:placeholder="placeholder !== undefined ? placeholder : label"
|
|
@@ -24,6 +24,9 @@ import {
|
|
|
24
24
|
handleEnumValidation,
|
|
25
25
|
} from '../../handler';
|
|
26
26
|
import Big from 'big.js';
|
|
27
|
+
import {
|
|
28
|
+
useVModel,
|
|
29
|
+
} from '@vueuse/core';
|
|
27
30
|
|
|
28
31
|
defineOptions({
|
|
29
32
|
inheritAttrs: false,
|
|
@@ -46,6 +49,7 @@ const props = withDefaults(defineProps<{
|
|
|
46
49
|
wrapperClass?: string | Record<string, boolean>;
|
|
47
50
|
messages?: string[];
|
|
48
51
|
decimalPlaces?: number;
|
|
52
|
+
inputRef?: HTMLInputElement | null;
|
|
49
53
|
}>(), {
|
|
50
54
|
state: InputState.base,
|
|
51
55
|
disabled: false,
|
|
@@ -55,9 +59,11 @@ const props = withDefaults(defineProps<{
|
|
|
55
59
|
limiter: false,
|
|
56
60
|
messages: () => [],
|
|
57
61
|
decimalPlaces: 2,
|
|
62
|
+
inputRef: null,
|
|
58
63
|
});
|
|
59
64
|
const emit = defineEmits([
|
|
60
65
|
'update:modelValue',
|
|
66
|
+
'update:inputRef',
|
|
61
67
|
'validate',
|
|
62
68
|
]);
|
|
63
69
|
|
|
@@ -73,6 +79,7 @@ const _modelValue = computed({
|
|
|
73
79
|
emit('update:modelValue', Number(val));
|
|
74
80
|
},
|
|
75
81
|
});
|
|
82
|
+
const _inputRef = useVModel(props, 'inputRef', emit);
|
|
76
83
|
|
|
77
84
|
onMounted(() => {
|
|
78
85
|
handleEnumValidation(props.state, InputState, 'state');
|
|
@@ -97,6 +104,7 @@ onMounted(() => {
|
|
|
97
104
|
>
|
|
98
105
|
<AntBaseInput
|
|
99
106
|
v-model="_modelValue"
|
|
107
|
+
v-model:input-ref="_inputRef"
|
|
100
108
|
:type="BaseInputType.number"
|
|
101
109
|
:grouped="Grouped.left"
|
|
102
110
|
wrapper-class="flex-grow"
|
|
@@ -214,6 +214,7 @@ function onKeyDownDropDown(e: KeyboardEvent) {
|
|
|
214
214
|
|
|
215
215
|
if (nextOptionIndex !== null) {
|
|
216
216
|
focusedDropDownItem.value = props.options[nextOptionIndex].value || null;
|
|
217
|
+
_modelValue.value = props.options[nextOptionIndex].value || null;
|
|
217
218
|
}
|
|
218
219
|
}
|
|
219
220
|
|
|
@@ -226,6 +227,7 @@ function onKeyDownDropDown(e: KeyboardEvent) {
|
|
|
226
227
|
|
|
227
228
|
if (prevOptionIndex !== null) {
|
|
228
229
|
focusedDropDownItem.value = props.options[prevOptionIndex].value || null;
|
|
230
|
+
_modelValue.value = props.options[prevOptionIndex].value || null;
|
|
229
231
|
}
|
|
230
232
|
}
|
|
231
233
|
|
|
@@ -80,26 +80,6 @@ const meta = {
|
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
82
|
module.exports = meta;
|
|
83
|
-
const options1 = [{
|
|
84
|
-
label: "Option 1",
|
|
85
|
-
value: "1"
|
|
86
|
-
}, {
|
|
87
|
-
label: "Option 2",
|
|
88
|
-
value: "2"
|
|
89
|
-
}, {
|
|
90
|
-
label: "Option 3",
|
|
91
|
-
value: "3"
|
|
92
|
-
}];
|
|
93
|
-
const options2 = [{
|
|
94
|
-
label: "Option 4",
|
|
95
|
-
value: "4"
|
|
96
|
-
}, {
|
|
97
|
-
label: "Option 5",
|
|
98
|
-
value: "5"
|
|
99
|
-
}, {
|
|
100
|
-
label: "Option 6",
|
|
101
|
-
value: "6"
|
|
102
|
-
}];
|
|
103
83
|
const Docs = exports.Docs = {
|
|
104
84
|
render: args => ({
|
|
105
85
|
components: {
|
|
@@ -107,40 +87,28 @@ const Docs = exports.Docs = {
|
|
|
107
87
|
AntButton: _AntButton.default
|
|
108
88
|
},
|
|
109
89
|
setup() {
|
|
110
|
-
const value = (0, _vue.ref)(["
|
|
111
|
-
const currentOptions = (0, _vue.ref)(options1);
|
|
112
|
-
const selectOptions = number => currentOptions.value = number === 1 ? options1 : options2;
|
|
90
|
+
const value = (0, _vue.ref)(["1", "2", "3"]);
|
|
113
91
|
return {
|
|
114
92
|
args,
|
|
115
|
-
value,
|
|
116
93
|
State: _enums.State,
|
|
117
|
-
|
|
118
|
-
selectOptions
|
|
94
|
+
value
|
|
119
95
|
};
|
|
120
96
|
},
|
|
121
97
|
template: `
|
|
122
|
-
|
|
123
|
-
<div class="flex gap-2.5">
|
|
124
|
-
<AntButton
|
|
125
|
-
:state="currentOptions[0].value === '1' ? State.primary : State.base"
|
|
126
|
-
:filled="currentOptions[0].value === '1'"
|
|
127
|
-
@click="selectOptions(1)"
|
|
128
|
-
>
|
|
129
|
-
Options 1
|
|
130
|
-
</AntButton>
|
|
131
|
-
<AntButton
|
|
132
|
-
:state="currentOptions[0].value === '4' ? State.primary : State.base"
|
|
133
|
-
:filled="currentOptions[0].value === '4'"
|
|
134
|
-
@click="selectOptions()"
|
|
135
|
-
>
|
|
136
|
-
Options 2
|
|
137
|
-
</AntButton>
|
|
138
|
-
</div>
|
|
139
|
-
<AntMultiSelect v-bind="args" v-model="value" :options="currentOptions"/>
|
|
140
|
-
</div>
|
|
98
|
+
<AntMultiSelect v-bind="args" v-model="value"/>
|
|
141
99
|
`
|
|
142
100
|
}),
|
|
143
101
|
args: {
|
|
102
|
+
options: [{
|
|
103
|
+
label: "Option 1",
|
|
104
|
+
value: "1"
|
|
105
|
+
}, {
|
|
106
|
+
label: "Option 2",
|
|
107
|
+
value: "2"
|
|
108
|
+
}, {
|
|
109
|
+
label: "Option 3",
|
|
110
|
+
value: "3"
|
|
111
|
+
}],
|
|
144
112
|
label: "Label",
|
|
145
113
|
description: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod",
|
|
146
114
|
nullable: true
|
|
@@ -212,6 +180,15 @@ const Summary = exports.Summary = {
|
|
|
212
180
|
}),
|
|
213
181
|
args: {
|
|
214
182
|
placeholder: "Placeholder",
|
|
215
|
-
options:
|
|
183
|
+
options: [{
|
|
184
|
+
label: "Option 1",
|
|
185
|
+
value: "1"
|
|
186
|
+
}, {
|
|
187
|
+
label: "Option 2",
|
|
188
|
+
value: "2"
|
|
189
|
+
}, {
|
|
190
|
+
label: "Option 3",
|
|
191
|
+
value: "3"
|
|
192
|
+
}]
|
|
216
193
|
}
|
|
217
194
|
};
|
|
@@ -82,34 +82,6 @@ const meta = {
|
|
|
82
82
|
}
|
|
83
83
|
};
|
|
84
84
|
export default meta;
|
|
85
|
-
const options1 = [
|
|
86
|
-
{
|
|
87
|
-
label: "Option 1",
|
|
88
|
-
value: "1"
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
label: "Option 2",
|
|
92
|
-
value: "2"
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
label: "Option 3",
|
|
96
|
-
value: "3"
|
|
97
|
-
}
|
|
98
|
-
];
|
|
99
|
-
const options2 = [
|
|
100
|
-
{
|
|
101
|
-
label: "Option 4",
|
|
102
|
-
value: "4"
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
label: "Option 5",
|
|
106
|
-
value: "5"
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
label: "Option 6",
|
|
110
|
-
value: "6"
|
|
111
|
-
}
|
|
112
|
-
];
|
|
113
85
|
export const Docs = {
|
|
114
86
|
render: (args) => ({
|
|
115
87
|
components: {
|
|
@@ -118,42 +90,35 @@ export const Docs = {
|
|
|
118
90
|
},
|
|
119
91
|
setup() {
|
|
120
92
|
const value = ref([
|
|
121
|
-
"
|
|
93
|
+
"1",
|
|
94
|
+
"2",
|
|
122
95
|
"3"
|
|
123
96
|
]);
|
|
124
|
-
const currentOptions = ref(options1);
|
|
125
|
-
const selectOptions = (number) => currentOptions.value = number === 1 ? options1 : options2;
|
|
126
97
|
return {
|
|
127
98
|
args,
|
|
128
|
-
value,
|
|
129
99
|
State,
|
|
130
|
-
|
|
131
|
-
selectOptions
|
|
100
|
+
value
|
|
132
101
|
};
|
|
133
102
|
},
|
|
134
103
|
template: `
|
|
135
|
-
|
|
136
|
-
<div class="flex gap-2.5">
|
|
137
|
-
<AntButton
|
|
138
|
-
:state="currentOptions[0].value === '1' ? State.primary : State.base"
|
|
139
|
-
:filled="currentOptions[0].value === '1'"
|
|
140
|
-
@click="selectOptions(1)"
|
|
141
|
-
>
|
|
142
|
-
Options 1
|
|
143
|
-
</AntButton>
|
|
144
|
-
<AntButton
|
|
145
|
-
:state="currentOptions[0].value === '4' ? State.primary : State.base"
|
|
146
|
-
:filled="currentOptions[0].value === '4'"
|
|
147
|
-
@click="selectOptions()"
|
|
148
|
-
>
|
|
149
|
-
Options 2
|
|
150
|
-
</AntButton>
|
|
151
|
-
</div>
|
|
152
|
-
<AntMultiSelect v-bind="args" v-model="value" :options="currentOptions"/>
|
|
153
|
-
</div>
|
|
104
|
+
<AntMultiSelect v-bind="args" v-model="value"/>
|
|
154
105
|
`
|
|
155
106
|
}),
|
|
156
107
|
args: {
|
|
108
|
+
options: [
|
|
109
|
+
{
|
|
110
|
+
label: "Option 1",
|
|
111
|
+
value: "1"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
label: "Option 2",
|
|
115
|
+
value: "2"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
label: "Option 3",
|
|
119
|
+
value: "3"
|
|
120
|
+
}
|
|
121
|
+
],
|
|
157
122
|
label: "Label",
|
|
158
123
|
description: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod",
|
|
159
124
|
nullable: true
|
|
@@ -229,6 +194,19 @@ export const Summary = {
|
|
|
229
194
|
}),
|
|
230
195
|
args: {
|
|
231
196
|
placeholder: "Placeholder",
|
|
232
|
-
options:
|
|
197
|
+
options: [
|
|
198
|
+
{
|
|
199
|
+
label: "Option 1",
|
|
200
|
+
value: "1"
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
label: "Option 2",
|
|
204
|
+
value: "2"
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
label: "Option 3",
|
|
208
|
+
value: "3"
|
|
209
|
+
}
|
|
210
|
+
]
|
|
233
211
|
}
|
|
234
212
|
};
|