/** * @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 */ import { EventEmitter, OnChanges, OnDestroy, OnInit } from '@angular/core'; import { SortDirection } from './sort-direction'; import { Subject } from 'rxjs'; import { Initializable } from '../shared/initializable'; /** Interface for a directive that holds sorting state consumed by `HcSortHeaderComponent`. */ export interface HcSortable { /** 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 Sort { /** The id of the column being sorted. */ active: string; /** The sort direction. */ direction: SortDirection; } /** Container for HcSortables to manage the sort state and provide default sort parameters. */ export declare class HcSort extends Initializable implements OnChanges, OnDestroy, OnInit { /** 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 HcSortable. */ active: string; /** * The direction to set when an HcSortable is initially sorted. * May be overriden by the HcSortable's sort start. */ start: 'asc' | 'desc'; /** The sort direction of the currently active HcSortable. */ direction: SortDirection; private _direction; /** * Whether to disable the user from clearing the sort by finishing the sort direction cycle. * May be overriden by the HcSortable's disable clear input. */ disableClear: boolean; private _disableClear; disabled: any; private _disabled; /** Event emitted when the user changes either the active sort or sort direction. */ readonly sortChange: EventEmitter; /** * Register function to be used by the contained HcSortables. Adds the HcSortable to the * collection of HcSortables. */ register(sortable: HcSortable): void; /** * Unregister function to be used by the contained HcSortables. Removes the HcSortable from the * collection of contained HcSortables. */ deregister(sortable: HcSortable): void; /** Sets the active sort id and determines the new sort direction. */ sort(sortable: HcSortable): void; /** Returns the next sort direction of the active sortable, checking for potential overrides. */ getNextSortDirection(sortable: HcSortable): SortDirection; ngOnInit(): void; ngOnChanges(): void; ngOnDestroy(): void; }