1 | (function (global, factory) {
|
---|
2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/cdk/a11y'), require('@angular/cdk/bidi'), require('@angular/cdk'), require('@angular/common'), require('@angular/cdk/platform'), require('@angular/cdk/coercion'), require('rxjs'), require('rxjs/operators'), require('@angular/platform-browser/animations'), require('@angular/cdk/keycodes')) :
|
---|
3 | typeof define === 'function' && define.amd ? define('@angular/material/core', ['exports', '@angular/core', '@angular/cdk/a11y', '@angular/cdk/bidi', '@angular/cdk', '@angular/common', '@angular/cdk/platform', '@angular/cdk/coercion', 'rxjs', 'rxjs/operators', '@angular/platform-browser/animations', '@angular/cdk/keycodes'], factory) :
|
---|
4 | (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.ng = global.ng || {}, global.ng.material = global.ng.material || {}, global.ng.material.core = {}), global.ng.core, global.ng.cdk.a11y, global.ng.cdk.bidi, global.ng.cdk, global.ng.common, global.ng.cdk.platform, global.ng.cdk.coercion, global.rxjs, global.rxjs.operators, global.ng.platformBrowser.animations, global.ng.cdk.keycodes));
|
---|
5 | }(this, (function (exports, i0, a11y, bidi, cdk, common, platform, coercion, rxjs, operators, animations, keycodes) { 'use strict';
|
---|
6 |
|
---|
7 | function _interopNamespace(e) {
|
---|
8 | if (e && e.__esModule) return e;
|
---|
9 | var n = Object.create(null);
|
---|
10 | if (e) {
|
---|
11 | Object.keys(e).forEach(function (k) {
|
---|
12 | if (k !== 'default') {
|
---|
13 | var d = Object.getOwnPropertyDescriptor(e, k);
|
---|
14 | Object.defineProperty(n, k, d.get ? d : {
|
---|
15 | enumerable: true,
|
---|
16 | get: function () {
|
---|
17 | return e[k];
|
---|
18 | }
|
---|
19 | });
|
---|
20 | }
|
---|
21 | });
|
---|
22 | }
|
---|
23 | n['default'] = e;
|
---|
24 | return Object.freeze(n);
|
---|
25 | }
|
---|
26 |
|
---|
27 | var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
|
---|
28 |
|
---|
29 | /**
|
---|
30 | * @license
|
---|
31 | * Copyright Google LLC All Rights Reserved.
|
---|
32 | *
|
---|
33 | * Use of this source code is governed by an MIT-style license that can be
|
---|
34 | * found in the LICENSE file at https://angular.io/license
|
---|
35 | */
|
---|
36 | /** Current version of Angular Material. */
|
---|
37 | var VERSION$1 = new i0.Version('12.2.13');
|
---|
38 |
|
---|
39 | /**
|
---|
40 | * @license
|
---|
41 | * Copyright Google LLC All Rights Reserved.
|
---|
42 | *
|
---|
43 | * Use of this source code is governed by an MIT-style license that can be
|
---|
44 | * found in the LICENSE file at https://angular.io/license
|
---|
45 | */
|
---|
46 | /** @docs-private */
|
---|
47 | var AnimationCurves = /** @class */ (function () {
|
---|
48 | function AnimationCurves() {
|
---|
49 | }
|
---|
50 | return AnimationCurves;
|
---|
51 | }());
|
---|
52 | AnimationCurves.STANDARD_CURVE = 'cubic-bezier(0.4,0.0,0.2,1)';
|
---|
53 | AnimationCurves.DECELERATION_CURVE = 'cubic-bezier(0.0,0.0,0.2,1)';
|
---|
54 | AnimationCurves.ACCELERATION_CURVE = 'cubic-bezier(0.4,0.0,1,1)';
|
---|
55 | AnimationCurves.SHARP_CURVE = 'cubic-bezier(0.4,0.0,0.6,1)';
|
---|
56 | /** @docs-private */
|
---|
57 | var AnimationDurations = /** @class */ (function () {
|
---|
58 | function AnimationDurations() {
|
---|
59 | }
|
---|
60 | return AnimationDurations;
|
---|
61 | }());
|
---|
62 | AnimationDurations.COMPLEX = '375ms';
|
---|
63 | AnimationDurations.ENTERING = '225ms';
|
---|
64 | AnimationDurations.EXITING = '195ms';
|
---|
65 |
|
---|
66 | /**
|
---|
67 | * @license
|
---|
68 | * Copyright Google LLC All Rights Reserved.
|
---|
69 | *
|
---|
70 | * Use of this source code is governed by an MIT-style license that can be
|
---|
71 | * found in the LICENSE file at https://angular.io/license
|
---|
72 | */
|
---|
73 | // Private version constant to circumvent test/build issues,
|
---|
74 | // i.e. avoid core to depend on the @angular/material primary entry-point
|
---|
75 | // Can be removed once the Material primary entry-point no longer
|
---|
76 | // re-exports all secondary entry-points
|
---|
77 | var VERSION = new i0.Version('12.2.13');
|
---|
78 | /** @docs-private */
|
---|
79 | function MATERIAL_SANITY_CHECKS_FACTORY() {
|
---|
80 | return true;
|
---|
81 | }
|
---|
82 | /** Injection token that configures whether the Material sanity checks are enabled. */
|
---|
83 | var MATERIAL_SANITY_CHECKS = new i0.InjectionToken('mat-sanity-checks', {
|
---|
84 | providedIn: 'root',
|
---|
85 | factory: MATERIAL_SANITY_CHECKS_FACTORY,
|
---|
86 | });
|
---|
87 | /**
|
---|
88 | * Module that captures anything that should be loaded and/or run for *all* Angular Material
|
---|
89 | * components. This includes Bidi, etc.
|
---|
90 | *
|
---|
91 | * This module should be imported to each top-level component module (e.g., MatTabsModule).
|
---|
92 | */
|
---|
93 | var MatCommonModule = /** @class */ (function () {
|
---|
94 | function MatCommonModule(highContrastModeDetector, sanityChecks, document) {
|
---|
95 | /** Whether we've done the global sanity checks (e.g. a theme is loaded, there is a doctype). */
|
---|
96 | this._hasDoneGlobalChecks = false;
|
---|
97 | this._document = document;
|
---|
98 | // While A11yModule also does this, we repeat it here to avoid importing A11yModule
|
---|
99 | // in MatCommonModule.
|
---|
100 | highContrastModeDetector._applyBodyHighContrastModeCssClasses();
|
---|
101 | // Note that `_sanityChecks` is typed to `any`, because AoT
|
---|
102 | // throws an error if we use the `SanityChecks` type directly.
|
---|
103 | this._sanityChecks = sanityChecks;
|
---|
104 | if (!this._hasDoneGlobalChecks) {
|
---|
105 | this._checkDoctypeIsDefined();
|
---|
106 | this._checkThemeIsPresent();
|
---|
107 | this._checkCdkVersionMatch();
|
---|
108 | this._hasDoneGlobalChecks = true;
|
---|
109 | }
|
---|
110 | }
|
---|
111 | /** Gets whether a specific sanity check is enabled. */
|
---|
112 | MatCommonModule.prototype._checkIsEnabled = function (name) {
|
---|
113 | // TODO(crisbeto): we can't use `ngDevMode` here yet, because ViewEngine apps might not support
|
---|
114 | // it. Since these checks can have performance implications and they aren't tree shakeable
|
---|
115 | // in their current form, we can leave the `isDevMode` check in for now.
|
---|
116 | // tslint:disable-next-line:ban
|
---|
117 | if (!i0.isDevMode() || platform._isTestEnvironment()) {
|
---|
118 | return false;
|
---|
119 | }
|
---|
120 | if (typeof this._sanityChecks === 'boolean') {
|
---|
121 | return this._sanityChecks;
|
---|
122 | }
|
---|
123 | return !!this._sanityChecks[name];
|
---|
124 | };
|
---|
125 | MatCommonModule.prototype._checkDoctypeIsDefined = function () {
|
---|
126 | if (this._checkIsEnabled('doctype') && !this._document.doctype) {
|
---|
127 | console.warn('Current document does not have a doctype. This may cause ' +
|
---|
128 | 'some Angular Material components not to behave as expected.');
|
---|
129 | }
|
---|
130 | };
|
---|
131 | MatCommonModule.prototype._checkThemeIsPresent = function () {
|
---|
132 | // We need to assert that the `body` is defined, because these checks run very early
|
---|
133 | // and the `body` won't be defined if the consumer put their scripts in the `head`.
|
---|
134 | if (!this._checkIsEnabled('theme') || !this._document.body ||
|
---|
135 | typeof getComputedStyle !== 'function') {
|
---|
136 | return;
|
---|
137 | }
|
---|
138 | var testElement = this._document.createElement('div');
|
---|
139 | testElement.classList.add('mat-theme-loaded-marker');
|
---|
140 | this._document.body.appendChild(testElement);
|
---|
141 | var computedStyle = getComputedStyle(testElement);
|
---|
142 | // In some situations the computed style of the test element can be null. For example in
|
---|
143 | // Firefox, the computed style is null if an application is running inside of a hidden iframe.
|
---|
144 | // See: https://bugzilla.mozilla.org/show_bug.cgi?id=548397
|
---|
145 | if (computedStyle && computedStyle.display !== 'none') {
|
---|
146 | console.warn('Could not find Angular Material core theme. Most Material ' +
|
---|
147 | 'components may not work as expected. For more info refer ' +
|
---|
148 | 'to the theming guide: https://material.angular.io/guide/theming');
|
---|
149 | }
|
---|
150 | this._document.body.removeChild(testElement);
|
---|
151 | };
|
---|
152 | /** Checks whether the material version matches the cdk version */
|
---|
153 | MatCommonModule.prototype._checkCdkVersionMatch = function () {
|
---|
154 | if (this._checkIsEnabled('version') && VERSION.full !== cdk.VERSION.full) {
|
---|
155 | console.warn('The Angular Material version (' + VERSION.full + ') does not match ' +
|
---|
156 | 'the Angular CDK version (' + cdk.VERSION.full + ').\n' +
|
---|
157 | 'Please ensure the versions of these two packages exactly match.');
|
---|
158 | }
|
---|
159 | };
|
---|
160 | return MatCommonModule;
|
---|
161 | }());
|
---|
162 | MatCommonModule.decorators = [
|
---|
163 | { type: i0.NgModule, args: [{
|
---|
164 | imports: [bidi.BidiModule],
|
---|
165 | exports: [bidi.BidiModule],
|
---|
166 | },] }
|
---|
167 | ];
|
---|
168 | MatCommonModule.ctorParameters = function () { return [
|
---|
169 | { type: a11y.HighContrastModeDetector },
|
---|
170 | { type: undefined, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [MATERIAL_SANITY_CHECKS,] }] },
|
---|
171 | { type: undefined, decorators: [{ type: i0.Inject, args: [common.DOCUMENT,] }] }
|
---|
172 | ]; };
|
---|
173 |
|
---|
174 | /*! *****************************************************************************
|
---|
175 | Copyright (c) Microsoft Corporation.
|
---|
176 |
|
---|
177 | Permission to use, copy, modify, and/or distribute this software for any
|
---|
178 | purpose with or without fee is hereby granted.
|
---|
179 |
|
---|
180 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
---|
181 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
---|
182 | AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
---|
183 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
---|
184 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
---|
185 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
---|
186 | PERFORMANCE OF THIS SOFTWARE.
|
---|
187 | ***************************************************************************** */
|
---|
188 | /* global Reflect, Promise */
|
---|
189 | var extendStatics = function (d, b) {
|
---|
190 | extendStatics = Object.setPrototypeOf ||
|
---|
191 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
---|
192 | function (d, b) { for (var p in b)
|
---|
193 | if (Object.prototype.hasOwnProperty.call(b, p))
|
---|
194 | d[p] = b[p]; };
|
---|
195 | return extendStatics(d, b);
|
---|
196 | };
|
---|
197 | function __extends(d, b) {
|
---|
198 | if (typeof b !== "function" && b !== null)
|
---|
199 | throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
---|
200 | extendStatics(d, b);
|
---|
201 | function __() { this.constructor = d; }
|
---|
202 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
---|
203 | }
|
---|
204 | var __assign = function () {
|
---|
205 | __assign = Object.assign || function __assign(t) {
|
---|
206 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
---|
207 | s = arguments[i];
|
---|
208 | for (var p in s)
|
---|
209 | if (Object.prototype.hasOwnProperty.call(s, p))
|
---|
210 | t[p] = s[p];
|
---|
211 | }
|
---|
212 | return t;
|
---|
213 | };
|
---|
214 | return __assign.apply(this, arguments);
|
---|
215 | };
|
---|
216 | function __rest(s, e) {
|
---|
217 | var t = {};
|
---|
218 | for (var p in s)
|
---|
219 | if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
---|
220 | t[p] = s[p];
|
---|
221 | if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
---|
222 | for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
---|
223 | if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
---|
224 | t[p[i]] = s[p[i]];
|
---|
225 | }
|
---|
226 | return t;
|
---|
227 | }
|
---|
228 | function __decorate(decorators, target, key, desc) {
|
---|
229 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
---|
230 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
---|
231 | r = Reflect.decorate(decorators, target, key, desc);
|
---|
232 | else
|
---|
233 | for (var i = decorators.length - 1; i >= 0; i--)
|
---|
234 | if (d = decorators[i])
|
---|
235 | r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
---|
236 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
---|
237 | }
|
---|
238 | function __param(paramIndex, decorator) {
|
---|
239 | return function (target, key) { decorator(target, key, paramIndex); };
|
---|
240 | }
|
---|
241 | function __metadata(metadataKey, metadataValue) {
|
---|
242 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
---|
243 | return Reflect.metadata(metadataKey, metadataValue);
|
---|
244 | }
|
---|
245 | function __awaiter(thisArg, _arguments, P, generator) {
|
---|
246 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
---|
247 | return new (P || (P = Promise))(function (resolve, reject) {
|
---|
248 | function fulfilled(value) { try {
|
---|
249 | step(generator.next(value));
|
---|
250 | }
|
---|
251 | catch (e) {
|
---|
252 | reject(e);
|
---|
253 | } }
|
---|
254 | function rejected(value) { try {
|
---|
255 | step(generator["throw"](value));
|
---|
256 | }
|
---|
257 | catch (e) {
|
---|
258 | reject(e);
|
---|
259 | } }
|
---|
260 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
---|
261 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
---|
262 | });
|
---|
263 | }
|
---|
264 | function __generator(thisArg, body) {
|
---|
265 | var _ = { label: 0, sent: function () { if (t[0] & 1)
|
---|
266 | throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
---|
267 | return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
|
---|
268 | function verb(n) { return function (v) { return step([n, v]); }; }
|
---|
269 | function step(op) {
|
---|
270 | if (f)
|
---|
271 | throw new TypeError("Generator is already executing.");
|
---|
272 | while (_)
|
---|
273 | try {
|
---|
274 | 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)
|
---|
275 | return t;
|
---|
276 | if (y = 0, t)
|
---|
277 | op = [op[0] & 2, t.value];
|
---|
278 | switch (op[0]) {
|
---|
279 | case 0:
|
---|
280 | case 1:
|
---|
281 | t = op;
|
---|
282 | break;
|
---|
283 | case 4:
|
---|
284 | _.label++;
|
---|
285 | return { value: op[1], done: false };
|
---|
286 | case 5:
|
---|
287 | _.label++;
|
---|
288 | y = op[1];
|
---|
289 | op = [0];
|
---|
290 | continue;
|
---|
291 | case 7:
|
---|
292 | op = _.ops.pop();
|
---|
293 | _.trys.pop();
|
---|
294 | continue;
|
---|
295 | default:
|
---|
296 | if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
---|
297 | _ = 0;
|
---|
298 | continue;
|
---|
299 | }
|
---|
300 | if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
|
---|
301 | _.label = op[1];
|
---|
302 | break;
|
---|
303 | }
|
---|
304 | if (op[0] === 6 && _.label < t[1]) {
|
---|
305 | _.label = t[1];
|
---|
306 | t = op;
|
---|
307 | break;
|
---|
308 | }
|
---|
309 | if (t && _.label < t[2]) {
|
---|
310 | _.label = t[2];
|
---|
311 | _.ops.push(op);
|
---|
312 | break;
|
---|
313 | }
|
---|
314 | if (t[2])
|
---|
315 | _.ops.pop();
|
---|
316 | _.trys.pop();
|
---|
317 | continue;
|
---|
318 | }
|
---|
319 | op = body.call(thisArg, _);
|
---|
320 | }
|
---|
321 | catch (e) {
|
---|
322 | op = [6, e];
|
---|
323 | y = 0;
|
---|
324 | }
|
---|
325 | finally {
|
---|
326 | f = t = 0;
|
---|
327 | }
|
---|
328 | if (op[0] & 5)
|
---|
329 | throw op[1];
|
---|
330 | return { value: op[0] ? op[1] : void 0, done: true };
|
---|
331 | }
|
---|
332 | }
|
---|
333 | var __createBinding = Object.create ? (function (o, m, k, k2) {
|
---|
334 | if (k2 === undefined)
|
---|
335 | k2 = k;
|
---|
336 | Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
|
---|
337 | }) : (function (o, m, k, k2) {
|
---|
338 | if (k2 === undefined)
|
---|
339 | k2 = k;
|
---|
340 | o[k2] = m[k];
|
---|
341 | });
|
---|
342 | function __exportStar(m, o) {
|
---|
343 | for (var p in m)
|
---|
344 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
|
---|
345 | __createBinding(o, m, p);
|
---|
346 | }
|
---|
347 | function __values(o) {
|
---|
348 | var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
---|
349 | if (m)
|
---|
350 | return m.call(o);
|
---|
351 | if (o && typeof o.length === "number")
|
---|
352 | return {
|
---|
353 | next: function () {
|
---|
354 | if (o && i >= o.length)
|
---|
355 | o = void 0;
|
---|
356 | return { value: o && o[i++], done: !o };
|
---|
357 | }
|
---|
358 | };
|
---|
359 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
---|
360 | }
|
---|
361 | function __read(o, n) {
|
---|
362 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
---|
363 | if (!m)
|
---|
364 | return o;
|
---|
365 | var i = m.call(o), r, ar = [], e;
|
---|
366 | try {
|
---|
367 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
---|
368 | ar.push(r.value);
|
---|
369 | }
|
---|
370 | catch (error) {
|
---|
371 | e = { error: error };
|
---|
372 | }
|
---|
373 | finally {
|
---|
374 | try {
|
---|
375 | if (r && !r.done && (m = i["return"]))
|
---|
376 | m.call(i);
|
---|
377 | }
|
---|
378 | finally {
|
---|
379 | if (e)
|
---|
380 | throw e.error;
|
---|
381 | }
|
---|
382 | }
|
---|
383 | return ar;
|
---|
384 | }
|
---|
385 | /** @deprecated */
|
---|
386 | function __spread() {
|
---|
387 | for (var ar = [], i = 0; i < arguments.length; i++)
|
---|
388 | ar = ar.concat(__read(arguments[i]));
|
---|
389 | return ar;
|
---|
390 | }
|
---|
391 | /** @deprecated */
|
---|
392 | function __spreadArrays() {
|
---|
393 | for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
---|
394 | s += arguments[i].length;
|
---|
395 | for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
---|
396 | for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
---|
397 | r[k] = a[j];
|
---|
398 | return r;
|
---|
399 | }
|
---|
400 | function __spreadArray(to, from, pack) {
|
---|
401 | if (pack || arguments.length === 2)
|
---|
402 | for (var i = 0, l = from.length, ar; i < l; i++) {
|
---|
403 | if (ar || !(i in from)) {
|
---|
404 | if (!ar)
|
---|
405 | ar = Array.prototype.slice.call(from, 0, i);
|
---|
406 | ar[i] = from[i];
|
---|
407 | }
|
---|
408 | }
|
---|
409 | return to.concat(ar || from);
|
---|
410 | }
|
---|
411 | function __await(v) {
|
---|
412 | return this instanceof __await ? (this.v = v, this) : new __await(v);
|
---|
413 | }
|
---|
414 | function __asyncGenerator(thisArg, _arguments, generator) {
|
---|
415 | if (!Symbol.asyncIterator)
|
---|
416 | throw new TypeError("Symbol.asyncIterator is not defined.");
|
---|
417 | var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
---|
418 | return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
---|
419 | function verb(n) { if (g[n])
|
---|
420 | i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
---|
421 | function resume(n, v) { try {
|
---|
422 | step(g[n](v));
|
---|
423 | }
|
---|
424 | catch (e) {
|
---|
425 | settle(q[0][3], e);
|
---|
426 | } }
|
---|
427 | function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
---|
428 | function fulfill(value) { resume("next", value); }
|
---|
429 | function reject(value) { resume("throw", value); }
|
---|
430 | function settle(f, v) { if (f(v), q.shift(), q.length)
|
---|
431 | resume(q[0][0], q[0][1]); }
|
---|
432 | }
|
---|
433 | function __asyncDelegator(o) {
|
---|
434 | var i, p;
|
---|
435 | return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
---|
436 | 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; }
|
---|
437 | }
|
---|
438 | function __asyncValues(o) {
|
---|
439 | if (!Symbol.asyncIterator)
|
---|
440 | throw new TypeError("Symbol.asyncIterator is not defined.");
|
---|
441 | var m = o[Symbol.asyncIterator], i;
|
---|
442 | 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);
|
---|
443 | 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); }); }; }
|
---|
444 | function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
---|
445 | }
|
---|
446 | function __makeTemplateObject(cooked, raw) {
|
---|
447 | if (Object.defineProperty) {
|
---|
448 | Object.defineProperty(cooked, "raw", { value: raw });
|
---|
449 | }
|
---|
450 | else {
|
---|
451 | cooked.raw = raw;
|
---|
452 | }
|
---|
453 | return cooked;
|
---|
454 | }
|
---|
455 | ;
|
---|
456 | var __setModuleDefault = Object.create ? (function (o, v) {
|
---|
457 | Object.defineProperty(o, "default", { enumerable: true, value: v });
|
---|
458 | }) : function (o, v) {
|
---|
459 | o["default"] = v;
|
---|
460 | };
|
---|
461 | function __importStar(mod) {
|
---|
462 | if (mod && mod.__esModule)
|
---|
463 | return mod;
|
---|
464 | var result = {};
|
---|
465 | if (mod != null)
|
---|
466 | for (var k in mod)
|
---|
467 | if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
---|
468 | __createBinding(result, mod, k);
|
---|
469 | __setModuleDefault(result, mod);
|
---|
470 | return result;
|
---|
471 | }
|
---|
472 | function __importDefault(mod) {
|
---|
473 | return (mod && mod.__esModule) ? mod : { default: mod };
|
---|
474 | }
|
---|
475 | function __classPrivateFieldGet(receiver, state, kind, f) {
|
---|
476 | if (kind === "a" && !f)
|
---|
477 | throw new TypeError("Private accessor was defined without a getter");
|
---|
478 | if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
---|
479 | throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
---|
480 | return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
---|
481 | }
|
---|
482 | function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
---|
483 | if (kind === "m")
|
---|
484 | throw new TypeError("Private method is not writable");
|
---|
485 | if (kind === "a" && !f)
|
---|
486 | throw new TypeError("Private accessor was defined without a setter");
|
---|
487 | if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
---|
488 | throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
---|
489 | return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
---|
490 | }
|
---|
491 |
|
---|
492 | function mixinDisabled(base) {
|
---|
493 | return /** @class */ (function (_super) {
|
---|
494 | __extends(class_1, _super);
|
---|
495 | function class_1() {
|
---|
496 | var args = [];
|
---|
497 | for (var _i = 0; _i < arguments.length; _i++) {
|
---|
498 | args[_i] = arguments[_i];
|
---|
499 | }
|
---|
500 | var _this = _super.apply(this, __spreadArray([], __read(args))) || this;
|
---|
501 | _this._disabled = false;
|
---|
502 | return _this;
|
---|
503 | }
|
---|
504 | Object.defineProperty(class_1.prototype, "disabled", {
|
---|
505 | get: function () { return this._disabled; },
|
---|
506 | set: function (value) { this._disabled = coercion.coerceBooleanProperty(value); },
|
---|
507 | enumerable: false,
|
---|
508 | configurable: true
|
---|
509 | });
|
---|
510 | return class_1;
|
---|
511 | }(base));
|
---|
512 | }
|
---|
513 |
|
---|
514 | /**
|
---|
515 | * @license
|
---|
516 | * Copyright Google LLC All Rights Reserved.
|
---|
517 | *
|
---|
518 | * Use of this source code is governed by an MIT-style license that can be
|
---|
519 | * found in the LICENSE file at https://angular.io/license
|
---|
520 | */
|
---|
521 | function mixinColor(base, defaultColor) {
|
---|
522 | return /** @class */ (function (_super) {
|
---|
523 | __extends(class_1, _super);
|
---|
524 | function class_1() {
|
---|
525 | var args = [];
|
---|
526 | for (var _i = 0; _i < arguments.length; _i++) {
|
---|
527 | args[_i] = arguments[_i];
|
---|
528 | }
|
---|
529 | var _this = _super.apply(this, __spreadArray([], __read(args))) || this;
|
---|
530 | _this.defaultColor = defaultColor;
|
---|
531 | // Set the default color that can be specified from the mixin.
|
---|
532 | _this.color = defaultColor;
|
---|
533 | return _this;
|
---|
534 | }
|
---|
535 | Object.defineProperty(class_1.prototype, "color", {
|
---|
536 | get: function () { return this._color; },
|
---|
537 | set: function (value) {
|
---|
538 | var colorPalette = value || this.defaultColor;
|
---|
539 | if (colorPalette !== this._color) {
|
---|
540 | if (this._color) {
|
---|
541 | this._elementRef.nativeElement.classList.remove("mat-" + this._color);
|
---|
542 | }
|
---|
543 | if (colorPalette) {
|
---|
544 | this._elementRef.nativeElement.classList.add("mat-" + colorPalette);
|
---|
545 | }
|
---|
546 | this._color = colorPalette;
|
---|
547 | }
|
---|
548 | },
|
---|
549 | enumerable: false,
|
---|
550 | configurable: true
|
---|
551 | });
|
---|
552 | return class_1;
|
---|
553 | }(base));
|
---|
554 | }
|
---|
555 |
|
---|
556 | function mixinDisableRipple(base) {
|
---|
557 | return /** @class */ (function (_super) {
|
---|
558 | __extends(class_1, _super);
|
---|
559 | function class_1() {
|
---|
560 | var args = [];
|
---|
561 | for (var _i = 0; _i < arguments.length; _i++) {
|
---|
562 | args[_i] = arguments[_i];
|
---|
563 | }
|
---|
564 | var _this = _super.apply(this, __spreadArray([], __read(args))) || this;
|
---|
565 | _this._disableRipple = false;
|
---|
566 | return _this;
|
---|
567 | }
|
---|
568 | Object.defineProperty(class_1.prototype, "disableRipple", {
|
---|
569 | /** Whether the ripple effect is disabled or not. */
|
---|
570 | get: function () { return this._disableRipple; },
|
---|
571 | set: function (value) { this._disableRipple = coercion.coerceBooleanProperty(value); },
|
---|
572 | enumerable: false,
|
---|
573 | configurable: true
|
---|
574 | });
|
---|
575 | return class_1;
|
---|
576 | }(base));
|
---|
577 | }
|
---|
578 |
|
---|
579 | function mixinTabIndex(base, defaultTabIndex) {
|
---|
580 | if (defaultTabIndex === void 0) { defaultTabIndex = 0; }
|
---|
581 | return /** @class */ (function (_super) {
|
---|
582 | __extends(class_1, _super);
|
---|
583 | function class_1() {
|
---|
584 | var args = [];
|
---|
585 | for (var _i = 0; _i < arguments.length; _i++) {
|
---|
586 | args[_i] = arguments[_i];
|
---|
587 | }
|
---|
588 | var _this = _super.apply(this, __spreadArray([], __read(args))) || this;
|
---|
589 | _this._tabIndex = defaultTabIndex;
|
---|
590 | _this.defaultTabIndex = defaultTabIndex;
|
---|
591 | return _this;
|
---|
592 | }
|
---|
593 | Object.defineProperty(class_1.prototype, "tabIndex", {
|
---|
594 | get: function () { return this.disabled ? -1 : this._tabIndex; },
|
---|
595 | set: function (value) {
|
---|
596 | // If the specified tabIndex value is null or undefined, fall back to the default value.
|
---|
597 | this._tabIndex = value != null ? coercion.coerceNumberProperty(value) : this.defaultTabIndex;
|
---|
598 | },
|
---|
599 | enumerable: false,
|
---|
600 | configurable: true
|
---|
601 | });
|
---|
602 | return class_1;
|
---|
603 | }(base));
|
---|
604 | }
|
---|
605 |
|
---|
606 | function mixinErrorState(base) {
|
---|
607 | return /** @class */ (function (_super) {
|
---|
608 | __extends(class_1, _super);
|
---|
609 | function class_1() {
|
---|
610 | var args = [];
|
---|
611 | for (var _i = 0; _i < arguments.length; _i++) {
|
---|
612 | args[_i] = arguments[_i];
|
---|
613 | }
|
---|
614 | var _this = _super.apply(this, __spreadArray([], __read(args))) || this;
|
---|
615 | // This class member exists as an interop with `MatFormFieldControl` which expects
|
---|
616 | // a public `stateChanges` observable to emit whenever the form field should be updated.
|
---|
617 | // The description is not specifically mentioning the error state, as classes using this
|
---|
618 | // mixin can/should emit an event in other cases too.
|
---|
619 | /** Emits whenever the component state changes. */
|
---|
620 | _this.stateChanges = new rxjs.Subject();
|
---|
621 | /** Whether the component is in an error state. */
|
---|
622 | _this.errorState = false;
|
---|
623 | return _this;
|
---|
624 | }
|
---|
625 | /** Updates the error state based on the provided error state matcher. */
|
---|
626 | class_1.prototype.updateErrorState = function () {
|
---|
627 | var oldState = this.errorState;
|
---|
628 | var parent = this._parentFormGroup || this._parentForm;
|
---|
629 | var matcher = this.errorStateMatcher || this._defaultErrorStateMatcher;
|
---|
630 | var control = this.ngControl ? this.ngControl.control : null;
|
---|
631 | var newState = matcher.isErrorState(control, parent);
|
---|
632 | if (newState !== oldState) {
|
---|
633 | this.errorState = newState;
|
---|
634 | this.stateChanges.next();
|
---|
635 | }
|
---|
636 | };
|
---|
637 | return class_1;
|
---|
638 | }(base));
|
---|
639 | }
|
---|
640 |
|
---|
641 | /** Mixin to augment a directive with an initialized property that will emits when ngOnInit ends. */
|
---|
642 | function mixinInitialized(base) {
|
---|
643 | return /** @class */ (function (_super) {
|
---|
644 | __extends(class_1, _super);
|
---|
645 | function class_1() {
|
---|
646 | var args = [];
|
---|
647 | for (var _i = 0; _i < arguments.length; _i++) {
|
---|
648 | args[_i] = arguments[_i];
|
---|
649 | }
|
---|
650 | var _this = _super.apply(this, __spreadArray([], __read(args))) || this;
|
---|
651 | /** Whether this directive has been marked as initialized. */
|
---|
652 | _this._isInitialized = false;
|
---|
653 | /**
|
---|
654 | * List of subscribers that subscribed before the directive was initialized. Should be notified
|
---|
655 | * during _markInitialized. Set to null after pending subscribers are notified, and should
|
---|
656 | * not expect to be populated after.
|
---|
657 | */
|
---|
658 | _this._pendingSubscribers = [];
|
---|
659 | /**
|
---|
660 | * Observable stream that emits when the directive initializes. If already initialized, the
|
---|
661 | * subscriber is stored to be notified once _markInitialized is called.
|
---|
662 | */
|
---|
663 | _this.initialized = new rxjs.Observable(function (subscriber) {
|
---|
664 | // If initialized, immediately notify the subscriber. Otherwise store the subscriber to notify
|
---|
665 | // when _markInitialized is called.
|
---|
666 | if (_this._isInitialized) {
|
---|
667 | _this._notifySubscriber(subscriber);
|
---|
668 | }
|
---|
669 | else {
|
---|
670 | _this._pendingSubscribers.push(subscriber);
|
---|
671 | }
|
---|
672 | });
|
---|
673 | return _this;
|
---|
674 | }
|
---|
675 | /**
|
---|
676 | * Marks the state as initialized and notifies pending subscribers. Should be called at the end
|
---|
677 | * of ngOnInit.
|
---|
678 | * @docs-private
|
---|
679 | */
|
---|
680 | class_1.prototype._markInitialized = function () {
|
---|
681 | if (this._isInitialized && (typeof ngDevMode === 'undefined' || ngDevMode)) {
|
---|
682 | throw Error('This directive has already been marked as initialized and ' +
|
---|
683 | 'should not be called twice.');
|
---|
684 | }
|
---|
685 | this._isInitialized = true;
|
---|
686 | this._pendingSubscribers.forEach(this._notifySubscriber);
|
---|
687 | this._pendingSubscribers = null;
|
---|
688 | };
|
---|
689 | /** Emits and completes the subscriber stream (should only emit once). */
|
---|
690 | class_1.prototype._notifySubscriber = function (subscriber) {
|
---|
691 | subscriber.next();
|
---|
692 | subscriber.complete();
|
---|
693 | };
|
---|
694 | return class_1;
|
---|
695 | }(base));
|
---|
696 | }
|
---|
697 |
|
---|
698 | /**
|
---|
699 | * @license
|
---|
700 | * Copyright Google LLC All Rights Reserved.
|
---|
701 | *
|
---|
702 | * Use of this source code is governed by an MIT-style license that can be
|
---|
703 | * found in the LICENSE file at https://angular.io/license
|
---|
704 | */
|
---|
705 |
|
---|
706 | /**
|
---|
707 | * @license
|
---|
708 | * Copyright Google LLC All Rights Reserved.
|
---|
709 | *
|
---|
710 | * Use of this source code is governed by an MIT-style license that can be
|
---|
711 | * found in the LICENSE file at https://angular.io/license
|
---|
712 | */
|
---|
713 | /** InjectionToken for datepicker that can be used to override default locale code. */
|
---|
714 | var MAT_DATE_LOCALE = new i0.InjectionToken('MAT_DATE_LOCALE', {
|
---|
715 | providedIn: 'root',
|
---|
716 | factory: MAT_DATE_LOCALE_FACTORY,
|
---|
717 | });
|
---|
718 | /** @docs-private */
|
---|
719 | function MAT_DATE_LOCALE_FACTORY() {
|
---|
720 | return i0.inject(i0.LOCALE_ID);
|
---|
721 | }
|
---|
722 | /** Adapts type `D` to be usable as a date by cdk-based components that work with dates. */
|
---|
723 | var DateAdapter = /** @class */ (function () {
|
---|
724 | function DateAdapter() {
|
---|
725 | this._localeChanges = new rxjs.Subject();
|
---|
726 | /** A stream that emits when the locale changes. */
|
---|
727 | this.localeChanges = this._localeChanges;
|
---|
728 | }
|
---|
729 | /**
|
---|
730 | * Given a potential date object, returns that same date object if it is
|
---|
731 | * a valid date, or `null` if it's not a valid date.
|
---|
732 | * @param obj The object to check.
|
---|
733 | * @returns A date or `null`.
|
---|
734 | */
|
---|
735 | DateAdapter.prototype.getValidDateOrNull = function (obj) {
|
---|
736 | return this.isDateInstance(obj) && this.isValid(obj) ? obj : null;
|
---|
737 | };
|
---|
738 | /**
|
---|
739 | * Attempts to deserialize a value to a valid date object. This is different from parsing in that
|
---|
740 | * deserialize should only accept non-ambiguous, locale-independent formats (e.g. a ISO 8601
|
---|
741 | * string). The default implementation does not allow any deserialization, it simply checks that
|
---|
742 | * the given value is already a valid date object or null. The `<mat-datepicker>` will call this
|
---|
743 | * method on all of its `@Input()` properties that accept dates. It is therefore possible to
|
---|
744 | * support passing values from your backend directly to these properties by overriding this method
|
---|
745 | * to also deserialize the format used by your backend.
|
---|
746 | * @param value The value to be deserialized into a date object.
|
---|
747 | * @returns The deserialized date object, either a valid date, null if the value can be
|
---|
748 | * deserialized into a null date (e.g. the empty string), or an invalid date.
|
---|
749 | */
|
---|
750 | DateAdapter.prototype.deserialize = function (value) {
|
---|
751 | if (value == null || this.isDateInstance(value) && this.isValid(value)) {
|
---|
752 | return value;
|
---|
753 | }
|
---|
754 | return this.invalid();
|
---|
755 | };
|
---|
756 | /**
|
---|
757 | * Sets the locale used for all dates.
|
---|
758 | * @param locale The new locale.
|
---|
759 | */
|
---|
760 | DateAdapter.prototype.setLocale = function (locale) {
|
---|
761 | this.locale = locale;
|
---|
762 | this._localeChanges.next();
|
---|
763 | };
|
---|
764 | /**
|
---|
765 | * Compares two dates.
|
---|
766 | * @param first The first date to compare.
|
---|
767 | * @param second The second date to compare.
|
---|
768 | * @returns 0 if the dates are equal, a number less than 0 if the first date is earlier,
|
---|
769 | * a number greater than 0 if the first date is later.
|
---|
770 | */
|
---|
771 | DateAdapter.prototype.compareDate = function (first, second) {
|
---|
772 | return this.getYear(first) - this.getYear(second) ||
|
---|
773 | this.getMonth(first) - this.getMonth(second) ||
|
---|
774 | this.getDate(first) - this.getDate(second);
|
---|
775 | };
|
---|
776 | /**
|
---|
777 | * Checks if two dates are equal.
|
---|
778 | * @param first The first date to check.
|
---|
779 | * @param second The second date to check.
|
---|
780 | * @returns Whether the two dates are equal.
|
---|
781 | * Null dates are considered equal to other null dates.
|
---|
782 | */
|
---|
783 | DateAdapter.prototype.sameDate = function (first, second) {
|
---|
784 | if (first && second) {
|
---|
785 | var firstValid = this.isValid(first);
|
---|
786 | var secondValid = this.isValid(second);
|
---|
787 | if (firstValid && secondValid) {
|
---|
788 | return !this.compareDate(first, second);
|
---|
789 | }
|
---|
790 | return firstValid == secondValid;
|
---|
791 | }
|
---|
792 | return first == second;
|
---|
793 | };
|
---|
794 | /**
|
---|
795 | * Clamp the given date between min and max dates.
|
---|
796 | * @param date The date to clamp.
|
---|
797 | * @param min The minimum value to allow. If null or omitted no min is enforced.
|
---|
798 | * @param max The maximum value to allow. If null or omitted no max is enforced.
|
---|
799 | * @returns `min` if `date` is less than `min`, `max` if date is greater than `max`,
|
---|
800 | * otherwise `date`.
|
---|
801 | */
|
---|
802 | DateAdapter.prototype.clampDate = function (date, min, max) {
|
---|
803 | if (min && this.compareDate(date, min) < 0) {
|
---|
804 | return min;
|
---|
805 | }
|
---|
806 | if (max && this.compareDate(date, max) > 0) {
|
---|
807 | return max;
|
---|
808 | }
|
---|
809 | return date;
|
---|
810 | };
|
---|
811 | return DateAdapter;
|
---|
812 | }());
|
---|
813 |
|
---|
814 | /**
|
---|
815 | * @license
|
---|
816 | * Copyright Google LLC All Rights Reserved.
|
---|
817 | *
|
---|
818 | * Use of this source code is governed by an MIT-style license that can be
|
---|
819 | * found in the LICENSE file at https://angular.io/license
|
---|
820 | */
|
---|
821 | var MAT_DATE_FORMATS = new i0.InjectionToken('mat-date-formats');
|
---|
822 |
|
---|
823 | // TODO(mmalerba): Remove when we no longer support safari 9.
|
---|
824 | /** Whether the browser supports the Intl API. */
|
---|
825 | var SUPPORTS_INTL_API;
|
---|
826 | // We need a try/catch around the reference to `Intl`, because accessing it in some cases can
|
---|
827 | // cause IE to throw. These cases are tied to particular versions of Windows and can happen if
|
---|
828 | // the consumer is providing a polyfilled `Map`. See:
|
---|
829 | // https://github.com/Microsoft/ChakraCore/issues/3189
|
---|
830 | // https://github.com/angular/components/issues/15687
|
---|
831 | try {
|
---|
832 | SUPPORTS_INTL_API = typeof Intl != 'undefined';
|
---|
833 | }
|
---|
834 | catch (_a) {
|
---|
835 | SUPPORTS_INTL_API = false;
|
---|
836 | }
|
---|
837 | /** The default month names to use if Intl API is not available. */
|
---|
838 | var DEFAULT_MONTH_NAMES = {
|
---|
839 | 'long': [
|
---|
840 | 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September',
|
---|
841 | 'October', 'November', 'December'
|
---|
842 | ],
|
---|
843 | 'short': ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
---|
844 | 'narrow': ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D']
|
---|
845 | };
|
---|
846 | var ɵ0$1 = function (i) { return String(i + 1); };
|
---|
847 | /** The default date names to use if Intl API is not available. */
|
---|
848 | var DEFAULT_DATE_NAMES = range(31, ɵ0$1);
|
---|
849 | /** The default day of the week names to use if Intl API is not available. */
|
---|
850 | var DEFAULT_DAY_OF_WEEK_NAMES = {
|
---|
851 | 'long': ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
|
---|
852 | 'short': ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
|
---|
853 | 'narrow': ['S', 'M', 'T', 'W', 'T', 'F', 'S']
|
---|
854 | };
|
---|
855 | /**
|
---|
856 | * Matches strings that have the form of a valid RFC 3339 string
|
---|
857 | * (https://tools.ietf.org/html/rfc3339). Note that the string may not actually be a valid date
|
---|
858 | * because the regex will match strings an with out of bounds month, date, etc.
|
---|
859 | */
|
---|
860 | var ISO_8601_REGEX = /^\d{4}-\d{2}-\d{2}(?:T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|(?:(?:\+|-)\d{2}:\d{2}))?)?$/;
|
---|
861 | /** Creates an array and fills it with values. */
|
---|
862 | function range(length, valueFunction) {
|
---|
863 | var valuesArray = Array(length);
|
---|
864 | for (var i = 0; i < length; i++) {
|
---|
865 | valuesArray[i] = valueFunction(i);
|
---|
866 | }
|
---|
867 | return valuesArray;
|
---|
868 | }
|
---|
869 | /** Adapts the native JS Date for use with cdk-based components that work with dates. */
|
---|
870 | var NativeDateAdapter = /** @class */ (function (_super) {
|
---|
871 | __extends(NativeDateAdapter, _super);
|
---|
872 | function NativeDateAdapter(matDateLocale, platform) {
|
---|
873 | var _this = _super.call(this) || this;
|
---|
874 | /**
|
---|
875 | * Whether to use `timeZone: 'utc'` with `Intl.DateTimeFormat` when formatting dates.
|
---|
876 | * Without this `Intl.DateTimeFormat` sometimes chooses the wrong timeZone, which can throw off
|
---|
877 | * the result. (e.g. in the en-US locale `new Date(1800, 7, 14).toLocaleDateString()`
|
---|
878 | * will produce `'8/13/1800'`.
|
---|
879 | *
|
---|
880 | * TODO(mmalerba): drop this variable. It's not being used in the code right now. We're now
|
---|
881 | * getting the string representation of a Date object from its utc representation. We're keeping
|
---|
882 | * it here for sometime, just for precaution, in case we decide to revert some of these changes
|
---|
883 | * though.
|
---|
884 | */
|
---|
885 | _this.useUtcForDisplay = true;
|
---|
886 | _super.prototype.setLocale.call(_this, matDateLocale);
|
---|
887 | // IE does its own time zone correction, so we disable this on IE.
|
---|
888 | _this.useUtcForDisplay = !platform.TRIDENT;
|
---|
889 | _this._clampDate = platform.TRIDENT || platform.EDGE;
|
---|
890 | return _this;
|
---|
891 | }
|
---|
892 | NativeDateAdapter.prototype.getYear = function (date) {
|
---|
893 | return date.getFullYear();
|
---|
894 | };
|
---|
895 | NativeDateAdapter.prototype.getMonth = function (date) {
|
---|
896 | return date.getMonth();
|
---|
897 | };
|
---|
898 | NativeDateAdapter.prototype.getDate = function (date) {
|
---|
899 | return date.getDate();
|
---|
900 | };
|
---|
901 | NativeDateAdapter.prototype.getDayOfWeek = function (date) {
|
---|
902 | return date.getDay();
|
---|
903 | };
|
---|
904 | NativeDateAdapter.prototype.getMonthNames = function (style) {
|
---|
905 | var _this = this;
|
---|
906 | if (SUPPORTS_INTL_API) {
|
---|
907 | var dtf_1 = new Intl.DateTimeFormat(this.locale, { month: style, timeZone: 'utc' });
|
---|
908 | return range(12, function (i) { return _this._stripDirectionalityCharacters(_this._format(dtf_1, new Date(2017, i, 1))); });
|
---|
909 | }
|
---|
910 | return DEFAULT_MONTH_NAMES[style];
|
---|
911 | };
|
---|
912 | NativeDateAdapter.prototype.getDateNames = function () {
|
---|
913 | var _this = this;
|
---|
914 | if (SUPPORTS_INTL_API) {
|
---|
915 | var dtf_2 = new Intl.DateTimeFormat(this.locale, { day: 'numeric', timeZone: 'utc' });
|
---|
916 | return range(31, function (i) { return _this._stripDirectionalityCharacters(_this._format(dtf_2, new Date(2017, 0, i + 1))); });
|
---|
917 | }
|
---|
918 | return DEFAULT_DATE_NAMES;
|
---|
919 | };
|
---|
920 | NativeDateAdapter.prototype.getDayOfWeekNames = function (style) {
|
---|
921 | var _this = this;
|
---|
922 | if (SUPPORTS_INTL_API) {
|
---|
923 | var dtf_3 = new Intl.DateTimeFormat(this.locale, { weekday: style, timeZone: 'utc' });
|
---|
924 | return range(7, function (i) { return _this._stripDirectionalityCharacters(_this._format(dtf_3, new Date(2017, 0, i + 1))); });
|
---|
925 | }
|
---|
926 | return DEFAULT_DAY_OF_WEEK_NAMES[style];
|
---|
927 | };
|
---|
928 | NativeDateAdapter.prototype.getYearName = function (date) {
|
---|
929 | if (SUPPORTS_INTL_API) {
|
---|
930 | var dtf = new Intl.DateTimeFormat(this.locale, { year: 'numeric', timeZone: 'utc' });
|
---|
931 | return this._stripDirectionalityCharacters(this._format(dtf, date));
|
---|
932 | }
|
---|
933 | return String(this.getYear(date));
|
---|
934 | };
|
---|
935 | NativeDateAdapter.prototype.getFirstDayOfWeek = function () {
|
---|
936 | // We can't tell using native JS Date what the first day of the week is, we default to Sunday.
|
---|
937 | return 0;
|
---|
938 | };
|
---|
939 | NativeDateAdapter.prototype.getNumDaysInMonth = function (date) {
|
---|
940 | return this.getDate(this._createDateWithOverflow(this.getYear(date), this.getMonth(date) + 1, 0));
|
---|
941 | };
|
---|
942 | NativeDateAdapter.prototype.clone = function (date) {
|
---|
943 | return new Date(date.getTime());
|
---|
944 | };
|
---|
945 | NativeDateAdapter.prototype.createDate = function (year, month, date) {
|
---|
946 | if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
---|
947 | // Check for invalid month and date (except upper bound on date which we have to check after
|
---|
948 | // creating the Date).
|
---|
949 | if (month < 0 || month > 11) {
|
---|
950 | throw Error("Invalid month index \"" + month + "\". Month index has to be between 0 and 11.");
|
---|
951 | }
|
---|
952 | if (date < 1) {
|
---|
953 | throw Error("Invalid date \"" + date + "\". Date has to be greater than 0.");
|
---|
954 | }
|
---|
955 | }
|
---|
956 | var result = this._createDateWithOverflow(year, month, date);
|
---|
957 | // Check that the date wasn't above the upper bound for the month, causing the month to overflow
|
---|
958 | if (result.getMonth() != month && (typeof ngDevMode === 'undefined' || ngDevMode)) {
|
---|
959 | throw Error("Invalid date \"" + date + "\" for month with index \"" + month + "\".");
|
---|
960 | }
|
---|
961 | return result;
|
---|
962 | };
|
---|
963 | NativeDateAdapter.prototype.today = function () {
|
---|
964 | return new Date();
|
---|
965 | };
|
---|
966 | NativeDateAdapter.prototype.parse = function (value) {
|
---|
967 | // We have no way using the native JS Date to set the parse format or locale, so we ignore these
|
---|
968 | // parameters.
|
---|
969 | if (typeof value == 'number') {
|
---|
970 | return new Date(value);
|
---|
971 | }
|
---|
972 | return value ? new Date(Date.parse(value)) : null;
|
---|
973 | };
|
---|
974 | NativeDateAdapter.prototype.format = function (date, displayFormat) {
|
---|
975 | if (!this.isValid(date)) {
|
---|
976 | throw Error('NativeDateAdapter: Cannot format invalid date.');
|
---|
977 | }
|
---|
978 | if (SUPPORTS_INTL_API) {
|
---|
979 | // On IE and Edge the i18n API will throw a hard error that can crash the entire app
|
---|
980 | // if we attempt to format a date whose year is less than 1 or greater than 9999.
|
---|
981 | if (this._clampDate && (date.getFullYear() < 1 || date.getFullYear() > 9999)) {
|
---|
982 | date = this.clone(date);
|
---|
983 | date.setFullYear(Math.max(1, Math.min(9999, date.getFullYear())));
|
---|
984 | }
|
---|
985 | displayFormat = Object.assign(Object.assign({}, displayFormat), { timeZone: 'utc' });
|
---|
986 | var dtf = new Intl.DateTimeFormat(this.locale, displayFormat);
|
---|
987 | return this._stripDirectionalityCharacters(this._format(dtf, date));
|
---|
988 | }
|
---|
989 | return this._stripDirectionalityCharacters(date.toDateString());
|
---|
990 | };
|
---|
991 | NativeDateAdapter.prototype.addCalendarYears = function (date, years) {
|
---|
992 | return this.addCalendarMonths(date, years * 12);
|
---|
993 | };
|
---|
994 | NativeDateAdapter.prototype.addCalendarMonths = function (date, months) {
|
---|
995 | var newDate = this._createDateWithOverflow(this.getYear(date), this.getMonth(date) + months, this.getDate(date));
|
---|
996 | // It's possible to wind up in the wrong month if the original month has more days than the new
|
---|
997 | // month. In this case we want to go to the last day of the desired month.
|
---|
998 | // Note: the additional + 12 % 12 ensures we end up with a positive number, since JS % doesn't
|
---|
999 | // guarantee this.
|
---|
1000 | if (this.getMonth(newDate) != ((this.getMonth(date) + months) % 12 + 12) % 12) {
|
---|
1001 | newDate = this._createDateWithOverflow(this.getYear(newDate), this.getMonth(newDate), 0);
|
---|
1002 | }
|
---|
1003 | return newDate;
|
---|
1004 | };
|
---|
1005 | NativeDateAdapter.prototype.addCalendarDays = function (date, days) {
|
---|
1006 | return this._createDateWithOverflow(this.getYear(date), this.getMonth(date), this.getDate(date) + days);
|
---|
1007 | };
|
---|
1008 | NativeDateAdapter.prototype.toIso8601 = function (date) {
|
---|
1009 | return [
|
---|
1010 | date.getUTCFullYear(),
|
---|
1011 | this._2digit(date.getUTCMonth() + 1),
|
---|
1012 | this._2digit(date.getUTCDate())
|
---|
1013 | ].join('-');
|
---|
1014 | };
|
---|
1015 | /**
|
---|
1016 | * Returns the given value if given a valid Date or null. Deserializes valid ISO 8601 strings
|
---|
1017 | * (https://www.ietf.org/rfc/rfc3339.txt) into valid Dates and empty string into null. Returns an
|
---|
1018 | * invalid date for all other values.
|
---|
1019 | */
|
---|
1020 | NativeDateAdapter.prototype.deserialize = function (value) {
|
---|
1021 | if (typeof value === 'string') {
|
---|
1022 | if (!value) {
|
---|
1023 | return null;
|
---|
1024 | }
|
---|
1025 | // The `Date` constructor accepts formats other than ISO 8601, so we need to make sure the
|
---|
1026 | // string is the right format first.
|
---|
1027 | if (ISO_8601_REGEX.test(value)) {
|
---|
1028 | var date = new Date(value);
|
---|
1029 | if (this.isValid(date)) {
|
---|
1030 | return date;
|
---|
1031 | }
|
---|
1032 | }
|
---|
1033 | }
|
---|
1034 | return _super.prototype.deserialize.call(this, value);
|
---|
1035 | };
|
---|
1036 | NativeDateAdapter.prototype.isDateInstance = function (obj) {
|
---|
1037 | return obj instanceof Date;
|
---|
1038 | };
|
---|
1039 | NativeDateAdapter.prototype.isValid = function (date) {
|
---|
1040 | return !isNaN(date.getTime());
|
---|
1041 | };
|
---|
1042 | NativeDateAdapter.prototype.invalid = function () {
|
---|
1043 | return new Date(NaN);
|
---|
1044 | };
|
---|
1045 | /** Creates a date but allows the month and date to overflow. */
|
---|
1046 | NativeDateAdapter.prototype._createDateWithOverflow = function (year, month, date) {
|
---|
1047 | // Passing the year to the constructor causes year numbers <100 to be converted to 19xx.
|
---|
1048 | // To work around this we use `setFullYear` and `setHours` instead.
|
---|
1049 | var d = new Date();
|
---|
1050 | d.setFullYear(year, month, date);
|
---|
1051 | d.setHours(0, 0, 0, 0);
|
---|
1052 | return d;
|
---|
1053 | };
|
---|
1054 | /**
|
---|
1055 | * Pads a number to make it two digits.
|
---|
1056 | * @param n The number to pad.
|
---|
1057 | * @returns The padded number.
|
---|
1058 | */
|
---|
1059 | NativeDateAdapter.prototype._2digit = function (n) {
|
---|
1060 | return ('00' + n).slice(-2);
|
---|
1061 | };
|
---|
1062 | /**
|
---|
1063 | * Strip out unicode LTR and RTL characters. Edge and IE insert these into formatted dates while
|
---|
1064 | * other browsers do not. We remove them to make output consistent and because they interfere with
|
---|
1065 | * date parsing.
|
---|
1066 | * @param str The string to strip direction characters from.
|
---|
1067 | * @returns The stripped string.
|
---|
1068 | */
|
---|
1069 | NativeDateAdapter.prototype._stripDirectionalityCharacters = function (str) {
|
---|
1070 | return str.replace(/[\u200e\u200f]/g, '');
|
---|
1071 | };
|
---|
1072 | /**
|
---|
1073 | * When converting Date object to string, javascript built-in functions may return wrong
|
---|
1074 | * results because it applies its internal DST rules. The DST rules around the world change
|
---|
1075 | * very frequently, and the current valid rule is not always valid in previous years though.
|
---|
1076 | * We work around this problem building a new Date object which has its internal UTC
|
---|
1077 | * representation with the local date and time.
|
---|
1078 | * @param dtf Intl.DateTimeFormat object, containg the desired string format. It must have
|
---|
1079 | * timeZone set to 'utc' to work fine.
|
---|
1080 | * @param date Date from which we want to get the string representation according to dtf
|
---|
1081 | * @returns A Date object with its UTC representation based on the passed in date info
|
---|
1082 | */
|
---|
1083 | NativeDateAdapter.prototype._format = function (dtf, date) {
|
---|
1084 | // Passing the year to the constructor causes year numbers <100 to be converted to 19xx.
|
---|
1085 | // To work around this we use `setUTCFullYear` and `setUTCHours` instead.
|
---|
1086 | var d = new Date();
|
---|
1087 | d.setUTCFullYear(date.getFullYear(), date.getMonth(), date.getDate());
|
---|
1088 | d.setUTCHours(date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
|
---|
1089 | return dtf.format(d);
|
---|
1090 | };
|
---|
1091 | return NativeDateAdapter;
|
---|
1092 | }(DateAdapter));
|
---|
1093 | NativeDateAdapter.decorators = [
|
---|
1094 | { type: i0.Injectable }
|
---|
1095 | ];
|
---|
1096 | NativeDateAdapter.ctorParameters = function () { return [
|
---|
1097 | { type: String, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [MAT_DATE_LOCALE,] }] },
|
---|
1098 | { type: platform.Platform }
|
---|
1099 | ]; };
|
---|
1100 |
|
---|
1101 | /**
|
---|
1102 | * @license
|
---|
1103 | * Copyright Google LLC All Rights Reserved.
|
---|
1104 | *
|
---|
1105 | * Use of this source code is governed by an MIT-style license that can be
|
---|
1106 | * found in the LICENSE file at https://angular.io/license
|
---|
1107 | */
|
---|
1108 | var MAT_NATIVE_DATE_FORMATS = {
|
---|
1109 | parse: {
|
---|
1110 | dateInput: null,
|
---|
1111 | },
|
---|
1112 | display: {
|
---|
1113 | dateInput: { year: 'numeric', month: 'numeric', day: 'numeric' },
|
---|
1114 | monthYearLabel: { year: 'numeric', month: 'short' },
|
---|
1115 | dateA11yLabel: { year: 'numeric', month: 'long', day: 'numeric' },
|
---|
1116 | monthYearA11yLabel: { year: 'numeric', month: 'long' },
|
---|
1117 | }
|
---|
1118 | };
|
---|
1119 |
|
---|
1120 | /**
|
---|
1121 | * @license
|
---|
1122 | * Copyright Google LLC All Rights Reserved.
|
---|
1123 | *
|
---|
1124 | * Use of this source code is governed by an MIT-style license that can be
|
---|
1125 | * found in the LICENSE file at https://angular.io/license
|
---|
1126 | */
|
---|
1127 | var NativeDateModule = /** @class */ (function () {
|
---|
1128 | function NativeDateModule() {
|
---|
1129 | }
|
---|
1130 | return NativeDateModule;
|
---|
1131 | }());
|
---|
1132 | NativeDateModule.decorators = [
|
---|
1133 | { type: i0.NgModule, args: [{
|
---|
1134 | imports: [platform.PlatformModule],
|
---|
1135 | providers: [
|
---|
1136 | { provide: DateAdapter, useClass: NativeDateAdapter },
|
---|
1137 | ],
|
---|
1138 | },] }
|
---|
1139 | ];
|
---|
1140 | var ɵ0 = MAT_NATIVE_DATE_FORMATS;
|
---|
1141 | var MatNativeDateModule = /** @class */ (function () {
|
---|
1142 | function MatNativeDateModule() {
|
---|
1143 | }
|
---|
1144 | return MatNativeDateModule;
|
---|
1145 | }());
|
---|
1146 | MatNativeDateModule.decorators = [
|
---|
1147 | { type: i0.NgModule, args: [{
|
---|
1148 | imports: [NativeDateModule],
|
---|
1149 | providers: [{ provide: MAT_DATE_FORMATS, useValue: ɵ0 }],
|
---|
1150 | },] }
|
---|
1151 | ];
|
---|
1152 |
|
---|
1153 | /**
|
---|
1154 | * @license
|
---|
1155 | * Copyright Google LLC All Rights Reserved.
|
---|
1156 | *
|
---|
1157 | * Use of this source code is governed by an MIT-style license that can be
|
---|
1158 | * found in the LICENSE file at https://angular.io/license
|
---|
1159 | */
|
---|
1160 | /** Error state matcher that matches when a control is invalid and dirty. */
|
---|
1161 | var ShowOnDirtyErrorStateMatcher = /** @class */ (function () {
|
---|
1162 | function ShowOnDirtyErrorStateMatcher() {
|
---|
1163 | }
|
---|
1164 | ShowOnDirtyErrorStateMatcher.prototype.isErrorState = function (control, form) {
|
---|
1165 | return !!(control && control.invalid && (control.dirty || (form && form.submitted)));
|
---|
1166 | };
|
---|
1167 | return ShowOnDirtyErrorStateMatcher;
|
---|
1168 | }());
|
---|
1169 | ShowOnDirtyErrorStateMatcher.decorators = [
|
---|
1170 | { type: i0.Injectable }
|
---|
1171 | ];
|
---|
1172 | /** Provider that defines how form controls behave with regards to displaying error messages. */
|
---|
1173 | var ErrorStateMatcher = /** @class */ (function () {
|
---|
1174 | function ErrorStateMatcher() {
|
---|
1175 | }
|
---|
1176 | ErrorStateMatcher.prototype.isErrorState = function (control, form) {
|
---|
1177 | return !!(control && control.invalid && (control.touched || (form && form.submitted)));
|
---|
1178 | };
|
---|
1179 | return ErrorStateMatcher;
|
---|
1180 | }());
|
---|
1181 | ErrorStateMatcher.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function ErrorStateMatcher_Factory() { return new ErrorStateMatcher(); }, token: ErrorStateMatcher, providedIn: "root" });
|
---|
1182 | ErrorStateMatcher.decorators = [
|
---|
1183 | { type: i0.Injectable, args: [{ providedIn: 'root' },] }
|
---|
1184 | ];
|
---|
1185 |
|
---|
1186 | /**
|
---|
1187 | * @license
|
---|
1188 | * Copyright Google LLC All Rights Reserved.
|
---|
1189 | *
|
---|
1190 | * Use of this source code is governed by an MIT-style license that can be
|
---|
1191 | * found in the LICENSE file at https://angular.io/license
|
---|
1192 | */
|
---|
1193 | /**
|
---|
1194 | * Shared directive to count lines inside a text area, such as a list item.
|
---|
1195 | * Line elements can be extracted with a @ContentChildren(MatLine) query, then
|
---|
1196 | * counted by checking the query list's length.
|
---|
1197 | */
|
---|
1198 | var MatLine = /** @class */ (function () {
|
---|
1199 | function MatLine() {
|
---|
1200 | }
|
---|
1201 | return MatLine;
|
---|
1202 | }());
|
---|
1203 | MatLine.decorators = [
|
---|
1204 | { type: i0.Directive, args: [{
|
---|
1205 | selector: '[mat-line], [matLine]',
|
---|
1206 | host: { 'class': 'mat-line' }
|
---|
1207 | },] }
|
---|
1208 | ];
|
---|
1209 | /**
|
---|
1210 | * Helper that takes a query list of lines and sets the correct class on the host.
|
---|
1211 | * @docs-private
|
---|
1212 | */
|
---|
1213 | function setLines(lines, element, prefix) {
|
---|
1214 | if (prefix === void 0) { prefix = 'mat'; }
|
---|
1215 | // Note: doesn't need to unsubscribe, because `changes`
|
---|
1216 | // gets completed by Angular when the view is destroyed.
|
---|
1217 | lines.changes.pipe(operators.startWith(lines)).subscribe(function (_a) {
|
---|
1218 | var length = _a.length;
|
---|
1219 | setClass(element, prefix + "-2-line", false);
|
---|
1220 | setClass(element, prefix + "-3-line", false);
|
---|
1221 | setClass(element, prefix + "-multi-line", false);
|
---|
1222 | if (length === 2 || length === 3) {
|
---|
1223 | setClass(element, prefix + "-" + length + "-line", true);
|
---|
1224 | }
|
---|
1225 | else if (length > 3) {
|
---|
1226 | setClass(element, prefix + "-multi-line", true);
|
---|
1227 | }
|
---|
1228 | });
|
---|
1229 | }
|
---|
1230 | /** Adds or removes a class from an element. */
|
---|
1231 | function setClass(element, className, isAdd) {
|
---|
1232 | var classList = element.nativeElement.classList;
|
---|
1233 | isAdd ? classList.add(className) : classList.remove(className);
|
---|
1234 | }
|
---|
1235 | var MatLineModule = /** @class */ (function () {
|
---|
1236 | function MatLineModule() {
|
---|
1237 | }
|
---|
1238 | return MatLineModule;
|
---|
1239 | }());
|
---|
1240 | MatLineModule.decorators = [
|
---|
1241 | { type: i0.NgModule, args: [{
|
---|
1242 | imports: [MatCommonModule],
|
---|
1243 | exports: [MatLine, MatCommonModule],
|
---|
1244 | declarations: [MatLine],
|
---|
1245 | },] }
|
---|
1246 | ];
|
---|
1247 |
|
---|
1248 | /**
|
---|
1249 | * @license
|
---|
1250 | * Copyright Google LLC All Rights Reserved.
|
---|
1251 | *
|
---|
1252 | * Use of this source code is governed by an MIT-style license that can be
|
---|
1253 | * found in the LICENSE file at https://angular.io/license
|
---|
1254 | */
|
---|
1255 | /**
|
---|
1256 | * Reference to a previously launched ripple element.
|
---|
1257 | */
|
---|
1258 | var RippleRef = /** @class */ (function () {
|
---|
1259 | function RippleRef(_renderer,
|
---|
1260 | /** Reference to the ripple HTML element. */
|
---|
1261 | element,
|
---|
1262 | /** Ripple configuration used for the ripple. */
|
---|
1263 | config) {
|
---|
1264 | this._renderer = _renderer;
|
---|
1265 | this.element = element;
|
---|
1266 | this.config = config;
|
---|
1267 | /** Current state of the ripple. */
|
---|
1268 | this.state = 3 /* HIDDEN */;
|
---|
1269 | }
|
---|
1270 | /** Fades out the ripple element. */
|
---|
1271 | RippleRef.prototype.fadeOut = function () {
|
---|
1272 | this._renderer.fadeOutRipple(this);
|
---|
1273 | };
|
---|
1274 | return RippleRef;
|
---|
1275 | }());
|
---|
1276 |
|
---|
1277 | // TODO: import these values from `@material/ripple` eventually.
|
---|
1278 | /**
|
---|
1279 | * Default ripple animation configuration for ripples without an explicit
|
---|
1280 | * animation config specified.
|
---|
1281 | */
|
---|
1282 | var defaultRippleAnimationConfig = {
|
---|
1283 | enterDuration: 225,
|
---|
1284 | exitDuration: 150
|
---|
1285 | };
|
---|
1286 | /**
|
---|
1287 | * Timeout for ignoring mouse events. Mouse events will be temporary ignored after touch
|
---|
1288 | * events to avoid synthetic mouse events.
|
---|
1289 | */
|
---|
1290 | var ignoreMouseEventsTimeout = 800;
|
---|
1291 | /** Options that apply to all the event listeners that are bound by the ripple renderer. */
|
---|
1292 | var passiveEventOptions = platform.normalizePassiveListenerOptions({ passive: true });
|
---|
1293 | /** Events that signal that the pointer is down. */
|
---|
1294 | var pointerDownEvents = ['mousedown', 'touchstart'];
|
---|
1295 | /** Events that signal that the pointer is up. */
|
---|
1296 | var pointerUpEvents = ['mouseup', 'mouseleave', 'touchend', 'touchcancel'];
|
---|
1297 | /**
|
---|
1298 | * Helper service that performs DOM manipulations. Not intended to be used outside this module.
|
---|
1299 | * The constructor takes a reference to the ripple directive's host element and a map of DOM
|
---|
1300 | * event handlers to be installed on the element that triggers ripple animations.
|
---|
1301 | * This will eventually become a custom renderer once Angular support exists.
|
---|
1302 | * @docs-private
|
---|
1303 | */
|
---|
1304 | var RippleRenderer = /** @class */ (function () {
|
---|
1305 | function RippleRenderer(_target, _ngZone, elementOrElementRef, platform) {
|
---|
1306 | this._target = _target;
|
---|
1307 | this._ngZone = _ngZone;
|
---|
1308 | /** Whether the pointer is currently down or not. */
|
---|
1309 | this._isPointerDown = false;
|
---|
1310 | /** Set of currently active ripple references. */
|
---|
1311 | this._activeRipples = new Set();
|
---|
1312 | /** Whether pointer-up event listeners have been registered. */
|
---|
1313 | this._pointerUpEventsRegistered = false;
|
---|
1314 | // Only do anything if we're on the browser.
|
---|
1315 | if (platform.isBrowser) {
|
---|
1316 | this._containerElement = coercion.coerceElement(elementOrElementRef);
|
---|
1317 | }
|
---|
1318 | }
|
---|
1319 | /**
|
---|
1320 | * Fades in a ripple at the given coordinates.
|
---|
1321 | * @param x Coordinate within the element, along the X axis at which to start the ripple.
|
---|
1322 | * @param y Coordinate within the element, along the Y axis at which to start the ripple.
|
---|
1323 | * @param config Extra ripple options.
|
---|
1324 | */
|
---|
1325 | RippleRenderer.prototype.fadeInRipple = function (x, y, config) {
|
---|
1326 | var _this = this;
|
---|
1327 | if (config === void 0) { config = {}; }
|
---|
1328 | var containerRect = this._containerRect =
|
---|
1329 | this._containerRect || this._containerElement.getBoundingClientRect();
|
---|
1330 | var animationConfig = Object.assign(Object.assign({}, defaultRippleAnimationConfig), config.animation);
|
---|
1331 | if (config.centered) {
|
---|
1332 | x = containerRect.left + containerRect.width / 2;
|
---|
1333 | y = containerRect.top + containerRect.height / 2;
|
---|
1334 | }
|
---|
1335 | var radius = config.radius || distanceToFurthestCorner(x, y, containerRect);
|
---|
1336 | var offsetX = x - containerRect.left;
|
---|
1337 | var offsetY = y - containerRect.top;
|
---|
1338 | var duration = animationConfig.enterDuration;
|
---|
1339 | var ripple = document.createElement('div');
|
---|
1340 | ripple.classList.add('mat-ripple-element');
|
---|
1341 | ripple.style.left = offsetX - radius + "px";
|
---|
1342 | ripple.style.top = offsetY - radius + "px";
|
---|
1343 | ripple.style.height = radius * 2 + "px";
|
---|
1344 | ripple.style.width = radius * 2 + "px";
|
---|
1345 | // If a custom color has been specified, set it as inline style. If no color is
|
---|
1346 | // set, the default color will be applied through the ripple theme styles.
|
---|
1347 | if (config.color != null) {
|
---|
1348 | ripple.style.backgroundColor = config.color;
|
---|
1349 | }
|
---|
1350 | ripple.style.transitionDuration = duration + "ms";
|
---|
1351 | this._containerElement.appendChild(ripple);
|
---|
1352 | // By default the browser does not recalculate the styles of dynamically created
|
---|
1353 | // ripple elements. This is critical because then the `scale` would not animate properly.
|
---|
1354 | enforceStyleRecalculation(ripple);
|
---|
1355 | ripple.style.transform = 'scale(1)';
|
---|
1356 | // Exposed reference to the ripple that will be returned.
|
---|
1357 | var rippleRef = new RippleRef(this, ripple, config);
|
---|
1358 | rippleRef.state = 0 /* FADING_IN */;
|
---|
1359 | // Add the ripple reference to the list of all active ripples.
|
---|
1360 | this._activeRipples.add(rippleRef);
|
---|
1361 | if (!config.persistent) {
|
---|
1362 | this._mostRecentTransientRipple = rippleRef;
|
---|
1363 | }
|
---|
1364 | // Wait for the ripple element to be completely faded in.
|
---|
1365 | // Once it's faded in, the ripple can be hidden immediately if the mouse is released.
|
---|
1366 | this._runTimeoutOutsideZone(function () {
|
---|
1367 | var isMostRecentTransientRipple = rippleRef === _this._mostRecentTransientRipple;
|
---|
1368 | rippleRef.state = 1 /* VISIBLE */;
|
---|
1369 | // When the timer runs out while the user has kept their pointer down, we want to
|
---|
1370 | // keep only the persistent ripples and the latest transient ripple. We do this,
|
---|
1371 | // because we don't want stacked transient ripples to appear after their enter
|
---|
1372 | // animation has finished.
|
---|
1373 | if (!config.persistent && (!isMostRecentTransientRipple || !_this._isPointerDown)) {
|
---|
1374 | rippleRef.fadeOut();
|
---|
1375 | }
|
---|
1376 | }, duration);
|
---|
1377 | return rippleRef;
|
---|
1378 | };
|
---|
1379 | /** Fades out a ripple reference. */
|
---|
1380 | RippleRenderer.prototype.fadeOutRipple = function (rippleRef) {
|
---|
1381 | var wasActive = this._activeRipples.delete(rippleRef);
|
---|
1382 | if (rippleRef === this._mostRecentTransientRipple) {
|
---|
1383 | this._mostRecentTransientRipple = null;
|
---|
1384 | }
|
---|
1385 | // Clear out the cached bounding rect if we have no more ripples.
|
---|
1386 | if (!this._activeRipples.size) {
|
---|
1387 | this._containerRect = null;
|
---|
1388 | }
|
---|
1389 | // For ripples that are not active anymore, don't re-run the fade-out animation.
|
---|
1390 | if (!wasActive) {
|
---|
1391 | return;
|
---|
1392 | }
|
---|
1393 | var rippleEl = rippleRef.element;
|
---|
1394 | var animationConfig = Object.assign(Object.assign({}, defaultRippleAnimationConfig), rippleRef.config.animation);
|
---|
1395 | rippleEl.style.transitionDuration = animationConfig.exitDuration + "ms";
|
---|
1396 | rippleEl.style.opacity = '0';
|
---|
1397 | rippleRef.state = 2 /* FADING_OUT */;
|
---|
1398 | // Once the ripple faded out, the ripple can be safely removed from the DOM.
|
---|
1399 | this._runTimeoutOutsideZone(function () {
|
---|
1400 | rippleRef.state = 3 /* HIDDEN */;
|
---|
1401 | rippleEl.parentNode.removeChild(rippleEl);
|
---|
1402 | }, animationConfig.exitDuration);
|
---|
1403 | };
|
---|
1404 | /** Fades out all currently active ripples. */
|
---|
1405 | RippleRenderer.prototype.fadeOutAll = function () {
|
---|
1406 | this._activeRipples.forEach(function (ripple) { return ripple.fadeOut(); });
|
---|
1407 | };
|
---|
1408 | /** Fades out all currently active non-persistent ripples. */
|
---|
1409 | RippleRenderer.prototype.fadeOutAllNonPersistent = function () {
|
---|
1410 | this._activeRipples.forEach(function (ripple) {
|
---|
1411 | if (!ripple.config.persistent) {
|
---|
1412 | ripple.fadeOut();
|
---|
1413 | }
|
---|
1414 | });
|
---|
1415 | };
|
---|
1416 | /** Sets up the trigger event listeners */
|
---|
1417 | RippleRenderer.prototype.setupTriggerEvents = function (elementOrElementRef) {
|
---|
1418 | var element = coercion.coerceElement(elementOrElementRef);
|
---|
1419 | if (!element || element === this._triggerElement) {
|
---|
1420 | return;
|
---|
1421 | }
|
---|
1422 | // Remove all previously registered event listeners from the trigger element.
|
---|
1423 | this._removeTriggerEvents();
|
---|
1424 | this._triggerElement = element;
|
---|
1425 | this._registerEvents(pointerDownEvents);
|
---|
1426 | };
|
---|
1427 | /**
|
---|
1428 | * Handles all registered events.
|
---|
1429 | * @docs-private
|
---|
1430 | */
|
---|
1431 | RippleRenderer.prototype.handleEvent = function (event) {
|
---|
1432 | if (event.type === 'mousedown') {
|
---|
1433 | this._onMousedown(event);
|
---|
1434 | }
|
---|
1435 | else if (event.type === 'touchstart') {
|
---|
1436 | this._onTouchStart(event);
|
---|
1437 | }
|
---|
1438 | else {
|
---|
1439 | this._onPointerUp();
|
---|
1440 | }
|
---|
1441 | // If pointer-up events haven't been registered yet, do so now.
|
---|
1442 | // We do this on-demand in order to reduce the total number of event listeners
|
---|
1443 | // registered by the ripples, which speeds up the rendering time for large UIs.
|
---|
1444 | if (!this._pointerUpEventsRegistered) {
|
---|
1445 | this._registerEvents(pointerUpEvents);
|
---|
1446 | this._pointerUpEventsRegistered = true;
|
---|
1447 | }
|
---|
1448 | };
|
---|
1449 | /** Function being called whenever the trigger is being pressed using mouse. */
|
---|
1450 | RippleRenderer.prototype._onMousedown = function (event) {
|
---|
1451 | // Screen readers will fire fake mouse events for space/enter. Skip launching a
|
---|
1452 | // ripple in this case for consistency with the non-screen-reader experience.
|
---|
1453 | var isFakeMousedown = a11y.isFakeMousedownFromScreenReader(event);
|
---|
1454 | var isSyntheticEvent = this._lastTouchStartEvent &&
|
---|
1455 | Date.now() < this._lastTouchStartEvent + ignoreMouseEventsTimeout;
|
---|
1456 | if (!this._target.rippleDisabled && !isFakeMousedown && !isSyntheticEvent) {
|
---|
1457 | this._isPointerDown = true;
|
---|
1458 | this.fadeInRipple(event.clientX, event.clientY, this._target.rippleConfig);
|
---|
1459 | }
|
---|
1460 | };
|
---|
1461 | /** Function being called whenever the trigger is being pressed using touch. */
|
---|
1462 | RippleRenderer.prototype._onTouchStart = function (event) {
|
---|
1463 | if (!this._target.rippleDisabled && !a11y.isFakeTouchstartFromScreenReader(event)) {
|
---|
1464 | // Some browsers fire mouse events after a `touchstart` event. Those synthetic mouse
|
---|
1465 | // events will launch a second ripple if we don't ignore mouse events for a specific
|
---|
1466 | // time after a touchstart event.
|
---|
1467 | this._lastTouchStartEvent = Date.now();
|
---|
1468 | this._isPointerDown = true;
|
---|
1469 | // Use `changedTouches` so we skip any touches where the user put
|
---|
1470 | // their finger down, but used another finger to tap the element again.
|
---|
1471 | var touches = event.changedTouches;
|
---|
1472 | for (var i = 0; i < touches.length; i++) {
|
---|
1473 | this.fadeInRipple(touches[i].clientX, touches[i].clientY, this._target.rippleConfig);
|
---|
1474 | }
|
---|
1475 | }
|
---|
1476 | };
|
---|
1477 | /** Function being called whenever the trigger is being released. */
|
---|
1478 | RippleRenderer.prototype._onPointerUp = function () {
|
---|
1479 | if (!this._isPointerDown) {
|
---|
1480 | return;
|
---|
1481 | }
|
---|
1482 | this._isPointerDown = false;
|
---|
1483 | // Fade-out all ripples that are visible and not persistent.
|
---|
1484 | this._activeRipples.forEach(function (ripple) {
|
---|
1485 | // By default, only ripples that are completely visible will fade out on pointer release.
|
---|
1486 | // If the `terminateOnPointerUp` option is set, ripples that still fade in will also fade out.
|
---|
1487 | var isVisible = ripple.state === 1 /* VISIBLE */ ||
|
---|
1488 | ripple.config.terminateOnPointerUp && ripple.state === 0 /* FADING_IN */;
|
---|
1489 | if (!ripple.config.persistent && isVisible) {
|
---|
1490 | ripple.fadeOut();
|
---|
1491 | }
|
---|
1492 | });
|
---|
1493 | };
|
---|
1494 | /** Runs a timeout outside of the Angular zone to avoid triggering the change detection. */
|
---|
1495 | RippleRenderer.prototype._runTimeoutOutsideZone = function (fn, delay) {
|
---|
1496 | if (delay === void 0) { delay = 0; }
|
---|
1497 | this._ngZone.runOutsideAngular(function () { return setTimeout(fn, delay); });
|
---|
1498 | };
|
---|
1499 | /** Registers event listeners for a given list of events. */
|
---|
1500 | RippleRenderer.prototype._registerEvents = function (eventTypes) {
|
---|
1501 | var _this = this;
|
---|
1502 | this._ngZone.runOutsideAngular(function () {
|
---|
1503 | eventTypes.forEach(function (type) {
|
---|
1504 | _this._triggerElement.addEventListener(type, _this, passiveEventOptions);
|
---|
1505 | });
|
---|
1506 | });
|
---|
1507 | };
|
---|
1508 | /** Removes previously registered event listeners from the trigger element. */
|
---|
1509 | RippleRenderer.prototype._removeTriggerEvents = function () {
|
---|
1510 | var _this = this;
|
---|
1511 | if (this._triggerElement) {
|
---|
1512 | pointerDownEvents.forEach(function (type) {
|
---|
1513 | _this._triggerElement.removeEventListener(type, _this, passiveEventOptions);
|
---|
1514 | });
|
---|
1515 | if (this._pointerUpEventsRegistered) {
|
---|
1516 | pointerUpEvents.forEach(function (type) {
|
---|
1517 | _this._triggerElement.removeEventListener(type, _this, passiveEventOptions);
|
---|
1518 | });
|
---|
1519 | }
|
---|
1520 | }
|
---|
1521 | };
|
---|
1522 | return RippleRenderer;
|
---|
1523 | }());
|
---|
1524 | /** Enforces a style recalculation of a DOM element by computing its styles. */
|
---|
1525 | function enforceStyleRecalculation(element) {
|
---|
1526 | // Enforce a style recalculation by calling `getComputedStyle` and accessing any property.
|
---|
1527 | // Calling `getPropertyValue` is important to let optimizers know that this is not a noop.
|
---|
1528 | // See: https://gist.github.com/paulirish/5d52fb081b3570c81e3a
|
---|
1529 | window.getComputedStyle(element).getPropertyValue('opacity');
|
---|
1530 | }
|
---|
1531 | /**
|
---|
1532 | * Returns the distance from the point (x, y) to the furthest corner of a rectangle.
|
---|
1533 | */
|
---|
1534 | function distanceToFurthestCorner(x, y, rect) {
|
---|
1535 | var distX = Math.max(Math.abs(x - rect.left), Math.abs(x - rect.right));
|
---|
1536 | var distY = Math.max(Math.abs(y - rect.top), Math.abs(y - rect.bottom));
|
---|
1537 | return Math.sqrt(distX * distX + distY * distY);
|
---|
1538 | }
|
---|
1539 |
|
---|
1540 | /**
|
---|
1541 | * @license
|
---|
1542 | * Copyright Google LLC All Rights Reserved.
|
---|
1543 | *
|
---|
1544 | * Use of this source code is governed by an MIT-style license that can be
|
---|
1545 | * found in the LICENSE file at https://angular.io/license
|
---|
1546 | */
|
---|
1547 | /** Injection token that can be used to specify the global ripple options. */
|
---|
1548 | var MAT_RIPPLE_GLOBAL_OPTIONS = new i0.InjectionToken('mat-ripple-global-options');
|
---|
1549 | var MatRipple = /** @class */ (function () {
|
---|
1550 | function MatRipple(_elementRef, ngZone, platform, globalOptions, _animationMode) {
|
---|
1551 | this._elementRef = _elementRef;
|
---|
1552 | this._animationMode = _animationMode;
|
---|
1553 | /**
|
---|
1554 | * If set, the radius in pixels of foreground ripples when fully expanded. If unset, the radius
|
---|
1555 | * will be the distance from the center of the ripple to the furthest corner of the host element's
|
---|
1556 | * bounding rectangle.
|
---|
1557 | */
|
---|
1558 | this.radius = 0;
|
---|
1559 | this._disabled = false;
|
---|
1560 | /** Whether ripple directive is initialized and the input bindings are set. */
|
---|
1561 | this._isInitialized = false;
|
---|
1562 | this._globalOptions = globalOptions || {};
|
---|
1563 | this._rippleRenderer = new RippleRenderer(this, ngZone, _elementRef, platform);
|
---|
1564 | }
|
---|
1565 | Object.defineProperty(MatRipple.prototype, "disabled", {
|
---|
1566 | /**
|
---|
1567 | * Whether click events will not trigger the ripple. Ripples can be still launched manually
|
---|
1568 | * by using the `launch()` method.
|
---|
1569 | */
|
---|
1570 | get: function () { return this._disabled; },
|
---|
1571 | set: function (value) {
|
---|
1572 | if (value) {
|
---|
1573 | this.fadeOutAllNonPersistent();
|
---|
1574 | }
|
---|
1575 | this._disabled = value;
|
---|
1576 | this._setupTriggerEventsIfEnabled();
|
---|
1577 | },
|
---|
1578 | enumerable: false,
|
---|
1579 | configurable: true
|
---|
1580 | });
|
---|
1581 | Object.defineProperty(MatRipple.prototype, "trigger", {
|
---|
1582 | /**
|
---|
1583 | * The element that triggers the ripple when click events are received.
|
---|
1584 | * Defaults to the directive's host element.
|
---|
1585 | */
|
---|
1586 | get: function () { return this._trigger || this._elementRef.nativeElement; },
|
---|
1587 | set: function (trigger) {
|
---|
1588 | this._trigger = trigger;
|
---|
1589 | this._setupTriggerEventsIfEnabled();
|
---|
1590 | },
|
---|
1591 | enumerable: false,
|
---|
1592 | configurable: true
|
---|
1593 | });
|
---|
1594 | MatRipple.prototype.ngOnInit = function () {
|
---|
1595 | this._isInitialized = true;
|
---|
1596 | this._setupTriggerEventsIfEnabled();
|
---|
1597 | };
|
---|
1598 | MatRipple.prototype.ngOnDestroy = function () {
|
---|
1599 | this._rippleRenderer._removeTriggerEvents();
|
---|
1600 | };
|
---|
1601 | /** Fades out all currently showing ripple elements. */
|
---|
1602 | MatRipple.prototype.fadeOutAll = function () {
|
---|
1603 | this._rippleRenderer.fadeOutAll();
|
---|
1604 | };
|
---|
1605 | /** Fades out all currently showing non-persistent ripple elements. */
|
---|
1606 | MatRipple.prototype.fadeOutAllNonPersistent = function () {
|
---|
1607 | this._rippleRenderer.fadeOutAllNonPersistent();
|
---|
1608 | };
|
---|
1609 | Object.defineProperty(MatRipple.prototype, "rippleConfig", {
|
---|
1610 | /**
|
---|
1611 | * Ripple configuration from the directive's input values.
|
---|
1612 | * @docs-private Implemented as part of RippleTarget
|
---|
1613 | */
|
---|
1614 | get: function () {
|
---|
1615 | return {
|
---|
1616 | centered: this.centered,
|
---|
1617 | radius: this.radius,
|
---|
1618 | color: this.color,
|
---|
1619 | animation: Object.assign(Object.assign(Object.assign({}, this._globalOptions.animation), (this._animationMode === 'NoopAnimations' ? { enterDuration: 0, exitDuration: 0 } : {})), this.animation),
|
---|
1620 | terminateOnPointerUp: this._globalOptions.terminateOnPointerUp,
|
---|
1621 | };
|
---|
1622 | },
|
---|
1623 | enumerable: false,
|
---|
1624 | configurable: true
|
---|
1625 | });
|
---|
1626 | Object.defineProperty(MatRipple.prototype, "rippleDisabled", {
|
---|
1627 | /**
|
---|
1628 | * Whether ripples on pointer-down are disabled or not.
|
---|
1629 | * @docs-private Implemented as part of RippleTarget
|
---|
1630 | */
|
---|
1631 | get: function () {
|
---|
1632 | return this.disabled || !!this._globalOptions.disabled;
|
---|
1633 | },
|
---|
1634 | enumerable: false,
|
---|
1635 | configurable: true
|
---|
1636 | });
|
---|
1637 | /** Sets up the trigger event listeners if ripples are enabled. */
|
---|
1638 | MatRipple.prototype._setupTriggerEventsIfEnabled = function () {
|
---|
1639 | if (!this.disabled && this._isInitialized) {
|
---|
1640 | this._rippleRenderer.setupTriggerEvents(this.trigger);
|
---|
1641 | }
|
---|
1642 | };
|
---|
1643 | /** Launches a manual ripple at the specified coordinated or just by the ripple config. */
|
---|
1644 | MatRipple.prototype.launch = function (configOrX, y, config) {
|
---|
1645 | if (y === void 0) { y = 0; }
|
---|
1646 | if (typeof configOrX === 'number') {
|
---|
1647 | return this._rippleRenderer.fadeInRipple(configOrX, y, Object.assign(Object.assign({}, this.rippleConfig), config));
|
---|
1648 | }
|
---|
1649 | else {
|
---|
1650 | return this._rippleRenderer.fadeInRipple(0, 0, Object.assign(Object.assign({}, this.rippleConfig), configOrX));
|
---|
1651 | }
|
---|
1652 | };
|
---|
1653 | return MatRipple;
|
---|
1654 | }());
|
---|
1655 | MatRipple.decorators = [
|
---|
1656 | { type: i0.Directive, args: [{
|
---|
1657 | selector: '[mat-ripple], [matRipple]',
|
---|
1658 | exportAs: 'matRipple',
|
---|
1659 | host: {
|
---|
1660 | 'class': 'mat-ripple',
|
---|
1661 | '[class.mat-ripple-unbounded]': 'unbounded'
|
---|
1662 | }
|
---|
1663 | },] }
|
---|
1664 | ];
|
---|
1665 | MatRipple.ctorParameters = function () { return [
|
---|
1666 | { type: i0.ElementRef },
|
---|
1667 | { type: i0.NgZone },
|
---|
1668 | { type: platform.Platform },
|
---|
1669 | { type: undefined, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [MAT_RIPPLE_GLOBAL_OPTIONS,] }] },
|
---|
1670 | { type: String, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
|
---|
1671 | ]; };
|
---|
1672 | MatRipple.propDecorators = {
|
---|
1673 | color: [{ type: i0.Input, args: ['matRippleColor',] }],
|
---|
1674 | unbounded: [{ type: i0.Input, args: ['matRippleUnbounded',] }],
|
---|
1675 | centered: [{ type: i0.Input, args: ['matRippleCentered',] }],
|
---|
1676 | radius: [{ type: i0.Input, args: ['matRippleRadius',] }],
|
---|
1677 | animation: [{ type: i0.Input, args: ['matRippleAnimation',] }],
|
---|
1678 | disabled: [{ type: i0.Input, args: ['matRippleDisabled',] }],
|
---|
1679 | trigger: [{ type: i0.Input, args: ['matRippleTrigger',] }]
|
---|
1680 | };
|
---|
1681 |
|
---|
1682 | /**
|
---|
1683 | * @license
|
---|
1684 | * Copyright Google LLC All Rights Reserved.
|
---|
1685 | *
|
---|
1686 | * Use of this source code is governed by an MIT-style license that can be
|
---|
1687 | * found in the LICENSE file at https://angular.io/license
|
---|
1688 | */
|
---|
1689 | var MatRippleModule = /** @class */ (function () {
|
---|
1690 | function MatRippleModule() {
|
---|
1691 | }
|
---|
1692 | return MatRippleModule;
|
---|
1693 | }());
|
---|
1694 | MatRippleModule.decorators = [
|
---|
1695 | { type: i0.NgModule, args: [{
|
---|
1696 | imports: [MatCommonModule, platform.PlatformModule],
|
---|
1697 | exports: [MatRipple, MatCommonModule],
|
---|
1698 | declarations: [MatRipple],
|
---|
1699 | },] }
|
---|
1700 | ];
|
---|
1701 |
|
---|
1702 | /**
|
---|
1703 | * @license
|
---|
1704 | * Copyright Google LLC All Rights Reserved.
|
---|
1705 | *
|
---|
1706 | * Use of this source code is governed by an MIT-style license that can be
|
---|
1707 | * found in the LICENSE file at https://angular.io/license
|
---|
1708 | */
|
---|
1709 | /**
|
---|
1710 | * Component that shows a simplified checkbox without including any kind of "real" checkbox.
|
---|
1711 | * Meant to be used when the checkbox is purely decorative and a large number of them will be
|
---|
1712 | * included, such as for the options in a multi-select. Uses no SVGs or complex animations.
|
---|
1713 | * Note that theming is meant to be handled by the parent element, e.g.
|
---|
1714 | * `mat-primary .mat-pseudo-checkbox`.
|
---|
1715 | *
|
---|
1716 | * Note that this component will be completely invisible to screen-reader users. This is *not*
|
---|
1717 | * interchangeable with `<mat-checkbox>` and should *not* be used if the user would directly
|
---|
1718 | * interact with the checkbox. The pseudo-checkbox should only be used as an implementation detail
|
---|
1719 | * of more complex components that appropriately handle selected / checked state.
|
---|
1720 | * @docs-private
|
---|
1721 | */
|
---|
1722 | var MatPseudoCheckbox = /** @class */ (function () {
|
---|
1723 | function MatPseudoCheckbox(_animationMode) {
|
---|
1724 | this._animationMode = _animationMode;
|
---|
1725 | /** Display state of the checkbox. */
|
---|
1726 | this.state = 'unchecked';
|
---|
1727 | /** Whether the checkbox is disabled. */
|
---|
1728 | this.disabled = false;
|
---|
1729 | }
|
---|
1730 | return MatPseudoCheckbox;
|
---|
1731 | }());
|
---|
1732 | MatPseudoCheckbox.decorators = [
|
---|
1733 | { type: i0.Component, args: [{
|
---|
1734 | encapsulation: i0.ViewEncapsulation.None,
|
---|
1735 | changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
---|
1736 | selector: 'mat-pseudo-checkbox',
|
---|
1737 | template: '',
|
---|
1738 | host: {
|
---|
1739 | 'class': 'mat-pseudo-checkbox',
|
---|
1740 | '[class.mat-pseudo-checkbox-indeterminate]': 'state === "indeterminate"',
|
---|
1741 | '[class.mat-pseudo-checkbox-checked]': 'state === "checked"',
|
---|
1742 | '[class.mat-pseudo-checkbox-disabled]': 'disabled',
|
---|
1743 | '[class._mat-animation-noopable]': '_animationMode === "NoopAnimations"',
|
---|
1744 | },
|
---|
1745 | styles: [".mat-pseudo-checkbox{width:16px;height:16px;border:2px solid;border-radius:2px;cursor:pointer;display:inline-block;vertical-align:middle;box-sizing:border-box;position:relative;flex-shrink:0;transition:border-color 90ms cubic-bezier(0, 0, 0.2, 0.1),background-color 90ms cubic-bezier(0, 0, 0.2, 0.1)}.mat-pseudo-checkbox::after{position:absolute;opacity:0;content:\"\";border-bottom:2px solid currentColor;transition:opacity 90ms cubic-bezier(0, 0, 0.2, 0.1)}.mat-pseudo-checkbox.mat-pseudo-checkbox-checked,.mat-pseudo-checkbox.mat-pseudo-checkbox-indeterminate{border-color:transparent}._mat-animation-noopable.mat-pseudo-checkbox{transition:none;animation:none}._mat-animation-noopable.mat-pseudo-checkbox::after{transition:none}.mat-pseudo-checkbox-disabled{cursor:default}.mat-pseudo-checkbox-indeterminate::after{top:5px;left:1px;width:10px;opacity:1;border-radius:2px}.mat-pseudo-checkbox-checked::after{top:2.4px;left:1px;width:8px;height:3px;border-left:2px solid currentColor;transform:rotate(-45deg);opacity:1;box-sizing:content-box}\n"]
|
---|
1746 | },] }
|
---|
1747 | ];
|
---|
1748 | MatPseudoCheckbox.ctorParameters = function () { return [
|
---|
1749 | { type: String, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
|
---|
1750 | ]; };
|
---|
1751 | MatPseudoCheckbox.propDecorators = {
|
---|
1752 | state: [{ type: i0.Input }],
|
---|
1753 | disabled: [{ type: i0.Input }]
|
---|
1754 | };
|
---|
1755 |
|
---|
1756 | /**
|
---|
1757 | * @license
|
---|
1758 | * Copyright Google LLC All Rights Reserved.
|
---|
1759 | *
|
---|
1760 | * Use of this source code is governed by an MIT-style license that can be
|
---|
1761 | * found in the LICENSE file at https://angular.io/license
|
---|
1762 | */
|
---|
1763 | var MatPseudoCheckboxModule = /** @class */ (function () {
|
---|
1764 | function MatPseudoCheckboxModule() {
|
---|
1765 | }
|
---|
1766 | return MatPseudoCheckboxModule;
|
---|
1767 | }());
|
---|
1768 | MatPseudoCheckboxModule.decorators = [
|
---|
1769 | { type: i0.NgModule, args: [{
|
---|
1770 | imports: [MatCommonModule],
|
---|
1771 | exports: [MatPseudoCheckbox],
|
---|
1772 | declarations: [MatPseudoCheckbox]
|
---|
1773 | },] }
|
---|
1774 | ];
|
---|
1775 |
|
---|
1776 | /**
|
---|
1777 | * @license
|
---|
1778 | * Copyright Google LLC All Rights Reserved.
|
---|
1779 | *
|
---|
1780 | * Use of this source code is governed by an MIT-style license that can be
|
---|
1781 | * found in the LICENSE file at https://angular.io/license
|
---|
1782 | */
|
---|
1783 | /**
|
---|
1784 | * Injection token used to provide the parent component to options.
|
---|
1785 | */
|
---|
1786 | var MAT_OPTION_PARENT_COMPONENT = new i0.InjectionToken('MAT_OPTION_PARENT_COMPONENT');
|
---|
1787 |
|
---|
1788 | // Notes on the accessibility pattern used for `mat-optgroup`.
|
---|
1789 | // The option group has two different "modes": regular and inert. The regular mode uses the
|
---|
1790 | // recommended a11y pattern which has `role="group"` on the group element with `aria-labelledby`
|
---|
1791 | // pointing to the label. This works for `mat-select`, but it seems to hit a bug for autocomplete
|
---|
1792 | // under VoiceOver where the group doesn't get read out at all. The bug appears to be that if
|
---|
1793 | // there's __any__ a11y-related attribute on the group (e.g. `role` or `aria-labelledby`),
|
---|
1794 | // VoiceOver on Safari won't read it out.
|
---|
1795 | // We've introduced the `inert` mode as a workaround. Under this mode, all a11y attributes are
|
---|
1796 | // removed from the group, and we get the screen reader to read out the group label by mirroring it
|
---|
1797 | // inside an invisible element in the option. This is sub-optimal, because the screen reader will
|
---|
1798 | // repeat the group label on each navigation, whereas the default pattern only reads the group when
|
---|
1799 | // the user enters a new group. The following alternate approaches were considered:
|
---|
1800 | // 1. Reading out the group label using the `LiveAnnouncer` solves the problem, but we can't control
|
---|
1801 | // when the text will be read out so sometimes it comes in too late or never if the user
|
---|
1802 | // navigates quickly.
|
---|
1803 | // 2. `<mat-option aria-describedby="groupLabel"` - This works on Safari, but VoiceOver in Chrome
|
---|
1804 | // won't read out the description at all.
|
---|
1805 | // 3. `<mat-option aria-labelledby="optionLabel groupLabel"` - This works on Chrome, but Safari
|
---|
1806 | // doesn't read out the text at all. Furthermore, on
|
---|
1807 | // Boilerplate for applying mixins to MatOptgroup.
|
---|
1808 | /** @docs-private */
|
---|
1809 | var _MatOptgroupMixinBase = mixinDisabled(/** @class */ (function () {
|
---|
1810 | function class_1() {
|
---|
1811 | }
|
---|
1812 | return class_1;
|
---|
1813 | }()));
|
---|
1814 | // Counter for unique group ids.
|
---|
1815 | var _uniqueOptgroupIdCounter = 0;
|
---|
1816 | var _MatOptgroupBase = /** @class */ (function (_super) {
|
---|
1817 | __extends(_MatOptgroupBase, _super);
|
---|
1818 | function _MatOptgroupBase(parent) {
|
---|
1819 | var _this = this;
|
---|
1820 | var _a;
|
---|
1821 | _this = _super.call(this) || this;
|
---|
1822 | /** Unique id for the underlying label. */
|
---|
1823 | _this._labelId = "mat-optgroup-label-" + _uniqueOptgroupIdCounter++;
|
---|
1824 | _this._inert = (_a = parent === null || parent === void 0 ? void 0 : parent.inertGroups) !== null && _a !== void 0 ? _a : false;
|
---|
1825 | return _this;
|
---|
1826 | }
|
---|
1827 | return _MatOptgroupBase;
|
---|
1828 | }(_MatOptgroupMixinBase));
|
---|
1829 | _MatOptgroupBase.decorators = [
|
---|
1830 | { type: i0.Directive }
|
---|
1831 | ];
|
---|
1832 | _MatOptgroupBase.ctorParameters = function () { return [
|
---|
1833 | { type: undefined, decorators: [{ type: i0.Inject, args: [MAT_OPTION_PARENT_COMPONENT,] }, { type: i0.Optional }] }
|
---|
1834 | ]; };
|
---|
1835 | _MatOptgroupBase.propDecorators = {
|
---|
1836 | label: [{ type: i0.Input }]
|
---|
1837 | };
|
---|
1838 | /**
|
---|
1839 | * Injection token that can be used to reference instances of `MatOptgroup`. It serves as
|
---|
1840 | * alternative token to the actual `MatOptgroup` class which could cause unnecessary
|
---|
1841 | * retention of the class and its component metadata.
|
---|
1842 | */
|
---|
1843 | var MAT_OPTGROUP = new i0.InjectionToken('MatOptgroup');
|
---|
1844 | /**
|
---|
1845 | * Component that is used to group instances of `mat-option`.
|
---|
1846 | */
|
---|
1847 | var MatOptgroup = /** @class */ (function (_super) {
|
---|
1848 | __extends(MatOptgroup, _super);
|
---|
1849 | function MatOptgroup() {
|
---|
1850 | return _super !== null && _super.apply(this, arguments) || this;
|
---|
1851 | }
|
---|
1852 | return MatOptgroup;
|
---|
1853 | }(_MatOptgroupBase));
|
---|
1854 | MatOptgroup.decorators = [
|
---|
1855 | { type: i0.Component, args: [{
|
---|
1856 | selector: 'mat-optgroup',
|
---|
1857 | exportAs: 'matOptgroup',
|
---|
1858 | template: "<span class=\"mat-optgroup-label\" aria-hidden=\"true\" [id]=\"_labelId\">{{ label }} <ng-content></ng-content></span>\n<ng-content select=\"mat-option, ng-container\"></ng-content>\n",
|
---|
1859 | encapsulation: i0.ViewEncapsulation.None,
|
---|
1860 | changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
---|
1861 | inputs: ['disabled'],
|
---|
1862 | host: {
|
---|
1863 | 'class': 'mat-optgroup',
|
---|
1864 | '[attr.role]': '_inert ? null : "group"',
|
---|
1865 | '[attr.aria-disabled]': '_inert ? null : disabled.toString()',
|
---|
1866 | '[attr.aria-labelledby]': '_inert ? null : _labelId',
|
---|
1867 | '[class.mat-optgroup-disabled]': 'disabled',
|
---|
1868 | },
|
---|
1869 | providers: [{ provide: MAT_OPTGROUP, useExisting: MatOptgroup }],
|
---|
1870 | styles: [".mat-optgroup-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block;line-height:48px;height:48px;padding:0 16px;text-align:left;text-decoration:none;max-width:100%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.mat-optgroup-label[disabled]{cursor:default}[dir=rtl] .mat-optgroup-label{text-align:right}.mat-optgroup-label .mat-icon{margin-right:16px;vertical-align:middle}.mat-optgroup-label .mat-icon svg{vertical-align:top}[dir=rtl] .mat-optgroup-label .mat-icon{margin-left:16px;margin-right:0}\n"]
|
---|
1871 | },] }
|
---|
1872 | ];
|
---|
1873 |
|
---|
1874 | /**
|
---|
1875 | * Option IDs need to be unique across components, so this counter exists outside of
|
---|
1876 | * the component definition.
|
---|
1877 | */
|
---|
1878 | var _uniqueIdCounter = 0;
|
---|
1879 | /** Event object emitted by MatOption when selected or deselected. */
|
---|
1880 | var MatOptionSelectionChange = /** @class */ (function () {
|
---|
1881 | function MatOptionSelectionChange(
|
---|
1882 | /** Reference to the option that emitted the event. */
|
---|
1883 | source,
|
---|
1884 | /** Whether the change in the option's value was a result of a user action. */
|
---|
1885 | isUserInput) {
|
---|
1886 | if (isUserInput === void 0) { isUserInput = false; }
|
---|
1887 | this.source = source;
|
---|
1888 | this.isUserInput = isUserInput;
|
---|
1889 | }
|
---|
1890 | return MatOptionSelectionChange;
|
---|
1891 | }());
|
---|
1892 | var _MatOptionBase = /** @class */ (function () {
|
---|
1893 | function _MatOptionBase(_element, _changeDetectorRef, _parent, group) {
|
---|
1894 | this._element = _element;
|
---|
1895 | this._changeDetectorRef = _changeDetectorRef;
|
---|
1896 | this._parent = _parent;
|
---|
1897 | this.group = group;
|
---|
1898 | this._selected = false;
|
---|
1899 | this._active = false;
|
---|
1900 | this._disabled = false;
|
---|
1901 | this._mostRecentViewValue = '';
|
---|
1902 | /** The unique ID of the option. */
|
---|
1903 | this.id = "mat-option-" + _uniqueIdCounter++;
|
---|
1904 | /** Event emitted when the option is selected or deselected. */
|
---|
1905 | // tslint:disable-next-line:no-output-on-prefix
|
---|
1906 | this.onSelectionChange = new i0.EventEmitter();
|
---|
1907 | /** Emits when the state of the option changes and any parents have to be notified. */
|
---|
1908 | this._stateChanges = new rxjs.Subject();
|
---|
1909 | }
|
---|
1910 | Object.defineProperty(_MatOptionBase.prototype, "multiple", {
|
---|
1911 | /** Whether the wrapping component is in multiple selection mode. */
|
---|
1912 | get: function () { return this._parent && this._parent.multiple; },
|
---|
1913 | enumerable: false,
|
---|
1914 | configurable: true
|
---|
1915 | });
|
---|
1916 | Object.defineProperty(_MatOptionBase.prototype, "selected", {
|
---|
1917 | /** Whether or not the option is currently selected. */
|
---|
1918 | get: function () { return this._selected; },
|
---|
1919 | enumerable: false,
|
---|
1920 | configurable: true
|
---|
1921 | });
|
---|
1922 | Object.defineProperty(_MatOptionBase.prototype, "disabled", {
|
---|
1923 | /** Whether the option is disabled. */
|
---|
1924 | get: function () { return (this.group && this.group.disabled) || this._disabled; },
|
---|
1925 | set: function (value) { this._disabled = coercion.coerceBooleanProperty(value); },
|
---|
1926 | enumerable: false,
|
---|
1927 | configurable: true
|
---|
1928 | });
|
---|
1929 | Object.defineProperty(_MatOptionBase.prototype, "disableRipple", {
|
---|
1930 | /** Whether ripples for the option are disabled. */
|
---|
1931 | get: function () { return this._parent && this._parent.disableRipple; },
|
---|
1932 | enumerable: false,
|
---|
1933 | configurable: true
|
---|
1934 | });
|
---|
1935 | Object.defineProperty(_MatOptionBase.prototype, "active", {
|
---|
1936 | /**
|
---|
1937 | * Whether or not the option is currently active and ready to be selected.
|
---|
1938 | * An active option displays styles as if it is focused, but the
|
---|
1939 | * focus is actually retained somewhere else. This comes in handy
|
---|
1940 | * for components like autocomplete where focus must remain on the input.
|
---|
1941 | */
|
---|
1942 | get: function () {
|
---|
1943 | return this._active;
|
---|
1944 | },
|
---|
1945 | enumerable: false,
|
---|
1946 | configurable: true
|
---|
1947 | });
|
---|
1948 | Object.defineProperty(_MatOptionBase.prototype, "viewValue", {
|
---|
1949 | /**
|
---|
1950 | * The displayed value of the option. It is necessary to show the selected option in the
|
---|
1951 | * select's trigger.
|
---|
1952 | */
|
---|
1953 | get: function () {
|
---|
1954 | // TODO(kara): Add input property alternative for node envs.
|
---|
1955 | return (this._getHostElement().textContent || '').trim();
|
---|
1956 | },
|
---|
1957 | enumerable: false,
|
---|
1958 | configurable: true
|
---|
1959 | });
|
---|
1960 | /** Selects the option. */
|
---|
1961 | _MatOptionBase.prototype.select = function () {
|
---|
1962 | if (!this._selected) {
|
---|
1963 | this._selected = true;
|
---|
1964 | this._changeDetectorRef.markForCheck();
|
---|
1965 | this._emitSelectionChangeEvent();
|
---|
1966 | }
|
---|
1967 | };
|
---|
1968 | /** Deselects the option. */
|
---|
1969 | _MatOptionBase.prototype.deselect = function () {
|
---|
1970 | if (this._selected) {
|
---|
1971 | this._selected = false;
|
---|
1972 | this._changeDetectorRef.markForCheck();
|
---|
1973 | this._emitSelectionChangeEvent();
|
---|
1974 | }
|
---|
1975 | };
|
---|
1976 | /** Sets focus onto this option. */
|
---|
1977 | _MatOptionBase.prototype.focus = function (_origin, options) {
|
---|
1978 | // Note that we aren't using `_origin`, but we need to keep it because some internal consumers
|
---|
1979 | // use `MatOption` in a `FocusKeyManager` and we need it to match `FocusableOption`.
|
---|
1980 | var element = this._getHostElement();
|
---|
1981 | if (typeof element.focus === 'function') {
|
---|
1982 | element.focus(options);
|
---|
1983 | }
|
---|
1984 | };
|
---|
1985 | /**
|
---|
1986 | * This method sets display styles on the option to make it appear
|
---|
1987 | * active. This is used by the ActiveDescendantKeyManager so key
|
---|
1988 | * events will display the proper options as active on arrow key events.
|
---|
1989 | */
|
---|
1990 | _MatOptionBase.prototype.setActiveStyles = function () {
|
---|
1991 | if (!this._active) {
|
---|
1992 | this._active = true;
|
---|
1993 | this._changeDetectorRef.markForCheck();
|
---|
1994 | }
|
---|
1995 | };
|
---|
1996 | /**
|
---|
1997 | * This method removes display styles on the option that made it appear
|
---|
1998 | * active. This is used by the ActiveDescendantKeyManager so key
|
---|
1999 | * events will display the proper options as active on arrow key events.
|
---|
2000 | */
|
---|
2001 | _MatOptionBase.prototype.setInactiveStyles = function () {
|
---|
2002 | if (this._active) {
|
---|
2003 | this._active = false;
|
---|
2004 | this._changeDetectorRef.markForCheck();
|
---|
2005 | }
|
---|
2006 | };
|
---|
2007 | /** Gets the label to be used when determining whether the option should be focused. */
|
---|
2008 | _MatOptionBase.prototype.getLabel = function () {
|
---|
2009 | return this.viewValue;
|
---|
2010 | };
|
---|
2011 | /** Ensures the option is selected when activated from the keyboard. */
|
---|
2012 | _MatOptionBase.prototype._handleKeydown = function (event) {
|
---|
2013 | if ((event.keyCode === keycodes.ENTER || event.keyCode === keycodes.SPACE) && !keycodes.hasModifierKey(event)) {
|
---|
2014 | this._selectViaInteraction();
|
---|
2015 | // Prevent the page from scrolling down and form submits.
|
---|
2016 | event.preventDefault();
|
---|
2017 | }
|
---|
2018 | };
|
---|
2019 | /**
|
---|
2020 | * `Selects the option while indicating the selection came from the user. Used to
|
---|
2021 | * determine if the select's view -> model callback should be invoked.`
|
---|
2022 | */
|
---|
2023 | _MatOptionBase.prototype._selectViaInteraction = function () {
|
---|
2024 | if (!this.disabled) {
|
---|
2025 | this._selected = this.multiple ? !this._selected : true;
|
---|
2026 | this._changeDetectorRef.markForCheck();
|
---|
2027 | this._emitSelectionChangeEvent(true);
|
---|
2028 | }
|
---|
2029 | };
|
---|
2030 | /**
|
---|
2031 | * Gets the `aria-selected` value for the option. We explicitly omit the `aria-selected`
|
---|
2032 | * attribute from single-selection, unselected options. Including the `aria-selected="false"`
|
---|
2033 | * attributes adds a significant amount of noise to screen-reader users without providing useful
|
---|
2034 | * information.
|
---|
2035 | */
|
---|
2036 | _MatOptionBase.prototype._getAriaSelected = function () {
|
---|
2037 | return this.selected || (this.multiple ? false : null);
|
---|
2038 | };
|
---|
2039 | /** Returns the correct tabindex for the option depending on disabled state. */
|
---|
2040 | _MatOptionBase.prototype._getTabIndex = function () {
|
---|
2041 | return this.disabled ? '-1' : '0';
|
---|
2042 | };
|
---|
2043 | /** Gets the host DOM element. */
|
---|
2044 | _MatOptionBase.prototype._getHostElement = function () {
|
---|
2045 | return this._element.nativeElement;
|
---|
2046 | };
|
---|
2047 | _MatOptionBase.prototype.ngAfterViewChecked = function () {
|
---|
2048 | // Since parent components could be using the option's label to display the selected values
|
---|
2049 | // (e.g. `mat-select`) and they don't have a way of knowing if the option's label has changed
|
---|
2050 | // we have to check for changes in the DOM ourselves and dispatch an event. These checks are
|
---|
2051 | // relatively cheap, however we still limit them only to selected options in order to avoid
|
---|
2052 | // hitting the DOM too often.
|
---|
2053 | if (this._selected) {
|
---|
2054 | var viewValue = this.viewValue;
|
---|
2055 | if (viewValue !== this._mostRecentViewValue) {
|
---|
2056 | this._mostRecentViewValue = viewValue;
|
---|
2057 | this._stateChanges.next();
|
---|
2058 | }
|
---|
2059 | }
|
---|
2060 | };
|
---|
2061 | _MatOptionBase.prototype.ngOnDestroy = function () {
|
---|
2062 | this._stateChanges.complete();
|
---|
2063 | };
|
---|
2064 | /** Emits the selection change event. */
|
---|
2065 | _MatOptionBase.prototype._emitSelectionChangeEvent = function (isUserInput) {
|
---|
2066 | if (isUserInput === void 0) { isUserInput = false; }
|
---|
2067 | this.onSelectionChange.emit(new MatOptionSelectionChange(this, isUserInput));
|
---|
2068 | };
|
---|
2069 | return _MatOptionBase;
|
---|
2070 | }());
|
---|
2071 | _MatOptionBase.decorators = [
|
---|
2072 | { type: i0.Directive }
|
---|
2073 | ];
|
---|
2074 | _MatOptionBase.ctorParameters = function () { return [
|
---|
2075 | { type: i0.ElementRef },
|
---|
2076 | { type: i0.ChangeDetectorRef },
|
---|
2077 | { type: undefined },
|
---|
2078 | { type: _MatOptgroupBase }
|
---|
2079 | ]; };
|
---|
2080 | _MatOptionBase.propDecorators = {
|
---|
2081 | value: [{ type: i0.Input }],
|
---|
2082 | id: [{ type: i0.Input }],
|
---|
2083 | disabled: [{ type: i0.Input }],
|
---|
2084 | onSelectionChange: [{ type: i0.Output }]
|
---|
2085 | };
|
---|
2086 | /**
|
---|
2087 | * Single option inside of a `<mat-select>` element.
|
---|
2088 | */
|
---|
2089 | var MatOption = /** @class */ (function (_super) {
|
---|
2090 | __extends(MatOption, _super);
|
---|
2091 | function MatOption(element, changeDetectorRef, parent, group) {
|
---|
2092 | return _super.call(this, element, changeDetectorRef, parent, group) || this;
|
---|
2093 | }
|
---|
2094 | return MatOption;
|
---|
2095 | }(_MatOptionBase));
|
---|
2096 | MatOption.decorators = [
|
---|
2097 | { type: i0.Component, args: [{
|
---|
2098 | selector: 'mat-option',
|
---|
2099 | exportAs: 'matOption',
|
---|
2100 | host: {
|
---|
2101 | 'role': 'option',
|
---|
2102 | '[attr.tabindex]': '_getTabIndex()',
|
---|
2103 | '[class.mat-selected]': 'selected',
|
---|
2104 | '[class.mat-option-multiple]': 'multiple',
|
---|
2105 | '[class.mat-active]': 'active',
|
---|
2106 | '[id]': 'id',
|
---|
2107 | '[attr.aria-selected]': '_getAriaSelected()',
|
---|
2108 | '[attr.aria-disabled]': 'disabled.toString()',
|
---|
2109 | '[class.mat-option-disabled]': 'disabled',
|
---|
2110 | '(click)': '_selectViaInteraction()',
|
---|
2111 | '(keydown)': '_handleKeydown($event)',
|
---|
2112 | 'class': 'mat-option mat-focus-indicator',
|
---|
2113 | },
|
---|
2114 | template: "<mat-pseudo-checkbox *ngIf=\"multiple\" class=\"mat-option-pseudo-checkbox\"\n [state]=\"selected ? 'checked' : 'unchecked'\" [disabled]=\"disabled\"></mat-pseudo-checkbox>\n\n<span class=\"mat-option-text\"><ng-content></ng-content></span>\n\n<!-- See a11y notes inside optgroup.ts for context behind this element. -->\n<span class=\"cdk-visually-hidden\" *ngIf=\"group && group._inert\">({{ group.label }})</span>\n\n<div class=\"mat-option-ripple\" mat-ripple\n [matRippleTrigger]=\"_getHostElement()\"\n [matRippleDisabled]=\"disabled || disableRipple\">\n</div>\n",
|
---|
2115 | encapsulation: i0.ViewEncapsulation.None,
|
---|
2116 | changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
---|
2117 | styles: [".mat-option{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block;line-height:48px;height:48px;padding:0 16px;text-align:left;text-decoration:none;max-width:100%;position:relative;cursor:pointer;outline:none;display:flex;flex-direction:row;max-width:100%;box-sizing:border-box;align-items:center;-webkit-tap-highlight-color:transparent}.mat-option[disabled]{cursor:default}[dir=rtl] .mat-option{text-align:right}.mat-option .mat-icon{margin-right:16px;vertical-align:middle}.mat-option .mat-icon svg{vertical-align:top}[dir=rtl] .mat-option .mat-icon{margin-left:16px;margin-right:0}.mat-option[aria-disabled=true]{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.mat-optgroup .mat-option:not(.mat-option-multiple){padding-left:32px}[dir=rtl] .mat-optgroup .mat-option:not(.mat-option-multiple){padding-left:16px;padding-right:32px}.cdk-high-contrast-active .mat-option{margin:0 1px}.cdk-high-contrast-active .mat-option.mat-active{border:solid 1px currentColor;margin:0}.cdk-high-contrast-active .mat-option[aria-disabled=true]{opacity:.5}.mat-option-text{display:inline-block;flex-grow:1;overflow:hidden;text-overflow:ellipsis}.mat-option .mat-option-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}.mat-option-pseudo-checkbox{margin-right:8px}[dir=rtl] .mat-option-pseudo-checkbox{margin-left:8px;margin-right:0}\n"]
|
---|
2118 | },] }
|
---|
2119 | ];
|
---|
2120 | MatOption.ctorParameters = function () { return [
|
---|
2121 | { type: i0.ElementRef },
|
---|
2122 | { type: i0.ChangeDetectorRef },
|
---|
2123 | { type: undefined, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [MAT_OPTION_PARENT_COMPONENT,] }] },
|
---|
2124 | { type: MatOptgroup, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [MAT_OPTGROUP,] }] }
|
---|
2125 | ]; };
|
---|
2126 | /**
|
---|
2127 | * Counts the amount of option group labels that precede the specified option.
|
---|
2128 | * @param optionIndex Index of the option at which to start counting.
|
---|
2129 | * @param options Flat list of all of the options.
|
---|
2130 | * @param optionGroups Flat list of all of the option groups.
|
---|
2131 | * @docs-private
|
---|
2132 | */
|
---|
2133 | function _countGroupLabelsBeforeOption(optionIndex, options, optionGroups) {
|
---|
2134 | if (optionGroups.length) {
|
---|
2135 | var optionsArray = options.toArray();
|
---|
2136 | var groups = optionGroups.toArray();
|
---|
2137 | var groupCounter = 0;
|
---|
2138 | for (var i = 0; i < optionIndex + 1; i++) {
|
---|
2139 | if (optionsArray[i].group && optionsArray[i].group === groups[groupCounter]) {
|
---|
2140 | groupCounter++;
|
---|
2141 | }
|
---|
2142 | }
|
---|
2143 | return groupCounter;
|
---|
2144 | }
|
---|
2145 | return 0;
|
---|
2146 | }
|
---|
2147 | /**
|
---|
2148 | * Determines the position to which to scroll a panel in order for an option to be into view.
|
---|
2149 | * @param optionOffset Offset of the option from the top of the panel.
|
---|
2150 | * @param optionHeight Height of the options.
|
---|
2151 | * @param currentScrollPosition Current scroll position of the panel.
|
---|
2152 | * @param panelHeight Height of the panel.
|
---|
2153 | * @docs-private
|
---|
2154 | */
|
---|
2155 | function _getOptionScrollPosition(optionOffset, optionHeight, currentScrollPosition, panelHeight) {
|
---|
2156 | if (optionOffset < currentScrollPosition) {
|
---|
2157 | return optionOffset;
|
---|
2158 | }
|
---|
2159 | if (optionOffset + optionHeight > currentScrollPosition + panelHeight) {
|
---|
2160 | return Math.max(0, optionOffset - panelHeight + optionHeight);
|
---|
2161 | }
|
---|
2162 | return currentScrollPosition;
|
---|
2163 | }
|
---|
2164 |
|
---|
2165 | /**
|
---|
2166 | * @license
|
---|
2167 | * Copyright Google LLC All Rights Reserved.
|
---|
2168 | *
|
---|
2169 | * Use of this source code is governed by an MIT-style license that can be
|
---|
2170 | * found in the LICENSE file at https://angular.io/license
|
---|
2171 | */
|
---|
2172 | var MatOptionModule = /** @class */ (function () {
|
---|
2173 | function MatOptionModule() {
|
---|
2174 | }
|
---|
2175 | return MatOptionModule;
|
---|
2176 | }());
|
---|
2177 | MatOptionModule.decorators = [
|
---|
2178 | { type: i0.NgModule, args: [{
|
---|
2179 | imports: [MatRippleModule, common.CommonModule, MatCommonModule, MatPseudoCheckboxModule],
|
---|
2180 | exports: [MatOption, MatOptgroup],
|
---|
2181 | declarations: [MatOption, MatOptgroup]
|
---|
2182 | },] }
|
---|
2183 | ];
|
---|
2184 |
|
---|
2185 | /**
|
---|
2186 | * @license
|
---|
2187 | * Copyright Google LLC All Rights Reserved.
|
---|
2188 | *
|
---|
2189 | * Use of this source code is governed by an MIT-style license that can be
|
---|
2190 | * found in the LICENSE file at https://angular.io/license
|
---|
2191 | */
|
---|
2192 |
|
---|
2193 | /**
|
---|
2194 | * Generated bundle index. Do not edit.
|
---|
2195 | */
|
---|
2196 |
|
---|
2197 | exports.AnimationCurves = AnimationCurves;
|
---|
2198 | exports.AnimationDurations = AnimationDurations;
|
---|
2199 | exports.DateAdapter = DateAdapter;
|
---|
2200 | exports.ErrorStateMatcher = ErrorStateMatcher;
|
---|
2201 | exports.MATERIAL_SANITY_CHECKS = MATERIAL_SANITY_CHECKS;
|
---|
2202 | exports.MAT_DATE_FORMATS = MAT_DATE_FORMATS;
|
---|
2203 | exports.MAT_DATE_LOCALE = MAT_DATE_LOCALE;
|
---|
2204 | exports.MAT_DATE_LOCALE_FACTORY = MAT_DATE_LOCALE_FACTORY;
|
---|
2205 | exports.MAT_NATIVE_DATE_FORMATS = MAT_NATIVE_DATE_FORMATS;
|
---|
2206 | exports.MAT_OPTGROUP = MAT_OPTGROUP;
|
---|
2207 | exports.MAT_OPTION_PARENT_COMPONENT = MAT_OPTION_PARENT_COMPONENT;
|
---|
2208 | exports.MAT_RIPPLE_GLOBAL_OPTIONS = MAT_RIPPLE_GLOBAL_OPTIONS;
|
---|
2209 | exports.MatCommonModule = MatCommonModule;
|
---|
2210 | exports.MatLine = MatLine;
|
---|
2211 | exports.MatLineModule = MatLineModule;
|
---|
2212 | exports.MatNativeDateModule = MatNativeDateModule;
|
---|
2213 | exports.MatOptgroup = MatOptgroup;
|
---|
2214 | exports.MatOption = MatOption;
|
---|
2215 | exports.MatOptionModule = MatOptionModule;
|
---|
2216 | exports.MatOptionSelectionChange = MatOptionSelectionChange;
|
---|
2217 | exports.MatPseudoCheckbox = MatPseudoCheckbox;
|
---|
2218 | exports.MatPseudoCheckboxModule = MatPseudoCheckboxModule;
|
---|
2219 | exports.MatRipple = MatRipple;
|
---|
2220 | exports.MatRippleModule = MatRippleModule;
|
---|
2221 | exports.NativeDateAdapter = NativeDateAdapter;
|
---|
2222 | exports.NativeDateModule = NativeDateModule;
|
---|
2223 | exports.RippleRef = RippleRef;
|
---|
2224 | exports.RippleRenderer = RippleRenderer;
|
---|
2225 | exports.ShowOnDirtyErrorStateMatcher = ShowOnDirtyErrorStateMatcher;
|
---|
2226 | exports.VERSION = VERSION$1;
|
---|
2227 | exports._MatOptgroupBase = _MatOptgroupBase;
|
---|
2228 | exports._MatOptionBase = _MatOptionBase;
|
---|
2229 | exports._countGroupLabelsBeforeOption = _countGroupLabelsBeforeOption;
|
---|
2230 | exports._getOptionScrollPosition = _getOptionScrollPosition;
|
---|
2231 | exports.defaultRippleAnimationConfig = defaultRippleAnimationConfig;
|
---|
2232 | exports.mixinColor = mixinColor;
|
---|
2233 | exports.mixinDisableRipple = mixinDisableRipple;
|
---|
2234 | exports.mixinDisabled = mixinDisabled;
|
---|
2235 | exports.mixinErrorState = mixinErrorState;
|
---|
2236 | exports.mixinInitialized = mixinInitialized;
|
---|
2237 | exports.mixinTabIndex = mixinTabIndex;
|
---|
2238 | exports.setLines = setLines;
|
---|
2239 | exports.ɵ0 = ɵ0;
|
---|
2240 | exports.ɵangular_material_src_material_core_core_a = MATERIAL_SANITY_CHECKS_FACTORY;
|
---|
2241 |
|
---|
2242 | Object.defineProperty(exports, '__esModule', { value: true });
|
---|
2243 |
|
---|
2244 | })));
|
---|
2245 | //# sourceMappingURL=material-core.umd.js.map
|
---|