/** * * Adaptation from angular's material * * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** Container for NwbSortables to manage the sort state and provide default sort parameters. */ import { EventEmitter, OnChanges, OnDestroy } from '@angular/core'; import { Subject } from 'rxjs'; import { SortDirection } from './sort-direction'; /** Interface for a directive that holds sorting state consumed by `MatSortHeader`. */ export interface NwbSortable { /** The id of the column being sorted. */ id: string; /** Starting sort direction. */ start: 'asc' | 'desc'; } /** The current sort state. */ export interface Sort { /** The id of the column being sorted. */ active: string; /** The sort direction. */ direction: SortDirection; } export declare class NwbSort implements OnChanges, OnDestroy { /** Collection of all registered sortables that this directive manages. */ sortables: Map; /** Used to notify any child components listening to state changes. */ readonly _stateChanges: Subject; /** The id of the most recently sorted NwbSortable. */ active: string; /** * The direction to set when an NwbSortable is initially sorted. * May be overriden by the NwbSortable's sort start. */ start: 'asc' | 'desc'; /** The sort direction of the currently active NwbSortable. */ direction: SortDirection; private _direction; /** Event emitted when the user changes either the active sort or sort direction. */ readonly sortChange: EventEmitter; /** * Register function to be used by the contained NwbSortables. Adds the NwbSortable to the * collection of NwbSortables. */ register(sortable: NwbSortable): void; /** * Unregister function to be used by the contained NwbSortables. Removes the NwbSortable from the * collection of contained NwbSortables. */ deregister(sortable: NwbSortable): void; /** Sets the active sort id and determines the new sort direction. */ sort(sortable: NwbSortable): void; /** Returns the next sort direction of the active sortable, checking for potential overrides. */ getNextSortDirection(sortable: NwbSortable): SortDirection; ngOnChanges(): void; ngOnDestroy(): void; }