@angular/material 19.2.0-next.1 → 19.2.0-next.3
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/bottom-sheet/index.d.ts +18 -8
- package/button/_button-base.scss +4 -4
- package/checkbox/_checkbox-common.scss +38 -25
- package/chips/index.d.ts +0 -2
- package/core/index.d.ts +1 -0
- package/datepicker/index.d.ts +3 -3
- package/dialog/index.d.ts +10 -3
- package/expansion/index.d.ts +7 -4
- package/fesm2022/autocomplete.mjs +13 -13
- 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 +138 -50
- package/fesm2022/bottom-sheet.mjs.map +1 -1
- package/fesm2022/button-toggle.mjs +14 -14
- 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 +52 -53
- package/fesm2022/chips.mjs.map +1 -1
- package/fesm2022/core.mjs +74 -76
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/datepicker.mjs +205 -131
- package/fesm2022/datepicker.mjs.map +1 -1
- package/fesm2022/dialog.mjs +123 -43
- package/fesm2022/dialog.mjs.map +1 -1
- package/fesm2022/divider.mjs +7 -7
- package/fesm2022/divider.mjs.map +1 -1
- package/fesm2022/expansion.mjs +97 -41
- package/fesm2022/expansion.mjs.map +1 -1
- package/fesm2022/form-field.mjs +68 -43
- 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 +51 -51
- package/fesm2022/list.mjs.map +1 -1
- package/fesm2022/menu.mjs +111 -51
- 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 +174 -69
- package/fesm2022/select.mjs.map +1 -1
- package/fesm2022/sidenav.mjs +94 -44
- 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 +179 -91
- package/fesm2022/snack-bar.mjs.map +1 -1
- package/fesm2022/sort.mjs +299 -56
- package/fesm2022/sort.mjs.map +1 -1
- package/fesm2022/stepper.mjs +169 -60
- package/fesm2022/stepper.mjs.map +1 -1
- package/fesm2022/table.mjs +55 -55
- package/fesm2022/table.mjs.map +1 -1
- package/fesm2022/tabs.mjs +171 -73
- 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 +46 -19
- package/fesm2022/tooltip.mjs.map +1 -1
- package/fesm2022/tree.mjs +25 -25
- package/fesm2022/tree.mjs.map +1 -1
- package/form-field/index.d.ts +1 -2
- package/menu/index.d.ts +5 -10
- package/package.json +2 -2
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-add/index.mjs +1 -1
- package/schematics/ng-generate/address-form/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts.template +2 -2
- package/schematics/ng-generate/dashboard/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts.template +2 -2
- package/schematics/ng-generate/navigation/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts.template +2 -2
- package/schematics/ng-generate/table/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts.template +2 -2
- package/schematics/ng-generate/tree/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts.template +2 -2
- package/select/index.d.ts +12 -11
- package/sidenav/index.d.ts +1 -2
- package/snack-bar/index.d.ts +9 -8
- package/sort/index.d.ts +6 -7
- package/stepper/index.d.ts +2 -3
- package/tabs/index.d.ts +1 -2
- package/timepicker/index.d.ts +4 -1
- package/tooltip/index.d.ts +1 -2
package/fesm2022/snack-bar.mjs
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, Directive, inject, Component, ViewEncapsulation, ChangeDetectionStrategy, NgZone, ElementRef, ChangeDetectorRef, ViewChild, Injector, TemplateRef, Injectable, NgModule } from '@angular/core';
|
|
2
|
+
import { InjectionToken, Directive, inject, Component, ViewEncapsulation, ChangeDetectionStrategy, NgZone, ElementRef, ChangeDetectorRef, ANIMATION_MODULE_TYPE, afterRender, ViewChild, Injector, TemplateRef, Injectable, NgModule } from '@angular/core';
|
|
3
3
|
import { MatButton, MatButtonModule } from '@angular/material/button';
|
|
4
|
-
import { Subject } from 'rxjs';
|
|
4
|
+
import { Subject, of } from 'rxjs';
|
|
5
5
|
import { DOCUMENT } from '@angular/common';
|
|
6
|
-
import { trigger, state, style, transition, animate } from '@angular/animations';
|
|
7
6
|
import { BasePortalOutlet, CdkPortalOutlet, ComponentPortal, TemplatePortal, PortalModule } from '@angular/cdk/portal';
|
|
8
7
|
import { _IdGenerator, LiveAnnouncer } from '@angular/cdk/a11y';
|
|
9
8
|
import { Platform } from '@angular/cdk/platform';
|
|
9
|
+
import { take, takeUntil } from 'rxjs/operators';
|
|
10
10
|
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
|
|
11
11
|
import { Overlay, OverlayConfig, OverlayModule } from '@angular/cdk/overlay';
|
|
12
|
-
import { takeUntil } from 'rxjs/operators';
|
|
13
12
|
import { MatCommonModule } from '@angular/material/core';
|
|
14
13
|
|
|
15
14
|
/** Maximum amount of milliseconds that can be passed into setTimeout. */
|
|
@@ -140,10 +139,10 @@ class MatSnackBarConfig {
|
|
|
140
139
|
|
|
141
140
|
/** Directive that should be applied to the text element to be rendered in the snack bar. */
|
|
142
141
|
class MatSnackBarLabel {
|
|
143
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.
|
|
144
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.
|
|
142
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: MatSnackBarLabel, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
143
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.3", type: MatSnackBarLabel, isStandalone: true, selector: "[matSnackBarLabel]", host: { classAttribute: "mat-mdc-snack-bar-label mdc-snackbar__label" }, ngImport: i0 });
|
|
145
144
|
}
|
|
146
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.
|
|
145
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: MatSnackBarLabel, decorators: [{
|
|
147
146
|
type: Directive,
|
|
148
147
|
args: [{
|
|
149
148
|
selector: `[matSnackBarLabel]`,
|
|
@@ -154,10 +153,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-rc.0", ng
|
|
|
154
153
|
}] });
|
|
155
154
|
/** Directive that should be applied to the element containing the snack bar's action buttons. */
|
|
156
155
|
class MatSnackBarActions {
|
|
157
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.
|
|
158
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.
|
|
156
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: MatSnackBarActions, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
157
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.3", type: MatSnackBarActions, isStandalone: true, selector: "[matSnackBarActions]", host: { classAttribute: "mat-mdc-snack-bar-actions mdc-snackbar__actions" }, ngImport: i0 });
|
|
159
158
|
}
|
|
160
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.
|
|
159
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: MatSnackBarActions, decorators: [{
|
|
161
160
|
type: Directive,
|
|
162
161
|
args: [{
|
|
163
162
|
selector: `[matSnackBarActions]`,
|
|
@@ -168,10 +167,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-rc.0", ng
|
|
|
168
167
|
}] });
|
|
169
168
|
/** Directive that should be applied to each of the snack bar's action buttons. */
|
|
170
169
|
class MatSnackBarAction {
|
|
171
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.
|
|
172
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.
|
|
170
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: MatSnackBarAction, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
171
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.3", type: MatSnackBarAction, isStandalone: true, selector: "[matSnackBarAction]", host: { classAttribute: "mat-mdc-snack-bar-action mdc-snackbar__action" }, ngImport: i0 });
|
|
173
172
|
}
|
|
174
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.
|
|
173
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: MatSnackBarAction, decorators: [{
|
|
175
174
|
type: Directive,
|
|
176
175
|
args: [{
|
|
177
176
|
selector: `[matSnackBarAction]`,
|
|
@@ -193,38 +192,18 @@ class SimpleSnackBar {
|
|
|
193
192
|
get hasAction() {
|
|
194
193
|
return !!this.data.action;
|
|
195
194
|
}
|
|
196
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.
|
|
197
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.
|
|
195
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: SimpleSnackBar, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
196
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.3", type: SimpleSnackBar, isStandalone: true, selector: "simple-snack-bar", host: { classAttribute: "mat-mdc-simple-snack-bar" }, exportAs: ["matSnackBar"], ngImport: i0, template: "<div matSnackBarLabel>\n {{data.message}}\n</div>\n\n@if (hasAction) {\n <div matSnackBarActions>\n <button mat-button matSnackBarAction (click)=\"action()\">\n {{data.action}}\n </button>\n </div>\n}\n", styles: [".mat-mdc-simple-snack-bar{display:flex}"], dependencies: [{ kind: "component", type: MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "directive", type: MatSnackBarLabel, selector: "[matSnackBarLabel]" }, { kind: "directive", type: MatSnackBarActions, selector: "[matSnackBarActions]" }, { kind: "directive", type: MatSnackBarAction, selector: "[matSnackBarAction]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
198
197
|
}
|
|
199
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.
|
|
198
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: SimpleSnackBar, decorators: [{
|
|
200
199
|
type: Component,
|
|
201
200
|
args: [{ selector: 'simple-snack-bar', exportAs: 'matSnackBar', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, imports: [MatButton, MatSnackBarLabel, MatSnackBarActions, MatSnackBarAction], host: {
|
|
202
201
|
'class': 'mat-mdc-simple-snack-bar',
|
|
203
202
|
}, template: "<div matSnackBarLabel>\n {{data.message}}\n</div>\n\n@if (hasAction) {\n <div matSnackBarActions>\n <button mat-button matSnackBarAction (click)=\"action()\">\n {{data.action}}\n </button>\n </div>\n}\n", styles: [".mat-mdc-simple-snack-bar{display:flex}"] }]
|
|
204
203
|
}], ctorParameters: () => [] });
|
|
205
204
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
* @docs-private
|
|
209
|
-
*/
|
|
210
|
-
const matSnackBarAnimations = {
|
|
211
|
-
/** Animation that shows and hides a snack bar. */
|
|
212
|
-
snackBarState: trigger('state', [
|
|
213
|
-
state('void, hidden', style({
|
|
214
|
-
transform: 'scale(0.8)',
|
|
215
|
-
opacity: 0,
|
|
216
|
-
})),
|
|
217
|
-
state('visible', style({
|
|
218
|
-
transform: 'scale(1)',
|
|
219
|
-
opacity: 1,
|
|
220
|
-
})),
|
|
221
|
-
transition('* => visible', animate('150ms cubic-bezier(0, 0, 0.2, 1)')),
|
|
222
|
-
transition('* => void, * => hidden', animate('75ms cubic-bezier(0.4, 0.0, 1, 1)', style({
|
|
223
|
-
opacity: 0,
|
|
224
|
-
}))),
|
|
225
|
-
]),
|
|
226
|
-
};
|
|
227
|
-
|
|
205
|
+
const ENTER_ANIMATION = '_mat-snack-bar-enter';
|
|
206
|
+
const EXIT_ANIMATION = '_mat-snack-bar-exit';
|
|
228
207
|
/**
|
|
229
208
|
* Internal component that wraps user-provided snack bar content.
|
|
230
209
|
* @docs-private
|
|
@@ -234,9 +213,14 @@ class MatSnackBarContainer extends BasePortalOutlet {
|
|
|
234
213
|
_elementRef = inject(ElementRef);
|
|
235
214
|
_changeDetectorRef = inject(ChangeDetectorRef);
|
|
236
215
|
_platform = inject(Platform);
|
|
216
|
+
_rendersRef;
|
|
217
|
+
_animationsDisabled = inject(ANIMATION_MODULE_TYPE, { optional: true }) === 'NoopAnimations';
|
|
237
218
|
snackBarConfig = inject(MatSnackBarConfig);
|
|
238
219
|
_document = inject(DOCUMENT);
|
|
239
220
|
_trackedModals = new Set();
|
|
221
|
+
_enterFallback;
|
|
222
|
+
_exitFallback;
|
|
223
|
+
_renders = new Subject();
|
|
240
224
|
/** The number of milliseconds to wait before announcing the snack bar's content. */
|
|
241
225
|
_announceDelay = 150;
|
|
242
226
|
/** The timeout for announcing the snack bar's content. */
|
|
@@ -292,6 +276,10 @@ class MatSnackBarContainer extends BasePortalOutlet {
|
|
|
292
276
|
this._role = 'alert';
|
|
293
277
|
}
|
|
294
278
|
}
|
|
279
|
+
// Note: ideally we'd just do an `afterNextRender` in the places where we need to delay
|
|
280
|
+
// something, however in some cases (TestBed teardown) the injector can be destroyed at an
|
|
281
|
+
// unexpected time, causing the `afterRender` to fail.
|
|
282
|
+
this._rendersRef = afterRender(() => this._renders.next(), { manualCleanup: true });
|
|
295
283
|
}
|
|
296
284
|
/** Attach a component portal as content to this snack bar container. */
|
|
297
285
|
attachComponentPortal(portal) {
|
|
@@ -319,18 +307,15 @@ class MatSnackBarContainer extends BasePortalOutlet {
|
|
|
319
307
|
return result;
|
|
320
308
|
};
|
|
321
309
|
/** Handle end of animations, updating the state of the snackbar. */
|
|
322
|
-
onAnimationEnd(
|
|
323
|
-
|
|
324
|
-
if ((toState === 'void' && fromState !== 'void') || toState === 'hidden') {
|
|
310
|
+
onAnimationEnd(animationName) {
|
|
311
|
+
if (animationName === EXIT_ANIMATION) {
|
|
325
312
|
this._completeExit();
|
|
326
313
|
}
|
|
327
|
-
if (
|
|
328
|
-
|
|
329
|
-
// because it can cause a memory leak.
|
|
330
|
-
const onEnter = this._onEnter;
|
|
314
|
+
else if (animationName === ENTER_ANIMATION) {
|
|
315
|
+
clearTimeout(this._enterFallback);
|
|
331
316
|
this._ngZone.run(() => {
|
|
332
|
-
|
|
333
|
-
|
|
317
|
+
this._onEnter.next();
|
|
318
|
+
this._onEnter.complete();
|
|
334
319
|
});
|
|
335
320
|
}
|
|
336
321
|
}
|
|
@@ -343,10 +328,27 @@ class MatSnackBarContainer extends BasePortalOutlet {
|
|
|
343
328
|
this._changeDetectorRef.markForCheck();
|
|
344
329
|
this._changeDetectorRef.detectChanges();
|
|
345
330
|
this._screenReaderAnnounce();
|
|
331
|
+
if (this._animationsDisabled) {
|
|
332
|
+
this._renders.pipe(take(1)).subscribe(() => {
|
|
333
|
+
this._ngZone.run(() => queueMicrotask(() => this.onAnimationEnd(ENTER_ANIMATION)));
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
else {
|
|
337
|
+
clearTimeout(this._enterFallback);
|
|
338
|
+
this._enterFallback = setTimeout(() => {
|
|
339
|
+
// The snack bar will stay invisible if it fails to animate. Add a fallback class so it
|
|
340
|
+
// becomes visible. This can happen in some apps that do `* {animation: none !important}`.
|
|
341
|
+
this._elementRef.nativeElement.classList.add('mat-snack-bar-fallback-visible');
|
|
342
|
+
this.onAnimationEnd(ENTER_ANIMATION);
|
|
343
|
+
}, 200);
|
|
344
|
+
}
|
|
346
345
|
}
|
|
347
346
|
}
|
|
348
347
|
/** Begin animation of the snack bar exiting from view. */
|
|
349
348
|
exit() {
|
|
349
|
+
if (this._destroyed) {
|
|
350
|
+
return of(undefined);
|
|
351
|
+
}
|
|
350
352
|
// It's common for snack bars to be opened by random outside calls like HTTP requests or
|
|
351
353
|
// errors. Run inside the NgZone to ensure that it functions correctly.
|
|
352
354
|
this._ngZone.run(() => {
|
|
@@ -362,6 +364,15 @@ class MatSnackBarContainer extends BasePortalOutlet {
|
|
|
362
364
|
// If the snack bar hasn't been announced by the time it exits it wouldn't have been open
|
|
363
365
|
// long enough to visually read it either, so clear the timeout for announcing.
|
|
364
366
|
clearTimeout(this._announceTimeoutId);
|
|
367
|
+
if (this._animationsDisabled) {
|
|
368
|
+
this._renders.pipe(take(1)).subscribe(() => {
|
|
369
|
+
this._ngZone.run(() => queueMicrotask(() => this.onAnimationEnd(EXIT_ANIMATION)));
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
else {
|
|
373
|
+
clearTimeout(this._exitFallback);
|
|
374
|
+
this._exitFallback = setTimeout(() => this.onAnimationEnd(EXIT_ANIMATION), 200);
|
|
375
|
+
}
|
|
365
376
|
});
|
|
366
377
|
return this._onExit;
|
|
367
378
|
}
|
|
@@ -370,12 +381,11 @@ class MatSnackBarContainer extends BasePortalOutlet {
|
|
|
370
381
|
this._destroyed = true;
|
|
371
382
|
this._clearFromModals();
|
|
372
383
|
this._completeExit();
|
|
384
|
+
this._renders.complete();
|
|
385
|
+
this._rendersRef.destroy();
|
|
373
386
|
}
|
|
374
|
-
/**
|
|
375
|
-
* Removes the element in a microtask. Helps prevent errors where we end up
|
|
376
|
-
* removing an element which is in the middle of an animation.
|
|
377
|
-
*/
|
|
378
387
|
_completeExit() {
|
|
388
|
+
clearTimeout(this._exitFallback);
|
|
379
389
|
queueMicrotask(() => {
|
|
380
390
|
this._onExit.next();
|
|
381
391
|
this._onExit.complete();
|
|
@@ -458,40 +468,48 @@ class MatSnackBarContainer extends BasePortalOutlet {
|
|
|
458
468
|
* announce it.
|
|
459
469
|
*/
|
|
460
470
|
_screenReaderAnnounce() {
|
|
461
|
-
if (
|
|
462
|
-
|
|
463
|
-
this._announceTimeoutId = setTimeout(() => {
|
|
464
|
-
const inertElement = this._elementRef.nativeElement.querySelector('[aria-hidden]');
|
|
465
|
-
const liveElement = this._elementRef.nativeElement.querySelector('[aria-live]');
|
|
466
|
-
if (inertElement && liveElement) {
|
|
467
|
-
// If an element in the snack bar content is focused before being moved
|
|
468
|
-
// track it and restore focus after moving to the live region.
|
|
469
|
-
let focusedElement = null;
|
|
470
|
-
if (this._platform.isBrowser &&
|
|
471
|
-
document.activeElement instanceof HTMLElement &&
|
|
472
|
-
inertElement.contains(document.activeElement)) {
|
|
473
|
-
focusedElement = document.activeElement;
|
|
474
|
-
}
|
|
475
|
-
inertElement.removeAttribute('aria-hidden');
|
|
476
|
-
liveElement.appendChild(inertElement);
|
|
477
|
-
focusedElement?.focus();
|
|
478
|
-
this._onAnnounce.next();
|
|
479
|
-
this._onAnnounce.complete();
|
|
480
|
-
}
|
|
481
|
-
}, this._announceDelay);
|
|
482
|
-
});
|
|
471
|
+
if (this._announceTimeoutId) {
|
|
472
|
+
return;
|
|
483
473
|
}
|
|
474
|
+
this._ngZone.runOutsideAngular(() => {
|
|
475
|
+
this._announceTimeoutId = setTimeout(() => {
|
|
476
|
+
if (this._destroyed) {
|
|
477
|
+
return;
|
|
478
|
+
}
|
|
479
|
+
const element = this._elementRef.nativeElement;
|
|
480
|
+
const inertElement = element.querySelector('[aria-hidden]');
|
|
481
|
+
const liveElement = element.querySelector('[aria-live]');
|
|
482
|
+
if (inertElement && liveElement) {
|
|
483
|
+
// If an element in the snack bar content is focused before being moved
|
|
484
|
+
// track it and restore focus after moving to the live region.
|
|
485
|
+
let focusedElement = null;
|
|
486
|
+
if (this._platform.isBrowser &&
|
|
487
|
+
document.activeElement instanceof HTMLElement &&
|
|
488
|
+
inertElement.contains(document.activeElement)) {
|
|
489
|
+
focusedElement = document.activeElement;
|
|
490
|
+
}
|
|
491
|
+
inertElement.removeAttribute('aria-hidden');
|
|
492
|
+
liveElement.appendChild(inertElement);
|
|
493
|
+
focusedElement?.focus();
|
|
494
|
+
this._onAnnounce.next();
|
|
495
|
+
this._onAnnounce.complete();
|
|
496
|
+
}
|
|
497
|
+
}, this._announceDelay);
|
|
498
|
+
});
|
|
484
499
|
}
|
|
485
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.
|
|
486
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.
|
|
500
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: MatSnackBarContainer, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
501
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.3", type: MatSnackBarContainer, isStandalone: true, selector: "mat-snack-bar-container", host: { listeners: { "animationend": "onAnimationEnd($event.animationName)", "animationcancel": "onAnimationEnd($event.animationName)" }, properties: { "class.mat-snack-bar-container-enter": "_animationState === \"visible\"", "class.mat-snack-bar-container-exit": "_animationState === \"hidden\"", "class.mat-snack-bar-container-animations-enabled": "!_animationsDisabled" }, classAttribute: "mdc-snackbar mat-mdc-snack-bar-container" }, viewQueries: [{ propertyName: "_portalOutlet", first: true, predicate: CdkPortalOutlet, descendants: true, static: true }, { propertyName: "_label", first: true, predicate: ["label"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"mdc-snackbar__surface mat-mdc-snackbar-surface\">\n <!--\n This outer label wrapper will have the class `mdc-snackbar__label` applied if\n the attached template/component does not contain it.\n -->\n <div class=\"mat-mdc-snack-bar-label\" #label>\n <!-- Initialy holds the snack bar content, will be empty after announcing to screen readers. -->\n <div aria-hidden=\"true\">\n <ng-template cdkPortalOutlet />\n </div>\n\n <!-- Will receive the snack bar content from the non-live div, move will happen a short delay after opening -->\n <div [attr.aria-live]=\"_live\" [attr.role]=\"_role\" [attr.id]=\"_liveElementId\"></div>\n </div>\n</div>\n", styles: ["@keyframes _mat-snack-bar-enter{from{transform:scale(0.8);opacity:0}to{transform:scale(1);opacity:1}}@keyframes _mat-snack-bar-exit{from{opacity:1}to{opacity:0}}.mat-mdc-snack-bar-container{display:flex;align-items:center;justify-content:center;box-sizing:border-box;-webkit-tap-highlight-color:rgba(0,0,0,0);margin:8px}.mat-mdc-snack-bar-handset .mat-mdc-snack-bar-container{width:100vw}.mat-snack-bar-container-animations-enabled{opacity:0}.mat-snack-bar-container-animations-enabled.mat-snack-bar-fallback-visible{opacity:1}.mat-snack-bar-container-animations-enabled.mat-snack-bar-container-enter{animation:_mat-snack-bar-enter 150ms cubic-bezier(0, 0, 0.2, 1) forwards}.mat-snack-bar-container-animations-enabled.mat-snack-bar-container-exit{animation:_mat-snack-bar-exit 75ms cubic-bezier(0.4, 0, 1, 1) forwards}.mat-mdc-snackbar-surface{box-shadow:0px 3px 5px -1px rgba(0, 0, 0, 0.2), 0px 6px 10px 0px rgba(0, 0, 0, 0.14), 0px 1px 18px 0px rgba(0, 0, 0, 0.12);display:flex;align-items:center;justify-content:flex-start;box-sizing:border-box;padding-left:0;padding-right:8px}[dir=rtl] .mat-mdc-snackbar-surface{padding-right:0;padding-left:8px}.mat-mdc-snack-bar-container .mat-mdc-snackbar-surface{min-width:344px;max-width:672px}.mat-mdc-snack-bar-handset .mat-mdc-snackbar-surface{width:100%;min-width:0}@media(forced-colors: active){.mat-mdc-snackbar-surface{outline:solid 1px}}.mat-mdc-snack-bar-container .mat-mdc-snackbar-surface{color:var(--mdc-snackbar-supporting-text-color, var(--mat-sys-inverse-on-surface));border-radius:var(--mdc-snackbar-container-shape, var(--mat-sys-corner-extra-small));background-color:var(--mdc-snackbar-container-color, var(--mat-sys-inverse-surface))}.mdc-snackbar__label{width:100%;flex-grow:1;box-sizing:border-box;margin:0;padding:14px 8px 14px 16px}[dir=rtl] .mdc-snackbar__label{padding-left:8px;padding-right:16px}.mat-mdc-snack-bar-container .mdc-snackbar__label{font-family:var(--mdc-snackbar-supporting-text-font, var(--mat-sys-body-medium-font));font-size:var(--mdc-snackbar-supporting-text-size, var(--mat-sys-body-medium-size));font-weight:var(--mdc-snackbar-supporting-text-weight, var(--mat-sys-body-medium-weight));line-height:var(--mdc-snackbar-supporting-text-line-height, var(--mat-sys-body-medium-line-height))}.mat-mdc-snack-bar-actions{display:flex;flex-shrink:0;align-items:center;box-sizing:border-box}.mat-mdc-snack-bar-handset,.mat-mdc-snack-bar-container,.mat-mdc-snack-bar-label{flex:1 1 auto}.mat-mdc-snack-bar-container .mat-mdc-button.mat-mdc-snack-bar-action:not(:disabled).mat-unthemed{color:var(--mat-snack-bar-button-color, var(--mat-sys-inverse-primary))}.mat-mdc-snack-bar-container .mat-mdc-button.mat-mdc-snack-bar-action:not(:disabled){--mat-text-button-state-layer-color:currentColor;--mat-text-button-ripple-color:currentColor}.mat-mdc-snack-bar-container .mat-mdc-button.mat-mdc-snack-bar-action:not(:disabled) .mat-ripple-element{opacity:.1}"], dependencies: [{ kind: "directive", type: CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.Default, encapsulation: i0.ViewEncapsulation.None });
|
|
487
502
|
}
|
|
488
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.
|
|
503
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: MatSnackBarContainer, decorators: [{
|
|
489
504
|
type: Component,
|
|
490
|
-
args: [{ selector: 'mat-snack-bar-container', changeDetection: ChangeDetectionStrategy.Default, encapsulation: ViewEncapsulation.None,
|
|
505
|
+
args: [{ selector: 'mat-snack-bar-container', changeDetection: ChangeDetectionStrategy.Default, encapsulation: ViewEncapsulation.None, imports: [CdkPortalOutlet], host: {
|
|
491
506
|
'class': 'mdc-snackbar mat-mdc-snack-bar-container',
|
|
492
|
-
'[
|
|
493
|
-
'
|
|
494
|
-
|
|
507
|
+
'[class.mat-snack-bar-container-enter]': '_animationState === "visible"',
|
|
508
|
+
'[class.mat-snack-bar-container-exit]': '_animationState === "hidden"',
|
|
509
|
+
'[class.mat-snack-bar-container-animations-enabled]': '!_animationsDisabled',
|
|
510
|
+
'(animationend)': 'onAnimationEnd($event.animationName)',
|
|
511
|
+
'(animationcancel)': 'onAnimationEnd($event.animationName)',
|
|
512
|
+
}, template: "<div class=\"mdc-snackbar__surface mat-mdc-snackbar-surface\">\n <!--\n This outer label wrapper will have the class `mdc-snackbar__label` applied if\n the attached template/component does not contain it.\n -->\n <div class=\"mat-mdc-snack-bar-label\" #label>\n <!-- Initialy holds the snack bar content, will be empty after announcing to screen readers. -->\n <div aria-hidden=\"true\">\n <ng-template cdkPortalOutlet />\n </div>\n\n <!-- Will receive the snack bar content from the non-live div, move will happen a short delay after opening -->\n <div [attr.aria-live]=\"_live\" [attr.role]=\"_role\" [attr.id]=\"_liveElementId\"></div>\n </div>\n</div>\n", styles: ["@keyframes _mat-snack-bar-enter{from{transform:scale(0.8);opacity:0}to{transform:scale(1);opacity:1}}@keyframes _mat-snack-bar-exit{from{opacity:1}to{opacity:0}}.mat-mdc-snack-bar-container{display:flex;align-items:center;justify-content:center;box-sizing:border-box;-webkit-tap-highlight-color:rgba(0,0,0,0);margin:8px}.mat-mdc-snack-bar-handset .mat-mdc-snack-bar-container{width:100vw}.mat-snack-bar-container-animations-enabled{opacity:0}.mat-snack-bar-container-animations-enabled.mat-snack-bar-fallback-visible{opacity:1}.mat-snack-bar-container-animations-enabled.mat-snack-bar-container-enter{animation:_mat-snack-bar-enter 150ms cubic-bezier(0, 0, 0.2, 1) forwards}.mat-snack-bar-container-animations-enabled.mat-snack-bar-container-exit{animation:_mat-snack-bar-exit 75ms cubic-bezier(0.4, 0, 1, 1) forwards}.mat-mdc-snackbar-surface{box-shadow:0px 3px 5px -1px rgba(0, 0, 0, 0.2), 0px 6px 10px 0px rgba(0, 0, 0, 0.14), 0px 1px 18px 0px rgba(0, 0, 0, 0.12);display:flex;align-items:center;justify-content:flex-start;box-sizing:border-box;padding-left:0;padding-right:8px}[dir=rtl] .mat-mdc-snackbar-surface{padding-right:0;padding-left:8px}.mat-mdc-snack-bar-container .mat-mdc-snackbar-surface{min-width:344px;max-width:672px}.mat-mdc-snack-bar-handset .mat-mdc-snackbar-surface{width:100%;min-width:0}@media(forced-colors: active){.mat-mdc-snackbar-surface{outline:solid 1px}}.mat-mdc-snack-bar-container .mat-mdc-snackbar-surface{color:var(--mdc-snackbar-supporting-text-color, var(--mat-sys-inverse-on-surface));border-radius:var(--mdc-snackbar-container-shape, var(--mat-sys-corner-extra-small));background-color:var(--mdc-snackbar-container-color, var(--mat-sys-inverse-surface))}.mdc-snackbar__label{width:100%;flex-grow:1;box-sizing:border-box;margin:0;padding:14px 8px 14px 16px}[dir=rtl] .mdc-snackbar__label{padding-left:8px;padding-right:16px}.mat-mdc-snack-bar-container .mdc-snackbar__label{font-family:var(--mdc-snackbar-supporting-text-font, var(--mat-sys-body-medium-font));font-size:var(--mdc-snackbar-supporting-text-size, var(--mat-sys-body-medium-size));font-weight:var(--mdc-snackbar-supporting-text-weight, var(--mat-sys-body-medium-weight));line-height:var(--mdc-snackbar-supporting-text-line-height, var(--mat-sys-body-medium-line-height))}.mat-mdc-snack-bar-actions{display:flex;flex-shrink:0;align-items:center;box-sizing:border-box}.mat-mdc-snack-bar-handset,.mat-mdc-snack-bar-container,.mat-mdc-snack-bar-label{flex:1 1 auto}.mat-mdc-snack-bar-container .mat-mdc-button.mat-mdc-snack-bar-action:not(:disabled).mat-unthemed{color:var(--mat-snack-bar-button-color, var(--mat-sys-inverse-primary))}.mat-mdc-snack-bar-container .mat-mdc-button.mat-mdc-snack-bar-action:not(:disabled){--mat-text-button-state-layer-color:currentColor;--mat-text-button-ripple-color:currentColor}.mat-mdc-snack-bar-container .mat-mdc-button.mat-mdc-snack-bar-action:not(:disabled) .mat-ripple-element{opacity:.1}"] }]
|
|
495
513
|
}], ctorParameters: () => [], propDecorators: { _portalOutlet: [{
|
|
496
514
|
type: ViewChild,
|
|
497
515
|
args: [CdkPortalOutlet, { static: true }]
|
|
@@ -664,6 +682,10 @@ class MatSnackBar {
|
|
|
664
682
|
this._live.clear();
|
|
665
683
|
}
|
|
666
684
|
});
|
|
685
|
+
// If a dismiss timeout is provided, set up dismiss based on after the snackbar is opened.
|
|
686
|
+
if (config.duration && config.duration > 0) {
|
|
687
|
+
snackBarRef.afterOpened().subscribe(() => snackBarRef._dismissAfter(config.duration));
|
|
688
|
+
}
|
|
667
689
|
if (this._openedSnackBarRef) {
|
|
668
690
|
// If a snack bar is already in view, dismiss it and enter the
|
|
669
691
|
// new snack bar after exit animation is complete.
|
|
@@ -676,10 +698,6 @@ class MatSnackBar {
|
|
|
676
698
|
// If no snack bar is in view, enter the new snack bar.
|
|
677
699
|
snackBarRef.containerInstance.enter();
|
|
678
700
|
}
|
|
679
|
-
// If a dismiss timeout is provided, set up dismiss based on after the snackbar is opened.
|
|
680
|
-
if (config.duration && config.duration > 0) {
|
|
681
|
-
snackBarRef.afterOpened().subscribe(() => snackBarRef._dismissAfter(config.duration));
|
|
682
|
-
}
|
|
683
701
|
}
|
|
684
702
|
/**
|
|
685
703
|
* Creates a new overlay and places it in the correct location.
|
|
@@ -729,29 +747,29 @@ class MatSnackBar {
|
|
|
729
747
|
],
|
|
730
748
|
});
|
|
731
749
|
}
|
|
732
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.
|
|
733
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.
|
|
750
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: MatSnackBar, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
751
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: MatSnackBar, providedIn: 'root' });
|
|
734
752
|
}
|
|
735
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.
|
|
753
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: MatSnackBar, decorators: [{
|
|
736
754
|
type: Injectable,
|
|
737
755
|
args: [{ providedIn: 'root' }]
|
|
738
756
|
}], ctorParameters: () => [] });
|
|
739
757
|
|
|
740
758
|
const DIRECTIVES = [MatSnackBarContainer, MatSnackBarLabel, MatSnackBarActions, MatSnackBarAction];
|
|
741
759
|
class MatSnackBarModule {
|
|
742
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.
|
|
743
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.
|
|
760
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: MatSnackBarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
761
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.3", ngImport: i0, type: MatSnackBarModule, imports: [OverlayModule,
|
|
744
762
|
PortalModule,
|
|
745
763
|
MatButtonModule,
|
|
746
764
|
MatCommonModule,
|
|
747
765
|
SimpleSnackBar, MatSnackBarContainer, MatSnackBarLabel, MatSnackBarActions, MatSnackBarAction], exports: [MatCommonModule, MatSnackBarContainer, MatSnackBarLabel, MatSnackBarActions, MatSnackBarAction] });
|
|
748
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.
|
|
766
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: MatSnackBarModule, providers: [MatSnackBar], imports: [OverlayModule,
|
|
749
767
|
PortalModule,
|
|
750
768
|
MatButtonModule,
|
|
751
769
|
MatCommonModule,
|
|
752
770
|
SimpleSnackBar, MatCommonModule] });
|
|
753
771
|
}
|
|
754
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.
|
|
772
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: MatSnackBarModule, decorators: [{
|
|
755
773
|
type: NgModule,
|
|
756
774
|
args: [{
|
|
757
775
|
imports: [
|
|
@@ -767,6 +785,76 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-rc.0", ng
|
|
|
767
785
|
}]
|
|
768
786
|
}] });
|
|
769
787
|
|
|
788
|
+
/**
|
|
789
|
+
* Animations used by the Material snack bar.
|
|
790
|
+
* @docs-private
|
|
791
|
+
* @deprecated No longer used, will be removed.
|
|
792
|
+
* @breaking-change 21.0.0
|
|
793
|
+
*/
|
|
794
|
+
const matSnackBarAnimations = {
|
|
795
|
+
// Represents
|
|
796
|
+
// trigger('state', [
|
|
797
|
+
// state(
|
|
798
|
+
// 'void, hidden',
|
|
799
|
+
// style({
|
|
800
|
+
// transform: 'scale(0.8)',
|
|
801
|
+
// opacity: 0,
|
|
802
|
+
// }),
|
|
803
|
+
// ),
|
|
804
|
+
// state(
|
|
805
|
+
// 'visible',
|
|
806
|
+
// style({
|
|
807
|
+
// transform: 'scale(1)',
|
|
808
|
+
// opacity: 1,
|
|
809
|
+
// }),
|
|
810
|
+
// ),
|
|
811
|
+
// transition('* => visible', animate('150ms cubic-bezier(0, 0, 0.2, 1)')),
|
|
812
|
+
// transition(
|
|
813
|
+
// '* => void, * => hidden',
|
|
814
|
+
// animate(
|
|
815
|
+
// '75ms cubic-bezier(0.4, 0.0, 1, 1)',
|
|
816
|
+
// style({
|
|
817
|
+
// opacity: 0,
|
|
818
|
+
// }),
|
|
819
|
+
// ),
|
|
820
|
+
// ),
|
|
821
|
+
// ])
|
|
822
|
+
/** Animation that shows and hides a snack bar. */
|
|
823
|
+
snackBarState: {
|
|
824
|
+
type: 7,
|
|
825
|
+
name: 'state',
|
|
826
|
+
'definitions': [
|
|
827
|
+
{
|
|
828
|
+
type: 0,
|
|
829
|
+
name: 'void, hidden',
|
|
830
|
+
styles: { type: 6, styles: { transform: 'scale(0.8)', opacity: 0 }, offset: null },
|
|
831
|
+
},
|
|
832
|
+
{
|
|
833
|
+
type: 0,
|
|
834
|
+
name: 'visible',
|
|
835
|
+
styles: { type: 6, styles: { transform: 'scale(1)', opacity: 1 }, offset: null },
|
|
836
|
+
},
|
|
837
|
+
{
|
|
838
|
+
type: 1,
|
|
839
|
+
expr: '* => visible',
|
|
840
|
+
animation: { type: 4, styles: null, timings: '150ms cubic-bezier(0, 0, 0.2, 1)' },
|
|
841
|
+
options: null,
|
|
842
|
+
},
|
|
843
|
+
{
|
|
844
|
+
type: 1,
|
|
845
|
+
expr: '* => void, * => hidden',
|
|
846
|
+
animation: {
|
|
847
|
+
type: 4,
|
|
848
|
+
styles: { type: 6, styles: { opacity: 0 }, offset: null },
|
|
849
|
+
timings: '75ms cubic-bezier(0.4, 0.0, 1, 1)',
|
|
850
|
+
},
|
|
851
|
+
options: null,
|
|
852
|
+
},
|
|
853
|
+
],
|
|
854
|
+
options: {},
|
|
855
|
+
},
|
|
856
|
+
};
|
|
857
|
+
|
|
770
858
|
/**
|
|
771
859
|
* Generated bundle index. Do not edit.
|
|
772
860
|
*/
|