From 2c3e46be6c0014d312429612ee60bd255e06b46a Mon Sep 17 00:00:00 2001 From: Blesilda Ramirez Date: Mon, 25 Nov 2024 00:42:29 +0800 Subject: [PATCH] pkp/pkp-lib#10624 Remove autosuggest props in api --- .../Form/fields/FieldBaseAutosuggest.vue | 22 ++++++------- src/composables/useAutosuggest.js | 32 +------------------ 2 files changed, 11 insertions(+), 43 deletions(-) diff --git a/src/components/Form/fields/FieldBaseAutosuggest.vue b/src/components/Form/fields/FieldBaseAutosuggest.vue index fc2cc9e2..c7825a53 100644 --- a/src/components/Form/fields/FieldBaseAutosuggest.vue +++ b/src/components/Form/fields/FieldBaseAutosuggest.vue @@ -123,7 +123,6 @@ import Tooltip from '@/components/Tooltip/Tooltip.vue'; import HelpButton from '@/components/HelpButton/HelpButton.vue'; import FieldError from '@/components/Form/FieldError.vue'; import MultilingualProgress from '@/components/MultilingualProgress/MultilingualProgress.vue'; -import {useAutosuggest} from '@/composables/useAutosuggest'; import ajaxError from '@/mixins/ajaxError'; import debounce from 'debounce'; @@ -269,17 +268,16 @@ export default { return direction === 'rtl'; }, autoSuggestProps() { - const {autoSuggestProps} = useAutosuggest( - this.inputProps, - this.autosuggestId, - this.suggestions, - this.selectedLabel, - this.currentValue, - this.currentSelected, - this.isDisabled, - this.deselectLabel, - ); - return autoSuggestProps; + return { + id: this.autosuggestId, + inputProps: this.inputProps, + suggestions: this.suggestions, + selectedLabel: this.selectedLabel, + currentValue: this.currentValue, + currentSelected: this.currentSelected, + isDisabled: this.isDisabled, + deselectLabel: this.deselectLabel, + }; }, }, watch: { diff --git a/src/composables/useAutosuggest.js b/src/composables/useAutosuggest.js index 6646337d..fe86790a 100644 --- a/src/composables/useAutosuggest.js +++ b/src/composables/useAutosuggest.js @@ -1,28 +1,10 @@ import {ref, inject} from 'vue'; -export function useAutosuggest( - _inputProps = {}, - _id = '', - _suggestions = [], - _selectedLabel = '', - _currentValue = '', - _currentSelected = [], - _isDisabled = false, - _deselectLabel = '', -) { +export function useAutosuggest() { 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); @@ -38,17 +20,6 @@ export function useAutosuggest( 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, @@ -56,6 +27,5 @@ export function useAutosuggest( handleChange, handleFocus, handleBlur, - autoSuggestProps, }; }