@angular/material 19.2.0-next.0 → 19.2.0-next.2
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/autocomplete/index.d.ts +2 -4
- package/bottom-sheet/index.d.ts +17 -6
- package/button/_button-base.scss +3 -3
- package/checkbox/_checkbox-common.scss +10 -10
- package/core/index.d.ts +1 -0
- package/datepicker/index.d.ts +11 -8
- package/dialog/index.d.ts +5 -1
- package/fesm2022/autocomplete.mjs +19 -45
- package/fesm2022/autocomplete.mjs.map +1 -1
- package/fesm2022/badge.mjs +10 -10
- package/fesm2022/badge.mjs.map +1 -1
- package/fesm2022/bottom-sheet/testing.mjs +1 -1
- package/fesm2022/bottom-sheet/testing.mjs.map +1 -1
- package/fesm2022/bottom-sheet.mjs +79 -50
- package/fesm2022/bottom-sheet.mjs.map +1 -1
- package/fesm2022/button-toggle.mjs +11 -11
- package/fesm2022/button-toggle.mjs.map +1 -1
- package/fesm2022/button.mjs +42 -42
- package/fesm2022/button.mjs.map +1 -1
- package/fesm2022/card.mjs +46 -46
- package/fesm2022/card.mjs.map +1 -1
- package/fesm2022/checkbox.mjs +16 -16
- package/fesm2022/checkbox.mjs.map +1 -1
- package/fesm2022/chips.mjs +45 -46
- package/fesm2022/chips.mjs.map +1 -1
- package/fesm2022/core.mjs +74 -76
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/datepicker.mjs +181 -160
- package/fesm2022/datepicker.mjs.map +1 -1
- package/fesm2022/dialog.mjs +31 -27
- package/fesm2022/dialog.mjs.map +1 -1
- package/fesm2022/divider.mjs +7 -7
- package/fesm2022/divider.mjs.map +1 -1
- package/fesm2022/expansion.mjs +26 -26
- package/fesm2022/expansion.mjs.map +1 -1
- package/fesm2022/form-field.mjs +69 -62
- package/fesm2022/form-field.mjs.map +1 -1
- package/fesm2022/grid-list.mjs +22 -22
- package/fesm2022/grid-list.mjs.map +1 -1
- package/fesm2022/icon/testing.mjs +7 -7
- package/fesm2022/icon/testing.mjs.map +1 -1
- package/fesm2022/icon.mjs +10 -10
- package/fesm2022/icon.mjs.map +1 -1
- package/fesm2022/input.mjs +7 -7
- package/fesm2022/input.mjs.map +1 -1
- package/fesm2022/list.mjs +49 -49
- package/fesm2022/list.mjs.map +1 -1
- package/fesm2022/menu.mjs +27 -30
- package/fesm2022/menu.mjs.map +1 -1
- package/fesm2022/paginator.mjs +10 -10
- package/fesm2022/paginator.mjs.map +1 -1
- package/fesm2022/progress-bar.mjs +7 -7
- package/fesm2022/progress-bar.mjs.map +1 -1
- package/fesm2022/progress-spinner.mjs +7 -7
- package/fesm2022/progress-spinner.mjs.map +1 -1
- package/fesm2022/radio.mjs +10 -10
- package/fesm2022/radio.mjs.map +1 -1
- package/fesm2022/select.mjs +106 -69
- package/fesm2022/select.mjs.map +1 -1
- package/fesm2022/sidenav.mjs +22 -22
- package/fesm2022/sidenav.mjs.map +1 -1
- package/fesm2022/slide-toggle.mjs +14 -14
- package/fesm2022/slide-toggle.mjs.map +1 -1
- package/fesm2022/slider.mjs +16 -16
- package/fesm2022/slider.mjs.map +1 -1
- package/fesm2022/snack-bar.mjs +134 -91
- package/fesm2022/snack-bar.mjs.map +1 -1
- package/fesm2022/sort.mjs +13 -13
- package/fesm2022/sort.mjs.map +1 -1
- package/fesm2022/stepper.mjs +31 -31
- package/fesm2022/stepper.mjs.map +1 -1
- package/fesm2022/table.mjs +55 -55
- package/fesm2022/table.mjs.map +1 -1
- package/fesm2022/tabs.mjs +43 -43
- package/fesm2022/tabs.mjs.map +1 -1
- package/fesm2022/timepicker.mjs +36 -43
- package/fesm2022/timepicker.mjs.map +1 -1
- package/fesm2022/toolbar.mjs +10 -10
- package/fesm2022/toolbar.mjs.map +1 -1
- package/fesm2022/tooltip.mjs +10 -10
- package/fesm2022/tooltip.mjs.map +1 -1
- package/fesm2022/tree.mjs +25 -25
- package/fesm2022/tree.mjs.map +1 -1
- package/form-field/_form-field-subscript.scss +18 -0
- package/form-field/_mdc-text-field-structure.scss +6 -3
- package/form-field/index.d.ts +5 -4
- package/menu/index.d.ts +1 -5
- package/package.json +2 -2
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-add/index.mjs +1 -1
- package/select/index.d.ts +10 -8
- package/snack-bar/index.d.ts +8 -6
- package/timepicker/index.d.ts +4 -1
package/autocomplete/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ActiveDescendantKeyManager } from '@angular/cdk/a11y';
|
|
2
2
|
import { AfterContentInit } from '@angular/core';
|
|
3
3
|
import { AfterViewInit } from '@angular/core';
|
|
4
|
-
import { AnimationEvent as AnimationEvent_2 } from '@angular/animations';
|
|
5
4
|
import { ControlValueAccessor } from '@angular/forms';
|
|
6
5
|
import { ElementRef } from '@angular/core';
|
|
7
6
|
import { EventEmitter } from '@angular/core';
|
|
@@ -87,9 +86,8 @@ export declare class MatAutocomplete implements AfterContentInit, OnDestroy {
|
|
|
87
86
|
private _changeDetectorRef;
|
|
88
87
|
private _elementRef;
|
|
89
88
|
protected _defaults: MatAutocompleteDefaultOptions;
|
|
89
|
+
protected _animationsDisabled: boolean;
|
|
90
90
|
private _activeOptionChanges;
|
|
91
|
-
/** Emits when the panel animation is done. Null if the panel doesn't animate. */
|
|
92
|
-
_animationDone: EventEmitter<AnimationEvent_2>;
|
|
93
91
|
/** Manages active item in option list based on key events. */
|
|
94
92
|
_keyManager: ActiveDescendantKeyManager<MatOption>;
|
|
95
93
|
/** Whether the autocomplete panel should be visible, depending on option length. */
|
|
@@ -248,7 +246,7 @@ export declare class MatAutocompleteSelectedEvent {
|
|
|
248
246
|
|
|
249
247
|
/** Base class with all of the `MatAutocompleteTrigger` functionality. */
|
|
250
248
|
export declare class MatAutocompleteTrigger implements ControlValueAccessor, AfterViewInit, OnChanges, OnDestroy {
|
|
251
|
-
private
|
|
249
|
+
private _environmentInjector;
|
|
252
250
|
private _element;
|
|
253
251
|
private _overlay;
|
|
254
252
|
private _viewContainerRef;
|
package/bottom-sheet/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { AnimationEvent as AnimationEvent_2 } from '@angular/animations';
|
|
2
1
|
import { AnimationTriggerMetadata } from '@angular/animations';
|
|
3
2
|
import { CdkDialogContainer } from '@angular/cdk/dialog';
|
|
4
3
|
import { ComponentRef } from '@angular/core';
|
|
@@ -69,7 +68,11 @@ export declare class MatBottomSheet implements OnDestroy {
|
|
|
69
68
|
static ɵprov: i0.ɵɵInjectableDeclaration<MatBottomSheet>;
|
|
70
69
|
}
|
|
71
70
|
|
|
72
|
-
/**
|
|
71
|
+
/**
|
|
72
|
+
* Animations used by the Material bottom sheet.
|
|
73
|
+
* @deprecated No longer used. Will be removed.
|
|
74
|
+
* @breaking-change 21.0.0
|
|
75
|
+
*/
|
|
73
76
|
export declare const matBottomSheetAnimations: {
|
|
74
77
|
readonly bottomSheetState: AnimationTriggerMetadata;
|
|
75
78
|
};
|
|
@@ -94,7 +97,11 @@ export declare class MatBottomSheetConfig<D = any> {
|
|
|
94
97
|
disableClose?: boolean;
|
|
95
98
|
/** Aria label to assign to the bottom sheet element. */
|
|
96
99
|
ariaLabel?: string | null;
|
|
97
|
-
/**
|
|
100
|
+
/**
|
|
101
|
+
* Whether this is a modal dialog. Used to set the `aria-modal` attribute. Off by default,
|
|
102
|
+
* because it can interfere with other overlay-based components (e.g. `mat-select`) and because
|
|
103
|
+
* it is redundant since the dialog marks all outside content as `aria-hidden` anyway.
|
|
104
|
+
*/
|
|
98
105
|
ariaModal?: boolean;
|
|
99
106
|
/**
|
|
100
107
|
* Whether the bottom sheet should close when the user goes backwards/forwards in history.
|
|
@@ -129,10 +136,14 @@ export declare class MatBottomSheetConfig<D = any> {
|
|
|
129
136
|
*/
|
|
130
137
|
export declare class MatBottomSheetContainer extends CdkDialogContainer implements OnDestroy {
|
|
131
138
|
private _breakpointSubscription;
|
|
139
|
+
protected _animationsDisabled: boolean;
|
|
132
140
|
/** The state of the bottom sheet animations. */
|
|
133
141
|
_animationState: 'void' | 'visible' | 'hidden';
|
|
134
142
|
/** Emits whenever the state of the animation changes. */
|
|
135
|
-
_animationStateChanged: EventEmitter<
|
|
143
|
+
_animationStateChanged: EventEmitter<{
|
|
144
|
+
toState: "visible" | "hidden";
|
|
145
|
+
phase: "start" | "done";
|
|
146
|
+
}>;
|
|
136
147
|
/** Whether the component has been destroyed. */
|
|
137
148
|
private _destroyed;
|
|
138
149
|
constructor(...args: unknown[]);
|
|
@@ -141,8 +152,8 @@ export declare class MatBottomSheetContainer extends CdkDialogContainer implemen
|
|
|
141
152
|
/** Begin animation of the bottom sheet exiting from view. */
|
|
142
153
|
exit(): void;
|
|
143
154
|
ngOnDestroy(): void;
|
|
144
|
-
|
|
145
|
-
|
|
155
|
+
private _simulateAnimation;
|
|
156
|
+
protected _handleAnimationEvent(isStart: boolean, animationName: string): void;
|
|
146
157
|
protected _captureInitialFocus(): void;
|
|
147
158
|
static ɵfac: i0.ɵɵFactoryDeclaration<MatBottomSheetContainer, never>;
|
|
148
159
|
static ɵcmp: i0.ɵɵComponentDeclaration<MatBottomSheetContainer, "mat-bottom-sheet-container", never, {}, {}, never, never, true, never>;
|
package/button/_button-base.scss
CHANGED
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
@include layout-common.fill();
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
&:focus .mat-focus-indicator::before {
|
|
55
|
+
&:focus > .mat-focus-indicator::before {
|
|
56
56
|
content: '';
|
|
57
57
|
}
|
|
58
58
|
}
|
|
@@ -78,12 +78,12 @@
|
|
|
78
78
|
&.cdk-program-focused,
|
|
79
79
|
&.cdk-keyboard-focused,
|
|
80
80
|
&.mat-mdc-button-disabled-interactive:focus {
|
|
81
|
-
.mat-mdc-button-persistent-ripple::before {
|
|
81
|
+
> .mat-mdc-button-persistent-ripple::before {
|
|
82
82
|
@include token-utils.create-token-slot(opacity, focus-state-layer-opacity);
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
&:active .mat-mdc-button-persistent-ripple::before {
|
|
86
|
+
&:active > .mat-mdc-button-persistent-ripple::before {
|
|
87
87
|
@include token-utils.create-token-slot(opacity, pressed-state-layer-opacity);
|
|
88
88
|
}
|
|
89
89
|
}
|
|
@@ -457,7 +457,7 @@ $_fallback-size: 40px;
|
|
|
457
457
|
// MDC expects `.mdc-checkbox__ripple::before` to be the state layer, but we use
|
|
458
458
|
// `.mdc-checkbox__ripple` instead, so we emit the state layer slots ourselves.
|
|
459
459
|
&:hover {
|
|
460
|
-
.mdc-checkbox__ripple {
|
|
460
|
+
> .mdc-checkbox__ripple {
|
|
461
461
|
@include token-utils.create-token-slot(opacity, unselected-hover-state-layer-opacity);
|
|
462
462
|
@include token-utils.create-token-slot(
|
|
463
463
|
background-color,
|
|
@@ -465,7 +465,7 @@ $_fallback-size: 40px;
|
|
|
465
465
|
);
|
|
466
466
|
}
|
|
467
467
|
|
|
468
|
-
.mat-mdc-checkbox-ripple .mat-ripple-element {
|
|
468
|
+
> .mat-mdc-checkbox-ripple .mat-ripple-element {
|
|
469
469
|
@include token-utils.create-token-slot(
|
|
470
470
|
background-color,
|
|
471
471
|
unselected-hover-state-layer-color
|
|
@@ -474,7 +474,7 @@ $_fallback-size: 40px;
|
|
|
474
474
|
}
|
|
475
475
|
|
|
476
476
|
.mdc-checkbox__native-control:focus {
|
|
477
|
-
&
|
|
477
|
+
& + .mdc-checkbox__ripple {
|
|
478
478
|
@include token-utils.create-token-slot(opacity, unselected-focus-state-layer-opacity);
|
|
479
479
|
@include token-utils.create-token-slot(
|
|
480
480
|
background-color,
|
|
@@ -490,8 +490,8 @@ $_fallback-size: 40px;
|
|
|
490
490
|
}
|
|
491
491
|
}
|
|
492
492
|
|
|
493
|
-
&:active .mdc-checkbox__native-control {
|
|
494
|
-
&
|
|
493
|
+
&:active > .mdc-checkbox__native-control {
|
|
494
|
+
& + .mdc-checkbox__ripple {
|
|
495
495
|
@include token-utils.create-token-slot(opacity, unselected-pressed-state-layer-opacity);
|
|
496
496
|
@include token-utils.create-token-slot(
|
|
497
497
|
background-color,
|
|
@@ -508,7 +508,7 @@ $_fallback-size: 40px;
|
|
|
508
508
|
}
|
|
509
509
|
|
|
510
510
|
&:hover .mdc-checkbox__native-control:checked {
|
|
511
|
-
&
|
|
511
|
+
& + .mdc-checkbox__ripple {
|
|
512
512
|
@include token-utils.create-token-slot(opacity, selected-hover-state-layer-opacity);
|
|
513
513
|
@include token-utils.create-token-slot(
|
|
514
514
|
background-color,
|
|
@@ -525,7 +525,7 @@ $_fallback-size: 40px;
|
|
|
525
525
|
}
|
|
526
526
|
|
|
527
527
|
.mdc-checkbox__native-control:focus:checked {
|
|
528
|
-
&
|
|
528
|
+
& + .mdc-checkbox__ripple {
|
|
529
529
|
@include token-utils.create-token-slot(opacity, selected-focus-state-layer-opacity);
|
|
530
530
|
@include token-utils.create-token-slot(
|
|
531
531
|
background-color,
|
|
@@ -541,8 +541,8 @@ $_fallback-size: 40px;
|
|
|
541
541
|
}
|
|
542
542
|
}
|
|
543
543
|
|
|
544
|
-
&:active .mdc-checkbox__native-control:checked {
|
|
545
|
-
&
|
|
544
|
+
&:active > .mdc-checkbox__native-control:checked {
|
|
545
|
+
& + .mdc-checkbox__ripple {
|
|
546
546
|
@include token-utils.create-token-slot(opacity, selected-pressed-state-layer-opacity);
|
|
547
547
|
@include token-utils.create-token-slot(
|
|
548
548
|
background-color,
|
|
@@ -561,7 +561,7 @@ $_fallback-size: 40px;
|
|
|
561
561
|
// Needs extra specificity to override the focus, hover, active states.
|
|
562
562
|
.mdc-checkbox--disabled.mat-mdc-checkbox-disabled-interactive & {
|
|
563
563
|
.mdc-checkbox__native-control ~ .mat-mdc-checkbox-ripple .mat-ripple-element,
|
|
564
|
-
.mdc-checkbox__native-control
|
|
564
|
+
.mdc-checkbox__native-control + .mdc-checkbox__ripple {
|
|
565
565
|
@include token-utils.create-token-slot(
|
|
566
566
|
background-color,
|
|
567
567
|
unselected-hover-state-layer-color
|
package/core/index.d.ts
CHANGED
package/datepicker/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { AbstractControl } from '@angular/forms';
|
|
|
2
2
|
import { AfterContentInit } from '@angular/core';
|
|
3
3
|
import { AfterViewChecked } from '@angular/core';
|
|
4
4
|
import { AfterViewInit } from '@angular/core';
|
|
5
|
-
import { AnimationEvent as AnimationEvent_2 } from '@angular/animations';
|
|
6
5
|
import { AnimationTriggerMetadata } from '@angular/animations';
|
|
7
6
|
import { ChangeDetectorRef } from '@angular/core';
|
|
8
7
|
import { ComponentType } from '@angular/cdk/portal';
|
|
@@ -386,6 +385,7 @@ export declare class MatCalendarBody<D = any> implements OnChanges, OnDestroy, A
|
|
|
386
385
|
private _ngZone;
|
|
387
386
|
private _platform;
|
|
388
387
|
private _intl;
|
|
388
|
+
private _eventCleanups;
|
|
389
389
|
/**
|
|
390
390
|
* Used to skip the next focus event when rendering the preview range.
|
|
391
391
|
* We need a flag like this, because some browsers fire focus events asynchronously.
|
|
@@ -660,6 +660,8 @@ export declare class MatDatepickerActions implements AfterViewInit, OnDestroy {
|
|
|
660
660
|
/**
|
|
661
661
|
* Animations used by the Material datepicker.
|
|
662
662
|
* @docs-private
|
|
663
|
+
* @deprecated No longer used, will be removed.
|
|
664
|
+
* @breaking-change 21.0.0
|
|
663
665
|
*/
|
|
664
666
|
export declare const matDatepickerAnimations: {
|
|
665
667
|
readonly transformPanel: AnimationTriggerMetadata;
|
|
@@ -843,14 +845,18 @@ export declare class MatDatepickerCancel {
|
|
|
843
845
|
* future. (e.g. confirmation buttons).
|
|
844
846
|
* @docs-private
|
|
845
847
|
*/
|
|
846
|
-
export declare class MatDatepickerContent<S, D = ExtractDateTypeFromSelection<S>> implements
|
|
847
|
-
protected _elementRef: ElementRef<
|
|
848
|
+
export declare class MatDatepickerContent<S, D = ExtractDateTypeFromSelection<S>> implements AfterViewInit, OnDestroy {
|
|
849
|
+
protected _elementRef: ElementRef<HTMLElement>;
|
|
850
|
+
protected _animationsDisabled: boolean;
|
|
848
851
|
private _changeDetectorRef;
|
|
849
852
|
private _globalModel;
|
|
850
853
|
private _dateAdapter;
|
|
854
|
+
private _ngZone;
|
|
851
855
|
private _rangeSelectionStrategy;
|
|
852
|
-
private
|
|
856
|
+
private _stateChanges;
|
|
853
857
|
private _model;
|
|
858
|
+
private _eventCleanups;
|
|
859
|
+
private _animationFallback;
|
|
854
860
|
/** Reference to the internal calendar component. */
|
|
855
861
|
_calendar: MatCalendar<D>;
|
|
856
862
|
/**
|
|
@@ -873,8 +879,6 @@ export declare class MatDatepickerContent<S, D = ExtractDateTypeFromSelection<S>
|
|
|
873
879
|
endDateAccessibleName: string | null;
|
|
874
880
|
/** Whether the datepicker is above or below the input. */
|
|
875
881
|
_isAbove: boolean;
|
|
876
|
-
/** Current state of the animation. */
|
|
877
|
-
_animationState: 'enter-dropdown' | 'enter-dialog' | 'void';
|
|
878
882
|
/** Emits when an animation has finished. */
|
|
879
883
|
readonly _animationDone: Subject<void>;
|
|
880
884
|
/** Whether there is an in-progress animation. */
|
|
@@ -888,13 +892,12 @@ export declare class MatDatepickerContent<S, D = ExtractDateTypeFromSelection<S>
|
|
|
888
892
|
/** Id of the label for the `role="dialog"` element. */
|
|
889
893
|
_dialogLabelId: string | null;
|
|
890
894
|
constructor(...args: unknown[]);
|
|
891
|
-
ngOnInit(): void;
|
|
892
895
|
ngAfterViewInit(): void;
|
|
893
896
|
ngOnDestroy(): void;
|
|
894
897
|
_handleUserSelection(event: MatCalendarUserEvent<D | null>): void;
|
|
895
898
|
_handleUserDragDrop(event: MatCalendarUserEvent<DateRange<D>>): void;
|
|
896
899
|
_startExitAnimation(): void;
|
|
897
|
-
_handleAnimationEvent
|
|
900
|
+
private _handleAnimationEvent;
|
|
898
901
|
_getSelected(): D | DateRange<D> | null;
|
|
899
902
|
/** Applies the current pending selection to the global model. */
|
|
900
903
|
_applyPendingSelection(): void;
|
package/dialog/index.d.ts
CHANGED
|
@@ -272,7 +272,11 @@ export declare class MatDialogConfig<D = any> {
|
|
|
272
272
|
ariaLabelledBy?: string | null;
|
|
273
273
|
/** Aria label to assign to the dialog element. */
|
|
274
274
|
ariaLabel?: string | null;
|
|
275
|
-
/**
|
|
275
|
+
/**
|
|
276
|
+
* Whether this is a modal dialog. Used to set the `aria-modal` attribute. Off by default,
|
|
277
|
+
* because it can interfere with other overlay-based components (e.g. `mat-select`) and because
|
|
278
|
+
* it is redundant since the dialog marks all outside content as `aria-hidden` anyway.
|
|
279
|
+
*/
|
|
276
280
|
ariaModal?: boolean;
|
|
277
281
|
/**
|
|
278
282
|
* Where the dialog should focus on open.
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, inject, ChangeDetectorRef, ElementRef, EventEmitter, booleanAttribute, TemplateRef, Component, ViewEncapsulation, ChangeDetectionStrategy, ViewChild, ContentChildren, Input, Output, Directive, forwardRef,
|
|
2
|
+
import { InjectionToken, inject, ChangeDetectorRef, ElementRef, ANIMATION_MODULE_TYPE, EventEmitter, booleanAttribute, TemplateRef, Component, ViewEncapsulation, ChangeDetectionStrategy, ViewChild, ContentChildren, Input, Output, Directive, forwardRef, EnvironmentInjector, ViewContainerRef, NgZone, Renderer2, afterNextRender, NgModule } from '@angular/core';
|
|
3
3
|
import { MAT_OPTION_PARENT_COMPONENT, MatOption, MAT_OPTGROUP, MatOptionSelectionChange, _countGroupLabelsBeforeOption, _getOptionScrollPosition, MatOptionModule, MatCommonModule } from '@angular/material/core';
|
|
4
4
|
export { MatOptgroup, MatOption } from '@angular/material/core';
|
|
5
5
|
import { ViewportRuler, CdkScrollableModule } from '@angular/cdk/scrolling';
|
|
6
6
|
import { Overlay, OverlayConfig, OverlayModule } from '@angular/cdk/overlay';
|
|
7
7
|
import { _IdGenerator, ActiveDescendantKeyManager, removeAriaReferencedId, addAriaReferencedId } from '@angular/cdk/a11y';
|
|
8
8
|
import { Platform, _getEventTarget } from '@angular/cdk/platform';
|
|
9
|
-
import { trigger, state, style, transition, group, animate } from '@angular/animations';
|
|
10
9
|
import { Subscription, Subject, merge, of, defer, Observable } from 'rxjs';
|
|
11
10
|
import { Directionality } from '@angular/cdk/bidi';
|
|
12
11
|
import { hasModifierKey, ESCAPE, ENTER, UP_ARROW, DOWN_ARROW, TAB } from '@angular/cdk/keycodes';
|
|
@@ -17,22 +16,6 @@ import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
|
17
16
|
import { MAT_FORM_FIELD } from '@angular/material/form-field';
|
|
18
17
|
import { filter, map, startWith, switchMap, tap, delay, take } from 'rxjs/operators';
|
|
19
18
|
|
|
20
|
-
// Animation values come from
|
|
21
|
-
// TODO(mmalerba): Ideally find a way to import the values from MDC's code.
|
|
22
|
-
const panelAnimation = trigger('panelAnimation', [
|
|
23
|
-
state('void, hidden', style({
|
|
24
|
-
opacity: 0,
|
|
25
|
-
transform: 'scaleY(0.8)',
|
|
26
|
-
})),
|
|
27
|
-
transition(':enter, hidden => visible', [
|
|
28
|
-
group([
|
|
29
|
-
animate('0.03s linear', style({ opacity: 1 })),
|
|
30
|
-
animate('0.12s cubic-bezier(0, 0, 0.2, 1)', style({ transform: 'scaleY(1)' })),
|
|
31
|
-
]),
|
|
32
|
-
]),
|
|
33
|
-
transition(':leave, visible => hidden', [animate('0.075s linear', style({ opacity: 0 }))]),
|
|
34
|
-
]);
|
|
35
|
-
|
|
36
19
|
/** Event object that is emitted when an autocomplete option is selected. */
|
|
37
20
|
class MatAutocompleteSelectedEvent {
|
|
38
21
|
source;
|
|
@@ -65,9 +48,8 @@ class MatAutocomplete {
|
|
|
65
48
|
_changeDetectorRef = inject(ChangeDetectorRef);
|
|
66
49
|
_elementRef = inject(ElementRef);
|
|
67
50
|
_defaults = inject(MAT_AUTOCOMPLETE_DEFAULT_OPTIONS);
|
|
51
|
+
_animationsDisabled = inject(ANIMATION_MODULE_TYPE, { optional: true }) === 'NoopAnimations';
|
|
68
52
|
_activeOptionChanges = Subscription.EMPTY;
|
|
69
|
-
/** Emits when the panel animation is done. Null if the panel doesn't animate. */
|
|
70
|
-
_animationDone = new EventEmitter();
|
|
71
53
|
/** Manages active item in option list based on key events. */
|
|
72
54
|
_keyManager;
|
|
73
55
|
/** Whether the autocomplete panel should be visible, depending on option length. */
|
|
@@ -192,7 +174,6 @@ class MatAutocomplete {
|
|
|
192
174
|
ngOnDestroy() {
|
|
193
175
|
this._keyManager?.destroy();
|
|
194
176
|
this._activeOptionChanges.unsubscribe();
|
|
195
|
-
this._animationDone.complete();
|
|
196
177
|
}
|
|
197
178
|
/**
|
|
198
179
|
* Sets the panel scrollTop. This allows us to manually scroll to display options
|
|
@@ -242,14 +223,14 @@ class MatAutocomplete {
|
|
|
242
223
|
_skipPredicate() {
|
|
243
224
|
return false;
|
|
244
225
|
}
|
|
245
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.
|
|
246
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "19.1.
|
|
226
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: MatAutocomplete, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
227
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "19.1.3", type: MatAutocomplete, isStandalone: true, selector: "mat-autocomplete", inputs: { ariaLabel: ["aria-label", "ariaLabel"], ariaLabelledby: ["aria-labelledby", "ariaLabelledby"], displayWith: "displayWith", autoActiveFirstOption: ["autoActiveFirstOption", "autoActiveFirstOption", booleanAttribute], autoSelectActiveOption: ["autoSelectActiveOption", "autoSelectActiveOption", booleanAttribute], requireSelection: ["requireSelection", "requireSelection", booleanAttribute], panelWidth: "panelWidth", disableRipple: ["disableRipple", "disableRipple", booleanAttribute], classList: ["class", "classList"], hideSingleSelectionIndicator: ["hideSingleSelectionIndicator", "hideSingleSelectionIndicator", booleanAttribute] }, outputs: { optionSelected: "optionSelected", opened: "opened", closed: "closed", optionActivated: "optionActivated" }, host: { classAttribute: "mat-mdc-autocomplete" }, providers: [{ provide: MAT_OPTION_PARENT_COMPONENT, useExisting: MatAutocomplete }], queries: [{ propertyName: "options", predicate: MatOption, descendants: true }, { propertyName: "optionGroups", predicate: MAT_OPTGROUP, descendants: true }], viewQueries: [{ propertyName: "template", first: true, predicate: TemplateRef, descendants: true, static: true }, { propertyName: "panel", first: true, predicate: ["panel"], descendants: true }], exportAs: ["matAutocomplete"], ngImport: i0, template: "<ng-template let-formFieldId=\"id\">\n <div\n class=\"mat-mdc-autocomplete-panel mdc-menu-surface mdc-menu-surface--open\"\n role=\"listbox\"\n [id]=\"id\"\n [class]=\"_classList\"\n [class.mat-mdc-autocomplete-visible]=\"showPanel\"\n [class.mat-mdc-autocomplete-hidden]=\"!showPanel\"\n [class.mat-autocomplete-panel-animations-enabled]=\"!_animationsDisabled\"\n [class.mat-primary]=\"_color === 'primary'\"\n [class.mat-accent]=\"_color === 'accent'\"\n [class.mat-warn]=\"_color === 'warn'\"\n [attr.aria-label]=\"ariaLabel || null\"\n [attr.aria-labelledby]=\"_getPanelAriaLabelledby(formFieldId)\"\n #panel>\n <ng-content></ng-content>\n </div>\n</ng-template>\n", styles: ["div.mat-mdc-autocomplete-panel{width:100%;max-height:256px;visibility:hidden;transform-origin:center top;overflow:auto;padding:8px 0;box-sizing:border-box;position:static;border-radius:var(--mat-autocomplete-container-shape, var(--mat-sys-corner-extra-small));box-shadow:var(--mat-autocomplete-container-elevation-shadow, 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12));background-color:var(--mat-autocomplete-background-color, var(--mat-sys-surface-container))}@media(forced-colors: active){div.mat-mdc-autocomplete-panel{outline:solid 1px}}.cdk-overlay-pane:not(.mat-mdc-autocomplete-panel-above) div.mat-mdc-autocomplete-panel{border-top-left-radius:0;border-top-right-radius:0}.mat-mdc-autocomplete-panel-above div.mat-mdc-autocomplete-panel{border-bottom-left-radius:0;border-bottom-right-radius:0;transform-origin:center bottom}div.mat-mdc-autocomplete-panel.mat-mdc-autocomplete-visible{visibility:visible}div.mat-mdc-autocomplete-panel.mat-mdc-autocomplete-hidden{visibility:hidden;pointer-events:none}@keyframes _mat-autocomplete-enter{from{opacity:0;transform:scaleY(0.8)}to{opacity:1;transform:none}}.mat-autocomplete-panel-animations-enabled{animation:_mat-autocomplete-enter 120ms cubic-bezier(0, 0, 0.2, 1)}mat-autocomplete{display:none}"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
247
228
|
}
|
|
248
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.
|
|
229
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: MatAutocomplete, decorators: [{
|
|
249
230
|
type: Component,
|
|
250
231
|
args: [{ selector: 'mat-autocomplete', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, exportAs: 'matAutocomplete', host: {
|
|
251
232
|
'class': 'mat-mdc-autocomplete',
|
|
252
|
-
}, providers: [{ provide: MAT_OPTION_PARENT_COMPONENT, useExisting: MatAutocomplete }],
|
|
233
|
+
}, providers: [{ provide: MAT_OPTION_PARENT_COMPONENT, useExisting: MatAutocomplete }], template: "<ng-template let-formFieldId=\"id\">\n <div\n class=\"mat-mdc-autocomplete-panel mdc-menu-surface mdc-menu-surface--open\"\n role=\"listbox\"\n [id]=\"id\"\n [class]=\"_classList\"\n [class.mat-mdc-autocomplete-visible]=\"showPanel\"\n [class.mat-mdc-autocomplete-hidden]=\"!showPanel\"\n [class.mat-autocomplete-panel-animations-enabled]=\"!_animationsDisabled\"\n [class.mat-primary]=\"_color === 'primary'\"\n [class.mat-accent]=\"_color === 'accent'\"\n [class.mat-warn]=\"_color === 'warn'\"\n [attr.aria-label]=\"ariaLabel || null\"\n [attr.aria-labelledby]=\"_getPanelAriaLabelledby(formFieldId)\"\n #panel>\n <ng-content></ng-content>\n </div>\n</ng-template>\n", styles: ["div.mat-mdc-autocomplete-panel{width:100%;max-height:256px;visibility:hidden;transform-origin:center top;overflow:auto;padding:8px 0;box-sizing:border-box;position:static;border-radius:var(--mat-autocomplete-container-shape, var(--mat-sys-corner-extra-small));box-shadow:var(--mat-autocomplete-container-elevation-shadow, 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12));background-color:var(--mat-autocomplete-background-color, var(--mat-sys-surface-container))}@media(forced-colors: active){div.mat-mdc-autocomplete-panel{outline:solid 1px}}.cdk-overlay-pane:not(.mat-mdc-autocomplete-panel-above) div.mat-mdc-autocomplete-panel{border-top-left-radius:0;border-top-right-radius:0}.mat-mdc-autocomplete-panel-above div.mat-mdc-autocomplete-panel{border-bottom-left-radius:0;border-bottom-right-radius:0;transform-origin:center bottom}div.mat-mdc-autocomplete-panel.mat-mdc-autocomplete-visible{visibility:visible}div.mat-mdc-autocomplete-panel.mat-mdc-autocomplete-hidden{visibility:hidden;pointer-events:none}@keyframes _mat-autocomplete-enter{from{opacity:0;transform:scaleY(0.8)}to{opacity:1;transform:none}}.mat-autocomplete-panel-animations-enabled{animation:_mat-autocomplete-enter 120ms cubic-bezier(0, 0, 0.2, 1)}mat-autocomplete{display:none}"] }]
|
|
253
234
|
}], ctorParameters: () => [], propDecorators: { template: [{
|
|
254
235
|
type: ViewChild,
|
|
255
236
|
args: [TemplateRef, { static: true }]
|
|
@@ -307,10 +288,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-rc.0", ng
|
|
|
307
288
|
class MatAutocompleteOrigin {
|
|
308
289
|
elementRef = inject(ElementRef);
|
|
309
290
|
constructor() { }
|
|
310
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.
|
|
311
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.
|
|
291
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: MatAutocompleteOrigin, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
292
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.3", type: MatAutocompleteOrigin, isStandalone: true, selector: "[matAutocompleteOrigin]", exportAs: ["matAutocompleteOrigin"], ngImport: i0 });
|
|
312
293
|
}
|
|
313
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.
|
|
294
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: MatAutocompleteOrigin, decorators: [{
|
|
314
295
|
type: Directive,
|
|
315
296
|
args: [{
|
|
316
297
|
selector: '[matAutocompleteOrigin]',
|
|
@@ -356,7 +337,7 @@ const MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY_PROVIDER = {
|
|
|
356
337
|
};
|
|
357
338
|
/** Base class with all of the `MatAutocompleteTrigger` functionality. */
|
|
358
339
|
class MatAutocompleteTrigger {
|
|
359
|
-
|
|
340
|
+
_environmentInjector = inject(EnvironmentInjector);
|
|
360
341
|
_element = inject(ElementRef);
|
|
361
342
|
_overlay = inject(Overlay);
|
|
362
343
|
_viewContainerRef = inject(ViewContainerRef);
|
|
@@ -745,7 +726,7 @@ class MatAutocompleteTrigger {
|
|
|
745
726
|
const initialRender = new Observable(subscriber => {
|
|
746
727
|
afterNextRender(() => {
|
|
747
728
|
subscriber.next();
|
|
748
|
-
}, { injector: this.
|
|
729
|
+
}, { injector: this._environmentInjector });
|
|
749
730
|
});
|
|
750
731
|
const optionChanges = this.autocomplete.options.changes.pipe(tap(() => this._positionStrategy.reapplyLastPosition()),
|
|
751
732
|
// Defer emitting to the stream until the next tick, because changing
|
|
@@ -851,14 +832,7 @@ class MatAutocompleteTrigger {
|
|
|
851
832
|
this._element.nativeElement.value !== this._valueOnAttach) {
|
|
852
833
|
this._clearPreviousSelectedOption(null);
|
|
853
834
|
this._assignOptionValue(null);
|
|
854
|
-
|
|
855
|
-
// the options might change while the animation is running which looks glitchy.
|
|
856
|
-
if (panel._animationDone) {
|
|
857
|
-
panel._animationDone.pipe(take(1)).subscribe(() => this._onChange(null));
|
|
858
|
-
}
|
|
859
|
-
else {
|
|
860
|
-
this._onChange(null);
|
|
861
|
-
}
|
|
835
|
+
this._onChange(null);
|
|
862
836
|
}
|
|
863
837
|
this.closePanel();
|
|
864
838
|
}
|
|
@@ -1161,10 +1135,10 @@ class MatAutocompleteTrigger {
|
|
|
1161
1135
|
this._trackedModal = null;
|
|
1162
1136
|
}
|
|
1163
1137
|
}
|
|
1164
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.
|
|
1165
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "19.1.
|
|
1138
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: MatAutocompleteTrigger, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1139
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "19.1.3", type: MatAutocompleteTrigger, isStandalone: true, selector: "input[matAutocomplete], textarea[matAutocomplete]", inputs: { autocomplete: ["matAutocomplete", "autocomplete"], position: ["matAutocompletePosition", "position"], connectedTo: ["matAutocompleteConnectedTo", "connectedTo"], autocompleteAttribute: ["autocomplete", "autocompleteAttribute"], autocompleteDisabled: ["matAutocompleteDisabled", "autocompleteDisabled", booleanAttribute] }, host: { listeners: { "focusin": "_handleFocus()", "blur": "_onTouched()", "input": "_handleInput($event)", "keydown": "_handleKeydown($event)", "click": "_handleClick()" }, properties: { "attr.autocomplete": "autocompleteAttribute", "attr.role": "autocompleteDisabled ? null : \"combobox\"", "attr.aria-autocomplete": "autocompleteDisabled ? null : \"list\"", "attr.aria-activedescendant": "(panelOpen && activeOption) ? activeOption.id : null", "attr.aria-expanded": "autocompleteDisabled ? null : panelOpen.toString()", "attr.aria-controls": "(autocompleteDisabled || !panelOpen) ? null : autocomplete?.id", "attr.aria-haspopup": "autocompleteDisabled ? null : \"listbox\"" }, classAttribute: "mat-mdc-autocomplete-trigger" }, providers: [MAT_AUTOCOMPLETE_VALUE_ACCESSOR], exportAs: ["matAutocompleteTrigger"], usesOnChanges: true, ngImport: i0 });
|
|
1166
1140
|
}
|
|
1167
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.
|
|
1141
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: MatAutocompleteTrigger, decorators: [{
|
|
1168
1142
|
type: Directive,
|
|
1169
1143
|
args: [{
|
|
1170
1144
|
selector: `input[matAutocomplete], textarea[matAutocomplete]`,
|
|
@@ -1206,8 +1180,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-rc.0", ng
|
|
|
1206
1180
|
}] } });
|
|
1207
1181
|
|
|
1208
1182
|
class MatAutocompleteModule {
|
|
1209
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.
|
|
1210
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.
|
|
1183
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: MatAutocompleteModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1184
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.3", ngImport: i0, type: MatAutocompleteModule, imports: [OverlayModule,
|
|
1211
1185
|
MatOptionModule,
|
|
1212
1186
|
MatCommonModule,
|
|
1213
1187
|
MatAutocomplete,
|
|
@@ -1218,13 +1192,13 @@ class MatAutocompleteModule {
|
|
|
1218
1192
|
MatCommonModule,
|
|
1219
1193
|
MatAutocompleteTrigger,
|
|
1220
1194
|
MatAutocompleteOrigin] });
|
|
1221
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.
|
|
1195
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: MatAutocompleteModule, providers: [MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY_PROVIDER], imports: [OverlayModule,
|
|
1222
1196
|
MatOptionModule,
|
|
1223
1197
|
MatCommonModule, CdkScrollableModule,
|
|
1224
1198
|
MatOptionModule,
|
|
1225
1199
|
MatCommonModule] });
|
|
1226
1200
|
}
|
|
1227
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.
|
|
1201
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: MatAutocompleteModule, decorators: [{
|
|
1228
1202
|
type: NgModule,
|
|
1229
1203
|
args: [{
|
|
1230
1204
|
imports: [
|