@angular/material 19.1.0-next.0 → 19.1.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/button-toggle.mjs +28 -17
- package/fesm2022/button-toggle.mjs.map +1 -1
- package/fesm2022/core.mjs +3 -3
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/sort.mjs +86 -198
- package/fesm2022/sort.mjs.map +1 -1
- package/fesm2022/tabs.mjs +1 -0
- package/fesm2022/tabs.mjs.map +1 -1
- package/package.json +2 -2
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-add/index.mjs +1 -1
- package/schematics/ng-update/index_bundled.js +19 -10
- package/schematics/ng-update/index_bundled.js.map +2 -2
- package/sort/index.d.ts +15 -48
package/fesm2022/sort.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, EventEmitter, booleanAttribute, Directive, Optional, Inject, Input, Output, Injectable, SkipSelf, inject, ChangeDetectorRef, ElementRef, Component, ViewEncapsulation, ChangeDetectionStrategy, NgModule } from '@angular/core';
|
|
2
|
+
import { InjectionToken, EventEmitter, booleanAttribute, Directive, Optional, Inject, Input, Output, Injectable, SkipSelf, inject, ChangeDetectorRef, ElementRef, ANIMATION_MODULE_TYPE, signal, Component, ViewEncapsulation, ChangeDetectionStrategy, NgModule } from '@angular/core';
|
|
3
3
|
import { FocusMonitor, AriaDescriber } from '@angular/cdk/a11y';
|
|
4
4
|
import { SPACE, ENTER } from '@angular/cdk/keycodes';
|
|
5
5
|
import { ReplaySubject, Subject, merge } from 'rxjs';
|
|
6
|
-
import { trigger, state, style, transition, animate, keyframes, query, animateChild } from '@angular/animations';
|
|
7
|
-
import { AnimationDurations, AnimationCurves, _StructuralStylesLoader, MatCommonModule } from '@angular/material/core';
|
|
8
6
|
import { _CdkPrivateStyleLoader } from '@angular/cdk/private';
|
|
7
|
+
import { _StructuralStylesLoader, MatCommonModule, AnimationDurations, AnimationCurves } from '@angular/material/core';
|
|
8
|
+
import { trigger, state, style, transition, animate, keyframes, query, animateChild } from '@angular/animations';
|
|
9
9
|
|
|
10
10
|
/** @docs-private */
|
|
11
11
|
function getSortDuplicateSortableIdError(id) {
|
|
@@ -175,66 +175,6 @@ function getSortDirectionCycle(start, disableClear) {
|
|
|
175
175
|
return sortOrder;
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
-
const SORT_ANIMATION_TRANSITION = AnimationDurations.ENTERING + ' ' + AnimationCurves.STANDARD_CURVE;
|
|
179
|
-
/**
|
|
180
|
-
* Animations used by MatSort.
|
|
181
|
-
* @docs-private
|
|
182
|
-
*/
|
|
183
|
-
const matSortAnimations = {
|
|
184
|
-
/** Animation that moves the sort indicator. */
|
|
185
|
-
indicator: trigger('indicator', [
|
|
186
|
-
state('active-asc, asc', style({ transform: 'translateY(0px)' })),
|
|
187
|
-
// 10px is the height of the sort indicator, minus the width of the pointers
|
|
188
|
-
state('active-desc, desc', style({ transform: 'translateY(10px)' })),
|
|
189
|
-
transition('active-asc <=> active-desc', animate(SORT_ANIMATION_TRANSITION)),
|
|
190
|
-
]),
|
|
191
|
-
/** Animation that rotates the left pointer of the indicator based on the sorting direction. */
|
|
192
|
-
leftPointer: trigger('leftPointer', [
|
|
193
|
-
state('active-asc, asc', style({ transform: 'rotate(-45deg)' })),
|
|
194
|
-
state('active-desc, desc', style({ transform: 'rotate(45deg)' })),
|
|
195
|
-
transition('active-asc <=> active-desc', animate(SORT_ANIMATION_TRANSITION)),
|
|
196
|
-
]),
|
|
197
|
-
/** Animation that rotates the right pointer of the indicator based on the sorting direction. */
|
|
198
|
-
rightPointer: trigger('rightPointer', [
|
|
199
|
-
state('active-asc, asc', style({ transform: 'rotate(45deg)' })),
|
|
200
|
-
state('active-desc, desc', style({ transform: 'rotate(-45deg)' })),
|
|
201
|
-
transition('active-asc <=> active-desc', animate(SORT_ANIMATION_TRANSITION)),
|
|
202
|
-
]),
|
|
203
|
-
/** Animation that controls the arrow opacity. */
|
|
204
|
-
arrowOpacity: trigger('arrowOpacity', [
|
|
205
|
-
state('desc-to-active, asc-to-active, active', style({ opacity: 1 })),
|
|
206
|
-
state('desc-to-hint, asc-to-hint, hint', style({ opacity: 0.54 })),
|
|
207
|
-
state('hint-to-desc, active-to-desc, desc, hint-to-asc, active-to-asc, asc, void', style({ opacity: 0 })),
|
|
208
|
-
// Transition between all states except for immediate transitions
|
|
209
|
-
transition('* => asc, * => desc, * => active, * => hint, * => void', animate('0ms')),
|
|
210
|
-
transition('* <=> *', animate(SORT_ANIMATION_TRANSITION)),
|
|
211
|
-
]),
|
|
212
|
-
/**
|
|
213
|
-
* Animation for the translation of the arrow as a whole. States are separated into two
|
|
214
|
-
* groups: ones with animations and others that are immediate. Immediate states are asc, desc,
|
|
215
|
-
* peek, and active. The other states define a specific animation (source-to-destination)
|
|
216
|
-
* and are determined as a function of their prev user-perceived state and what the next state
|
|
217
|
-
* should be.
|
|
218
|
-
*/
|
|
219
|
-
arrowPosition: trigger('arrowPosition', [
|
|
220
|
-
// Hidden Above => Hint Center
|
|
221
|
-
transition('* => desc-to-hint, * => desc-to-active', animate(SORT_ANIMATION_TRANSITION, keyframes([style({ transform: 'translateY(-25%)' }), style({ transform: 'translateY(0)' })]))),
|
|
222
|
-
// Hint Center => Hidden Below
|
|
223
|
-
transition('* => hint-to-desc, * => active-to-desc', animate(SORT_ANIMATION_TRANSITION, keyframes([style({ transform: 'translateY(0)' }), style({ transform: 'translateY(25%)' })]))),
|
|
224
|
-
// Hidden Below => Hint Center
|
|
225
|
-
transition('* => asc-to-hint, * => asc-to-active', animate(SORT_ANIMATION_TRANSITION, keyframes([style({ transform: 'translateY(25%)' }), style({ transform: 'translateY(0)' })]))),
|
|
226
|
-
// Hint Center => Hidden Above
|
|
227
|
-
transition('* => hint-to-asc, * => active-to-asc', animate(SORT_ANIMATION_TRANSITION, keyframes([style({ transform: 'translateY(0)' }), style({ transform: 'translateY(-25%)' })]))),
|
|
228
|
-
state('desc-to-hint, asc-to-hint, hint, desc-to-active, asc-to-active, active', style({ transform: 'translateY(0)' })),
|
|
229
|
-
state('hint-to-desc, active-to-desc, desc', style({ transform: 'translateY(-25%)' })),
|
|
230
|
-
state('hint-to-asc, active-to-asc, asc', style({ transform: 'translateY(25%)' })),
|
|
231
|
-
]),
|
|
232
|
-
/** Necessary trigger that calls animate on children animations. */
|
|
233
|
-
allowChildren: trigger('allowChildren', [
|
|
234
|
-
transition('* <=> *', [query('@*', animateChild(), { optional: true })]),
|
|
235
|
-
]),
|
|
236
|
-
};
|
|
237
|
-
|
|
238
178
|
/**
|
|
239
179
|
* To modify the labels and text displayed, create a new instance of MatSortHeaderIntl and
|
|
240
180
|
* include it in a custom provider.
|
|
@@ -275,37 +215,26 @@ const MAT_SORT_HEADER_INTL_PROVIDER = {
|
|
|
275
215
|
*/
|
|
276
216
|
class MatSortHeader {
|
|
277
217
|
_intl = inject(MatSortHeaderIntl);
|
|
278
|
-
_changeDetectorRef = inject(ChangeDetectorRef);
|
|
279
218
|
_sort = inject(MatSort, { optional: true });
|
|
280
219
|
_columnDef = inject('MAT_SORT_HEADER_COLUMN_DEF', {
|
|
281
220
|
optional: true,
|
|
282
221
|
});
|
|
222
|
+
_changeDetectorRef = inject(ChangeDetectorRef);
|
|
283
223
|
_focusMonitor = inject(FocusMonitor);
|
|
284
224
|
_elementRef = inject(ElementRef);
|
|
285
225
|
_ariaDescriber = inject(AriaDescriber, { optional: true });
|
|
286
|
-
|
|
226
|
+
_renderChanges;
|
|
227
|
+
_animationModule = inject(ANIMATION_MODULE_TYPE, { optional: true });
|
|
228
|
+
/**
|
|
229
|
+
* Indicates which state was just cleared from the sort header.
|
|
230
|
+
* Will be reset on the next interaction. Used for coordinating animations.
|
|
231
|
+
*/
|
|
232
|
+
_recentlyCleared = signal(null);
|
|
287
233
|
/**
|
|
288
234
|
* The element with role="button" inside this component's view. We need this
|
|
289
235
|
* in order to apply a description with AriaDescriber.
|
|
290
236
|
*/
|
|
291
237
|
_sortButton;
|
|
292
|
-
/**
|
|
293
|
-
* Flag set to true when the indicator should be displayed while the sort is not active. Used to
|
|
294
|
-
* provide an affordance that the header is sortable by showing on focus and hover.
|
|
295
|
-
*/
|
|
296
|
-
_showIndicatorHint = false;
|
|
297
|
-
/**
|
|
298
|
-
* The view transition state of the arrow (translation/ opacity) - indicates its `from` and `to`
|
|
299
|
-
* position through the animation. If animations are currently disabled, the fromState is removed
|
|
300
|
-
* so that there is no animation displayed.
|
|
301
|
-
*/
|
|
302
|
-
_viewState = {};
|
|
303
|
-
/** The direction the arrow should be facing according to the current state. */
|
|
304
|
-
_arrowDirection = '';
|
|
305
|
-
/**
|
|
306
|
-
* Whether the view state animation should show the transition between the `from` and `to` states.
|
|
307
|
-
*/
|
|
308
|
-
_disableViewStateAnimation = false;
|
|
309
238
|
/**
|
|
310
239
|
* ID of this sort header. If used within the context of a CdkColumnDef, this will default to
|
|
311
240
|
* the column's name.
|
|
@@ -348,88 +277,42 @@ class MatSortHeader {
|
|
|
348
277
|
if (defaultOptions?.arrowPosition) {
|
|
349
278
|
this.arrowPosition = defaultOptions?.arrowPosition;
|
|
350
279
|
}
|
|
351
|
-
this._handleStateChanges();
|
|
352
280
|
}
|
|
353
281
|
ngOnInit() {
|
|
354
282
|
if (!this.id && this._columnDef) {
|
|
355
283
|
this.id = this._columnDef.name;
|
|
356
284
|
}
|
|
357
|
-
// Initialize the direction of the arrow and set the view state to be immediately that state.
|
|
358
|
-
this._updateArrowDirection();
|
|
359
|
-
this._setAnimationTransitionState({
|
|
360
|
-
toState: this._isSorted() ? 'active' : this._arrowDirection,
|
|
361
|
-
});
|
|
362
285
|
this._sort.register(this);
|
|
286
|
+
this._renderChanges = merge(this._sort._stateChanges, this._sort.sortChange).subscribe(() => this._changeDetectorRef.markForCheck());
|
|
363
287
|
this._sortButton = this._elementRef.nativeElement.querySelector('.mat-sort-header-container');
|
|
364
288
|
this._updateSortActionDescription(this._sortActionDescription);
|
|
365
289
|
}
|
|
366
290
|
ngAfterViewInit() {
|
|
367
291
|
// We use the focus monitor because we also want to style
|
|
368
292
|
// things differently based on the focus origin.
|
|
369
|
-
this._focusMonitor
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
this._setIndicatorHintVisible(newState);
|
|
373
|
-
this._changeDetectorRef.markForCheck();
|
|
374
|
-
}
|
|
375
|
-
});
|
|
293
|
+
this._focusMonitor
|
|
294
|
+
.monitor(this._elementRef, true)
|
|
295
|
+
.subscribe(() => this._recentlyCleared.set(null));
|
|
376
296
|
}
|
|
377
297
|
ngOnDestroy() {
|
|
378
298
|
this._focusMonitor.stopMonitoring(this._elementRef);
|
|
379
299
|
this._sort.deregister(this);
|
|
380
|
-
this.
|
|
300
|
+
this._renderChanges?.unsubscribe();
|
|
381
301
|
if (this._sortButton) {
|
|
382
302
|
this._ariaDescriber?.removeDescription(this._sortButton, this._sortActionDescription);
|
|
383
303
|
}
|
|
384
304
|
}
|
|
385
|
-
/**
|
|
386
|
-
* Sets the "hint" state such that the arrow will be semi-transparently displayed as a hint to the
|
|
387
|
-
* user showing what the active sort will become. If set to false, the arrow will fade away.
|
|
388
|
-
*/
|
|
389
|
-
_setIndicatorHintVisible(visible) {
|
|
390
|
-
// No-op if the sort header is disabled - should not make the hint visible.
|
|
391
|
-
if (this._isDisabled() && visible) {
|
|
392
|
-
return;
|
|
393
|
-
}
|
|
394
|
-
this._showIndicatorHint = visible;
|
|
395
|
-
if (!this._isSorted()) {
|
|
396
|
-
this._updateArrowDirection();
|
|
397
|
-
if (this._showIndicatorHint) {
|
|
398
|
-
this._setAnimationTransitionState({ fromState: this._arrowDirection, toState: 'hint' });
|
|
399
|
-
}
|
|
400
|
-
else {
|
|
401
|
-
this._setAnimationTransitionState({ fromState: 'hint', toState: this._arrowDirection });
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
/**
|
|
406
|
-
* Sets the animation transition view state for the arrow's position and opacity. If the
|
|
407
|
-
* `disableViewStateAnimation` flag is set to true, the `fromState` will be ignored so that
|
|
408
|
-
* no animation appears.
|
|
409
|
-
*/
|
|
410
|
-
_setAnimationTransitionState(viewState) {
|
|
411
|
-
this._viewState = viewState || {};
|
|
412
|
-
// If the animation for arrow position state (opacity/translation) should be disabled,
|
|
413
|
-
// remove the fromState so that it jumps right to the toState.
|
|
414
|
-
if (this._disableViewStateAnimation) {
|
|
415
|
-
this._viewState = { toState: viewState.toState };
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
305
|
/** Triggers the sort on this sort header and removes the indicator hint. */
|
|
419
306
|
_toggleOnInteraction() {
|
|
420
|
-
this._sort.sort(this);
|
|
421
|
-
// Do not show the animation if the header was already shown in the right position.
|
|
422
|
-
if (this._viewState.toState === 'hint' || this._viewState.toState === 'active') {
|
|
423
|
-
this._disableViewStateAnimation = true;
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
_handleClick() {
|
|
427
307
|
if (!this._isDisabled()) {
|
|
308
|
+
const wasSorted = this._isSorted();
|
|
309
|
+
const prevDirection = this._sort.direction;
|
|
428
310
|
this._sort.sort(this);
|
|
311
|
+
this._recentlyCleared.set(wasSorted && !this._isSorted() ? prevDirection : null);
|
|
429
312
|
}
|
|
430
313
|
}
|
|
431
314
|
_handleKeydown(event) {
|
|
432
|
-
if (
|
|
315
|
+
if (event.keyCode === SPACE || event.keyCode === ENTER) {
|
|
433
316
|
event.preventDefault();
|
|
434
317
|
this._toggleOnInteraction();
|
|
435
318
|
}
|
|
@@ -439,28 +322,6 @@ class MatSortHeader {
|
|
|
439
322
|
return (this._sort.active == this.id &&
|
|
440
323
|
(this._sort.direction === 'asc' || this._sort.direction === 'desc'));
|
|
441
324
|
}
|
|
442
|
-
/** Returns the animation state for the arrow direction (indicator and pointers). */
|
|
443
|
-
_getArrowDirectionState() {
|
|
444
|
-
return `${this._isSorted() ? 'active-' : ''}${this._arrowDirection}`;
|
|
445
|
-
}
|
|
446
|
-
/** Returns the arrow position state (opacity, translation). */
|
|
447
|
-
_getArrowViewState() {
|
|
448
|
-
const fromState = this._viewState.fromState;
|
|
449
|
-
return (fromState ? `${fromState}-to-` : '') + this._viewState.toState;
|
|
450
|
-
}
|
|
451
|
-
/**
|
|
452
|
-
* Updates the direction the arrow should be pointing. If it is not sorted, the arrow should be
|
|
453
|
-
* facing the start direction. Otherwise if it is sorted, the arrow should point in the currently
|
|
454
|
-
* active sorted direction. The reason this is updated through a function is because the direction
|
|
455
|
-
* should only be changed at specific times - when deactivated but the hint is displayed and when
|
|
456
|
-
* the sort is active and the direction changes. Otherwise the arrow's direction should linger
|
|
457
|
-
* in cases such as the sort becoming deactivated but we want to animate the arrow away while
|
|
458
|
-
* preserving its direction, even though the next sort direction is actually different and should
|
|
459
|
-
* only be changed once the arrow displays again (hint or activation).
|
|
460
|
-
*/
|
|
461
|
-
_updateArrowDirection() {
|
|
462
|
-
this._arrowDirection = this._isSorted() ? this._sort.direction : this.start || this._sort.start;
|
|
463
|
-
}
|
|
464
325
|
_isDisabled() {
|
|
465
326
|
return this._sort.disabled || this.disabled;
|
|
466
327
|
}
|
|
@@ -494,54 +355,19 @@ class MatSortHeader {
|
|
|
494
355
|
}
|
|
495
356
|
this._sortActionDescription = newDescription;
|
|
496
357
|
}
|
|
497
|
-
/** Handles changes in the sorting state. */
|
|
498
|
-
_handleStateChanges() {
|
|
499
|
-
this._rerenderSubscription = merge(this._sort.sortChange, this._sort._stateChanges, this._intl.changes).subscribe(() => {
|
|
500
|
-
if (this._isSorted()) {
|
|
501
|
-
this._updateArrowDirection();
|
|
502
|
-
// Do not show the animation if the header was already shown in the right position.
|
|
503
|
-
if (this._viewState.toState === 'hint' || this._viewState.toState === 'active') {
|
|
504
|
-
this._disableViewStateAnimation = true;
|
|
505
|
-
}
|
|
506
|
-
this._setAnimationTransitionState({ fromState: this._arrowDirection, toState: 'active' });
|
|
507
|
-
this._showIndicatorHint = false;
|
|
508
|
-
}
|
|
509
|
-
// If this header was recently active and now no longer sorted, animate away the arrow.
|
|
510
|
-
if (!this._isSorted() && this._viewState && this._viewState.toState === 'active') {
|
|
511
|
-
this._disableViewStateAnimation = false;
|
|
512
|
-
this._setAnimationTransitionState({ fromState: 'active', toState: this._arrowDirection });
|
|
513
|
-
}
|
|
514
|
-
this._changeDetectorRef.markForCheck();
|
|
515
|
-
});
|
|
516
|
-
}
|
|
517
358
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: MatSortHeader, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
518
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.0", type: MatSortHeader, isStandalone: true, selector: "[mat-sort-header]", inputs: { id: ["mat-sort-header", "id"], arrowPosition: "arrowPosition", start: "start", disabled: ["disabled", "disabled", booleanAttribute], sortActionDescription: "sortActionDescription", disableClear: ["disableClear", "disableClear", booleanAttribute] }, host: { listeners: { "click": "
|
|
519
|
-
matSortAnimations.indicator,
|
|
520
|
-
matSortAnimations.leftPointer,
|
|
521
|
-
matSortAnimations.rightPointer,
|
|
522
|
-
matSortAnimations.arrowOpacity,
|
|
523
|
-
matSortAnimations.arrowPosition,
|
|
524
|
-
matSortAnimations.allowChildren,
|
|
525
|
-
], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
359
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.0", type: MatSortHeader, isStandalone: true, selector: "[mat-sort-header]", inputs: { id: ["mat-sort-header", "id"], arrowPosition: "arrowPosition", start: "start", disabled: ["disabled", "disabled", booleanAttribute], sortActionDescription: "sortActionDescription", disableClear: ["disableClear", "disableClear", booleanAttribute] }, host: { listeners: { "click": "_toggleOnInteraction()", "keydown": "_handleKeydown($event)", "mouseleave": "_recentlyCleared.set(false)" }, properties: { "attr.aria-sort": "_getAriaSortAttribute()", "class.mat-sort-header-disabled": "_isDisabled()" }, classAttribute: "mat-sort-header" }, exportAs: ["matSortHeader"], ngImport: i0, template: "<!--\n We set the `tabindex` on an element inside the table header, rather than the header itself,\n because of a bug in NVDA where having a `tabindex` on a `th` breaks keyboard navigation in the\n table (see https://github.com/nvaccess/nvda/issues/7718). This allows for the header to both\n be focusable, and have screen readers read out its `aria-sort` state. We prefer this approach\n over having a button with an `aria-label` inside the header, because the button's `aria-label`\n will be read out as the user is navigating the table's cell (see #13012).\n\n The approach is based off of: https://dequeuniversity.com/library/aria/tables/sf-sortable-grid\n-->\n<div class=\"mat-sort-header-container mat-focus-indicator\"\n [class.mat-sort-header-sorted]=\"_isSorted()\"\n [class.mat-sort-header-position-before]=\"arrowPosition === 'before'\"\n [class.mat-sort-header-descending]=\"this._sort.direction === 'desc'\"\n [class.mat-sort-header-ascending]=\"this._sort.direction === 'asc'\"\n [class.mat-sort-header-recently-cleared-ascending]=\"_recentlyCleared() === 'asc'\"\n [class.mat-sort-header-recently-cleared-descending]=\"_recentlyCleared() === 'desc'\"\n [class.mat-sort-header-animations-disabled]=\"_animationModule === 'NoopAnimations'\"\n [attr.tabindex]=\"_isDisabled() ? null : 0\"\n [attr.role]=\"_isDisabled() ? null : 'button'\">\n\n <!--\n TODO(crisbeto): this div isn't strictly necessary, but we have to keep it due to a large\n number of screenshot diff failures. It should be removed eventually. Note that the difference\n isn't visible with a shorter header, but once it breaks up into multiple lines, this element\n causes it to be center-aligned, whereas removing it will keep the text to the left.\n -->\n <div class=\"mat-sort-header-content\">\n <ng-content></ng-content>\n </div>\n\n <!-- Disable animations while a current animation is running -->\n @if (_renderArrow()) {\n <div class=\"mat-sort-header-arrow\">\n <svg viewBox=\"0 -960 960 960\" focusable=\"false\" aria-hidden=\"true\">\n <path d=\"M440-240v-368L296-464l-56-56 240-240 240 240-56 56-144-144v368h-80Z\"/>\n </svg>\n </div>\n }\n</div>\n", styles: [".mat-sort-header-container{display:flex;cursor:pointer;align-items:center;letter-spacing:normal;outline:0}[mat-sort-header].cdk-keyboard-focused .mat-sort-header-container,[mat-sort-header].cdk-program-focused .mat-sort-header-container{border-bottom:solid 1px currentColor}.mat-sort-header-disabled .mat-sort-header-container{cursor:default}.mat-sort-header-container::before{margin:calc(calc(var(--mat-focus-indicator-border-width, 3px) + 2px)*-1)}.mat-sort-header-content{text-align:center;display:flex;align-items:center}.mat-sort-header-position-before{flex-direction:row-reverse}@keyframes _mat-sort-header-recently-cleared-ascending{from{transform:translateY(0);opacity:1}to{transform:translateY(-25%);opacity:0}}@keyframes _mat-sort-header-recently-cleared-descending{from{transform:translateY(0) rotate(180deg);opacity:1}to{transform:translateY(25%) rotate(180deg);opacity:0}}.mat-sort-header-arrow{height:12px;width:12px;position:relative;transition:transform 225ms cubic-bezier(0.4, 0, 0.2, 1),opacity 225ms cubic-bezier(0.4, 0, 0.2, 1);opacity:0;overflow:visible;color:var(--mat-sort-arrow-color, var(--mat-sys-on-surface))}.mat-sort-header:hover .mat-sort-header-arrow{opacity:.54}.mat-sort-header .mat-sort-header-sorted .mat-sort-header-arrow{opacity:1}.mat-sort-header-descending .mat-sort-header-arrow{transform:rotate(180deg)}.mat-sort-header-recently-cleared-ascending .mat-sort-header-arrow{transform:translateY(-25%)}.mat-sort-header-recently-cleared-ascending .mat-sort-header-arrow{transition:none;animation:_mat-sort-header-recently-cleared-ascending 225ms cubic-bezier(0.4, 0, 0.2, 1) forwards}.mat-sort-header-recently-cleared-descending .mat-sort-header-arrow{transition:none;animation:_mat-sort-header-recently-cleared-descending 225ms cubic-bezier(0.4, 0, 0.2, 1) forwards}.mat-sort-header-animations-disabled .mat-sort-header-arrow{transition-duration:0ms;animation-duration:0ms}.mat-sort-header-arrow svg{width:24px;height:24px;fill:currentColor;position:absolute;top:50%;left:50%;margin:-12px 0 0 -12px;transform:translateZ(0)}.mat-sort-header-arrow,[dir=rtl] .mat-sort-header-position-before .mat-sort-header-arrow{margin:0 0 0 6px}.mat-sort-header-position-before .mat-sort-header-arrow,[dir=rtl] .mat-sort-header-arrow{margin:0 6px 0 0}"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
526
360
|
}
|
|
527
361
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: MatSortHeader, decorators: [{
|
|
528
362
|
type: Component,
|
|
529
363
|
args: [{ selector: '[mat-sort-header]', exportAs: 'matSortHeader', host: {
|
|
530
364
|
'class': 'mat-sort-header',
|
|
531
|
-
'(click)': '
|
|
365
|
+
'(click)': '_toggleOnInteraction()',
|
|
532
366
|
'(keydown)': '_handleKeydown($event)',
|
|
533
|
-
'(
|
|
534
|
-
'(mouseleave)': '_setIndicatorHintVisible(false)',
|
|
367
|
+
'(mouseleave)': '_recentlyCleared.set(false)',
|
|
535
368
|
'[attr.aria-sort]': '_getAriaSortAttribute()',
|
|
536
369
|
'[class.mat-sort-header-disabled]': '_isDisabled()',
|
|
537
|
-
}, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, animations: [
|
|
538
|
-
matSortAnimations.indicator,
|
|
539
|
-
matSortAnimations.leftPointer,
|
|
540
|
-
matSortAnimations.rightPointer,
|
|
541
|
-
matSortAnimations.arrowOpacity,
|
|
542
|
-
matSortAnimations.arrowPosition,
|
|
543
|
-
matSortAnimations.allowChildren,
|
|
544
|
-
], template: "<!--\n We set the `tabindex` on an element inside the table header, rather than the header itself,\n because of a bug in NVDA where having a `tabindex` on a `th` breaks keyboard navigation in the\n table (see https://github.com/nvaccess/nvda/issues/7718). This allows for the header to both\n be focusable, and have screen readers read out its `aria-sort` state. We prefer this approach\n over having a button with an `aria-label` inside the header, because the button's `aria-label`\n will be read out as the user is navigating the table's cell (see #13012).\n\n The approach is based off of: https://dequeuniversity.com/library/aria/tables/sf-sortable-grid\n-->\n<div class=\"mat-sort-header-container mat-focus-indicator\"\n [class.mat-sort-header-sorted]=\"_isSorted()\"\n [class.mat-sort-header-position-before]=\"arrowPosition === 'before'\"\n [attr.tabindex]=\"_isDisabled() ? null : 0\"\n [attr.role]=\"_isDisabled() ? null : 'button'\">\n\n <!--\n TODO(crisbeto): this div isn't strictly necessary, but we have to keep it due to a large\n number of screenshot diff failures. It should be removed eventually. Note that the difference\n isn't visible with a shorter header, but once it breaks up into multiple lines, this element\n causes it to be center-aligned, whereas removing it will keep the text to the left.\n -->\n <div class=\"mat-sort-header-content\">\n <ng-content></ng-content>\n </div>\n\n <!-- Disable animations while a current animation is running -->\n @if (_renderArrow()) {\n <div class=\"mat-sort-header-arrow\"\n [@arrowOpacity]=\"_getArrowViewState()\"\n [@arrowPosition]=\"_getArrowViewState()\"\n [@allowChildren]=\"_getArrowDirectionState()\"\n (@arrowPosition.start)=\"_disableViewStateAnimation = true\"\n (@arrowPosition.done)=\"_disableViewStateAnimation = false\">\n <div class=\"mat-sort-header-stem\"></div>\n <div class=\"mat-sort-header-indicator\" [@indicator]=\"_getArrowDirectionState()\">\n <div class=\"mat-sort-header-pointer-left\" [@leftPointer]=\"_getArrowDirectionState()\"></div>\n <div class=\"mat-sort-header-pointer-right\" [@rightPointer]=\"_getArrowDirectionState()\"></div>\n <div class=\"mat-sort-header-pointer-middle\"></div>\n </div>\n </div>\n }\n</div>\n", styles: [".mat-sort-header-container{display:flex;cursor:pointer;align-items:center;letter-spacing:normal;outline:0}[mat-sort-header].cdk-keyboard-focused .mat-sort-header-container,[mat-sort-header].cdk-program-focused .mat-sort-header-container{border-bottom:solid 1px currentColor}.mat-sort-header-disabled .mat-sort-header-container{cursor:default}.mat-sort-header-container::before{margin:calc(calc(var(--mat-focus-indicator-border-width, 3px) + 2px)*-1)}.mat-sort-header-content{text-align:center;display:flex;align-items:center}.mat-sort-header-position-before{flex-direction:row-reverse}.mat-sort-header-arrow{height:12px;width:12px;min-width:12px;position:relative;display:flex;color:var(--mat-sort-arrow-color, var(--mat-sys-on-surface));opacity:0}.mat-sort-header-arrow,[dir=rtl] .mat-sort-header-position-before .mat-sort-header-arrow{margin:0 0 0 6px}.mat-sort-header-position-before .mat-sort-header-arrow,[dir=rtl] .mat-sort-header-arrow{margin:0 6px 0 0}.mat-sort-header-stem{background:currentColor;height:10px;width:2px;margin:auto;display:flex;align-items:center}@media(forced-colors: active){.mat-sort-header-stem{width:0;border-left:solid 2px}}.mat-sort-header-indicator{width:100%;height:2px;display:flex;align-items:center;position:absolute;top:0;left:0}.mat-sort-header-pointer-middle{margin:auto;height:2px;width:2px;background:currentColor;transform:rotate(45deg)}@media(forced-colors: active){.mat-sort-header-pointer-middle{width:0;height:0;border-top:solid 2px;border-left:solid 2px}}.mat-sort-header-pointer-left,.mat-sort-header-pointer-right{background:currentColor;width:6px;height:2px;position:absolute;top:0}@media(forced-colors: active){.mat-sort-header-pointer-left,.mat-sort-header-pointer-right{width:0;height:0;border-left:solid 6px;border-top:solid 2px}}.mat-sort-header-pointer-left{transform-origin:right;left:0}.mat-sort-header-pointer-right{transform-origin:left;right:0}"] }]
|
|
370
|
+
}, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<!--\n We set the `tabindex` on an element inside the table header, rather than the header itself,\n because of a bug in NVDA where having a `tabindex` on a `th` breaks keyboard navigation in the\n table (see https://github.com/nvaccess/nvda/issues/7718). This allows for the header to both\n be focusable, and have screen readers read out its `aria-sort` state. We prefer this approach\n over having a button with an `aria-label` inside the header, because the button's `aria-label`\n will be read out as the user is navigating the table's cell (see #13012).\n\n The approach is based off of: https://dequeuniversity.com/library/aria/tables/sf-sortable-grid\n-->\n<div class=\"mat-sort-header-container mat-focus-indicator\"\n [class.mat-sort-header-sorted]=\"_isSorted()\"\n [class.mat-sort-header-position-before]=\"arrowPosition === 'before'\"\n [class.mat-sort-header-descending]=\"this._sort.direction === 'desc'\"\n [class.mat-sort-header-ascending]=\"this._sort.direction === 'asc'\"\n [class.mat-sort-header-recently-cleared-ascending]=\"_recentlyCleared() === 'asc'\"\n [class.mat-sort-header-recently-cleared-descending]=\"_recentlyCleared() === 'desc'\"\n [class.mat-sort-header-animations-disabled]=\"_animationModule === 'NoopAnimations'\"\n [attr.tabindex]=\"_isDisabled() ? null : 0\"\n [attr.role]=\"_isDisabled() ? null : 'button'\">\n\n <!--\n TODO(crisbeto): this div isn't strictly necessary, but we have to keep it due to a large\n number of screenshot diff failures. It should be removed eventually. Note that the difference\n isn't visible with a shorter header, but once it breaks up into multiple lines, this element\n causes it to be center-aligned, whereas removing it will keep the text to the left.\n -->\n <div class=\"mat-sort-header-content\">\n <ng-content></ng-content>\n </div>\n\n <!-- Disable animations while a current animation is running -->\n @if (_renderArrow()) {\n <div class=\"mat-sort-header-arrow\">\n <svg viewBox=\"0 -960 960 960\" focusable=\"false\" aria-hidden=\"true\">\n <path d=\"M440-240v-368L296-464l-56-56 240-240 240 240-56 56-144-144v368h-80Z\"/>\n </svg>\n </div>\n }\n</div>\n", styles: [".mat-sort-header-container{display:flex;cursor:pointer;align-items:center;letter-spacing:normal;outline:0}[mat-sort-header].cdk-keyboard-focused .mat-sort-header-container,[mat-sort-header].cdk-program-focused .mat-sort-header-container{border-bottom:solid 1px currentColor}.mat-sort-header-disabled .mat-sort-header-container{cursor:default}.mat-sort-header-container::before{margin:calc(calc(var(--mat-focus-indicator-border-width, 3px) + 2px)*-1)}.mat-sort-header-content{text-align:center;display:flex;align-items:center}.mat-sort-header-position-before{flex-direction:row-reverse}@keyframes _mat-sort-header-recently-cleared-ascending{from{transform:translateY(0);opacity:1}to{transform:translateY(-25%);opacity:0}}@keyframes _mat-sort-header-recently-cleared-descending{from{transform:translateY(0) rotate(180deg);opacity:1}to{transform:translateY(25%) rotate(180deg);opacity:0}}.mat-sort-header-arrow{height:12px;width:12px;position:relative;transition:transform 225ms cubic-bezier(0.4, 0, 0.2, 1),opacity 225ms cubic-bezier(0.4, 0, 0.2, 1);opacity:0;overflow:visible;color:var(--mat-sort-arrow-color, var(--mat-sys-on-surface))}.mat-sort-header:hover .mat-sort-header-arrow{opacity:.54}.mat-sort-header .mat-sort-header-sorted .mat-sort-header-arrow{opacity:1}.mat-sort-header-descending .mat-sort-header-arrow{transform:rotate(180deg)}.mat-sort-header-recently-cleared-ascending .mat-sort-header-arrow{transform:translateY(-25%)}.mat-sort-header-recently-cleared-ascending .mat-sort-header-arrow{transition:none;animation:_mat-sort-header-recently-cleared-ascending 225ms cubic-bezier(0.4, 0, 0.2, 1) forwards}.mat-sort-header-recently-cleared-descending .mat-sort-header-arrow{transition:none;animation:_mat-sort-header-recently-cleared-descending 225ms cubic-bezier(0.4, 0, 0.2, 1) forwards}.mat-sort-header-animations-disabled .mat-sort-header-arrow{transition-duration:0ms;animation-duration:0ms}.mat-sort-header-arrow svg{width:24px;height:24px;fill:currentColor;position:absolute;top:50%;left:50%;margin:-12px 0 0 -12px;transform:translateZ(0)}.mat-sort-header-arrow,[dir=rtl] .mat-sort-header-position-before .mat-sort-header-arrow{margin:0 0 0 6px}.mat-sort-header-position-before .mat-sort-header-arrow,[dir=rtl] .mat-sort-header-arrow{margin:0 6px 0 0}"] }]
|
|
545
371
|
}], ctorParameters: () => [], propDecorators: { id: [{
|
|
546
372
|
type: Input,
|
|
547
373
|
args: ['mat-sort-header']
|
|
@@ -573,6 +399,68 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImpor
|
|
|
573
399
|
}]
|
|
574
400
|
}] });
|
|
575
401
|
|
|
402
|
+
const SORT_ANIMATION_TRANSITION = AnimationDurations.ENTERING + ' ' + AnimationCurves.STANDARD_CURVE;
|
|
403
|
+
/**
|
|
404
|
+
* Animations used by MatSort.
|
|
405
|
+
* @docs-private
|
|
406
|
+
* @deprecated No longer being used, to be removed.
|
|
407
|
+
* @breaking-change 21.0.0
|
|
408
|
+
*/
|
|
409
|
+
const matSortAnimations = {
|
|
410
|
+
/** Animation that moves the sort indicator. */
|
|
411
|
+
indicator: trigger('indicator', [
|
|
412
|
+
state('active-asc, asc', style({ transform: 'translateY(0px)' })),
|
|
413
|
+
// 10px is the height of the sort indicator, minus the width of the pointers
|
|
414
|
+
state('active-desc, desc', style({ transform: 'translateY(10px)' })),
|
|
415
|
+
transition('active-asc <=> active-desc', animate(SORT_ANIMATION_TRANSITION)),
|
|
416
|
+
]),
|
|
417
|
+
/** Animation that rotates the left pointer of the indicator based on the sorting direction. */
|
|
418
|
+
leftPointer: trigger('leftPointer', [
|
|
419
|
+
state('active-asc, asc', style({ transform: 'rotate(-45deg)' })),
|
|
420
|
+
state('active-desc, desc', style({ transform: 'rotate(45deg)' })),
|
|
421
|
+
transition('active-asc <=> active-desc', animate(SORT_ANIMATION_TRANSITION)),
|
|
422
|
+
]),
|
|
423
|
+
/** Animation that rotates the right pointer of the indicator based on the sorting direction. */
|
|
424
|
+
rightPointer: trigger('rightPointer', [
|
|
425
|
+
state('active-asc, asc', style({ transform: 'rotate(45deg)' })),
|
|
426
|
+
state('active-desc, desc', style({ transform: 'rotate(-45deg)' })),
|
|
427
|
+
transition('active-asc <=> active-desc', animate(SORT_ANIMATION_TRANSITION)),
|
|
428
|
+
]),
|
|
429
|
+
/** Animation that controls the arrow opacity. */
|
|
430
|
+
arrowOpacity: trigger('arrowOpacity', [
|
|
431
|
+
state('desc-to-active, asc-to-active, active', style({ opacity: 1 })),
|
|
432
|
+
state('desc-to-hint, asc-to-hint, hint', style({ opacity: 0.54 })),
|
|
433
|
+
state('hint-to-desc, active-to-desc, desc, hint-to-asc, active-to-asc, asc, void', style({ opacity: 0 })),
|
|
434
|
+
// Transition between all states except for immediate transitions
|
|
435
|
+
transition('* => asc, * => desc, * => active, * => hint, * => void', animate('0ms')),
|
|
436
|
+
transition('* <=> *', animate(SORT_ANIMATION_TRANSITION)),
|
|
437
|
+
]),
|
|
438
|
+
/**
|
|
439
|
+
* Animation for the translation of the arrow as a whole. States are separated into two
|
|
440
|
+
* groups: ones with animations and others that are immediate. Immediate states are asc, desc,
|
|
441
|
+
* peek, and active. The other states define a specific animation (source-to-destination)
|
|
442
|
+
* and are determined as a function of their prev user-perceived state and what the next state
|
|
443
|
+
* should be.
|
|
444
|
+
*/
|
|
445
|
+
arrowPosition: trigger('arrowPosition', [
|
|
446
|
+
// Hidden Above => Hint Center
|
|
447
|
+
transition('* => desc-to-hint, * => desc-to-active', animate(SORT_ANIMATION_TRANSITION, keyframes([style({ transform: 'translateY(-25%)' }), style({ transform: 'translateY(0)' })]))),
|
|
448
|
+
// Hint Center => Hidden Below
|
|
449
|
+
transition('* => hint-to-desc, * => active-to-desc', animate(SORT_ANIMATION_TRANSITION, keyframes([style({ transform: 'translateY(0)' }), style({ transform: 'translateY(25%)' })]))),
|
|
450
|
+
// Hidden Below => Hint Center
|
|
451
|
+
transition('* => asc-to-hint, * => asc-to-active', animate(SORT_ANIMATION_TRANSITION, keyframes([style({ transform: 'translateY(25%)' }), style({ transform: 'translateY(0)' })]))),
|
|
452
|
+
// Hint Center => Hidden Above
|
|
453
|
+
transition('* => hint-to-asc, * => active-to-asc', animate(SORT_ANIMATION_TRANSITION, keyframes([style({ transform: 'translateY(0)' }), style({ transform: 'translateY(-25%)' })]))),
|
|
454
|
+
state('desc-to-hint, asc-to-hint, hint, desc-to-active, asc-to-active, active', style({ transform: 'translateY(0)' })),
|
|
455
|
+
state('hint-to-desc, active-to-desc, desc', style({ transform: 'translateY(-25%)' })),
|
|
456
|
+
state('hint-to-asc, active-to-asc, asc', style({ transform: 'translateY(25%)' })),
|
|
457
|
+
]),
|
|
458
|
+
/** Necessary trigger that calls animate on children animations. */
|
|
459
|
+
allowChildren: trigger('allowChildren', [
|
|
460
|
+
transition('* <=> *', [query('@*', animateChild(), { optional: true })]),
|
|
461
|
+
]),
|
|
462
|
+
};
|
|
463
|
+
|
|
576
464
|
/**
|
|
577
465
|
* Generated bundle index. Do not edit.
|
|
578
466
|
*/
|