import { AfterViewChecked, AfterViewInit, ChangeDetectorRef, DoCheck, EventEmitter, TemplateRef } from '@angular/core'; import { ListboxValueChangeEvent } from '@angular/cdk/listbox'; import { OptionComponent } from './option.component'; import { ControlValueAccessor } from '@angular/forms'; import { BooleanInput } from '@angular/cdk/coercion'; import { ListboxChild } from './listbox-child'; import { SectionDirective } from './section.directive'; import { ListboxInputDirective } from './listbox-input.directive'; import { TranslateService } from '../../common/translate.service'; import * as i0 from "@angular/core"; export declare class ListboxComponent implements ControlValueAccessor, AfterViewInit, AfterViewChecked, DoCheck { private changeDetectorRef; private t; /** * The list of selected values (`value`s of selected sp-options). * It's always an array, regardless of {@property multiple} being true or not. */ selectedValues: readonly string[]; /** * Emitted when the selection is changed. Emits selected values. */ selectedValuesChange: EventEmitter; /** * Allows for passing the list of listbox items instead of having them collected * from children. Useful when a component wants to render a listbox within its view * but wants to collect listbox items from its own content. */ _itemsInput?: Iterable; disabled?: BooleanInput; /** * Whether multiple selection is allowed */ multiple?: BooleanInput; /** * If true, pressing ArrowUp/ArrowDown on the first/last item will not move * focus to the last/first item. */ navigationWrapDisabled: BooleanInput; ariaLabel: string; ariaLabelledBy?: string; id?: string; /** * Used to provide custom empty state content. * When not provided, the default "No results" (in given language) message is shown. * Passing `null` will hide the empty state message. */ emptyState?: TemplateRef | string | null; /** * Emits whenever an option is selected, regardless of if it's already selected. */ selected: EventEmitter; private itemsInContent; private onTouched; private onChange; /** * List of spOption or spSection components either collected from the content * or passed as input. */ get options(): Iterable; get isEmpty(): boolean; private cdkListbox?; private cdkOptions?; private connectedInput?; /** * CdkListbox throws if there is a selected value that doesn't match any of the cdkOptions * It's probably an artificial check, and maybe they could remove it, but that's how it is now, * and selected value can be none of the currently visible options if options are searchable. * Since the check seems unnecessary, we do the filtering right in the listbox component instead * of in searchable select. * @private */ _validSelectedValues: readonly string[]; /** * Our expected behavior (matching the React impl) is to navigate to the last option, when * ArrowDown is pressed and no option is currently focused, but to not have focus wrapping. * disabling focus wrapping on cdkListbox is implemented differently, and doesn't allow for * that, so we enable it regardless of `navigationWrapDisabled` input, if there is no active * option. */ _forceEnableNavigationWrap: boolean; constructor(changeDetectorRef: ChangeDetectorRef, t: TranslateService); /** * Connects the listbox to an input, for combobox-like use cases. * Returns a keydown event handler to be used on the connected input. * Connecting an input to the listbox also causes listbox to use virtual focus * since the actual focus will be in the input. * @param inputDirective * * @internal */ connectToInput(inputDirective: ListboxInputDirective): { onKeydown: (event: KeyboardEvent) => void; onFocus: () => void; onBlur: () => void; }; isSelected(option: OptionComponent): boolean; ngAfterViewInit(): void; ngDoCheck(): void; ngAfterViewChecked(): void; /** * Sets active (focused) option. Passing null removes active state if any. * @param value option value */ setActiveOption(value: string | null): void; /** * @returns currently active (focused) option. */ getActiveOption(): string | null; registerOnChange(fn: any): void; registerOnTouched(fn: any): void; setDisabledState(isDisabled: boolean): void; writeValue(obj: any): void; /** * @private */ _handleSelectionChange({ value }: ListboxValueChangeEvent): void; /** * @private */ _isOption(item: ListboxChild): item is OptionComponent; /** * @private */ _isSection(item: ListboxChild): item is SectionDirective; /** * @private */ _shouldUseVirtualFocus(): boolean; /** * @private */ _isConnectedToInput(): boolean; _isString(input: unknown): boolean; _getEmptyState(): string | TemplateRef | null; _getEmptyStateTemplate(): TemplateRef | null; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; }