import { FocusableOption, FocusKeyManager } from '@angular/cdk/a11y'; import { SelectionModel } from '@angular/cdk/collections'; import { AfterContentInit, ChangeDetectorRef, ElementRef, EventEmitter, OnDestroy, OnInit, QueryList } from '@angular/core'; import { ControlValueAccessor } from '@angular/forms'; import { CanDisableRipple, VdlLine } from 'vdl-angular/core'; import { VdlListItemAvatar, VdlListItemIcon } from './list'; import { ListService } from './list.service'; /** @docs-private */ export declare class VdlSelectionListBase { } export declare const _VdlSelectionListMixinBase: (new (...args: any[]) => CanDisableRipple) & typeof VdlSelectionListBase; /** @docs-private */ export declare class VdlListOptionBase { } export declare const _VdlListOptionMixinBase: (new (...args: any[]) => CanDisableRipple) & typeof VdlListOptionBase; /** @docs-private */ export declare const VDL_SELECTION_LIST_VALUE_ACCESSOR: any; /** Change event that is being fired whenever the selected state of an option changes. */ export declare class VdlSelectionListChange { /** Reference to the selection list that emitted the event. */ source: VdlSelectionList; /** Reference to the option that has been changed. */ option: VdlListOption; constructor( /** Reference to the selection list that emitted the event. */ source: VdlSelectionList, /** Reference to the option that has been changed. */ option: VdlListOption); } /** * Component for list-options of selection-list. Each list-option can automatically * generate a checkbox/radio button and can put current item into the selectionModel of selection-list * if the current item is selected. */ export declare class VdlListOption extends _VdlListOptionMixinBase implements AfterContentInit, OnDestroy, OnInit, FocusableOption, CanDisableRipple { private _element; private _changeDetector; /** @docs-private */ selectionList: VdlSelectionList; private _lineSetter; private _selected; private _disabled; private _id; _lastActive: boolean; /** Whether the option has focus. */ _hasFocus: boolean; _lines: QueryList; _hasAvatar: VdlListItemAvatar; _hasIcon: VdlListItemIcon; /** DOM element containing the item's text. */ _text: ElementRef; /** Whether the label should appear before or after the checkbox. Defaults to 'before' */ checkboxPosition: 'before' | 'after'; /** The id of the list item */ id: string; /** Whether or not the list item should stay inline */ isInline: boolean; /** Whether the list item is multi-select or single-select. Defaults to true */ isMultiSelect: boolean; /** Whether or not the list item should wrap */ wrapTextContent: boolean; /** Returns which VDL list item was selected */ lastActive: EventEmitter; /** Event emitted when a list item is clicked */ listItemClick: EventEmitter; /** Value of the option */ value: any; /** Whether the option is disabled. */ disabled: any; /** Whether the option is selected. */ selected: boolean; /** @docs-private */ _listService: ListService; constructor(_element: ElementRef, _changeDetector: ChangeDetectorRef, /** @docs-private */ selectionList: VdlSelectionList, listService: ListService); ngOnInit(): void; ngAfterContentInit(): void; ngOnDestroy(): void; /** Toggles the selection state of the option. */ toggle(): void; /** Allows for programmatic focusing of the option. */ focus(): void; /** * Returns the list item's text label. Implemented as a part of the FocusKeyManager. * @docs-private */ getLabel(): any; _hasIconOrAvatar(): boolean; _isRippleDisabled(): boolean; _handleClick(): void; _handleFocus(): void; _handleBlur(): void; /** Retrieves the DOM element of the component host. */ _getHostElement(): HTMLElement; /** Sets the selected state of the option. Returns whether the value has changed. */ _setSelected(selected: boolean): boolean; /** * Notifies Angular that the option needs to be checked in the next change detection run. Mainly * used to trigger an update of the list option if the disabled state of the selection list * changed. */ _markForCheck(): void; _detectChanges(): void; _radioClicked(event: Event): void; } /** * Veritas Design list component where each item is a selectable option. Behaves as a listbox. */ export declare class VdlSelectionList extends _VdlSelectionListMixinBase implements FocusableOption, CanDisableRipple, AfterContentInit, ControlValueAccessor, OnDestroy { private _element; private _changeDetector; /** The FocusKeyManager which handles focus. */ _keyManager: FocusKeyManager; /** The option components contained within this selection-list. */ options: QueryList; /** Emits a change event whenever the selected state of an option changes. */ readonly selectionChange: EventEmitter; /** Tabindex of the selection list. */ tabIndex: number; /** Whether list is multi-select or single-select. Default is true for backwards compatibility */ isMultiSelect: boolean; _isMultiSelect: boolean; multiSelectChangeEvent: EventEmitter; /** * Function used for comparing an option against the selected value when determining which * options should appear as selected. The first argument is the value of an options. The second * one is a value from the selected value. A boolean must be returned. */ compareWith: (o1: any, o2: any) => boolean; /** Whether the selection list is disabled. */ disabled: boolean; private _disabled; /** The currently selected options. */ selectedOptions: SelectionModel; /** View to model callback that should be called whenever the selected options change. */ private _onChange; /** Used for storing the values that were assigned before the options were initialized. */ private _tempValues; /** Subscription to sync value changes in the SelectionModel back to the SelectionList. */ private _modelChanges; /** View to model callback that should be called if the list or its options lost focus. */ _onTouched: () => void; constructor(_element: ElementRef, _changeDetector: ChangeDetectorRef, tabIndex: string); ngOnInit(): void; ngAfterContentInit(): void; ngOnDestroy(): void; /** Focuses the last active list option. */ focus(): void; /** Selects all of the options. */ selectAll(): void; /** Deselects all of the options. */ deselectAll(): void; /** Sets the focused option of the selection-list. */ _setFocusedOption(option: VdlListOption): void; /** Removes an option from the selection list and updates the active item. */ _removeOptionFromList(option: VdlListOption): void; /** Passes relevant key presses to our key manager. */ _keydown(event: KeyboardEvent): void; /** Reports a value change to the ControlValueAccessor */ _reportValueChange(): void; /** Emits a change event if the selected state of an option changed. */ _emitChangeEvent(option: VdlListOption): void; /** Implemented as part of ControlValueAccessor. */ writeValue(values: string[]): void; /** Implemented as a part of ControlValueAccessor. */ setDisabledState(isDisabled: boolean): void; /** Implemented as part of ControlValueAccessor. */ registerOnChange(fn: (value: any) => void): void; /** Implemented as part of ControlValueAccessor. */ registerOnTouched(fn: () => void): void; /** Sets the selected options based on the specified values. */ private _setOptionsFromValues(values); /** Returns the values of the selected options. */ private _getSelectedOptionValues(); /** Toggles the selected state of the currently focused option. */ private _toggleSelectOnFocusedOption(); /** * Sets the selected state on all of the options * and emits an event if anything changed. */ private _setAllOptionsSelected(isSelected); /** * 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 options. */ private _isValidIndex(index); /** Returns the index of the specified list option. */ private _getOptionIndex(option); }