UNPKG

@ux-aspects/ux-aspects

Version:

Open source user interface framework for building modern, responsive, mobile big data applications

65 lines (64 loc) 3.61 kB
import { AfterContentInit, ChangeDetectorRef, EventEmitter, OnDestroy, QueryList } from '@angular/core'; import { SelectionItemDirective } from './selection-item.directive'; import { SelectionMode, SelectionService } from './selection.service'; import { SelectionStrategy } from './strategies/selection.strategy'; import * as i0 from "@angular/core"; export declare class SelectionDirective<T> implements AfterContentInit, OnDestroy { readonly _selectionService: SelectionService<T>; readonly _cdRef: ChangeDetectorRef; /** Defines the items that should be selected. */ set uxSelection(items: Array<T> | ReadonlyArray<T>); /** Can be used to enabled/disable selection behavior. */ set disabled(disabled: boolean); /** * Defines the selection behavior. Alternatively, custom selection behavior can be defined by defining a * class which extends SelectionStrategy, and providing an instance of the custom class to this property. * See below for details of the SelectionStrategy class. */ set mode(mode: SelectionMode | SelectionStrategy<T>); /** * Can be used to enable/disable click selection on items. This can be used to manually control the selection of an item, * for example, binding the selection state to a checkbox. */ set clickSelection(isClickEnabled: boolean); /** Can be used to enable/disable keyboard navigation on items. Use this if you wish to provide custom keyboard controls for selection. */ set keyboardSelection(isKeyboardEnabled: boolean); /** * The full set of selection items. * Only needed if the full set of `uxSelectionItem`s is not available, e.g. within a virtual scroll container. */ set selectionItems(value: T[]); /** The tabstop of the selection outer element */ tabindex: string | number; /** This event will be triggered when there is a change to the selected items. It will contain an array of the currently selected items. */ uxSelectionChange: EventEmitter<T[]>; /** Access all items within the list */ items: QueryList<SelectionItemDirective<T>>; /** Unsubscribe from all observables on component destroy */ private readonly _onDestroy; /** Store the previous selection so we don't emit more than we have to */ private _lastSelection; /** Whether a value has been provided to the `selectionItems` input. */ private _hasExplicitDataset; constructor(); ngAfterContentInit(): void; ngOnDestroy(): void; /** * Update the dataset to reflect the latest selection items */ update(): void; /** * Select all the items in the list */ selectAll(): void; /** * Deselect all currently selected items */ deselectAll(): void; /** * Determine if the previous selection is the same as the current selection */ private isSelectionChanged; static ɵfac: i0.ɵɵFactoryDeclaration<SelectionDirective<any>, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<SelectionDirective<any>, "[uxSelection]", ["ux-selection"], { "uxSelection": { "alias": "uxSelection"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "mode": { "alias": "mode"; "required": false; }; "clickSelection": { "alias": "clickSelection"; "required": false; }; "keyboardSelection": { "alias": "keyboardSelection"; "required": false; }; "selectionItems": { "alias": "selectionItems"; "required": false; }; "tabindex": { "alias": "tabindex"; "required": false; }; }, { "uxSelectionChange": "uxSelectionChange"; }, ["items"], never, false, never>; }