@angular/material 21.0.0-next.9 → 21.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/tokens/_classes.scss +1 -1
- package/core/tokens/m2/_md-sys-color.scss +17 -17
- package/fesm2022/_animation-chunk.mjs +10 -16
- package/fesm2022/_animation-chunk.mjs.map +1 -1
- package/fesm2022/_date-formats-chunk.mjs +68 -164
- package/fesm2022/_date-formats-chunk.mjs.map +1 -1
- package/fesm2022/_date-range-input-harness-chunk.mjs +284 -463
- package/fesm2022/_date-range-input-harness-chunk.mjs.map +1 -1
- package/fesm2022/_error-options-chunk.mjs +56 -19
- package/fesm2022/_error-options-chunk.mjs.map +1 -1
- package/fesm2022/_error-state-chunk.mjs +24 -31
- package/fesm2022/_error-state-chunk.mjs.map +1 -1
- package/fesm2022/_form-field-chunk.mjs +1224 -1017
- package/fesm2022/_form-field-chunk.mjs.map +1 -1
- package/fesm2022/_icon-button-chunk.mjs +243 -187
- package/fesm2022/_icon-button-chunk.mjs.map +1 -1
- package/fesm2022/_icon-registry-chunk.mjs +350 -575
- package/fesm2022/_icon-registry-chunk.mjs.map +1 -1
- package/fesm2022/_input-harness-chunk.mjs +56 -107
- package/fesm2022/_input-harness-chunk.mjs.map +1 -1
- package/fesm2022/_input-value-accessor-chunk.mjs +0 -6
- package/fesm2022/_input-value-accessor-chunk.mjs.map +1 -1
- package/fesm2022/_internal-form-field-chunk.mjs +59 -19
- package/fesm2022/_internal-form-field-chunk.mjs.map +1 -1
- package/fesm2022/_line-chunk.mjs +83 -43
- package/fesm2022/_line-chunk.mjs.map +1 -1
- package/fesm2022/_option-chunk.mjs +348 -311
- package/fesm2022/_option-chunk.mjs.map +1 -1
- package/fesm2022/_option-harness-chunk.mjs +23 -39
- package/fesm2022/_option-harness-chunk.mjs.map +1 -1
- package/fesm2022/_option-module-chunk.mjs +36 -10
- package/fesm2022/_option-module-chunk.mjs.map +1 -1
- package/fesm2022/_pseudo-checkbox-chunk.mjs +79 -44
- package/fesm2022/_pseudo-checkbox-chunk.mjs.map +1 -1
- package/fesm2022/_pseudo-checkbox-module-chunk.mjs +36 -10
- package/fesm2022/_pseudo-checkbox-module-chunk.mjs.map +1 -1
- package/fesm2022/_public-api-chunk.mjs +71 -134
- package/fesm2022/_public-api-chunk.mjs.map +1 -1
- package/fesm2022/_ripple-chunk.mjs +504 -600
- package/fesm2022/_ripple-chunk.mjs.map +1 -1
- package/fesm2022/_ripple-loader-chunk.mjs +120 -138
- package/fesm2022/_ripple-loader-chunk.mjs.map +1 -1
- package/fesm2022/_ripple-module-chunk.mjs +36 -10
- package/fesm2022/_ripple-module-chunk.mjs.map +1 -1
- package/fesm2022/_structural-styles-chunk.mjs +37 -10
- package/fesm2022/_structural-styles-chunk.mjs.map +1 -1
- package/fesm2022/_tooltip-chunk.mjs +811 -888
- package/fesm2022/_tooltip-chunk.mjs.map +1 -1
- package/fesm2022/autocomplete-testing.mjs +62 -86
- package/fesm2022/autocomplete-testing.mjs.map +1 -1
- package/fesm2022/autocomplete.mjs +965 -1126
- package/fesm2022/autocomplete.mjs.map +1 -1
- package/fesm2022/badge-testing.mjs +38 -54
- package/fesm2022/badge-testing.mjs.map +1 -1
- package/fesm2022/badge.mjs +321 -272
- package/fesm2022/badge.mjs.map +1 -1
- package/fesm2022/bottom-sheet-testing.mjs +10 -24
- package/fesm2022/bottom-sheet-testing.mjs.map +1 -1
- package/fesm2022/bottom-sheet.mjs +349 -344
- package/fesm2022/bottom-sheet.mjs.map +1 -1
- package/fesm2022/button-testing.mjs +60 -94
- package/fesm2022/button-testing.mjs.map +1 -1
- package/fesm2022/button-toggle-testing.mjs +76 -125
- package/fesm2022/button-toggle-testing.mjs.map +1 -1
- package/fesm2022/button-toggle.mjs +752 -662
- package/fesm2022/button-toggle.mjs.map +1 -1
- package/fesm2022/button.mjs +263 -158
- package/fesm2022/button.mjs.map +1 -1
- package/fesm2022/card-testing.mjs +19 -33
- package/fesm2022/card-testing.mjs.map +1 -1
- package/fesm2022/card.mjs +576 -272
- package/fesm2022/card.mjs.map +1 -1
- package/fesm2022/checkbox-testing.mjs +71 -123
- package/fesm2022/checkbox-testing.mjs.map +1 -1
- package/fesm2022/checkbox.mjs +515 -477
- package/fesm2022/checkbox.mjs.map +1 -1
- package/fesm2022/chips-testing.mjs +201 -344
- package/fesm2022/chips-testing.mjs.map +1 -1
- package/fesm2022/chips.mjs +2552 -2289
- package/fesm2022/chips.mjs.map +1 -1
- package/fesm2022/core-testing.mjs +14 -28
- package/fesm2022/core-testing.mjs.map +1 -1
- package/fesm2022/core.mjs +357 -328
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/datepicker-testing.mjs +15 -25
- package/fesm2022/datepicker-testing.mjs.map +1 -1
- package/fesm2022/datepicker.mjs +4826 -4563
- package/fesm2022/datepicker.mjs.map +1 -1
- package/fesm2022/dialog-testing.mjs +93 -129
- package/fesm2022/dialog-testing.mjs.map +1 -1
- package/fesm2022/dialog.mjs +810 -829
- package/fesm2022/dialog.mjs.map +1 -1
- package/fesm2022/divider-testing.mjs +10 -11
- package/fesm2022/divider-testing.mjs.map +1 -1
- package/fesm2022/divider.mjs +119 -43
- package/fesm2022/divider.mjs.map +1 -1
- package/fesm2022/expansion-testing.mjs +74 -130
- package/fesm2022/expansion-testing.mjs.map +1 -1
- package/fesm2022/expansion.mjs +703 -515
- package/fesm2022/expansion.mjs.map +1 -1
- package/fesm2022/form-field-testing-control.mjs +16 -33
- package/fesm2022/form-field-testing-control.mjs.map +1 -1
- package/fesm2022/form-field-testing.mjs +118 -179
- package/fesm2022/form-field-testing.mjs.map +1 -1
- package/fesm2022/form-field.mjs +36 -10
- package/fesm2022/form-field.mjs.map +1 -1
- package/fesm2022/grid-list-testing.mjs +65 -113
- package/fesm2022/grid-list-testing.mjs.map +1 -1
- package/fesm2022/grid-list.mjs +559 -494
- package/fesm2022/grid-list.mjs.map +1 -1
- package/fesm2022/icon-testing.mjs +148 -127
- package/fesm2022/icon-testing.mjs.map +1 -1
- package/fesm2022/icon.mjs +325 -351
- package/fesm2022/icon.mjs.map +1 -1
- package/fesm2022/input-testing.mjs +59 -99
- package/fesm2022/input-testing.mjs.map +1 -1
- package/fesm2022/input.mjs +457 -520
- package/fesm2022/input.mjs.map +1 -1
- package/fesm2022/list-testing.mjs +251 -434
- package/fesm2022/list-testing.mjs.map +1 -1
- package/fesm2022/list.mjs +1522 -1204
- package/fesm2022/list.mjs.map +1 -1
- package/fesm2022/material.mjs +0 -5
- package/fesm2022/material.mjs.map +1 -1
- package/fesm2022/menu-testing.mjs +159 -228
- package/fesm2022/menu-testing.mjs.map +1 -1
- package/fesm2022/menu.mjs +1338 -1343
- package/fesm2022/menu.mjs.map +1 -1
- package/fesm2022/paginator-testing.mjs +55 -79
- package/fesm2022/paginator-testing.mjs.map +1 -1
- package/fesm2022/paginator.mjs +381 -309
- package/fesm2022/paginator.mjs.map +1 -1
- package/fesm2022/progress-bar-testing.mjs +12 -21
- package/fesm2022/progress-bar-testing.mjs.map +1 -1
- package/fesm2022/progress-bar.mjs +224 -169
- package/fesm2022/progress-bar.mjs.map +1 -1
- package/fesm2022/progress-spinner-testing.mjs +13 -23
- package/fesm2022/progress-spinner-testing.mjs.map +1 -1
- package/fesm2022/progress-spinner.mjs +235 -160
- package/fesm2022/progress-spinner.mjs.map +1 -1
- package/fesm2022/radio-testing.mjs +133 -208
- package/fesm2022/radio-testing.mjs.map +1 -1
- package/fesm2022/radio.mjs +712 -679
- package/fesm2022/radio.mjs.map +1 -1
- package/fesm2022/select-testing.mjs +83 -117
- package/fesm2022/select-testing.mjs.map +1 -1
- package/fesm2022/select.mjs +1116 -1246
- package/fesm2022/select.mjs.map +1 -1
- package/fesm2022/sidenav-testing.mjs +54 -120
- package/fesm2022/sidenav-testing.mjs.map +1 -1
- package/fesm2022/sidenav.mjs +1078 -995
- package/fesm2022/sidenav.mjs.map +1 -1
- package/fesm2022/slide-toggle-testing.mjs +57 -92
- package/fesm2022/slide-toggle-testing.mjs.map +1 -1
- package/fesm2022/slide-toggle.mjs +369 -279
- package/fesm2022/slide-toggle.mjs.map +1 -1
- package/fesm2022/slider-testing.mjs +90 -138
- package/fesm2022/slider-testing.mjs.map +1 -1
- package/fesm2022/slider.mjs +1651 -1716
- package/fesm2022/slider.mjs.map +1 -1
- package/fesm2022/snack-bar-testing.mjs +40 -87
- package/fesm2022/snack-bar-testing.mjs.map +1 -1
- package/fesm2022/snack-bar.mjs +763 -714
- package/fesm2022/snack-bar.mjs.map +1 -1
- package/fesm2022/sort-testing.mjs +45 -66
- package/fesm2022/sort-testing.mjs.map +1 -1
- package/fesm2022/sort.mjs +419 -344
- package/fesm2022/sort.mjs.map +1 -1
- package/fesm2022/stepper-testing.mjs +78 -154
- package/fesm2022/stepper-testing.mjs.map +1 -1
- package/fesm2022/stepper.mjs +790 -498
- package/fesm2022/stepper.mjs.map +1 -1
- package/fesm2022/table-testing.mjs +120 -213
- package/fesm2022/table-testing.mjs.map +1 -1
- package/fesm2022/table.mjs +1026 -684
- package/fesm2022/table.mjs.map +1 -1
- package/fesm2022/tabs-testing.mjs +125 -197
- package/fesm2022/tabs-testing.mjs.map +1 -1
- package/fesm2022/tabs.mjs +2351 -2028
- package/fesm2022/tabs.mjs.map +1 -1
- package/fesm2022/timepicker-testing.mjs +113 -172
- package/fesm2022/timepicker-testing.mjs.map +1 -1
- package/fesm2022/timepicker.mjs +1019 -826
- package/fesm2022/timepicker.mjs.map +1 -1
- package/fesm2022/toolbar-testing.mjs +16 -27
- package/fesm2022/toolbar-testing.mjs.map +1 -1
- package/fesm2022/toolbar.mjs +163 -78
- package/fesm2022/toolbar.mjs.map +1 -1
- package/fesm2022/tooltip-testing.mjs +41 -52
- package/fesm2022/tooltip-testing.mjs.map +1 -1
- package/fesm2022/tooltip.mjs +36 -10
- package/fesm2022/tooltip.mjs.map +1 -1
- package/fesm2022/tree-testing.mjs +86 -162
- package/fesm2022/tree-testing.mjs.map +1 -1
- package/fesm2022/tree.mjs +638 -466
- package/fesm2022/tree.mjs.map +1 -1
- package/package.json +2 -2
- package/schematics/ng-add/index.js +1 -1
- package/types/expansion.d.ts +4 -2
- package/types/menu-testing.d.ts +2 -0
- package/types/select.d.ts +1 -1
- package/types/timepicker.d.ts +1 -0
package/fesm2022/snack-bar.mjs
CHANGED
|
@@ -18,754 +18,803 @@ import '@angular/cdk/coercion';
|
|
|
18
18
|
import './_structural-styles-chunk.mjs';
|
|
19
19
|
import './_ripple-module-chunk.mjs';
|
|
20
20
|
|
|
21
|
-
/** Maximum amount of milliseconds that can be passed into setTimeout. */
|
|
22
21
|
const MAX_TIMEOUT = Math.pow(2, 31) - 1;
|
|
23
|
-
/**
|
|
24
|
-
* Reference to a snack bar dispatched from the snack bar service.
|
|
25
|
-
*/
|
|
26
22
|
class MatSnackBarRef {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
this._afterOpened.next();
|
|
88
|
-
this._afterOpened.complete();
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
/** Cleans up the DOM after closing. */
|
|
92
|
-
_finishDismiss() {
|
|
93
|
-
this._overlayRef.dispose();
|
|
94
|
-
if (!this._onAction.closed) {
|
|
95
|
-
this._onAction.complete();
|
|
96
|
-
}
|
|
97
|
-
this._afterDismissed.next({ dismissedByAction: this._dismissedByAction });
|
|
98
|
-
this._afterDismissed.complete();
|
|
99
|
-
this._dismissedByAction = false;
|
|
100
|
-
}
|
|
101
|
-
/** Gets an observable that is notified when the snack bar is finished closing. */
|
|
102
|
-
afterDismissed() {
|
|
103
|
-
return this._afterDismissed;
|
|
104
|
-
}
|
|
105
|
-
/** Gets an observable that is notified when the snack bar has opened and appeared. */
|
|
106
|
-
afterOpened() {
|
|
107
|
-
return this.containerInstance._onEnter;
|
|
108
|
-
}
|
|
109
|
-
/** Gets an observable that is notified when the snack bar action is called. */
|
|
110
|
-
onAction() {
|
|
111
|
-
return this._onAction;
|
|
112
|
-
}
|
|
23
|
+
_overlayRef;
|
|
24
|
+
instance;
|
|
25
|
+
containerInstance;
|
|
26
|
+
_afterDismissed = new Subject();
|
|
27
|
+
_afterOpened = new Subject();
|
|
28
|
+
_onAction = new Subject();
|
|
29
|
+
_durationTimeoutId;
|
|
30
|
+
_dismissedByAction = false;
|
|
31
|
+
constructor(containerInstance, _overlayRef) {
|
|
32
|
+
this._overlayRef = _overlayRef;
|
|
33
|
+
this.containerInstance = containerInstance;
|
|
34
|
+
containerInstance._onExit.subscribe(() => this._finishDismiss());
|
|
35
|
+
}
|
|
36
|
+
dismiss() {
|
|
37
|
+
if (!this._afterDismissed.closed) {
|
|
38
|
+
this.containerInstance.exit();
|
|
39
|
+
}
|
|
40
|
+
clearTimeout(this._durationTimeoutId);
|
|
41
|
+
}
|
|
42
|
+
dismissWithAction() {
|
|
43
|
+
if (!this._onAction.closed) {
|
|
44
|
+
this._dismissedByAction = true;
|
|
45
|
+
this._onAction.next();
|
|
46
|
+
this._onAction.complete();
|
|
47
|
+
this.dismiss();
|
|
48
|
+
}
|
|
49
|
+
clearTimeout(this._durationTimeoutId);
|
|
50
|
+
}
|
|
51
|
+
closeWithAction() {
|
|
52
|
+
this.dismissWithAction();
|
|
53
|
+
}
|
|
54
|
+
_dismissAfter(duration) {
|
|
55
|
+
this._durationTimeoutId = setTimeout(() => this.dismiss(), Math.min(duration, MAX_TIMEOUT));
|
|
56
|
+
}
|
|
57
|
+
_open() {
|
|
58
|
+
if (!this._afterOpened.closed) {
|
|
59
|
+
this._afterOpened.next();
|
|
60
|
+
this._afterOpened.complete();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
_finishDismiss() {
|
|
64
|
+
this._overlayRef.dispose();
|
|
65
|
+
if (!this._onAction.closed) {
|
|
66
|
+
this._onAction.complete();
|
|
67
|
+
}
|
|
68
|
+
this._afterDismissed.next({
|
|
69
|
+
dismissedByAction: this._dismissedByAction
|
|
70
|
+
});
|
|
71
|
+
this._afterDismissed.complete();
|
|
72
|
+
this._dismissedByAction = false;
|
|
73
|
+
}
|
|
74
|
+
afterDismissed() {
|
|
75
|
+
return this._afterDismissed;
|
|
76
|
+
}
|
|
77
|
+
afterOpened() {
|
|
78
|
+
return this.containerInstance._onEnter;
|
|
79
|
+
}
|
|
80
|
+
onAction() {
|
|
81
|
+
return this._onAction;
|
|
82
|
+
}
|
|
113
83
|
}
|
|
114
84
|
|
|
115
|
-
/** Injection token that can be used to access the data that was passed in to a snack bar. */
|
|
116
85
|
const MAT_SNACK_BAR_DATA = new InjectionToken('MatSnackBarData');
|
|
117
|
-
/**
|
|
118
|
-
* Configuration used when opening a snack-bar.
|
|
119
|
-
*/
|
|
120
86
|
class MatSnackBarConfig {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
* injection. Note: this does not affect where the snackbar is inserted in the DOM.
|
|
131
|
-
*/
|
|
132
|
-
viewContainerRef;
|
|
133
|
-
/** The length of time in milliseconds to wait before automatically dismissing the snack bar. */
|
|
134
|
-
duration = 0;
|
|
135
|
-
/** Extra CSS classes to be added to the snack bar container. */
|
|
136
|
-
panelClass;
|
|
137
|
-
/** Text layout direction for the snack bar. */
|
|
138
|
-
direction;
|
|
139
|
-
/** Data being injected into the child component. */
|
|
140
|
-
data = null;
|
|
141
|
-
/** The horizontal position to place the snack bar. */
|
|
142
|
-
horizontalPosition = 'center';
|
|
143
|
-
/** The vertical position to place the snack bar. */
|
|
144
|
-
verticalPosition = 'bottom';
|
|
87
|
+
politeness = 'polite';
|
|
88
|
+
announcementMessage = '';
|
|
89
|
+
viewContainerRef;
|
|
90
|
+
duration = 0;
|
|
91
|
+
panelClass;
|
|
92
|
+
direction;
|
|
93
|
+
data = null;
|
|
94
|
+
horizontalPosition = 'center';
|
|
95
|
+
verticalPosition = 'bottom';
|
|
145
96
|
}
|
|
146
97
|
|
|
147
|
-
/** Directive that should be applied to the text element to be rendered in the snack bar. */
|
|
148
98
|
class MatSnackBarLabel {
|
|
149
|
-
|
|
150
|
-
|
|
99
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
100
|
+
minVersion: "12.0.0",
|
|
101
|
+
version: "20.2.0-next.2",
|
|
102
|
+
ngImport: i0,
|
|
103
|
+
type: MatSnackBarLabel,
|
|
104
|
+
deps: [],
|
|
105
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
106
|
+
});
|
|
107
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
108
|
+
minVersion: "14.0.0",
|
|
109
|
+
version: "20.2.0-next.2",
|
|
110
|
+
type: MatSnackBarLabel,
|
|
111
|
+
isStandalone: true,
|
|
112
|
+
selector: "[matSnackBarLabel]",
|
|
113
|
+
host: {
|
|
114
|
+
classAttribute: "mat-mdc-snack-bar-label mdc-snackbar__label"
|
|
115
|
+
},
|
|
116
|
+
ngImport: i0
|
|
117
|
+
});
|
|
151
118
|
}
|
|
152
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
119
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
120
|
+
minVersion: "12.0.0",
|
|
121
|
+
version: "20.2.0-next.2",
|
|
122
|
+
ngImport: i0,
|
|
123
|
+
type: MatSnackBarLabel,
|
|
124
|
+
decorators: [{
|
|
125
|
+
type: Directive,
|
|
126
|
+
args: [{
|
|
127
|
+
selector: `[matSnackBarLabel]`,
|
|
128
|
+
host: {
|
|
129
|
+
'class': 'mat-mdc-snack-bar-label mdc-snackbar__label'
|
|
130
|
+
}
|
|
131
|
+
}]
|
|
132
|
+
}]
|
|
133
|
+
});
|
|
162
134
|
class MatSnackBarActions {
|
|
163
|
-
|
|
164
|
-
|
|
135
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
136
|
+
minVersion: "12.0.0",
|
|
137
|
+
version: "20.2.0-next.2",
|
|
138
|
+
ngImport: i0,
|
|
139
|
+
type: MatSnackBarActions,
|
|
140
|
+
deps: [],
|
|
141
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
142
|
+
});
|
|
143
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
144
|
+
minVersion: "14.0.0",
|
|
145
|
+
version: "20.2.0-next.2",
|
|
146
|
+
type: MatSnackBarActions,
|
|
147
|
+
isStandalone: true,
|
|
148
|
+
selector: "[matSnackBarActions]",
|
|
149
|
+
host: {
|
|
150
|
+
classAttribute: "mat-mdc-snack-bar-actions mdc-snackbar__actions"
|
|
151
|
+
},
|
|
152
|
+
ngImport: i0
|
|
153
|
+
});
|
|
165
154
|
}
|
|
166
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
155
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
156
|
+
minVersion: "12.0.0",
|
|
157
|
+
version: "20.2.0-next.2",
|
|
158
|
+
ngImport: i0,
|
|
159
|
+
type: MatSnackBarActions,
|
|
160
|
+
decorators: [{
|
|
161
|
+
type: Directive,
|
|
162
|
+
args: [{
|
|
163
|
+
selector: `[matSnackBarActions]`,
|
|
164
|
+
host: {
|
|
165
|
+
'class': 'mat-mdc-snack-bar-actions mdc-snackbar__actions'
|
|
166
|
+
}
|
|
167
|
+
}]
|
|
168
|
+
}]
|
|
169
|
+
});
|
|
176
170
|
class MatSnackBarAction {
|
|
177
|
-
|
|
178
|
-
|
|
171
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
172
|
+
minVersion: "12.0.0",
|
|
173
|
+
version: "20.2.0-next.2",
|
|
174
|
+
ngImport: i0,
|
|
175
|
+
type: MatSnackBarAction,
|
|
176
|
+
deps: [],
|
|
177
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
178
|
+
});
|
|
179
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
180
|
+
minVersion: "14.0.0",
|
|
181
|
+
version: "20.2.0-next.2",
|
|
182
|
+
type: MatSnackBarAction,
|
|
183
|
+
isStandalone: true,
|
|
184
|
+
selector: "[matSnackBarAction]",
|
|
185
|
+
host: {
|
|
186
|
+
classAttribute: "mat-mdc-snack-bar-action mdc-snackbar__action"
|
|
187
|
+
},
|
|
188
|
+
ngImport: i0
|
|
189
|
+
});
|
|
179
190
|
}
|
|
180
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
191
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
192
|
+
minVersion: "12.0.0",
|
|
193
|
+
version: "20.2.0-next.2",
|
|
194
|
+
ngImport: i0,
|
|
195
|
+
type: MatSnackBarAction,
|
|
196
|
+
decorators: [{
|
|
197
|
+
type: Directive,
|
|
198
|
+
args: [{
|
|
199
|
+
selector: `[matSnackBarAction]`,
|
|
200
|
+
host: {
|
|
201
|
+
'class': 'mat-mdc-snack-bar-action mdc-snackbar__action'
|
|
202
|
+
}
|
|
203
|
+
}]
|
|
204
|
+
}]
|
|
205
|
+
});
|
|
189
206
|
|
|
190
207
|
class SimpleSnackBar {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
208
|
+
snackBarRef = inject(MatSnackBarRef);
|
|
209
|
+
data = inject(MAT_SNACK_BAR_DATA);
|
|
210
|
+
constructor() {}
|
|
211
|
+
action() {
|
|
212
|
+
this.snackBarRef.dismissWithAction();
|
|
213
|
+
}
|
|
214
|
+
get hasAction() {
|
|
215
|
+
return !!this.data.action;
|
|
216
|
+
}
|
|
217
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
218
|
+
minVersion: "12.0.0",
|
|
219
|
+
version: "20.2.0-next.2",
|
|
220
|
+
ngImport: i0,
|
|
221
|
+
type: SimpleSnackBar,
|
|
222
|
+
deps: [],
|
|
223
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
224
|
+
});
|
|
225
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
226
|
+
minVersion: "17.0.0",
|
|
227
|
+
version: "20.2.0-next.2",
|
|
228
|
+
type: SimpleSnackBar,
|
|
229
|
+
isStandalone: true,
|
|
230
|
+
selector: "simple-snack-bar",
|
|
231
|
+
host: {
|
|
232
|
+
classAttribute: "mat-mdc-simple-snack-bar"
|
|
233
|
+
},
|
|
234
|
+
exportAs: ["matSnackBar"],
|
|
235
|
+
ngImport: i0,
|
|
236
|
+
template: "<div matSnackBarLabel>\n {{data.message}}\n</div>\n\n@if (hasAction) {\n <div matSnackBarActions>\n <button matButton matSnackBarAction (click)=\"action()\">\n {{data.action}}\n </button>\n </div>\n}\n",
|
|
237
|
+
styles: [".mat-mdc-simple-snack-bar{display:flex}.mat-mdc-simple-snack-bar .mat-mdc-snack-bar-label{max-height:50vh;overflow:auto}\n"],
|
|
238
|
+
dependencies: [{
|
|
239
|
+
kind: "component",
|
|
240
|
+
type: MatButton,
|
|
241
|
+
selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ",
|
|
242
|
+
inputs: ["matButton"],
|
|
243
|
+
exportAs: ["matButton", "matAnchor"]
|
|
244
|
+
}, {
|
|
245
|
+
kind: "directive",
|
|
246
|
+
type: MatSnackBarLabel,
|
|
247
|
+
selector: "[matSnackBarLabel]"
|
|
248
|
+
}, {
|
|
249
|
+
kind: "directive",
|
|
250
|
+
type: MatSnackBarActions,
|
|
251
|
+
selector: "[matSnackBarActions]"
|
|
252
|
+
}, {
|
|
253
|
+
kind: "directive",
|
|
254
|
+
type: MatSnackBarAction,
|
|
255
|
+
selector: "[matSnackBarAction]"
|
|
256
|
+
}],
|
|
257
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
258
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
259
|
+
});
|
|
204
260
|
}
|
|
205
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
261
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
262
|
+
minVersion: "12.0.0",
|
|
263
|
+
version: "20.2.0-next.2",
|
|
264
|
+
ngImport: i0,
|
|
265
|
+
type: SimpleSnackBar,
|
|
266
|
+
decorators: [{
|
|
267
|
+
type: Component,
|
|
268
|
+
args: [{
|
|
269
|
+
selector: 'simple-snack-bar',
|
|
270
|
+
exportAs: 'matSnackBar',
|
|
271
|
+
encapsulation: ViewEncapsulation.None,
|
|
272
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
273
|
+
imports: [MatButton, MatSnackBarLabel, MatSnackBarActions, MatSnackBarAction],
|
|
274
|
+
host: {
|
|
275
|
+
'class': 'mat-mdc-simple-snack-bar'
|
|
276
|
+
},
|
|
277
|
+
template: "<div matSnackBarLabel>\n {{data.message}}\n</div>\n\n@if (hasAction) {\n <div matSnackBarActions>\n <button matButton matSnackBarAction (click)=\"action()\">\n {{data.action}}\n </button>\n </div>\n}\n",
|
|
278
|
+
styles: [".mat-mdc-simple-snack-bar{display:flex}.mat-mdc-simple-snack-bar .mat-mdc-snack-bar-label{max-height:50vh;overflow:auto}\n"]
|
|
279
|
+
}]
|
|
280
|
+
}],
|
|
281
|
+
ctorParameters: () => []
|
|
282
|
+
});
|
|
211
283
|
|
|
212
284
|
const ENTER_ANIMATION = '_mat-snack-bar-enter';
|
|
213
285
|
const EXIT_ANIMATION = '_mat-snack-bar-exit';
|
|
214
|
-
/**
|
|
215
|
-
* Internal component that wraps user-provided snack bar content.
|
|
216
|
-
* @docs-private
|
|
217
|
-
*/
|
|
218
286
|
class MatSnackBarContainer extends BasePortalOutlet {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
* Attaches a DOM portal to the snack bar container.
|
|
302
|
-
* @deprecated To be turned into a method.
|
|
303
|
-
* @breaking-change 10.0.0
|
|
304
|
-
*/
|
|
305
|
-
attachDomPortal = (portal) => {
|
|
306
|
-
this._assertNotAttached();
|
|
307
|
-
const result = this._portalOutlet.attachDomPortal(portal);
|
|
308
|
-
this._afterPortalAttached();
|
|
309
|
-
return result;
|
|
310
|
-
};
|
|
311
|
-
/** Handle end of animations, updating the state of the snackbar. */
|
|
312
|
-
onAnimationEnd(animationName) {
|
|
313
|
-
if (animationName === EXIT_ANIMATION) {
|
|
314
|
-
this._completeExit();
|
|
315
|
-
}
|
|
316
|
-
else if (animationName === ENTER_ANIMATION) {
|
|
317
|
-
clearTimeout(this._enterFallback);
|
|
318
|
-
this._ngZone.run(() => {
|
|
319
|
-
this._onEnter.next();
|
|
320
|
-
this._onEnter.complete();
|
|
321
|
-
});
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
/** Begin animation of snack bar entrance into view. */
|
|
325
|
-
enter() {
|
|
326
|
-
if (!this._destroyed) {
|
|
327
|
-
this._animationState = 'visible';
|
|
328
|
-
// _animationState lives in host bindings and `detectChanges` does not refresh host bindings
|
|
329
|
-
// so we have to call `markForCheck` to ensure the host view is refreshed eventually.
|
|
330
|
-
this._changeDetectorRef.markForCheck();
|
|
331
|
-
this._changeDetectorRef.detectChanges();
|
|
332
|
-
this._screenReaderAnnounce();
|
|
333
|
-
if (this._animationsDisabled) {
|
|
334
|
-
afterNextRender(() => {
|
|
335
|
-
this._ngZone.run(() => queueMicrotask(() => this.onAnimationEnd(ENTER_ANIMATION)));
|
|
336
|
-
}, { injector: this._injector });
|
|
337
|
-
}
|
|
338
|
-
else {
|
|
339
|
-
clearTimeout(this._enterFallback);
|
|
340
|
-
this._enterFallback = setTimeout(() => {
|
|
341
|
-
// The snack bar will stay invisible if it fails to animate. Add a fallback class so it
|
|
342
|
-
// becomes visible. This can happen in some apps that do `* {animation: none !important}`.
|
|
343
|
-
this._elementRef.nativeElement.classList.add('mat-snack-bar-fallback-visible');
|
|
344
|
-
this.onAnimationEnd(ENTER_ANIMATION);
|
|
345
|
-
}, 200);
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
/** Begin animation of the snack bar exiting from view. */
|
|
350
|
-
exit() {
|
|
351
|
-
if (this._destroyed) {
|
|
352
|
-
return of(undefined);
|
|
353
|
-
}
|
|
354
|
-
// It's common for snack bars to be opened by random outside calls like HTTP requests or
|
|
355
|
-
// errors. Run inside the NgZone to ensure that it functions correctly.
|
|
356
|
-
this._ngZone.run(() => {
|
|
357
|
-
// Note: this one transitions to `hidden`, rather than `void`, in order to handle the case
|
|
358
|
-
// where multiple snack bars are opened in quick succession (e.g. two consecutive calls to
|
|
359
|
-
// `MatSnackBar.open`).
|
|
360
|
-
this._animationState = 'hidden';
|
|
361
|
-
this._changeDetectorRef.markForCheck();
|
|
362
|
-
// Mark this element with an 'exit' attribute to indicate that the snackbar has
|
|
363
|
-
// been dismissed and will soon be removed from the DOM. This is used by the snackbar
|
|
364
|
-
// test harness.
|
|
365
|
-
this._elementRef.nativeElement.setAttribute('mat-exit', '');
|
|
366
|
-
// If the snack bar hasn't been announced by the time it exits it wouldn't have been open
|
|
367
|
-
// long enough to visually read it either, so clear the timeout for announcing.
|
|
368
|
-
clearTimeout(this._announceTimeoutId);
|
|
369
|
-
if (this._animationsDisabled) {
|
|
370
|
-
afterNextRender(() => {
|
|
371
|
-
this._ngZone.run(() => queueMicrotask(() => this.onAnimationEnd(EXIT_ANIMATION)));
|
|
372
|
-
}, { injector: this._injector });
|
|
373
|
-
}
|
|
374
|
-
else {
|
|
375
|
-
clearTimeout(this._exitFallback);
|
|
376
|
-
this._exitFallback = setTimeout(() => this.onAnimationEnd(EXIT_ANIMATION), 200);
|
|
377
|
-
}
|
|
287
|
+
_ngZone = inject(NgZone);
|
|
288
|
+
_elementRef = inject(ElementRef);
|
|
289
|
+
_changeDetectorRef = inject(ChangeDetectorRef);
|
|
290
|
+
_platform = inject(Platform);
|
|
291
|
+
_animationsDisabled = _animationsDisabled();
|
|
292
|
+
snackBarConfig = inject(MatSnackBarConfig);
|
|
293
|
+
_document = inject(DOCUMENT);
|
|
294
|
+
_trackedModals = new Set();
|
|
295
|
+
_enterFallback;
|
|
296
|
+
_exitFallback;
|
|
297
|
+
_injector = inject(Injector);
|
|
298
|
+
_announceDelay = 150;
|
|
299
|
+
_announceTimeoutId;
|
|
300
|
+
_destroyed = false;
|
|
301
|
+
_portalOutlet;
|
|
302
|
+
_onAnnounce = new Subject();
|
|
303
|
+
_onExit = new Subject();
|
|
304
|
+
_onEnter = new Subject();
|
|
305
|
+
_animationState = 'void';
|
|
306
|
+
_live;
|
|
307
|
+
_label;
|
|
308
|
+
_role;
|
|
309
|
+
_liveElementId = inject(_IdGenerator).getId('mat-snack-bar-container-live-');
|
|
310
|
+
constructor() {
|
|
311
|
+
super();
|
|
312
|
+
const config = this.snackBarConfig;
|
|
313
|
+
if (config.politeness === 'assertive' && !config.announcementMessage) {
|
|
314
|
+
this._live = 'assertive';
|
|
315
|
+
} else if (config.politeness === 'off') {
|
|
316
|
+
this._live = 'off';
|
|
317
|
+
} else {
|
|
318
|
+
this._live = 'polite';
|
|
319
|
+
}
|
|
320
|
+
if (this._platform.FIREFOX) {
|
|
321
|
+
if (this._live === 'polite') {
|
|
322
|
+
this._role = 'status';
|
|
323
|
+
}
|
|
324
|
+
if (this._live === 'assertive') {
|
|
325
|
+
this._role = 'alert';
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
attachComponentPortal(portal) {
|
|
330
|
+
this._assertNotAttached();
|
|
331
|
+
const result = this._portalOutlet.attachComponentPortal(portal);
|
|
332
|
+
this._afterPortalAttached();
|
|
333
|
+
return result;
|
|
334
|
+
}
|
|
335
|
+
attachTemplatePortal(portal) {
|
|
336
|
+
this._assertNotAttached();
|
|
337
|
+
const result = this._portalOutlet.attachTemplatePortal(portal);
|
|
338
|
+
this._afterPortalAttached();
|
|
339
|
+
return result;
|
|
340
|
+
}
|
|
341
|
+
attachDomPortal = portal => {
|
|
342
|
+
this._assertNotAttached();
|
|
343
|
+
const result = this._portalOutlet.attachDomPortal(portal);
|
|
344
|
+
this._afterPortalAttached();
|
|
345
|
+
return result;
|
|
346
|
+
};
|
|
347
|
+
onAnimationEnd(animationName) {
|
|
348
|
+
if (animationName === EXIT_ANIMATION) {
|
|
349
|
+
this._completeExit();
|
|
350
|
+
} else if (animationName === ENTER_ANIMATION) {
|
|
351
|
+
clearTimeout(this._enterFallback);
|
|
352
|
+
this._ngZone.run(() => {
|
|
353
|
+
this._onEnter.next();
|
|
354
|
+
this._onEnter.complete();
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
enter() {
|
|
359
|
+
if (!this._destroyed) {
|
|
360
|
+
this._animationState = 'visible';
|
|
361
|
+
this._changeDetectorRef.markForCheck();
|
|
362
|
+
this._changeDetectorRef.detectChanges();
|
|
363
|
+
this._screenReaderAnnounce();
|
|
364
|
+
if (this._animationsDisabled) {
|
|
365
|
+
afterNextRender(() => {
|
|
366
|
+
this._ngZone.run(() => queueMicrotask(() => this.onAnimationEnd(ENTER_ANIMATION)));
|
|
367
|
+
}, {
|
|
368
|
+
injector: this._injector
|
|
378
369
|
});
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
370
|
+
} else {
|
|
371
|
+
clearTimeout(this._enterFallback);
|
|
372
|
+
this._enterFallback = setTimeout(() => {
|
|
373
|
+
this._elementRef.nativeElement.classList.add('mat-snack-bar-fallback-visible');
|
|
374
|
+
this.onAnimationEnd(ENTER_ANIMATION);
|
|
375
|
+
}, 200);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
exit() {
|
|
380
|
+
if (this._destroyed) {
|
|
381
|
+
return of(undefined);
|
|
382
|
+
}
|
|
383
|
+
this._ngZone.run(() => {
|
|
384
|
+
this._animationState = 'hidden';
|
|
385
|
+
this._changeDetectorRef.markForCheck();
|
|
386
|
+
this._elementRef.nativeElement.setAttribute('mat-exit', '');
|
|
387
|
+
clearTimeout(this._announceTimeoutId);
|
|
388
|
+
if (this._animationsDisabled) {
|
|
389
|
+
afterNextRender(() => {
|
|
390
|
+
this._ngZone.run(() => queueMicrotask(() => this.onAnimationEnd(EXIT_ANIMATION)));
|
|
391
|
+
}, {
|
|
392
|
+
injector: this._injector
|
|
392
393
|
});
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
* announce it.
|
|
469
|
-
*/
|
|
470
|
-
_screenReaderAnnounce() {
|
|
471
|
-
if (this._announceTimeoutId) {
|
|
472
|
-
return;
|
|
394
|
+
} else {
|
|
395
|
+
clearTimeout(this._exitFallback);
|
|
396
|
+
this._exitFallback = setTimeout(() => this.onAnimationEnd(EXIT_ANIMATION), 200);
|
|
397
|
+
}
|
|
398
|
+
});
|
|
399
|
+
return this._onExit;
|
|
400
|
+
}
|
|
401
|
+
ngOnDestroy() {
|
|
402
|
+
this._destroyed = true;
|
|
403
|
+
this._clearFromModals();
|
|
404
|
+
this._completeExit();
|
|
405
|
+
}
|
|
406
|
+
_completeExit() {
|
|
407
|
+
clearTimeout(this._exitFallback);
|
|
408
|
+
queueMicrotask(() => {
|
|
409
|
+
this._onExit.next();
|
|
410
|
+
this._onExit.complete();
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
_afterPortalAttached() {
|
|
414
|
+
const element = this._elementRef.nativeElement;
|
|
415
|
+
const panelClasses = this.snackBarConfig.panelClass;
|
|
416
|
+
if (panelClasses) {
|
|
417
|
+
if (Array.isArray(panelClasses)) {
|
|
418
|
+
panelClasses.forEach(cssClass => element.classList.add(cssClass));
|
|
419
|
+
} else {
|
|
420
|
+
element.classList.add(panelClasses);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
this._exposeToModals();
|
|
424
|
+
const label = this._label.nativeElement;
|
|
425
|
+
const labelClass = 'mdc-snackbar__label';
|
|
426
|
+
label.classList.toggle(labelClass, !label.querySelector(`.${labelClass}`));
|
|
427
|
+
}
|
|
428
|
+
_exposeToModals() {
|
|
429
|
+
const id = this._liveElementId;
|
|
430
|
+
const modals = this._document.querySelectorAll('body > .cdk-overlay-container [aria-modal="true"]');
|
|
431
|
+
for (let i = 0; i < modals.length; i++) {
|
|
432
|
+
const modal = modals[i];
|
|
433
|
+
const ariaOwns = modal.getAttribute('aria-owns');
|
|
434
|
+
this._trackedModals.add(modal);
|
|
435
|
+
if (!ariaOwns) {
|
|
436
|
+
modal.setAttribute('aria-owns', id);
|
|
437
|
+
} else if (ariaOwns.indexOf(id) === -1) {
|
|
438
|
+
modal.setAttribute('aria-owns', ariaOwns + ' ' + id);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
_clearFromModals() {
|
|
443
|
+
this._trackedModals.forEach(modal => {
|
|
444
|
+
const ariaOwns = modal.getAttribute('aria-owns');
|
|
445
|
+
if (ariaOwns) {
|
|
446
|
+
const newValue = ariaOwns.replace(this._liveElementId, '').trim();
|
|
447
|
+
if (newValue.length > 0) {
|
|
448
|
+
modal.setAttribute('aria-owns', newValue);
|
|
449
|
+
} else {
|
|
450
|
+
modal.removeAttribute('aria-owns');
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
});
|
|
454
|
+
this._trackedModals.clear();
|
|
455
|
+
}
|
|
456
|
+
_assertNotAttached() {
|
|
457
|
+
if (this._portalOutlet.hasAttached() && (typeof ngDevMode === 'undefined' || ngDevMode)) {
|
|
458
|
+
throw Error('Attempting to attach snack bar content after content is already attached');
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
_screenReaderAnnounce() {
|
|
462
|
+
if (this._announceTimeoutId) {
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
465
|
+
this._ngZone.runOutsideAngular(() => {
|
|
466
|
+
this._announceTimeoutId = setTimeout(() => {
|
|
467
|
+
if (this._destroyed) {
|
|
468
|
+
return;
|
|
473
469
|
}
|
|
474
|
-
this.
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
470
|
+
const element = this._elementRef.nativeElement;
|
|
471
|
+
const inertElement = element.querySelector('[aria-hidden]');
|
|
472
|
+
const liveElement = element.querySelector('[aria-live]');
|
|
473
|
+
if (inertElement && liveElement) {
|
|
474
|
+
let focusedElement = null;
|
|
475
|
+
if (this._platform.isBrowser && document.activeElement instanceof HTMLElement && inertElement.contains(document.activeElement)) {
|
|
476
|
+
focusedElement = document.activeElement;
|
|
477
|
+
}
|
|
478
|
+
inertElement.removeAttribute('aria-hidden');
|
|
479
|
+
liveElement.appendChild(inertElement);
|
|
480
|
+
focusedElement?.focus();
|
|
481
|
+
this._onAnnounce.next();
|
|
482
|
+
this._onAnnounce.complete();
|
|
483
|
+
}
|
|
484
|
+
}, this._announceDelay);
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
488
|
+
minVersion: "12.0.0",
|
|
489
|
+
version: "20.2.0-next.2",
|
|
490
|
+
ngImport: i0,
|
|
491
|
+
type: MatSnackBarContainer,
|
|
492
|
+
deps: [],
|
|
493
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
494
|
+
});
|
|
495
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
496
|
+
minVersion: "14.0.0",
|
|
497
|
+
version: "20.2.0-next.2",
|
|
498
|
+
type: MatSnackBarContainer,
|
|
499
|
+
isStandalone: true,
|
|
500
|
+
selector: "mat-snack-bar-container",
|
|
501
|
+
host: {
|
|
502
|
+
listeners: {
|
|
503
|
+
"animationend": "onAnimationEnd($event.animationName)",
|
|
504
|
+
"animationcancel": "onAnimationEnd($event.animationName)"
|
|
505
|
+
},
|
|
506
|
+
properties: {
|
|
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
|
+
},
|
|
511
|
+
classAttribute: "mdc-snackbar mat-mdc-snack-bar-container"
|
|
512
|
+
},
|
|
513
|
+
viewQueries: [{
|
|
514
|
+
propertyName: "_portalOutlet",
|
|
515
|
+
first: true,
|
|
516
|
+
predicate: CdkPortalOutlet,
|
|
517
|
+
descendants: true,
|
|
518
|
+
static: true
|
|
519
|
+
}, {
|
|
520
|
+
propertyName: "_label",
|
|
521
|
+
first: true,
|
|
522
|
+
predicate: ["label"],
|
|
523
|
+
descendants: true,
|
|
524
|
+
static: true
|
|
525
|
+
}],
|
|
526
|
+
usesInheritance: true,
|
|
527
|
+
ngImport: i0,
|
|
528
|
+
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",
|
|
529
|
+
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(--mat-snack-bar-supporting-text-color, var(--mat-sys-inverse-on-surface));border-radius:var(--mat-snack-bar-container-shape, var(--mat-sys-corner-extra-small));background-color:var(--mat-snack-bar-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(--mat-snack-bar-supporting-text-font, var(--mat-sys-body-medium-font));font-size:var(--mat-snack-bar-supporting-text-size, var(--mat-sys-body-medium-size));font-weight:var(--mat-snack-bar-supporting-text-weight, var(--mat-sys-body-medium-weight));line-height:var(--mat-snack-bar-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-button-text-state-layer-color: currentColor;--mat-button-text-ripple-color: currentColor}.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-ripple-element{opacity:.1}\n"],
|
|
530
|
+
dependencies: [{
|
|
531
|
+
kind: "directive",
|
|
532
|
+
type: CdkPortalOutlet,
|
|
533
|
+
selector: "[cdkPortalOutlet]",
|
|
534
|
+
inputs: ["cdkPortalOutlet"],
|
|
535
|
+
outputs: ["attached"],
|
|
536
|
+
exportAs: ["cdkPortalOutlet"]
|
|
537
|
+
}],
|
|
538
|
+
changeDetection: i0.ChangeDetectionStrategy.Default,
|
|
539
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
540
|
+
});
|
|
502
541
|
}
|
|
503
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
542
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
543
|
+
minVersion: "12.0.0",
|
|
544
|
+
version: "20.2.0-next.2",
|
|
545
|
+
ngImport: i0,
|
|
546
|
+
type: MatSnackBarContainer,
|
|
547
|
+
decorators: [{
|
|
548
|
+
type: Component,
|
|
549
|
+
args: [{
|
|
550
|
+
selector: 'mat-snack-bar-container',
|
|
551
|
+
changeDetection: ChangeDetectionStrategy.Default,
|
|
552
|
+
encapsulation: ViewEncapsulation.None,
|
|
553
|
+
imports: [CdkPortalOutlet],
|
|
554
|
+
host: {
|
|
555
|
+
'class': 'mdc-snackbar mat-mdc-snack-bar-container',
|
|
556
|
+
'[class.mat-snack-bar-container-enter]': '_animationState === "visible"',
|
|
557
|
+
'[class.mat-snack-bar-container-exit]': '_animationState === "hidden"',
|
|
558
|
+
'[class.mat-snack-bar-container-animations-enabled]': '!_animationsDisabled',
|
|
559
|
+
'(animationend)': 'onAnimationEnd($event.animationName)',
|
|
560
|
+
'(animationcancel)': 'onAnimationEnd($event.animationName)'
|
|
561
|
+
},
|
|
562
|
+
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",
|
|
563
|
+
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(--mat-snack-bar-supporting-text-color, var(--mat-sys-inverse-on-surface));border-radius:var(--mat-snack-bar-container-shape, var(--mat-sys-corner-extra-small));background-color:var(--mat-snack-bar-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(--mat-snack-bar-supporting-text-font, var(--mat-sys-body-medium-font));font-size:var(--mat-snack-bar-supporting-text-size, var(--mat-sys-body-medium-size));font-weight:var(--mat-snack-bar-supporting-text-weight, var(--mat-sys-body-medium-weight));line-height:var(--mat-snack-bar-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-button-text-state-layer-color: currentColor;--mat-button-text-ripple-color: currentColor}.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-ripple-element{opacity:.1}\n"]
|
|
564
|
+
}]
|
|
565
|
+
}],
|
|
566
|
+
ctorParameters: () => [],
|
|
567
|
+
propDecorators: {
|
|
568
|
+
_portalOutlet: [{
|
|
569
|
+
type: ViewChild,
|
|
570
|
+
args: [CdkPortalOutlet, {
|
|
571
|
+
static: true
|
|
572
|
+
}]
|
|
573
|
+
}],
|
|
574
|
+
_label: [{
|
|
575
|
+
type: ViewChild,
|
|
576
|
+
args: ['label', {
|
|
577
|
+
static: true
|
|
578
|
+
}]
|
|
579
|
+
}]
|
|
580
|
+
}
|
|
581
|
+
});
|
|
520
582
|
|
|
521
|
-
/** Injection token that can be used to specify default snack bar. */
|
|
522
583
|
const MAT_SNACK_BAR_DEFAULT_OPTIONS = new InjectionToken('mat-snack-bar-default-options', {
|
|
523
|
-
|
|
524
|
-
|
|
584
|
+
providedIn: 'root',
|
|
585
|
+
factory: () => new MatSnackBarConfig()
|
|
525
586
|
});
|
|
526
|
-
/**
|
|
527
|
-
* Service to dispatch Material Design snack bar messages.
|
|
528
|
-
*/
|
|
529
587
|
class MatSnackBar {
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
overlayConfig.direction = config.direction;
|
|
705
|
-
const positionStrategy = createGlobalPositionStrategy(this._injector);
|
|
706
|
-
// Set horizontal position.
|
|
707
|
-
const isRtl = config.direction === 'rtl';
|
|
708
|
-
const isLeft = config.horizontalPosition === 'left' ||
|
|
709
|
-
(config.horizontalPosition === 'start' && !isRtl) ||
|
|
710
|
-
(config.horizontalPosition === 'end' && isRtl);
|
|
711
|
-
const isRight = !isLeft && config.horizontalPosition !== 'center';
|
|
712
|
-
if (isLeft) {
|
|
713
|
-
positionStrategy.left('0');
|
|
714
|
-
}
|
|
715
|
-
else if (isRight) {
|
|
716
|
-
positionStrategy.right('0');
|
|
717
|
-
}
|
|
718
|
-
else {
|
|
719
|
-
positionStrategy.centerHorizontally();
|
|
720
|
-
}
|
|
721
|
-
// Set horizontal position.
|
|
722
|
-
if (config.verticalPosition === 'top') {
|
|
723
|
-
positionStrategy.top('0');
|
|
724
|
-
}
|
|
725
|
-
else {
|
|
726
|
-
positionStrategy.bottom('0');
|
|
727
|
-
}
|
|
728
|
-
overlayConfig.positionStrategy = positionStrategy;
|
|
729
|
-
overlayConfig.disableAnimations = this._animationsDisabled;
|
|
730
|
-
return createOverlayRef(this._injector, overlayConfig);
|
|
731
|
-
}
|
|
732
|
-
/**
|
|
733
|
-
* Creates an injector to be used inside of a snack bar component.
|
|
734
|
-
* @param config Config that was used to create the snack bar.
|
|
735
|
-
* @param snackBarRef Reference to the snack bar.
|
|
736
|
-
*/
|
|
737
|
-
_createInjector(config, snackBarRef) {
|
|
738
|
-
const userInjector = config && config.viewContainerRef && config.viewContainerRef.injector;
|
|
739
|
-
return Injector.create({
|
|
740
|
-
parent: userInjector || this._injector,
|
|
741
|
-
providers: [
|
|
742
|
-
{ provide: MatSnackBarRef, useValue: snackBarRef },
|
|
743
|
-
{ provide: MAT_SNACK_BAR_DATA, useValue: config.data },
|
|
744
|
-
],
|
|
745
|
-
});
|
|
746
|
-
}
|
|
747
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: MatSnackBar, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
748
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: MatSnackBar, providedIn: 'root' });
|
|
588
|
+
_live = inject(LiveAnnouncer);
|
|
589
|
+
_injector = inject(Injector);
|
|
590
|
+
_breakpointObserver = inject(BreakpointObserver);
|
|
591
|
+
_parentSnackBar = inject(MatSnackBar, {
|
|
592
|
+
optional: true,
|
|
593
|
+
skipSelf: true
|
|
594
|
+
});
|
|
595
|
+
_defaultConfig = inject(MAT_SNACK_BAR_DEFAULT_OPTIONS);
|
|
596
|
+
_animationsDisabled = _animationsDisabled();
|
|
597
|
+
_snackBarRefAtThisLevel = null;
|
|
598
|
+
simpleSnackBarComponent = SimpleSnackBar;
|
|
599
|
+
snackBarContainerComponent = MatSnackBarContainer;
|
|
600
|
+
handsetCssClass = 'mat-mdc-snack-bar-handset';
|
|
601
|
+
get _openedSnackBarRef() {
|
|
602
|
+
const parent = this._parentSnackBar;
|
|
603
|
+
return parent ? parent._openedSnackBarRef : this._snackBarRefAtThisLevel;
|
|
604
|
+
}
|
|
605
|
+
set _openedSnackBarRef(value) {
|
|
606
|
+
if (this._parentSnackBar) {
|
|
607
|
+
this._parentSnackBar._openedSnackBarRef = value;
|
|
608
|
+
} else {
|
|
609
|
+
this._snackBarRefAtThisLevel = value;
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
constructor() {}
|
|
613
|
+
openFromComponent(component, config) {
|
|
614
|
+
return this._attach(component, config);
|
|
615
|
+
}
|
|
616
|
+
openFromTemplate(template, config) {
|
|
617
|
+
return this._attach(template, config);
|
|
618
|
+
}
|
|
619
|
+
open(message, action = '', config) {
|
|
620
|
+
const _config = {
|
|
621
|
+
...this._defaultConfig,
|
|
622
|
+
...config
|
|
623
|
+
};
|
|
624
|
+
_config.data = {
|
|
625
|
+
message,
|
|
626
|
+
action
|
|
627
|
+
};
|
|
628
|
+
if (_config.announcementMessage === message) {
|
|
629
|
+
_config.announcementMessage = undefined;
|
|
630
|
+
}
|
|
631
|
+
return this.openFromComponent(this.simpleSnackBarComponent, _config);
|
|
632
|
+
}
|
|
633
|
+
dismiss() {
|
|
634
|
+
if (this._openedSnackBarRef) {
|
|
635
|
+
this._openedSnackBarRef.dismiss();
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
ngOnDestroy() {
|
|
639
|
+
if (this._snackBarRefAtThisLevel) {
|
|
640
|
+
this._snackBarRefAtThisLevel.dismiss();
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
_attachSnackBarContainer(overlayRef, config) {
|
|
644
|
+
const userInjector = config && config.viewContainerRef && config.viewContainerRef.injector;
|
|
645
|
+
const injector = Injector.create({
|
|
646
|
+
parent: userInjector || this._injector,
|
|
647
|
+
providers: [{
|
|
648
|
+
provide: MatSnackBarConfig,
|
|
649
|
+
useValue: config
|
|
650
|
+
}]
|
|
651
|
+
});
|
|
652
|
+
const containerPortal = new ComponentPortal(this.snackBarContainerComponent, config.viewContainerRef, injector);
|
|
653
|
+
const containerRef = overlayRef.attach(containerPortal);
|
|
654
|
+
containerRef.instance.snackBarConfig = config;
|
|
655
|
+
return containerRef.instance;
|
|
656
|
+
}
|
|
657
|
+
_attach(content, userConfig) {
|
|
658
|
+
const config = {
|
|
659
|
+
...new MatSnackBarConfig(),
|
|
660
|
+
...this._defaultConfig,
|
|
661
|
+
...userConfig
|
|
662
|
+
};
|
|
663
|
+
const overlayRef = this._createOverlay(config);
|
|
664
|
+
const container = this._attachSnackBarContainer(overlayRef, config);
|
|
665
|
+
const snackBarRef = new MatSnackBarRef(container, overlayRef);
|
|
666
|
+
if (content instanceof TemplateRef) {
|
|
667
|
+
const portal = new TemplatePortal(content, null, {
|
|
668
|
+
$implicit: config.data,
|
|
669
|
+
snackBarRef
|
|
670
|
+
});
|
|
671
|
+
snackBarRef.instance = container.attachTemplatePortal(portal);
|
|
672
|
+
} else {
|
|
673
|
+
const injector = this._createInjector(config, snackBarRef);
|
|
674
|
+
const portal = new ComponentPortal(content, undefined, injector);
|
|
675
|
+
const contentRef = container.attachComponentPortal(portal);
|
|
676
|
+
snackBarRef.instance = contentRef.instance;
|
|
677
|
+
}
|
|
678
|
+
this._breakpointObserver.observe(Breakpoints.HandsetPortrait).pipe(takeUntil(overlayRef.detachments())).subscribe(state => {
|
|
679
|
+
overlayRef.overlayElement.classList.toggle(this.handsetCssClass, state.matches);
|
|
680
|
+
});
|
|
681
|
+
if (config.announcementMessage) {
|
|
682
|
+
container._onAnnounce.subscribe(() => {
|
|
683
|
+
this._live.announce(config.announcementMessage, config.politeness);
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
this._animateSnackBar(snackBarRef, config);
|
|
687
|
+
this._openedSnackBarRef = snackBarRef;
|
|
688
|
+
return this._openedSnackBarRef;
|
|
689
|
+
}
|
|
690
|
+
_animateSnackBar(snackBarRef, config) {
|
|
691
|
+
snackBarRef.afterDismissed().subscribe(() => {
|
|
692
|
+
if (this._openedSnackBarRef == snackBarRef) {
|
|
693
|
+
this._openedSnackBarRef = null;
|
|
694
|
+
}
|
|
695
|
+
if (config.announcementMessage) {
|
|
696
|
+
this._live.clear();
|
|
697
|
+
}
|
|
698
|
+
});
|
|
699
|
+
if (config.duration && config.duration > 0) {
|
|
700
|
+
snackBarRef.afterOpened().subscribe(() => snackBarRef._dismissAfter(config.duration));
|
|
701
|
+
}
|
|
702
|
+
if (this._openedSnackBarRef) {
|
|
703
|
+
this._openedSnackBarRef.afterDismissed().subscribe(() => {
|
|
704
|
+
snackBarRef.containerInstance.enter();
|
|
705
|
+
});
|
|
706
|
+
this._openedSnackBarRef.dismiss();
|
|
707
|
+
} else {
|
|
708
|
+
snackBarRef.containerInstance.enter();
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
_createOverlay(config) {
|
|
712
|
+
const overlayConfig = new OverlayConfig();
|
|
713
|
+
overlayConfig.direction = config.direction;
|
|
714
|
+
const positionStrategy = createGlobalPositionStrategy(this._injector);
|
|
715
|
+
const isRtl = config.direction === 'rtl';
|
|
716
|
+
const isLeft = config.horizontalPosition === 'left' || config.horizontalPosition === 'start' && !isRtl || config.horizontalPosition === 'end' && isRtl;
|
|
717
|
+
const isRight = !isLeft && config.horizontalPosition !== 'center';
|
|
718
|
+
if (isLeft) {
|
|
719
|
+
positionStrategy.left('0');
|
|
720
|
+
} else if (isRight) {
|
|
721
|
+
positionStrategy.right('0');
|
|
722
|
+
} else {
|
|
723
|
+
positionStrategy.centerHorizontally();
|
|
724
|
+
}
|
|
725
|
+
if (config.verticalPosition === 'top') {
|
|
726
|
+
positionStrategy.top('0');
|
|
727
|
+
} else {
|
|
728
|
+
positionStrategy.bottom('0');
|
|
729
|
+
}
|
|
730
|
+
overlayConfig.positionStrategy = positionStrategy;
|
|
731
|
+
overlayConfig.disableAnimations = this._animationsDisabled;
|
|
732
|
+
return createOverlayRef(this._injector, overlayConfig);
|
|
733
|
+
}
|
|
734
|
+
_createInjector(config, snackBarRef) {
|
|
735
|
+
const userInjector = config && config.viewContainerRef && config.viewContainerRef.injector;
|
|
736
|
+
return Injector.create({
|
|
737
|
+
parent: userInjector || this._injector,
|
|
738
|
+
providers: [{
|
|
739
|
+
provide: MatSnackBarRef,
|
|
740
|
+
useValue: snackBarRef
|
|
741
|
+
}, {
|
|
742
|
+
provide: MAT_SNACK_BAR_DATA,
|
|
743
|
+
useValue: config.data
|
|
744
|
+
}]
|
|
745
|
+
});
|
|
746
|
+
}
|
|
747
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
748
|
+
minVersion: "12.0.0",
|
|
749
|
+
version: "20.2.0-next.2",
|
|
750
|
+
ngImport: i0,
|
|
751
|
+
type: MatSnackBar,
|
|
752
|
+
deps: [],
|
|
753
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
754
|
+
});
|
|
755
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
756
|
+
minVersion: "12.0.0",
|
|
757
|
+
version: "20.2.0-next.2",
|
|
758
|
+
ngImport: i0,
|
|
759
|
+
type: MatSnackBar,
|
|
760
|
+
providedIn: 'root'
|
|
761
|
+
});
|
|
749
762
|
}
|
|
750
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
763
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
764
|
+
minVersion: "12.0.0",
|
|
765
|
+
version: "20.2.0-next.2",
|
|
766
|
+
ngImport: i0,
|
|
767
|
+
type: MatSnackBar,
|
|
768
|
+
decorators: [{
|
|
769
|
+
type: Injectable,
|
|
770
|
+
args: [{
|
|
771
|
+
providedIn: 'root'
|
|
772
|
+
}]
|
|
773
|
+
}],
|
|
774
|
+
ctorParameters: () => []
|
|
775
|
+
});
|
|
754
776
|
|
|
755
777
|
const DIRECTIVES = [MatSnackBarContainer, MatSnackBarLabel, MatSnackBarActions, MatSnackBarAction];
|
|
756
778
|
class MatSnackBarModule {
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
779
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
780
|
+
minVersion: "12.0.0",
|
|
781
|
+
version: "20.2.0-next.2",
|
|
782
|
+
ngImport: i0,
|
|
783
|
+
type: MatSnackBarModule,
|
|
784
|
+
deps: [],
|
|
785
|
+
target: i0.ɵɵFactoryTarget.NgModule
|
|
786
|
+
});
|
|
787
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({
|
|
788
|
+
minVersion: "14.0.0",
|
|
789
|
+
version: "20.2.0-next.2",
|
|
790
|
+
ngImport: i0,
|
|
791
|
+
type: MatSnackBarModule,
|
|
792
|
+
imports: [OverlayModule, PortalModule, MatButtonModule, SimpleSnackBar, MatSnackBarContainer, MatSnackBarLabel, MatSnackBarActions, MatSnackBarAction],
|
|
793
|
+
exports: [BidiModule, MatSnackBarContainer, MatSnackBarLabel, MatSnackBarActions, MatSnackBarAction]
|
|
794
|
+
});
|
|
795
|
+
static ɵinj = i0.ɵɵngDeclareInjector({
|
|
796
|
+
minVersion: "12.0.0",
|
|
797
|
+
version: "20.2.0-next.2",
|
|
798
|
+
ngImport: i0,
|
|
799
|
+
type: MatSnackBarModule,
|
|
800
|
+
providers: [MatSnackBar],
|
|
801
|
+
imports: [OverlayModule, PortalModule, MatButtonModule, SimpleSnackBar, BidiModule]
|
|
802
|
+
});
|
|
760
803
|
}
|
|
761
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
804
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
805
|
+
minVersion: "12.0.0",
|
|
806
|
+
version: "20.2.0-next.2",
|
|
807
|
+
ngImport: i0,
|
|
808
|
+
type: MatSnackBarModule,
|
|
809
|
+
decorators: [{
|
|
810
|
+
type: NgModule,
|
|
811
|
+
args: [{
|
|
812
|
+
imports: [OverlayModule, PortalModule, MatButtonModule, SimpleSnackBar, ...DIRECTIVES],
|
|
813
|
+
exports: [BidiModule, ...DIRECTIVES],
|
|
814
|
+
providers: [MatSnackBar]
|
|
815
|
+
}]
|
|
816
|
+
}]
|
|
817
|
+
});
|
|
769
818
|
|
|
770
819
|
export { MAT_SNACK_BAR_DATA, MAT_SNACK_BAR_DEFAULT_OPTIONS, MatSnackBar, MatSnackBarAction, MatSnackBarActions, MatSnackBarConfig, MatSnackBarContainer, MatSnackBarLabel, MatSnackBarModule, MatSnackBarRef, SimpleSnackBar };
|
|
771
820
|
//# sourceMappingURL=snack-bar.mjs.map
|