1 | (function (global, factory) {
|
---|
2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/cdk/observers'), require('@angular/common'), require('@angular/core'), require('@angular/material/core'), require('@angular/cdk/bidi'), require('@angular/cdk/coercion'), require('rxjs'), require('rxjs/operators'), require('@angular/animations'), require('@angular/cdk/platform'), require('@angular/platform-browser/animations')) :
|
---|
3 | typeof define === 'function' && define.amd ? define('@angular/material/form-field', ['exports', '@angular/cdk/observers', '@angular/common', '@angular/core', '@angular/material/core', '@angular/cdk/bidi', '@angular/cdk/coercion', 'rxjs', 'rxjs/operators', '@angular/animations', '@angular/cdk/platform', '@angular/platform-browser/animations'], factory) :
|
---|
4 | (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.ng = global.ng || {}, global.ng.material = global.ng.material || {}, global.ng.material.formField = {}), global.ng.cdk.observers, global.ng.common, global.ng.core, global.ng.material.core, global.ng.cdk.bidi, global.ng.cdk.coercion, global.rxjs, global.rxjs.operators, global.ng.animations, global.ng.cdk.platform, global.ng.platformBrowser.animations));
|
---|
5 | }(this, (function (exports, observers, common, core, core$1, bidi, coercion, rxjs, operators, animations, platform, animations$1) { 'use strict';
|
---|
6 |
|
---|
7 | /**
|
---|
8 | * @license
|
---|
9 | * Copyright Google LLC All Rights Reserved.
|
---|
10 | *
|
---|
11 | * Use of this source code is governed by an MIT-style license that can be
|
---|
12 | * found in the LICENSE file at https://angular.io/license
|
---|
13 | */
|
---|
14 | var nextUniqueId$2 = 0;
|
---|
15 | /**
|
---|
16 | * Injection token that can be used to reference instances of `MatError`. It serves as
|
---|
17 | * alternative token to the actual `MatError` class which could cause unnecessary
|
---|
18 | * retention of the class and its directive metadata.
|
---|
19 | */
|
---|
20 | var MAT_ERROR = new core.InjectionToken('MatError');
|
---|
21 | /** Single error message to be shown underneath the form field. */
|
---|
22 | var MatError = /** @class */ (function () {
|
---|
23 | function MatError(ariaLive, elementRef) {
|
---|
24 | this.id = "mat-error-" + nextUniqueId$2++;
|
---|
25 | // If no aria-live value is set add 'polite' as a default. This is preferred over setting
|
---|
26 | // role='alert' so that screen readers do not interrupt the current task to read this aloud.
|
---|
27 | if (!ariaLive) {
|
---|
28 | elementRef.nativeElement.setAttribute('aria-live', 'polite');
|
---|
29 | }
|
---|
30 | }
|
---|
31 | return MatError;
|
---|
32 | }());
|
---|
33 | MatError.decorators = [
|
---|
34 | { type: core.Directive, args: [{
|
---|
35 | selector: 'mat-error',
|
---|
36 | host: {
|
---|
37 | 'class': 'mat-error',
|
---|
38 | '[attr.id]': 'id',
|
---|
39 | 'aria-atomic': 'true',
|
---|
40 | },
|
---|
41 | providers: [{ provide: MAT_ERROR, useExisting: MatError }],
|
---|
42 | },] }
|
---|
43 | ];
|
---|
44 | MatError.ctorParameters = function () { return [
|
---|
45 | { type: String, decorators: [{ type: core.Attribute, args: ['aria-live',] }] },
|
---|
46 | { type: core.ElementRef }
|
---|
47 | ]; };
|
---|
48 | MatError.propDecorators = {
|
---|
49 | id: [{ type: core.Input }]
|
---|
50 | };
|
---|
51 |
|
---|
52 | /*! *****************************************************************************
|
---|
53 | Copyright (c) Microsoft Corporation.
|
---|
54 |
|
---|
55 | Permission to use, copy, modify, and/or distribute this software for any
|
---|
56 | purpose with or without fee is hereby granted.
|
---|
57 |
|
---|
58 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
---|
59 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
---|
60 | AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
---|
61 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
---|
62 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
---|
63 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
---|
64 | PERFORMANCE OF THIS SOFTWARE.
|
---|
65 | ***************************************************************************** */
|
---|
66 | /* global Reflect, Promise */
|
---|
67 | var extendStatics = function (d, b) {
|
---|
68 | extendStatics = Object.setPrototypeOf ||
|
---|
69 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
---|
70 | function (d, b) { for (var p in b)
|
---|
71 | if (Object.prototype.hasOwnProperty.call(b, p))
|
---|
72 | d[p] = b[p]; };
|
---|
73 | return extendStatics(d, b);
|
---|
74 | };
|
---|
75 | function __extends(d, b) {
|
---|
76 | if (typeof b !== "function" && b !== null)
|
---|
77 | throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
---|
78 | extendStatics(d, b);
|
---|
79 | function __() { this.constructor = d; }
|
---|
80 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
---|
81 | }
|
---|
82 | var __assign = function () {
|
---|
83 | __assign = Object.assign || function __assign(t) {
|
---|
84 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
---|
85 | s = arguments[i];
|
---|
86 | for (var p in s)
|
---|
87 | if (Object.prototype.hasOwnProperty.call(s, p))
|
---|
88 | t[p] = s[p];
|
---|
89 | }
|
---|
90 | return t;
|
---|
91 | };
|
---|
92 | return __assign.apply(this, arguments);
|
---|
93 | };
|
---|
94 | function __rest(s, e) {
|
---|
95 | var t = {};
|
---|
96 | for (var p in s)
|
---|
97 | if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
---|
98 | t[p] = s[p];
|
---|
99 | if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
---|
100 | for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
---|
101 | if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
---|
102 | t[p[i]] = s[p[i]];
|
---|
103 | }
|
---|
104 | return t;
|
---|
105 | }
|
---|
106 | function __decorate(decorators, target, key, desc) {
|
---|
107 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
---|
108 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
---|
109 | r = Reflect.decorate(decorators, target, key, desc);
|
---|
110 | else
|
---|
111 | for (var i = decorators.length - 1; i >= 0; i--)
|
---|
112 | if (d = decorators[i])
|
---|
113 | r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
---|
114 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
---|
115 | }
|
---|
116 | function __param(paramIndex, decorator) {
|
---|
117 | return function (target, key) { decorator(target, key, paramIndex); };
|
---|
118 | }
|
---|
119 | function __metadata(metadataKey, metadataValue) {
|
---|
120 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
---|
121 | return Reflect.metadata(metadataKey, metadataValue);
|
---|
122 | }
|
---|
123 | function __awaiter(thisArg, _arguments, P, generator) {
|
---|
124 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
---|
125 | return new (P || (P = Promise))(function (resolve, reject) {
|
---|
126 | function fulfilled(value) { try {
|
---|
127 | step(generator.next(value));
|
---|
128 | }
|
---|
129 | catch (e) {
|
---|
130 | reject(e);
|
---|
131 | } }
|
---|
132 | function rejected(value) { try {
|
---|
133 | step(generator["throw"](value));
|
---|
134 | }
|
---|
135 | catch (e) {
|
---|
136 | reject(e);
|
---|
137 | } }
|
---|
138 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
---|
139 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
---|
140 | });
|
---|
141 | }
|
---|
142 | function __generator(thisArg, body) {
|
---|
143 | var _ = { label: 0, sent: function () { if (t[0] & 1)
|
---|
144 | throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
---|
145 | return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
|
---|
146 | function verb(n) { return function (v) { return step([n, v]); }; }
|
---|
147 | function step(op) {
|
---|
148 | if (f)
|
---|
149 | throw new TypeError("Generator is already executing.");
|
---|
150 | while (_)
|
---|
151 | try {
|
---|
152 | 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)
|
---|
153 | return t;
|
---|
154 | if (y = 0, t)
|
---|
155 | op = [op[0] & 2, t.value];
|
---|
156 | switch (op[0]) {
|
---|
157 | case 0:
|
---|
158 | case 1:
|
---|
159 | t = op;
|
---|
160 | break;
|
---|
161 | case 4:
|
---|
162 | _.label++;
|
---|
163 | return { value: op[1], done: false };
|
---|
164 | case 5:
|
---|
165 | _.label++;
|
---|
166 | y = op[1];
|
---|
167 | op = [0];
|
---|
168 | continue;
|
---|
169 | case 7:
|
---|
170 | op = _.ops.pop();
|
---|
171 | _.trys.pop();
|
---|
172 | continue;
|
---|
173 | default:
|
---|
174 | if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
---|
175 | _ = 0;
|
---|
176 | continue;
|
---|
177 | }
|
---|
178 | if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
|
---|
179 | _.label = op[1];
|
---|
180 | break;
|
---|
181 | }
|
---|
182 | if (op[0] === 6 && _.label < t[1]) {
|
---|
183 | _.label = t[1];
|
---|
184 | t = op;
|
---|
185 | break;
|
---|
186 | }
|
---|
187 | if (t && _.label < t[2]) {
|
---|
188 | _.label = t[2];
|
---|
189 | _.ops.push(op);
|
---|
190 | break;
|
---|
191 | }
|
---|
192 | if (t[2])
|
---|
193 | _.ops.pop();
|
---|
194 | _.trys.pop();
|
---|
195 | continue;
|
---|
196 | }
|
---|
197 | op = body.call(thisArg, _);
|
---|
198 | }
|
---|
199 | catch (e) {
|
---|
200 | op = [6, e];
|
---|
201 | y = 0;
|
---|
202 | }
|
---|
203 | finally {
|
---|
204 | f = t = 0;
|
---|
205 | }
|
---|
206 | if (op[0] & 5)
|
---|
207 | throw op[1];
|
---|
208 | return { value: op[0] ? op[1] : void 0, done: true };
|
---|
209 | }
|
---|
210 | }
|
---|
211 | var __createBinding = Object.create ? (function (o, m, k, k2) {
|
---|
212 | if (k2 === undefined)
|
---|
213 | k2 = k;
|
---|
214 | Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
|
---|
215 | }) : (function (o, m, k, k2) {
|
---|
216 | if (k2 === undefined)
|
---|
217 | k2 = k;
|
---|
218 | o[k2] = m[k];
|
---|
219 | });
|
---|
220 | function __exportStar(m, o) {
|
---|
221 | for (var p in m)
|
---|
222 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
|
---|
223 | __createBinding(o, m, p);
|
---|
224 | }
|
---|
225 | function __values(o) {
|
---|
226 | var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
---|
227 | if (m)
|
---|
228 | return m.call(o);
|
---|
229 | if (o && typeof o.length === "number")
|
---|
230 | return {
|
---|
231 | next: function () {
|
---|
232 | if (o && i >= o.length)
|
---|
233 | o = void 0;
|
---|
234 | return { value: o && o[i++], done: !o };
|
---|
235 | }
|
---|
236 | };
|
---|
237 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
---|
238 | }
|
---|
239 | function __read(o, n) {
|
---|
240 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
---|
241 | if (!m)
|
---|
242 | return o;
|
---|
243 | var i = m.call(o), r, ar = [], e;
|
---|
244 | try {
|
---|
245 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
---|
246 | ar.push(r.value);
|
---|
247 | }
|
---|
248 | catch (error) {
|
---|
249 | e = { error: error };
|
---|
250 | }
|
---|
251 | finally {
|
---|
252 | try {
|
---|
253 | if (r && !r.done && (m = i["return"]))
|
---|
254 | m.call(i);
|
---|
255 | }
|
---|
256 | finally {
|
---|
257 | if (e)
|
---|
258 | throw e.error;
|
---|
259 | }
|
---|
260 | }
|
---|
261 | return ar;
|
---|
262 | }
|
---|
263 | /** @deprecated */
|
---|
264 | function __spread() {
|
---|
265 | for (var ar = [], i = 0; i < arguments.length; i++)
|
---|
266 | ar = ar.concat(__read(arguments[i]));
|
---|
267 | return ar;
|
---|
268 | }
|
---|
269 | /** @deprecated */
|
---|
270 | function __spreadArrays() {
|
---|
271 | for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
---|
272 | s += arguments[i].length;
|
---|
273 | for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
---|
274 | for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
---|
275 | r[k] = a[j];
|
---|
276 | return r;
|
---|
277 | }
|
---|
278 | function __spreadArray(to, from, pack) {
|
---|
279 | if (pack || arguments.length === 2)
|
---|
280 | for (var i = 0, l = from.length, ar; i < l; i++) {
|
---|
281 | if (ar || !(i in from)) {
|
---|
282 | if (!ar)
|
---|
283 | ar = Array.prototype.slice.call(from, 0, i);
|
---|
284 | ar[i] = from[i];
|
---|
285 | }
|
---|
286 | }
|
---|
287 | return to.concat(ar || from);
|
---|
288 | }
|
---|
289 | function __await(v) {
|
---|
290 | return this instanceof __await ? (this.v = v, this) : new __await(v);
|
---|
291 | }
|
---|
292 | function __asyncGenerator(thisArg, _arguments, generator) {
|
---|
293 | if (!Symbol.asyncIterator)
|
---|
294 | throw new TypeError("Symbol.asyncIterator is not defined.");
|
---|
295 | var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
---|
296 | return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
---|
297 | function verb(n) { if (g[n])
|
---|
298 | i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
---|
299 | function resume(n, v) { try {
|
---|
300 | step(g[n](v));
|
---|
301 | }
|
---|
302 | catch (e) {
|
---|
303 | settle(q[0][3], e);
|
---|
304 | } }
|
---|
305 | function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
---|
306 | function fulfill(value) { resume("next", value); }
|
---|
307 | function reject(value) { resume("throw", value); }
|
---|
308 | function settle(f, v) { if (f(v), q.shift(), q.length)
|
---|
309 | resume(q[0][0], q[0][1]); }
|
---|
310 | }
|
---|
311 | function __asyncDelegator(o) {
|
---|
312 | var i, p;
|
---|
313 | return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
---|
314 | 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; }
|
---|
315 | }
|
---|
316 | function __asyncValues(o) {
|
---|
317 | if (!Symbol.asyncIterator)
|
---|
318 | throw new TypeError("Symbol.asyncIterator is not defined.");
|
---|
319 | var m = o[Symbol.asyncIterator], i;
|
---|
320 | 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);
|
---|
321 | 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); }); }; }
|
---|
322 | function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
---|
323 | }
|
---|
324 | function __makeTemplateObject(cooked, raw) {
|
---|
325 | if (Object.defineProperty) {
|
---|
326 | Object.defineProperty(cooked, "raw", { value: raw });
|
---|
327 | }
|
---|
328 | else {
|
---|
329 | cooked.raw = raw;
|
---|
330 | }
|
---|
331 | return cooked;
|
---|
332 | }
|
---|
333 | ;
|
---|
334 | var __setModuleDefault = Object.create ? (function (o, v) {
|
---|
335 | Object.defineProperty(o, "default", { enumerable: true, value: v });
|
---|
336 | }) : function (o, v) {
|
---|
337 | o["default"] = v;
|
---|
338 | };
|
---|
339 | function __importStar(mod) {
|
---|
340 | if (mod && mod.__esModule)
|
---|
341 | return mod;
|
---|
342 | var result = {};
|
---|
343 | if (mod != null)
|
---|
344 | for (var k in mod)
|
---|
345 | if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
---|
346 | __createBinding(result, mod, k);
|
---|
347 | __setModuleDefault(result, mod);
|
---|
348 | return result;
|
---|
349 | }
|
---|
350 | function __importDefault(mod) {
|
---|
351 | return (mod && mod.__esModule) ? mod : { default: mod };
|
---|
352 | }
|
---|
353 | function __classPrivateFieldGet(receiver, state, kind, f) {
|
---|
354 | if (kind === "a" && !f)
|
---|
355 | throw new TypeError("Private accessor was defined without a getter");
|
---|
356 | if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
---|
357 | throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
---|
358 | return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
---|
359 | }
|
---|
360 | function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
---|
361 | if (kind === "m")
|
---|
362 | throw new TypeError("Private method is not writable");
|
---|
363 | if (kind === "a" && !f)
|
---|
364 | throw new TypeError("Private accessor was defined without a setter");
|
---|
365 | if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
---|
366 | throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
---|
367 | return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
---|
368 | }
|
---|
369 |
|
---|
370 | /**
|
---|
371 | * @license
|
---|
372 | * Copyright Google LLC All Rights Reserved.
|
---|
373 | *
|
---|
374 | * Use of this source code is governed by an MIT-style license that can be
|
---|
375 | * found in the LICENSE file at https://angular.io/license
|
---|
376 | */
|
---|
377 | /**
|
---|
378 | * Animations used by the MatFormField.
|
---|
379 | * @docs-private
|
---|
380 | */
|
---|
381 | var matFormFieldAnimations = {
|
---|
382 | /** Animation that transitions the form field's error and hint messages. */
|
---|
383 | transitionMessages: animations.trigger('transitionMessages', [
|
---|
384 | // TODO(mmalerba): Use angular animations for label animation as well.
|
---|
385 | animations.state('enter', animations.style({ opacity: 1, transform: 'translateY(0%)' })),
|
---|
386 | animations.transition('void => enter', [
|
---|
387 | animations.style({ opacity: 0, transform: 'translateY(-5px)' }),
|
---|
388 | animations.animate('300ms cubic-bezier(0.55, 0, 0.55, 0.2)'),
|
---|
389 | ]),
|
---|
390 | ])
|
---|
391 | };
|
---|
392 |
|
---|
393 | /**
|
---|
394 | * @license
|
---|
395 | * Copyright Google LLC All Rights Reserved.
|
---|
396 | *
|
---|
397 | * Use of this source code is governed by an MIT-style license that can be
|
---|
398 | * found in the LICENSE file at https://angular.io/license
|
---|
399 | */
|
---|
400 | /** An interface which allows a control to work inside of a `MatFormField`. */
|
---|
401 | var MatFormFieldControl = /** @class */ (function () {
|
---|
402 | function MatFormFieldControl() {
|
---|
403 | }
|
---|
404 | return MatFormFieldControl;
|
---|
405 | }());
|
---|
406 | MatFormFieldControl.decorators = [
|
---|
407 | { type: core.Directive }
|
---|
408 | ];
|
---|
409 |
|
---|
410 | /**
|
---|
411 | * @license
|
---|
412 | * Copyright Google LLC All Rights Reserved.
|
---|
413 | *
|
---|
414 | * Use of this source code is governed by an MIT-style license that can be
|
---|
415 | * found in the LICENSE file at https://angular.io/license
|
---|
416 | */
|
---|
417 | /** @docs-private */
|
---|
418 | function getMatFormFieldPlaceholderConflictError() {
|
---|
419 | return Error('Placeholder attribute and child element were both specified.');
|
---|
420 | }
|
---|
421 | /** @docs-private */
|
---|
422 | function getMatFormFieldDuplicatedHintError(align) {
|
---|
423 | return Error("A hint was already declared for 'align=\"" + align + "\"'.");
|
---|
424 | }
|
---|
425 | /** @docs-private */
|
---|
426 | function getMatFormFieldMissingControlError() {
|
---|
427 | return Error('mat-form-field must contain a MatFormFieldControl.');
|
---|
428 | }
|
---|
429 |
|
---|
430 | /**
|
---|
431 | * @license
|
---|
432 | * Copyright Google LLC All Rights Reserved.
|
---|
433 | *
|
---|
434 | * Use of this source code is governed by an MIT-style license that can be
|
---|
435 | * found in the LICENSE file at https://angular.io/license
|
---|
436 | */
|
---|
437 | var nextUniqueId$1 = 0;
|
---|
438 | /**
|
---|
439 | * Injection token that can be used to reference instances of `MatHint`. It serves as
|
---|
440 | * alternative token to the actual `MatHint` class which could cause unnecessary
|
---|
441 | * retention of the class and its directive metadata.
|
---|
442 | *
|
---|
443 | * *Note*: This is not part of the public API as the MDC-based form-field will not
|
---|
444 | * need a lightweight token for `MatHint` and we want to reduce breaking changes.
|
---|
445 | */
|
---|
446 | var _MAT_HINT = new core.InjectionToken('MatHint');
|
---|
447 | /** Hint text to be shown underneath the form field control. */
|
---|
448 | var MatHint = /** @class */ (function () {
|
---|
449 | function MatHint() {
|
---|
450 | /** Whether to align the hint label at the start or end of the line. */
|
---|
451 | this.align = 'start';
|
---|
452 | /** Unique ID for the hint. Used for the aria-describedby on the form field control. */
|
---|
453 | this.id = "mat-hint-" + nextUniqueId$1++;
|
---|
454 | }
|
---|
455 | return MatHint;
|
---|
456 | }());
|
---|
457 | MatHint.decorators = [
|
---|
458 | { type: core.Directive, args: [{
|
---|
459 | selector: 'mat-hint',
|
---|
460 | host: {
|
---|
461 | 'class': 'mat-hint',
|
---|
462 | '[class.mat-form-field-hint-end]': 'align === "end"',
|
---|
463 | '[attr.id]': 'id',
|
---|
464 | // Remove align attribute to prevent it from interfering with layout.
|
---|
465 | '[attr.align]': 'null',
|
---|
466 | },
|
---|
467 | providers: [{ provide: _MAT_HINT, useExisting: MatHint }],
|
---|
468 | },] }
|
---|
469 | ];
|
---|
470 | MatHint.propDecorators = {
|
---|
471 | align: [{ type: core.Input }],
|
---|
472 | id: [{ type: core.Input }]
|
---|
473 | };
|
---|
474 |
|
---|
475 | /**
|
---|
476 | * @license
|
---|
477 | * Copyright Google LLC All Rights Reserved.
|
---|
478 | *
|
---|
479 | * Use of this source code is governed by an MIT-style license that can be
|
---|
480 | * found in the LICENSE file at https://angular.io/license
|
---|
481 | */
|
---|
482 | /** The floating label for a `mat-form-field`. */
|
---|
483 | var MatLabel = /** @class */ (function () {
|
---|
484 | function MatLabel() {
|
---|
485 | }
|
---|
486 | return MatLabel;
|
---|
487 | }());
|
---|
488 | MatLabel.decorators = [
|
---|
489 | { type: core.Directive, args: [{
|
---|
490 | selector: 'mat-label'
|
---|
491 | },] }
|
---|
492 | ];
|
---|
493 |
|
---|
494 | /**
|
---|
495 | * @license
|
---|
496 | * Copyright Google LLC All Rights Reserved.
|
---|
497 | *
|
---|
498 | * Use of this source code is governed by an MIT-style license that can be
|
---|
499 | * found in the LICENSE file at https://angular.io/license
|
---|
500 | */
|
---|
501 | /**
|
---|
502 | * The placeholder text for an `MatFormField`.
|
---|
503 | * @deprecated Use `<mat-label>` to specify the label and the `placeholder` attribute to specify the
|
---|
504 | * placeholder.
|
---|
505 | * @breaking-change 8.0.0
|
---|
506 | */
|
---|
507 | var MatPlaceholder = /** @class */ (function () {
|
---|
508 | function MatPlaceholder() {
|
---|
509 | }
|
---|
510 | return MatPlaceholder;
|
---|
511 | }());
|
---|
512 | MatPlaceholder.decorators = [
|
---|
513 | { type: core.Directive, args: [{
|
---|
514 | selector: 'mat-placeholder'
|
---|
515 | },] }
|
---|
516 | ];
|
---|
517 |
|
---|
518 | /**
|
---|
519 | * @license
|
---|
520 | * Copyright Google LLC All Rights Reserved.
|
---|
521 | *
|
---|
522 | * Use of this source code is governed by an MIT-style license that can be
|
---|
523 | * found in the LICENSE file at https://angular.io/license
|
---|
524 | */
|
---|
525 | /**
|
---|
526 | * Injection token that can be used to reference instances of `MatPrefix`. It serves as
|
---|
527 | * alternative token to the actual `MatPrefix` class which could cause unnecessary
|
---|
528 | * retention of the class and its directive metadata.
|
---|
529 | */
|
---|
530 | var MAT_PREFIX = new core.InjectionToken('MatPrefix');
|
---|
531 | /** Prefix to be placed in front of the form field. */
|
---|
532 | var MatPrefix = /** @class */ (function () {
|
---|
533 | function MatPrefix() {
|
---|
534 | }
|
---|
535 | return MatPrefix;
|
---|
536 | }());
|
---|
537 | MatPrefix.decorators = [
|
---|
538 | { type: core.Directive, args: [{
|
---|
539 | selector: '[matPrefix]',
|
---|
540 | providers: [{ provide: MAT_PREFIX, useExisting: MatPrefix }],
|
---|
541 | },] }
|
---|
542 | ];
|
---|
543 |
|
---|
544 | /**
|
---|
545 | * @license
|
---|
546 | * Copyright Google LLC All Rights Reserved.
|
---|
547 | *
|
---|
548 | * Use of this source code is governed by an MIT-style license that can be
|
---|
549 | * found in the LICENSE file at https://angular.io/license
|
---|
550 | */
|
---|
551 | /**
|
---|
552 | * Injection token that can be used to reference instances of `MatSuffix`. It serves as
|
---|
553 | * alternative token to the actual `MatSuffix` class which could cause unnecessary
|
---|
554 | * retention of the class and its directive metadata.
|
---|
555 | */
|
---|
556 | var MAT_SUFFIX = new core.InjectionToken('MatSuffix');
|
---|
557 | /** Suffix to be placed at the end of the form field. */
|
---|
558 | var MatSuffix = /** @class */ (function () {
|
---|
559 | function MatSuffix() {
|
---|
560 | }
|
---|
561 | return MatSuffix;
|
---|
562 | }());
|
---|
563 | MatSuffix.decorators = [
|
---|
564 | { type: core.Directive, args: [{
|
---|
565 | selector: '[matSuffix]',
|
---|
566 | providers: [{ provide: MAT_SUFFIX, useExisting: MatSuffix }],
|
---|
567 | },] }
|
---|
568 | ];
|
---|
569 |
|
---|
570 | var nextUniqueId = 0;
|
---|
571 | var floatingLabelScale = 0.75;
|
---|
572 | var outlineGapPadding = 5;
|
---|
573 | /**
|
---|
574 | * Boilerplate for applying mixins to MatFormField.
|
---|
575 | * @docs-private
|
---|
576 | */
|
---|
577 | var _MatFormFieldBase = core$1.mixinColor(/** @class */ (function () {
|
---|
578 | function class_1(_elementRef) {
|
---|
579 | this._elementRef = _elementRef;
|
---|
580 | }
|
---|
581 | return class_1;
|
---|
582 | }()), 'primary');
|
---|
583 | /**
|
---|
584 | * Injection token that can be used to configure the
|
---|
585 | * default options for all form field within an app.
|
---|
586 | */
|
---|
587 | var MAT_FORM_FIELD_DEFAULT_OPTIONS = new core.InjectionToken('MAT_FORM_FIELD_DEFAULT_OPTIONS');
|
---|
588 | /**
|
---|
589 | * Injection token that can be used to inject an instances of `MatFormField`. It serves
|
---|
590 | * as alternative token to the actual `MatFormField` class which would cause unnecessary
|
---|
591 | * retention of the `MatFormField` class and its component metadata.
|
---|
592 | */
|
---|
593 | var MAT_FORM_FIELD = new core.InjectionToken('MatFormField');
|
---|
594 | /** Container for form controls that applies Material Design styling and behavior. */
|
---|
595 | var MatFormField = /** @class */ (function (_super) {
|
---|
596 | __extends(MatFormField, _super);
|
---|
597 | function MatFormField(elementRef, _changeDetectorRef,
|
---|
598 | /**
|
---|
599 | * @deprecated `_labelOptions` parameter no longer being used. To be removed.
|
---|
600 | * @breaking-change 12.0.0
|
---|
601 | */
|
---|
602 | // Use `ElementRef` here so Angular has something to inject.
|
---|
603 | _labelOptions, _dir, _defaults, _platform, _ngZone, _animationMode) {
|
---|
604 | var _this = _super.call(this, elementRef) || this;
|
---|
605 | _this._changeDetectorRef = _changeDetectorRef;
|
---|
606 | _this._dir = _dir;
|
---|
607 | _this._defaults = _defaults;
|
---|
608 | _this._platform = _platform;
|
---|
609 | _this._ngZone = _ngZone;
|
---|
610 | /**
|
---|
611 | * Whether the outline gap needs to be calculated
|
---|
612 | * immediately on the next change detection run.
|
---|
613 | */
|
---|
614 | _this._outlineGapCalculationNeededImmediately = false;
|
---|
615 | /** Whether the outline gap needs to be calculated next time the zone has stabilized. */
|
---|
616 | _this._outlineGapCalculationNeededOnStable = false;
|
---|
617 | _this._destroyed = new rxjs.Subject();
|
---|
618 | /** Override for the logic that disables the label animation in certain cases. */
|
---|
619 | _this._showAlwaysAnimate = false;
|
---|
620 | /** State of the mat-hint and mat-error animations. */
|
---|
621 | _this._subscriptAnimationState = '';
|
---|
622 | _this._hintLabel = '';
|
---|
623 | // Unique id for the hint label.
|
---|
624 | _this._hintLabelId = "mat-hint-" + nextUniqueId++;
|
---|
625 | // Unique id for the label element.
|
---|
626 | _this._labelId = "mat-form-field-label-" + nextUniqueId++;
|
---|
627 | _this.floatLabel = _this._getDefaultFloatLabelState();
|
---|
628 | _this._animationsEnabled = _animationMode !== 'NoopAnimations';
|
---|
629 | // Set the default through here so we invoke the setter on the first run.
|
---|
630 | _this.appearance = (_defaults && _defaults.appearance) ? _defaults.appearance : 'legacy';
|
---|
631 | _this._hideRequiredMarker = (_defaults && _defaults.hideRequiredMarker != null) ?
|
---|
632 | _defaults.hideRequiredMarker : false;
|
---|
633 | return _this;
|
---|
634 | }
|
---|
635 | Object.defineProperty(MatFormField.prototype, "appearance", {
|
---|
636 | /** The form-field appearance style. */
|
---|
637 | get: function () { return this._appearance; },
|
---|
638 | set: function (value) {
|
---|
639 | var oldValue = this._appearance;
|
---|
640 | this._appearance = value || (this._defaults && this._defaults.appearance) || 'legacy';
|
---|
641 | if (this._appearance === 'outline' && oldValue !== value) {
|
---|
642 | this._outlineGapCalculationNeededOnStable = true;
|
---|
643 | }
|
---|
644 | },
|
---|
645 | enumerable: false,
|
---|
646 | configurable: true
|
---|
647 | });
|
---|
648 | Object.defineProperty(MatFormField.prototype, "hideRequiredMarker", {
|
---|
649 | /** Whether the required marker should be hidden. */
|
---|
650 | get: function () { return this._hideRequiredMarker; },
|
---|
651 | set: function (value) {
|
---|
652 | this._hideRequiredMarker = coercion.coerceBooleanProperty(value);
|
---|
653 | },
|
---|
654 | enumerable: false,
|
---|
655 | configurable: true
|
---|
656 | });
|
---|
657 | /** Whether the floating label should always float or not. */
|
---|
658 | MatFormField.prototype._shouldAlwaysFloat = function () {
|
---|
659 | return this.floatLabel === 'always' && !this._showAlwaysAnimate;
|
---|
660 | };
|
---|
661 | /** Whether the label can float or not. */
|
---|
662 | MatFormField.prototype._canLabelFloat = function () { return this.floatLabel !== 'never'; };
|
---|
663 | Object.defineProperty(MatFormField.prototype, "hintLabel", {
|
---|
664 | /** Text for the form field hint. */
|
---|
665 | get: function () { return this._hintLabel; },
|
---|
666 | set: function (value) {
|
---|
667 | this._hintLabel = value;
|
---|
668 | this._processHints();
|
---|
669 | },
|
---|
670 | enumerable: false,
|
---|
671 | configurable: true
|
---|
672 | });
|
---|
673 | Object.defineProperty(MatFormField.prototype, "floatLabel", {
|
---|
674 | /**
|
---|
675 | * Whether the label should always float, never float or float as the user types.
|
---|
676 | *
|
---|
677 | * Note: only the legacy appearance supports the `never` option. `never` was originally added as a
|
---|
678 | * way to make the floating label emulate the behavior of a standard input placeholder. However
|
---|
679 | * the form field now supports both floating labels and placeholders. Therefore in the non-legacy
|
---|
680 | * appearances the `never` option has been disabled in favor of just using the placeholder.
|
---|
681 | */
|
---|
682 | get: function () {
|
---|
683 | return this.appearance !== 'legacy' && this._floatLabel === 'never' ? 'auto' : this._floatLabel;
|
---|
684 | },
|
---|
685 | set: function (value) {
|
---|
686 | if (value !== this._floatLabel) {
|
---|
687 | this._floatLabel = value || this._getDefaultFloatLabelState();
|
---|
688 | this._changeDetectorRef.markForCheck();
|
---|
689 | }
|
---|
690 | },
|
---|
691 | enumerable: false,
|
---|
692 | configurable: true
|
---|
693 | });
|
---|
694 | Object.defineProperty(MatFormField.prototype, "_control", {
|
---|
695 | get: function () {
|
---|
696 | // TODO(crisbeto): we need this workaround in order to support both Ivy and ViewEngine.
|
---|
697 | // We should clean this up once Ivy is the default renderer.
|
---|
698 | return this._explicitFormFieldControl || this._controlNonStatic || this._controlStatic;
|
---|
699 | },
|
---|
700 | set: function (value) {
|
---|
701 | this._explicitFormFieldControl = value;
|
---|
702 | },
|
---|
703 | enumerable: false,
|
---|
704 | configurable: true
|
---|
705 | });
|
---|
706 | /**
|
---|
707 | * Gets the id of the label element. If no label is present, returns `null`.
|
---|
708 | */
|
---|
709 | MatFormField.prototype.getLabelId = function () {
|
---|
710 | return this._hasFloatingLabel() ? this._labelId : null;
|
---|
711 | };
|
---|
712 | /**
|
---|
713 | * Gets an ElementRef for the element that a overlay attached to the form-field should be
|
---|
714 | * positioned relative to.
|
---|
715 | */
|
---|
716 | MatFormField.prototype.getConnectedOverlayOrigin = function () {
|
---|
717 | return this._connectionContainerRef || this._elementRef;
|
---|
718 | };
|
---|
719 | MatFormField.prototype.ngAfterContentInit = function () {
|
---|
720 | var _this = this;
|
---|
721 | this._validateControlChild();
|
---|
722 | var control = this._control;
|
---|
723 | if (control.controlType) {
|
---|
724 | this._elementRef.nativeElement.classList.add("mat-form-field-type-" + control.controlType);
|
---|
725 | }
|
---|
726 | // Subscribe to changes in the child control state in order to update the form field UI.
|
---|
727 | control.stateChanges.pipe(operators.startWith(null)).subscribe(function () {
|
---|
728 | _this._validatePlaceholders();
|
---|
729 | _this._syncDescribedByIds();
|
---|
730 | _this._changeDetectorRef.markForCheck();
|
---|
731 | });
|
---|
732 | // Run change detection if the value changes.
|
---|
733 | if (control.ngControl && control.ngControl.valueChanges) {
|
---|
734 | control.ngControl.valueChanges
|
---|
735 | .pipe(operators.takeUntil(this._destroyed))
|
---|
736 | .subscribe(function () { return _this._changeDetectorRef.markForCheck(); });
|
---|
737 | }
|
---|
738 | // Note that we have to run outside of the `NgZone` explicitly,
|
---|
739 | // in order to avoid throwing users into an infinite loop
|
---|
740 | // if `zone-patch-rxjs` is included.
|
---|
741 | this._ngZone.runOutsideAngular(function () {
|
---|
742 | _this._ngZone.onStable.pipe(operators.takeUntil(_this._destroyed)).subscribe(function () {
|
---|
743 | if (_this._outlineGapCalculationNeededOnStable) {
|
---|
744 | _this.updateOutlineGap();
|
---|
745 | }
|
---|
746 | });
|
---|
747 | });
|
---|
748 | // Run change detection and update the outline if the suffix or prefix changes.
|
---|
749 | rxjs.merge(this._prefixChildren.changes, this._suffixChildren.changes).subscribe(function () {
|
---|
750 | _this._outlineGapCalculationNeededOnStable = true;
|
---|
751 | _this._changeDetectorRef.markForCheck();
|
---|
752 | });
|
---|
753 | // Re-validate when the number of hints changes.
|
---|
754 | this._hintChildren.changes.pipe(operators.startWith(null)).subscribe(function () {
|
---|
755 | _this._processHints();
|
---|
756 | _this._changeDetectorRef.markForCheck();
|
---|
757 | });
|
---|
758 | // Update the aria-described by when the number of errors changes.
|
---|
759 | this._errorChildren.changes.pipe(operators.startWith(null)).subscribe(function () {
|
---|
760 | _this._syncDescribedByIds();
|
---|
761 | _this._changeDetectorRef.markForCheck();
|
---|
762 | });
|
---|
763 | if (this._dir) {
|
---|
764 | this._dir.change.pipe(operators.takeUntil(this._destroyed)).subscribe(function () {
|
---|
765 | if (typeof requestAnimationFrame === 'function') {
|
---|
766 | _this._ngZone.runOutsideAngular(function () {
|
---|
767 | requestAnimationFrame(function () { return _this.updateOutlineGap(); });
|
---|
768 | });
|
---|
769 | }
|
---|
770 | else {
|
---|
771 | _this.updateOutlineGap();
|
---|
772 | }
|
---|
773 | });
|
---|
774 | }
|
---|
775 | };
|
---|
776 | MatFormField.prototype.ngAfterContentChecked = function () {
|
---|
777 | this._validateControlChild();
|
---|
778 | if (this._outlineGapCalculationNeededImmediately) {
|
---|
779 | this.updateOutlineGap();
|
---|
780 | }
|
---|
781 | };
|
---|
782 | MatFormField.prototype.ngAfterViewInit = function () {
|
---|
783 | // Avoid animations on load.
|
---|
784 | this._subscriptAnimationState = 'enter';
|
---|
785 | this._changeDetectorRef.detectChanges();
|
---|
786 | };
|
---|
787 | MatFormField.prototype.ngOnDestroy = function () {
|
---|
788 | this._destroyed.next();
|
---|
789 | this._destroyed.complete();
|
---|
790 | };
|
---|
791 | /** Determines whether a class from the NgControl should be forwarded to the host element. */
|
---|
792 | MatFormField.prototype._shouldForward = function (prop) {
|
---|
793 | var ngControl = this._control ? this._control.ngControl : null;
|
---|
794 | return ngControl && ngControl[prop];
|
---|
795 | };
|
---|
796 | MatFormField.prototype._hasPlaceholder = function () {
|
---|
797 | return !!(this._control && this._control.placeholder || this._placeholderChild);
|
---|
798 | };
|
---|
799 | MatFormField.prototype._hasLabel = function () {
|
---|
800 | return !!(this._labelChildNonStatic || this._labelChildStatic);
|
---|
801 | };
|
---|
802 | MatFormField.prototype._shouldLabelFloat = function () {
|
---|
803 | return this._canLabelFloat() &&
|
---|
804 | ((this._control && this._control.shouldLabelFloat) || this._shouldAlwaysFloat());
|
---|
805 | };
|
---|
806 | MatFormField.prototype._hideControlPlaceholder = function () {
|
---|
807 | // In the legacy appearance the placeholder is promoted to a label if no label is given.
|
---|
808 | return this.appearance === 'legacy' && !this._hasLabel() ||
|
---|
809 | this._hasLabel() && !this._shouldLabelFloat();
|
---|
810 | };
|
---|
811 | MatFormField.prototype._hasFloatingLabel = function () {
|
---|
812 | // In the legacy appearance the placeholder is promoted to a label if no label is given.
|
---|
813 | return this._hasLabel() || this.appearance === 'legacy' && this._hasPlaceholder();
|
---|
814 | };
|
---|
815 | /** Determines whether to display hints or errors. */
|
---|
816 | MatFormField.prototype._getDisplayedMessages = function () {
|
---|
817 | return (this._errorChildren && this._errorChildren.length > 0 &&
|
---|
818 | this._control.errorState) ? 'error' : 'hint';
|
---|
819 | };
|
---|
820 | /** Animates the placeholder up and locks it in position. */
|
---|
821 | MatFormField.prototype._animateAndLockLabel = function () {
|
---|
822 | var _this = this;
|
---|
823 | if (this._hasFloatingLabel() && this._canLabelFloat()) {
|
---|
824 | // If animations are disabled, we shouldn't go in here,
|
---|
825 | // because the `transitionend` will never fire.
|
---|
826 | if (this._animationsEnabled && this._label) {
|
---|
827 | this._showAlwaysAnimate = true;
|
---|
828 | rxjs.fromEvent(this._label.nativeElement, 'transitionend').pipe(operators.take(1)).subscribe(function () {
|
---|
829 | _this._showAlwaysAnimate = false;
|
---|
830 | });
|
---|
831 | }
|
---|
832 | this.floatLabel = 'always';
|
---|
833 | this._changeDetectorRef.markForCheck();
|
---|
834 | }
|
---|
835 | };
|
---|
836 | /**
|
---|
837 | * Ensure that there is only one placeholder (either `placeholder` attribute on the child control
|
---|
838 | * or child element with the `mat-placeholder` directive).
|
---|
839 | */
|
---|
840 | MatFormField.prototype._validatePlaceholders = function () {
|
---|
841 | if (this._control.placeholder && this._placeholderChild &&
|
---|
842 | (typeof ngDevMode === 'undefined' || ngDevMode)) {
|
---|
843 | throw getMatFormFieldPlaceholderConflictError();
|
---|
844 | }
|
---|
845 | };
|
---|
846 | /** Does any extra processing that is required when handling the hints. */
|
---|
847 | MatFormField.prototype._processHints = function () {
|
---|
848 | this._validateHints();
|
---|
849 | this._syncDescribedByIds();
|
---|
850 | };
|
---|
851 | /**
|
---|
852 | * Ensure that there is a maximum of one of each `<mat-hint>` alignment specified, with the
|
---|
853 | * attribute being considered as `align="start"`.
|
---|
854 | */
|
---|
855 | MatFormField.prototype._validateHints = function () {
|
---|
856 | var _this = this;
|
---|
857 | if (this._hintChildren && (typeof ngDevMode === 'undefined' || ngDevMode)) {
|
---|
858 | var startHint_1;
|
---|
859 | var endHint_1;
|
---|
860 | this._hintChildren.forEach(function (hint) {
|
---|
861 | if (hint.align === 'start') {
|
---|
862 | if (startHint_1 || _this.hintLabel) {
|
---|
863 | throw getMatFormFieldDuplicatedHintError('start');
|
---|
864 | }
|
---|
865 | startHint_1 = hint;
|
---|
866 | }
|
---|
867 | else if (hint.align === 'end') {
|
---|
868 | if (endHint_1) {
|
---|
869 | throw getMatFormFieldDuplicatedHintError('end');
|
---|
870 | }
|
---|
871 | endHint_1 = hint;
|
---|
872 | }
|
---|
873 | });
|
---|
874 | }
|
---|
875 | };
|
---|
876 | /** Gets the default float label state. */
|
---|
877 | MatFormField.prototype._getDefaultFloatLabelState = function () {
|
---|
878 | return (this._defaults && this._defaults.floatLabel) || 'auto';
|
---|
879 | };
|
---|
880 | /**
|
---|
881 | * Sets the list of element IDs that describe the child control. This allows the control to update
|
---|
882 | * its `aria-describedby` attribute accordingly.
|
---|
883 | */
|
---|
884 | MatFormField.prototype._syncDescribedByIds = function () {
|
---|
885 | if (this._control) {
|
---|
886 | var ids = [];
|
---|
887 | // TODO(wagnermaciel): Remove the type check when we find the root cause of this bug.
|
---|
888 | if (this._control.userAriaDescribedBy &&
|
---|
889 | typeof this._control.userAriaDescribedBy === 'string') {
|
---|
890 | ids.push.apply(ids, __spreadArray([], __read(this._control.userAriaDescribedBy.split(' '))));
|
---|
891 | }
|
---|
892 | if (this._getDisplayedMessages() === 'hint') {
|
---|
893 | var startHint = this._hintChildren ?
|
---|
894 | this._hintChildren.find(function (hint) { return hint.align === 'start'; }) : null;
|
---|
895 | var endHint = this._hintChildren ?
|
---|
896 | this._hintChildren.find(function (hint) { return hint.align === 'end'; }) : null;
|
---|
897 | if (startHint) {
|
---|
898 | ids.push(startHint.id);
|
---|
899 | }
|
---|
900 | else if (this._hintLabel) {
|
---|
901 | ids.push(this._hintLabelId);
|
---|
902 | }
|
---|
903 | if (endHint) {
|
---|
904 | ids.push(endHint.id);
|
---|
905 | }
|
---|
906 | }
|
---|
907 | else if (this._errorChildren) {
|
---|
908 | ids.push.apply(ids, __spreadArray([], __read(this._errorChildren.map(function (error) { return error.id; }))));
|
---|
909 | }
|
---|
910 | this._control.setDescribedByIds(ids);
|
---|
911 | }
|
---|
912 | };
|
---|
913 | /** Throws an error if the form field's control is missing. */
|
---|
914 | MatFormField.prototype._validateControlChild = function () {
|
---|
915 | if (!this._control && (typeof ngDevMode === 'undefined' || ngDevMode)) {
|
---|
916 | throw getMatFormFieldMissingControlError();
|
---|
917 | }
|
---|
918 | };
|
---|
919 | /**
|
---|
920 | * Updates the width and position of the gap in the outline. Only relevant for the outline
|
---|
921 | * appearance.
|
---|
922 | */
|
---|
923 | MatFormField.prototype.updateOutlineGap = function () {
|
---|
924 | var labelEl = this._label ? this._label.nativeElement : null;
|
---|
925 | if (this.appearance !== 'outline' || !labelEl || !labelEl.children.length ||
|
---|
926 | !labelEl.textContent.trim()) {
|
---|
927 | return;
|
---|
928 | }
|
---|
929 | if (!this._platform.isBrowser) {
|
---|
930 | // getBoundingClientRect isn't available on the server.
|
---|
931 | return;
|
---|
932 | }
|
---|
933 | // If the element is not present in the DOM, the outline gap will need to be calculated
|
---|
934 | // the next time it is checked and in the DOM.
|
---|
935 | if (!this._isAttachedToDOM()) {
|
---|
936 | this._outlineGapCalculationNeededImmediately = true;
|
---|
937 | return;
|
---|
938 | }
|
---|
939 | var startWidth = 0;
|
---|
940 | var gapWidth = 0;
|
---|
941 | var container = this._connectionContainerRef.nativeElement;
|
---|
942 | var startEls = container.querySelectorAll('.mat-form-field-outline-start');
|
---|
943 | var gapEls = container.querySelectorAll('.mat-form-field-outline-gap');
|
---|
944 | if (this._label && this._label.nativeElement.children.length) {
|
---|
945 | var containerRect = container.getBoundingClientRect();
|
---|
946 | // If the container's width and height are zero, it means that the element is
|
---|
947 | // invisible and we can't calculate the outline gap. Mark the element as needing
|
---|
948 | // to be checked the next time the zone stabilizes. We can't do this immediately
|
---|
949 | // on the next change detection, because even if the element becomes visible,
|
---|
950 | // the `ClientRect` won't be reclaculated immediately. We reset the
|
---|
951 | // `_outlineGapCalculationNeededImmediately` flag some we don't run the checks twice.
|
---|
952 | if (containerRect.width === 0 && containerRect.height === 0) {
|
---|
953 | this._outlineGapCalculationNeededOnStable = true;
|
---|
954 | this._outlineGapCalculationNeededImmediately = false;
|
---|
955 | return;
|
---|
956 | }
|
---|
957 | var containerStart = this._getStartEnd(containerRect);
|
---|
958 | var labelChildren = labelEl.children;
|
---|
959 | var labelStart = this._getStartEnd(labelChildren[0].getBoundingClientRect());
|
---|
960 | var labelWidth = 0;
|
---|
961 | for (var i = 0; i < labelChildren.length; i++) {
|
---|
962 | labelWidth += labelChildren[i].offsetWidth;
|
---|
963 | }
|
---|
964 | startWidth = Math.abs(labelStart - containerStart) - outlineGapPadding;
|
---|
965 | gapWidth = labelWidth > 0 ? labelWidth * floatingLabelScale + outlineGapPadding * 2 : 0;
|
---|
966 | }
|
---|
967 | for (var i = 0; i < startEls.length; i++) {
|
---|
968 | startEls[i].style.width = startWidth + "px";
|
---|
969 | }
|
---|
970 | for (var i = 0; i < gapEls.length; i++) {
|
---|
971 | gapEls[i].style.width = gapWidth + "px";
|
---|
972 | }
|
---|
973 | this._outlineGapCalculationNeededOnStable =
|
---|
974 | this._outlineGapCalculationNeededImmediately = false;
|
---|
975 | };
|
---|
976 | /** Gets the start end of the rect considering the current directionality. */
|
---|
977 | MatFormField.prototype._getStartEnd = function (rect) {
|
---|
978 | return (this._dir && this._dir.value === 'rtl') ? rect.right : rect.left;
|
---|
979 | };
|
---|
980 | /** Checks whether the form field is attached to the DOM. */
|
---|
981 | MatFormField.prototype._isAttachedToDOM = function () {
|
---|
982 | var element = this._elementRef.nativeElement;
|
---|
983 | if (element.getRootNode) {
|
---|
984 | var rootNode = element.getRootNode();
|
---|
985 | // If the element is inside the DOM the root node will be either the document
|
---|
986 | // or the closest shadow root, otherwise it'll be the element itself.
|
---|
987 | return rootNode && rootNode !== element;
|
---|
988 | }
|
---|
989 | // Otherwise fall back to checking if it's in the document. This doesn't account for
|
---|
990 | // shadow DOM, however browser that support shadow DOM should support `getRootNode` as well.
|
---|
991 | return document.documentElement.contains(element);
|
---|
992 | };
|
---|
993 | return MatFormField;
|
---|
994 | }(_MatFormFieldBase));
|
---|
995 | MatFormField.decorators = [
|
---|
996 | { type: core.Component, args: [{
|
---|
997 | selector: 'mat-form-field',
|
---|
998 | exportAs: 'matFormField',
|
---|
999 | template: "<div class=\"mat-form-field-wrapper\">\n <div class=\"mat-form-field-flex\" #connectionContainer\n (click)=\"_control.onContainerClick && _control.onContainerClick($event)\">\n\n <!-- Outline used for outline appearance. -->\n <ng-container *ngIf=\"appearance == 'outline'\">\n <div class=\"mat-form-field-outline\">\n <div class=\"mat-form-field-outline-start\"></div>\n <div class=\"mat-form-field-outline-gap\"></div>\n <div class=\"mat-form-field-outline-end\"></div>\n </div>\n <div class=\"mat-form-field-outline mat-form-field-outline-thick\">\n <div class=\"mat-form-field-outline-start\"></div>\n <div class=\"mat-form-field-outline-gap\"></div>\n <div class=\"mat-form-field-outline-end\"></div>\n </div>\n </ng-container>\n\n <div class=\"mat-form-field-prefix\" *ngIf=\"_prefixChildren.length\">\n <ng-content select=\"[matPrefix]\"></ng-content>\n </div>\n\n <div class=\"mat-form-field-infix\" #inputContainer>\n <ng-content></ng-content>\n\n <span class=\"mat-form-field-label-wrapper\">\n <!-- We add aria-owns as a workaround for an issue in JAWS & NVDA where the label isn't\n read if it comes before the control in the DOM. -->\n <label class=\"mat-form-field-label\"\n (cdkObserveContent)=\"updateOutlineGap()\"\n [cdkObserveContentDisabled]=\"appearance != 'outline'\"\n [id]=\"_labelId\"\n [attr.for]=\"_control.id\"\n [attr.aria-owns]=\"_control.id\"\n [class.mat-empty]=\"_control.empty && !_shouldAlwaysFloat()\"\n [class.mat-form-field-empty]=\"_control.empty && !_shouldAlwaysFloat()\"\n [class.mat-accent]=\"color == 'accent'\"\n [class.mat-warn]=\"color == 'warn'\"\n #label\n *ngIf=\"_hasFloatingLabel()\"\n [ngSwitch]=\"_hasLabel()\">\n\n <!-- @breaking-change 8.0.0 remove in favor of mat-label element an placeholder attr. -->\n <ng-container *ngSwitchCase=\"false\">\n <ng-content select=\"mat-placeholder\"></ng-content>\n <span>{{_control.placeholder}}</span>\n </ng-container>\n\n <ng-content select=\"mat-label\" *ngSwitchCase=\"true\"></ng-content>\n\n <!-- @breaking-change 8.0.0 remove `mat-placeholder-required` class -->\n <span\n class=\"mat-placeholder-required mat-form-field-required-marker\"\n aria-hidden=\"true\"\n *ngIf=\"!hideRequiredMarker && _control.required && !_control.disabled\"> *</span>\n </label>\n </span>\n </div>\n\n <div class=\"mat-form-field-suffix\" *ngIf=\"_suffixChildren.length\">\n <ng-content select=\"[matSuffix]\"></ng-content>\n </div>\n </div>\n\n <!-- Underline used for legacy, standard, and box appearances. -->\n <div class=\"mat-form-field-underline\" #underline\n *ngIf=\"appearance != 'outline'\">\n <span class=\"mat-form-field-ripple\"\n [class.mat-accent]=\"color == 'accent'\"\n [class.mat-warn]=\"color == 'warn'\"></span>\n </div>\n\n <div class=\"mat-form-field-subscript-wrapper\"\n [ngSwitch]=\"_getDisplayedMessages()\">\n <div *ngSwitchCase=\"'error'\" [@transitionMessages]=\"_subscriptAnimationState\">\n <ng-content select=\"mat-error\"></ng-content>\n </div>\n\n <div class=\"mat-form-field-hint-wrapper\" *ngSwitchCase=\"'hint'\"\n [@transitionMessages]=\"_subscriptAnimationState\">\n <!-- TODO(mmalerba): use an actual <mat-hint> once all selectors are switched to mat-* -->\n <div *ngIf=\"hintLabel\" [id]=\"_hintLabelId\" class=\"mat-hint\">{{hintLabel}}</div>\n <ng-content select=\"mat-hint:not([align='end'])\"></ng-content>\n <div class=\"mat-form-field-hint-spacer\"></div>\n <ng-content select=\"mat-hint[align='end']\"></ng-content>\n </div>\n </div>\n</div>\n",
|
---|
1000 | animations: [matFormFieldAnimations.transitionMessages],
|
---|
1001 | host: {
|
---|
1002 | 'class': 'mat-form-field',
|
---|
1003 | '[class.mat-form-field-appearance-standard]': 'appearance == "standard"',
|
---|
1004 | '[class.mat-form-field-appearance-fill]': 'appearance == "fill"',
|
---|
1005 | '[class.mat-form-field-appearance-outline]': 'appearance == "outline"',
|
---|
1006 | '[class.mat-form-field-appearance-legacy]': 'appearance == "legacy"',
|
---|
1007 | '[class.mat-form-field-invalid]': '_control.errorState',
|
---|
1008 | '[class.mat-form-field-can-float]': '_canLabelFloat()',
|
---|
1009 | '[class.mat-form-field-should-float]': '_shouldLabelFloat()',
|
---|
1010 | '[class.mat-form-field-has-label]': '_hasFloatingLabel()',
|
---|
1011 | '[class.mat-form-field-hide-placeholder]': '_hideControlPlaceholder()',
|
---|
1012 | '[class.mat-form-field-disabled]': '_control.disabled',
|
---|
1013 | '[class.mat-form-field-autofilled]': '_control.autofilled',
|
---|
1014 | '[class.mat-focused]': '_control.focused',
|
---|
1015 | '[class.ng-untouched]': '_shouldForward("untouched")',
|
---|
1016 | '[class.ng-touched]': '_shouldForward("touched")',
|
---|
1017 | '[class.ng-pristine]': '_shouldForward("pristine")',
|
---|
1018 | '[class.ng-dirty]': '_shouldForward("dirty")',
|
---|
1019 | '[class.ng-valid]': '_shouldForward("valid")',
|
---|
1020 | '[class.ng-invalid]': '_shouldForward("invalid")',
|
---|
1021 | '[class.ng-pending]': '_shouldForward("pending")',
|
---|
1022 | '[class._mat-animation-noopable]': '!_animationsEnabled',
|
---|
1023 | },
|
---|
1024 | inputs: ['color'],
|
---|
1025 | encapsulation: core.ViewEncapsulation.None,
|
---|
1026 | changeDetection: core.ChangeDetectionStrategy.OnPush,
|
---|
1027 | providers: [
|
---|
1028 | { provide: MAT_FORM_FIELD, useExisting: MatFormField },
|
---|
1029 | ],
|
---|
1030 | styles: [".mat-form-field{display:inline-block;position:relative;text-align:left}[dir=rtl] .mat-form-field{text-align:right}.mat-form-field-wrapper{position:relative}.mat-form-field-flex{display:inline-flex;align-items:baseline;box-sizing:border-box;width:100%}.mat-form-field-prefix,.mat-form-field-suffix{white-space:nowrap;flex:none;position:relative}.mat-form-field-infix{display:block;position:relative;flex:auto;min-width:0;width:180px}.cdk-high-contrast-active .mat-form-field-infix{border-image:linear-gradient(transparent, transparent)}.mat-form-field-label-wrapper{position:absolute;left:0;box-sizing:content-box;width:100%;height:100%;overflow:hidden;pointer-events:none}[dir=rtl] .mat-form-field-label-wrapper{left:auto;right:0}.mat-form-field-label{position:absolute;left:0;font:inherit;pointer-events:none;width:100%;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;transform-origin:0 0;transition:transform 400ms cubic-bezier(0.25, 0.8, 0.25, 1),color 400ms cubic-bezier(0.25, 0.8, 0.25, 1),width 400ms cubic-bezier(0.25, 0.8, 0.25, 1);display:none}[dir=rtl] .mat-form-field-label{transform-origin:100% 0;left:auto;right:0}.mat-form-field-empty.mat-form-field-label,.mat-form-field-can-float.mat-form-field-should-float .mat-form-field-label{display:block}.mat-form-field-autofill-control:-webkit-autofill+.mat-form-field-label-wrapper .mat-form-field-label{display:none}.mat-form-field-can-float .mat-form-field-autofill-control:-webkit-autofill+.mat-form-field-label-wrapper .mat-form-field-label{display:block;transition:none}.mat-input-server:focus+.mat-form-field-label-wrapper .mat-form-field-label,.mat-input-server[placeholder]:not(:placeholder-shown)+.mat-form-field-label-wrapper .mat-form-field-label{display:none}.mat-form-field-can-float .mat-input-server:focus+.mat-form-field-label-wrapper .mat-form-field-label,.mat-form-field-can-float .mat-input-server[placeholder]:not(:placeholder-shown)+.mat-form-field-label-wrapper .mat-form-field-label{display:block}.mat-form-field-label:not(.mat-form-field-empty){transition:none}.mat-form-field-underline{position:absolute;width:100%;pointer-events:none;transform:scale3d(1, 1.0001, 1)}.mat-form-field-ripple{position:absolute;left:0;width:100%;transform-origin:50%;transform:scaleX(0.5);opacity:0;transition:background-color 300ms cubic-bezier(0.55, 0, 0.55, 0.2)}.mat-form-field.mat-focused .mat-form-field-ripple,.mat-form-field.mat-form-field-invalid .mat-form-field-ripple{opacity:1;transform:none;transition:transform 300ms cubic-bezier(0.25, 0.8, 0.25, 1),opacity 100ms cubic-bezier(0.25, 0.8, 0.25, 1),background-color 300ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-form-field-subscript-wrapper{position:absolute;box-sizing:border-box;width:100%;overflow:hidden}.mat-form-field-subscript-wrapper .mat-icon,.mat-form-field-label-wrapper .mat-icon{width:1em;height:1em;font-size:inherit;vertical-align:baseline}.mat-form-field-hint-wrapper{display:flex}.mat-form-field-hint-spacer{flex:1 0 1em}.mat-error{display:block}.mat-form-field-control-wrapper{position:relative}.mat-form-field-hint-end{order:1}.mat-form-field._mat-animation-noopable .mat-form-field-label,.mat-form-field._mat-animation-noopable .mat-form-field-ripple{transition:none}\n", ".mat-form-field-appearance-fill .mat-form-field-flex{border-radius:4px 4px 0 0;padding:.75em .75em 0 .75em}.cdk-high-contrast-active .mat-form-field-appearance-fill .mat-form-field-flex{outline:solid 1px}.cdk-high-contrast-active .mat-form-field-appearance-fill.mat-focused .mat-form-field-flex{outline:dashed 3px}.mat-form-field-appearance-fill .mat-form-field-underline::before{content:\"\";display:block;position:absolute;bottom:0;height:1px;width:100%}.mat-form-field-appearance-fill .mat-form-field-ripple{bottom:0;height:2px}.cdk-high-contrast-active .mat-form-field-appearance-fill .mat-form-field-ripple{height:0}.mat-form-field-appearance-fill:not(.mat-form-field-disabled) .mat-form-field-flex:hover~.mat-form-field-underline .mat-form-field-ripple{opacity:1;transform:none;transition:opacity 600ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-form-field-appearance-fill._mat-animation-noopable:not(.mat-form-field-disabled) .mat-form-field-flex:hover~.mat-form-field-underline .mat-form-field-ripple{transition:none}.mat-form-field-appearance-fill .mat-form-field-subscript-wrapper{padding:0 1em}\n", ".mat-input-element{font:inherit;background:transparent;color:currentColor;border:none;outline:none;padding:0;margin:0;width:100%;max-width:100%;vertical-align:bottom;text-align:inherit;box-sizing:content-box}.mat-input-element:-moz-ui-invalid{box-shadow:none}.mat-input-element::-ms-clear,.mat-input-element::-ms-reveal{display:none}.mat-input-element,.mat-input-element::-webkit-search-cancel-button,.mat-input-element::-webkit-search-decoration,.mat-input-element::-webkit-search-results-button,.mat-input-element::-webkit-search-results-decoration{-webkit-appearance:none}.mat-input-element::-webkit-contacts-auto-fill-button,.mat-input-element::-webkit-caps-lock-indicator,.mat-input-element:not([type=password])::-webkit-credentials-auto-fill-button{visibility:hidden}.mat-input-element[type=date],.mat-input-element[type=datetime],.mat-input-element[type=datetime-local],.mat-input-element[type=month],.mat-input-element[type=week],.mat-input-element[type=time]{line-height:1}.mat-input-element[type=date]::after,.mat-input-element[type=datetime]::after,.mat-input-element[type=datetime-local]::after,.mat-input-element[type=month]::after,.mat-input-element[type=week]::after,.mat-input-element[type=time]::after{content:\" \";white-space:pre;width:1px}.mat-input-element::-webkit-inner-spin-button,.mat-input-element::-webkit-calendar-picker-indicator,.mat-input-element::-webkit-clear-button{font-size:.75em}.mat-input-element::placeholder{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;transition:color 400ms 133.3333333333ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-input-element::placeholder:-ms-input-placeholder{-ms-user-select:text}.mat-input-element::-moz-placeholder{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;transition:color 400ms 133.3333333333ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-input-element::-moz-placeholder:-ms-input-placeholder{-ms-user-select:text}.mat-input-element::-webkit-input-placeholder{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;transition:color 400ms 133.3333333333ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-input-element::-webkit-input-placeholder:-ms-input-placeholder{-ms-user-select:text}.mat-input-element:-ms-input-placeholder{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;transition:color 400ms 133.3333333333ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-input-element:-ms-input-placeholder:-ms-input-placeholder{-ms-user-select:text}.mat-form-field-hide-placeholder .mat-input-element::placeholder{color:transparent !important;-webkit-text-fill-color:transparent;transition:none}.cdk-high-contrast-active .mat-form-field-hide-placeholder .mat-input-element::placeholder{opacity:0}.mat-form-field-hide-placeholder .mat-input-element::-moz-placeholder{color:transparent !important;-webkit-text-fill-color:transparent;transition:none}.cdk-high-contrast-active .mat-form-field-hide-placeholder .mat-input-element::-moz-placeholder{opacity:0}.mat-form-field-hide-placeholder .mat-input-element::-webkit-input-placeholder{color:transparent !important;-webkit-text-fill-color:transparent;transition:none}.cdk-high-contrast-active .mat-form-field-hide-placeholder .mat-input-element::-webkit-input-placeholder{opacity:0}.mat-form-field-hide-placeholder .mat-input-element:-ms-input-placeholder{color:transparent !important;-webkit-text-fill-color:transparent;transition:none}.cdk-high-contrast-active .mat-form-field-hide-placeholder .mat-input-element:-ms-input-placeholder{opacity:0}textarea.mat-input-element{resize:vertical;overflow:auto}textarea.mat-input-element.cdk-textarea-autosize{resize:none}textarea.mat-input-element{padding:2px 0;margin:-2px 0}select.mat-input-element{-moz-appearance:none;-webkit-appearance:none;position:relative;background-color:transparent;display:inline-flex;box-sizing:border-box;padding-top:1em;top:-1em;margin-bottom:-1em}select.mat-input-element::-ms-expand{display:none}select.mat-input-element::-moz-focus-inner{border:0}select.mat-input-element:not(:disabled){cursor:pointer}select.mat-input-element::-ms-value{color:inherit;background:none}.mat-focused .cdk-high-contrast-active select.mat-input-element::-ms-value{color:inherit}.mat-form-field-type-mat-native-select .mat-form-field-infix::after{content:\"\";width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-top:5px solid;position:absolute;top:50%;right:0;margin-top:-2.5px;pointer-events:none}[dir=rtl] .mat-form-field-type-mat-native-select .mat-form-field-infix::after{right:auto;left:0}.mat-form-field-type-mat-native-select .mat-input-element{padding-right:15px}[dir=rtl] .mat-form-field-type-mat-native-select .mat-input-element{padding-right:0;padding-left:15px}.mat-form-field-type-mat-native-select .mat-form-field-label-wrapper{max-width:calc(100% - 10px)}.mat-form-field-type-mat-native-select.mat-form-field-appearance-outline .mat-form-field-infix::after{margin-top:-5px}.mat-form-field-type-mat-native-select.mat-form-field-appearance-fill .mat-form-field-infix::after{margin-top:-10px}\n", ".mat-form-field-appearance-legacy .mat-form-field-label{transform:perspective(100px);-ms-transform:none}.mat-form-field-appearance-legacy .mat-form-field-prefix .mat-icon,.mat-form-field-appearance-legacy .mat-form-field-suffix .mat-icon{width:1em}.mat-form-field-appearance-legacy .mat-form-field-prefix .mat-icon-button,.mat-form-field-appearance-legacy .mat-form-field-suffix .mat-icon-button{font:inherit;vertical-align:baseline}.mat-form-field-appearance-legacy .mat-form-field-prefix .mat-icon-button .mat-icon,.mat-form-field-appearance-legacy .mat-form-field-suffix .mat-icon-button .mat-icon{font-size:inherit}.mat-form-field-appearance-legacy .mat-form-field-underline{height:1px}.cdk-high-contrast-active .mat-form-field-appearance-legacy .mat-form-field-underline{height:0;border-top:solid 1px}.mat-form-field-appearance-legacy .mat-form-field-ripple{top:0;height:2px;overflow:hidden}.cdk-high-contrast-active .mat-form-field-appearance-legacy .mat-form-field-ripple{height:0;border-top:solid 2px}.mat-form-field-appearance-legacy.mat-form-field-disabled .mat-form-field-underline{background-position:0;background-color:transparent}.cdk-high-contrast-active .mat-form-field-appearance-legacy.mat-form-field-disabled .mat-form-field-underline{border-top-style:dotted;border-top-width:2px}.mat-form-field-appearance-legacy.mat-form-field-invalid:not(.mat-focused) .mat-form-field-ripple{height:1px}\n", ".mat-form-field-appearance-outline .mat-form-field-wrapper{margin:.25em 0}.mat-form-field-appearance-outline .mat-form-field-flex{padding:0 .75em 0 .75em;margin-top:-0.25em;position:relative}.mat-form-field-appearance-outline .mat-form-field-prefix,.mat-form-field-appearance-outline .mat-form-field-suffix{top:.25em}.mat-form-field-appearance-outline .mat-form-field-outline{display:flex;position:absolute;top:.25em;left:0;right:0;bottom:0;pointer-events:none}.mat-form-field-appearance-outline .mat-form-field-outline-start,.mat-form-field-appearance-outline .mat-form-field-outline-end{border:1px solid currentColor;min-width:5px}.mat-form-field-appearance-outline .mat-form-field-outline-start{border-radius:5px 0 0 5px;border-right-style:none}[dir=rtl] .mat-form-field-appearance-outline .mat-form-field-outline-start{border-right-style:solid;border-left-style:none;border-radius:0 5px 5px 0}.mat-form-field-appearance-outline .mat-form-field-outline-end{border-radius:0 5px 5px 0;border-left-style:none;flex-grow:1}[dir=rtl] .mat-form-field-appearance-outline .mat-form-field-outline-end{border-left-style:solid;border-right-style:none;border-radius:5px 0 0 5px}.mat-form-field-appearance-outline .mat-form-field-outline-gap{border-radius:.000001px;border:1px solid currentColor;border-left-style:none;border-right-style:none}.mat-form-field-appearance-outline.mat-form-field-can-float.mat-form-field-should-float .mat-form-field-outline-gap{border-top-color:transparent}.mat-form-field-appearance-outline .mat-form-field-outline-thick{opacity:0}.mat-form-field-appearance-outline .mat-form-field-outline-thick .mat-form-field-outline-start,.mat-form-field-appearance-outline .mat-form-field-outline-thick .mat-form-field-outline-end,.mat-form-field-appearance-outline .mat-form-field-outline-thick .mat-form-field-outline-gap{border-width:2px}.mat-form-field-appearance-outline.mat-focused .mat-form-field-outline,.mat-form-field-appearance-outline.mat-form-field-invalid .mat-form-field-outline{opacity:0;transition:opacity 100ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-form-field-appearance-outline.mat-focused .mat-form-field-outline-thick,.mat-form-field-appearance-outline.mat-form-field-invalid .mat-form-field-outline-thick{opacity:1}.cdk-high-contrast-active .mat-form-field-appearance-outline.mat-focused .mat-form-field-outline-thick{border:3px dashed}.mat-form-field-appearance-outline:not(.mat-form-field-disabled) .mat-form-field-flex:hover .mat-form-field-outline{opacity:0;transition:opacity 600ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-form-field-appearance-outline:not(.mat-form-field-disabled) .mat-form-field-flex:hover .mat-form-field-outline-thick{opacity:1}.mat-form-field-appearance-outline .mat-form-field-subscript-wrapper{padding:0 1em}.mat-form-field-appearance-outline._mat-animation-noopable:not(.mat-form-field-disabled) .mat-form-field-flex:hover~.mat-form-field-outline,.mat-form-field-appearance-outline._mat-animation-noopable .mat-form-field-outline,.mat-form-field-appearance-outline._mat-animation-noopable .mat-form-field-outline-start,.mat-form-field-appearance-outline._mat-animation-noopable .mat-form-field-outline-end,.mat-form-field-appearance-outline._mat-animation-noopable .mat-form-field-outline-gap{transition:none}\n", ".mat-form-field-appearance-standard .mat-form-field-flex{padding-top:.75em}.mat-form-field-appearance-standard .mat-form-field-underline{height:1px}.cdk-high-contrast-active .mat-form-field-appearance-standard .mat-form-field-underline{height:0;border-top:solid 1px}.mat-form-field-appearance-standard .mat-form-field-ripple{bottom:0;height:2px}.cdk-high-contrast-active .mat-form-field-appearance-standard .mat-form-field-ripple{height:0;border-top:solid 2px}.mat-form-field-appearance-standard.mat-form-field-disabled .mat-form-field-underline{background-position:0;background-color:transparent}.cdk-high-contrast-active .mat-form-field-appearance-standard.mat-form-field-disabled .mat-form-field-underline{border-top-style:dotted;border-top-width:2px}.mat-form-field-appearance-standard:not(.mat-form-field-disabled) .mat-form-field-flex:hover~.mat-form-field-underline .mat-form-field-ripple{opacity:1;transform:none;transition:opacity 600ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-form-field-appearance-standard._mat-animation-noopable:not(.mat-form-field-disabled) .mat-form-field-flex:hover~.mat-form-field-underline .mat-form-field-ripple{transition:none}\n"]
|
---|
1031 | },] }
|
---|
1032 | ];
|
---|
1033 | MatFormField.ctorParameters = function () { return [
|
---|
1034 | { type: core.ElementRef },
|
---|
1035 | { type: core.ChangeDetectorRef },
|
---|
1036 | { type: undefined, decorators: [{ type: core.Inject, args: [core.ElementRef,] }] },
|
---|
1037 | { type: bidi.Directionality, decorators: [{ type: core.Optional }] },
|
---|
1038 | { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_FORM_FIELD_DEFAULT_OPTIONS,] }] },
|
---|
1039 | { type: platform.Platform },
|
---|
1040 | { type: core.NgZone },
|
---|
1041 | { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations$1.ANIMATION_MODULE_TYPE,] }] }
|
---|
1042 | ]; };
|
---|
1043 | MatFormField.propDecorators = {
|
---|
1044 | appearance: [{ type: core.Input }],
|
---|
1045 | hideRequiredMarker: [{ type: core.Input }],
|
---|
1046 | hintLabel: [{ type: core.Input }],
|
---|
1047 | floatLabel: [{ type: core.Input }],
|
---|
1048 | underlineRef: [{ type: core.ViewChild, args: ['underline',] }],
|
---|
1049 | _connectionContainerRef: [{ type: core.ViewChild, args: ['connectionContainer', { static: true },] }],
|
---|
1050 | _inputContainerRef: [{ type: core.ViewChild, args: ['inputContainer',] }],
|
---|
1051 | _label: [{ type: core.ViewChild, args: ['label',] }],
|
---|
1052 | _controlNonStatic: [{ type: core.ContentChild, args: [MatFormFieldControl,] }],
|
---|
1053 | _controlStatic: [{ type: core.ContentChild, args: [MatFormFieldControl, { static: true },] }],
|
---|
1054 | _labelChildNonStatic: [{ type: core.ContentChild, args: [MatLabel,] }],
|
---|
1055 | _labelChildStatic: [{ type: core.ContentChild, args: [MatLabel, { static: true },] }],
|
---|
1056 | _placeholderChild: [{ type: core.ContentChild, args: [MatPlaceholder,] }],
|
---|
1057 | _errorChildren: [{ type: core.ContentChildren, args: [MAT_ERROR, { descendants: true },] }],
|
---|
1058 | _hintChildren: [{ type: core.ContentChildren, args: [_MAT_HINT, { descendants: true },] }],
|
---|
1059 | _prefixChildren: [{ type: core.ContentChildren, args: [MAT_PREFIX, { descendants: true },] }],
|
---|
1060 | _suffixChildren: [{ type: core.ContentChildren, args: [MAT_SUFFIX, { descendants: true },] }]
|
---|
1061 | };
|
---|
1062 |
|
---|
1063 | /**
|
---|
1064 | * @license
|
---|
1065 | * Copyright Google LLC All Rights Reserved.
|
---|
1066 | *
|
---|
1067 | * Use of this source code is governed by an MIT-style license that can be
|
---|
1068 | * found in the LICENSE file at https://angular.io/license
|
---|
1069 | */
|
---|
1070 | var MatFormFieldModule = /** @class */ (function () {
|
---|
1071 | function MatFormFieldModule() {
|
---|
1072 | }
|
---|
1073 | return MatFormFieldModule;
|
---|
1074 | }());
|
---|
1075 | MatFormFieldModule.decorators = [
|
---|
1076 | { type: core.NgModule, args: [{
|
---|
1077 | declarations: [
|
---|
1078 | MatError,
|
---|
1079 | MatFormField,
|
---|
1080 | MatHint,
|
---|
1081 | MatLabel,
|
---|
1082 | MatPlaceholder,
|
---|
1083 | MatPrefix,
|
---|
1084 | MatSuffix,
|
---|
1085 | ],
|
---|
1086 | imports: [
|
---|
1087 | common.CommonModule,
|
---|
1088 | core$1.MatCommonModule,
|
---|
1089 | observers.ObserversModule,
|
---|
1090 | ],
|
---|
1091 | exports: [
|
---|
1092 | core$1.MatCommonModule,
|
---|
1093 | MatError,
|
---|
1094 | MatFormField,
|
---|
1095 | MatHint,
|
---|
1096 | MatLabel,
|
---|
1097 | MatPlaceholder,
|
---|
1098 | MatPrefix,
|
---|
1099 | MatSuffix,
|
---|
1100 | ],
|
---|
1101 | },] }
|
---|
1102 | ];
|
---|
1103 |
|
---|
1104 | /**
|
---|
1105 | * @license
|
---|
1106 | * Copyright Google LLC All Rights Reserved.
|
---|
1107 | *
|
---|
1108 | * Use of this source code is governed by an MIT-style license that can be
|
---|
1109 | * found in the LICENSE file at https://angular.io/license
|
---|
1110 | */
|
---|
1111 |
|
---|
1112 | /**
|
---|
1113 | * Generated bundle index. Do not edit.
|
---|
1114 | */
|
---|
1115 |
|
---|
1116 | exports.MAT_ERROR = MAT_ERROR;
|
---|
1117 | exports.MAT_FORM_FIELD = MAT_FORM_FIELD;
|
---|
1118 | exports.MAT_FORM_FIELD_DEFAULT_OPTIONS = MAT_FORM_FIELD_DEFAULT_OPTIONS;
|
---|
1119 | exports.MAT_PREFIX = MAT_PREFIX;
|
---|
1120 | exports.MAT_SUFFIX = MAT_SUFFIX;
|
---|
1121 | exports.MatError = MatError;
|
---|
1122 | exports.MatFormField = MatFormField;
|
---|
1123 | exports.MatFormFieldControl = MatFormFieldControl;
|
---|
1124 | exports.MatFormFieldModule = MatFormFieldModule;
|
---|
1125 | exports.MatHint = MatHint;
|
---|
1126 | exports.MatLabel = MatLabel;
|
---|
1127 | exports.MatPlaceholder = MatPlaceholder;
|
---|
1128 | exports.MatPrefix = MatPrefix;
|
---|
1129 | exports.MatSuffix = MatSuffix;
|
---|
1130 | exports._MAT_HINT = _MAT_HINT;
|
---|
1131 | exports.getMatFormFieldDuplicatedHintError = getMatFormFieldDuplicatedHintError;
|
---|
1132 | exports.getMatFormFieldMissingControlError = getMatFormFieldMissingControlError;
|
---|
1133 | exports.getMatFormFieldPlaceholderConflictError = getMatFormFieldPlaceholderConflictError;
|
---|
1134 | exports.matFormFieldAnimations = matFormFieldAnimations;
|
---|
1135 |
|
---|
1136 | Object.defineProperty(exports, '__esModule', { value: true });
|
---|
1137 |
|
---|
1138 | })));
|
---|
1139 | //# sourceMappingURL=material-form-field.umd.js.map
|
---|