@finema/core 2.55.0 → 2.56.0

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.
Files changed (32) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +1 -1
  3. package/dist/runtime/components/Form/FieldWrapper.vue +13 -13
  4. package/dist/runtime/components/Form/Fields.vue +13 -13
  5. package/dist/runtime/components/Form/InputCheckbox/index.vue +18 -18
  6. package/dist/runtime/components/Form/InputMonth/index.vue +51 -51
  7. package/dist/runtime/components/Form/InputNumber/index.vue +20 -20
  8. package/dist/runtime/components/Form/InputSelectMultiple/index.vue +43 -43
  9. package/dist/runtime/components/Form/InputTags/index.d.vue.ts +2 -0
  10. package/dist/runtime/components/Form/InputTags/index.vue +179 -25
  11. package/dist/runtime/components/Form/InputTags/index.vue.d.ts +2 -0
  12. package/dist/runtime/components/Form/InputTags/types.d.ts +5 -3
  13. package/dist/runtime/components/Form/InputTextarea/index.vue +18 -18
  14. package/dist/runtime/components/Form/InputToggle/index.vue +17 -17
  15. package/dist/runtime/components/Form/InputUploadDropzone/index.vue +30 -30
  16. package/dist/runtime/components/Form/InputUploadDropzoneAuto/index.vue +50 -50
  17. package/dist/runtime/components/Form/fileState/EmptyState.vue +21 -21
  18. package/dist/runtime/components/Form/fileState/FailedState.vue +33 -33
  19. package/dist/runtime/components/Form/fileState/LoadingState.vue +24 -24
  20. package/dist/runtime/components/Form/fileState/PreviewModal.vue +23 -23
  21. package/dist/runtime/components/Form/index.vue +5 -5
  22. package/dist/runtime/components/Image.vue +28 -28
  23. package/dist/runtime/components/Log/index.vue +17 -17
  24. package/dist/runtime/components/Table/ColumnDate.vue +1 -1
  25. package/dist/runtime/components/Table/ColumnDateTime.vue +1 -1
  26. package/dist/runtime/components/Table/ColumnImage.vue +4 -4
  27. package/dist/runtime/components/Table/ColumnText.vue +1 -1
  28. package/dist/runtime/components/Table/Pagination.vue +46 -46
  29. package/dist/runtime/components/Table/Simple.vue +17 -17
  30. package/dist/runtime/server/tsconfig.json +3 -3
  31. package/dist/runtime/theme/table.js +2 -2
  32. package/package.json +2 -2
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finema/core",
3
- "version": "2.55.0",
3
+ "version": "2.56.0",
4
4
  "configKey": "core",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
package/dist/module.mjs CHANGED
@@ -4,7 +4,7 @@ import * as lodash from 'lodash-es';
4
4
  import * as theme from '../dist/runtime/theme/index.js';
5
5
 
6
6
  const name = "@finema/core";
7
- const version = "2.55.0";
7
+ const version = "2.56.0";
8
8
 
9
9
  const nuxtAppOptions = {
10
10
  head: {
@@ -1,17 +1,17 @@
1
1
  <template>
2
- <FormField
3
- :label="label"
4
- :name="name"
5
- :description="description"
6
- :hint="hint"
7
- :data-testid="name"
8
- :help="help"
9
- :error="errorMessage"
10
- :required="!!required"
11
- :ui="containerUi"
12
- >
13
- <slot />
14
- </FormField>
2
+ <FormField
3
+ :label="label"
4
+ :name="name"
5
+ :description="description"
6
+ :hint="hint"
7
+ :data-testid="name"
8
+ :help="help"
9
+ :error="errorMessage"
10
+ :required="!!required"
11
+ :ui="containerUi"
12
+ >
13
+ <slot />
14
+ </FormField>
15
15
  </template>
16
16
 
17
17
  <script setup>
@@ -1,22 +1,22 @@
1
1
  <template>
2
- <div
2
+ <div
3
3
  :class="[theme.base({
4
4
  class: [$props.class, ui?.base]
5
- })]"
6
- >
7
- <component
8
- :is="componentMap[option.type]?.component"
9
- v-for="option in options.filter((item) => !item.isHide)"
10
- :key="option.props.name"
11
- :class="option.class"
12
- :form="form"
5
+ })]"
6
+ >
7
+ <component
8
+ :is="componentMap[option.type]?.component"
9
+ v-for="option in options.filter((item) => !item.isHide)"
10
+ :key="option.props.name"
11
+ :class="option.class"
12
+ :form="form"
13
13
  v-bind="{
