@ng-matero/extensions 12.9.1 → 12.10.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/alert/alert.component.d.ts +1 -1
- package/alert/mtxAlert.metadata.json +1 -1
- package/bundles/mtxAlert.umd.js +2 -2
- package/bundles/mtxAlert.umd.js.map +1 -1
- package/bundles/mtxCore.umd.js.map +1 -1
- package/bundles/mtxDatetimepicker.umd.js +5 -0
- package/bundles/mtxDatetimepicker.umd.js.map +1 -1
- package/bundles/mtxFormGroup.umd.js +1 -1
- package/bundles/mtxFormGroup.umd.js.map +1 -1
- package/bundles/mtxGrid.umd.js +51 -54
- package/bundles/mtxGrid.umd.js.map +1 -1
- package/bundles/mtxPopover.umd.js +997 -803
- package/bundles/mtxPopover.umd.js.map +1 -1
- package/bundles/mtxSelect.umd.js +237 -156
- package/bundles/mtxSelect.umd.js.map +1 -1
- package/core/datetime/datetime-formats.d.ts +2 -0
- package/esm2015/alert/alert.component.js +3 -3
- package/esm2015/core/datetime/datetime-formats.js +1 -1
- package/esm2015/datetimepicker/datetimepicker-input.js +6 -1
- package/esm2015/form-group/form-group.component.js +2 -2
- package/esm2015/grid/cell.component.js +32 -32
- package/esm2015/grid/column-menu.component.js +10 -14
- package/esm2015/grid/grid.component.js +12 -7
- package/esm2015/popover/popover-animations.js +10 -13
- package/esm2015/popover/popover-content.js +99 -0
- package/esm2015/popover/popover-interfaces.js +1 -1
- package/esm2015/popover/popover-module.js +7 -5
- package/esm2015/popover/popover-target.js +3 -3
- package/esm2015/popover/popover-trigger.js +210 -172
- package/esm2015/popover/popover-types.js +1 -1
- package/esm2015/popover/popover.js +173 -125
- package/esm2015/popover/public-api.js +2 -1
- package/esm2015/select/option.component.js +4 -6
- package/esm2015/select/select.component.js +111 -31
- package/fesm2015/mtxAlert.js +2 -2
- package/fesm2015/mtxAlert.js.map +1 -1
- package/fesm2015/mtxCore.js.map +1 -1
- package/fesm2015/mtxDatetimepicker.js +5 -0
- package/fesm2015/mtxDatetimepicker.js.map +1 -1
- package/fesm2015/mtxFormGroup.js +1 -1
- package/fesm2015/mtxFormGroup.js.map +1 -1
- package/fesm2015/mtxGrid.js +51 -50
- package/fesm2015/mtxGrid.js.map +1 -1
- package/fesm2015/mtxPopover.js +526 -351
- package/fesm2015/mtxPopover.js.map +1 -1
- package/fesm2015/mtxSelect.js +169 -92
- package/fesm2015/mtxSelect.js.map +1 -1
- package/form-group/mtxFormGroup.metadata.json +1 -1
- package/grid/cell.component.d.ts +5 -8
- package/grid/column-menu.component.d.ts +3 -5
- package/grid/grid.component.d.ts +6 -4
- package/grid/mtxGrid.metadata.json +1 -1
- package/package.json +1 -1
- package/popover/mtxPopover.metadata.json +1 -1
- package/popover/popover-animations.d.ts +1 -1
- package/popover/popover-content.d.ts +38 -0
- package/popover/popover-interfaces.d.ts +37 -31
- package/popover/popover-target.d.ts +2 -2
- package/popover/popover-trigger.d.ts +65 -60
- package/popover/popover-types.d.ts +6 -1
- package/popover/popover.d.ts +97 -69
- package/popover/popover.scss +2 -0
- package/popover/public-api.d.ts +1 -0
- package/select/mtxSelect.metadata.json +1 -1
- package/select/option.component.d.ts +7 -6
- package/select/select.component.d.ts +59 -20
|
@@ -1,32 +1,11 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/cdk/overlay'), require('@angular/cdk/a11y'), require('@angular/cdk/coercion'), require('@angular/cdk/keycodes'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@ng-matero/extensions/popover', ['exports', '@angular/core', '@angular/common', '@angular/cdk/overlay', '@angular/cdk/a11y', '@angular/cdk/coercion', '@angular/cdk/keycodes', '
|
|
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.popover = {}), global.ng.core, global.ng.common, global.ng.cdk.overlay, global.ng.cdk.a11y, global.ng.cdk.coercion, global.ng.cdk.keycodes, global.
|
|
5
|
-
})(this, (function (exports, core, common, overlay, a11y, coercion, keycodes,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/cdk/overlay'), require('@angular/cdk/a11y'), require('@angular/cdk/coercion'), require('@angular/cdk/keycodes'), require('rxjs'), require('@angular/animations'), require('@angular/cdk/portal'), require('@angular/cdk/bidi'), require('rxjs/operators')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@ng-matero/extensions/popover', ['exports', '@angular/core', '@angular/common', '@angular/cdk/overlay', '@angular/cdk/a11y', '@angular/cdk/coercion', '@angular/cdk/keycodes', 'rxjs', '@angular/animations', '@angular/cdk/portal', '@angular/cdk/bidi', '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.popover = {}), global.ng.core, global.ng.common, global.ng.cdk.overlay, global.ng.cdk.a11y, global.ng.cdk.coercion, global.ng.cdk.keycodes, global.rxjs, global.ng.animations, global.ng.cdk.portal, global.ng.cdk.bidi, global.rxjs.operators));
|
|
5
|
+
})(this, (function (exports, core, common, overlay, a11y, coercion, keycodes, rxjs, animations, portal, bidi, operators) { 'use strict';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
*/
|
|
10
|
-
function throwMtxPopoverMissingError() {
|
|
11
|
-
throw Error("mtx-popover-trigger: must pass in an mtx-popover instance.\n\n Example:\n <mtx-popover #popover=\"mtxPopover\"></mtx-popover>\n <button [mtxPopoverTriggerFor]=\"popover\"></button>");
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Throws an exception for the case when popover's mtxPopoverPosition[0] value isn't valid.
|
|
15
|
-
* In other words, it doesn't match 'above', 'below', 'before' or 'after'.
|
|
16
|
-
*/
|
|
17
|
-
function throwMtxPopoverInvalidPositionStart() {
|
|
18
|
-
throw Error("mtxPopoverPosition[0] value must be either 'above', 'below', 'before' or 'after'.\n Example: <mtx-popover [position]=\"['below', 'after']\" #popover=\"mtxPopover\"></mtx-popover>");
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Throws an exception for the case when popover's mtxPopoverPosition[1] value isn't valid.
|
|
22
|
-
* In other words, it doesn't match 'above', 'below', 'before', 'after' or 'center'.
|
|
23
|
-
*/
|
|
24
|
-
function throwMtxPopoverInvalidPositionEnd() {
|
|
25
|
-
throw Error("mtxPopoverPosition[1] value must be either 'above', 'below', 'before', 'after' or 'center'.\n Example: <mtx-popover [position]=\"['below', 'after']\" #popover=\"mtxPopover\"></mtx-popover>");
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Below are all the animations for the md-popover component.
|
|
8
|
+
* Below are all the animations for the mtx-popover component.
|
|
30
9
|
* Animation duration and timing values are based on AngularJS Material.
|
|
31
10
|
*/
|
|
32
11
|
/**
|
|
@@ -38,174 +17,599 @@
|
|
|
38
17
|
* delay to display the ripple.
|
|
39
18
|
*/
|
|
40
19
|
var transformPopover = animations.trigger('transformPopover', [
|
|
41
|
-
animations.state('
|
|
42
|
-
opacity:
|
|
43
|
-
transform:
|
|
20
|
+
animations.state('void', animations.style({
|
|
21
|
+
opacity: 0,
|
|
22
|
+
transform: 'scale(0.8)',
|
|
44
23
|
})),
|
|
45
|
-
animations.transition('void =>
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
animations.animate("200ms cubic-bezier(0.25, 0.8, 0.25, 1)"),
|
|
51
|
-
]),
|
|
52
|
-
animations.transition('* => void', [animations.animate('50ms 100ms linear', animations.style({ opacity: 0 }))]),
|
|
24
|
+
animations.transition('void => enter', animations.animate('120ms cubic-bezier(0, 0, 0.2, 1)', animations.style({
|
|
25
|
+
opacity: 1,
|
|
26
|
+
transform: 'scale(1)',
|
|
27
|
+
}))),
|
|
28
|
+
animations.transition('* => void', animations.animate('100ms 25ms linear', animations.style({ opacity: 0 }))),
|
|
53
29
|
]);
|
|
54
30
|
|
|
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
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
31
|
+
/*! *****************************************************************************
|
|
32
|
+
Copyright (c) Microsoft Corporation.
|
|
33
|
+
|
|
34
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
35
|
+
purpose with or without fee is hereby granted.
|
|
36
|
+
|
|
37
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
38
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
39
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
40
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
41
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
42
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
43
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
44
|
+
***************************************************************************** */
|
|
45
|
+
/* global Reflect, Promise */
|
|
46
|
+
var extendStatics = function (d, b) {
|
|
47
|
+
extendStatics = Object.setPrototypeOf ||
|
|
48
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
49
|
+
function (d, b) { for (var p in b)
|
|
50
|
+
if (Object.prototype.hasOwnProperty.call(b, p))
|
|
51
|
+
d[p] = b[p]; };
|
|
52
|
+
return extendStatics(d, b);
|
|
53
|
+
};
|
|
54
|
+
function __extends(d, b) {
|
|
55
|
+
if (typeof b !== "function" && b !== null)
|
|
56
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
57
|
+
extendStatics(d, b);
|
|
58
|
+
function __() { this.constructor = d; }
|
|
59
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
60
|
+
}
|
|
61
|
+
var __assign = function () {
|
|
62
|
+
__assign = Object.assign || function __assign(t) {
|
|
63
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
64
|
+
s = arguments[i];
|
|
65
|
+
for (var p in s)
|
|
66
|
+
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
67
|
+
t[p] = s[p];
|
|
68
|
+
}
|
|
69
|
+
return t;
|
|
70
|
+
};
|
|
71
|
+
return __assign.apply(this, arguments);
|
|
72
|
+
};
|
|
73
|
+
function __rest(s, e) {
|
|
74
|
+
var t = {};
|
|
75
|
+
for (var p in s)
|
|
76
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
77
|
+
t[p] = s[p];
|
|
78
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
79
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
80
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
81
|
+
t[p[i]] = s[p[i]];
|
|
82
|
+
}
|
|
83
|
+
return t;
|
|
84
|
+
}
|
|
85
|
+
function __decorate(decorators, target, key, desc) {
|
|
86
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
87
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
88
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
89
|
+
else
|
|
90
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
91
|
+
if (d = decorators[i])
|
|
92
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
93
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
94
|
+
}
|
|
95
|
+
function __param(paramIndex, decorator) {
|
|
96
|
+
return function (target, key) { decorator(target, key, paramIndex); };
|
|
97
|
+
}
|
|
98
|
+
function __metadata(metadataKey, metadataValue) {
|
|
99
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
100
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
101
|
+
}
|
|
102
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
103
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
104
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
105
|
+
function fulfilled(value) { try {
|
|
106
|
+
step(generator.next(value));
|
|
107
|
+
}
|
|
108
|
+
catch (e) {
|
|
109
|
+
reject(e);
|
|
110
|
+
} }
|
|
111
|
+
function rejected(value) { try {
|
|
112
|
+
step(generator["throw"](value));
|
|
113
|
+
}
|
|
114
|
+
catch (e) {
|
|
115
|
+
reject(e);
|
|
116
|
+
} }
|
|
117
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
118
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
function __generator(thisArg, body) {
|
|
122
|
+
var _ = { label: 0, sent: function () { if (t[0] & 1)
|
|
123
|
+
throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
124
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
|
|
125
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
126
|
+
function step(op) {
|
|
127
|
+
if (f)
|
|
128
|
+
throw new TypeError("Generator is already executing.");
|
|
129
|
+
while (_)
|
|
130
|
+
try {
|
|
131
|
+
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)
|
|
132
|
+
return t;
|
|
133
|
+
if (y = 0, t)
|
|
134
|
+
op = [op[0] & 2, t.value];
|
|
135
|
+
switch (op[0]) {
|
|
136
|
+
case 0:
|
|
137
|
+
case 1:
|
|
138
|
+
t = op;
|
|
139
|
+
break;
|
|
140
|
+
case 4:
|
|
141
|
+
_.label++;
|
|
142
|
+
return { value: op[1], done: false };
|
|
143
|
+
case 5:
|
|
144
|
+
_.label++;
|
|
145
|
+
y = op[1];
|
|
146
|
+
op = [0];
|
|
147
|
+
continue;
|
|
148
|
+
case 7:
|
|
149
|
+
op = _.ops.pop();
|
|
150
|
+
_.trys.pop();
|
|
151
|
+
continue;
|
|
152
|
+
default:
|
|
153
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
154
|
+
_ = 0;
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
|
|
158
|
+
_.label = op[1];
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
162
|
+
_.label = t[1];
|
|
163
|
+
t = op;
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
if (t && _.label < t[2]) {
|
|
167
|
+
_.label = t[2];
|
|
168
|
+
_.ops.push(op);
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
if (t[2])
|
|
172
|
+
_.ops.pop();
|
|
173
|
+
_.trys.pop();
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
op = body.call(thisArg, _);
|
|
98
177
|
}
|
|
99
|
-
|
|
100
|
-
|
|
178
|
+
catch (e) {
|
|
179
|
+
op = [6, e];
|
|
180
|
+
y = 0;
|
|
101
181
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
182
|
+
finally {
|
|
183
|
+
f = t = 0;
|
|
184
|
+
}
|
|
185
|
+
if (op[0] & 5)
|
|
186
|
+
throw op[1];
|
|
187
|
+
return { value: op[0] ? op[1] : void 0, done: true };
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
var __createBinding = Object.create ? (function (o, m, k, k2) {
|
|
191
|
+
if (k2 === undefined)
|
|
192
|
+
k2 = k;
|
|
193
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
|
|
194
|
+
}) : (function (o, m, k, k2) {
|
|
195
|
+
if (k2 === undefined)
|
|
196
|
+
k2 = k;
|
|
197
|
+
o[k2] = m[k];
|
|
198
|
+
});
|
|
199
|
+
function __exportStar(m, o) {
|
|
200
|
+
for (var p in m)
|
|
201
|
+
if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
|
|
202
|
+
__createBinding(o, m, p);
|
|
203
|
+
}
|
|
204
|
+
function __values(o) {
|
|
205
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
206
|
+
if (m)
|
|
207
|
+
return m.call(o);
|
|
208
|
+
if (o && typeof o.length === "number")
|
|
209
|
+
return {
|
|
210
|
+
next: function () {
|
|
211
|
+
if (o && i >= o.length)
|
|
212
|
+
o = void 0;
|
|
213
|
+
return { value: o && o[i++], done: !o };
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
217
|
+
}
|
|
218
|
+
function __read(o, n) {
|
|
219
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
220
|
+
if (!m)
|
|
221
|
+
return o;
|
|
222
|
+
var i = m.call(o), r, ar = [], e;
|
|
223
|
+
try {
|
|
224
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
|
225
|
+
ar.push(r.value);
|
|
226
|
+
}
|
|
227
|
+
catch (error) {
|
|
228
|
+
e = { error: error };
|
|
229
|
+
}
|
|
230
|
+
finally {
|
|
231
|
+
try {
|
|
232
|
+
if (r && !r.done && (m = i["return"]))
|
|
233
|
+
m.call(i);
|
|
234
|
+
}
|
|
235
|
+
finally {
|
|
236
|
+
if (e)
|
|
237
|
+
throw e.error;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return ar;
|
|
241
|
+
}
|
|
242
|
+
/** @deprecated */
|
|
243
|
+
function __spread() {
|
|
244
|
+
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
245
|
+
ar = ar.concat(__read(arguments[i]));
|
|
246
|
+
return ar;
|
|
247
|
+
}
|
|
248
|
+
/** @deprecated */
|
|
249
|
+
function __spreadArrays() {
|
|
250
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
|
251
|
+
s += arguments[i].length;
|
|
252
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
253
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
254
|
+
r[k] = a[j];
|
|
255
|
+
return r;
|
|
256
|
+
}
|
|
257
|
+
function __spreadArray(to, from, pack) {
|
|
258
|
+
if (pack || arguments.length === 2)
|
|
259
|
+
for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
260
|
+
if (ar || !(i in from)) {
|
|
261
|
+
if (!ar)
|
|
262
|
+
ar = Array.prototype.slice.call(from, 0, i);
|
|
263
|
+
ar[i] = from[i];
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
return to.concat(ar || from);
|
|
267
|
+
}
|
|
268
|
+
function __await(v) {
|
|
269
|
+
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
270
|
+
}
|
|
271
|
+
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
272
|
+
if (!Symbol.asyncIterator)
|
|
273
|
+
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
274
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
275
|
+
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
276
|
+
function verb(n) { if (g[n])
|
|
277
|
+
i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
278
|
+
function resume(n, v) { try {
|
|
279
|
+
step(g[n](v));
|
|
280
|
+
}
|
|
281
|
+
catch (e) {
|
|
282
|
+
settle(q[0][3], e);
|
|
283
|
+
} }
|
|
284
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
285
|
+
function fulfill(value) { resume("next", value); }
|
|
286
|
+
function reject(value) { resume("throw", value); }
|
|
287
|
+
function settle(f, v) { if (f(v), q.shift(), q.length)
|
|
288
|
+
resume(q[0][0], q[0][1]); }
|
|
289
|
+
}
|
|
290
|
+
function __asyncDelegator(o) {
|
|
291
|
+
var i, p;
|
|
292
|
+
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
293
|
+
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; }
|
|
294
|
+
}
|
|
295
|
+
function __asyncValues(o) {
|
|
296
|
+
if (!Symbol.asyncIterator)
|
|
297
|
+
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
298
|
+
var m = o[Symbol.asyncIterator], i;
|
|
299
|
+
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);
|
|
300
|
+
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); }); }; }
|
|
301
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
|
302
|
+
}
|
|
303
|
+
function __makeTemplateObject(cooked, raw) {
|
|
304
|
+
if (Object.defineProperty) {
|
|
305
|
+
Object.defineProperty(cooked, "raw", { value: raw });
|
|
306
|
+
}
|
|
307
|
+
else {
|
|
308
|
+
cooked.raw = raw;
|
|
309
|
+
}
|
|
310
|
+
return cooked;
|
|
311
|
+
}
|
|
312
|
+
;
|
|
313
|
+
var __setModuleDefault = Object.create ? (function (o, v) {
|
|
314
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
315
|
+
}) : function (o, v) {
|
|
316
|
+
o["default"] = v;
|
|
317
|
+
};
|
|
318
|
+
function __importStar(mod) {
|
|
319
|
+
if (mod && mod.__esModule)
|
|
320
|
+
return mod;
|
|
321
|
+
var result = {};
|
|
322
|
+
if (mod != null)
|
|
323
|
+
for (var k in mod)
|
|
324
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
325
|
+
__createBinding(result, mod, k);
|
|
326
|
+
__setModuleDefault(result, mod);
|
|
327
|
+
return result;
|
|
328
|
+
}
|
|
329
|
+
function __importDefault(mod) {
|
|
330
|
+
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
331
|
+
}
|
|
332
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
333
|
+
if (kind === "a" && !f)
|
|
334
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
335
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
336
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
337
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
338
|
+
}
|
|
339
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
340
|
+
if (kind === "m")
|
|
341
|
+
throw new TypeError("Private method is not writable");
|
|
342
|
+
if (kind === "a" && !f)
|
|
343
|
+
throw new TypeError("Private accessor was defined without a setter");
|
|
344
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
345
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
346
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Injection token that can be used to reference instances of `MtxPopoverContent`. It serves
|
|
351
|
+
* as alternative token to the actual `MtxPopoverContent` class which could cause unnecessary
|
|
352
|
+
* retention of the class and its directive metadata.
|
|
353
|
+
*/
|
|
354
|
+
var MTX_POPOVER_CONTENT = new core.InjectionToken('MtxPopoverContent');
|
|
355
|
+
var _MtxPopoverContentBase = /** @class */ (function () {
|
|
356
|
+
function _MtxPopoverContentBase(_template, _componentFactoryResolver, _appRef, _injector, _viewContainerRef, _document, _changeDetectorRef) {
|
|
357
|
+
this._template = _template;
|
|
358
|
+
this._componentFactoryResolver = _componentFactoryResolver;
|
|
359
|
+
this._appRef = _appRef;
|
|
360
|
+
this._injector = _injector;
|
|
361
|
+
this._viewContainerRef = _viewContainerRef;
|
|
362
|
+
this._document = _document;
|
|
363
|
+
this._changeDetectorRef = _changeDetectorRef;
|
|
364
|
+
/** Emits when the popover content has been attached. */
|
|
365
|
+
this._attached = new rxjs.Subject();
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Attaches the content with a particular context.
|
|
369
|
+
* @docs-private
|
|
370
|
+
*/
|
|
371
|
+
_MtxPopoverContentBase.prototype.attach = function (context) {
|
|
372
|
+
if (context === void 0) { context = {}; }
|
|
373
|
+
if (!this._portal) {
|
|
374
|
+
this._portal = new portal.TemplatePortal(this._template, this._viewContainerRef);
|
|
375
|
+
}
|
|
376
|
+
this.detach();
|
|
377
|
+
if (!this._outlet) {
|
|
378
|
+
this._outlet = new portal.DomPortalOutlet(this._document.createElement('div'), this._componentFactoryResolver, this._appRef, this._injector);
|
|
379
|
+
}
|
|
380
|
+
var element = this._template.elementRef.nativeElement;
|
|
381
|
+
// Because we support opening the same popover from different triggers (which in turn have their
|
|
382
|
+
// own `OverlayRef` panel), we have to re-insert the host element every time, otherwise we
|
|
383
|
+
// risk it staying attached to a pane that's no longer in the DOM.
|
|
384
|
+
element.parentNode.insertBefore(this._outlet.outletElement, element);
|
|
385
|
+
// When `MtxPopoverContent` is used in an `OnPush` component, the insertion of the popover
|
|
386
|
+
// content via `createEmbeddedView` does not cause the content to be seen as "dirty"
|
|
387
|
+
// by Angular. This causes the `@ContentChildren` for popover items within the popover to
|
|
388
|
+
// not be updated by Angular. By explicitly marking for check here, we tell Angular that
|
|
389
|
+
// it needs to check for new popover items and update the `@ContentChild` in `MtxPopover`.
|
|
390
|
+
// @breaking-change 9.0.0 Make change detector ref required
|
|
391
|
+
if (this._changeDetectorRef) {
|
|
392
|
+
this._changeDetectorRef.markForCheck();
|
|
393
|
+
}
|
|
394
|
+
this._portal.attach(this._outlet, context);
|
|
395
|
+
this._attached.next();
|
|
396
|
+
};
|
|
397
|
+
/**
|
|
398
|
+
* Detaches the content.
|
|
399
|
+
* @docs-private
|
|
400
|
+
*/
|
|
401
|
+
_MtxPopoverContentBase.prototype.detach = function () {
|
|
402
|
+
if (this._portal.isAttached) {
|
|
403
|
+
this._portal.detach();
|
|
404
|
+
}
|
|
405
|
+
};
|
|
406
|
+
_MtxPopoverContentBase.prototype.ngOnDestroy = function () {
|
|
407
|
+
if (this._outlet) {
|
|
408
|
+
this._outlet.dispose();
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
return _MtxPopoverContentBase;
|
|
412
|
+
}());
|
|
413
|
+
/** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
|
|
414
|
+
_MtxPopoverContentBase.decorators = [
|
|
415
|
+
{ type: core.Directive }
|
|
416
|
+
];
|
|
417
|
+
/**
|
|
418
|
+
* @type {function(): !Array<(null|{
|
|
419
|
+
* type: ?,
|
|
420
|
+
* decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>),
|
|
421
|
+
* })>}
|
|
422
|
+
* @nocollapse
|
|
423
|
+
*/
|
|
424
|
+
_MtxPopoverContentBase.ctorParameters = function () { return [
|
|
425
|
+
{ type: core.TemplateRef },
|
|
426
|
+
{ type: core.ComponentFactoryResolver },
|
|
427
|
+
{ type: core.ApplicationRef },
|
|
428
|
+
{ type: core.Injector },
|
|
429
|
+
{ type: core.ViewContainerRef },
|
|
430
|
+
{ type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] },
|
|
431
|
+
{ type: core.ChangeDetectorRef }
|
|
432
|
+
]; };
|
|
433
|
+
/**
|
|
434
|
+
* Popover content that will be rendered lazily once the popover is opened.
|
|
435
|
+
*/
|
|
436
|
+
var MtxPopoverContent = /** @class */ (function (_super) {
|
|
437
|
+
__extends(MtxPopoverContent, _super);
|
|
438
|
+
function MtxPopoverContent() {
|
|
439
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
440
|
+
}
|
|
441
|
+
return MtxPopoverContent;
|
|
442
|
+
}(_MtxPopoverContentBase));
|
|
443
|
+
/** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
|
|
444
|
+
MtxPopoverContent.decorators = [
|
|
445
|
+
{ type: core.Directive, args: [{
|
|
446
|
+
selector: 'ng-template[mtxPopoverContent]',
|
|
447
|
+
providers: [{ provide: MTX_POPOVER_CONTENT, useExisting: MtxPopoverContent }],
|
|
448
|
+
},] }
|
|
449
|
+
];
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* Throws an exception for the case when popover trigger doesn't have a valid mtx-popover instance
|
|
453
|
+
*/
|
|
454
|
+
function throwMtxPopoverMissingError() {
|
|
455
|
+
throw Error("mtx-popover-trigger: must pass in an mtx-popover instance.\n\n Example:\n <mtx-popover #popover=\"mtxPopover\"></mtx-popover>\n <button [mtxPopoverTriggerFor]=\"popover\"></button>");
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Throws an exception for the case when popover's mtxPopoverPosition[0] value isn't valid.
|
|
459
|
+
* In other words, it doesn't match 'above', 'below', 'before' or 'after'.
|
|
460
|
+
*/
|
|
461
|
+
function throwMtxPopoverInvalidPositionStart() {
|
|
462
|
+
throw Error("mtxPopoverPosition[0] value must be either 'above', 'below', 'before' or 'after'.\n Example: <mtx-popover [position]=\"['below', 'after']\" #popover=\"mtxPopover\"></mtx-popover>");
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Throws an exception for the case when popover's mtxPopoverPosition[1] value isn't valid.
|
|
466
|
+
* In other words, it doesn't match 'above', 'below', 'before', 'after' or 'center'.
|
|
467
|
+
*/
|
|
468
|
+
function throwMtxPopoverInvalidPositionEnd() {
|
|
469
|
+
throw Error("mtxPopoverPosition[1] value must be either 'above', 'below', 'before', 'after' or 'center'.\n Example: <mtx-popover [position]=\"['below', 'after']\" #popover=\"mtxPopover\"></mtx-popover>");
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
/** Injection token to be used to override the default options for `mtx-popover`. */
|
|
473
|
+
var MTX_POPOVER_DEFAULT_OPTIONS = new core.InjectionToken('mtx-popover-default-options', {
|
|
474
|
+
providedIn: 'root',
|
|
475
|
+
factory: MTX_POPOVER_DEFAULT_OPTIONS_FACTORY,
|
|
476
|
+
});
|
|
477
|
+
/** @docs-private */
|
|
478
|
+
function MTX_POPOVER_DEFAULT_OPTIONS_FACTORY() {
|
|
479
|
+
return {
|
|
480
|
+
backdropClass: 'cdk-overlay-transparent-backdrop',
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
var popoverPanelUid = 0;
|
|
484
|
+
var MtxPopover = /** @class */ (function () {
|
|
485
|
+
function MtxPopover(_elementRef, _ngZone, _defaultOptions) {
|
|
486
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
487
|
+
this._elementRef = _elementRef;
|
|
488
|
+
this._ngZone = _ngZone;
|
|
489
|
+
this._defaultOptions = _defaultOptions;
|
|
490
|
+
this._triggerEvent = (_a = this._defaultOptions.triggerEvent) !== null && _a !== void 0 ? _a : 'hover';
|
|
491
|
+
this._enterDelay = (_b = this._defaultOptions.enterDelay) !== null && _b !== void 0 ? _b : 100;
|
|
492
|
+
this._leaveDelay = (_c = this._defaultOptions.leaveDelay) !== null && _c !== void 0 ? _c : 100;
|
|
493
|
+
this._position = (_d = this._defaultOptions.position) !== null && _d !== void 0 ? _d : ['below', 'after'];
|
|
494
|
+
this._panelOffsetX = (_e = this._defaultOptions.xOffset) !== null && _e !== void 0 ? _e : 0;
|
|
495
|
+
this._panelOffsetY = (_f = this._defaultOptions.yOffset) !== null && _f !== void 0 ? _f : 0;
|
|
496
|
+
this._arrowWidth = (_g = this._defaultOptions.arrowWidth) !== null && _g !== void 0 ? _g : 16;
|
|
497
|
+
this._arrowHeight = (_h = this._defaultOptions.arrowHeight) !== null && _h !== void 0 ? _h : 16;
|
|
498
|
+
this._arrowOffsetX = (_j = this._defaultOptions.arrowOffsetX) !== null && _j !== void 0 ? _j : 20;
|
|
499
|
+
this._arrowOffsetY = (_k = this._defaultOptions.arrowOffsetY) !== null && _k !== void 0 ? _k : 20;
|
|
500
|
+
this._closeOnPanelClick = (_l = this._defaultOptions.closeOnPanelClick) !== null && _l !== void 0 ? _l : false;
|
|
501
|
+
this._closeOnBackdropClick = (_m = this._defaultOptions.closeOnBackdropClick) !== null && _m !== void 0 ? _m : true;
|
|
502
|
+
this._focusTrapEnabled = (_o = this._defaultOptions.focusTrapEnabled) !== null && _o !== void 0 ? _o : false;
|
|
503
|
+
this._focusTrapAutoCaptureEnabled = (_p = this._defaultOptions.focusTrapAutoCaptureEnabled) !== null && _p !== void 0 ? _p : false;
|
|
504
|
+
this._hasBackdrop = this._defaultOptions.hasBackdrop;
|
|
505
|
+
this._elevation = (_q = this._defaultOptions.elevation) !== null && _q !== void 0 ? _q : 8;
|
|
506
|
+
this._elevationPrefix = 'mat-elevation-z';
|
|
507
|
+
/** Config object to be passed into the popover's ngClass. */
|
|
508
|
+
this._classList = {};
|
|
509
|
+
/** Current state of the panel animation. */
|
|
510
|
+
this._panelAnimationState = 'void';
|
|
511
|
+
/** Emits whenever an animation on the popover completes. */
|
|
512
|
+
this._animationDone = new rxjs.Subject();
|
|
513
|
+
/** Whether the popover is animating. */
|
|
514
|
+
this._isAnimating = false;
|
|
515
|
+
/** Closing disabled on popover */
|
|
516
|
+
this.closeDisabled = false;
|
|
517
|
+
/** Config object to be passed into the popover's arrow ngStyle */
|
|
518
|
+
this.arrowStyles = null;
|
|
519
|
+
/** Class or list of classes to be added to the overlay panel. */
|
|
520
|
+
this.overlayPanelClass = this._defaultOptions.overlayPanelClass || '';
|
|
521
|
+
/** Class to be added to the backdrop element. */
|
|
522
|
+
this.backdropClass = this._defaultOptions.backdropClass;
|
|
523
|
+
/** Event emitted when the popover is closed. */
|
|
524
|
+
this.closed = new core.EventEmitter();
|
|
525
|
+
this.panelId = "mtx-popover-panel-" + popoverPanelUid++;
|
|
526
|
+
}
|
|
527
|
+
Object.defineProperty(MtxPopover.prototype, "triggerEvent", {
|
|
528
|
+
/** Popover's trigger event. */
|
|
529
|
+
get: function () {
|
|
530
|
+
return this._triggerEvent;
|
|
178
531
|
},
|
|
179
532
|
set: function (value) {
|
|
180
|
-
this.
|
|
533
|
+
this._triggerEvent = value;
|
|
181
534
|
},
|
|
182
535
|
enumerable: false,
|
|
183
536
|
configurable: true
|
|
184
537
|
});
|
|
185
|
-
Object.defineProperty(MtxPopover.prototype, "
|
|
186
|
-
/** Popover
|
|
538
|
+
Object.defineProperty(MtxPopover.prototype, "enterDelay", {
|
|
539
|
+
/** Popover's enter delay. */
|
|
187
540
|
get: function () {
|
|
188
|
-
return this.
|
|
541
|
+
return this._enterDelay;
|
|
189
542
|
},
|
|
190
543
|
set: function (value) {
|
|
191
|
-
this.
|
|
544
|
+
this._enterDelay = value;
|
|
192
545
|
},
|
|
193
546
|
enumerable: false,
|
|
194
547
|
configurable: true
|
|
195
548
|
});
|
|
196
|
-
Object.defineProperty(MtxPopover.prototype, "
|
|
197
|
-
/** Popover
|
|
549
|
+
Object.defineProperty(MtxPopover.prototype, "leaveDelay", {
|
|
550
|
+
/** Popover's leave delay. */
|
|
198
551
|
get: function () {
|
|
199
|
-
return this.
|
|
552
|
+
return this._leaveDelay;
|
|
200
553
|
},
|
|
201
554
|
set: function (value) {
|
|
202
|
-
this.
|
|
555
|
+
this._leaveDelay = value;
|
|
203
556
|
},
|
|
204
557
|
enumerable: false,
|
|
205
558
|
configurable: true
|
|
206
559
|
});
|
|
207
|
-
Object.defineProperty(MtxPopover.prototype, "
|
|
208
|
-
/** Popover
|
|
560
|
+
Object.defineProperty(MtxPopover.prototype, "position", {
|
|
561
|
+
/** Popover's position. */
|
|
562
|
+
get: function () {
|
|
563
|
+
return this._position;
|
|
564
|
+
},
|
|
565
|
+
set: function (value) {
|
|
566
|
+
if (!['before', 'after', 'above', 'below'].includes(value[0])) {
|
|
567
|
+
throwMtxPopoverInvalidPositionStart();
|
|
568
|
+
}
|
|
569
|
+
if (!['before', 'after', 'above', 'below', 'center'].includes(value[1])) {
|
|
570
|
+
throwMtxPopoverInvalidPositionEnd();
|
|
571
|
+
}
|
|
572
|
+
this._position = value;
|
|
573
|
+
this.setPositionClasses();
|
|
574
|
+
},
|
|
575
|
+
enumerable: false,
|
|
576
|
+
configurable: true
|
|
577
|
+
});
|
|
578
|
+
Object.defineProperty(MtxPopover.prototype, "xOffset", {
|
|
579
|
+
/** Popover-panel's X offset. */
|
|
580
|
+
get: function () {
|
|
581
|
+
return this._panelOffsetX;
|
|
582
|
+
},
|
|
583
|
+
set: function (value) {
|
|
584
|
+
this._panelOffsetX = value;
|
|
585
|
+
},
|
|
586
|
+
enumerable: false,
|
|
587
|
+
configurable: true
|
|
588
|
+
});
|
|
589
|
+
Object.defineProperty(MtxPopover.prototype, "yOffset", {
|
|
590
|
+
/** Popover-panel's Y offset. */
|
|
591
|
+
get: function () {
|
|
592
|
+
return this._panelOffsetY;
|
|
593
|
+
},
|
|
594
|
+
set: function (value) {
|
|
595
|
+
this._panelOffsetY = value;
|
|
596
|
+
},
|
|
597
|
+
enumerable: false,
|
|
598
|
+
configurable: true
|
|
599
|
+
});
|
|
600
|
+
Object.defineProperty(MtxPopover.prototype, "arrowWidth", {
|
|
601
|
+
/** Popover-arrow's width. */
|
|
602
|
+
get: function () {
|
|
603
|
+
return this._arrowWidth;
|
|
604
|
+
},
|
|
605
|
+
set: function (value) {
|
|
606
|
+
this._arrowWidth = value;
|
|
607
|
+
},
|
|
608
|
+
enumerable: false,
|
|
609
|
+
configurable: true
|
|
610
|
+
});
|
|
611
|
+
Object.defineProperty(MtxPopover.prototype, "arrowHeight", {
|
|
612
|
+
/** Popover-arrow's height. */
|
|
209
613
|
get: function () {
|
|
210
614
|
return this._arrowHeight;
|
|
211
615
|
},
|
|
@@ -215,41 +619,52 @@
|
|
|
215
619
|
enumerable: false,
|
|
216
620
|
configurable: true
|
|
217
621
|
});
|
|
218
|
-
Object.defineProperty(MtxPopover.prototype, "
|
|
219
|
-
/** Popover
|
|
622
|
+
Object.defineProperty(MtxPopover.prototype, "arrowOffsetX", {
|
|
623
|
+
/** Popover-arrow's X offset. */
|
|
220
624
|
get: function () {
|
|
221
|
-
return this.
|
|
625
|
+
return this._arrowOffsetX;
|
|
222
626
|
},
|
|
223
627
|
set: function (value) {
|
|
224
|
-
this.
|
|
628
|
+
this._arrowOffsetX = value;
|
|
225
629
|
},
|
|
226
630
|
enumerable: false,
|
|
227
631
|
configurable: true
|
|
228
632
|
});
|
|
229
|
-
Object.defineProperty(MtxPopover.prototype, "
|
|
230
|
-
/** Popover
|
|
633
|
+
Object.defineProperty(MtxPopover.prototype, "arrowOffsetY", {
|
|
634
|
+
/** Popover-arrow's Y offset. */
|
|
231
635
|
get: function () {
|
|
232
|
-
return this.
|
|
636
|
+
return this._arrowOffsetY;
|
|
233
637
|
},
|
|
234
638
|
set: function (value) {
|
|
235
|
-
this.
|
|
639
|
+
this._arrowOffsetY = value;
|
|
640
|
+
},
|
|
641
|
+
enumerable: false,
|
|
642
|
+
configurable: true
|
|
643
|
+
});
|
|
644
|
+
Object.defineProperty(MtxPopover.prototype, "closeOnPanelClick", {
|
|
645
|
+
/** Whether popover can be closed when click the popover-panel. */
|
|
646
|
+
get: function () {
|
|
647
|
+
return this._closeOnPanelClick;
|
|
648
|
+
},
|
|
649
|
+
set: function (value) {
|
|
650
|
+
this._closeOnPanelClick = coercion.coerceBooleanProperty(value);
|
|
236
651
|
},
|
|
237
652
|
enumerable: false,
|
|
238
653
|
configurable: true
|
|
239
654
|
});
|
|
240
|
-
Object.defineProperty(MtxPopover.prototype, "
|
|
241
|
-
/**
|
|
655
|
+
Object.defineProperty(MtxPopover.prototype, "closeOnBackdropClick", {
|
|
656
|
+
/** Whether popover can be closed when click the backdrop. */
|
|
242
657
|
get: function () {
|
|
243
|
-
return this.
|
|
658
|
+
return this._closeOnBackdropClick;
|
|
244
659
|
},
|
|
245
660
|
set: function (value) {
|
|
246
|
-
this.
|
|
661
|
+
this._closeOnBackdropClick = coercion.coerceBooleanProperty(value);
|
|
247
662
|
},
|
|
248
663
|
enumerable: false,
|
|
249
664
|
configurable: true
|
|
250
665
|
});
|
|
251
666
|
Object.defineProperty(MtxPopover.prototype, "focusTrapEnabled", {
|
|
252
|
-
/**
|
|
667
|
+
/** Whether enable focus trap using `cdkTrapFocus`. */
|
|
253
668
|
get: function () {
|
|
254
669
|
return this._focusTrapEnabled;
|
|
255
670
|
},
|
|
@@ -260,7 +675,7 @@
|
|
|
260
675
|
configurable: true
|
|
261
676
|
});
|
|
262
677
|
Object.defineProperty(MtxPopover.prototype, "focusTrapAutoCaptureEnabled", {
|
|
263
|
-
/**
|
|
678
|
+
/** Whether enable focus trap auto capture using `cdkTrapFocusAutoCapture`. */
|
|
264
679
|
get: function () {
|
|
265
680
|
return this._focusTrapAutoCaptureEnabled;
|
|
266
681
|
},
|
|
@@ -270,10 +685,32 @@
|
|
|
270
685
|
enumerable: false,
|
|
271
686
|
configurable: true
|
|
272
687
|
});
|
|
688
|
+
Object.defineProperty(MtxPopover.prototype, "hasBackdrop", {
|
|
689
|
+
/** Whether the popover has a backdrop. It will always be false if the trigger event is hover. */
|
|
690
|
+
get: function () {
|
|
691
|
+
return this._hasBackdrop;
|
|
692
|
+
},
|
|
693
|
+
set: function (value) {
|
|
694
|
+
this._hasBackdrop = coercion.coerceBooleanProperty(value);
|
|
695
|
+
},
|
|
696
|
+
enumerable: false,
|
|
697
|
+
configurable: true
|
|
698
|
+
});
|
|
699
|
+
Object.defineProperty(MtxPopover.prototype, "elevation", {
|
|
700
|
+
/** Popover-panel's elevation (0~24). */
|
|
701
|
+
get: function () {
|
|
702
|
+
return Math.max(0, Math.min(Math.round(this._elevation), 24));
|
|
703
|
+
},
|
|
704
|
+
set: function (value) {
|
|
705
|
+
this._elevation = value;
|
|
706
|
+
},
|
|
707
|
+
enumerable: false,
|
|
708
|
+
configurable: true
|
|
709
|
+
});
|
|
273
710
|
Object.defineProperty(MtxPopover.prototype, "panelClass", {
|
|
274
711
|
/**
|
|
275
712
|
* This method takes classes set on the host md-popover element and applies them on the
|
|
276
|
-
* popover template that displays in the overlay container.
|
|
713
|
+
* popover template that displays in the overlay container. Otherwise, it's difficult
|
|
277
714
|
* to style the containing popover from outside the component.
|
|
278
715
|
* @param classes list of class names
|
|
279
716
|
*/
|
|
@@ -293,7 +730,7 @@
|
|
|
293
730
|
Object.defineProperty(MtxPopover.prototype, "classList", {
|
|
294
731
|
/**
|
|
295
732
|
* This method takes classes set on the host md-popover element and applies them on the
|
|
296
|
-
* popover template that displays in the overlay container.
|
|
733
|
+
* popover template that displays in the overlay container. Otherwise, it's difficult
|
|
297
734
|
* to style the containing popover from outside the component.
|
|
298
735
|
* @deprecated Use `panelClass` instead.
|
|
299
736
|
* @breaking-change 8.0.0
|
|
@@ -307,495 +744,242 @@
|
|
|
307
744
|
enumerable: false,
|
|
308
745
|
configurable: true
|
|
309
746
|
});
|
|
747
|
+
MtxPopover.prototype.ngOnInit = function () {
|
|
748
|
+
this.setPositionClasses();
|
|
749
|
+
};
|
|
310
750
|
MtxPopover.prototype.ngOnDestroy = function () {
|
|
311
|
-
this._emitCloseEvent();
|
|
312
751
|
this.closed.complete();
|
|
313
752
|
};
|
|
314
753
|
/** Handle a keyboard event from the popover, delegating to the appropriate action. */
|
|
315
754
|
MtxPopover.prototype._handleKeydown = function (event) {
|
|
316
|
-
|
|
755
|
+
var keyCode = event.keyCode;
|
|
756
|
+
switch (keyCode) {
|
|
317
757
|
case keycodes.ESCAPE:
|
|
318
|
-
|
|
319
|
-
|
|
758
|
+
if (!keycodes.hasModifierKey(event)) {
|
|
759
|
+
event.preventDefault();
|
|
760
|
+
this.closed.emit('keydown');
|
|
761
|
+
}
|
|
762
|
+
break;
|
|
320
763
|
}
|
|
321
764
|
};
|
|
322
|
-
/**
|
|
323
|
-
|
|
324
|
-
* trigger will close the popover.
|
|
325
|
-
*/
|
|
326
|
-
MtxPopover.prototype._emitCloseEvent = function () {
|
|
327
|
-
this.closed.emit();
|
|
328
|
-
};
|
|
329
|
-
/** Close popover on click if closeOnPanelClick is true */
|
|
330
|
-
MtxPopover.prototype.onClick = function () {
|
|
765
|
+
/** Close popover on click if `closeOnPanelClick` is true. */
|
|
766
|
+
MtxPopover.prototype._handleClick = function () {
|
|
331
767
|
if (this.closeOnPanelClick) {
|
|
332
|
-
this.
|
|
768
|
+
this.closed.emit('click');
|
|
333
769
|
}
|
|
334
770
|
};
|
|
335
|
-
/** Disables close of popover when leaving trigger element and mouse over the popover */
|
|
336
|
-
MtxPopover.prototype.
|
|
771
|
+
/** Disables close of popover when leaving trigger element and mouse over the popover. */
|
|
772
|
+
MtxPopover.prototype._handleMouseOver = function () {
|
|
337
773
|
if (this.triggerEvent === 'hover') {
|
|
338
774
|
this.closeDisabled = true;
|
|
339
775
|
}
|
|
340
776
|
};
|
|
341
|
-
/** Enables close of popover when mouse leaving popover element */
|
|
342
|
-
MtxPopover.prototype.
|
|
777
|
+
/** Enables close of popover when mouse leaving popover element. */
|
|
778
|
+
MtxPopover.prototype._handleMouseLeave = function () {
|
|
343
779
|
var _this = this;
|
|
344
780
|
if (this.triggerEvent === 'hover') {
|
|
345
781
|
setTimeout(function () {
|
|
346
782
|
_this.closeDisabled = false;
|
|
347
|
-
_this.
|
|
783
|
+
_this.closed.emit();
|
|
348
784
|
}, this.leaveDelay);
|
|
349
785
|
}
|
|
350
|
-
};
|
|
351
|
-
/** Sets the current styles for the popover to allow for dynamically changing settings */
|
|
352
|
-
MtxPopover.prototype.setCurrentStyles = function (pos) {
|
|
353
|
-
if (pos === void 0) { pos = this.position; }
|
|
354
|
-
var left = pos[1] === 'after'
|
|
355
|
-
? this.arrowOffsetX - this.arrowWidth / 2 + "px"
|
|
356
|
-
: pos[1] === 'center'
|
|
357
|
-
? "calc(50% - " + this.arrowWidth / 2 + "px)"
|
|
358
|
-
: '';
|
|
359
|
-
var right = pos[1] === 'before' ? this.arrowOffsetX - this.arrowWidth / 2 + "px" : '';
|
|
360
|
-
var bottom = pos[1] === 'above'
|
|
361
|
-
? this.arrowOffsetY - this.arrowHeight / 2 + "px"
|
|
362
|
-
: pos[1] === 'center'
|
|
363
|
-
? "calc(50% - " + this.arrowHeight / 2 + "px)"
|
|
364
|
-
: '';
|
|
365
|
-
var top = pos[1] === 'below' ? this.arrowOffsetY - this.arrowHeight / 2 + "px" : '';
|
|
366
|
-
this.
|
|
367
|
-
pos[0] === 'above' || pos[0] === 'below'
|
|
368
|
-
? {
|
|
369
|
-
left: this.
|
|
370
|
-
right: this.
|
|
371
|
-
}
|
|
372
|
-
: {
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
this._classList['mtx-popover-
|
|
384
|
-
this._classList['mtx-popover-
|
|
385
|
-
this._classList['mtx-popover-
|
|
386
|
-
this._classList['mtx-popover-
|
|
387
|
-
this._classList['mtx-popover-
|
|
388
|
-
this._classList['mtx-popover-after
|
|
389
|
-
this._classList['mtx-popover-
|
|
390
|
-
this._classList['mtx-popover-
|
|
391
|
-
this._classList['mtx-popover-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
/** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
|
|
399
|
-
MtxPopover.decorators = [
|
|
400
|
-
{ type: core.Component, args: [{
|
|
401
|
-
selector: 'mtx-popover',
|
|
402
|
-
template: "<ng-template>\r\n <div class=\"mtx-popover-panel mat-elevation-z8\" role=\"dialog\"\r\n [ngClass]=\"_classList\"\r\n [ngStyle]=\"popoverPanelStyles\"\r\n (keydown)=\"_handleKeydown($event)\"\r\n (click)=\"onClick()\"\r\n (mouseover)=\"onMouseOver()\"\r\n (mouseleave)=\"onMouseLeave()\"\r\n [@.disabled]=\"disableAnimation\"\r\n [@transformPopover]=\"'enter'\">\r\n <div class=\"mtx-popover-direction-arrow\" [ngStyle]=\"popoverArrowStyles\"></div>\r\n <div class=\"mtx-popover-content\"\r\n [ngStyle]=\"popoverContentStyles\"\r\n [cdkTrapFocus]=\"focusTrapEnabled\"\r\n [cdkTrapFocusAutoCapture]=\"focusTrapAutoCaptureEnabled\">\r\n <ng-content></ng-content>\r\n </div>\r\n </div>\r\n</ng-template>\r\n",
|
|
403
|
-
changeDetection: core.ChangeDetectionStrategy.OnPush,
|
|
404
|
-
encapsulation: core.ViewEncapsulation.None,
|
|
405
|
-
animations: [transformPopover],
|
|
406
|
-
exportAs: 'mtxPopover',
|
|
407
|
-
styles: [".mtx-popover-panel{max-height:calc(100vh - 48px);padding:8px;border-radius:4px;font-size:16px}.mtx-popover-panel[class*=mtx-popover-below]{margin-top:calc(.5em + 2px)}.mtx-popover-panel[class*=mtx-popover-above]{margin-bottom:calc(.5em + 2px)}.mtx-popover-panel[class*=mtx-popover-before]{margin-right:calc(.5em + 2px)}[dir=rtl] .mtx-popover-panel[class*=mtx-popover-before]{margin-right:auto;margin-left:calc(.5em + 2px)}.mtx-popover-panel[class*=mtx-popover-after]{margin-left:calc(.5em + 2px)}[dir=rtl] .mtx-popover-panel[class*=mtx-popover-after]{margin-left:auto;margin-right:calc(.5em + 2px)}.mtx-popover-direction-arrow{position:absolute}.mtx-popover-direction-arrow:before,.mtx-popover-direction-arrow:after{position:absolute;display:inline-block;content:\"\";border-width:.5em;border-style:solid}.mtx-popover-direction-arrow:after{border-width:calc(.5em - 1px)}[class*=mtx-popover-below] .mtx-popover-direction-arrow,[class*=mtx-popover-above] .mtx-popover-direction-arrow{width:1em}[class*=mtx-popover-below] .mtx-popover-direction-arrow:after,[class*=mtx-popover-above] .mtx-popover-direction-arrow:after{left:1px}[dir=rtl] [class*=mtx-popover-below] .mtx-popover-direction-arrow:after,[dir=rtl] [class*=mtx-popover-above] .mtx-popover-direction-arrow:after{right:1px;left:auto}[class*=mtx-popover-below] .mtx-popover-direction-arrow{top:0}[class*=mtx-popover-below] .mtx-popover-direction-arrow:before,[class*=mtx-popover-below] .mtx-popover-direction-arrow:after{bottom:0;border-top-width:0}[class*=mtx-popover-above] .mtx-popover-direction-arrow{bottom:0}[class*=mtx-popover-above] .mtx-popover-direction-arrow:before,[class*=mtx-popover-above] .mtx-popover-direction-arrow:after{top:0;border-bottom-width:0}[class*=mtx-popover-before] .mtx-popover-direction-arrow,[class*=mtx-popover-after] .mtx-popover-direction-arrow{height:1em}[class*=mtx-popover-before] .mtx-popover-direction-arrow:after,[class*=mtx-popover-after] .mtx-popover-direction-arrow:after{top:1px}[class*=mtx-popover-before] .mtx-popover-direction-arrow{right:0}[class*=mtx-popover-before] .mtx-popover-direction-arrow:before,[class*=mtx-popover-before] .mtx-popover-direction-arrow:after{left:0;border-right-width:0}[dir=rtl] [class*=mtx-popover-before] .mtx-popover-direction-arrow{right:auto;left:0}[dir=rtl] [class*=mtx-popover-before] .mtx-popover-direction-arrow:before,[dir=rtl] [class*=mtx-popover-before] .mtx-popover-direction-arrow:after{left:auto;right:0;border-left-width:0}[dir=rtl] [class*=mtx-popover-before] .mtx-popover-direction-arrow:before{border-right-width:.5em}[dir=rtl] [class*=mtx-popover-before] .mtx-popover-direction-arrow:after{border-right-width:calc(.5em - 1px)}[class*=mtx-popover-after] .mtx-popover-direction-arrow{left:0}[class*=mtx-popover-after] .mtx-popover-direction-arrow:before,[class*=mtx-popover-after] .mtx-popover-direction-arrow:after{right:0;border-left-width:0}[dir=rtl] [class*=mtx-popover-after] .mtx-popover-direction-arrow{left:auto;right:0}[dir=rtl] [class*=mtx-popover-after] .mtx-popover-direction-arrow:before,[dir=rtl] [class*=mtx-popover-after] .mtx-popover-direction-arrow:after{right:auto;left:0;border-right-width:0}[dir=rtl] [class*=mtx-popover-after] .mtx-popover-direction-arrow:before{border-left-width:.5em}[dir=rtl] [class*=mtx-popover-after] .mtx-popover-direction-arrow:after{border-left-width:calc(.5em - 1px)}\n"]
|
|
408
|
-
},] }
|
|
409
|
-
];
|
|
410
|
-
/**
|
|
411
|
-
* @type {function(): !Array<(null|{
|
|
412
|
-
* type: ?,
|
|
413
|
-
* decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>),
|
|
414
|
-
* })>}
|
|
415
|
-
* @nocollapse
|
|
416
|
-
*/
|
|
417
|
-
MtxPopover.ctorParameters = function () { return [
|
|
418
|
-
{ type: bidi.Directionality, decorators: [{ type: core.Optional }] },
|
|
419
|
-
{ type: core.ElementRef },
|
|
420
|
-
{ type: core.NgZone }
|
|
421
|
-
]; };
|
|
422
|
-
/** @type {!Object<string, !Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
|
|
423
|
-
MtxPopover.propDecorators = {
|
|
424
|
-
role: [{ type: core.HostBinding, args: ['attr.role',] }],
|
|
425
|
-
position: [{ type: core.Input }],
|
|
426
|
-
triggerEvent: [{ type: core.Input }],
|
|
427
|
-
scrollStrategy: [{ type: core.Input }],
|
|
428
|
-
enterDelay: [{ type: core.Input }],
|
|
429
|
-
leaveDelay: [{ type: core.Input }],
|
|
430
|
-
xOffset: [{ type: core.Input }],
|
|
431
|
-
yOffset: [{ type: core.Input }],
|
|
432
|
-
arrowOffsetX: [{ type: core.Input }],
|
|
433
|
-
arrowOffsetY: [{ type: core.Input }],
|
|
434
|
-
arrowWidth: [{ type: core.Input }],
|
|
435
|
-
arrowHeight: [{ type: core.Input }],
|
|
436
|
-
closeOnPanelClick: [{ type: core.Input }],
|
|
437
|
-
closeOnBackdropClick: [{ type: core.Input }],
|
|
438
|
-
disableAnimation: [{ type: core.Input }],
|
|
439
|
-
focusTrapEnabled: [{ type: core.Input }],
|
|
440
|
-
focusTrapAutoCaptureEnabled: [{ type: core.Input }],
|
|
441
|
-
panelClass: [{ type: core.Input, args: ['class',] }],
|
|
442
|
-
classList: [{ type: core.Input }],
|
|
443
|
-
closed: [{ type: core.Output }],
|
|
444
|
-
templateRef: [{ type: core.ViewChild, args: [core.TemplateRef,] }]
|
|
445
|
-
};
|
|
446
|
-
|
|
447
|
-
/*! *****************************************************************************
|
|
448
|
-
Copyright (c) Microsoft Corporation.
|
|
449
|
-
|
|
450
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
451
|
-
purpose with or without fee is hereby granted.
|
|
452
|
-
|
|
453
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
454
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
455
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
456
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
457
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
458
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
459
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
460
|
-
***************************************************************************** */
|
|
461
|
-
/* global Reflect, Promise */
|
|
462
|
-
var extendStatics = function (d, b) {
|
|
463
|
-
extendStatics = Object.setPrototypeOf ||
|
|
464
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
465
|
-
function (d, b) { for (var p in b)
|
|
466
|
-
if (Object.prototype.hasOwnProperty.call(b, p))
|
|
467
|
-
d[p] = b[p]; };
|
|
468
|
-
return extendStatics(d, b);
|
|
469
|
-
};
|
|
470
|
-
function __extends(d, b) {
|
|
471
|
-
if (typeof b !== "function" && b !== null)
|
|
472
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
473
|
-
extendStatics(d, b);
|
|
474
|
-
function __() { this.constructor = d; }
|
|
475
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
476
|
-
}
|
|
477
|
-
var __assign = function () {
|
|
478
|
-
__assign = Object.assign || function __assign(t) {
|
|
479
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
480
|
-
s = arguments[i];
|
|
481
|
-
for (var p in s)
|
|
482
|
-
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
483
|
-
t[p] = s[p];
|
|
484
|
-
}
|
|
485
|
-
return t;
|
|
486
|
-
};
|
|
487
|
-
return __assign.apply(this, arguments);
|
|
488
|
-
};
|
|
489
|
-
function __rest(s, e) {
|
|
490
|
-
var t = {};
|
|
491
|
-
for (var p in s)
|
|
492
|
-
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
493
|
-
t[p] = s[p];
|
|
494
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
495
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
496
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
497
|
-
t[p[i]] = s[p[i]];
|
|
498
|
-
}
|
|
499
|
-
return t;
|
|
500
|
-
}
|
|
501
|
-
function __decorate(decorators, target, key, desc) {
|
|
502
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
503
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
504
|
-
r = Reflect.decorate(decorators, target, key, desc);
|
|
505
|
-
else
|
|
506
|
-
for (var i = decorators.length - 1; i >= 0; i--)
|
|
507
|
-
if (d = decorators[i])
|
|
508
|
-
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
509
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
510
|
-
}
|
|
511
|
-
function __param(paramIndex, decorator) {
|
|
512
|
-
return function (target, key) { decorator(target, key, paramIndex); };
|
|
513
|
-
}
|
|
514
|
-
function __metadata(metadataKey, metadataValue) {
|
|
515
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
516
|
-
return Reflect.metadata(metadataKey, metadataValue);
|
|
517
|
-
}
|
|
518
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
519
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
520
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
521
|
-
function fulfilled(value) { try {
|
|
522
|
-
step(generator.next(value));
|
|
523
|
-
}
|
|
524
|
-
catch (e) {
|
|
525
|
-
reject(e);
|
|
526
|
-
} }
|
|
527
|
-
function rejected(value) { try {
|
|
528
|
-
step(generator["throw"](value));
|
|
529
|
-
}
|
|
530
|
-
catch (e) {
|
|
531
|
-
reject(e);
|
|
532
|
-
} }
|
|
533
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
534
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
535
|
-
});
|
|
536
|
-
}
|
|
537
|
-
function __generator(thisArg, body) {
|
|
538
|
-
var _ = { label: 0, sent: function () { if (t[0] & 1)
|
|
539
|
-
throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
540
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
|
|
541
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
542
|
-
function step(op) {
|
|
543
|
-
if (f)
|
|
544
|
-
throw new TypeError("Generator is already executing.");
|
|
545
|
-
while (_)
|
|
546
|
-
try {
|
|
547
|
-
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)
|
|
548
|
-
return t;
|
|
549
|
-
if (y = 0, t)
|
|
550
|
-
op = [op[0] & 2, t.value];
|
|
551
|
-
switch (op[0]) {
|
|
552
|
-
case 0:
|
|
553
|
-
case 1:
|
|
554
|
-
t = op;
|
|
555
|
-
break;
|
|
556
|
-
case 4:
|
|
557
|
-
_.label++;
|
|
558
|
-
return { value: op[1], done: false };
|
|
559
|
-
case 5:
|
|
560
|
-
_.label++;
|
|
561
|
-
y = op[1];
|
|
562
|
-
op = [0];
|
|
563
|
-
continue;
|
|
564
|
-
case 7:
|
|
565
|
-
op = _.ops.pop();
|
|
566
|
-
_.trys.pop();
|
|
567
|
-
continue;
|
|
568
|
-
default:
|
|
569
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
570
|
-
_ = 0;
|
|
571
|
-
continue;
|
|
572
|
-
}
|
|
573
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
|
|
574
|
-
_.label = op[1];
|
|
575
|
-
break;
|
|
576
|
-
}
|
|
577
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
578
|
-
_.label = t[1];
|
|
579
|
-
t = op;
|
|
580
|
-
break;
|
|
581
|
-
}
|
|
582
|
-
if (t && _.label < t[2]) {
|
|
583
|
-
_.label = t[2];
|
|
584
|
-
_.ops.push(op);
|
|
585
|
-
break;
|
|
586
|
-
}
|
|
587
|
-
if (t[2])
|
|
588
|
-
_.ops.pop();
|
|
589
|
-
_.trys.pop();
|
|
590
|
-
continue;
|
|
591
|
-
}
|
|
592
|
-
op = body.call(thisArg, _);
|
|
593
|
-
}
|
|
594
|
-
catch (e) {
|
|
595
|
-
op = [6, e];
|
|
596
|
-
y = 0;
|
|
597
|
-
}
|
|
598
|
-
finally {
|
|
599
|
-
f = t = 0;
|
|
600
|
-
}
|
|
601
|
-
if (op[0] & 5)
|
|
602
|
-
throw op[1];
|
|
603
|
-
return { value: op[0] ? op[1] : void 0, done: true };
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
var __createBinding = Object.create ? (function (o, m, k, k2) {
|
|
607
|
-
if (k2 === undefined)
|
|
608
|
-
k2 = k;
|
|
609
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
|
|
610
|
-
}) : (function (o, m, k, k2) {
|
|
611
|
-
if (k2 === undefined)
|
|
612
|
-
k2 = k;
|
|
613
|
-
o[k2] = m[k];
|
|
614
|
-
});
|
|
615
|
-
function __exportStar(m, o) {
|
|
616
|
-
for (var p in m)
|
|
617
|
-
if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
|
|
618
|
-
__createBinding(o, m, p);
|
|
619
|
-
}
|
|
620
|
-
function __values(o) {
|
|
621
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
622
|
-
if (m)
|
|
623
|
-
return m.call(o);
|
|
624
|
-
if (o && typeof o.length === "number")
|
|
625
|
-
return {
|
|
626
|
-
next: function () {
|
|
627
|
-
if (o && i >= o.length)
|
|
628
|
-
o = void 0;
|
|
629
|
-
return { value: o && o[i++], done: !o };
|
|
630
|
-
}
|
|
631
|
-
};
|
|
632
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
633
|
-
}
|
|
634
|
-
function __read(o, n) {
|
|
635
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
636
|
-
if (!m)
|
|
637
|
-
return o;
|
|
638
|
-
var i = m.call(o), r, ar = [], e;
|
|
639
|
-
try {
|
|
640
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
|
641
|
-
ar.push(r.value);
|
|
642
|
-
}
|
|
643
|
-
catch (error) {
|
|
644
|
-
e = { error: error };
|
|
645
|
-
}
|
|
646
|
-
finally {
|
|
647
|
-
try {
|
|
648
|
-
if (r && !r.done && (m = i["return"]))
|
|
649
|
-
m.call(i);
|
|
650
|
-
}
|
|
651
|
-
finally {
|
|
652
|
-
if (e)
|
|
653
|
-
throw e.error;
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
return ar;
|
|
657
|
-
}
|
|
658
|
-
/** @deprecated */
|
|
659
|
-
function __spread() {
|
|
660
|
-
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
661
|
-
ar = ar.concat(__read(arguments[i]));
|
|
662
|
-
return ar;
|
|
663
|
-
}
|
|
664
|
-
/** @deprecated */
|
|
665
|
-
function __spreadArrays() {
|
|
666
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
|
667
|
-
s += arguments[i].length;
|
|
668
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
669
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
670
|
-
r[k] = a[j];
|
|
671
|
-
return r;
|
|
672
|
-
}
|
|
673
|
-
function __spreadArray(to, from, pack) {
|
|
674
|
-
if (pack || arguments.length === 2)
|
|
675
|
-
for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
676
|
-
if (ar || !(i in from)) {
|
|
677
|
-
if (!ar)
|
|
678
|
-
ar = Array.prototype.slice.call(from, 0, i);
|
|
679
|
-
ar[i] = from[i];
|
|
680
|
-
}
|
|
786
|
+
};
|
|
787
|
+
/** Sets the current styles for the popover to allow for dynamically changing settings. */
|
|
788
|
+
MtxPopover.prototype.setCurrentStyles = function (pos) {
|
|
789
|
+
if (pos === void 0) { pos = this.position; }
|
|
790
|
+
var left = pos[1] === 'after'
|
|
791
|
+
? this.arrowOffsetX - this.arrowWidth / 2 + "px"
|
|
792
|
+
: pos[1] === 'center'
|
|
793
|
+
? "calc(50% - " + this.arrowWidth / 2 + "px)"
|
|
794
|
+
: '';
|
|
795
|
+
var right = pos[1] === 'before' ? this.arrowOffsetX - this.arrowWidth / 2 + "px" : '';
|
|
796
|
+
var bottom = pos[1] === 'above'
|
|
797
|
+
? this.arrowOffsetY - this.arrowHeight / 2 + "px"
|
|
798
|
+
: pos[1] === 'center'
|
|
799
|
+
? "calc(50% - " + this.arrowHeight / 2 + "px)"
|
|
800
|
+
: '';
|
|
801
|
+
var top = pos[1] === 'below' ? this.arrowOffsetY - this.arrowHeight / 2 + "px" : '';
|
|
802
|
+
this.arrowStyles =
|
|
803
|
+
pos[0] === 'above' || pos[0] === 'below'
|
|
804
|
+
? {
|
|
805
|
+
left: this.direction === 'ltr' ? left : right,
|
|
806
|
+
right: this.direction === 'ltr' ? right : left,
|
|
807
|
+
}
|
|
808
|
+
: { top: top, bottom: bottom };
|
|
809
|
+
};
|
|
810
|
+
/**
|
|
811
|
+
* It's necessary to set position-based classes to ensure the popover panel animation
|
|
812
|
+
* folds out from the correct direction.
|
|
813
|
+
*/
|
|
814
|
+
MtxPopover.prototype.setPositionClasses = function (pos) {
|
|
815
|
+
if (pos === void 0) { pos = this.position; }
|
|
816
|
+
this._classList['mtx-popover-before-above'] = pos[0] === 'before' && pos[1] === 'above';
|
|
817
|
+
this._classList['mtx-popover-before-center'] = pos[0] === 'before' && pos[1] === 'center';
|
|
818
|
+
this._classList['mtx-popover-before-below'] = pos[0] === 'before' && pos[1] === 'below';
|
|
819
|
+
this._classList['mtx-popover-after-above'] = pos[0] === 'after' && pos[1] === 'above';
|
|
820
|
+
this._classList['mtx-popover-after-center'] = pos[0] === 'after' && pos[1] === 'center';
|
|
821
|
+
this._classList['mtx-popover-after-below'] = pos[0] === 'after' && pos[1] === 'below';
|
|
822
|
+
this._classList['mtx-popover-above-before'] = pos[0] === 'above' && pos[1] === 'before';
|
|
823
|
+
this._classList['mtx-popover-above-center'] = pos[0] === 'above' && pos[1] === 'center';
|
|
824
|
+
this._classList['mtx-popover-above-after'] = pos[0] === 'above' && pos[1] === 'after';
|
|
825
|
+
this._classList['mtx-popover-below-before'] = pos[0] === 'below' && pos[1] === 'before';
|
|
826
|
+
this._classList['mtx-popover-below-center'] = pos[0] === 'below' && pos[1] === 'center';
|
|
827
|
+
this._classList['mtx-popover-below-after'] = pos[0] === 'below' && pos[1] === 'after';
|
|
828
|
+
};
|
|
829
|
+
/** Sets the popover-panel's elevation. */
|
|
830
|
+
MtxPopover.prototype.setElevation = function () {
|
|
831
|
+
var newElevation = "" + this._elevationPrefix + this.elevation;
|
|
832
|
+
if (this._previousElevation) {
|
|
833
|
+
this._classList[this._previousElevation] = false;
|
|
681
834
|
}
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
}
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
;
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
835
|
+
this._classList[newElevation] = true;
|
|
836
|
+
this._previousElevation = newElevation;
|
|
837
|
+
};
|
|
838
|
+
/** Starts the enter animation. */
|
|
839
|
+
MtxPopover.prototype._startAnimation = function () {
|
|
840
|
+
// @breaking-change 8.0.0 Combine with _resetAnimation.
|
|
841
|
+
this._panelAnimationState = 'enter';
|
|
842
|
+
};
|
|
843
|
+
/** Resets the panel animation to its initial state. */
|
|
844
|
+
MtxPopover.prototype._resetAnimation = function () {
|
|
845
|
+
// @breaking-change 8.0.0 Combine with _startAnimation.
|
|
846
|
+
this._panelAnimationState = 'void';
|
|
847
|
+
};
|
|
848
|
+
/** Callback that is invoked when the panel animation completes. */
|
|
849
|
+
MtxPopover.prototype._onAnimationDone = function (event) {
|
|
850
|
+
this._animationDone.next(event);
|
|
851
|
+
this._isAnimating = false;
|
|
852
|
+
};
|
|
853
|
+
MtxPopover.prototype._onAnimationStart = function (event) {
|
|
854
|
+
this._isAnimating = true;
|
|
855
|
+
};
|
|
856
|
+
return MtxPopover;
|
|
857
|
+
}());
|
|
858
|
+
/** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
|
|
859
|
+
MtxPopover.decorators = [
|
|
860
|
+
{ type: core.Component, args: [{
|
|
861
|
+
selector: 'mtx-popover',
|
|
862
|
+
template: "<ng-template>\r\n <div class=\"mtx-popover-panel\"\r\n [id]=\"panelId\"\r\n [ngClass]=\"_classList\"\r\n (keydown)=\"_handleKeydown($event)\"\r\n (click)=\"_handleClick()\"\r\n (mouseover)=\"_handleMouseOver()\"\r\n (mouseleave)=\"_handleMouseLeave()\"\r\n [@transformPopover]=\"_panelAnimationState\"\r\n (@transformPopover.start)=\"_onAnimationStart($event)\"\r\n (@transformPopover.done)=\"_onAnimationDone($event)\"\r\n tabindex=\"-1\"\r\n role=\"dialog\"\r\n [attr.aria-label]=\"ariaLabel || null\"\r\n [attr.aria-labelledby]=\"ariaLabelledby || null\"\r\n [attr.aria-describedby]=\"ariaDescribedby || null\"\r\n [cdkTrapFocus]=\"focusTrapEnabled\"\r\n [cdkTrapFocusAutoCapture]=\"focusTrapAutoCaptureEnabled\">\r\n <div class=\"mtx-popover-content\">\r\n <ng-content></ng-content>\r\n </div>\r\n <div class=\"mtx-popover-direction-arrow\" [ngStyle]=\"arrowStyles\"></div>\r\n </div>\r\n</ng-template>\r\n",
|
|
863
|
+
changeDetection: core.ChangeDetectionStrategy.OnPush,
|
|
864
|
+
encapsulation: core.ViewEncapsulation.None,
|
|
865
|
+
animations: [transformPopover],
|
|
866
|
+
exportAs: 'mtxPopover',
|
|
867
|
+
styles: [".mtx-popover-panel{position:relative;max-height:calc(100vh - 48px);padding:8px;border-radius:4px;font-size:16px;outline:0}.mtx-popover-panel[class*=mtx-popover-below]{margin-top:calc(.5em + 2px)}.mtx-popover-panel[class*=mtx-popover-above]{margin-bottom:calc(.5em + 2px)}.mtx-popover-panel[class*=mtx-popover-before]{margin-right:calc(.5em + 2px)}[dir=rtl] .mtx-popover-panel[class*=mtx-popover-before]{margin-right:auto;margin-left:calc(.5em + 2px)}.mtx-popover-panel[class*=mtx-popover-after]{margin-left:calc(.5em + 2px)}[dir=rtl] .mtx-popover-panel[class*=mtx-popover-after]{margin-left:auto;margin-right:calc(.5em + 2px)}.mtx-popover-direction-arrow{position:absolute}.mtx-popover-direction-arrow:before,.mtx-popover-direction-arrow:after{position:absolute;display:inline-block;content:\"\";border-width:.5em;border-style:solid}.mtx-popover-direction-arrow:after{border-width:calc(.5em - 1px)}[class*=mtx-popover-below] .mtx-popover-direction-arrow,[class*=mtx-popover-above] .mtx-popover-direction-arrow{width:1em}[class*=mtx-popover-below] .mtx-popover-direction-arrow:after,[class*=mtx-popover-above] .mtx-popover-direction-arrow:after{left:1px}[dir=rtl] [class*=mtx-popover-below] .mtx-popover-direction-arrow:after,[dir=rtl] [class*=mtx-popover-above] .mtx-popover-direction-arrow:after{right:1px;left:auto}[class*=mtx-popover-below] .mtx-popover-direction-arrow{top:0}[class*=mtx-popover-below] .mtx-popover-direction-arrow:before,[class*=mtx-popover-below] .mtx-popover-direction-arrow:after{bottom:0;border-top-width:0}[class*=mtx-popover-above] .mtx-popover-direction-arrow{bottom:0}[class*=mtx-popover-above] .mtx-popover-direction-arrow:before,[class*=mtx-popover-above] .mtx-popover-direction-arrow:after{top:0;border-bottom-width:0}[class*=mtx-popover-before] .mtx-popover-direction-arrow,[class*=mtx-popover-after] .mtx-popover-direction-arrow{height:1em}[class*=mtx-popover-before] .mtx-popover-direction-arrow:after,[class*=mtx-popover-after] .mtx-popover-direction-arrow:after{top:1px}[class*=mtx-popover-before] .mtx-popover-direction-arrow{right:0}[class*=mtx-popover-before] .mtx-popover-direction-arrow:before,[class*=mtx-popover-before] .mtx-popover-direction-arrow:after{left:0;border-right-width:0}[dir=rtl] [class*=mtx-popover-before] .mtx-popover-direction-arrow{right:auto;left:0}[dir=rtl] [class*=mtx-popover-before] .mtx-popover-direction-arrow:before,[dir=rtl] [class*=mtx-popover-before] .mtx-popover-direction-arrow:after{left:auto;right:0;border-left-width:0}[dir=rtl] [class*=mtx-popover-before] .mtx-popover-direction-arrow:before{border-right-width:.5em}[dir=rtl] [class*=mtx-popover-before] .mtx-popover-direction-arrow:after{border-right-width:calc(.5em - 1px)}[class*=mtx-popover-after] .mtx-popover-direction-arrow{left:0}[class*=mtx-popover-after] .mtx-popover-direction-arrow:before,[class*=mtx-popover-after] .mtx-popover-direction-arrow:after{right:0;border-left-width:0}[dir=rtl] [class*=mtx-popover-after] .mtx-popover-direction-arrow{left:auto;right:0}[dir=rtl] [class*=mtx-popover-after] .mtx-popover-direction-arrow:before,[dir=rtl] [class*=mtx-popover-after] .mtx-popover-direction-arrow:after{right:auto;left:0;border-right-width:0}[dir=rtl] [class*=mtx-popover-after] .mtx-popover-direction-arrow:before{border-left-width:.5em}[dir=rtl] [class*=mtx-popover-after] .mtx-popover-direction-arrow:after{border-left-width:calc(.5em - 1px)}\n"]
|
|
868
|
+
},] }
|
|
869
|
+
];
|
|
870
|
+
/**
|
|
871
|
+
* @type {function(): !Array<(null|{
|
|
872
|
+
* type: ?,
|
|
873
|
+
* decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>),
|
|
874
|
+
* })>}
|
|
875
|
+
* @nocollapse
|
|
876
|
+
*/
|
|
877
|
+
MtxPopover.ctorParameters = function () { return [
|
|
878
|
+
{ type: core.ElementRef },
|
|
879
|
+
{ type: core.NgZone },
|
|
880
|
+
{ type: undefined, decorators: [{ type: core.Inject, args: [MTX_POPOVER_DEFAULT_OPTIONS,] }] }
|
|
881
|
+
]; };
|
|
882
|
+
/** @type {!Object<string, !Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
|
|
883
|
+
MtxPopover.propDecorators = {
|
|
884
|
+
backdropClass: [{ type: core.Input }],
|
|
885
|
+
ariaLabel: [{ type: core.Input, args: ['aria-label',] }],
|
|
886
|
+
ariaLabelledby: [{ type: core.Input, args: ['aria-labelledby',] }],
|
|
887
|
+
ariaDescribedby: [{ type: core.Input, args: ['aria-describedby',] }],
|
|
888
|
+
triggerEvent: [{ type: core.Input }],
|
|
889
|
+
enterDelay: [{ type: core.Input }],
|
|
890
|
+
leaveDelay: [{ type: core.Input }],
|
|
891
|
+
position: [{ type: core.Input }],
|
|
892
|
+
xOffset: [{ type: core.Input }],
|
|
893
|
+
yOffset: [{ type: core.Input }],
|
|
894
|
+
arrowWidth: [{ type: core.Input }],
|
|
895
|
+
arrowHeight: [{ type: core.Input }],
|
|
896
|
+
arrowOffsetX: [{ type: core.Input }],
|
|
897
|
+
arrowOffsetY: [{ type: core.Input }],
|
|
898
|
+
closeOnPanelClick: [{ type: core.Input }],
|
|
899
|
+
closeOnBackdropClick: [{ type: core.Input }],
|
|
900
|
+
focusTrapEnabled: [{ type: core.Input }],
|
|
901
|
+
focusTrapAutoCaptureEnabled: [{ type: core.Input }],
|
|
902
|
+
hasBackdrop: [{ type: core.Input }],
|
|
903
|
+
elevation: [{ type: core.Input }],
|
|
904
|
+
panelClass: [{ type: core.Input, args: ['class',] }],
|
|
905
|
+
classList: [{ type: core.Input }],
|
|
906
|
+
closed: [{ type: core.Output }],
|
|
907
|
+
templateRef: [{ type: core.ViewChild, args: [core.TemplateRef,] }],
|
|
908
|
+
lazyContent: [{ type: core.ContentChild, args: [MTX_POPOVER_CONTENT,] }]
|
|
733
909
|
};
|
|
734
|
-
function __importStar(mod) {
|
|
735
|
-
if (mod && mod.__esModule)
|
|
736
|
-
return mod;
|
|
737
|
-
var result = {};
|
|
738
|
-
if (mod != null)
|
|
739
|
-
for (var k in mod)
|
|
740
|
-
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
741
|
-
__createBinding(result, mod, k);
|
|
742
|
-
__setModuleDefault(result, mod);
|
|
743
|
-
return result;
|
|
744
|
-
}
|
|
745
|
-
function __importDefault(mod) {
|
|
746
|
-
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
747
|
-
}
|
|
748
|
-
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
749
|
-
if (kind === "a" && !f)
|
|
750
|
-
throw new TypeError("Private accessor was defined without a getter");
|
|
751
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
752
|
-
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
753
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
754
|
-
}
|
|
755
|
-
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
756
|
-
if (kind === "m")
|
|
757
|
-
throw new TypeError("Private method is not writable");
|
|
758
|
-
if (kind === "a" && !f)
|
|
759
|
-
throw new TypeError("Private accessor was defined without a setter");
|
|
760
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
761
|
-
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
762
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
763
|
-
}
|
|
764
910
|
|
|
911
|
+
/** Injection token that determines the scroll handling while the popover is open. */
|
|
912
|
+
var MTX_POPOVER_SCROLL_STRATEGY = new core.InjectionToken('mtx-popover-scroll-strategy');
|
|
913
|
+
/** @docs-private */
|
|
914
|
+
function MTX_POPOVER_SCROLL_STRATEGY_FACTORY(overlay) {
|
|
915
|
+
return function () { return overlay.scrollStrategies.reposition(); };
|
|
916
|
+
}
|
|
917
|
+
/** @docs-private */
|
|
918
|
+
var MTX_POPOVER_SCROLL_STRATEGY_FACTORY_PROVIDER = {
|
|
919
|
+
provide: MTX_POPOVER_SCROLL_STRATEGY,
|
|
920
|
+
deps: [overlay.Overlay],
|
|
921
|
+
useFactory: MTX_POPOVER_SCROLL_STRATEGY_FACTORY,
|
|
922
|
+
};
|
|
765
923
|
/**
|
|
766
|
-
* This directive is intended to be used in conjunction with an mtx-popover tag. It is
|
|
924
|
+
* This directive is intended to be used in conjunction with an `mtx-popover` tag. It is
|
|
767
925
|
* responsible for toggling the display of the provided popover instance.
|
|
768
926
|
*/
|
|
769
927
|
var MtxPopoverTrigger = /** @class */ (function () {
|
|
770
|
-
function MtxPopoverTrigger(_overlay, _elementRef, _viewContainerRef, _dir, _changeDetectorRef) {
|
|
928
|
+
function MtxPopoverTrigger(_overlay, _elementRef, _viewContainerRef, scrollStrategy, _dir, _changeDetectorRef, _focusMonitor) {
|
|
771
929
|
this._overlay = _overlay;
|
|
772
930
|
this._elementRef = _elementRef;
|
|
773
931
|
this._viewContainerRef = _viewContainerRef;
|
|
774
932
|
this._dir = _dir;
|
|
775
933
|
this._changeDetectorRef = _changeDetectorRef;
|
|
776
|
-
this.
|
|
777
|
-
this.popoverOpened$ = new rxjs.Subject();
|
|
778
|
-
this.popoverClosed$ = new rxjs.Subject();
|
|
934
|
+
this._focusMonitor = _focusMonitor;
|
|
779
935
|
this._overlayRef = null;
|
|
780
936
|
this._popoverOpen = false;
|
|
781
937
|
this._halt = false;
|
|
782
|
-
|
|
938
|
+
this._positionSubscription = rxjs.Subscription.EMPTY;
|
|
939
|
+
this._popoverCloseSubscription = rxjs.Subscription.EMPTY;
|
|
940
|
+
this._closingActionsSubscription = rxjs.Subscription.EMPTY;
|
|
941
|
+
// Tracking input type is necessary so it's possible to only auto-focus
|
|
783
942
|
// the first item of the list when the popover is opened via the keyboard
|
|
784
|
-
this.
|
|
785
|
-
this._onDestroy = new rxjs.Subject();
|
|
943
|
+
this._openedBy = undefined;
|
|
786
944
|
/** Event emitted when the associated popover is opened. */
|
|
787
945
|
this.popoverOpened = new core.EventEmitter();
|
|
788
946
|
/** Event emitted when the associated popover is closed. */
|
|
789
947
|
this.popoverClosed = new core.EventEmitter();
|
|
948
|
+
this._scrollStrategy = scrollStrategy;
|
|
790
949
|
}
|
|
791
|
-
MtxPopoverTrigger.prototype
|
|
792
|
-
|
|
950
|
+
Object.defineProperty(MtxPopoverTrigger.prototype, "popover", {
|
|
951
|
+
/** References the popover instance that the trigger is associated with. */
|
|
952
|
+
get: function () {
|
|
953
|
+
return this._popover;
|
|
954
|
+
},
|
|
955
|
+
set: function (popover) {
|
|
956
|
+
var _this = this;
|
|
957
|
+
if (popover === this._popover) {
|
|
958
|
+
return;
|
|
959
|
+
}
|
|
960
|
+
this._popover = popover;
|
|
961
|
+
this._popoverCloseSubscription.unsubscribe();
|
|
962
|
+
if (popover) {
|
|
963
|
+
this._popoverCloseSubscription = popover.closed.subscribe(function (reason) {
|
|
964
|
+
_this._destroyPopover();
|
|
965
|
+
});
|
|
966
|
+
}
|
|
967
|
+
},
|
|
968
|
+
enumerable: false,
|
|
969
|
+
configurable: true
|
|
970
|
+
});
|
|
971
|
+
MtxPopoverTrigger.prototype.ngAfterContentInit = function () {
|
|
793
972
|
this._checkPopover();
|
|
794
973
|
this._setCurrentConfig();
|
|
795
|
-
this.popover.closed.subscribe(function () { return _this.closePopover(); });
|
|
796
974
|
};
|
|
797
975
|
MtxPopoverTrigger.prototype.ngOnDestroy = function () {
|
|
798
|
-
this.
|
|
976
|
+
if (this._overlayRef) {
|
|
977
|
+
this._overlayRef.dispose();
|
|
978
|
+
this._overlayRef = null;
|
|
979
|
+
}
|
|
980
|
+
this._positionSubscription.unsubscribe();
|
|
981
|
+
this._popoverCloseSubscription.unsubscribe();
|
|
982
|
+
this._closingActionsSubscription.unsubscribe();
|
|
799
983
|
};
|
|
800
984
|
MtxPopoverTrigger.prototype._setCurrentConfig = function () {
|
|
801
985
|
if (this.triggerEvent) {
|
|
@@ -811,12 +995,22 @@
|
|
|
811
995
|
enumerable: false,
|
|
812
996
|
configurable: true
|
|
813
997
|
});
|
|
814
|
-
MtxPopoverTrigger.prototype
|
|
998
|
+
Object.defineProperty(MtxPopoverTrigger.prototype, "dir", {
|
|
999
|
+
/** The text direction of the containing app. */
|
|
1000
|
+
get: function () {
|
|
1001
|
+
return this._dir && this._dir.value === 'rtl' ? 'rtl' : 'ltr';
|
|
1002
|
+
},
|
|
1003
|
+
enumerable: false,
|
|
1004
|
+
configurable: true
|
|
1005
|
+
});
|
|
1006
|
+
/** Handles mouse click on the trigger. */
|
|
1007
|
+
MtxPopoverTrigger.prototype._handleClick = function (event) {
|
|
815
1008
|
if (this.popover.triggerEvent === 'click') {
|
|
816
1009
|
this.togglePopover();
|
|
817
1010
|
}
|
|
818
1011
|
};
|
|
819
|
-
|
|
1012
|
+
/** Handles mouse enter on the trigger. */
|
|
1013
|
+
MtxPopoverTrigger.prototype._handleMouseEnter = function (event) {
|
|
820
1014
|
var _this = this;
|
|
821
1015
|
this._halt = false;
|
|
822
1016
|
if (this.popover.triggerEvent === 'hover') {
|
|
@@ -825,7 +1019,8 @@
|
|
|
825
1019
|
}, this.popover.enterDelay);
|
|
826
1020
|
}
|
|
827
1021
|
};
|
|
828
|
-
|
|
1022
|
+
/** Handles mouse leave on the trigger. */
|
|
1023
|
+
MtxPopoverTrigger.prototype._handleMouseLeave = function (event) {
|
|
829
1024
|
var _this = this;
|
|
830
1025
|
if (this.popover.triggerEvent === 'hover') {
|
|
831
1026
|
if (this._mouseoverTimer) {
|
|
@@ -844,123 +1039,122 @@
|
|
|
844
1039
|
}
|
|
845
1040
|
}
|
|
846
1041
|
};
|
|
1042
|
+
/** Handles mouse presses on the trigger. */
|
|
1043
|
+
MtxPopoverTrigger.prototype._handleMousedown = function (event) {
|
|
1044
|
+
if (!a11y.isFakeMousedownFromScreenReader(event)) {
|
|
1045
|
+
// Since right or middle button clicks won't trigger the `click` event,
|
|
1046
|
+
// we shouldn't consider the popover as opened by mouse in those cases.
|
|
1047
|
+
this._openedBy = event.button === 0 ? 'mouse' : undefined;
|
|
1048
|
+
}
|
|
1049
|
+
};
|
|
1050
|
+
/** Handles key presses on the trigger. */
|
|
1051
|
+
MtxPopoverTrigger.prototype._handleKeydown = function (event) {
|
|
1052
|
+
var keyCode = event.keyCode;
|
|
1053
|
+
// Pressing enter on the trigger will trigger the click handler later.
|
|
1054
|
+
if (keyCode === keycodes.ENTER || keyCode === keycodes.SPACE) {
|
|
1055
|
+
this._openedBy = 'keyboard';
|
|
1056
|
+
}
|
|
1057
|
+
};
|
|
847
1058
|
/** Toggles the popover between the open and closed states. */
|
|
848
1059
|
MtxPopoverTrigger.prototype.togglePopover = function () {
|
|
849
1060
|
return this._popoverOpen ? this.closePopover() : this.openPopover();
|
|
850
1061
|
};
|
|
851
1062
|
/** Opens the popover. */
|
|
852
1063
|
MtxPopoverTrigger.prototype.openPopover = function () {
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
1064
|
+
var _this = this;
|
|
1065
|
+
var _a;
|
|
1066
|
+
if (this._popoverOpen || this._halt) {
|
|
1067
|
+
return;
|
|
1068
|
+
}
|
|
1069
|
+
this._checkPopover();
|
|
1070
|
+
var overlayRef = this._createOverlay();
|
|
1071
|
+
var overlayConfig = overlayRef.getConfig();
|
|
1072
|
+
this._setPosition(overlayConfig.positionStrategy);
|
|
1073
|
+
if (this.popover.triggerEvent === 'click') {
|
|
1074
|
+
overlayConfig.hasBackdrop = (_a = this.popover.hasBackdrop) !== null && _a !== void 0 ? _a : true;
|
|
1075
|
+
}
|
|
1076
|
+
overlayRef.attach(this._getPortal());
|
|
1077
|
+
if (this.popover.lazyContent) {
|
|
1078
|
+
this.popover.lazyContent.attach(this.popoverData);
|
|
1079
|
+
}
|
|
1080
|
+
this._closingActionsSubscription = this._popoverClosingActions().subscribe(function () { return _this.closePopover(); });
|
|
1081
|
+
this._initPopover();
|
|
1082
|
+
if (this.popover instanceof MtxPopover) {
|
|
1083
|
+
this.popover._startAnimation();
|
|
858
1084
|
}
|
|
859
1085
|
};
|
|
860
1086
|
/** Closes the popover. */
|
|
861
1087
|
MtxPopoverTrigger.prototype.closePopover = function () {
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
1088
|
+
this.popover.closed.emit();
|
|
1089
|
+
};
|
|
1090
|
+
/**
|
|
1091
|
+
* Focuses the popover trigger.
|
|
1092
|
+
* @param origin Source of the popover trigger's focus.
|
|
1093
|
+
*/
|
|
1094
|
+
MtxPopoverTrigger.prototype.focus = function (origin, options) {
|
|
1095
|
+
if (this._focusMonitor && origin) {
|
|
1096
|
+
this._focusMonitor.focusVia(this._elementRef, origin, options);
|
|
1097
|
+
}
|
|
1098
|
+
else {
|
|
1099
|
+
this._elementRef.nativeElement.focus(options);
|
|
865
1100
|
}
|
|
866
|
-
this.destroyPopover();
|
|
867
1101
|
};
|
|
868
1102
|
/** Removes the popover from the DOM. */
|
|
869
|
-
MtxPopoverTrigger.prototype.
|
|
1103
|
+
MtxPopoverTrigger.prototype._destroyPopover = function (reason) {
|
|
1104
|
+
var _this = this;
|
|
1105
|
+
if (!this._overlayRef || !this.popoverOpen) {
|
|
1106
|
+
return;
|
|
1107
|
+
}
|
|
1108
|
+
// Clear the timeout for hover event.
|
|
870
1109
|
if (this._mouseoverTimer) {
|
|
871
1110
|
clearTimeout(this._mouseoverTimer);
|
|
872
1111
|
this._mouseoverTimer = null;
|
|
873
1112
|
}
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
},
|
|
891
|
-
enumerable: false,
|
|
892
|
-
configurable: true
|
|
893
|
-
});
|
|
894
|
-
/**
|
|
895
|
-
* This method ensures that the popover closes when the overlay backdrop is clicked.
|
|
896
|
-
* We do not use first() here because doing so would not catch clicks from within
|
|
897
|
-
* the popover, and it would fail to unsubscribe properly. Instead, we unsubscribe
|
|
898
|
-
* explicitly when the popover is closed or destroyed.
|
|
899
|
-
*/
|
|
900
|
-
MtxPopoverTrigger.prototype._subscribeToBackdrop = function () {
|
|
901
|
-
var _this = this;
|
|
902
|
-
if (this._overlayRef) {
|
|
903
|
-
/** Only subscribe to backdrop if trigger event is click */
|
|
904
|
-
if (this.triggerEvent === 'click' && this.popover.closeOnBackdropClick === true) {
|
|
905
|
-
this._overlayRef
|
|
906
|
-
.backdropClick()
|
|
907
|
-
.pipe(operators.takeUntil(this.popoverClosed$), operators.takeUntil(this._onDestroy))
|
|
908
|
-
.subscribe(function () {
|
|
909
|
-
_this.popover._emitCloseEvent();
|
|
1113
|
+
var popover = this.popover;
|
|
1114
|
+
this._closingActionsSubscription.unsubscribe();
|
|
1115
|
+
this._overlayRef.detach();
|
|
1116
|
+
this._openedBy = undefined;
|
|
1117
|
+
if (popover instanceof MtxPopover) {
|
|
1118
|
+
popover._resetAnimation();
|
|
1119
|
+
if (popover.lazyContent) {
|
|
1120
|
+
// Wait for the exit animation to finish before detaching the content.
|
|
1121
|
+
popover._animationDone
|
|
1122
|
+
.pipe(operators.filter(function (event) { return event.toState === 'void'; }), operators.take(1),
|
|
1123
|
+
// Interrupt if the content got re-attached.
|
|
1124
|
+
operators.takeUntil(popover.lazyContent._attached))
|
|
1125
|
+
.subscribe({
|
|
1126
|
+
next: function () { return popover.lazyContent.detach(); },
|
|
1127
|
+
// No matter whether the content got re-attached, reset the popover.
|
|
1128
|
+
complete: function () { return _this._setIsPopoverOpen(false); },
|
|
910
1129
|
});
|
|
911
1130
|
}
|
|
1131
|
+
else {
|
|
1132
|
+
this._setIsPopoverOpen(false);
|
|
1133
|
+
}
|
|
912
1134
|
}
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
.detachments()
|
|
919
|
-
.pipe(operators.takeUntil(this.popoverClosed$), operators.takeUntil(this._onDestroy))
|
|
920
|
-
.subscribe(function () {
|
|
921
|
-
_this._setPopoverClosed();
|
|
922
|
-
});
|
|
1135
|
+
else {
|
|
1136
|
+
this._setIsPopoverOpen(false);
|
|
1137
|
+
if (popover.lazyContent) {
|
|
1138
|
+
popover.lazyContent.detach();
|
|
1139
|
+
}
|
|
923
1140
|
}
|
|
924
1141
|
};
|
|
925
1142
|
/**
|
|
926
|
-
* This method sets the popover state to open
|
|
927
|
-
* the popover was opened via the keyboard.
|
|
1143
|
+
* This method sets the popover state to open.
|
|
928
1144
|
*/
|
|
929
1145
|
MtxPopoverTrigger.prototype._initPopover = function () {
|
|
930
|
-
this.
|
|
1146
|
+
this.popover.direction = this.dir;
|
|
1147
|
+
this.popover.setElevation();
|
|
1148
|
+
this._setIsPopoverOpen(true);
|
|
931
1149
|
};
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
MtxPopoverTrigger.prototype._resetPopover = function () {
|
|
937
|
-
this._setPopoverClosed();
|
|
938
|
-
// Focus only needs to be reset to the host element if the popover was opened
|
|
939
|
-
// by the keyboard and manually shifted to the first popover item.
|
|
940
|
-
if (!this._openedByMouse) {
|
|
941
|
-
this.focus();
|
|
942
|
-
}
|
|
943
|
-
this._openedByMouse = false;
|
|
944
|
-
};
|
|
945
|
-
/** set state rather than toggle to support triggers sharing a popover */
|
|
946
|
-
MtxPopoverTrigger.prototype._setPopoverOpened = function () {
|
|
947
|
-
if (!this._popoverOpen) {
|
|
948
|
-
this._popoverOpen = true;
|
|
949
|
-
this.popoverOpened$.next();
|
|
950
|
-
this.popoverOpened.emit();
|
|
951
|
-
}
|
|
952
|
-
};
|
|
953
|
-
/** set state rather than toggle to support triggers sharing a popover */
|
|
954
|
-
MtxPopoverTrigger.prototype._setPopoverClosed = function () {
|
|
955
|
-
if (this._popoverOpen) {
|
|
956
|
-
this._popoverOpen = false;
|
|
957
|
-
this.popoverClosed$.next();
|
|
958
|
-
this.popoverClosed.emit();
|
|
959
|
-
}
|
|
1150
|
+
// set state rather than toggle to support triggers sharing a popover
|
|
1151
|
+
MtxPopoverTrigger.prototype._setIsPopoverOpen = function (isOpen) {
|
|
1152
|
+
this._popoverOpen = isOpen;
|
|
1153
|
+
this._popoverOpen ? this.popoverOpened.emit() : this.popoverClosed.emit();
|
|
960
1154
|
};
|
|
961
1155
|
/**
|
|
962
|
-
*
|
|
963
|
-
*
|
|
1156
|
+
* This method checks that a valid instance of MdPopover has been passed into
|
|
1157
|
+
* `mtxPopoverTriggerFor`. If not, an exception is thrown.
|
|
964
1158
|
*/
|
|
965
1159
|
MtxPopoverTrigger.prototype._checkPopover = function () {
|
|
966
1160
|
if (!this.popover) {
|
|
@@ -968,16 +1162,20 @@
|
|
|
968
1162
|
}
|
|
969
1163
|
};
|
|
970
1164
|
/**
|
|
971
|
-
*
|
|
972
|
-
*
|
|
1165
|
+
* This method creates the overlay from the provided popover's template and saves its
|
|
1166
|
+
* OverlayRef so that it can be attached to the DOM when openPopover is called.
|
|
973
1167
|
*/
|
|
974
1168
|
MtxPopoverTrigger.prototype._createOverlay = function () {
|
|
975
1169
|
if (!this._overlayRef) {
|
|
976
|
-
this._portal = new portal.TemplatePortal(this.popover.templateRef, this._viewContainerRef);
|
|
977
1170
|
var config = this._getOverlayConfig();
|
|
978
1171
|
this._subscribeToPositions(config.positionStrategy);
|
|
979
1172
|
this._overlayRef = this._overlay.create(config);
|
|
980
1173
|
}
|
|
1174
|
+
else {
|
|
1175
|
+
var overlayConfig = this._overlayRef.getConfig();
|
|
1176
|
+
var positionStrategy = overlayConfig.positionStrategy;
|
|
1177
|
+
positionStrategy.setOrigin(this._getTargetElement());
|
|
1178
|
+
}
|
|
981
1179
|
return this._overlayRef;
|
|
982
1180
|
};
|
|
983
1181
|
/**
|
|
@@ -985,32 +1183,24 @@
|
|
|
985
1183
|
* @returns OverlayConfig
|
|
986
1184
|
*/
|
|
987
1185
|
MtxPopoverTrigger.prototype._getOverlayConfig = function () {
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
1186
|
+
return new overlay.OverlayConfig({
|
|
1187
|
+
positionStrategy: this._overlay
|
|
1188
|
+
.position()
|
|
1189
|
+
.flexibleConnectedTo(this._getTargetElement())
|
|
1190
|
+
.withLockedPosition()
|
|
1191
|
+
.withGrowAfterOpen()
|
|
1192
|
+
.withTransformOriginOn('.mtx-popover-panel'),
|
|
1193
|
+
backdropClass: this.popover.backdropClass || 'cdk-overlay-transparent-backdrop',
|
|
1194
|
+
panelClass: this.popover.overlayPanelClass,
|
|
1195
|
+
scrollStrategy: this._scrollStrategy(),
|
|
1196
|
+
direction: this._dir,
|
|
1197
|
+
});
|
|
998
1198
|
};
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
MtxPopoverTrigger.prototype._getOverlayScrollStrategy = function (strategy) {
|
|
1003
|
-
switch (strategy) {
|
|
1004
|
-
case 'noop':
|
|
1005
|
-
return this._overlay.scrollStrategies.noop();
|
|
1006
|
-
case 'close':
|
|
1007
|
-
return this._overlay.scrollStrategies.close();
|
|
1008
|
-
case 'block':
|
|
1009
|
-
return this._overlay.scrollStrategies.block();
|
|
1010
|
-
case 'reposition':
|
|
1011
|
-
default:
|
|
1012
|
-
return this._overlay.scrollStrategies.reposition();
|
|
1199
|
+
MtxPopoverTrigger.prototype._getTargetElement = function () {
|
|
1200
|
+
if (this.targetElement) {
|
|
1201
|
+
return this.targetElement.elementRef;
|
|
1013
1202
|
}
|
|
1203
|
+
return this._elementRef;
|
|
1014
1204
|
};
|
|
1015
1205
|
/**
|
|
1016
1206
|
* Listens to changes in the position of the overlay and sets the correct classes
|
|
@@ -1035,38 +1225,36 @@
|
|
|
1035
1225
|
: [posX, posY];
|
|
1036
1226
|
// required for ChangeDetectionStrategy.OnPush
|
|
1037
1227
|
_this._changeDetectorRef.markForCheck();
|
|
1038
|
-
_this.popover.
|
|
1039
|
-
|
|
1040
|
-
_this.popover.setPositionClasses(pos);
|
|
1041
|
-
});
|
|
1228
|
+
_this.popover.setCurrentStyles(pos);
|
|
1229
|
+
_this.popover.setPositionClasses(pos);
|
|
1042
1230
|
});
|
|
1043
1231
|
};
|
|
1044
1232
|
/**
|
|
1045
|
-
*
|
|
1046
|
-
*
|
|
1047
|
-
* @
|
|
1233
|
+
* Sets the appropriate positions on a position strategy
|
|
1234
|
+
* so the overlay connects with the trigger correctly.
|
|
1235
|
+
* @param positionStrategy Strategy whose position to update.
|
|
1048
1236
|
*/
|
|
1049
|
-
MtxPopoverTrigger.prototype.
|
|
1050
|
-
var
|
|
1237
|
+
MtxPopoverTrigger.prototype._setPosition = function (positionStrategy) {
|
|
1238
|
+
var _b = __read(this.popover.position[0] === 'before' || this.popover.position[1] === 'after'
|
|
1051
1239
|
? ['start', 'center', 'end']
|
|
1052
1240
|
: this.popover.position[0] === 'after' || this.popover.position[1] === 'before'
|
|
1053
1241
|
? ['end', 'center', 'start']
|
|
1054
|
-
: ['center', 'start', 'end'], 3), originX =
|
|
1055
|
-
var
|
|
1242
|
+
: ['center', 'start', 'end'], 3), originX = _b[0], origin2ndX = _b[1], origin3rdX = _b[2];
|
|
1243
|
+
var _c = __read(this.popover.position[0] === 'above' || this.popover.position[1] === 'below'
|
|
1056
1244
|
? ['top', 'center', 'bottom']
|
|
1057
1245
|
: this.popover.position[0] === 'below' || this.popover.position[1] === 'above'
|
|
1058
1246
|
? ['bottom', 'center', 'top']
|
|
1059
|
-
: ['center', 'top', 'bottom'], 3), originY =
|
|
1060
|
-
var
|
|
1247
|
+
: ['center', 'top', 'bottom'], 3), originY = _c[0], origin2ndY = _c[1], origin3rdY = _c[2];
|
|
1248
|
+
var _d = __read(this.popover.position[0] === 'below' || this.popover.position[0] === 'above'
|
|
1061
1249
|
? [originX, originX]
|
|
1062
1250
|
: this.popover.position[0] === 'before'
|
|
1063
1251
|
? ['end', 'start']
|
|
1064
|
-
: ['start', 'end'], 2), overlayX =
|
|
1065
|
-
var
|
|
1252
|
+
: ['start', 'end'], 2), overlayX = _d[0], overlayFallbackX = _d[1];
|
|
1253
|
+
var _e = __read(this.popover.position[0] === 'before' || this.popover.position[0] === 'after'
|
|
1066
1254
|
? [originY, originY]
|
|
1067
1255
|
: this.popover.position[0] === 'below'
|
|
1068
1256
|
? ['top', 'bottom']
|
|
1069
|
-
: ['bottom', 'top'], 2), overlayY =
|
|
1257
|
+
: ['bottom', 'top'], 2), overlayY = _e[0], overlayFallbackY = _e[1];
|
|
1070
1258
|
var originFallbackX = overlayX;
|
|
1071
1259
|
var originFallbackY = overlayY;
|
|
1072
1260
|
var offsetX = this.popover.xOffset && !isNaN(Number(this.popover.xOffset))
|
|
@@ -1075,16 +1263,6 @@
|
|
|
1075
1263
|
var offsetY = this.popover.yOffset && !isNaN(Number(this.popover.yOffset))
|
|
1076
1264
|
? Number(this.popover.yOffset)
|
|
1077
1265
|
: 0;
|
|
1078
|
-
/**
|
|
1079
|
-
* For overriding position element, when `mtxPopoverTargetAt` has a valid element reference.
|
|
1080
|
-
* Useful for sticking popover to parent element and offsetting arrow to trigger element.
|
|
1081
|
-
* If undefined defaults to the trigger element reference.
|
|
1082
|
-
*/
|
|
1083
|
-
var element = this._elementRef;
|
|
1084
|
-
if (typeof this.targetElement !== 'undefined') {
|
|
1085
|
-
this.popover.containerPositioning = true;
|
|
1086
|
-
element = this.targetElement._elementRef;
|
|
1087
|
-
}
|
|
1088
1266
|
var positions = [{ originX: originX, originY: originY, overlayX: overlayX, overlayY: overlayY }];
|
|
1089
1267
|
if (this.popover.position[0] === 'above' || this.popover.position[0] === 'below') {
|
|
1090
1268
|
positions = [
|
|
@@ -1142,37 +1320,46 @@
|
|
|
1142
1320
|
},
|
|
1143
1321
|
];
|
|
1144
1322
|
}
|
|
1145
|
-
|
|
1146
|
-
.position()
|
|
1147
|
-
.flexibleConnectedTo(element)
|
|
1148
|
-
.withLockedPosition()
|
|
1323
|
+
positionStrategy
|
|
1149
1324
|
.withPositions(positions)
|
|
1150
1325
|
.withDefaultOffsetX(offsetX)
|
|
1151
1326
|
.withDefaultOffsetY(offsetY);
|
|
1152
1327
|
};
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
if (this._detachmentsSubscription) {
|
|
1161
|
-
this._detachmentsSubscription.unsubscribe();
|
|
1162
|
-
}
|
|
1328
|
+
/** Returns a stream that emits whenever an action that should close the popover occurs. */
|
|
1329
|
+
MtxPopoverTrigger.prototype._popoverClosingActions = function () {
|
|
1330
|
+
var backdrop = this.popover.triggerEvent === 'click' && this.popover.closeOnBackdropClick === true
|
|
1331
|
+
? this._overlayRef.backdropClick()
|
|
1332
|
+
: rxjs.of();
|
|
1333
|
+
var detachments = this._overlayRef.detachments();
|
|
1334
|
+
return rxjs.merge(backdrop, detachments);
|
|
1163
1335
|
};
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1336
|
+
/** Gets the portal that should be attached to the overlay. */
|
|
1337
|
+
MtxPopoverTrigger.prototype._getPortal = function () {
|
|
1338
|
+
// Note that we can avoid this check by keeping the portal on the popover panel.
|
|
1339
|
+
// While it would be cleaner, we'd have to introduce another required method on
|
|
1340
|
+
// `MtxPopoverPanel`, making it harder to consume.
|
|
1341
|
+
if (!this._portal || this._portal.templateRef !== this.popover.templateRef) {
|
|
1342
|
+
this._portal = new portal.TemplatePortal(this.popover.templateRef, this._viewContainerRef);
|
|
1167
1343
|
}
|
|
1344
|
+
return this._portal;
|
|
1168
1345
|
};
|
|
1169
1346
|
return MtxPopoverTrigger;
|
|
1170
1347
|
}());
|
|
1171
1348
|
/** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
|
|
1172
1349
|
MtxPopoverTrigger.decorators = [
|
|
1173
1350
|
{ type: core.Directive, args: [{
|
|
1174
|
-
selector: '[mtxPopoverTriggerFor]',
|
|
1351
|
+
selector: '[mtx-popover-trigger-for], [mtxPopoverTriggerFor]',
|
|
1175
1352
|
exportAs: 'mtxPopoverTrigger',
|
|
1353
|
+
host: {
|
|
1354
|
+
'aria-haspopup': 'true',
|
|
1355
|
+
'[attr.aria-expanded]': 'popoverOpen || null',
|
|
1356
|
+
'[attr.aria-controls]': 'popoverOpen ? popover.panelId : null',
|
|
1357
|
+
'(click)': '_handleClick($event)',
|
|
1358
|
+
'(mouseenter)': '_handleMouseEnter($event)',
|
|
1359
|
+
'(mouseleave)': '_handleMouseLeave($event)',
|
|
1360
|
+
'(mousedown)': '_handleMousedown($event)',
|
|
1361
|
+
'(keydown)': '_handleKeydown($event)',
|
|
1362
|
+
},
|
|
1176
1363
|
},] }
|
|
1177
1364
|
];
|
|
1178
1365
|
/**
|
|
@@ -1186,26 +1373,24 @@
|
|
|
1186
1373
|
{ type: overlay.Overlay },
|
|
1187
1374
|
{ type: core.ElementRef },
|
|
1188
1375
|
{ type: core.ViewContainerRef },
|
|
1376
|
+
{ type: undefined, decorators: [{ type: core.Inject, args: [MTX_POPOVER_SCROLL_STRATEGY,] }] },
|
|
1189
1377
|
{ type: bidi.Directionality, decorators: [{ type: core.Optional }] },
|
|
1190
|
-
{ type: core.ChangeDetectorRef }
|
|
1378
|
+
{ type: core.ChangeDetectorRef },
|
|
1379
|
+
{ type: a11y.FocusMonitor }
|
|
1191
1380
|
]; };
|
|
1192
1381
|
/** @type {!Object<string, !Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
|
|
1193
1382
|
MtxPopoverTrigger.propDecorators = {
|
|
1194
|
-
ariaHaspopup: [{ type: core.HostBinding, args: ['attr.aria-haspopup',] }],
|
|
1195
1383
|
popover: [{ type: core.Input, args: ['mtxPopoverTriggerFor',] }],
|
|
1384
|
+
popoverData: [{ type: core.Input, args: ['mtxPopoverTriggerData',] }],
|
|
1196
1385
|
targetElement: [{ type: core.Input, args: ['mtxPopoverTargetAt',] }],
|
|
1197
1386
|
triggerEvent: [{ type: core.Input, args: ['mtxPopoverTriggerOn',] }],
|
|
1198
1387
|
popoverOpened: [{ type: core.Output }],
|
|
1199
|
-
popoverClosed: [{ type: core.Output }]
|
|
1200
|
-
onClick: [{ type: core.HostListener, args: ['click', ['$event'],] }],
|
|
1201
|
-
onMouseEnter: [{ type: core.HostListener, args: ['mouseenter', ['$event'],] }],
|
|
1202
|
-
onMouseLeave: [{ type: core.HostListener, args: ['mouseleave', ['$event'],] }],
|
|
1203
|
-
_handleMousedown: [{ type: core.HostListener, args: ['mousedown', ['$event'],] }]
|
|
1388
|
+
popoverClosed: [{ type: core.Output }]
|
|
1204
1389
|
};
|
|
1205
1390
|
|
|
1206
1391
|
var MtxPopoverTarget = /** @class */ (function () {
|
|
1207
|
-
function MtxPopoverTarget(
|
|
1208
|
-
this.
|
|
1392
|
+
function MtxPopoverTarget(elementRef) {
|
|
1393
|
+
this.elementRef = elementRef;
|
|
1209
1394
|
}
|
|
1210
1395
|
return MtxPopoverTarget;
|
|
1211
1396
|
}());
|
|
@@ -1235,9 +1420,10 @@
|
|
|
1235
1420
|
/** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
|
|
1236
1421
|
MtxPopoverModule.decorators = [
|
|
1237
1422
|
{ type: core.NgModule, args: [{
|
|
1238
|
-
imports: [
|
|
1239
|
-
exports: [MtxPopover, MtxPopoverTrigger, MtxPopoverTarget],
|
|
1240
|
-
declarations: [MtxPopover, MtxPopoverTrigger, MtxPopoverTarget],
|
|
1423
|
+
imports: [common.CommonModule, overlay.OverlayModule, a11y.A11yModule],
|
|
1424
|
+
exports: [MtxPopover, MtxPopoverTrigger, MtxPopoverTarget, MtxPopoverContent],
|
|
1425
|
+
declarations: [MtxPopover, MtxPopoverTrigger, MtxPopoverTarget, MtxPopoverContent],
|
|
1426
|
+
providers: [MTX_POPOVER_SCROLL_STRATEGY_FACTORY_PROVIDER],
|
|
1241
1427
|
},] }
|
|
1242
1428
|
];
|
|
1243
1429
|
|
|
@@ -1245,10 +1431,18 @@
|
|
|
1245
1431
|
* Generated bundle index. Do not edit.
|
|
1246
1432
|
*/
|
|
1247
1433
|
|
|
1434
|
+
exports.MTX_POPOVER_CONTENT = MTX_POPOVER_CONTENT;
|
|
1435
|
+
exports.MTX_POPOVER_DEFAULT_OPTIONS = MTX_POPOVER_DEFAULT_OPTIONS;
|
|
1436
|
+
exports.MTX_POPOVER_DEFAULT_OPTIONS_FACTORY = MTX_POPOVER_DEFAULT_OPTIONS_FACTORY;
|
|
1437
|
+
exports.MTX_POPOVER_SCROLL_STRATEGY = MTX_POPOVER_SCROLL_STRATEGY;
|
|
1438
|
+
exports.MTX_POPOVER_SCROLL_STRATEGY_FACTORY = MTX_POPOVER_SCROLL_STRATEGY_FACTORY;
|
|
1439
|
+
exports.MTX_POPOVER_SCROLL_STRATEGY_FACTORY_PROVIDER = MTX_POPOVER_SCROLL_STRATEGY_FACTORY_PROVIDER;
|
|
1248
1440
|
exports.MtxPopover = MtxPopover;
|
|
1441
|
+
exports.MtxPopoverContent = MtxPopoverContent;
|
|
1249
1442
|
exports.MtxPopoverModule = MtxPopoverModule;
|
|
1250
1443
|
exports.MtxPopoverTarget = MtxPopoverTarget;
|
|
1251
1444
|
exports.MtxPopoverTrigger = MtxPopoverTrigger;
|
|
1445
|
+
exports._MtxPopoverContentBase = _MtxPopoverContentBase;
|
|
1252
1446
|
exports.transformPopover = transformPopover;
|
|
1253
1447
|
|
|
1254
1448
|
Object.defineProperty(exports, '__esModule', { value: true });
|