// Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ import type { AutocompleteSelectValue } from '#shared/components/Form/fields/FieldAutocomplete/types.ts' import createInput from '#shared/form/core/createInput.ts' import addLink from '#shared/form/features/addLink.ts' import formUpdaterTrigger from '#shared/form/features/formUpdaterTrigger.ts' import FieldAutoCompleteInput from './FieldAutoCompleteInput.vue' import type { AutoCompleteProps } from './types.ts' import type { FormKitBaseSlots, FormKitInputs } from '@formkit/inputs' declare module '@formkit/inputs' { interface FormKitInputProps> { autocomplete: AutoCompleteProps & { type: 'autocomplete' value: AutocompleteSelectValue | null } } interface FormKitInputSlots> { treeselect: FormKitBaseSlots } } export const autoCompleteProps = [ 'actions', 'alternativeBackground', 'additionalQueryParams', 'clearable', 'debounceInterval', 'defaultFilter', 'limit', 'multiple', 'noOptionsLabelTranslation', 'belongsToObjectField', 'optionIconComponent', 'dialogNotFoundMessage', 'dialogEmptyMessage', 'options', 'initialOptionBuilder', 'autocompleteOptionsPreprocessor', 'sorting', 'complexValue', 'clearValue', 'emptyInitialLabelText', ] const fieldDefinition = createInput( FieldAutoCompleteInput, [...autoCompleteProps, 'gqlQuery'], { features: [addLink, formUpdaterTrigger()] }, ) export default { fieldType: 'autocomplete', definition: fieldDefinition, }