UNPKG

@ux-aspects/ux-aspects

Version:

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

44 lines (43 loc) 2.88 kB
import { EventEmitter, OnChanges, OnDestroy, OnInit, SimpleChanges, TemplateRef } from '@angular/core'; import { ColumnSortingIndicatorContext, ColumnSortingOrder, ColumnSortingState } from './column-sorting.directive'; import * as i0 from "@angular/core"; export declare class ColumnSortingComponent implements OnInit, OnChanges, OnDestroy { private readonly _sorter; private readonly _changeDetector; /** Defines the sorting order of a column: `NoSort`, `Ascending` or `Descending`. */ state: ColumnSortingState; /** Defines a unique identifier for the column that can be used when sorting. */ key: string; /** Store the order of the sorting - used when multiple columns are being sorted at once */ order: number; /** Determine if a column can have a `NoSort` state */ allowNoSort: boolean; /** Specifies name of the ascending icon */ ascendingIcon: string; /** Specifies name of the descending icon */ descendingIcon: string; /** * Changes the state of the sorting on the column between `NoSort`, `Ascending` and `Descending`. * This returns an array of objects for each column being sorted containing `key: string` and `state: ColumnSortingState`. * State can be used to find the current sorting state of the column eg. `(state === ColumnSortingState.Ascending)`. * The `ColumnSortingOrder` interface has been provided for objects in the array. */ stateChange: EventEmitter<ColumnSortingState>; /** Emit whenever the order changes */ orderChange: EventEmitter<number>; /** Expose the sorting state enum to the view */ ColumnSortingState: typeof ColumnSortingState; /** Access the custom sort indicator if one was provided */ get _sortIndicator(): TemplateRef<ColumnSortingIndicatorContext>; /** Unsubscribe from all observables on component destroy */ private readonly _onDestroy$; ngOnInit(): void; ngOnChanges(changes: SimpleChanges): void; ngOnDestroy(): void; /** Toggle the sorting state of a column - this is designed to be programmatically called by the consuming component */ changeState(): ColumnSortingOrder[]; /** Update the state based on column order */ private updateState; static ɵfac: i0.ɵɵFactoryDeclaration<ColumnSortingComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<ColumnSortingComponent, "ux-column-sorting", ["ux-column-sorting"], { "state": { "alias": "state"; "required": false; }; "key": { "alias": "key"; "required": false; }; "order": { "alias": "order"; "required": false; }; "allowNoSort": { "alias": "allowNoSort"; "required": false; }; "ascendingIcon": { "alias": "ascendingIcon"; "required": false; }; "descendingIcon": { "alias": "descendingIcon"; "required": false; }; }, { "stateChange": "stateChange"; "orderChange": "orderChange"; }, never, never, false, never>; }