import * as _angular_core from '@angular/core'; import { AfterViewInit, QueryList, ChangeDetectorRef, Signal, EventEmitter, PipeTransform, InjectionToken } from '@angular/core'; import * as rxjs from 'rxjs'; import { ActiveDescendantKeyManager, Highlightable } from '@angular/cdk/a11y'; import { StringifyFn, StringSearchHandler } from '@odx/angular'; import { CustomFormControl, InputControlDirective } from '@odx/angular/cdk/custom-form-control'; import { OptionControl } from '@odx/angular/cdk/option-control'; import { DropdownDirective, DropdownOptions } from '@odx/angular/components/dropdown'; import { FormFieldComponent } from '@odx/angular/components/form-field'; import * as _angular_platform_browser from '@angular/platform-browser'; /** * `AutocompleteControl` is a base directive to enhance an input field with autocomplete functionality, * providing keyboard navigation and selection for options displayed in a dropdown. It's designed to be extended * for specific implementations. * Extends `CustomFormControl` to provide form control behavior and state management. * * @see {CustomFormControl} * * This directive manages the open/close state of the dropdown, the loading state indication, and the interaction between * the autocomplete input and the dropdown options. It utilizes `ActiveDescendantKeyManager` for keyboard navigation among options. * * Extend this directive to create a fully functional autocomplete control tailored to your data type and UI requirements. * * @template T - The type of the items displayed in the autocomplete dropdown. */ declare abstract class AutocompleteControl extends CustomFormControl implements AfterViewInit { protected abstract readonly options?: QueryList>; protected readonly changeDetector: ChangeDetectorRef; protected readonly formField: FormFieldComponent | null; protected readonly takeUntilDestroyed: () => rxjs.MonoTypeOperatorFunction; protected keyManager?: ActiveDescendantKeyManager; protected smoothScrollEnabled: boolean; protected readonly dropdown?: DropdownDirective; abstract searchField?: InputControlDirective; readonly element: _angular_core.ElementRef; get dropdownReferenceElement(): HTMLElement; get hasOptions(): boolean; get isOpen(): boolean; /** * When set to true, the dropdown will match the width of the host component. * * @type {boolean} * @default false */ matchReferenceWidth: _angular_core.InputSignalWithTransform; /** Internal */ readonly dropdownOptions: Signal>; /** * Indicates whether the component is in a loading state, used to show a loading spinner. * @type {boolean} * @default false */ isLoading: boolean; /** * A function that converts an item of type T to a string representation. * Used by the AutocompleteControl component to display the selected item. * * @type {StringifyFn} * * @example * ```ts * // Define a stringify function for a custom type Person * const stringifyPerson: StringifyFn = (person) => `${person.firstName} ${person.lastName}`; * * // Assign the stringify function to the AutocompleteControl * autocompleteControl.stringify = stringifyPerson; * ``` */ stringify?: StringifyFn; /** * Emits the selected option when an option is selected from the dropdown. * * @emits {T} - The selected option. * * @example * ```ts * autocompleteControl.optionSelected.subscribe((selectedOption) => { * console.log('Selected option:', selectedOption); * }); * ``` */ optionSelected: EventEmitter; /** * Event emitted before the dropdown opens. * @emits {void} * * @example * ```html * * * ``` */ beforeDropdownOpen: EventEmitter; /** * Event emitted after the dropdown opened. * * @emits {void} * * @example * ```html * * * ``` */ afterDropdownOpen: EventEmitter; /** * Event emitted before the dropdown closes. * * @emits {void} * * @example * ```html * * * ``` */ beforeDropdownClose: EventEmitter; /** * Event emitted after the dropdown closed. * * @emits {void} * * @example * ```html * * * ``` */ afterDropdownClose: EventEmitter; constructor(); ngAfterViewInit(): void; /** * Scrolls the specified option element into view. * @param {OptionControl} option - The option control containing the element to scroll into view. * @returns {void} * * @example * ```ts * const optionControl: OptionControl = { element: myOptionElement }; * scrollOptionIntoView(optionControl); * ``` */ scrollOptionIntoView({ element }: OptionControl): void; protected abstract handleQueryListOption(options: QueryList>): void; protected abstract handleSearchFieldChanges(): void; protected abstract activateSelectedOption(): void; protected initKeyManager(options: Highlightable[]): void; protected disableSmoothScroll(): void; protected enableSmoothScroll(): void; protected openDropdown(): void; protected closeDropdown(): void; protected onDropdownOpen(): void; protected onDropdownOpened(): void; protected onDropdownClose(): void; protected onDropdownClosed(): void; protected handleFocusOut(event: FocusEvent): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration, never>; static ɵdir: _angular_core.ɵɵDirectiveDeclaration, never, never, { "matchReferenceWidth": { "alias": "matchReferenceWidth"; "required": false; "isSignal": true; }; "isLoading": { "alias": "isLoading"; "required": false; }; "stringify": { "alias": "stringify"; "required": false; }; }, { "optionSelected": "optionSelected"; "beforeDropdownOpen": "beforeDropdownOpen"; "afterDropdownOpen": "afterDropdownOpen"; "beforeDropdownClose": "beforeDropdownClose"; "afterDropdownClose": "afterDropdownClose"; }, never, never, true, never>; static ngAcceptInputType_isLoading: unknown; } declare class HighlightSearchDirective { private readonly sanitizer; protected highlightedText: _angular_core.Signal<_angular_platform_browser.SafeHtml>; /** * Search string * @required * @type string */ odxHighlightSearch: _angular_core.InputSignal; /** * Text to highlight * @required * @type string */ text: _angular_core.InputSignal; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵdir: _angular_core.ɵɵDirectiveDeclaration; } interface HostController { searchField?: InputControlDirective; stringify?: StringifyFn; } interface SearchFilterPipeOptions { searchHandler?: StringSearchHandler; stringify?: StringifyFn; } declare const ODX_SEARCH_FILTER_HOST: InjectionToken; declare abstract class BaseSearchFilterPipe implements PipeTransform { private readonly stringSearchHandler; private readonly defaultStringify; protected readonly hostController: HostController | null; protected get searchField(): InputControlDirective | undefined; protected get stringify(): StringifyFn; transform(items: T[] | null, optionsOrHandler?: SearchFilterPipeOptions | StringSearchHandler): T[] | null; protected queryHandler(query: string): string; private filter; private isStringSearchHandler; } export { AutocompleteControl, BaseSearchFilterPipe, HighlightSearchDirective, ODX_SEARCH_FILTER_HOST };