@ng-matero/extensions 12.7.0 → 12.9.0
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/_all-theme.scss +2 -0
- package/_index.scss +1 -0
- package/_theming.scss +1 -0
- package/bundles/extensions.umd.js +18 -11
- package/bundles/extensions.umd.js.map +1 -1
- package/bundles/mtxDrawer.umd.js +936 -0
- package/bundles/mtxDrawer.umd.js.map +1 -0
- package/bundles/mtxGrid.umd.js +45 -25
- package/bundles/mtxGrid.umd.js.map +1 -1
- package/bundles/mtxPopover.umd.js +5 -8
- package/bundles/mtxPopover.umd.js.map +1 -1
- package/bundles/mtxSelect.umd.js +1 -0
- package/bundles/mtxSelect.umd.js.map +1 -1
- package/drawer/_drawer-theme.import.scss +2 -0
- package/drawer/_drawer-theme.scss +40 -0
- package/drawer/drawer-animation.d.ts +5 -0
- package/drawer/drawer-config.d.ts +53 -0
- package/drawer/drawer-container.d.ts +80 -0
- package/drawer/drawer-container.scss +32 -0
- package/drawer/drawer-module.d.ts +2 -0
- package/drawer/drawer-ref.d.ts +44 -0
- package/drawer/drawer.d.ts +58 -0
- package/drawer/mtxDrawer.d.ts +4 -0
- package/drawer/mtxDrawer.metadata.json +1 -0
- package/drawer/package.json +11 -0
- package/drawer/public-api.d.ts +6 -0
- package/esm2015/drawer/drawer-animation.js +18 -0
- package/esm2015/drawer/drawer-config.js +39 -0
- package/esm2015/drawer/drawer-container.js +261 -0
- package/esm2015/drawer/drawer-module.js +18 -0
- package/esm2015/drawer/drawer-ref.js +90 -0
- package/esm2015/drawer/drawer.js +166 -0
- package/esm2015/drawer/mtxDrawer.js +5 -0
- package/esm2015/drawer/public-api.js +7 -0
- package/esm2015/extensions.module.js +5 -3
- package/esm2015/grid/cell.component.js +4 -4
- package/esm2015/grid/column-menu.component.js +29 -8
- package/esm2015/grid/grid.component.js +12 -17
- package/esm2015/grid/grid.interface.js +1 -1
- package/esm2015/popover/popover.js +5 -9
- package/esm2015/public-api.js +3 -2
- package/esm2015/select/select.component.js +2 -1
- package/extensions.metadata.json +1 -1
- package/fesm2015/extensions.js +6 -3
- package/fesm2015/extensions.js.map +1 -1
- package/fesm2015/mtxDrawer.js +586 -0
- package/fesm2015/mtxDrawer.js.map +1 -0
- package/fesm2015/mtxGrid.js +42 -26
- package/fesm2015/mtxGrid.js.map +1 -1
- package/fesm2015/mtxPopover.js +4 -8
- package/fesm2015/mtxPopover.js.map +1 -1
- package/fesm2015/mtxSelect.js +1 -0
- package/fesm2015/mtxSelect.js.map +1 -1
- package/grid/cell.component.d.ts +1 -1
- package/grid/cell.component.scss +0 -9
- package/grid/column-menu.component.d.ts +10 -5
- package/grid/column-menu.component.scss +28 -2
- package/grid/grid.component.d.ts +5 -5
- package/grid/grid.component.scss +27 -9
- package/grid/grid.interface.d.ts +12 -12
- package/grid/mtxGrid.metadata.json +1 -1
- package/package.json +1 -1
- package/popover/popover.d.ts +0 -4
- package/public-api.d.ts +2 -1
- package/select/mtxSelect.metadata.json +1 -1
|
@@ -0,0 +1,936 @@
|
|
|
1
|
+
(function (global, factory) {
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/cdk/overlay'), require('@angular/cdk/portal'), require('@angular/core'), require('@angular/material/core'), require('@angular/cdk/bidi'), require('rxjs'), require('@angular/cdk/a11y'), require('@angular/cdk/coercion'), require('@angular/cdk/layout'), require('@angular/cdk/platform'), require('@angular/common'), require('@angular/animations'), require('@angular/cdk/keycodes'), require('rxjs/operators')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@ng-matero/extensions/drawer', ['exports', '@angular/cdk/overlay', '@angular/cdk/portal', '@angular/core', '@angular/material/core', '@angular/cdk/bidi', 'rxjs', '@angular/cdk/a11y', '@angular/cdk/coercion', '@angular/cdk/layout', '@angular/cdk/platform', '@angular/common', '@angular/animations', '@angular/cdk/keycodes', 'rxjs/operators'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global["ng-matero"] = global["ng-matero"] || {}, global["ng-matero"].extensions = global["ng-matero"].extensions || {}, global["ng-matero"].extensions.drawer = {}), global.ng.cdk.overlay, global.ng.cdk.portal, global.ng.core, global.ng.material.core, global.ng.cdk.bidi, global.rxjs, global.ng.cdk.a11y, global.ng.cdk.coercion, global.ng.cdk.layout, global.ng.cdk.platform, global.ng.common, global.ng.animations, global.ng.cdk.keycodes, global.rxjs.operators));
|
|
5
|
+
})(this, (function (exports, overlay, portal, core, core$1, bidi, rxjs, a11y, coercion, layout, platform, common, animations, keycodes, operators) { 'use strict';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Configuration used when opening a drawer.
|
|
9
|
+
*/
|
|
10
|
+
var MtxDrawerConfig = /** @class */ (function () {
|
|
11
|
+
function MtxDrawerConfig() {
|
|
12
|
+
/** Data being injected into the child component. */
|
|
13
|
+
this.data = null;
|
|
14
|
+
/** Whether the drawer has a backdrop. */
|
|
15
|
+
this.hasBackdrop = true;
|
|
16
|
+
/** Whether the user can use escape or clicking outside to close the drawer. */
|
|
17
|
+
this.disableClose = false;
|
|
18
|
+
/** Aria label to assign to the drawer element. */
|
|
19
|
+
this.ariaLabel = null;
|
|
20
|
+
/**
|
|
21
|
+
* Whether the drawer should close when the user goes backwards/forwards in history.
|
|
22
|
+
* Note that this usually doesn't include clicking on links (unless the user is using
|
|
23
|
+
* the `HashLocationStrategy`).
|
|
24
|
+
*/
|
|
25
|
+
this.closeOnNavigation = true;
|
|
26
|
+
/**
|
|
27
|
+
* Where the drawer should focus on open.
|
|
28
|
+
* @breaking-change 14.0.0 Remove boolean option from autoFocus. Use string or
|
|
29
|
+
* AutoFocusTarget instead.
|
|
30
|
+
*/
|
|
31
|
+
this.autoFocus = 'first-tabbable';
|
|
32
|
+
/**
|
|
33
|
+
* Whether the drawer should restore focus to the
|
|
34
|
+
* previously-focused element, after it's closed.
|
|
35
|
+
*/
|
|
36
|
+
this.restoreFocus = true;
|
|
37
|
+
/** Position of the drawer */
|
|
38
|
+
this.position = 'right';
|
|
39
|
+
/** Width of the drawer. */
|
|
40
|
+
this.width = '';
|
|
41
|
+
/** Height of the drawer. */
|
|
42
|
+
this.height = '';
|
|
43
|
+
}
|
|
44
|
+
return MtxDrawerConfig;
|
|
45
|
+
}());
|
|
46
|
+
|
|
47
|
+
/*! *****************************************************************************
|
|
48
|
+
Copyright (c) Microsoft Corporation.
|
|
49
|
+
|
|
50
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
51
|
+
purpose with or without fee is hereby granted.
|
|
52
|
+
|
|
53
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
54
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
55
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
56
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
57
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
58
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
59
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
60
|
+
***************************************************************************** */
|
|
61
|
+
/* global Reflect, Promise */
|
|
62
|
+
var extendStatics = function (d, b) {
|
|
63
|
+
extendStatics = Object.setPrototypeOf ||
|
|
64
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
65
|
+
function (d, b) { for (var p in b)
|
|
66
|
+
if (Object.prototype.hasOwnProperty.call(b, p))
|
|
67
|
+
d[p] = b[p]; };
|
|
68
|
+
return extendStatics(d, b);
|
|
69
|
+
};
|
|
70
|
+
function __extends(d, b) {
|
|
71
|
+
if (typeof b !== "function" && b !== null)
|
|
72
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
73
|
+
extendStatics(d, b);
|
|
74
|
+
function __() { this.constructor = d; }
|
|
75
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
76
|
+
}
|
|
77
|
+
var __assign = function () {
|
|
78
|
+
__assign = Object.assign || function __assign(t) {
|
|
79
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
80
|
+
s = arguments[i];
|
|
81
|
+
for (var p in s)
|
|
82
|
+
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
83
|
+
t[p] = s[p];
|
|
84
|
+
}
|
|
85
|
+
return t;
|
|
86
|
+
};
|
|
87
|
+
return __assign.apply(this, arguments);
|
|
88
|
+
};
|
|
89
|
+
function __rest(s, e) {
|
|
90
|
+
var t = {};
|
|
91
|
+
for (var p in s)
|
|
92
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
93
|
+
t[p] = s[p];
|
|
94
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
95
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
96
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
97
|
+
t[p[i]] = s[p[i]];
|
|
98
|
+
}
|
|
99
|
+
return t;
|
|
100
|
+
}
|
|
101
|
+
function __decorate(decorators, target, key, desc) {
|
|
102
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
103
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
104
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
105
|
+
else
|
|
106
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
107
|
+
if (d = decorators[i])
|
|
108
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
109
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
110
|
+
}
|
|
111
|
+
function __param(paramIndex, decorator) {
|
|
112
|
+
return function (target, key) { decorator(target, key, paramIndex); };
|
|
113
|
+
}
|
|
114
|
+
function __metadata(metadataKey, metadataValue) {
|
|
115
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
116
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
117
|
+
}
|
|
118
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
119
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
120
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
121
|
+
function fulfilled(value) { try {
|
|
122
|
+
step(generator.next(value));
|
|
123
|
+
}
|
|
124
|
+
catch (e) {
|
|
125
|
+
reject(e);
|
|
126
|
+
} }
|
|
127
|
+
function rejected(value) { try {
|
|
128
|
+
step(generator["throw"](value));
|
|
129
|
+
}
|
|
130
|
+
catch (e) {
|
|
131
|
+
reject(e);
|
|
132
|
+
} }
|
|
133
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
134
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
function __generator(thisArg, body) {
|
|
138
|
+
var _ = { label: 0, sent: function () { if (t[0] & 1)
|
|
139
|
+
throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
140
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
|
|
141
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
142
|
+
function step(op) {
|
|
143
|
+
if (f)
|
|
144
|
+
throw new TypeError("Generator is already executing.");
|
|
145
|
+
while (_)
|
|
146
|
+
try {
|
|
147
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
|
|
148
|
+
return t;
|
|
149
|
+
if (y = 0, t)
|
|
150
|
+
op = [op[0] & 2, t.value];
|
|
151
|
+
switch (op[0]) {
|
|
152
|
+
case 0:
|
|
153
|
+
case 1:
|
|
154
|
+
t = op;
|
|
155
|
+
break;
|
|
156
|
+
case 4:
|
|
157
|
+
_.label++;
|
|
158
|
+
return { value: op[1], done: false };
|
|
159
|
+
case 5:
|
|
160
|
+
_.label++;
|
|
161
|
+
y = op[1];
|
|
162
|
+
op = [0];
|
|
163
|
+
continue;
|
|
164
|
+
case 7:
|
|
165
|
+
op = _.ops.pop();
|
|
166
|
+
_.trys.pop();
|
|
167
|
+
continue;
|
|
168
|
+
default:
|
|
169
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
170
|
+
_ = 0;
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
|
|
174
|
+
_.label = op[1];
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
177
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
178
|
+
_.label = t[1];
|
|
179
|
+
t = op;
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
182
|
+
if (t && _.label < t[2]) {
|
|
183
|
+
_.label = t[2];
|
|
184
|
+
_.ops.push(op);
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
if (t[2])
|
|
188
|
+
_.ops.pop();
|
|
189
|
+
_.trys.pop();
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
op = body.call(thisArg, _);
|
|
193
|
+
}
|
|
194
|
+
catch (e) {
|
|
195
|
+
op = [6, e];
|
|
196
|
+
y = 0;
|
|
197
|
+
}
|
|
198
|
+
finally {
|
|
199
|
+
f = t = 0;
|
|
200
|
+
}
|
|
201
|
+
if (op[0] & 5)
|
|
202
|
+
throw op[1];
|
|
203
|
+
return { value: op[0] ? op[1] : void 0, done: true };
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
var __createBinding = Object.create ? (function (o, m, k, k2) {
|
|
207
|
+
if (k2 === undefined)
|
|
208
|
+
k2 = k;
|
|
209
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
|
|
210
|
+
}) : (function (o, m, k, k2) {
|
|
211
|
+
if (k2 === undefined)
|
|
212
|
+
k2 = k;
|
|
213
|
+
o[k2] = m[k];
|
|
214
|
+
});
|
|
215
|
+
function __exportStar(m, o) {
|
|
216
|
+
for (var p in m)
|
|
217
|
+
if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
|
|
218
|
+
__createBinding(o, m, p);
|
|
219
|
+
}
|
|
220
|
+
function __values(o) {
|
|
221
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
222
|
+
if (m)
|
|
223
|
+
return m.call(o);
|
|
224
|
+
if (o && typeof o.length === "number")
|
|
225
|
+
return {
|
|
226
|
+
next: function () {
|
|
227
|
+
if (o && i >= o.length)
|
|
228
|
+
o = void 0;
|
|
229
|
+
return { value: o && o[i++], done: !o };
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
233
|
+
}
|
|
234
|
+
function __read(o, n) {
|
|
235
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
236
|
+
if (!m)
|
|
237
|
+
return o;
|
|
238
|
+
var i = m.call(o), r, ar = [], e;
|
|
239
|
+
try {
|
|
240
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
|
241
|
+
ar.push(r.value);
|
|
242
|
+
}
|
|
243
|
+
catch (error) {
|
|
244
|
+
e = { error: error };
|
|
245
|
+
}
|
|
246
|
+
finally {
|
|
247
|
+
try {
|
|
248
|
+
if (r && !r.done && (m = i["return"]))
|
|
249
|
+
m.call(i);
|
|
250
|
+
}
|
|
251
|
+
finally {
|
|
252
|
+
if (e)
|
|
253
|
+
throw e.error;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
return ar;
|
|
257
|
+
}
|
|
258
|
+
/** @deprecated */
|
|
259
|
+
function __spread() {
|
|
260
|
+
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
261
|
+
ar = ar.concat(__read(arguments[i]));
|
|
262
|
+
return ar;
|
|
263
|
+
}
|
|
264
|
+
/** @deprecated */
|
|
265
|
+
function __spreadArrays() {
|
|
266
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
|
267
|
+
s += arguments[i].length;
|
|
268
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
269
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
270
|
+
r[k] = a[j];
|
|
271
|
+
return r;
|
|
272
|
+
}
|
|
273
|
+
function __spreadArray(to, from, pack) {
|
|
274
|
+
if (pack || arguments.length === 2)
|
|
275
|
+
for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
276
|
+
if (ar || !(i in from)) {
|
|
277
|
+
if (!ar)
|
|
278
|
+
ar = Array.prototype.slice.call(from, 0, i);
|
|
279
|
+
ar[i] = from[i];
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
return to.concat(ar || from);
|
|
283
|
+
}
|
|
284
|
+
function __await(v) {
|
|
285
|
+
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
286
|
+
}
|
|
287
|
+
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
288
|
+
if (!Symbol.asyncIterator)
|
|
289
|
+
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
290
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
291
|
+
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
292
|
+
function verb(n) { if (g[n])
|
|
293
|
+
i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
294
|
+
function resume(n, v) { try {
|
|
295
|
+
step(g[n](v));
|
|
296
|
+
}
|
|
297
|
+
catch (e) {
|
|
298
|
+
settle(q[0][3], e);
|
|
299
|
+
} }
|
|
300
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
301
|
+
function fulfill(value) { resume("next", value); }
|
|
302
|
+
function reject(value) { resume("throw", value); }
|
|
303
|
+
function settle(f, v) { if (f(v), q.shift(), q.length)
|
|
304
|
+
resume(q[0][0], q[0][1]); }
|
|
305
|
+
}
|
|
306
|
+
function __asyncDelegator(o) {
|
|
307
|
+
var i, p;
|
|
308
|
+
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
309
|
+
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
|
310
|
+
}
|
|
311
|
+
function __asyncValues(o) {
|
|
312
|
+
if (!Symbol.asyncIterator)
|
|
313
|
+
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
314
|
+
var m = o[Symbol.asyncIterator], i;
|
|
315
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
316
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
317
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
|
318
|
+
}
|
|
319
|
+
function __makeTemplateObject(cooked, raw) {
|
|
320
|
+
if (Object.defineProperty) {
|
|
321
|
+
Object.defineProperty(cooked, "raw", { value: raw });
|
|
322
|
+
}
|
|
323
|
+
else {
|
|
324
|
+
cooked.raw = raw;
|
|
325
|
+
}
|
|
326
|
+
return cooked;
|
|
327
|
+
}
|
|
328
|
+
;
|
|
329
|
+
var __setModuleDefault = Object.create ? (function (o, v) {
|
|
330
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
331
|
+
}) : function (o, v) {
|
|
332
|
+
o["default"] = v;
|
|
333
|
+
};
|
|
334
|
+
function __importStar(mod) {
|
|
335
|
+
if (mod && mod.__esModule)
|
|
336
|
+
return mod;
|
|
337
|
+
var result = {};
|
|
338
|
+
if (mod != null)
|
|
339
|
+
for (var k in mod)
|
|
340
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
341
|
+
__createBinding(result, mod, k);
|
|
342
|
+
__setModuleDefault(result, mod);
|
|
343
|
+
return result;
|
|
344
|
+
}
|
|
345
|
+
function __importDefault(mod) {
|
|
346
|
+
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
347
|
+
}
|
|
348
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
349
|
+
if (kind === "a" && !f)
|
|
350
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
351
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
352
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
353
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
354
|
+
}
|
|
355
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
356
|
+
if (kind === "m")
|
|
357
|
+
throw new TypeError("Private method is not writable");
|
|
358
|
+
if (kind === "a" && !f)
|
|
359
|
+
throw new TypeError("Private accessor was defined without a setter");
|
|
360
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
361
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
362
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/** Animations used by the drawer. */
|
|
366
|
+
var mtxDrawerAnimations = {
|
|
367
|
+
/** Animation that shows and hides a drawer. */
|
|
368
|
+
drawerState: animations.trigger('state', [
|
|
369
|
+
animations.state('void, hidden', animations.style({
|
|
370
|
+
'box-shadow': 'none',
|
|
371
|
+
'visibility': 'hidden',
|
|
372
|
+
})),
|
|
373
|
+
animations.state('visible', animations.style({
|
|
374
|
+
transform: 'none',
|
|
375
|
+
visibility: 'visible',
|
|
376
|
+
})),
|
|
377
|
+
animations.transition('visible => void, visible => hidden', animations.animate('400ms cubic-bezier(0.25, 0.8, 0.25, 1)')),
|
|
378
|
+
animations.transition('void => visible', animations.animate('150ms cubic-bezier(0, 0, 0.2, 1)')),
|
|
379
|
+
]),
|
|
380
|
+
};
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Internal component that wraps user-provided drawer content.
|
|
384
|
+
* @docs-private
|
|
385
|
+
*/
|
|
386
|
+
var MtxDrawerContainer = /** @class */ (function (_super) {
|
|
387
|
+
__extends(MtxDrawerContainer, _super);
|
|
388
|
+
function MtxDrawerContainer(_elementRef, _changeDetectorRef, _focusTrapFactory, _interactivityChecker, _ngZone, breakpointObserver, document,
|
|
389
|
+
/** The drawer configuration. */
|
|
390
|
+
drawerConfig) {
|
|
391
|
+
var _this = _super.call(this) || this;
|
|
392
|
+
_this._elementRef = _elementRef;
|
|
393
|
+
_this._changeDetectorRef = _changeDetectorRef;
|
|
394
|
+
_this._focusTrapFactory = _focusTrapFactory;
|
|
395
|
+
_this._interactivityChecker = _interactivityChecker;
|
|
396
|
+
_this._ngZone = _ngZone;
|
|
397
|
+
_this.drawerConfig = drawerConfig;
|
|
398
|
+
/** The state of the drawer animations. */
|
|
399
|
+
_this._animationState = 'void';
|
|
400
|
+
/** Emits whenever the state of the animation changes. */
|
|
401
|
+
_this._animationStateChanged = new core.EventEmitter();
|
|
402
|
+
/** Element that was focused before the drawer was opened. */
|
|
403
|
+
_this._elementFocusedBeforeOpened = null;
|
|
404
|
+
/**
|
|
405
|
+
* Attaches a DOM portal to the drawer container.
|
|
406
|
+
* @deprecated To be turned into a method.
|
|
407
|
+
* @breaking-change 10.0.0
|
|
408
|
+
*/
|
|
409
|
+
_this.attachDomPortal = function (portal) {
|
|
410
|
+
_this._validatePortalAttached();
|
|
411
|
+
_this._setPanelClass();
|
|
412
|
+
_this._savePreviouslyFocusedElement();
|
|
413
|
+
return _this._portalOutlet.attachDomPortal(portal);
|
|
414
|
+
};
|
|
415
|
+
_this._document = document;
|
|
416
|
+
_this._breakpointSubscription = breakpointObserver
|
|
417
|
+
.observe([layout.Breakpoints.Medium, layout.Breakpoints.Large, layout.Breakpoints.XLarge])
|
|
418
|
+
.subscribe(function () { });
|
|
419
|
+
return _this;
|
|
420
|
+
}
|
|
421
|
+
Object.defineProperty(MtxDrawerContainer.prototype, "drawerPosition", {
|
|
422
|
+
get: function () {
|
|
423
|
+
return "mtx-drawer-" + this.drawerConfig.position;
|
|
424
|
+
},
|
|
425
|
+
enumerable: false,
|
|
426
|
+
configurable: true
|
|
427
|
+
});
|
|
428
|
+
Object.defineProperty(MtxDrawerContainer.prototype, "drawerWidth", {
|
|
429
|
+
get: function () {
|
|
430
|
+
return this.drawerConfig.position === 'left' || this.drawerConfig.position === 'right'
|
|
431
|
+
? this.drawerConfig.width
|
|
432
|
+
: '100vw';
|
|
433
|
+
},
|
|
434
|
+
enumerable: false,
|
|
435
|
+
configurable: true
|
|
436
|
+
});
|
|
437
|
+
Object.defineProperty(MtxDrawerContainer.prototype, "drawerHeight", {
|
|
438
|
+
get: function () {
|
|
439
|
+
return this.drawerConfig.position === 'top' || this.drawerConfig.position === 'bottom'
|
|
440
|
+
? this.drawerConfig.height
|
|
441
|
+
: '100vh';
|
|
442
|
+
},
|
|
443
|
+
enumerable: false,
|
|
444
|
+
configurable: true
|
|
445
|
+
});
|
|
446
|
+
/** Attach a component portal as content to this drawer container. */
|
|
447
|
+
MtxDrawerContainer.prototype.attachComponentPortal = function (portal) {
|
|
448
|
+
this._validatePortalAttached();
|
|
449
|
+
this._setPanelClass();
|
|
450
|
+
this._savePreviouslyFocusedElement();
|
|
451
|
+
return this._portalOutlet.attachComponentPortal(portal);
|
|
452
|
+
};
|
|
453
|
+
/** Attach a template portal as content to this drawer container. */
|
|
454
|
+
MtxDrawerContainer.prototype.attachTemplatePortal = function (portal) {
|
|
455
|
+
this._validatePortalAttached();
|
|
456
|
+
this._setPanelClass();
|
|
457
|
+
this._savePreviouslyFocusedElement();
|
|
458
|
+
return this._portalOutlet.attachTemplatePortal(portal);
|
|
459
|
+
};
|
|
460
|
+
/** Begin animation of drawer entrance into view. */
|
|
461
|
+
MtxDrawerContainer.prototype.enter = function () {
|
|
462
|
+
if (!this._destroyed) {
|
|
463
|
+
this._animationState = 'visible';
|
|
464
|
+
this._changeDetectorRef.detectChanges();
|
|
465
|
+
}
|
|
466
|
+
};
|
|
467
|
+
/** Begin animation of the drawer exiting from view. */
|
|
468
|
+
MtxDrawerContainer.prototype.exit = function () {
|
|
469
|
+
if (!this._destroyed) {
|
|
470
|
+
this._animationState = 'hidden';
|
|
471
|
+
this._changeDetectorRef.markForCheck();
|
|
472
|
+
}
|
|
473
|
+
};
|
|
474
|
+
MtxDrawerContainer.prototype.ngOnDestroy = function () {
|
|
475
|
+
this._breakpointSubscription.unsubscribe();
|
|
476
|
+
this._destroyed = true;
|
|
477
|
+
};
|
|
478
|
+
MtxDrawerContainer.prototype._onAnimationDone = function (event) {
|
|
479
|
+
if (event.toState === 'hidden') {
|
|
480
|
+
this._restoreFocus();
|
|
481
|
+
}
|
|
482
|
+
else if (event.toState === 'visible') {
|
|
483
|
+
this._trapFocus();
|
|
484
|
+
}
|
|
485
|
+
this._animationStateChanged.emit(event);
|
|
486
|
+
};
|
|
487
|
+
MtxDrawerContainer.prototype._onAnimationStart = function (event) {
|
|
488
|
+
this._animationStateChanged.emit(event);
|
|
489
|
+
};
|
|
490
|
+
MtxDrawerContainer.prototype._toggleClass = function (cssClass, add) {
|
|
491
|
+
this._elementRef.nativeElement.classList.toggle(cssClass, add);
|
|
492
|
+
};
|
|
493
|
+
MtxDrawerContainer.prototype._validatePortalAttached = function () {
|
|
494
|
+
if (this._portalOutlet.hasAttached()) {
|
|
495
|
+
throw Error('Attempting to attach drawer content after content is already attached');
|
|
496
|
+
}
|
|
497
|
+
};
|
|
498
|
+
MtxDrawerContainer.prototype._setPanelClass = function () {
|
|
499
|
+
var _a;
|
|
500
|
+
var element = this._elementRef.nativeElement;
|
|
501
|
+
(_a = element.classList).add.apply(_a, __spreadArray([], __read(coercion.coerceArray(this.drawerConfig.panelClass || []))));
|
|
502
|
+
};
|
|
503
|
+
/**
|
|
504
|
+
* Focuses the provided element. If the element is not focusable, it will add a tabIndex
|
|
505
|
+
* attribute to forcefully focus it. The attribute is removed after focus is moved.
|
|
506
|
+
* @param element The element to focus.
|
|
507
|
+
*/
|
|
508
|
+
MtxDrawerContainer.prototype._forceFocus = function (element, options) {
|
|
509
|
+
if (!this._interactivityChecker.isFocusable(element)) {
|
|
510
|
+
element.tabIndex = -1;
|
|
511
|
+
// The tabindex attribute should be removed to avoid navigating to that element again
|
|
512
|
+
this._ngZone.runOutsideAngular(function () {
|
|
513
|
+
element.addEventListener('blur', function () { return element.removeAttribute('tabindex'); });
|
|
514
|
+
element.addEventListener('mousedown', function () { return element.removeAttribute('tabindex'); });
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
element.focus(options);
|
|
518
|
+
};
|
|
519
|
+
/**
|
|
520
|
+
* Focuses the first element that matches the given selector within the focus trap.
|
|
521
|
+
* @param selector The CSS selector for the element to set focus to.
|
|
522
|
+
*/
|
|
523
|
+
MtxDrawerContainer.prototype._focusByCssSelector = function (selector, options) {
|
|
524
|
+
var elementToFocus = this._elementRef.nativeElement.querySelector(selector);
|
|
525
|
+
if (elementToFocus) {
|
|
526
|
+
this._forceFocus(elementToFocus, options);
|
|
527
|
+
}
|
|
528
|
+
};
|
|
529
|
+
/**
|
|
530
|
+
* Moves the focus inside the focus trap. When autoFocus is not set to 'bottom-sheet',
|
|
531
|
+
* if focus cannot be moved then focus will go to the drawer container.
|
|
532
|
+
*/
|
|
533
|
+
MtxDrawerContainer.prototype._trapFocus = function () {
|
|
534
|
+
var element = this._elementRef.nativeElement;
|
|
535
|
+
if (!this._focusTrap) {
|
|
536
|
+
this._focusTrap = this._focusTrapFactory.create(element);
|
|
537
|
+
}
|
|
538
|
+
// If were to attempt to focus immediately, then the content of the drawer would not
|
|
539
|
+
// yet be ready in instances where change detection has to run first. To deal with this,
|
|
540
|
+
// we simply wait for the microtask queue to be empty when setting focus when autoFocus
|
|
541
|
+
// isn't set to drawer. If the element inside the drawer can't be focused,
|
|
542
|
+
// then the container is focused so the user can't tab into other elements behind it.
|
|
543
|
+
switch (this.drawerConfig.autoFocus) {
|
|
544
|
+
case false:
|
|
545
|
+
case 'dialog':
|
|
546
|
+
// eslint-disable-next-line no-case-declarations
|
|
547
|
+
var activeElement = platform._getFocusedElementPierceShadowDom();
|
|
548
|
+
// Ensure that focus is on the drawer container. It's possible that a different
|
|
549
|
+
// component tried to move focus while the open animation was running. See:
|
|
550
|
+
// https://github.com/angular/components/issues/16215. Note that we only want to do this
|
|
551
|
+
// if the focus isn't inside the drawer already, because it's possible that the
|
|
552
|
+
// consumer specified `autoFocus` in order to move focus themselves.
|
|
553
|
+
if (activeElement !== element && !element.contains(activeElement)) {
|
|
554
|
+
element.focus();
|
|
555
|
+
}
|
|
556
|
+
break;
|
|
557
|
+
case true:
|
|
558
|
+
case 'first-tabbable':
|
|
559
|
+
this._focusTrap.focusInitialElementWhenReady();
|
|
560
|
+
break;
|
|
561
|
+
case 'first-heading':
|
|
562
|
+
this._focusByCssSelector('h1, h2, h3, h4, h5, h6, [role="heading"]');
|
|
563
|
+
break;
|
|
564
|
+
default:
|
|
565
|
+
this._focusByCssSelector(this.drawerConfig.autoFocus);
|
|
566
|
+
break;
|
|
567
|
+
}
|
|
568
|
+
};
|
|
569
|
+
/** Restores focus to the element that was focused before the drawer was opened. */
|
|
570
|
+
MtxDrawerContainer.prototype._restoreFocus = function () {
|
|
571
|
+
var toFocus = this._elementFocusedBeforeOpened;
|
|
572
|
+
// We need the extra check, because IE can set the `activeElement` to null in some cases.
|
|
573
|
+
if (this.drawerConfig.restoreFocus && toFocus && typeof toFocus.focus === 'function') {
|
|
574
|
+
var activeElement = platform._getFocusedElementPierceShadowDom();
|
|
575
|
+
var element = this._elementRef.nativeElement;
|
|
576
|
+
// Make sure that focus is still inside the drawer or is on the body (usually because a
|
|
577
|
+
// non-focusable element like the backdrop was clicked) before moving it. It's possible that
|
|
578
|
+
// the consumer moved it themselves before the animation was done, in which case we shouldn't
|
|
579
|
+
// do anything.
|
|
580
|
+
if (!activeElement ||
|
|
581
|
+
activeElement === this._document.body ||
|
|
582
|
+
activeElement === element ||
|
|
583
|
+
element.contains(activeElement)) {
|
|
584
|
+
toFocus.focus();
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
if (this._focusTrap) {
|
|
588
|
+
this._focusTrap.destroy();
|
|
589
|
+
}
|
|
590
|
+
};
|
|
591
|
+
/** Saves a reference to the element that was focused before the drawer was opened. */
|
|
592
|
+
MtxDrawerContainer.prototype._savePreviouslyFocusedElement = function () {
|
|
593
|
+
var _this = this;
|
|
594
|
+
this._elementFocusedBeforeOpened = platform._getFocusedElementPierceShadowDom();
|
|
595
|
+
// The `focus` method isn't available during server-side rendering.
|
|
596
|
+
if (this._elementRef.nativeElement.focus) {
|
|
597
|
+
this._ngZone.runOutsideAngular(function () {
|
|
598
|
+
Promise.resolve().then(function () { return _this._elementRef.nativeElement.focus(); });
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
};
|
|
602
|
+
return MtxDrawerContainer;
|
|
603
|
+
}(portal.BasePortalOutlet));
|
|
604
|
+
/** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
|
|
605
|
+
MtxDrawerContainer.decorators = [
|
|
606
|
+
{ type: core.Component, args: [{
|
|
607
|
+
selector: 'mtx-drawer-container',
|
|
608
|
+
template: "<div class=\"mtx-drawer-content-wrapper\" [style.width]=\"drawerWidth\" [style.height]=\"drawerHeight\">\n <ng-template cdkPortalOutlet></ng-template>\n</div>\n",
|
|
609
|
+
// In Ivy embedded views will be change detected from their declaration place, rather than where
|
|
610
|
+
// they were stamped out. This means that we can't have the drawer container be OnPush,
|
|
611
|
+
// because it might cause the sheets that were opened from a template not to be out of date.
|
|
612
|
+
changeDetection: core.ChangeDetectionStrategy.Default,
|
|
613
|
+
encapsulation: core.ViewEncapsulation.None,
|
|
614
|
+
animations: [mtxDrawerAnimations.drawerState],
|
|
615
|
+
host: {
|
|
616
|
+
'class': 'mtx-drawer-container',
|
|
617
|
+
'[class]': 'drawerPosition',
|
|
618
|
+
'tabindex': '-1',
|
|
619
|
+
'role': 'dialog',
|
|
620
|
+
'aria-modal': 'true',
|
|
621
|
+
'[attr.aria-label]': 'drawerConfig?.ariaLabel',
|
|
622
|
+
'[@state]': '_animationState',
|
|
623
|
+
'(@state.start)': '_onAnimationStart($event)',
|
|
624
|
+
'(@state.done)': '_onAnimationDone($event)',
|
|
625
|
+
},
|
|
626
|
+
styles: [".mtx-drawer-container{display:block;outline:0}.cdk-high-contrast-active .mtx-drawer-container{outline:1px solid}.mtx-drawer-content-wrapper{box-sizing:border-box;padding:8px 16px;overflow:auto}.mtx-drawer-right{transform:translate(100%)}.mtx-drawer-left{transform:translate(-100%)}.mtx-drawer-bottom{transform:translateY(100%)}.mtx-drawer-top{transform:translateY(-100%)}\n"]
|
|
627
|
+
},] }
|
|
628
|
+
];
|
|
629
|
+
/**
|
|
630
|
+
* @type {function(): !Array<(null|{
|
|
631
|
+
* type: ?,
|
|
632
|
+
* decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>),
|
|
633
|
+
* })>}
|
|
634
|
+
* @nocollapse
|
|
635
|
+
*/
|
|
636
|
+
MtxDrawerContainer.ctorParameters = function () { return [
|
|
637
|
+
{ type: core.ElementRef },
|
|
638
|
+
{ type: core.ChangeDetectorRef },
|
|
639
|
+
{ type: a11y.FocusTrapFactory },
|
|
640
|
+
{ type: a11y.InteractivityChecker },
|
|
641
|
+
{ type: core.NgZone },
|
|
642
|
+
{ type: layout.BreakpointObserver },
|
|
643
|
+
{ type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [common.DOCUMENT,] }] },
|
|
644
|
+
{ type: MtxDrawerConfig }
|
|
645
|
+
]; };
|
|
646
|
+
/** @type {!Object<string, !Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
|
|
647
|
+
MtxDrawerContainer.propDecorators = {
|
|
648
|
+
_portalOutlet: [{ type: core.ViewChild, args: [portal.CdkPortalOutlet, { static: true },] }]
|
|
649
|
+
};
|
|
650
|
+
|
|
651
|
+
/**
|
|
652
|
+
* Reference to a drawer dispatched from the drawer service.
|
|
653
|
+
*/
|
|
654
|
+
var MtxDrawerRef = /** @class */ (function () {
|
|
655
|
+
function MtxDrawerRef(containerInstance, _overlayRef) {
|
|
656
|
+
var _this = this;
|
|
657
|
+
this._overlayRef = _overlayRef;
|
|
658
|
+
/** Subject for notifying the user that the drawer has been dismissed. */
|
|
659
|
+
this._afterDismissed = new rxjs.Subject();
|
|
660
|
+
/** Subject for notifying the user that the drawer has opened and appeared. */
|
|
661
|
+
this._afterOpened = new rxjs.Subject();
|
|
662
|
+
this.containerInstance = containerInstance;
|
|
663
|
+
this.disableClose = containerInstance.drawerConfig.disableClose;
|
|
664
|
+
// Emit when opening animation completes
|
|
665
|
+
containerInstance._animationStateChanged
|
|
666
|
+
.pipe(operators.filter(function (event) { return event.phaseName === 'done' && event.toState === 'visible'; }), operators.take(1))
|
|
667
|
+
.subscribe(function () {
|
|
668
|
+
_this._afterOpened.next();
|
|
669
|
+
_this._afterOpened.complete();
|
|
670
|
+
});
|
|
671
|
+
// Dispose overlay when closing animation is complete
|
|
672
|
+
containerInstance._animationStateChanged
|
|
673
|
+
.pipe(operators.filter(function (event) { return event.phaseName === 'done' && event.toState === 'hidden'; }), operators.take(1))
|
|
674
|
+
.subscribe(function () {
|
|
675
|
+
clearTimeout(_this._closeFallbackTimeout);
|
|
676
|
+
_overlayRef.dispose();
|
|
677
|
+
});
|
|
678
|
+
_overlayRef
|
|
679
|
+
.detachments()
|
|
680
|
+
.pipe(operators.take(1))
|
|
681
|
+
.subscribe(function () {
|
|
682
|
+
_this._afterDismissed.next(_this._result);
|
|
683
|
+
_this._afterDismissed.complete();
|
|
684
|
+
});
|
|
685
|
+
rxjs.merge(_overlayRef.backdropClick(), _overlayRef.keydownEvents().pipe(operators.filter(function (event) { return event.keyCode === keycodes.ESCAPE; }))).subscribe(function (event) {
|
|
686
|
+
if (!_this.disableClose &&
|
|
687
|
+
(event.type !== 'keydown' || !keycodes.hasModifierKey(event))) {
|
|
688
|
+
event.preventDefault();
|
|
689
|
+
_this.dismiss();
|
|
690
|
+
}
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
/**
|
|
694
|
+
* Dismisses the drawer.
|
|
695
|
+
* @param result Data to be passed back to the drawer opener.
|
|
696
|
+
*/
|
|
697
|
+
MtxDrawerRef.prototype.dismiss = function (result) {
|
|
698
|
+
var _this = this;
|
|
699
|
+
if (!this._afterDismissed.closed) {
|
|
700
|
+
// Transition the backdrop in parallel to the drawer.
|
|
701
|
+
this.containerInstance._animationStateChanged
|
|
702
|
+
.pipe(operators.filter(function (event) { return event.phaseName === 'start'; }), operators.take(1))
|
|
703
|
+
.subscribe(function (event) {
|
|
704
|
+
// The logic that disposes of the overlay depends on the exit animation completing, however
|
|
705
|
+
// it isn't guaranteed if the parent view is destroyed while it's running. Add a fallback
|
|
706
|
+
// timeout which will clean everything up if the animation hasn't fired within the specified
|
|
707
|
+
// amount of time plus 100ms. We don't need to run this outside the NgZone, because for the
|
|
708
|
+
// vast majority of cases the timeout will have been cleared before it has fired.
|
|
709
|
+
_this._closeFallbackTimeout = setTimeout(function () {
|
|
710
|
+
_this._overlayRef.dispose();
|
|
711
|
+
}, event.totalTime + 100);
|
|
712
|
+
_this._overlayRef.detachBackdrop();
|
|
713
|
+
});
|
|
714
|
+
this._result = result;
|
|
715
|
+
this.containerInstance.exit();
|
|
716
|
+
}
|
|
717
|
+
};
|
|
718
|
+
/** Gets an observable that is notified when the drawer is finished closing. */
|
|
719
|
+
MtxDrawerRef.prototype.afterDismissed = function () {
|
|
720
|
+
return this._afterDismissed;
|
|
721
|
+
};
|
|
722
|
+
/** Gets an observable that is notified when the drawer has opened and appeared. */
|
|
723
|
+
MtxDrawerRef.prototype.afterOpened = function () {
|
|
724
|
+
return this._afterOpened;
|
|
725
|
+
};
|
|
726
|
+
/**
|
|
727
|
+
* Gets an observable that emits when the overlay's backdrop has been clicked.
|
|
728
|
+
*/
|
|
729
|
+
MtxDrawerRef.prototype.backdropClick = function () {
|
|
730
|
+
return this._overlayRef.backdropClick();
|
|
731
|
+
};
|
|
732
|
+
/**
|
|
733
|
+
* Gets an observable that emits when keydown events are targeted on the overlay.
|
|
734
|
+
*/
|
|
735
|
+
MtxDrawerRef.prototype.keydownEvents = function () {
|
|
736
|
+
return this._overlayRef.keydownEvents();
|
|
737
|
+
};
|
|
738
|
+
return MtxDrawerRef;
|
|
739
|
+
}());
|
|
740
|
+
|
|
741
|
+
/** Injection token that can be used to access the data that was passed in to a drawer. */
|
|
742
|
+
var MTX_DRAWER_DATA = new core.InjectionToken('MtxDrawerData');
|
|
743
|
+
/** Injection token that can be used to specify default drawer options. */
|
|
744
|
+
var MTX_DRAWER_DEFAULT_OPTIONS = new core.InjectionToken('mtx-drawer-default-options');
|
|
745
|
+
/**
|
|
746
|
+
* Service to trigger Material Design bottom sheets.
|
|
747
|
+
*/
|
|
748
|
+
var MtxDrawer = /** @class */ (function () {
|
|
749
|
+
function MtxDrawer(_overlay, _injector, _parentDrawer, _defaultOptions) {
|
|
750
|
+
this._overlay = _overlay;
|
|
751
|
+
this._injector = _injector;
|
|
752
|
+
this._parentDrawer = _parentDrawer;
|
|
753
|
+
this._defaultOptions = _defaultOptions;
|
|
754
|
+
this._drawerRefAtThisLevel = null;
|
|
755
|
+
}
|
|
756
|
+
Object.defineProperty(MtxDrawer.prototype, "_openedDrawerRef", {
|
|
757
|
+
/** Reference to the currently opened drawer. */
|
|
758
|
+
get: function () {
|
|
759
|
+
var parent = this._parentDrawer;
|
|
760
|
+
return parent ? parent._openedDrawerRef : this._drawerRefAtThisLevel;
|
|
761
|
+
},
|
|
762
|
+
set: function (value) {
|
|
763
|
+
if (this._parentDrawer) {
|
|
764
|
+
this._parentDrawer._openedDrawerRef = value;
|
|
765
|
+
}
|
|
766
|
+
else {
|
|
767
|
+
this._drawerRefAtThisLevel = value;
|
|
768
|
+
}
|
|
769
|
+
},
|
|
770
|
+
enumerable: false,
|
|
771
|
+
configurable: true
|
|
772
|
+
});
|
|
773
|
+
MtxDrawer.prototype.open = function (componentOrTemplateRef, config) {
|
|
774
|
+
var _this = this;
|
|
775
|
+
var _config = _applyConfigDefaults(this._defaultOptions || new MtxDrawerConfig(), config);
|
|
776
|
+
var overlayRef = this._createOverlay(_config);
|
|
777
|
+
var container = this._attachContainer(overlayRef, _config);
|
|
778
|
+
var ref = new MtxDrawerRef(container, overlayRef);
|
|
779
|
+
if (componentOrTemplateRef instanceof core.TemplateRef) {
|
|
780
|
+
container.attachTemplatePortal(new portal.TemplatePortal(componentOrTemplateRef, null, {
|
|
781
|
+
$implicit: _config.data,
|
|
782
|
+
drawerRef: ref,
|
|
783
|
+
}));
|
|
784
|
+
}
|
|
785
|
+
else {
|
|
786
|
+
var portal$1 = new portal.ComponentPortal(componentOrTemplateRef, undefined, this._createInjector(_config, ref));
|
|
787
|
+
var contentRef = container.attachComponentPortal(portal$1);
|
|
788
|
+
ref.instance = contentRef.instance;
|
|
789
|
+
}
|
|
790
|
+
// When the drawer is dismissed, clear the reference to it.
|
|
791
|
+
ref.afterDismissed().subscribe(function () {
|
|
792
|
+
// Clear the drawer ref if it hasn't already been replaced by a newer one.
|
|
793
|
+
if (_this._openedDrawerRef == ref) {
|
|
794
|
+
_this._openedDrawerRef = null;
|
|
795
|
+
}
|
|
796
|
+
});
|
|
797
|
+
if (this._openedDrawerRef) {
|
|
798
|
+
// If a drawer is already in view, dismiss it and enter the
|
|
799
|
+
// new drawer after exit animation is complete.
|
|
800
|
+
this._openedDrawerRef.afterDismissed().subscribe(function () { return ref.containerInstance.enter(); });
|
|
801
|
+
this._openedDrawerRef.dismiss();
|
|
802
|
+
}
|
|
803
|
+
else {
|
|
804
|
+
// If no drawer is in view, enter the new drawer.
|
|
805
|
+
ref.containerInstance.enter();
|
|
806
|
+
}
|
|
807
|
+
this._openedDrawerRef = ref;
|
|
808
|
+
return ref;
|
|
809
|
+
};
|
|
810
|
+
/**
|
|
811
|
+
* Dismisses the currently-visible drawer.
|
|
812
|
+
* @param result Data to pass to the drawer instance.
|
|
813
|
+
*/
|
|
814
|
+
MtxDrawer.prototype.dismiss = function (result) {
|
|
815
|
+
if (this._openedDrawerRef) {
|
|
816
|
+
this._openedDrawerRef.dismiss(result);
|
|
817
|
+
}
|
|
818
|
+
};
|
|
819
|
+
MtxDrawer.prototype.ngOnDestroy = function () {
|
|
820
|
+
if (this._drawerRefAtThisLevel) {
|
|
821
|
+
this._drawerRefAtThisLevel.dismiss();
|
|
822
|
+
}
|
|
823
|
+
};
|
|
824
|
+
/**
|
|
825
|
+
* Attaches the drawer container component to the overlay.
|
|
826
|
+
*/
|
|
827
|
+
MtxDrawer.prototype._attachContainer = function (overlayRef, config) {
|
|
828
|
+
var userInjector = config && config.viewContainerRef && config.viewContainerRef.injector;
|
|
829
|
+
var injector = core.Injector.create({
|
|
830
|
+
parent: userInjector || this._injector,
|
|
831
|
+
providers: [{ provide: MtxDrawerConfig, useValue: config }],
|
|
832
|
+
});
|
|
833
|
+
var containerPortal = new portal.ComponentPortal(MtxDrawerContainer, config.viewContainerRef, injector);
|
|
834
|
+
var containerRef = overlayRef.attach(containerPortal);
|
|
835
|
+
return containerRef.instance;
|
|
836
|
+
};
|
|
837
|
+
/**
|
|
838
|
+
* Creates a new overlay and places it in the correct location.
|
|
839
|
+
* @param config The user-specified drawer config.
|
|
840
|
+
*/
|
|
841
|
+
MtxDrawer.prototype._createOverlay = function (config) {
|
|
842
|
+
var overlayConfig = new overlay.OverlayConfig({
|
|
843
|
+
direction: config.direction,
|
|
844
|
+
hasBackdrop: config.hasBackdrop,
|
|
845
|
+
disposeOnNavigation: config.closeOnNavigation,
|
|
846
|
+
maxWidth: '100%',
|
|
847
|
+
scrollStrategy: config.scrollStrategy || this._overlay.scrollStrategies.block(),
|
|
848
|
+
positionStrategy: this._overlay.position().global()[config.position]('0'),
|
|
849
|
+
});
|
|
850
|
+
if (config.backdropClass) {
|
|
851
|
+
overlayConfig.backdropClass = config.backdropClass;
|
|
852
|
+
}
|
|
853
|
+
return this._overlay.create(overlayConfig);
|
|
854
|
+
};
|
|
855
|
+
/**
|
|
856
|
+
* Creates an injector to be used inside of a drawer component.
|
|
857
|
+
* @param config Config that was used to create the drawer.
|
|
858
|
+
* @param drawerRef Reference to the drawer.
|
|
859
|
+
*/
|
|
860
|
+
MtxDrawer.prototype._createInjector = function (config, drawerRef) {
|
|
861
|
+
var userInjector = config && config.viewContainerRef && config.viewContainerRef.injector;
|
|
862
|
+
var providers = [
|
|
863
|
+
{ provide: MtxDrawerRef, useValue: drawerRef },
|
|
864
|
+
{ provide: MTX_DRAWER_DATA, useValue: config.data },
|
|
865
|
+
];
|
|
866
|
+
if (config.direction &&
|
|
867
|
+
(!userInjector ||
|
|
868
|
+
!userInjector.get(bidi.Directionality, null, core.InjectFlags.Optional))) {
|
|
869
|
+
providers.push({
|
|
870
|
+
provide: bidi.Directionality,
|
|
871
|
+
useValue: { value: config.direction, change: rxjs.of() },
|
|
872
|
+
});
|
|
873
|
+
}
|
|
874
|
+
return core.Injector.create({ parent: userInjector || this._injector, providers: providers });
|
|
875
|
+
};
|
|
876
|
+
return MtxDrawer;
|
|
877
|
+
}());
|
|
878
|
+
/** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
|
|
879
|
+
MtxDrawer.decorators = [
|
|
880
|
+
{ type: core.Injectable }
|
|
881
|
+
];
|
|
882
|
+
/**
|
|
883
|
+
* @type {function(): !Array<(null|{
|
|
884
|
+
* type: ?,
|
|
885
|
+
* decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>),
|
|
886
|
+
* })>}
|
|
887
|
+
* @nocollapse
|
|
888
|
+
*/
|
|
889
|
+
MtxDrawer.ctorParameters = function () { return [
|
|
890
|
+
{ type: overlay.Overlay },
|
|
891
|
+
{ type: core.Injector },
|
|
892
|
+
{ type: MtxDrawer, decorators: [{ type: core.Optional }, { type: core.SkipSelf }] },
|
|
893
|
+
{ type: MtxDrawerConfig, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MTX_DRAWER_DEFAULT_OPTIONS,] }] }
|
|
894
|
+
]; };
|
|
895
|
+
/**
|
|
896
|
+
* Applies default options to the drawer config.
|
|
897
|
+
* @param defaults Object containing the default values to which to fall back.
|
|
898
|
+
* @param config The configuration to which the defaults will be applied.
|
|
899
|
+
* @returns The new configuration object with defaults applied.
|
|
900
|
+
*/
|
|
901
|
+
function _applyConfigDefaults(defaults, config) {
|
|
902
|
+
return Object.assign(Object.assign({}, defaults), config);
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
var MtxDrawerModule = /** @class */ (function () {
|
|
906
|
+
function MtxDrawerModule() {
|
|
907
|
+
}
|
|
908
|
+
return MtxDrawerModule;
|
|
909
|
+
}());
|
|
910
|
+
/** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
|
|
911
|
+
MtxDrawerModule.decorators = [
|
|
912
|
+
{ type: core.NgModule, args: [{
|
|
913
|
+
imports: [overlay.OverlayModule, portal.PortalModule, core$1.MatCommonModule],
|
|
914
|
+
exports: [MtxDrawerContainer, core$1.MatCommonModule],
|
|
915
|
+
declarations: [MtxDrawerContainer],
|
|
916
|
+
providers: [MtxDrawer],
|
|
917
|
+
},] }
|
|
918
|
+
];
|
|
919
|
+
|
|
920
|
+
/**
|
|
921
|
+
* Generated bundle index. Do not edit.
|
|
922
|
+
*/
|
|
923
|
+
|
|
924
|
+
exports.MTX_DRAWER_DATA = MTX_DRAWER_DATA;
|
|
925
|
+
exports.MTX_DRAWER_DEFAULT_OPTIONS = MTX_DRAWER_DEFAULT_OPTIONS;
|
|
926
|
+
exports.MtxDrawer = MtxDrawer;
|
|
927
|
+
exports.MtxDrawerConfig = MtxDrawerConfig;
|
|
928
|
+
exports.MtxDrawerContainer = MtxDrawerContainer;
|
|
929
|
+
exports.MtxDrawerModule = MtxDrawerModule;
|
|
930
|
+
exports.MtxDrawerRef = MtxDrawerRef;
|
|
931
|
+
exports.mtxDrawerAnimations = mtxDrawerAnimations;
|
|
932
|
+
|
|
933
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
934
|
+
|
|
935
|
+
}));
|
|
936
|
+
//# sourceMappingURL=mtxDrawer.umd.js.map
|