@cute-widgets/base 20.0.3 → 20.0.5
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/CHANGELOG.md +31 -4
- package/abstract/index.d.ts +13 -4
- package/button/index.d.ts +47 -24
- package/button-toggle/index.d.ts +8 -4
- package/card/index.d.ts +9 -6
- package/collapse/index.d.ts +49 -48
- package/core/directives/index.d.ts +1 -31
- package/core/index.d.ts +41 -28
- package/core/interfaces/index.d.ts +1 -1
- package/core/layout/index.d.ts +40 -27
- package/core/nav/index.d.ts +1 -2
- package/dialog/index.d.ts +81 -57
- package/expansion/index.d.ts +5 -18
- package/fesm2022/cute-widgets-base-abstract.mjs +13 -8
- package/fesm2022/cute-widgets-base-abstract.mjs.map +1 -1
- package/fesm2022/cute-widgets-base-button-toggle.mjs +36 -29
- package/fesm2022/cute-widgets-base-button-toggle.mjs.map +1 -1
- package/fesm2022/cute-widgets-base-button.mjs +169 -104
- package/fesm2022/cute-widgets-base-button.mjs.map +1 -1
- package/fesm2022/cute-widgets-base-card.mjs +46 -29
- package/fesm2022/cute-widgets-base-card.mjs.map +1 -1
- package/fesm2022/cute-widgets-base-chips.mjs +6 -18
- package/fesm2022/cute-widgets-base-chips.mjs.map +1 -1
- package/fesm2022/cute-widgets-base-collapse.mjs +114 -126
- package/fesm2022/cute-widgets-base-collapse.mjs.map +1 -1
- package/fesm2022/cute-widgets-base-core-directives.mjs +4 -72
- package/fesm2022/cute-widgets-base-core-directives.mjs.map +1 -1
- package/fesm2022/cute-widgets-base-core-interfaces.mjs.map +1 -1
- package/fesm2022/cute-widgets-base-core-layout.mjs +76 -40
- package/fesm2022/cute-widgets-base-core-layout.mjs.map +1 -1
- package/fesm2022/cute-widgets-base-core-nav.mjs +1 -2
- package/fesm2022/cute-widgets-base-core-nav.mjs.map +1 -1
- package/fesm2022/cute-widgets-base-core-theming.mjs +1 -1
- package/fesm2022/cute-widgets-base-core-theming.mjs.map +1 -1
- package/fesm2022/cute-widgets-base-core.mjs +77 -41
- package/fesm2022/cute-widgets-base-core.mjs.map +1 -1
- package/fesm2022/cute-widgets-base-dialog.mjs +152 -117
- package/fesm2022/cute-widgets-base-dialog.mjs.map +1 -1
- package/fesm2022/cute-widgets-base-expansion.mjs +19 -13
- package/fesm2022/cute-widgets-base-expansion.mjs.map +1 -1
- package/fesm2022/cute-widgets-base-list.mjs +2 -2
- package/fesm2022/cute-widgets-base-list.mjs.map +1 -1
- package/fesm2022/cute-widgets-base-menu.mjs +5 -27
- package/fesm2022/cute-widgets-base-menu.mjs.map +1 -1
- package/fesm2022/cute-widgets-base-navbar.mjs +88 -42
- package/fesm2022/cute-widgets-base-navbar.mjs.map +1 -1
- package/fesm2022/cute-widgets-base-paginator.mjs +13 -11
- package/fesm2022/cute-widgets-base-paginator.mjs.map +1 -1
- package/fesm2022/cute-widgets-base-radio.mjs +1 -2
- package/fesm2022/cute-widgets-base-radio.mjs.map +1 -1
- package/fesm2022/cute-widgets-base-select.mjs +2 -2
- package/fesm2022/cute-widgets-base-select.mjs.map +1 -1
- package/fesm2022/cute-widgets-base-sidenav.mjs +31 -30
- package/fesm2022/cute-widgets-base-sidenav.mjs.map +1 -1
- package/fesm2022/cute-widgets-base-snack-bar.mjs +2 -2
- package/fesm2022/cute-widgets-base-snack-bar.mjs.map +1 -1
- package/fesm2022/cute-widgets-base-sort.mjs +60 -257
- package/fesm2022/cute-widgets-base-sort.mjs.map +1 -1
- package/fesm2022/cute-widgets-base-table.mjs +6 -3
- package/fesm2022/cute-widgets-base-table.mjs.map +1 -1
- package/fesm2022/cute-widgets-base-tabs.mjs +86 -61
- package/fesm2022/cute-widgets-base-tabs.mjs.map +1 -1
- package/fesm2022/cute-widgets-base.mjs +3 -1
- package/fesm2022/cute-widgets-base.mjs.map +1 -1
- package/navbar/index.d.ts +30 -9
- package/package.json +6 -5
- package/paginator/index.d.ts +6 -17
- package/radio/index.d.ts +0 -1
- package/sidenav/index.d.ts +1 -2
- package/sort/index.d.ts +22 -135
- package/table/index.d.ts +8 -8
- package/tabs/index.d.ts +35 -14
|
@@ -1,10 +1,9 @@
|
|
|
1
|
+
import { FocusMonitor, AriaDescriber } from '@angular/cdk/a11y';
|
|
1
2
|
import { SPACE, ENTER } from '@angular/cdk/keycodes';
|
|
2
3
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { InjectionToken, isDevMode, EventEmitter, booleanAttribute, Output, Input, Optional, Inject, Directive, Injectable, SkipSelf, ChangeDetectionStrategy, ViewEncapsulation, Component, NgModule } from '@angular/core';
|
|
4
|
+
import { InjectionToken, isDevMode, EventEmitter, booleanAttribute, Output, Input, Optional, Inject, Directive, Injectable, SkipSelf, inject, ChangeDetectorRef, ElementRef, signal, ChangeDetectionStrategy, ViewEncapsulation, Component, NgModule } from '@angular/core';
|
|
4
5
|
import { ReplaySubject, Subject, merge } from 'rxjs';
|
|
5
|
-
import {
|
|
6
|
-
import { AnimationDurations, AnimationCurves } from '@cute-widgets/base/core';
|
|
7
|
-
import * as i3 from '@angular/cdk/a11y';
|
|
6
|
+
import { _animationsDisabled } from '@cute-widgets/base/core/animation';
|
|
8
7
|
import { CommonModule } from '@angular/common';
|
|
9
8
|
|
|
10
9
|
/** @docs-private */
|
|
@@ -35,9 +34,10 @@ function getSortInvalidDirectionError(direction) {
|
|
|
35
34
|
* This code is a modification of the `@angular/material` original
|
|
36
35
|
* code licensed under MIT-style License (https://angular.dev/license).
|
|
37
36
|
*/
|
|
38
|
-
/** Injection token to be used to override the default options for `
|
|
37
|
+
/** Injection token to be used to override the default options for `cute-sort`. */
|
|
39
38
|
const CUTE_SORT_DEFAULT_OPTIONS = new InjectionToken('CUTE_SORT_DEFAULT_OPTIONS');
|
|
40
|
-
|
|
39
|
+
// CWT: Changes to Sort interface implementation
|
|
40
|
+
/** Container for `CuteSortable`s to manage the sort state and provide default sort parameters. */
|
|
41
41
|
class CuteSort {
|
|
42
42
|
/** The sort direction of the currently active CuteSortable. */
|
|
43
43
|
get direction() { return this._direction; }
|
|
@@ -57,6 +57,8 @@ class CuteSort {
|
|
|
57
57
|
this.sortables = new Map();
|
|
58
58
|
/** Used to notify any child components listening to state changes. */
|
|
59
59
|
this._stateChanges = new Subject();
|
|
60
|
+
/** The id of the most recently sorted CuteSortable. */
|
|
61
|
+
this.active = "";
|
|
60
62
|
/**
|
|
61
63
|
* The direction to set when a CuteSortable is initially sorted.
|
|
62
64
|
* May be overridden by the CuteSortable's sort start.
|
|
@@ -182,77 +184,6 @@ function getSortDirectionCycle(start, disableClear) {
|
|
|
182
184
|
return sortOrder;
|
|
183
185
|
}
|
|
184
186
|
|
|
185
|
-
/**
|
|
186
|
-
* @license Apache-2.0
|
|
187
|
-
*
|
|
188
|
-
* Copyright (c) 2025 CuteWidgets Team. All Rights Reserved.
|
|
189
|
-
*
|
|
190
|
-
* You may not use this file except in compliance with the License
|
|
191
|
-
* that can be found at http://www.apache.org/licenses/LICENSE-2.0
|
|
192
|
-
*
|
|
193
|
-
* This code is a modification of the `@angular/material` original
|
|
194
|
-
* code licensed under MIT-style License (https://angular.dev/license).
|
|
195
|
-
*/
|
|
196
|
-
const SORT_ANIMATION_TRANSITION = AnimationDurations.ENTERING + ' ' + AnimationCurves.STANDARD_CURVE;
|
|
197
|
-
/**
|
|
198
|
-
* Animations used by CuteSort.
|
|
199
|
-
* @docs-private
|
|
200
|
-
*/
|
|
201
|
-
const cuteSortAnimations = {
|
|
202
|
-
/** Animation that moves the sort indicator. */
|
|
203
|
-
indicator: trigger('indicator', [
|
|
204
|
-
state('active-asc, asc', style({ transform: 'translateY(0px)' })),
|
|
205
|
-
// 10px is the height of the sort indicator, minus the width of the pointers
|
|
206
|
-
state('active-desc, desc', style({ transform: 'translateY(10px)' })),
|
|
207
|
-
transition('active-asc <=> active-desc', animate(SORT_ANIMATION_TRANSITION)),
|
|
208
|
-
]),
|
|
209
|
-
/** Animation that rotates the left pointer of the indicator based on the sorting direction. */
|
|
210
|
-
leftPointer: trigger('leftPointer', [
|
|
211
|
-
state('active-asc, asc', style({ transform: 'rotate(-45deg)' })),
|
|
212
|
-
state('active-desc, desc', style({ transform: 'rotate(45deg)' })),
|
|
213
|
-
transition('active-asc <=> active-desc', animate(SORT_ANIMATION_TRANSITION)),
|
|
214
|
-
]),
|
|
215
|
-
/** Animation that rotates the right pointer of the indicator based on the sorting direction. */
|
|
216
|
-
rightPointer: trigger('rightPointer', [
|
|
217
|
-
state('active-asc, asc', style({ transform: 'rotate(45deg)' })),
|
|
218
|
-
state('active-desc, desc', style({ transform: 'rotate(-45deg)' })),
|
|
219
|
-
transition('active-asc <=> active-desc', animate(SORT_ANIMATION_TRANSITION)),
|
|
220
|
-
]),
|
|
221
|
-
/** Animation that controls the arrow opacity. */
|
|
222
|
-
arrowOpacity: trigger('arrowOpacity', [
|
|
223
|
-
state('desc-to-active, asc-to-active, active', style({ opacity: 1 })),
|
|
224
|
-
state('desc-to-hint, asc-to-hint, hint', style({ opacity: 0.54 })),
|
|
225
|
-
state('hint-to-desc, active-to-desc, desc, hint-to-asc, active-to-asc, asc, void', style({ opacity: 0 })),
|
|
226
|
-
// Transition between all states except for immediate transitions
|
|
227
|
-
transition('* => asc, * => desc, * => active, * => hint, * => void', animate('0ms')),
|
|
228
|
-
transition('* <=> *', animate(SORT_ANIMATION_TRANSITION)),
|
|
229
|
-
]),
|
|
230
|
-
/**
|
|
231
|
-
* Animation for the translation of the arrow as a whole. States are separated into two
|
|
232
|
-
* groups: ones with animations and others that are immediate. Immediate states are asc, desc,
|
|
233
|
-
* peek, and active. The other states define a specific animation (source-to-destination)
|
|
234
|
-
* and are determined as a function of their prev user-perceived state and what the next state
|
|
235
|
-
* should be.
|
|
236
|
-
*/
|
|
237
|
-
arrowPosition: trigger('arrowPosition', [
|
|
238
|
-
// Hidden Above => Hint Center
|
|
239
|
-
transition('* => desc-to-hint, * => desc-to-active', animate(SORT_ANIMATION_TRANSITION, keyframes([style({ transform: 'translateY(-25%)' }), style({ transform: 'translateY(0)' })]))),
|
|
240
|
-
// Hint Center => Hidden Below
|
|
241
|
-
transition('* => hint-to-desc, * => active-to-desc', animate(SORT_ANIMATION_TRANSITION, keyframes([style({ transform: 'translateY(0)' }), style({ transform: 'translateY(25%)' })]))),
|
|
242
|
-
// Hidden Below => Hint Center
|
|
243
|
-
transition('* => asc-to-hint, * => asc-to-active', animate(SORT_ANIMATION_TRANSITION, keyframes([style({ transform: 'translateY(25%)' }), style({ transform: 'translateY(0)' })]))),
|
|
244
|
-
// Hint Center => Hidden Above
|
|
245
|
-
transition('* => hint-to-asc, * => active-to-asc', animate(SORT_ANIMATION_TRANSITION, keyframes([style({ transform: 'translateY(0)' }), style({ transform: 'translateY(-25%)' })]))),
|
|
246
|
-
state('desc-to-hint, asc-to-hint, hint, desc-to-active, asc-to-active, active', style({ transform: 'translateY(0)' })),
|
|
247
|
-
state('hint-to-desc, active-to-desc, desc', style({ transform: 'translateY(-25%)' })),
|
|
248
|
-
state('hint-to-asc, active-to-asc, asc', style({ transform: 'translateY(25%)' })),
|
|
249
|
-
]),
|
|
250
|
-
/** Necessary trigger that calls animate on children animations. */
|
|
251
|
-
allowChildren: trigger('allowChildren', [
|
|
252
|
-
transition('* <=> *', [query('@*', animateChild(), { optional: true })]),
|
|
253
|
-
]),
|
|
254
|
-
};
|
|
255
|
-
|
|
256
187
|
/**
|
|
257
188
|
* @license Apache-2.0
|
|
258
189
|
*
|
|
@@ -289,17 +220,28 @@ function CUTE_SORT_HEADER_INTL_PROVIDER_FACTORY(parentIntl) {
|
|
|
289
220
|
}
|
|
290
221
|
/** @docs-private */
|
|
291
222
|
const CUTE_SORT_HEADER_INTL_PROVIDER = {
|
|
292
|
-
// If there is already an
|
|
223
|
+
// If there is already an CuteSortHeaderIntl available, use that. Otherwise, provide a new one.
|
|
293
224
|
provide: CuteSortHeaderIntl,
|
|
294
225
|
deps: [[new Optional(), new SkipSelf(), CuteSortHeaderIntl]],
|
|
295
226
|
useFactory: CUTE_SORT_HEADER_INTL_PROVIDER_FACTORY,
|
|
296
227
|
};
|
|
297
228
|
|
|
229
|
+
/**
|
|
230
|
+
* @license Apache-2.0
|
|
231
|
+
*
|
|
232
|
+
* Copyright (c) 2025 CuteWidgets Team. All Rights Reserved.
|
|
233
|
+
*
|
|
234
|
+
* You may not use this file except in compliance with the License
|
|
235
|
+
* that can be found at http://www.apache.org/licenses/LICENSE-2.0
|
|
236
|
+
*
|
|
237
|
+
* This code is a modification of the `@angular/material` original
|
|
238
|
+
* code licensed under MIT-style License (https://angular.dev/license).
|
|
239
|
+
*/
|
|
298
240
|
/**
|
|
299
241
|
* Applies sorting behavior (click to change sort) and styles to an element, including an
|
|
300
242
|
* arrow to display the current sort direction.
|
|
301
243
|
*
|
|
302
|
-
* Must be provided with an id and contained within a parent
|
|
244
|
+
* Must be provided with an id and contained within a parent CuteSort directive.
|
|
303
245
|
*
|
|
304
246
|
* If used on header cells in a CdkTable, it will automatically default its id from its containing
|
|
305
247
|
* column definition.
|
|
@@ -315,55 +257,24 @@ class CuteSortHeader {
|
|
|
315
257
|
set sortActionDescription(value) {
|
|
316
258
|
this._updateSortActionDescription(value);
|
|
317
259
|
}
|
|
318
|
-
constructor(
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
this._intl = _intl;
|
|
330
|
-
this._changeDetectorRef = _changeDetectorRef;
|
|
331
|
-
this._sort = _sort;
|
|
332
|
-
this._columnDef = _columnDef;
|
|
333
|
-
this._focusMonitor = _focusMonitor;
|
|
334
|
-
this._elementRef = _elementRef;
|
|
335
|
-
this._ariaDescriber = _ariaDescriber;
|
|
336
|
-
/**
|
|
337
|
-
* The element with role="button" inside this component's view. We need this to apply
|
|
338
|
-
* a description with AriaDescriber.
|
|
339
|
-
*/
|
|
340
|
-
this._sortButton = null;
|
|
341
|
-
/**
|
|
342
|
-
* Flag set to true when the indicator should be displayed while the sort is not active. Used to
|
|
343
|
-
* provide an affordance that the header is sortable by showing on focus and hover.
|
|
344
|
-
*/
|
|
345
|
-
this._showIndicatorHint = false;
|
|
346
|
-
/**
|
|
347
|
-
* The view transition state of the arrow (translation/ opacity) - indicates its `from` and `to`
|
|
348
|
-
* position through the animation. If animations are currently disabled, the `fromState` is removed
|
|
349
|
-
* so that there is no animation displayed.
|
|
350
|
-
*/
|
|
351
|
-
this._viewState = {};
|
|
352
|
-
/** The direction the arrow should be facing, according to the current state. */
|
|
353
|
-
this._arrowDirection = '';
|
|
354
|
-
/**
|
|
355
|
-
* Whether the view state animation should show the transition between the `from` and `to` states.
|
|
356
|
-
*/
|
|
357
|
-
this._disableViewStateAnimation = false;
|
|
260
|
+
constructor() {
|
|
261
|
+
this._intl = inject(CuteSortHeaderIntl);
|
|
262
|
+
this._sort = inject(CuteSort, { optional: true });
|
|
263
|
+
this._columnDef = inject('CUTE_SORT_HEADER_COLUMN_DEF', {
|
|
264
|
+
optional: true,
|
|
265
|
+
});
|
|
266
|
+
this._changeDetectorRef = inject(ChangeDetectorRef);
|
|
267
|
+
this._focusMonitor = inject(FocusMonitor);
|
|
268
|
+
this._elementRef = inject(ElementRef);
|
|
269
|
+
this._ariaDescriber = inject(AriaDescriber, { optional: true });
|
|
270
|
+
this._animationsDisabled = _animationsDisabled();
|
|
358
271
|
/**
|
|
359
|
-
*
|
|
360
|
-
* the
|
|
272
|
+
* Indicates which state was just cleared from the sort header.
|
|
273
|
+
* Will be reset on the next interaction. Used for coordinating animations.
|
|
361
274
|
*/
|
|
362
|
-
this.
|
|
275
|
+
this._recentlyCleared = signal(null, ...(ngDevMode ? [{ debugName: "_recentlyCleared" }] : []));
|
|
363
276
|
/** Sets the position of the arrow that displays when sorted. */
|
|
364
277
|
this.arrowPosition = 'after';
|
|
365
|
-
/** Overrides the sort start value of the containing CuteSort for this CuteSortable. */
|
|
366
|
-
this.start = "";
|
|
367
278
|
/** whether the sort header is disabled. */
|
|
368
279
|
this.disabled = false;
|
|
369
280
|
// Default the action description to "Sort" because it's better than nothing.
|
|
@@ -372,95 +283,58 @@ class CuteSortHeader {
|
|
|
372
283
|
this._sortActionDescription = 'Sort';
|
|
373
284
|
/** Overrides the disable clear value of the containing CuteSort for this CuteSortable. */
|
|
374
285
|
this.disableClear = false;
|
|
286
|
+
//inject(_CdkPrivateStyleLoader).load(_StructuralStylesLoader);
|
|
287
|
+
const defaultOptions = inject(CUTE_SORT_DEFAULT_OPTIONS, {
|
|
288
|
+
optional: true,
|
|
289
|
+
});
|
|
375
290
|
// Note that we use a string token for the `_columnDef`, because the value is provided both by
|
|
376
|
-
// `
|
|
291
|
+
// `cute/table` and `cdk/table` and we can't have the CDK depending on Material, CuteWidgets etc.,
|
|
377
292
|
// and we want to avoid having the sort header depending on the CDK table because
|
|
378
293
|
// of this single reference.
|
|
379
|
-
if (!_sort &&
|
|
294
|
+
if (!this._sort && (typeof ngDevMode === 'undefined' || ngDevMode)) {
|
|
380
295
|
throw getSortHeaderNotContainedWithinSortError();
|
|
381
296
|
}
|
|
382
297
|
if (defaultOptions?.arrowPosition) {
|
|
383
298
|
this.arrowPosition = defaultOptions?.arrowPosition;
|
|
384
299
|
}
|
|
385
|
-
this._handleStateChanges();
|
|
386
300
|
}
|
|
387
301
|
ngOnInit() {
|
|
388
302
|
if (!this.id && this._columnDef) {
|
|
389
303
|
this.id = this._columnDef.name;
|
|
390
304
|
}
|
|
391
|
-
// Initialize the direction of the arrow and set the view state to be immediately that state.
|
|
392
|
-
this._updateArrowDirection();
|
|
393
|
-
this._setAnimationTransitionState({
|
|
394
|
-
toState: this._isSorted() ? 'active' : this._arrowDirection,
|
|
395
|
-
});
|
|
396
305
|
this._sort.register(this);
|
|
306
|
+
this._renderChanges = merge(this._sort._stateChanges, this._sort.sortChange).subscribe(() => this._changeDetectorRef.markForCheck());
|
|
397
307
|
this._sortButton = this._elementRef.nativeElement.querySelector('.cute-sort-header-container');
|
|
398
308
|
this._updateSortActionDescription(this._sortActionDescription);
|
|
399
309
|
}
|
|
400
310
|
ngAfterViewInit() {
|
|
401
311
|
// We use the focus monitor because we also want to style
|
|
402
312
|
// things differently based on the focus origin.
|
|
403
|
-
this._focusMonitor.monitor(this._elementRef, true).subscribe(
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
this._changeDetectorRef.markForCheck();
|
|
408
|
-
}
|
|
313
|
+
this._focusMonitor.monitor(this._elementRef, true).subscribe(() => {
|
|
314
|
+
// We need the delay here, because we can trigger a signal write error if the header
|
|
315
|
+
// has a signal bound to `disabled` which causes it to be blurred (see #31723.)
|
|
316
|
+
Promise.resolve().then(() => this._recentlyCleared.set(null));
|
|
409
317
|
});
|
|
410
318
|
}
|
|
411
319
|
ngOnDestroy() {
|
|
412
320
|
this._focusMonitor.stopMonitoring(this._elementRef);
|
|
413
321
|
this._sort.deregister(this);
|
|
414
|
-
this.
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
* Sets the "hint" state such that the arrow will be semi-transparently displayed as a hint to the
|
|
418
|
-
* user showing what the active sort will become. If set to false, the arrow will fade away.
|
|
419
|
-
*/
|
|
420
|
-
_setIndicatorHintVisible(visible) {
|
|
421
|
-
// No-op if the sort header is disabled - should not make the hint visible.
|
|
422
|
-
if (this._isDisabled() && visible) {
|
|
423
|
-
return;
|
|
424
|
-
}
|
|
425
|
-
this._showIndicatorHint = visible;
|
|
426
|
-
if (!this._isSorted()) {
|
|
427
|
-
this._updateArrowDirection();
|
|
428
|
-
if (this._showIndicatorHint) {
|
|
429
|
-
this._setAnimationTransitionState({ fromState: this._arrowDirection, toState: 'hint' });
|
|
430
|
-
}
|
|
431
|
-
else {
|
|
432
|
-
this._setAnimationTransitionState({ fromState: 'hint', toState: this._arrowDirection });
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
/**
|
|
437
|
-
* Sets the animation transition view state for the arrow's position and opacity. If the
|
|
438
|
-
* `disableViewStateAnimation` flag is set to true, the `fromState` will be ignored so that
|
|
439
|
-
* no animation appears.
|
|
440
|
-
*/
|
|
441
|
-
_setAnimationTransitionState(viewState) {
|
|
442
|
-
this._viewState = viewState || {};
|
|
443
|
-
// If the animation for arrow position state (opacity/translation) should be disabled,
|
|
444
|
-
// remove the fromState so that it jumps right to the toState.
|
|
445
|
-
if (this._disableViewStateAnimation) {
|
|
446
|
-
this._viewState = { toState: viewState.toState };
|
|
322
|
+
this._renderChanges?.unsubscribe();
|
|
323
|
+
if (this._sortButton) {
|
|
324
|
+
this._ariaDescriber?.removeDescription(this._sortButton, this._sortActionDescription);
|
|
447
325
|
}
|
|
448
326
|
}
|
|
449
327
|
/** Triggers the sort on this sort header and removes the indicator hint. */
|
|
450
328
|
_toggleOnInteraction() {
|
|
451
|
-
this._sort.sort(this);
|
|
452
|
-
// Do not show the animation if the header was already shown in the right position.
|
|
453
|
-
if (this._viewState.toState === 'hint' || this._viewState.toState === 'active') {
|
|
454
|
-
this._disableViewStateAnimation = true;
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
_handleClick() {
|
|
458
329
|
if (!this._isDisabled()) {
|
|
330
|
+
const wasSorted = this._isSorted();
|
|
331
|
+
const prevDirection = this._sort.direction;
|
|
459
332
|
this._sort.sort(this);
|
|
333
|
+
this._recentlyCleared.set(wasSorted && !this._isSorted() ? prevDirection : null);
|
|
460
334
|
}
|
|
461
335
|
}
|
|
462
336
|
_handleKeydown(event) {
|
|
463
|
-
if (
|
|
337
|
+
if (event.keyCode === SPACE || event.keyCode === ENTER) {
|
|
464
338
|
event.preventDefault();
|
|
465
339
|
this._toggleOnInteraction();
|
|
466
340
|
}
|
|
@@ -470,28 +344,6 @@ class CuteSortHeader {
|
|
|
470
344
|
return (this._sort.active == this.id &&
|
|
471
345
|
(this._sort.direction === 'asc' || this._sort.direction === 'desc'));
|
|
472
346
|
}
|
|
473
|
-
/** Returns the animation state for the arrow direction (indicator and pointers). */
|
|
474
|
-
_getArrowDirectionState() {
|
|
475
|
-
return `${this._isSorted() ? 'active-' : ''}${this._arrowDirection}`;
|
|
476
|
-
}
|
|
477
|
-
/** Returns the arrow position state (opacity, translation). */
|
|
478
|
-
_getArrowViewState() {
|
|
479
|
-
const fromState = this._viewState.fromState;
|
|
480
|
-
return (fromState ? `${fromState}-to-` : '') + this._viewState.toState;
|
|
481
|
-
}
|
|
482
|
-
/**
|
|
483
|
-
* Updates the direction the arrow should be pointing. If it is not sorted, the arrow should be
|
|
484
|
-
* facing the start direction. Otherwise, if it is sorted, the arrow should point in the currently
|
|
485
|
-
* active sorted direction. The reason this is updated through a function is because the direction
|
|
486
|
-
* should only be changed at specific times - when deactivated but the hint is displayed and when
|
|
487
|
-
* the sort is active and the direction changes. Otherwise, the arrow's direction should linger
|
|
488
|
-
* in cases such as the sort becoming deactivated but we want to animate the arrow away while
|
|
489
|
-
* preserving its direction, even though the next sort direction is actually different and should
|
|
490
|
-
* only be changed once the arrow displays again (hint or activation).
|
|
491
|
-
*/
|
|
492
|
-
_updateArrowDirection() {
|
|
493
|
-
this._arrowDirection = this._isSorted() ? this._sort.direction : this.start || this._sort.start;
|
|
494
|
-
}
|
|
495
347
|
_isDisabled() {
|
|
496
348
|
return this._sort.disabled || this.disabled;
|
|
497
349
|
}
|
|
@@ -525,69 +377,20 @@ class CuteSortHeader {
|
|
|
525
377
|
}
|
|
526
378
|
this._sortActionDescription = newDescription;
|
|
527
379
|
}
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
this._rerenderSubscription = merge(this._sort.sortChange, this._sort._stateChanges, this._intl.changes).subscribe(() => {
|
|
531
|
-
if (this._isSorted()) {
|
|
532
|
-
this._updateArrowDirection();
|
|
533
|
-
// Do not show the animation if the header was already shown in the right position.
|
|
534
|
-
if (this._viewState.toState === 'hint' || this._viewState.toState === 'active') {
|
|
535
|
-
this._disableViewStateAnimation = true;
|
|
536
|
-
}
|
|
537
|
-
this._setAnimationTransitionState({ fromState: this._arrowDirection, toState: 'active' });
|
|
538
|
-
this._showIndicatorHint = false;
|
|
539
|
-
}
|
|
540
|
-
// If this header was recently active and now no longer sorted, animate away the arrow.
|
|
541
|
-
if (!this._isSorted() && this._viewState && this._viewState.toState === 'active') {
|
|
542
|
-
this._disableViewStateAnimation = false;
|
|
543
|
-
this._setAnimationTransitionState({ fromState: 'active', toState: this._arrowDirection });
|
|
544
|
-
}
|
|
545
|
-
this._changeDetectorRef.markForCheck();
|
|
546
|
-
});
|
|
547
|
-
}
|
|
548
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteSortHeader, deps: [{ token: CuteSortHeaderIntl }, { token: i0.ChangeDetectorRef }, { token: CuteSort, optional: true }, { token: 'CUTE_SORT_HEADER_COLUMN_DEF', optional: true }, { token: i3.FocusMonitor }, { token: i0.ElementRef }, { token: i3.AriaDescriber, optional: true }, { token: CUTE_SORT_DEFAULT_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
549
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.15", type: CuteSortHeader, isStandalone: true, selector: "[cute-sort-header]", inputs: { id: ["cute-sort-header", "id"], arrowPosition: "arrowPosition", start: "start", disabled: ["disabled", "disabled", booleanAttribute], sortActionDescription: "sortActionDescription", disableClear: ["disableClear", "disableClear", booleanAttribute] }, host: { listeners: { "click": "_handleClick()", "keydown": "_handleKeydown($event)", "mouseenter": "_setIndicatorHintVisible(true)", "mouseleave": "_setIndicatorHintVisible(false)" }, properties: { "attr.aria-sort": "_getAriaSortAttribute()", "class.cute-sort-header-disabled": "_isDisabled()" }, classAttribute: "cute-sort-header" }, exportAs: ["cuteSortHeader"], ngImport: i0, template: "<!--\r\n We set the `tabindex` on an element inside the table header, rather than the header itself,\r\n because of a bug in NVDA where having a `tabindex` on a `th` breaks keyboard navigation in the\r\n table (see https://github.com/nvaccess/nvda/issues/7718). This allows for the header to both\r\n be focusable, and have screen readers read out its `aria-sort` state. We prefer this approach\r\n over having a button with an `aria-label` inside the header, because the button's `aria-label`\r\n will be read out as the user is navigating the table's cell (see #13012).\r\n\r\n The approach is based off of: https://dequeuniversity.com/library/aria/tables/sf-sortable-grid\r\n-->\r\n<div class=\"cute-sort-header-container cute-focus-indicator\"\r\n [class.cute-sort-header-sorted]=\"_isSorted()\"\r\n [class.cute-sort-header-position-before]=\"arrowPosition === 'before'\"\r\n [attr.tabindex]=\"_isDisabled() ? null : 0\"\r\n [attr.role]=\"_isDisabled() ? null : 'button'\">\r\n\r\n <!--\r\n TODO(crisbeto): this div isn't strictly necessary, but we have to keep it due to a large\r\n number of screenshot diff failures. It should be removed eventually. Note that the difference\r\n isn't visible with a shorter header, but once it breaks up into multiple lines, this element\r\n causes it to be center-aligned, whereas removing it will keep the text to the left.\r\n -->\r\n <div class=\"cute-sort-header-content\">\r\n <ng-content></ng-content>\r\n </div>\r\n\r\n <!-- Disable animations while a current animation is running -->\r\n @if (_renderArrow()) {\r\n <div class=\"cute-sort-header-arrow\"\r\n [@arrowOpacity]=\"_getArrowViewState()\"\r\n [@arrowPosition]=\"_getArrowViewState()\"\r\n [@allowChildren]=\"_getArrowDirectionState()\"\r\n (@arrowPosition.start)=\"_disableViewStateAnimation = true\"\r\n (@arrowPosition.done)=\"_disableViewStateAnimation = false\">\r\n <div class=\"cute-sort-header-stem\"></div>\r\n <div class=\"cute-sort-header-indicator\" [@indicator]=\"_getArrowDirectionState()\">\r\n <div class=\"cute-sort-header-pointer-left\" [@leftPointer]=\"_getArrowDirectionState()\"></div>\r\n <div class=\"cute-sort-header-pointer-right\" [@rightPointer]=\"_getArrowDirectionState()\"></div>\r\n <div class=\"cute-sort-header-pointer-middle\"></div>\r\n </div>\r\n </div>\r\n }\r\n</div>\r\n", styles: [".cute-sort-header-container{display:flex;cursor:pointer;align-items:center;letter-spacing:normal;outline:0}[cute-sort-header].cdk-keyboard-focused .cute-sort-header-container,[cute-sort-header].cdk-program-focused .cute-sort-header-container{border-bottom:solid 1px currentColor}.cute-sort-header-disabled .cute-sort-header-container{cursor:default}.cute-sort-header-container:before{margin:calc(calc(var(--cute-focus-indicator-border-width, 1px) + 2px) * -1)}.cute-sort-header-content{text-align:center;display:flex;align-items:center}.cute-sort-header-position-before{flex-direction:row-reverse}.cute-sort-header-arrow{height:12px;width:12px;min-width:12px;position:relative;display:flex;opacity:0}.cute-sort-header-arrow,[dir=rtl] .cute-sort-header-position-before .cute-sort-header-arrow{margin:0 0 0 6px}.cute-sort-header-position-before .cute-sort-header-arrow,[dir=rtl] .cute-sort-header-arrow{margin:0 6px 0 0}.cute-sort-header-stem{background:currentColor;height:10px;width:2px;margin:auto;display:flex;align-items:center}@media (forced-colors: active){.cute-sort-header-stem{width:0;border-left:solid 2px}}.cute-sort-header-indicator{width:100%;height:2px;display:flex;align-items:center;position:absolute;top:0;left:0}.cute-sort-header-pointer-middle{margin:auto;height:2px;width:2px;background:currentColor;transform:rotate(45deg)}@media (forced-colors: active){.cute-sort-header-pointer-middle{width:0;height:0;border-top:solid 2px;border-left:solid 2px}}.cute-sort-header-pointer-left,.cute-sort-header-pointer-right{background:currentColor;width:6px;height:2px;position:absolute;top:0}@media (forced-colors: active){.cute-sort-header-pointer-left,.cute-sort-header-pointer-right{width:0;height:0;border-left:solid 6px;border-top:solid 2px}}.cute-sort-header-pointer-left{transform-origin:right;left:0}.cute-sort-header-pointer-right{transform-origin:left;right:0}\n"], animations: [
|
|
550
|
-
cuteSortAnimations.indicator,
|
|
551
|
-
cuteSortAnimations.leftPointer,
|
|
552
|
-
cuteSortAnimations.rightPointer,
|
|
553
|
-
cuteSortAnimations.arrowOpacity,
|
|
554
|
-
cuteSortAnimations.arrowPosition,
|
|
555
|
-
cuteSortAnimations.allowChildren,
|
|
556
|
-
], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
380
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteSortHeader, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
381
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.15", type: CuteSortHeader, isStandalone: true, selector: "[cute-sort-header]", inputs: { id: ["cute-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(null)" }, properties: { "attr.aria-sort": "_getAriaSortAttribute()", "class.cute-sort-header-disabled": "_isDisabled()" }, classAttribute: "cute-sort-header" }, exportAs: ["cuteSortHeader"], ngImport: i0, template: "<!--\r\n We set the `tabindex` on an element inside the table header, rather than the header itself,\r\n because of a bug in NVDA where having a `tabindex` on a `th` breaks keyboard navigation in the\r\n table (see https://github.com/nvaccess/nvda/issues/7718). This allows for the header to both\r\n be focusable, and have screen readers read out its `aria-sort` state. We prefer this approach\r\n over having a button with an `aria-label` inside the header, because the button's `aria-label`\r\n will be read out as the user is navigating the table's cell (see #13012).\r\n\r\n The approach is based off of: https://dequeuniversity.com/library/aria/tables/sf-sortable-grid\r\n-->\r\n<div class=\"cute-sort-header-container cute-focus-indicator\"\r\n [class.cute-sort-header-sorted]=\"_isSorted()\"\r\n [class.cute-sort-header-position-before]=\"arrowPosition === 'before'\"\r\n [class.cute-sort-header-descending]=\"_sort.direction === 'desc'\"\r\n [class.cute-sort-header-ascending]=\"_sort.direction === 'asc'\"\r\n [class.cute-sort-header-recently-cleared-ascending]=\"_recentlyCleared() === 'asc'\"\r\n [class.cute-sort-header-recently-cleared-descending]=\"_recentlyCleared() === 'desc'\"\r\n [class.cute-sort-header-animations-disabled]=\"_animationsDisabled\"\r\n [attr.tabindex]=\"_isDisabled() ? null : 0\"\r\n [attr.role]=\"_isDisabled() ? null : 'button'\">\r\n\r\n <!--\r\n TODO(crisbeto): this div isn't strictly necessary, but we have to keep it due to a large\r\n number of screenshot diff failures. It should be removed eventually. Note that the difference\r\n isn't visible with a shorter header, but once it breaks up into multiple lines, this element\r\n causes it to be center-aligned, whereas removing it will keep the text to the left.\r\n -->\r\n <div class=\"cute-sort-header-content\">\r\n <ng-content></ng-content>\r\n </div>\r\n\r\n <!-- Disable animations while a current animation is running -->\r\n @if (_renderArrow()) {\r\n <div class=\"cute-sort-header-arrow\">\r\n <ng-content select=\"[cuteSortHeaderIcon]\">\r\n <svg viewBox=\"0 -960 960 960\" focusable=\"false\" aria-hidden=\"true\">\r\n <path d=\"M440-240v-368L296-464l-56-56 240-240 240 240-56 56-144-144v368h-80Z\"/>\r\n </svg>\r\n </ng-content>\r\n </div>\r\n }\r\n</div>\r\n", styles: [".cute-sort-header{cursor:pointer}.cute-sort-header-disabled{cursor:default}.cute-sort-header-container{display:flex;align-items:center;letter-spacing:normal;outline:0}[cute-sort-header].cdk-keyboard-focused .cute-sort-header-container,[cute-sort-header].cdk-program-focused .cute-sort-header-container{border-bottom:solid 1px currentColor}.cute-sort-header-container:before{margin:calc(calc(var(--cute-focus-indicator-border-width, 1px) + 2px) * -1)}.cute-sort-header-content{display:flex;align-items:center;text-align:center}.cute-sort-header-position-before{flex-direction:row-reverse}@keyframes _cute-sort-header-recently-cleared-ascending{0%{transform:translateY(0);opacity:.68}to{transform:translateY(-25%);opacity:0}}@keyframes _cute-sort-header-recently-cleared-descending{0%{transform:translateY(0) rotate(180deg);opacity:.68}to{transform:translateY(25%) rotate(180deg);opacity:0}}.cute-sort-header-arrow{height:12px;width:12px;min-width:12px;position:relative;transition:transform 225ms cubic-bezier(.4,0,.2,1),opacity 225ms cubic-bezier(.4,0,.2,1);opacity:0;overflow:visible}.cute-sort-header.cdk-keyboard-focused .cute-sort-header-arrow,.cute-sort-header.cdk-program-focused .cute-sort-header-arrow,.cute-sort-header:hover .cute-sort-header-arrow{opacity:.38}.cute-sort-header .cute-sort-header-sorted .cute-sort-header-arrow{opacity:.68}.cute-sort-header-descending .cute-sort-header-arrow{transform:rotate(180deg)}.cute-sort-header-recently-cleared-ascending .cute-sort-header-arrow{transform:translateY(-25%)}.cute-sort-header-recently-cleared-ascending .cute-sort-header-arrow{transition:none;animation:_cute-sort-header-recently-cleared-ascending 225ms cubic-bezier(.4,0,.2,1) forwards}.cute-sort-header-recently-cleared-descending .cute-sort-header-arrow{transition:none;animation:_cute-sort-header-recently-cleared-descending 225ms cubic-bezier(.4,0,.2,1) forwards}.cute-sort-header-animations-disabled .cute-sort-header-arrow{transition-duration:0ms;animation-duration:0ms}.cute-sort-header-arrow>svg,.cute-sort-header-arrow [cuteSortHeaderIcon]{width:24px;height:24px;fill:currentColor;position:absolute;top:50%;left:50%;margin:-12px 0 0 -12px;transform:translateZ(0)}.cute-sort-header-arrow,[dir=rtl] .cute-sort-header-position-before .cute-sort-header-arrow{margin:0 0 0 6px}.cute-sort-header-position-before .cute-sort-header-arrow,[dir=rtl] .cute-sort-header-arrow{margin:0 6px 0 0}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
557
382
|
}
|
|
558
383
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteSortHeader, decorators: [{
|
|
559
384
|
type: Component,
|
|
560
385
|
args: [{ selector: '[cute-sort-header]', exportAs: 'cuteSortHeader', host: {
|
|
561
386
|
'class': 'cute-sort-header',
|
|
562
|
-
'(click)': '
|
|
387
|
+
'(click)': '_toggleOnInteraction()',
|
|
563
388
|
'(keydown)': '_handleKeydown($event)',
|
|
564
|
-
'(
|
|
565
|
-
'(mouseleave)': '_setIndicatorHintVisible(false)',
|
|
389
|
+
'(mouseleave)': '_recentlyCleared.set(null)',
|
|
566
390
|
'[attr.aria-sort]': '_getAriaSortAttribute()',
|
|
567
391
|
'[class.cute-sort-header-disabled]': '_isDisabled()',
|
|
568
|
-
}, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, animations: [
|
|
569
|
-
|
|
570
|
-
cuteSortAnimations.leftPointer,
|
|
571
|
-
cuteSortAnimations.rightPointer,
|
|
572
|
-
cuteSortAnimations.arrowOpacity,
|
|
573
|
-
cuteSortAnimations.arrowPosition,
|
|
574
|
-
cuteSortAnimations.allowChildren,
|
|
575
|
-
], standalone: true, template: "<!--\r\n We set the `tabindex` on an element inside the table header, rather than the header itself,\r\n because of a bug in NVDA where having a `tabindex` on a `th` breaks keyboard navigation in the\r\n table (see https://github.com/nvaccess/nvda/issues/7718). This allows for the header to both\r\n be focusable, and have screen readers read out its `aria-sort` state. We prefer this approach\r\n over having a button with an `aria-label` inside the header, because the button's `aria-label`\r\n will be read out as the user is navigating the table's cell (see #13012).\r\n\r\n The approach is based off of: https://dequeuniversity.com/library/aria/tables/sf-sortable-grid\r\n-->\r\n<div class=\"cute-sort-header-container cute-focus-indicator\"\r\n [class.cute-sort-header-sorted]=\"_isSorted()\"\r\n [class.cute-sort-header-position-before]=\"arrowPosition === 'before'\"\r\n [attr.tabindex]=\"_isDisabled() ? null : 0\"\r\n [attr.role]=\"_isDisabled() ? null : 'button'\">\r\n\r\n <!--\r\n TODO(crisbeto): this div isn't strictly necessary, but we have to keep it due to a large\r\n number of screenshot diff failures. It should be removed eventually. Note that the difference\r\n isn't visible with a shorter header, but once it breaks up into multiple lines, this element\r\n causes it to be center-aligned, whereas removing it will keep the text to the left.\r\n -->\r\n <div class=\"cute-sort-header-content\">\r\n <ng-content></ng-content>\r\n </div>\r\n\r\n <!-- Disable animations while a current animation is running -->\r\n @if (_renderArrow()) {\r\n <div class=\"cute-sort-header-arrow\"\r\n [@arrowOpacity]=\"_getArrowViewState()\"\r\n [@arrowPosition]=\"_getArrowViewState()\"\r\n [@allowChildren]=\"_getArrowDirectionState()\"\r\n (@arrowPosition.start)=\"_disableViewStateAnimation = true\"\r\n (@arrowPosition.done)=\"_disableViewStateAnimation = false\">\r\n <div class=\"cute-sort-header-stem\"></div>\r\n <div class=\"cute-sort-header-indicator\" [@indicator]=\"_getArrowDirectionState()\">\r\n <div class=\"cute-sort-header-pointer-left\" [@leftPointer]=\"_getArrowDirectionState()\"></div>\r\n <div class=\"cute-sort-header-pointer-right\" [@rightPointer]=\"_getArrowDirectionState()\"></div>\r\n <div class=\"cute-sort-header-pointer-middle\"></div>\r\n </div>\r\n </div>\r\n }\r\n</div>\r\n", styles: [".cute-sort-header-container{display:flex;cursor:pointer;align-items:center;letter-spacing:normal;outline:0}[cute-sort-header].cdk-keyboard-focused .cute-sort-header-container,[cute-sort-header].cdk-program-focused .cute-sort-header-container{border-bottom:solid 1px currentColor}.cute-sort-header-disabled .cute-sort-header-container{cursor:default}.cute-sort-header-container:before{margin:calc(calc(var(--cute-focus-indicator-border-width, 1px) + 2px) * -1)}.cute-sort-header-content{text-align:center;display:flex;align-items:center}.cute-sort-header-position-before{flex-direction:row-reverse}.cute-sort-header-arrow{height:12px;width:12px;min-width:12px;position:relative;display:flex;opacity:0}.cute-sort-header-arrow,[dir=rtl] .cute-sort-header-position-before .cute-sort-header-arrow{margin:0 0 0 6px}.cute-sort-header-position-before .cute-sort-header-arrow,[dir=rtl] .cute-sort-header-arrow{margin:0 6px 0 0}.cute-sort-header-stem{background:currentColor;height:10px;width:2px;margin:auto;display:flex;align-items:center}@media (forced-colors: active){.cute-sort-header-stem{width:0;border-left:solid 2px}}.cute-sort-header-indicator{width:100%;height:2px;display:flex;align-items:center;position:absolute;top:0;left:0}.cute-sort-header-pointer-middle{margin:auto;height:2px;width:2px;background:currentColor;transform:rotate(45deg)}@media (forced-colors: active){.cute-sort-header-pointer-middle{width:0;height:0;border-top:solid 2px;border-left:solid 2px}}.cute-sort-header-pointer-left,.cute-sort-header-pointer-right{background:currentColor;width:6px;height:2px;position:absolute;top:0}@media (forced-colors: active){.cute-sort-header-pointer-left,.cute-sort-header-pointer-right{width:0;height:0;border-left:solid 6px;border-top:solid 2px}}.cute-sort-header-pointer-left{transform-origin:right;left:0}.cute-sort-header-pointer-right{transform-origin:left;right:0}\n"] }]
|
|
576
|
-
}], ctorParameters: () => [{ type: CuteSortHeaderIntl }, { type: i0.ChangeDetectorRef }, { type: CuteSort, decorators: [{
|
|
577
|
-
type: Optional
|
|
578
|
-
}] }, { type: undefined, decorators: [{
|
|
579
|
-
type: Inject,
|
|
580
|
-
args: ['CUTE_SORT_HEADER_COLUMN_DEF']
|
|
581
|
-
}, {
|
|
582
|
-
type: Optional
|
|
583
|
-
}] }, { type: i3.FocusMonitor }, { type: i0.ElementRef }, { type: i3.AriaDescriber, decorators: [{
|
|
584
|
-
type: Optional
|
|
585
|
-
}] }, { type: undefined, decorators: [{
|
|
586
|
-
type: Optional
|
|
587
|
-
}, {
|
|
588
|
-
type: Inject,
|
|
589
|
-
args: [CUTE_SORT_DEFAULT_OPTIONS]
|
|
590
|
-
}] }], propDecorators: { id: [{
|
|
392
|
+
}, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<!--\r\n We set the `tabindex` on an element inside the table header, rather than the header itself,\r\n because of a bug in NVDA where having a `tabindex` on a `th` breaks keyboard navigation in the\r\n table (see https://github.com/nvaccess/nvda/issues/7718). This allows for the header to both\r\n be focusable, and have screen readers read out its `aria-sort` state. We prefer this approach\r\n over having a button with an `aria-label` inside the header, because the button's `aria-label`\r\n will be read out as the user is navigating the table's cell (see #13012).\r\n\r\n The approach is based off of: https://dequeuniversity.com/library/aria/tables/sf-sortable-grid\r\n-->\r\n<div class=\"cute-sort-header-container cute-focus-indicator\"\r\n [class.cute-sort-header-sorted]=\"_isSorted()\"\r\n [class.cute-sort-header-position-before]=\"arrowPosition === 'before'\"\r\n [class.cute-sort-header-descending]=\"_sort.direction === 'desc'\"\r\n [class.cute-sort-header-ascending]=\"_sort.direction === 'asc'\"\r\n [class.cute-sort-header-recently-cleared-ascending]=\"_recentlyCleared() === 'asc'\"\r\n [class.cute-sort-header-recently-cleared-descending]=\"_recentlyCleared() === 'desc'\"\r\n [class.cute-sort-header-animations-disabled]=\"_animationsDisabled\"\r\n [attr.tabindex]=\"_isDisabled() ? null : 0\"\r\n [attr.role]=\"_isDisabled() ? null : 'button'\">\r\n\r\n <!--\r\n TODO(crisbeto): this div isn't strictly necessary, but we have to keep it due to a large\r\n number of screenshot diff failures. It should be removed eventually. Note that the difference\r\n isn't visible with a shorter header, but once it breaks up into multiple lines, this element\r\n causes it to be center-aligned, whereas removing it will keep the text to the left.\r\n -->\r\n <div class=\"cute-sort-header-content\">\r\n <ng-content></ng-content>\r\n </div>\r\n\r\n <!-- Disable animations while a current animation is running -->\r\n @if (_renderArrow()) {\r\n <div class=\"cute-sort-header-arrow\">\r\n <ng-content select=\"[cuteSortHeaderIcon]\">\r\n <svg viewBox=\"0 -960 960 960\" focusable=\"false\" aria-hidden=\"true\">\r\n <path d=\"M440-240v-368L296-464l-56-56 240-240 240 240-56 56-144-144v368h-80Z\"/>\r\n </svg>\r\n </ng-content>\r\n </div>\r\n }\r\n</div>\r\n", styles: [".cute-sort-header{cursor:pointer}.cute-sort-header-disabled{cursor:default}.cute-sort-header-container{display:flex;align-items:center;letter-spacing:normal;outline:0}[cute-sort-header].cdk-keyboard-focused .cute-sort-header-container,[cute-sort-header].cdk-program-focused .cute-sort-header-container{border-bottom:solid 1px currentColor}.cute-sort-header-container:before{margin:calc(calc(var(--cute-focus-indicator-border-width, 1px) + 2px) * -1)}.cute-sort-header-content{display:flex;align-items:center;text-align:center}.cute-sort-header-position-before{flex-direction:row-reverse}@keyframes _cute-sort-header-recently-cleared-ascending{0%{transform:translateY(0);opacity:.68}to{transform:translateY(-25%);opacity:0}}@keyframes _cute-sort-header-recently-cleared-descending{0%{transform:translateY(0) rotate(180deg);opacity:.68}to{transform:translateY(25%) rotate(180deg);opacity:0}}.cute-sort-header-arrow{height:12px;width:12px;min-width:12px;position:relative;transition:transform 225ms cubic-bezier(.4,0,.2,1),opacity 225ms cubic-bezier(.4,0,.2,1);opacity:0;overflow:visible}.cute-sort-header.cdk-keyboard-focused .cute-sort-header-arrow,.cute-sort-header.cdk-program-focused .cute-sort-header-arrow,.cute-sort-header:hover .cute-sort-header-arrow{opacity:.38}.cute-sort-header .cute-sort-header-sorted .cute-sort-header-arrow{opacity:.68}.cute-sort-header-descending .cute-sort-header-arrow{transform:rotate(180deg)}.cute-sort-header-recently-cleared-ascending .cute-sort-header-arrow{transform:translateY(-25%)}.cute-sort-header-recently-cleared-ascending .cute-sort-header-arrow{transition:none;animation:_cute-sort-header-recently-cleared-ascending 225ms cubic-bezier(.4,0,.2,1) forwards}.cute-sort-header-recently-cleared-descending .cute-sort-header-arrow{transition:none;animation:_cute-sort-header-recently-cleared-descending 225ms cubic-bezier(.4,0,.2,1) forwards}.cute-sort-header-animations-disabled .cute-sort-header-arrow{transition-duration:0ms;animation-duration:0ms}.cute-sort-header-arrow>svg,.cute-sort-header-arrow [cuteSortHeaderIcon]{width:24px;height:24px;fill:currentColor;position:absolute;top:50%;left:50%;margin:-12px 0 0 -12px;transform:translateZ(0)}.cute-sort-header-arrow,[dir=rtl] .cute-sort-header-position-before .cute-sort-header-arrow{margin:0 0 0 6px}.cute-sort-header-position-before .cute-sort-header-arrow,[dir=rtl] .cute-sort-header-arrow{margin:0 6px 0 0}\n"] }]
|
|
393
|
+
}], ctorParameters: () => [], propDecorators: { id: [{
|
|
591
394
|
type: Input,
|
|
592
395
|
args: ['cute-sort-header']
|
|
593
396
|
}], arrowPosition: [{
|
|
@@ -635,5 +438,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImpo
|
|
|
635
438
|
* Generated bundle index. Do not edit.
|
|
636
439
|
*/
|
|
637
440
|
|
|
638
|
-
export { CUTE_SORT_DEFAULT_OPTIONS, CUTE_SORT_HEADER_INTL_PROVIDER, CUTE_SORT_HEADER_INTL_PROVIDER_FACTORY, CuteSort, CuteSortHeader, CuteSortHeaderIntl, CuteSortModule
|
|
441
|
+
export { CUTE_SORT_DEFAULT_OPTIONS, CUTE_SORT_HEADER_INTL_PROVIDER, CUTE_SORT_HEADER_INTL_PROVIDER_FACTORY, CuteSort, CuteSortHeader, CuteSortHeaderIntl, CuteSortModule };
|
|
639
442
|
//# sourceMappingURL=cute-widgets-base-sort.mjs.map
|