14
14
  ...getFieldBinding(option),
15
15
  ...componentMap[option.type]?.props
16
- }"
17
- v-on="option.on ?? {}"
18
- />
19
- </div>
16
+ }"
17
+ v-on="option.on ?? {}"
18
+ />
19
+ </div>
20
20
  </template>
21
21
 
22
22
  <script setup>
@@ -1,22 +1,22 @@
1
1
  <template>
2
- <FieldWrapper
3
- v-bind="wrapperProps"
4
- label=""
5
- description=""
6
- >
7
- <Checkbox
8
- :model-value="value"
9
- :disabled="wrapperProps.disabled"
10
- :name="name"
11
- :label="label"
12
- :description="description"
13
- :required="required"
14
- :variant="variant"
15
- :indicator="indicator"
16
- :ui="ui"
17
- @update:modelValue="onChange"
18
- />
19
- </FieldWrapper>
2
+ <FieldWrapper
3
+ v-bind="wrapperProps"
4
+ label=""
5
+ description=""
6
+ >
7
+ <Checkbox
8
+ :model-value="value"
9
+ :disabled="wrapperProps.disabled"
10
+ :name="name"
11
+ :label="label"
12
+ :description="description"
13
+ :required="required"
14
+ :variant="variant"
15
+ :indicator="indicator"
16
+ :ui="ui"
17
+ @update:modelValue="onChange"
18
+ />
19
+ </FieldWrapper>
20
20
  </template>
21
21
 
22
22
  <script setup>
@@ -1,60 +1,60 @@
1
1
  <template>
2
- <FieldWrapper v-bind="wrapperProps">
3
- <Datepicker
4
- :model-value="value"
5
- :teleport="teleport"
6
- :disabled="wrapperProps.disabled"
7
- :cancel-text="appConfig.core?.locale === 'th' ? '\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01' : 'Cancel'"
8
- :select-text="appConfig.core?.locale === 'th' ? '\u0E15\u0E01\u0E25\u0E07' : 'Select'"
9
- :locale="appConfig.core?.locale"
10
- :format="appConfig.core?.month_format"
11
- month-picker
12
- :placeholder="wrapperProps.placeholder"
13
- :min-date="minDate"
14
- :max-date="maxDate"
15
- :required="wrapperProps.required"
16
- :clearable="true"
17
- :always-clearable="true"
18
- @update:model-value="onInput"
19
- >
20
- <template
21
- v-if="appConfig.core?.is_thai_year"
22
- #year="{ year }"
23
- >
24
- {{ year + 543 }}
25
- </template>
26
- <template
27
- v-if="appConfig.core?.is_thai_year"
28
- #year-overlay-value="{ value }"
29
- >
30
- {{ value + 543 }}
31
- </template>
32
- <template #dp-input>
33
- <Input
34
- :trailing-icon="!wrapperProps.required && value ? void 0 : 'i-heroicons-calendar-days'"
35
- type="text"
36
- :disabled="wrapperProps.disabled"
37
- :model-value="formatDisplay(value)"
38
- :placeholder="wrapperProps.placeholder"
39
- :readonly="true"
2
+ <FieldWrapper v-bind="wrapperProps">
3
+ <Datepicker
4
+ :model-value="value"
5
+ :teleport="teleport"
6
+ :disabled="wrapperProps.disabled"
7
+ :cancel-text="appConfig.core?.locale === 'th' ? '\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01' : 'Cancel'"
8
+ :select-text="appConfig.core?.locale === 'th' ? '\u0E15\u0E01\u0E25\u0E07' : 'Select'"
9
+ :locale="appConfig.core?.locale"
10
+ :format="appConfig.core?.month_format"
11
+ month-picker
12
+ :placeholder="wrapperProps.placeholder"
13
+ :min-date="minDate"
14
+ :max-date="maxDate"
15
+ :required="wrapperProps.required"
16
+ :clearable="true"
17
+ :always-clearable="true"
18
+ @update:model-value="onInput"
19
+ >
20
+ <template
21
+ v-if="appConfig.core?.is_thai_year"
22
+ #year="{ year }"
23
+ >
24
+ {{ year + 543 }}
25
+ </template>
26
+ <template
27
+ v-if="appConfig.core?.is_thai_year"
28
+ #year-overlay-value="{ value }"
29
+ >
30
+ {{ value + 543 }}
31
+ </template>
32
+ <template #dp-input>
33
+ <Input
34
+ :trailing-icon="!wrapperProps.required && value ? void 0 : 'i-heroicons-calendar-days'"
35
+ type="text"
36
+ :disabled="wrapperProps.disabled"
37
+ :model-value="formatDisplay(value)"
38
+ :placeholder="wrapperProps.placeholder"
39
+ :readonly="true"
40
40
  :ui="{
