From 52813c0848d476d5f3f4c3a6c3c4dc8ed19ea91b Mon Sep 17 00:00:00 2001 From: tugcekucukoglu Date: Mon, 18 Mar 2024 13:01:24 +0300 Subject: [PATCH] Refactor #5426 - For Autocomplete --- components/lib/autocomplete/AutoComplete.d.ts | 33 ++++++--- components/lib/autocomplete/AutoComplete.vue | 68 +++++++++++-------- .../autocomplete/style/AutoCompleteStyle.js | 16 +++-- 3 files changed, 72 insertions(+), 45 deletions(-) diff --git a/components/lib/autocomplete/AutoComplete.d.ts b/components/lib/autocomplete/AutoComplete.d.ts index 763d69f67..bdee223a8 100755 --- a/components/lib/autocomplete/AutoComplete.d.ts +++ b/components/lib/autocomplete/AutoComplete.d.ts @@ -9,9 +9,9 @@ */ import { HTMLAttributes, InputHTMLAttributes, TransitionProps, VNode } from 'vue'; import { ComponentHooks } from '../basecomponent'; -import { ButtonPassThroughOptions } from '../button'; +import { InputTextPassThroughOptions } from '../inputtext'; import { PassThroughOptions } from '../passthrough'; -import { ClassComponent, GlobalComponentConstructor, PassThrough, HintedString } from '../ts-helpers'; +import { ClassComponent, GlobalComponentConstructor, HintedString, Nullable, PassThrough } from '../ts-helpers'; import { VirtualScrollerItemOptions, VirtualScrollerPassThroughOptionType, VirtualScrollerProps } from '../virtualscroller'; export declare type AutoCompletePassThroughOptionType = AutoCompletePassThroughAttributes | ((options: AutoCompletePassThroughMethodOptions) => AutoCompletePassThroughAttributes | string) | string | null | undefined; @@ -143,9 +143,10 @@ export interface AutoCompletePassThroughOptions { */ root?: AutoCompletePassThroughOptionType; /** - * Used to pass attributes to the input's DOM element. + * Used to pass attributes to the InputText component. + * @see {@link InputTextPassThroughOptions} */ - input?: AutoCompletePassThroughOptionType; + input?: InputTextPassThroughOptions; /** * Used to pass attributes to the container's DOM element. */ @@ -171,10 +172,9 @@ export interface AutoCompletePassThroughOptions { */ loadingIcon?: AutoCompletePassThroughOptionType; /** - * Used to pass attributes to the Button component. - * @see {@link ButtonPassThroughOptions} + * Used to pass attributes to the dropdown button component. */ - dropdownButton?: ButtonPassThroughOptions; + dropdownButton?: AutoCompletePassThroughOptionType; /** * Used to pass attributes to the panel's DOM element. */ @@ -241,12 +241,12 @@ export interface AutoCompleteState { focused: boolean; /** * Current focused item index as a number. - * @defaultvalue -1 + * @defaultValue -1 */ focusedOptionIndex: number; /** * Current focused item index as a number. - * @defaultvalue -1 + * @defaultValue -1 */ focusedMultipleOptionIndex: number; /** @@ -259,6 +259,11 @@ export interface AutoCompleteState { * @defaultValue false */ searching: boolean; + /** + * Value of the token input as a string. + * @defaultValue null + */ + multipleInputValue: Nullable; } /** @@ -687,6 +692,16 @@ export interface AutoCompleteSlots { */ class: string; }): VNode[]; + /** + * Custom dropdown button template. + */ + dropdownbutton(scope: { + /** + * Toggle function. + * @param {Event} event - Browser event + */ + toggleCallback: (event: Event) => void; + }): VNode[]; } /** diff --git a/components/lib/autocomplete/AutoComplete.vue b/components/lib/autocomplete/AutoComplete.vue index 01782561e..eb8a01bb9 100755 --- a/components/lib/autocomplete/AutoComplete.vue +++ b/components/lib/autocomplete/AutoComplete.vue @@ -1,6 +1,6 @@