diff --git a/src/components/Form/fields/Autosuggest.vue b/src/components/Form/fields/Autosuggest.vue
new file mode 100644
index 00000000..ed50fc47
--- /dev/null
+++ b/src/components/Form/fields/Autosuggest.vue
@@ -0,0 +1,147 @@
+
+ {{ selectedLabel }}
+
+ {{ t('common.none') }}
+
+
+ {{ item.label }}
+
+
+
+
+ handleChange(event, emit)"
+ @focus="() => handleFocus(emit)"
+ @blur="() => handleBlur(emit)"
+ />
+
+
+
+ {{ localInputValue }}
+
+
+
+
+
+ {{ suggestion.label }}
+
+
+
+
+
+
diff --git a/src/components/Form/fields/FieldBaseAutosuggest.vue b/src/components/Form/fields/FieldBaseAutosuggest.vue
index 1c1483c3..fc2cc9e2 100644
--- a/src/components/Form/fields/FieldBaseAutosuggest.vue
+++ b/src/components/Form/fields/FieldBaseAutosuggest.vue
@@ -80,43 +80,22 @@
/>
- {{ selectedLabel }}
-
- {{ t('common.none') }}
-
-
- {{ item.label }}
-
-
-
-
+
+
+
-
+
@@ -138,14 +117,13 @@
diff --git a/src/composables/useAutosuggest.js b/src/composables/useAutosuggest.js
index 4800717a..6646337d 100644
--- a/src/composables/useAutosuggest.js
+++ b/src/composables/useAutosuggest.js
@@ -1,10 +1,28 @@
import {ref, inject} from 'vue';
-export function useAutosuggest(emit) {
+export function useAutosuggest(
+ _inputProps = {},
+ _id = '',
+ _suggestions = [],
+ _selectedLabel = '',
+ _currentValue = '',
+ _currentSelected = [],
+ _isDisabled = false,
+ _deselectLabel = '',
+) {
const allowCustom = inject('allowCustom', false);
const localInputValue = ref('');
const isFocused = ref(false);
+ const inputProps = ref(_inputProps);
+ const id = ref(_id);
+ const suggestions = ref(_suggestions);
+ const selectedLabel = ref(_selectedLabel);
+ const currentValue = ref(_currentValue);
+ const currentSelected = ref(_currentSelected);
+ const isDisabled = ref(_isDisabled);
+ const deselectLabel = ref(_deselectLabel);
+
function handleChange(event, emit) {
localInputValue.value = event.target.value.trim();
emit('update:inputValue', localInputValue.value);
@@ -20,6 +38,17 @@ export function useAutosuggest(emit) {
emit('update:isFocused', isFocused.value);
}
+ const autoSuggestProps = {
+ inputProps: inputProps.value,
+ id: id.value,
+ suggestions: suggestions.value,
+ selectedLabel: selectedLabel.value,
+ currentValue: currentValue.value,
+ currentSelected: currentSelected.value,
+ isDisabled: isDisabled.value,
+ deselectLabel: deselectLabel.value,
+ };
+
return {
allowCustom,
localInputValue,
@@ -27,5 +56,6 @@ export function useAutosuggest(emit) {
handleChange,
handleFocus,
handleBlur,
+ autoSuggestProps,
};
}