| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163 |
- /**
- * @license
- * Copyright Google LLC All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- (function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/platform-browser'), require('@angular/cdk/bidi'), require('@angular/cdk'), require('@angular/cdk/coercion'), require('rxjs'), require('@angular/cdk/platform'), require('rxjs/operators'), require('@angular/cdk/a11y'), require('@angular/platform-browser/animations'), require('@angular/cdk/keycodes'), require('@angular/common')) :
- typeof define === 'function' && define.amd ? define('@angular/material/core', ['exports', '@angular/core', '@angular/platform-browser', '@angular/cdk/bidi', '@angular/cdk', '@angular/cdk/coercion', 'rxjs', '@angular/cdk/platform', 'rxjs/operators', '@angular/cdk/a11y', '@angular/platform-browser/animations', '@angular/cdk/keycodes', '@angular/common'], factory) :
- (factory((global.ng = global.ng || {}, global.ng.material = global.ng.material || {}, global.ng.material.core = {}),global.ng.core,global.ng.platformBrowser,global.ng.cdk.bidi,global.ng.cdk,global.ng.cdk.coercion,global.rxjs,global.ng.cdk.platform,global.rxjs.operators,global.ng.cdk.a11y,global.ng.platformBrowser.animations,global.ng.cdk.keycodes,global.ng.common));
- }(this, (function (exports,core,platformBrowser,bidi,cdk,coercion,rxjs,platform,operators,a11y,animations,keycodes,common) { 'use strict';
- /*! *****************************************************************************
- Copyright (c) Microsoft Corporation. All rights reserved.
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
- this file except in compliance with the License. You may obtain a copy of the
- License at http://www.apache.org/licenses/LICENSE-2.0
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
- MERCHANTABLITY OR NON-INFRINGEMENT.
- See the Apache Version 2.0 License for specific language governing permissions
- and limitations under the License.
- ***************************************************************************** */
- /* global Reflect, Promise */
- var extendStatics = function(d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- function __extends(d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- }
- var __assign = function() {
- __assign = Object.assign || function __assign(t) {
- for (var s, i = 1, n = arguments.length; i < n; i++) {
- s = arguments[i];
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
- }
- return t;
- };
- return __assign.apply(this, arguments);
- };
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Current version of Angular Material.
- * @type {?}
- */
- var VERSION$1 = new core.Version('8.1.4');
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * \@docs-private
- */
- var AnimationCurves = /** @class */ (function () {
- function AnimationCurves() {
- }
- AnimationCurves.STANDARD_CURVE = 'cubic-bezier(0.4,0.0,0.2,1)';
- AnimationCurves.DECELERATION_CURVE = 'cubic-bezier(0.0,0.0,0.2,1)';
- AnimationCurves.ACCELERATION_CURVE = 'cubic-bezier(0.4,0.0,1,1)';
- AnimationCurves.SHARP_CURVE = 'cubic-bezier(0.4,0.0,0.6,1)';
- return AnimationCurves;
- }());
- /**
- * \@docs-private
- */
- var AnimationDurations = /** @class */ (function () {
- function AnimationDurations() {
- }
- AnimationDurations.COMPLEX = '375ms';
- AnimationDurations.ENTERING = '225ms';
- AnimationDurations.EXITING = '195ms';
- return AnimationDurations;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- // Private version constant to circumvent test/build issues,
- // i.e. avoid core to depend on the @angular/material primary entry-point
- // Can be removed once the Material primary entry-point no longer
- // re-exports all secondary entry-points
- /** @type {?} */
- var VERSION$2 = new core.Version('8.1.4');
- /**
- * Injection token that configures whether the Material sanity checks are enabled.
- * @type {?}
- */
- var MATERIAL_SANITY_CHECKS = new core.InjectionToken('mat-sanity-checks', {
- providedIn: 'root',
- factory: MATERIAL_SANITY_CHECKS_FACTORY,
- });
- /**
- * \@docs-private
- * @return {?}
- */
- function MATERIAL_SANITY_CHECKS_FACTORY() {
- return true;
- }
- /**
- * Module that captures anything that should be loaded and/or run for *all* Angular Material
- * components. This includes Bidi, etc.
- *
- * This module should be imported to each top-level component module (e.g., MatTabsModule).
- */
- var MatCommonModule = /** @class */ (function () {
- function MatCommonModule(_sanityChecksEnabled, _hammerLoader) {
- this._sanityChecksEnabled = _sanityChecksEnabled;
- this._hammerLoader = _hammerLoader;
- /**
- * Whether we've done the global sanity checks (e.g. a theme is loaded, there is a doctype).
- */
- this._hasDoneGlobalChecks = false;
- /**
- * Whether we've already checked for HammerJs availability.
- */
- this._hasCheckedHammer = false;
- /**
- * Reference to the global `document` object.
- */
- this._document = typeof document === 'object' && document ? document : null;
- /**
- * Reference to the global 'window' object.
- */
- this._window = typeof window === 'object' && window ? window : null;
- if (this._areChecksEnabled() && !this._hasDoneGlobalChecks) {
- this._checkDoctypeIsDefined();
- this._checkThemeIsPresent();
- this._checkCdkVersionMatch();
- this._hasDoneGlobalChecks = true;
- }
- }
- /** Whether any sanity checks are enabled */
- /**
- * Whether any sanity checks are enabled
- * @private
- * @return {?}
- */
- MatCommonModule.prototype._areChecksEnabled = /**
- * Whether any sanity checks are enabled
- * @private
- * @return {?}
- */
- function () {
- return this._sanityChecksEnabled && core.isDevMode() && !this._isTestEnv();
- };
- /** Whether the code is running in tests. */
- /**
- * Whether the code is running in tests.
- * @private
- * @return {?}
- */
- MatCommonModule.prototype._isTestEnv = /**
- * Whether the code is running in tests.
- * @private
- * @return {?}
- */
- function () {
- /** @type {?} */
- var window = (/** @type {?} */ (this._window));
- return window && (window.__karma__ || window.jasmine);
- };
- /**
- * @private
- * @return {?}
- */
- MatCommonModule.prototype._checkDoctypeIsDefined = /**
- * @private
- * @return {?}
- */
- function () {
- if (this._document && !this._document.doctype) {
- console.warn('Current document does not have a doctype. This may cause ' +
- 'some Angular Material components not to behave as expected.');
- }
- };
- /**
- * @private
- * @return {?}
- */
- MatCommonModule.prototype._checkThemeIsPresent = /**
- * @private
- * @return {?}
- */
- function () {
- // We need to assert that the `body` is defined, because these checks run very early
- // and the `body` won't be defined if the consumer put their scripts in the `head`.
- if (!this._document || !this._document.body || typeof getComputedStyle !== 'function') {
- return;
- }
- /** @type {?} */
- var testElement = this._document.createElement('div');
- testElement.classList.add('mat-theme-loaded-marker');
- this._document.body.appendChild(testElement);
- /** @type {?} */
- var computedStyle = getComputedStyle(testElement);
- // In some situations the computed style of the test element can be null. For example in
- // Firefox, the computed style is null if an application is running inside of a hidden iframe.
- // See: https://bugzilla.mozilla.org/show_bug.cgi?id=548397
- if (computedStyle && computedStyle.display !== 'none') {
- console.warn('Could not find Angular Material core theme. Most Material ' +
- 'components may not work as expected. For more info refer ' +
- 'to the theming guide: https://material.angular.io/guide/theming');
- }
- this._document.body.removeChild(testElement);
- };
- /** Checks whether the material version matches the cdk version */
- /**
- * Checks whether the material version matches the cdk version
- * @private
- * @return {?}
- */
- MatCommonModule.prototype._checkCdkVersionMatch = /**
- * Checks whether the material version matches the cdk version
- * @private
- * @return {?}
- */
- function () {
- if (VERSION$2.full !== cdk.VERSION.full) {
- console.warn('The Angular Material version (' + VERSION$2.full + ') does not match ' +
- 'the Angular CDK version (' + cdk.VERSION.full + ').\n' +
- 'Please ensure the versions of these two packages exactly match.');
- }
- };
- /** Checks whether HammerJS is available. */
- /**
- * Checks whether HammerJS is available.
- * @return {?}
- */
- MatCommonModule.prototype._checkHammerIsAvailable = /**
- * Checks whether HammerJS is available.
- * @return {?}
- */
- function () {
- if (this._hasCheckedHammer || !this._window) {
- return;
- }
- if (this._areChecksEnabled() && !((/** @type {?} */ (this._window)))['Hammer'] && !this._hammerLoader) {
- console.warn('Could not find HammerJS. Certain Angular Material components may not work correctly.');
- }
- this._hasCheckedHammer = true;
- };
- MatCommonModule.decorators = [
- { type: core.NgModule, args: [{
- imports: [bidi.BidiModule],
- exports: [bidi.BidiModule],
- },] },
- ];
- /** @nocollapse */
- MatCommonModule.ctorParameters = function () { return [
- { type: Boolean, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MATERIAL_SANITY_CHECKS,] }] },
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [platformBrowser.HAMMER_LOADER,] }] }
- ]; };
- return MatCommonModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Mixin to augment a directive with a `disabled` property.
- * @template T
- * @param {?} base
- * @return {?}
- */
- function mixinDisabled(base) {
- return /** @class */ (function (_super) {
- __extends(class_1, _super);
- function class_1() {
- var args = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- args[_i] = arguments[_i];
- }
- var _this = _super.apply(this, args) || this;
- _this._disabled = false;
- return _this;
- }
- Object.defineProperty(class_1.prototype, "disabled", {
- get: /**
- * @return {?}
- */
- function () { return this._disabled; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) { this._disabled = coercion.coerceBooleanProperty(value); },
- enumerable: true,
- configurable: true
- });
- return class_1;
- }(base));
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Mixin to augment a directive with a `color` property.
- * @template T
- * @param {?} base
- * @param {?=} defaultColor
- * @return {?}
- */
- function mixinColor(base, defaultColor) {
- return /** @class */ (function (_super) {
- __extends(class_1, _super);
- function class_1() {
- var args = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- args[_i] = arguments[_i];
- }
- var _this = _super.apply(this, args) || this;
- // Set the default color that can be specified from the mixin.
- _this.color = defaultColor;
- return _this;
- }
- Object.defineProperty(class_1.prototype, "color", {
- get: /**
- * @return {?}
- */
- function () { return this._color; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- /** @type {?} */
- var colorPalette = value || defaultColor;
- if (colorPalette !== this._color) {
- if (this._color) {
- this._elementRef.nativeElement.classList.remove("mat-" + this._color);
- }
- if (colorPalette) {
- this._elementRef.nativeElement.classList.add("mat-" + colorPalette);
- }
- this._color = colorPalette;
- }
- },
- enumerable: true,
- configurable: true
- });
- return class_1;
- }(base));
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Mixin to augment a directive with a `disableRipple` property.
- * @template T
- * @param {?} base
- * @return {?}
- */
- function mixinDisableRipple(base) {
- return /** @class */ (function (_super) {
- __extends(class_1, _super);
- function class_1() {
- var args = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- args[_i] = arguments[_i];
- }
- var _this = _super.apply(this, args) || this;
- _this._disableRipple = false;
- return _this;
- }
- Object.defineProperty(class_1.prototype, "disableRipple", {
- /** Whether the ripple effect is disabled or not. */
- get: /**
- * Whether the ripple effect is disabled or not.
- * @return {?}
- */
- function () { return this._disableRipple; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) { this._disableRipple = coercion.coerceBooleanProperty(value); },
- enumerable: true,
- configurable: true
- });
- return class_1;
- }(base));
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Mixin to augment a directive with a `tabIndex` property.
- * @template T
- * @param {?} base
- * @param {?=} defaultTabIndex
- * @return {?}
- */
- function mixinTabIndex(base, defaultTabIndex) {
- if (defaultTabIndex === void 0) { defaultTabIndex = 0; }
- return /** @class */ (function (_super) {
- __extends(class_1, _super);
- function class_1() {
- var args = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- args[_i] = arguments[_i];
- }
- var _this = _super.apply(this, args) || this;
- _this._tabIndex = defaultTabIndex;
- return _this;
- }
- Object.defineProperty(class_1.prototype, "tabIndex", {
- get: /**
- * @return {?}
- */
- function () { return this.disabled ? -1 : this._tabIndex; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- // If the specified tabIndex value is null or undefined, fall back to the default value.
- this._tabIndex = value != null ? value : defaultTabIndex;
- },
- enumerable: true,
- configurable: true
- });
- return class_1;
- }(base));
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Mixin to augment a directive with updateErrorState method.
- * For component with `errorState` and need to update `errorState`.
- * @template T
- * @param {?} base
- * @return {?}
- */
- function mixinErrorState(base) {
- return /** @class */ (function (_super) {
- __extends(class_1, _super);
- function class_1() {
- var args = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- args[_i] = arguments[_i];
- }
- var _this = _super.apply(this, args) || this;
- /**
- * Whether the component is in an error state.
- */
- _this.errorState = false;
- /**
- * Stream that emits whenever the state of the input changes such that the wrapping
- * `MatFormField` needs to run change detection.
- */
- _this.stateChanges = new rxjs.Subject();
- return _this;
- }
- /**
- * @return {?}
- */
- class_1.prototype.updateErrorState = /**
- * @return {?}
- */
- function () {
- /** @type {?} */
- var oldState = this.errorState;
- /** @type {?} */
- var parent = this._parentFormGroup || this._parentForm;
- /** @type {?} */
- var matcher = this.errorStateMatcher || this._defaultErrorStateMatcher;
- /** @type {?} */
- var control = this.ngControl ? (/** @type {?} */ (this.ngControl.control)) : null;
- /** @type {?} */
- var newState = matcher.isErrorState(control, parent);
- if (newState !== oldState) {
- this.errorState = newState;
- this.stateChanges.next();
- }
- };
- return class_1;
- }(base));
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Mixin to augment a directive with an initialized property that will emits when ngOnInit ends.
- * @template T
- * @param {?} base
- * @return {?}
- */
- function mixinInitialized(base) {
- return /** @class */ (function (_super) {
- __extends(class_1, _super);
- function class_1() {
- var args = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- args[_i] = arguments[_i];
- }
- var _this = _super.apply(this, args) || this;
- /**
- * Whether this directive has been marked as initialized.
- */
- _this._isInitialized = false;
- /**
- * List of subscribers that subscribed before the directive was initialized. Should be notified
- * during _markInitialized. Set to null after pending subscribers are notified, and should
- * not expect to be populated after.
- */
- _this._pendingSubscribers = [];
- /**
- * Observable stream that emits when the directive initializes. If already initialized, the
- * subscriber is stored to be notified once _markInitialized is called.
- */
- _this.initialized = new rxjs.Observable((/**
- * @param {?} subscriber
- * @return {?}
- */
- function (subscriber) {
- // If initialized, immediately notify the subscriber. Otherwise store the subscriber to notify
- // when _markInitialized is called.
- if (_this._isInitialized) {
- _this._notifySubscriber(subscriber);
- }
- else {
- (/** @type {?} */ (_this._pendingSubscribers)).push(subscriber);
- }
- }));
- return _this;
- }
- /**
- * Marks the state as initialized and notifies pending subscribers. Should be called at the end
- * of ngOnInit.
- * @docs-private
- */
- /**
- * Marks the state as initialized and notifies pending subscribers. Should be called at the end
- * of ngOnInit.
- * \@docs-private
- * @return {?}
- */
- class_1.prototype._markInitialized = /**
- * Marks the state as initialized and notifies pending subscribers. Should be called at the end
- * of ngOnInit.
- * \@docs-private
- * @return {?}
- */
- function () {
- if (this._isInitialized) {
- throw Error('This directive has already been marked as initialized and ' +
- 'should not be called twice.');
- }
- this._isInitialized = true;
- (/** @type {?} */ (this._pendingSubscribers)).forEach(this._notifySubscriber);
- this._pendingSubscribers = null;
- };
- /** Emits and completes the subscriber stream (should only emit once). */
- /**
- * Emits and completes the subscriber stream (should only emit once).
- * @param {?} subscriber
- * @return {?}
- */
- class_1.prototype._notifySubscriber = /**
- * Emits and completes the subscriber stream (should only emit once).
- * @param {?} subscriber
- * @return {?}
- */
- function (subscriber) {
- subscriber.next();
- subscriber.complete();
- };
- return class_1;
- }(base));
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * InjectionToken for datepicker that can be used to override default locale code.
- * @type {?}
- */
- var MAT_DATE_LOCALE = new core.InjectionToken('MAT_DATE_LOCALE', {
- providedIn: 'root',
- factory: MAT_DATE_LOCALE_FACTORY,
- });
- /**
- * \@docs-private
- * @return {?}
- */
- function MAT_DATE_LOCALE_FACTORY() {
- return core.inject(core.LOCALE_ID);
- }
- /**
- * No longer needed since MAT_DATE_LOCALE has been changed to a scoped injectable.
- * If you are importing and providing this in your code you can simply remove it.
- * @deprecated
- * \@breaking-change 8.0.0
- * @type {?}
- */
- var MAT_DATE_LOCALE_PROVIDER = { provide: MAT_DATE_LOCALE, useExisting: core.LOCALE_ID };
- /**
- * Adapts type `D` to be usable as a date by cdk-based components that work with dates.
- * @abstract
- * @template D
- */
- var /**
- * Adapts type `D` to be usable as a date by cdk-based components that work with dates.
- * @abstract
- * @template D
- */
- DateAdapter = /** @class */ (function () {
- function DateAdapter() {
- this._localeChanges = new rxjs.Subject();
- }
- Object.defineProperty(DateAdapter.prototype, "localeChanges", {
- /** A stream that emits when the locale changes. */
- get: /**
- * A stream that emits when the locale changes.
- * @return {?}
- */
- function () { return this._localeChanges; },
- enumerable: true,
- configurable: true
- });
- /**
- * Attempts to deserialize a value to a valid date object. This is different from parsing in that
- * deserialize should only accept non-ambiguous, locale-independent formats (e.g. a ISO 8601
- * string). The default implementation does not allow any deserialization, it simply checks that
- * the given value is already a valid date object or null. The `<mat-datepicker>` will call this
- * method on all of it's `@Input()` properties that accept dates. It is therefore possible to
- * support passing values from your backend directly to these properties by overriding this method
- * to also deserialize the format used by your backend.
- * @param value The value to be deserialized into a date object.
- * @returns The deserialized date object, either a valid date, null if the value can be
- * deserialized into a null date (e.g. the empty string), or an invalid date.
- */
- /**
- * Attempts to deserialize a value to a valid date object. This is different from parsing in that
- * deserialize should only accept non-ambiguous, locale-independent formats (e.g. a ISO 8601
- * string). The default implementation does not allow any deserialization, it simply checks that
- * the given value is already a valid date object or null. The `<mat-datepicker>` will call this
- * method on all of it's `\@Input()` properties that accept dates. It is therefore possible to
- * support passing values from your backend directly to these properties by overriding this method
- * to also deserialize the format used by your backend.
- * @param {?} value The value to be deserialized into a date object.
- * @return {?} The deserialized date object, either a valid date, null if the value can be
- * deserialized into a null date (e.g. the empty string), or an invalid date.
- */
- DateAdapter.prototype.deserialize = /**
- * Attempts to deserialize a value to a valid date object. This is different from parsing in that
- * deserialize should only accept non-ambiguous, locale-independent formats (e.g. a ISO 8601
- * string). The default implementation does not allow any deserialization, it simply checks that
- * the given value is already a valid date object or null. The `<mat-datepicker>` will call this
- * method on all of it's `\@Input()` properties that accept dates. It is therefore possible to
- * support passing values from your backend directly to these properties by overriding this method
- * to also deserialize the format used by your backend.
- * @param {?} value The value to be deserialized into a date object.
- * @return {?} The deserialized date object, either a valid date, null if the value can be
- * deserialized into a null date (e.g. the empty string), or an invalid date.
- */
- function (value) {
- if (value == null || this.isDateInstance(value) && this.isValid(value)) {
- return value;
- }
- return this.invalid();
- };
- /**
- * Sets the locale used for all dates.
- * @param locale The new locale.
- */
- /**
- * Sets the locale used for all dates.
- * @param {?} locale The new locale.
- * @return {?}
- */
- DateAdapter.prototype.setLocale = /**
- * Sets the locale used for all dates.
- * @param {?} locale The new locale.
- * @return {?}
- */
- function (locale) {
- this.locale = locale;
- this._localeChanges.next();
- };
- /**
- * Compares two dates.
- * @param first The first date to compare.
- * @param second The second date to compare.
- * @returns 0 if the dates are equal, a number less than 0 if the first date is earlier,
- * a number greater than 0 if the first date is later.
- */
- /**
- * Compares two dates.
- * @param {?} first The first date to compare.
- * @param {?} second The second date to compare.
- * @return {?} 0 if the dates are equal, a number less than 0 if the first date is earlier,
- * a number greater than 0 if the first date is later.
- */
- DateAdapter.prototype.compareDate = /**
- * Compares two dates.
- * @param {?} first The first date to compare.
- * @param {?} second The second date to compare.
- * @return {?} 0 if the dates are equal, a number less than 0 if the first date is earlier,
- * a number greater than 0 if the first date is later.
- */
- function (first, second) {
- return this.getYear(first) - this.getYear(second) ||
- this.getMonth(first) - this.getMonth(second) ||
- this.getDate(first) - this.getDate(second);
- };
- /**
- * Checks if two dates are equal.
- * @param first The first date to check.
- * @param second The second date to check.
- * @returns Whether the two dates are equal.
- * Null dates are considered equal to other null dates.
- */
- /**
- * Checks if two dates are equal.
- * @param {?} first The first date to check.
- * @param {?} second The second date to check.
- * @return {?} Whether the two dates are equal.
- * Null dates are considered equal to other null dates.
- */
- DateAdapter.prototype.sameDate = /**
- * Checks if two dates are equal.
- * @param {?} first The first date to check.
- * @param {?} second The second date to check.
- * @return {?} Whether the two dates are equal.
- * Null dates are considered equal to other null dates.
- */
- function (first, second) {
- if (first && second) {
- /** @type {?} */
- var firstValid = this.isValid(first);
- /** @type {?} */
- var secondValid = this.isValid(second);
- if (firstValid && secondValid) {
- return !this.compareDate(first, second);
- }
- return firstValid == secondValid;
- }
- return first == second;
- };
- /**
- * Clamp the given date between min and max dates.
- * @param date The date to clamp.
- * @param min The minimum value to allow. If null or omitted no min is enforced.
- * @param max The maximum value to allow. If null or omitted no max is enforced.
- * @returns `min` if `date` is less than `min`, `max` if date is greater than `max`,
- * otherwise `date`.
- */
- /**
- * Clamp the given date between min and max dates.
- * @param {?} date The date to clamp.
- * @param {?=} min The minimum value to allow. If null or omitted no min is enforced.
- * @param {?=} max The maximum value to allow. If null or omitted no max is enforced.
- * @return {?} `min` if `date` is less than `min`, `max` if date is greater than `max`,
- * otherwise `date`.
- */
- DateAdapter.prototype.clampDate = /**
- * Clamp the given date between min and max dates.
- * @param {?} date The date to clamp.
- * @param {?=} min The minimum value to allow. If null or omitted no min is enforced.
- * @param {?=} max The maximum value to allow. If null or omitted no max is enforced.
- * @return {?} `min` if `date` is less than `min`, `max` if date is greater than `max`,
- * otherwise `date`.
- */
- function (date, min, max) {
- if (min && this.compareDate(date, min) < 0) {
- return min;
- }
- if (max && this.compareDate(date, max) > 0) {
- return max;
- }
- return date;
- };
- return DateAdapter;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /** @type {?} */
- var MAT_DATE_FORMATS = new core.InjectionToken('mat-date-formats');
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- // TODO(mmalerba): Remove when we no longer support safari 9.
- /**
- * Whether the browser supports the Intl API.
- * @type {?}
- */
- var SUPPORTS_INTL_API;
- // We need a try/catch around the reference to `Intl`, because accessing it in some cases can
- // cause IE to throw. These cases are tied to particular versions of Windows and can happen if
- // the consumer is providing a polyfilled `Map`. See:
- // https://github.com/Microsoft/ChakraCore/issues/3189
- // https://github.com/angular/components/issues/15687
- try {
- SUPPORTS_INTL_API = typeof Intl != 'undefined';
- }
- catch (_a) {
- SUPPORTS_INTL_API = false;
- }
- /**
- * The default month names to use if Intl API is not available.
- * @type {?}
- */
- var DEFAULT_MONTH_NAMES = {
- 'long': [
- 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September',
- 'October', 'November', 'December'
- ],
- 'short': ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
- 'narrow': ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D']
- };
- var ɵ0 = /**
- * @param {?} i
- * @return {?}
- */
- function (i) { return String(i + 1); };
- /**
- * The default date names to use if Intl API is not available.
- * @type {?}
- */
- var DEFAULT_DATE_NAMES = range(31, (ɵ0));
- /**
- * The default day of the week names to use if Intl API is not available.
- * @type {?}
- */
- var DEFAULT_DAY_OF_WEEK_NAMES = {
- 'long': ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
- 'short': ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
- 'narrow': ['S', 'M', 'T', 'W', 'T', 'F', 'S']
- };
- /**
- * Matches strings that have the form of a valid RFC 3339 string
- * (https://tools.ietf.org/html/rfc3339). Note that the string may not actually be a valid date
- * because the regex will match strings an with out of bounds month, date, etc.
- * @type {?}
- */
- var ISO_8601_REGEX = /^\d{4}-\d{2}-\d{2}(?:T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|(?:(?:\+|-)\d{2}:\d{2}))?)?$/;
- /**
- * Creates an array and fills it with values.
- * @template T
- * @param {?} length
- * @param {?} valueFunction
- * @return {?}
- */
- function range(length, valueFunction) {
- /** @type {?} */
- var valuesArray = Array(length);
- for (var i = 0; i < length; i++) {
- valuesArray[i] = valueFunction(i);
- }
- return valuesArray;
- }
- /**
- * Adapts the native JS Date for use with cdk-based components that work with dates.
- */
- var NativeDateAdapter = /** @class */ (function (_super) {
- __extends(NativeDateAdapter, _super);
- function NativeDateAdapter(matDateLocale, platform$$1) {
- var _this = _super.call(this) || this;
- /**
- * Whether to use `timeZone: 'utc'` with `Intl.DateTimeFormat` when formatting dates.
- * Without this `Intl.DateTimeFormat` sometimes chooses the wrong timeZone, which can throw off
- * the result. (e.g. in the en-US locale `new Date(1800, 7, 14).toLocaleDateString()`
- * will produce `'8/13/1800'`.
- *
- * TODO(mmalerba): drop this variable. It's not being used in the code right now. We're now
- * getting the string representation of a Date object from it's utc representation. We're keeping
- * it here for sometime, just for precaution, in case we decide to revert some of these changes
- * though.
- */
- _this.useUtcForDisplay = true;
- _super.prototype.setLocale.call(_this, matDateLocale);
- // IE does its own time zone correction, so we disable this on IE.
- _this.useUtcForDisplay = !platform$$1.TRIDENT;
- _this._clampDate = platform$$1.TRIDENT || platform$$1.EDGE;
- return _this;
- }
- /**
- * @param {?} date
- * @return {?}
- */
- NativeDateAdapter.prototype.getYear = /**
- * @param {?} date
- * @return {?}
- */
- function (date) {
- return date.getFullYear();
- };
- /**
- * @param {?} date
- * @return {?}
- */
- NativeDateAdapter.prototype.getMonth = /**
- * @param {?} date
- * @return {?}
- */
- function (date) {
- return date.getMonth();
- };
- /**
- * @param {?} date
- * @return {?}
- */
- NativeDateAdapter.prototype.getDate = /**
- * @param {?} date
- * @return {?}
- */
- function (date) {
- return date.getDate();
- };
- /**
- * @param {?} date
- * @return {?}
- */
- NativeDateAdapter.prototype.getDayOfWeek = /**
- * @param {?} date
- * @return {?}
- */
- function (date) {
- return date.getDay();
- };
- /**
- * @param {?} style
- * @return {?}
- */
- NativeDateAdapter.prototype.getMonthNames = /**
- * @param {?} style
- * @return {?}
- */
- function (style) {
- var _this = this;
- if (SUPPORTS_INTL_API) {
- /** @type {?} */
- var dtf_1 = new Intl.DateTimeFormat(this.locale, { month: style, timeZone: 'utc' });
- return range(12, (/**
- * @param {?} i
- * @return {?}
- */
- function (i) {
- return _this._stripDirectionalityCharacters(_this._format(dtf_1, new Date(2017, i, 1)));
- }));
- }
- return DEFAULT_MONTH_NAMES[style];
- };
- /**
- * @return {?}
- */
- NativeDateAdapter.prototype.getDateNames = /**
- * @return {?}
- */
- function () {
- var _this = this;
- if (SUPPORTS_INTL_API) {
- /** @type {?} */
- var dtf_2 = new Intl.DateTimeFormat(this.locale, { day: 'numeric', timeZone: 'utc' });
- return range(31, (/**
- * @param {?} i
- * @return {?}
- */
- function (i) { return _this._stripDirectionalityCharacters(_this._format(dtf_2, new Date(2017, 0, i + 1))); }));
- }
- return DEFAULT_DATE_NAMES;
- };
- /**
- * @param {?} style
- * @return {?}
- */
- NativeDateAdapter.prototype.getDayOfWeekNames = /**
- * @param {?} style
- * @return {?}
- */
- function (style) {
- var _this = this;
- if (SUPPORTS_INTL_API) {
- /** @type {?} */
- var dtf_3 = new Intl.DateTimeFormat(this.locale, { weekday: style, timeZone: 'utc' });
- return range(7, (/**
- * @param {?} i
- * @return {?}
- */
- function (i) { return _this._stripDirectionalityCharacters(_this._format(dtf_3, new Date(2017, 0, i + 1))); }));
- }
- return DEFAULT_DAY_OF_WEEK_NAMES[style];
- };
- /**
- * @param {?} date
- * @return {?}
- */
- NativeDateAdapter.prototype.getYearName = /**
- * @param {?} date
- * @return {?}
- */
- function (date) {
- if (SUPPORTS_INTL_API) {
- /** @type {?} */
- var dtf = new Intl.DateTimeFormat(this.locale, { year: 'numeric', timeZone: 'utc' });
- return this._stripDirectionalityCharacters(this._format(dtf, date));
- }
- return String(this.getYear(date));
- };
- /**
- * @return {?}
- */
- NativeDateAdapter.prototype.getFirstDayOfWeek = /**
- * @return {?}
- */
- function () {
- // We can't tell using native JS Date what the first day of the week is, we default to Sunday.
- return 0;
- };
- /**
- * @param {?} date
- * @return {?}
- */
- NativeDateAdapter.prototype.getNumDaysInMonth = /**
- * @param {?} date
- * @return {?}
- */
- function (date) {
- return this.getDate(this._createDateWithOverflow(this.getYear(date), this.getMonth(date) + 1, 0));
- };
- /**
- * @param {?} date
- * @return {?}
- */
- NativeDateAdapter.prototype.clone = /**
- * @param {?} date
- * @return {?}
- */
- function (date) {
- return new Date(date.getTime());
- };
- /**
- * @param {?} year
- * @param {?} month
- * @param {?} date
- * @return {?}
- */
- NativeDateAdapter.prototype.createDate = /**
- * @param {?} year
- * @param {?} month
- * @param {?} date
- * @return {?}
- */
- function (year, month, date) {
- // Check for invalid month and date (except upper bound on date which we have to check after
- // creating the Date).
- if (month < 0 || month > 11) {
- throw Error("Invalid month index \"" + month + "\". Month index has to be between 0 and 11.");
- }
- if (date < 1) {
- throw Error("Invalid date \"" + date + "\". Date has to be greater than 0.");
- }
- /** @type {?} */
- var result = this._createDateWithOverflow(year, month, date);
- // Check that the date wasn't above the upper bound for the month, causing the month to overflow
- if (result.getMonth() != month) {
- throw Error("Invalid date \"" + date + "\" for month with index \"" + month + "\".");
- }
- return result;
- };
- /**
- * @return {?}
- */
- NativeDateAdapter.prototype.today = /**
- * @return {?}
- */
- function () {
- return new Date();
- };
- /**
- * @param {?} value
- * @return {?}
- */
- NativeDateAdapter.prototype.parse = /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- // We have no way using the native JS Date to set the parse format or locale, so we ignore these
- // parameters.
- if (typeof value == 'number') {
- return new Date(value);
- }
- return value ? new Date(Date.parse(value)) : null;
- };
- /**
- * @param {?} date
- * @param {?} displayFormat
- * @return {?}
- */
- NativeDateAdapter.prototype.format = /**
- * @param {?} date
- * @param {?} displayFormat
- * @return {?}
- */
- function (date, displayFormat) {
- if (!this.isValid(date)) {
- throw Error('NativeDateAdapter: Cannot format invalid date.');
- }
- if (SUPPORTS_INTL_API) {
- // On IE and Edge the i18n API will throw a hard error that can crash the entire app
- // if we attempt to format a date whose year is less than 1 or greater than 9999.
- if (this._clampDate && (date.getFullYear() < 1 || date.getFullYear() > 9999)) {
- date = this.clone(date);
- date.setFullYear(Math.max(1, Math.min(9999, date.getFullYear())));
- }
- displayFormat = __assign({}, displayFormat, { timeZone: 'utc' });
- /** @type {?} */
- var dtf = new Intl.DateTimeFormat(this.locale, displayFormat);
- return this._stripDirectionalityCharacters(this._format(dtf, date));
- }
- return this._stripDirectionalityCharacters(date.toDateString());
- };
- /**
- * @param {?} date
- * @param {?} years
- * @return {?}
- */
- NativeDateAdapter.prototype.addCalendarYears = /**
- * @param {?} date
- * @param {?} years
- * @return {?}
- */
- function (date, years) {
- return this.addCalendarMonths(date, years * 12);
- };
- /**
- * @param {?} date
- * @param {?} months
- * @return {?}
- */
- NativeDateAdapter.prototype.addCalendarMonths = /**
- * @param {?} date
- * @param {?} months
- * @return {?}
- */
- function (date, months) {
- /** @type {?} */
- var newDate = this._createDateWithOverflow(this.getYear(date), this.getMonth(date) + months, this.getDate(date));
- // It's possible to wind up in the wrong month if the original month has more days than the new
- // month. In this case we want to go to the last day of the desired month.
- // Note: the additional + 12 % 12 ensures we end up with a positive number, since JS % doesn't
- // guarantee this.
- if (this.getMonth(newDate) != ((this.getMonth(date) + months) % 12 + 12) % 12) {
- newDate = this._createDateWithOverflow(this.getYear(newDate), this.getMonth(newDate), 0);
- }
- return newDate;
- };
- /**
- * @param {?} date
- * @param {?} days
- * @return {?}
- */
- NativeDateAdapter.prototype.addCalendarDays = /**
- * @param {?} date
- * @param {?} days
- * @return {?}
- */
- function (date, days) {
- return this._createDateWithOverflow(this.getYear(date), this.getMonth(date), this.getDate(date) + days);
- };
- /**
- * @param {?} date
- * @return {?}
- */
- NativeDateAdapter.prototype.toIso8601 = /**
- * @param {?} date
- * @return {?}
- */
- function (date) {
- return [
- date.getUTCFullYear(),
- this._2digit(date.getUTCMonth() + 1),
- this._2digit(date.getUTCDate())
- ].join('-');
- };
- /**
- * Returns the given value if given a valid Date or null. Deserializes valid ISO 8601 strings
- * (https://www.ietf.org/rfc/rfc3339.txt) into valid Dates and empty string into null. Returns an
- * invalid date for all other values.
- */
- /**
- * Returns the given value if given a valid Date or null. Deserializes valid ISO 8601 strings
- * (https://www.ietf.org/rfc/rfc3339.txt) into valid Dates and empty string into null. Returns an
- * invalid date for all other values.
- * @param {?} value
- * @return {?}
- */
- NativeDateAdapter.prototype.deserialize = /**
- * Returns the given value if given a valid Date or null. Deserializes valid ISO 8601 strings
- * (https://www.ietf.org/rfc/rfc3339.txt) into valid Dates and empty string into null. Returns an
- * invalid date for all other values.
- * @param {?} value
- * @return {?}
- */
- function (value) {
- if (typeof value === 'string') {
- if (!value) {
- return null;
- }
- // The `Date` constructor accepts formats other than ISO 8601, so we need to make sure the
- // string is the right format first.
- if (ISO_8601_REGEX.test(value)) {
- /** @type {?} */
- var date = new Date(value);
- if (this.isValid(date)) {
- return date;
- }
- }
- }
- return _super.prototype.deserialize.call(this, value);
- };
- /**
- * @param {?} obj
- * @return {?}
- */
- NativeDateAdapter.prototype.isDateInstance = /**
- * @param {?} obj
- * @return {?}
- */
- function (obj) {
- return obj instanceof Date;
- };
- /**
- * @param {?} date
- * @return {?}
- */
- NativeDateAdapter.prototype.isValid = /**
- * @param {?} date
- * @return {?}
- */
- function (date) {
- return !isNaN(date.getTime());
- };
- /**
- * @return {?}
- */
- NativeDateAdapter.prototype.invalid = /**
- * @return {?}
- */
- function () {
- return new Date(NaN);
- };
- /** Creates a date but allows the month and date to overflow. */
- /**
- * Creates a date but allows the month and date to overflow.
- * @private
- * @param {?} year
- * @param {?} month
- * @param {?} date
- * @return {?}
- */
- NativeDateAdapter.prototype._createDateWithOverflow = /**
- * Creates a date but allows the month and date to overflow.
- * @private
- * @param {?} year
- * @param {?} month
- * @param {?} date
- * @return {?}
- */
- function (year, month, date) {
- /** @type {?} */
- var result = new Date(year, month, date);
- // We need to correct for the fact that JS native Date treats years in range [0, 99] as
- // abbreviations for 19xx.
- if (year >= 0 && year < 100) {
- result.setFullYear(this.getYear(result) - 1900);
- }
- return result;
- };
- /**
- * Pads a number to make it two digits.
- * @param n The number to pad.
- * @returns The padded number.
- */
- /**
- * Pads a number to make it two digits.
- * @private
- * @param {?} n The number to pad.
- * @return {?} The padded number.
- */
- NativeDateAdapter.prototype._2digit = /**
- * Pads a number to make it two digits.
- * @private
- * @param {?} n The number to pad.
- * @return {?} The padded number.
- */
- function (n) {
- return ('00' + n).slice(-2);
- };
- /**
- * Strip out unicode LTR and RTL characters. Edge and IE insert these into formatted dates while
- * other browsers do not. We remove them to make output consistent and because they interfere with
- * date parsing.
- * @param str The string to strip direction characters from.
- * @returns The stripped string.
- */
- /**
- * Strip out unicode LTR and RTL characters. Edge and IE insert these into formatted dates while
- * other browsers do not. We remove them to make output consistent and because they interfere with
- * date parsing.
- * @private
- * @param {?} str The string to strip direction characters from.
- * @return {?} The stripped string.
- */
- NativeDateAdapter.prototype._stripDirectionalityCharacters = /**
- * Strip out unicode LTR and RTL characters. Edge and IE insert these into formatted dates while
- * other browsers do not. We remove them to make output consistent and because they interfere with
- * date parsing.
- * @private
- * @param {?} str The string to strip direction characters from.
- * @return {?} The stripped string.
- */
- function (str) {
- return str.replace(/[\u200e\u200f]/g, '');
- };
- /**
- * When converting Date object to string, javascript built-in functions may return wrong
- * results because it applies its internal DST rules. The DST rules around the world change
- * very frequently, and the current valid rule is not always valid in previous years though.
- * We work around this problem building a new Date object which has its internal UTC
- * representation with the local date and time.
- * @param dtf Intl.DateTimeFormat object, containg the desired string format. It must have
- * timeZone set to 'utc' to work fine.
- * @param date Date from which we want to get the string representation according to dtf
- * @returns A Date object with its UTC representation based on the passed in date info
- */
- /**
- * When converting Date object to string, javascript built-in functions may return wrong
- * results because it applies its internal DST rules. The DST rules around the world change
- * very frequently, and the current valid rule is not always valid in previous years though.
- * We work around this problem building a new Date object which has its internal UTC
- * representation with the local date and time.
- * @private
- * @param {?} dtf Intl.DateTimeFormat object, containg the desired string format. It must have
- * timeZone set to 'utc' to work fine.
- * @param {?} date Date from which we want to get the string representation according to dtf
- * @return {?} A Date object with its UTC representation based on the passed in date info
- */
- NativeDateAdapter.prototype._format = /**
- * When converting Date object to string, javascript built-in functions may return wrong
- * results because it applies its internal DST rules. The DST rules around the world change
- * very frequently, and the current valid rule is not always valid in previous years though.
- * We work around this problem building a new Date object which has its internal UTC
- * representation with the local date and time.
- * @private
- * @param {?} dtf Intl.DateTimeFormat object, containg the desired string format. It must have
- * timeZone set to 'utc' to work fine.
- * @param {?} date Date from which we want to get the string representation according to dtf
- * @return {?} A Date object with its UTC representation based on the passed in date info
- */
- function (dtf, date) {
- /** @type {?} */
- var d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
- return dtf.format(d);
- };
- NativeDateAdapter.decorators = [
- { type: core.Injectable },
- ];
- /** @nocollapse */
- NativeDateAdapter.ctorParameters = function () { return [
- { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_DATE_LOCALE,] }] },
- { type: platform.Platform }
- ]; };
- return NativeDateAdapter;
- }(DateAdapter));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /** @type {?} */
- var MAT_NATIVE_DATE_FORMATS = {
- parse: {
- dateInput: null,
- },
- display: {
- dateInput: { year: 'numeric', month: 'numeric', day: 'numeric' },
- monthYearLabel: { year: 'numeric', month: 'short' },
- dateA11yLabel: { year: 'numeric', month: 'long', day: 'numeric' },
- monthYearA11yLabel: { year: 'numeric', month: 'long' },
- }
- };
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var NativeDateModule = /** @class */ (function () {
- function NativeDateModule() {
- }
- NativeDateModule.decorators = [
- { type: core.NgModule, args: [{
- imports: [platform.PlatformModule],
- providers: [
- { provide: DateAdapter, useClass: NativeDateAdapter },
- ],
- },] },
- ];
- return NativeDateModule;
- }());
- var ɵ0$1 = MAT_NATIVE_DATE_FORMATS;
- var MatNativeDateModule = /** @class */ (function () {
- function MatNativeDateModule() {
- }
- MatNativeDateModule.decorators = [
- { type: core.NgModule, args: [{
- imports: [NativeDateModule],
- providers: [{ provide: MAT_DATE_FORMATS, useValue: ɵ0$1 }],
- },] },
- ];
- return MatNativeDateModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Error state matcher that matches when a control is invalid and dirty.
- */
- var ShowOnDirtyErrorStateMatcher = /** @class */ (function () {
- function ShowOnDirtyErrorStateMatcher() {
- }
- /**
- * @param {?} control
- * @param {?} form
- * @return {?}
- */
- ShowOnDirtyErrorStateMatcher.prototype.isErrorState = /**
- * @param {?} control
- * @param {?} form
- * @return {?}
- */
- function (control, form) {
- return !!(control && control.invalid && (control.dirty || (form && form.submitted)));
- };
- ShowOnDirtyErrorStateMatcher.decorators = [
- { type: core.Injectable },
- ];
- return ShowOnDirtyErrorStateMatcher;
- }());
- /**
- * Provider that defines how form controls behave with regards to displaying error messages.
- */
- var ErrorStateMatcher = /** @class */ (function () {
- function ErrorStateMatcher() {
- }
- /**
- * @param {?} control
- * @param {?} form
- * @return {?}
- */
- ErrorStateMatcher.prototype.isErrorState = /**
- * @param {?} control
- * @param {?} form
- * @return {?}
- */
- function (control, form) {
- return !!(control && control.invalid && (control.touched || (form && form.submitted)));
- };
- ErrorStateMatcher.decorators = [
- { type: core.Injectable, args: [{ providedIn: 'root' },] },
- ];
- /** @nocollapse */ ErrorStateMatcher.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function ErrorStateMatcher_Factory() { return new ErrorStateMatcher(); }, token: ErrorStateMatcher, providedIn: "root" });
- return ErrorStateMatcher;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Injection token that can be used to provide options to the Hammerjs instance.
- * More info at http://hammerjs.github.io/api/.
- * @type {?}
- */
- var MAT_HAMMER_OPTIONS = new core.InjectionToken('MAT_HAMMER_OPTIONS');
- /** @type {?} */
- var ANGULAR_MATERIAL_SUPPORTED_HAMMER_GESTURES = [
- 'longpress',
- 'slide',
- 'slidestart',
- 'slideend',
- 'slideright',
- 'slideleft'
- ];
- var ɵ0$2 = /**
- * @return {?}
- */
- function () { }, ɵ1 = /**
- * @return {?}
- */
- function () { };
- /**
- * Fake HammerInstance that is used when a Hammer instance is requested when HammerJS has not
- * been loaded on the page.
- * @type {?}
- */
- var noopHammerInstance = {
- on: (ɵ0$2),
- off: (ɵ1),
- };
- /**
- * Adjusts configuration of our gesture library, Hammer.
- */
- var GestureConfig = /** @class */ (function (_super) {
- __extends(GestureConfig, _super);
- function GestureConfig(_hammerOptions, commonModule) {
- var _this = _super.call(this) || this;
- _this._hammerOptions = _hammerOptions;
- /**
- * List of new event names to add to the gesture support list
- */
- _this.events = ANGULAR_MATERIAL_SUPPORTED_HAMMER_GESTURES;
- if (commonModule) {
- commonModule._checkHammerIsAvailable();
- }
- return _this;
- }
- /**
- * Builds Hammer instance manually to add custom recognizers that match the Material Design spec.
- *
- * Our gesture names come from the Material Design gestures spec:
- * https://material.io/design/#gestures-touch-mechanics
- *
- * More information on default recognizers can be found in Hammer docs:
- * http://hammerjs.github.io/recognizer-pan/
- * http://hammerjs.github.io/recognizer-press/
- *
- * @param element Element to which to assign the new HammerJS gestures.
- * @returns Newly-created HammerJS instance.
- */
- /**
- * Builds Hammer instance manually to add custom recognizers that match the Material Design spec.
- *
- * Our gesture names come from the Material Design gestures spec:
- * https://material.io/design/#gestures-touch-mechanics
- *
- * More information on default recognizers can be found in Hammer docs:
- * http://hammerjs.github.io/recognizer-pan/
- * http://hammerjs.github.io/recognizer-press/
- *
- * @param {?} element Element to which to assign the new HammerJS gestures.
- * @return {?} Newly-created HammerJS instance.
- */
- GestureConfig.prototype.buildHammer = /**
- * Builds Hammer instance manually to add custom recognizers that match the Material Design spec.
- *
- * Our gesture names come from the Material Design gestures spec:
- * https://material.io/design/#gestures-touch-mechanics
- *
- * More information on default recognizers can be found in Hammer docs:
- * http://hammerjs.github.io/recognizer-pan/
- * http://hammerjs.github.io/recognizer-press/
- *
- * @param {?} element Element to which to assign the new HammerJS gestures.
- * @return {?} Newly-created HammerJS instance.
- */
- function (element) {
- /** @type {?} */
- var hammer = typeof window !== 'undefined' ? ((/** @type {?} */ (window))).Hammer : null;
- if (!hammer) {
- // If HammerJS is not loaded here, return the noop HammerInstance. This is necessary to
- // ensure that omitting HammerJS completely will not cause any errors while *also* supporting
- // the lazy-loading of HammerJS via the HAMMER_LOADER token introduced in Angular 6.1.
- // Because we can't depend on HAMMER_LOADER's existance until 7.0, we have to always set
- // `this.events` to the set we support, instead of conditionally setting it to `[]` if
- // `HAMMER_LOADER` is present (and then throwing an Error here if `window.Hammer` is
- // undefined).
- // @breaking-change 8.0.0
- return noopHammerInstance;
- }
- /** @type {?} */
- var mc = new hammer(element, this._hammerOptions || undefined);
- // Default Hammer Recognizers.
- /** @type {?} */
- var pan = new hammer.Pan();
- /** @type {?} */
- var swipe = new hammer.Swipe();
- /** @type {?} */
- var press = new hammer.Press();
- // Notice that a HammerJS recognizer can only depend on one other recognizer once.
- // Otherwise the previous `recognizeWith` will be dropped.
- // TODO: Confirm threshold numbers with Material Design UX Team
- /** @type {?} */
- var slide = this._createRecognizer(pan, { event: 'slide', threshold: 0 }, swipe);
- /** @type {?} */
- var longpress = this._createRecognizer(press, { event: 'longpress', time: 500 });
- // Overwrite the default `pan` event to use the swipe event.
- pan.recognizeWith(swipe);
- // Since the slide event threshold is set to zero, the slide recognizer can fire and
- // accidentally reset the longpress recognizer. In order to make sure that the two
- // recognizers can run simultaneously but don't affect each other, we allow the slide
- // recognizer to recognize while a longpress is being processed.
- // See: https://github.com/hammerjs/hammer.js/blob/master/src/manager.js#L123-L124
- longpress.recognizeWith(slide);
- // Add customized gestures to Hammer manager
- mc.add([swipe, press, pan, slide, longpress]);
- return (/** @type {?} */ (mc));
- };
- /** Creates a new recognizer, without affecting the default recognizers of HammerJS */
- /**
- * Creates a new recognizer, without affecting the default recognizers of HammerJS
- * @private
- * @param {?} base
- * @param {?} options
- * @param {...?} inheritances
- * @return {?}
- */
- GestureConfig.prototype._createRecognizer = /**
- * Creates a new recognizer, without affecting the default recognizers of HammerJS
- * @private
- * @param {?} base
- * @param {?} options
- * @param {...?} inheritances
- * @return {?}
- */
- function (base, options) {
- var inheritances = [];
- for (var _i = 2; _i < arguments.length; _i++) {
- inheritances[_i - 2] = arguments[_i];
- }
- /** @type {?} */
- var recognizer = new ((/** @type {?} */ (base.constructor)))(options);
- inheritances.push(base);
- inheritances.forEach((/**
- * @param {?} item
- * @return {?}
- */
- function (item) { return recognizer.recognizeWith(item); }));
- return recognizer;
- };
- GestureConfig.decorators = [
- { type: core.Injectable },
- ];
- /** @nocollapse */
- GestureConfig.ctorParameters = function () { return [
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_HAMMER_OPTIONS,] }] },
- { type: MatCommonModule, decorators: [{ type: core.Optional }] }
- ]; };
- return GestureConfig;
- }(platformBrowser.HammerGestureConfig));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Shared directive to count lines inside a text area, such as a list item.
- * Line elements can be extracted with a \@ContentChildren(MatLine) query, then
- * counted by checking the query list's length.
- */
- var MatLine = /** @class */ (function () {
- function MatLine() {
- }
- MatLine.decorators = [
- { type: core.Directive, args: [{
- selector: '[mat-line], [matLine]',
- host: { 'class': 'mat-line' }
- },] },
- ];
- return MatLine;
- }());
- /**
- * Helper that takes a query list of lines and sets the correct class on the host.
- * \@docs-private
- * @param {?} lines
- * @param {?} element
- * @return {?}
- */
- function setLines(lines, element) {
- // Note: doesn't need to unsubscribe, because `changes`
- // gets completed by Angular when the view is destroyed.
- lines.changes.pipe(operators.startWith(lines)).subscribe((/**
- * @param {?} __0
- * @return {?}
- */
- function (_a) {
- var length = _a.length;
- setClass(element, 'mat-2-line', false);
- setClass(element, 'mat-3-line', false);
- setClass(element, 'mat-multi-line', false);
- if (length === 2 || length === 3) {
- setClass(element, "mat-" + length + "-line", true);
- }
- else if (length > 3) {
- setClass(element, "mat-multi-line", true);
- }
- }));
- }
- /**
- * Adds or removes a class from an element.
- * @param {?} element
- * @param {?} className
- * @param {?} isAdd
- * @return {?}
- */
- function setClass(element, className, isAdd) {
- /** @type {?} */
- var classList = element.nativeElement.classList;
- isAdd ? classList.add(className) : classList.remove(className);
- }
- /**
- * Helper that takes a query list of lines and sets the correct class on the host.
- * \@docs-private
- * @deprecated Use `setLines` instead.
- * \@breaking-change 8.0.0
- */
- var /**
- * Helper that takes a query list of lines and sets the correct class on the host.
- * \@docs-private
- * @deprecated Use `setLines` instead.
- * \@breaking-change 8.0.0
- */
- MatLineSetter = /** @class */ (function () {
- function MatLineSetter(lines, element) {
- setLines(lines, element);
- }
- return MatLineSetter;
- }());
- var MatLineModule = /** @class */ (function () {
- function MatLineModule() {
- }
- MatLineModule.decorators = [
- { type: core.NgModule, args: [{
- imports: [MatCommonModule],
- exports: [MatLine, MatCommonModule],
- declarations: [MatLine],
- },] },
- ];
- return MatLineModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /** @enum {number} */
- var RippleState = {
- FADING_IN: 0, VISIBLE: 1, FADING_OUT: 2, HIDDEN: 3,
- };
- RippleState[RippleState.FADING_IN] = 'FADING_IN';
- RippleState[RippleState.VISIBLE] = 'VISIBLE';
- RippleState[RippleState.FADING_OUT] = 'FADING_OUT';
- RippleState[RippleState.HIDDEN] = 'HIDDEN';
- /**
- * Reference to a previously launched ripple element.
- */
- var /**
- * Reference to a previously launched ripple element.
- */
- RippleRef = /** @class */ (function () {
- function RippleRef(_renderer, element, config) {
- this._renderer = _renderer;
- this.element = element;
- this.config = config;
- /**
- * Current state of the ripple.
- */
- this.state = RippleState.HIDDEN;
- }
- /** Fades out the ripple element. */
- /**
- * Fades out the ripple element.
- * @return {?}
- */
- RippleRef.prototype.fadeOut = /**
- * Fades out the ripple element.
- * @return {?}
- */
- function () {
- this._renderer.fadeOutRipple(this);
- };
- return RippleRef;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Default ripple animation configuration for ripples without an explicit
- * animation config specified.
- * @type {?}
- */
- var defaultRippleAnimationConfig = {
- enterDuration: 450,
- exitDuration: 400
- };
- /**
- * Timeout for ignoring mouse events. Mouse events will be temporary ignored after touch
- * events to avoid synthetic mouse events.
- * @type {?}
- */
- var ignoreMouseEventsTimeout = 800;
- /**
- * Options that apply to all the event listeners that are bound by the ripple renderer.
- * @type {?}
- */
- var passiveEventOptions = platform.normalizePassiveListenerOptions({ passive: true });
- /**
- * Helper service that performs DOM manipulations. Not intended to be used outside this module.
- * The constructor takes a reference to the ripple directive's host element and a map of DOM
- * event handlers to be installed on the element that triggers ripple animations.
- * This will eventually become a custom renderer once Angular support exists.
- * \@docs-private
- */
- var /**
- * Helper service that performs DOM manipulations. Not intended to be used outside this module.
- * The constructor takes a reference to the ripple directive's host element and a map of DOM
- * event handlers to be installed on the element that triggers ripple animations.
- * This will eventually become a custom renderer once Angular support exists.
- * \@docs-private
- */
- RippleRenderer = /** @class */ (function () {
- function RippleRenderer(_target, _ngZone, elementRef, platform$$1) {
- var _this = this;
- this._target = _target;
- this._ngZone = _ngZone;
- /**
- * Whether the pointer is currently down or not.
- */
- this._isPointerDown = false;
- /**
- * Events to be registered on the trigger element.
- */
- this._triggerEvents = new Map();
- /**
- * Set of currently active ripple references.
- */
- this._activeRipples = new Set();
- /**
- * Function being called whenever the trigger is being pressed using mouse.
- */
- this._onMousedown = (/**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- // Screen readers will fire fake mouse events for space/enter. Skip launching a
- // ripple in this case for consistency with the non-screen-reader experience.
- /** @type {?} */
- var isFakeMousedown = a11y.isFakeMousedownFromScreenReader(event);
- /** @type {?} */
- var isSyntheticEvent = _this._lastTouchStartEvent &&
- Date.now() < _this._lastTouchStartEvent + ignoreMouseEventsTimeout;
- if (!_this._target.rippleDisabled && !isFakeMousedown && !isSyntheticEvent) {
- _this._isPointerDown = true;
- _this.fadeInRipple(event.clientX, event.clientY, _this._target.rippleConfig);
- }
- });
- /**
- * Function being called whenever the trigger is being pressed using touch.
- */
- this._onTouchStart = (/**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- if (!_this._target.rippleDisabled) {
- // Some browsers fire mouse events after a `touchstart` event. Those synthetic mouse
- // events will launch a second ripple if we don't ignore mouse events for a specific
- // time after a touchstart event.
- _this._lastTouchStartEvent = Date.now();
- _this._isPointerDown = true;
- // Use `changedTouches` so we skip any touches where the user put
- // their finger down, but used another finger to tap the element again.
- /** @type {?} */
- var touches = event.changedTouches;
- for (var i = 0; i < touches.length; i++) {
- _this.fadeInRipple(touches[i].clientX, touches[i].clientY, _this._target.rippleConfig);
- }
- }
- });
- /**
- * Function being called whenever the trigger is being released.
- */
- this._onPointerUp = (/**
- * @return {?}
- */
- function () {
- if (!_this._isPointerDown) {
- return;
- }
- _this._isPointerDown = false;
- // Fade-out all ripples that are visible and not persistent.
- _this._activeRipples.forEach((/**
- * @param {?} ripple
- * @return {?}
- */
- function (ripple) {
- // By default, only ripples that are completely visible will fade out on pointer release.
- // If the `terminateOnPointerUp` option is set, ripples that still fade in will also fade out.
- /** @type {?} */
- var isVisible = ripple.state === RippleState.VISIBLE ||
- ripple.config.terminateOnPointerUp && ripple.state === RippleState.FADING_IN;
- if (!ripple.config.persistent && isVisible) {
- ripple.fadeOut();
- }
- }));
- });
- // Only do anything if we're on the browser.
- if (platform$$1.isBrowser) {
- this._containerElement = elementRef.nativeElement;
- // Specify events which need to be registered on the trigger.
- this._triggerEvents
- .set('mousedown', this._onMousedown)
- .set('mouseup', this._onPointerUp)
- .set('mouseleave', this._onPointerUp)
- .set('touchstart', this._onTouchStart)
- .set('touchend', this._onPointerUp)
- .set('touchcancel', this._onPointerUp);
- }
- }
- /**
- * Fades in a ripple at the given coordinates.
- * @param x Coordinate within the element, along the X axis at which to start the ripple.
- * @param y Coordinate within the element, along the Y axis at which to start the ripple.
- * @param config Extra ripple options.
- */
- /**
- * Fades in a ripple at the given coordinates.
- * @param {?} x Coordinate within the element, along the X axis at which to start the ripple.
- * @param {?} y Coordinate within the element, along the Y axis at which to start the ripple.
- * @param {?=} config Extra ripple options.
- * @return {?}
- */
- RippleRenderer.prototype.fadeInRipple = /**
- * Fades in a ripple at the given coordinates.
- * @param {?} x Coordinate within the element, along the X axis at which to start the ripple.
- * @param {?} y Coordinate within the element, along the Y axis at which to start the ripple.
- * @param {?=} config Extra ripple options.
- * @return {?}
- */
- function (x, y, config) {
- var _this = this;
- if (config === void 0) { config = {}; }
- /** @type {?} */
- var containerRect = this._containerRect =
- this._containerRect || this._containerElement.getBoundingClientRect();
- /** @type {?} */
- var animationConfig = __assign({}, defaultRippleAnimationConfig, config.animation);
- if (config.centered) {
- x = containerRect.left + containerRect.width / 2;
- y = containerRect.top + containerRect.height / 2;
- }
- /** @type {?} */
- var radius = config.radius || distanceToFurthestCorner(x, y, containerRect);
- /** @type {?} */
- var offsetX = x - containerRect.left;
- /** @type {?} */
- var offsetY = y - containerRect.top;
- /** @type {?} */
- var duration = animationConfig.enterDuration;
- /** @type {?} */
- var ripple = document.createElement('div');
- ripple.classList.add('mat-ripple-element');
- ripple.style.left = offsetX - radius + "px";
- ripple.style.top = offsetY - radius + "px";
- ripple.style.height = radius * 2 + "px";
- ripple.style.width = radius * 2 + "px";
- // If the color is not set, the default CSS color will be used.
- ripple.style.backgroundColor = config.color || null;
- ripple.style.transitionDuration = duration + "ms";
- this._containerElement.appendChild(ripple);
- // By default the browser does not recalculate the styles of dynamically created
- // ripple elements. This is critical because then the `scale` would not animate properly.
- enforceStyleRecalculation(ripple);
- ripple.style.transform = 'scale(1)';
- // Exposed reference to the ripple that will be returned.
- /** @type {?} */
- var rippleRef = new RippleRef(this, ripple, config);
- rippleRef.state = RippleState.FADING_IN;
- // Add the ripple reference to the list of all active ripples.
- this._activeRipples.add(rippleRef);
- if (!config.persistent) {
- this._mostRecentTransientRipple = rippleRef;
- }
- // Wait for the ripple element to be completely faded in.
- // Once it's faded in, the ripple can be hidden immediately if the mouse is released.
- this._runTimeoutOutsideZone((/**
- * @return {?}
- */
- function () {
- /** @type {?} */
- var isMostRecentTransientRipple = rippleRef === _this._mostRecentTransientRipple;
- rippleRef.state = RippleState.VISIBLE;
- // When the timer runs out while the user has kept their pointer down, we want to
- // keep only the persistent ripples and the latest transient ripple. We do this,
- // because we don't want stacked transient ripples to appear after their enter
- // animation has finished.
- if (!config.persistent && (!isMostRecentTransientRipple || !_this._isPointerDown)) {
- rippleRef.fadeOut();
- }
- }), duration);
- return rippleRef;
- };
- /** Fades out a ripple reference. */
- /**
- * Fades out a ripple reference.
- * @param {?} rippleRef
- * @return {?}
- */
- RippleRenderer.prototype.fadeOutRipple = /**
- * Fades out a ripple reference.
- * @param {?} rippleRef
- * @return {?}
- */
- function (rippleRef) {
- /** @type {?} */
- var wasActive = this._activeRipples.delete(rippleRef);
- if (rippleRef === this._mostRecentTransientRipple) {
- this._mostRecentTransientRipple = null;
- }
- // Clear out the cached bounding rect if we have no more ripples.
- if (!this._activeRipples.size) {
- this._containerRect = null;
- }
- // For ripples that are not active anymore, don't re-run the fade-out animation.
- if (!wasActive) {
- return;
- }
- /** @type {?} */
- var rippleEl = rippleRef.element;
- /** @type {?} */
- var animationConfig = __assign({}, defaultRippleAnimationConfig, rippleRef.config.animation);
- rippleEl.style.transitionDuration = animationConfig.exitDuration + "ms";
- rippleEl.style.opacity = '0';
- rippleRef.state = RippleState.FADING_OUT;
- // Once the ripple faded out, the ripple can be safely removed from the DOM.
- this._runTimeoutOutsideZone((/**
- * @return {?}
- */
- function () {
- rippleRef.state = RippleState.HIDDEN;
- (/** @type {?} */ (rippleEl.parentNode)).removeChild(rippleEl);
- }), animationConfig.exitDuration);
- };
- /** Fades out all currently active ripples. */
- /**
- * Fades out all currently active ripples.
- * @return {?}
- */
- RippleRenderer.prototype.fadeOutAll = /**
- * Fades out all currently active ripples.
- * @return {?}
- */
- function () {
- this._activeRipples.forEach((/**
- * @param {?} ripple
- * @return {?}
- */
- function (ripple) { return ripple.fadeOut(); }));
- };
- /** Sets up the trigger event listeners */
- /**
- * Sets up the trigger event listeners
- * @param {?} element
- * @return {?}
- */
- RippleRenderer.prototype.setupTriggerEvents = /**
- * Sets up the trigger event listeners
- * @param {?} element
- * @return {?}
- */
- function (element) {
- var _this = this;
- if (!element || element === this._triggerElement) {
- return;
- }
- // Remove all previously registered event listeners from the trigger element.
- this._removeTriggerEvents();
- this._ngZone.runOutsideAngular((/**
- * @return {?}
- */
- function () {
- _this._triggerEvents.forEach((/**
- * @param {?} fn
- * @param {?} type
- * @return {?}
- */
- function (fn, type) {
- element.addEventListener(type, fn, passiveEventOptions);
- }));
- }));
- this._triggerElement = element;
- };
- /** Runs a timeout outside of the Angular zone to avoid triggering the change detection. */
- /**
- * Runs a timeout outside of the Angular zone to avoid triggering the change detection.
- * @private
- * @param {?} fn
- * @param {?=} delay
- * @return {?}
- */
- RippleRenderer.prototype._runTimeoutOutsideZone = /**
- * Runs a timeout outside of the Angular zone to avoid triggering the change detection.
- * @private
- * @param {?} fn
- * @param {?=} delay
- * @return {?}
- */
- function (fn, delay) {
- if (delay === void 0) { delay = 0; }
- this._ngZone.runOutsideAngular((/**
- * @return {?}
- */
- function () { return setTimeout(fn, delay); }));
- };
- /** Removes previously registered event listeners from the trigger element. */
- /**
- * Removes previously registered event listeners from the trigger element.
- * @return {?}
- */
- RippleRenderer.prototype._removeTriggerEvents = /**
- * Removes previously registered event listeners from the trigger element.
- * @return {?}
- */
- function () {
- var _this = this;
- if (this._triggerElement) {
- this._triggerEvents.forEach((/**
- * @param {?} fn
- * @param {?} type
- * @return {?}
- */
- function (fn, type) {
- (/** @type {?} */ (_this._triggerElement)).removeEventListener(type, fn, passiveEventOptions);
- }));
- }
- };
- return RippleRenderer;
- }());
- /**
- * Enforces a style recalculation of a DOM element by computing its styles.
- * @param {?} element
- * @return {?}
- */
- function enforceStyleRecalculation(element) {
- // Enforce a style recalculation by calling `getComputedStyle` and accessing any property.
- // Calling `getPropertyValue` is important to let optimizers know that this is not a noop.
- // See: https://gist.github.com/paulirish/5d52fb081b3570c81e3a
- window.getComputedStyle(element).getPropertyValue('opacity');
- }
- /**
- * Returns the distance from the point (x, y) to the furthest corner of a rectangle.
- * @param {?} x
- * @param {?} y
- * @param {?} rect
- * @return {?}
- */
- function distanceToFurthestCorner(x, y, rect) {
- /** @type {?} */
- var distX = Math.max(Math.abs(x - rect.left), Math.abs(x - rect.right));
- /** @type {?} */
- var distY = Math.max(Math.abs(y - rect.top), Math.abs(y - rect.bottom));
- return Math.sqrt(distX * distX + distY * distY);
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Injection token that can be used to specify the global ripple options.
- * @type {?}
- */
- var MAT_RIPPLE_GLOBAL_OPTIONS = new core.InjectionToken('mat-ripple-global-options');
- var MatRipple = /** @class */ (function () {
- function MatRipple(_elementRef, ngZone, platform$$1, globalOptions, animationMode) {
- this._elementRef = _elementRef;
- /**
- * If set, the radius in pixels of foreground ripples when fully expanded. If unset, the radius
- * will be the distance from the center of the ripple to the furthest corner of the host element's
- * bounding rectangle.
- */
- this.radius = 0;
- this._disabled = false;
- /**
- * Whether ripple directive is initialized and the input bindings are set.
- */
- this._isInitialized = false;
- this._globalOptions = globalOptions || {};
- this._rippleRenderer = new RippleRenderer(this, ngZone, _elementRef, platform$$1);
- if (animationMode === 'NoopAnimations') {
- this._globalOptions.animation = { enterDuration: 0, exitDuration: 0 };
- }
- }
- Object.defineProperty(MatRipple.prototype, "disabled", {
- /**
- * Whether click events will not trigger the ripple. Ripples can be still launched manually
- * by using the `launch()` method.
- */
- get: /**
- * Whether click events will not trigger the ripple. Ripples can be still launched manually
- * by using the `launch()` method.
- * @return {?}
- */
- function () { return this._disabled; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._disabled = value;
- this._setupTriggerEventsIfEnabled();
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatRipple.prototype, "trigger", {
- /**
- * The element that triggers the ripple when click events are received.
- * Defaults to the directive's host element.
- */
- get: /**
- * The element that triggers the ripple when click events are received.
- * Defaults to the directive's host element.
- * @return {?}
- */
- function () { return this._trigger || this._elementRef.nativeElement; },
- set: /**
- * @param {?} trigger
- * @return {?}
- */
- function (trigger) {
- this._trigger = trigger;
- this._setupTriggerEventsIfEnabled();
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- MatRipple.prototype.ngOnInit = /**
- * @return {?}
- */
- function () {
- this._isInitialized = true;
- this._setupTriggerEventsIfEnabled();
- };
- /**
- * @return {?}
- */
- MatRipple.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- this._rippleRenderer._removeTriggerEvents();
- };
- /** Fades out all currently showing ripple elements. */
- /**
- * Fades out all currently showing ripple elements.
- * @return {?}
- */
- MatRipple.prototype.fadeOutAll = /**
- * Fades out all currently showing ripple elements.
- * @return {?}
- */
- function () {
- this._rippleRenderer.fadeOutAll();
- };
- Object.defineProperty(MatRipple.prototype, "rippleConfig", {
- /**
- * Ripple configuration from the directive's input values.
- * @docs-private Implemented as part of RippleTarget
- */
- get: /**
- * Ripple configuration from the directive's input values.
- * \@docs-private Implemented as part of RippleTarget
- * @return {?}
- */
- function () {
- return {
- centered: this.centered,
- radius: this.radius,
- color: this.color,
- animation: __assign({}, this._globalOptions.animation, this.animation),
- terminateOnPointerUp: this._globalOptions.terminateOnPointerUp,
- };
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatRipple.prototype, "rippleDisabled", {
- /**
- * Whether ripples on pointer-down are disabled or not.
- * @docs-private Implemented as part of RippleTarget
- */
- get: /**
- * Whether ripples on pointer-down are disabled or not.
- * \@docs-private Implemented as part of RippleTarget
- * @return {?}
- */
- function () {
- return this.disabled || !!this._globalOptions.disabled;
- },
- enumerable: true,
- configurable: true
- });
- /** Sets up the trigger event listeners if ripples are enabled. */
- /**
- * Sets up the trigger event listeners if ripples are enabled.
- * @private
- * @return {?}
- */
- MatRipple.prototype._setupTriggerEventsIfEnabled = /**
- * Sets up the trigger event listeners if ripples are enabled.
- * @private
- * @return {?}
- */
- function () {
- if (!this.disabled && this._isInitialized) {
- this._rippleRenderer.setupTriggerEvents(this.trigger);
- }
- };
- /** Launches a manual ripple at the specified coordinated or just by the ripple config. */
- /**
- * Launches a manual ripple at the specified coordinated or just by the ripple config.
- * @param {?} configOrX
- * @param {?=} y
- * @param {?=} config
- * @return {?}
- */
- MatRipple.prototype.launch = /**
- * Launches a manual ripple at the specified coordinated or just by the ripple config.
- * @param {?} configOrX
- * @param {?=} y
- * @param {?=} config
- * @return {?}
- */
- function (configOrX, y, config) {
- if (y === void 0) { y = 0; }
- if (typeof configOrX === 'number') {
- return this._rippleRenderer.fadeInRipple(configOrX, y, __assign({}, this.rippleConfig, config));
- }
- else {
- return this._rippleRenderer.fadeInRipple(0, 0, __assign({}, this.rippleConfig, configOrX));
- }
- };
- MatRipple.decorators = [
- { type: core.Directive, args: [{
- selector: '[mat-ripple], [matRipple]',
- exportAs: 'matRipple',
- host: {
- 'class': 'mat-ripple',
- '[class.mat-ripple-unbounded]': 'unbounded'
- }
- },] },
- ];
- /** @nocollapse */
- MatRipple.ctorParameters = function () { return [
- { type: core.ElementRef },
- { type: core.NgZone },
- { type: platform.Platform },
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_RIPPLE_GLOBAL_OPTIONS,] }] },
- { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
- ]; };
- MatRipple.propDecorators = {
- color: [{ type: core.Input, args: ['matRippleColor',] }],
- unbounded: [{ type: core.Input, args: ['matRippleUnbounded',] }],
- centered: [{ type: core.Input, args: ['matRippleCentered',] }],
- radius: [{ type: core.Input, args: ['matRippleRadius',] }],
- animation: [{ type: core.Input, args: ['matRippleAnimation',] }],
- disabled: [{ type: core.Input, args: ['matRippleDisabled',] }],
- trigger: [{ type: core.Input, args: ['matRippleTrigger',] }]
- };
- return MatRipple;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var MatRippleModule = /** @class */ (function () {
- function MatRippleModule() {
- }
- MatRippleModule.decorators = [
- { type: core.NgModule, args: [{
- imports: [MatCommonModule, platform.PlatformModule],
- exports: [MatRipple, MatCommonModule],
- declarations: [MatRipple],
- },] },
- ];
- return MatRippleModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Component that shows a simplified checkbox without including any kind of "real" checkbox.
- * Meant to be used when the checkbox is purely decorative and a large number of them will be
- * included, such as for the options in a multi-select. Uses no SVGs or complex animations.
- * Note that theming is meant to be handled by the parent element, e.g.
- * `mat-primary .mat-pseudo-checkbox`.
- *
- * Note that this component will be completely invisible to screen-reader users. This is *not*
- * interchangeable with `<mat-checkbox>` and should *not* be used if the user would directly
- * interact with the checkbox. The pseudo-checkbox should only be used as an implementation detail
- * of more complex components that appropriately handle selected / checked state.
- * \@docs-private
- */
- var MatPseudoCheckbox = /** @class */ (function () {
- function MatPseudoCheckbox(_animationMode) {
- this._animationMode = _animationMode;
- /**
- * Display state of the checkbox.
- */
- this.state = 'unchecked';
- /**
- * Whether the checkbox is disabled.
- */
- this.disabled = false;
- }
- MatPseudoCheckbox.decorators = [
- { type: core.Component, args: [{encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- selector: 'mat-pseudo-checkbox',
- styles: [".mat-pseudo-checkbox{width:16px;height:16px;border:2px solid;border-radius:2px;cursor:pointer;display:inline-block;vertical-align:middle;box-sizing:border-box;position:relative;flex-shrink:0;transition:border-color 90ms cubic-bezier(0,0,.2,.1),background-color 90ms cubic-bezier(0,0,.2,.1)}.mat-pseudo-checkbox::after{position:absolute;opacity:0;content:'';border-bottom:2px solid currentColor;transition:opacity 90ms cubic-bezier(0,0,.2,.1)}.mat-pseudo-checkbox.mat-pseudo-checkbox-checked,.mat-pseudo-checkbox.mat-pseudo-checkbox-indeterminate{border-color:transparent}._mat-animation-noopable.mat-pseudo-checkbox{transition:none;animation:none}._mat-animation-noopable.mat-pseudo-checkbox::after{transition:none}.mat-pseudo-checkbox-disabled{cursor:default}.mat-pseudo-checkbox-indeterminate::after{top:5px;left:1px;width:10px;opacity:1;border-radius:2px}.mat-pseudo-checkbox-checked::after{top:2.4px;left:1px;width:8px;height:3px;border-left:2px solid currentColor;transform:rotate(-45deg);opacity:1;box-sizing:content-box}"],
- template: '',
- host: {
- 'class': 'mat-pseudo-checkbox',
- '[class.mat-pseudo-checkbox-indeterminate]': 'state === "indeterminate"',
- '[class.mat-pseudo-checkbox-checked]': 'state === "checked"',
- '[class.mat-pseudo-checkbox-disabled]': 'disabled',
- '[class._mat-animation-noopable]': '_animationMode === "NoopAnimations"',
- },
- },] },
- ];
- /** @nocollapse */
- MatPseudoCheckbox.ctorParameters = function () { return [
- { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
- ]; };
- MatPseudoCheckbox.propDecorators = {
- state: [{ type: core.Input }],
- disabled: [{ type: core.Input }]
- };
- return MatPseudoCheckbox;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var MatPseudoCheckboxModule = /** @class */ (function () {
- function MatPseudoCheckboxModule() {
- }
- MatPseudoCheckboxModule.decorators = [
- { type: core.NgModule, args: [{
- exports: [MatPseudoCheckbox],
- declarations: [MatPseudoCheckbox]
- },] },
- ];
- return MatPseudoCheckboxModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- // Boilerplate for applying mixins to MatOptgroup.
- /**
- * \@docs-private
- */
- var
- // Boilerplate for applying mixins to MatOptgroup.
- /**
- * \@docs-private
- */
- MatOptgroupBase = /** @class */ (function () {
- function MatOptgroupBase() {
- }
- return MatOptgroupBase;
- }());
- /** @type {?} */
- var _MatOptgroupMixinBase = mixinDisabled(MatOptgroupBase);
- // Counter for unique group ids.
- /** @type {?} */
- var _uniqueOptgroupIdCounter = 0;
- /**
- * Component that is used to group instances of `mat-option`.
- */
- var MatOptgroup = /** @class */ (function (_super) {
- __extends(MatOptgroup, _super);
- function MatOptgroup() {
- var _this = _super !== null && _super.apply(this, arguments) || this;
- /**
- * Unique id for the underlying label.
- */
- _this._labelId = "mat-optgroup-label-" + _uniqueOptgroupIdCounter++;
- return _this;
- }
- MatOptgroup.decorators = [
- { type: core.Component, args: [{selector: 'mat-optgroup',
- exportAs: 'matOptgroup',
- template: "<label class=\"mat-optgroup-label\" [id]=\"_labelId\">{{ label }}<ng-content></ng-content></label><ng-content select=\"mat-option, ng-container\"></ng-content>",
- encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- inputs: ['disabled'],
- styles: [".mat-optgroup-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block;line-height:48px;height:48px;padding:0 16px;text-align:left;text-decoration:none;max-width:100%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.mat-optgroup-label[disabled]{cursor:default}[dir=rtl] .mat-optgroup-label{text-align:right}.mat-optgroup-label .mat-icon{margin-right:16px;vertical-align:middle}.mat-optgroup-label .mat-icon svg{vertical-align:top}[dir=rtl] .mat-optgroup-label .mat-icon{margin-left:16px;margin-right:0}"],
- host: {
- 'class': 'mat-optgroup',
- 'role': 'group',
- '[class.mat-optgroup-disabled]': 'disabled',
- '[attr.aria-disabled]': 'disabled.toString()',
- '[attr.aria-labelledby]': '_labelId',
- }
- },] },
- ];
- MatOptgroup.propDecorators = {
- label: [{ type: core.Input }]
- };
- return MatOptgroup;
- }(_MatOptgroupMixinBase));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Option IDs need to be unique across components, so this counter exists outside of
- * the component definition.
- * @type {?}
- */
- var _uniqueIdCounter = 0;
- /**
- * Event object emitted by MatOption when selected or deselected.
- */
- var /**
- * Event object emitted by MatOption when selected or deselected.
- */
- MatOptionSelectionChange = /** @class */ (function () {
- function MatOptionSelectionChange(source, isUserInput) {
- if (isUserInput === void 0) { isUserInput = false; }
- this.source = source;
- this.isUserInput = isUserInput;
- }
- return MatOptionSelectionChange;
- }());
- /**
- * Injection token used to provide the parent component to options.
- * @type {?}
- */
- var MAT_OPTION_PARENT_COMPONENT = new core.InjectionToken('MAT_OPTION_PARENT_COMPONENT');
- /**
- * Single option inside of a `<mat-select>` element.
- */
- var MatOption = /** @class */ (function () {
- function MatOption(_element, _changeDetectorRef, _parent, group) {
- this._element = _element;
- this._changeDetectorRef = _changeDetectorRef;
- this._parent = _parent;
- this.group = group;
- this._selected = false;
- this._active = false;
- this._disabled = false;
- this._mostRecentViewValue = '';
- /**
- * The unique ID of the option.
- */
- this.id = "mat-option-" + _uniqueIdCounter++;
- /**
- * Event emitted when the option is selected or deselected.
- */
- // tslint:disable-next-line:no-output-on-prefix
- this.onSelectionChange = new core.EventEmitter();
- /**
- * Emits when the state of the option changes and any parents have to be notified.
- */
- this._stateChanges = new rxjs.Subject();
- }
- Object.defineProperty(MatOption.prototype, "multiple", {
- /** Whether the wrapping component is in multiple selection mode. */
- get: /**
- * Whether the wrapping component is in multiple selection mode.
- * @return {?}
- */
- function () { return this._parent && this._parent.multiple; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatOption.prototype, "selected", {
- /** Whether or not the option is currently selected. */
- get: /**
- * Whether or not the option is currently selected.
- * @return {?}
- */
- function () { return this._selected; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatOption.prototype, "disabled", {
- /** Whether the option is disabled. */
- get: /**
- * Whether the option is disabled.
- * @return {?}
- */
- function () { return (this.group && this.group.disabled) || this._disabled; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) { this._disabled = coercion.coerceBooleanProperty(value); },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatOption.prototype, "disableRipple", {
- /** Whether ripples for the option are disabled. */
- get: /**
- * Whether ripples for the option are disabled.
- * @return {?}
- */
- function () { return this._parent && this._parent.disableRipple; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatOption.prototype, "active", {
- /**
- * Whether or not the option is currently active and ready to be selected.
- * An active option displays styles as if it is focused, but the
- * focus is actually retained somewhere else. This comes in handy
- * for components like autocomplete where focus must remain on the input.
- */
- get: /**
- * Whether or not the option is currently active and ready to be selected.
- * An active option displays styles as if it is focused, but the
- * focus is actually retained somewhere else. This comes in handy
- * for components like autocomplete where focus must remain on the input.
- * @return {?}
- */
- function () {
- return this._active;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatOption.prototype, "viewValue", {
- /**
- * The displayed value of the option. It is necessary to show the selected option in the
- * select's trigger.
- */
- get: /**
- * The displayed value of the option. It is necessary to show the selected option in the
- * select's trigger.
- * @return {?}
- */
- function () {
- // TODO(kara): Add input property alternative for node envs.
- return (this._getHostElement().textContent || '').trim();
- },
- enumerable: true,
- configurable: true
- });
- /** Selects the option. */
- /**
- * Selects the option.
- * @return {?}
- */
- MatOption.prototype.select = /**
- * Selects the option.
- * @return {?}
- */
- function () {
- if (!this._selected) {
- this._selected = true;
- this._changeDetectorRef.markForCheck();
- this._emitSelectionChangeEvent();
- }
- };
- /** Deselects the option. */
- /**
- * Deselects the option.
- * @return {?}
- */
- MatOption.prototype.deselect = /**
- * Deselects the option.
- * @return {?}
- */
- function () {
- if (this._selected) {
- this._selected = false;
- this._changeDetectorRef.markForCheck();
- this._emitSelectionChangeEvent();
- }
- };
- /** Sets focus onto this option. */
- /**
- * Sets focus onto this option.
- * @param {?=} _origin
- * @param {?=} options
- * @return {?}
- */
- MatOption.prototype.focus = /**
- * Sets focus onto this option.
- * @param {?=} _origin
- * @param {?=} options
- * @return {?}
- */
- function (_origin, options) {
- // Note that we aren't using `_origin`, but we need to keep it because some internal consumers
- // use `MatOption` in a `FocusKeyManager` and we need it to match `FocusableOption`.
- /** @type {?} */
- var element = this._getHostElement();
- if (typeof element.focus === 'function') {
- element.focus(options);
- }
- };
- /**
- * This method sets display styles on the option to make it appear
- * active. This is used by the ActiveDescendantKeyManager so key
- * events will display the proper options as active on arrow key events.
- */
- /**
- * This method sets display styles on the option to make it appear
- * active. This is used by the ActiveDescendantKeyManager so key
- * events will display the proper options as active on arrow key events.
- * @return {?}
- */
- MatOption.prototype.setActiveStyles = /**
- * This method sets display styles on the option to make it appear
- * active. This is used by the ActiveDescendantKeyManager so key
- * events will display the proper options as active on arrow key events.
- * @return {?}
- */
- function () {
- if (!this._active) {
- this._active = true;
- this._changeDetectorRef.markForCheck();
- }
- };
- /**
- * This method removes display styles on the option that made it appear
- * active. This is used by the ActiveDescendantKeyManager so key
- * events will display the proper options as active on arrow key events.
- */
- /**
- * This method removes display styles on the option that made it appear
- * active. This is used by the ActiveDescendantKeyManager so key
- * events will display the proper options as active on arrow key events.
- * @return {?}
- */
- MatOption.prototype.setInactiveStyles = /**
- * This method removes display styles on the option that made it appear
- * active. This is used by the ActiveDescendantKeyManager so key
- * events will display the proper options as active on arrow key events.
- * @return {?}
- */
- function () {
- if (this._active) {
- this._active = false;
- this._changeDetectorRef.markForCheck();
- }
- };
- /** Gets the label to be used when determining whether the option should be focused. */
- /**
- * Gets the label to be used when determining whether the option should be focused.
- * @return {?}
- */
- MatOption.prototype.getLabel = /**
- * Gets the label to be used when determining whether the option should be focused.
- * @return {?}
- */
- function () {
- return this.viewValue;
- };
- /** Ensures the option is selected when activated from the keyboard. */
- /**
- * Ensures the option is selected when activated from the keyboard.
- * @param {?} event
- * @return {?}
- */
- MatOption.prototype._handleKeydown = /**
- * Ensures the option is selected when activated from the keyboard.
- * @param {?} event
- * @return {?}
- */
- function (event) {
- if ((event.keyCode === keycodes.ENTER || event.keyCode === keycodes.SPACE) && !keycodes.hasModifierKey(event)) {
- this._selectViaInteraction();
- // Prevent the page from scrolling down and form submits.
- event.preventDefault();
- }
- };
- /**
- * `Selects the option while indicating the selection came from the user. Used to
- * determine if the select's view -> model callback should be invoked.`
- */
- /**
- * `Selects the option while indicating the selection came from the user. Used to
- * determine if the select's view -> model callback should be invoked.`
- * @return {?}
- */
- MatOption.prototype._selectViaInteraction = /**
- * `Selects the option while indicating the selection came from the user. Used to
- * determine if the select's view -> model callback should be invoked.`
- * @return {?}
- */
- function () {
- if (!this.disabled) {
- this._selected = this.multiple ? !this._selected : true;
- this._changeDetectorRef.markForCheck();
- this._emitSelectionChangeEvent(true);
- }
- };
- /**
- * Gets the `aria-selected` value for the option. We explicitly omit the `aria-selected`
- * attribute from single-selection, unselected options. Including the `aria-selected="false"`
- * attributes adds a significant amount of noise to screen-reader users without providing useful
- * information.
- */
- /**
- * Gets the `aria-selected` value for the option. We explicitly omit the `aria-selected`
- * attribute from single-selection, unselected options. Including the `aria-selected="false"`
- * attributes adds a significant amount of noise to screen-reader users without providing useful
- * information.
- * @return {?}
- */
- MatOption.prototype._getAriaSelected = /**
- * Gets the `aria-selected` value for the option. We explicitly omit the `aria-selected`
- * attribute from single-selection, unselected options. Including the `aria-selected="false"`
- * attributes adds a significant amount of noise to screen-reader users without providing useful
- * information.
- * @return {?}
- */
- function () {
- return this.selected || (this.multiple ? false : null);
- };
- /** Returns the correct tabindex for the option depending on disabled state. */
- /**
- * Returns the correct tabindex for the option depending on disabled state.
- * @return {?}
- */
- MatOption.prototype._getTabIndex = /**
- * Returns the correct tabindex for the option depending on disabled state.
- * @return {?}
- */
- function () {
- return this.disabled ? '-1' : '0';
- };
- /** Gets the host DOM element. */
- /**
- * Gets the host DOM element.
- * @return {?}
- */
- MatOption.prototype._getHostElement = /**
- * Gets the host DOM element.
- * @return {?}
- */
- function () {
- return this._element.nativeElement;
- };
- /**
- * @return {?}
- */
- MatOption.prototype.ngAfterViewChecked = /**
- * @return {?}
- */
- function () {
- // Since parent components could be using the option's label to display the selected values
- // (e.g. `mat-select`) and they don't have a way of knowing if the option's label has changed
- // we have to check for changes in the DOM ourselves and dispatch an event. These checks are
- // relatively cheap, however we still limit them only to selected options in order to avoid
- // hitting the DOM too often.
- if (this._selected) {
- /** @type {?} */
- var viewValue = this.viewValue;
- if (viewValue !== this._mostRecentViewValue) {
- this._mostRecentViewValue = viewValue;
- this._stateChanges.next();
- }
- }
- };
- /**
- * @return {?}
- */
- MatOption.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- this._stateChanges.complete();
- };
- /** Emits the selection change event. */
- /**
- * Emits the selection change event.
- * @private
- * @param {?=} isUserInput
- * @return {?}
- */
- MatOption.prototype._emitSelectionChangeEvent = /**
- * Emits the selection change event.
- * @private
- * @param {?=} isUserInput
- * @return {?}
- */
- function (isUserInput) {
- if (isUserInput === void 0) { isUserInput = false; }
- this.onSelectionChange.emit(new MatOptionSelectionChange(this, isUserInput));
- };
- MatOption.decorators = [
- { type: core.Component, args: [{selector: 'mat-option',
- exportAs: 'matOption',
- host: {
- 'role': 'option',
- '[attr.tabindex]': '_getTabIndex()',
- '[class.mat-selected]': 'selected',
- '[class.mat-option-multiple]': 'multiple',
- '[class.mat-active]': 'active',
- '[id]': 'id',
- '[attr.aria-selected]': '_getAriaSelected()',
- '[attr.aria-disabled]': 'disabled.toString()',
- '[class.mat-option-disabled]': 'disabled',
- '(click)': '_selectViaInteraction()',
- '(keydown)': '_handleKeydown($event)',
- 'class': 'mat-option',
- },
- styles: [".mat-option{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block;line-height:48px;height:48px;padding:0 16px;text-align:left;text-decoration:none;max-width:100%;position:relative;cursor:pointer;outline:0;display:flex;flex-direction:row;max-width:100%;box-sizing:border-box;align-items:center;-webkit-tap-highlight-color:transparent}.mat-option[disabled]{cursor:default}[dir=rtl] .mat-option{text-align:right}.mat-option .mat-icon{margin-right:16px;vertical-align:middle}.mat-option .mat-icon svg{vertical-align:top}[dir=rtl] .mat-option .mat-icon{margin-left:16px;margin-right:0}.mat-option[aria-disabled=true]{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.mat-optgroup .mat-option:not(.mat-option-multiple){padding-left:32px}[dir=rtl] .mat-optgroup .mat-option:not(.mat-option-multiple){padding-left:16px;padding-right:32px}@media (-ms-high-contrast:active){.mat-option{margin:0 1px}.mat-option.mat-active{border:solid 1px currentColor;margin:0}}.mat-option-text{display:inline-block;flex-grow:1;overflow:hidden;text-overflow:ellipsis}.mat-option .mat-option-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}@media (-ms-high-contrast:active){.mat-option .mat-option-ripple{opacity:.5}}.mat-option-pseudo-checkbox{margin-right:8px}[dir=rtl] .mat-option-pseudo-checkbox{margin-left:8px;margin-right:0}"],
- template: "<mat-pseudo-checkbox *ngIf=\"multiple\" class=\"mat-option-pseudo-checkbox\" [state]=\"selected ? 'checked' : ''\" [disabled]=\"disabled\"></mat-pseudo-checkbox><span class=\"mat-option-text\"><ng-content></ng-content></span><div class=\"mat-option-ripple\" mat-ripple [matRippleTrigger]=\"_getHostElement()\" [matRippleDisabled]=\"disabled || disableRipple\"></div>",
- encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- },] },
- ];
- /** @nocollapse */
- MatOption.ctorParameters = function () { return [
- { type: core.ElementRef },
- { type: core.ChangeDetectorRef },
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_OPTION_PARENT_COMPONENT,] }] },
- { type: MatOptgroup, decorators: [{ type: core.Optional }] }
- ]; };
- MatOption.propDecorators = {
- value: [{ type: core.Input }],
- id: [{ type: core.Input }],
- disabled: [{ type: core.Input }],
- onSelectionChange: [{ type: core.Output }]
- };
- return MatOption;
- }());
- /**
- * Counts the amount of option group labels that precede the specified option.
- * \@docs-private
- * @param {?} optionIndex Index of the option at which to start counting.
- * @param {?} options Flat list of all of the options.
- * @param {?} optionGroups Flat list of all of the option groups.
- * @return {?}
- */
- function _countGroupLabelsBeforeOption(optionIndex, options, optionGroups) {
- if (optionGroups.length) {
- /** @type {?} */
- var optionsArray = options.toArray();
- /** @type {?} */
- var groups = optionGroups.toArray();
- /** @type {?} */
- var groupCounter = 0;
- for (var i = 0; i < optionIndex + 1; i++) {
- if (optionsArray[i].group && optionsArray[i].group === groups[groupCounter]) {
- groupCounter++;
- }
- }
- return groupCounter;
- }
- return 0;
- }
- /**
- * Determines the position to which to scroll a panel in order for an option to be into view.
- * \@docs-private
- * @param {?} optionIndex Index of the option to be scrolled into the view.
- * @param {?} optionHeight Height of the options.
- * @param {?} currentScrollPosition Current scroll position of the panel.
- * @param {?} panelHeight Height of the panel.
- * @return {?}
- */
- function _getOptionScrollPosition(optionIndex, optionHeight, currentScrollPosition, panelHeight) {
- /** @type {?} */
- var optionOffset = optionIndex * optionHeight;
- if (optionOffset < currentScrollPosition) {
- return optionOffset;
- }
- if (optionOffset + optionHeight > currentScrollPosition + panelHeight) {
- return Math.max(0, optionOffset - panelHeight + optionHeight);
- }
- return currentScrollPosition;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var MatOptionModule = /** @class */ (function () {
- function MatOptionModule() {
- }
- MatOptionModule.decorators = [
- { type: core.NgModule, args: [{
- imports: [MatRippleModule, common.CommonModule, MatPseudoCheckboxModule],
- exports: [MatOption, MatOptgroup],
- declarations: [MatOption, MatOptgroup]
- },] },
- ];
- return MatOptionModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * InjectionToken that can be used to specify the global label options.
- * @type {?}
- */
- var MAT_LABEL_GLOBAL_OPTIONS = new core.InjectionToken('mat-label-global-options');
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * When constructing a Date, the month is zero-based. This can be confusing, since people are
- * used to seeing them one-based. So we create these aliases to make writing the tests easier.
- * \@docs-private
- * \@breaking-change 8.0.0 Remove this with V8 since it was only targeted for testing.
- * @type {?}
- */
- var JAN = 0;
- /** @type {?} */
- var FEB = 1;
- /** @type {?} */
- var MAR = 2;
- /** @type {?} */
- var APR = 3;
- /** @type {?} */
- var MAY = 4;
- /** @type {?} */
- var JUN = 5;
- /** @type {?} */
- var JUL = 6;
- /** @type {?} */
- var AUG = 7;
- /** @type {?} */
- var SEP = 8;
- /** @type {?} */
- var OCT = 9;
- /** @type {?} */
- var NOV = 10;
- /** @type {?} */
- var DEC = 11;
- exports.VERSION = VERSION$1;
- exports.AnimationCurves = AnimationCurves;
- exports.AnimationDurations = AnimationDurations;
- exports.MatCommonModule = MatCommonModule;
- exports.MATERIAL_SANITY_CHECKS = MATERIAL_SANITY_CHECKS;
- exports.mixinDisabled = mixinDisabled;
- exports.mixinColor = mixinColor;
- exports.mixinDisableRipple = mixinDisableRipple;
- exports.mixinTabIndex = mixinTabIndex;
- exports.mixinErrorState = mixinErrorState;
- exports.mixinInitialized = mixinInitialized;
- exports.NativeDateModule = NativeDateModule;
- exports.MatNativeDateModule = MatNativeDateModule;
- exports.MAT_DATE_LOCALE_FACTORY = MAT_DATE_LOCALE_FACTORY;
- exports.MAT_DATE_LOCALE = MAT_DATE_LOCALE;
- exports.MAT_DATE_LOCALE_PROVIDER = MAT_DATE_LOCALE_PROVIDER;
- exports.DateAdapter = DateAdapter;
- exports.MAT_DATE_FORMATS = MAT_DATE_FORMATS;
- exports.NativeDateAdapter = NativeDateAdapter;
- exports.MAT_NATIVE_DATE_FORMATS = MAT_NATIVE_DATE_FORMATS;
- exports.ShowOnDirtyErrorStateMatcher = ShowOnDirtyErrorStateMatcher;
- exports.ErrorStateMatcher = ErrorStateMatcher;
- exports.MAT_HAMMER_OPTIONS = MAT_HAMMER_OPTIONS;
- exports.GestureConfig = GestureConfig;
- exports.setLines = setLines;
- exports.MatLine = MatLine;
- exports.MatLineSetter = MatLineSetter;
- exports.MatLineModule = MatLineModule;
- exports.MatOptionModule = MatOptionModule;
- exports._countGroupLabelsBeforeOption = _countGroupLabelsBeforeOption;
- exports._getOptionScrollPosition = _getOptionScrollPosition;
- exports.MatOptionSelectionChange = MatOptionSelectionChange;
- exports.MAT_OPTION_PARENT_COMPONENT = MAT_OPTION_PARENT_COMPONENT;
- exports.MatOption = MatOption;
- exports.MatOptgroup = MatOptgroup;
- exports.MAT_LABEL_GLOBAL_OPTIONS = MAT_LABEL_GLOBAL_OPTIONS;
- exports.MatRippleModule = MatRippleModule;
- exports.MAT_RIPPLE_GLOBAL_OPTIONS = MAT_RIPPLE_GLOBAL_OPTIONS;
- exports.MatRipple = MatRipple;
- exports.RippleState = RippleState;
- exports.RippleRef = RippleRef;
- exports.defaultRippleAnimationConfig = defaultRippleAnimationConfig;
- exports.RippleRenderer = RippleRenderer;
- exports.MatPseudoCheckboxModule = MatPseudoCheckboxModule;
- exports.MatPseudoCheckbox = MatPseudoCheckbox;
- exports.JAN = JAN;
- exports.FEB = FEB;
- exports.MAR = MAR;
- exports.APR = APR;
- exports.MAY = MAY;
- exports.JUN = JUN;
- exports.JUL = JUL;
- exports.AUG = AUG;
- exports.SEP = SEP;
- exports.OCT = OCT;
- exports.NOV = NOV;
- exports.DEC = DEC;
- exports.ɵa1 = MATERIAL_SANITY_CHECKS_FACTORY;
- Object.defineProperty(exports, '__esModule', { value: true });
- })));
- //# sourceMappingURL=material-core.umd.js.map
|