import { FocusKeyManager } from '@angular/cdk/a11y'; import { Directionality } from '@angular/cdk/bidi'; import { SelectionModel } from '@angular/cdk/collections'; import { AfterContentInit, ChangeDetectorRef, DoCheck, ElementRef, OnDestroy, OnInit, QueryList, EventEmitter } from '@angular/core'; import { ControlValueAccessor, FormGroupDirective, NgControl, NgForm } from '@angular/forms'; import { Observable } from 'rxjs'; import { GraniteChipComponent, GraniteChipEvent, GraniteChipSelectionChangeEvent } from './chip.component'; import { GraniteChipTextControl } from './chip-input'; import * as i0 from "@angular/core"; declare abstract class GraniteChipListBase { _parentForm: NgForm; _parentFormGroup: FormGroupDirective; ngControl: NgControl; readonly stateChanges: EventEmitter; constructor(_parentForm: NgForm, _parentFormGroup: FormGroupDirective, ngControl: NgControl); } export declare class GraniteChipListComponent extends GraniteChipListBase implements ControlValueAccessor, AfterContentInit, DoCheck, OnInit, OnDestroy { protected _elementRef: ElementRef; private _changeDetectorRef; private _dir; ariaLabel: string | null; ariaLabelledby: string | null; ariaOrientation: 'horizontal' | 'vertical'; /** The chips contained within this chip list. */ chips: QueryList; readonly controlType: string; /** Uid of the chip list */ _uid: string; /** Tab index for the chip list. */ _tabIndex: number; /** * User defined tab index. * When it is not null, use user defined tab index. Otherwise use _tabIndex */ _userTabIndex: number | null; /** The FocusKeyManager which handles focus. */ _keyManager: FocusKeyManager; _selectionModel: SelectionModel; /** The chip input to add more chips */ protected _chipInput: GraniteChipTextControl; protected _disabled: boolean; protected _selectable: boolean; /** * When a chip is destroyed, we store the index of the destroyed chip until the chips * query list notifies about the update. This is necessary because we cannot determine an * appropriate chip that should receive focus until the array of chips updated completely. */ private _lastDestroyedChipIndex; /** Subject that emits when the component has been destroyed. */ private readonly _destroyed; /** Subscription to focus changes in the chips. */ private _chipFocusSubscription; /** Subscription to blur changes in the chips. */ private _chipBlurSubscription; /** Subscription to selection changes in chips. */ private _chipSelectionSubscription; /** Subscription to remove changes in chips. */ private _chipRemoveSubscription; /** The ARIA role applied to the chip list. */ get role(): string | null; set role(role: string | null); private _explicitRole?; /** Whether the user should be allowed to select multiselect chips. */ get multiselect(): boolean; set multiselect(value: boolean); private _multiple; /** * Whether the chip list is disabled. */ get disabled(): boolean; set disabled(value: boolean); /** * Whether or not this chip list is selectable. When a chip list is not selectable, * the selected states for all the chips inside the chip list are always ignored. */ get selectable(): boolean; set selectable(value: boolean); set tabindex(value: number); /** Unique identifier for the chip list. */ get id(): string; /** Whether any chips or the matChipInput inside of this chip-list has focus. */ get focused(): boolean; /** Whether the chip list is empty. */ get empty(): boolean; /** The array of selected chips inside chip list. */ get selected(): GraniteChipComponent[] | GraniteChipComponent; /** Combined stream of all of the child chips' selection change events. */ get chipSelectionChanges(): Observable; /** Combined stream of all of the child chips' focus change events. */ get chipFocusChanges(): Observable; /** Combined stream of all of the child chips' blur change events. */ get chipBlurChanges(): Observable; /** Combined stream of all of the child chips' remove change events. */ get chipRemoveChanges(): Observable; constructor(_elementRef: ElementRef, _changeDetectorRef: ChangeDetectorRef, _dir: Directionality, _parentForm: NgForm, _parentFormGroup: FormGroupDirective, ngControl: NgControl); /** Function when changed */ _onChange: (value: any) => void; /** Function when changed */ _onTouched: () => void; ngAfterContentInit(): void; ngOnInit(): void; ngDoCheck(): void; ngOnDestroy(): void; /** Associates an HTML input element with this chip list. */ registerInput(inputElement: GraniteChipTextControl): void; writeValue(value: any): void; registerOnChange(fn: (value: any) => void): void; registerOnTouched(fn: () => void): void; setDisabledState(isDisabled: boolean): void; /** * Focus chip list when click on the container. */ onContainerClick(event: MouseEvent): void; /** * Focuses the first non-disabled chip in this chip list, or the associated input when there * are no eligible chips. */ focus(options?: FocusOptions): void; /** Attempt to focus an input if we have one. */ _focusInput(options?: FocusOptions): void; /** * Pass events to the keyboard manager. Available here for tests. */ _keydown(event: KeyboardEvent): void; /** When blurred, mark the field as touched when focus moved outside the chip list. */ _blur(): void; /** Mark the field as touched */ _markAsTouched(): void; /** * Removes the `tabindex` from the chip list and resets it back afterwards, allowing the * user to tab out of it. This prevents the list from capturing focus and redirecting * it back to the first chip, creating a focus trap, if it user tries to tab away. */ _allowFocusEscape(): void; /** * Check the tab index as you should not be allowed to focus an empty list. */ protected _updateTabIndex(): void; /** * If the amount of chips changed, we need to update the * key manager state and focus the next closest chip. */ protected _updateFocusForDestroyedChips(): void; /** * Utility to ensure all indexes are valid. * * @param index The index to be checked. * @returns True if the index is valid for our list of chips. */ private _isValidIndex; private _setSelectionByValue; /** * Finds and selects the chip based on its value. * @returns Chip that has the corresponding value. */ private _selectValue; private _initializeSelection; /** * Deselects every chip in the list. * @param skip Chip that should not be deselected. */ private _clearSelection; /** * Sorts the model values, ensuring that they keep the same * order that they have in the panel. */ private _sortValues; private _compareWith; private _resetChips; private _dropSubscriptions; /** Listens to user-generated selection events on each chip. */ private _listenToChipsSelection; /** Listens to user-generated selection events on each chip. */ private _listenToChipsFocus; private _listenToChipsRemoved; /** Checks whether an event comes from inside a chip element. */ private _originatesFromChip; /** Checks whether any of the chips is focused. */ private _hasFocusedChip; /** Syncs the list's state with the individual chips. */ private _syncChipsState; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } export {};