UNPKG

@engie-group/fluid-design-system-angular

Version:

Fluid Design System Angular

150 lines (149 loc) 5.06 kB
import { AfterViewInit, ChangeDetectorRef, ElementRef, OnDestroy, QueryList } from '@angular/core'; import { ControlValueAccessor } from '@angular/forms'; import { CustomLabelDirective } from '../custom-label/custom-label.directive'; import { FormItemComponent } from '../form-item/form-item.component'; import { ListDeprecatedComponent } from '../list-deprecated/list-deprecated.component'; import { ListItemDeprecatedComponent } from '../list-item-deprecated/list-item-deprecated.component'; import { SelectCustomLabelContext } from './select-custom-label-context.model'; import * as i0 from "@angular/core"; export declare class SelectComponent extends FormItemComponent implements AfterViewInit, ControlValueAccessor, OnDestroy { private readonly element; private readonly cdr; private document; private static readonly ESCAPE_CODE; private static readonly ENTER_CODE; private static readonly UP_CODE; private static readonly DOWN_CODE; private static readonly ALPHA_NUMERIC_REGEX; /** * @ignore */ private _onChange; /** * @ignore */ private _onTouched; /** * Notifier used to stop items click event subscription. * @ignore */ private unsubscribe; private childOptionsChange; /** * @ignore */ isOpen: boolean; /** * @ignore */ selectedValue: string | null; /** * @ignore */ selectedIndex: number; iconName: string; /** * Label used for accessibility related attributes on button and list. * Should be the same value (text only) as the `<label>` element */ fieldLabel?: string; label?: string; /** * Instructions on how to navigate the list. It is append after the input label. * @example "Use up and down arrows and Enter to select a value" */ listNavigationLabel?: string; /** * Button default label when no value is selected. It is append after the input label. * @example "Select a value" */ buttonDefaultValueLabel?: string; /** * Trigger button to toggle the list * @ignore */ buttonEl?: ElementRef<HTMLButtonElement>; protected customLabelEl?: ElementRef<HTMLElement>; /** * List containing options * @ignore */ listEl?: ListDeprecatedComponent; /** * Label to display instead of raw text value * @ignore * @example * <ng-template njCustomLabel let-value let-index="index"> * Value: {{value}} - Index: {{index}} * </ng-template> * * @example * <span *njCustomLabel="let value;let index=index"> * Value: {{value}} - Index: {{index}} * </span> */ protected customLabel?: CustomLabelDirective<SelectCustomLabelContext>; /** * Option items * @ignore */ selectOptions?: QueryList<ListItemDeprecatedComponent>; constructor(element: ElementRef<HTMLElement>, cdr: ChangeDetectorRef, document: Document); ngAfterViewInit(): void; ngOnDestroy(): void; private setInputsAndListenersOnOptions; /** * @ignore */ getAdditionalClass(): string; protected getSubscriptId(): string; protected getInstructionsId(): string; protected getDescriptionId(): string; /** * Get index of the selected value */ private indexForValue; private openList; private closeList; protected toggleIsOpen(): void; /** * Index of the currently focused option. */ private get focusedIndex(); private set focusedIndex(value); protected handleListKeydown(e: KeyboardEvent): void; protected handleFocusout(e: FocusEvent): void; /** * Implemented as part of ControlValueAccessor. * @ignore */ registerOnChange(fn: any): void; /** * Implemented as part of ControlValueAccessor. * @ignore */ registerOnTouched(fn: any): void; /** * Implemented as part of ControlValueAccessor. * @ignore */ setDisabledState(isDisabled: boolean): void; /** * Implemented as part of ControlValueAccessor. * @ignore */ writeValue(value: string): void; protected get customLabelContext(): SelectCustomLabelContext; /** * Label (≠ value) of selected option * @ignore */ get selectedLabel(): string; /** * Aria-label for the trigger button element. * @ignore */ get buttonLabel(): string; static ɵfac: i0.ɵɵFactoryDeclaration<SelectComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<SelectComponent, "nj-select", never, { "iconName": { "alias": "iconName"; "required": false; }; "fieldLabel": { "alias": "fieldLabel"; "required": false; }; "label": { "alias": "label"; "required": false; }; "listNavigationLabel": { "alias": "listNavigationLabel"; "required": false; }; "buttonDefaultValueLabel": { "alias": "buttonDefaultValueLabel"; "required": false; }; }, {}, ["customLabel", "selectOptions"], ["[njFormLabel]", "[njFormSubscript]", "[njSelectOptions]"], true, never>; }