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 { AriaDescriber, FocusMonitor } from '@angular/cdk/a11y';
|
---|
9 | import { BooleanInput } from '@angular/cdk/coercion';
|
---|
10 | import { AfterViewInit, ChangeDetectorRef, ElementRef, OnDestroy, OnInit } from '@angular/core';
|
---|
11 | import { CanDisable } from '@angular/material/core';
|
---|
12 | import { MatSort, MatSortable } from './sort';
|
---|
13 | import { SortDirection } from './sort-direction';
|
---|
14 | import { MatSortHeaderIntl } from './sort-header-intl';
|
---|
15 | /** @docs-private */
|
---|
16 | declare const _MatSortHeaderBase: import("@angular/material/core/common-behaviors/constructor").Constructor<CanDisable> & import("@angular/material/core/common-behaviors/constructor").AbstractConstructor<CanDisable> & {
|
---|
17 | new (): {};
|
---|
18 | };
|
---|
19 | /**
|
---|
20 | * Valid positions for the arrow to be in for its opacity and translation. If the state is a
|
---|
21 | * sort direction, the position of the arrow will be above/below and opacity 0. If the state is
|
---|
22 | * hint, the arrow will be in the center with a slight opacity. Active state means the arrow will
|
---|
23 | * be fully opaque in the center.
|
---|
24 | *
|
---|
25 | * @docs-private
|
---|
26 | */
|
---|
27 | export declare type ArrowViewState = SortDirection | 'hint' | 'active';
|
---|
28 | /**
|
---|
29 | * States describing the arrow's animated position (animating fromState to toState).
|
---|
30 | * If the fromState is not defined, there will be no animated transition to the toState.
|
---|
31 | * @docs-private
|
---|
32 | */
|
---|
33 | export interface ArrowViewStateTransition {
|
---|
34 | fromState?: ArrowViewState;
|
---|
35 | toState?: ArrowViewState;
|
---|
36 | }
|
---|
37 | /** Column definition associated with a `MatSortHeader`. */
|
---|
38 | interface MatSortHeaderColumnDef {
|
---|
39 | name: string;
|
---|
40 | }
|
---|
41 | /**
|
---|
42 | * Applies sorting behavior (click to change sort) and styles to an element, including an
|
---|
43 | * arrow to display the current sort direction.
|
---|
44 | *
|
---|
45 | * Must be provided with an id and contained within a parent MatSort directive.
|
---|
46 | *
|
---|
47 | * If used on header cells in a CdkTable, it will automatically default its id from its containing
|
---|
48 | * column definition.
|
---|
49 | */
|
---|
50 | export declare class MatSortHeader extends _MatSortHeaderBase implements CanDisable, MatSortable, OnDestroy, OnInit, AfterViewInit {
|
---|
51 | /**
|
---|
52 | * @deprecated `_intl` parameter isn't being used anymore and it'll be removed.
|
---|
53 | * @breaking-change 13.0.0
|
---|
54 | */
|
---|
55 | _intl: MatSortHeaderIntl;
|
---|
56 | private _changeDetectorRef;
|
---|
57 | _sort: MatSort;
|
---|
58 | _columnDef: MatSortHeaderColumnDef;
|
---|
59 | private _focusMonitor;
|
---|
60 | private _elementRef;
|
---|
61 | /** @breaking-change 14.0.0 _ariaDescriber will be required. */
|
---|
62 | private _ariaDescriber?;
|
---|
63 | private _rerenderSubscription;
|
---|
64 | /**
|
---|
65 | * The element with role="button" inside this component's view. We need this
|
---|
66 | * in order to apply a description with AriaDescriber.
|
---|
67 | */
|
---|
68 | private _sortButton;
|
---|
69 | /**
|
---|
70 | * Flag set to true when the indicator should be displayed while the sort is not active. Used to
|
---|
71 | * provide an affordance that the header is sortable by showing on focus and hover.
|
---|
72 | */
|
---|
73 | _showIndicatorHint: boolean;
|
---|
74 | /**
|
---|
75 | * The view transition state of the arrow (translation/ opacity) - indicates its `from` and `to`
|
---|
76 | * position through the animation. If animations are currently disabled, the fromState is removed
|
---|
77 | * so that there is no animation displayed.
|
---|
78 | */
|
---|
79 | _viewState: ArrowViewStateTransition;
|
---|
80 | /** The direction the arrow should be facing according to the current state. */
|
---|
81 | _arrowDirection: SortDirection;
|
---|
82 | /**
|
---|
83 | * Whether the view state animation should show the transition between the `from` and `to` states.
|
---|
84 | */
|
---|
85 | _disableViewStateAnimation: boolean;
|
---|
86 | /**
|
---|
87 | * ID of this sort header. If used within the context of a CdkColumnDef, this will default to
|
---|
88 | * the column's name.
|
---|
89 | */
|
---|
90 | id: string;
|
---|
91 | /** Sets the position of the arrow that displays when sorted. */
|
---|
92 | arrowPosition: 'before' | 'after';
|
---|
93 | /** Overrides the sort start value of the containing MatSort for this MatSortable. */
|
---|
94 | start: 'asc' | 'desc';
|
---|
95 | /**
|
---|
96 | * Description applied to MatSortHeader's button element with aria-describedby. This text should
|
---|
97 | * describe the action that will occur when the user clicks the sort header.
|
---|
98 | */
|
---|
99 | get sortActionDescription(): string;
|
---|
100 | set sortActionDescription(value: string);
|
---|
101 | private _sortActionDescription;
|
---|
102 | /** Overrides the disable clear value of the containing MatSort for this MatSortable. */
|
---|
103 | get disableClear(): boolean;
|
---|
104 | set disableClear(v: boolean);
|
---|
105 | private _disableClear;
|
---|
106 | constructor(
|
---|
107 | /**
|
---|
108 | * @deprecated `_intl` parameter isn't being used anymore and it'll be removed.
|
---|
109 | * @breaking-change 13.0.0
|
---|
110 | */
|
---|
111 | _intl: MatSortHeaderIntl, _changeDetectorRef: ChangeDetectorRef, _sort: MatSort, _columnDef: MatSortHeaderColumnDef, _focusMonitor: FocusMonitor, _elementRef: ElementRef<HTMLElement>,
|
---|
112 | /** @breaking-change 14.0.0 _ariaDescriber will be required. */
|
---|
113 | _ariaDescriber?: AriaDescriber | null | undefined);
|
---|
114 | ngOnInit(): void;
|
---|
115 | ngAfterViewInit(): void;
|
---|
116 | ngOnDestroy(): void;
|
---|
117 | /**
|
---|
118 | * Sets the "hint" state such that the arrow will be semi-transparently displayed as a hint to the
|
---|
119 | * user showing what the active sort will become. If set to false, the arrow will fade away.
|
---|
120 | */
|
---|
121 | _setIndicatorHintVisible(visible: boolean): void;
|
---|
122 | /**
|
---|
123 | * Sets the animation transition view state for the arrow's position and opacity. If the
|
---|
124 | * `disableViewStateAnimation` flag is set to true, the `fromState` will be ignored so that
|
---|
125 | * no animation appears.
|
---|
126 | */
|
---|
127 | _setAnimationTransitionState(viewState: ArrowViewStateTransition): void;
|
---|
128 | /** Triggers the sort on this sort header and removes the indicator hint. */
|
---|
129 | _toggleOnInteraction(): void;
|
---|
130 | _handleClick(): void;
|
---|
131 | _handleKeydown(event: KeyboardEvent): void;
|
---|
132 | /** Whether this MatSortHeader is currently sorted in either ascending or descending order. */
|
---|
133 | _isSorted(): boolean;
|
---|
134 | /** Returns the animation state for the arrow direction (indicator and pointers). */
|
---|
135 | _getArrowDirectionState(): string;
|
---|
136 | /** Returns the arrow position state (opacity, translation). */
|
---|
137 | _getArrowViewState(): string;
|
---|
138 | /**
|
---|
139 | * Updates the direction the arrow should be pointing. If it is not sorted, the arrow should be
|
---|
140 | * facing the start direction. Otherwise if it is sorted, the arrow should point in the currently
|
---|
141 | * active sorted direction. The reason this is updated through a function is because the direction
|
---|
142 | * should only be changed at specific times - when deactivated but the hint is displayed and when
|
---|
143 | * the sort is active and the direction changes. Otherwise the arrow's direction should linger
|
---|
144 | * in cases such as the sort becoming deactivated but we want to animate the arrow away while
|
---|
145 | * preserving its direction, even though the next sort direction is actually different and should
|
---|
146 | * only be changed once the arrow displays again (hint or activation).
|
---|
147 | */
|
---|
148 | _updateArrowDirection(): void;
|
---|
149 | _isDisabled(): boolean;
|
---|
150 | /**
|
---|
151 | * Gets the aria-sort attribute that should be applied to this sort header. If this header
|
---|
152 | * is not sorted, returns null so that the attribute is removed from the host element. Aria spec
|
---|
153 | * says that the aria-sort property should only be present on one header at a time, so removing
|
---|
154 | * ensures this is true.
|
---|
155 | */
|
---|
156 | _getAriaSortAttribute(): "none" | "ascending" | "descending";
|
---|
157 | /** Whether the arrow inside the sort header should be rendered. */
|
---|
158 | _renderArrow(): boolean;
|
---|
159 | private _updateSortActionDescription;
|
---|
160 | /** Handles changes in the sorting state. */
|
---|
161 | private _handleStateChanges;
|
---|
162 | static ngAcceptInputType_disableClear: BooleanInput;
|
---|
163 | static ngAcceptInputType_disabled: BooleanInput;
|
---|
164 | }
|
---|
165 | export {};
|
---|