import { BooleanInput } from '@angular/cdk/coercion'; import { EventEmitter, OnChanges, OnDestroy, OnInit } from '@angular/core'; import { HasInitialized, HasInitializedCtor } from '@sbb-esta/angular-core/common-behaviors'; import { Subject } from 'rxjs'; import { SbbSortDirection } from './sort-direction'; /** Interface for a directive that holds sorting state consumed by `SbbSortHeader`. */ export interface SbbSortable { /** 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 SbbSort { /** The id of the column being sorted. */ active: string; /** The sort direction. */ direction: SbbSortDirection; } /** @docs-private */ export declare class SbbSortDirectiveBase { } /** @docs-private */ export declare const SbbSortDirectiveMixinBase: HasInitializedCtor & typeof SbbSortDirectiveBase; /** Container for SbbSortables to manage the sort state and provide default sort parameters. */ export declare class SbbSortDirective extends SbbSortDirectiveMixinBase implements OnInit, OnChanges, OnDestroy, HasInitialized { /** The sort direction of the currently active SbbSortable. */ get direction(): SbbSortDirection; set direction(direction: SbbSortDirection); /** * Whether to disable the user from clearing the sort by finishing the sort direction cycle. * May be overriden by the SbbSortable's disable clear input. */ get disableClear(): boolean; set disableClear(v: boolean); /** 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 SbbSortable. */ active: string; /** * The direction to set when an SbbSortable is initially sorted. * May be overriden by the SbbSortable's sort start. */ start: 'asc' | 'desc'; private _direction; private _disableClear; /** Event emitted when the user changes either the active sort or sort direction. */ readonly sbbSortChange: EventEmitter; readonly sortChange: EventEmitter; /** * Register function to be used by the contained SbbSortables. Adds the SbbSortable to the * collection of SbbSortables. */ register(sortable: SbbSortable): void; /** * Unregister function to be used by the contained SbbSortables. Removes the SbbSortable from the * collection of contained SbbSortables. */ deregister(sortable: SbbSortable): void; /** Sets the active sort id and determines the new sort direction. */ sort(sortable: SbbSortable): void; /** Returns the next sort direction of the active sortable, checking for potential overrides. */ getNextSortDirection(sortable: SbbSortable): SbbSortDirection; ngOnInit(): void; ngOnChanges(): void; ngOnDestroy(): void; static ngAcceptInputType_disableClear: BooleanInput; }