41
41
  base: 'cursor-pointer select-none',
42
42
  trailingIcon: 'cursor-pointer'
43
- }"
44
- />
45
- </template>
46
- <template #clear-icon="{ clear }">
47
- <Icon
48
- v-if="value && !wrapperProps.disabled && !wrapperProps.required"
49
- :name="clearIcon"
43
+ }"
44
+ />
45
+ </template>
46
+ <template #clear-icon="{ clear }">
47
+ <Icon
48
+ v-if="value && !wrapperProps.disabled && !wrapperProps.required"
49
+ :name="clearIcon"
50
50
  :class="theme.clearIcon({
51
51
  class: [ui?.clearIcon]
52
- })"
53
- @click.stop="clear"
54
- />
55
- </template>
56
- </Datepicker>
57
- </FieldWrapper>
52
+ })"
53
+ @click.stop="clear"
54
+ />
55
+ </template>
56
+ </Datepicker>
57
+ </FieldWrapper>
58
58
  </template>
59
59
 
60
60
  <script setup>
@@ -1,24 +1,24 @@
1
1
  <template>
2
- <FieldWrapper v-bind="wrapperProps">
3
- <InputNumber
4
- :model-value="value"
5
- :disabled="wrapperProps.disabled"
6
- :name="name"
7
- :placeholder="wrapperProps.placeholder"
8
- :autofocus="!!autoFocus"
9
- :readonly="readonly"
10
- :orientation="orientation"
11
- :increment-disabled="incrementDisabled"
12
- :decrement-disabled="decrementDisabled"
13
- :min="min"
14
- :max="max"
15
- :step="step"
16
- :disable-wheel-change="disableWheelChange"
17
- :format-options="formatOptions"
18
- :ui="ui"
19
- @update:model-value="onChange"
20
- />
21
- </FieldWrapper>
2
+ <FieldWrapper v-bind="wrapperProps">
3
+ <InputNumber
4
+ :model-value="value"
5
+ :disabled="wrapperProps.disabled"
6
+ :name="name"
7
+ :placeholder="wrapperProps.placeholder"
8
+ :autofocus="!!autoFocus"
9
+ :readonly="readonly"
10
+ :orientation="orientation"
11
+ :increment-disabled="incrementDisabled"
12
+ :decrement-disabled="decrementDisabled"
13
+ :min="min"
14
+ :max="max"
15
+ :step="step"
16
+ :disable-wheel-change="disableWheelChange"
17
+ :format-options="formatOptions"
18
+ :ui="ui"
19
+ @update:model-value="onChange"
20
+ />
21
+ </FieldWrapper>
22
22
  </template>
23
23
 
24
24
  <script setup>
@@ -1,57 +1,57 @@
1
1
  <template>
2
- <FieldWrapper v-bind="wrapperProps">
3
- <SelectMenu
4
- :model-value="value"
5
- :items="options"
6
- multiple
7
- :placeholder="wrapperProps.placeholder"
8
- :disabled="wrapperProps.disabled"
9
- :loading="loading"
10
- :search-input="searchInput"
11
- :selected-icon="selectedIcon"
12
- value-key="value"
13
- label-key="label"
14
- :icon="icon"
15
- :ui="ui"
16
- :ignore-filter="!!$attrs.onSearch"
17
- @update:model-value="onChange"
18
- @update:searchTerm="onSearch"
19
- >
20
- <template #default="{ modelValue }">
21
- <div
22
- v-if="!ArrayHelper.isEmpty(value)"
2
+ <FieldWrapper v-bind="wrapperProps">
3
+ <SelectMenu
4
+ :model-value="value"
5
+ :items="options"
6
+ multiple
7
+ :placeholder="wrapperProps.placeholder"
8
+ :disabled="wrapperProps.disabled"
9
+ :loading="loading"
10
+ :search-input="searchInput"
11
+ :selected-icon="selectedIcon"
12
+ value-key="value"
13
+ label-key="label"
14
+ :icon="icon"
15
+ :ui="ui"
16
+ :ignore-filter="!!$attrs.onSearch"
17
+ @update:model-value="onChange"
18
+ @update:searchTerm="onSearch"
19
+ >
20
+ <template #default="{ modelValue }">
21
+ <div
22
+ v-if="!ArrayHelper.isEmpty(value)"
23
23
  :class="theme.tagsWrapper({
