import { EventEmitter, OnChanges, OnDestroy } from '@angular/core'; import { Subject } from 'rxjs'; /** * Define the allowed sort directions for {@link TsSortDirective} */ export declare type TsSortDirection = 'asc' | 'desc' | ''; /** * Interface for a directive that holds sorting state consumed by `TsSortHeaderComponent` */ export interface TsSortableItem { /** * The id of the column being sorted */ id: string; /** * Starting sort direction */ start: 'asc' | 'desc'; /** * Whether to disable clearing the sorting state */ disableClear: boolean; } /** * The current sort state */ export interface TsSortState { /** * The id of the column being sorted */ active: string; /** * The sort direction */ direction: TsSortDirection; } /** * Container for TsSortables to manage the sort state and provide default sort parameters * * @example * * * ... * * * https://getterminus.github.io/ui-demos-release/components/table */ export declare class TsSortDirective implements OnChanges, OnDestroy { /** * Store the disabled flag */ disabled: boolean; /** * Collection of all registered sortables that this directive manages */ private sortables; /** * Used to notify any child components listening to state changes */ _stateChanges: Subject; /** * The id of the most recently sorted TsSortable */ active: string; /** * The direction to set when an TsSortable is initially sorted. * * May be overridden by the TsSortable's sort start. */ start: 'asc' | 'desc'; /** * The sort direction of the currently active TsSortable * * @param direction */ set direction(direction: TsSortDirection); get direction(): TsSortDirection; private _direction; /** * Whether to disable the user from clearing the sort by finishing the sort direction cycle. * * May be overridden by the TsSortable's disable clear input. */ disableClear: boolean; /** * Event emitted when the user changes either the active sort or sort direction */ readonly sortChange: EventEmitter; /** * Trigger next on all changes */ ngOnChanges(): void; /** * Complete the observable on destroy */ ngOnDestroy(): void; /** * Register function to be used by the contained TsSortables. Adds the TsSortable to the * collection of TsSortables. * * @param sortable */ register(sortable: TsSortableItem): void; /** * Unregister function to be used by the contained TsSortables. Removes the TsSortable from the * collection of contained TsSortables. * * @param sortable */ deregister(sortable: TsSortableItem): void; /** * Sets the active sort id and determines the new sort direction * * @param sortable */ sort(sortable: TsSortableItem): void; /** * Returns the next sort direction of the active sortable, checking for potential overrides * * @param sortable */ getNextSortDirection(sortable: TsSortableItem): TsSortDirection; }