[6a3a178] | 1 | /**
|
---|
| 2 | * @license
|
---|
| 3 | * Copyright Google LLC All Rights Reserved.
|
---|
| 4 | *
|
---|
| 5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
| 6 | * found in the LICENSE file at https://angular.io/license
|
---|
| 7 | */
|
---|
| 8 | import { BooleanInput } from '@angular/cdk/coercion';
|
---|
| 9 | import { EventEmitter, InjectionToken, OnChanges, OnDestroy, OnInit } from '@angular/core';
|
---|
| 10 | import { CanDisable, HasInitialized } from '@angular/material/core';
|
---|
| 11 | import { Subject } from 'rxjs';
|
---|
| 12 | import { SortDirection } from './sort-direction';
|
---|
| 13 | /** Interface for a directive that holds sorting state consumed by `MatSortHeader`. */
|
---|
| 14 | export interface MatSortable {
|
---|
| 15 | /** The id of the column being sorted. */
|
---|
| 16 | id: string;
|
---|
| 17 | /** Starting sort direction. */
|
---|
| 18 | start: 'asc' | 'desc';
|
---|
| 19 | /** Whether to disable clearing the sorting state. */
|
---|
| 20 | disableClear: boolean;
|
---|
| 21 | }
|
---|
| 22 | /** The current sort state. */
|
---|
| 23 | export interface Sort {
|
---|
| 24 | /** The id of the column being sorted. */
|
---|
| 25 | active: string;
|
---|
| 26 | /** The sort direction. */
|
---|
| 27 | direction: SortDirection;
|
---|
| 28 | }
|
---|
| 29 | /** Default options for `mat-sort`. */
|
---|
| 30 | export interface MatSortDefaultOptions {
|
---|
| 31 | /** Whether to disable clearing the sorting state. */
|
---|
| 32 | disableClear?: boolean;
|
---|
| 33 | }
|
---|
| 34 | /** Injection token to be used to override the default options for `mat-sort`. */
|
---|
| 35 | export declare const MAT_SORT_DEFAULT_OPTIONS: InjectionToken<MatSortDefaultOptions>;
|
---|
| 36 | /** @docs-private */
|
---|
| 37 | declare const _MatSortBase: import("@angular/material/core").HasInitializedCtor & import("@angular/material/core/common-behaviors/constructor").Constructor<CanDisable> & import("@angular/material/core/common-behaviors/constructor").AbstractConstructor<CanDisable> & {
|
---|
| 38 | new (): {};
|
---|
| 39 | };
|
---|
| 40 | /** Container for MatSortables to manage the sort state and provide default sort parameters. */
|
---|
| 41 | export declare class MatSort extends _MatSortBase implements CanDisable, HasInitialized, OnChanges, OnDestroy, OnInit {
|
---|
| 42 | private _defaultOptions?;
|
---|
| 43 | /** Collection of all registered sortables that this directive manages. */
|
---|
| 44 | sortables: Map<string, MatSortable>;
|
---|
| 45 | /** Used to notify any child components listening to state changes. */
|
---|
| 46 | readonly _stateChanges: Subject<void>;
|
---|
| 47 | /** The id of the most recently sorted MatSortable. */
|
---|
| 48 | active: string;
|
---|
| 49 | /**
|
---|
| 50 | * The direction to set when an MatSortable is initially sorted.
|
---|
| 51 | * May be overriden by the MatSortable's sort start.
|
---|
| 52 | */
|
---|
| 53 | start: 'asc' | 'desc';
|
---|
| 54 | /** The sort direction of the currently active MatSortable. */
|
---|
| 55 | get direction(): SortDirection;
|
---|
| 56 | set direction(direction: SortDirection);
|
---|
| 57 | private _direction;
|
---|
| 58 | /**
|
---|
| 59 | * Whether to disable the user from clearing the sort by finishing the sort direction cycle.
|
---|
| 60 | * May be overriden by the MatSortable's disable clear input.
|
---|
| 61 | */
|
---|
| 62 | get disableClear(): boolean;
|
---|
| 63 | set disableClear(v: boolean);
|
---|
| 64 | private _disableClear;
|
---|
| 65 | /** Event emitted when the user changes either the active sort or sort direction. */
|
---|
| 66 | readonly sortChange: EventEmitter<Sort>;
|
---|
| 67 | constructor(_defaultOptions?: MatSortDefaultOptions | undefined);
|
---|
| 68 | /**
|
---|
| 69 | * Register function to be used by the contained MatSortables. Adds the MatSortable to the
|
---|
| 70 | * collection of MatSortables.
|
---|
| 71 | */
|
---|
| 72 | register(sortable: MatSortable): void;
|
---|
| 73 | /**
|
---|
| 74 | * Unregister function to be used by the contained MatSortables. Removes the MatSortable from the
|
---|
| 75 | * collection of contained MatSortables.
|
---|
| 76 | */
|
---|
| 77 | deregister(sortable: MatSortable): void;
|
---|
| 78 | /** Sets the active sort id and determines the new sort direction. */
|
---|
| 79 | sort(sortable: MatSortable): void;
|
---|
| 80 | /** Returns the next sort direction of the active sortable, checking for potential overrides. */
|
---|
| 81 | getNextSortDirection(sortable: MatSortable): SortDirection;
|
---|
| 82 | ngOnInit(): void;
|
---|
| 83 | ngOnChanges(): void;
|
---|
| 84 | ngOnDestroy(): void;
|
---|
| 85 | static ngAcceptInputType_disableClear: BooleanInput;
|
---|
| 86 | static ngAcceptInputType_disabled: BooleanInput;
|
---|
| 87 | }
|
---|
| 88 | export {};
|
---|