24
24
  class: [ui?.tagsWrapper]
25
- })"
26
- >
27
- <div
28
- v-for="_value in ArrayHelper.toArray(modelValue)"
29
- :key="_value"
25
+ })"
26
+ >
27
+ <div
28
+ v-for="_value in ArrayHelper.toArray(modelValue)"
29
+ :key="_value"
30
30
  :class="theme.tagsItem({
31
31
  class: [ui?.tagsItem]
32
- })"
33
- >
34
- <div
32
+ })"
33
+ >
34
+ <div
35
35
  :class="theme.tagsItemText({
36
36
  class: [ui?.tagsItemText]
37
- })"
38
- >
39
- {{ options.find((item) => item.value === _value)?.label || _value }}
40
- <Icon
37
+ })"
38
+ >
39
+ {{ options.find((item) => item.value === _value)?.label || _value }}
40
+ <Icon
41
41
  :name="theme.tagsItemDeleteIcon({
42
42
  class: [ui?.tagsItemDeleteIcon]
43
- })"
43
+ })"
44
44
  :class="theme.tagsItemDelete({
45
45
  class: [ui?.tagsItemDelete]
46
- })"
47
- @click.stop="handleDelete(_value)"
48
- />
49
- </div>
50
- </div>
51
- </div>
52
- </template>
53
- </SelectMenu>
54
- </FieldWrapper>
46
+ })"
47
+ @click.stop="handleDelete(_value)"
48
+ />
49
+ </div>
50
+ </div>
51
+ </div>
52
+ </template>
53
+ </SelectMenu>
54
+ </FieldWrapper>
55
55
  </template>
56
56
 
57
57
  <script setup>
@@ -2,10 +2,12 @@ import type { ITagsFieldProps } from '#core/components/Form/InputTags/types';
2
2
  declare const __VLS_export: import("vue").DefineComponent<ITagsFieldProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
3
3
  add: (...args: any[]) => void;
4
4
  change: (...args: any[]) => void;
5
+ selected: (...args: any[]) => void;
5
6
  remove: (...args: any[]) => void;
6
7
  }, string, import("vue").PublicProps, Readonly<ITagsFieldProps> & Readonly<{
7
8
  onAdd?: ((...args: any[]) => any) | undefined;
8
9
  onChange?: ((...args: any[]) => any) | undefined;
10
+ onSelected?: ((...args: any[]) => any) | undefined;
9
11
  onRemove?: ((...args: any[]) => any) | undefined;
10
12
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
13
  declare const _default: typeof __VLS_export;
@@ -1,43 +1,82 @@
1
1
  <template>
2
- <FieldWrapper v-bind="wrapperProps">
3
- <InputTags
4
- :model-value="value"
5
- :disabled="wrapperProps.disabled"
6
- :leading-icon="leadingIcon"
7
- :max-length="maxLength"
8
- :varant="variant"
9
- :delete-icon="deleteIcon"
10
- :size="size"
11
- :trailing-icon="trailingIcon"
12
- :loading="loading"
13
- :loading-icon="loadingIcon"
14
- :name="name"
15
- :placeholder="wrapperProps.placeholder"
16
- :autofocus="!!autoFocus"
17
- :icon="icon"
18
- :readonly="readonly"
19
- :ui="ui"
20
- @update:model-value="onChange"
21
- @addTag="onAdd"
22
- @removeTag="onRemove"
23
- />
24
- </FieldWrapper>
2
+ <FieldWrapper v-bind="wrapperProps">
3
+ <Popover
4
+ v-model:open="showSuggestions"
5
+ :dismissible="false"
6
+ :ui="{ content: 'w-(--reka-popper-anchor-width)' }"
7
+ >
8
+ <template #anchor>
9
+ <InputTags
10
+ :model-value="value"
11
+ :disabled="wrapperProps.disabled"
12
+ :leading-icon="leadingIcon"
13
+ :max-length="maxLength"
14
+ :variant="variant"
15
+ :delete-icon="deleteIcon"
16
+ :size="size"
17
+ :trailing-icon="trailingIcon"
18
+ :loading="loading"
19
+ :loading-icon="loadingIcon"
20
+ :name="name"
21
+ :placeholder="wrapperProps.placeholder"
22
+ :autofocus="!!autoFocus"
23
+ :icon="icon"
24
+ :readonly="readonly"
25
+ :ui="ui"
26
+ @update:model-value="onChange"
27
+ @addTag="onAdd"
28
+ @removeTag="onRemove"
29
+ @focus="onFocus"
30
+ @blur="onBlur"
31
+ @keydown="onKeydown"
32
+ @input="onInput"
33
+ />
34
+ </template>
35
+
36
+ <template #content>
37
+ <div
38
+ v-if="showSuggestions && filteredSuggestions.length > 0"
39
+ ref="suggestionsContainerRef"
40
+ :class="theme.suggestionsContainer()"
41
+ >
42
+ <div
43
+ v-for="(suggestion, index) in filteredSuggestions"
44
+ :key="suggestion"
45
+ :ref="(el) => setSuggestionItemRef(el, index)"
46
+ :class="[
47
+ theme.suggestionItem(),
48
+ {
49
+ [theme.suggestionItemActive()]: index === selectedSuggestionIndex
50
+ }
51
+ ]"
52
+ @mousedown.prevent="selectSuggestion(suggestion, index)"
53
+ @mouseenter="selectedSuggestionIndex = index"
54
+ >
55
+ {{ suggestion }}
56
+ </div>
57
+ </div>
58
+ </template>
59
+ </Popover>
60
+ </FieldWrapper>
25
61
  </template>
