material-form-field.umd.js 57 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081
  1. /**
  2. * @license
  3. * Copyright Google LLC All Rights Reserved.
  4. *
  5. * Use of this source code is governed by an MIT-style license that can be
  6. * found in the LICENSE file at https://angular.io/license
  7. */
  8. (function (global, factory) {
  9. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/animations'), require('@angular/cdk/bidi'), require('@angular/cdk/coercion'), require('@angular/material/core'), require('rxjs'), require('rxjs/operators'), require('@angular/cdk/platform'), require('@angular/platform-browser/animations'), require('@angular/common'), require('@angular/cdk/observers')) :
  10. typeof define === 'function' && define.amd ? define('@angular/material/form-field', ['exports', '@angular/core', '@angular/animations', '@angular/cdk/bidi', '@angular/cdk/coercion', '@angular/material/core', 'rxjs', 'rxjs/operators', '@angular/cdk/platform', '@angular/platform-browser/animations', '@angular/common', '@angular/cdk/observers'], factory) :
  11. (factory((global.ng = global.ng || {}, global.ng.material = global.ng.material || {}, global.ng.material.formField = {}),global.ng.core,global.ng.animations,global.ng.cdk.bidi,global.ng.cdk.coercion,global.ng.material.core,global.rxjs,global.rxjs.operators,global.ng.cdk.platform,global.ng.platformBrowser.animations,global.ng.common,global.ng.cdk.observers));
  12. }(this, (function (exports,core,animations,bidi,coercion,core$1,rxjs,operators,platform,animations$1,common,observers) { 'use strict';
  13. /*! *****************************************************************************
  14. Copyright (c) Microsoft Corporation. All rights reserved.
  15. Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  16. this file except in compliance with the License. You may obtain a copy of the
  17. License at http://www.apache.org/licenses/LICENSE-2.0
  18. THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  19. KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
  20. WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
  21. MERCHANTABLITY OR NON-INFRINGEMENT.
  22. See the Apache Version 2.0 License for specific language governing permissions
  23. and limitations under the License.
  24. ***************************************************************************** */
  25. /* global Reflect, Promise */
  26. var extendStatics = function(d, b) {
  27. extendStatics = Object.setPrototypeOf ||
  28. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  29. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  30. return extendStatics(d, b);
  31. };
  32. function __extends(d, b) {
  33. extendStatics(d, b);
  34. function __() { this.constructor = d; }
  35. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  36. }
  37. /**
  38. * @fileoverview added by tsickle
  39. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  40. */
  41. /** @type {?} */
  42. var nextUniqueId = 0;
  43. /**
  44. * Single error message to be shown underneath the form field.
  45. */
  46. var MatError = /** @class */ (function () {
  47. function MatError() {
  48. this.id = "mat-error-" + nextUniqueId++;
  49. }
  50. MatError.decorators = [
  51. { type: core.Directive, args: [{
  52. selector: 'mat-error',
  53. host: {
  54. 'class': 'mat-error',
  55. 'role': 'alert',
  56. '[attr.id]': 'id',
  57. }
  58. },] },
  59. ];
  60. MatError.propDecorators = {
  61. id: [{ type: core.Input }]
  62. };
  63. return MatError;
  64. }());
  65. /**
  66. * @fileoverview added by tsickle
  67. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  68. */
  69. /**
  70. * Animations used by the MatFormField.
  71. * \@docs-private
  72. * @type {?}
  73. */
  74. var matFormFieldAnimations = {
  75. /**
  76. * Animation that transitions the form field's error and hint messages.
  77. */
  78. transitionMessages: animations.trigger('transitionMessages', [
  79. // TODO(mmalerba): Use angular animations for label animation as well.
  80. animations.state('enter', animations.style({ opacity: 1, transform: 'translateY(0%)' })),
  81. animations.transition('void => enter', [
  82. animations.style({ opacity: 0, transform: 'translateY(-100%)' }),
  83. animations.animate('300ms cubic-bezier(0.55, 0, 0.55, 0.2)'),
  84. ]),
  85. ])
  86. };
  87. /**
  88. * @fileoverview added by tsickle
  89. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  90. */
  91. /**
  92. * An interface which allows a control to work inside of a `MatFormField`.
  93. * @abstract
  94. * @template T
  95. */
  96. var /**
  97. * An interface which allows a control to work inside of a `MatFormField`.
  98. * @abstract
  99. * @template T
  100. */
  101. MatFormFieldControl = /** @class */ (function () {
  102. function MatFormFieldControl() {
  103. }
  104. return MatFormFieldControl;
  105. }());
  106. /**
  107. * @fileoverview added by tsickle
  108. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  109. */
  110. /**
  111. * \@docs-private
  112. * @return {?}
  113. */
  114. function getMatFormFieldPlaceholderConflictError() {
  115. return Error('Placeholder attribute and child element were both specified.');
  116. }
  117. /**
  118. * \@docs-private
  119. * @param {?} align
  120. * @return {?}
  121. */
  122. function getMatFormFieldDuplicatedHintError(align) {
  123. return Error("A hint was already declared for 'align=\"" + align + "\"'.");
  124. }
  125. /**
  126. * \@docs-private
  127. * @return {?}
  128. */
  129. function getMatFormFieldMissingControlError() {
  130. return Error('mat-form-field must contain a MatFormFieldControl.');
  131. }
  132. /**
  133. * @fileoverview added by tsickle
  134. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  135. */
  136. /** @type {?} */
  137. var nextUniqueId$1 = 0;
  138. /**
  139. * Hint text to be shown underneath the form field control.
  140. */
  141. var MatHint = /** @class */ (function () {
  142. function MatHint() {
  143. /**
  144. * Whether to align the hint label at the start or end of the line.
  145. */
  146. this.align = 'start';
  147. /**
  148. * Unique ID for the hint. Used for the aria-describedby on the form field control.
  149. */
  150. this.id = "mat-hint-" + nextUniqueId$1++;
  151. }
  152. MatHint.decorators = [
  153. { type: core.Directive, args: [{
  154. selector: 'mat-hint',
  155. host: {
  156. 'class': 'mat-hint',
  157. '[class.mat-right]': 'align == "end"',
  158. '[attr.id]': 'id',
  159. // Remove align attribute to prevent it from interfering with layout.
  160. '[attr.align]': 'null',
  161. }
  162. },] },
  163. ];
  164. MatHint.propDecorators = {
  165. align: [{ type: core.Input }],
  166. id: [{ type: core.Input }]
  167. };
  168. return MatHint;
  169. }());
  170. /**
  171. * @fileoverview added by tsickle
  172. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  173. */
  174. /**
  175. * The floating label for a `mat-form-field`.
  176. */
  177. var MatLabel = /** @class */ (function () {
  178. function MatLabel() {
  179. }
  180. MatLabel.decorators = [
  181. { type: core.Directive, args: [{
  182. selector: 'mat-label'
  183. },] },
  184. ];
  185. return MatLabel;
  186. }());
  187. /**
  188. * @fileoverview added by tsickle
  189. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  190. */
  191. /**
  192. * The placeholder text for an `MatFormField`.
  193. * @deprecated Use `<mat-label>` to specify the label and the `placeholder` attribute to specify the
  194. * placeholder.
  195. * \@breaking-change 8.0.0
  196. */
  197. var MatPlaceholder = /** @class */ (function () {
  198. function MatPlaceholder() {
  199. }
  200. MatPlaceholder.decorators = [
  201. { type: core.Directive, args: [{
  202. selector: 'mat-placeholder'
  203. },] },
  204. ];
  205. return MatPlaceholder;
  206. }());
  207. /**
  208. * @fileoverview added by tsickle
  209. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  210. */
  211. /**
  212. * Prefix to be placed in front of the form field.
  213. */
  214. var MatPrefix = /** @class */ (function () {
  215. function MatPrefix() {
  216. }
  217. MatPrefix.decorators = [
  218. { type: core.Directive, args: [{
  219. selector: '[matPrefix]',
  220. },] },
  221. ];
  222. return MatPrefix;
  223. }());
  224. /**
  225. * @fileoverview added by tsickle
  226. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  227. */
  228. /**
  229. * Suffix to be placed at the end of the form field.
  230. */
  231. var MatSuffix = /** @class */ (function () {
  232. function MatSuffix() {
  233. }
  234. MatSuffix.decorators = [
  235. { type: core.Directive, args: [{
  236. selector: '[matSuffix]',
  237. },] },
  238. ];
  239. return MatSuffix;
  240. }());
  241. /**
  242. * @fileoverview added by tsickle
  243. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  244. */
  245. /** @type {?} */
  246. var nextUniqueId$2 = 0;
  247. /** @type {?} */
  248. var floatingLabelScale = 0.75;
  249. /** @type {?} */
  250. var outlineGapPadding = 5;
  251. /**
  252. * Boilerplate for applying mixins to MatFormField.
  253. * \@docs-private
  254. */
  255. var /**
  256. * Boilerplate for applying mixins to MatFormField.
  257. * \@docs-private
  258. */
  259. MatFormFieldBase = /** @class */ (function () {
  260. function MatFormFieldBase(_elementRef) {
  261. this._elementRef = _elementRef;
  262. }
  263. return MatFormFieldBase;
  264. }());
  265. /**
  266. * Base class to which we're applying the form field mixins.
  267. * \@docs-private
  268. * @type {?}
  269. */
  270. var _MatFormFieldMixinBase = core$1.mixinColor(MatFormFieldBase, 'primary');
  271. /**
  272. * Injection token that can be used to configure the
  273. * default options for all form field within an app.
  274. * @type {?}
  275. */
  276. var MAT_FORM_FIELD_DEFAULT_OPTIONS = new core.InjectionToken('MAT_FORM_FIELD_DEFAULT_OPTIONS');
  277. /**
  278. * Container for form controls that applies Material Design styling and behavior.
  279. */
  280. var MatFormField = /** @class */ (function (_super) {
  281. __extends(MatFormField, _super);
  282. function MatFormField(_elementRef, _changeDetectorRef, labelOptions, _dir, _defaults, _platform, _ngZone, _animationMode) {
  283. var _this = _super.call(this, _elementRef) || this;
  284. _this._elementRef = _elementRef;
  285. _this._changeDetectorRef = _changeDetectorRef;
  286. _this._dir = _dir;
  287. _this._defaults = _defaults;
  288. _this._platform = _platform;
  289. _this._ngZone = _ngZone;
  290. /**
  291. * Whether the outline gap needs to be calculated
  292. * immediately on the next change detection run.
  293. */
  294. _this._outlineGapCalculationNeededImmediately = false;
  295. /**
  296. * Whether the outline gap needs to be calculated next time the zone has stabilized.
  297. */
  298. _this._outlineGapCalculationNeededOnStable = false;
  299. _this._destroyed = new rxjs.Subject();
  300. /**
  301. * Override for the logic that disables the label animation in certain cases.
  302. */
  303. _this._showAlwaysAnimate = false;
  304. /**
  305. * State of the mat-hint and mat-error animations.
  306. */
  307. _this._subscriptAnimationState = '';
  308. _this._hintLabel = '';
  309. // Unique id for the hint label.
  310. _this._hintLabelId = "mat-hint-" + nextUniqueId$2++;
  311. // Unique id for the internal form field label.
  312. _this._labelId = "mat-form-field-label-" + nextUniqueId$2++;
  313. _this._labelOptions = labelOptions ? labelOptions : {};
  314. _this.floatLabel = _this._labelOptions.float || 'auto';
  315. _this._animationsEnabled = _animationMode !== 'NoopAnimations';
  316. // Set the default through here so we invoke the setter on the first run.
  317. _this.appearance = (_defaults && _defaults.appearance) ? _defaults.appearance : 'legacy';
  318. return _this;
  319. }
  320. Object.defineProperty(MatFormField.prototype, "appearance", {
  321. /** The form-field appearance style. */
  322. get: /**
  323. * The form-field appearance style.
  324. * @return {?}
  325. */
  326. function () { return this._appearance; },
  327. set: /**
  328. * @param {?} value
  329. * @return {?}
  330. */
  331. function (value) {
  332. /** @type {?} */
  333. var oldValue = this._appearance;
  334. this._appearance = value || (this._defaults && this._defaults.appearance) || 'legacy';
  335. if (this._appearance === 'outline' && oldValue !== value) {
  336. this._outlineGapCalculationNeededOnStable = true;
  337. }
  338. },
  339. enumerable: true,
  340. configurable: true
  341. });
  342. Object.defineProperty(MatFormField.prototype, "hideRequiredMarker", {
  343. /** Whether the required marker should be hidden. */
  344. get: /**
  345. * Whether the required marker should be hidden.
  346. * @return {?}
  347. */
  348. function () { return this._hideRequiredMarker; },
  349. set: /**
  350. * @param {?} value
  351. * @return {?}
  352. */
  353. function (value) {
  354. this._hideRequiredMarker = coercion.coerceBooleanProperty(value);
  355. },
  356. enumerable: true,
  357. configurable: true
  358. });
  359. Object.defineProperty(MatFormField.prototype, "_shouldAlwaysFloat", {
  360. /** Whether the floating label should always float or not. */
  361. get: /**
  362. * Whether the floating label should always float or not.
  363. * @return {?}
  364. */
  365. function () {
  366. return this.floatLabel === 'always' && !this._showAlwaysAnimate;
  367. },
  368. enumerable: true,
  369. configurable: true
  370. });
  371. Object.defineProperty(MatFormField.prototype, "_canLabelFloat", {
  372. /** Whether the label can float or not. */
  373. get: /**
  374. * Whether the label can float or not.
  375. * @return {?}
  376. */
  377. function () { return this.floatLabel !== 'never'; },
  378. enumerable: true,
  379. configurable: true
  380. });
  381. Object.defineProperty(MatFormField.prototype, "hintLabel", {
  382. /** Text for the form field hint. */
  383. get: /**
  384. * Text for the form field hint.
  385. * @return {?}
  386. */
  387. function () { return this._hintLabel; },
  388. set: /**
  389. * @param {?} value
  390. * @return {?}
  391. */
  392. function (value) {
  393. this._hintLabel = value;
  394. this._processHints();
  395. },
  396. enumerable: true,
  397. configurable: true
  398. });
  399. Object.defineProperty(MatFormField.prototype, "floatLabel", {
  400. /**
  401. * Whether the label should always float, never float or float as the user types.
  402. *
  403. * Note: only the legacy appearance supports the `never` option. `never` was originally added as a
  404. * way to make the floating label emulate the behavior of a standard input placeholder. However
  405. * the form field now supports both floating labels and placeholders. Therefore in the non-legacy
  406. * appearances the `never` option has been disabled in favor of just using the placeholder.
  407. */
  408. get: /**
  409. * Whether the label should always float, never float or float as the user types.
  410. *
  411. * Note: only the legacy appearance supports the `never` option. `never` was originally added as a
  412. * way to make the floating label emulate the behavior of a standard input placeholder. However
  413. * the form field now supports both floating labels and placeholders. Therefore in the non-legacy
  414. * appearances the `never` option has been disabled in favor of just using the placeholder.
  415. * @return {?}
  416. */
  417. function () {
  418. return this.appearance !== 'legacy' && this._floatLabel === 'never' ? 'auto' : this._floatLabel;
  419. },
  420. set: /**
  421. * @param {?} value
  422. * @return {?}
  423. */
  424. function (value) {
  425. if (value !== this._floatLabel) {
  426. this._floatLabel = value || this._labelOptions.float || 'auto';
  427. this._changeDetectorRef.markForCheck();
  428. }
  429. },
  430. enumerable: true,
  431. configurable: true
  432. });
  433. Object.defineProperty(MatFormField.prototype, "_control", {
  434. get: /**
  435. * @return {?}
  436. */
  437. function () {
  438. // TODO(crisbeto): we need this hacky workaround in order to support both Ivy
  439. // and ViewEngine. We should clean this up once Ivy is the default renderer.
  440. return this._explicitFormFieldControl || this._controlNonStatic || this._controlStatic;
  441. },
  442. set: /**
  443. * @param {?} value
  444. * @return {?}
  445. */
  446. function (value) {
  447. this._explicitFormFieldControl = value;
  448. },
  449. enumerable: true,
  450. configurable: true
  451. });
  452. Object.defineProperty(MatFormField.prototype, "_labelChild", {
  453. get: /**
  454. * @return {?}
  455. */
  456. function () {
  457. return this._labelChildNonStatic || this._labelChildStatic;
  458. },
  459. enumerable: true,
  460. configurable: true
  461. });
  462. /**
  463. * Gets an ElementRef for the element that a overlay attached to the form-field should be
  464. * positioned relative to.
  465. */
  466. /**
  467. * Gets an ElementRef for the element that a overlay attached to the form-field should be
  468. * positioned relative to.
  469. * @return {?}
  470. */
  471. MatFormField.prototype.getConnectedOverlayOrigin = /**
  472. * Gets an ElementRef for the element that a overlay attached to the form-field should be
  473. * positioned relative to.
  474. * @return {?}
  475. */
  476. function () {
  477. return this._connectionContainerRef || this._elementRef;
  478. };
  479. /**
  480. * @return {?}
  481. */
  482. MatFormField.prototype.ngAfterContentInit = /**
  483. * @return {?}
  484. */
  485. function () {
  486. var _this = this;
  487. this._validateControlChild();
  488. /** @type {?} */
  489. var control = this._control;
  490. if (control.controlType) {
  491. this._elementRef.nativeElement.classList.add("mat-form-field-type-" + control.controlType);
  492. }
  493. // Subscribe to changes in the child control state in order to update the form field UI.
  494. control.stateChanges.pipe(operators.startWith((/** @type {?} */ (null)))).subscribe((/**
  495. * @return {?}
  496. */
  497. function () {
  498. _this._validatePlaceholders();
  499. _this._syncDescribedByIds();
  500. _this._changeDetectorRef.markForCheck();
  501. }));
  502. // Run change detection if the value changes.
  503. if (control.ngControl && control.ngControl.valueChanges) {
  504. control.ngControl.valueChanges
  505. .pipe(operators.takeUntil(this._destroyed))
  506. .subscribe((/**
  507. * @return {?}
  508. */
  509. function () { return _this._changeDetectorRef.markForCheck(); }));
  510. }
  511. // Note that we have to run outside of the `NgZone` explicitly,
  512. // in order to avoid throwing users into an infinite loop
  513. // if `zone-patch-rxjs` is included.
  514. this._ngZone.runOutsideAngular((/**
  515. * @return {?}
  516. */
  517. function () {
  518. _this._ngZone.onStable.asObservable().pipe(operators.takeUntil(_this._destroyed)).subscribe((/**
  519. * @return {?}
  520. */
  521. function () {
  522. if (_this._outlineGapCalculationNeededOnStable) {
  523. _this.updateOutlineGap();
  524. }
  525. }));
  526. }));
  527. // Run change detection and update the outline if the suffix or prefix changes.
  528. rxjs.merge(this._prefixChildren.changes, this._suffixChildren.changes).subscribe((/**
  529. * @return {?}
  530. */
  531. function () {
  532. _this._outlineGapCalculationNeededOnStable = true;
  533. _this._changeDetectorRef.markForCheck();
  534. }));
  535. // Re-validate when the number of hints changes.
  536. this._hintChildren.changes.pipe(operators.startWith(null)).subscribe((/**
  537. * @return {?}
  538. */
  539. function () {
  540. _this._processHints();
  541. _this._changeDetectorRef.markForCheck();
  542. }));
  543. // Update the aria-described by when the number of errors changes.
  544. this._errorChildren.changes.pipe(operators.startWith(null)).subscribe((/**
  545. * @return {?}
  546. */
  547. function () {
  548. _this._syncDescribedByIds();
  549. _this._changeDetectorRef.markForCheck();
  550. }));
  551. if (this._dir) {
  552. this._dir.change.pipe(operators.takeUntil(this._destroyed)).subscribe((/**
  553. * @return {?}
  554. */
  555. function () { return _this.updateOutlineGap(); }));
  556. }
  557. };
  558. /**
  559. * @return {?}
  560. */
  561. MatFormField.prototype.ngAfterContentChecked = /**
  562. * @return {?}
  563. */
  564. function () {
  565. this._validateControlChild();
  566. if (this._outlineGapCalculationNeededImmediately) {
  567. this.updateOutlineGap();
  568. }
  569. };
  570. /**
  571. * @return {?}
  572. */
  573. MatFormField.prototype.ngAfterViewInit = /**
  574. * @return {?}
  575. */
  576. function () {
  577. // Avoid animations on load.
  578. this._subscriptAnimationState = 'enter';
  579. this._changeDetectorRef.detectChanges();
  580. };
  581. /**
  582. * @return {?}
  583. */
  584. MatFormField.prototype.ngOnDestroy = /**
  585. * @return {?}
  586. */
  587. function () {
  588. this._destroyed.next();
  589. this._destroyed.complete();
  590. };
  591. /** Determines whether a class from the NgControl should be forwarded to the host element. */
  592. /**
  593. * Determines whether a class from the NgControl should be forwarded to the host element.
  594. * @param {?} prop
  595. * @return {?}
  596. */
  597. MatFormField.prototype._shouldForward = /**
  598. * Determines whether a class from the NgControl should be forwarded to the host element.
  599. * @param {?} prop
  600. * @return {?}
  601. */
  602. function (prop) {
  603. /** @type {?} */
  604. var ngControl = this._control ? this._control.ngControl : null;
  605. return ngControl && ngControl[prop];
  606. };
  607. /**
  608. * @return {?}
  609. */
  610. MatFormField.prototype._hasPlaceholder = /**
  611. * @return {?}
  612. */
  613. function () {
  614. return !!(this._control && this._control.placeholder || this._placeholderChild);
  615. };
  616. /**
  617. * @return {?}
  618. */
  619. MatFormField.prototype._hasLabel = /**
  620. * @return {?}
  621. */
  622. function () {
  623. return !!this._labelChild;
  624. };
  625. /**
  626. * @return {?}
  627. */
  628. MatFormField.prototype._shouldLabelFloat = /**
  629. * @return {?}
  630. */
  631. function () {
  632. return this._canLabelFloat && (this._control.shouldLabelFloat || this._shouldAlwaysFloat);
  633. };
  634. /**
  635. * @return {?}
  636. */
  637. MatFormField.prototype._hideControlPlaceholder = /**
  638. * @return {?}
  639. */
  640. function () {
  641. // In the legacy appearance the placeholder is promoted to a label if no label is given.
  642. return this.appearance === 'legacy' && !this._hasLabel() ||
  643. this._hasLabel() && !this._shouldLabelFloat();
  644. };
  645. /**
  646. * @return {?}
  647. */
  648. MatFormField.prototype._hasFloatingLabel = /**
  649. * @return {?}
  650. */
  651. function () {
  652. // In the legacy appearance the placeholder is promoted to a label if no label is given.
  653. return this._hasLabel() || this.appearance === 'legacy' && this._hasPlaceholder();
  654. };
  655. /** Determines whether to display hints or errors. */
  656. /**
  657. * Determines whether to display hints or errors.
  658. * @return {?}
  659. */
  660. MatFormField.prototype._getDisplayedMessages = /**
  661. * Determines whether to display hints or errors.
  662. * @return {?}
  663. */
  664. function () {
  665. return (this._errorChildren && this._errorChildren.length > 0 &&
  666. this._control.errorState) ? 'error' : 'hint';
  667. };
  668. /** Animates the placeholder up and locks it in position. */
  669. /**
  670. * Animates the placeholder up and locks it in position.
  671. * @return {?}
  672. */
  673. MatFormField.prototype._animateAndLockLabel = /**
  674. * Animates the placeholder up and locks it in position.
  675. * @return {?}
  676. */
  677. function () {
  678. var _this = this;
  679. if (this._hasFloatingLabel() && this._canLabelFloat) {
  680. // If animations are disabled, we shouldn't go in here,
  681. // because the `transitionend` will never fire.
  682. if (this._animationsEnabled) {
  683. this._showAlwaysAnimate = true;
  684. rxjs.fromEvent(this._label.nativeElement, 'transitionend').pipe(operators.take(1)).subscribe((/**
  685. * @return {?}
  686. */
  687. function () {
  688. _this._showAlwaysAnimate = false;
  689. }));
  690. }
  691. this.floatLabel = 'always';
  692. this._changeDetectorRef.markForCheck();
  693. }
  694. };
  695. /**
  696. * Ensure that there is only one placeholder (either `placeholder` attribute on the child control
  697. * or child element with the `mat-placeholder` directive).
  698. */
  699. /**
  700. * Ensure that there is only one placeholder (either `placeholder` attribute on the child control
  701. * or child element with the `mat-placeholder` directive).
  702. * @private
  703. * @return {?}
  704. */
  705. MatFormField.prototype._validatePlaceholders = /**
  706. * Ensure that there is only one placeholder (either `placeholder` attribute on the child control
  707. * or child element with the `mat-placeholder` directive).
  708. * @private
  709. * @return {?}
  710. */
  711. function () {
  712. if (this._control.placeholder && this._placeholderChild) {
  713. throw getMatFormFieldPlaceholderConflictError();
  714. }
  715. };
  716. /** Does any extra processing that is required when handling the hints. */
  717. /**
  718. * Does any extra processing that is required when handling the hints.
  719. * @private
  720. * @return {?}
  721. */
  722. MatFormField.prototype._processHints = /**
  723. * Does any extra processing that is required when handling the hints.
  724. * @private
  725. * @return {?}
  726. */
  727. function () {
  728. this._validateHints();
  729. this._syncDescribedByIds();
  730. };
  731. /**
  732. * Ensure that there is a maximum of one of each `<mat-hint>` alignment specified, with the
  733. * attribute being considered as `align="start"`.
  734. */
  735. /**
  736. * Ensure that there is a maximum of one of each `<mat-hint>` alignment specified, with the
  737. * attribute being considered as `align="start"`.
  738. * @private
  739. * @return {?}
  740. */
  741. MatFormField.prototype._validateHints = /**
  742. * Ensure that there is a maximum of one of each `<mat-hint>` alignment specified, with the
  743. * attribute being considered as `align="start"`.
  744. * @private
  745. * @return {?}
  746. */
  747. function () {
  748. var _this = this;
  749. if (this._hintChildren) {
  750. /** @type {?} */
  751. var startHint_1;
  752. /** @type {?} */
  753. var endHint_1;
  754. this._hintChildren.forEach((/**
  755. * @param {?} hint
  756. * @return {?}
  757. */
  758. function (hint) {
  759. if (hint.align === 'start') {
  760. if (startHint_1 || _this.hintLabel) {
  761. throw getMatFormFieldDuplicatedHintError('start');
  762. }
  763. startHint_1 = hint;
  764. }
  765. else if (hint.align === 'end') {
  766. if (endHint_1) {
  767. throw getMatFormFieldDuplicatedHintError('end');
  768. }
  769. endHint_1 = hint;
  770. }
  771. }));
  772. }
  773. };
  774. /**
  775. * Sets the list of element IDs that describe the child control. This allows the control to update
  776. * its `aria-describedby` attribute accordingly.
  777. */
  778. /**
  779. * Sets the list of element IDs that describe the child control. This allows the control to update
  780. * its `aria-describedby` attribute accordingly.
  781. * @private
  782. * @return {?}
  783. */
  784. MatFormField.prototype._syncDescribedByIds = /**
  785. * Sets the list of element IDs that describe the child control. This allows the control to update
  786. * its `aria-describedby` attribute accordingly.
  787. * @private
  788. * @return {?}
  789. */
  790. function () {
  791. if (this._control) {
  792. /** @type {?} */
  793. var ids = [];
  794. if (this._getDisplayedMessages() === 'hint') {
  795. /** @type {?} */
  796. var startHint = this._hintChildren ?
  797. this._hintChildren.find((/**
  798. * @param {?} hint
  799. * @return {?}
  800. */
  801. function (hint) { return hint.align === 'start'; })) : null;
  802. /** @type {?} */
  803. var endHint = this._hintChildren ?
  804. this._hintChildren.find((/**
  805. * @param {?} hint
  806. * @return {?}
  807. */
  808. function (hint) { return hint.align === 'end'; })) : null;
  809. if (startHint) {
  810. ids.push(startHint.id);
  811. }
  812. else if (this._hintLabel) {
  813. ids.push(this._hintLabelId);
  814. }
  815. if (endHint) {
  816. ids.push(endHint.id);
  817. }
  818. }
  819. else if (this._errorChildren) {
  820. ids = this._errorChildren.map((/**
  821. * @param {?} error
  822. * @return {?}
  823. */
  824. function (error) { return error.id; }));
  825. }
  826. this._control.setDescribedByIds(ids);
  827. }
  828. };
  829. /** Throws an error if the form field's control is missing. */
  830. /**
  831. * Throws an error if the form field's control is missing.
  832. * @protected
  833. * @return {?}
  834. */
  835. MatFormField.prototype._validateControlChild = /**
  836. * Throws an error if the form field's control is missing.
  837. * @protected
  838. * @return {?}
  839. */
  840. function () {
  841. if (!this._control) {
  842. throw getMatFormFieldMissingControlError();
  843. }
  844. };
  845. /**
  846. * Updates the width and position of the gap in the outline. Only relevant for the outline
  847. * appearance.
  848. */
  849. /**
  850. * Updates the width and position of the gap in the outline. Only relevant for the outline
  851. * appearance.
  852. * @return {?}
  853. */
  854. MatFormField.prototype.updateOutlineGap = /**
  855. * Updates the width and position of the gap in the outline. Only relevant for the outline
  856. * appearance.
  857. * @return {?}
  858. */
  859. function () {
  860. /** @type {?} */
  861. var labelEl = this._label ? this._label.nativeElement : null;
  862. if (this.appearance !== 'outline' || !labelEl || !labelEl.children.length ||
  863. !labelEl.textContent.trim()) {
  864. return;
  865. }
  866. if (!this._platform.isBrowser) {
  867. // getBoundingClientRect isn't available on the server.
  868. return;
  869. }
  870. // If the element is not present in the DOM, the outline gap will need to be calculated
  871. // the next time it is checked and in the DOM.
  872. if (!(/** @type {?} */ (document.documentElement)).contains(this._elementRef.nativeElement)) {
  873. this._outlineGapCalculationNeededImmediately = true;
  874. return;
  875. }
  876. /** @type {?} */
  877. var startWidth = 0;
  878. /** @type {?} */
  879. var gapWidth = 0;
  880. /** @type {?} */
  881. var container = this._connectionContainerRef.nativeElement;
  882. /** @type {?} */
  883. var startEls = container.querySelectorAll('.mat-form-field-outline-start');
  884. /** @type {?} */
  885. var gapEls = container.querySelectorAll('.mat-form-field-outline-gap');
  886. if (this._label && this._label.nativeElement.children.length) {
  887. /** @type {?} */
  888. var containerRect = container.getBoundingClientRect();
  889. // If the container's width and height are zero, it means that the element is
  890. // invisible and we can't calculate the outline gap. Mark the element as needing
  891. // to be checked the next time the zone stabilizes. We can't do this immediately
  892. // on the next change detection, because even if the element becomes visible,
  893. // the `ClientRect` won't be reclaculated immediately. We reset the
  894. // `_outlineGapCalculationNeededImmediately` flag some we don't run the checks twice.
  895. if (containerRect.width === 0 && containerRect.height === 0) {
  896. this._outlineGapCalculationNeededOnStable = true;
  897. this._outlineGapCalculationNeededImmediately = false;
  898. return;
  899. }
  900. /** @type {?} */
  901. var containerStart = this._getStartEnd(containerRect);
  902. /** @type {?} */
  903. var labelStart = this._getStartEnd(labelEl.children[0].getBoundingClientRect());
  904. /** @type {?} */
  905. var labelWidth = 0;
  906. for (var _i = 0, _a = labelEl.children; _i < _a.length; _i++) {
  907. var child = _a[_i];
  908. labelWidth += child.offsetWidth;
  909. }
  910. startWidth = labelStart - containerStart - outlineGapPadding;
  911. gapWidth = labelWidth > 0 ? labelWidth * floatingLabelScale + outlineGapPadding * 2 : 0;
  912. }
  913. for (var i = 0; i < startEls.length; i++) {
  914. startEls.item(i).style.width = startWidth + "px";
  915. }
  916. for (var i = 0; i < gapEls.length; i++) {
  917. gapEls.item(i).style.width = gapWidth + "px";
  918. }
  919. this._outlineGapCalculationNeededOnStable =
  920. this._outlineGapCalculationNeededImmediately = false;
  921. };
  922. /** Gets the start end of the rect considering the current directionality. */
  923. /**
  924. * Gets the start end of the rect considering the current directionality.
  925. * @private
  926. * @param {?} rect
  927. * @return {?}
  928. */
  929. MatFormField.prototype._getStartEnd = /**
  930. * Gets the start end of the rect considering the current directionality.
  931. * @private
  932. * @param {?} rect
  933. * @return {?}
  934. */
  935. function (rect) {
  936. return this._dir && this._dir.value === 'rtl' ? rect.right : rect.left;
  937. };
  938. MatFormField.decorators = [
  939. { type: core.Component, args: [{selector: 'mat-form-field',
  940. exportAs: 'matFormField',
  941. template: "<div class=\"mat-form-field-wrapper\"><div class=\"mat-form-field-flex\" #connectionContainer (click)=\"_control.onContainerClick && _control.onContainerClick($event)\"><ng-container *ngIf=\"appearance == 'outline'\"><div class=\"mat-form-field-outline\"><div class=\"mat-form-field-outline-start\"></div><div class=\"mat-form-field-outline-gap\"></div><div class=\"mat-form-field-outline-end\"></div></div><div class=\"mat-form-field-outline mat-form-field-outline-thick\"><div class=\"mat-form-field-outline-start\"></div><div class=\"mat-form-field-outline-gap\"></div><div class=\"mat-form-field-outline-end\"></div></div></ng-container><div class=\"mat-form-field-prefix\" *ngIf=\"_prefixChildren.length\"><ng-content select=\"[matPrefix]\"></ng-content></div><div class=\"mat-form-field-infix\" #inputContainer><ng-content></ng-content><span class=\"mat-form-field-label-wrapper\"><label class=\"mat-form-field-label\" (cdkObserveContent)=\"updateOutlineGap()\" [cdkObserveContentDisabled]=\"appearance != 'outline'\" [id]=\"_labelId\" [attr.for]=\"_control.id\" [attr.aria-owns]=\"_control.id\" [class.mat-empty]=\"_control.empty && !_shouldAlwaysFloat\" [class.mat-form-field-empty]=\"_control.empty && !_shouldAlwaysFloat\" [class.mat-accent]=\"color == 'accent'\" [class.mat-warn]=\"color == 'warn'\" #label *ngIf=\"_hasFloatingLabel()\" [ngSwitch]=\"_hasLabel()\"><ng-container *ngSwitchCase=\"false\"><ng-content select=\"mat-placeholder\"></ng-content><span>{{_control.placeholder}}</span></ng-container><ng-content select=\"mat-label\" *ngSwitchCase=\"true\"></ng-content><span class=\"mat-placeholder-required mat-form-field-required-marker\" aria-hidden=\"true\" *ngIf=\"!hideRequiredMarker && _control.required && !_control.disabled\">&#32;*</span></label></span></div><div class=\"mat-form-field-suffix\" *ngIf=\"_suffixChildren.length\"><ng-content select=\"[matSuffix]\"></ng-content></div></div><div class=\"mat-form-field-underline\" #underline *ngIf=\"appearance != 'outline'\"><span class=\"mat-form-field-ripple\" [class.mat-accent]=\"color == 'accent'\" [class.mat-warn]=\"color == 'warn'\"></span></div><div class=\"mat-form-field-subscript-wrapper\" [ngSwitch]=\"_getDisplayedMessages()\"><div *ngSwitchCase=\"'error'\" [@transitionMessages]=\"_subscriptAnimationState\"><ng-content select=\"mat-error\"></ng-content></div><div class=\"mat-form-field-hint-wrapper\" *ngSwitchCase=\"'hint'\" [@transitionMessages]=\"_subscriptAnimationState\"><div *ngIf=\"hintLabel\" [id]=\"_hintLabelId\" class=\"mat-hint\">{{hintLabel}}</div><ng-content select=\"mat-hint:not([align='end'])\"></ng-content><div class=\"mat-form-field-hint-spacer\"></div><ng-content select=\"mat-hint[align='end']\"></ng-content></div></div></div>",
  942. // MatInput is a directive and can't have styles, so we need to include its styles here
  943. // in form-field-input.css. The MatInput styles are fairly minimal so it shouldn't be a
  944. // big deal for people who aren't using MatInput.
  945. 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}@media (-ms-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 .4s cubic-bezier(.25,.8,.25,1),color .4s cubic-bezier(.25,.8,.25,1),width .4s cubic-bezier(.25,.8,.25,1);display:none}[dir=rtl] .mat-form-field-label{transform-origin:100% 0;left:auto;right:0}.mat-form-field-can-float.mat-form-field-should-float .mat-form-field-label,.mat-form-field-empty.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:scaleY(1.0001)}.mat-form-field-ripple{position:absolute;left:0;width:100%;transform-origin:50%;transform:scaleX(.5);opacity:0;transition:background-color .3s cubic-bezier(.55,0,.55,.2)}.mat-form-field.mat-focused .mat-form-field-ripple,.mat-form-field.mat-form-field-invalid .mat-form-field-ripple{opacity:1;transform:scaleX(1);transition:transform .3s cubic-bezier(.25,.8,.25,1),opacity .1s cubic-bezier(.25,.8,.25,1),background-color .3s cubic-bezier(.25,.8,.25,1)}.mat-form-field-subscript-wrapper{position:absolute;box-sizing:border-box;width:100%;overflow:hidden}.mat-form-field-label-wrapper .mat-icon,.mat-form-field-subscript-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._mat-animation-noopable .mat-form-field-label,.mat-form-field._mat-animation-noopable .mat-form-field-ripple{transition:none} .mat-form-field-appearance-fill .mat-form-field-flex{border-radius:4px 4px 0 0;padding:.75em .75em 0 .75em}@media (-ms-high-contrast:active){.mat-form-field-appearance-fill .mat-form-field-flex{outline:solid 1px}}.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}@media (-ms-high-contrast:active){.mat-form-field-appearance-fill .mat-form-field-ripple{height:0;border-top:solid 2px}}.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 .6s cubic-bezier(.25,.8,.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} .mat-input-element{font:inherit;background:0 0;color:currentColor;border:none;outline:0;padding:0;margin:0;width:100%;max-width:100%;vertical-align:bottom;text-align:inherit}.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-caps-lock-indicator,.mat-input-element::-webkit-contacts-auto-fill-button,.mat-input-element::-webkit-credentials-auto-fill-button{visibility:hidden}.mat-input-element[type=date]::after,.mat-input-element[type=datetime-local]::after,.mat-input-element[type=datetime]::after,.mat-input-element[type=month]::after,.mat-input-element[type=time]::after,.mat-input-element[type=week]::after{content:' ';white-space:pre;width:1px}.mat-input-element::-webkit-calendar-picker-indicator,.mat-input-element::-webkit-clear-button,.mat-input-element::-webkit-inner-spin-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 .4s .133s cubic-bezier(.25,.8,.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 .4s .133s cubic-bezier(.25,.8,.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 .4s .133s cubic-bezier(.25,.8,.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 .4s .133s cubic-bezier(.25,.8,.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}.mat-form-field-hide-placeholder .mat-input-element::-moz-placeholder{color:transparent!important;-webkit-text-fill-color:transparent;transition:none}.mat-form-field-hide-placeholder .mat-input-element::-webkit-input-placeholder{color:transparent!important;-webkit-text-fill-color:transparent;transition:none}.mat-form-field-hide-placeholder .mat-input-element:-ms-input-placeholder{color:transparent!important;-webkit-text-fill-color:transparent;transition:none}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:0 0}@media (-ms-high-contrast:active){.mat-focused 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} .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}@media (-ms-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}@media (-ms-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}@media (-ms-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} .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:-.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-end,.mat-form-field-appearance-outline .mat-form-field-outline-start{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-end,.mat-form-field-appearance-outline .mat-form-field-outline-thick .mat-form-field-outline-gap,.mat-form-field-appearance-outline .mat-form-field-outline-thick .mat-form-field-outline-start{border-width:2px;transition:border-color .3s cubic-bezier(.25,.8,.25,1)}.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 .1s cubic-bezier(.25,.8,.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}.mat-form-field-appearance-outline:not(.mat-form-field-disabled) .mat-form-field-flex:hover .mat-form-field-outline{opacity:0;transition:opacity .6s cubic-bezier(.25,.8,.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 .mat-form-field-outline,.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,.mat-form-field-appearance-outline._mat-animation-noopable .mat-form-field-outline-start,.mat-form-field-appearance-outline._mat-animation-noopable:not(.mat-form-field-disabled) .mat-form-field-flex:hover~.mat-form-field-outline{transition:none} .mat-form-field-appearance-standard .mat-form-field-flex{padding-top:.75em}.mat-form-field-appearance-standard .mat-form-field-underline{height:1px}@media (-ms-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}@media (-ms-high-contrast:active){.mat-form-field-appearance-standard .mat-form-field-ripple{height:0;border-top:2px}}.mat-form-field-appearance-standard.mat-form-field-disabled .mat-form-field-underline{background-position:0;background-color:transparent}@media (-ms-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 .6s cubic-bezier(.25,.8,.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}"],
  946. animations: [matFormFieldAnimations.transitionMessages],
  947. host: {
  948. 'class': 'mat-form-field',
  949. '[class.mat-form-field-appearance-standard]': 'appearance == "standard"',
  950. '[class.mat-form-field-appearance-fill]': 'appearance == "fill"',
  951. '[class.mat-form-field-appearance-outline]': 'appearance == "outline"',
  952. '[class.mat-form-field-appearance-legacy]': 'appearance == "legacy"',
  953. '[class.mat-form-field-invalid]': '_control.errorState',
  954. '[class.mat-form-field-can-float]': '_canLabelFloat',
  955. '[class.mat-form-field-should-float]': '_shouldLabelFloat()',
  956. '[class.mat-form-field-has-label]': '_hasFloatingLabel()',
  957. '[class.mat-form-field-hide-placeholder]': '_hideControlPlaceholder()',
  958. '[class.mat-form-field-disabled]': '_control.disabled',
  959. '[class.mat-form-field-autofilled]': '_control.autofilled',
  960. '[class.mat-focused]': '_control.focused',
  961. '[class.mat-accent]': 'color == "accent"',
  962. '[class.mat-warn]': 'color == "warn"',
  963. '[class.ng-untouched]': '_shouldForward("untouched")',
  964. '[class.ng-touched]': '_shouldForward("touched")',
  965. '[class.ng-pristine]': '_shouldForward("pristine")',
  966. '[class.ng-dirty]': '_shouldForward("dirty")',
  967. '[class.ng-valid]': '_shouldForward("valid")',
  968. '[class.ng-invalid]': '_shouldForward("invalid")',
  969. '[class.ng-pending]': '_shouldForward("pending")',
  970. '[class._mat-animation-noopable]': '!_animationsEnabled',
  971. },
  972. inputs: ['color'],
  973. encapsulation: core.ViewEncapsulation.None,
  974. changeDetection: core.ChangeDetectionStrategy.OnPush,
  975. },] },
  976. ];
  977. /** @nocollapse */
  978. MatFormField.ctorParameters = function () { return [
  979. { type: core.ElementRef },
  980. { type: core.ChangeDetectorRef },
  981. { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [core$1.MAT_LABEL_GLOBAL_OPTIONS,] }] },
  982. { type: bidi.Directionality, decorators: [{ type: core.Optional }] },
  983. { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_FORM_FIELD_DEFAULT_OPTIONS,] }] },
  984. { type: platform.Platform },
  985. { type: core.NgZone },
  986. { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations$1.ANIMATION_MODULE_TYPE,] }] }
  987. ]; };
  988. MatFormField.propDecorators = {
  989. appearance: [{ type: core.Input }],
  990. hideRequiredMarker: [{ type: core.Input }],
  991. hintLabel: [{ type: core.Input }],
  992. floatLabel: [{ type: core.Input }],
  993. underlineRef: [{ type: core.ViewChild, args: ['underline', { static: false },] }],
  994. _connectionContainerRef: [{ type: core.ViewChild, args: ['connectionContainer', { static: true },] }],
  995. _inputContainerRef: [{ type: core.ViewChild, args: ['inputContainer', { static: false },] }],
  996. _label: [{ type: core.ViewChild, args: ['label', { static: false },] }],
  997. _controlNonStatic: [{ type: core.ContentChild, args: [MatFormFieldControl, { static: false },] }],
  998. _controlStatic: [{ type: core.ContentChild, args: [MatFormFieldControl, { static: true },] }],
  999. _labelChildNonStatic: [{ type: core.ContentChild, args: [MatLabel, { static: false },] }],
  1000. _labelChildStatic: [{ type: core.ContentChild, args: [MatLabel, { static: true },] }],
  1001. _placeholderChild: [{ type: core.ContentChild, args: [MatPlaceholder, { static: false },] }],
  1002. _errorChildren: [{ type: core.ContentChildren, args: [MatError,] }],
  1003. _hintChildren: [{ type: core.ContentChildren, args: [MatHint,] }],
  1004. _prefixChildren: [{ type: core.ContentChildren, args: [MatPrefix,] }],
  1005. _suffixChildren: [{ type: core.ContentChildren, args: [MatSuffix,] }]
  1006. };
  1007. return MatFormField;
  1008. }(_MatFormFieldMixinBase));
  1009. /**
  1010. * @fileoverview added by tsickle
  1011. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  1012. */
  1013. var MatFormFieldModule = /** @class */ (function () {
  1014. function MatFormFieldModule() {
  1015. }
  1016. MatFormFieldModule.decorators = [
  1017. { type: core.NgModule, args: [{
  1018. declarations: [
  1019. MatError,
  1020. MatFormField,
  1021. MatHint,
  1022. MatLabel,
  1023. MatPlaceholder,
  1024. MatPrefix,
  1025. MatSuffix,
  1026. ],
  1027. imports: [
  1028. common.CommonModule,
  1029. observers.ObserversModule,
  1030. ],
  1031. exports: [
  1032. MatError,
  1033. MatFormField,
  1034. MatHint,
  1035. MatLabel,
  1036. MatPlaceholder,
  1037. MatPrefix,
  1038. MatSuffix,
  1039. ],
  1040. },] },
  1041. ];
  1042. return MatFormFieldModule;
  1043. }());
  1044. exports.MatFormFieldModule = MatFormFieldModule;
  1045. exports.MatError = MatError;
  1046. exports.MAT_FORM_FIELD_DEFAULT_OPTIONS = MAT_FORM_FIELD_DEFAULT_OPTIONS;
  1047. exports.MatFormField = MatFormField;
  1048. exports.MatFormFieldControl = MatFormFieldControl;
  1049. exports.getMatFormFieldPlaceholderConflictError = getMatFormFieldPlaceholderConflictError;
  1050. exports.getMatFormFieldDuplicatedHintError = getMatFormFieldDuplicatedHintError;
  1051. exports.getMatFormFieldMissingControlError = getMatFormFieldMissingControlError;
  1052. exports.MatHint = MatHint;
  1053. exports.MatPlaceholder = MatPlaceholder;
  1054. exports.MatPrefix = MatPrefix;
  1055. exports.MatSuffix = MatSuffix;
  1056. exports.MatLabel = MatLabel;
  1057. exports.matFormFieldAnimations = matFormFieldAnimations;
  1058. Object.defineProperty(exports, '__esModule', { value: true });
  1059. })));
  1060. //# sourceMappingURL=material-form-field.umd.js.map