26
62
 
27
63
  <script setup>
28
64
  import { useFieldHOC } from "#core/composables/useForm";
29
65
  import FieldWrapper from "#core/components/Form/FieldWrapper.vue";
30
- const emits = defineEmits(["change", "add", "remove"]);
66
+ import { ref, computed, nextTick, useUiConfig } from "#imports";
67
+ import { inputTheme } from "#core/theme/input";
68
+ const emits = defineEmits(["change", "add", "remove", "selected"]);
31
69
  const props = defineProps({
32
70
  leadingIcon: { type: null, required: false },
33
71
  trailingIcon: { type: null, required: false },
34
72
  loading: { type: Boolean, required: false },
35
73
  loadingIcon: { type: null, required: false },
36
74
  icon: { type: String, required: false },
37
- maxLength: { type: String, required: false },
75
+ maxLength: { type: Number, required: false },
38
76
  variant: { type: String, required: false },
39
77
  size: { type: String, required: false },
40
78
  deleteIcon: { type: String, required: false },
79
+ suggestions: { type: Array, required: false },
41
80
  form: { type: Object, required: false },
42
81
  name: { type: String, required: true },
43
82
  errorMessage: { type: String, required: false },
@@ -53,11 +92,18 @@ const props = defineProps({
53
92
  help: { type: String, required: false },
54
93
  ui: { type: null, required: false }
55
94
  });
95
+ const theme = computed(() => useUiConfig(inputTheme, "input")());
56
96
  const {
57
97
  value,
58
98
  wrapperProps,
59
99
  handleChange
60
100
  } = useFieldHOC(props);
101
+ const showSuggestions = ref(false);
102
+ const selectedSuggestionIndex = ref(-1);
103
+ const suggestionsContainerRef = ref();
104
+ const suggestionItemRefs = ref([]);
105
+ const inputRef = ref();
106
+ const currentInput = ref("");
61
107
  const onChange = (value2) => {
62
108
  handleChange(value2);
63
109
  emits("change", value2);
@@ -68,4 +114,112 @@ const onAdd = (value2) => {
68
114
  const onRemove = (value2) => {
69
115
  emits("remove", value2);
70
116
  };
117
+ const onInput = (event) => {
118
+ const target = event.target;
119
+ currentInput.value = target.value.toLowerCase();
120
+ };
121
+ const setSuggestionItemRef = (el, index) => {
122
+ if (suggestionItemRefs.value) {
123
+ suggestionItemRefs.value[index] = el;
124
+ }
125
+ };
126
+ const filteredSuggestions = computed(() => {
127
+ if (!props.suggestions) return [];
128
+ const inputVal = currentInput.value?.trim().toLowerCase() || "";
129
+ if (!inputVal) {
130
+ return props.suggestions.filter((s) => !value.value?.includes(s));
131
+ }
132
+ return props.suggestions.filter(
133
+ (suggestion) => suggestion.toLowerCase().includes(inputVal) && !value.value?.includes(suggestion)
134
+ );
135
+ });
136
+ const onFocus = () => {
137
+ if (props.suggestions && props.suggestions.length > 0) {
138
+ showSuggestions.value = true;
139
+ selectedSuggestionIndex.value = -1;
140
+ }
141
+ };
142
+ const onBlur = (event) => {
143
+ setTimeout(() => {
144
+ showSuggestions.value = false;
145
+ selectedSuggestionIndex.value = -1;
146
+ }, 150);
147
+ };
148
+ const onKeydown = (event) => {
149
+ if (!showSuggestions.value || filteredSuggestions.value.length === 0) {
150
+ return;
151
+ }
152
+ switch (event.key) {
153
+ case "ArrowDown":
154
+ event.preventDefault();
155
+ selectedSuggestionIndex.value = selectedSuggestionIndex.value < filteredSuggestions.value.length - 1 ? selectedSuggestionIndex.value + 1 : 0;
156
+ scrollToSelectedSuggestion();
157
+ break;
158
+ case "ArrowUp":
159
+ event.preventDefault();
160
+ selectedSuggestionIndex.value = selectedSuggestionIndex.value > 0 ? selectedSuggestionIndex.value - 1 : filteredSuggestions.value.length - 1;
161
+ scrollToSelectedSuggestion();
162
+ break;
163
+ case "Enter":
164
+ if (selectedSuggestionIndex.value === -1) {
165
+ return;
166
+ }
167
+ event.preventDefault();
168
+ if (selectedSuggestionIndex.value >= 0) {
169
+ const suggestion = filteredSuggestions.value[selectedSuggestionIndex.value];
170
+ if (suggestion) {
171
+ selectSuggestion(suggestion, selectedSuggestionIndex.value);
172
+ }
173
+ }
174
+ break;
175
+ case "Escape":
176
+ showSuggestions.value = false;
177
+ selectedSuggestionIndex.value = -1;
178
+ break;
179
+ }
180
+ };
181
+ const selectSuggestion = (suggestion, index) => {
182
+ if (index !== void 0) {
183
+ scrollToSuggestionByIndex(index);
184
+ }
185
+ const newValue = [...value.value || [], suggestion];
186
+ handleChange(newValue);
187
+ emits("selected", suggestion);
188
+ emits("change", newValue);
189
+ showSuggestions.value = false;
190
+ selectedSuggestionIndex.value = -1;
191
+ currentInput.value = "";
192
+ nextTick(() => {
193
+ if (inputRef.value) {
194
+ inputRef.value.$el.querySelector("input")?.focus();
195
+ }
196
+ });
197
+ };
198
+ const scrollToSelectedSuggestion = () => {
199
+ nextTick(() => {
200
+ if (selectedSuggestionIndex.value >= 0) {
201
+ scrollToSuggestionByIndex(selectedSuggestionIndex.value);
202
+ }
203
+ });
204
+ };
205
+ const scrollToSuggestionByIndex = (index) => {
206
+ if (!suggestionsContainerRef.value || !suggestionItemRefs.value[index]) {
207
+ return;
208
+ }
209
+ const container = suggestionsContainerRef.value;
210
+ const item = suggestionItemRefs.value[index];
211
+ if (item) {
212
+ const containerRect = container.getBoundingClientRect();
213
+ const itemRect = item.getBoundingClientRect();
214
+ const isAboveView = itemRect.top < containerRect.top;
215
+ const isBelowView = itemRect.bottom > containerRect.bottom;
216
+ if (isAboveView || isBelowView) {
217
+ item.scrollIntoView({
218
+ behavior: "smooth",
219
+ block: "nearest",
220
+ inline: "nearest"
221
+ });
222
+ }
223
+ }
224
+ };
71
225
  </script>
@@ -2,10 +2,12 @@ import type { ITagsFieldProps } from '#core/components/Form/InputTags/types';
2
2
  declare const __VLS_export: import("vue").DefineComponent<ITagsFieldProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
3
3
  add: (...args: any[]) => void;
4
4
  change: (...args: any[]) => void;
5
+ selected: (...args: any[]) => void;
5
6
  remove: (...args: any[]) => void;
6
7
  }, string, import("vue").PublicProps, Readonly<ITagsFieldProps> & Readonly<{
7
8
  onAdd?: ((...args: any[]) => any) | undefined;
8
9
  onChange?: ((...args: any[]) => any) | undefined;
10
+ onSelected?: ((...args: any[]) => any) | undefined;
9
11
  onRemove?: ((...args: any[]) => any) | undefined;
10
12
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
13
  declare const _default: typeof __VLS_export;