material.umd.js 1.6 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827
  1. /**
  2. * @license
  3. * Copyright Google LLC All Rights Reserved.
  4. *
  5. * Use of this source code is governed by an MIT-style license that can be
  6. * found in the LICENSE file at https://angular.io/license
  7. */
  8. (function (global, factory) {
  9. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/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'), require('@angular/animations'), require('@angular/cdk/observers'), require('@angular/cdk/overlay'), require('@angular/cdk/portal'), require('@angular/cdk/scrolling'), require('@angular/forms'), require('@angular/cdk/layout'), require('@angular/cdk/collections'), require('@angular/cdk/text-field'), require('@angular/cdk/accordion'), require('@angular/common/http'), require('@angular/cdk/stepper'), require('@angular/cdk/table'), require('@angular/cdk/tree')) :
  10. typeof define === 'function' && define.amd ? define('@angular/material', ['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', '@angular/animations', '@angular/cdk/observers', '@angular/cdk/overlay', '@angular/cdk/portal', '@angular/cdk/scrolling', '@angular/forms', '@angular/cdk/layout', '@angular/cdk/collections', '@angular/cdk/text-field', '@angular/cdk/accordion', '@angular/common/http', '@angular/cdk/stepper', '@angular/cdk/table', '@angular/cdk/tree'], factory) :
  11. (factory((global.ng = global.ng || {}, global.ng.material = {}),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,global.ng.animations,global.ng.cdk.observers,global.ng.cdk.overlay,global.ng.cdk.portal,global.ng.cdk.scrolling,global.ng.forms,global.ng.cdk.layout,global.ng.cdk.collections,global.ng.cdk.textField,global.ng.cdk.accordion,global.ng.common.http,global.ng.cdk.stepper,global.ng.cdk.table,global.ng.cdk.tree));
  12. }(this, (function (exports,core,platformBrowser,bidi,cdk,coercion,rxjs,platform,operators,a11y,animations,keycodes,common,animations$1,observers,overlay,portal,scrolling,forms,layout,collections,textField,accordion,http,stepper,table,tree) { 'use strict';
  13. /*! *****************************************************************************
  14. Copyright (c) Microsoft Corporation. All rights reserved.
  15. Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  16. this file except in compliance with the License. You may obtain a copy of the
  17. License at http://www.apache.org/licenses/LICENSE-2.0
  18. THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  19. KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
  20. WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
  21. MERCHANTABLITY OR NON-INFRINGEMENT.
  22. See the Apache Version 2.0 License for specific language governing permissions
  23. and limitations under the License.
  24. ***************************************************************************** */
  25. /* global Reflect, Promise */
  26. var extendStatics = function(d, b) {
  27. extendStatics = Object.setPrototypeOf ||
  28. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  29. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  30. return extendStatics(d, b);
  31. };
  32. function __extends(d, b) {
  33. extendStatics(d, b);
  34. function __() { this.constructor = d; }
  35. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  36. }
  37. var __assign = function() {
  38. __assign = Object.assign || function __assign(t) {
  39. for (var s, i = 1, n = arguments.length; i < n; i++) {
  40. s = arguments[i];
  41. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  42. }
  43. return t;
  44. };
  45. return __assign.apply(this, arguments);
  46. };
  47. /**
  48. * @fileoverview added by tsickle
  49. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  50. */
  51. /**
  52. * Current version of Angular Material.
  53. * @type {?}
  54. */
  55. var VERSION$1 = new core.Version('8.1.4');
  56. /**
  57. * @fileoverview added by tsickle
  58. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  59. */
  60. /**
  61. * \@docs-private
  62. */
  63. var AnimationCurves = /** @class */ (function () {
  64. function AnimationCurves() {
  65. }
  66. AnimationCurves.STANDARD_CURVE = 'cubic-bezier(0.4,0.0,0.2,1)';
  67. AnimationCurves.DECELERATION_CURVE = 'cubic-bezier(0.0,0.0,0.2,1)';
  68. AnimationCurves.ACCELERATION_CURVE = 'cubic-bezier(0.4,0.0,1,1)';
  69. AnimationCurves.SHARP_CURVE = 'cubic-bezier(0.4,0.0,0.6,1)';
  70. return AnimationCurves;
  71. }());
  72. /**
  73. * \@docs-private
  74. */
  75. var AnimationDurations = /** @class */ (function () {
  76. function AnimationDurations() {
  77. }
  78. AnimationDurations.COMPLEX = '375ms';
  79. AnimationDurations.ENTERING = '225ms';
  80. AnimationDurations.EXITING = '195ms';
  81. return AnimationDurations;
  82. }());
  83. /**
  84. * @fileoverview added by tsickle
  85. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  86. */
  87. // Private version constant to circumvent test/build issues,
  88. // i.e. avoid core to depend on the @angular/material primary entry-point
  89. // Can be removed once the Material primary entry-point no longer
  90. // re-exports all secondary entry-points
  91. /** @type {?} */
  92. var VERSION$2 = new core.Version('8.1.4');
  93. /**
  94. * Injection token that configures whether the Material sanity checks are enabled.
  95. * @type {?}
  96. */
  97. var MATERIAL_SANITY_CHECKS = new core.InjectionToken('mat-sanity-checks', {
  98. providedIn: 'root',
  99. factory: MATERIAL_SANITY_CHECKS_FACTORY,
  100. });
  101. /**
  102. * \@docs-private
  103. * @return {?}
  104. */
  105. function MATERIAL_SANITY_CHECKS_FACTORY() {
  106. return true;
  107. }
  108. /**
  109. * Module that captures anything that should be loaded and/or run for *all* Angular Material
  110. * components. This includes Bidi, etc.
  111. *
  112. * This module should be imported to each top-level component module (e.g., MatTabsModule).
  113. */
  114. var MatCommonModule = /** @class */ (function () {
  115. function MatCommonModule(_sanityChecksEnabled, _hammerLoader) {
  116. this._sanityChecksEnabled = _sanityChecksEnabled;
  117. this._hammerLoader = _hammerLoader;
  118. /**
  119. * Whether we've done the global sanity checks (e.g. a theme is loaded, there is a doctype).
  120. */
  121. this._hasDoneGlobalChecks = false;
  122. /**
  123. * Whether we've already checked for HammerJs availability.
  124. */
  125. this._hasCheckedHammer = false;
  126. /**
  127. * Reference to the global `document` object.
  128. */
  129. this._document = typeof document === 'object' && document ? document : null;
  130. /**
  131. * Reference to the global 'window' object.
  132. */
  133. this._window = typeof window === 'object' && window ? window : null;
  134. if (this._areChecksEnabled() && !this._hasDoneGlobalChecks) {
  135. this._checkDoctypeIsDefined();
  136. this._checkThemeIsPresent();
  137. this._checkCdkVersionMatch();
  138. this._hasDoneGlobalChecks = true;
  139. }
  140. }
  141. /** Whether any sanity checks are enabled */
  142. /**
  143. * Whether any sanity checks are enabled
  144. * @private
  145. * @return {?}
  146. */
  147. MatCommonModule.prototype._areChecksEnabled = /**
  148. * Whether any sanity checks are enabled
  149. * @private
  150. * @return {?}
  151. */
  152. function () {
  153. return this._sanityChecksEnabled && core.isDevMode() && !this._isTestEnv();
  154. };
  155. /** Whether the code is running in tests. */
  156. /**
  157. * Whether the code is running in tests.
  158. * @private
  159. * @return {?}
  160. */
  161. MatCommonModule.prototype._isTestEnv = /**
  162. * Whether the code is running in tests.
  163. * @private
  164. * @return {?}
  165. */
  166. function () {
  167. /** @type {?} */
  168. var window = (/** @type {?} */ (this._window));
  169. return window && (window.__karma__ || window.jasmine);
  170. };
  171. /**
  172. * @private
  173. * @return {?}
  174. */
  175. MatCommonModule.prototype._checkDoctypeIsDefined = /**
  176. * @private
  177. * @return {?}
  178. */
  179. function () {
  180. if (this._document && !this._document.doctype) {
  181. console.warn('Current document does not have a doctype. This may cause ' +
  182. 'some Angular Material components not to behave as expected.');
  183. }
  184. };
  185. /**
  186. * @private
  187. * @return {?}
  188. */
  189. MatCommonModule.prototype._checkThemeIsPresent = /**
  190. * @private
  191. * @return {?}
  192. */
  193. function () {
  194. // We need to assert that the `body` is defined, because these checks run very early
  195. // and the `body` won't be defined if the consumer put their scripts in the `head`.
  196. if (!this._document || !this._document.body || typeof getComputedStyle !== 'function') {
  197. return;
  198. }
  199. /** @type {?} */
  200. var testElement = this._document.createElement('div');
  201. testElement.classList.add('mat-theme-loaded-marker');
  202. this._document.body.appendChild(testElement);
  203. /** @type {?} */
  204. var computedStyle = getComputedStyle(testElement);
  205. // In some situations the computed style of the test element can be null. For example in
  206. // Firefox, the computed style is null if an application is running inside of a hidden iframe.
  207. // See: https://bugzilla.mozilla.org/show_bug.cgi?id=548397
  208. if (computedStyle && computedStyle.display !== 'none') {
  209. console.warn('Could not find Angular Material core theme. Most Material ' +
  210. 'components may not work as expected. For more info refer ' +
  211. 'to the theming guide: https://material.angular.io/guide/theming');
  212. }
  213. this._document.body.removeChild(testElement);
  214. };
  215. /** Checks whether the material version matches the cdk version */
  216. /**
  217. * Checks whether the material version matches the cdk version
  218. * @private
  219. * @return {?}
  220. */
  221. MatCommonModule.prototype._checkCdkVersionMatch = /**
  222. * Checks whether the material version matches the cdk version
  223. * @private
  224. * @return {?}
  225. */
  226. function () {
  227. if (VERSION$2.full !== cdk.VERSION.full) {
  228. console.warn('The Angular Material version (' + VERSION$2.full + ') does not match ' +
  229. 'the Angular CDK version (' + cdk.VERSION.full + ').\n' +
  230. 'Please ensure the versions of these two packages exactly match.');
  231. }
  232. };
  233. /** Checks whether HammerJS is available. */
  234. /**
  235. * Checks whether HammerJS is available.
  236. * @return {?}
  237. */
  238. MatCommonModule.prototype._checkHammerIsAvailable = /**
  239. * Checks whether HammerJS is available.
  240. * @return {?}
  241. */
  242. function () {
  243. if (this._hasCheckedHammer || !this._window) {
  244. return;
  245. }
  246. if (this._areChecksEnabled() && !((/** @type {?} */ (this._window)))['Hammer'] && !this._hammerLoader) {
  247. console.warn('Could not find HammerJS. Certain Angular Material components may not work correctly.');
  248. }
  249. this._hasCheckedHammer = true;
  250. };
  251. MatCommonModule.decorators = [
  252. { type: core.NgModule, args: [{
  253. imports: [bidi.BidiModule],
  254. exports: [bidi.BidiModule],
  255. },] },
  256. ];
  257. /** @nocollapse */
  258. MatCommonModule.ctorParameters = function () { return [
  259. { type: Boolean, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MATERIAL_SANITY_CHECKS,] }] },
  260. { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [platformBrowser.HAMMER_LOADER,] }] }
  261. ]; };
  262. return MatCommonModule;
  263. }());
  264. /**
  265. * @fileoverview added by tsickle
  266. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  267. */
  268. /**
  269. * Mixin to augment a directive with a `disabled` property.
  270. * @template T
  271. * @param {?} base
  272. * @return {?}
  273. */
  274. function mixinDisabled(base) {
  275. return /** @class */ (function (_super) {
  276. __extends(class_1, _super);
  277. function class_1() {
  278. var args = [];
  279. for (var _i = 0; _i < arguments.length; _i++) {
  280. args[_i] = arguments[_i];
  281. }
  282. var _this = _super.apply(this, args) || this;
  283. _this._disabled = false;
  284. return _this;
  285. }
  286. Object.defineProperty(class_1.prototype, "disabled", {
  287. get: /**
  288. * @return {?}
  289. */
  290. function () { return this._disabled; },
  291. set: /**
  292. * @param {?} value
  293. * @return {?}
  294. */
  295. function (value) { this._disabled = coercion.coerceBooleanProperty(value); },
  296. enumerable: true,
  297. configurable: true
  298. });
  299. return class_1;
  300. }(base));
  301. }
  302. /**
  303. * @fileoverview added by tsickle
  304. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  305. */
  306. /**
  307. * Mixin to augment a directive with a `color` property.
  308. * @template T
  309. * @param {?} base
  310. * @param {?=} defaultColor
  311. * @return {?}
  312. */
  313. function mixinColor(base, defaultColor) {
  314. return /** @class */ (function (_super) {
  315. __extends(class_1, _super);
  316. function class_1() {
  317. var args = [];
  318. for (var _i = 0; _i < arguments.length; _i++) {
  319. args[_i] = arguments[_i];
  320. }
  321. var _this = _super.apply(this, args) || this;
  322. // Set the default color that can be specified from the mixin.
  323. _this.color = defaultColor;
  324. return _this;
  325. }
  326. Object.defineProperty(class_1.prototype, "color", {
  327. get: /**
  328. * @return {?}
  329. */
  330. function () { return this._color; },
  331. set: /**
  332. * @param {?} value
  333. * @return {?}
  334. */
  335. function (value) {
  336. /** @type {?} */
  337. var colorPalette = value || defaultColor;
  338. if (colorPalette !== this._color) {
  339. if (this._color) {
  340. this._elementRef.nativeElement.classList.remove("mat-" + this._color);
  341. }
  342. if (colorPalette) {
  343. this._elementRef.nativeElement.classList.add("mat-" + colorPalette);
  344. }
  345. this._color = colorPalette;
  346. }
  347. },
  348. enumerable: true,
  349. configurable: true
  350. });
  351. return class_1;
  352. }(base));
  353. }
  354. /**
  355. * @fileoverview added by tsickle
  356. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  357. */
  358. /**
  359. * Mixin to augment a directive with a `disableRipple` property.
  360. * @template T
  361. * @param {?} base
  362. * @return {?}
  363. */
  364. function mixinDisableRipple(base) {
  365. return /** @class */ (function (_super) {
  366. __extends(class_1, _super);
  367. function class_1() {
  368. var args = [];
  369. for (var _i = 0; _i < arguments.length; _i++) {
  370. args[_i] = arguments[_i];
  371. }
  372. var _this = _super.apply(this, args) || this;
  373. _this._disableRipple = false;
  374. return _this;
  375. }
  376. Object.defineProperty(class_1.prototype, "disableRipple", {
  377. /** Whether the ripple effect is disabled or not. */
  378. get: /**
  379. * Whether the ripple effect is disabled or not.
  380. * @return {?}
  381. */
  382. function () { return this._disableRipple; },
  383. set: /**
  384. * @param {?} value
  385. * @return {?}
  386. */
  387. function (value) { this._disableRipple = coercion.coerceBooleanProperty(value); },
  388. enumerable: true,
  389. configurable: true
  390. });
  391. return class_1;
  392. }(base));
  393. }
  394. /**
  395. * @fileoverview added by tsickle
  396. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  397. */
  398. /**
  399. * Mixin to augment a directive with a `tabIndex` property.
  400. * @template T
  401. * @param {?} base
  402. * @param {?=} defaultTabIndex
  403. * @return {?}
  404. */
  405. function mixinTabIndex(base, defaultTabIndex) {
  406. if (defaultTabIndex === void 0) { defaultTabIndex = 0; }
  407. return /** @class */ (function (_super) {
  408. __extends(class_1, _super);
  409. function class_1() {
  410. var args = [];
  411. for (var _i = 0; _i < arguments.length; _i++) {
  412. args[_i] = arguments[_i];
  413. }
  414. var _this = _super.apply(this, args) || this;
  415. _this._tabIndex = defaultTabIndex;
  416. return _this;
  417. }
  418. Object.defineProperty(class_1.prototype, "tabIndex", {
  419. get: /**
  420. * @return {?}
  421. */
  422. function () { return this.disabled ? -1 : this._tabIndex; },
  423. set: /**
  424. * @param {?} value
  425. * @return {?}
  426. */
  427. function (value) {
  428. // If the specified tabIndex value is null or undefined, fall back to the default value.
  429. this._tabIndex = value != null ? value : defaultTabIndex;
  430. },
  431. enumerable: true,
  432. configurable: true
  433. });
  434. return class_1;
  435. }(base));
  436. }
  437. /**
  438. * @fileoverview added by tsickle
  439. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  440. */
  441. /**
  442. * Mixin to augment a directive with updateErrorState method.
  443. * For component with `errorState` and need to update `errorState`.
  444. * @template T
  445. * @param {?} base
  446. * @return {?}
  447. */
  448. function mixinErrorState(base) {
  449. return /** @class */ (function (_super) {
  450. __extends(class_1, _super);
  451. function class_1() {
  452. var args = [];
  453. for (var _i = 0; _i < arguments.length; _i++) {
  454. args[_i] = arguments[_i];
  455. }
  456. var _this = _super.apply(this, args) || this;
  457. /**
  458. * Whether the component is in an error state.
  459. */
  460. _this.errorState = false;
  461. /**
  462. * Stream that emits whenever the state of the input changes such that the wrapping
  463. * `MatFormField` needs to run change detection.
  464. */
  465. _this.stateChanges = new rxjs.Subject();
  466. return _this;
  467. }
  468. /**
  469. * @return {?}
  470. */
  471. class_1.prototype.updateErrorState = /**
  472. * @return {?}
  473. */
  474. function () {
  475. /** @type {?} */
  476. var oldState = this.errorState;
  477. /** @type {?} */
  478. var parent = this._parentFormGroup || this._parentForm;
  479. /** @type {?} */
  480. var matcher = this.errorStateMatcher || this._defaultErrorStateMatcher;
  481. /** @type {?} */
  482. var control = this.ngControl ? (/** @type {?} */ (this.ngControl.control)) : null;
  483. /** @type {?} */
  484. var newState = matcher.isErrorState(control, parent);
  485. if (newState !== oldState) {
  486. this.errorState = newState;
  487. this.stateChanges.next();
  488. }
  489. };
  490. return class_1;
  491. }(base));
  492. }
  493. /**
  494. * @fileoverview added by tsickle
  495. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  496. */
  497. /**
  498. * Mixin to augment a directive with an initialized property that will emits when ngOnInit ends.
  499. * @template T
  500. * @param {?} base
  501. * @return {?}
  502. */
  503. function mixinInitialized(base) {
  504. return /** @class */ (function (_super) {
  505. __extends(class_1, _super);
  506. function class_1() {
  507. var args = [];
  508. for (var _i = 0; _i < arguments.length; _i++) {
  509. args[_i] = arguments[_i];
  510. }
  511. var _this = _super.apply(this, args) || this;
  512. /**
  513. * Whether this directive has been marked as initialized.
  514. */
  515. _this._isInitialized = false;
  516. /**
  517. * List of subscribers that subscribed before the directive was initialized. Should be notified
  518. * during _markInitialized. Set to null after pending subscribers are notified, and should
  519. * not expect to be populated after.
  520. */
  521. _this._pendingSubscribers = [];
  522. /**
  523. * Observable stream that emits when the directive initializes. If already initialized, the
  524. * subscriber is stored to be notified once _markInitialized is called.
  525. */
  526. _this.initialized = new rxjs.Observable((/**
  527. * @param {?} subscriber
  528. * @return {?}
  529. */
  530. function (subscriber) {
  531. // If initialized, immediately notify the subscriber. Otherwise store the subscriber to notify
  532. // when _markInitialized is called.
  533. if (_this._isInitialized) {
  534. _this._notifySubscriber(subscriber);
  535. }
  536. else {
  537. (/** @type {?} */ (_this._pendingSubscribers)).push(subscriber);
  538. }
  539. }));
  540. return _this;
  541. }
  542. /**
  543. * Marks the state as initialized and notifies pending subscribers. Should be called at the end
  544. * of ngOnInit.
  545. * @docs-private
  546. */
  547. /**
  548. * Marks the state as initialized and notifies pending subscribers. Should be called at the end
  549. * of ngOnInit.
  550. * \@docs-private
  551. * @return {?}
  552. */
  553. class_1.prototype._markInitialized = /**
  554. * Marks the state as initialized and notifies pending subscribers. Should be called at the end
  555. * of ngOnInit.
  556. * \@docs-private
  557. * @return {?}
  558. */
  559. function () {
  560. if (this._isInitialized) {
  561. throw Error('This directive has already been marked as initialized and ' +
  562. 'should not be called twice.');
  563. }
  564. this._isInitialized = true;
  565. (/** @type {?} */ (this._pendingSubscribers)).forEach(this._notifySubscriber);
  566. this._pendingSubscribers = null;
  567. };
  568. /** Emits and completes the subscriber stream (should only emit once). */
  569. /**
  570. * Emits and completes the subscriber stream (should only emit once).
  571. * @param {?} subscriber
  572. * @return {?}
  573. */
  574. class_1.prototype._notifySubscriber = /**
  575. * Emits and completes the subscriber stream (should only emit once).
  576. * @param {?} subscriber
  577. * @return {?}
  578. */
  579. function (subscriber) {
  580. subscriber.next();
  581. subscriber.complete();
  582. };
  583. return class_1;
  584. }(base));
  585. }
  586. /**
  587. * @fileoverview added by tsickle
  588. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  589. */
  590. /**
  591. * @fileoverview added by tsickle
  592. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  593. */
  594. /**
  595. * InjectionToken for datepicker that can be used to override default locale code.
  596. * @type {?}
  597. */
  598. var MAT_DATE_LOCALE = new core.InjectionToken('MAT_DATE_LOCALE', {
  599. providedIn: 'root',
  600. factory: MAT_DATE_LOCALE_FACTORY,
  601. });
  602. /**
  603. * \@docs-private
  604. * @return {?}
  605. */
  606. function MAT_DATE_LOCALE_FACTORY() {
  607. return core.inject(core.LOCALE_ID);
  608. }
  609. /**
  610. * No longer needed since MAT_DATE_LOCALE has been changed to a scoped injectable.
  611. * If you are importing and providing this in your code you can simply remove it.
  612. * @deprecated
  613. * \@breaking-change 8.0.0
  614. * @type {?}
  615. */
  616. var MAT_DATE_LOCALE_PROVIDER = { provide: MAT_DATE_LOCALE, useExisting: core.LOCALE_ID };
  617. /**
  618. * Adapts type `D` to be usable as a date by cdk-based components that work with dates.
  619. * @abstract
  620. * @template D
  621. */
  622. var /**
  623. * Adapts type `D` to be usable as a date by cdk-based components that work with dates.
  624. * @abstract
  625. * @template D
  626. */
  627. DateAdapter = /** @class */ (function () {
  628. function DateAdapter() {
  629. this._localeChanges = new rxjs.Subject();
  630. }
  631. Object.defineProperty(DateAdapter.prototype, "localeChanges", {
  632. /** A stream that emits when the locale changes. */
  633. get: /**
  634. * A stream that emits when the locale changes.
  635. * @return {?}
  636. */
  637. function () { return this._localeChanges; },
  638. enumerable: true,
  639. configurable: true
  640. });
  641. /**
  642. * Attempts to deserialize a value to a valid date object. This is different from parsing in that
  643. * deserialize should only accept non-ambiguous, locale-independent formats (e.g. a ISO 8601
  644. * string). The default implementation does not allow any deserialization, it simply checks that
  645. * the given value is already a valid date object or null. The `<mat-datepicker>` will call this
  646. * method on all of it's `@Input()` properties that accept dates. It is therefore possible to
  647. * support passing values from your backend directly to these properties by overriding this method
  648. * to also deserialize the format used by your backend.
  649. * @param value The value to be deserialized into a date object.
  650. * @returns The deserialized date object, either a valid date, null if the value can be
  651. * deserialized into a null date (e.g. the empty string), or an invalid date.
  652. */
  653. /**
  654. * Attempts to deserialize a value to a valid date object. This is different from parsing in that
  655. * deserialize should only accept non-ambiguous, locale-independent formats (e.g. a ISO 8601
  656. * string). The default implementation does not allow any deserialization, it simply checks that
  657. * the given value is already a valid date object or null. The `<mat-datepicker>` will call this
  658. * method on all of it's `\@Input()` properties that accept dates. It is therefore possible to
  659. * support passing values from your backend directly to these properties by overriding this method
  660. * to also deserialize the format used by your backend.
  661. * @param {?} value The value to be deserialized into a date object.
  662. * @return {?} The deserialized date object, either a valid date, null if the value can be
  663. * deserialized into a null date (e.g. the empty string), or an invalid date.
  664. */
  665. DateAdapter.prototype.deserialize = /**
  666. * Attempts to deserialize a value to a valid date object. This is different from parsing in that
  667. * deserialize should only accept non-ambiguous, locale-independent formats (e.g. a ISO 8601
  668. * string). The default implementation does not allow any deserialization, it simply checks that
  669. * the given value is already a valid date object or null. The `<mat-datepicker>` will call this
  670. * method on all of it's `\@Input()` properties that accept dates. It is therefore possible to
  671. * support passing values from your backend directly to these properties by overriding this method
  672. * to also deserialize the format used by your backend.
  673. * @param {?} value The value to be deserialized into a date object.
  674. * @return {?} The deserialized date object, either a valid date, null if the value can be
  675. * deserialized into a null date (e.g. the empty string), or an invalid date.
  676. */
  677. function (value) {
  678. if (value == null || this.isDateInstance(value) && this.isValid(value)) {
  679. return value;
  680. }
  681. return this.invalid();
  682. };
  683. /**
  684. * Sets the locale used for all dates.
  685. * @param locale The new locale.
  686. */
  687. /**
  688. * Sets the locale used for all dates.
  689. * @param {?} locale The new locale.
  690. * @return {?}
  691. */
  692. DateAdapter.prototype.setLocale = /**
  693. * Sets the locale used for all dates.
  694. * @param {?} locale The new locale.
  695. * @return {?}
  696. */
  697. function (locale) {
  698. this.locale = locale;
  699. this._localeChanges.next();
  700. };
  701. /**
  702. * Compares two dates.
  703. * @param first The first date to compare.
  704. * @param second The second date to compare.
  705. * @returns 0 if the dates are equal, a number less than 0 if the first date is earlier,
  706. * a number greater than 0 if the first date is later.
  707. */
  708. /**
  709. * Compares two dates.
  710. * @param {?} first The first date to compare.
  711. * @param {?} second The second date to compare.
  712. * @return {?} 0 if the dates are equal, a number less than 0 if the first date is earlier,
  713. * a number greater than 0 if the first date is later.
  714. */
  715. DateAdapter.prototype.compareDate = /**
  716. * Compares two dates.
  717. * @param {?} first The first date to compare.
  718. * @param {?} second The second date to compare.
  719. * @return {?} 0 if the dates are equal, a number less than 0 if the first date is earlier,
  720. * a number greater than 0 if the first date is later.
  721. */
  722. function (first, second) {
  723. return this.getYear(first) - this.getYear(second) ||
  724. this.getMonth(first) - this.getMonth(second) ||
  725. this.getDate(first) - this.getDate(second);
  726. };
  727. /**
  728. * Checks if two dates are equal.
  729. * @param first The first date to check.
  730. * @param second The second date to check.
  731. * @returns Whether the two dates are equal.
  732. * Null dates are considered equal to other null dates.
  733. */
  734. /**
  735. * Checks if two dates are equal.
  736. * @param {?} first The first date to check.
  737. * @param {?} second The second date to check.
  738. * @return {?} Whether the two dates are equal.
  739. * Null dates are considered equal to other null dates.
  740. */
  741. DateAdapter.prototype.sameDate = /**
  742. * Checks if two dates are equal.
  743. * @param {?} first The first date to check.
  744. * @param {?} second The second date to check.
  745. * @return {?} Whether the two dates are equal.
  746. * Null dates are considered equal to other null dates.
  747. */
  748. function (first, second) {
  749. if (first && second) {
  750. /** @type {?} */
  751. var firstValid = this.isValid(first);
  752. /** @type {?} */
  753. var secondValid = this.isValid(second);
  754. if (firstValid && secondValid) {
  755. return !this.compareDate(first, second);
  756. }
  757. return firstValid == secondValid;
  758. }
  759. return first == second;
  760. };
  761. /**
  762. * Clamp the given date between min and max dates.
  763. * @param date The date to clamp.
  764. * @param min The minimum value to allow. If null or omitted no min is enforced.
  765. * @param max The maximum value to allow. If null or omitted no max is enforced.
  766. * @returns `min` if `date` is less than `min`, `max` if date is greater than `max`,
  767. * otherwise `date`.
  768. */
  769. /**
  770. * Clamp the given date between min and max dates.
  771. * @param {?} date The date to clamp.
  772. * @param {?=} min The minimum value to allow. If null or omitted no min is enforced.
  773. * @param {?=} max The maximum value to allow. If null or omitted no max is enforced.
  774. * @return {?} `min` if `date` is less than `min`, `max` if date is greater than `max`,
  775. * otherwise `date`.
  776. */
  777. DateAdapter.prototype.clampDate = /**
  778. * Clamp the given date between min and max dates.
  779. * @param {?} date The date to clamp.
  780. * @param {?=} min The minimum value to allow. If null or omitted no min is enforced.
  781. * @param {?=} max The maximum value to allow. If null or omitted no max is enforced.
  782. * @return {?} `min` if `date` is less than `min`, `max` if date is greater than `max`,
  783. * otherwise `date`.
  784. */
  785. function (date, min, max) {
  786. if (min && this.compareDate(date, min) < 0) {
  787. return min;
  788. }
  789. if (max && this.compareDate(date, max) > 0) {
  790. return max;
  791. }
  792. return date;
  793. };
  794. return DateAdapter;
  795. }());
  796. /**
  797. * @fileoverview added by tsickle
  798. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  799. */
  800. /** @type {?} */
  801. var MAT_DATE_FORMATS = new core.InjectionToken('mat-date-formats');
  802. /**
  803. * @fileoverview added by tsickle
  804. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  805. */
  806. // TODO(mmalerba): Remove when we no longer support safari 9.
  807. /**
  808. * Whether the browser supports the Intl API.
  809. * @type {?}
  810. */
  811. var SUPPORTS_INTL_API;
  812. // We need a try/catch around the reference to `Intl`, because accessing it in some cases can
  813. // cause IE to throw. These cases are tied to particular versions of Windows and can happen if
  814. // the consumer is providing a polyfilled `Map`. See:
  815. // https://github.com/Microsoft/ChakraCore/issues/3189
  816. // https://github.com/angular/components/issues/15687
  817. try {
  818. SUPPORTS_INTL_API = typeof Intl != 'undefined';
  819. }
  820. catch (_a) {
  821. SUPPORTS_INTL_API = false;
  822. }
  823. /**
  824. * The default month names to use if Intl API is not available.
  825. * @type {?}
  826. */
  827. var DEFAULT_MONTH_NAMES = {
  828. 'long': [
  829. 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September',
  830. 'October', 'November', 'December'
  831. ],
  832. 'short': ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
  833. 'narrow': ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D']
  834. };
  835. var ɵ0 = /**
  836. * @param {?} i
  837. * @return {?}
  838. */
  839. function (i) { return String(i + 1); };
  840. /**
  841. * The default date names to use if Intl API is not available.
  842. * @type {?}
  843. */
  844. var DEFAULT_DATE_NAMES = range(31, (ɵ0));
  845. /**
  846. * The default day of the week names to use if Intl API is not available.
  847. * @type {?}
  848. */
  849. var DEFAULT_DAY_OF_WEEK_NAMES = {
  850. 'long': ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
  851. 'short': ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
  852. 'narrow': ['S', 'M', 'T', 'W', 'T', 'F', 'S']
  853. };
  854. /**
  855. * Matches strings that have the form of a valid RFC 3339 string
  856. * (https://tools.ietf.org/html/rfc3339). Note that the string may not actually be a valid date
  857. * because the regex will match strings an with out of bounds month, date, etc.
  858. * @type {?}
  859. */
  860. var ISO_8601_REGEX = /^\d{4}-\d{2}-\d{2}(?:T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|(?:(?:\+|-)\d{2}:\d{2}))?)?$/;
  861. /**
  862. * Creates an array and fills it with values.
  863. * @template T
  864. * @param {?} length
  865. * @param {?} valueFunction
  866. * @return {?}
  867. */
  868. function range(length, valueFunction) {
  869. /** @type {?} */
  870. var valuesArray = Array(length);
  871. for (var i = 0; i < length; i++) {
  872. valuesArray[i] = valueFunction(i);
  873. }
  874. return valuesArray;
  875. }
  876. /**
  877. * Adapts the native JS Date for use with cdk-based components that work with dates.
  878. */
  879. var NativeDateAdapter = /** @class */ (function (_super) {
  880. __extends(NativeDateAdapter, _super);
  881. function NativeDateAdapter(matDateLocale, platform$$1) {
  882. var _this = _super.call(this) || this;
  883. /**
  884. * Whether to use `timeZone: 'utc'` with `Intl.DateTimeFormat` when formatting dates.
  885. * Without this `Intl.DateTimeFormat` sometimes chooses the wrong timeZone, which can throw off
  886. * the result. (e.g. in the en-US locale `new Date(1800, 7, 14).toLocaleDateString()`
  887. * will produce `'8/13/1800'`.
  888. *
  889. * TODO(mmalerba): drop this variable. It's not being used in the code right now. We're now
  890. * getting the string representation of a Date object from it's utc representation. We're keeping
  891. * it here for sometime, just for precaution, in case we decide to revert some of these changes
  892. * though.
  893. */
  894. _this.useUtcForDisplay = true;
  895. _super.prototype.setLocale.call(_this, matDateLocale);
  896. // IE does its own time zone correction, so we disable this on IE.
  897. _this.useUtcForDisplay = !platform$$1.TRIDENT;
  898. _this._clampDate = platform$$1.TRIDENT || platform$$1.EDGE;
  899. return _this;
  900. }
  901. /**
  902. * @param {?} date
  903. * @return {?}
  904. */
  905. NativeDateAdapter.prototype.getYear = /**
  906. * @param {?} date
  907. * @return {?}
  908. */
  909. function (date) {
  910. return date.getFullYear();
  911. };
  912. /**
  913. * @param {?} date
  914. * @return {?}
  915. */
  916. NativeDateAdapter.prototype.getMonth = /**
  917. * @param {?} date
  918. * @return {?}
  919. */
  920. function (date) {
  921. return date.getMonth();
  922. };
  923. /**
  924. * @param {?} date
  925. * @return {?}
  926. */
  927. NativeDateAdapter.prototype.getDate = /**
  928. * @param {?} date
  929. * @return {?}
  930. */
  931. function (date) {
  932. return date.getDate();
  933. };
  934. /**
  935. * @param {?} date
  936. * @return {?}
  937. */
  938. NativeDateAdapter.prototype.getDayOfWeek = /**
  939. * @param {?} date
  940. * @return {?}
  941. */
  942. function (date) {
  943. return date.getDay();
  944. };
  945. /**
  946. * @param {?} style
  947. * @return {?}
  948. */
  949. NativeDateAdapter.prototype.getMonthNames = /**
  950. * @param {?} style
  951. * @return {?}
  952. */
  953. function (style) {
  954. var _this = this;
  955. if (SUPPORTS_INTL_API) {
  956. /** @type {?} */
  957. var dtf_1 = new Intl.DateTimeFormat(this.locale, { month: style, timeZone: 'utc' });
  958. return range(12, (/**
  959. * @param {?} i
  960. * @return {?}
  961. */
  962. function (i) {
  963. return _this._stripDirectionalityCharacters(_this._format(dtf_1, new Date(2017, i, 1)));
  964. }));
  965. }
  966. return DEFAULT_MONTH_NAMES[style];
  967. };
  968. /**
  969. * @return {?}
  970. */
  971. NativeDateAdapter.prototype.getDateNames = /**
  972. * @return {?}
  973. */
  974. function () {
  975. var _this = this;
  976. if (SUPPORTS_INTL_API) {
  977. /** @type {?} */
  978. var dtf_2 = new Intl.DateTimeFormat(this.locale, { day: 'numeric', timeZone: 'utc' });
  979. return range(31, (/**
  980. * @param {?} i
  981. * @return {?}
  982. */
  983. function (i) { return _this._stripDirectionalityCharacters(_this._format(dtf_2, new Date(2017, 0, i + 1))); }));
  984. }
  985. return DEFAULT_DATE_NAMES;
  986. };
  987. /**
  988. * @param {?} style
  989. * @return {?}
  990. */
  991. NativeDateAdapter.prototype.getDayOfWeekNames = /**
  992. * @param {?} style
  993. * @return {?}
  994. */
  995. function (style) {
  996. var _this = this;
  997. if (SUPPORTS_INTL_API) {
  998. /** @type {?} */
  999. var dtf_3 = new Intl.DateTimeFormat(this.locale, { weekday: style, timeZone: 'utc' });
  1000. return range(7, (/**
  1001. * @param {?} i
  1002. * @return {?}
  1003. */
  1004. function (i) { return _this._stripDirectionalityCharacters(_this._format(dtf_3, new Date(2017, 0, i + 1))); }));
  1005. }
  1006. return DEFAULT_DAY_OF_WEEK_NAMES[style];
  1007. };
  1008. /**
  1009. * @param {?} date
  1010. * @return {?}
  1011. */
  1012. NativeDateAdapter.prototype.getYearName = /**
  1013. * @param {?} date
  1014. * @return {?}
  1015. */
  1016. function (date) {
  1017. if (SUPPORTS_INTL_API) {
  1018. /** @type {?} */
  1019. var dtf = new Intl.DateTimeFormat(this.locale, { year: 'numeric', timeZone: 'utc' });
  1020. return this._stripDirectionalityCharacters(this._format(dtf, date));
  1021. }
  1022. return String(this.getYear(date));
  1023. };
  1024. /**
  1025. * @return {?}
  1026. */
  1027. NativeDateAdapter.prototype.getFirstDayOfWeek = /**
  1028. * @return {?}
  1029. */
  1030. function () {
  1031. // We can't tell using native JS Date what the first day of the week is, we default to Sunday.
  1032. return 0;
  1033. };
  1034. /**
  1035. * @param {?} date
  1036. * @return {?}
  1037. */
  1038. NativeDateAdapter.prototype.getNumDaysInMonth = /**
  1039. * @param {?} date
  1040. * @return {?}
  1041. */
  1042. function (date) {
  1043. return this.getDate(this._createDateWithOverflow(this.getYear(date), this.getMonth(date) + 1, 0));
  1044. };
  1045. /**
  1046. * @param {?} date
  1047. * @return {?}
  1048. */
  1049. NativeDateAdapter.prototype.clone = /**
  1050. * @param {?} date
  1051. * @return {?}
  1052. */
  1053. function (date) {
  1054. return new Date(date.getTime());
  1055. };
  1056. /**
  1057. * @param {?} year
  1058. * @param {?} month
  1059. * @param {?} date
  1060. * @return {?}
  1061. */
  1062. NativeDateAdapter.prototype.createDate = /**
  1063. * @param {?} year
  1064. * @param {?} month
  1065. * @param {?} date
  1066. * @return {?}
  1067. */
  1068. function (year, month, date) {
  1069. // Check for invalid month and date (except upper bound on date which we have to check after
  1070. // creating the Date).
  1071. if (month < 0 || month > 11) {
  1072. throw Error("Invalid month index \"" + month + "\". Month index has to be between 0 and 11.");
  1073. }
  1074. if (date < 1) {
  1075. throw Error("Invalid date \"" + date + "\". Date has to be greater than 0.");
  1076. }
  1077. /** @type {?} */
  1078. var result = this._createDateWithOverflow(year, month, date);
  1079. // Check that the date wasn't above the upper bound for the month, causing the month to overflow
  1080. if (result.getMonth() != month) {
  1081. throw Error("Invalid date \"" + date + "\" for month with index \"" + month + "\".");
  1082. }
  1083. return result;
  1084. };
  1085. /**
  1086. * @return {?}
  1087. */
  1088. NativeDateAdapter.prototype.today = /**
  1089. * @return {?}
  1090. */
  1091. function () {
  1092. return new Date();
  1093. };
  1094. /**
  1095. * @param {?} value
  1096. * @return {?}
  1097. */
  1098. NativeDateAdapter.prototype.parse = /**
  1099. * @param {?} value
  1100. * @return {?}
  1101. */
  1102. function (value) {
  1103. // We have no way using the native JS Date to set the parse format or locale, so we ignore these
  1104. // parameters.
  1105. if (typeof value == 'number') {
  1106. return new Date(value);
  1107. }
  1108. return value ? new Date(Date.parse(value)) : null;
  1109. };
  1110. /**
  1111. * @param {?} date
  1112. * @param {?} displayFormat
  1113. * @return {?}
  1114. */
  1115. NativeDateAdapter.prototype.format = /**
  1116. * @param {?} date
  1117. * @param {?} displayFormat
  1118. * @return {?}
  1119. */
  1120. function (date, displayFormat) {
  1121. if (!this.isValid(date)) {
  1122. throw Error('NativeDateAdapter: Cannot format invalid date.');
  1123. }
  1124. if (SUPPORTS_INTL_API) {
  1125. // On IE and Edge the i18n API will throw a hard error that can crash the entire app
  1126. // if we attempt to format a date whose year is less than 1 or greater than 9999.
  1127. if (this._clampDate && (date.getFullYear() < 1 || date.getFullYear() > 9999)) {
  1128. date = this.clone(date);
  1129. date.setFullYear(Math.max(1, Math.min(9999, date.getFullYear())));
  1130. }
  1131. displayFormat = __assign({}, displayFormat, { timeZone: 'utc' });
  1132. /** @type {?} */
  1133. var dtf = new Intl.DateTimeFormat(this.locale, displayFormat);
  1134. return this._stripDirectionalityCharacters(this._format(dtf, date));
  1135. }
  1136. return this._stripDirectionalityCharacters(date.toDateString());
  1137. };
  1138. /**
  1139. * @param {?} date
  1140. * @param {?} years
  1141. * @return {?}
  1142. */
  1143. NativeDateAdapter.prototype.addCalendarYears = /**
  1144. * @param {?} date
  1145. * @param {?} years
  1146. * @return {?}
  1147. */
  1148. function (date, years) {
  1149. return this.addCalendarMonths(date, years * 12);
  1150. };
  1151. /**
  1152. * @param {?} date
  1153. * @param {?} months
  1154. * @return {?}
  1155. */
  1156. NativeDateAdapter.prototype.addCalendarMonths = /**
  1157. * @param {?} date
  1158. * @param {?} months
  1159. * @return {?}
  1160. */
  1161. function (date, months) {
  1162. /** @type {?} */
  1163. var newDate = this._createDateWithOverflow(this.getYear(date), this.getMonth(date) + months, this.getDate(date));
  1164. // It's possible to wind up in the wrong month if the original month has more days than the new
  1165. // month. In this case we want to go to the last day of the desired month.
  1166. // Note: the additional + 12 % 12 ensures we end up with a positive number, since JS % doesn't
  1167. // guarantee this.
  1168. if (this.getMonth(newDate) != ((this.getMonth(date) + months) % 12 + 12) % 12) {
  1169. newDate = this._createDateWithOverflow(this.getYear(newDate), this.getMonth(newDate), 0);
  1170. }
  1171. return newDate;
  1172. };
  1173. /**
  1174. * @param {?} date
  1175. * @param {?} days
  1176. * @return {?}
  1177. */
  1178. NativeDateAdapter.prototype.addCalendarDays = /**
  1179. * @param {?} date
  1180. * @param {?} days
  1181. * @return {?}
  1182. */
  1183. function (date, days) {
  1184. return this._createDateWithOverflow(this.getYear(date), this.getMonth(date), this.getDate(date) + days);
  1185. };
  1186. /**
  1187. * @param {?} date
  1188. * @return {?}
  1189. */
  1190. NativeDateAdapter.prototype.toIso8601 = /**
  1191. * @param {?} date
  1192. * @return {?}
  1193. */
  1194. function (date) {
  1195. return [
  1196. date.getUTCFullYear(),
  1197. this._2digit(date.getUTCMonth() + 1),
  1198. this._2digit(date.getUTCDate())
  1199. ].join('-');
  1200. };
  1201. /**
  1202. * Returns the given value if given a valid Date or null. Deserializes valid ISO 8601 strings
  1203. * (https://www.ietf.org/rfc/rfc3339.txt) into valid Dates and empty string into null. Returns an
  1204. * invalid date for all other values.
  1205. */
  1206. /**
  1207. * Returns the given value if given a valid Date or null. Deserializes valid ISO 8601 strings
  1208. * (https://www.ietf.org/rfc/rfc3339.txt) into valid Dates and empty string into null. Returns an
  1209. * invalid date for all other values.
  1210. * @param {?} value
  1211. * @return {?}
  1212. */
  1213. NativeDateAdapter.prototype.deserialize = /**
  1214. * Returns the given value if given a valid Date or null. Deserializes valid ISO 8601 strings
  1215. * (https://www.ietf.org/rfc/rfc3339.txt) into valid Dates and empty string into null. Returns an
  1216. * invalid date for all other values.
  1217. * @param {?} value
  1218. * @return {?}
  1219. */
  1220. function (value) {
  1221. if (typeof value === 'string') {
  1222. if (!value) {
  1223. return null;
  1224. }
  1225. // The `Date` constructor accepts formats other than ISO 8601, so we need to make sure the
  1226. // string is the right format first.
  1227. if (ISO_8601_REGEX.test(value)) {
  1228. /** @type {?} */
  1229. var date = new Date(value);
  1230. if (this.isValid(date)) {
  1231. return date;
  1232. }
  1233. }
  1234. }
  1235. return _super.prototype.deserialize.call(this, value);
  1236. };
  1237. /**
  1238. * @param {?} obj
  1239. * @return {?}
  1240. */
  1241. NativeDateAdapter.prototype.isDateInstance = /**
  1242. * @param {?} obj
  1243. * @return {?}
  1244. */
  1245. function (obj) {
  1246. return obj instanceof Date;
  1247. };
  1248. /**
  1249. * @param {?} date
  1250. * @return {?}
  1251. */
  1252. NativeDateAdapter.prototype.isValid = /**
  1253. * @param {?} date
  1254. * @return {?}
  1255. */
  1256. function (date) {
  1257. return !isNaN(date.getTime());
  1258. };
  1259. /**
  1260. * @return {?}
  1261. */
  1262. NativeDateAdapter.prototype.invalid = /**
  1263. * @return {?}
  1264. */
  1265. function () {
  1266. return new Date(NaN);
  1267. };
  1268. /** Creates a date but allows the month and date to overflow. */
  1269. /**
  1270. * Creates a date but allows the month and date to overflow.
  1271. * @private
  1272. * @param {?} year
  1273. * @param {?} month
  1274. * @param {?} date
  1275. * @return {?}
  1276. */
  1277. NativeDateAdapter.prototype._createDateWithOverflow = /**
  1278. * Creates a date but allows the month and date to overflow.
  1279. * @private
  1280. * @param {?} year
  1281. * @param {?} month
  1282. * @param {?} date
  1283. * @return {?}
  1284. */
  1285. function (year, month, date) {
  1286. /** @type {?} */
  1287. var result = new Date(year, month, date);
  1288. // We need to correct for the fact that JS native Date treats years in range [0, 99] as
  1289. // abbreviations for 19xx.
  1290. if (year >= 0 && year < 100) {
  1291. result.setFullYear(this.getYear(result) - 1900);
  1292. }
  1293. return result;
  1294. };
  1295. /**
  1296. * Pads a number to make it two digits.
  1297. * @param n The number to pad.
  1298. * @returns The padded number.
  1299. */
  1300. /**
  1301. * Pads a number to make it two digits.
  1302. * @private
  1303. * @param {?} n The number to pad.
  1304. * @return {?} The padded number.
  1305. */
  1306. NativeDateAdapter.prototype._2digit = /**
  1307. * Pads a number to make it two digits.
  1308. * @private
  1309. * @param {?} n The number to pad.
  1310. * @return {?} The padded number.
  1311. */
  1312. function (n) {
  1313. return ('00' + n).slice(-2);
  1314. };
  1315. /**
  1316. * Strip out unicode LTR and RTL characters. Edge and IE insert these into formatted dates while
  1317. * other browsers do not. We remove them to make output consistent and because they interfere with
  1318. * date parsing.
  1319. * @param str The string to strip direction characters from.
  1320. * @returns The stripped string.
  1321. */
  1322. /**
  1323. * Strip out unicode LTR and RTL characters. Edge and IE insert these into formatted dates while
  1324. * other browsers do not. We remove them to make output consistent and because they interfere with
  1325. * date parsing.
  1326. * @private
  1327. * @param {?} str The string to strip direction characters from.
  1328. * @return {?} The stripped string.
  1329. */
  1330. NativeDateAdapter.prototype._stripDirectionalityCharacters = /**
  1331. * Strip out unicode LTR and RTL characters. Edge and IE insert these into formatted dates while
  1332. * other browsers do not. We remove them to make output consistent and because they interfere with
  1333. * date parsing.
  1334. * @private
  1335. * @param {?} str The string to strip direction characters from.
  1336. * @return {?} The stripped string.
  1337. */
  1338. function (str) {
  1339. return str.replace(/[\u200e\u200f]/g, '');
  1340. };
  1341. /**
  1342. * When converting Date object to string, javascript built-in functions may return wrong
  1343. * results because it applies its internal DST rules. The DST rules around the world change
  1344. * very frequently, and the current valid rule is not always valid in previous years though.
  1345. * We work around this problem building a new Date object which has its internal UTC
  1346. * representation with the local date and time.
  1347. * @param dtf Intl.DateTimeFormat object, containg the desired string format. It must have
  1348. * timeZone set to 'utc' to work fine.
  1349. * @param date Date from which we want to get the string representation according to dtf
  1350. * @returns A Date object with its UTC representation based on the passed in date info
  1351. */
  1352. /**
  1353. * When converting Date object to string, javascript built-in functions may return wrong
  1354. * results because it applies its internal DST rules. The DST rules around the world change
  1355. * very frequently, and the current valid rule is not always valid in previous years though.
  1356. * We work around this problem building a new Date object which has its internal UTC
  1357. * representation with the local date and time.
  1358. * @private
  1359. * @param {?} dtf Intl.DateTimeFormat object, containg the desired string format. It must have
  1360. * timeZone set to 'utc' to work fine.
  1361. * @param {?} date Date from which we want to get the string representation according to dtf
  1362. * @return {?} A Date object with its UTC representation based on the passed in date info
  1363. */
  1364. NativeDateAdapter.prototype._format = /**
  1365. * When converting Date object to string, javascript built-in functions may return wrong
  1366. * results because it applies its internal DST rules. The DST rules around the world change
  1367. * very frequently, and the current valid rule is not always valid in previous years though.
  1368. * We work around this problem building a new Date object which has its internal UTC
  1369. * representation with the local date and time.
  1370. * @private
  1371. * @param {?} dtf Intl.DateTimeFormat object, containg the desired string format. It must have
  1372. * timeZone set to 'utc' to work fine.
  1373. * @param {?} date Date from which we want to get the string representation according to dtf
  1374. * @return {?} A Date object with its UTC representation based on the passed in date info
  1375. */
  1376. function (dtf, date) {
  1377. /** @type {?} */
  1378. var d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
  1379. return dtf.format(d);
  1380. };
  1381. NativeDateAdapter.decorators = [
  1382. { type: core.Injectable },
  1383. ];
  1384. /** @nocollapse */
  1385. NativeDateAdapter.ctorParameters = function () { return [
  1386. { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_DATE_LOCALE,] }] },
  1387. { type: platform.Platform }
  1388. ]; };
  1389. return NativeDateAdapter;
  1390. }(DateAdapter));
  1391. /**
  1392. * @fileoverview added by tsickle
  1393. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  1394. */
  1395. /** @type {?} */
  1396. var MAT_NATIVE_DATE_FORMATS = {
  1397. parse: {
  1398. dateInput: null,
  1399. },
  1400. display: {
  1401. dateInput: { year: 'numeric', month: 'numeric', day: 'numeric' },
  1402. monthYearLabel: { year: 'numeric', month: 'short' },
  1403. dateA11yLabel: { year: 'numeric', month: 'long', day: 'numeric' },
  1404. monthYearA11yLabel: { year: 'numeric', month: 'long' },
  1405. }
  1406. };
  1407. /**
  1408. * @fileoverview added by tsickle
  1409. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  1410. */
  1411. var NativeDateModule = /** @class */ (function () {
  1412. function NativeDateModule() {
  1413. }
  1414. NativeDateModule.decorators = [
  1415. { type: core.NgModule, args: [{
  1416. imports: [platform.PlatformModule],
  1417. providers: [
  1418. { provide: DateAdapter, useClass: NativeDateAdapter },
  1419. ],
  1420. },] },
  1421. ];
  1422. return NativeDateModule;
  1423. }());
  1424. var ɵ0$1 = MAT_NATIVE_DATE_FORMATS;
  1425. var MatNativeDateModule = /** @class */ (function () {
  1426. function MatNativeDateModule() {
  1427. }
  1428. MatNativeDateModule.decorators = [
  1429. { type: core.NgModule, args: [{
  1430. imports: [NativeDateModule],
  1431. providers: [{ provide: MAT_DATE_FORMATS, useValue: ɵ0$1 }],
  1432. },] },
  1433. ];
  1434. return MatNativeDateModule;
  1435. }());
  1436. /**
  1437. * @fileoverview added by tsickle
  1438. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  1439. */
  1440. /**
  1441. * Error state matcher that matches when a control is invalid and dirty.
  1442. */
  1443. var ShowOnDirtyErrorStateMatcher = /** @class */ (function () {
  1444. function ShowOnDirtyErrorStateMatcher() {
  1445. }
  1446. /**
  1447. * @param {?} control
  1448. * @param {?} form
  1449. * @return {?}
  1450. */
  1451. ShowOnDirtyErrorStateMatcher.prototype.isErrorState = /**
  1452. * @param {?} control
  1453. * @param {?} form
  1454. * @return {?}
  1455. */
  1456. function (control, form) {
  1457. return !!(control && control.invalid && (control.dirty || (form && form.submitted)));
  1458. };
  1459. ShowOnDirtyErrorStateMatcher.decorators = [
  1460. { type: core.Injectable },
  1461. ];
  1462. return ShowOnDirtyErrorStateMatcher;
  1463. }());
  1464. /**
  1465. * Provider that defines how form controls behave with regards to displaying error messages.
  1466. */
  1467. var ErrorStateMatcher = /** @class */ (function () {
  1468. function ErrorStateMatcher() {
  1469. }
  1470. /**
  1471. * @param {?} control
  1472. * @param {?} form
  1473. * @return {?}
  1474. */
  1475. ErrorStateMatcher.prototype.isErrorState = /**
  1476. * @param {?} control
  1477. * @param {?} form
  1478. * @return {?}
  1479. */
  1480. function (control, form) {
  1481. return !!(control && control.invalid && (control.touched || (form && form.submitted)));
  1482. };
  1483. ErrorStateMatcher.decorators = [
  1484. { type: core.Injectable, args: [{ providedIn: 'root' },] },
  1485. ];
  1486. /** @nocollapse */ ErrorStateMatcher.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function ErrorStateMatcher_Factory() { return new ErrorStateMatcher(); }, token: ErrorStateMatcher, providedIn: "root" });
  1487. return ErrorStateMatcher;
  1488. }());
  1489. /**
  1490. * @fileoverview added by tsickle
  1491. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  1492. */
  1493. /**
  1494. * @fileoverview added by tsickle
  1495. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  1496. */
  1497. /**
  1498. * Injection token that can be used to provide options to the Hammerjs instance.
  1499. * More info at http://hammerjs.github.io/api/.
  1500. * @type {?}
  1501. */
  1502. var MAT_HAMMER_OPTIONS = new core.InjectionToken('MAT_HAMMER_OPTIONS');
  1503. /** @type {?} */
  1504. var ANGULAR_MATERIAL_SUPPORTED_HAMMER_GESTURES = [
  1505. 'longpress',
  1506. 'slide',
  1507. 'slidestart',
  1508. 'slideend',
  1509. 'slideright',
  1510. 'slideleft'
  1511. ];
  1512. var ɵ0$2 = /**
  1513. * @return {?}
  1514. */
  1515. function () { }, ɵ1 = /**
  1516. * @return {?}
  1517. */
  1518. function () { };
  1519. /**
  1520. * Fake HammerInstance that is used when a Hammer instance is requested when HammerJS has not
  1521. * been loaded on the page.
  1522. * @type {?}
  1523. */
  1524. var noopHammerInstance = {
  1525. on: (ɵ0$2),
  1526. off: (ɵ1),
  1527. };
  1528. /**
  1529. * Adjusts configuration of our gesture library, Hammer.
  1530. */
  1531. var GestureConfig = /** @class */ (function (_super) {
  1532. __extends(GestureConfig, _super);
  1533. function GestureConfig(_hammerOptions, commonModule) {
  1534. var _this = _super.call(this) || this;
  1535. _this._hammerOptions = _hammerOptions;
  1536. /**
  1537. * List of new event names to add to the gesture support list
  1538. */
  1539. _this.events = ANGULAR_MATERIAL_SUPPORTED_HAMMER_GESTURES;
  1540. if (commonModule) {
  1541. commonModule._checkHammerIsAvailable();
  1542. }
  1543. return _this;
  1544. }
  1545. /**
  1546. * Builds Hammer instance manually to add custom recognizers that match the Material Design spec.
  1547. *
  1548. * Our gesture names come from the Material Design gestures spec:
  1549. * https://material.io/design/#gestures-touch-mechanics
  1550. *
  1551. * More information on default recognizers can be found in Hammer docs:
  1552. * http://hammerjs.github.io/recognizer-pan/
  1553. * http://hammerjs.github.io/recognizer-press/
  1554. *
  1555. * @param element Element to which to assign the new HammerJS gestures.
  1556. * @returns Newly-created HammerJS instance.
  1557. */
  1558. /**
  1559. * Builds Hammer instance manually to add custom recognizers that match the Material Design spec.
  1560. *
  1561. * Our gesture names come from the Material Design gestures spec:
  1562. * https://material.io/design/#gestures-touch-mechanics
  1563. *
  1564. * More information on default recognizers can be found in Hammer docs:
  1565. * http://hammerjs.github.io/recognizer-pan/
  1566. * http://hammerjs.github.io/recognizer-press/
  1567. *
  1568. * @param {?} element Element to which to assign the new HammerJS gestures.
  1569. * @return {?} Newly-created HammerJS instance.
  1570. */
  1571. GestureConfig.prototype.buildHammer = /**
  1572. * Builds Hammer instance manually to add custom recognizers that match the Material Design spec.
  1573. *
  1574. * Our gesture names come from the Material Design gestures spec:
  1575. * https://material.io/design/#gestures-touch-mechanics
  1576. *
  1577. * More information on default recognizers can be found in Hammer docs:
  1578. * http://hammerjs.github.io/recognizer-pan/
  1579. * http://hammerjs.github.io/recognizer-press/
  1580. *
  1581. * @param {?} element Element to which to assign the new HammerJS gestures.
  1582. * @return {?} Newly-created HammerJS instance.
  1583. */
  1584. function (element) {
  1585. /** @type {?} */
  1586. var hammer = typeof window !== 'undefined' ? ((/** @type {?} */ (window))).Hammer : null;
  1587. if (!hammer) {
  1588. // If HammerJS is not loaded here, return the noop HammerInstance. This is necessary to
  1589. // ensure that omitting HammerJS completely will not cause any errors while *also* supporting
  1590. // the lazy-loading of HammerJS via the HAMMER_LOADER token introduced in Angular 6.1.
  1591. // Because we can't depend on HAMMER_LOADER's existance until 7.0, we have to always set
  1592. // `this.events` to the set we support, instead of conditionally setting it to `[]` if
  1593. // `HAMMER_LOADER` is present (and then throwing an Error here if `window.Hammer` is
  1594. // undefined).
  1595. // @breaking-change 8.0.0
  1596. return noopHammerInstance;
  1597. }
  1598. /** @type {?} */
  1599. var mc = new hammer(element, this._hammerOptions || undefined);
  1600. // Default Hammer Recognizers.
  1601. /** @type {?} */
  1602. var pan = new hammer.Pan();
  1603. /** @type {?} */
  1604. var swipe = new hammer.Swipe();
  1605. /** @type {?} */
  1606. var press = new hammer.Press();
  1607. // Notice that a HammerJS recognizer can only depend on one other recognizer once.
  1608. // Otherwise the previous `recognizeWith` will be dropped.
  1609. // TODO: Confirm threshold numbers with Material Design UX Team
  1610. /** @type {?} */
  1611. var slide = this._createRecognizer(pan, { event: 'slide', threshold: 0 }, swipe);
  1612. /** @type {?} */
  1613. var longpress = this._createRecognizer(press, { event: 'longpress', time: 500 });
  1614. // Overwrite the default `pan` event to use the swipe event.
  1615. pan.recognizeWith(swipe);
  1616. // Since the slide event threshold is set to zero, the slide recognizer can fire and
  1617. // accidentally reset the longpress recognizer. In order to make sure that the two
  1618. // recognizers can run simultaneously but don't affect each other, we allow the slide
  1619. // recognizer to recognize while a longpress is being processed.
  1620. // See: https://github.com/hammerjs/hammer.js/blob/master/src/manager.js#L123-L124
  1621. longpress.recognizeWith(slide);
  1622. // Add customized gestures to Hammer manager
  1623. mc.add([swipe, press, pan, slide, longpress]);
  1624. return (/** @type {?} */ (mc));
  1625. };
  1626. /** Creates a new recognizer, without affecting the default recognizers of HammerJS */
  1627. /**
  1628. * Creates a new recognizer, without affecting the default recognizers of HammerJS
  1629. * @private
  1630. * @param {?} base
  1631. * @param {?} options
  1632. * @param {...?} inheritances
  1633. * @return {?}
  1634. */
  1635. GestureConfig.prototype._createRecognizer = /**
  1636. * Creates a new recognizer, without affecting the default recognizers of HammerJS
  1637. * @private
  1638. * @param {?} base
  1639. * @param {?} options
  1640. * @param {...?} inheritances
  1641. * @return {?}
  1642. */
  1643. function (base, options) {
  1644. var inheritances = [];
  1645. for (var _i = 2; _i < arguments.length; _i++) {
  1646. inheritances[_i - 2] = arguments[_i];
  1647. }
  1648. /** @type {?} */
  1649. var recognizer = new ((/** @type {?} */ (base.constructor)))(options);
  1650. inheritances.push(base);
  1651. inheritances.forEach((/**
  1652. * @param {?} item
  1653. * @return {?}
  1654. */
  1655. function (item) { return recognizer.recognizeWith(item); }));
  1656. return recognizer;
  1657. };
  1658. GestureConfig.decorators = [
  1659. { type: core.Injectable },
  1660. ];
  1661. /** @nocollapse */
  1662. GestureConfig.ctorParameters = function () { return [
  1663. { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_HAMMER_OPTIONS,] }] },
  1664. { type: MatCommonModule, decorators: [{ type: core.Optional }] }
  1665. ]; };
  1666. return GestureConfig;
  1667. }(platformBrowser.HammerGestureConfig));
  1668. /**
  1669. * @fileoverview added by tsickle
  1670. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  1671. */
  1672. /**
  1673. * Shared directive to count lines inside a text area, such as a list item.
  1674. * Line elements can be extracted with a \@ContentChildren(MatLine) query, then
  1675. * counted by checking the query list's length.
  1676. */
  1677. var MatLine = /** @class */ (function () {
  1678. function MatLine() {
  1679. }
  1680. MatLine.decorators = [
  1681. { type: core.Directive, args: [{
  1682. selector: '[mat-line], [matLine]',
  1683. host: { 'class': 'mat-line' }
  1684. },] },
  1685. ];
  1686. return MatLine;
  1687. }());
  1688. /**
  1689. * Helper that takes a query list of lines and sets the correct class on the host.
  1690. * \@docs-private
  1691. * @param {?} lines
  1692. * @param {?} element
  1693. * @return {?}
  1694. */
  1695. function setLines(lines, element) {
  1696. // Note: doesn't need to unsubscribe, because `changes`
  1697. // gets completed by Angular when the view is destroyed.
  1698. lines.changes.pipe(operators.startWith(lines)).subscribe((/**
  1699. * @param {?} __0
  1700. * @return {?}
  1701. */
  1702. function (_a) {
  1703. var length = _a.length;
  1704. setClass(element, 'mat-2-line', false);
  1705. setClass(element, 'mat-3-line', false);
  1706. setClass(element, 'mat-multi-line', false);
  1707. if (length === 2 || length === 3) {
  1708. setClass(element, "mat-" + length + "-line", true);
  1709. }
  1710. else if (length > 3) {
  1711. setClass(element, "mat-multi-line", true);
  1712. }
  1713. }));
  1714. }
  1715. /**
  1716. * Adds or removes a class from an element.
  1717. * @param {?} element
  1718. * @param {?} className
  1719. * @param {?} isAdd
  1720. * @return {?}
  1721. */
  1722. function setClass(element, className, isAdd) {
  1723. /** @type {?} */
  1724. var classList = element.nativeElement.classList;
  1725. isAdd ? classList.add(className) : classList.remove(className);
  1726. }
  1727. /**
  1728. * Helper that takes a query list of lines and sets the correct class on the host.
  1729. * \@docs-private
  1730. * @deprecated Use `setLines` instead.
  1731. * \@breaking-change 8.0.0
  1732. */
  1733. var /**
  1734. * Helper that takes a query list of lines and sets the correct class on the host.
  1735. * \@docs-private
  1736. * @deprecated Use `setLines` instead.
  1737. * \@breaking-change 8.0.0
  1738. */
  1739. MatLineSetter = /** @class */ (function () {
  1740. function MatLineSetter(lines, element) {
  1741. setLines(lines, element);
  1742. }
  1743. return MatLineSetter;
  1744. }());
  1745. var MatLineModule = /** @class */ (function () {
  1746. function MatLineModule() {
  1747. }
  1748. MatLineModule.decorators = [
  1749. { type: core.NgModule, args: [{
  1750. imports: [MatCommonModule],
  1751. exports: [MatLine, MatCommonModule],
  1752. declarations: [MatLine],
  1753. },] },
  1754. ];
  1755. return MatLineModule;
  1756. }());
  1757. /**
  1758. * @fileoverview added by tsickle
  1759. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  1760. */
  1761. /** @enum {number} */
  1762. var RippleState = {
  1763. FADING_IN: 0, VISIBLE: 1, FADING_OUT: 2, HIDDEN: 3,
  1764. };
  1765. RippleState[RippleState.FADING_IN] = 'FADING_IN';
  1766. RippleState[RippleState.VISIBLE] = 'VISIBLE';
  1767. RippleState[RippleState.FADING_OUT] = 'FADING_OUT';
  1768. RippleState[RippleState.HIDDEN] = 'HIDDEN';
  1769. /**
  1770. * Reference to a previously launched ripple element.
  1771. */
  1772. var /**
  1773. * Reference to a previously launched ripple element.
  1774. */
  1775. RippleRef = /** @class */ (function () {
  1776. function RippleRef(_renderer, element, config) {
  1777. this._renderer = _renderer;
  1778. this.element = element;
  1779. this.config = config;
  1780. /**
  1781. * Current state of the ripple.
  1782. */
  1783. this.state = RippleState.HIDDEN;
  1784. }
  1785. /** Fades out the ripple element. */
  1786. /**
  1787. * Fades out the ripple element.
  1788. * @return {?}
  1789. */
  1790. RippleRef.prototype.fadeOut = /**
  1791. * Fades out the ripple element.
  1792. * @return {?}
  1793. */
  1794. function () {
  1795. this._renderer.fadeOutRipple(this);
  1796. };
  1797. return RippleRef;
  1798. }());
  1799. /**
  1800. * @fileoverview added by tsickle
  1801. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  1802. */
  1803. /**
  1804. * Default ripple animation configuration for ripples without an explicit
  1805. * animation config specified.
  1806. * @type {?}
  1807. */
  1808. var defaultRippleAnimationConfig = {
  1809. enterDuration: 450,
  1810. exitDuration: 400
  1811. };
  1812. /**
  1813. * Timeout for ignoring mouse events. Mouse events will be temporary ignored after touch
  1814. * events to avoid synthetic mouse events.
  1815. * @type {?}
  1816. */
  1817. var ignoreMouseEventsTimeout = 800;
  1818. /**
  1819. * Options that apply to all the event listeners that are bound by the ripple renderer.
  1820. * @type {?}
  1821. */
  1822. var passiveEventOptions = platform.normalizePassiveListenerOptions({ passive: true });
  1823. /**
  1824. * Helper service that performs DOM manipulations. Not intended to be used outside this module.
  1825. * The constructor takes a reference to the ripple directive's host element and a map of DOM
  1826. * event handlers to be installed on the element that triggers ripple animations.
  1827. * This will eventually become a custom renderer once Angular support exists.
  1828. * \@docs-private
  1829. */
  1830. var /**
  1831. * Helper service that performs DOM manipulations. Not intended to be used outside this module.
  1832. * The constructor takes a reference to the ripple directive's host element and a map of DOM
  1833. * event handlers to be installed on the element that triggers ripple animations.
  1834. * This will eventually become a custom renderer once Angular support exists.
  1835. * \@docs-private
  1836. */
  1837. RippleRenderer = /** @class */ (function () {
  1838. function RippleRenderer(_target, _ngZone, elementRef, platform$$1) {
  1839. var _this = this;
  1840. this._target = _target;
  1841. this._ngZone = _ngZone;
  1842. /**
  1843. * Whether the pointer is currently down or not.
  1844. */
  1845. this._isPointerDown = false;
  1846. /**
  1847. * Events to be registered on the trigger element.
  1848. */
  1849. this._triggerEvents = new Map();
  1850. /**
  1851. * Set of currently active ripple references.
  1852. */
  1853. this._activeRipples = new Set();
  1854. /**
  1855. * Function being called whenever the trigger is being pressed using mouse.
  1856. */
  1857. this._onMousedown = (/**
  1858. * @param {?} event
  1859. * @return {?}
  1860. */
  1861. function (event) {
  1862. // Screen readers will fire fake mouse events for space/enter. Skip launching a
  1863. // ripple in this case for consistency with the non-screen-reader experience.
  1864. /** @type {?} */
  1865. var isFakeMousedown = a11y.isFakeMousedownFromScreenReader(event);
  1866. /** @type {?} */
  1867. var isSyntheticEvent = _this._lastTouchStartEvent &&
  1868. Date.now() < _this._lastTouchStartEvent + ignoreMouseEventsTimeout;
  1869. if (!_this._target.rippleDisabled && !isFakeMousedown && !isSyntheticEvent) {
  1870. _this._isPointerDown = true;
  1871. _this.fadeInRipple(event.clientX, event.clientY, _this._target.rippleConfig);
  1872. }
  1873. });
  1874. /**
  1875. * Function being called whenever the trigger is being pressed using touch.
  1876. */
  1877. this._onTouchStart = (/**
  1878. * @param {?} event
  1879. * @return {?}
  1880. */
  1881. function (event) {
  1882. if (!_this._target.rippleDisabled) {
  1883. // Some browsers fire mouse events after a `touchstart` event. Those synthetic mouse
  1884. // events will launch a second ripple if we don't ignore mouse events for a specific
  1885. // time after a touchstart event.
  1886. _this._lastTouchStartEvent = Date.now();
  1887. _this._isPointerDown = true;
  1888. // Use `changedTouches` so we skip any touches where the user put
  1889. // their finger down, but used another finger to tap the element again.
  1890. /** @type {?} */
  1891. var touches = event.changedTouches;
  1892. for (var i = 0; i < touches.length; i++) {
  1893. _this.fadeInRipple(touches[i].clientX, touches[i].clientY, _this._target.rippleConfig);
  1894. }
  1895. }
  1896. });
  1897. /**
  1898. * Function being called whenever the trigger is being released.
  1899. */
  1900. this._onPointerUp = (/**
  1901. * @return {?}
  1902. */
  1903. function () {
  1904. if (!_this._isPointerDown) {
  1905. return;
  1906. }
  1907. _this._isPointerDown = false;
  1908. // Fade-out all ripples that are visible and not persistent.
  1909. _this._activeRipples.forEach((/**
  1910. * @param {?} ripple
  1911. * @return {?}
  1912. */
  1913. function (ripple) {
  1914. // By default, only ripples that are completely visible will fade out on pointer release.
  1915. // If the `terminateOnPointerUp` option is set, ripples that still fade in will also fade out.
  1916. /** @type {?} */
  1917. var isVisible = ripple.state === RippleState.VISIBLE ||
  1918. ripple.config.terminateOnPointerUp && ripple.state === RippleState.FADING_IN;
  1919. if (!ripple.config.persistent && isVisible) {
  1920. ripple.fadeOut();
  1921. }
  1922. }));
  1923. });
  1924. // Only do anything if we're on the browser.
  1925. if (platform$$1.isBrowser) {
  1926. this._containerElement = elementRef.nativeElement;
  1927. // Specify events which need to be registered on the trigger.
  1928. this._triggerEvents
  1929. .set('mousedown', this._onMousedown)
  1930. .set('mouseup', this._onPointerUp)
  1931. .set('mouseleave', this._onPointerUp)
  1932. .set('touchstart', this._onTouchStart)
  1933. .set('touchend', this._onPointerUp)
  1934. .set('touchcancel', this._onPointerUp);
  1935. }
  1936. }
  1937. /**
  1938. * Fades in a ripple at the given coordinates.
  1939. * @param x Coordinate within the element, along the X axis at which to start the ripple.
  1940. * @param y Coordinate within the element, along the Y axis at which to start the ripple.
  1941. * @param config Extra ripple options.
  1942. */
  1943. /**
  1944. * Fades in a ripple at the given coordinates.
  1945. * @param {?} x Coordinate within the element, along the X axis at which to start the ripple.
  1946. * @param {?} y Coordinate within the element, along the Y axis at which to start the ripple.
  1947. * @param {?=} config Extra ripple options.
  1948. * @return {?}
  1949. */
  1950. RippleRenderer.prototype.fadeInRipple = /**
  1951. * Fades in a ripple at the given coordinates.
  1952. * @param {?} x Coordinate within the element, along the X axis at which to start the ripple.
  1953. * @param {?} y Coordinate within the element, along the Y axis at which to start the ripple.
  1954. * @param {?=} config Extra ripple options.
  1955. * @return {?}
  1956. */
  1957. function (x, y, config) {
  1958. var _this = this;
  1959. if (config === void 0) { config = {}; }
  1960. /** @type {?} */
  1961. var containerRect = this._containerRect =
  1962. this._containerRect || this._containerElement.getBoundingClientRect();
  1963. /** @type {?} */
  1964. var animationConfig = __assign({}, defaultRippleAnimationConfig, config.animation);
  1965. if (config.centered) {
  1966. x = containerRect.left + containerRect.width / 2;
  1967. y = containerRect.top + containerRect.height / 2;
  1968. }
  1969. /** @type {?} */
  1970. var radius = config.radius || distanceToFurthestCorner(x, y, containerRect);
  1971. /** @type {?} */
  1972. var offsetX = x - containerRect.left;
  1973. /** @type {?} */
  1974. var offsetY = y - containerRect.top;
  1975. /** @type {?} */
  1976. var duration = animationConfig.enterDuration;
  1977. /** @type {?} */
  1978. var ripple = document.createElement('div');
  1979. ripple.classList.add('mat-ripple-element');
  1980. ripple.style.left = offsetX - radius + "px";
  1981. ripple.style.top = offsetY - radius + "px";
  1982. ripple.style.height = radius * 2 + "px";
  1983. ripple.style.width = radius * 2 + "px";
  1984. // If the color is not set, the default CSS color will be used.
  1985. ripple.style.backgroundColor = config.color || null;
  1986. ripple.style.transitionDuration = duration + "ms";
  1987. this._containerElement.appendChild(ripple);
  1988. // By default the browser does not recalculate the styles of dynamically created
  1989. // ripple elements. This is critical because then the `scale` would not animate properly.
  1990. enforceStyleRecalculation(ripple);
  1991. ripple.style.transform = 'scale(1)';
  1992. // Exposed reference to the ripple that will be returned.
  1993. /** @type {?} */
  1994. var rippleRef = new RippleRef(this, ripple, config);
  1995. rippleRef.state = RippleState.FADING_IN;
  1996. // Add the ripple reference to the list of all active ripples.
  1997. this._activeRipples.add(rippleRef);
  1998. if (!config.persistent) {
  1999. this._mostRecentTransientRipple = rippleRef;
  2000. }
  2001. // Wait for the ripple element to be completely faded in.
  2002. // Once it's faded in, the ripple can be hidden immediately if the mouse is released.
  2003. this._runTimeoutOutsideZone((/**
  2004. * @return {?}
  2005. */
  2006. function () {
  2007. /** @type {?} */
  2008. var isMostRecentTransientRipple = rippleRef === _this._mostRecentTransientRipple;
  2009. rippleRef.state = RippleState.VISIBLE;
  2010. // When the timer runs out while the user has kept their pointer down, we want to
  2011. // keep only the persistent ripples and the latest transient ripple. We do this,
  2012. // because we don't want stacked transient ripples to appear after their enter
  2013. // animation has finished.
  2014. if (!config.persistent && (!isMostRecentTransientRipple || !_this._isPointerDown)) {
  2015. rippleRef.fadeOut();
  2016. }
  2017. }), duration);
  2018. return rippleRef;
  2019. };
  2020. /** Fades out a ripple reference. */
  2021. /**
  2022. * Fades out a ripple reference.
  2023. * @param {?} rippleRef
  2024. * @return {?}
  2025. */
  2026. RippleRenderer.prototype.fadeOutRipple = /**
  2027. * Fades out a ripple reference.
  2028. * @param {?} rippleRef
  2029. * @return {?}
  2030. */
  2031. function (rippleRef) {
  2032. /** @type {?} */
  2033. var wasActive = this._activeRipples.delete(rippleRef);
  2034. if (rippleRef === this._mostRecentTransientRipple) {
  2035. this._mostRecentTransientRipple = null;
  2036. }
  2037. // Clear out the cached bounding rect if we have no more ripples.
  2038. if (!this._activeRipples.size) {
  2039. this._containerRect = null;
  2040. }
  2041. // For ripples that are not active anymore, don't re-run the fade-out animation.
  2042. if (!wasActive) {
  2043. return;
  2044. }
  2045. /** @type {?} */
  2046. var rippleEl = rippleRef.element;
  2047. /** @type {?} */
  2048. var animationConfig = __assign({}, defaultRippleAnimationConfig, rippleRef.config.animation);
  2049. rippleEl.style.transitionDuration = animationConfig.exitDuration + "ms";
  2050. rippleEl.style.opacity = '0';
  2051. rippleRef.state = RippleState.FADING_OUT;
  2052. // Once the ripple faded out, the ripple can be safely removed from the DOM.
  2053. this._runTimeoutOutsideZone((/**
  2054. * @return {?}
  2055. */
  2056. function () {
  2057. rippleRef.state = RippleState.HIDDEN;
  2058. (/** @type {?} */ (rippleEl.parentNode)).removeChild(rippleEl);
  2059. }), animationConfig.exitDuration);
  2060. };
  2061. /** Fades out all currently active ripples. */
  2062. /**
  2063. * Fades out all currently active ripples.
  2064. * @return {?}
  2065. */
  2066. RippleRenderer.prototype.fadeOutAll = /**
  2067. * Fades out all currently active ripples.
  2068. * @return {?}
  2069. */
  2070. function () {
  2071. this._activeRipples.forEach((/**
  2072. * @param {?} ripple
  2073. * @return {?}
  2074. */
  2075. function (ripple) { return ripple.fadeOut(); }));
  2076. };
  2077. /** Sets up the trigger event listeners */
  2078. /**
  2079. * Sets up the trigger event listeners
  2080. * @param {?} element
  2081. * @return {?}
  2082. */
  2083. RippleRenderer.prototype.setupTriggerEvents = /**
  2084. * Sets up the trigger event listeners
  2085. * @param {?} element
  2086. * @return {?}
  2087. */
  2088. function (element) {
  2089. var _this = this;
  2090. if (!element || element === this._triggerElement) {
  2091. return;
  2092. }
  2093. // Remove all previously registered event listeners from the trigger element.
  2094. this._removeTriggerEvents();
  2095. this._ngZone.runOutsideAngular((/**
  2096. * @return {?}
  2097. */
  2098. function () {
  2099. _this._triggerEvents.forEach((/**
  2100. * @param {?} fn
  2101. * @param {?} type
  2102. * @return {?}
  2103. */
  2104. function (fn, type) {
  2105. element.addEventListener(type, fn, passiveEventOptions);
  2106. }));
  2107. }));
  2108. this._triggerElement = element;
  2109. };
  2110. /** Runs a timeout outside of the Angular zone to avoid triggering the change detection. */
  2111. /**
  2112. * Runs a timeout outside of the Angular zone to avoid triggering the change detection.
  2113. * @private
  2114. * @param {?} fn
  2115. * @param {?=} delay
  2116. * @return {?}
  2117. */
  2118. RippleRenderer.prototype._runTimeoutOutsideZone = /**
  2119. * Runs a timeout outside of the Angular zone to avoid triggering the change detection.
  2120. * @private
  2121. * @param {?} fn
  2122. * @param {?=} delay
  2123. * @return {?}
  2124. */
  2125. function (fn, delay) {
  2126. if (delay === void 0) { delay = 0; }
  2127. this._ngZone.runOutsideAngular((/**
  2128. * @return {?}
  2129. */
  2130. function () { return setTimeout(fn, delay); }));
  2131. };
  2132. /** Removes previously registered event listeners from the trigger element. */
  2133. /**
  2134. * Removes previously registered event listeners from the trigger element.
  2135. * @return {?}
  2136. */
  2137. RippleRenderer.prototype._removeTriggerEvents = /**
  2138. * Removes previously registered event listeners from the trigger element.
  2139. * @return {?}
  2140. */
  2141. function () {
  2142. var _this = this;
  2143. if (this._triggerElement) {
  2144. this._triggerEvents.forEach((/**
  2145. * @param {?} fn
  2146. * @param {?} type
  2147. * @return {?}
  2148. */
  2149. function (fn, type) {
  2150. (/** @type {?} */ (_this._triggerElement)).removeEventListener(type, fn, passiveEventOptions);
  2151. }));
  2152. }
  2153. };
  2154. return RippleRenderer;
  2155. }());
  2156. /**
  2157. * Enforces a style recalculation of a DOM element by computing its styles.
  2158. * @param {?} element
  2159. * @return {?}
  2160. */
  2161. function enforceStyleRecalculation(element) {
  2162. // Enforce a style recalculation by calling `getComputedStyle` and accessing any property.
  2163. // Calling `getPropertyValue` is important to let optimizers know that this is not a noop.
  2164. // See: https://gist.github.com/paulirish/5d52fb081b3570c81e3a
  2165. window.getComputedStyle(element).getPropertyValue('opacity');
  2166. }
  2167. /**
  2168. * Returns the distance from the point (x, y) to the furthest corner of a rectangle.
  2169. * @param {?} x
  2170. * @param {?} y
  2171. * @param {?} rect
  2172. * @return {?}
  2173. */
  2174. function distanceToFurthestCorner(x, y, rect) {
  2175. /** @type {?} */
  2176. var distX = Math.max(Math.abs(x - rect.left), Math.abs(x - rect.right));
  2177. /** @type {?} */
  2178. var distY = Math.max(Math.abs(y - rect.top), Math.abs(y - rect.bottom));
  2179. return Math.sqrt(distX * distX + distY * distY);
  2180. }
  2181. /**
  2182. * @fileoverview added by tsickle
  2183. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  2184. */
  2185. /**
  2186. * Injection token that can be used to specify the global ripple options.
  2187. * @type {?}
  2188. */
  2189. var MAT_RIPPLE_GLOBAL_OPTIONS = new core.InjectionToken('mat-ripple-global-options');
  2190. var MatRipple = /** @class */ (function () {
  2191. function MatRipple(_elementRef, ngZone, platform$$1, globalOptions, animationMode) {
  2192. this._elementRef = _elementRef;
  2193. /**
  2194. * If set, the radius in pixels of foreground ripples when fully expanded. If unset, the radius
  2195. * will be the distance from the center of the ripple to the furthest corner of the host element's
  2196. * bounding rectangle.
  2197. */
  2198. this.radius = 0;
  2199. this._disabled = false;
  2200. /**
  2201. * Whether ripple directive is initialized and the input bindings are set.
  2202. */
  2203. this._isInitialized = false;
  2204. this._globalOptions = globalOptions || {};
  2205. this._rippleRenderer = new RippleRenderer(this, ngZone, _elementRef, platform$$1);
  2206. if (animationMode === 'NoopAnimations') {
  2207. this._globalOptions.animation = { enterDuration: 0, exitDuration: 0 };
  2208. }
  2209. }
  2210. Object.defineProperty(MatRipple.prototype, "disabled", {
  2211. /**
  2212. * Whether click events will not trigger the ripple. Ripples can be still launched manually
  2213. * by using the `launch()` method.
  2214. */
  2215. get: /**
  2216. * Whether click events will not trigger the ripple. Ripples can be still launched manually
  2217. * by using the `launch()` method.
  2218. * @return {?}
  2219. */
  2220. function () { return this._disabled; },
  2221. set: /**
  2222. * @param {?} value
  2223. * @return {?}
  2224. */
  2225. function (value) {
  2226. this._disabled = value;
  2227. this._setupTriggerEventsIfEnabled();
  2228. },
  2229. enumerable: true,
  2230. configurable: true
  2231. });
  2232. Object.defineProperty(MatRipple.prototype, "trigger", {
  2233. /**
  2234. * The element that triggers the ripple when click events are received.
  2235. * Defaults to the directive's host element.
  2236. */
  2237. get: /**
  2238. * The element that triggers the ripple when click events are received.
  2239. * Defaults to the directive's host element.
  2240. * @return {?}
  2241. */
  2242. function () { return this._trigger || this._elementRef.nativeElement; },
  2243. set: /**
  2244. * @param {?} trigger
  2245. * @return {?}
  2246. */
  2247. function (trigger) {
  2248. this._trigger = trigger;
  2249. this._setupTriggerEventsIfEnabled();
  2250. },
  2251. enumerable: true,
  2252. configurable: true
  2253. });
  2254. /**
  2255. * @return {?}
  2256. */
  2257. MatRipple.prototype.ngOnInit = /**
  2258. * @return {?}
  2259. */
  2260. function () {
  2261. this._isInitialized = true;
  2262. this._setupTriggerEventsIfEnabled();
  2263. };
  2264. /**
  2265. * @return {?}
  2266. */
  2267. MatRipple.prototype.ngOnDestroy = /**
  2268. * @return {?}
  2269. */
  2270. function () {
  2271. this._rippleRenderer._removeTriggerEvents();
  2272. };
  2273. /** Fades out all currently showing ripple elements. */
  2274. /**
  2275. * Fades out all currently showing ripple elements.
  2276. * @return {?}
  2277. */
  2278. MatRipple.prototype.fadeOutAll = /**
  2279. * Fades out all currently showing ripple elements.
  2280. * @return {?}
  2281. */
  2282. function () {
  2283. this._rippleRenderer.fadeOutAll();
  2284. };
  2285. Object.defineProperty(MatRipple.prototype, "rippleConfig", {
  2286. /**
  2287. * Ripple configuration from the directive's input values.
  2288. * @docs-private Implemented as part of RippleTarget
  2289. */
  2290. get: /**
  2291. * Ripple configuration from the directive's input values.
  2292. * \@docs-private Implemented as part of RippleTarget
  2293. * @return {?}
  2294. */
  2295. function () {
  2296. return {
  2297. centered: this.centered,
  2298. radius: this.radius,
  2299. color: this.color,
  2300. animation: __assign({}, this._globalOptions.animation, this.animation),
  2301. terminateOnPointerUp: this._globalOptions.terminateOnPointerUp,
  2302. };
  2303. },
  2304. enumerable: true,
  2305. configurable: true
  2306. });
  2307. Object.defineProperty(MatRipple.prototype, "rippleDisabled", {
  2308. /**
  2309. * Whether ripples on pointer-down are disabled or not.
  2310. * @docs-private Implemented as part of RippleTarget
  2311. */
  2312. get: /**
  2313. * Whether ripples on pointer-down are disabled or not.
  2314. * \@docs-private Implemented as part of RippleTarget
  2315. * @return {?}
  2316. */
  2317. function () {
  2318. return this.disabled || !!this._globalOptions.disabled;
  2319. },
  2320. enumerable: true,
  2321. configurable: true
  2322. });
  2323. /** Sets up the trigger event listeners if ripples are enabled. */
  2324. /**
  2325. * Sets up the trigger event listeners if ripples are enabled.
  2326. * @private
  2327. * @return {?}
  2328. */
  2329. MatRipple.prototype._setupTriggerEventsIfEnabled = /**
  2330. * Sets up the trigger event listeners if ripples are enabled.
  2331. * @private
  2332. * @return {?}
  2333. */
  2334. function () {
  2335. if (!this.disabled && this._isInitialized) {
  2336. this._rippleRenderer.setupTriggerEvents(this.trigger);
  2337. }
  2338. };
  2339. /** Launches a manual ripple at the specified coordinated or just by the ripple config. */
  2340. /**
  2341. * Launches a manual ripple at the specified coordinated or just by the ripple config.
  2342. * @param {?} configOrX
  2343. * @param {?=} y
  2344. * @param {?=} config
  2345. * @return {?}
  2346. */
  2347. MatRipple.prototype.launch = /**
  2348. * Launches a manual ripple at the specified coordinated or just by the ripple config.
  2349. * @param {?} configOrX
  2350. * @param {?=} y
  2351. * @param {?=} config
  2352. * @return {?}
  2353. */
  2354. function (configOrX, y, config) {
  2355. if (y === void 0) { y = 0; }
  2356. if (typeof configOrX === 'number') {
  2357. return this._rippleRenderer.fadeInRipple(configOrX, y, __assign({}, this.rippleConfig, config));
  2358. }
  2359. else {
  2360. return this._rippleRenderer.fadeInRipple(0, 0, __assign({}, this.rippleConfig, configOrX));
  2361. }
  2362. };
  2363. MatRipple.decorators = [
  2364. { type: core.Directive, args: [{
  2365. selector: '[mat-ripple], [matRipple]',
  2366. exportAs: 'matRipple',
  2367. host: {
  2368. 'class': 'mat-ripple',
  2369. '[class.mat-ripple-unbounded]': 'unbounded'
  2370. }
  2371. },] },
  2372. ];
  2373. /** @nocollapse */
  2374. MatRipple.ctorParameters = function () { return [
  2375. { type: core.ElementRef },
  2376. { type: core.NgZone },
  2377. { type: platform.Platform },
  2378. { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_RIPPLE_GLOBAL_OPTIONS,] }] },
  2379. { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
  2380. ]; };
  2381. MatRipple.propDecorators = {
  2382. color: [{ type: core.Input, args: ['matRippleColor',] }],
  2383. unbounded: [{ type: core.Input, args: ['matRippleUnbounded',] }],
  2384. centered: [{ type: core.Input, args: ['matRippleCentered',] }],
  2385. radius: [{ type: core.Input, args: ['matRippleRadius',] }],
  2386. animation: [{ type: core.Input, args: ['matRippleAnimation',] }],
  2387. disabled: [{ type: core.Input, args: ['matRippleDisabled',] }],
  2388. trigger: [{ type: core.Input, args: ['matRippleTrigger',] }]
  2389. };
  2390. return MatRipple;
  2391. }());
  2392. /**
  2393. * @fileoverview added by tsickle
  2394. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  2395. */
  2396. var MatRippleModule = /** @class */ (function () {
  2397. function MatRippleModule() {
  2398. }
  2399. MatRippleModule.decorators = [
  2400. { type: core.NgModule, args: [{
  2401. imports: [MatCommonModule, platform.PlatformModule],
  2402. exports: [MatRipple, MatCommonModule],
  2403. declarations: [MatRipple],
  2404. },] },
  2405. ];
  2406. return MatRippleModule;
  2407. }());
  2408. /**
  2409. * @fileoverview added by tsickle
  2410. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  2411. */
  2412. /**
  2413. * Component that shows a simplified checkbox without including any kind of "real" checkbox.
  2414. * Meant to be used when the checkbox is purely decorative and a large number of them will be
  2415. * included, such as for the options in a multi-select. Uses no SVGs or complex animations.
  2416. * Note that theming is meant to be handled by the parent element, e.g.
  2417. * `mat-primary .mat-pseudo-checkbox`.
  2418. *
  2419. * Note that this component will be completely invisible to screen-reader users. This is *not*
  2420. * interchangeable with `<mat-checkbox>` and should *not* be used if the user would directly
  2421. * interact with the checkbox. The pseudo-checkbox should only be used as an implementation detail
  2422. * of more complex components that appropriately handle selected / checked state.
  2423. * \@docs-private
  2424. */
  2425. var MatPseudoCheckbox = /** @class */ (function () {
  2426. function MatPseudoCheckbox(_animationMode) {
  2427. this._animationMode = _animationMode;
  2428. /**
  2429. * Display state of the checkbox.
  2430. */
  2431. this.state = 'unchecked';
  2432. /**
  2433. * Whether the checkbox is disabled.
  2434. */
  2435. this.disabled = false;
  2436. }
  2437. MatPseudoCheckbox.decorators = [
  2438. { type: core.Component, args: [{encapsulation: core.ViewEncapsulation.None,
  2439. changeDetection: core.ChangeDetectionStrategy.OnPush,
  2440. selector: 'mat-pseudo-checkbox',
  2441. 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}"],
  2442. template: '',
  2443. host: {
  2444. 'class': 'mat-pseudo-checkbox',
  2445. '[class.mat-pseudo-checkbox-indeterminate]': 'state === "indeterminate"',
  2446. '[class.mat-pseudo-checkbox-checked]': 'state === "checked"',
  2447. '[class.mat-pseudo-checkbox-disabled]': 'disabled',
  2448. '[class._mat-animation-noopable]': '_animationMode === "NoopAnimations"',
  2449. },
  2450. },] },
  2451. ];
  2452. /** @nocollapse */
  2453. MatPseudoCheckbox.ctorParameters = function () { return [
  2454. { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
  2455. ]; };
  2456. MatPseudoCheckbox.propDecorators = {
  2457. state: [{ type: core.Input }],
  2458. disabled: [{ type: core.Input }]
  2459. };
  2460. return MatPseudoCheckbox;
  2461. }());
  2462. /**
  2463. * @fileoverview added by tsickle
  2464. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  2465. */
  2466. var MatPseudoCheckboxModule = /** @class */ (function () {
  2467. function MatPseudoCheckboxModule() {
  2468. }
  2469. MatPseudoCheckboxModule.decorators = [
  2470. { type: core.NgModule, args: [{
  2471. exports: [MatPseudoCheckbox],
  2472. declarations: [MatPseudoCheckbox]
  2473. },] },
  2474. ];
  2475. return MatPseudoCheckboxModule;
  2476. }());
  2477. /**
  2478. * @fileoverview added by tsickle
  2479. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  2480. */
  2481. // Boilerplate for applying mixins to MatOptgroup.
  2482. /**
  2483. * \@docs-private
  2484. */
  2485. var
  2486. // Boilerplate for applying mixins to MatOptgroup.
  2487. /**
  2488. * \@docs-private
  2489. */
  2490. MatOptgroupBase = /** @class */ (function () {
  2491. function MatOptgroupBase() {
  2492. }
  2493. return MatOptgroupBase;
  2494. }());
  2495. /** @type {?} */
  2496. var _MatOptgroupMixinBase = mixinDisabled(MatOptgroupBase);
  2497. // Counter for unique group ids.
  2498. /** @type {?} */
  2499. var _uniqueOptgroupIdCounter = 0;
  2500. /**
  2501. * Component that is used to group instances of `mat-option`.
  2502. */
  2503. var MatOptgroup = /** @class */ (function (_super) {
  2504. __extends(MatOptgroup, _super);
  2505. function MatOptgroup() {
  2506. var _this = _super !== null && _super.apply(this, arguments) || this;
  2507. /**
  2508. * Unique id for the underlying label.
  2509. */
  2510. _this._labelId = "mat-optgroup-label-" + _uniqueOptgroupIdCounter++;
  2511. return _this;
  2512. }
  2513. MatOptgroup.decorators = [
  2514. { type: core.Component, args: [{selector: 'mat-optgroup',
  2515. exportAs: 'matOptgroup',
  2516. template: "<label class=\"mat-optgroup-label\" [id]=\"_labelId\">{{ label }}<ng-content></ng-content></label><ng-content select=\"mat-option, ng-container\"></ng-content>",
  2517. encapsulation: core.ViewEncapsulation.None,
  2518. changeDetection: core.ChangeDetectionStrategy.OnPush,
  2519. inputs: ['disabled'],
  2520. 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}"],
  2521. host: {
  2522. 'class': 'mat-optgroup',
  2523. 'role': 'group',
  2524. '[class.mat-optgroup-disabled]': 'disabled',
  2525. '[attr.aria-disabled]': 'disabled.toString()',
  2526. '[attr.aria-labelledby]': '_labelId',
  2527. }
  2528. },] },
  2529. ];
  2530. MatOptgroup.propDecorators = {
  2531. label: [{ type: core.Input }]
  2532. };
  2533. return MatOptgroup;
  2534. }(_MatOptgroupMixinBase));
  2535. /**
  2536. * @fileoverview added by tsickle
  2537. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  2538. */
  2539. /**
  2540. * Option IDs need to be unique across components, so this counter exists outside of
  2541. * the component definition.
  2542. * @type {?}
  2543. */
  2544. var _uniqueIdCounter = 0;
  2545. /**
  2546. * Event object emitted by MatOption when selected or deselected.
  2547. */
  2548. var /**
  2549. * Event object emitted by MatOption when selected or deselected.
  2550. */
  2551. MatOptionSelectionChange = /** @class */ (function () {
  2552. function MatOptionSelectionChange(source, isUserInput) {
  2553. if (isUserInput === void 0) { isUserInput = false; }
  2554. this.source = source;
  2555. this.isUserInput = isUserInput;
  2556. }
  2557. return MatOptionSelectionChange;
  2558. }());
  2559. /**
  2560. * Injection token used to provide the parent component to options.
  2561. * @type {?}
  2562. */
  2563. var MAT_OPTION_PARENT_COMPONENT = new core.InjectionToken('MAT_OPTION_PARENT_COMPONENT');
  2564. /**
  2565. * Single option inside of a `<mat-select>` element.
  2566. */
  2567. var MatOption = /** @class */ (function () {
  2568. function MatOption(_element, _changeDetectorRef, _parent, group) {
  2569. this._element = _element;
  2570. this._changeDetectorRef = _changeDetectorRef;
  2571. this._parent = _parent;
  2572. this.group = group;
  2573. this._selected = false;
  2574. this._active = false;
  2575. this._disabled = false;
  2576. this._mostRecentViewValue = '';
  2577. /**
  2578. * The unique ID of the option.
  2579. */
  2580. this.id = "mat-option-" + _uniqueIdCounter++;
  2581. /**
  2582. * Event emitted when the option is selected or deselected.
  2583. */
  2584. // tslint:disable-next-line:no-output-on-prefix
  2585. this.onSelectionChange = new core.EventEmitter();
  2586. /**
  2587. * Emits when the state of the option changes and any parents have to be notified.
  2588. */
  2589. this._stateChanges = new rxjs.Subject();
  2590. }
  2591. Object.defineProperty(MatOption.prototype, "multiple", {
  2592. /** Whether the wrapping component is in multiple selection mode. */
  2593. get: /**
  2594. * Whether the wrapping component is in multiple selection mode.
  2595. * @return {?}
  2596. */
  2597. function () { return this._parent && this._parent.multiple; },
  2598. enumerable: true,
  2599. configurable: true
  2600. });
  2601. Object.defineProperty(MatOption.prototype, "selected", {
  2602. /** Whether or not the option is currently selected. */
  2603. get: /**
  2604. * Whether or not the option is currently selected.
  2605. * @return {?}
  2606. */
  2607. function () { return this._selected; },
  2608. enumerable: true,
  2609. configurable: true
  2610. });
  2611. Object.defineProperty(MatOption.prototype, "disabled", {
  2612. /** Whether the option is disabled. */
  2613. get: /**
  2614. * Whether the option is disabled.
  2615. * @return {?}
  2616. */
  2617. function () { return (this.group && this.group.disabled) || this._disabled; },
  2618. set: /**
  2619. * @param {?} value
  2620. * @return {?}
  2621. */
  2622. function (value) { this._disabled = coercion.coerceBooleanProperty(value); },
  2623. enumerable: true,
  2624. configurable: true
  2625. });
  2626. Object.defineProperty(MatOption.prototype, "disableRipple", {
  2627. /** Whether ripples for the option are disabled. */
  2628. get: /**
  2629. * Whether ripples for the option are disabled.
  2630. * @return {?}
  2631. */
  2632. function () { return this._parent && this._parent.disableRipple; },
  2633. enumerable: true,
  2634. configurable: true
  2635. });
  2636. Object.defineProperty(MatOption.prototype, "active", {
  2637. /**
  2638. * Whether or not the option is currently active and ready to be selected.
  2639. * An active option displays styles as if it is focused, but the
  2640. * focus is actually retained somewhere else. This comes in handy
  2641. * for components like autocomplete where focus must remain on the input.
  2642. */
  2643. get: /**
  2644. * Whether or not the option is currently active and ready to be selected.
  2645. * An active option displays styles as if it is focused, but the
  2646. * focus is actually retained somewhere else. This comes in handy
  2647. * for components like autocomplete where focus must remain on the input.
  2648. * @return {?}
  2649. */
  2650. function () {
  2651. return this._active;
  2652. },
  2653. enumerable: true,
  2654. configurable: true
  2655. });
  2656. Object.defineProperty(MatOption.prototype, "viewValue", {
  2657. /**
  2658. * The displayed value of the option. It is necessary to show the selected option in the
  2659. * select's trigger.
  2660. */
  2661. get: /**
  2662. * The displayed value of the option. It is necessary to show the selected option in the
  2663. * select's trigger.
  2664. * @return {?}
  2665. */
  2666. function () {
  2667. // TODO(kara): Add input property alternative for node envs.
  2668. return (this._getHostElement().textContent || '').trim();
  2669. },
  2670. enumerable: true,
  2671. configurable: true
  2672. });
  2673. /** Selects the option. */
  2674. /**
  2675. * Selects the option.
  2676. * @return {?}
  2677. */
  2678. MatOption.prototype.select = /**
  2679. * Selects the option.
  2680. * @return {?}
  2681. */
  2682. function () {
  2683. if (!this._selected) {
  2684. this._selected = true;
  2685. this._changeDetectorRef.markForCheck();
  2686. this._emitSelectionChangeEvent();
  2687. }
  2688. };
  2689. /** Deselects the option. */
  2690. /**
  2691. * Deselects the option.
  2692. * @return {?}
  2693. */
  2694. MatOption.prototype.deselect = /**
  2695. * Deselects the option.
  2696. * @return {?}
  2697. */
  2698. function () {
  2699. if (this._selected) {
  2700. this._selected = false;
  2701. this._changeDetectorRef.markForCheck();
  2702. this._emitSelectionChangeEvent();
  2703. }
  2704. };
  2705. /** Sets focus onto this option. */
  2706. /**
  2707. * Sets focus onto this option.
  2708. * @param {?=} _origin
  2709. * @param {?=} options
  2710. * @return {?}
  2711. */
  2712. MatOption.prototype.focus = /**
  2713. * Sets focus onto this option.
  2714. * @param {?=} _origin
  2715. * @param {?=} options
  2716. * @return {?}
  2717. */
  2718. function (_origin, options) {
  2719. // Note that we aren't using `_origin`, but we need to keep it because some internal consumers
  2720. // use `MatOption` in a `FocusKeyManager` and we need it to match `FocusableOption`.
  2721. /** @type {?} */
  2722. var element = this._getHostElement();
  2723. if (typeof element.focus === 'function') {
  2724. element.focus(options);
  2725. }
  2726. };
  2727. /**
  2728. * This method sets display styles on the option to make it appear
  2729. * active. This is used by the ActiveDescendantKeyManager so key
  2730. * events will display the proper options as active on arrow key events.
  2731. */
  2732. /**
  2733. * This method sets display styles on the option to make it appear
  2734. * active. This is used by the ActiveDescendantKeyManager so key
  2735. * events will display the proper options as active on arrow key events.
  2736. * @return {?}
  2737. */
  2738. MatOption.prototype.setActiveStyles = /**
  2739. * This method sets display styles on the option to make it appear
  2740. * active. This is used by the ActiveDescendantKeyManager so key
  2741. * events will display the proper options as active on arrow key events.
  2742. * @return {?}
  2743. */
  2744. function () {
  2745. if (!this._active) {
  2746. this._active = true;
  2747. this._changeDetectorRef.markForCheck();
  2748. }
  2749. };
  2750. /**
  2751. * This method removes display styles on the option that made it appear
  2752. * active. This is used by the ActiveDescendantKeyManager so key
  2753. * events will display the proper options as active on arrow key events.
  2754. */
  2755. /**
  2756. * This method removes display styles on the option that made it appear
  2757. * active. This is used by the ActiveDescendantKeyManager so key
  2758. * events will display the proper options as active on arrow key events.
  2759. * @return {?}
  2760. */
  2761. MatOption.prototype.setInactiveStyles = /**
  2762. * This method removes display styles on the option that made it appear
  2763. * active. This is used by the ActiveDescendantKeyManager so key
  2764. * events will display the proper options as active on arrow key events.
  2765. * @return {?}
  2766. */
  2767. function () {
  2768. if (this._active) {
  2769. this._active = false;
  2770. this._changeDetectorRef.markForCheck();
  2771. }
  2772. };
  2773. /** Gets the label to be used when determining whether the option should be focused. */
  2774. /**
  2775. * Gets the label to be used when determining whether the option should be focused.
  2776. * @return {?}
  2777. */
  2778. MatOption.prototype.getLabel = /**
  2779. * Gets the label to be used when determining whether the option should be focused.
  2780. * @return {?}
  2781. */
  2782. function () {
  2783. return this.viewValue;
  2784. };
  2785. /** Ensures the option is selected when activated from the keyboard. */
  2786. /**
  2787. * Ensures the option is selected when activated from the keyboard.
  2788. * @param {?} event
  2789. * @return {?}
  2790. */
  2791. MatOption.prototype._handleKeydown = /**
  2792. * Ensures the option is selected when activated from the keyboard.
  2793. * @param {?} event
  2794. * @return {?}
  2795. */
  2796. function (event) {
  2797. if ((event.keyCode === keycodes.ENTER || event.keyCode === keycodes.SPACE) && !keycodes.hasModifierKey(event)) {
  2798. this._selectViaInteraction();
  2799. // Prevent the page from scrolling down and form submits.
  2800. event.preventDefault();
  2801. }
  2802. };
  2803. /**
  2804. * `Selects the option while indicating the selection came from the user. Used to
  2805. * determine if the select's view -> model callback should be invoked.`
  2806. */
  2807. /**
  2808. * `Selects the option while indicating the selection came from the user. Used to
  2809. * determine if the select's view -> model callback should be invoked.`
  2810. * @return {?}
  2811. */
  2812. MatOption.prototype._selectViaInteraction = /**
  2813. * `Selects the option while indicating the selection came from the user. Used to
  2814. * determine if the select's view -> model callback should be invoked.`
  2815. * @return {?}
  2816. */
  2817. function () {
  2818. if (!this.disabled) {
  2819. this._selected = this.multiple ? !this._selected : true;
  2820. this._changeDetectorRef.markForCheck();
  2821. this._emitSelectionChangeEvent(true);
  2822. }
  2823. };
  2824. /**
  2825. * Gets the `aria-selected` value for the option. We explicitly omit the `aria-selected`
  2826. * attribute from single-selection, unselected options. Including the `aria-selected="false"`
  2827. * attributes adds a significant amount of noise to screen-reader users without providing useful
  2828. * information.
  2829. */
  2830. /**
  2831. * Gets the `aria-selected` value for the option. We explicitly omit the `aria-selected`
  2832. * attribute from single-selection, unselected options. Including the `aria-selected="false"`
  2833. * attributes adds a significant amount of noise to screen-reader users without providing useful
  2834. * information.
  2835. * @return {?}
  2836. */
  2837. MatOption.prototype._getAriaSelected = /**
  2838. * Gets the `aria-selected` value for the option. We explicitly omit the `aria-selected`
  2839. * attribute from single-selection, unselected options. Including the `aria-selected="false"`
  2840. * attributes adds a significant amount of noise to screen-reader users without providing useful
  2841. * information.
  2842. * @return {?}
  2843. */
  2844. function () {
  2845. return this.selected || (this.multiple ? false : null);
  2846. };
  2847. /** Returns the correct tabindex for the option depending on disabled state. */
  2848. /**
  2849. * Returns the correct tabindex for the option depending on disabled state.
  2850. * @return {?}
  2851. */
  2852. MatOption.prototype._getTabIndex = /**
  2853. * Returns the correct tabindex for the option depending on disabled state.
  2854. * @return {?}
  2855. */
  2856. function () {
  2857. return this.disabled ? '-1' : '0';
  2858. };
  2859. /** Gets the host DOM element. */
  2860. /**
  2861. * Gets the host DOM element.
  2862. * @return {?}
  2863. */
  2864. MatOption.prototype._getHostElement = /**
  2865. * Gets the host DOM element.
  2866. * @return {?}
  2867. */
  2868. function () {
  2869. return this._element.nativeElement;
  2870. };
  2871. /**
  2872. * @return {?}
  2873. */
  2874. MatOption.prototype.ngAfterViewChecked = /**
  2875. * @return {?}
  2876. */
  2877. function () {
  2878. // Since parent components could be using the option's label to display the selected values
  2879. // (e.g. `mat-select`) and they don't have a way of knowing if the option's label has changed
  2880. // we have to check for changes in the DOM ourselves and dispatch an event. These checks are
  2881. // relatively cheap, however we still limit them only to selected options in order to avoid
  2882. // hitting the DOM too often.
  2883. if (this._selected) {
  2884. /** @type {?} */
  2885. var viewValue = this.viewValue;
  2886. if (viewValue !== this._mostRecentViewValue) {
  2887. this._mostRecentViewValue = viewValue;
  2888. this._stateChanges.next();
  2889. }
  2890. }
  2891. };
  2892. /**
  2893. * @return {?}
  2894. */
  2895. MatOption.prototype.ngOnDestroy = /**
  2896. * @return {?}
  2897. */
  2898. function () {
  2899. this._stateChanges.complete();
  2900. };
  2901. /** Emits the selection change event. */
  2902. /**
  2903. * Emits the selection change event.
  2904. * @private
  2905. * @param {?=} isUserInput
  2906. * @return {?}
  2907. */
  2908. MatOption.prototype._emitSelectionChangeEvent = /**
  2909. * Emits the selection change event.
  2910. * @private
  2911. * @param {?=} isUserInput
  2912. * @return {?}
  2913. */
  2914. function (isUserInput) {
  2915. if (isUserInput === void 0) { isUserInput = false; }
  2916. this.onSelectionChange.emit(new MatOptionSelectionChange(this, isUserInput));
  2917. };
  2918. MatOption.decorators = [
  2919. { type: core.Component, args: [{selector: 'mat-option',
  2920. exportAs: 'matOption',
  2921. host: {
  2922. 'role': 'option',
  2923. '[attr.tabindex]': '_getTabIndex()',
  2924. '[class.mat-selected]': 'selected',
  2925. '[class.mat-option-multiple]': 'multiple',
  2926. '[class.mat-active]': 'active',
  2927. '[id]': 'id',
  2928. '[attr.aria-selected]': '_getAriaSelected()',
  2929. '[attr.aria-disabled]': 'disabled.toString()',
  2930. '[class.mat-option-disabled]': 'disabled',
  2931. '(click)': '_selectViaInteraction()',
  2932. '(keydown)': '_handleKeydown($event)',
  2933. 'class': 'mat-option',
  2934. },
  2935. 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}"],
  2936. 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>",
  2937. encapsulation: core.ViewEncapsulation.None,
  2938. changeDetection: core.ChangeDetectionStrategy.OnPush,
  2939. },] },
  2940. ];
  2941. /** @nocollapse */
  2942. MatOption.ctorParameters = function () { return [
  2943. { type: core.ElementRef },
  2944. { type: core.ChangeDetectorRef },
  2945. { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_OPTION_PARENT_COMPONENT,] }] },
  2946. { type: MatOptgroup, decorators: [{ type: core.Optional }] }
  2947. ]; };
  2948. MatOption.propDecorators = {
  2949. value: [{ type: core.Input }],
  2950. id: [{ type: core.Input }],
  2951. disabled: [{ type: core.Input }],
  2952. onSelectionChange: [{ type: core.Output }]
  2953. };
  2954. return MatOption;
  2955. }());
  2956. /**
  2957. * Counts the amount of option group labels that precede the specified option.
  2958. * \@docs-private
  2959. * @param {?} optionIndex Index of the option at which to start counting.
  2960. * @param {?} options Flat list of all of the options.
  2961. * @param {?} optionGroups Flat list of all of the option groups.
  2962. * @return {?}
  2963. */
  2964. function _countGroupLabelsBeforeOption(optionIndex, options, optionGroups) {
  2965. if (optionGroups.length) {
  2966. /** @type {?} */
  2967. var optionsArray = options.toArray();
  2968. /** @type {?} */
  2969. var groups = optionGroups.toArray();
  2970. /** @type {?} */
  2971. var groupCounter = 0;
  2972. for (var i = 0; i < optionIndex + 1; i++) {
  2973. if (optionsArray[i].group && optionsArray[i].group === groups[groupCounter]) {
  2974. groupCounter++;
  2975. }
  2976. }
  2977. return groupCounter;
  2978. }
  2979. return 0;
  2980. }
  2981. /**
  2982. * Determines the position to which to scroll a panel in order for an option to be into view.
  2983. * \@docs-private
  2984. * @param {?} optionIndex Index of the option to be scrolled into the view.
  2985. * @param {?} optionHeight Height of the options.
  2986. * @param {?} currentScrollPosition Current scroll position of the panel.
  2987. * @param {?} panelHeight Height of the panel.
  2988. * @return {?}
  2989. */
  2990. function _getOptionScrollPosition(optionIndex, optionHeight, currentScrollPosition, panelHeight) {
  2991. /** @type {?} */
  2992. var optionOffset = optionIndex * optionHeight;
  2993. if (optionOffset < currentScrollPosition) {
  2994. return optionOffset;
  2995. }
  2996. if (optionOffset + optionHeight > currentScrollPosition + panelHeight) {
  2997. return Math.max(0, optionOffset - panelHeight + optionHeight);
  2998. }
  2999. return currentScrollPosition;
  3000. }
  3001. /**
  3002. * @fileoverview added by tsickle
  3003. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  3004. */
  3005. var MatOptionModule = /** @class */ (function () {
  3006. function MatOptionModule() {
  3007. }
  3008. MatOptionModule.decorators = [
  3009. { type: core.NgModule, args: [{
  3010. imports: [MatRippleModule, common.CommonModule, MatPseudoCheckboxModule],
  3011. exports: [MatOption, MatOptgroup],
  3012. declarations: [MatOption, MatOptgroup]
  3013. },] },
  3014. ];
  3015. return MatOptionModule;
  3016. }());
  3017. /**
  3018. * @fileoverview added by tsickle
  3019. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  3020. */
  3021. /**
  3022. * InjectionToken that can be used to specify the global label options.
  3023. * @type {?}
  3024. */
  3025. var MAT_LABEL_GLOBAL_OPTIONS = new core.InjectionToken('mat-label-global-options');
  3026. /**
  3027. * @fileoverview added by tsickle
  3028. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  3029. */
  3030. /**
  3031. * When constructing a Date, the month is zero-based. This can be confusing, since people are
  3032. * used to seeing them one-based. So we create these aliases to make writing the tests easier.
  3033. * \@docs-private
  3034. * \@breaking-change 8.0.0 Remove this with V8 since it was only targeted for testing.
  3035. * @type {?}
  3036. */
  3037. var JAN = 0;
  3038. /** @type {?} */
  3039. var FEB = 1;
  3040. /** @type {?} */
  3041. var MAR = 2;
  3042. /** @type {?} */
  3043. var APR = 3;
  3044. /** @type {?} */
  3045. var MAY = 4;
  3046. /** @type {?} */
  3047. var JUN = 5;
  3048. /** @type {?} */
  3049. var JUL = 6;
  3050. /** @type {?} */
  3051. var AUG = 7;
  3052. /** @type {?} */
  3053. var SEP = 8;
  3054. /** @type {?} */
  3055. var OCT = 9;
  3056. /** @type {?} */
  3057. var NOV = 10;
  3058. /** @type {?} */
  3059. var DEC = 11;
  3060. /**
  3061. * @fileoverview added by tsickle
  3062. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  3063. */
  3064. /** @type {?} */
  3065. var nextUniqueId = 0;
  3066. /**
  3067. * Single error message to be shown underneath the form field.
  3068. */
  3069. var MatError = /** @class */ (function () {
  3070. function MatError() {
  3071. this.id = "mat-error-" + nextUniqueId++;
  3072. }
  3073. MatError.decorators = [
  3074. { type: core.Directive, args: [{
  3075. selector: 'mat-error',
  3076. host: {
  3077. 'class': 'mat-error',
  3078. 'role': 'alert',
  3079. '[attr.id]': 'id',
  3080. }
  3081. },] },
  3082. ];
  3083. MatError.propDecorators = {
  3084. id: [{ type: core.Input }]
  3085. };
  3086. return MatError;
  3087. }());
  3088. /**
  3089. * @fileoverview added by tsickle
  3090. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  3091. */
  3092. /**
  3093. * Animations used by the MatFormField.
  3094. * \@docs-private
  3095. * @type {?}
  3096. */
  3097. var matFormFieldAnimations = {
  3098. /**
  3099. * Animation that transitions the form field's error and hint messages.
  3100. */
  3101. transitionMessages: animations$1.trigger('transitionMessages', [
  3102. // TODO(mmalerba): Use angular animations for label animation as well.
  3103. animations$1.state('enter', animations$1.style({ opacity: 1, transform: 'translateY(0%)' })),
  3104. animations$1.transition('void => enter', [
  3105. animations$1.style({ opacity: 0, transform: 'translateY(-100%)' }),
  3106. animations$1.animate('300ms cubic-bezier(0.55, 0, 0.55, 0.2)'),
  3107. ]),
  3108. ])
  3109. };
  3110. /**
  3111. * @fileoverview added by tsickle
  3112. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  3113. */
  3114. /**
  3115. * An interface which allows a control to work inside of a `MatFormField`.
  3116. * @abstract
  3117. * @template T
  3118. */
  3119. var /**
  3120. * An interface which allows a control to work inside of a `MatFormField`.
  3121. * @abstract
  3122. * @template T
  3123. */
  3124. MatFormFieldControl = /** @class */ (function () {
  3125. function MatFormFieldControl() {
  3126. }
  3127. return MatFormFieldControl;
  3128. }());
  3129. /**
  3130. * @fileoverview added by tsickle
  3131. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  3132. */
  3133. /**
  3134. * \@docs-private
  3135. * @return {?}
  3136. */
  3137. function getMatFormFieldPlaceholderConflictError() {
  3138. return Error('Placeholder attribute and child element were both specified.');
  3139. }
  3140. /**
  3141. * \@docs-private
  3142. * @param {?} align
  3143. * @return {?}
  3144. */
  3145. function getMatFormFieldDuplicatedHintError(align) {
  3146. return Error("A hint was already declared for 'align=\"" + align + "\"'.");
  3147. }
  3148. /**
  3149. * \@docs-private
  3150. * @return {?}
  3151. */
  3152. function getMatFormFieldMissingControlError() {
  3153. return Error('mat-form-field must contain a MatFormFieldControl.');
  3154. }
  3155. /**
  3156. * @fileoverview added by tsickle
  3157. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  3158. */
  3159. /** @type {?} */
  3160. var nextUniqueId$1 = 0;
  3161. /**
  3162. * Hint text to be shown underneath the form field control.
  3163. */
  3164. var MatHint = /** @class */ (function () {
  3165. function MatHint() {
  3166. /**
  3167. * Whether to align the hint label at the start or end of the line.
  3168. */
  3169. this.align = 'start';
  3170. /**
  3171. * Unique ID for the hint. Used for the aria-describedby on the form field control.
  3172. */
  3173. this.id = "mat-hint-" + nextUniqueId$1++;
  3174. }
  3175. MatHint.decorators = [
  3176. { type: core.Directive, args: [{
  3177. selector: 'mat-hint',
  3178. host: {
  3179. 'class': 'mat-hint',
  3180. '[class.mat-right]': 'align == "end"',
  3181. '[attr.id]': 'id',
  3182. // Remove align attribute to prevent it from interfering with layout.
  3183. '[attr.align]': 'null',
  3184. }
  3185. },] },
  3186. ];
  3187. MatHint.propDecorators = {
  3188. align: [{ type: core.Input }],
  3189. id: [{ type: core.Input }]
  3190. };
  3191. return MatHint;
  3192. }());
  3193. /**
  3194. * @fileoverview added by tsickle
  3195. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  3196. */
  3197. /**
  3198. * The floating label for a `mat-form-field`.
  3199. */
  3200. var MatLabel = /** @class */ (function () {
  3201. function MatLabel() {
  3202. }
  3203. MatLabel.decorators = [
  3204. { type: core.Directive, args: [{
  3205. selector: 'mat-label'
  3206. },] },
  3207. ];
  3208. return MatLabel;
  3209. }());
  3210. /**
  3211. * @fileoverview added by tsickle
  3212. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  3213. */
  3214. /**
  3215. * The placeholder text for an `MatFormField`.
  3216. * @deprecated Use `<mat-label>` to specify the label and the `placeholder` attribute to specify the
  3217. * placeholder.
  3218. * \@breaking-change 8.0.0
  3219. */
  3220. var MatPlaceholder = /** @class */ (function () {
  3221. function MatPlaceholder() {
  3222. }
  3223. MatPlaceholder.decorators = [
  3224. { type: core.Directive, args: [{
  3225. selector: 'mat-placeholder'
  3226. },] },
  3227. ];
  3228. return MatPlaceholder;
  3229. }());
  3230. /**
  3231. * @fileoverview added by tsickle
  3232. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  3233. */
  3234. /**
  3235. * Prefix to be placed in front of the form field.
  3236. */
  3237. var MatPrefix = /** @class */ (function () {
  3238. function MatPrefix() {
  3239. }
  3240. MatPrefix.decorators = [
  3241. { type: core.Directive, args: [{
  3242. selector: '[matPrefix]',
  3243. },] },
  3244. ];
  3245. return MatPrefix;
  3246. }());
  3247. /**
  3248. * @fileoverview added by tsickle
  3249. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  3250. */
  3251. /**
  3252. * Suffix to be placed at the end of the form field.
  3253. */
  3254. var MatSuffix = /** @class */ (function () {
  3255. function MatSuffix() {
  3256. }
  3257. MatSuffix.decorators = [
  3258. { type: core.Directive, args: [{
  3259. selector: '[matSuffix]',
  3260. },] },
  3261. ];
  3262. return MatSuffix;
  3263. }());
  3264. /**
  3265. * @fileoverview added by tsickle
  3266. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  3267. */
  3268. /** @type {?} */
  3269. var nextUniqueId$2 = 0;
  3270. /** @type {?} */
  3271. var floatingLabelScale = 0.75;
  3272. /** @type {?} */
  3273. var outlineGapPadding = 5;
  3274. /**
  3275. * Boilerplate for applying mixins to MatFormField.
  3276. * \@docs-private
  3277. */
  3278. var /**
  3279. * Boilerplate for applying mixins to MatFormField.
  3280. * \@docs-private
  3281. */
  3282. MatFormFieldBase = /** @class */ (function () {
  3283. function MatFormFieldBase(_elementRef) {
  3284. this._elementRef = _elementRef;
  3285. }
  3286. return MatFormFieldBase;
  3287. }());
  3288. /**
  3289. * Base class to which we're applying the form field mixins.
  3290. * \@docs-private
  3291. * @type {?}
  3292. */
  3293. var _MatFormFieldMixinBase = mixinColor(MatFormFieldBase, 'primary');
  3294. /**
  3295. * Injection token that can be used to configure the
  3296. * default options for all form field within an app.
  3297. * @type {?}
  3298. */
  3299. var MAT_FORM_FIELD_DEFAULT_OPTIONS = new core.InjectionToken('MAT_FORM_FIELD_DEFAULT_OPTIONS');
  3300. /**
  3301. * Container for form controls that applies Material Design styling and behavior.
  3302. */
  3303. var MatFormField = /** @class */ (function (_super) {
  3304. __extends(MatFormField, _super);
  3305. function MatFormField(_elementRef, _changeDetectorRef, labelOptions, _dir, _defaults, _platform, _ngZone, _animationMode) {
  3306. var _this = _super.call(this, _elementRef) || this;
  3307. _this._elementRef = _elementRef;
  3308. _this._changeDetectorRef = _changeDetectorRef;
  3309. _this._dir = _dir;
  3310. _this._defaults = _defaults;
  3311. _this._platform = _platform;
  3312. _this._ngZone = _ngZone;
  3313. /**
  3314. * Whether the outline gap needs to be calculated
  3315. * immediately on the next change detection run.
  3316. */
  3317. _this._outlineGapCalculationNeededImmediately = false;
  3318. /**
  3319. * Whether the outline gap needs to be calculated next time the zone has stabilized.
  3320. */
  3321. _this._outlineGapCalculationNeededOnStable = false;
  3322. _this._destroyed = new rxjs.Subject();
  3323. /**
  3324. * Override for the logic that disables the label animation in certain cases.
  3325. */
  3326. _this._showAlwaysAnimate = false;
  3327. /**
  3328. * State of the mat-hint and mat-error animations.
  3329. */
  3330. _this._subscriptAnimationState = '';
  3331. _this._hintLabel = '';
  3332. // Unique id for the hint label.
  3333. _this._hintLabelId = "mat-hint-" + nextUniqueId$2++;
  3334. // Unique id for the internal form field label.
  3335. _this._labelId = "mat-form-field-label-" + nextUniqueId$2++;
  3336. _this._labelOptions = labelOptions ? labelOptions : {};
  3337. _this.floatLabel = _this._labelOptions.float || 'auto';
  3338. _this._animationsEnabled = _animationMode !== 'NoopAnimations';
  3339. // Set the default through here so we invoke the setter on the first run.
  3340. _this.appearance = (_defaults && _defaults.appearance) ? _defaults.appearance : 'legacy';
  3341. return _this;
  3342. }
  3343. Object.defineProperty(MatFormField.prototype, "appearance", {
  3344. /** The form-field appearance style. */
  3345. get: /**
  3346. * The form-field appearance style.
  3347. * @return {?}
  3348. */
  3349. function () { return this._appearance; },
  3350. set: /**
  3351. * @param {?} value
  3352. * @return {?}
  3353. */
  3354. function (value) {
  3355. /** @type {?} */
  3356. var oldValue = this._appearance;
  3357. this._appearance = value || (this._defaults && this._defaults.appearance) || 'legacy';
  3358. if (this._appearance === 'outline' && oldValue !== value) {
  3359. this._outlineGapCalculationNeededOnStable = true;
  3360. }
  3361. },
  3362. enumerable: true,
  3363. configurable: true
  3364. });
  3365. Object.defineProperty(MatFormField.prototype, "hideRequiredMarker", {
  3366. /** Whether the required marker should be hidden. */
  3367. get: /**
  3368. * Whether the required marker should be hidden.
  3369. * @return {?}
  3370. */
  3371. function () { return this._hideRequiredMarker; },
  3372. set: /**
  3373. * @param {?} value
  3374. * @return {?}
  3375. */
  3376. function (value) {
  3377. this._hideRequiredMarker = coercion.coerceBooleanProperty(value);
  3378. },
  3379. enumerable: true,
  3380. configurable: true
  3381. });
  3382. Object.defineProperty(MatFormField.prototype, "_shouldAlwaysFloat", {
  3383. /** Whether the floating label should always float or not. */
  3384. get: /**
  3385. * Whether the floating label should always float or not.
  3386. * @return {?}
  3387. */
  3388. function () {
  3389. return this.floatLabel === 'always' && !this._showAlwaysAnimate;
  3390. },
  3391. enumerable: true,
  3392. configurable: true
  3393. });
  3394. Object.defineProperty(MatFormField.prototype, "_canLabelFloat", {
  3395. /** Whether the label can float or not. */
  3396. get: /**
  3397. * Whether the label can float or not.
  3398. * @return {?}
  3399. */
  3400. function () { return this.floatLabel !== 'never'; },
  3401. enumerable: true,
  3402. configurable: true
  3403. });
  3404. Object.defineProperty(MatFormField.prototype, "hintLabel", {
  3405. /** Text for the form field hint. */
  3406. get: /**
  3407. * Text for the form field hint.
  3408. * @return {?}
  3409. */
  3410. function () { return this._hintLabel; },
  3411. set: /**
  3412. * @param {?} value
  3413. * @return {?}
  3414. */
  3415. function (value) {
  3416. this._hintLabel = value;
  3417. this._processHints();
  3418. },
  3419. enumerable: true,
  3420. configurable: true
  3421. });
  3422. Object.defineProperty(MatFormField.prototype, "floatLabel", {
  3423. /**
  3424. * Whether the label should always float, never float or float as the user types.
  3425. *
  3426. * Note: only the legacy appearance supports the `never` option. `never` was originally added as a
  3427. * way to make the floating label emulate the behavior of a standard input placeholder. However
  3428. * the form field now supports both floating labels and placeholders. Therefore in the non-legacy
  3429. * appearances the `never` option has been disabled in favor of just using the placeholder.
  3430. */
  3431. get: /**
  3432. * Whether the label should always float, never float or float as the user types.
  3433. *
  3434. * Note: only the legacy appearance supports the `never` option. `never` was originally added as a
  3435. * way to make the floating label emulate the behavior of a standard input placeholder. However
  3436. * the form field now supports both floating labels and placeholders. Therefore in the non-legacy
  3437. * appearances the `never` option has been disabled in favor of just using the placeholder.
  3438. * @return {?}
  3439. */
  3440. function () {
  3441. return this.appearance !== 'legacy' && this._floatLabel === 'never' ? 'auto' : this._floatLabel;
  3442. },
  3443. set: /**
  3444. * @param {?} value
  3445. * @return {?}
  3446. */
  3447. function (value) {
  3448. if (value !== this._floatLabel) {
  3449. this._floatLabel = value || this._labelOptions.float || 'auto';
  3450. this._changeDetectorRef.markForCheck();
  3451. }
  3452. },
  3453. enumerable: true,
  3454. configurable: true
  3455. });
  3456. Object.defineProperty(MatFormField.prototype, "_control", {
  3457. get: /**
  3458. * @return {?}
  3459. */
  3460. function () {
  3461. // TODO(crisbeto): we need this hacky workaround in order to support both Ivy
  3462. // and ViewEngine. We should clean this up once Ivy is the default renderer.
  3463. return this._explicitFormFieldControl || this._controlNonStatic || this._controlStatic;
  3464. },
  3465. set: /**
  3466. * @param {?} value
  3467. * @return {?}
  3468. */
  3469. function (value) {
  3470. this._explicitFormFieldControl = value;
  3471. },
  3472. enumerable: true,
  3473. configurable: true
  3474. });
  3475. Object.defineProperty(MatFormField.prototype, "_labelChild", {
  3476. get: /**
  3477. * @return {?}
  3478. */
  3479. function () {
  3480. return this._labelChildNonStatic || this._labelChildStatic;
  3481. },
  3482. enumerable: true,
  3483. configurable: true
  3484. });
  3485. /**
  3486. * Gets an ElementRef for the element that a overlay attached to the form-field should be
  3487. * positioned relative to.
  3488. */
  3489. /**
  3490. * Gets an ElementRef for the element that a overlay attached to the form-field should be
  3491. * positioned relative to.
  3492. * @return {?}
  3493. */
  3494. MatFormField.prototype.getConnectedOverlayOrigin = /**
  3495. * Gets an ElementRef for the element that a overlay attached to the form-field should be
  3496. * positioned relative to.
  3497. * @return {?}
  3498. */
  3499. function () {
  3500. return this._connectionContainerRef || this._elementRef;
  3501. };
  3502. /**
  3503. * @return {?}
  3504. */
  3505. MatFormField.prototype.ngAfterContentInit = /**
  3506. * @return {?}
  3507. */
  3508. function () {
  3509. var _this = this;
  3510. this._validateControlChild();
  3511. /** @type {?} */
  3512. var control = this._control;
  3513. if (control.controlType) {
  3514. this._elementRef.nativeElement.classList.add("mat-form-field-type-" + control.controlType);
  3515. }
  3516. // Subscribe to changes in the child control state in order to update the form field UI.
  3517. control.stateChanges.pipe(operators.startWith((/** @type {?} */ (null)))).subscribe((/**
  3518. * @return {?}
  3519. */
  3520. function () {
  3521. _this._validatePlaceholders();
  3522. _this._syncDescribedByIds();
  3523. _this._changeDetectorRef.markForCheck();
  3524. }));
  3525. // Run change detection if the value changes.
  3526. if (control.ngControl && control.ngControl.valueChanges) {
  3527. control.ngControl.valueChanges
  3528. .pipe(operators.takeUntil(this._destroyed))
  3529. .subscribe((/**
  3530. * @return {?}
  3531. */
  3532. function () { return _this._changeDetectorRef.markForCheck(); }));
  3533. }
  3534. // Note that we have to run outside of the `NgZone` explicitly,
  3535. // in order to avoid throwing users into an infinite loop
  3536. // if `zone-patch-rxjs` is included.
  3537. this._ngZone.runOutsideAngular((/**
  3538. * @return {?}
  3539. */
  3540. function () {
  3541. _this._ngZone.onStable.asObservable().pipe(operators.takeUntil(_this._destroyed)).subscribe((/**
  3542. * @return {?}
  3543. */
  3544. function () {
  3545. if (_this._outlineGapCalculationNeededOnStable) {
  3546. _this.updateOutlineGap();
  3547. }
  3548. }));
  3549. }));
  3550. // Run change detection and update the outline if the suffix or prefix changes.
  3551. rxjs.merge(this._prefixChildren.changes, this._suffixChildren.changes).subscribe((/**
  3552. * @return {?}
  3553. */
  3554. function () {
  3555. _this._outlineGapCalculationNeededOnStable = true;
  3556. _this._changeDetectorRef.markForCheck();
  3557. }));
  3558. // Re-validate when the number of hints changes.
  3559. this._hintChildren.changes.pipe(operators.startWith(null)).subscribe((/**
  3560. * @return {?}
  3561. */
  3562. function () {
  3563. _this._processHints();
  3564. _this._changeDetectorRef.markForCheck();
  3565. }));
  3566. // Update the aria-described by when the number of errors changes.
  3567. this._errorChildren.changes.pipe(operators.startWith(null)).subscribe((/**
  3568. * @return {?}
  3569. */
  3570. function () {
  3571. _this._syncDescribedByIds();
  3572. _this._changeDetectorRef.markForCheck();
  3573. }));
  3574. if (this._dir) {
  3575. this._dir.change.pipe(operators.takeUntil(this._destroyed)).subscribe((/**
  3576. * @return {?}
  3577. */
  3578. function () { return _this.updateOutlineGap(); }));
  3579. }
  3580. };
  3581. /**
  3582. * @return {?}
  3583. */
  3584. MatFormField.prototype.ngAfterContentChecked = /**
  3585. * @return {?}
  3586. */
  3587. function () {
  3588. this._validateControlChild();
  3589. if (this._outlineGapCalculationNeededImmediately) {
  3590. this.updateOutlineGap();
  3591. }
  3592. };
  3593. /**
  3594. * @return {?}
  3595. */
  3596. MatFormField.prototype.ngAfterViewInit = /**
  3597. * @return {?}
  3598. */
  3599. function () {
  3600. // Avoid animations on load.
  3601. this._subscriptAnimationState = 'enter';
  3602. this._changeDetectorRef.detectChanges();
  3603. };
  3604. /**
  3605. * @return {?}
  3606. */
  3607. MatFormField.prototype.ngOnDestroy = /**
  3608. * @return {?}
  3609. */
  3610. function () {
  3611. this._destroyed.next();
  3612. this._destroyed.complete();
  3613. };
  3614. /** Determines whether a class from the NgControl should be forwarded to the host element. */
  3615. /**
  3616. * Determines whether a class from the NgControl should be forwarded to the host element.
  3617. * @param {?} prop
  3618. * @return {?}
  3619. */
  3620. MatFormField.prototype._shouldForward = /**
  3621. * Determines whether a class from the NgControl should be forwarded to the host element.
  3622. * @param {?} prop
  3623. * @return {?}
  3624. */
  3625. function (prop) {
  3626. /** @type {?} */
  3627. var ngControl = this._control ? this._control.ngControl : null;
  3628. return ngControl && ngControl[prop];
  3629. };
  3630. /**
  3631. * @return {?}
  3632. */
  3633. MatFormField.prototype._hasPlaceholder = /**
  3634. * @return {?}
  3635. */
  3636. function () {
  3637. return !!(this._control && this._control.placeholder || this._placeholderChild);
  3638. };
  3639. /**
  3640. * @return {?}
  3641. */
  3642. MatFormField.prototype._hasLabel = /**
  3643. * @return {?}
  3644. */
  3645. function () {
  3646. return !!this._labelChild;
  3647. };
  3648. /**
  3649. * @return {?}
  3650. */
  3651. MatFormField.prototype._shouldLabelFloat = /**
  3652. * @return {?}
  3653. */
  3654. function () {
  3655. return this._canLabelFloat && (this._control.shouldLabelFloat || this._shouldAlwaysFloat);
  3656. };
  3657. /**
  3658. * @return {?}
  3659. */
  3660. MatFormField.prototype._hideControlPlaceholder = /**
  3661. * @return {?}
  3662. */
  3663. function () {
  3664. // In the legacy appearance the placeholder is promoted to a label if no label is given.
  3665. return this.appearance === 'legacy' && !this._hasLabel() ||
  3666. this._hasLabel() && !this._shouldLabelFloat();
  3667. };
  3668. /**
  3669. * @return {?}
  3670. */
  3671. MatFormField.prototype._hasFloatingLabel = /**
  3672. * @return {?}
  3673. */
  3674. function () {
  3675. // In the legacy appearance the placeholder is promoted to a label if no label is given.
  3676. return this._hasLabel() || this.appearance === 'legacy' && this._hasPlaceholder();
  3677. };
  3678. /** Determines whether to display hints or errors. */
  3679. /**
  3680. * Determines whether to display hints or errors.
  3681. * @return {?}
  3682. */
  3683. MatFormField.prototype._getDisplayedMessages = /**
  3684. * Determines whether to display hints or errors.
  3685. * @return {?}
  3686. */
  3687. function () {
  3688. return (this._errorChildren && this._errorChildren.length > 0 &&
  3689. this._control.errorState) ? 'error' : 'hint';
  3690. };
  3691. /** Animates the placeholder up and locks it in position. */
  3692. /**
  3693. * Animates the placeholder up and locks it in position.
  3694. * @return {?}
  3695. */
  3696. MatFormField.prototype._animateAndLockLabel = /**
  3697. * Animates the placeholder up and locks it in position.
  3698. * @return {?}
  3699. */
  3700. function () {
  3701. var _this = this;
  3702. if (this._hasFloatingLabel() && this._canLabelFloat) {
  3703. // If animations are disabled, we shouldn't go in here,
  3704. // because the `transitionend` will never fire.
  3705. if (this._animationsEnabled) {
  3706. this._showAlwaysAnimate = true;
  3707. rxjs.fromEvent(this._label.nativeElement, 'transitionend').pipe(operators.take(1)).subscribe((/**
  3708. * @return {?}
  3709. */
  3710. function () {
  3711. _this._showAlwaysAnimate = false;
  3712. }));
  3713. }
  3714. this.floatLabel = 'always';
  3715. this._changeDetectorRef.markForCheck();
  3716. }
  3717. };
  3718. /**
  3719. * Ensure that there is only one placeholder (either `placeholder` attribute on the child control
  3720. * or child element with the `mat-placeholder` directive).
  3721. */
  3722. /**
  3723. * Ensure that there is only one placeholder (either `placeholder` attribute on the child control
  3724. * or child element with the `mat-placeholder` directive).
  3725. * @private
  3726. * @return {?}
  3727. */
  3728. MatFormField.prototype._validatePlaceholders = /**
  3729. * Ensure that there is only one placeholder (either `placeholder` attribute on the child control
  3730. * or child element with the `mat-placeholder` directive).
  3731. * @private
  3732. * @return {?}
  3733. */
  3734. function () {
  3735. if (this._control.placeholder && this._placeholderChild) {
  3736. throw getMatFormFieldPlaceholderConflictError();
  3737. }
  3738. };
  3739. /** Does any extra processing that is required when handling the hints. */
  3740. /**
  3741. * Does any extra processing that is required when handling the hints.
  3742. * @private
  3743. * @return {?}
  3744. */
  3745. MatFormField.prototype._processHints = /**
  3746. * Does any extra processing that is required when handling the hints.
  3747. * @private
  3748. * @return {?}
  3749. */
  3750. function () {
  3751. this._validateHints();
  3752. this._syncDescribedByIds();
  3753. };
  3754. /**
  3755. * Ensure that there is a maximum of one of each `<mat-hint>` alignment specified, with the
  3756. * attribute being considered as `align="start"`.
  3757. */
  3758. /**
  3759. * Ensure that there is a maximum of one of each `<mat-hint>` alignment specified, with the
  3760. * attribute being considered as `align="start"`.
  3761. * @private
  3762. * @return {?}
  3763. */
  3764. MatFormField.prototype._validateHints = /**
  3765. * Ensure that there is a maximum of one of each `<mat-hint>` alignment specified, with the
  3766. * attribute being considered as `align="start"`.
  3767. * @private
  3768. * @return {?}
  3769. */
  3770. function () {
  3771. var _this = this;
  3772. if (this._hintChildren) {
  3773. /** @type {?} */
  3774. var startHint_1;
  3775. /** @type {?} */
  3776. var endHint_1;
  3777. this._hintChildren.forEach((/**
  3778. * @param {?} hint
  3779. * @return {?}
  3780. */
  3781. function (hint) {
  3782. if (hint.align === 'start') {
  3783. if (startHint_1 || _this.hintLabel) {
  3784. throw getMatFormFieldDuplicatedHintError('start');
  3785. }
  3786. startHint_1 = hint;
  3787. }
  3788. else if (hint.align === 'end') {
  3789. if (endHint_1) {
  3790. throw getMatFormFieldDuplicatedHintError('end');
  3791. }
  3792. endHint_1 = hint;
  3793. }
  3794. }));
  3795. }
  3796. };
  3797. /**
  3798. * Sets the list of element IDs that describe the child control. This allows the control to update
  3799. * its `aria-describedby` attribute accordingly.
  3800. */
  3801. /**
  3802. * Sets the list of element IDs that describe the child control. This allows the control to update
  3803. * its `aria-describedby` attribute accordingly.
  3804. * @private
  3805. * @return {?}
  3806. */
  3807. MatFormField.prototype._syncDescribedByIds = /**
  3808. * Sets the list of element IDs that describe the child control. This allows the control to update
  3809. * its `aria-describedby` attribute accordingly.
  3810. * @private
  3811. * @return {?}
  3812. */
  3813. function () {
  3814. if (this._control) {
  3815. /** @type {?} */
  3816. var ids = [];
  3817. if (this._getDisplayedMessages() === 'hint') {
  3818. /** @type {?} */
  3819. var startHint = this._hintChildren ?
  3820. this._hintChildren.find((/**
  3821. * @param {?} hint
  3822. * @return {?}
  3823. */
  3824. function (hint) { return hint.align === 'start'; })) : null;
  3825. /** @type {?} */
  3826. var endHint = this._hintChildren ?
  3827. this._hintChildren.find((/**
  3828. * @param {?} hint
  3829. * @return {?}
  3830. */
  3831. function (hint) { return hint.align === 'end'; })) : null;
  3832. if (startHint) {
  3833. ids.push(startHint.id);
  3834. }
  3835. else if (this._hintLabel) {
  3836. ids.push(this._hintLabelId);
  3837. }
  3838. if (endHint) {
  3839. ids.push(endHint.id);
  3840. }
  3841. }
  3842. else if (this._errorChildren) {
  3843. ids = this._errorChildren.map((/**
  3844. * @param {?} error
  3845. * @return {?}
  3846. */
  3847. function (error) { return error.id; }));
  3848. }
  3849. this._control.setDescribedByIds(ids);
  3850. }
  3851. };
  3852. /** Throws an error if the form field's control is missing. */
  3853. /**
  3854. * Throws an error if the form field's control is missing.
  3855. * @protected
  3856. * @return {?}
  3857. */
  3858. MatFormField.prototype._validateControlChild = /**
  3859. * Throws an error if the form field's control is missing.
  3860. * @protected
  3861. * @return {?}
  3862. */
  3863. function () {
  3864. if (!this._control) {
  3865. throw getMatFormFieldMissingControlError();
  3866. }
  3867. };
  3868. /**
  3869. * Updates the width and position of the gap in the outline. Only relevant for the outline
  3870. * appearance.
  3871. */
  3872. /**
  3873. * Updates the width and position of the gap in the outline. Only relevant for the outline
  3874. * appearance.
  3875. * @return {?}
  3876. */
  3877. MatFormField.prototype.updateOutlineGap = /**
  3878. * Updates the width and position of the gap in the outline. Only relevant for the outline
  3879. * appearance.
  3880. * @return {?}
  3881. */
  3882. function () {
  3883. /** @type {?} */
  3884. var labelEl = this._label ? this._label.nativeElement : null;
  3885. if (this.appearance !== 'outline' || !labelEl || !labelEl.children.length ||
  3886. !labelEl.textContent.trim()) {
  3887. return;
  3888. }
  3889. if (!this._platform.isBrowser) {
  3890. // getBoundingClientRect isn't available on the server.
  3891. return;
  3892. }
  3893. // If the element is not present in the DOM, the outline gap will need to be calculated
  3894. // the next time it is checked and in the DOM.
  3895. if (!(/** @type {?} */ (document.documentElement)).contains(this._elementRef.nativeElement)) {
  3896. this._outlineGapCalculationNeededImmediately = true;
  3897. return;
  3898. }
  3899. /** @type {?} */
  3900. var startWidth = 0;
  3901. /** @type {?} */
  3902. var gapWidth = 0;
  3903. /** @type {?} */
  3904. var container = this._connectionContainerRef.nativeElement;
  3905. /** @type {?} */
  3906. var startEls = container.querySelectorAll('.mat-form-field-outline-start');
  3907. /** @type {?} */
  3908. var gapEls = container.querySelectorAll('.mat-form-field-outline-gap');
  3909. if (this._label && this._label.nativeElement.children.length) {
  3910. /** @type {?} */
  3911. var containerRect = container.getBoundingClientRect();
  3912. // If the container's width and height are zero, it means that the element is
  3913. // invisible and we can't calculate the outline gap. Mark the element as needing
  3914. // to be checked the next time the zone stabilizes. We can't do this immediately
  3915. // on the next change detection, because even if the element becomes visible,
  3916. // the `ClientRect` won't be reclaculated immediately. We reset the
  3917. // `_outlineGapCalculationNeededImmediately` flag some we don't run the checks twice.
  3918. if (containerRect.width === 0 && containerRect.height === 0) {
  3919. this._outlineGapCalculationNeededOnStable = true;
  3920. this._outlineGapCalculationNeededImmediately = false;
  3921. return;
  3922. }
  3923. /** @type {?} */
  3924. var containerStart = this._getStartEnd(containerRect);
  3925. /** @type {?} */
  3926. var labelStart = this._getStartEnd(labelEl.children[0].getBoundingClientRect());
  3927. /** @type {?} */
  3928. var labelWidth = 0;
  3929. for (var _i = 0, _a = labelEl.children; _i < _a.length; _i++) {
  3930. var child = _a[_i];
  3931. labelWidth += child.offsetWidth;
  3932. }
  3933. startWidth = labelStart - containerStart - outlineGapPadding;
  3934. gapWidth = labelWidth > 0 ? labelWidth * floatingLabelScale + outlineGapPadding * 2 : 0;
  3935. }
  3936. for (var i = 0; i < startEls.length; i++) {
  3937. startEls.item(i).style.width = startWidth + "px";
  3938. }
  3939. for (var i = 0; i < gapEls.length; i++) {
  3940. gapEls.item(i).style.width = gapWidth + "px";
  3941. }
  3942. this._outlineGapCalculationNeededOnStable =
  3943. this._outlineGapCalculationNeededImmediately = false;
  3944. };
  3945. /** Gets the start end of the rect considering the current directionality. */
  3946. /**
  3947. * Gets the start end of the rect considering the current directionality.
  3948. * @private
  3949. * @param {?} rect
  3950. * @return {?}
  3951. */
  3952. MatFormField.prototype._getStartEnd = /**
  3953. * Gets the start end of the rect considering the current directionality.
  3954. * @private
  3955. * @param {?} rect
  3956. * @return {?}
  3957. */
  3958. function (rect) {
  3959. return this._dir && this._dir.value === 'rtl' ? rect.right : rect.left;
  3960. };
  3961. MatFormField.decorators = [
  3962. { type: core.Component, args: [{selector: 'mat-form-field',
  3963. exportAs: 'matFormField',
  3964. template: "<div class=\"mat-form-field-wrapper\"><div class=\"mat-form-field-flex\" #connectionContainer (click)=\"_control.onContainerClick && _control.onContainerClick($event)\"><ng-container *ngIf=\"appearance == 'outline'\"><div class=\"mat-form-field-outline\"><div class=\"mat-form-field-outline-start\"></div><div class=\"mat-form-field-outline-gap\"></div><div class=\"mat-form-field-outline-end\"></div></div><div class=\"mat-form-field-outline mat-form-field-outline-thick\"><div class=\"mat-form-field-outline-start\"></div><div class=\"mat-form-field-outline-gap\"></div><div class=\"mat-form-field-outline-end\"></div></div></ng-container><div class=\"mat-form-field-prefix\" *ngIf=\"_prefixChildren.length\"><ng-content select=\"[matPrefix]\"></ng-content></div><div class=\"mat-form-field-infix\" #inputContainer><ng-content></ng-content><span class=\"mat-form-field-label-wrapper\"><label class=\"mat-form-field-label\" (cdkObserveContent)=\"updateOutlineGap()\" [cdkObserveContentDisabled]=\"appearance != 'outline'\" [id]=\"_labelId\" [attr.for]=\"_control.id\" [attr.aria-owns]=\"_control.id\" [class.mat-empty]=\"_control.empty && !_shouldAlwaysFloat\" [class.mat-form-field-empty]=\"_control.empty && !_shouldAlwaysFloat\" [class.mat-accent]=\"color == 'accent'\" [class.mat-warn]=\"color == 'warn'\" #label *ngIf=\"_hasFloatingLabel()\" [ngSwitch]=\"_hasLabel()\"><ng-container *ngSwitchCase=\"false\"><ng-content select=\"mat-placeholder\"></ng-content><span>{{_control.placeholder}}</span></ng-container><ng-content select=\"mat-label\" *ngSwitchCase=\"true\"></ng-content><span class=\"mat-placeholder-required mat-form-field-required-marker\" aria-hidden=\"true\" *ngIf=\"!hideRequiredMarker && _control.required && !_control.disabled\">&#32;*</span></label></span></div><div class=\"mat-form-field-suffix\" *ngIf=\"_suffixChildren.length\"><ng-content select=\"[matSuffix]\"></ng-content></div></div><div class=\"mat-form-field-underline\" #underline *ngIf=\"appearance != 'outline'\"><span class=\"mat-form-field-ripple\" [class.mat-accent]=\"color == 'accent'\" [class.mat-warn]=\"color == 'warn'\"></span></div><div class=\"mat-form-field-subscript-wrapper\" [ngSwitch]=\"_getDisplayedMessages()\"><div *ngSwitchCase=\"'error'\" [@transitionMessages]=\"_subscriptAnimationState\"><ng-content select=\"mat-error\"></ng-content></div><div class=\"mat-form-field-hint-wrapper\" *ngSwitchCase=\"'hint'\" [@transitionMessages]=\"_subscriptAnimationState\"><div *ngIf=\"hintLabel\" [id]=\"_hintLabelId\" class=\"mat-hint\">{{hintLabel}}</div><ng-content select=\"mat-hint:not([align='end'])\"></ng-content><div class=\"mat-form-field-hint-spacer\"></div><ng-content select=\"mat-hint[align='end']\"></ng-content></div></div></div>",
  3965. // MatInput is a directive and can't have styles, so we need to include its styles here
  3966. // in form-field-input.css. The MatInput styles are fairly minimal so it shouldn't be a
  3967. // big deal for people who aren't using MatInput.
  3968. styles: [".mat-form-field{display:inline-block;position:relative;text-align:left}[dir=rtl] .mat-form-field{text-align:right}.mat-form-field-wrapper{position:relative}.mat-form-field-flex{display:inline-flex;align-items:baseline;box-sizing:border-box;width:100%}.mat-form-field-prefix,.mat-form-field-suffix{white-space:nowrap;flex:none;position:relative}.mat-form-field-infix{display:block;position:relative;flex:auto;min-width:0;width:180px}@media (-ms-high-contrast:active){.mat-form-field-infix{border-image:linear-gradient(transparent,transparent)}}.mat-form-field-label-wrapper{position:absolute;left:0;box-sizing:content-box;width:100%;height:100%;overflow:hidden;pointer-events:none}[dir=rtl] .mat-form-field-label-wrapper{left:auto;right:0}.mat-form-field-label{position:absolute;left:0;font:inherit;pointer-events:none;width:100%;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;transform-origin:0 0;transition:transform .4s cubic-bezier(.25,.8,.25,1),color .4s cubic-bezier(.25,.8,.25,1),width .4s cubic-bezier(.25,.8,.25,1);display:none}[dir=rtl] .mat-form-field-label{transform-origin:100% 0;left:auto;right:0}.mat-form-field-can-float.mat-form-field-should-float .mat-form-field-label,.mat-form-field-empty.mat-form-field-label{display:block}.mat-form-field-autofill-control:-webkit-autofill+.mat-form-field-label-wrapper .mat-form-field-label{display:none}.mat-form-field-can-float .mat-form-field-autofill-control:-webkit-autofill+.mat-form-field-label-wrapper .mat-form-field-label{display:block;transition:none}.mat-input-server:focus+.mat-form-field-label-wrapper .mat-form-field-label,.mat-input-server[placeholder]:not(:placeholder-shown)+.mat-form-field-label-wrapper .mat-form-field-label{display:none}.mat-form-field-can-float .mat-input-server:focus+.mat-form-field-label-wrapper .mat-form-field-label,.mat-form-field-can-float .mat-input-server[placeholder]:not(:placeholder-shown)+.mat-form-field-label-wrapper .mat-form-field-label{display:block}.mat-form-field-label:not(.mat-form-field-empty){transition:none}.mat-form-field-underline{position:absolute;width:100%;pointer-events:none;transform:scaleY(1.0001)}.mat-form-field-ripple{position:absolute;left:0;width:100%;transform-origin:50%;transform:scaleX(.5);opacity:0;transition:background-color .3s cubic-bezier(.55,0,.55,.2)}.mat-form-field.mat-focused .mat-form-field-ripple,.mat-form-field.mat-form-field-invalid .mat-form-field-ripple{opacity:1;transform:scaleX(1);transition:transform .3s cubic-bezier(.25,.8,.25,1),opacity .1s cubic-bezier(.25,.8,.25,1),background-color .3s cubic-bezier(.25,.8,.25,1)}.mat-form-field-subscript-wrapper{position:absolute;box-sizing:border-box;width:100%;overflow:hidden}.mat-form-field-label-wrapper .mat-icon,.mat-form-field-subscript-wrapper .mat-icon{width:1em;height:1em;font-size:inherit;vertical-align:baseline}.mat-form-field-hint-wrapper{display:flex}.mat-form-field-hint-spacer{flex:1 0 1em}.mat-error{display:block}.mat-form-field-control-wrapper{position:relative}.mat-form-field._mat-animation-noopable .mat-form-field-label,.mat-form-field._mat-animation-noopable .mat-form-field-ripple{transition:none} .mat-form-field-appearance-fill .mat-form-field-flex{border-radius:4px 4px 0 0;padding:.75em .75em 0 .75em}@media (-ms-high-contrast:active){.mat-form-field-appearance-fill .mat-form-field-flex{outline:solid 1px}}.mat-form-field-appearance-fill .mat-form-field-underline::before{content:'';display:block;position:absolute;bottom:0;height:1px;width:100%}.mat-form-field-appearance-fill .mat-form-field-ripple{bottom:0;height:2px}@media (-ms-high-contrast:active){.mat-form-field-appearance-fill .mat-form-field-ripple{height:0;border-top:solid 2px}}.mat-form-field-appearance-fill:not(.mat-form-field-disabled) .mat-form-field-flex:hover~.mat-form-field-underline .mat-form-field-ripple{opacity:1;transform:none;transition:opacity .6s cubic-bezier(.25,.8,.25,1)}.mat-form-field-appearance-fill._mat-animation-noopable:not(.mat-form-field-disabled) .mat-form-field-flex:hover~.mat-form-field-underline .mat-form-field-ripple{transition:none}.mat-form-field-appearance-fill .mat-form-field-subscript-wrapper{padding:0 1em} .mat-input-element{font:inherit;background:0 0;color:currentColor;border:none;outline:0;padding:0;margin:0;width:100%;max-width:100%;vertical-align:bottom;text-align:inherit}.mat-input-element:-moz-ui-invalid{box-shadow:none}.mat-input-element::-ms-clear,.mat-input-element::-ms-reveal{display:none}.mat-input-element,.mat-input-element::-webkit-search-cancel-button,.mat-input-element::-webkit-search-decoration,.mat-input-element::-webkit-search-results-button,.mat-input-element::-webkit-search-results-decoration{-webkit-appearance:none}.mat-input-element::-webkit-caps-lock-indicator,.mat-input-element::-webkit-contacts-auto-fill-button,.mat-input-element::-webkit-credentials-auto-fill-button{visibility:hidden}.mat-input-element[type=date]::after,.mat-input-element[type=datetime-local]::after,.mat-input-element[type=datetime]::after,.mat-input-element[type=month]::after,.mat-input-element[type=time]::after,.mat-input-element[type=week]::after{content:' ';white-space:pre;width:1px}.mat-input-element::-webkit-calendar-picker-indicator,.mat-input-element::-webkit-clear-button,.mat-input-element::-webkit-inner-spin-button{font-size:.75em}.mat-input-element::placeholder{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;transition:color .4s .133s cubic-bezier(.25,.8,.25,1)}.mat-input-element::placeholder:-ms-input-placeholder{-ms-user-select:text}.mat-input-element::-moz-placeholder{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;transition:color .4s .133s cubic-bezier(.25,.8,.25,1)}.mat-input-element::-moz-placeholder:-ms-input-placeholder{-ms-user-select:text}.mat-input-element::-webkit-input-placeholder{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;transition:color .4s .133s cubic-bezier(.25,.8,.25,1)}.mat-input-element::-webkit-input-placeholder:-ms-input-placeholder{-ms-user-select:text}.mat-input-element:-ms-input-placeholder{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;transition:color .4s .133s cubic-bezier(.25,.8,.25,1)}.mat-input-element:-ms-input-placeholder:-ms-input-placeholder{-ms-user-select:text}.mat-form-field-hide-placeholder .mat-input-element::placeholder{color:transparent!important;-webkit-text-fill-color:transparent;transition:none}.mat-form-field-hide-placeholder .mat-input-element::-moz-placeholder{color:transparent!important;-webkit-text-fill-color:transparent;transition:none}.mat-form-field-hide-placeholder .mat-input-element::-webkit-input-placeholder{color:transparent!important;-webkit-text-fill-color:transparent;transition:none}.mat-form-field-hide-placeholder .mat-input-element:-ms-input-placeholder{color:transparent!important;-webkit-text-fill-color:transparent;transition:none}textarea.mat-input-element{resize:vertical;overflow:auto}textarea.mat-input-element.cdk-textarea-autosize{resize:none}textarea.mat-input-element{padding:2px 0;margin:-2px 0}select.mat-input-element{-moz-appearance:none;-webkit-appearance:none;position:relative;background-color:transparent;display:inline-flex;box-sizing:border-box;padding-top:1em;top:-1em;margin-bottom:-1em}select.mat-input-element::-ms-expand{display:none}select.mat-input-element::-moz-focus-inner{border:0}select.mat-input-element:not(:disabled){cursor:pointer}select.mat-input-element::-ms-value{color:inherit;background:0 0}@media (-ms-high-contrast:active){.mat-focused select.mat-input-element::-ms-value{color:inherit}}.mat-form-field-type-mat-native-select .mat-form-field-infix::after{content:'';width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-top:5px solid;position:absolute;top:50%;right:0;margin-top:-2.5px;pointer-events:none}[dir=rtl] .mat-form-field-type-mat-native-select .mat-form-field-infix::after{right:auto;left:0}.mat-form-field-type-mat-native-select .mat-input-element{padding-right:15px}[dir=rtl] .mat-form-field-type-mat-native-select .mat-input-element{padding-right:0;padding-left:15px}.mat-form-field-type-mat-native-select .mat-form-field-label-wrapper{max-width:calc(100% - 10px)}.mat-form-field-type-mat-native-select.mat-form-field-appearance-outline .mat-form-field-infix::after{margin-top:-5px}.mat-form-field-type-mat-native-select.mat-form-field-appearance-fill .mat-form-field-infix::after{margin-top:-10px} .mat-form-field-appearance-legacy .mat-form-field-label{transform:perspective(100px);-ms-transform:none}.mat-form-field-appearance-legacy .mat-form-field-prefix .mat-icon,.mat-form-field-appearance-legacy .mat-form-field-suffix .mat-icon{width:1em}.mat-form-field-appearance-legacy .mat-form-field-prefix .mat-icon-button,.mat-form-field-appearance-legacy .mat-form-field-suffix .mat-icon-button{font:inherit;vertical-align:baseline}.mat-form-field-appearance-legacy .mat-form-field-prefix .mat-icon-button .mat-icon,.mat-form-field-appearance-legacy .mat-form-field-suffix .mat-icon-button .mat-icon{font-size:inherit}.mat-form-field-appearance-legacy .mat-form-field-underline{height:1px}@media (-ms-high-contrast:active){.mat-form-field-appearance-legacy .mat-form-field-underline{height:0;border-top:solid 1px}}.mat-form-field-appearance-legacy .mat-form-field-ripple{top:0;height:2px;overflow:hidden}@media (-ms-high-contrast:active){.mat-form-field-appearance-legacy .mat-form-field-ripple{height:0;border-top:solid 2px}}.mat-form-field-appearance-legacy.mat-form-field-disabled .mat-form-field-underline{background-position:0;background-color:transparent}@media (-ms-high-contrast:active){.mat-form-field-appearance-legacy.mat-form-field-disabled .mat-form-field-underline{border-top-style:dotted;border-top-width:2px}}.mat-form-field-appearance-legacy.mat-form-field-invalid:not(.mat-focused) .mat-form-field-ripple{height:1px} .mat-form-field-appearance-outline .mat-form-field-wrapper{margin:.25em 0}.mat-form-field-appearance-outline .mat-form-field-flex{padding:0 .75em 0 .75em;margin-top:-.25em;position:relative}.mat-form-field-appearance-outline .mat-form-field-prefix,.mat-form-field-appearance-outline .mat-form-field-suffix{top:.25em}.mat-form-field-appearance-outline .mat-form-field-outline{display:flex;position:absolute;top:.25em;left:0;right:0;bottom:0;pointer-events:none}.mat-form-field-appearance-outline .mat-form-field-outline-end,.mat-form-field-appearance-outline .mat-form-field-outline-start{border:1px solid currentColor;min-width:5px}.mat-form-field-appearance-outline .mat-form-field-outline-start{border-radius:5px 0 0 5px;border-right-style:none}[dir=rtl] .mat-form-field-appearance-outline .mat-form-field-outline-start{border-right-style:solid;border-left-style:none;border-radius:0 5px 5px 0}.mat-form-field-appearance-outline .mat-form-field-outline-end{border-radius:0 5px 5px 0;border-left-style:none;flex-grow:1}[dir=rtl] .mat-form-field-appearance-outline .mat-form-field-outline-end{border-left-style:solid;border-right-style:none;border-radius:5px 0 0 5px}.mat-form-field-appearance-outline .mat-form-field-outline-gap{border-radius:.000001px;border:1px solid currentColor;border-left-style:none;border-right-style:none}.mat-form-field-appearance-outline.mat-form-field-can-float.mat-form-field-should-float .mat-form-field-outline-gap{border-top-color:transparent}.mat-form-field-appearance-outline .mat-form-field-outline-thick{opacity:0}.mat-form-field-appearance-outline .mat-form-field-outline-thick .mat-form-field-outline-end,.mat-form-field-appearance-outline .mat-form-field-outline-thick .mat-form-field-outline-gap,.mat-form-field-appearance-outline .mat-form-field-outline-thick .mat-form-field-outline-start{border-width:2px;transition:border-color .3s cubic-bezier(.25,.8,.25,1)}.mat-form-field-appearance-outline.mat-focused .mat-form-field-outline,.mat-form-field-appearance-outline.mat-form-field-invalid .mat-form-field-outline{opacity:0;transition:opacity .1s cubic-bezier(.25,.8,.25,1)}.mat-form-field-appearance-outline.mat-focused .mat-form-field-outline-thick,.mat-form-field-appearance-outline.mat-form-field-invalid .mat-form-field-outline-thick{opacity:1}.mat-form-field-appearance-outline:not(.mat-form-field-disabled) .mat-form-field-flex:hover .mat-form-field-outline{opacity:0;transition:opacity .6s cubic-bezier(.25,.8,.25,1)}.mat-form-field-appearance-outline:not(.mat-form-field-disabled) .mat-form-field-flex:hover .mat-form-field-outline-thick{opacity:1}.mat-form-field-appearance-outline .mat-form-field-subscript-wrapper{padding:0 1em}.mat-form-field-appearance-outline._mat-animation-noopable .mat-form-field-outline,.mat-form-field-appearance-outline._mat-animation-noopable .mat-form-field-outline-end,.mat-form-field-appearance-outline._mat-animation-noopable .mat-form-field-outline-gap,.mat-form-field-appearance-outline._mat-animation-noopable .mat-form-field-outline-start,.mat-form-field-appearance-outline._mat-animation-noopable:not(.mat-form-field-disabled) .mat-form-field-flex:hover~.mat-form-field-outline{transition:none} .mat-form-field-appearance-standard .mat-form-field-flex{padding-top:.75em}.mat-form-field-appearance-standard .mat-form-field-underline{height:1px}@media (-ms-high-contrast:active){.mat-form-field-appearance-standard .mat-form-field-underline{height:0;border-top:solid 1px}}.mat-form-field-appearance-standard .mat-form-field-ripple{bottom:0;height:2px}@media (-ms-high-contrast:active){.mat-form-field-appearance-standard .mat-form-field-ripple{height:0;border-top:2px}}.mat-form-field-appearance-standard.mat-form-field-disabled .mat-form-field-underline{background-position:0;background-color:transparent}@media (-ms-high-contrast:active){.mat-form-field-appearance-standard.mat-form-field-disabled .mat-form-field-underline{border-top-style:dotted;border-top-width:2px}}.mat-form-field-appearance-standard:not(.mat-form-field-disabled) .mat-form-field-flex:hover~.mat-form-field-underline .mat-form-field-ripple{opacity:1;transform:none;transition:opacity .6s cubic-bezier(.25,.8,.25,1)}.mat-form-field-appearance-standard._mat-animation-noopable:not(.mat-form-field-disabled) .mat-form-field-flex:hover~.mat-form-field-underline .mat-form-field-ripple{transition:none}"],
  3969. animations: [matFormFieldAnimations.transitionMessages],
  3970. host: {
  3971. 'class': 'mat-form-field',
  3972. '[class.mat-form-field-appearance-standard]': 'appearance == "standard"',
  3973. '[class.mat-form-field-appearance-fill]': 'appearance == "fill"',
  3974. '[class.mat-form-field-appearance-outline]': 'appearance == "outline"',
  3975. '[class.mat-form-field-appearance-legacy]': 'appearance == "legacy"',
  3976. '[class.mat-form-field-invalid]': '_control.errorState',
  3977. '[class.mat-form-field-can-float]': '_canLabelFloat',
  3978. '[class.mat-form-field-should-float]': '_shouldLabelFloat()',
  3979. '[class.mat-form-field-has-label]': '_hasFloatingLabel()',
  3980. '[class.mat-form-field-hide-placeholder]': '_hideControlPlaceholder()',
  3981. '[class.mat-form-field-disabled]': '_control.disabled',
  3982. '[class.mat-form-field-autofilled]': '_control.autofilled',
  3983. '[class.mat-focused]': '_control.focused',
  3984. '[class.mat-accent]': 'color == "accent"',
  3985. '[class.mat-warn]': 'color == "warn"',
  3986. '[class.ng-untouched]': '_shouldForward("untouched")',
  3987. '[class.ng-touched]': '_shouldForward("touched")',
  3988. '[class.ng-pristine]': '_shouldForward("pristine")',
  3989. '[class.ng-dirty]': '_shouldForward("dirty")',
  3990. '[class.ng-valid]': '_shouldForward("valid")',
  3991. '[class.ng-invalid]': '_shouldForward("invalid")',
  3992. '[class.ng-pending]': '_shouldForward("pending")',
  3993. '[class._mat-animation-noopable]': '!_animationsEnabled',
  3994. },
  3995. inputs: ['color'],
  3996. encapsulation: core.ViewEncapsulation.None,
  3997. changeDetection: core.ChangeDetectionStrategy.OnPush,
  3998. },] },
  3999. ];
  4000. /** @nocollapse */
  4001. MatFormField.ctorParameters = function () { return [
  4002. { type: core.ElementRef },
  4003. { type: core.ChangeDetectorRef },
  4004. { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_LABEL_GLOBAL_OPTIONS,] }] },
  4005. { type: bidi.Directionality, decorators: [{ type: core.Optional }] },
  4006. { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_FORM_FIELD_DEFAULT_OPTIONS,] }] },
  4007. { type: platform.Platform },
  4008. { type: core.NgZone },
  4009. { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
  4010. ]; };
  4011. MatFormField.propDecorators = {
  4012. appearance: [{ type: core.Input }],
  4013. hideRequiredMarker: [{ type: core.Input }],
  4014. hintLabel: [{ type: core.Input }],
  4015. floatLabel: [{ type: core.Input }],
  4016. underlineRef: [{ type: core.ViewChild, args: ['underline', { static: false },] }],
  4017. _connectionContainerRef: [{ type: core.ViewChild, args: ['connectionContainer', { static: true },] }],
  4018. _inputContainerRef: [{ type: core.ViewChild, args: ['inputContainer', { static: false },] }],
  4019. _label: [{ type: core.ViewChild, args: ['label', { static: false },] }],
  4020. _controlNonStatic: [{ type: core.ContentChild, args: [MatFormFieldControl, { static: false },] }],
  4021. _controlStatic: [{ type: core.ContentChild, args: [MatFormFieldControl, { static: true },] }],
  4022. _labelChildNonStatic: [{ type: core.ContentChild, args: [MatLabel, { static: false },] }],
  4023. _labelChildStatic: [{ type: core.ContentChild, args: [MatLabel, { static: true },] }],
  4024. _placeholderChild: [{ type: core.ContentChild, args: [MatPlaceholder, { static: false },] }],
  4025. _errorChildren: [{ type: core.ContentChildren, args: [MatError,] }],
  4026. _hintChildren: [{ type: core.ContentChildren, args: [MatHint,] }],
  4027. _prefixChildren: [{ type: core.ContentChildren, args: [MatPrefix,] }],
  4028. _suffixChildren: [{ type: core.ContentChildren, args: [MatSuffix,] }]
  4029. };
  4030. return MatFormField;
  4031. }(_MatFormFieldMixinBase));
  4032. /**
  4033. * @fileoverview added by tsickle
  4034. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  4035. */
  4036. var MatFormFieldModule = /** @class */ (function () {
  4037. function MatFormFieldModule() {
  4038. }
  4039. MatFormFieldModule.decorators = [
  4040. { type: core.NgModule, args: [{
  4041. declarations: [
  4042. MatError,
  4043. MatFormField,
  4044. MatHint,
  4045. MatLabel,
  4046. MatPlaceholder,
  4047. MatPrefix,
  4048. MatSuffix,
  4049. ],
  4050. imports: [
  4051. common.CommonModule,
  4052. observers.ObserversModule,
  4053. ],
  4054. exports: [
  4055. MatError,
  4056. MatFormField,
  4057. MatHint,
  4058. MatLabel,
  4059. MatPlaceholder,
  4060. MatPrefix,
  4061. MatSuffix,
  4062. ],
  4063. },] },
  4064. ];
  4065. return MatFormFieldModule;
  4066. }());
  4067. /**
  4068. * @fileoverview added by tsickle
  4069. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  4070. */
  4071. /**
  4072. * Autocomplete IDs need to be unique across components, so this counter exists outside of
  4073. * the component definition.
  4074. * @type {?}
  4075. */
  4076. var _uniqueAutocompleteIdCounter = 0;
  4077. /**
  4078. * Event object that is emitted when an autocomplete option is selected.
  4079. */
  4080. var /**
  4081. * Event object that is emitted when an autocomplete option is selected.
  4082. */
  4083. MatAutocompleteSelectedEvent = /** @class */ (function () {
  4084. function MatAutocompleteSelectedEvent(source, option) {
  4085. this.source = source;
  4086. this.option = option;
  4087. }
  4088. return MatAutocompleteSelectedEvent;
  4089. }());
  4090. // Boilerplate for applying mixins to MatAutocomplete.
  4091. /**
  4092. * \@docs-private
  4093. */
  4094. var
  4095. // Boilerplate for applying mixins to MatAutocomplete.
  4096. /**
  4097. * \@docs-private
  4098. */
  4099. MatAutocompleteBase = /** @class */ (function () {
  4100. function MatAutocompleteBase() {
  4101. }
  4102. return MatAutocompleteBase;
  4103. }());
  4104. /** @type {?} */
  4105. var _MatAutocompleteMixinBase = mixinDisableRipple(MatAutocompleteBase);
  4106. /**
  4107. * Injection token to be used to override the default options for `mat-autocomplete`.
  4108. * @type {?}
  4109. */
  4110. var MAT_AUTOCOMPLETE_DEFAULT_OPTIONS = new core.InjectionToken('mat-autocomplete-default-options', {
  4111. providedIn: 'root',
  4112. factory: MAT_AUTOCOMPLETE_DEFAULT_OPTIONS_FACTORY,
  4113. });
  4114. /**
  4115. * \@docs-private
  4116. * @return {?}
  4117. */
  4118. function MAT_AUTOCOMPLETE_DEFAULT_OPTIONS_FACTORY() {
  4119. return { autoActiveFirstOption: false };
  4120. }
  4121. var MatAutocomplete = /** @class */ (function (_super) {
  4122. __extends(MatAutocomplete, _super);
  4123. function MatAutocomplete(_changeDetectorRef, _elementRef, defaults) {
  4124. var _this = _super.call(this) || this;
  4125. _this._changeDetectorRef = _changeDetectorRef;
  4126. _this._elementRef = _elementRef;
  4127. /**
  4128. * Whether the autocomplete panel should be visible, depending on option length.
  4129. */
  4130. _this.showPanel = false;
  4131. _this._isOpen = false;
  4132. /**
  4133. * Function that maps an option's control value to its display value in the trigger.
  4134. */
  4135. _this.displayWith = null;
  4136. /**
  4137. * Event that is emitted whenever an option from the list is selected.
  4138. */
  4139. _this.optionSelected = new core.EventEmitter();
  4140. /**
  4141. * Event that is emitted when the autocomplete panel is opened.
  4142. */
  4143. _this.opened = new core.EventEmitter();
  4144. /**
  4145. * Event that is emitted when the autocomplete panel is closed.
  4146. */
  4147. _this.closed = new core.EventEmitter();
  4148. _this._classList = {};
  4149. /**
  4150. * Unique ID to be used by autocomplete trigger's "aria-owns" property.
  4151. */
  4152. _this.id = "mat-autocomplete-" + _uniqueAutocompleteIdCounter++;
  4153. _this._autoActiveFirstOption = !!defaults.autoActiveFirstOption;
  4154. return _this;
  4155. }
  4156. Object.defineProperty(MatAutocomplete.prototype, "isOpen", {
  4157. /** Whether the autocomplete panel is open. */
  4158. get: /**
  4159. * Whether the autocomplete panel is open.
  4160. * @return {?}
  4161. */
  4162. function () { return this._isOpen && this.showPanel; },
  4163. enumerable: true,
  4164. configurable: true
  4165. });
  4166. Object.defineProperty(MatAutocomplete.prototype, "autoActiveFirstOption", {
  4167. /**
  4168. * Whether the first option should be highlighted when the autocomplete panel is opened.
  4169. * Can be configured globally through the `MAT_AUTOCOMPLETE_DEFAULT_OPTIONS` token.
  4170. */
  4171. get: /**
  4172. * Whether the first option should be highlighted when the autocomplete panel is opened.
  4173. * Can be configured globally through the `MAT_AUTOCOMPLETE_DEFAULT_OPTIONS` token.
  4174. * @return {?}
  4175. */
  4176. function () { return this._autoActiveFirstOption; },
  4177. set: /**
  4178. * @param {?} value
  4179. * @return {?}
  4180. */
  4181. function (value) {
  4182. this._autoActiveFirstOption = coercion.coerceBooleanProperty(value);
  4183. },
  4184. enumerable: true,
  4185. configurable: true
  4186. });
  4187. Object.defineProperty(MatAutocomplete.prototype, "classList", {
  4188. /**
  4189. * Takes classes set on the host mat-autocomplete element and applies them to the panel
  4190. * inside the overlay container to allow for easy styling.
  4191. */
  4192. set: /**
  4193. * Takes classes set on the host mat-autocomplete element and applies them to the panel
  4194. * inside the overlay container to allow for easy styling.
  4195. * @param {?} value
  4196. * @return {?}
  4197. */
  4198. function (value) {
  4199. if (value && value.length) {
  4200. this._classList = value.split(' ').reduce((/**
  4201. * @param {?} classList
  4202. * @param {?} className
  4203. * @return {?}
  4204. */
  4205. function (classList, className) {
  4206. classList[className.trim()] = true;
  4207. return classList;
  4208. }), (/** @type {?} */ ({})));
  4209. }
  4210. else {
  4211. this._classList = {};
  4212. }
  4213. this._setVisibilityClasses(this._classList);
  4214. this._elementRef.nativeElement.className = '';
  4215. },
  4216. enumerable: true,
  4217. configurable: true
  4218. });
  4219. /**
  4220. * @return {?}
  4221. */
  4222. MatAutocomplete.prototype.ngAfterContentInit = /**
  4223. * @return {?}
  4224. */
  4225. function () {
  4226. this._keyManager = new a11y.ActiveDescendantKeyManager(this.options).withWrap();
  4227. // Set the initial visibility state.
  4228. this._setVisibility();
  4229. };
  4230. /**
  4231. * Sets the panel scrollTop. This allows us to manually scroll to display options
  4232. * above or below the fold, as they are not actually being focused when active.
  4233. */
  4234. /**
  4235. * Sets the panel scrollTop. This allows us to manually scroll to display options
  4236. * above or below the fold, as they are not actually being focused when active.
  4237. * @param {?} scrollTop
  4238. * @return {?}
  4239. */
  4240. MatAutocomplete.prototype._setScrollTop = /**
  4241. * Sets the panel scrollTop. This allows us to manually scroll to display options
  4242. * above or below the fold, as they are not actually being focused when active.
  4243. * @param {?} scrollTop
  4244. * @return {?}
  4245. */
  4246. function (scrollTop) {
  4247. if (this.panel) {
  4248. this.panel.nativeElement.scrollTop = scrollTop;
  4249. }
  4250. };
  4251. /** Returns the panel's scrollTop. */
  4252. /**
  4253. * Returns the panel's scrollTop.
  4254. * @return {?}
  4255. */
  4256. MatAutocomplete.prototype._getScrollTop = /**
  4257. * Returns the panel's scrollTop.
  4258. * @return {?}
  4259. */
  4260. function () {
  4261. return this.panel ? this.panel.nativeElement.scrollTop : 0;
  4262. };
  4263. /** Panel should hide itself when the option list is empty. */
  4264. /**
  4265. * Panel should hide itself when the option list is empty.
  4266. * @return {?}
  4267. */
  4268. MatAutocomplete.prototype._setVisibility = /**
  4269. * Panel should hide itself when the option list is empty.
  4270. * @return {?}
  4271. */
  4272. function () {
  4273. this.showPanel = !!this.options.length;
  4274. this._setVisibilityClasses(this._classList);
  4275. this._changeDetectorRef.markForCheck();
  4276. };
  4277. /** Emits the `select` event. */
  4278. /**
  4279. * Emits the `select` event.
  4280. * @param {?} option
  4281. * @return {?}
  4282. */
  4283. MatAutocomplete.prototype._emitSelectEvent = /**
  4284. * Emits the `select` event.
  4285. * @param {?} option
  4286. * @return {?}
  4287. */
  4288. function (option) {
  4289. /** @type {?} */
  4290. var event = new MatAutocompleteSelectedEvent(this, option);
  4291. this.optionSelected.emit(event);
  4292. };
  4293. /** Sets the autocomplete visibility classes on a classlist based on the panel is visible. */
  4294. /**
  4295. * Sets the autocomplete visibility classes on a classlist based on the panel is visible.
  4296. * @private
  4297. * @param {?} classList
  4298. * @return {?}
  4299. */
  4300. MatAutocomplete.prototype._setVisibilityClasses = /**
  4301. * Sets the autocomplete visibility classes on a classlist based on the panel is visible.
  4302. * @private
  4303. * @param {?} classList
  4304. * @return {?}
  4305. */
  4306. function (classList) {
  4307. classList['mat-autocomplete-visible'] = this.showPanel;
  4308. classList['mat-autocomplete-hidden'] = !this.showPanel;
  4309. };
  4310. MatAutocomplete.decorators = [
  4311. { type: core.Component, args: [{selector: 'mat-autocomplete',
  4312. template: "<ng-template><div class=\"mat-autocomplete-panel\" role=\"listbox\" [id]=\"id\" [ngClass]=\"_classList\" #panel><ng-content></ng-content></div></ng-template>",
  4313. styles: [".mat-autocomplete-panel{min-width:112px;max-width:280px;overflow:auto;-webkit-overflow-scrolling:touch;visibility:hidden;max-width:none;max-height:256px;position:relative;width:100%;border-bottom-left-radius:4px;border-bottom-right-radius:4px}.mat-autocomplete-panel.mat-autocomplete-visible{visibility:visible}.mat-autocomplete-panel.mat-autocomplete-hidden{visibility:hidden}.mat-autocomplete-panel-above .mat-autocomplete-panel{border-radius:0;border-top-left-radius:4px;border-top-right-radius:4px}.mat-autocomplete-panel .mat-divider-horizontal{margin-top:-1px}@media (-ms-high-contrast:active){.mat-autocomplete-panel{outline:solid 1px}}"],
  4314. encapsulation: core.ViewEncapsulation.None,
  4315. changeDetection: core.ChangeDetectionStrategy.OnPush,
  4316. exportAs: 'matAutocomplete',
  4317. inputs: ['disableRipple'],
  4318. host: {
  4319. 'class': 'mat-autocomplete'
  4320. },
  4321. providers: [
  4322. { provide: MAT_OPTION_PARENT_COMPONENT, useExisting: MatAutocomplete }
  4323. ]
  4324. },] },
  4325. ];
  4326. /** @nocollapse */
  4327. MatAutocomplete.ctorParameters = function () { return [
  4328. { type: core.ChangeDetectorRef },
  4329. { type: core.ElementRef },
  4330. { type: undefined, decorators: [{ type: core.Inject, args: [MAT_AUTOCOMPLETE_DEFAULT_OPTIONS,] }] }
  4331. ]; };
  4332. MatAutocomplete.propDecorators = {
  4333. template: [{ type: core.ViewChild, args: [core.TemplateRef, { static: true },] }],
  4334. panel: [{ type: core.ViewChild, args: ['panel', { static: false },] }],
  4335. options: [{ type: core.ContentChildren, args: [MatOption, { descendants: true },] }],
  4336. optionGroups: [{ type: core.ContentChildren, args: [MatOptgroup,] }],
  4337. displayWith: [{ type: core.Input }],
  4338. autoActiveFirstOption: [{ type: core.Input }],
  4339. panelWidth: [{ type: core.Input }],
  4340. optionSelected: [{ type: core.Output }],
  4341. opened: [{ type: core.Output }],
  4342. closed: [{ type: core.Output }],
  4343. classList: [{ type: core.Input, args: ['class',] }]
  4344. };
  4345. return MatAutocomplete;
  4346. }(_MatAutocompleteMixinBase));
  4347. /**
  4348. * @fileoverview added by tsickle
  4349. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  4350. */
  4351. /**
  4352. * Directive applied to an element to make it usable
  4353. * as a connection point for an autocomplete panel.
  4354. */
  4355. var MatAutocompleteOrigin = /** @class */ (function () {
  4356. function MatAutocompleteOrigin(elementRef) {
  4357. this.elementRef = elementRef;
  4358. }
  4359. MatAutocompleteOrigin.decorators = [
  4360. { type: core.Directive, args: [{
  4361. selector: '[matAutocompleteOrigin]',
  4362. exportAs: 'matAutocompleteOrigin',
  4363. },] },
  4364. ];
  4365. /** @nocollapse */
  4366. MatAutocompleteOrigin.ctorParameters = function () { return [
  4367. { type: core.ElementRef }
  4368. ]; };
  4369. return MatAutocompleteOrigin;
  4370. }());
  4371. /**
  4372. * @fileoverview added by tsickle
  4373. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  4374. */
  4375. /**
  4376. * The height of each autocomplete option.
  4377. * @type {?}
  4378. */
  4379. var AUTOCOMPLETE_OPTION_HEIGHT = 48;
  4380. /**
  4381. * The total height of the autocomplete panel.
  4382. * @type {?}
  4383. */
  4384. var AUTOCOMPLETE_PANEL_HEIGHT = 256;
  4385. /**
  4386. * Injection token that determines the scroll handling while the autocomplete panel is open.
  4387. * @type {?}
  4388. */
  4389. var MAT_AUTOCOMPLETE_SCROLL_STRATEGY = new core.InjectionToken('mat-autocomplete-scroll-strategy');
  4390. /**
  4391. * \@docs-private
  4392. * @param {?} overlay
  4393. * @return {?}
  4394. */
  4395. function MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY(overlay$$1) {
  4396. return (/**
  4397. * @return {?}
  4398. */
  4399. function () { return overlay$$1.scrollStrategies.reposition(); });
  4400. }
  4401. /**
  4402. * \@docs-private
  4403. * @type {?}
  4404. */
  4405. var MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY_PROVIDER = {
  4406. provide: MAT_AUTOCOMPLETE_SCROLL_STRATEGY,
  4407. deps: [overlay.Overlay],
  4408. useFactory: MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY,
  4409. };
  4410. /**
  4411. * Provider that allows the autocomplete to register as a ControlValueAccessor.
  4412. * \@docs-private
  4413. * @type {?}
  4414. */
  4415. var MAT_AUTOCOMPLETE_VALUE_ACCESSOR = {
  4416. provide: forms.NG_VALUE_ACCESSOR,
  4417. useExisting: core.forwardRef((/**
  4418. * @return {?}
  4419. */
  4420. function () { return MatAutocompleteTrigger; })),
  4421. multi: true
  4422. };
  4423. /**
  4424. * Creates an error to be thrown when attempting to use an autocomplete trigger without a panel.
  4425. * \@docs-private
  4426. * @return {?}
  4427. */
  4428. function getMatAutocompleteMissingPanelError() {
  4429. return Error('Attempting to open an undefined instance of `mat-autocomplete`. ' +
  4430. 'Make sure that the id passed to the `matAutocomplete` is correct and that ' +
  4431. 'you\'re attempting to open it after the ngAfterContentInit hook.');
  4432. }
  4433. var MatAutocompleteTrigger = /** @class */ (function () {
  4434. function MatAutocompleteTrigger(_element, _overlay, _viewContainerRef, _zone, _changeDetectorRef, scrollStrategy, _dir, _formField, _document, _viewportRuler) {
  4435. var _this = this;
  4436. this._element = _element;
  4437. this._overlay = _overlay;
  4438. this._viewContainerRef = _viewContainerRef;
  4439. this._zone = _zone;
  4440. this._changeDetectorRef = _changeDetectorRef;
  4441. this._dir = _dir;
  4442. this._formField = _formField;
  4443. this._document = _document;
  4444. this._viewportRuler = _viewportRuler;
  4445. this._componentDestroyed = false;
  4446. this._autocompleteDisabled = false;
  4447. /**
  4448. * Whether or not the label state is being overridden.
  4449. */
  4450. this._manuallyFloatingLabel = false;
  4451. /**
  4452. * Subscription to viewport size changes.
  4453. */
  4454. this._viewportSubscription = rxjs.Subscription.EMPTY;
  4455. /**
  4456. * Whether the autocomplete can open the next time it is focused. Used to prevent a focused,
  4457. * closed autocomplete from being reopened if the user switches to another browser tab and then
  4458. * comes back.
  4459. */
  4460. this._canOpenOnNextFocus = true;
  4461. /**
  4462. * Stream of keyboard events that can close the panel.
  4463. */
  4464. this._closeKeyEventStream = new rxjs.Subject();
  4465. /**
  4466. * Event handler for when the window is blurred. Needs to be an
  4467. * arrow function in order to preserve the context.
  4468. */
  4469. this._windowBlurHandler = (/**
  4470. * @return {?}
  4471. */
  4472. function () {
  4473. // If the user blurred the window while the autocomplete is focused, it means that it'll be
  4474. // refocused when they come back. In this case we want to skip the first focus event, if the
  4475. // pane was closed, in order to avoid reopening it unintentionally.
  4476. _this._canOpenOnNextFocus =
  4477. _this._document.activeElement !== _this._element.nativeElement || _this.panelOpen;
  4478. });
  4479. /**
  4480. * `View -> model callback called when value changes`
  4481. */
  4482. this._onChange = (/**
  4483. * @return {?}
  4484. */
  4485. function () { });
  4486. /**
  4487. * `View -> model callback called when autocomplete has been touched`
  4488. */
  4489. this._onTouched = (/**
  4490. * @return {?}
  4491. */
  4492. function () { });
  4493. /**
  4494. * Position of the autocomplete panel relative to the trigger element. A position of `auto`
  4495. * will render the panel underneath the trigger if there is enough space for it to fit in
  4496. * the viewport, otherwise the panel will be shown above it. If the position is set to
  4497. * `above` or `below`, the panel will always be shown above or below the trigger. no matter
  4498. * whether it fits completely in the viewport.
  4499. */
  4500. this.position = 'auto';
  4501. /**
  4502. * `autocomplete` attribute to be set on the input element.
  4503. * \@docs-private
  4504. */
  4505. this.autocompleteAttribute = 'off';
  4506. this._overlayAttached = false;
  4507. /**
  4508. * Stream of autocomplete option selections.
  4509. */
  4510. this.optionSelections = (/** @type {?} */ (rxjs.defer((/**
  4511. * @return {?}
  4512. */
  4513. function () {
  4514. if (_this.autocomplete && _this.autocomplete.options) {
  4515. return rxjs.merge.apply(void 0, _this.autocomplete.options.map((/**
  4516. * @param {?} option
  4517. * @return {?}
  4518. */
  4519. function (option) { return option.onSelectionChange; })));
  4520. }
  4521. // If there are any subscribers before `ngAfterViewInit`, the `autocomplete` will be undefined.
  4522. // Return a stream that we'll replace with the real one once everything is in place.
  4523. return _this._zone.onStable
  4524. .asObservable()
  4525. .pipe(operators.take(1), operators.switchMap((/**
  4526. * @return {?}
  4527. */
  4528. function () { return _this.optionSelections; })));
  4529. }))));
  4530. if (typeof window !== 'undefined') {
  4531. _zone.runOutsideAngular((/**
  4532. * @return {?}
  4533. */
  4534. function () {
  4535. window.addEventListener('blur', _this._windowBlurHandler);
  4536. }));
  4537. }
  4538. this._scrollStrategy = scrollStrategy;
  4539. }
  4540. Object.defineProperty(MatAutocompleteTrigger.prototype, "autocompleteDisabled", {
  4541. /**
  4542. * Whether the autocomplete is disabled. When disabled, the element will
  4543. * act as a regular input and the user won't be able to open the panel.
  4544. */
  4545. get: /**
  4546. * Whether the autocomplete is disabled. When disabled, the element will
  4547. * act as a regular input and the user won't be able to open the panel.
  4548. * @return {?}
  4549. */
  4550. function () { return this._autocompleteDisabled; },
  4551. set: /**
  4552. * @param {?} value
  4553. * @return {?}
  4554. */
  4555. function (value) {
  4556. this._autocompleteDisabled = coercion.coerceBooleanProperty(value);
  4557. },
  4558. enumerable: true,
  4559. configurable: true
  4560. });
  4561. /**
  4562. * @param {?} changes
  4563. * @return {?}
  4564. */
  4565. MatAutocompleteTrigger.prototype.ngOnChanges = /**
  4566. * @param {?} changes
  4567. * @return {?}
  4568. */
  4569. function (changes) {
  4570. if (changes['position'] && this._positionStrategy) {
  4571. this._setStrategyPositions(this._positionStrategy);
  4572. if (this.panelOpen) {
  4573. (/** @type {?} */ (this._overlayRef)).updatePosition();
  4574. }
  4575. }
  4576. };
  4577. /**
  4578. * @return {?}
  4579. */
  4580. MatAutocompleteTrigger.prototype.ngOnDestroy = /**
  4581. * @return {?}
  4582. */
  4583. function () {
  4584. if (typeof window !== 'undefined') {
  4585. window.removeEventListener('blur', this._windowBlurHandler);
  4586. }
  4587. this._viewportSubscription.unsubscribe();
  4588. this._componentDestroyed = true;
  4589. this._destroyPanel();
  4590. this._closeKeyEventStream.complete();
  4591. };
  4592. Object.defineProperty(MatAutocompleteTrigger.prototype, "panelOpen", {
  4593. /** Whether or not the autocomplete panel is open. */
  4594. get: /**
  4595. * Whether or not the autocomplete panel is open.
  4596. * @return {?}
  4597. */
  4598. function () {
  4599. return this._overlayAttached && this.autocomplete.showPanel;
  4600. },
  4601. enumerable: true,
  4602. configurable: true
  4603. });
  4604. /** Opens the autocomplete suggestion panel. */
  4605. /**
  4606. * Opens the autocomplete suggestion panel.
  4607. * @return {?}
  4608. */
  4609. MatAutocompleteTrigger.prototype.openPanel = /**
  4610. * Opens the autocomplete suggestion panel.
  4611. * @return {?}
  4612. */
  4613. function () {
  4614. this._attachOverlay();
  4615. this._floatLabel();
  4616. };
  4617. /** Closes the autocomplete suggestion panel. */
  4618. /**
  4619. * Closes the autocomplete suggestion panel.
  4620. * @return {?}
  4621. */
  4622. MatAutocompleteTrigger.prototype.closePanel = /**
  4623. * Closes the autocomplete suggestion panel.
  4624. * @return {?}
  4625. */
  4626. function () {
  4627. this._resetLabel();
  4628. if (!this._overlayAttached) {
  4629. return;
  4630. }
  4631. if (this.panelOpen) {
  4632. // Only emit if the panel was visible.
  4633. this.autocomplete.closed.emit();
  4634. }
  4635. this.autocomplete._isOpen = this._overlayAttached = false;
  4636. if (this._overlayRef && this._overlayRef.hasAttached()) {
  4637. this._overlayRef.detach();
  4638. this._closingActionsSubscription.unsubscribe();
  4639. }
  4640. // Note that in some cases this can end up being called after the component is destroyed.
  4641. // Add a check to ensure that we don't try to run change detection on a destroyed view.
  4642. if (!this._componentDestroyed) {
  4643. // We need to trigger change detection manually, because
  4644. // `fromEvent` doesn't seem to do it at the proper time.
  4645. // This ensures that the label is reset when the
  4646. // user clicks outside.
  4647. this._changeDetectorRef.detectChanges();
  4648. }
  4649. };
  4650. /**
  4651. * Updates the position of the autocomplete suggestion panel to ensure that it fits all options
  4652. * within the viewport.
  4653. */
  4654. /**
  4655. * Updates the position of the autocomplete suggestion panel to ensure that it fits all options
  4656. * within the viewport.
  4657. * @return {?}
  4658. */
  4659. MatAutocompleteTrigger.prototype.updatePosition = /**
  4660. * Updates the position of the autocomplete suggestion panel to ensure that it fits all options
  4661. * within the viewport.
  4662. * @return {?}
  4663. */
  4664. function () {
  4665. if (this._overlayAttached) {
  4666. (/** @type {?} */ (this._overlayRef)).updatePosition();
  4667. }
  4668. };
  4669. Object.defineProperty(MatAutocompleteTrigger.prototype, "panelClosingActions", {
  4670. /**
  4671. * A stream of actions that should close the autocomplete panel, including
  4672. * when an option is selected, on blur, and when TAB is pressed.
  4673. */
  4674. get: /**
  4675. * A stream of actions that should close the autocomplete panel, including
  4676. * when an option is selected, on blur, and when TAB is pressed.
  4677. * @return {?}
  4678. */
  4679. function () {
  4680. var _this = this;
  4681. return rxjs.merge(this.optionSelections, this.autocomplete._keyManager.tabOut.pipe(operators.filter((/**
  4682. * @return {?}
  4683. */
  4684. function () { return _this._overlayAttached; }))), this._closeKeyEventStream, this._getOutsideClickStream(), this._overlayRef ?
  4685. this._overlayRef.detachments().pipe(operators.filter((/**
  4686. * @return {?}
  4687. */
  4688. function () { return _this._overlayAttached; }))) :
  4689. rxjs.of()).pipe(
  4690. // Normalize the output so we return a consistent type.
  4691. operators.map((/**
  4692. * @param {?} event
  4693. * @return {?}
  4694. */
  4695. function (event) { return event instanceof MatOptionSelectionChange ? event : null; })));
  4696. },
  4697. enumerable: true,
  4698. configurable: true
  4699. });
  4700. Object.defineProperty(MatAutocompleteTrigger.prototype, "activeOption", {
  4701. /** The currently active option, coerced to MatOption type. */
  4702. get: /**
  4703. * The currently active option, coerced to MatOption type.
  4704. * @return {?}
  4705. */
  4706. function () {
  4707. if (this.autocomplete && this.autocomplete._keyManager) {
  4708. return this.autocomplete._keyManager.activeItem;
  4709. }
  4710. return null;
  4711. },
  4712. enumerable: true,
  4713. configurable: true
  4714. });
  4715. /** Stream of clicks outside of the autocomplete panel. */
  4716. /**
  4717. * Stream of clicks outside of the autocomplete panel.
  4718. * @private
  4719. * @return {?}
  4720. */
  4721. MatAutocompleteTrigger.prototype._getOutsideClickStream = /**
  4722. * Stream of clicks outside of the autocomplete panel.
  4723. * @private
  4724. * @return {?}
  4725. */
  4726. function () {
  4727. var _this = this;
  4728. return rxjs.merge((/** @type {?} */ (rxjs.fromEvent(this._document, 'click'))), (/** @type {?} */ (rxjs.fromEvent(this._document, 'touchend'))))
  4729. .pipe(operators.filter((/**
  4730. * @param {?} event
  4731. * @return {?}
  4732. */
  4733. function (event) {
  4734. /** @type {?} */
  4735. var clickTarget = (/** @type {?} */ (event.target));
  4736. /** @type {?} */
  4737. var formField = _this._formField ?
  4738. _this._formField._elementRef.nativeElement : null;
  4739. return _this._overlayAttached &&
  4740. clickTarget !== _this._element.nativeElement &&
  4741. (!formField || !formField.contains(clickTarget)) &&
  4742. (!!_this._overlayRef && !_this._overlayRef.overlayElement.contains(clickTarget));
  4743. })));
  4744. };
  4745. // Implemented as part of ControlValueAccessor.
  4746. // Implemented as part of ControlValueAccessor.
  4747. /**
  4748. * @param {?} value
  4749. * @return {?}
  4750. */
  4751. MatAutocompleteTrigger.prototype.writeValue =
  4752. // Implemented as part of ControlValueAccessor.
  4753. /**
  4754. * @param {?} value
  4755. * @return {?}
  4756. */
  4757. function (value) {
  4758. var _this = this;
  4759. Promise.resolve(null).then((/**
  4760. * @return {?}
  4761. */
  4762. function () { return _this._setTriggerValue(value); }));
  4763. };
  4764. // Implemented as part of ControlValueAccessor.
  4765. // Implemented as part of ControlValueAccessor.
  4766. /**
  4767. * @param {?} fn
  4768. * @return {?}
  4769. */
  4770. MatAutocompleteTrigger.prototype.registerOnChange =
  4771. // Implemented as part of ControlValueAccessor.
  4772. /**
  4773. * @param {?} fn
  4774. * @return {?}
  4775. */
  4776. function (fn) {
  4777. this._onChange = fn;
  4778. };
  4779. // Implemented as part of ControlValueAccessor.
  4780. // Implemented as part of ControlValueAccessor.
  4781. /**
  4782. * @param {?} fn
  4783. * @return {?}
  4784. */
  4785. MatAutocompleteTrigger.prototype.registerOnTouched =
  4786. // Implemented as part of ControlValueAccessor.
  4787. /**
  4788. * @param {?} fn
  4789. * @return {?}
  4790. */
  4791. function (fn) {
  4792. this._onTouched = fn;
  4793. };
  4794. // Implemented as part of ControlValueAccessor.
  4795. // Implemented as part of ControlValueAccessor.
  4796. /**
  4797. * @param {?} isDisabled
  4798. * @return {?}
  4799. */
  4800. MatAutocompleteTrigger.prototype.setDisabledState =
  4801. // Implemented as part of ControlValueAccessor.
  4802. /**
  4803. * @param {?} isDisabled
  4804. * @return {?}
  4805. */
  4806. function (isDisabled) {
  4807. this._element.nativeElement.disabled = isDisabled;
  4808. };
  4809. /**
  4810. * @param {?} event
  4811. * @return {?}
  4812. */
  4813. MatAutocompleteTrigger.prototype._handleKeydown = /**
  4814. * @param {?} event
  4815. * @return {?}
  4816. */
  4817. function (event) {
  4818. /** @type {?} */
  4819. var keyCode = event.keyCode;
  4820. // Prevent the default action on all escape key presses. This is here primarily to bring IE
  4821. // in line with other browsers. By default, pressing escape on IE will cause it to revert
  4822. // the input value to the one that it had on focus, however it won't dispatch any events
  4823. // which means that the model value will be out of sync with the view.
  4824. if (keyCode === keycodes.ESCAPE) {
  4825. event.preventDefault();
  4826. }
  4827. if (this.activeOption && keyCode === keycodes.ENTER && this.panelOpen) {
  4828. this.activeOption._selectViaInteraction();
  4829. this._resetActiveItem();
  4830. event.preventDefault();
  4831. }
  4832. else if (this.autocomplete) {
  4833. /** @type {?} */
  4834. var prevActiveItem = this.autocomplete._keyManager.activeItem;
  4835. /** @type {?} */
  4836. var isArrowKey = keyCode === keycodes.UP_ARROW || keyCode === keycodes.DOWN_ARROW;
  4837. if (this.panelOpen || keyCode === keycodes.TAB) {
  4838. this.autocomplete._keyManager.onKeydown(event);
  4839. }
  4840. else if (isArrowKey && this._canOpen()) {
  4841. this.openPanel();
  4842. }
  4843. if (isArrowKey || this.autocomplete._keyManager.activeItem !== prevActiveItem) {
  4844. this._scrollToOption();
  4845. }
  4846. }
  4847. };
  4848. /**
  4849. * @param {?} event
  4850. * @return {?}
  4851. */
  4852. MatAutocompleteTrigger.prototype._handleInput = /**
  4853. * @param {?} event
  4854. * @return {?}
  4855. */
  4856. function (event) {
  4857. /** @type {?} */
  4858. var target = (/** @type {?} */ (event.target));
  4859. /** @type {?} */
  4860. var value = target.value;
  4861. // Based on `NumberValueAccessor` from forms.
  4862. if (target.type === 'number') {
  4863. value = value == '' ? null : parseFloat(value);
  4864. }
  4865. // If the input has a placeholder, IE will fire the `input` event on page load,
  4866. // focus and blur, in addition to when the user actually changed the value. To
  4867. // filter out all of the extra events, we save the value on focus and between
  4868. // `input` events, and we check whether it changed.
  4869. // See: https://connect.microsoft.com/IE/feedback/details/885747/
  4870. if (this._previousValue !== value) {
  4871. this._previousValue = value;
  4872. this._onChange(value);
  4873. if (this._canOpen() && this._document.activeElement === event.target) {
  4874. this.openPanel();
  4875. }
  4876. }
  4877. };
  4878. /**
  4879. * @return {?}
  4880. */
  4881. MatAutocompleteTrigger.prototype._handleFocus = /**
  4882. * @return {?}
  4883. */
  4884. function () {
  4885. if (!this._canOpenOnNextFocus) {
  4886. this._canOpenOnNextFocus = true;
  4887. }
  4888. else if (this._canOpen()) {
  4889. this._previousValue = this._element.nativeElement.value;
  4890. this._attachOverlay();
  4891. this._floatLabel(true);
  4892. }
  4893. };
  4894. /**
  4895. * In "auto" mode, the label will animate down as soon as focus is lost.
  4896. * This causes the value to jump when selecting an option with the mouse.
  4897. * This method manually floats the label until the panel can be closed.
  4898. * @param shouldAnimate Whether the label should be animated when it is floated.
  4899. */
  4900. /**
  4901. * In "auto" mode, the label will animate down as soon as focus is lost.
  4902. * This causes the value to jump when selecting an option with the mouse.
  4903. * This method manually floats the label until the panel can be closed.
  4904. * @private
  4905. * @param {?=} shouldAnimate Whether the label should be animated when it is floated.
  4906. * @return {?}
  4907. */
  4908. MatAutocompleteTrigger.prototype._floatLabel = /**
  4909. * In "auto" mode, the label will animate down as soon as focus is lost.
  4910. * This causes the value to jump when selecting an option with the mouse.
  4911. * This method manually floats the label until the panel can be closed.
  4912. * @private
  4913. * @param {?=} shouldAnimate Whether the label should be animated when it is floated.
  4914. * @return {?}
  4915. */
  4916. function (shouldAnimate) {
  4917. if (shouldAnimate === void 0) { shouldAnimate = false; }
  4918. if (this._formField && this._formField.floatLabel === 'auto') {
  4919. if (shouldAnimate) {
  4920. this._formField._animateAndLockLabel();
  4921. }
  4922. else {
  4923. this._formField.floatLabel = 'always';
  4924. }
  4925. this._manuallyFloatingLabel = true;
  4926. }
  4927. };
  4928. /** If the label has been manually elevated, return it to its normal state. */
  4929. /**
  4930. * If the label has been manually elevated, return it to its normal state.
  4931. * @private
  4932. * @return {?}
  4933. */
  4934. MatAutocompleteTrigger.prototype._resetLabel = /**
  4935. * If the label has been manually elevated, return it to its normal state.
  4936. * @private
  4937. * @return {?}
  4938. */
  4939. function () {
  4940. if (this._manuallyFloatingLabel) {
  4941. this._formField.floatLabel = 'auto';
  4942. this._manuallyFloatingLabel = false;
  4943. }
  4944. };
  4945. /**
  4946. * Given that we are not actually focusing active options, we must manually adjust scroll
  4947. * to reveal options below the fold. First, we find the offset of the option from the top
  4948. * of the panel. If that offset is below the fold, the new scrollTop will be the offset -
  4949. * the panel height + the option height, so the active option will be just visible at the
  4950. * bottom of the panel. If that offset is above the top of the visible panel, the new scrollTop
  4951. * will become the offset. If that offset is visible within the panel already, the scrollTop is
  4952. * not adjusted.
  4953. */
  4954. /**
  4955. * Given that we are not actually focusing active options, we must manually adjust scroll
  4956. * to reveal options below the fold. First, we find the offset of the option from the top
  4957. * of the panel. If that offset is below the fold, the new scrollTop will be the offset -
  4958. * the panel height + the option height, so the active option will be just visible at the
  4959. * bottom of the panel. If that offset is above the top of the visible panel, the new scrollTop
  4960. * will become the offset. If that offset is visible within the panel already, the scrollTop is
  4961. * not adjusted.
  4962. * @private
  4963. * @return {?}
  4964. */
  4965. MatAutocompleteTrigger.prototype._scrollToOption = /**
  4966. * Given that we are not actually focusing active options, we must manually adjust scroll
  4967. * to reveal options below the fold. First, we find the offset of the option from the top
  4968. * of the panel. If that offset is below the fold, the new scrollTop will be the offset -
  4969. * the panel height + the option height, so the active option will be just visible at the
  4970. * bottom of the panel. If that offset is above the top of the visible panel, the new scrollTop
  4971. * will become the offset. If that offset is visible within the panel already, the scrollTop is
  4972. * not adjusted.
  4973. * @private
  4974. * @return {?}
  4975. */
  4976. function () {
  4977. /** @type {?} */
  4978. var index = this.autocomplete._keyManager.activeItemIndex || 0;
  4979. /** @type {?} */
  4980. var labelCount = _countGroupLabelsBeforeOption(index, this.autocomplete.options, this.autocomplete.optionGroups);
  4981. /** @type {?} */
  4982. var newScrollPosition = _getOptionScrollPosition(index + labelCount, AUTOCOMPLETE_OPTION_HEIGHT, this.autocomplete._getScrollTop(), AUTOCOMPLETE_PANEL_HEIGHT);
  4983. this.autocomplete._setScrollTop(newScrollPosition);
  4984. };
  4985. /**
  4986. * This method listens to a stream of panel closing actions and resets the
  4987. * stream every time the option list changes.
  4988. */
  4989. /**
  4990. * This method listens to a stream of panel closing actions and resets the
  4991. * stream every time the option list changes.
  4992. * @private
  4993. * @return {?}
  4994. */
  4995. MatAutocompleteTrigger.prototype._subscribeToClosingActions = /**
  4996. * This method listens to a stream of panel closing actions and resets the
  4997. * stream every time the option list changes.
  4998. * @private
  4999. * @return {?}
  5000. */
  5001. function () {
  5002. var _this = this;
  5003. /** @type {?} */
  5004. var firstStable = this._zone.onStable.asObservable().pipe(operators.take(1));
  5005. /** @type {?} */
  5006. var optionChanges = this.autocomplete.options.changes.pipe(operators.tap((/**
  5007. * @return {?}
  5008. */
  5009. function () { return _this._positionStrategy.reapplyLastPosition(); })),
  5010. // Defer emitting to the stream until the next tick, because changing
  5011. // bindings in here will cause "changed after checked" errors.
  5012. operators.delay(0));
  5013. // When the zone is stable initially, and when the option list changes...
  5014. return rxjs.merge(firstStable, optionChanges)
  5015. .pipe(
  5016. // create a new stream of panelClosingActions, replacing any previous streams
  5017. // that were created, and flatten it so our stream only emits closing events...
  5018. operators.switchMap((/**
  5019. * @return {?}
  5020. */
  5021. function () {
  5022. /** @type {?} */
  5023. var wasOpen = _this.panelOpen;
  5024. _this._resetActiveItem();
  5025. _this.autocomplete._setVisibility();
  5026. if (_this.panelOpen) {
  5027. (/** @type {?} */ (_this._overlayRef)).updatePosition();
  5028. // If the `panelOpen` state changed, we need to make sure to emit the `opened`
  5029. // event, because we may not have emitted it when the panel was attached. This
  5030. // can happen if the users opens the panel and there are no options, but the
  5031. // options come in slightly later or as a result of the value changing.
  5032. if (wasOpen !== _this.panelOpen) {
  5033. _this.autocomplete.opened.emit();
  5034. }
  5035. }
  5036. return _this.panelClosingActions;
  5037. })),
  5038. // when the first closing event occurs...
  5039. operators.take(1))
  5040. // set the value, close the panel, and complete.
  5041. .subscribe((/**
  5042. * @param {?} event
  5043. * @return {?}
  5044. */
  5045. function (event) { return _this._setValueAndClose(event); }));
  5046. };
  5047. /** Destroys the autocomplete suggestion panel. */
  5048. /**
  5049. * Destroys the autocomplete suggestion panel.
  5050. * @private
  5051. * @return {?}
  5052. */
  5053. MatAutocompleteTrigger.prototype._destroyPanel = /**
  5054. * Destroys the autocomplete suggestion panel.
  5055. * @private
  5056. * @return {?}
  5057. */
  5058. function () {
  5059. if (this._overlayRef) {
  5060. this.closePanel();
  5061. this._overlayRef.dispose();
  5062. this._overlayRef = null;
  5063. }
  5064. };
  5065. /**
  5066. * @private
  5067. * @param {?} value
  5068. * @return {?}
  5069. */
  5070. MatAutocompleteTrigger.prototype._setTriggerValue = /**
  5071. * @private
  5072. * @param {?} value
  5073. * @return {?}
  5074. */
  5075. function (value) {
  5076. /** @type {?} */
  5077. var toDisplay = this.autocomplete && this.autocomplete.displayWith ?
  5078. this.autocomplete.displayWith(value) :
  5079. value;
  5080. // Simply falling back to an empty string if the display value is falsy does not work properly.
  5081. // The display value can also be the number zero and shouldn't fall back to an empty string.
  5082. /** @type {?} */
  5083. var inputValue = toDisplay != null ? toDisplay : '';
  5084. // If it's used within a `MatFormField`, we should set it through the property so it can go
  5085. // through change detection.
  5086. if (this._formField) {
  5087. this._formField._control.value = inputValue;
  5088. }
  5089. else {
  5090. this._element.nativeElement.value = inputValue;
  5091. }
  5092. this._previousValue = inputValue;
  5093. };
  5094. /**
  5095. * This method closes the panel, and if a value is specified, also sets the associated
  5096. * control to that value. It will also mark the control as dirty if this interaction
  5097. * stemmed from the user.
  5098. */
  5099. /**
  5100. * This method closes the panel, and if a value is specified, also sets the associated
  5101. * control to that value. It will also mark the control as dirty if this interaction
  5102. * stemmed from the user.
  5103. * @private
  5104. * @param {?} event
  5105. * @return {?}
  5106. */
  5107. MatAutocompleteTrigger.prototype._setValueAndClose = /**
  5108. * This method closes the panel, and if a value is specified, also sets the associated
  5109. * control to that value. It will also mark the control as dirty if this interaction
  5110. * stemmed from the user.
  5111. * @private
  5112. * @param {?} event
  5113. * @return {?}
  5114. */
  5115. function (event) {
  5116. if (event && event.source) {
  5117. this._clearPreviousSelectedOption(event.source);
  5118. this._setTriggerValue(event.source.value);
  5119. this._onChange(event.source.value);
  5120. this._element.nativeElement.focus();
  5121. this.autocomplete._emitSelectEvent(event.source);
  5122. }
  5123. this.closePanel();
  5124. };
  5125. /**
  5126. * Clear any previous selected option and emit a selection change event for this option
  5127. */
  5128. /**
  5129. * Clear any previous selected option and emit a selection change event for this option
  5130. * @private
  5131. * @param {?} skip
  5132. * @return {?}
  5133. */
  5134. MatAutocompleteTrigger.prototype._clearPreviousSelectedOption = /**
  5135. * Clear any previous selected option and emit a selection change event for this option
  5136. * @private
  5137. * @param {?} skip
  5138. * @return {?}
  5139. */
  5140. function (skip) {
  5141. this.autocomplete.options.forEach((/**
  5142. * @param {?} option
  5143. * @return {?}
  5144. */
  5145. function (option) {
  5146. if (option != skip && option.selected) {
  5147. option.deselect();
  5148. }
  5149. }));
  5150. };
  5151. /**
  5152. * @private
  5153. * @return {?}
  5154. */
  5155. MatAutocompleteTrigger.prototype._attachOverlay = /**
  5156. * @private
  5157. * @return {?}
  5158. */
  5159. function () {
  5160. var _this = this;
  5161. if (!this.autocomplete) {
  5162. throw getMatAutocompleteMissingPanelError();
  5163. }
  5164. /** @type {?} */
  5165. var overlayRef = this._overlayRef;
  5166. if (!overlayRef) {
  5167. this._portal = new portal.TemplatePortal(this.autocomplete.template, this._viewContainerRef);
  5168. overlayRef = this._overlay.create(this._getOverlayConfig());
  5169. this._overlayRef = overlayRef;
  5170. // Use the `keydownEvents` in order to take advantage of
  5171. // the overlay event targeting provided by the CDK overlay.
  5172. overlayRef.keydownEvents().subscribe((/**
  5173. * @param {?} event
  5174. * @return {?}
  5175. */
  5176. function (event) {
  5177. // Close when pressing ESCAPE or ALT + UP_ARROW, based on the a11y guidelines.
  5178. // See: https://www.w3.org/TR/wai-aria-practices-1.1/#textbox-keyboard-interaction
  5179. if (event.keyCode === keycodes.ESCAPE || (event.keyCode === keycodes.UP_ARROW && event.altKey)) {
  5180. _this._resetActiveItem();
  5181. _this._closeKeyEventStream.next();
  5182. // We need to stop propagation, otherwise the event will eventually
  5183. // reach the input itself and cause the overlay to be reopened.
  5184. event.stopPropagation();
  5185. event.preventDefault();
  5186. }
  5187. }));
  5188. if (this._viewportRuler) {
  5189. this._viewportSubscription = this._viewportRuler.change().subscribe((/**
  5190. * @return {?}
  5191. */
  5192. function () {
  5193. if (_this.panelOpen && overlayRef) {
  5194. overlayRef.updateSize({ width: _this._getPanelWidth() });
  5195. }
  5196. }));
  5197. }
  5198. }
  5199. else {
  5200. // Update the trigger, panel width and direction, in case anything has changed.
  5201. this._positionStrategy.setOrigin(this._getConnectedElement());
  5202. overlayRef.updateSize({ width: this._getPanelWidth() });
  5203. }
  5204. if (overlayRef && !overlayRef.hasAttached()) {
  5205. overlayRef.attach(this._portal);
  5206. this._closingActionsSubscription = this._subscribeToClosingActions();
  5207. }
  5208. /** @type {?} */
  5209. var wasOpen = this.panelOpen;
  5210. this.autocomplete._setVisibility();
  5211. this.autocomplete._isOpen = this._overlayAttached = true;
  5212. // We need to do an extra `panelOpen` check in here, because the
  5213. // autocomplete won't be shown if there are no options.
  5214. if (this.panelOpen && wasOpen !== this.panelOpen) {
  5215. this.autocomplete.opened.emit();
  5216. }
  5217. };
  5218. /**
  5219. * @private
  5220. * @return {?}
  5221. */
  5222. MatAutocompleteTrigger.prototype._getOverlayConfig = /**
  5223. * @private
  5224. * @return {?}
  5225. */
  5226. function () {
  5227. return new overlay.OverlayConfig({
  5228. positionStrategy: this._getOverlayPosition(),
  5229. scrollStrategy: this._scrollStrategy(),
  5230. width: this._getPanelWidth(),
  5231. direction: this._dir
  5232. });
  5233. };
  5234. /**
  5235. * @private
  5236. * @return {?}
  5237. */
  5238. MatAutocompleteTrigger.prototype._getOverlayPosition = /**
  5239. * @private
  5240. * @return {?}
  5241. */
  5242. function () {
  5243. /** @type {?} */
  5244. var strategy = this._overlay.position()
  5245. .flexibleConnectedTo(this._getConnectedElement())
  5246. .withFlexibleDimensions(false)
  5247. .withPush(false);
  5248. this._setStrategyPositions(strategy);
  5249. this._positionStrategy = strategy;
  5250. return strategy;
  5251. };
  5252. /** Sets the positions on a position strategy based on the directive's input state. */
  5253. /**
  5254. * Sets the positions on a position strategy based on the directive's input state.
  5255. * @private
  5256. * @param {?} positionStrategy
  5257. * @return {?}
  5258. */
  5259. MatAutocompleteTrigger.prototype._setStrategyPositions = /**
  5260. * Sets the positions on a position strategy based on the directive's input state.
  5261. * @private
  5262. * @param {?} positionStrategy
  5263. * @return {?}
  5264. */
  5265. function (positionStrategy) {
  5266. /** @type {?} */
  5267. var belowPosition = {
  5268. originX: 'start',
  5269. originY: 'bottom',
  5270. overlayX: 'start',
  5271. overlayY: 'top'
  5272. };
  5273. /** @type {?} */
  5274. var abovePosition = {
  5275. originX: 'start',
  5276. originY: 'top',
  5277. overlayX: 'start',
  5278. overlayY: 'bottom',
  5279. // The overlay edge connected to the trigger should have squared corners, while
  5280. // the opposite end has rounded corners. We apply a CSS class to swap the
  5281. // border-radius based on the overlay position.
  5282. panelClass: 'mat-autocomplete-panel-above'
  5283. };
  5284. /** @type {?} */
  5285. var positions;
  5286. if (this.position === 'above') {
  5287. positions = [abovePosition];
  5288. }
  5289. else if (this.position === 'below') {
  5290. positions = [belowPosition];
  5291. }
  5292. else {
  5293. positions = [belowPosition, abovePosition];
  5294. }
  5295. positionStrategy.withPositions(positions);
  5296. };
  5297. /**
  5298. * @private
  5299. * @return {?}
  5300. */
  5301. MatAutocompleteTrigger.prototype._getConnectedElement = /**
  5302. * @private
  5303. * @return {?}
  5304. */
  5305. function () {
  5306. if (this.connectedTo) {
  5307. return this.connectedTo.elementRef;
  5308. }
  5309. return this._formField ? this._formField.getConnectedOverlayOrigin() : this._element;
  5310. };
  5311. /**
  5312. * @private
  5313. * @return {?}
  5314. */
  5315. MatAutocompleteTrigger.prototype._getPanelWidth = /**
  5316. * @private
  5317. * @return {?}
  5318. */
  5319. function () {
  5320. return this.autocomplete.panelWidth || this._getHostWidth();
  5321. };
  5322. /** Returns the width of the input element, so the panel width can match it. */
  5323. /**
  5324. * Returns the width of the input element, so the panel width can match it.
  5325. * @private
  5326. * @return {?}
  5327. */
  5328. MatAutocompleteTrigger.prototype._getHostWidth = /**
  5329. * Returns the width of the input element, so the panel width can match it.
  5330. * @private
  5331. * @return {?}
  5332. */
  5333. function () {
  5334. return this._getConnectedElement().nativeElement.getBoundingClientRect().width;
  5335. };
  5336. /**
  5337. * Resets the active item to -1 so arrow events will activate the
  5338. * correct options, or to 0 if the consumer opted into it.
  5339. */
  5340. /**
  5341. * Resets the active item to -1 so arrow events will activate the
  5342. * correct options, or to 0 if the consumer opted into it.
  5343. * @private
  5344. * @return {?}
  5345. */
  5346. MatAutocompleteTrigger.prototype._resetActiveItem = /**
  5347. * Resets the active item to -1 so arrow events will activate the
  5348. * correct options, or to 0 if the consumer opted into it.
  5349. * @private
  5350. * @return {?}
  5351. */
  5352. function () {
  5353. this.autocomplete._keyManager.setActiveItem(this.autocomplete.autoActiveFirstOption ? 0 : -1);
  5354. };
  5355. /** Determines whether the panel can be opened. */
  5356. /**
  5357. * Determines whether the panel can be opened.
  5358. * @private
  5359. * @return {?}
  5360. */
  5361. MatAutocompleteTrigger.prototype._canOpen = /**
  5362. * Determines whether the panel can be opened.
  5363. * @private
  5364. * @return {?}
  5365. */
  5366. function () {
  5367. /** @type {?} */
  5368. var element = this._element.nativeElement;
  5369. return !element.readOnly && !element.disabled && !this._autocompleteDisabled;
  5370. };
  5371. MatAutocompleteTrigger.decorators = [
  5372. { type: core.Directive, args: [{
  5373. selector: "input[matAutocomplete], textarea[matAutocomplete]",
  5374. host: {
  5375. '[attr.autocomplete]': 'autocompleteAttribute',
  5376. '[attr.role]': 'autocompleteDisabled ? null : "combobox"',
  5377. '[attr.aria-autocomplete]': 'autocompleteDisabled ? null : "list"',
  5378. '[attr.aria-activedescendant]': '(panelOpen && activeOption) ? activeOption.id : null',
  5379. '[attr.aria-expanded]': 'autocompleteDisabled ? null : panelOpen.toString()',
  5380. '[attr.aria-owns]': '(autocompleteDisabled || !panelOpen) ? null : autocomplete?.id',
  5381. '[attr.aria-haspopup]': '!autocompleteDisabled',
  5382. // Note: we use `focusin`, as opposed to `focus`, in order to open the panel
  5383. // a little earlier. This avoids issues where IE delays the focusing of the input.
  5384. '(focusin)': '_handleFocus()',
  5385. '(blur)': '_onTouched()',
  5386. '(input)': '_handleInput($event)',
  5387. '(keydown)': '_handleKeydown($event)',
  5388. },
  5389. exportAs: 'matAutocompleteTrigger',
  5390. providers: [MAT_AUTOCOMPLETE_VALUE_ACCESSOR]
  5391. },] },
  5392. ];
  5393. /** @nocollapse */
  5394. MatAutocompleteTrigger.ctorParameters = function () { return [
  5395. { type: core.ElementRef },
  5396. { type: overlay.Overlay },
  5397. { type: core.ViewContainerRef },
  5398. { type: core.NgZone },
  5399. { type: core.ChangeDetectorRef },
  5400. { type: undefined, decorators: [{ type: core.Inject, args: [MAT_AUTOCOMPLETE_SCROLL_STRATEGY,] }] },
  5401. { type: bidi.Directionality, decorators: [{ type: core.Optional }] },
  5402. { type: MatFormField, decorators: [{ type: core.Optional }, { type: core.Host }] },
  5403. { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [common.DOCUMENT,] }] },
  5404. { type: scrolling.ViewportRuler }
  5405. ]; };
  5406. MatAutocompleteTrigger.propDecorators = {
  5407. autocomplete: [{ type: core.Input, args: ['matAutocomplete',] }],
  5408. position: [{ type: core.Input, args: ['matAutocompletePosition',] }],
  5409. connectedTo: [{ type: core.Input, args: ['matAutocompleteConnectedTo',] }],
  5410. autocompleteAttribute: [{ type: core.Input, args: ['autocomplete',] }],
  5411. autocompleteDisabled: [{ type: core.Input, args: ['matAutocompleteDisabled',] }]
  5412. };
  5413. return MatAutocompleteTrigger;
  5414. }());
  5415. /**
  5416. * @fileoverview added by tsickle
  5417. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  5418. */
  5419. var MatAutocompleteModule = /** @class */ (function () {
  5420. function MatAutocompleteModule() {
  5421. }
  5422. MatAutocompleteModule.decorators = [
  5423. { type: core.NgModule, args: [{
  5424. imports: [MatOptionModule, overlay.OverlayModule, MatCommonModule, common.CommonModule],
  5425. exports: [
  5426. MatAutocomplete,
  5427. MatOptionModule,
  5428. MatAutocompleteTrigger,
  5429. MatAutocompleteOrigin,
  5430. MatCommonModule
  5431. ],
  5432. declarations: [MatAutocomplete, MatAutocompleteTrigger, MatAutocompleteOrigin],
  5433. providers: [MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY_PROVIDER],
  5434. },] },
  5435. ];
  5436. return MatAutocompleteModule;
  5437. }());
  5438. /**
  5439. * @fileoverview added by tsickle
  5440. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  5441. */
  5442. /** @type {?} */
  5443. var nextId = 0;
  5444. // Boilerplate for applying mixins to MatBadge.
  5445. /**
  5446. * \@docs-private
  5447. */
  5448. var
  5449. // Boilerplate for applying mixins to MatBadge.
  5450. /**
  5451. * \@docs-private
  5452. */
  5453. MatBadgeBase = /** @class */ (function () {
  5454. function MatBadgeBase() {
  5455. }
  5456. return MatBadgeBase;
  5457. }());
  5458. /** @type {?} */
  5459. var _MatBadgeMixinBase = mixinDisabled(MatBadgeBase);
  5460. /**
  5461. * Directive to display a text badge.
  5462. */
  5463. var MatBadge = /** @class */ (function (_super) {
  5464. __extends(MatBadge, _super);
  5465. function MatBadge(_ngZone, _elementRef, _ariaDescriber, _renderer, _animationMode) {
  5466. var _this = _super.call(this) || this;
  5467. _this._ngZone = _ngZone;
  5468. _this._elementRef = _elementRef;
  5469. _this._ariaDescriber = _ariaDescriber;
  5470. _this._renderer = _renderer;
  5471. _this._animationMode = _animationMode;
  5472. /**
  5473. * Whether the badge has any content.
  5474. */
  5475. _this._hasContent = false;
  5476. _this._color = 'primary';
  5477. _this._overlap = true;
  5478. /**
  5479. * Position the badge should reside.
  5480. * Accepts any combination of 'above'|'below' and 'before'|'after'
  5481. */
  5482. _this.position = 'above after';
  5483. /**
  5484. * Size of the badge. Can be 'small', 'medium', or 'large'.
  5485. */
  5486. _this.size = 'medium';
  5487. /**
  5488. * Unique id for the badge
  5489. */
  5490. _this._id = nextId++;
  5491. if (core.isDevMode()) {
  5492. /** @type {?} */
  5493. var nativeElement = _elementRef.nativeElement;
  5494. if (nativeElement.nodeType !== nativeElement.ELEMENT_NODE) {
  5495. throw Error('matBadge must be attached to an element node.');
  5496. }
  5497. }
  5498. return _this;
  5499. }
  5500. Object.defineProperty(MatBadge.prototype, "color", {
  5501. /** The color of the badge. Can be `primary`, `accent`, or `warn`. */
  5502. get: /**
  5503. * The color of the badge. Can be `primary`, `accent`, or `warn`.
  5504. * @return {?}
  5505. */
  5506. function () { return this._color; },
  5507. set: /**
  5508. * @param {?} value
  5509. * @return {?}
  5510. */
  5511. function (value) {
  5512. this._setColor(value);
  5513. this._color = value;
  5514. },
  5515. enumerable: true,
  5516. configurable: true
  5517. });
  5518. Object.defineProperty(MatBadge.prototype, "overlap", {
  5519. /** Whether the badge should overlap its contents or not */
  5520. get: /**
  5521. * Whether the badge should overlap its contents or not
  5522. * @return {?}
  5523. */
  5524. function () { return this._overlap; },
  5525. set: /**
  5526. * @param {?} val
  5527. * @return {?}
  5528. */
  5529. function (val) {
  5530. this._overlap = coercion.coerceBooleanProperty(val);
  5531. },
  5532. enumerable: true,
  5533. configurable: true
  5534. });
  5535. Object.defineProperty(MatBadge.prototype, "description", {
  5536. /** Message used to describe the decorated element via aria-describedby */
  5537. get: /**
  5538. * Message used to describe the decorated element via aria-describedby
  5539. * @return {?}
  5540. */
  5541. function () { return this._description; },
  5542. set: /**
  5543. * @param {?} newDescription
  5544. * @return {?}
  5545. */
  5546. function (newDescription) {
  5547. if (newDescription !== this._description) {
  5548. /** @type {?} */
  5549. var badgeElement = this._badgeElement;
  5550. this._updateHostAriaDescription(newDescription, this._description);
  5551. this._description = newDescription;
  5552. if (badgeElement) {
  5553. newDescription ? badgeElement.setAttribute('aria-label', newDescription) :
  5554. badgeElement.removeAttribute('aria-label');
  5555. }
  5556. }
  5557. },
  5558. enumerable: true,
  5559. configurable: true
  5560. });
  5561. Object.defineProperty(MatBadge.prototype, "hidden", {
  5562. /** Whether the badge is hidden. */
  5563. get: /**
  5564. * Whether the badge is hidden.
  5565. * @return {?}
  5566. */
  5567. function () { return this._hidden; },
  5568. set: /**
  5569. * @param {?} val
  5570. * @return {?}
  5571. */
  5572. function (val) {
  5573. this._hidden = coercion.coerceBooleanProperty(val);
  5574. },
  5575. enumerable: true,
  5576. configurable: true
  5577. });
  5578. /** Whether the badge is above the host or not */
  5579. /**
  5580. * Whether the badge is above the host or not
  5581. * @return {?}
  5582. */
  5583. MatBadge.prototype.isAbove = /**
  5584. * Whether the badge is above the host or not
  5585. * @return {?}
  5586. */
  5587. function () {
  5588. return this.position.indexOf('below') === -1;
  5589. };
  5590. /** Whether the badge is after the host or not */
  5591. /**
  5592. * Whether the badge is after the host or not
  5593. * @return {?}
  5594. */
  5595. MatBadge.prototype.isAfter = /**
  5596. * Whether the badge is after the host or not
  5597. * @return {?}
  5598. */
  5599. function () {
  5600. return this.position.indexOf('before') === -1;
  5601. };
  5602. /**
  5603. * @param {?} changes
  5604. * @return {?}
  5605. */
  5606. MatBadge.prototype.ngOnChanges = /**
  5607. * @param {?} changes
  5608. * @return {?}
  5609. */
  5610. function (changes) {
  5611. /** @type {?} */
  5612. var contentChange = changes['content'];
  5613. if (contentChange) {
  5614. /** @type {?} */
  5615. var value = contentChange.currentValue;
  5616. this._hasContent = value != null && ("" + value).trim().length > 0;
  5617. this._updateTextContent();
  5618. }
  5619. };
  5620. /**
  5621. * @return {?}
  5622. */
  5623. MatBadge.prototype.ngOnDestroy = /**
  5624. * @return {?}
  5625. */
  5626. function () {
  5627. /** @type {?} */
  5628. var badgeElement = this._badgeElement;
  5629. if (badgeElement) {
  5630. if (this.description) {
  5631. this._ariaDescriber.removeDescription(badgeElement, this.description);
  5632. }
  5633. // When creating a badge through the Renderer, Angular will keep it in an index.
  5634. // We have to destroy it ourselves, otherwise it'll be retained in memory.
  5635. if (this._renderer.destroyNode) {
  5636. this._renderer.destroyNode(badgeElement);
  5637. }
  5638. }
  5639. };
  5640. /**
  5641. * Gets the element into which the badge's content is being rendered.
  5642. * Undefined if the element hasn't been created (e.g. if the badge doesn't have content).
  5643. */
  5644. /**
  5645. * Gets the element into which the badge's content is being rendered.
  5646. * Undefined if the element hasn't been created (e.g. if the badge doesn't have content).
  5647. * @return {?}
  5648. */
  5649. MatBadge.prototype.getBadgeElement = /**
  5650. * Gets the element into which the badge's content is being rendered.
  5651. * Undefined if the element hasn't been created (e.g. if the badge doesn't have content).
  5652. * @return {?}
  5653. */
  5654. function () {
  5655. return this._badgeElement;
  5656. };
  5657. /** Injects a span element into the DOM with the content. */
  5658. /**
  5659. * Injects a span element into the DOM with the content.
  5660. * @private
  5661. * @return {?}
  5662. */
  5663. MatBadge.prototype._updateTextContent = /**
  5664. * Injects a span element into the DOM with the content.
  5665. * @private
  5666. * @return {?}
  5667. */
  5668. function () {
  5669. if (!this._badgeElement) {
  5670. this._badgeElement = this._createBadgeElement();
  5671. }
  5672. else {
  5673. this._badgeElement.textContent = this.content;
  5674. }
  5675. return this._badgeElement;
  5676. };
  5677. /** Creates the badge element */
  5678. /**
  5679. * Creates the badge element
  5680. * @private
  5681. * @return {?}
  5682. */
  5683. MatBadge.prototype._createBadgeElement = /**
  5684. * Creates the badge element
  5685. * @private
  5686. * @return {?}
  5687. */
  5688. function () {
  5689. /** @type {?} */
  5690. var badgeElement = this._renderer.createElement('span');
  5691. /** @type {?} */
  5692. var activeClass = 'mat-badge-active';
  5693. /** @type {?} */
  5694. var contentClass = 'mat-badge-content';
  5695. // Clear any existing badges which may have persisted from a server-side render.
  5696. this._clearExistingBadges(contentClass);
  5697. badgeElement.setAttribute('id', "mat-badge-content-" + this._id);
  5698. badgeElement.classList.add(contentClass);
  5699. badgeElement.textContent = this.content;
  5700. if (this._animationMode === 'NoopAnimations') {
  5701. badgeElement.classList.add('_mat-animation-noopable');
  5702. }
  5703. if (this.description) {
  5704. badgeElement.setAttribute('aria-label', this.description);
  5705. }
  5706. this._elementRef.nativeElement.appendChild(badgeElement);
  5707. // animate in after insertion
  5708. if (typeof requestAnimationFrame === 'function' && this._animationMode !== 'NoopAnimations') {
  5709. this._ngZone.runOutsideAngular((/**
  5710. * @return {?}
  5711. */
  5712. function () {
  5713. requestAnimationFrame((/**
  5714. * @return {?}
  5715. */
  5716. function () {
  5717. badgeElement.classList.add(activeClass);
  5718. }));
  5719. }));
  5720. }
  5721. else {
  5722. badgeElement.classList.add(activeClass);
  5723. }
  5724. return badgeElement;
  5725. };
  5726. /** Sets the aria-label property on the element */
  5727. /**
  5728. * Sets the aria-label property on the element
  5729. * @private
  5730. * @param {?} newDescription
  5731. * @param {?} oldDescription
  5732. * @return {?}
  5733. */
  5734. MatBadge.prototype._updateHostAriaDescription = /**
  5735. * Sets the aria-label property on the element
  5736. * @private
  5737. * @param {?} newDescription
  5738. * @param {?} oldDescription
  5739. * @return {?}
  5740. */
  5741. function (newDescription, oldDescription) {
  5742. // ensure content available before setting label
  5743. /** @type {?} */
  5744. var content = this._updateTextContent();
  5745. if (oldDescription) {
  5746. this._ariaDescriber.removeDescription(content, oldDescription);
  5747. }
  5748. if (newDescription) {
  5749. this._ariaDescriber.describe(content, newDescription);
  5750. }
  5751. };
  5752. /** Adds css theme class given the color to the component host */
  5753. /**
  5754. * Adds css theme class given the color to the component host
  5755. * @private
  5756. * @param {?} colorPalette
  5757. * @return {?}
  5758. */
  5759. MatBadge.prototype._setColor = /**
  5760. * Adds css theme class given the color to the component host
  5761. * @private
  5762. * @param {?} colorPalette
  5763. * @return {?}
  5764. */
  5765. function (colorPalette) {
  5766. if (colorPalette !== this._color) {
  5767. if (this._color) {
  5768. this._elementRef.nativeElement.classList.remove("mat-badge-" + this._color);
  5769. }
  5770. if (colorPalette) {
  5771. this._elementRef.nativeElement.classList.add("mat-badge-" + colorPalette);
  5772. }
  5773. }
  5774. };
  5775. /** Clears any existing badges that might be left over from server-side rendering. */
  5776. /**
  5777. * Clears any existing badges that might be left over from server-side rendering.
  5778. * @private
  5779. * @param {?} cssClass
  5780. * @return {?}
  5781. */
  5782. MatBadge.prototype._clearExistingBadges = /**
  5783. * Clears any existing badges that might be left over from server-side rendering.
  5784. * @private
  5785. * @param {?} cssClass
  5786. * @return {?}
  5787. */
  5788. function (cssClass) {
  5789. /** @type {?} */
  5790. var element = this._elementRef.nativeElement;
  5791. /** @type {?} */
  5792. var childCount = element.children.length;
  5793. // Use a reverse while, because we'll be removing elements from the list as we're iterating.
  5794. while (childCount--) {
  5795. /** @type {?} */
  5796. var currentChild = element.children[childCount];
  5797. if (currentChild.classList.contains(cssClass)) {
  5798. element.removeChild(currentChild);
  5799. }
  5800. }
  5801. };
  5802. MatBadge.decorators = [
  5803. { type: core.Directive, args: [{
  5804. selector: '[matBadge]',
  5805. inputs: ['disabled: matBadgeDisabled'],
  5806. host: {
  5807. 'class': 'mat-badge',
  5808. '[class.mat-badge-overlap]': 'overlap',
  5809. '[class.mat-badge-above]': 'isAbove()',
  5810. '[class.mat-badge-below]': '!isAbove()',
  5811. '[class.mat-badge-before]': '!isAfter()',
  5812. '[class.mat-badge-after]': 'isAfter()',
  5813. '[class.mat-badge-small]': 'size === "small"',
  5814. '[class.mat-badge-medium]': 'size === "medium"',
  5815. '[class.mat-badge-large]': 'size === "large"',
  5816. '[class.mat-badge-hidden]': 'hidden || !_hasContent',
  5817. '[class.mat-badge-disabled]': 'disabled',
  5818. },
  5819. },] },
  5820. ];
  5821. /** @nocollapse */
  5822. MatBadge.ctorParameters = function () { return [
  5823. { type: core.NgZone },
  5824. { type: core.ElementRef },
  5825. { type: a11y.AriaDescriber },
  5826. { type: core.Renderer2 },
  5827. { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
  5828. ]; };
  5829. MatBadge.propDecorators = {
  5830. color: [{ type: core.Input, args: ['matBadgeColor',] }],
  5831. overlap: [{ type: core.Input, args: ['matBadgeOverlap',] }],
  5832. position: [{ type: core.Input, args: ['matBadgePosition',] }],
  5833. content: [{ type: core.Input, args: ['matBadge',] }],
  5834. description: [{ type: core.Input, args: ['matBadgeDescription',] }],
  5835. size: [{ type: core.Input, args: ['matBadgeSize',] }],
  5836. hidden: [{ type: core.Input, args: ['matBadgeHidden',] }]
  5837. };
  5838. return MatBadge;
  5839. }(_MatBadgeMixinBase));
  5840. /**
  5841. * @fileoverview added by tsickle
  5842. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  5843. */
  5844. var MatBadgeModule = /** @class */ (function () {
  5845. function MatBadgeModule() {
  5846. }
  5847. MatBadgeModule.decorators = [
  5848. { type: core.NgModule, args: [{
  5849. imports: [
  5850. a11y.A11yModule,
  5851. MatCommonModule
  5852. ],
  5853. exports: [MatBadge],
  5854. declarations: [MatBadge],
  5855. },] },
  5856. ];
  5857. return MatBadgeModule;
  5858. }());
  5859. /**
  5860. * @fileoverview added by tsickle
  5861. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  5862. */
  5863. /**
  5864. * Injection token that can be used to access the data that was passed in to a bottom sheet.
  5865. * @type {?}
  5866. */
  5867. var MAT_BOTTOM_SHEET_DATA = new core.InjectionToken('MatBottomSheetData');
  5868. /**
  5869. * Configuration used when opening a bottom sheet.
  5870. * @template D
  5871. */
  5872. var /**
  5873. * Configuration used when opening a bottom sheet.
  5874. * @template D
  5875. */
  5876. MatBottomSheetConfig = /** @class */ (function () {
  5877. function MatBottomSheetConfig() {
  5878. /**
  5879. * Data being injected into the child component.
  5880. */
  5881. this.data = null;
  5882. /**
  5883. * Whether the bottom sheet has a backdrop.
  5884. */
  5885. this.hasBackdrop = true;
  5886. /**
  5887. * Whether the user can use escape or clicking outside to close the bottom sheet.
  5888. */
  5889. this.disableClose = false;
  5890. /**
  5891. * Aria label to assign to the bottom sheet element.
  5892. */
  5893. this.ariaLabel = null;
  5894. /**
  5895. * Whether the bottom sheet should close when the user goes backwards/forwards in history.
  5896. * Note that this usually doesn't include clicking on links (unless the user is using
  5897. * the `HashLocationStrategy`).
  5898. */
  5899. this.closeOnNavigation = true;
  5900. // Note that this is disabled by default, because while the a11y recommendations are to focus
  5901. // the first focusable element, doing so prevents screen readers from reading out the
  5902. // rest of the bottom sheet content.
  5903. /**
  5904. * Whether the bottom sheet should focus the first focusable element on open.
  5905. */
  5906. this.autoFocus = false;
  5907. /**
  5908. * Whether the bottom sheet should restore focus to the
  5909. * previously-focused element, after it's closed.
  5910. */
  5911. this.restoreFocus = true;
  5912. }
  5913. return MatBottomSheetConfig;
  5914. }());
  5915. /**
  5916. * @fileoverview added by tsickle
  5917. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  5918. */
  5919. /**
  5920. * Animations used by the Material bottom sheet.
  5921. * @type {?}
  5922. */
  5923. var matBottomSheetAnimations = {
  5924. /**
  5925. * Animation that shows and hides a bottom sheet.
  5926. */
  5927. bottomSheetState: animations$1.trigger('state', [
  5928. animations$1.state('void, hidden', animations$1.style({ transform: 'translateY(100%)' })),
  5929. animations$1.state('visible', animations$1.style({ transform: 'translateY(0%)' })),
  5930. animations$1.transition('visible => void, visible => hidden', animations$1.animate(AnimationDurations.COMPLEX + " " + AnimationCurves.ACCELERATION_CURVE)),
  5931. animations$1.transition('void => visible', animations$1.animate(AnimationDurations.EXITING + " " + AnimationCurves.DECELERATION_CURVE)),
  5932. ])
  5933. };
  5934. /**
  5935. * @fileoverview added by tsickle
  5936. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  5937. */
  5938. // TODO(crisbeto): consolidate some logic between this, MatDialog and MatSnackBar
  5939. /**
  5940. * Internal component that wraps user-provided bottom sheet content.
  5941. * \@docs-private
  5942. */
  5943. var MatBottomSheetContainer = /** @class */ (function (_super) {
  5944. __extends(MatBottomSheetContainer, _super);
  5945. function MatBottomSheetContainer(_elementRef, _changeDetectorRef, _focusTrapFactory, breakpointObserver, document, bottomSheetConfig) {
  5946. var _this = _super.call(this) || this;
  5947. _this._elementRef = _elementRef;
  5948. _this._changeDetectorRef = _changeDetectorRef;
  5949. _this._focusTrapFactory = _focusTrapFactory;
  5950. _this.bottomSheetConfig = bottomSheetConfig;
  5951. /**
  5952. * The state of the bottom sheet animations.
  5953. */
  5954. _this._animationState = 'void';
  5955. /**
  5956. * Emits whenever the state of the animation changes.
  5957. */
  5958. _this._animationStateChanged = new core.EventEmitter();
  5959. /**
  5960. * Element that was focused before the bottom sheet was opened.
  5961. */
  5962. _this._elementFocusedBeforeOpened = null;
  5963. _this._document = document;
  5964. _this._breakpointSubscription = breakpointObserver
  5965. .observe([layout.Breakpoints.Medium, layout.Breakpoints.Large, layout.Breakpoints.XLarge])
  5966. .subscribe((/**
  5967. * @return {?}
  5968. */
  5969. function () {
  5970. _this._toggleClass('mat-bottom-sheet-container-medium', breakpointObserver.isMatched(layout.Breakpoints.Medium));
  5971. _this._toggleClass('mat-bottom-sheet-container-large', breakpointObserver.isMatched(layout.Breakpoints.Large));
  5972. _this._toggleClass('mat-bottom-sheet-container-xlarge', breakpointObserver.isMatched(layout.Breakpoints.XLarge));
  5973. }));
  5974. return _this;
  5975. }
  5976. /** Attach a component portal as content to this bottom sheet container. */
  5977. /**
  5978. * Attach a component portal as content to this bottom sheet container.
  5979. * @template T
  5980. * @param {?} portal
  5981. * @return {?}
  5982. */
  5983. MatBottomSheetContainer.prototype.attachComponentPortal = /**
  5984. * Attach a component portal as content to this bottom sheet container.
  5985. * @template T
  5986. * @param {?} portal
  5987. * @return {?}
  5988. */
  5989. function (portal$$1) {
  5990. this._validatePortalAttached();
  5991. this._setPanelClass();
  5992. this._savePreviouslyFocusedElement();
  5993. return this._portalOutlet.attachComponentPortal(portal$$1);
  5994. };
  5995. /** Attach a template portal as content to this bottom sheet container. */
  5996. /**
  5997. * Attach a template portal as content to this bottom sheet container.
  5998. * @template C
  5999. * @param {?} portal
  6000. * @return {?}
  6001. */
  6002. MatBottomSheetContainer.prototype.attachTemplatePortal = /**
  6003. * Attach a template portal as content to this bottom sheet container.
  6004. * @template C
  6005. * @param {?} portal
  6006. * @return {?}
  6007. */
  6008. function (portal$$1) {
  6009. this._validatePortalAttached();
  6010. this._setPanelClass();
  6011. this._savePreviouslyFocusedElement();
  6012. return this._portalOutlet.attachTemplatePortal(portal$$1);
  6013. };
  6014. /** Begin animation of bottom sheet entrance into view. */
  6015. /**
  6016. * Begin animation of bottom sheet entrance into view.
  6017. * @return {?}
  6018. */
  6019. MatBottomSheetContainer.prototype.enter = /**
  6020. * Begin animation of bottom sheet entrance into view.
  6021. * @return {?}
  6022. */
  6023. function () {
  6024. if (!this._destroyed) {
  6025. this._animationState = 'visible';
  6026. this._changeDetectorRef.detectChanges();
  6027. }
  6028. };
  6029. /** Begin animation of the bottom sheet exiting from view. */
  6030. /**
  6031. * Begin animation of the bottom sheet exiting from view.
  6032. * @return {?}
  6033. */
  6034. MatBottomSheetContainer.prototype.exit = /**
  6035. * Begin animation of the bottom sheet exiting from view.
  6036. * @return {?}
  6037. */
  6038. function () {
  6039. if (!this._destroyed) {
  6040. this._animationState = 'hidden';
  6041. this._changeDetectorRef.markForCheck();
  6042. }
  6043. };
  6044. /**
  6045. * @return {?}
  6046. */
  6047. MatBottomSheetContainer.prototype.ngOnDestroy = /**
  6048. * @return {?}
  6049. */
  6050. function () {
  6051. this._breakpointSubscription.unsubscribe();
  6052. this._destroyed = true;
  6053. };
  6054. /**
  6055. * @param {?} event
  6056. * @return {?}
  6057. */
  6058. MatBottomSheetContainer.prototype._onAnimationDone = /**
  6059. * @param {?} event
  6060. * @return {?}
  6061. */
  6062. function (event) {
  6063. if (event.toState === 'hidden') {
  6064. this._restoreFocus();
  6065. }
  6066. else if (event.toState === 'visible') {
  6067. this._trapFocus();
  6068. }
  6069. this._animationStateChanged.emit(event);
  6070. };
  6071. /**
  6072. * @param {?} event
  6073. * @return {?}
  6074. */
  6075. MatBottomSheetContainer.prototype._onAnimationStart = /**
  6076. * @param {?} event
  6077. * @return {?}
  6078. */
  6079. function (event) {
  6080. this._animationStateChanged.emit(event);
  6081. };
  6082. /**
  6083. * @private
  6084. * @param {?} cssClass
  6085. * @param {?} add
  6086. * @return {?}
  6087. */
  6088. MatBottomSheetContainer.prototype._toggleClass = /**
  6089. * @private
  6090. * @param {?} cssClass
  6091. * @param {?} add
  6092. * @return {?}
  6093. */
  6094. function (cssClass, add) {
  6095. /** @type {?} */
  6096. var classList = this._elementRef.nativeElement.classList;
  6097. add ? classList.add(cssClass) : classList.remove(cssClass);
  6098. };
  6099. /**
  6100. * @private
  6101. * @return {?}
  6102. */
  6103. MatBottomSheetContainer.prototype._validatePortalAttached = /**
  6104. * @private
  6105. * @return {?}
  6106. */
  6107. function () {
  6108. if (this._portalOutlet.hasAttached()) {
  6109. throw Error('Attempting to attach bottom sheet content after content is already attached');
  6110. }
  6111. };
  6112. /**
  6113. * @private
  6114. * @return {?}
  6115. */
  6116. MatBottomSheetContainer.prototype._setPanelClass = /**
  6117. * @private
  6118. * @return {?}
  6119. */
  6120. function () {
  6121. /** @type {?} */
  6122. var element = this._elementRef.nativeElement;
  6123. /** @type {?} */
  6124. var panelClass = this.bottomSheetConfig.panelClass;
  6125. if (Array.isArray(panelClass)) {
  6126. // Note that we can't use a spread here, because IE doesn't support multiple arguments.
  6127. panelClass.forEach((/**
  6128. * @param {?} cssClass
  6129. * @return {?}
  6130. */
  6131. function (cssClass) { return element.classList.add(cssClass); }));
  6132. }
  6133. else if (panelClass) {
  6134. element.classList.add(panelClass);
  6135. }
  6136. };
  6137. /** Moves the focus inside the focus trap. */
  6138. /**
  6139. * Moves the focus inside the focus trap.
  6140. * @private
  6141. * @return {?}
  6142. */
  6143. MatBottomSheetContainer.prototype._trapFocus = /**
  6144. * Moves the focus inside the focus trap.
  6145. * @private
  6146. * @return {?}
  6147. */
  6148. function () {
  6149. /** @type {?} */
  6150. var element = this._elementRef.nativeElement;
  6151. if (!this._focusTrap) {
  6152. this._focusTrap = this._focusTrapFactory.create(element);
  6153. }
  6154. if (this.bottomSheetConfig.autoFocus) {
  6155. this._focusTrap.focusInitialElementWhenReady();
  6156. }
  6157. else {
  6158. /** @type {?} */
  6159. var activeElement = this._document.activeElement;
  6160. // Otherwise ensure that focus is on the container. It's possible that a different
  6161. // component tried to move focus while the open animation was running. See:
  6162. // https://github.com/angular/components/issues/16215. Note that we only want to do this
  6163. // if the focus isn't inside the bottom sheet already, because it's possible that the
  6164. // consumer turned off `autoFocus` in order to move focus themselves.
  6165. if (activeElement !== element && !element.contains(activeElement)) {
  6166. element.focus();
  6167. }
  6168. }
  6169. };
  6170. /** Restores focus to the element that was focused before the bottom sheet was opened. */
  6171. /**
  6172. * Restores focus to the element that was focused before the bottom sheet was opened.
  6173. * @private
  6174. * @return {?}
  6175. */
  6176. MatBottomSheetContainer.prototype._restoreFocus = /**
  6177. * Restores focus to the element that was focused before the bottom sheet was opened.
  6178. * @private
  6179. * @return {?}
  6180. */
  6181. function () {
  6182. /** @type {?} */
  6183. var toFocus = this._elementFocusedBeforeOpened;
  6184. // We need the extra check, because IE can set the `activeElement` to null in some cases.
  6185. if (this.bottomSheetConfig.restoreFocus && toFocus && typeof toFocus.focus === 'function') {
  6186. toFocus.focus();
  6187. }
  6188. if (this._focusTrap) {
  6189. this._focusTrap.destroy();
  6190. }
  6191. };
  6192. /** Saves a reference to the element that was focused before the bottom sheet was opened. */
  6193. /**
  6194. * Saves a reference to the element that was focused before the bottom sheet was opened.
  6195. * @private
  6196. * @return {?}
  6197. */
  6198. MatBottomSheetContainer.prototype._savePreviouslyFocusedElement = /**
  6199. * Saves a reference to the element that was focused before the bottom sheet was opened.
  6200. * @private
  6201. * @return {?}
  6202. */
  6203. function () {
  6204. var _this = this;
  6205. this._elementFocusedBeforeOpened = (/** @type {?} */ (this._document.activeElement));
  6206. // The `focus` method isn't available during server-side rendering.
  6207. if (this._elementRef.nativeElement.focus) {
  6208. Promise.resolve().then((/**
  6209. * @return {?}
  6210. */
  6211. function () { return _this._elementRef.nativeElement.focus(); }));
  6212. }
  6213. };
  6214. MatBottomSheetContainer.decorators = [
  6215. { type: core.Component, args: [{selector: 'mat-bottom-sheet-container',
  6216. template: "<ng-template cdkPortalOutlet></ng-template>",
  6217. styles: [".mat-bottom-sheet-container{padding:8px 16px;min-width:100vw;box-sizing:border-box;display:block;outline:0;max-height:80vh;overflow:auto}@media (-ms-high-contrast:active){.mat-bottom-sheet-container{outline:1px solid}}.mat-bottom-sheet-container-large,.mat-bottom-sheet-container-medium,.mat-bottom-sheet-container-xlarge{border-top-left-radius:4px;border-top-right-radius:4px}.mat-bottom-sheet-container-medium{min-width:384px;max-width:calc(100vw - 128px)}.mat-bottom-sheet-container-large{min-width:512px;max-width:calc(100vw - 256px)}.mat-bottom-sheet-container-xlarge{min-width:576px;max-width:calc(100vw - 384px)}"],
  6218. changeDetection: core.ChangeDetectionStrategy.OnPush,
  6219. encapsulation: core.ViewEncapsulation.None,
  6220. animations: [matBottomSheetAnimations.bottomSheetState],
  6221. host: {
  6222. 'class': 'mat-bottom-sheet-container',
  6223. 'tabindex': '-1',
  6224. 'role': 'dialog',
  6225. 'aria-modal': 'true',
  6226. '[attr.aria-label]': 'bottomSheetConfig?.ariaLabel',
  6227. '[@state]': '_animationState',
  6228. '(@state.start)': '_onAnimationStart($event)',
  6229. '(@state.done)': '_onAnimationDone($event)'
  6230. },
  6231. },] },
  6232. ];
  6233. /** @nocollapse */
  6234. MatBottomSheetContainer.ctorParameters = function () { return [
  6235. { type: core.ElementRef },
  6236. { type: core.ChangeDetectorRef },
  6237. { type: a11y.FocusTrapFactory },
  6238. { type: layout.BreakpointObserver },
  6239. { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [common.DOCUMENT,] }] },
  6240. { type: MatBottomSheetConfig }
  6241. ]; };
  6242. MatBottomSheetContainer.propDecorators = {
  6243. _portalOutlet: [{ type: core.ViewChild, args: [portal.CdkPortalOutlet, { static: true },] }]
  6244. };
  6245. return MatBottomSheetContainer;
  6246. }(portal.BasePortalOutlet));
  6247. /**
  6248. * @fileoverview added by tsickle
  6249. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  6250. */
  6251. var MatBottomSheetModule = /** @class */ (function () {
  6252. function MatBottomSheetModule() {
  6253. }
  6254. MatBottomSheetModule.decorators = [
  6255. { type: core.NgModule, args: [{
  6256. imports: [
  6257. common.CommonModule,
  6258. overlay.OverlayModule,
  6259. MatCommonModule,
  6260. portal.PortalModule,
  6261. ],
  6262. exports: [MatBottomSheetContainer, MatCommonModule],
  6263. declarations: [MatBottomSheetContainer],
  6264. entryComponents: [MatBottomSheetContainer],
  6265. },] },
  6266. ];
  6267. return MatBottomSheetModule;
  6268. }());
  6269. /**
  6270. * @fileoverview added by tsickle
  6271. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  6272. */
  6273. /**
  6274. * Reference to a bottom sheet dispatched from the bottom sheet service.
  6275. * @template T, R
  6276. */
  6277. var /**
  6278. * Reference to a bottom sheet dispatched from the bottom sheet service.
  6279. * @template T, R
  6280. */
  6281. MatBottomSheetRef = /** @class */ (function () {
  6282. function MatBottomSheetRef(containerInstance, _overlayRef,
  6283. // @breaking-change 8.0.0 `_location` parameter to be removed.
  6284. _location) {
  6285. var _this = this;
  6286. this._overlayRef = _overlayRef;
  6287. /**
  6288. * Subject for notifying the user that the bottom sheet has been dismissed.
  6289. */
  6290. this._afterDismissed = new rxjs.Subject();
  6291. /**
  6292. * Subject for notifying the user that the bottom sheet has opened and appeared.
  6293. */
  6294. this._afterOpened = new rxjs.Subject();
  6295. this.containerInstance = containerInstance;
  6296. this.disableClose = containerInstance.bottomSheetConfig.disableClose;
  6297. // Emit when opening animation completes
  6298. containerInstance._animationStateChanged.pipe(operators.filter((/**
  6299. * @param {?} event
  6300. * @return {?}
  6301. */
  6302. function (event) { return event.phaseName === 'done' && event.toState === 'visible'; })), operators.take(1))
  6303. .subscribe((/**
  6304. * @return {?}
  6305. */
  6306. function () {
  6307. _this._afterOpened.next();
  6308. _this._afterOpened.complete();
  6309. }));
  6310. // Dispose overlay when closing animation is complete
  6311. containerInstance._animationStateChanged
  6312. .pipe(operators.filter((/**
  6313. * @param {?} event
  6314. * @return {?}
  6315. */
  6316. function (event) { return event.phaseName === 'done' && event.toState === 'hidden'; })), operators.take(1))
  6317. .subscribe((/**
  6318. * @return {?}
  6319. */
  6320. function () {
  6321. clearTimeout(_this._closeFallbackTimeout);
  6322. _overlayRef.dispose();
  6323. }));
  6324. _overlayRef.detachments().pipe(operators.take(1)).subscribe((/**
  6325. * @return {?}
  6326. */
  6327. function () {
  6328. _this._afterDismissed.next(_this._result);
  6329. _this._afterDismissed.complete();
  6330. }));
  6331. rxjs.merge(_overlayRef.backdropClick(), _overlayRef.keydownEvents().pipe(operators.filter((/**
  6332. * @param {?} event
  6333. * @return {?}
  6334. */
  6335. function (event) { return event.keyCode === keycodes.ESCAPE; })))).subscribe((/**
  6336. * @param {?} event
  6337. * @return {?}
  6338. */
  6339. function (event) {
  6340. if (!_this.disableClose &&
  6341. (event.type !== 'keydown' || !keycodes.hasModifierKey((/** @type {?} */ (event))))) {
  6342. event.preventDefault();
  6343. _this.dismiss();
  6344. }
  6345. }));
  6346. }
  6347. /**
  6348. * Dismisses the bottom sheet.
  6349. * @param result Data to be passed back to the bottom sheet opener.
  6350. */
  6351. /**
  6352. * Dismisses the bottom sheet.
  6353. * @param {?=} result Data to be passed back to the bottom sheet opener.
  6354. * @return {?}
  6355. */
  6356. MatBottomSheetRef.prototype.dismiss = /**
  6357. * Dismisses the bottom sheet.
  6358. * @param {?=} result Data to be passed back to the bottom sheet opener.
  6359. * @return {?}
  6360. */
  6361. function (result) {
  6362. var _this = this;
  6363. if (!this._afterDismissed.closed) {
  6364. // Transition the backdrop in parallel to the bottom sheet.
  6365. this.containerInstance._animationStateChanged.pipe(operators.filter((/**
  6366. * @param {?} event
  6367. * @return {?}
  6368. */
  6369. function (event) { return event.phaseName === 'start'; })), operators.take(1)).subscribe((/**
  6370. * @param {?} event
  6371. * @return {?}
  6372. */
  6373. function (event) {
  6374. // The logic that disposes of the overlay depends on the exit animation completing, however
  6375. // it isn't guaranteed if the parent view is destroyed while it's running. Add a fallback
  6376. // timeout which will clean everything up if the animation hasn't fired within the specified
  6377. // amount of time plus 100ms. We don't need to run this outside the NgZone, because for the
  6378. // vast majority of cases the timeout will have been cleared before it has fired.
  6379. _this._closeFallbackTimeout = setTimeout((/**
  6380. * @return {?}
  6381. */
  6382. function () {
  6383. _this._overlayRef.dispose();
  6384. }), event.totalTime + 100);
  6385. _this._overlayRef.detachBackdrop();
  6386. }));
  6387. this._result = result;
  6388. this.containerInstance.exit();
  6389. }
  6390. };
  6391. /** Gets an observable that is notified when the bottom sheet is finished closing. */
  6392. /**
  6393. * Gets an observable that is notified when the bottom sheet is finished closing.
  6394. * @return {?}
  6395. */
  6396. MatBottomSheetRef.prototype.afterDismissed = /**
  6397. * Gets an observable that is notified when the bottom sheet is finished closing.
  6398. * @return {?}
  6399. */
  6400. function () {
  6401. return this._afterDismissed.asObservable();
  6402. };
  6403. /** Gets an observable that is notified when the bottom sheet has opened and appeared. */
  6404. /**
  6405. * Gets an observable that is notified when the bottom sheet has opened and appeared.
  6406. * @return {?}
  6407. */
  6408. MatBottomSheetRef.prototype.afterOpened = /**
  6409. * Gets an observable that is notified when the bottom sheet has opened and appeared.
  6410. * @return {?}
  6411. */
  6412. function () {
  6413. return this._afterOpened.asObservable();
  6414. };
  6415. /**
  6416. * Gets an observable that emits when the overlay's backdrop has been clicked.
  6417. */
  6418. /**
  6419. * Gets an observable that emits when the overlay's backdrop has been clicked.
  6420. * @return {?}
  6421. */
  6422. MatBottomSheetRef.prototype.backdropClick = /**
  6423. * Gets an observable that emits when the overlay's backdrop has been clicked.
  6424. * @return {?}
  6425. */
  6426. function () {
  6427. return this._overlayRef.backdropClick();
  6428. };
  6429. /**
  6430. * Gets an observable that emits when keydown events are targeted on the overlay.
  6431. */
  6432. /**
  6433. * Gets an observable that emits when keydown events are targeted on the overlay.
  6434. * @return {?}
  6435. */
  6436. MatBottomSheetRef.prototype.keydownEvents = /**
  6437. * Gets an observable that emits when keydown events are targeted on the overlay.
  6438. * @return {?}
  6439. */
  6440. function () {
  6441. return this._overlayRef.keydownEvents();
  6442. };
  6443. return MatBottomSheetRef;
  6444. }());
  6445. /**
  6446. * @fileoverview added by tsickle
  6447. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  6448. */
  6449. /**
  6450. * Injection token that can be used to specify default bottom sheet options.
  6451. * @type {?}
  6452. */
  6453. var MAT_BOTTOM_SHEET_DEFAULT_OPTIONS = new core.InjectionToken('mat-bottom-sheet-default-options');
  6454. /**
  6455. * Service to trigger Material Design bottom sheets.
  6456. */
  6457. var MatBottomSheet = /** @class */ (function () {
  6458. function MatBottomSheet(_overlay, _injector, _parentBottomSheet, _location, _defaultOptions) {
  6459. this._overlay = _overlay;
  6460. this._injector = _injector;
  6461. this._parentBottomSheet = _parentBottomSheet;
  6462. this._location = _location;
  6463. this._defaultOptions = _defaultOptions;
  6464. this._bottomSheetRefAtThisLevel = null;
  6465. }
  6466. Object.defineProperty(MatBottomSheet.prototype, "_openedBottomSheetRef", {
  6467. /** Reference to the currently opened bottom sheet. */
  6468. get: /**
  6469. * Reference to the currently opened bottom sheet.
  6470. * @return {?}
  6471. */
  6472. function () {
  6473. /** @type {?} */
  6474. var parent = this._parentBottomSheet;
  6475. return parent ? parent._openedBottomSheetRef : this._bottomSheetRefAtThisLevel;
  6476. },
  6477. set: /**
  6478. * @param {?} value
  6479. * @return {?}
  6480. */
  6481. function (value) {
  6482. if (this._parentBottomSheet) {
  6483. this._parentBottomSheet._openedBottomSheetRef = value;
  6484. }
  6485. else {
  6486. this._bottomSheetRefAtThisLevel = value;
  6487. }
  6488. },
  6489. enumerable: true,
  6490. configurable: true
  6491. });
  6492. /**
  6493. * @template T, D, R
  6494. * @param {?} componentOrTemplateRef
  6495. * @param {?=} config
  6496. * @return {?}
  6497. */
  6498. MatBottomSheet.prototype.open = /**
  6499. * @template T, D, R
  6500. * @param {?} componentOrTemplateRef
  6501. * @param {?=} config
  6502. * @return {?}
  6503. */
  6504. function (componentOrTemplateRef, config) {
  6505. var _this = this;
  6506. /** @type {?} */
  6507. var _config = _applyConfigDefaults(this._defaultOptions || new MatBottomSheetConfig(), config);
  6508. /** @type {?} */
  6509. var overlayRef = this._createOverlay(_config);
  6510. /** @type {?} */
  6511. var container = this._attachContainer(overlayRef, _config);
  6512. /** @type {?} */
  6513. var ref = new MatBottomSheetRef(container, overlayRef, this._location);
  6514. if (componentOrTemplateRef instanceof core.TemplateRef) {
  6515. container.attachTemplatePortal(new portal.TemplatePortal(componentOrTemplateRef, (/** @type {?} */ (null)), (/** @type {?} */ ({
  6516. $implicit: _config.data,
  6517. bottomSheetRef: ref
  6518. }))));
  6519. }
  6520. else {
  6521. /** @type {?} */
  6522. var portal$$1 = new portal.ComponentPortal(componentOrTemplateRef, undefined, this._createInjector(_config, ref));
  6523. /** @type {?} */
  6524. var contentRef = container.attachComponentPortal(portal$$1);
  6525. ref.instance = contentRef.instance;
  6526. }
  6527. // When the bottom sheet is dismissed, clear the reference to it.
  6528. ref.afterDismissed().subscribe((/**
  6529. * @return {?}
  6530. */
  6531. function () {
  6532. // Clear the bottom sheet ref if it hasn't already been replaced by a newer one.
  6533. if (_this._openedBottomSheetRef == ref) {
  6534. _this._openedBottomSheetRef = null;
  6535. }
  6536. }));
  6537. if (this._openedBottomSheetRef) {
  6538. // If a bottom sheet is already in view, dismiss it and enter the
  6539. // new bottom sheet after exit animation is complete.
  6540. this._openedBottomSheetRef.afterDismissed().subscribe((/**
  6541. * @return {?}
  6542. */
  6543. function () { return ref.containerInstance.enter(); }));
  6544. this._openedBottomSheetRef.dismiss();
  6545. }
  6546. else {
  6547. // If no bottom sheet is in view, enter the new bottom sheet.
  6548. ref.containerInstance.enter();
  6549. }
  6550. this._openedBottomSheetRef = ref;
  6551. return ref;
  6552. };
  6553. /**
  6554. * Dismisses the currently-visible bottom sheet.
  6555. */
  6556. /**
  6557. * Dismisses the currently-visible bottom sheet.
  6558. * @return {?}
  6559. */
  6560. MatBottomSheet.prototype.dismiss = /**
  6561. * Dismisses the currently-visible bottom sheet.
  6562. * @return {?}
  6563. */
  6564. function () {
  6565. if (this._openedBottomSheetRef) {
  6566. this._openedBottomSheetRef.dismiss();
  6567. }
  6568. };
  6569. /**
  6570. * @return {?}
  6571. */
  6572. MatBottomSheet.prototype.ngOnDestroy = /**
  6573. * @return {?}
  6574. */
  6575. function () {
  6576. if (this._bottomSheetRefAtThisLevel) {
  6577. this._bottomSheetRefAtThisLevel.dismiss();
  6578. }
  6579. };
  6580. /**
  6581. * Attaches the bottom sheet container component to the overlay.
  6582. */
  6583. /**
  6584. * Attaches the bottom sheet container component to the overlay.
  6585. * @private
  6586. * @param {?} overlayRef
  6587. * @param {?} config
  6588. * @return {?}
  6589. */
  6590. MatBottomSheet.prototype._attachContainer = /**
  6591. * Attaches the bottom sheet container component to the overlay.
  6592. * @private
  6593. * @param {?} overlayRef
  6594. * @param {?} config
  6595. * @return {?}
  6596. */
  6597. function (overlayRef, config) {
  6598. /** @type {?} */
  6599. var userInjector = config && config.viewContainerRef && config.viewContainerRef.injector;
  6600. /** @type {?} */
  6601. var injector = new portal.PortalInjector(userInjector || this._injector, new WeakMap([
  6602. [MatBottomSheetConfig, config]
  6603. ]));
  6604. /** @type {?} */
  6605. var containerPortal = new portal.ComponentPortal(MatBottomSheetContainer, config.viewContainerRef, injector);
  6606. /** @type {?} */
  6607. var containerRef = overlayRef.attach(containerPortal);
  6608. return containerRef.instance;
  6609. };
  6610. /**
  6611. * Creates a new overlay and places it in the correct location.
  6612. * @param config The user-specified bottom sheet config.
  6613. */
  6614. /**
  6615. * Creates a new overlay and places it in the correct location.
  6616. * @private
  6617. * @param {?} config The user-specified bottom sheet config.
  6618. * @return {?}
  6619. */
  6620. MatBottomSheet.prototype._createOverlay = /**
  6621. * Creates a new overlay and places it in the correct location.
  6622. * @private
  6623. * @param {?} config The user-specified bottom sheet config.
  6624. * @return {?}
  6625. */
  6626. function (config) {
  6627. /** @type {?} */
  6628. var overlayConfig = new overlay.OverlayConfig({
  6629. direction: config.direction,
  6630. hasBackdrop: config.hasBackdrop,
  6631. disposeOnNavigation: config.closeOnNavigation,
  6632. maxWidth: '100%',
  6633. scrollStrategy: config.scrollStrategy || this._overlay.scrollStrategies.block(),
  6634. positionStrategy: this._overlay.position().global().centerHorizontally().bottom('0')
  6635. });
  6636. if (config.backdropClass) {
  6637. overlayConfig.backdropClass = config.backdropClass;
  6638. }
  6639. return this._overlay.create(overlayConfig);
  6640. };
  6641. /**
  6642. * Creates an injector to be used inside of a bottom sheet component.
  6643. * @param config Config that was used to create the bottom sheet.
  6644. * @param bottomSheetRef Reference to the bottom sheet.
  6645. */
  6646. /**
  6647. * Creates an injector to be used inside of a bottom sheet component.
  6648. * @private
  6649. * @template T
  6650. * @param {?} config Config that was used to create the bottom sheet.
  6651. * @param {?} bottomSheetRef Reference to the bottom sheet.
  6652. * @return {?}
  6653. */
  6654. MatBottomSheet.prototype._createInjector = /**
  6655. * Creates an injector to be used inside of a bottom sheet component.
  6656. * @private
  6657. * @template T
  6658. * @param {?} config Config that was used to create the bottom sheet.
  6659. * @param {?} bottomSheetRef Reference to the bottom sheet.
  6660. * @return {?}
  6661. */
  6662. function (config, bottomSheetRef) {
  6663. /** @type {?} */
  6664. var userInjector = config && config.viewContainerRef && config.viewContainerRef.injector;
  6665. /** @type {?} */
  6666. var injectionTokens = new WeakMap([
  6667. [MatBottomSheetRef, bottomSheetRef],
  6668. [MAT_BOTTOM_SHEET_DATA, config.data]
  6669. ]);
  6670. if (config.direction &&
  6671. (!userInjector || !userInjector.get(bidi.Directionality, null))) {
  6672. injectionTokens.set(bidi.Directionality, {
  6673. value: config.direction,
  6674. change: rxjs.of()
  6675. });
  6676. }
  6677. return new portal.PortalInjector(userInjector || this._injector, injectionTokens);
  6678. };
  6679. MatBottomSheet.decorators = [
  6680. { type: core.Injectable, args: [{ providedIn: MatBottomSheetModule },] },
  6681. ];
  6682. /** @nocollapse */
  6683. MatBottomSheet.ctorParameters = function () { return [
  6684. { type: overlay.Overlay },
  6685. { type: core.Injector },
  6686. { type: MatBottomSheet, decorators: [{ type: core.Optional }, { type: core.SkipSelf }] },
  6687. { type: common.Location, decorators: [{ type: core.Optional }] },
  6688. { type: MatBottomSheetConfig, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_BOTTOM_SHEET_DEFAULT_OPTIONS,] }] }
  6689. ]; };
  6690. /** @nocollapse */ MatBottomSheet.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function MatBottomSheet_Factory() { return new MatBottomSheet(core.ɵɵinject(overlay.Overlay), core.ɵɵinject(core.INJECTOR), core.ɵɵinject(MatBottomSheet, 12), core.ɵɵinject(common.Location, 8), core.ɵɵinject(MAT_BOTTOM_SHEET_DEFAULT_OPTIONS, 8)); }, token: MatBottomSheet, providedIn: MatBottomSheetModule });
  6691. return MatBottomSheet;
  6692. }());
  6693. /**
  6694. * Applies default options to the bottom sheet config.
  6695. * @param {?} defaults Object containing the default values to which to fall back.
  6696. * @param {?=} config The configuration to which the defaults will be applied.
  6697. * @return {?} The new configuration object with defaults applied.
  6698. */
  6699. function _applyConfigDefaults(defaults, config) {
  6700. return __assign({}, defaults, config);
  6701. }
  6702. /**
  6703. * @fileoverview added by tsickle
  6704. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  6705. */
  6706. /**
  6707. * Default color palette for round buttons (mat-fab and mat-mini-fab)
  6708. * @type {?}
  6709. */
  6710. var DEFAULT_ROUND_BUTTON_COLOR = 'accent';
  6711. /**
  6712. * List of classes to add to MatButton instances based on host attributes to
  6713. * style as different variants.
  6714. * @type {?}
  6715. */
  6716. var BUTTON_HOST_ATTRIBUTES = [
  6717. 'mat-button',
  6718. 'mat-flat-button',
  6719. 'mat-icon-button',
  6720. 'mat-raised-button',
  6721. 'mat-stroked-button',
  6722. 'mat-mini-fab',
  6723. 'mat-fab',
  6724. ];
  6725. // Boilerplate for applying mixins to MatButton.
  6726. /**
  6727. * \@docs-private
  6728. */
  6729. var
  6730. // Boilerplate for applying mixins to MatButton.
  6731. /**
  6732. * \@docs-private
  6733. */
  6734. MatButtonBase = /** @class */ (function () {
  6735. function MatButtonBase(_elementRef) {
  6736. this._elementRef = _elementRef;
  6737. }
  6738. return MatButtonBase;
  6739. }());
  6740. /** @type {?} */
  6741. var _MatButtonMixinBase = mixinColor(mixinDisabled(mixinDisableRipple(MatButtonBase)));
  6742. /**
  6743. * Material design button.
  6744. */
  6745. var MatButton = /** @class */ (function (_super) {
  6746. __extends(MatButton, _super);
  6747. function MatButton(elementRef, _focusMonitor, _animationMode) {
  6748. var _this = _super.call(this, elementRef) || this;
  6749. _this._focusMonitor = _focusMonitor;
  6750. _this._animationMode = _animationMode;
  6751. /**
  6752. * Whether the button is round.
  6753. */
  6754. _this.isRoundButton = _this._hasHostAttributes('mat-fab', 'mat-mini-fab');
  6755. /**
  6756. * Whether the button is icon button.
  6757. */
  6758. _this.isIconButton = _this._hasHostAttributes('mat-icon-button');
  6759. // For each of the variant selectors that is present in the button's host
  6760. // attributes, add the correct corresponding class.
  6761. for (var _i = 0, BUTTON_HOST_ATTRIBUTES_1 = BUTTON_HOST_ATTRIBUTES; _i < BUTTON_HOST_ATTRIBUTES_1.length; _i++) {
  6762. var attr = BUTTON_HOST_ATTRIBUTES_1[_i];
  6763. if (_this._hasHostAttributes(attr)) {
  6764. ((/** @type {?} */ (_this._getHostElement()))).classList.add(attr);
  6765. }
  6766. }
  6767. // Add a class that applies to all buttons. This makes it easier to target if somebody
  6768. // wants to target all Material buttons. We do it here rather than `host` to ensure that
  6769. // the class is applied to derived classes.
  6770. elementRef.nativeElement.classList.add('mat-button-base');
  6771. _this._focusMonitor.monitor(_this._elementRef, true);
  6772. if (_this.isRoundButton) {
  6773. _this.color = DEFAULT_ROUND_BUTTON_COLOR;
  6774. }
  6775. return _this;
  6776. }
  6777. /**
  6778. * @return {?}
  6779. */
  6780. MatButton.prototype.ngOnDestroy = /**
  6781. * @return {?}
  6782. */
  6783. function () {
  6784. this._focusMonitor.stopMonitoring(this._elementRef);
  6785. };
  6786. /** Focuses the button. */
  6787. /**
  6788. * Focuses the button.
  6789. * @param {?=} _origin
  6790. * @param {?=} options
  6791. * @return {?}
  6792. */
  6793. MatButton.prototype.focus = /**
  6794. * Focuses the button.
  6795. * @param {?=} _origin
  6796. * @param {?=} options
  6797. * @return {?}
  6798. */
  6799. function (_origin, options) {
  6800. // Note that we aren't using `_origin`, but we need to keep it because some internal consumers
  6801. // use `MatButton` in a `FocusKeyManager` and we need it to match `FocusableOption`.
  6802. this._getHostElement().focus(options);
  6803. };
  6804. /**
  6805. * @return {?}
  6806. */
  6807. MatButton.prototype._getHostElement = /**
  6808. * @return {?}
  6809. */
  6810. function () {
  6811. return this._elementRef.nativeElement;
  6812. };
  6813. /**
  6814. * @return {?}
  6815. */
  6816. MatButton.prototype._isRippleDisabled = /**
  6817. * @return {?}
  6818. */
  6819. function () {
  6820. return this.disableRipple || this.disabled;
  6821. };
  6822. /** Gets whether the button has one of the given attributes. */
  6823. /**
  6824. * Gets whether the button has one of the given attributes.
  6825. * @param {...?} attributes
  6826. * @return {?}
  6827. */
  6828. MatButton.prototype._hasHostAttributes = /**
  6829. * Gets whether the button has one of the given attributes.
  6830. * @param {...?} attributes
  6831. * @return {?}
  6832. */
  6833. function () {
  6834. var _this = this;
  6835. var attributes = [];
  6836. for (var _i = 0; _i < arguments.length; _i++) {
  6837. attributes[_i] = arguments[_i];
  6838. }
  6839. return attributes.some((/**
  6840. * @param {?} attribute
  6841. * @return {?}
  6842. */
  6843. function (attribute) { return _this._getHostElement().hasAttribute(attribute); }));
  6844. };
  6845. MatButton.decorators = [
  6846. { type: core.Component, args: [{selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button],\n button[mat-fab], button[mat-mini-fab], button[mat-stroked-button],\n button[mat-flat-button]",
  6847. exportAs: 'matButton',
  6848. host: {
  6849. '[attr.disabled]': 'disabled || null',
  6850. '[class._mat-animation-noopable]': '_animationMode === "NoopAnimations"',
  6851. },
  6852. template: "<span class=\"mat-button-wrapper\"><ng-content></ng-content></span><div matRipple class=\"mat-button-ripple\" [class.mat-button-ripple-round]=\"isRoundButton || isIconButton\" [matRippleDisabled]=\"_isRippleDisabled()\" [matRippleCentered]=\"isIconButton\" [matRippleTrigger]=\"_getHostElement()\"></div><div class=\"mat-button-focus-overlay\"></div>",
  6853. styles: [".mat-button .mat-button-focus-overlay,.mat-icon-button .mat-button-focus-overlay{opacity:0}.mat-button:hover .mat-button-focus-overlay,.mat-stroked-button:hover .mat-button-focus-overlay{opacity:.04}@media (hover:none){.mat-button:hover .mat-button-focus-overlay,.mat-stroked-button:hover .mat-button-focus-overlay{opacity:0}}.mat-button,.mat-flat-button,.mat-icon-button,.mat-stroked-button{box-sizing:border-box;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer;outline:0;border:none;-webkit-tap-highlight-color:transparent;display:inline-block;white-space:nowrap;text-decoration:none;vertical-align:baseline;text-align:center;margin:0;min-width:64px;line-height:36px;padding:0 16px;border-radius:4px;overflow:visible}.mat-button::-moz-focus-inner,.mat-flat-button::-moz-focus-inner,.mat-icon-button::-moz-focus-inner,.mat-stroked-button::-moz-focus-inner{border:0}.mat-button[disabled],.mat-flat-button[disabled],.mat-icon-button[disabled],.mat-stroked-button[disabled]{cursor:default}.mat-button.cdk-keyboard-focused .mat-button-focus-overlay,.mat-button.cdk-program-focused .mat-button-focus-overlay,.mat-flat-button.cdk-keyboard-focused .mat-button-focus-overlay,.mat-flat-button.cdk-program-focused .mat-button-focus-overlay,.mat-icon-button.cdk-keyboard-focused .mat-button-focus-overlay,.mat-icon-button.cdk-program-focused .mat-button-focus-overlay,.mat-stroked-button.cdk-keyboard-focused .mat-button-focus-overlay,.mat-stroked-button.cdk-program-focused .mat-button-focus-overlay{opacity:.12}.mat-button::-moz-focus-inner,.mat-flat-button::-moz-focus-inner,.mat-icon-button::-moz-focus-inner,.mat-stroked-button::-moz-focus-inner{border:0}.mat-raised-button{box-sizing:border-box;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer;outline:0;border:none;-webkit-tap-highlight-color:transparent;display:inline-block;white-space:nowrap;text-decoration:none;vertical-align:baseline;text-align:center;margin:0;min-width:64px;line-height:36px;padding:0 16px;border-radius:4px;overflow:visible;transform:translate3d(0,0,0);transition:background .4s cubic-bezier(.25,.8,.25,1),box-shadow 280ms cubic-bezier(.4,0,.2,1)}.mat-raised-button::-moz-focus-inner{border:0}.mat-raised-button[disabled]{cursor:default}.mat-raised-button.cdk-keyboard-focused .mat-button-focus-overlay,.mat-raised-button.cdk-program-focused .mat-button-focus-overlay{opacity:.12}.mat-raised-button::-moz-focus-inner{border:0}._mat-animation-noopable.mat-raised-button{transition:none;animation:none}.mat-stroked-button{border:1px solid currentColor;padding:0 15px;line-height:34px}.mat-stroked-button .mat-button-focus-overlay,.mat-stroked-button .mat-button-ripple.mat-ripple{top:-1px;left:-1px;right:-1px;bottom:-1px}.mat-fab{box-sizing:border-box;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer;outline:0;border:none;-webkit-tap-highlight-color:transparent;display:inline-block;white-space:nowrap;text-decoration:none;vertical-align:baseline;text-align:center;margin:0;min-width:64px;line-height:36px;padding:0 16px;border-radius:4px;overflow:visible;transform:translate3d(0,0,0);transition:background .4s cubic-bezier(.25,.8,.25,1),box-shadow 280ms cubic-bezier(.4,0,.2,1);min-width:0;border-radius:50%;width:56px;height:56px;padding:0;flex-shrink:0}.mat-fab::-moz-focus-inner{border:0}.mat-fab[disabled]{cursor:default}.mat-fab.cdk-keyboard-focused .mat-button-focus-overlay,.mat-fab.cdk-program-focused .mat-button-focus-overlay{opacity:.12}.mat-fab::-moz-focus-inner{border:0}._mat-animation-noopable.mat-fab{transition:none;animation:none}.mat-fab .mat-button-wrapper{padding:16px 0;display:inline-block;line-height:24px}.mat-mini-fab{box-sizing:border-box;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer;outline:0;border:none;-webkit-tap-highlight-color:transparent;display:inline-block;white-space:nowrap;text-decoration:none;vertical-align:baseline;text-align:center;margin:0;min-width:64px;line-height:36px;padding:0 16px;border-radius:4px;overflow:visible;transform:translate3d(0,0,0);transition:background .4s cubic-bezier(.25,.8,.25,1),box-shadow 280ms cubic-bezier(.4,0,.2,1);min-width:0;border-radius:50%;width:40px;height:40px;padding:0;flex-shrink:0}.mat-mini-fab::-moz-focus-inner{border:0}.mat-mini-fab[disabled]{cursor:default}.mat-mini-fab.cdk-keyboard-focused .mat-button-focus-overlay,.mat-mini-fab.cdk-program-focused .mat-button-focus-overlay{opacity:.12}.mat-mini-fab::-moz-focus-inner{border:0}._mat-animation-noopable.mat-mini-fab{transition:none;animation:none}.mat-mini-fab .mat-button-wrapper{padding:8px 0;display:inline-block;line-height:24px}.mat-icon-button{padding:0;min-width:0;width:40px;height:40px;flex-shrink:0;line-height:40px;border-radius:50%}.mat-icon-button .mat-icon,.mat-icon-button i{line-height:24px}.mat-button-focus-overlay,.mat-button-ripple.mat-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none;border-radius:inherit}.mat-button-ripple.mat-ripple:not(:empty){transform:translateZ(0)}.mat-button-focus-overlay{opacity:0;transition:opacity .2s cubic-bezier(.35,0,.25,1),background-color .2s cubic-bezier(.35,0,.25,1)}._mat-animation-noopable .mat-button-focus-overlay{transition:none}@media (-ms-high-contrast:active){.mat-button-focus-overlay{background-color:#fff}}@media (-ms-high-contrast:black-on-white){.mat-button-focus-overlay{background-color:#000}}.mat-button-ripple-round{border-radius:50%;z-index:1}.mat-button .mat-button-wrapper>*,.mat-fab .mat-button-wrapper>*,.mat-flat-button .mat-button-wrapper>*,.mat-icon-button .mat-button-wrapper>*,.mat-mini-fab .mat-button-wrapper>*,.mat-raised-button .mat-button-wrapper>*,.mat-stroked-button .mat-button-wrapper>*{vertical-align:middle}.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-prefix .mat-icon-button,.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-suffix .mat-icon-button{display:block;font-size:inherit;width:2.5em;height:2.5em}@media (-ms-high-contrast:active){.mat-button,.mat-fab,.mat-flat-button,.mat-icon-button,.mat-mini-fab,.mat-raised-button{outline:solid 1px}}"],
  6854. inputs: ['disabled', 'disableRipple', 'color'],
  6855. encapsulation: core.ViewEncapsulation.None,
  6856. changeDetection: core.ChangeDetectionStrategy.OnPush,
  6857. },] },
  6858. ];
  6859. /** @nocollapse */
  6860. MatButton.ctorParameters = function () { return [
  6861. { type: core.ElementRef },
  6862. { type: a11y.FocusMonitor },
  6863. { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
  6864. ]; };
  6865. MatButton.propDecorators = {
  6866. ripple: [{ type: core.ViewChild, args: [MatRipple, { static: false },] }]
  6867. };
  6868. return MatButton;
  6869. }(_MatButtonMixinBase));
  6870. /**
  6871. * Material design anchor button.
  6872. */
  6873. var MatAnchor = /** @class */ (function (_super) {
  6874. __extends(MatAnchor, _super);
  6875. function MatAnchor(focusMonitor, elementRef, animationMode) {
  6876. return _super.call(this, elementRef, focusMonitor, animationMode) || this;
  6877. }
  6878. /**
  6879. * @param {?} event
  6880. * @return {?}
  6881. */
  6882. MatAnchor.prototype._haltDisabledEvents = /**
  6883. * @param {?} event
  6884. * @return {?}
  6885. */
  6886. function (event) {
  6887. // A disabled button shouldn't apply any actions
  6888. if (this.disabled) {
  6889. event.preventDefault();
  6890. event.stopImmediatePropagation();
  6891. }
  6892. };
  6893. MatAnchor.decorators = [
  6894. { type: core.Component, args: [{selector: "a[mat-button], a[mat-raised-button], a[mat-icon-button], a[mat-fab],\n a[mat-mini-fab], a[mat-stroked-button], a[mat-flat-button]",
  6895. exportAs: 'matButton, matAnchor',
  6896. host: {
  6897. // Note that we ignore the user-specified tabindex when it's disabled for
  6898. // consistency with the `mat-button` applied on native buttons where even
  6899. // though they have an index, they're not tabbable.
  6900. '[attr.tabindex]': 'disabled ? -1 : (tabIndex || 0)',
  6901. '[attr.disabled]': 'disabled || null',
  6902. '[attr.aria-disabled]': 'disabled.toString()',
  6903. '(click)': '_haltDisabledEvents($event)',
  6904. '[class._mat-animation-noopable]': '_animationMode === "NoopAnimations"',
  6905. },
  6906. inputs: ['disabled', 'disableRipple', 'color'],
  6907. template: "<span class=\"mat-button-wrapper\"><ng-content></ng-content></span><div matRipple class=\"mat-button-ripple\" [class.mat-button-ripple-round]=\"isRoundButton || isIconButton\" [matRippleDisabled]=\"_isRippleDisabled()\" [matRippleCentered]=\"isIconButton\" [matRippleTrigger]=\"_getHostElement()\"></div><div class=\"mat-button-focus-overlay\"></div>",
  6908. styles: [".mat-button .mat-button-focus-overlay,.mat-icon-button .mat-button-focus-overlay{opacity:0}.mat-button:hover .mat-button-focus-overlay,.mat-stroked-button:hover .mat-button-focus-overlay{opacity:.04}@media (hover:none){.mat-button:hover .mat-button-focus-overlay,.mat-stroked-button:hover .mat-button-focus-overlay{opacity:0}}.mat-button,.mat-flat-button,.mat-icon-button,.mat-stroked-button{box-sizing:border-box;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer;outline:0;border:none;-webkit-tap-highlight-color:transparent;display:inline-block;white-space:nowrap;text-decoration:none;vertical-align:baseline;text-align:center;margin:0;min-width:64px;line-height:36px;padding:0 16px;border-radius:4px;overflow:visible}.mat-button::-moz-focus-inner,.mat-flat-button::-moz-focus-inner,.mat-icon-button::-moz-focus-inner,.mat-stroked-button::-moz-focus-inner{border:0}.mat-button[disabled],.mat-flat-button[disabled],.mat-icon-button[disabled],.mat-stroked-button[disabled]{cursor:default}.mat-button.cdk-keyboard-focused .mat-button-focus-overlay,.mat-button.cdk-program-focused .mat-button-focus-overlay,.mat-flat-button.cdk-keyboard-focused .mat-button-focus-overlay,.mat-flat-button.cdk-program-focused .mat-button-focus-overlay,.mat-icon-button.cdk-keyboard-focused .mat-button-focus-overlay,.mat-icon-button.cdk-program-focused .mat-button-focus-overlay,.mat-stroked-button.cdk-keyboard-focused .mat-button-focus-overlay,.mat-stroked-button.cdk-program-focused .mat-button-focus-overlay{opacity:.12}.mat-button::-moz-focus-inner,.mat-flat-button::-moz-focus-inner,.mat-icon-button::-moz-focus-inner,.mat-stroked-button::-moz-focus-inner{border:0}.mat-raised-button{box-sizing:border-box;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer;outline:0;border:none;-webkit-tap-highlight-color:transparent;display:inline-block;white-space:nowrap;text-decoration:none;vertical-align:baseline;text-align:center;margin:0;min-width:64px;line-height:36px;padding:0 16px;border-radius:4px;overflow:visible;transform:translate3d(0,0,0);transition:background .4s cubic-bezier(.25,.8,.25,1),box-shadow 280ms cubic-bezier(.4,0,.2,1)}.mat-raised-button::-moz-focus-inner{border:0}.mat-raised-button[disabled]{cursor:default}.mat-raised-button.cdk-keyboard-focused .mat-button-focus-overlay,.mat-raised-button.cdk-program-focused .mat-button-focus-overlay{opacity:.12}.mat-raised-button::-moz-focus-inner{border:0}._mat-animation-noopable.mat-raised-button{transition:none;animation:none}.mat-stroked-button{border:1px solid currentColor;padding:0 15px;line-height:34px}.mat-stroked-button .mat-button-focus-overlay,.mat-stroked-button .mat-button-ripple.mat-ripple{top:-1px;left:-1px;right:-1px;bottom:-1px}.mat-fab{box-sizing:border-box;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer;outline:0;border:none;-webkit-tap-highlight-color:transparent;display:inline-block;white-space:nowrap;text-decoration:none;vertical-align:baseline;text-align:center;margin:0;min-width:64px;line-height:36px;padding:0 16px;border-radius:4px;overflow:visible;transform:translate3d(0,0,0);transition:background .4s cubic-bezier(.25,.8,.25,1),box-shadow 280ms cubic-bezier(.4,0,.2,1);min-width:0;border-radius:50%;width:56px;height:56px;padding:0;flex-shrink:0}.mat-fab::-moz-focus-inner{border:0}.mat-fab[disabled]{cursor:default}.mat-fab.cdk-keyboard-focused .mat-button-focus-overlay,.mat-fab.cdk-program-focused .mat-button-focus-overlay{opacity:.12}.mat-fab::-moz-focus-inner{border:0}._mat-animation-noopable.mat-fab{transition:none;animation:none}.mat-fab .mat-button-wrapper{padding:16px 0;display:inline-block;line-height:24px}.mat-mini-fab{box-sizing:border-box;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer;outline:0;border:none;-webkit-tap-highlight-color:transparent;display:inline-block;white-space:nowrap;text-decoration:none;vertical-align:baseline;text-align:center;margin:0;min-width:64px;line-height:36px;padding:0 16px;border-radius:4px;overflow:visible;transform:translate3d(0,0,0);transition:background .4s cubic-bezier(.25,.8,.25,1),box-shadow 280ms cubic-bezier(.4,0,.2,1);min-width:0;border-radius:50%;width:40px;height:40px;padding:0;flex-shrink:0}.mat-mini-fab::-moz-focus-inner{border:0}.mat-mini-fab[disabled]{cursor:default}.mat-mini-fab.cdk-keyboard-focused .mat-button-focus-overlay,.mat-mini-fab.cdk-program-focused .mat-button-focus-overlay{opacity:.12}.mat-mini-fab::-moz-focus-inner{border:0}._mat-animation-noopable.mat-mini-fab{transition:none;animation:none}.mat-mini-fab .mat-button-wrapper{padding:8px 0;display:inline-block;line-height:24px}.mat-icon-button{padding:0;min-width:0;width:40px;height:40px;flex-shrink:0;line-height:40px;border-radius:50%}.mat-icon-button .mat-icon,.mat-icon-button i{line-height:24px}.mat-button-focus-overlay,.mat-button-ripple.mat-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none;border-radius:inherit}.mat-button-ripple.mat-ripple:not(:empty){transform:translateZ(0)}.mat-button-focus-overlay{opacity:0;transition:opacity .2s cubic-bezier(.35,0,.25,1),background-color .2s cubic-bezier(.35,0,.25,1)}._mat-animation-noopable .mat-button-focus-overlay{transition:none}@media (-ms-high-contrast:active){.mat-button-focus-overlay{background-color:#fff}}@media (-ms-high-contrast:black-on-white){.mat-button-focus-overlay{background-color:#000}}.mat-button-ripple-round{border-radius:50%;z-index:1}.mat-button .mat-button-wrapper>*,.mat-fab .mat-button-wrapper>*,.mat-flat-button .mat-button-wrapper>*,.mat-icon-button .mat-button-wrapper>*,.mat-mini-fab .mat-button-wrapper>*,.mat-raised-button .mat-button-wrapper>*,.mat-stroked-button .mat-button-wrapper>*{vertical-align:middle}.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-prefix .mat-icon-button,.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-suffix .mat-icon-button{display:block;font-size:inherit;width:2.5em;height:2.5em}@media (-ms-high-contrast:active){.mat-button,.mat-fab,.mat-flat-button,.mat-icon-button,.mat-mini-fab,.mat-raised-button{outline:solid 1px}}"],
  6909. encapsulation: core.ViewEncapsulation.None,
  6910. changeDetection: core.ChangeDetectionStrategy.OnPush,
  6911. },] },
  6912. ];
  6913. /** @nocollapse */
  6914. MatAnchor.ctorParameters = function () { return [
  6915. { type: a11y.FocusMonitor },
  6916. { type: core.ElementRef },
  6917. { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
  6918. ]; };
  6919. MatAnchor.propDecorators = {
  6920. tabIndex: [{ type: core.Input }]
  6921. };
  6922. return MatAnchor;
  6923. }(MatButton));
  6924. /**
  6925. * @fileoverview added by tsickle
  6926. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  6927. */
  6928. var MatButtonModule = /** @class */ (function () {
  6929. function MatButtonModule() {
  6930. }
  6931. MatButtonModule.decorators = [
  6932. { type: core.NgModule, args: [{
  6933. imports: [
  6934. common.CommonModule,
  6935. MatRippleModule,
  6936. MatCommonModule,
  6937. ],
  6938. exports: [
  6939. MatButton,
  6940. MatAnchor,
  6941. MatCommonModule,
  6942. ],
  6943. declarations: [
  6944. MatButton,
  6945. MatAnchor,
  6946. ],
  6947. },] },
  6948. ];
  6949. return MatButtonModule;
  6950. }());
  6951. /**
  6952. * @fileoverview added by tsickle
  6953. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  6954. */
  6955. /**
  6956. * Injection token that can be used to configure the
  6957. * default options for all button toggles within an app.
  6958. * @type {?}
  6959. */
  6960. var MAT_BUTTON_TOGGLE_DEFAULT_OPTIONS = new core.InjectionToken('MAT_BUTTON_TOGGLE_DEFAULT_OPTIONS');
  6961. /**
  6962. * Provider Expression that allows mat-button-toggle-group to register as a ControlValueAccessor.
  6963. * This allows it to support [(ngModel)].
  6964. * \@docs-private
  6965. * @type {?}
  6966. */
  6967. var MAT_BUTTON_TOGGLE_GROUP_VALUE_ACCESSOR = {
  6968. provide: forms.NG_VALUE_ACCESSOR,
  6969. useExisting: core.forwardRef((/**
  6970. * @return {?}
  6971. */
  6972. function () { return MatButtonToggleGroup; })),
  6973. multi: true
  6974. };
  6975. /**
  6976. * @deprecated Use `MatButtonToggleGroup` instead.
  6977. * \@breaking-change 8.0.0
  6978. */
  6979. var /**
  6980. * @deprecated Use `MatButtonToggleGroup` instead.
  6981. * \@breaking-change 8.0.0
  6982. */
  6983. MatButtonToggleGroupMultiple = /** @class */ (function () {
  6984. function MatButtonToggleGroupMultiple() {
  6985. }
  6986. return MatButtonToggleGroupMultiple;
  6987. }());
  6988. /** @type {?} */
  6989. var _uniqueIdCounter$1 = 0;
  6990. /**
  6991. * Change event object emitted by MatButtonToggle.
  6992. */
  6993. var /**
  6994. * Change event object emitted by MatButtonToggle.
  6995. */
  6996. MatButtonToggleChange = /** @class */ (function () {
  6997. function MatButtonToggleChange(source, value) {
  6998. this.source = source;
  6999. this.value = value;
  7000. }
  7001. return MatButtonToggleChange;
  7002. }());
  7003. /**
  7004. * Exclusive selection button toggle group that behaves like a radio-button group.
  7005. */
  7006. var MatButtonToggleGroup = /** @class */ (function () {
  7007. function MatButtonToggleGroup(_changeDetector, defaultOptions) {
  7008. this._changeDetector = _changeDetector;
  7009. this._vertical = false;
  7010. this._multiple = false;
  7011. this._disabled = false;
  7012. /**
  7013. * The method to be called in order to update ngModel.
  7014. * Now `ngModel` binding is not supported in multiple selection mode.
  7015. */
  7016. this._controlValueAccessorChangeFn = (/**
  7017. * @return {?}
  7018. */
  7019. function () { });
  7020. /**
  7021. * onTouch function registered via registerOnTouch (ControlValueAccessor).
  7022. */
  7023. this._onTouched = (/**
  7024. * @return {?}
  7025. */
  7026. function () { });
  7027. this._name = "mat-button-toggle-group-" + _uniqueIdCounter$1++;
  7028. /**
  7029. * Event that emits whenever the value of the group changes.
  7030. * Used to facilitate two-way data binding.
  7031. * \@docs-private
  7032. */
  7033. this.valueChange = new core.EventEmitter();
  7034. /**
  7035. * Event emitted when the group's value changes.
  7036. */
  7037. this.change = new core.EventEmitter();
  7038. this.appearance =
  7039. defaultOptions && defaultOptions.appearance ? defaultOptions.appearance : 'standard';
  7040. }
  7041. Object.defineProperty(MatButtonToggleGroup.prototype, "name", {
  7042. /** `name` attribute for the underlying `input` element. */
  7043. get: /**
  7044. * `name` attribute for the underlying `input` element.
  7045. * @return {?}
  7046. */
  7047. function () { return this._name; },
  7048. set: /**
  7049. * @param {?} value
  7050. * @return {?}
  7051. */
  7052. function (value) {
  7053. var _this = this;
  7054. this._name = value;
  7055. if (this._buttonToggles) {
  7056. this._buttonToggles.forEach((/**
  7057. * @param {?} toggle
  7058. * @return {?}
  7059. */
  7060. function (toggle) {
  7061. toggle.name = _this._name;
  7062. toggle._markForCheck();
  7063. }));
  7064. }
  7065. },
  7066. enumerable: true,
  7067. configurable: true
  7068. });
  7069. Object.defineProperty(MatButtonToggleGroup.prototype, "vertical", {
  7070. /** Whether the toggle group is vertical. */
  7071. get: /**
  7072. * Whether the toggle group is vertical.
  7073. * @return {?}
  7074. */
  7075. function () { return this._vertical; },
  7076. set: /**
  7077. * @param {?} value
  7078. * @return {?}
  7079. */
  7080. function (value) {
  7081. this._vertical = coercion.coerceBooleanProperty(value);
  7082. },
  7083. enumerable: true,
  7084. configurable: true
  7085. });
  7086. Object.defineProperty(MatButtonToggleGroup.prototype, "value", {
  7087. /** Value of the toggle group. */
  7088. get: /**
  7089. * Value of the toggle group.
  7090. * @return {?}
  7091. */
  7092. function () {
  7093. /** @type {?} */
  7094. var selected = this._selectionModel ? this._selectionModel.selected : [];
  7095. if (this.multiple) {
  7096. return selected.map((/**
  7097. * @param {?} toggle
  7098. * @return {?}
  7099. */
  7100. function (toggle) { return toggle.value; }));
  7101. }
  7102. return selected[0] ? selected[0].value : undefined;
  7103. },
  7104. set: /**
  7105. * @param {?} newValue
  7106. * @return {?}
  7107. */
  7108. function (newValue) {
  7109. this._setSelectionByValue(newValue);
  7110. this.valueChange.emit(this.value);
  7111. },
  7112. enumerable: true,
  7113. configurable: true
  7114. });
  7115. Object.defineProperty(MatButtonToggleGroup.prototype, "selected", {
  7116. /** Selected button toggles in the group. */
  7117. get: /**
  7118. * Selected button toggles in the group.
  7119. * @return {?}
  7120. */
  7121. function () {
  7122. /** @type {?} */
  7123. var selected = this._selectionModel ? this._selectionModel.selected : [];
  7124. return this.multiple ? selected : (selected[0] || null);
  7125. },
  7126. enumerable: true,
  7127. configurable: true
  7128. });
  7129. Object.defineProperty(MatButtonToggleGroup.prototype, "multiple", {
  7130. /** Whether multiple button toggles can be selected. */
  7131. get: /**
  7132. * Whether multiple button toggles can be selected.
  7133. * @return {?}
  7134. */
  7135. function () { return this._multiple; },
  7136. set: /**
  7137. * @param {?} value
  7138. * @return {?}
  7139. */
  7140. function (value) {
  7141. this._multiple = coercion.coerceBooleanProperty(value);
  7142. },
  7143. enumerable: true,
  7144. configurable: true
  7145. });
  7146. Object.defineProperty(MatButtonToggleGroup.prototype, "disabled", {
  7147. /** Whether multiple button toggle group is disabled. */
  7148. get: /**
  7149. * Whether multiple button toggle group is disabled.
  7150. * @return {?}
  7151. */
  7152. function () { return this._disabled; },
  7153. set: /**
  7154. * @param {?} value
  7155. * @return {?}
  7156. */
  7157. function (value) {
  7158. this._disabled = coercion.coerceBooleanProperty(value);
  7159. if (this._buttonToggles) {
  7160. this._buttonToggles.forEach((/**
  7161. * @param {?} toggle
  7162. * @return {?}
  7163. */
  7164. function (toggle) { return toggle._markForCheck(); }));
  7165. }
  7166. },
  7167. enumerable: true,
  7168. configurable: true
  7169. });
  7170. /**
  7171. * @return {?}
  7172. */
  7173. MatButtonToggleGroup.prototype.ngOnInit = /**
  7174. * @return {?}
  7175. */
  7176. function () {
  7177. this._selectionModel = new collections.SelectionModel(this.multiple, undefined, false);
  7178. };
  7179. /**
  7180. * @return {?}
  7181. */
  7182. MatButtonToggleGroup.prototype.ngAfterContentInit = /**
  7183. * @return {?}
  7184. */
  7185. function () {
  7186. var _a;
  7187. (_a = this._selectionModel).select.apply(_a, this._buttonToggles.filter((/**
  7188. * @param {?} toggle
  7189. * @return {?}
  7190. */
  7191. function (toggle) { return toggle.checked; })));
  7192. };
  7193. /**
  7194. * Sets the model value. Implemented as part of ControlValueAccessor.
  7195. * @param value Value to be set to the model.
  7196. */
  7197. /**
  7198. * Sets the model value. Implemented as part of ControlValueAccessor.
  7199. * @param {?} value Value to be set to the model.
  7200. * @return {?}
  7201. */
  7202. MatButtonToggleGroup.prototype.writeValue = /**
  7203. * Sets the model value. Implemented as part of ControlValueAccessor.
  7204. * @param {?} value Value to be set to the model.
  7205. * @return {?}
  7206. */
  7207. function (value) {
  7208. this.value = value;
  7209. this._changeDetector.markForCheck();
  7210. };
  7211. // Implemented as part of ControlValueAccessor.
  7212. // Implemented as part of ControlValueAccessor.
  7213. /**
  7214. * @param {?} fn
  7215. * @return {?}
  7216. */
  7217. MatButtonToggleGroup.prototype.registerOnChange =
  7218. // Implemented as part of ControlValueAccessor.
  7219. /**
  7220. * @param {?} fn
  7221. * @return {?}
  7222. */
  7223. function (fn) {
  7224. this._controlValueAccessorChangeFn = fn;
  7225. };
  7226. // Implemented as part of ControlValueAccessor.
  7227. // Implemented as part of ControlValueAccessor.
  7228. /**
  7229. * @param {?} fn
  7230. * @return {?}
  7231. */
  7232. MatButtonToggleGroup.prototype.registerOnTouched =
  7233. // Implemented as part of ControlValueAccessor.
  7234. /**
  7235. * @param {?} fn
  7236. * @return {?}
  7237. */
  7238. function (fn) {
  7239. this._onTouched = fn;
  7240. };
  7241. // Implemented as part of ControlValueAccessor.
  7242. // Implemented as part of ControlValueAccessor.
  7243. /**
  7244. * @param {?} isDisabled
  7245. * @return {?}
  7246. */
  7247. MatButtonToggleGroup.prototype.setDisabledState =
  7248. // Implemented as part of ControlValueAccessor.
  7249. /**
  7250. * @param {?} isDisabled
  7251. * @return {?}
  7252. */
  7253. function (isDisabled) {
  7254. this.disabled = isDisabled;
  7255. };
  7256. /** Dispatch change event with current selection and group value. */
  7257. /**
  7258. * Dispatch change event with current selection and group value.
  7259. * @return {?}
  7260. */
  7261. MatButtonToggleGroup.prototype._emitChangeEvent = /**
  7262. * Dispatch change event with current selection and group value.
  7263. * @return {?}
  7264. */
  7265. function () {
  7266. /** @type {?} */
  7267. var selected = this.selected;
  7268. /** @type {?} */
  7269. var source = Array.isArray(selected) ? selected[selected.length - 1] : selected;
  7270. /** @type {?} */
  7271. var event = new MatButtonToggleChange((/** @type {?} */ (source)), this.value);
  7272. this._controlValueAccessorChangeFn(event.value);
  7273. this.change.emit(event);
  7274. };
  7275. /**
  7276. * Syncs a button toggle's selected state with the model value.
  7277. * @param toggle Toggle to be synced.
  7278. * @param select Whether the toggle should be selected.
  7279. * @param isUserInput Whether the change was a result of a user interaction.
  7280. * @param deferEvents Whether to defer emitting the change events.
  7281. */
  7282. /**
  7283. * Syncs a button toggle's selected state with the model value.
  7284. * @param {?} toggle Toggle to be synced.
  7285. * @param {?} select Whether the toggle should be selected.
  7286. * @param {?=} isUserInput Whether the change was a result of a user interaction.
  7287. * @param {?=} deferEvents Whether to defer emitting the change events.
  7288. * @return {?}
  7289. */
  7290. MatButtonToggleGroup.prototype._syncButtonToggle = /**
  7291. * Syncs a button toggle's selected state with the model value.
  7292. * @param {?} toggle Toggle to be synced.
  7293. * @param {?} select Whether the toggle should be selected.
  7294. * @param {?=} isUserInput Whether the change was a result of a user interaction.
  7295. * @param {?=} deferEvents Whether to defer emitting the change events.
  7296. * @return {?}
  7297. */
  7298. function (toggle, select, isUserInput, deferEvents) {
  7299. if (isUserInput === void 0) { isUserInput = false; }
  7300. if (deferEvents === void 0) { deferEvents = false; }
  7301. // Deselect the currently-selected toggle, if we're in single-selection
  7302. // mode and the button being toggled isn't selected at the moment.
  7303. if (!this.multiple && this.selected && !toggle.checked) {
  7304. ((/** @type {?} */ (this.selected))).checked = false;
  7305. }
  7306. if (this._selectionModel) {
  7307. if (select) {
  7308. this._selectionModel.select(toggle);
  7309. }
  7310. else {
  7311. this._selectionModel.deselect(toggle);
  7312. }
  7313. }
  7314. else {
  7315. deferEvents = true;
  7316. }
  7317. // We need to defer in some cases in order to avoid "changed after checked errors", however
  7318. // the side-effect is that we may end up updating the model value out of sequence in others
  7319. // The `deferEvents` flag allows us to decide whether to do it on a case-by-case basis.
  7320. if (deferEvents) {
  7321. }
  7322. else {
  7323. this._updateModelValue(isUserInput);
  7324. }
  7325. };
  7326. /** Checks whether a button toggle is selected. */
  7327. /**
  7328. * Checks whether a button toggle is selected.
  7329. * @param {?} toggle
  7330. * @return {?}
  7331. */
  7332. MatButtonToggleGroup.prototype._isSelected = /**
  7333. * Checks whether a button toggle is selected.
  7334. * @param {?} toggle
  7335. * @return {?}
  7336. */
  7337. function (toggle) {
  7338. return this._selectionModel && this._selectionModel.isSelected(toggle);
  7339. };
  7340. /** Determines whether a button toggle should be checked on init. */
  7341. /**
  7342. * Determines whether a button toggle should be checked on init.
  7343. * @param {?} toggle
  7344. * @return {?}
  7345. */
  7346. MatButtonToggleGroup.prototype._isPrechecked = /**
  7347. * Determines whether a button toggle should be checked on init.
  7348. * @param {?} toggle
  7349. * @return {?}
  7350. */
  7351. function (toggle) {
  7352. if (typeof this._rawValue === 'undefined') {
  7353. return false;
  7354. }
  7355. if (this.multiple && Array.isArray(this._rawValue)) {
  7356. return this._rawValue.some((/**
  7357. * @param {?} value
  7358. * @return {?}
  7359. */
  7360. function (value) { return toggle.value != null && value === toggle.value; }));
  7361. }
  7362. return toggle.value === this._rawValue;
  7363. };
  7364. /** Updates the selection state of the toggles in the group based on a value. */
  7365. /**
  7366. * Updates the selection state of the toggles in the group based on a value.
  7367. * @private
  7368. * @param {?} value
  7369. * @return {?}
  7370. */
  7371. MatButtonToggleGroup.prototype._setSelectionByValue = /**
  7372. * Updates the selection state of the toggles in the group based on a value.
  7373. * @private
  7374. * @param {?} value
  7375. * @return {?}
  7376. */
  7377. function (value) {
  7378. var _this = this;
  7379. this._rawValue = value;
  7380. if (!this._buttonToggles) {
  7381. return;
  7382. }
  7383. if (this.multiple && value) {
  7384. if (!Array.isArray(value)) {
  7385. throw Error('Value must be an array in multiple-selection mode.');
  7386. }
  7387. this._clearSelection();
  7388. value.forEach((/**
  7389. * @param {?} currentValue
  7390. * @return {?}
  7391. */
  7392. function (currentValue) { return _this._selectValue(currentValue); }));
  7393. }
  7394. else {
  7395. this._clearSelection();
  7396. this._selectValue(value);
  7397. }
  7398. };
  7399. /** Clears the selected toggles. */
  7400. /**
  7401. * Clears the selected toggles.
  7402. * @private
  7403. * @return {?}
  7404. */
  7405. MatButtonToggleGroup.prototype._clearSelection = /**
  7406. * Clears the selected toggles.
  7407. * @private
  7408. * @return {?}
  7409. */
  7410. function () {
  7411. this._selectionModel.clear();
  7412. this._buttonToggles.forEach((/**
  7413. * @param {?} toggle
  7414. * @return {?}
  7415. */
  7416. function (toggle) { return toggle.checked = false; }));
  7417. };
  7418. /** Selects a value if there's a toggle that corresponds to it. */
  7419. /**
  7420. * Selects a value if there's a toggle that corresponds to it.
  7421. * @private
  7422. * @param {?} value
  7423. * @return {?}
  7424. */
  7425. MatButtonToggleGroup.prototype._selectValue = /**
  7426. * Selects a value if there's a toggle that corresponds to it.
  7427. * @private
  7428. * @param {?} value
  7429. * @return {?}
  7430. */
  7431. function (value) {
  7432. /** @type {?} */
  7433. var correspondingOption = this._buttonToggles.find((/**
  7434. * @param {?} toggle
  7435. * @return {?}
  7436. */
  7437. function (toggle) {
  7438. return toggle.value != null && toggle.value === value;
  7439. }));
  7440. if (correspondingOption) {
  7441. correspondingOption.checked = true;
  7442. this._selectionModel.select(correspondingOption);
  7443. }
  7444. };
  7445. /** Syncs up the group's value with the model and emits the change event. */
  7446. /**
  7447. * Syncs up the group's value with the model and emits the change event.
  7448. * @private
  7449. * @param {?} isUserInput
  7450. * @return {?}
  7451. */
  7452. MatButtonToggleGroup.prototype._updateModelValue = /**
  7453. * Syncs up the group's value with the model and emits the change event.
  7454. * @private
  7455. * @param {?} isUserInput
  7456. * @return {?}
  7457. */
  7458. function (isUserInput) {
  7459. // Only emit the change event for user input.
  7460. if (isUserInput) {
  7461. this._emitChangeEvent();
  7462. }
  7463. // Note: we emit this one no matter whether it was a user interaction, because
  7464. // it is used by Angular to sync up the two-way data binding.
  7465. this.valueChange.emit(this.value);
  7466. };
  7467. MatButtonToggleGroup.decorators = [
  7468. { type: core.Directive, args: [{
  7469. selector: 'mat-button-toggle-group',
  7470. providers: [
  7471. MAT_BUTTON_TOGGLE_GROUP_VALUE_ACCESSOR,
  7472. { provide: MatButtonToggleGroupMultiple, useExisting: MatButtonToggleGroup },
  7473. ],
  7474. host: {
  7475. 'role': 'group',
  7476. 'class': 'mat-button-toggle-group',
  7477. '[attr.aria-disabled]': 'disabled',
  7478. '[class.mat-button-toggle-vertical]': 'vertical',
  7479. '[class.mat-button-toggle-group-appearance-standard]': 'appearance === "standard"',
  7480. },
  7481. exportAs: 'matButtonToggleGroup',
  7482. },] },
  7483. ];
  7484. /** @nocollapse */
  7485. MatButtonToggleGroup.ctorParameters = function () { return [
  7486. { type: core.ChangeDetectorRef },
  7487. { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_BUTTON_TOGGLE_DEFAULT_OPTIONS,] }] }
  7488. ]; };
  7489. MatButtonToggleGroup.propDecorators = {
  7490. _buttonToggles: [{ type: core.ContentChildren, args: [core.forwardRef((/**
  7491. * @return {?}
  7492. */
  7493. function () { return MatButtonToggle; })),] }],
  7494. appearance: [{ type: core.Input }],
  7495. name: [{ type: core.Input }],
  7496. vertical: [{ type: core.Input }],
  7497. value: [{ type: core.Input }],
  7498. valueChange: [{ type: core.Output }],
  7499. multiple: [{ type: core.Input }],
  7500. disabled: [{ type: core.Input }],
  7501. change: [{ type: core.Output }]
  7502. };
  7503. return MatButtonToggleGroup;
  7504. }());
  7505. // Boilerplate for applying mixins to the MatButtonToggle class.
  7506. /**
  7507. * \@docs-private
  7508. */
  7509. var
  7510. // Boilerplate for applying mixins to the MatButtonToggle class.
  7511. /**
  7512. * \@docs-private
  7513. */
  7514. MatButtonToggleBase = /** @class */ (function () {
  7515. function MatButtonToggleBase() {
  7516. }
  7517. return MatButtonToggleBase;
  7518. }());
  7519. /** @type {?} */
  7520. var _MatButtonToggleMixinBase = mixinDisableRipple(MatButtonToggleBase);
  7521. /**
  7522. * Single button inside of a toggle group.
  7523. */
  7524. var MatButtonToggle = /** @class */ (function (_super) {
  7525. __extends(MatButtonToggle, _super);
  7526. function MatButtonToggle(toggleGroup, _changeDetectorRef, _elementRef, _focusMonitor,
  7527. // @breaking-change 8.0.0 `defaultTabIndex` to be made a required parameter.
  7528. defaultTabIndex, defaultOptions) {
  7529. var _this = _super.call(this) || this;
  7530. _this._changeDetectorRef = _changeDetectorRef;
  7531. _this._elementRef = _elementRef;
  7532. _this._focusMonitor = _focusMonitor;
  7533. _this._isSingleSelector = false;
  7534. _this._checked = false;
  7535. /**
  7536. * Users can specify the `aria-labelledby` attribute which will be forwarded to the input element
  7537. */
  7538. _this.ariaLabelledby = null;
  7539. _this._disabled = false;
  7540. /**
  7541. * Event emitted when the group value changes.
  7542. */
  7543. _this.change = new core.EventEmitter();
  7544. /** @type {?} */
  7545. var parsedTabIndex = Number(defaultTabIndex);
  7546. _this.tabIndex = (parsedTabIndex || parsedTabIndex === 0) ? parsedTabIndex : null;
  7547. _this.buttonToggleGroup = toggleGroup;
  7548. _this.appearance =
  7549. defaultOptions && defaultOptions.appearance ? defaultOptions.appearance : 'standard';
  7550. return _this;
  7551. }
  7552. Object.defineProperty(MatButtonToggle.prototype, "buttonId", {
  7553. /** Unique ID for the underlying `button` element. */
  7554. get: /**
  7555. * Unique ID for the underlying `button` element.
  7556. * @return {?}
  7557. */
  7558. function () { return this.id + "-button"; },
  7559. enumerable: true,
  7560. configurable: true
  7561. });
  7562. Object.defineProperty(MatButtonToggle.prototype, "appearance", {
  7563. /** The appearance style of the button. */
  7564. get: /**
  7565. * The appearance style of the button.
  7566. * @return {?}
  7567. */
  7568. function () {
  7569. return this.buttonToggleGroup ? this.buttonToggleGroup.appearance : this._appearance;
  7570. },
  7571. set: /**
  7572. * @param {?} value
  7573. * @return {?}
  7574. */
  7575. function (value) {
  7576. this._appearance = value;
  7577. },
  7578. enumerable: true,
  7579. configurable: true
  7580. });
  7581. Object.defineProperty(MatButtonToggle.prototype, "checked", {
  7582. /** Whether the button is checked. */
  7583. get: /**
  7584. * Whether the button is checked.
  7585. * @return {?}
  7586. */
  7587. function () {
  7588. return this.buttonToggleGroup ? this.buttonToggleGroup._isSelected(this) : this._checked;
  7589. },
  7590. set: /**
  7591. * @param {?} value
  7592. * @return {?}
  7593. */
  7594. function (value) {
  7595. /** @type {?} */
  7596. var newValue = coercion.coerceBooleanProperty(value);
  7597. if (newValue !== this._checked) {
  7598. this._checked = newValue;
  7599. if (this.buttonToggleGroup) {
  7600. this.buttonToggleGroup._syncButtonToggle(this, this._checked);
  7601. }
  7602. this._changeDetectorRef.markForCheck();
  7603. }
  7604. },
  7605. enumerable: true,
  7606. configurable: true
  7607. });
  7608. Object.defineProperty(MatButtonToggle.prototype, "disabled", {
  7609. /** Whether the button is disabled. */
  7610. get: /**
  7611. * Whether the button is disabled.
  7612. * @return {?}
  7613. */
  7614. function () {
  7615. return this._disabled || (this.buttonToggleGroup && this.buttonToggleGroup.disabled);
  7616. },
  7617. set: /**
  7618. * @param {?} value
  7619. * @return {?}
  7620. */
  7621. function (value) { this._disabled = coercion.coerceBooleanProperty(value); },
  7622. enumerable: true,
  7623. configurable: true
  7624. });
  7625. /**
  7626. * @return {?}
  7627. */
  7628. MatButtonToggle.prototype.ngOnInit = /**
  7629. * @return {?}
  7630. */
  7631. function () {
  7632. this._isSingleSelector = this.buttonToggleGroup && !this.buttonToggleGroup.multiple;
  7633. this._type = this._isSingleSelector ? 'radio' : 'checkbox';
  7634. this.id = this.id || "mat-button-toggle-" + _uniqueIdCounter$1++;
  7635. if (this._isSingleSelector) {
  7636. this.name = this.buttonToggleGroup.name;
  7637. }
  7638. if (this.buttonToggleGroup && this.buttonToggleGroup._isPrechecked(this)) {
  7639. this.checked = true;
  7640. }
  7641. this._focusMonitor.monitor(this._elementRef, true);
  7642. };
  7643. /**
  7644. * @return {?}
  7645. */
  7646. MatButtonToggle.prototype.ngOnDestroy = /**
  7647. * @return {?}
  7648. */
  7649. function () {
  7650. /** @type {?} */
  7651. var group = this.buttonToggleGroup;
  7652. this._focusMonitor.stopMonitoring(this._elementRef);
  7653. // Remove the toggle from the selection once it's destroyed. Needs to happen
  7654. // on the next tick in order to avoid "changed after checked" errors.
  7655. if (group && group._isSelected(this)) {
  7656. group._syncButtonToggle(this, false, false, true);
  7657. }
  7658. };
  7659. /** Focuses the button. */
  7660. /**
  7661. * Focuses the button.
  7662. * @param {?=} options
  7663. * @return {?}
  7664. */
  7665. MatButtonToggle.prototype.focus = /**
  7666. * Focuses the button.
  7667. * @param {?=} options
  7668. * @return {?}
  7669. */
  7670. function (options) {
  7671. this._buttonElement.nativeElement.focus(options);
  7672. };
  7673. /** Checks the button toggle due to an interaction with the underlying native button. */
  7674. /**
  7675. * Checks the button toggle due to an interaction with the underlying native button.
  7676. * @return {?}
  7677. */
  7678. MatButtonToggle.prototype._onButtonClick = /**
  7679. * Checks the button toggle due to an interaction with the underlying native button.
  7680. * @return {?}
  7681. */
  7682. function () {
  7683. /** @type {?} */
  7684. var newChecked = this._isSingleSelector ? true : !this._checked;
  7685. if (newChecked !== this._checked) {
  7686. this._checked = newChecked;
  7687. if (this.buttonToggleGroup) {
  7688. this.buttonToggleGroup._syncButtonToggle(this, this._checked, true);
  7689. this.buttonToggleGroup._onTouched();
  7690. }
  7691. }
  7692. // Emit a change event when it's the single selector
  7693. this.change.emit(new MatButtonToggleChange(this, this.value));
  7694. };
  7695. /**
  7696. * Marks the button toggle as needing checking for change detection.
  7697. * This method is exposed because the parent button toggle group will directly
  7698. * update bound properties of the radio button.
  7699. */
  7700. /**
  7701. * Marks the button toggle as needing checking for change detection.
  7702. * This method is exposed because the parent button toggle group will directly
  7703. * update bound properties of the radio button.
  7704. * @return {?}
  7705. */
  7706. MatButtonToggle.prototype._markForCheck = /**
  7707. * Marks the button toggle as needing checking for change detection.
  7708. * This method is exposed because the parent button toggle group will directly
  7709. * update bound properties of the radio button.
  7710. * @return {?}
  7711. */
  7712. function () {
  7713. // When the group value changes, the button will not be notified.
  7714. // Use `markForCheck` to explicit update button toggle's status.
  7715. this._changeDetectorRef.markForCheck();
  7716. };
  7717. MatButtonToggle.decorators = [
  7718. { type: core.Component, args: [{selector: 'mat-button-toggle',
  7719. template: "<button #button class=\"mat-button-toggle-button\" type=\"button\" [id]=\"buttonId\" [attr.tabindex]=\"disabled ? -1 : tabIndex\" [attr.aria-pressed]=\"checked\" [disabled]=\"disabled || null\" [attr.name]=\"name || null\" [attr.aria-label]=\"ariaLabel\" [attr.aria-labelledby]=\"ariaLabelledby\" (click)=\"_onButtonClick()\"><div class=\"mat-button-toggle-label-content\"><ng-content></ng-content></div></button><div class=\"mat-button-toggle-focus-overlay\"></div><div class=\"mat-button-toggle-ripple\" matRipple [matRippleTrigger]=\"button\" [matRippleDisabled]=\"this.disableRipple || this.disabled\"></div>",
  7720. styles: [".mat-button-toggle-group,.mat-button-toggle-standalone{position:relative;display:inline-flex;flex-direction:row;white-space:nowrap;overflow:hidden;border-radius:2px;-webkit-tap-highlight-color:transparent}@media (-ms-high-contrast:active){.mat-button-toggle-group,.mat-button-toggle-standalone{outline:solid 1px}}.mat-button-toggle-group-appearance-standard,.mat-button-toggle-standalone.mat-button-toggle-appearance-standard{border-radius:4px}@media (-ms-high-contrast:active){.mat-button-toggle-group-appearance-standard,.mat-button-toggle-standalone.mat-button-toggle-appearance-standard{outline:0}}.mat-button-toggle-vertical{flex-direction:column}.mat-button-toggle-vertical .mat-button-toggle-label-content{display:block}.mat-button-toggle{white-space:nowrap;position:relative}.mat-button-toggle .mat-icon svg{vertical-align:top}.mat-button-toggle.cdk-keyboard-focused .mat-button-toggle-focus-overlay{opacity:1}@media (-ms-high-contrast:active){.mat-button-toggle.cdk-keyboard-focused .mat-button-toggle-focus-overlay{opacity:.5}}.mat-button-toggle-appearance-standard:not(.mat-button-toggle-disabled):hover .mat-button-toggle-focus-overlay{opacity:.04}.mat-button-toggle-appearance-standard.cdk-keyboard-focused:not(.mat-button-toggle-disabled) .mat-button-toggle-focus-overlay{opacity:.12}@media (-ms-high-contrast:active){.mat-button-toggle-appearance-standard.cdk-keyboard-focused:not(.mat-button-toggle-disabled) .mat-button-toggle-focus-overlay{opacity:.5}}@media (hover:none){.mat-button-toggle-appearance-standard:not(.mat-button-toggle-disabled):hover .mat-button-toggle-focus-overlay{display:none}}.mat-button-toggle-label-content{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:inline-block;line-height:36px;padding:0 16px;position:relative}.mat-button-toggle-appearance-standard .mat-button-toggle-label-content{line-height:48px;padding:0 12px}.mat-button-toggle-label-content>*{vertical-align:middle}.mat-button-toggle-focus-overlay{border-radius:inherit;pointer-events:none;opacity:0;top:0;left:0;right:0;bottom:0;position:absolute}.mat-button-toggle-checked .mat-button-toggle-focus-overlay{border-bottom:solid 36px}@media (-ms-high-contrast:active){.mat-button-toggle-checked .mat-button-toggle-focus-overlay{opacity:.5;height:0}}@media (-ms-high-contrast:active){.mat-button-toggle-checked.mat-button-toggle-appearance-standard .mat-button-toggle-focus-overlay{border-bottom:solid 48px}}.mat-button-toggle .mat-button-toggle-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}.mat-button-toggle-button{border:0;background:0 0;color:inherit;padding:0;margin:0;font:inherit;outline:0;width:100%;cursor:pointer}.mat-button-toggle-disabled .mat-button-toggle-button{cursor:default}.mat-button-toggle-button::-moz-focus-inner{border:0}"],
  7721. encapsulation: core.ViewEncapsulation.None,
  7722. exportAs: 'matButtonToggle',
  7723. changeDetection: core.ChangeDetectionStrategy.OnPush,
  7724. inputs: ['disableRipple'],
  7725. host: {
  7726. '[class.mat-button-toggle-standalone]': '!buttonToggleGroup',
  7727. '[class.mat-button-toggle-checked]': 'checked',
  7728. '[class.mat-button-toggle-disabled]': 'disabled',
  7729. '[class.mat-button-toggle-appearance-standard]': 'appearance === "standard"',
  7730. 'class': 'mat-button-toggle',
  7731. // Always reset the tabindex to -1 so it doesn't conflict with the one on the `button`,
  7732. // but can still receive focus from things like cdkFocusInitial.
  7733. '[attr.tabindex]': '-1',
  7734. '[attr.id]': 'id',
  7735. '[attr.name]': 'null',
  7736. '(focus)': 'focus()',
  7737. }
  7738. },] },
  7739. ];
  7740. /** @nocollapse */
  7741. MatButtonToggle.ctorParameters = function () { return [
  7742. { type: MatButtonToggleGroup, decorators: [{ type: core.Optional }] },
  7743. { type: core.ChangeDetectorRef },
  7744. { type: core.ElementRef },
  7745. { type: a11y.FocusMonitor },
  7746. { type: String, decorators: [{ type: core.Attribute, args: ['tabindex',] }] },
  7747. { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_BUTTON_TOGGLE_DEFAULT_OPTIONS,] }] }
  7748. ]; };
  7749. MatButtonToggle.propDecorators = {
  7750. ariaLabel: [{ type: core.Input, args: ['aria-label',] }],
  7751. ariaLabelledby: [{ type: core.Input, args: ['aria-labelledby',] }],
  7752. _buttonElement: [{ type: core.ViewChild, args: ['button', { static: false },] }],
  7753. id: [{ type: core.Input }],
  7754. name: [{ type: core.Input }],
  7755. value: [{ type: core.Input }],
  7756. tabIndex: [{ type: core.Input }],
  7757. appearance: [{ type: core.Input }],
  7758. checked: [{ type: core.Input }],
  7759. disabled: [{ type: core.Input }],
  7760. change: [{ type: core.Output }]
  7761. };
  7762. return MatButtonToggle;
  7763. }(_MatButtonToggleMixinBase));
  7764. /**
  7765. * @fileoverview added by tsickle
  7766. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  7767. */
  7768. var MatButtonToggleModule = /** @class */ (function () {
  7769. function MatButtonToggleModule() {
  7770. }
  7771. MatButtonToggleModule.decorators = [
  7772. { type: core.NgModule, args: [{
  7773. imports: [MatCommonModule, MatRippleModule],
  7774. exports: [MatCommonModule, MatButtonToggleGroup, MatButtonToggle],
  7775. declarations: [MatButtonToggleGroup, MatButtonToggle],
  7776. },] },
  7777. ];
  7778. return MatButtonToggleModule;
  7779. }());
  7780. /**
  7781. * @fileoverview added by tsickle
  7782. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  7783. */
  7784. /**
  7785. * Content of a card, needed as it's used as a selector in the API.
  7786. * \@docs-private
  7787. */
  7788. var MatCardContent = /** @class */ (function () {
  7789. function MatCardContent() {
  7790. }
  7791. MatCardContent.decorators = [
  7792. { type: core.Directive, args: [{
  7793. selector: 'mat-card-content',
  7794. host: { 'class': 'mat-card-content' }
  7795. },] },
  7796. ];
  7797. return MatCardContent;
  7798. }());
  7799. /**
  7800. * Title of a card, needed as it's used as a selector in the API.
  7801. * \@docs-private
  7802. */
  7803. var MatCardTitle = /** @class */ (function () {
  7804. function MatCardTitle() {
  7805. }
  7806. MatCardTitle.decorators = [
  7807. { type: core.Directive, args: [{
  7808. selector: "mat-card-title, [mat-card-title], [matCardTitle]",
  7809. host: {
  7810. 'class': 'mat-card-title'
  7811. }
  7812. },] },
  7813. ];
  7814. return MatCardTitle;
  7815. }());
  7816. /**
  7817. * Sub-title of a card, needed as it's used as a selector in the API.
  7818. * \@docs-private
  7819. */
  7820. var MatCardSubtitle = /** @class */ (function () {
  7821. function MatCardSubtitle() {
  7822. }
  7823. MatCardSubtitle.decorators = [
  7824. { type: core.Directive, args: [{
  7825. selector: "mat-card-subtitle, [mat-card-subtitle], [matCardSubtitle]",
  7826. host: {
  7827. 'class': 'mat-card-subtitle'
  7828. }
  7829. },] },
  7830. ];
  7831. return MatCardSubtitle;
  7832. }());
  7833. /**
  7834. * Action section of a card, needed as it's used as a selector in the API.
  7835. * \@docs-private
  7836. */
  7837. var MatCardActions = /** @class */ (function () {
  7838. function MatCardActions() {
  7839. /**
  7840. * Position of the actions inside the card.
  7841. */
  7842. this.align = 'start';
  7843. }
  7844. MatCardActions.decorators = [
  7845. { type: core.Directive, args: [{
  7846. selector: 'mat-card-actions',
  7847. exportAs: 'matCardActions',
  7848. host: {
  7849. 'class': 'mat-card-actions',
  7850. '[class.mat-card-actions-align-end]': 'align === "end"',
  7851. }
  7852. },] },
  7853. ];
  7854. MatCardActions.propDecorators = {
  7855. align: [{ type: core.Input }]
  7856. };
  7857. return MatCardActions;
  7858. }());
  7859. /**
  7860. * Footer of a card, needed as it's used as a selector in the API.
  7861. * \@docs-private
  7862. */
  7863. var MatCardFooter = /** @class */ (function () {
  7864. function MatCardFooter() {
  7865. }
  7866. MatCardFooter.decorators = [
  7867. { type: core.Directive, args: [{
  7868. selector: 'mat-card-footer',
  7869. host: { 'class': 'mat-card-footer' }
  7870. },] },
  7871. ];
  7872. return MatCardFooter;
  7873. }());
  7874. /**
  7875. * Image used in a card, needed to add the mat- CSS styling.
  7876. * \@docs-private
  7877. */
  7878. var MatCardImage = /** @class */ (function () {
  7879. function MatCardImage() {
  7880. }
  7881. MatCardImage.decorators = [
  7882. { type: core.Directive, args: [{
  7883. selector: '[mat-card-image], [matCardImage]',
  7884. host: { 'class': 'mat-card-image' }
  7885. },] },
  7886. ];
  7887. return MatCardImage;
  7888. }());
  7889. /**
  7890. * Image used in a card, needed to add the mat- CSS styling.
  7891. * \@docs-private
  7892. */
  7893. var MatCardSmImage = /** @class */ (function () {
  7894. function MatCardSmImage() {
  7895. }
  7896. MatCardSmImage.decorators = [
  7897. { type: core.Directive, args: [{
  7898. selector: '[mat-card-sm-image], [matCardImageSmall]',
  7899. host: { 'class': 'mat-card-sm-image' }
  7900. },] },
  7901. ];
  7902. return MatCardSmImage;
  7903. }());
  7904. /**
  7905. * Image used in a card, needed to add the mat- CSS styling.
  7906. * \@docs-private
  7907. */
  7908. var MatCardMdImage = /** @class */ (function () {
  7909. function MatCardMdImage() {
  7910. }
  7911. MatCardMdImage.decorators = [
  7912. { type: core.Directive, args: [{
  7913. selector: '[mat-card-md-image], [matCardImageMedium]',
  7914. host: { 'class': 'mat-card-md-image' }
  7915. },] },
  7916. ];
  7917. return MatCardMdImage;
  7918. }());
  7919. /**
  7920. * Image used in a card, needed to add the mat- CSS styling.
  7921. * \@docs-private
  7922. */
  7923. var MatCardLgImage = /** @class */ (function () {
  7924. function MatCardLgImage() {
  7925. }
  7926. MatCardLgImage.decorators = [
  7927. { type: core.Directive, args: [{
  7928. selector: '[mat-card-lg-image], [matCardImageLarge]',
  7929. host: { 'class': 'mat-card-lg-image' }
  7930. },] },
  7931. ];
  7932. return MatCardLgImage;
  7933. }());
  7934. /**
  7935. * Large image used in a card, needed to add the mat- CSS styling.
  7936. * \@docs-private
  7937. */
  7938. var MatCardXlImage = /** @class */ (function () {
  7939. function MatCardXlImage() {
  7940. }
  7941. MatCardXlImage.decorators = [
  7942. { type: core.Directive, args: [{
  7943. selector: '[mat-card-xl-image], [matCardImageXLarge]',
  7944. host: { 'class': 'mat-card-xl-image' }
  7945. },] },
  7946. ];
  7947. return MatCardXlImage;
  7948. }());
  7949. /**
  7950. * Avatar image used in a card, needed to add the mat- CSS styling.
  7951. * \@docs-private
  7952. */
  7953. var MatCardAvatar = /** @class */ (function () {
  7954. function MatCardAvatar() {
  7955. }
  7956. MatCardAvatar.decorators = [
  7957. { type: core.Directive, args: [{
  7958. selector: '[mat-card-avatar], [matCardAvatar]',
  7959. host: { 'class': 'mat-card-avatar' }
  7960. },] },
  7961. ];
  7962. return MatCardAvatar;
  7963. }());
  7964. /**
  7965. * A basic content container component that adds the styles of a Material design card.
  7966. *
  7967. * While this component can be used alone, it also provides a number
  7968. * of preset styles for common card sections, including:
  7969. * - mat-card-title
  7970. * - mat-card-subtitle
  7971. * - mat-card-content
  7972. * - mat-card-actions
  7973. * - mat-card-footer
  7974. */
  7975. var MatCard = /** @class */ (function () {
  7976. // @breaking-change 9.0.0 `_animationMode` parameter to be made required.
  7977. function MatCard(_animationMode) {
  7978. this._animationMode = _animationMode;
  7979. }
  7980. MatCard.decorators = [
  7981. { type: core.Component, args: [{selector: 'mat-card',
  7982. exportAs: 'matCard',
  7983. template: "<ng-content></ng-content><ng-content select=\"mat-card-footer\"></ng-content>",
  7984. styles: [".mat-card{transition:box-shadow 280ms cubic-bezier(.4,0,.2,1);display:block;position:relative;padding:16px;border-radius:4px}._mat-animation-noopable.mat-card{transition:none;animation:none}.mat-card .mat-divider-horizontal{position:absolute;left:0;width:100%}[dir=rtl] .mat-card .mat-divider-horizontal{left:auto;right:0}.mat-card .mat-divider-horizontal.mat-divider-inset{position:static;margin:0}[dir=rtl] .mat-card .mat-divider-horizontal.mat-divider-inset{margin-right:0}@media (-ms-high-contrast:active){.mat-card{outline:solid 1px}}.mat-card-actions,.mat-card-content,.mat-card-subtitle{display:block;margin-bottom:16px}.mat-card-title{display:block;margin-bottom:8px}.mat-card-actions{margin-left:-8px;margin-right:-8px;padding:8px 0}.mat-card-actions-align-end{display:flex;justify-content:flex-end}.mat-card-image{width:calc(100% + 32px);margin:0 -16px 16px -16px}.mat-card-footer{display:block;margin:0 -16px -16px -16px}.mat-card-actions .mat-button,.mat-card-actions .mat-raised-button{margin:0 8px}.mat-card-header{display:flex;flex-direction:row}.mat-card-header .mat-card-title{margin-bottom:12px}.mat-card-header-text{margin:0 16px}.mat-card-avatar{height:40px;width:40px;border-radius:50%;flex-shrink:0;object-fit:cover}.mat-card-title-group{display:flex;justify-content:space-between}.mat-card-sm-image{width:80px;height:80px}.mat-card-md-image{width:112px;height:112px}.mat-card-lg-image{width:152px;height:152px}.mat-card-xl-image{width:240px;height:240px;margin:-8px}.mat-card-title-group>.mat-card-xl-image{margin:-8px 0 8px}@media (max-width:599px){.mat-card-title-group{margin:0}.mat-card-xl-image{margin-left:0;margin-right:0}}.mat-card-content>:first-child,.mat-card>:first-child{margin-top:0}.mat-card-content>:last-child:not(.mat-card-footer),.mat-card>:last-child:not(.mat-card-footer){margin-bottom:0}.mat-card-image:first-child{margin-top:-16px;border-top-left-radius:inherit;border-top-right-radius:inherit}.mat-card>.mat-card-actions:last-child{margin-bottom:-8px;padding-bottom:0}.mat-card-actions .mat-button:first-child,.mat-card-actions .mat-raised-button:first-child{margin-left:0;margin-right:0}.mat-card-subtitle:not(:first-child),.mat-card-title:not(:first-child){margin-top:-4px}.mat-card-header .mat-card-subtitle:not(:first-child){margin-top:-8px}.mat-card>.mat-card-xl-image:first-child{margin-top:-8px}.mat-card>.mat-card-xl-image:last-child{margin-bottom:-8px}"],
  7985. encapsulation: core.ViewEncapsulation.None,
  7986. changeDetection: core.ChangeDetectionStrategy.OnPush,
  7987. host: {
  7988. 'class': 'mat-card',
  7989. '[class._mat-animation-noopable]': '_animationMode === "NoopAnimations"',
  7990. }
  7991. },] },
  7992. ];
  7993. /** @nocollapse */
  7994. MatCard.ctorParameters = function () { return [
  7995. { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
  7996. ]; };
  7997. return MatCard;
  7998. }());
  7999. /**
  8000. * Component intended to be used within the `<mat-card>` component. It adds styles for a
  8001. * preset header section (i.e. a title, subtitle, and avatar layout).
  8002. * \@docs-private
  8003. */
  8004. var MatCardHeader = /** @class */ (function () {
  8005. function MatCardHeader() {
  8006. }
  8007. MatCardHeader.decorators = [
  8008. { type: core.Component, args: [{selector: 'mat-card-header',
  8009. template: "<ng-content select=\"[mat-card-avatar], [matCardAvatar]\"></ng-content><div class=\"mat-card-header-text\"><ng-content select=\"mat-card-title, mat-card-subtitle, [mat-card-title], [mat-card-subtitle], [matCardTitle], [matCardSubtitle]\"></ng-content></div><ng-content></ng-content>",
  8010. encapsulation: core.ViewEncapsulation.None,
  8011. changeDetection: core.ChangeDetectionStrategy.OnPush,
  8012. host: { 'class': 'mat-card-header' }
  8013. },] },
  8014. ];
  8015. return MatCardHeader;
  8016. }());
  8017. /**
  8018. * Component intended to be used within the `<mat-card>` component. It adds styles for a preset
  8019. * layout that groups an image with a title section.
  8020. * \@docs-private
  8021. */
  8022. var MatCardTitleGroup = /** @class */ (function () {
  8023. function MatCardTitleGroup() {
  8024. }
  8025. MatCardTitleGroup.decorators = [
  8026. { type: core.Component, args: [{selector: 'mat-card-title-group',
  8027. template: "<div><ng-content select=\"mat-card-title, mat-card-subtitle, [mat-card-title], [mat-card-subtitle], [matCardTitle], [matCardSubtitle]\"></ng-content></div><ng-content select=\"img\"></ng-content><ng-content></ng-content>",
  8028. encapsulation: core.ViewEncapsulation.None,
  8029. changeDetection: core.ChangeDetectionStrategy.OnPush,
  8030. host: { 'class': 'mat-card-title-group' }
  8031. },] },
  8032. ];
  8033. return MatCardTitleGroup;
  8034. }());
  8035. /**
  8036. * @fileoverview added by tsickle
  8037. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  8038. */
  8039. var MatCardModule = /** @class */ (function () {
  8040. function MatCardModule() {
  8041. }
  8042. MatCardModule.decorators = [
  8043. { type: core.NgModule, args: [{
  8044. imports: [MatCommonModule],
  8045. exports: [
  8046. MatCard,
  8047. MatCardHeader,
  8048. MatCardTitleGroup,
  8049. MatCardContent,
  8050. MatCardTitle,
  8051. MatCardSubtitle,
  8052. MatCardActions,
  8053. MatCardFooter,
  8054. MatCardSmImage,
  8055. MatCardMdImage,
  8056. MatCardLgImage,
  8057. MatCardImage,
  8058. MatCardXlImage,
  8059. MatCardAvatar,
  8060. MatCommonModule,
  8061. ],
  8062. declarations: [
  8063. MatCard, MatCardHeader, MatCardTitleGroup, MatCardContent, MatCardTitle, MatCardSubtitle,
  8064. MatCardActions, MatCardFooter, MatCardSmImage, MatCardMdImage, MatCardLgImage, MatCardImage,
  8065. MatCardXlImage, MatCardAvatar,
  8066. ],
  8067. },] },
  8068. ];
  8069. return MatCardModule;
  8070. }());
  8071. /**
  8072. * @fileoverview added by tsickle
  8073. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  8074. */
  8075. /**
  8076. * Injection token that can be used to specify the checkbox click behavior.
  8077. * @type {?}
  8078. */
  8079. var MAT_CHECKBOX_CLICK_ACTION = new core.InjectionToken('mat-checkbox-click-action');
  8080. /**
  8081. * @fileoverview added by tsickle
  8082. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  8083. */
  8084. // Increasing integer for generating unique ids for checkbox components.
  8085. /** @type {?} */
  8086. var nextUniqueId$3 = 0;
  8087. /**
  8088. * Provider Expression that allows mat-checkbox to register as a ControlValueAccessor.
  8089. * This allows it to support [(ngModel)].
  8090. * \@docs-private
  8091. * @type {?}
  8092. */
  8093. var MAT_CHECKBOX_CONTROL_VALUE_ACCESSOR = {
  8094. provide: forms.NG_VALUE_ACCESSOR,
  8095. useExisting: core.forwardRef((/**
  8096. * @return {?}
  8097. */
  8098. function () { return MatCheckbox; })),
  8099. multi: true
  8100. };
  8101. /** @enum {number} */
  8102. var TransitionCheckState = {
  8103. /** The initial state of the component before any user interaction. */
  8104. Init: 0,
  8105. /** The state representing the component when it's becoming checked. */
  8106. Checked: 1,
  8107. /** The state representing the component when it's becoming unchecked. */
  8108. Unchecked: 2,
  8109. /** The state representing the component when it's becoming indeterminate. */
  8110. Indeterminate: 3,
  8111. };
  8112. TransitionCheckState[TransitionCheckState.Init] = 'Init';
  8113. TransitionCheckState[TransitionCheckState.Checked] = 'Checked';
  8114. TransitionCheckState[TransitionCheckState.Unchecked] = 'Unchecked';
  8115. TransitionCheckState[TransitionCheckState.Indeterminate] = 'Indeterminate';
  8116. /**
  8117. * Change event object emitted by MatCheckbox.
  8118. */
  8119. var /**
  8120. * Change event object emitted by MatCheckbox.
  8121. */
  8122. MatCheckboxChange = /** @class */ (function () {
  8123. function MatCheckboxChange() {
  8124. }
  8125. return MatCheckboxChange;
  8126. }());
  8127. // Boilerplate for applying mixins to MatCheckbox.
  8128. /**
  8129. * \@docs-private
  8130. */
  8131. var
  8132. // Boilerplate for applying mixins to MatCheckbox.
  8133. /**
  8134. * \@docs-private
  8135. */
  8136. MatCheckboxBase = /** @class */ (function () {
  8137. function MatCheckboxBase(_elementRef) {
  8138. this._elementRef = _elementRef;
  8139. }
  8140. return MatCheckboxBase;
  8141. }());
  8142. /** @type {?} */
  8143. var _MatCheckboxMixinBase = mixinTabIndex(mixinColor(mixinDisableRipple(mixinDisabled(MatCheckboxBase)), 'accent'));
  8144. /**
  8145. * A material design checkbox component. Supports all of the functionality of an HTML5 checkbox,
  8146. * and exposes a similar API. A MatCheckbox can be either checked, unchecked, indeterminate, or
  8147. * disabled. Note that all additional accessibility attributes are taken care of by the component,
  8148. * so there is no need to provide them yourself. However, if you want to omit a label and still
  8149. * have the checkbox be accessible, you may supply an [aria-label] input.
  8150. * See: https://material.io/design/components/selection-controls.html
  8151. */
  8152. var MatCheckbox = /** @class */ (function (_super) {
  8153. __extends(MatCheckbox, _super);
  8154. function MatCheckbox(elementRef, _changeDetectorRef, _focusMonitor, _ngZone, tabIndex, _clickAction, _animationMode) {
  8155. var _this = _super.call(this, elementRef) || this;
  8156. _this._changeDetectorRef = _changeDetectorRef;
  8157. _this._focusMonitor = _focusMonitor;
  8158. _this._ngZone = _ngZone;
  8159. _this._clickAction = _clickAction;
  8160. _this._animationMode = _animationMode;
  8161. /**
  8162. * Attached to the aria-label attribute of the host element. In most cases, aria-labelledby will
  8163. * take precedence so this may be omitted.
  8164. */
  8165. _this.ariaLabel = '';
  8166. /**
  8167. * Users can specify the `aria-labelledby` attribute which will be forwarded to the input element
  8168. */
  8169. _this.ariaLabelledby = null;
  8170. _this._uniqueId = "mat-checkbox-" + ++nextUniqueId$3;
  8171. /**
  8172. * A unique id for the checkbox input. If none is supplied, it will be auto-generated.
  8173. */
  8174. _this.id = _this._uniqueId;
  8175. /**
  8176. * Whether the label should appear after or before the checkbox. Defaults to 'after'
  8177. */
  8178. _this.labelPosition = 'after';
  8179. /**
  8180. * Name value will be applied to the input element if present
  8181. */
  8182. _this.name = null;
  8183. /**
  8184. * Event emitted when the checkbox's `checked` value changes.
  8185. */
  8186. _this.change = new core.EventEmitter();
  8187. /**
  8188. * Event emitted when the checkbox's `indeterminate` value changes.
  8189. */
  8190. _this.indeterminateChange = new core.EventEmitter();
  8191. /**
  8192. * Called when the checkbox is blurred. Needed to properly implement ControlValueAccessor.
  8193. * \@docs-private
  8194. */
  8195. _this._onTouched = (/**
  8196. * @return {?}
  8197. */
  8198. function () { });
  8199. _this._currentAnimationClass = '';
  8200. _this._currentCheckState = TransitionCheckState.Init;
  8201. _this._controlValueAccessorChangeFn = (/**
  8202. * @return {?}
  8203. */
  8204. function () { });
  8205. _this._checked = false;
  8206. _this._disabled = false;
  8207. _this._indeterminate = false;
  8208. _this.tabIndex = parseInt(tabIndex) || 0;
  8209. _this._focusMonitor.monitor(elementRef, true).subscribe((/**
  8210. * @param {?} focusOrigin
  8211. * @return {?}
  8212. */
  8213. function (focusOrigin) {
  8214. if (!focusOrigin) {
  8215. // When a focused element becomes disabled, the browser *immediately* fires a blur event.
  8216. // Angular does not expect events to be raised during change detection, so any state change
  8217. // (such as a form control's 'ng-touched') will cause a changed-after-checked error.
  8218. // See https://github.com/angular/angular/issues/17793. To work around this, we defer
  8219. // telling the form control it has been touched until the next tick.
  8220. Promise.resolve().then((/**
  8221. * @return {?}
  8222. */
  8223. function () {
  8224. _this._onTouched();
  8225. _changeDetectorRef.markForCheck();
  8226. }));
  8227. }
  8228. }));
  8229. return _this;
  8230. }
  8231. Object.defineProperty(MatCheckbox.prototype, "inputId", {
  8232. /** Returns the unique id for the visual hidden input. */
  8233. get: /**
  8234. * Returns the unique id for the visual hidden input.
  8235. * @return {?}
  8236. */
  8237. function () { return (this.id || this._uniqueId) + "-input"; },
  8238. enumerable: true,
  8239. configurable: true
  8240. });
  8241. Object.defineProperty(MatCheckbox.prototype, "required", {
  8242. /** Whether the checkbox is required. */
  8243. get: /**
  8244. * Whether the checkbox is required.
  8245. * @return {?}
  8246. */
  8247. function () { return this._required; },
  8248. set: /**
  8249. * @param {?} value
  8250. * @return {?}
  8251. */
  8252. function (value) { this._required = coercion.coerceBooleanProperty(value); },
  8253. enumerable: true,
  8254. configurable: true
  8255. });
  8256. // TODO: Delete next major revision.
  8257. // TODO: Delete next major revision.
  8258. /**
  8259. * @return {?}
  8260. */
  8261. MatCheckbox.prototype.ngAfterViewChecked =
  8262. // TODO: Delete next major revision.
  8263. /**
  8264. * @return {?}
  8265. */
  8266. function () { };
  8267. /**
  8268. * @return {?}
  8269. */
  8270. MatCheckbox.prototype.ngOnDestroy = /**
  8271. * @return {?}
  8272. */
  8273. function () {
  8274. this._focusMonitor.stopMonitoring(this._elementRef);
  8275. };
  8276. Object.defineProperty(MatCheckbox.prototype, "checked", {
  8277. /**
  8278. * Whether the checkbox is checked.
  8279. */
  8280. get: /**
  8281. * Whether the checkbox is checked.
  8282. * @return {?}
  8283. */
  8284. function () { return this._checked; },
  8285. set: /**
  8286. * @param {?} value
  8287. * @return {?}
  8288. */
  8289. function (value) {
  8290. if (value != this.checked) {
  8291. this._checked = value;
  8292. this._changeDetectorRef.markForCheck();
  8293. }
  8294. },
  8295. enumerable: true,
  8296. configurable: true
  8297. });
  8298. Object.defineProperty(MatCheckbox.prototype, "disabled", {
  8299. /**
  8300. * Whether the checkbox is disabled. This fully overrides the implementation provided by
  8301. * mixinDisabled, but the mixin is still required because mixinTabIndex requires it.
  8302. */
  8303. get: /**
  8304. * Whether the checkbox is disabled. This fully overrides the implementation provided by
  8305. * mixinDisabled, but the mixin is still required because mixinTabIndex requires it.
  8306. * @return {?}
  8307. */
  8308. function () { return this._disabled; },
  8309. set: /**
  8310. * @param {?} value
  8311. * @return {?}
  8312. */
  8313. function (value) {
  8314. /** @type {?} */
  8315. var newValue = coercion.coerceBooleanProperty(value);
  8316. if (newValue !== this.disabled) {
  8317. this._disabled = newValue;
  8318. this._changeDetectorRef.markForCheck();
  8319. }
  8320. },
  8321. enumerable: true,
  8322. configurable: true
  8323. });
  8324. Object.defineProperty(MatCheckbox.prototype, "indeterminate", {
  8325. /**
  8326. * Whether the checkbox is indeterminate. This is also known as "mixed" mode and can be used to
  8327. * represent a checkbox with three states, e.g. a checkbox that represents a nested list of
  8328. * checkable items. Note that whenever checkbox is manually clicked, indeterminate is immediately
  8329. * set to false.
  8330. */
  8331. get: /**
  8332. * Whether the checkbox is indeterminate. This is also known as "mixed" mode and can be used to
  8333. * represent a checkbox with three states, e.g. a checkbox that represents a nested list of
  8334. * checkable items. Note that whenever checkbox is manually clicked, indeterminate is immediately
  8335. * set to false.
  8336. * @return {?}
  8337. */
  8338. function () { return this._indeterminate; },
  8339. set: /**
  8340. * @param {?} value
  8341. * @return {?}
  8342. */
  8343. function (value) {
  8344. /** @type {?} */
  8345. var changed = value != this._indeterminate;
  8346. this._indeterminate = value;
  8347. if (changed) {
  8348. if (this._indeterminate) {
  8349. this._transitionCheckState(TransitionCheckState.Indeterminate);
  8350. }
  8351. else {
  8352. this._transitionCheckState(this.checked ? TransitionCheckState.Checked : TransitionCheckState.Unchecked);
  8353. }
  8354. this.indeterminateChange.emit(this._indeterminate);
  8355. }
  8356. },
  8357. enumerable: true,
  8358. configurable: true
  8359. });
  8360. /**
  8361. * @return {?}
  8362. */
  8363. MatCheckbox.prototype._isRippleDisabled = /**
  8364. * @return {?}
  8365. */
  8366. function () {
  8367. return this.disableRipple || this.disabled;
  8368. };
  8369. /** Method being called whenever the label text changes. */
  8370. /**
  8371. * Method being called whenever the label text changes.
  8372. * @return {?}
  8373. */
  8374. MatCheckbox.prototype._onLabelTextChange = /**
  8375. * Method being called whenever the label text changes.
  8376. * @return {?}
  8377. */
  8378. function () {
  8379. // Since the event of the `cdkObserveContent` directive runs outside of the zone, the checkbox
  8380. // component will be only marked for check, but no actual change detection runs automatically.
  8381. // Instead of going back into the zone in order to trigger a change detection which causes
  8382. // *all* components to be checked (if explicitly marked or not using OnPush), we only trigger
  8383. // an explicit change detection for the checkbox view and it's children.
  8384. this._changeDetectorRef.detectChanges();
  8385. };
  8386. // Implemented as part of ControlValueAccessor.
  8387. // Implemented as part of ControlValueAccessor.
  8388. /**
  8389. * @param {?} value
  8390. * @return {?}
  8391. */
  8392. MatCheckbox.prototype.writeValue =
  8393. // Implemented as part of ControlValueAccessor.
  8394. /**
  8395. * @param {?} value
  8396. * @return {?}
  8397. */
  8398. function (value) {
  8399. this.checked = !!value;
  8400. };
  8401. // Implemented as part of ControlValueAccessor.
  8402. // Implemented as part of ControlValueAccessor.
  8403. /**
  8404. * @param {?} fn
  8405. * @return {?}
  8406. */
  8407. MatCheckbox.prototype.registerOnChange =
  8408. // Implemented as part of ControlValueAccessor.
  8409. /**
  8410. * @param {?} fn
  8411. * @return {?}
  8412. */
  8413. function (fn) {
  8414. this._controlValueAccessorChangeFn = fn;
  8415. };
  8416. // Implemented as part of ControlValueAccessor.
  8417. // Implemented as part of ControlValueAccessor.
  8418. /**
  8419. * @param {?} fn
  8420. * @return {?}
  8421. */
  8422. MatCheckbox.prototype.registerOnTouched =
  8423. // Implemented as part of ControlValueAccessor.
  8424. /**
  8425. * @param {?} fn
  8426. * @return {?}
  8427. */
  8428. function (fn) {
  8429. this._onTouched = fn;
  8430. };
  8431. // Implemented as part of ControlValueAccessor.
  8432. // Implemented as part of ControlValueAccessor.
  8433. /**
  8434. * @param {?} isDisabled
  8435. * @return {?}
  8436. */
  8437. MatCheckbox.prototype.setDisabledState =
  8438. // Implemented as part of ControlValueAccessor.
  8439. /**
  8440. * @param {?} isDisabled
  8441. * @return {?}
  8442. */
  8443. function (isDisabled) {
  8444. this.disabled = isDisabled;
  8445. };
  8446. /**
  8447. * @return {?}
  8448. */
  8449. MatCheckbox.prototype._getAriaChecked = /**
  8450. * @return {?}
  8451. */
  8452. function () {
  8453. return this.checked ? 'true' : (this.indeterminate ? 'mixed' : 'false');
  8454. };
  8455. /**
  8456. * @private
  8457. * @param {?} newState
  8458. * @return {?}
  8459. */
  8460. MatCheckbox.prototype._transitionCheckState = /**
  8461. * @private
  8462. * @param {?} newState
  8463. * @return {?}
  8464. */
  8465. function (newState) {
  8466. /** @type {?} */
  8467. var oldState = this._currentCheckState;
  8468. /** @type {?} */
  8469. var element = this._elementRef.nativeElement;
  8470. if (oldState === newState) {
  8471. return;
  8472. }
  8473. if (this._currentAnimationClass.length > 0) {
  8474. element.classList.remove(this._currentAnimationClass);
  8475. }
  8476. this._currentAnimationClass = this._getAnimationClassForCheckStateTransition(oldState, newState);
  8477. this._currentCheckState = newState;
  8478. if (this._currentAnimationClass.length > 0) {
  8479. element.classList.add(this._currentAnimationClass);
  8480. // Remove the animation class to avoid animation when the checkbox is moved between containers
  8481. /** @type {?} */
  8482. var animationClass_1 = this._currentAnimationClass;
  8483. this._ngZone.runOutsideAngular((/**
  8484. * @return {?}
  8485. */
  8486. function () {
  8487. setTimeout((/**
  8488. * @return {?}
  8489. */
  8490. function () {
  8491. element.classList.remove(animationClass_1);
  8492. }), 1000);
  8493. }));
  8494. }
  8495. };
  8496. /**
  8497. * @private
  8498. * @return {?}
  8499. */
  8500. MatCheckbox.prototype._emitChangeEvent = /**
  8501. * @private
  8502. * @return {?}
  8503. */
  8504. function () {
  8505. /** @type {?} */
  8506. var event = new MatCheckboxChange();
  8507. event.source = this;
  8508. event.checked = this.checked;
  8509. this._controlValueAccessorChangeFn(this.checked);
  8510. this.change.emit(event);
  8511. };
  8512. /** Toggles the `checked` state of the checkbox. */
  8513. /**
  8514. * Toggles the `checked` state of the checkbox.
  8515. * @return {?}
  8516. */
  8517. MatCheckbox.prototype.toggle = /**
  8518. * Toggles the `checked` state of the checkbox.
  8519. * @return {?}
  8520. */
  8521. function () {
  8522. this.checked = !this.checked;
  8523. };
  8524. /**
  8525. * Event handler for checkbox input element.
  8526. * Toggles checked state if element is not disabled.
  8527. * Do not toggle on (change) event since IE doesn't fire change event when
  8528. * indeterminate checkbox is clicked.
  8529. * @param event
  8530. */
  8531. /**
  8532. * Event handler for checkbox input element.
  8533. * Toggles checked state if element is not disabled.
  8534. * Do not toggle on (change) event since IE doesn't fire change event when
  8535. * indeterminate checkbox is clicked.
  8536. * @param {?} event
  8537. * @return {?}
  8538. */
  8539. MatCheckbox.prototype._onInputClick = /**
  8540. * Event handler for checkbox input element.
  8541. * Toggles checked state if element is not disabled.
  8542. * Do not toggle on (change) event since IE doesn't fire change event when
  8543. * indeterminate checkbox is clicked.
  8544. * @param {?} event
  8545. * @return {?}
  8546. */
  8547. function (event) {
  8548. var _this = this;
  8549. // We have to stop propagation for click events on the visual hidden input element.
  8550. // By default, when a user clicks on a label element, a generated click event will be
  8551. // dispatched on the associated input element. Since we are using a label element as our
  8552. // root container, the click event on the `checkbox` will be executed twice.
  8553. // The real click event will bubble up, and the generated click event also tries to bubble up.
  8554. // This will lead to multiple click events.
  8555. // Preventing bubbling for the second event will solve that issue.
  8556. event.stopPropagation();
  8557. // If resetIndeterminate is false, and the current state is indeterminate, do nothing on click
  8558. if (!this.disabled && this._clickAction !== 'noop') {
  8559. // When user manually click on the checkbox, `indeterminate` is set to false.
  8560. if (this.indeterminate && this._clickAction !== 'check') {
  8561. Promise.resolve().then((/**
  8562. * @return {?}
  8563. */
  8564. function () {
  8565. _this._indeterminate = false;
  8566. _this.indeterminateChange.emit(_this._indeterminate);
  8567. }));
  8568. }
  8569. this.toggle();
  8570. this._transitionCheckState(this._checked ? TransitionCheckState.Checked : TransitionCheckState.Unchecked);
  8571. // Emit our custom change event if the native input emitted one.
  8572. // It is important to only emit it, if the native input triggered one, because
  8573. // we don't want to trigger a change event, when the `checked` variable changes for example.
  8574. this._emitChangeEvent();
  8575. }
  8576. else if (!this.disabled && this._clickAction === 'noop') {
  8577. // Reset native input when clicked with noop. The native checkbox becomes checked after
  8578. // click, reset it to be align with `checked` value of `mat-checkbox`.
  8579. this._inputElement.nativeElement.checked = this.checked;
  8580. this._inputElement.nativeElement.indeterminate = this.indeterminate;
  8581. }
  8582. };
  8583. /** Focuses the checkbox. */
  8584. /**
  8585. * Focuses the checkbox.
  8586. * @param {?=} origin
  8587. * @param {?=} options
  8588. * @return {?}
  8589. */
  8590. MatCheckbox.prototype.focus = /**
  8591. * Focuses the checkbox.
  8592. * @param {?=} origin
  8593. * @param {?=} options
  8594. * @return {?}
  8595. */
  8596. function (origin, options) {
  8597. if (origin === void 0) { origin = 'keyboard'; }
  8598. this._focusMonitor.focusVia(this._inputElement, origin, options);
  8599. };
  8600. /**
  8601. * @param {?} event
  8602. * @return {?}
  8603. */
  8604. MatCheckbox.prototype._onInteractionEvent = /**
  8605. * @param {?} event
  8606. * @return {?}
  8607. */
  8608. function (event) {
  8609. // We always have to stop propagation on the change event.
  8610. // Otherwise the change event, from the input element, will bubble up and
  8611. // emit its event object to the `change` output.
  8612. event.stopPropagation();
  8613. };
  8614. /**
  8615. * @private
  8616. * @param {?} oldState
  8617. * @param {?} newState
  8618. * @return {?}
  8619. */
  8620. MatCheckbox.prototype._getAnimationClassForCheckStateTransition = /**
  8621. * @private
  8622. * @param {?} oldState
  8623. * @param {?} newState
  8624. * @return {?}
  8625. */
  8626. function (oldState, newState) {
  8627. // Don't transition if animations are disabled.
  8628. if (this._animationMode === 'NoopAnimations') {
  8629. return '';
  8630. }
  8631. /** @type {?} */
  8632. var animSuffix = '';
  8633. switch (oldState) {
  8634. case TransitionCheckState.Init:
  8635. // Handle edge case where user interacts with checkbox that does not have [(ngModel)] or
  8636. // [checked] bound to it.
  8637. if (newState === TransitionCheckState.Checked) {
  8638. animSuffix = 'unchecked-checked';
  8639. }
  8640. else if (newState == TransitionCheckState.Indeterminate) {
  8641. animSuffix = 'unchecked-indeterminate';
  8642. }
  8643. else {
  8644. return '';
  8645. }
  8646. break;
  8647. case TransitionCheckState.Unchecked:
  8648. animSuffix = newState === TransitionCheckState.Checked ?
  8649. 'unchecked-checked' : 'unchecked-indeterminate';
  8650. break;
  8651. case TransitionCheckState.Checked:
  8652. animSuffix = newState === TransitionCheckState.Unchecked ?
  8653. 'checked-unchecked' : 'checked-indeterminate';
  8654. break;
  8655. case TransitionCheckState.Indeterminate:
  8656. animSuffix = newState === TransitionCheckState.Checked ?
  8657. 'indeterminate-checked' : 'indeterminate-unchecked';
  8658. break;
  8659. }
  8660. return "mat-checkbox-anim-" + animSuffix;
  8661. };
  8662. MatCheckbox.decorators = [
  8663. { type: core.Component, args: [{selector: 'mat-checkbox',
  8664. template: "<label [attr.for]=\"inputId\" class=\"mat-checkbox-layout\" #label><div class=\"mat-checkbox-inner-container\" [class.mat-checkbox-inner-container-no-side-margin]=\"!checkboxLabel.textContent || !checkboxLabel.textContent.trim()\"><input #input class=\"mat-checkbox-input cdk-visually-hidden\" type=\"checkbox\" [id]=\"inputId\" [required]=\"required\" [checked]=\"checked\" [attr.value]=\"value\" [disabled]=\"disabled\" [attr.name]=\"name\" [tabIndex]=\"tabIndex\" [indeterminate]=\"indeterminate\" [attr.aria-label]=\"ariaLabel || null\" [attr.aria-labelledby]=\"ariaLabelledby\" [attr.aria-checked]=\"_getAriaChecked()\" (change)=\"_onInteractionEvent($event)\" (click)=\"_onInputClick($event)\"><div matRipple class=\"mat-checkbox-ripple\" [matRippleTrigger]=\"label\" [matRippleDisabled]=\"_isRippleDisabled()\" [matRippleRadius]=\"20\" [matRippleCentered]=\"true\" [matRippleAnimation]=\"{enterDuration: 150}\"><div class=\"mat-ripple-element mat-checkbox-persistent-ripple\"></div></div><div class=\"mat-checkbox-frame\"></div><div class=\"mat-checkbox-background\"><svg version=\"1.1\" focusable=\"false\" class=\"mat-checkbox-checkmark\" viewBox=\"0 0 24 24\" xml:space=\"preserve\"><path class=\"mat-checkbox-checkmark-path\" fill=\"none\" stroke=\"white\" d=\"M4.1,12.7 9,17.6 20.3,6.3\"/></svg><div class=\"mat-checkbox-mixedmark\"></div></div></div><span class=\"mat-checkbox-label\" #checkboxLabel (cdkObserveContent)=\"_onLabelTextChange()\"><span style=\"display:none\">&nbsp;</span><ng-content></ng-content></span></label>",
  8665. styles: ["@keyframes mat-checkbox-fade-in-background{0%{opacity:0}50%{opacity:1}}@keyframes mat-checkbox-fade-out-background{0%,50%{opacity:1}100%{opacity:0}}@keyframes mat-checkbox-unchecked-checked-checkmark-path{0%,50%{stroke-dashoffset:22.91026}50%{animation-timing-function:cubic-bezier(0,0,.2,.1)}100%{stroke-dashoffset:0}}@keyframes mat-checkbox-unchecked-indeterminate-mixedmark{0%,68.2%{transform:scaleX(0)}68.2%{animation-timing-function:cubic-bezier(0,0,0,1)}100%{transform:scaleX(1)}}@keyframes mat-checkbox-checked-unchecked-checkmark-path{from{animation-timing-function:cubic-bezier(.4,0,1,1);stroke-dashoffset:0}to{stroke-dashoffset:-22.91026}}@keyframes mat-checkbox-checked-indeterminate-checkmark{from{animation-timing-function:cubic-bezier(0,0,.2,.1);opacity:1;transform:rotate(0)}to{opacity:0;transform:rotate(45deg)}}@keyframes mat-checkbox-indeterminate-checked-checkmark{from{animation-timing-function:cubic-bezier(.14,0,0,1);opacity:0;transform:rotate(45deg)}to{opacity:1;transform:rotate(360deg)}}@keyframes mat-checkbox-checked-indeterminate-mixedmark{from{animation-timing-function:cubic-bezier(0,0,.2,.1);opacity:0;transform:rotate(-45deg)}to{opacity:1;transform:rotate(0)}}@keyframes mat-checkbox-indeterminate-checked-mixedmark{from{animation-timing-function:cubic-bezier(.14,0,0,1);opacity:1;transform:rotate(0)}to{opacity:0;transform:rotate(315deg)}}@keyframes mat-checkbox-indeterminate-unchecked-mixedmark{0%{animation-timing-function:linear;opacity:1;transform:scaleX(1)}100%,32.8%{opacity:0;transform:scaleX(0)}}.mat-checkbox-background,.mat-checkbox-frame{top:0;left:0;right:0;bottom:0;position:absolute;border-radius:2px;box-sizing:border-box;pointer-events:none}.mat-checkbox{transition:background .4s cubic-bezier(.25,.8,.25,1),box-shadow 280ms cubic-bezier(.4,0,.2,1);cursor:pointer;-webkit-tap-highlight-color:transparent}._mat-animation-noopable.mat-checkbox{transition:none;animation:none}.mat-checkbox .mat-ripple-element:not(.mat-checkbox-persistent-ripple){opacity:.16}.mat-checkbox-layout{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:inherit;align-items:baseline;vertical-align:middle;display:inline-flex;white-space:nowrap}.mat-checkbox-label{-webkit-user-select:auto;-moz-user-select:auto;-ms-user-select:auto;user-select:auto}.mat-checkbox-inner-container{display:inline-block;height:16px;line-height:0;margin:auto;margin-right:8px;order:0;position:relative;vertical-align:middle;white-space:nowrap;width:16px;flex-shrink:0}[dir=rtl] .mat-checkbox-inner-container{margin-left:8px;margin-right:auto}.mat-checkbox-inner-container-no-side-margin{margin-left:0;margin-right:0}.mat-checkbox-frame{background-color:transparent;transition:border-color 90ms cubic-bezier(0,0,.2,.1);border-width:2px;border-style:solid}._mat-animation-noopable .mat-checkbox-frame{transition:none}@media (-ms-high-contrast:active){.mat-checkbox.cdk-keyboard-focused .mat-checkbox-frame{border-style:dotted}}.mat-checkbox-background{align-items:center;display:inline-flex;justify-content:center;transition:background-color 90ms cubic-bezier(0,0,.2,.1),opacity 90ms cubic-bezier(0,0,.2,.1)}._mat-animation-noopable .mat-checkbox-background{transition:none}.mat-checkbox-persistent-ripple{width:100%;height:100%;transform:none}.mat-checkbox-inner-container:hover .mat-checkbox-persistent-ripple{opacity:.04}.mat-checkbox.cdk-keyboard-focused .mat-checkbox-persistent-ripple{opacity:.12}.mat-checkbox-persistent-ripple,.mat-checkbox.mat-checkbox-disabled .mat-checkbox-inner-container:hover .mat-checkbox-persistent-ripple{opacity:0}@media (hover:none){.mat-checkbox-inner-container:hover .mat-checkbox-persistent-ripple{display:none}}.mat-checkbox-checkmark{top:0;left:0;right:0;bottom:0;position:absolute;width:100%}.mat-checkbox-checkmark-path{stroke-dashoffset:22.91026;stroke-dasharray:22.91026;stroke-width:2.13333px}.mat-checkbox-mixedmark{width:calc(100% - 6px);height:2px;opacity:0;transform:scaleX(0) rotate(0);border-radius:2px}@media (-ms-high-contrast:active){.mat-checkbox-mixedmark{height:0;border-top:solid 2px;margin-top:2px}}.mat-checkbox-label-before .mat-checkbox-inner-container{order:1;margin-left:8px;margin-right:auto}[dir=rtl] .mat-checkbox-label-before .mat-checkbox-inner-container{margin-left:auto;margin-right:8px}.mat-checkbox-checked .mat-checkbox-checkmark{opacity:1}.mat-checkbox-checked .mat-checkbox-checkmark-path{stroke-dashoffset:0}.mat-checkbox-checked .mat-checkbox-mixedmark{transform:scaleX(1) rotate(-45deg)}.mat-checkbox-indeterminate .mat-checkbox-checkmark{opacity:0;transform:rotate(45deg)}.mat-checkbox-indeterminate .mat-checkbox-checkmark-path{stroke-dashoffset:0}.mat-checkbox-indeterminate .mat-checkbox-mixedmark{opacity:1;transform:scaleX(1) rotate(0)}.mat-checkbox-unchecked .mat-checkbox-background{background-color:transparent}.mat-checkbox-disabled{cursor:default}.mat-checkbox-anim-unchecked-checked .mat-checkbox-background{animation:180ms linear 0s mat-checkbox-fade-in-background}.mat-checkbox-anim-unchecked-checked .mat-checkbox-checkmark-path{animation:180ms linear 0s mat-checkbox-unchecked-checked-checkmark-path}.mat-checkbox-anim-unchecked-indeterminate .mat-checkbox-background{animation:180ms linear 0s mat-checkbox-fade-in-background}.mat-checkbox-anim-unchecked-indeterminate .mat-checkbox-mixedmark{animation:90ms linear 0s mat-checkbox-unchecked-indeterminate-mixedmark}.mat-checkbox-anim-checked-unchecked .mat-checkbox-background{animation:180ms linear 0s mat-checkbox-fade-out-background}.mat-checkbox-anim-checked-unchecked .mat-checkbox-checkmark-path{animation:90ms linear 0s mat-checkbox-checked-unchecked-checkmark-path}.mat-checkbox-anim-checked-indeterminate .mat-checkbox-checkmark{animation:90ms linear 0s mat-checkbox-checked-indeterminate-checkmark}.mat-checkbox-anim-checked-indeterminate .mat-checkbox-mixedmark{animation:90ms linear 0s mat-checkbox-checked-indeterminate-mixedmark}.mat-checkbox-anim-indeterminate-checked .mat-checkbox-checkmark{animation:.5s linear 0s mat-checkbox-indeterminate-checked-checkmark}.mat-checkbox-anim-indeterminate-checked .mat-checkbox-mixedmark{animation:.5s linear 0s mat-checkbox-indeterminate-checked-mixedmark}.mat-checkbox-anim-indeterminate-unchecked .mat-checkbox-background{animation:180ms linear 0s mat-checkbox-fade-out-background}.mat-checkbox-anim-indeterminate-unchecked .mat-checkbox-mixedmark{animation:.3s linear 0s mat-checkbox-indeterminate-unchecked-mixedmark}.mat-checkbox-input{bottom:0;left:50%}.mat-checkbox .mat-checkbox-ripple{position:absolute;left:calc(50% - 20px);top:calc(50% - 20px);height:40px;width:40px;z-index:1;pointer-events:none}"],
  8666. exportAs: 'matCheckbox',
  8667. host: {
  8668. 'class': 'mat-checkbox',
  8669. '[id]': 'id',
  8670. '[attr.tabindex]': 'null',
  8671. '[class.mat-checkbox-indeterminate]': 'indeterminate',
  8672. '[class.mat-checkbox-checked]': 'checked',
  8673. '[class.mat-checkbox-disabled]': 'disabled',
  8674. '[class.mat-checkbox-label-before]': 'labelPosition == "before"',
  8675. '[class._mat-animation-noopable]': "_animationMode === 'NoopAnimations'",
  8676. },
  8677. providers: [MAT_CHECKBOX_CONTROL_VALUE_ACCESSOR],
  8678. inputs: ['disableRipple', 'color', 'tabIndex'],
  8679. encapsulation: core.ViewEncapsulation.None,
  8680. changeDetection: core.ChangeDetectionStrategy.OnPush
  8681. },] },
  8682. ];
  8683. /** @nocollapse */
  8684. MatCheckbox.ctorParameters = function () { return [
  8685. { type: core.ElementRef },
  8686. { type: core.ChangeDetectorRef },
  8687. { type: a11y.FocusMonitor },
  8688. { type: core.NgZone },
  8689. { type: String, decorators: [{ type: core.Attribute, args: ['tabindex',] }] },
  8690. { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_CHECKBOX_CLICK_ACTION,] }] },
  8691. { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
  8692. ]; };
  8693. MatCheckbox.propDecorators = {
  8694. ariaLabel: [{ type: core.Input, args: ['aria-label',] }],
  8695. ariaLabelledby: [{ type: core.Input, args: ['aria-labelledby',] }],
  8696. id: [{ type: core.Input }],
  8697. required: [{ type: core.Input }],
  8698. labelPosition: [{ type: core.Input }],
  8699. name: [{ type: core.Input }],
  8700. change: [{ type: core.Output }],
  8701. indeterminateChange: [{ type: core.Output }],
  8702. value: [{ type: core.Input }],
  8703. _inputElement: [{ type: core.ViewChild, args: ['input', { static: false },] }],
  8704. ripple: [{ type: core.ViewChild, args: [MatRipple, { static: false },] }],
  8705. checked: [{ type: core.Input }],
  8706. disabled: [{ type: core.Input }],
  8707. indeterminate: [{ type: core.Input }]
  8708. };
  8709. return MatCheckbox;
  8710. }(_MatCheckboxMixinBase));
  8711. /**
  8712. * @fileoverview added by tsickle
  8713. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  8714. */
  8715. /** @type {?} */
  8716. var MAT_CHECKBOX_REQUIRED_VALIDATOR = {
  8717. provide: forms.NG_VALIDATORS,
  8718. useExisting: core.forwardRef((/**
  8719. * @return {?}
  8720. */
  8721. function () { return MatCheckboxRequiredValidator; })),
  8722. multi: true
  8723. };
  8724. /**
  8725. * Validator for Material checkbox's required attribute in template-driven checkbox.
  8726. * Current CheckboxRequiredValidator only work with `input type=checkbox` and does not
  8727. * work with `mat-checkbox`.
  8728. */
  8729. var MatCheckboxRequiredValidator = /** @class */ (function (_super) {
  8730. __extends(MatCheckboxRequiredValidator, _super);
  8731. function MatCheckboxRequiredValidator() {
  8732. return _super !== null && _super.apply(this, arguments) || this;
  8733. }
  8734. MatCheckboxRequiredValidator.decorators = [
  8735. { type: core.Directive, args: [{
  8736. selector: "mat-checkbox[required][formControlName],\n mat-checkbox[required][formControl], mat-checkbox[required][ngModel]",
  8737. providers: [MAT_CHECKBOX_REQUIRED_VALIDATOR],
  8738. },] },
  8739. ];
  8740. return MatCheckboxRequiredValidator;
  8741. }(forms.CheckboxRequiredValidator));
  8742. /**
  8743. * @fileoverview added by tsickle
  8744. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  8745. */
  8746. /**
  8747. * This module is used by both original and MDC-based checkbox implementations.
  8748. */
  8749. var _MatCheckboxRequiredValidatorModule = /** @class */ (function () {
  8750. function _MatCheckboxRequiredValidatorModule() {
  8751. }
  8752. _MatCheckboxRequiredValidatorModule.decorators = [
  8753. { type: core.NgModule, args: [{
  8754. exports: [MatCheckboxRequiredValidator],
  8755. declarations: [MatCheckboxRequiredValidator],
  8756. },] },
  8757. ];
  8758. return _MatCheckboxRequiredValidatorModule;
  8759. }());
  8760. var MatCheckboxModule = /** @class */ (function () {
  8761. function MatCheckboxModule() {
  8762. }
  8763. MatCheckboxModule.decorators = [
  8764. { type: core.NgModule, args: [{
  8765. imports: [
  8766. common.CommonModule, MatRippleModule, MatCommonModule, observers.ObserversModule,
  8767. _MatCheckboxRequiredValidatorModule
  8768. ],
  8769. exports: [MatCheckbox, MatCommonModule, _MatCheckboxRequiredValidatorModule],
  8770. declarations: [MatCheckbox],
  8771. },] },
  8772. ];
  8773. return MatCheckboxModule;
  8774. }());
  8775. /**
  8776. * @fileoverview added by tsickle
  8777. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  8778. */
  8779. /**
  8780. * Event object emitted by MatChip when selected or deselected.
  8781. */
  8782. var /**
  8783. * Event object emitted by MatChip when selected or deselected.
  8784. */
  8785. MatChipSelectionChange = /** @class */ (function () {
  8786. function MatChipSelectionChange(source, selected, isUserInput) {
  8787. if (isUserInput === void 0) { isUserInput = false; }
  8788. this.source = source;
  8789. this.selected = selected;
  8790. this.isUserInput = isUserInput;
  8791. }
  8792. return MatChipSelectionChange;
  8793. }());
  8794. // Boilerplate for applying mixins to MatChip.
  8795. /**
  8796. * \@docs-private
  8797. */
  8798. var
  8799. // Boilerplate for applying mixins to MatChip.
  8800. /**
  8801. * \@docs-private
  8802. */
  8803. MatChipBase = /** @class */ (function () {
  8804. function MatChipBase(_elementRef) {
  8805. this._elementRef = _elementRef;
  8806. }
  8807. return MatChipBase;
  8808. }());
  8809. /** @type {?} */
  8810. var _MatChipMixinBase = mixinColor(mixinDisableRipple(mixinDisabled(MatChipBase)), 'primary');
  8811. /**
  8812. * Dummy directive to add CSS class to chip avatar.
  8813. * \@docs-private
  8814. */
  8815. var MatChipAvatar = /** @class */ (function () {
  8816. function MatChipAvatar() {
  8817. }
  8818. MatChipAvatar.decorators = [
  8819. { type: core.Directive, args: [{
  8820. selector: 'mat-chip-avatar, [matChipAvatar]',
  8821. host: { 'class': 'mat-chip-avatar' }
  8822. },] },
  8823. ];
  8824. return MatChipAvatar;
  8825. }());
  8826. /**
  8827. * Dummy directive to add CSS class to chip trailing icon.
  8828. * \@docs-private
  8829. */
  8830. var MatChipTrailingIcon = /** @class */ (function () {
  8831. function MatChipTrailingIcon() {
  8832. }
  8833. MatChipTrailingIcon.decorators = [
  8834. { type: core.Directive, args: [{
  8835. selector: 'mat-chip-trailing-icon, [matChipTrailingIcon]',
  8836. host: { 'class': 'mat-chip-trailing-icon' }
  8837. },] },
  8838. ];
  8839. return MatChipTrailingIcon;
  8840. }());
  8841. /**
  8842. * Material design styled Chip component. Used inside the MatChipList component.
  8843. */
  8844. var MatChip = /** @class */ (function (_super) {
  8845. __extends(MatChip, _super);
  8846. function MatChip(_elementRef, _ngZone, platform$$1, globalRippleOptions,
  8847. // @breaking-change 8.0.0 `animationMode` parameter to become required.
  8848. animationMode) {
  8849. var _this = _super.call(this, _elementRef) || this;
  8850. _this._elementRef = _elementRef;
  8851. _this._ngZone = _ngZone;
  8852. /**
  8853. * Whether the chip has focus.
  8854. */
  8855. _this._hasFocus = false;
  8856. /**
  8857. * Whether the chip list is selectable
  8858. */
  8859. _this.chipListSelectable = true;
  8860. /**
  8861. * Whether the chip list is in multi-selection mode.
  8862. */
  8863. _this._chipListMultiple = false;
  8864. _this._selected = false;
  8865. _this._selectable = true;
  8866. _this._removable = true;
  8867. /**
  8868. * Emits when the chip is focused.
  8869. */
  8870. _this._onFocus = new rxjs.Subject();
  8871. /**
  8872. * Emits when the chip is blured.
  8873. */
  8874. _this._onBlur = new rxjs.Subject();
  8875. /**
  8876. * Emitted when the chip is selected or deselected.
  8877. */
  8878. _this.selectionChange = new core.EventEmitter();
  8879. /**
  8880. * Emitted when the chip is destroyed.
  8881. */
  8882. _this.destroyed = new core.EventEmitter();
  8883. /**
  8884. * Emitted when a chip is to be removed.
  8885. */
  8886. _this.removed = new core.EventEmitter();
  8887. _this._addHostClassName();
  8888. _this._chipRipple = new RippleRenderer(_this, _ngZone, _elementRef, platform$$1);
  8889. _this._chipRipple.setupTriggerEvents(_elementRef.nativeElement);
  8890. _this.rippleConfig = globalRippleOptions || {};
  8891. _this._animationsDisabled = animationMode === 'NoopAnimations';
  8892. return _this;
  8893. }
  8894. Object.defineProperty(MatChip.prototype, "rippleDisabled", {
  8895. /**
  8896. * Whether ripples are disabled on interaction
  8897. * @docs-private
  8898. */
  8899. get: /**
  8900. * Whether ripples are disabled on interaction
  8901. * \@docs-private
  8902. * @return {?}
  8903. */
  8904. function () {
  8905. return this.disabled || this.disableRipple || !!this.rippleConfig.disabled;
  8906. },
  8907. enumerable: true,
  8908. configurable: true
  8909. });
  8910. Object.defineProperty(MatChip.prototype, "selected", {
  8911. /** Whether the chip is selected. */
  8912. get: /**
  8913. * Whether the chip is selected.
  8914. * @return {?}
  8915. */
  8916. function () { return this._selected; },
  8917. set: /**
  8918. * @param {?} value
  8919. * @return {?}
  8920. */
  8921. function (value) {
  8922. /** @type {?} */
  8923. var coercedValue = coercion.coerceBooleanProperty(value);
  8924. if (coercedValue !== this._selected) {
  8925. this._selected = coercedValue;
  8926. this._dispatchSelectionChange();
  8927. }
  8928. },
  8929. enumerable: true,
  8930. configurable: true
  8931. });
  8932. Object.defineProperty(MatChip.prototype, "value", {
  8933. /** The value of the chip. Defaults to the content inside `<mat-chip>` tags. */
  8934. get: /**
  8935. * The value of the chip. Defaults to the content inside `<mat-chip>` tags.
  8936. * @return {?}
  8937. */
  8938. function () {
  8939. return this._value != undefined
  8940. ? this._value
  8941. : this._elementRef.nativeElement.textContent;
  8942. },
  8943. set: /**
  8944. * @param {?} value
  8945. * @return {?}
  8946. */
  8947. function (value) { this._value = value; },
  8948. enumerable: true,
  8949. configurable: true
  8950. });
  8951. Object.defineProperty(MatChip.prototype, "selectable", {
  8952. /**
  8953. * Whether or not the chip is selectable. When a chip is not selectable,
  8954. * changes to its selected state are always ignored. By default a chip is
  8955. * selectable, and it becomes non-selectable if its parent chip list is
  8956. * not selectable.
  8957. */
  8958. get: /**
  8959. * Whether or not the chip is selectable. When a chip is not selectable,
  8960. * changes to its selected state are always ignored. By default a chip is
  8961. * selectable, and it becomes non-selectable if its parent chip list is
  8962. * not selectable.
  8963. * @return {?}
  8964. */
  8965. function () { return this._selectable && this.chipListSelectable; },
  8966. set: /**
  8967. * @param {?} value
  8968. * @return {?}
  8969. */
  8970. function (value) {
  8971. this._selectable = coercion.coerceBooleanProperty(value);
  8972. },
  8973. enumerable: true,
  8974. configurable: true
  8975. });
  8976. Object.defineProperty(MatChip.prototype, "removable", {
  8977. /**
  8978. * Determines whether or not the chip displays the remove styling and emits (removed) events.
  8979. */
  8980. get: /**
  8981. * Determines whether or not the chip displays the remove styling and emits (removed) events.
  8982. * @return {?}
  8983. */
  8984. function () { return this._removable; },
  8985. set: /**
  8986. * @param {?} value
  8987. * @return {?}
  8988. */
  8989. function (value) {
  8990. this._removable = coercion.coerceBooleanProperty(value);
  8991. },
  8992. enumerable: true,
  8993. configurable: true
  8994. });
  8995. Object.defineProperty(MatChip.prototype, "ariaSelected", {
  8996. /** The ARIA selected applied to the chip. */
  8997. get: /**
  8998. * The ARIA selected applied to the chip.
  8999. * @return {?}
  9000. */
  9001. function () {
  9002. // Remove the `aria-selected` when the chip is deselected in single-selection mode, because
  9003. // it adds noise to NVDA users where "not selected" will be read out for each chip.
  9004. return this.selectable && (this._chipListMultiple || this.selected) ?
  9005. this.selected.toString() : null;
  9006. },
  9007. enumerable: true,
  9008. configurable: true
  9009. });
  9010. /**
  9011. * @return {?}
  9012. */
  9013. MatChip.prototype._addHostClassName = /**
  9014. * @return {?}
  9015. */
  9016. function () {
  9017. /** @type {?} */
  9018. var basicChipAttrName = 'mat-basic-chip';
  9019. /** @type {?} */
  9020. var element = (/** @type {?} */ (this._elementRef.nativeElement));
  9021. if (element.hasAttribute(basicChipAttrName) ||
  9022. element.tagName.toLowerCase() === basicChipAttrName) {
  9023. element.classList.add(basicChipAttrName);
  9024. return;
  9025. }
  9026. else {
  9027. element.classList.add('mat-standard-chip');
  9028. }
  9029. };
  9030. /**
  9031. * @return {?}
  9032. */
  9033. MatChip.prototype.ngOnDestroy = /**
  9034. * @return {?}
  9035. */
  9036. function () {
  9037. this.destroyed.emit({ chip: this });
  9038. this._chipRipple._removeTriggerEvents();
  9039. };
  9040. /** Selects the chip. */
  9041. /**
  9042. * Selects the chip.
  9043. * @return {?}
  9044. */
  9045. MatChip.prototype.select = /**
  9046. * Selects the chip.
  9047. * @return {?}
  9048. */
  9049. function () {
  9050. if (!this._selected) {
  9051. this._selected = true;
  9052. this._dispatchSelectionChange();
  9053. }
  9054. };
  9055. /** Deselects the chip. */
  9056. /**
  9057. * Deselects the chip.
  9058. * @return {?}
  9059. */
  9060. MatChip.prototype.deselect = /**
  9061. * Deselects the chip.
  9062. * @return {?}
  9063. */
  9064. function () {
  9065. if (this._selected) {
  9066. this._selected = false;
  9067. this._dispatchSelectionChange();
  9068. }
  9069. };
  9070. /** Select this chip and emit selected event */
  9071. /**
  9072. * Select this chip and emit selected event
  9073. * @return {?}
  9074. */
  9075. MatChip.prototype.selectViaInteraction = /**
  9076. * Select this chip and emit selected event
  9077. * @return {?}
  9078. */
  9079. function () {
  9080. if (!this._selected) {
  9081. this._selected = true;
  9082. this._dispatchSelectionChange(true);
  9083. }
  9084. };
  9085. /** Toggles the current selected state of this chip. */
  9086. /**
  9087. * Toggles the current selected state of this chip.
  9088. * @param {?=} isUserInput
  9089. * @return {?}
  9090. */
  9091. MatChip.prototype.toggleSelected = /**
  9092. * Toggles the current selected state of this chip.
  9093. * @param {?=} isUserInput
  9094. * @return {?}
  9095. */
  9096. function (isUserInput) {
  9097. if (isUserInput === void 0) { isUserInput = false; }
  9098. this._selected = !this.selected;
  9099. this._dispatchSelectionChange(isUserInput);
  9100. return this.selected;
  9101. };
  9102. /** Allows for programmatic focusing of the chip. */
  9103. /**
  9104. * Allows for programmatic focusing of the chip.
  9105. * @return {?}
  9106. */
  9107. MatChip.prototype.focus = /**
  9108. * Allows for programmatic focusing of the chip.
  9109. * @return {?}
  9110. */
  9111. function () {
  9112. if (!this._hasFocus) {
  9113. this._elementRef.nativeElement.focus();
  9114. this._onFocus.next({ chip: this });
  9115. }
  9116. this._hasFocus = true;
  9117. };
  9118. /**
  9119. * Allows for programmatic removal of the chip. Called by the MatChipList when the DELETE or
  9120. * BACKSPACE keys are pressed.
  9121. *
  9122. * Informs any listeners of the removal request. Does not remove the chip from the DOM.
  9123. */
  9124. /**
  9125. * Allows for programmatic removal of the chip. Called by the MatChipList when the DELETE or
  9126. * BACKSPACE keys are pressed.
  9127. *
  9128. * Informs any listeners of the removal request. Does not remove the chip from the DOM.
  9129. * @return {?}
  9130. */
  9131. MatChip.prototype.remove = /**
  9132. * Allows for programmatic removal of the chip. Called by the MatChipList when the DELETE or
  9133. * BACKSPACE keys are pressed.
  9134. *
  9135. * Informs any listeners of the removal request. Does not remove the chip from the DOM.
  9136. * @return {?}
  9137. */
  9138. function () {
  9139. if (this.removable) {
  9140. this.removed.emit({ chip: this });
  9141. }
  9142. };
  9143. /** Handles click events on the chip. */
  9144. /**
  9145. * Handles click events on the chip.
  9146. * @param {?} event
  9147. * @return {?}
  9148. */
  9149. MatChip.prototype._handleClick = /**
  9150. * Handles click events on the chip.
  9151. * @param {?} event
  9152. * @return {?}
  9153. */
  9154. function (event) {
  9155. if (this.disabled) {
  9156. event.preventDefault();
  9157. }
  9158. else {
  9159. event.stopPropagation();
  9160. }
  9161. };
  9162. /** Handle custom key presses. */
  9163. /**
  9164. * Handle custom key presses.
  9165. * @param {?} event
  9166. * @return {?}
  9167. */
  9168. MatChip.prototype._handleKeydown = /**
  9169. * Handle custom key presses.
  9170. * @param {?} event
  9171. * @return {?}
  9172. */
  9173. function (event) {
  9174. if (this.disabled) {
  9175. return;
  9176. }
  9177. switch (event.keyCode) {
  9178. case keycodes.DELETE:
  9179. case keycodes.BACKSPACE:
  9180. // If we are removable, remove the focused chip
  9181. this.remove();
  9182. // Always prevent so page navigation does not occur
  9183. event.preventDefault();
  9184. break;
  9185. case keycodes.SPACE:
  9186. // If we are selectable, toggle the focused chip
  9187. if (this.selectable) {
  9188. this.toggleSelected(true);
  9189. }
  9190. // Always prevent space from scrolling the page since the list has focus
  9191. event.preventDefault();
  9192. break;
  9193. }
  9194. };
  9195. /**
  9196. * @return {?}
  9197. */
  9198. MatChip.prototype._blur = /**
  9199. * @return {?}
  9200. */
  9201. function () {
  9202. var _this = this;
  9203. // When animations are enabled, Angular may end up removing the chip from the DOM a little
  9204. // earlier than usual, causing it to be blurred and throwing off the logic in the chip list
  9205. // that moves focus not the next item. To work around the issue, we defer marking the chip
  9206. // as not focused until the next time the zone stabilizes.
  9207. this._ngZone.onStable
  9208. .asObservable()
  9209. .pipe(operators.take(1))
  9210. .subscribe((/**
  9211. * @return {?}
  9212. */
  9213. function () {
  9214. _this._ngZone.run((/**
  9215. * @return {?}
  9216. */
  9217. function () {
  9218. _this._hasFocus = false;
  9219. _this._onBlur.next({ chip: _this });
  9220. }));
  9221. }));
  9222. };
  9223. /**
  9224. * @private
  9225. * @param {?=} isUserInput
  9226. * @return {?}
  9227. */
  9228. MatChip.prototype._dispatchSelectionChange = /**
  9229. * @private
  9230. * @param {?=} isUserInput
  9231. * @return {?}
  9232. */
  9233. function (isUserInput) {
  9234. if (isUserInput === void 0) { isUserInput = false; }
  9235. this.selectionChange.emit({
  9236. source: this,
  9237. isUserInput: isUserInput,
  9238. selected: this._selected
  9239. });
  9240. };
  9241. MatChip.decorators = [
  9242. { type: core.Directive, args: [{
  9243. selector: "mat-basic-chip, [mat-basic-chip], mat-chip, [mat-chip]",
  9244. inputs: ['color', 'disabled', 'disableRipple'],
  9245. exportAs: 'matChip',
  9246. host: {
  9247. 'class': 'mat-chip',
  9248. '[attr.tabindex]': 'disabled ? null : -1',
  9249. 'role': 'option',
  9250. '[class.mat-chip-selected]': 'selected',
  9251. '[class.mat-chip-with-avatar]': 'avatar',
  9252. '[class.mat-chip-with-trailing-icon]': 'trailingIcon || removeIcon',
  9253. '[class.mat-chip-disabled]': 'disabled',
  9254. '[class._mat-animation-noopable]': '_animationsDisabled',
  9255. '[attr.disabled]': 'disabled || null',
  9256. '[attr.aria-disabled]': 'disabled.toString()',
  9257. '[attr.aria-selected]': 'ariaSelected',
  9258. '(click)': '_handleClick($event)',
  9259. '(keydown)': '_handleKeydown($event)',
  9260. '(focus)': 'focus()',
  9261. '(blur)': '_blur()',
  9262. },
  9263. },] },
  9264. ];
  9265. /** @nocollapse */
  9266. MatChip.ctorParameters = function () { return [
  9267. { type: core.ElementRef },
  9268. { type: core.NgZone },
  9269. { type: platform.Platform },
  9270. { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_RIPPLE_GLOBAL_OPTIONS,] }] },
  9271. { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
  9272. ]; };
  9273. MatChip.propDecorators = {
  9274. avatar: [{ type: core.ContentChild, args: [MatChipAvatar, { static: false },] }],
  9275. trailingIcon: [{ type: core.ContentChild, args: [MatChipTrailingIcon, { static: false },] }],
  9276. removeIcon: [{ type: core.ContentChild, args: [core.forwardRef((/**
  9277. * @return {?}
  9278. */
  9279. function () { return MatChipRemove; })), { static: false },] }],
  9280. selected: [{ type: core.Input }],
  9281. value: [{ type: core.Input }],
  9282. selectable: [{ type: core.Input }],
  9283. removable: [{ type: core.Input }],
  9284. selectionChange: [{ type: core.Output }],
  9285. destroyed: [{ type: core.Output }],
  9286. removed: [{ type: core.Output }]
  9287. };
  9288. return MatChip;
  9289. }(_MatChipMixinBase));
  9290. /**
  9291. * Applies proper (click) support and adds styling for use with the Material Design "cancel" icon
  9292. * available at https://material.io/icons/#ic_cancel.
  9293. *
  9294. * Example:
  9295. *
  9296. * `<mat-chip>
  9297. * <mat-icon matChipRemove>cancel</mat-icon>
  9298. * </mat-chip>`
  9299. *
  9300. * You *may* use a custom icon, but you may need to override the `mat-chip-remove` positioning
  9301. * styles to properly center the icon within the chip.
  9302. */
  9303. var MatChipRemove = /** @class */ (function () {
  9304. function MatChipRemove(_parentChip) {
  9305. this._parentChip = _parentChip;
  9306. }
  9307. /** Calls the parent chip's public `remove()` method if applicable. */
  9308. /**
  9309. * Calls the parent chip's public `remove()` method if applicable.
  9310. * @param {?} event
  9311. * @return {?}
  9312. */
  9313. MatChipRemove.prototype._handleClick = /**
  9314. * Calls the parent chip's public `remove()` method if applicable.
  9315. * @param {?} event
  9316. * @return {?}
  9317. */
  9318. function (event) {
  9319. /** @type {?} */
  9320. var parentChip = this._parentChip;
  9321. if (parentChip.removable && !parentChip.disabled) {
  9322. parentChip.remove();
  9323. }
  9324. // We need to stop event propagation because otherwise the event will bubble up to the
  9325. // form field and cause the `onContainerClick` method to be invoked. This method would then
  9326. // reset the focused chip that has been focused after chip removal. Usually the parent
  9327. // the parent click listener of the `MatChip` would prevent propagation, but it can happen
  9328. // that the chip is being removed before the event bubbles up.
  9329. event.stopPropagation();
  9330. };
  9331. MatChipRemove.decorators = [
  9332. { type: core.Directive, args: [{
  9333. selector: '[matChipRemove]',
  9334. host: {
  9335. 'class': 'mat-chip-remove mat-chip-trailing-icon',
  9336. '(click)': '_handleClick($event)',
  9337. }
  9338. },] },
  9339. ];
  9340. /** @nocollapse */
  9341. MatChipRemove.ctorParameters = function () { return [
  9342. { type: MatChip }
  9343. ]; };
  9344. return MatChipRemove;
  9345. }());
  9346. /**
  9347. * @fileoverview added by tsickle
  9348. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  9349. */
  9350. /**
  9351. * Injection token to be used to override the default options for the chips module.
  9352. * @type {?}
  9353. */
  9354. var MAT_CHIPS_DEFAULT_OPTIONS = new core.InjectionToken('mat-chips-default-options');
  9355. /**
  9356. * @fileoverview added by tsickle
  9357. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  9358. */
  9359. // Boilerplate for applying mixins to MatChipList.
  9360. /**
  9361. * \@docs-private
  9362. */
  9363. var
  9364. // Boilerplate for applying mixins to MatChipList.
  9365. /**
  9366. * \@docs-private
  9367. */
  9368. MatChipListBase = /** @class */ (function () {
  9369. function MatChipListBase(_defaultErrorStateMatcher, _parentForm, _parentFormGroup, ngControl) {
  9370. this._defaultErrorStateMatcher = _defaultErrorStateMatcher;
  9371. this._parentForm = _parentForm;
  9372. this._parentFormGroup = _parentFormGroup;
  9373. this.ngControl = ngControl;
  9374. }
  9375. return MatChipListBase;
  9376. }());
  9377. /** @type {?} */
  9378. var _MatChipListMixinBase = mixinErrorState(MatChipListBase);
  9379. // Increasing integer for generating unique ids for chip-list components.
  9380. /** @type {?} */
  9381. var nextUniqueId$4 = 0;
  9382. /**
  9383. * Change event object that is emitted when the chip list value has changed.
  9384. */
  9385. var /**
  9386. * Change event object that is emitted when the chip list value has changed.
  9387. */
  9388. MatChipListChange = /** @class */ (function () {
  9389. function MatChipListChange(source, value) {
  9390. this.source = source;
  9391. this.value = value;
  9392. }
  9393. return MatChipListChange;
  9394. }());
  9395. /**
  9396. * A material design chips component (named ChipList for its similarity to the List component).
  9397. */
  9398. var MatChipList = /** @class */ (function (_super) {
  9399. __extends(MatChipList, _super);
  9400. function MatChipList(_elementRef, _changeDetectorRef, _dir, _parentForm, _parentFormGroup, _defaultErrorStateMatcher, ngControl) {
  9401. var _this = _super.call(this, _defaultErrorStateMatcher, _parentForm, _parentFormGroup, ngControl) || this;
  9402. _this._elementRef = _elementRef;
  9403. _this._changeDetectorRef = _changeDetectorRef;
  9404. _this._dir = _dir;
  9405. _this.ngControl = ngControl;
  9406. /**
  9407. * Implemented as part of MatFormFieldControl.
  9408. * \@docs-private
  9409. */
  9410. _this.controlType = 'mat-chip-list';
  9411. /**
  9412. * When a chip is destroyed, we store the index of the destroyed chip until the chips
  9413. * query list notifies about the update. This is necessary because we cannot determine an
  9414. * appropriate chip that should receive focus until the array of chips updated completely.
  9415. */
  9416. _this._lastDestroyedChipIndex = null;
  9417. /**
  9418. * Subject that emits when the component has been destroyed.
  9419. */
  9420. _this._destroyed = new rxjs.Subject();
  9421. /**
  9422. * Uid of the chip list
  9423. */
  9424. _this._uid = "mat-chip-list-" + nextUniqueId$4++;
  9425. /**
  9426. * Tab index for the chip list.
  9427. */
  9428. _this._tabIndex = 0;
  9429. /**
  9430. * User defined tab index.
  9431. * When it is not null, use user defined tab index. Otherwise use _tabIndex
  9432. */
  9433. _this._userTabIndex = null;
  9434. /**
  9435. * Function when touched
  9436. */
  9437. _this._onTouched = (/**
  9438. * @return {?}
  9439. */
  9440. function () { });
  9441. /**
  9442. * Function when changed
  9443. */
  9444. _this._onChange = (/**
  9445. * @return {?}
  9446. */
  9447. function () { });
  9448. _this._multiple = false;
  9449. _this._compareWith = (/**
  9450. * @param {?} o1
  9451. * @param {?} o2
  9452. * @return {?}
  9453. */
  9454. function (o1, o2) { return o1 === o2; });
  9455. _this._required = false;
  9456. _this._disabled = false;
  9457. /**
  9458. * Orientation of the chip list.
  9459. */
  9460. _this.ariaOrientation = 'horizontal';
  9461. _this._selectable = true;
  9462. /**
  9463. * Event emitted when the selected chip list value has been changed by the user.
  9464. */
  9465. _this.change = new core.EventEmitter();
  9466. /**
  9467. * Event that emits whenever the raw value of the chip-list changes. This is here primarily
  9468. * to facilitate the two-way binding for the `value` input.
  9469. * \@docs-private
  9470. */
  9471. _this.valueChange = new core.EventEmitter();
  9472. if (_this.ngControl) {
  9473. _this.ngControl.valueAccessor = _this;
  9474. }
  9475. return _this;
  9476. }
  9477. Object.defineProperty(MatChipList.prototype, "selected", {
  9478. /** The array of selected chips inside chip list. */
  9479. get: /**
  9480. * The array of selected chips inside chip list.
  9481. * @return {?}
  9482. */
  9483. function () {
  9484. return this.multiple ? this._selectionModel.selected : this._selectionModel.selected[0];
  9485. },
  9486. enumerable: true,
  9487. configurable: true
  9488. });
  9489. Object.defineProperty(MatChipList.prototype, "role", {
  9490. /** The ARIA role applied to the chip list. */
  9491. get: /**
  9492. * The ARIA role applied to the chip list.
  9493. * @return {?}
  9494. */
  9495. function () { return this.empty ? null : 'listbox'; },
  9496. enumerable: true,
  9497. configurable: true
  9498. });
  9499. Object.defineProperty(MatChipList.prototype, "multiple", {
  9500. /** Whether the user should be allowed to select multiple chips. */
  9501. get: /**
  9502. * Whether the user should be allowed to select multiple chips.
  9503. * @return {?}
  9504. */
  9505. function () { return this._multiple; },
  9506. set: /**
  9507. * @param {?} value
  9508. * @return {?}
  9509. */
  9510. function (value) {
  9511. this._multiple = coercion.coerceBooleanProperty(value);
  9512. this._syncChipsState();
  9513. },
  9514. enumerable: true,
  9515. configurable: true
  9516. });
  9517. Object.defineProperty(MatChipList.prototype, "compareWith", {
  9518. /**
  9519. * A function to compare the option values with the selected values. The first argument
  9520. * is a value from an option. The second is a value from the selection. A boolean
  9521. * should be returned.
  9522. */
  9523. get: /**
  9524. * A function to compare the option values with the selected values. The first argument
  9525. * is a value from an option. The second is a value from the selection. A boolean
  9526. * should be returned.
  9527. * @return {?}
  9528. */
  9529. function () { return this._compareWith; },
  9530. set: /**
  9531. * @param {?} fn
  9532. * @return {?}
  9533. */
  9534. function (fn) {
  9535. this._compareWith = fn;
  9536. if (this._selectionModel) {
  9537. // A different comparator means the selection could change.
  9538. this._initializeSelection();
  9539. }
  9540. },
  9541. enumerable: true,
  9542. configurable: true
  9543. });
  9544. Object.defineProperty(MatChipList.prototype, "value", {
  9545. /**
  9546. * Implemented as part of MatFormFieldControl.
  9547. * @docs-private
  9548. */
  9549. get: /**
  9550. * Implemented as part of MatFormFieldControl.
  9551. * \@docs-private
  9552. * @return {?}
  9553. */
  9554. function () { return this._value; },
  9555. set: /**
  9556. * @param {?} value
  9557. * @return {?}
  9558. */
  9559. function (value) {
  9560. this.writeValue(value);
  9561. this._value = value;
  9562. },
  9563. enumerable: true,
  9564. configurable: true
  9565. });
  9566. Object.defineProperty(MatChipList.prototype, "id", {
  9567. /**
  9568. * Implemented as part of MatFormFieldControl.
  9569. * @docs-private
  9570. */
  9571. get: /**
  9572. * Implemented as part of MatFormFieldControl.
  9573. * \@docs-private
  9574. * @return {?}
  9575. */
  9576. function () {
  9577. return this._chipInput ? this._chipInput.id : this._uid;
  9578. },
  9579. enumerable: true,
  9580. configurable: true
  9581. });
  9582. Object.defineProperty(MatChipList.prototype, "required", {
  9583. /**
  9584. * Implemented as part of MatFormFieldControl.
  9585. * @docs-private
  9586. */
  9587. get: /**
  9588. * Implemented as part of MatFormFieldControl.
  9589. * \@docs-private
  9590. * @return {?}
  9591. */
  9592. function () { return this._required; },
  9593. set: /**
  9594. * @param {?} value
  9595. * @return {?}
  9596. */
  9597. function (value) {
  9598. this._required = coercion.coerceBooleanProperty(value);
  9599. this.stateChanges.next();
  9600. },
  9601. enumerable: true,
  9602. configurable: true
  9603. });
  9604. Object.defineProperty(MatChipList.prototype, "placeholder", {
  9605. /**
  9606. * Implemented as part of MatFormFieldControl.
  9607. * @docs-private
  9608. */
  9609. get: /**
  9610. * Implemented as part of MatFormFieldControl.
  9611. * \@docs-private
  9612. * @return {?}
  9613. */
  9614. function () {
  9615. return this._chipInput ? this._chipInput.placeholder : this._placeholder;
  9616. },
  9617. set: /**
  9618. * @param {?} value
  9619. * @return {?}
  9620. */
  9621. function (value) {
  9622. this._placeholder = value;
  9623. this.stateChanges.next();
  9624. },
  9625. enumerable: true,
  9626. configurable: true
  9627. });
  9628. Object.defineProperty(MatChipList.prototype, "focused", {
  9629. /** Whether any chips or the matChipInput inside of this chip-list has focus. */
  9630. get: /**
  9631. * Whether any chips or the matChipInput inside of this chip-list has focus.
  9632. * @return {?}
  9633. */
  9634. function () {
  9635. return (this._chipInput && this._chipInput.focused) || this._hasFocusedChip();
  9636. },
  9637. enumerable: true,
  9638. configurable: true
  9639. });
  9640. Object.defineProperty(MatChipList.prototype, "empty", {
  9641. /**
  9642. * Implemented as part of MatFormFieldControl.
  9643. * @docs-private
  9644. */
  9645. get: /**
  9646. * Implemented as part of MatFormFieldControl.
  9647. * \@docs-private
  9648. * @return {?}
  9649. */
  9650. function () {
  9651. return (!this._chipInput || this._chipInput.empty) && this.chips.length === 0;
  9652. },
  9653. enumerable: true,
  9654. configurable: true
  9655. });
  9656. Object.defineProperty(MatChipList.prototype, "shouldLabelFloat", {
  9657. /**
  9658. * Implemented as part of MatFormFieldControl.
  9659. * @docs-private
  9660. */
  9661. get: /**
  9662. * Implemented as part of MatFormFieldControl.
  9663. * \@docs-private
  9664. * @return {?}
  9665. */
  9666. function () { return !this.empty || this.focused; },
  9667. enumerable: true,
  9668. configurable: true
  9669. });
  9670. Object.defineProperty(MatChipList.prototype, "disabled", {
  9671. /**
  9672. * Implemented as part of MatFormFieldControl.
  9673. * @docs-private
  9674. */
  9675. get: /**
  9676. * Implemented as part of MatFormFieldControl.
  9677. * \@docs-private
  9678. * @return {?}
  9679. */
  9680. function () { return this.ngControl ? !!this.ngControl.disabled : this._disabled; },
  9681. set: /**
  9682. * @param {?} value
  9683. * @return {?}
  9684. */
  9685. function (value) {
  9686. this._disabled = coercion.coerceBooleanProperty(value);
  9687. this._syncChipsState();
  9688. },
  9689. enumerable: true,
  9690. configurable: true
  9691. });
  9692. Object.defineProperty(MatChipList.prototype, "selectable", {
  9693. /**
  9694. * Whether or not this chip list is selectable. When a chip list is not selectable,
  9695. * the selected states for all the chips inside the chip list are always ignored.
  9696. */
  9697. get: /**
  9698. * Whether or not this chip list is selectable. When a chip list is not selectable,
  9699. * the selected states for all the chips inside the chip list are always ignored.
  9700. * @return {?}
  9701. */
  9702. function () { return this._selectable; },
  9703. set: /**
  9704. * @param {?} value
  9705. * @return {?}
  9706. */
  9707. function (value) {
  9708. var _this = this;
  9709. this._selectable = coercion.coerceBooleanProperty(value);
  9710. if (this.chips) {
  9711. this.chips.forEach((/**
  9712. * @param {?} chip
  9713. * @return {?}
  9714. */
  9715. function (chip) { return chip.chipListSelectable = _this._selectable; }));
  9716. }
  9717. },
  9718. enumerable: true,
  9719. configurable: true
  9720. });
  9721. Object.defineProperty(MatChipList.prototype, "tabIndex", {
  9722. set: /**
  9723. * @param {?} value
  9724. * @return {?}
  9725. */
  9726. function (value) {
  9727. this._userTabIndex = value;
  9728. this._tabIndex = value;
  9729. },
  9730. enumerable: true,
  9731. configurable: true
  9732. });
  9733. Object.defineProperty(MatChipList.prototype, "chipSelectionChanges", {
  9734. /** Combined stream of all of the child chips' selection change events. */
  9735. get: /**
  9736. * Combined stream of all of the child chips' selection change events.
  9737. * @return {?}
  9738. */
  9739. function () {
  9740. return rxjs.merge.apply(void 0, this.chips.map((/**
  9741. * @param {?} chip
  9742. * @return {?}
  9743. */
  9744. function (chip) { return chip.selectionChange; })));
  9745. },
  9746. enumerable: true,
  9747. configurable: true
  9748. });
  9749. Object.defineProperty(MatChipList.prototype, "chipFocusChanges", {
  9750. /** Combined stream of all of the child chips' focus change events. */
  9751. get: /**
  9752. * Combined stream of all of the child chips' focus change events.
  9753. * @return {?}
  9754. */
  9755. function () {
  9756. return rxjs.merge.apply(void 0, this.chips.map((/**
  9757. * @param {?} chip
  9758. * @return {?}
  9759. */
  9760. function (chip) { return chip._onFocus; })));
  9761. },
  9762. enumerable: true,
  9763. configurable: true
  9764. });
  9765. Object.defineProperty(MatChipList.prototype, "chipBlurChanges", {
  9766. /** Combined stream of all of the child chips' blur change events. */
  9767. get: /**
  9768. * Combined stream of all of the child chips' blur change events.
  9769. * @return {?}
  9770. */
  9771. function () {
  9772. return rxjs.merge.apply(void 0, this.chips.map((/**
  9773. * @param {?} chip
  9774. * @return {?}
  9775. */
  9776. function (chip) { return chip._onBlur; })));
  9777. },
  9778. enumerable: true,
  9779. configurable: true
  9780. });
  9781. Object.defineProperty(MatChipList.prototype, "chipRemoveChanges", {
  9782. /** Combined stream of all of the child chips' remove change events. */
  9783. get: /**
  9784. * Combined stream of all of the child chips' remove change events.
  9785. * @return {?}
  9786. */
  9787. function () {
  9788. return rxjs.merge.apply(void 0, this.chips.map((/**
  9789. * @param {?} chip
  9790. * @return {?}
  9791. */
  9792. function (chip) { return chip.destroyed; })));
  9793. },
  9794. enumerable: true,
  9795. configurable: true
  9796. });
  9797. /**
  9798. * @return {?}
  9799. */
  9800. MatChipList.prototype.ngAfterContentInit = /**
  9801. * @return {?}
  9802. */
  9803. function () {
  9804. var _this = this;
  9805. this._keyManager = new a11y.FocusKeyManager(this.chips)
  9806. .withWrap()
  9807. .withVerticalOrientation()
  9808. .withHorizontalOrientation(this._dir ? this._dir.value : 'ltr');
  9809. if (this._dir) {
  9810. this._dir.change
  9811. .pipe(operators.takeUntil(this._destroyed))
  9812. .subscribe((/**
  9813. * @param {?} dir
  9814. * @return {?}
  9815. */
  9816. function (dir) { return _this._keyManager.withHorizontalOrientation(dir); }));
  9817. }
  9818. this._keyManager.tabOut.pipe(operators.takeUntil(this._destroyed)).subscribe((/**
  9819. * @return {?}
  9820. */
  9821. function () {
  9822. _this._allowFocusEscape();
  9823. }));
  9824. // When the list changes, re-subscribe
  9825. this.chips.changes.pipe(operators.startWith(null), operators.takeUntil(this._destroyed)).subscribe((/**
  9826. * @return {?}
  9827. */
  9828. function () {
  9829. if (_this.disabled) {
  9830. // Since this happens after the content has been
  9831. // checked, we need to defer it to the next tick.
  9832. Promise.resolve().then((/**
  9833. * @return {?}
  9834. */
  9835. function () {
  9836. _this._syncChipsState();
  9837. }));
  9838. }
  9839. _this._resetChips();
  9840. // Reset chips selected/deselected status
  9841. _this._initializeSelection();
  9842. // Check to see if we need to update our tab index
  9843. _this._updateTabIndex();
  9844. // Check to see if we have a destroyed chip and need to refocus
  9845. _this._updateFocusForDestroyedChips();
  9846. _this.stateChanges.next();
  9847. }));
  9848. };
  9849. /**
  9850. * @return {?}
  9851. */
  9852. MatChipList.prototype.ngOnInit = /**
  9853. * @return {?}
  9854. */
  9855. function () {
  9856. this._selectionModel = new collections.SelectionModel(this.multiple, undefined, false);
  9857. this.stateChanges.next();
  9858. };
  9859. /**
  9860. * @return {?}
  9861. */
  9862. MatChipList.prototype.ngDoCheck = /**
  9863. * @return {?}
  9864. */
  9865. function () {
  9866. if (this.ngControl) {
  9867. // We need to re-evaluate this on every change detection cycle, because there are some
  9868. // error triggers that we can't subscribe to (e.g. parent form submissions). This means
  9869. // that whatever logic is in here has to be super lean or we risk destroying the performance.
  9870. this.updateErrorState();
  9871. }
  9872. };
  9873. /**
  9874. * @return {?}
  9875. */
  9876. MatChipList.prototype.ngOnDestroy = /**
  9877. * @return {?}
  9878. */
  9879. function () {
  9880. this._destroyed.next();
  9881. this._destroyed.complete();
  9882. this.stateChanges.complete();
  9883. this._dropSubscriptions();
  9884. };
  9885. /** Associates an HTML input element with this chip list. */
  9886. /**
  9887. * Associates an HTML input element with this chip list.
  9888. * @param {?} inputElement
  9889. * @return {?}
  9890. */
  9891. MatChipList.prototype.registerInput = /**
  9892. * Associates an HTML input element with this chip list.
  9893. * @param {?} inputElement
  9894. * @return {?}
  9895. */
  9896. function (inputElement) {
  9897. this._chipInput = inputElement;
  9898. };
  9899. /**
  9900. * Implemented as part of MatFormFieldControl.
  9901. * @docs-private
  9902. */
  9903. /**
  9904. * Implemented as part of MatFormFieldControl.
  9905. * \@docs-private
  9906. * @param {?} ids
  9907. * @return {?}
  9908. */
  9909. MatChipList.prototype.setDescribedByIds = /**
  9910. * Implemented as part of MatFormFieldControl.
  9911. * \@docs-private
  9912. * @param {?} ids
  9913. * @return {?}
  9914. */
  9915. function (ids) { this._ariaDescribedby = ids.join(' '); };
  9916. // Implemented as part of ControlValueAccessor.
  9917. // Implemented as part of ControlValueAccessor.
  9918. /**
  9919. * @param {?} value
  9920. * @return {?}
  9921. */
  9922. MatChipList.prototype.writeValue =
  9923. // Implemented as part of ControlValueAccessor.
  9924. /**
  9925. * @param {?} value
  9926. * @return {?}
  9927. */
  9928. function (value) {
  9929. if (this.chips) {
  9930. this._setSelectionByValue(value, false);
  9931. }
  9932. };
  9933. // Implemented as part of ControlValueAccessor.
  9934. // Implemented as part of ControlValueAccessor.
  9935. /**
  9936. * @param {?} fn
  9937. * @return {?}
  9938. */
  9939. MatChipList.prototype.registerOnChange =
  9940. // Implemented as part of ControlValueAccessor.
  9941. /**
  9942. * @param {?} fn
  9943. * @return {?}
  9944. */
  9945. function (fn) {
  9946. this._onChange = fn;
  9947. };
  9948. // Implemented as part of ControlValueAccessor.
  9949. // Implemented as part of ControlValueAccessor.
  9950. /**
  9951. * @param {?} fn
  9952. * @return {?}
  9953. */
  9954. MatChipList.prototype.registerOnTouched =
  9955. // Implemented as part of ControlValueAccessor.
  9956. /**
  9957. * @param {?} fn
  9958. * @return {?}
  9959. */
  9960. function (fn) {
  9961. this._onTouched = fn;
  9962. };
  9963. // Implemented as part of ControlValueAccessor.
  9964. // Implemented as part of ControlValueAccessor.
  9965. /**
  9966. * @param {?} isDisabled
  9967. * @return {?}
  9968. */
  9969. MatChipList.prototype.setDisabledState =
  9970. // Implemented as part of ControlValueAccessor.
  9971. /**
  9972. * @param {?} isDisabled
  9973. * @return {?}
  9974. */
  9975. function (isDisabled) {
  9976. this.disabled = isDisabled;
  9977. this.stateChanges.next();
  9978. };
  9979. /**
  9980. * Implemented as part of MatFormFieldControl.
  9981. * @docs-private
  9982. */
  9983. /**
  9984. * Implemented as part of MatFormFieldControl.
  9985. * \@docs-private
  9986. * @param {?} event
  9987. * @return {?}
  9988. */
  9989. MatChipList.prototype.onContainerClick = /**
  9990. * Implemented as part of MatFormFieldControl.
  9991. * \@docs-private
  9992. * @param {?} event
  9993. * @return {?}
  9994. */
  9995. function (event) {
  9996. if (!this._originatesFromChip(event)) {
  9997. this.focus();
  9998. }
  9999. };
  10000. /**
  10001. * Focuses the first non-disabled chip in this chip list, or the associated input when there
  10002. * are no eligible chips.
  10003. */
  10004. /**
  10005. * Focuses the first non-disabled chip in this chip list, or the associated input when there
  10006. * are no eligible chips.
  10007. * @param {?=} options
  10008. * @return {?}
  10009. */
  10010. MatChipList.prototype.focus = /**
  10011. * Focuses the first non-disabled chip in this chip list, or the associated input when there
  10012. * are no eligible chips.
  10013. * @param {?=} options
  10014. * @return {?}
  10015. */
  10016. function (options) {
  10017. if (this.disabled) {
  10018. return;
  10019. }
  10020. // TODO: ARIA says this should focus the first `selected` chip if any are selected.
  10021. // Focus on first element if there's no chipInput inside chip-list
  10022. if (this._chipInput && this._chipInput.focused) {
  10023. // do nothing
  10024. }
  10025. else if (this.chips.length > 0) {
  10026. this._keyManager.setFirstItemActive();
  10027. this.stateChanges.next();
  10028. }
  10029. else {
  10030. this._focusInput(options);
  10031. this.stateChanges.next();
  10032. }
  10033. };
  10034. /** Attempt to focus an input if we have one. */
  10035. /**
  10036. * Attempt to focus an input if we have one.
  10037. * @param {?=} options
  10038. * @return {?}
  10039. */
  10040. MatChipList.prototype._focusInput = /**
  10041. * Attempt to focus an input if we have one.
  10042. * @param {?=} options
  10043. * @return {?}
  10044. */
  10045. function (options) {
  10046. if (this._chipInput) {
  10047. this._chipInput.focus(options);
  10048. }
  10049. };
  10050. /**
  10051. * Pass events to the keyboard manager. Available here for tests.
  10052. */
  10053. /**
  10054. * Pass events to the keyboard manager. Available here for tests.
  10055. * @param {?} event
  10056. * @return {?}
  10057. */
  10058. MatChipList.prototype._keydown = /**
  10059. * Pass events to the keyboard manager. Available here for tests.
  10060. * @param {?} event
  10061. * @return {?}
  10062. */
  10063. function (event) {
  10064. /** @type {?} */
  10065. var target = (/** @type {?} */ (event.target));
  10066. // If they are on an empty input and hit backspace, focus the last chip
  10067. if (event.keyCode === keycodes.BACKSPACE && this._isInputEmpty(target)) {
  10068. this._keyManager.setLastItemActive();
  10069. event.preventDefault();
  10070. }
  10071. else if (target && target.classList.contains('mat-chip')) {
  10072. if (event.keyCode === keycodes.HOME) {
  10073. this._keyManager.setFirstItemActive();
  10074. event.preventDefault();
  10075. }
  10076. else if (event.keyCode === keycodes.END) {
  10077. this._keyManager.setLastItemActive();
  10078. event.preventDefault();
  10079. }
  10080. else {
  10081. this._keyManager.onKeydown(event);
  10082. }
  10083. this.stateChanges.next();
  10084. }
  10085. };
  10086. /**
  10087. * Check the tab index as you should not be allowed to focus an empty list.
  10088. */
  10089. /**
  10090. * Check the tab index as you should not be allowed to focus an empty list.
  10091. * @protected
  10092. * @return {?}
  10093. */
  10094. MatChipList.prototype._updateTabIndex = /**
  10095. * Check the tab index as you should not be allowed to focus an empty list.
  10096. * @protected
  10097. * @return {?}
  10098. */
  10099. function () {
  10100. // If we have 0 chips, we should not allow keyboard focus
  10101. this._tabIndex = this._userTabIndex || (this.chips.length === 0 ? -1 : 0);
  10102. };
  10103. /**
  10104. * If the amount of chips changed, we need to update the
  10105. * key manager state and focus the next closest chip.
  10106. */
  10107. /**
  10108. * If the amount of chips changed, we need to update the
  10109. * key manager state and focus the next closest chip.
  10110. * @protected
  10111. * @return {?}
  10112. */
  10113. MatChipList.prototype._updateFocusForDestroyedChips = /**
  10114. * If the amount of chips changed, we need to update the
  10115. * key manager state and focus the next closest chip.
  10116. * @protected
  10117. * @return {?}
  10118. */
  10119. function () {
  10120. // Move focus to the closest chip. If no other chips remain, focus the chip-list itself.
  10121. if (this._lastDestroyedChipIndex != null) {
  10122. if (this.chips.length) {
  10123. /** @type {?} */
  10124. var newChipIndex = Math.min(this._lastDestroyedChipIndex, this.chips.length - 1);
  10125. this._keyManager.setActiveItem(newChipIndex);
  10126. }
  10127. else {
  10128. this.focus();
  10129. }
  10130. }
  10131. this._lastDestroyedChipIndex = null;
  10132. };
  10133. /**
  10134. * Utility to ensure all indexes are valid.
  10135. *
  10136. * @param index The index to be checked.
  10137. * @returns True if the index is valid for our list of chips.
  10138. */
  10139. /**
  10140. * Utility to ensure all indexes are valid.
  10141. *
  10142. * @private
  10143. * @param {?} index The index to be checked.
  10144. * @return {?} True if the index is valid for our list of chips.
  10145. */
  10146. MatChipList.prototype._isValidIndex = /**
  10147. * Utility to ensure all indexes are valid.
  10148. *
  10149. * @private
  10150. * @param {?} index The index to be checked.
  10151. * @return {?} True if the index is valid for our list of chips.
  10152. */
  10153. function (index) {
  10154. return index >= 0 && index < this.chips.length;
  10155. };
  10156. /**
  10157. * @private
  10158. * @param {?} element
  10159. * @return {?}
  10160. */
  10161. MatChipList.prototype._isInputEmpty = /**
  10162. * @private
  10163. * @param {?} element
  10164. * @return {?}
  10165. */
  10166. function (element) {
  10167. if (element && element.nodeName.toLowerCase() === 'input') {
  10168. /** @type {?} */
  10169. var input = (/** @type {?} */ (element));
  10170. return !input.value;
  10171. }
  10172. return false;
  10173. };
  10174. /**
  10175. * @param {?} value
  10176. * @param {?=} isUserInput
  10177. * @return {?}
  10178. */
  10179. MatChipList.prototype._setSelectionByValue = /**
  10180. * @param {?} value
  10181. * @param {?=} isUserInput
  10182. * @return {?}
  10183. */
  10184. function (value, isUserInput) {
  10185. var _this = this;
  10186. if (isUserInput === void 0) { isUserInput = true; }
  10187. this._clearSelection();
  10188. this.chips.forEach((/**
  10189. * @param {?} chip
  10190. * @return {?}
  10191. */
  10192. function (chip) { return chip.deselect(); }));
  10193. if (Array.isArray(value)) {
  10194. value.forEach((/**
  10195. * @param {?} currentValue
  10196. * @return {?}
  10197. */
  10198. function (currentValue) { return _this._selectValue(currentValue, isUserInput); }));
  10199. this._sortValues();
  10200. }
  10201. else {
  10202. /** @type {?} */
  10203. var correspondingChip = this._selectValue(value, isUserInput);
  10204. // Shift focus to the active item. Note that we shouldn't do this in multiple
  10205. // mode, because we don't know what chip the user interacted with last.
  10206. if (correspondingChip) {
  10207. if (isUserInput) {
  10208. this._keyManager.setActiveItem(correspondingChip);
  10209. }
  10210. }
  10211. }
  10212. };
  10213. /**
  10214. * Finds and selects the chip based on its value.
  10215. * @returns Chip that has the corresponding value.
  10216. */
  10217. /**
  10218. * Finds and selects the chip based on its value.
  10219. * @private
  10220. * @param {?} value
  10221. * @param {?=} isUserInput
  10222. * @return {?} Chip that has the corresponding value.
  10223. */
  10224. MatChipList.prototype._selectValue = /**
  10225. * Finds and selects the chip based on its value.
  10226. * @private
  10227. * @param {?} value
  10228. * @param {?=} isUserInput
  10229. * @return {?} Chip that has the corresponding value.
  10230. */
  10231. function (value, isUserInput) {
  10232. var _this = this;
  10233. if (isUserInput === void 0) { isUserInput = true; }
  10234. /** @type {?} */
  10235. var correspondingChip = this.chips.find((/**
  10236. * @param {?} chip
  10237. * @return {?}
  10238. */
  10239. function (chip) {
  10240. return chip.value != null && _this._compareWith(chip.value, value);
  10241. }));
  10242. if (correspondingChip) {
  10243. isUserInput ? correspondingChip.selectViaInteraction() : correspondingChip.select();
  10244. this._selectionModel.select(correspondingChip);
  10245. }
  10246. return correspondingChip;
  10247. };
  10248. /**
  10249. * @private
  10250. * @return {?}
  10251. */
  10252. MatChipList.prototype._initializeSelection = /**
  10253. * @private
  10254. * @return {?}
  10255. */
  10256. function () {
  10257. var _this = this;
  10258. // Defer setting the value in order to avoid the "Expression
  10259. // has changed after it was checked" errors from Angular.
  10260. Promise.resolve().then((/**
  10261. * @return {?}
  10262. */
  10263. function () {
  10264. if (_this.ngControl || _this._value) {
  10265. _this._setSelectionByValue(_this.ngControl ? _this.ngControl.value : _this._value, false);
  10266. _this.stateChanges.next();
  10267. }
  10268. }));
  10269. };
  10270. /**
  10271. * Deselects every chip in the list.
  10272. * @param skip Chip that should not be deselected.
  10273. */
  10274. /**
  10275. * Deselects every chip in the list.
  10276. * @private
  10277. * @param {?=} skip Chip that should not be deselected.
  10278. * @return {?}
  10279. */
  10280. MatChipList.prototype._clearSelection = /**
  10281. * Deselects every chip in the list.
  10282. * @private
  10283. * @param {?=} skip Chip that should not be deselected.
  10284. * @return {?}
  10285. */
  10286. function (skip) {
  10287. this._selectionModel.clear();
  10288. this.chips.forEach((/**
  10289. * @param {?} chip
  10290. * @return {?}
  10291. */
  10292. function (chip) {
  10293. if (chip !== skip) {
  10294. chip.deselect();
  10295. }
  10296. }));
  10297. this.stateChanges.next();
  10298. };
  10299. /**
  10300. * Sorts the model values, ensuring that they keep the same
  10301. * order that they have in the panel.
  10302. */
  10303. /**
  10304. * Sorts the model values, ensuring that they keep the same
  10305. * order that they have in the panel.
  10306. * @private
  10307. * @return {?}
  10308. */
  10309. MatChipList.prototype._sortValues = /**
  10310. * Sorts the model values, ensuring that they keep the same
  10311. * order that they have in the panel.
  10312. * @private
  10313. * @return {?}
  10314. */
  10315. function () {
  10316. var _this = this;
  10317. if (this._multiple) {
  10318. this._selectionModel.clear();
  10319. this.chips.forEach((/**
  10320. * @param {?} chip
  10321. * @return {?}
  10322. */
  10323. function (chip) {
  10324. if (chip.selected) {
  10325. _this._selectionModel.select(chip);
  10326. }
  10327. }));
  10328. this.stateChanges.next();
  10329. }
  10330. };
  10331. /** Emits change event to set the model value. */
  10332. /**
  10333. * Emits change event to set the model value.
  10334. * @private
  10335. * @param {?=} fallbackValue
  10336. * @return {?}
  10337. */
  10338. MatChipList.prototype._propagateChanges = /**
  10339. * Emits change event to set the model value.
  10340. * @private
  10341. * @param {?=} fallbackValue
  10342. * @return {?}
  10343. */
  10344. function (fallbackValue) {
  10345. /** @type {?} */
  10346. var valueToEmit = null;
  10347. if (Array.isArray(this.selected)) {
  10348. valueToEmit = this.selected.map((/**
  10349. * @param {?} chip
  10350. * @return {?}
  10351. */
  10352. function (chip) { return chip.value; }));
  10353. }
  10354. else {
  10355. valueToEmit = this.selected ? this.selected.value : fallbackValue;
  10356. }
  10357. this._value = valueToEmit;
  10358. this.change.emit(new MatChipListChange(this, valueToEmit));
  10359. this.valueChange.emit(valueToEmit);
  10360. this._onChange(valueToEmit);
  10361. this._changeDetectorRef.markForCheck();
  10362. };
  10363. /** When blurred, mark the field as touched when focus moved outside the chip list. */
  10364. /**
  10365. * When blurred, mark the field as touched when focus moved outside the chip list.
  10366. * @return {?}
  10367. */
  10368. MatChipList.prototype._blur = /**
  10369. * When blurred, mark the field as touched when focus moved outside the chip list.
  10370. * @return {?}
  10371. */
  10372. function () {
  10373. var _this = this;
  10374. if (!this._hasFocusedChip()) {
  10375. this._keyManager.setActiveItem(-1);
  10376. }
  10377. if (!this.disabled) {
  10378. if (this._chipInput) {
  10379. // If there's a chip input, we should check whether the focus moved to chip input.
  10380. // If the focus is not moved to chip input, mark the field as touched. If the focus moved
  10381. // to chip input, do nothing.
  10382. // Timeout is needed to wait for the focus() event trigger on chip input.
  10383. setTimeout((/**
  10384. * @return {?}
  10385. */
  10386. function () {
  10387. if (!_this.focused) {
  10388. _this._markAsTouched();
  10389. }
  10390. }));
  10391. }
  10392. else {
  10393. // If there's no chip input, then mark the field as touched.
  10394. this._markAsTouched();
  10395. }
  10396. }
  10397. };
  10398. /** Mark the field as touched */
  10399. /**
  10400. * Mark the field as touched
  10401. * @return {?}
  10402. */
  10403. MatChipList.prototype._markAsTouched = /**
  10404. * Mark the field as touched
  10405. * @return {?}
  10406. */
  10407. function () {
  10408. this._onTouched();
  10409. this._changeDetectorRef.markForCheck();
  10410. this.stateChanges.next();
  10411. };
  10412. /**
  10413. * Removes the `tabindex` from the chip list and resets it back afterwards, allowing the
  10414. * user to tab out of it. This prevents the list from capturing focus and redirecting
  10415. * it back to the first chip, creating a focus trap, if it user tries to tab away.
  10416. */
  10417. /**
  10418. * Removes the `tabindex` from the chip list and resets it back afterwards, allowing the
  10419. * user to tab out of it. This prevents the list from capturing focus and redirecting
  10420. * it back to the first chip, creating a focus trap, if it user tries to tab away.
  10421. * @return {?}
  10422. */
  10423. MatChipList.prototype._allowFocusEscape = /**
  10424. * Removes the `tabindex` from the chip list and resets it back afterwards, allowing the
  10425. * user to tab out of it. This prevents the list from capturing focus and redirecting
  10426. * it back to the first chip, creating a focus trap, if it user tries to tab away.
  10427. * @return {?}
  10428. */
  10429. function () {
  10430. var _this = this;
  10431. if (this._tabIndex !== -1) {
  10432. this._tabIndex = -1;
  10433. setTimeout((/**
  10434. * @return {?}
  10435. */
  10436. function () {
  10437. _this._tabIndex = _this._userTabIndex || 0;
  10438. _this._changeDetectorRef.markForCheck();
  10439. }));
  10440. }
  10441. };
  10442. /**
  10443. * @private
  10444. * @return {?}
  10445. */
  10446. MatChipList.prototype._resetChips = /**
  10447. * @private
  10448. * @return {?}
  10449. */
  10450. function () {
  10451. this._dropSubscriptions();
  10452. this._listenToChipsFocus();
  10453. this._listenToChipsSelection();
  10454. this._listenToChipsRemoved();
  10455. };
  10456. /**
  10457. * @private
  10458. * @return {?}
  10459. */
  10460. MatChipList.prototype._dropSubscriptions = /**
  10461. * @private
  10462. * @return {?}
  10463. */
  10464. function () {
  10465. if (this._chipFocusSubscription) {
  10466. this._chipFocusSubscription.unsubscribe();
  10467. this._chipFocusSubscription = null;
  10468. }
  10469. if (this._chipBlurSubscription) {
  10470. this._chipBlurSubscription.unsubscribe();
  10471. this._chipBlurSubscription = null;
  10472. }
  10473. if (this._chipSelectionSubscription) {
  10474. this._chipSelectionSubscription.unsubscribe();
  10475. this._chipSelectionSubscription = null;
  10476. }
  10477. if (this._chipRemoveSubscription) {
  10478. this._chipRemoveSubscription.unsubscribe();
  10479. this._chipRemoveSubscription = null;
  10480. }
  10481. };
  10482. /** Listens to user-generated selection events on each chip. */
  10483. /**
  10484. * Listens to user-generated selection events on each chip.
  10485. * @private
  10486. * @return {?}
  10487. */
  10488. MatChipList.prototype._listenToChipsSelection = /**
  10489. * Listens to user-generated selection events on each chip.
  10490. * @private
  10491. * @return {?}
  10492. */
  10493. function () {
  10494. var _this = this;
  10495. this._chipSelectionSubscription = this.chipSelectionChanges.subscribe((/**
  10496. * @param {?} event
  10497. * @return {?}
  10498. */
  10499. function (event) {
  10500. event.source.selected
  10501. ? _this._selectionModel.select(event.source)
  10502. : _this._selectionModel.deselect(event.source);
  10503. // For single selection chip list, make sure the deselected value is unselected.
  10504. if (!_this.multiple) {
  10505. _this.chips.forEach((/**
  10506. * @param {?} chip
  10507. * @return {?}
  10508. */
  10509. function (chip) {
  10510. if (!_this._selectionModel.isSelected(chip) && chip.selected) {
  10511. chip.deselect();
  10512. }
  10513. }));
  10514. }
  10515. if (event.isUserInput) {
  10516. _this._propagateChanges();
  10517. }
  10518. }));
  10519. };
  10520. /** Listens to user-generated selection events on each chip. */
  10521. /**
  10522. * Listens to user-generated selection events on each chip.
  10523. * @private
  10524. * @return {?}
  10525. */
  10526. MatChipList.prototype._listenToChipsFocus = /**
  10527. * Listens to user-generated selection events on each chip.
  10528. * @private
  10529. * @return {?}
  10530. */
  10531. function () {
  10532. var _this = this;
  10533. this._chipFocusSubscription = this.chipFocusChanges.subscribe((/**
  10534. * @param {?} event
  10535. * @return {?}
  10536. */
  10537. function (event) {
  10538. /** @type {?} */
  10539. var chipIndex = _this.chips.toArray().indexOf(event.chip);
  10540. if (_this._isValidIndex(chipIndex)) {
  10541. _this._keyManager.updateActiveItemIndex(chipIndex);
  10542. }
  10543. _this.stateChanges.next();
  10544. }));
  10545. this._chipBlurSubscription = this.chipBlurChanges.subscribe((/**
  10546. * @return {?}
  10547. */
  10548. function () {
  10549. _this._blur();
  10550. _this.stateChanges.next();
  10551. }));
  10552. };
  10553. /**
  10554. * @private
  10555. * @return {?}
  10556. */
  10557. MatChipList.prototype._listenToChipsRemoved = /**
  10558. * @private
  10559. * @return {?}
  10560. */
  10561. function () {
  10562. var _this = this;
  10563. this._chipRemoveSubscription = this.chipRemoveChanges.subscribe((/**
  10564. * @param {?} event
  10565. * @return {?}
  10566. */
  10567. function (event) {
  10568. /** @type {?} */
  10569. var chip = event.chip;
  10570. /** @type {?} */
  10571. var chipIndex = _this.chips.toArray().indexOf(event.chip);
  10572. // In case the chip that will be removed is currently focused, we temporarily store
  10573. // the index in order to be able to determine an appropriate sibling chip that will
  10574. // receive focus.
  10575. if (_this._isValidIndex(chipIndex) && chip._hasFocus) {
  10576. _this._lastDestroyedChipIndex = chipIndex;
  10577. }
  10578. }));
  10579. };
  10580. /** Checks whether an event comes from inside a chip element. */
  10581. /**
  10582. * Checks whether an event comes from inside a chip element.
  10583. * @private
  10584. * @param {?} event
  10585. * @return {?}
  10586. */
  10587. MatChipList.prototype._originatesFromChip = /**
  10588. * Checks whether an event comes from inside a chip element.
  10589. * @private
  10590. * @param {?} event
  10591. * @return {?}
  10592. */
  10593. function (event) {
  10594. /** @type {?} */
  10595. var currentElement = (/** @type {?} */ (event.target));
  10596. while (currentElement && currentElement !== this._elementRef.nativeElement) {
  10597. if (currentElement.classList.contains('mat-chip')) {
  10598. return true;
  10599. }
  10600. currentElement = currentElement.parentElement;
  10601. }
  10602. return false;
  10603. };
  10604. /** Checks whether any of the chips is focused. */
  10605. /**
  10606. * Checks whether any of the chips is focused.
  10607. * @private
  10608. * @return {?}
  10609. */
  10610. MatChipList.prototype._hasFocusedChip = /**
  10611. * Checks whether any of the chips is focused.
  10612. * @private
  10613. * @return {?}
  10614. */
  10615. function () {
  10616. return this.chips.some((/**
  10617. * @param {?} chip
  10618. * @return {?}
  10619. */
  10620. function (chip) { return chip._hasFocus; }));
  10621. };
  10622. /** Syncs the list's state with the individual chips. */
  10623. /**
  10624. * Syncs the list's state with the individual chips.
  10625. * @private
  10626. * @return {?}
  10627. */
  10628. MatChipList.prototype._syncChipsState = /**
  10629. * Syncs the list's state with the individual chips.
  10630. * @private
  10631. * @return {?}
  10632. */
  10633. function () {
  10634. var _this = this;
  10635. if (this.chips) {
  10636. this.chips.forEach((/**
  10637. * @param {?} chip
  10638. * @return {?}
  10639. */
  10640. function (chip) {
  10641. chip.disabled = _this._disabled;
  10642. chip._chipListMultiple = _this.multiple;
  10643. }));
  10644. }
  10645. };
  10646. MatChipList.decorators = [
  10647. { type: core.Component, args: [{selector: 'mat-chip-list',
  10648. template: "<div class=\"mat-chip-list-wrapper\"><ng-content></ng-content></div>",
  10649. exportAs: 'matChipList',
  10650. host: {
  10651. '[attr.tabindex]': 'disabled ? null : _tabIndex',
  10652. '[attr.aria-describedby]': '_ariaDescribedby || null',
  10653. '[attr.aria-required]': 'required.toString()',
  10654. '[attr.aria-disabled]': 'disabled.toString()',
  10655. '[attr.aria-invalid]': 'errorState',
  10656. '[attr.aria-multiselectable]': 'multiple',
  10657. '[attr.role]': 'role',
  10658. '[class.mat-chip-list-disabled]': 'disabled',
  10659. '[class.mat-chip-list-invalid]': 'errorState',
  10660. '[class.mat-chip-list-required]': 'required',
  10661. '[attr.aria-orientation]': 'ariaOrientation',
  10662. 'class': 'mat-chip-list',
  10663. '(focus)': 'focus()',
  10664. '(blur)': '_blur()',
  10665. '(keydown)': '_keydown($event)',
  10666. '[id]': '_uid',
  10667. },
  10668. providers: [{ provide: MatFormFieldControl, useExisting: MatChipList }],
  10669. styles: [".mat-chip{position:relative;overflow:hidden;box-sizing:border-box;-webkit-tap-highlight-color:transparent;transform:translateZ(0)}.mat-standard-chip{transition:box-shadow 280ms cubic-bezier(.4,0,.2,1);display:inline-flex;padding:7px 12px;border-radius:16px;align-items:center;cursor:default;min-height:32px;height:1px}._mat-animation-noopable.mat-standard-chip{transition:none;animation:none}.mat-standard-chip .mat-chip-remove.mat-icon{width:18px;height:18px}.mat-standard-chip::after{top:0;left:0;right:0;bottom:0;position:absolute;border-radius:inherit;opacity:0;content:'';pointer-events:none;transition:opacity .2s cubic-bezier(.35,0,.25,1)}.mat-standard-chip:hover::after{opacity:.12}.mat-standard-chip:focus{outline:0}.mat-standard-chip:focus::after{opacity:.16}@media (-ms-high-contrast:active){.mat-standard-chip{outline:solid 1px}.mat-standard-chip:focus{outline:dotted 2px}}.mat-standard-chip.mat-chip-disabled::after{opacity:0}.mat-standard-chip.mat-chip-disabled .mat-chip-remove,.mat-standard-chip.mat-chip-disabled .mat-chip-trailing-icon{cursor:default}.mat-standard-chip.mat-chip-with-avatar,.mat-standard-chip.mat-chip-with-trailing-icon.mat-chip-with-avatar{padding-top:0;padding-bottom:0}.mat-standard-chip.mat-chip-with-trailing-icon.mat-chip-with-avatar{padding-right:8px;padding-left:0}[dir=rtl] .mat-standard-chip.mat-chip-with-trailing-icon.mat-chip-with-avatar{padding-left:8px;padding-right:0}.mat-standard-chip.mat-chip-with-trailing-icon{padding-top:7px;padding-bottom:7px;padding-right:8px;padding-left:12px}[dir=rtl] .mat-standard-chip.mat-chip-with-trailing-icon{padding-left:8px;padding-right:12px}.mat-standard-chip.mat-chip-with-avatar{padding-left:0;padding-right:12px}[dir=rtl] .mat-standard-chip.mat-chip-with-avatar{padding-right:0;padding-left:12px}.mat-standard-chip .mat-chip-avatar{width:24px;height:24px;margin-right:8px;margin-left:4px}[dir=rtl] .mat-standard-chip .mat-chip-avatar{margin-left:8px;margin-right:4px}.mat-standard-chip .mat-chip-remove,.mat-standard-chip .mat-chip-trailing-icon{width:18px;height:18px;cursor:pointer}.mat-standard-chip .mat-chip-remove,.mat-standard-chip .mat-chip-trailing-icon{margin-left:8px;margin-right:0}[dir=rtl] .mat-standard-chip .mat-chip-remove,[dir=rtl] .mat-standard-chip .mat-chip-trailing-icon{margin-right:8px;margin-left:0}.mat-chip-list-wrapper{display:flex;flex-direction:row;flex-wrap:wrap;align-items:center;margin:-4px}.mat-chip-list-wrapper .mat-standard-chip,.mat-chip-list-wrapper input.mat-input-element{margin:4px}.mat-chip-list-stacked .mat-chip-list-wrapper{flex-direction:column;align-items:flex-start}.mat-chip-list-stacked .mat-chip-list-wrapper .mat-standard-chip{width:100%}.mat-chip-avatar{border-radius:50%;justify-content:center;align-items:center;display:flex;overflow:hidden;object-fit:cover}input.mat-chip-input{width:150px;margin:4px;flex:1 0 150px}"],
  10670. encapsulation: core.ViewEncapsulation.None,
  10671. changeDetection: core.ChangeDetectionStrategy.OnPush
  10672. },] },
  10673. ];
  10674. /** @nocollapse */
  10675. MatChipList.ctorParameters = function () { return [
  10676. { type: core.ElementRef },
  10677. { type: core.ChangeDetectorRef },
  10678. { type: bidi.Directionality, decorators: [{ type: core.Optional }] },
  10679. { type: forms.NgForm, decorators: [{ type: core.Optional }] },
  10680. { type: forms.FormGroupDirective, decorators: [{ type: core.Optional }] },
  10681. { type: ErrorStateMatcher },
  10682. { type: forms.NgControl, decorators: [{ type: core.Optional }, { type: core.Self }] }
  10683. ]; };
  10684. MatChipList.propDecorators = {
  10685. errorStateMatcher: [{ type: core.Input }],
  10686. multiple: [{ type: core.Input }],
  10687. compareWith: [{ type: core.Input }],
  10688. value: [{ type: core.Input }],
  10689. required: [{ type: core.Input }],
  10690. placeholder: [{ type: core.Input }],
  10691. disabled: [{ type: core.Input }],
  10692. ariaOrientation: [{ type: core.Input, args: ['aria-orientation',] }],
  10693. selectable: [{ type: core.Input }],
  10694. tabIndex: [{ type: core.Input }],
  10695. change: [{ type: core.Output }],
  10696. valueChange: [{ type: core.Output }],
  10697. chips: [{ type: core.ContentChildren, args: [MatChip, {
  10698. // We need to use `descendants: true`, because Ivy will no longer match
  10699. // indirect descendants if it's left as false.
  10700. descendants: true
  10701. },] }]
  10702. };
  10703. return MatChipList;
  10704. }(_MatChipListMixinBase));
  10705. /**
  10706. * @fileoverview added by tsickle
  10707. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  10708. */
  10709. // Increasing integer for generating unique ids.
  10710. /** @type {?} */
  10711. var nextUniqueId$1$1 = 0;
  10712. /**
  10713. * Directive that adds chip-specific behaviors to an input element inside `<mat-form-field>`.
  10714. * May be placed inside or outside of an `<mat-chip-list>`.
  10715. */
  10716. var MatChipInput = /** @class */ (function () {
  10717. function MatChipInput(_elementRef, _defaultOptions) {
  10718. this._elementRef = _elementRef;
  10719. this._defaultOptions = _defaultOptions;
  10720. /**
  10721. * Whether the control is focused.
  10722. */
  10723. this.focused = false;
  10724. this._addOnBlur = false;
  10725. /**
  10726. * The list of key codes that will trigger a chipEnd event.
  10727. *
  10728. * Defaults to `[ENTER]`.
  10729. */
  10730. this.separatorKeyCodes = this._defaultOptions.separatorKeyCodes;
  10731. /**
  10732. * Emitted when a chip is to be added.
  10733. */
  10734. this.chipEnd = new core.EventEmitter();
  10735. /**
  10736. * The input's placeholder text.
  10737. */
  10738. this.placeholder = '';
  10739. /**
  10740. * Unique id for the input.
  10741. */
  10742. this.id = "mat-chip-list-input-" + nextUniqueId$1$1++;
  10743. this._disabled = false;
  10744. this._inputElement = (/** @type {?} */ (this._elementRef.nativeElement));
  10745. }
  10746. Object.defineProperty(MatChipInput.prototype, "chipList", {
  10747. /** Register input for chip list */
  10748. set: /**
  10749. * Register input for chip list
  10750. * @param {?} value
  10751. * @return {?}
  10752. */
  10753. function (value) {
  10754. if (value) {
  10755. this._chipList = value;
  10756. this._chipList.registerInput(this);
  10757. }
  10758. },
  10759. enumerable: true,
  10760. configurable: true
  10761. });
  10762. Object.defineProperty(MatChipInput.prototype, "addOnBlur", {
  10763. /**
  10764. * Whether or not the chipEnd event will be emitted when the input is blurred.
  10765. */
  10766. get: /**
  10767. * Whether or not the chipEnd event will be emitted when the input is blurred.
  10768. * @return {?}
  10769. */
  10770. function () { return this._addOnBlur; },
  10771. set: /**
  10772. * @param {?} value
  10773. * @return {?}
  10774. */
  10775. function (value) { this._addOnBlur = coercion.coerceBooleanProperty(value); },
  10776. enumerable: true,
  10777. configurable: true
  10778. });
  10779. Object.defineProperty(MatChipInput.prototype, "disabled", {
  10780. /** Whether the input is disabled. */
  10781. get: /**
  10782. * Whether the input is disabled.
  10783. * @return {?}
  10784. */
  10785. function () { return this._disabled || (this._chipList && this._chipList.disabled); },
  10786. set: /**
  10787. * @param {?} value
  10788. * @return {?}
  10789. */
  10790. function (value) { this._disabled = coercion.coerceBooleanProperty(value); },
  10791. enumerable: true,
  10792. configurable: true
  10793. });
  10794. Object.defineProperty(MatChipInput.prototype, "empty", {
  10795. /** Whether the input is empty. */
  10796. get: /**
  10797. * Whether the input is empty.
  10798. * @return {?}
  10799. */
  10800. function () { return !this._inputElement.value; },
  10801. enumerable: true,
  10802. configurable: true
  10803. });
  10804. /**
  10805. * @return {?}
  10806. */
  10807. MatChipInput.prototype.ngOnChanges = /**
  10808. * @return {?}
  10809. */
  10810. function () {
  10811. this._chipList.stateChanges.next();
  10812. };
  10813. /** Utility method to make host definition/tests more clear. */
  10814. /**
  10815. * Utility method to make host definition/tests more clear.
  10816. * @param {?=} event
  10817. * @return {?}
  10818. */
  10819. MatChipInput.prototype._keydown = /**
  10820. * Utility method to make host definition/tests more clear.
  10821. * @param {?=} event
  10822. * @return {?}
  10823. */
  10824. function (event) {
  10825. // Allow the user's focus to escape when they're tabbing forward. Note that we don't
  10826. // want to do this when going backwards, because focus should go back to the first chip.
  10827. if (event && event.keyCode === keycodes.TAB && !keycodes.hasModifierKey(event, 'shiftKey')) {
  10828. this._chipList._allowFocusEscape();
  10829. }
  10830. this._emitChipEnd(event);
  10831. };
  10832. /** Checks to see if the blur should emit the (chipEnd) event. */
  10833. /**
  10834. * Checks to see if the blur should emit the (chipEnd) event.
  10835. * @return {?}
  10836. */
  10837. MatChipInput.prototype._blur = /**
  10838. * Checks to see if the blur should emit the (chipEnd) event.
  10839. * @return {?}
  10840. */
  10841. function () {
  10842. if (this.addOnBlur) {
  10843. this._emitChipEnd();
  10844. }
  10845. this.focused = false;
  10846. // Blur the chip list if it is not focused
  10847. if (!this._chipList.focused) {
  10848. this._chipList._blur();
  10849. }
  10850. this._chipList.stateChanges.next();
  10851. };
  10852. /**
  10853. * @return {?}
  10854. */
  10855. MatChipInput.prototype._focus = /**
  10856. * @return {?}
  10857. */
  10858. function () {
  10859. this.focused = true;
  10860. this._chipList.stateChanges.next();
  10861. };
  10862. /** Checks to see if the (chipEnd) event needs to be emitted. */
  10863. /**
  10864. * Checks to see if the (chipEnd) event needs to be emitted.
  10865. * @param {?=} event
  10866. * @return {?}
  10867. */
  10868. MatChipInput.prototype._emitChipEnd = /**
  10869. * Checks to see if the (chipEnd) event needs to be emitted.
  10870. * @param {?=} event
  10871. * @return {?}
  10872. */
  10873. function (event) {
  10874. if (!this._inputElement.value && !!event) {
  10875. this._chipList._keydown(event);
  10876. }
  10877. if (!event || this._isSeparatorKey(event)) {
  10878. this.chipEnd.emit({ input: this._inputElement, value: this._inputElement.value });
  10879. if (event) {
  10880. event.preventDefault();
  10881. }
  10882. }
  10883. };
  10884. /**
  10885. * @return {?}
  10886. */
  10887. MatChipInput.prototype._onInput = /**
  10888. * @return {?}
  10889. */
  10890. function () {
  10891. // Let chip list know whenever the value changes.
  10892. this._chipList.stateChanges.next();
  10893. };
  10894. /** Focuses the input. */
  10895. /**
  10896. * Focuses the input.
  10897. * @param {?=} options
  10898. * @return {?}
  10899. */
  10900. MatChipInput.prototype.focus = /**
  10901. * Focuses the input.
  10902. * @param {?=} options
  10903. * @return {?}
  10904. */
  10905. function (options) {
  10906. this._inputElement.focus(options);
  10907. };
  10908. /** Checks whether a keycode is one of the configured separators. */
  10909. /**
  10910. * Checks whether a keycode is one of the configured separators.
  10911. * @private
  10912. * @param {?} event
  10913. * @return {?}
  10914. */
  10915. MatChipInput.prototype._isSeparatorKey = /**
  10916. * Checks whether a keycode is one of the configured separators.
  10917. * @private
  10918. * @param {?} event
  10919. * @return {?}
  10920. */
  10921. function (event) {
  10922. if (keycodes.hasModifierKey(event)) {
  10923. return false;
  10924. }
  10925. /** @type {?} */
  10926. var separators = this.separatorKeyCodes;
  10927. /** @type {?} */
  10928. var keyCode = event.keyCode;
  10929. return Array.isArray(separators) ? separators.indexOf(keyCode) > -1 : separators.has(keyCode);
  10930. };
  10931. MatChipInput.decorators = [
  10932. { type: core.Directive, args: [{
  10933. selector: 'input[matChipInputFor]',
  10934. exportAs: 'matChipInput, matChipInputFor',
  10935. host: {
  10936. 'class': 'mat-chip-input mat-input-element',
  10937. '(keydown)': '_keydown($event)',
  10938. '(blur)': '_blur()',
  10939. '(focus)': '_focus()',
  10940. '(input)': '_onInput()',
  10941. '[id]': 'id',
  10942. '[attr.disabled]': 'disabled || null',
  10943. '[attr.placeholder]': 'placeholder || null',
  10944. '[attr.aria-invalid]': '_chipList && _chipList.ngControl ? _chipList.ngControl.invalid : null',
  10945. }
  10946. },] },
  10947. ];
  10948. /** @nocollapse */
  10949. MatChipInput.ctorParameters = function () { return [
  10950. { type: core.ElementRef },
  10951. { type: undefined, decorators: [{ type: core.Inject, args: [MAT_CHIPS_DEFAULT_OPTIONS,] }] }
  10952. ]; };
  10953. MatChipInput.propDecorators = {
  10954. chipList: [{ type: core.Input, args: ['matChipInputFor',] }],
  10955. addOnBlur: [{ type: core.Input, args: ['matChipInputAddOnBlur',] }],
  10956. separatorKeyCodes: [{ type: core.Input, args: ['matChipInputSeparatorKeyCodes',] }],
  10957. chipEnd: [{ type: core.Output, args: ['matChipInputTokenEnd',] }],
  10958. placeholder: [{ type: core.Input }],
  10959. id: [{ type: core.Input }],
  10960. disabled: [{ type: core.Input }]
  10961. };
  10962. return MatChipInput;
  10963. }());
  10964. /**
  10965. * @fileoverview added by tsickle
  10966. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  10967. */
  10968. /** @type {?} */
  10969. var CHIP_DECLARATIONS = [
  10970. MatChipList,
  10971. MatChip,
  10972. MatChipInput,
  10973. MatChipRemove,
  10974. MatChipAvatar,
  10975. MatChipTrailingIcon,
  10976. ];
  10977. var ɵ0$3 = ({
  10978. separatorKeyCodes: [keycodes.ENTER]
  10979. });
  10980. var MatChipsModule = /** @class */ (function () {
  10981. function MatChipsModule() {
  10982. }
  10983. MatChipsModule.decorators = [
  10984. { type: core.NgModule, args: [{
  10985. exports: CHIP_DECLARATIONS,
  10986. declarations: CHIP_DECLARATIONS,
  10987. providers: [
  10988. ErrorStateMatcher,
  10989. {
  10990. provide: MAT_CHIPS_DEFAULT_OPTIONS,
  10991. useValue: (/** @type {?} */ (ɵ0$3))
  10992. }
  10993. ]
  10994. },] },
  10995. ];
  10996. return MatChipsModule;
  10997. }());
  10998. /**
  10999. * @fileoverview added by tsickle
  11000. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  11001. */
  11002. /**
  11003. * Configuration for opening a modal dialog with the MatDialog service.
  11004. * @template D
  11005. */
  11006. var /**
  11007. * Configuration for opening a modal dialog with the MatDialog service.
  11008. * @template D
  11009. */
  11010. MatDialogConfig = /** @class */ (function () {
  11011. function MatDialogConfig() {
  11012. /**
  11013. * The ARIA role of the dialog element.
  11014. */
  11015. this.role = 'dialog';
  11016. /**
  11017. * Custom class for the overlay pane.
  11018. */
  11019. this.panelClass = '';
  11020. /**
  11021. * Whether the dialog has a backdrop.
  11022. */
  11023. this.hasBackdrop = true;
  11024. /**
  11025. * Custom class for the backdrop,
  11026. */
  11027. this.backdropClass = '';
  11028. /**
  11029. * Whether the user can use escape or clicking on the backdrop to close the modal.
  11030. */
  11031. this.disableClose = false;
  11032. /**
  11033. * Width of the dialog.
  11034. */
  11035. this.width = '';
  11036. /**
  11037. * Height of the dialog.
  11038. */
  11039. this.height = '';
  11040. /**
  11041. * Max-width of the dialog. If a number is provided, pixel units are assumed. Defaults to 80vw
  11042. */
  11043. this.maxWidth = '80vw';
  11044. /**
  11045. * Data being injected into the child component.
  11046. */
  11047. this.data = null;
  11048. /**
  11049. * ID of the element that describes the dialog.
  11050. */
  11051. this.ariaDescribedBy = null;
  11052. /**
  11053. * ID of the element that labels the dialog.
  11054. */
  11055. this.ariaLabelledBy = null;
  11056. /**
  11057. * Aria label to assign to the dialog element
  11058. */
  11059. this.ariaLabel = null;
  11060. /**
  11061. * Whether the dialog should focus the first focusable element on open.
  11062. */
  11063. this.autoFocus = true;
  11064. /**
  11065. * Whether the dialog should restore focus to the
  11066. * previously-focused element, after it's closed.
  11067. */
  11068. this.restoreFocus = true;
  11069. /**
  11070. * Whether the dialog should close when the user goes backwards/forwards in history.
  11071. * Note that this usually doesn't include clicking on links (unless the user is using
  11072. * the `HashLocationStrategy`).
  11073. */
  11074. this.closeOnNavigation = true;
  11075. // TODO(jelbourn): add configuration for lifecycle hooks, ARIA labelling.
  11076. }
  11077. return MatDialogConfig;
  11078. }());
  11079. /**
  11080. * @fileoverview added by tsickle
  11081. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  11082. */
  11083. /** @type {?} */
  11084. var animationBody = [
  11085. // Note: The `enter` animation transitions to `transform: none`, because for some reason
  11086. // specifying the transform explicitly, causes IE both to blur the dialog content and
  11087. // decimate the animation performance. Leaving it as `none` solves both issues.
  11088. animations$1.state('void, exit', animations$1.style({ opacity: 0, transform: 'scale(0.7)' })),
  11089. animations$1.state('enter', animations$1.style({ transform: 'none' })),
  11090. animations$1.transition('* => enter', animations$1.animate('150ms cubic-bezier(0, 0, 0.2, 1)', animations$1.style({ transform: 'none', opacity: 1 }))),
  11091. animations$1.transition('* => void, * => exit', animations$1.animate('75ms cubic-bezier(0.4, 0.0, 0.2, 1)', animations$1.style({ opacity: 0 }))),
  11092. ];
  11093. /**
  11094. * Animations used by MatDialog.
  11095. * \@docs-private
  11096. * @type {?}
  11097. */
  11098. var matDialogAnimations = {
  11099. /**
  11100. * Animation that is applied on the dialog container by defalt.
  11101. */
  11102. dialogContainer: animations$1.trigger('dialogContainer', animationBody),
  11103. /**
  11104. * @deprecated \@breaking-change 8.0.0 Use `matDialogAnimations.dialogContainer` instead.
  11105. */
  11106. slideDialog: animations$1.trigger('slideDialog', animationBody)
  11107. };
  11108. /**
  11109. * @fileoverview added by tsickle
  11110. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  11111. */
  11112. /**
  11113. * Throws an exception for the case when a ComponentPortal is
  11114. * attached to a DomPortalOutlet without an origin.
  11115. * \@docs-private
  11116. * @return {?}
  11117. */
  11118. function throwMatDialogContentAlreadyAttachedError() {
  11119. throw Error('Attempting to attach dialog content after content is already attached');
  11120. }
  11121. /**
  11122. * Internal component that wraps user-provided dialog content.
  11123. * Animation is based on https://material.io/guidelines/motion/choreography.html.
  11124. * \@docs-private
  11125. */
  11126. var MatDialogContainer = /** @class */ (function (_super) {
  11127. __extends(MatDialogContainer, _super);
  11128. function MatDialogContainer(_elementRef, _focusTrapFactory, _changeDetectorRef, _document, _config) {
  11129. var _this = _super.call(this) || this;
  11130. _this._elementRef = _elementRef;
  11131. _this._focusTrapFactory = _focusTrapFactory;
  11132. _this._changeDetectorRef = _changeDetectorRef;
  11133. _this._document = _document;
  11134. _this._config = _config;
  11135. /**
  11136. * Element that was focused before the dialog was opened. Save this to restore upon close.
  11137. */
  11138. _this._elementFocusedBeforeDialogWasOpened = null;
  11139. /**
  11140. * State of the dialog animation.
  11141. */
  11142. _this._state = 'enter';
  11143. /**
  11144. * Emits when an animation state changes.
  11145. */
  11146. _this._animationStateChanged = new core.EventEmitter();
  11147. _this._ariaLabelledBy = _config.ariaLabelledBy || null;
  11148. return _this;
  11149. }
  11150. /**
  11151. * Attach a ComponentPortal as content to this dialog container.
  11152. * @param portal Portal to be attached as the dialog content.
  11153. */
  11154. /**
  11155. * Attach a ComponentPortal as content to this dialog container.
  11156. * @template T
  11157. * @param {?} portal Portal to be attached as the dialog content.
  11158. * @return {?}
  11159. */
  11160. MatDialogContainer.prototype.attachComponentPortal = /**
  11161. * Attach a ComponentPortal as content to this dialog container.
  11162. * @template T
  11163. * @param {?} portal Portal to be attached as the dialog content.
  11164. * @return {?}
  11165. */
  11166. function (portal$$1) {
  11167. if (this._portalOutlet.hasAttached()) {
  11168. throwMatDialogContentAlreadyAttachedError();
  11169. }
  11170. this._savePreviouslyFocusedElement();
  11171. return this._portalOutlet.attachComponentPortal(portal$$1);
  11172. };
  11173. /**
  11174. * Attach a TemplatePortal as content to this dialog container.
  11175. * @param portal Portal to be attached as the dialog content.
  11176. */
  11177. /**
  11178. * Attach a TemplatePortal as content to this dialog container.
  11179. * @template C
  11180. * @param {?} portal Portal to be attached as the dialog content.
  11181. * @return {?}
  11182. */
  11183. MatDialogContainer.prototype.attachTemplatePortal = /**
  11184. * Attach a TemplatePortal as content to this dialog container.
  11185. * @template C
  11186. * @param {?} portal Portal to be attached as the dialog content.
  11187. * @return {?}
  11188. */
  11189. function (portal$$1) {
  11190. if (this._portalOutlet.hasAttached()) {
  11191. throwMatDialogContentAlreadyAttachedError();
  11192. }
  11193. this._savePreviouslyFocusedElement();
  11194. return this._portalOutlet.attachTemplatePortal(portal$$1);
  11195. };
  11196. /** Moves the focus inside the focus trap. */
  11197. /**
  11198. * Moves the focus inside the focus trap.
  11199. * @private
  11200. * @return {?}
  11201. */
  11202. MatDialogContainer.prototype._trapFocus = /**
  11203. * Moves the focus inside the focus trap.
  11204. * @private
  11205. * @return {?}
  11206. */
  11207. function () {
  11208. /** @type {?} */
  11209. var element = this._elementRef.nativeElement;
  11210. if (!this._focusTrap) {
  11211. this._focusTrap = this._focusTrapFactory.create(element);
  11212. }
  11213. // If we were to attempt to focus immediately, then the content of the dialog would not yet be
  11214. // ready in instances where change detection has to run first. To deal with this, we simply
  11215. // wait for the microtask queue to be empty.
  11216. if (this._config.autoFocus) {
  11217. this._focusTrap.focusInitialElementWhenReady();
  11218. }
  11219. else {
  11220. /** @type {?} */
  11221. var activeElement = this._document.activeElement;
  11222. // Otherwise ensure that focus is on the dialog container. It's possible that a different
  11223. // component tried to move focus while the open animation was running. See:
  11224. // https://github.com/angular/components/issues/16215. Note that we only want to do this
  11225. // if the focus isn't inside the dialog already, because it's possible that the consumer
  11226. // turned off `autoFocus` in order to move focus themselves.
  11227. if (activeElement !== element && !element.contains(activeElement)) {
  11228. element.focus();
  11229. }
  11230. }
  11231. };
  11232. /** Restores focus to the element that was focused before the dialog opened. */
  11233. /**
  11234. * Restores focus to the element that was focused before the dialog opened.
  11235. * @private
  11236. * @return {?}
  11237. */
  11238. MatDialogContainer.prototype._restoreFocus = /**
  11239. * Restores focus to the element that was focused before the dialog opened.
  11240. * @private
  11241. * @return {?}
  11242. */
  11243. function () {
  11244. /** @type {?} */
  11245. var toFocus = this._elementFocusedBeforeDialogWasOpened;
  11246. // We need the extra check, because IE can set the `activeElement` to null in some cases.
  11247. if (this._config.restoreFocus && toFocus && typeof toFocus.focus === 'function') {
  11248. toFocus.focus();
  11249. }
  11250. if (this._focusTrap) {
  11251. this._focusTrap.destroy();
  11252. }
  11253. };
  11254. /** Saves a reference to the element that was focused before the dialog was opened. */
  11255. /**
  11256. * Saves a reference to the element that was focused before the dialog was opened.
  11257. * @private
  11258. * @return {?}
  11259. */
  11260. MatDialogContainer.prototype._savePreviouslyFocusedElement = /**
  11261. * Saves a reference to the element that was focused before the dialog was opened.
  11262. * @private
  11263. * @return {?}
  11264. */
  11265. function () {
  11266. var _this = this;
  11267. if (this._document) {
  11268. this._elementFocusedBeforeDialogWasOpened = (/** @type {?} */ (this._document.activeElement));
  11269. // Note that there is no focus method when rendering on the server.
  11270. if (this._elementRef.nativeElement.focus) {
  11271. // Move focus onto the dialog immediately in order to prevent the user from accidentally
  11272. // opening multiple dialogs at the same time. Needs to be async, because the element
  11273. // may not be focusable immediately.
  11274. Promise.resolve().then((/**
  11275. * @return {?}
  11276. */
  11277. function () { return _this._elementRef.nativeElement.focus(); }));
  11278. }
  11279. }
  11280. };
  11281. /** Callback, invoked whenever an animation on the host completes. */
  11282. /**
  11283. * Callback, invoked whenever an animation on the host completes.
  11284. * @param {?} event
  11285. * @return {?}
  11286. */
  11287. MatDialogContainer.prototype._onAnimationDone = /**
  11288. * Callback, invoked whenever an animation on the host completes.
  11289. * @param {?} event
  11290. * @return {?}
  11291. */
  11292. function (event) {
  11293. if (event.toState === 'enter') {
  11294. this._trapFocus();
  11295. }
  11296. else if (event.toState === 'exit') {
  11297. this._restoreFocus();
  11298. }
  11299. this._animationStateChanged.emit(event);
  11300. };
  11301. /** Callback, invoked when an animation on the host starts. */
  11302. /**
  11303. * Callback, invoked when an animation on the host starts.
  11304. * @param {?} event
  11305. * @return {?}
  11306. */
  11307. MatDialogContainer.prototype._onAnimationStart = /**
  11308. * Callback, invoked when an animation on the host starts.
  11309. * @param {?} event
  11310. * @return {?}
  11311. */
  11312. function (event) {
  11313. this._animationStateChanged.emit(event);
  11314. };
  11315. /** Starts the dialog exit animation. */
  11316. /**
  11317. * Starts the dialog exit animation.
  11318. * @return {?}
  11319. */
  11320. MatDialogContainer.prototype._startExitAnimation = /**
  11321. * Starts the dialog exit animation.
  11322. * @return {?}
  11323. */
  11324. function () {
  11325. this._state = 'exit';
  11326. // Mark the container for check so it can react if the
  11327. // view container is using OnPush change detection.
  11328. this._changeDetectorRef.markForCheck();
  11329. };
  11330. MatDialogContainer.decorators = [
  11331. { type: core.Component, args: [{selector: 'mat-dialog-container',
  11332. template: "<ng-template cdkPortalOutlet></ng-template>",
  11333. styles: [".mat-dialog-container{display:block;padding:24px;border-radius:4px;box-sizing:border-box;overflow:auto;outline:0;width:100%;height:100%;min-height:inherit;max-height:inherit}@media (-ms-high-contrast:active){.mat-dialog-container{outline:solid 1px}}.mat-dialog-content{display:block;margin:0 -24px;padding:0 24px;max-height:65vh;overflow:auto;-webkit-overflow-scrolling:touch}.mat-dialog-title{margin:0 0 20px;display:block}.mat-dialog-actions{padding:8px 0;display:flex;flex-wrap:wrap;min-height:52px;align-items:center;margin-bottom:-24px}.mat-dialog-actions[align=end]{justify-content:flex-end}.mat-dialog-actions[align=center]{justify-content:center}.mat-dialog-actions .mat-button-base+.mat-button-base{margin-left:8px}[dir=rtl] .mat-dialog-actions .mat-button-base+.mat-button-base{margin-left:0;margin-right:8px}"],
  11334. encapsulation: core.ViewEncapsulation.None,
  11335. // Using OnPush for dialogs caused some G3 sync issues. Disabled until we can track them down.
  11336. // tslint:disable-next-line:validate-decorators
  11337. changeDetection: core.ChangeDetectionStrategy.Default,
  11338. animations: [matDialogAnimations.dialogContainer],
  11339. host: {
  11340. 'class': 'mat-dialog-container',
  11341. 'tabindex': '-1',
  11342. 'aria-modal': 'true',
  11343. '[attr.id]': '_id',
  11344. '[attr.role]': '_config.role',
  11345. '[attr.aria-labelledby]': '_config.ariaLabel ? null : _ariaLabelledBy',
  11346. '[attr.aria-label]': '_config.ariaLabel',
  11347. '[attr.aria-describedby]': '_config.ariaDescribedBy || null',
  11348. '[@dialogContainer]': '_state',
  11349. '(@dialogContainer.start)': '_onAnimationStart($event)',
  11350. '(@dialogContainer.done)': '_onAnimationDone($event)',
  11351. },
  11352. },] },
  11353. ];
  11354. /** @nocollapse */
  11355. MatDialogContainer.ctorParameters = function () { return [
  11356. { type: core.ElementRef },
  11357. { type: a11y.FocusTrapFactory },
  11358. { type: core.ChangeDetectorRef },
  11359. { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [common.DOCUMENT,] }] },
  11360. { type: MatDialogConfig }
  11361. ]; };
  11362. MatDialogContainer.propDecorators = {
  11363. _portalOutlet: [{ type: core.ViewChild, args: [portal.CdkPortalOutlet, { static: true },] }]
  11364. };
  11365. return MatDialogContainer;
  11366. }(portal.BasePortalOutlet));
  11367. /**
  11368. * @fileoverview added by tsickle
  11369. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  11370. */
  11371. // TODO(jelbourn): resizing
  11372. // Counter for unique dialog ids.
  11373. /** @type {?} */
  11374. var uniqueId = 0;
  11375. /**
  11376. * Reference to a dialog opened via the MatDialog service.
  11377. * @template T, R
  11378. */
  11379. var /**
  11380. * Reference to a dialog opened via the MatDialog service.
  11381. * @template T, R
  11382. */
  11383. MatDialogRef = /** @class */ (function () {
  11384. function MatDialogRef(_overlayRef, _containerInstance,
  11385. // @breaking-change 8.0.0 `_location` parameter to be removed.
  11386. _location, id) {
  11387. var _this = this;
  11388. if (id === void 0) { id = "mat-dialog-" + uniqueId++; }
  11389. this._overlayRef = _overlayRef;
  11390. this._containerInstance = _containerInstance;
  11391. this.id = id;
  11392. /**
  11393. * Whether the user is allowed to close the dialog.
  11394. */
  11395. this.disableClose = this._containerInstance._config.disableClose;
  11396. /**
  11397. * Subject for notifying the user that the dialog has finished opening.
  11398. */
  11399. this._afterOpened = new rxjs.Subject();
  11400. /**
  11401. * Subject for notifying the user that the dialog has finished closing.
  11402. */
  11403. this._afterClosed = new rxjs.Subject();
  11404. /**
  11405. * Subject for notifying the user that the dialog has started closing.
  11406. */
  11407. this._beforeClosed = new rxjs.Subject();
  11408. // Pass the id along to the container.
  11409. _containerInstance._id = id;
  11410. // Emit when opening animation completes
  11411. _containerInstance._animationStateChanged.pipe(operators.filter((/**
  11412. * @param {?} event
  11413. * @return {?}
  11414. */
  11415. function (event) { return event.phaseName === 'done' && event.toState === 'enter'; })), operators.take(1))
  11416. .subscribe((/**
  11417. * @return {?}
  11418. */
  11419. function () {
  11420. _this._afterOpened.next();
  11421. _this._afterOpened.complete();
  11422. }));
  11423. // Dispose overlay when closing animation is complete
  11424. _containerInstance._animationStateChanged.pipe(operators.filter((/**
  11425. * @param {?} event
  11426. * @return {?}
  11427. */
  11428. function (event) { return event.phaseName === 'done' && event.toState === 'exit'; })), operators.take(1)).subscribe((/**
  11429. * @return {?}
  11430. */
  11431. function () {
  11432. clearTimeout(_this._closeFallbackTimeout);
  11433. _this._overlayRef.dispose();
  11434. }));
  11435. _overlayRef.detachments().subscribe((/**
  11436. * @return {?}
  11437. */
  11438. function () {
  11439. _this._beforeClosed.next(_this._result);
  11440. _this._beforeClosed.complete();
  11441. _this._afterClosed.next(_this._result);
  11442. _this._afterClosed.complete();
  11443. _this.componentInstance = (/** @type {?} */ (null));
  11444. _this._overlayRef.dispose();
  11445. }));
  11446. _overlayRef.keydownEvents()
  11447. .pipe(operators.filter((/**
  11448. * @param {?} event
  11449. * @return {?}
  11450. */
  11451. function (event) {
  11452. return event.keyCode === keycodes.ESCAPE && !_this.disableClose && !keycodes.hasModifierKey(event);
  11453. })))
  11454. .subscribe((/**
  11455. * @param {?} event
  11456. * @return {?}
  11457. */
  11458. function (event) {
  11459. event.preventDefault();
  11460. _this.close();
  11461. }));
  11462. }
  11463. /**
  11464. * Close the dialog.
  11465. * @param dialogResult Optional result to return to the dialog opener.
  11466. */
  11467. /**
  11468. * Close the dialog.
  11469. * @param {?=} dialogResult Optional result to return to the dialog opener.
  11470. * @return {?}
  11471. */
  11472. MatDialogRef.prototype.close = /**
  11473. * Close the dialog.
  11474. * @param {?=} dialogResult Optional result to return to the dialog opener.
  11475. * @return {?}
  11476. */
  11477. function (dialogResult) {
  11478. var _this = this;
  11479. this._result = dialogResult;
  11480. // Transition the backdrop in parallel to the dialog.
  11481. this._containerInstance._animationStateChanged.pipe(operators.filter((/**
  11482. * @param {?} event
  11483. * @return {?}
  11484. */
  11485. function (event) { return event.phaseName === 'start'; })), operators.take(1))
  11486. .subscribe((/**
  11487. * @param {?} event
  11488. * @return {?}
  11489. */
  11490. function (event) {
  11491. _this._beforeClosed.next(dialogResult);
  11492. _this._beforeClosed.complete();
  11493. _this._overlayRef.detachBackdrop();
  11494. // The logic that disposes of the overlay depends on the exit animation completing, however
  11495. // it isn't guaranteed if the parent view is destroyed while it's running. Add a fallback
  11496. // timeout which will clean everything up if the animation hasn't fired within the specified
  11497. // amount of time plus 100ms. We don't need to run this outside the NgZone, because for the
  11498. // vast majority of cases the timeout will have been cleared before it has the chance to fire.
  11499. _this._closeFallbackTimeout = setTimeout((/**
  11500. * @return {?}
  11501. */
  11502. function () {
  11503. _this._overlayRef.dispose();
  11504. }), event.totalTime + 100);
  11505. }));
  11506. this._containerInstance._startExitAnimation();
  11507. };
  11508. /**
  11509. * Gets an observable that is notified when the dialog is finished opening.
  11510. */
  11511. /**
  11512. * Gets an observable that is notified when the dialog is finished opening.
  11513. * @return {?}
  11514. */
  11515. MatDialogRef.prototype.afterOpened = /**
  11516. * Gets an observable that is notified when the dialog is finished opening.
  11517. * @return {?}
  11518. */
  11519. function () {
  11520. return this._afterOpened.asObservable();
  11521. };
  11522. /**
  11523. * Gets an observable that is notified when the dialog is finished closing.
  11524. */
  11525. /**
  11526. * Gets an observable that is notified when the dialog is finished closing.
  11527. * @return {?}
  11528. */
  11529. MatDialogRef.prototype.afterClosed = /**
  11530. * Gets an observable that is notified when the dialog is finished closing.
  11531. * @return {?}
  11532. */
  11533. function () {
  11534. return this._afterClosed.asObservable();
  11535. };
  11536. /**
  11537. * Gets an observable that is notified when the dialog has started closing.
  11538. */
  11539. /**
  11540. * Gets an observable that is notified when the dialog has started closing.
  11541. * @return {?}
  11542. */
  11543. MatDialogRef.prototype.beforeClosed = /**
  11544. * Gets an observable that is notified when the dialog has started closing.
  11545. * @return {?}
  11546. */
  11547. function () {
  11548. return this._beforeClosed.asObservable();
  11549. };
  11550. /**
  11551. * Gets an observable that emits when the overlay's backdrop has been clicked.
  11552. */
  11553. /**
  11554. * Gets an observable that emits when the overlay's backdrop has been clicked.
  11555. * @return {?}
  11556. */
  11557. MatDialogRef.prototype.backdropClick = /**
  11558. * Gets an observable that emits when the overlay's backdrop has been clicked.
  11559. * @return {?}
  11560. */
  11561. function () {
  11562. return this._overlayRef.backdropClick();
  11563. };
  11564. /**
  11565. * Gets an observable that emits when keydown events are targeted on the overlay.
  11566. */
  11567. /**
  11568. * Gets an observable that emits when keydown events are targeted on the overlay.
  11569. * @return {?}
  11570. */
  11571. MatDialogRef.prototype.keydownEvents = /**
  11572. * Gets an observable that emits when keydown events are targeted on the overlay.
  11573. * @return {?}
  11574. */
  11575. function () {
  11576. return this._overlayRef.keydownEvents();
  11577. };
  11578. /**
  11579. * Updates the dialog's position.
  11580. * @param position New dialog position.
  11581. */
  11582. /**
  11583. * Updates the dialog's position.
  11584. * @template THIS
  11585. * @this {THIS}
  11586. * @param {?=} position New dialog position.
  11587. * @return {THIS}
  11588. */
  11589. MatDialogRef.prototype.updatePosition = /**
  11590. * Updates the dialog's position.
  11591. * @template THIS
  11592. * @this {THIS}
  11593. * @param {?=} position New dialog position.
  11594. * @return {THIS}
  11595. */
  11596. function (position) {
  11597. /** @type {?} */
  11598. var strategy = (/** @type {?} */ (this))._getPositionStrategy();
  11599. if (position && (position.left || position.right)) {
  11600. position.left ? strategy.left(position.left) : strategy.right(position.right);
  11601. }
  11602. else {
  11603. strategy.centerHorizontally();
  11604. }
  11605. if (position && (position.top || position.bottom)) {
  11606. position.top ? strategy.top(position.top) : strategy.bottom(position.bottom);
  11607. }
  11608. else {
  11609. strategy.centerVertically();
  11610. }
  11611. (/** @type {?} */ (this))._overlayRef.updatePosition();
  11612. return (/** @type {?} */ (this));
  11613. };
  11614. /**
  11615. * Updates the dialog's width and height.
  11616. * @param width New width of the dialog.
  11617. * @param height New height of the dialog.
  11618. */
  11619. /**
  11620. * Updates the dialog's width and height.
  11621. * @template THIS
  11622. * @this {THIS}
  11623. * @param {?=} width New width of the dialog.
  11624. * @param {?=} height New height of the dialog.
  11625. * @return {THIS}
  11626. */
  11627. MatDialogRef.prototype.updateSize = /**
  11628. * Updates the dialog's width and height.
  11629. * @template THIS
  11630. * @this {THIS}
  11631. * @param {?=} width New width of the dialog.
  11632. * @param {?=} height New height of the dialog.
  11633. * @return {THIS}
  11634. */
  11635. function (width, height) {
  11636. if (width === void 0) { width = ''; }
  11637. if (height === void 0) { height = ''; }
  11638. (/** @type {?} */ (this))._getPositionStrategy().width(width).height(height);
  11639. (/** @type {?} */ (this))._overlayRef.updatePosition();
  11640. return (/** @type {?} */ (this));
  11641. };
  11642. /** Add a CSS class or an array of classes to the overlay pane. */
  11643. /**
  11644. * Add a CSS class or an array of classes to the overlay pane.
  11645. * @template THIS
  11646. * @this {THIS}
  11647. * @param {?} classes
  11648. * @return {THIS}
  11649. */
  11650. MatDialogRef.prototype.addPanelClass = /**
  11651. * Add a CSS class or an array of classes to the overlay pane.
  11652. * @template THIS
  11653. * @this {THIS}
  11654. * @param {?} classes
  11655. * @return {THIS}
  11656. */
  11657. function (classes) {
  11658. (/** @type {?} */ (this))._overlayRef.addPanelClass(classes);
  11659. return (/** @type {?} */ (this));
  11660. };
  11661. /** Remove a CSS class or an array of classes from the overlay pane. */
  11662. /**
  11663. * Remove a CSS class or an array of classes from the overlay pane.
  11664. * @template THIS
  11665. * @this {THIS}
  11666. * @param {?} classes
  11667. * @return {THIS}
  11668. */
  11669. MatDialogRef.prototype.removePanelClass = /**
  11670. * Remove a CSS class or an array of classes from the overlay pane.
  11671. * @template THIS
  11672. * @this {THIS}
  11673. * @param {?} classes
  11674. * @return {THIS}
  11675. */
  11676. function (classes) {
  11677. (/** @type {?} */ (this))._overlayRef.removePanelClass(classes);
  11678. return (/** @type {?} */ (this));
  11679. };
  11680. /**
  11681. * Gets an observable that is notified when the dialog is finished opening.
  11682. * @deprecated Use `afterOpened` instead.
  11683. * @breaking-change 8.0.0
  11684. */
  11685. /**
  11686. * Gets an observable that is notified when the dialog is finished opening.
  11687. * @deprecated Use `afterOpened` instead.
  11688. * \@breaking-change 8.0.0
  11689. * @return {?}
  11690. */
  11691. MatDialogRef.prototype.afterOpen = /**
  11692. * Gets an observable that is notified when the dialog is finished opening.
  11693. * @deprecated Use `afterOpened` instead.
  11694. * \@breaking-change 8.0.0
  11695. * @return {?}
  11696. */
  11697. function () {
  11698. return this.afterOpened();
  11699. };
  11700. /**
  11701. * Gets an observable that is notified when the dialog has started closing.
  11702. * @deprecated Use `beforeClosed` instead.
  11703. * @breaking-change 8.0.0
  11704. */
  11705. /**
  11706. * Gets an observable that is notified when the dialog has started closing.
  11707. * @deprecated Use `beforeClosed` instead.
  11708. * \@breaking-change 8.0.0
  11709. * @return {?}
  11710. */
  11711. MatDialogRef.prototype.beforeClose = /**
  11712. * Gets an observable that is notified when the dialog has started closing.
  11713. * @deprecated Use `beforeClosed` instead.
  11714. * \@breaking-change 8.0.0
  11715. * @return {?}
  11716. */
  11717. function () {
  11718. return this.beforeClosed();
  11719. };
  11720. /** Fetches the position strategy object from the overlay ref. */
  11721. /**
  11722. * Fetches the position strategy object from the overlay ref.
  11723. * @private
  11724. * @return {?}
  11725. */
  11726. MatDialogRef.prototype._getPositionStrategy = /**
  11727. * Fetches the position strategy object from the overlay ref.
  11728. * @private
  11729. * @return {?}
  11730. */
  11731. function () {
  11732. return (/** @type {?} */ (this._overlayRef.getConfig().positionStrategy));
  11733. };
  11734. return MatDialogRef;
  11735. }());
  11736. /**
  11737. * @fileoverview added by tsickle
  11738. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  11739. */
  11740. /**
  11741. * Injection token that can be used to access the data that was passed in to a dialog.
  11742. * @type {?}
  11743. */
  11744. var MAT_DIALOG_DATA = new core.InjectionToken('MatDialogData');
  11745. /**
  11746. * Injection token that can be used to specify default dialog options.
  11747. * @type {?}
  11748. */
  11749. var MAT_DIALOG_DEFAULT_OPTIONS = new core.InjectionToken('mat-dialog-default-options');
  11750. /**
  11751. * Injection token that determines the scroll handling while the dialog is open.
  11752. * @type {?}
  11753. */
  11754. var MAT_DIALOG_SCROLL_STRATEGY = new core.InjectionToken('mat-dialog-scroll-strategy');
  11755. /**
  11756. * \@docs-private
  11757. * @param {?} overlay
  11758. * @return {?}
  11759. */
  11760. function MAT_DIALOG_SCROLL_STRATEGY_FACTORY(overlay$$1) {
  11761. return (/**
  11762. * @return {?}
  11763. */
  11764. function () { return overlay$$1.scrollStrategies.block(); });
  11765. }
  11766. /**
  11767. * \@docs-private
  11768. * @param {?} overlay
  11769. * @return {?}
  11770. */
  11771. function MAT_DIALOG_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay$$1) {
  11772. return (/**
  11773. * @return {?}
  11774. */
  11775. function () { return overlay$$1.scrollStrategies.block(); });
  11776. }
  11777. /**
  11778. * \@docs-private
  11779. * @type {?}
  11780. */
  11781. var MAT_DIALOG_SCROLL_STRATEGY_PROVIDER = {
  11782. provide: MAT_DIALOG_SCROLL_STRATEGY,
  11783. deps: [overlay.Overlay],
  11784. useFactory: MAT_DIALOG_SCROLL_STRATEGY_PROVIDER_FACTORY,
  11785. };
  11786. /**
  11787. * Service to open Material Design modal dialogs.
  11788. */
  11789. var MatDialog = /** @class */ (function () {
  11790. function MatDialog(_overlay, _injector, _location, _defaultOptions, scrollStrategy, _parentDialog, _overlayContainer) {
  11791. var _this = this;
  11792. this._overlay = _overlay;
  11793. this._injector = _injector;
  11794. this._location = _location;
  11795. this._defaultOptions = _defaultOptions;
  11796. this._parentDialog = _parentDialog;
  11797. this._overlayContainer = _overlayContainer;
  11798. this._openDialogsAtThisLevel = [];
  11799. this._afterAllClosedAtThisLevel = new rxjs.Subject();
  11800. this._afterOpenedAtThisLevel = new rxjs.Subject();
  11801. this._ariaHiddenElements = new Map();
  11802. // TODO (jelbourn): tighten the typing right-hand side of this expression.
  11803. /**
  11804. * Stream that emits when all open dialog have finished closing.
  11805. * Will emit on subscribe if there are no open dialogs to begin with.
  11806. */
  11807. this.afterAllClosed = (/** @type {?} */ (rxjs.defer((/**
  11808. * @return {?}
  11809. */
  11810. function () { return _this.openDialogs.length ?
  11811. _this._afterAllClosed :
  11812. _this._afterAllClosed.pipe(operators.startWith(undefined)); }))));
  11813. this._scrollStrategy = scrollStrategy;
  11814. }
  11815. Object.defineProperty(MatDialog.prototype, "openDialogs", {
  11816. /** Keeps track of the currently-open dialogs. */
  11817. get: /**
  11818. * Keeps track of the currently-open dialogs.
  11819. * @return {?}
  11820. */
  11821. function () {
  11822. return this._parentDialog ? this._parentDialog.openDialogs : this._openDialogsAtThisLevel;
  11823. },
  11824. enumerable: true,
  11825. configurable: true
  11826. });
  11827. Object.defineProperty(MatDialog.prototype, "afterOpened", {
  11828. /** Stream that emits when a dialog has been opened. */
  11829. get: /**
  11830. * Stream that emits when a dialog has been opened.
  11831. * @return {?}
  11832. */
  11833. function () {
  11834. return this._parentDialog ? this._parentDialog.afterOpened : this._afterOpenedAtThisLevel;
  11835. },
  11836. enumerable: true,
  11837. configurable: true
  11838. });
  11839. Object.defineProperty(MatDialog.prototype, "afterOpen", {
  11840. /**
  11841. * Stream that emits when a dialog has been opened.
  11842. * @deprecated Use `afterOpened` instead.
  11843. * @breaking-change 8.0.0
  11844. */
  11845. get: /**
  11846. * Stream that emits when a dialog has been opened.
  11847. * @deprecated Use `afterOpened` instead.
  11848. * \@breaking-change 8.0.0
  11849. * @return {?}
  11850. */
  11851. function () {
  11852. return this.afterOpened;
  11853. },
  11854. enumerable: true,
  11855. configurable: true
  11856. });
  11857. Object.defineProperty(MatDialog.prototype, "_afterAllClosed", {
  11858. get: /**
  11859. * @return {?}
  11860. */
  11861. function () {
  11862. /** @type {?} */
  11863. var parent = this._parentDialog;
  11864. return parent ? parent._afterAllClosed : this._afterAllClosedAtThisLevel;
  11865. },
  11866. enumerable: true,
  11867. configurable: true
  11868. });
  11869. /**
  11870. * Opens a modal dialog containing the given component.
  11871. * @param componentOrTemplateRef Type of the component to load into the dialog,
  11872. * or a TemplateRef to instantiate as the dialog content.
  11873. * @param config Extra configuration options.
  11874. * @returns Reference to the newly-opened dialog.
  11875. */
  11876. /**
  11877. * Opens a modal dialog containing the given component.
  11878. * @template T, D, R
  11879. * @param {?} componentOrTemplateRef Type of the component to load into the dialog,
  11880. * or a TemplateRef to instantiate as the dialog content.
  11881. * @param {?=} config Extra configuration options.
  11882. * @return {?} Reference to the newly-opened dialog.
  11883. */
  11884. MatDialog.prototype.open = /**
  11885. * Opens a modal dialog containing the given component.
  11886. * @template T, D, R
  11887. * @param {?} componentOrTemplateRef Type of the component to load into the dialog,
  11888. * or a TemplateRef to instantiate as the dialog content.
  11889. * @param {?=} config Extra configuration options.
  11890. * @return {?} Reference to the newly-opened dialog.
  11891. */
  11892. function (componentOrTemplateRef, config) {
  11893. var _this = this;
  11894. config = _applyConfigDefaults$1(config, this._defaultOptions || new MatDialogConfig());
  11895. if (config.id && this.getDialogById(config.id)) {
  11896. throw Error("Dialog with id \"" + config.id + "\" exists already. The dialog id must be unique.");
  11897. }
  11898. /** @type {?} */
  11899. var overlayRef = this._createOverlay(config);
  11900. /** @type {?} */
  11901. var dialogContainer = this._attachDialogContainer(overlayRef, config);
  11902. /** @type {?} */
  11903. var dialogRef = this._attachDialogContent(componentOrTemplateRef, dialogContainer, overlayRef, config);
  11904. // If this is the first dialog that we're opening, hide all the non-overlay content.
  11905. if (!this.openDialogs.length) {
  11906. this._hideNonDialogContentFromAssistiveTechnology();
  11907. }
  11908. this.openDialogs.push(dialogRef);
  11909. dialogRef.afterClosed().subscribe((/**
  11910. * @return {?}
  11911. */
  11912. function () { return _this._removeOpenDialog(dialogRef); }));
  11913. this.afterOpened.next(dialogRef);
  11914. return dialogRef;
  11915. };
  11916. /**
  11917. * Closes all of the currently-open dialogs.
  11918. */
  11919. /**
  11920. * Closes all of the currently-open dialogs.
  11921. * @return {?}
  11922. */
  11923. MatDialog.prototype.closeAll = /**
  11924. * Closes all of the currently-open dialogs.
  11925. * @return {?}
  11926. */
  11927. function () {
  11928. this._closeDialogs(this.openDialogs);
  11929. };
  11930. /**
  11931. * Finds an open dialog by its id.
  11932. * @param id ID to use when looking up the dialog.
  11933. */
  11934. /**
  11935. * Finds an open dialog by its id.
  11936. * @param {?} id ID to use when looking up the dialog.
  11937. * @return {?}
  11938. */
  11939. MatDialog.prototype.getDialogById = /**
  11940. * Finds an open dialog by its id.
  11941. * @param {?} id ID to use when looking up the dialog.
  11942. * @return {?}
  11943. */
  11944. function (id) {
  11945. return this.openDialogs.find((/**
  11946. * @param {?} dialog
  11947. * @return {?}
  11948. */
  11949. function (dialog) { return dialog.id === id; }));
  11950. };
  11951. /**
  11952. * @return {?}
  11953. */
  11954. MatDialog.prototype.ngOnDestroy = /**
  11955. * @return {?}
  11956. */
  11957. function () {
  11958. // Only close the dialogs at this level on destroy
  11959. // since the parent service may still be active.
  11960. this._closeDialogs(this._openDialogsAtThisLevel);
  11961. this._afterAllClosedAtThisLevel.complete();
  11962. this._afterOpenedAtThisLevel.complete();
  11963. };
  11964. /**
  11965. * Creates the overlay into which the dialog will be loaded.
  11966. * @param config The dialog configuration.
  11967. * @returns A promise resolving to the OverlayRef for the created overlay.
  11968. */
  11969. /**
  11970. * Creates the overlay into which the dialog will be loaded.
  11971. * @private
  11972. * @param {?} config The dialog configuration.
  11973. * @return {?} A promise resolving to the OverlayRef for the created overlay.
  11974. */
  11975. MatDialog.prototype._createOverlay = /**
  11976. * Creates the overlay into which the dialog will be loaded.
  11977. * @private
  11978. * @param {?} config The dialog configuration.
  11979. * @return {?} A promise resolving to the OverlayRef for the created overlay.
  11980. */
  11981. function (config) {
  11982. /** @type {?} */
  11983. var overlayConfig = this._getOverlayConfig(config);
  11984. return this._overlay.create(overlayConfig);
  11985. };
  11986. /**
  11987. * Creates an overlay config from a dialog config.
  11988. * @param dialogConfig The dialog configuration.
  11989. * @returns The overlay configuration.
  11990. */
  11991. /**
  11992. * Creates an overlay config from a dialog config.
  11993. * @private
  11994. * @param {?} dialogConfig The dialog configuration.
  11995. * @return {?} The overlay configuration.
  11996. */
  11997. MatDialog.prototype._getOverlayConfig = /**
  11998. * Creates an overlay config from a dialog config.
  11999. * @private
  12000. * @param {?} dialogConfig The dialog configuration.
  12001. * @return {?} The overlay configuration.
  12002. */
  12003. function (dialogConfig) {
  12004. /** @type {?} */
  12005. var state$$1 = new overlay.OverlayConfig({
  12006. positionStrategy: this._overlay.position().global(),
  12007. scrollStrategy: dialogConfig.scrollStrategy || this._scrollStrategy(),
  12008. panelClass: dialogConfig.panelClass,
  12009. hasBackdrop: dialogConfig.hasBackdrop,
  12010. direction: dialogConfig.direction,
  12011. minWidth: dialogConfig.minWidth,
  12012. minHeight: dialogConfig.minHeight,
  12013. maxWidth: dialogConfig.maxWidth,
  12014. maxHeight: dialogConfig.maxHeight,
  12015. disposeOnNavigation: dialogConfig.closeOnNavigation
  12016. });
  12017. if (dialogConfig.backdropClass) {
  12018. state$$1.backdropClass = dialogConfig.backdropClass;
  12019. }
  12020. return state$$1;
  12021. };
  12022. /**
  12023. * Attaches an MatDialogContainer to a dialog's already-created overlay.
  12024. * @param overlay Reference to the dialog's underlying overlay.
  12025. * @param config The dialog configuration.
  12026. * @returns A promise resolving to a ComponentRef for the attached container.
  12027. */
  12028. /**
  12029. * Attaches an MatDialogContainer to a dialog's already-created overlay.
  12030. * @private
  12031. * @param {?} overlay Reference to the dialog's underlying overlay.
  12032. * @param {?} config The dialog configuration.
  12033. * @return {?} A promise resolving to a ComponentRef for the attached container.
  12034. */
  12035. MatDialog.prototype._attachDialogContainer = /**
  12036. * Attaches an MatDialogContainer to a dialog's already-created overlay.
  12037. * @private
  12038. * @param {?} overlay Reference to the dialog's underlying overlay.
  12039. * @param {?} config The dialog configuration.
  12040. * @return {?} A promise resolving to a ComponentRef for the attached container.
  12041. */
  12042. function (overlay$$1, config) {
  12043. /** @type {?} */
  12044. var userInjector = config && config.viewContainerRef && config.viewContainerRef.injector;
  12045. /** @type {?} */
  12046. var injector = new portal.PortalInjector(userInjector || this._injector, new WeakMap([
  12047. [MatDialogConfig, config]
  12048. ]));
  12049. /** @type {?} */
  12050. var containerPortal = new portal.ComponentPortal(MatDialogContainer, config.viewContainerRef, injector);
  12051. /** @type {?} */
  12052. var containerRef = overlay$$1.attach(containerPortal);
  12053. return containerRef.instance;
  12054. };
  12055. /**
  12056. * Attaches the user-provided component to the already-created MatDialogContainer.
  12057. * @param componentOrTemplateRef The type of component being loaded into the dialog,
  12058. * or a TemplateRef to instantiate as the content.
  12059. * @param dialogContainer Reference to the wrapping MatDialogContainer.
  12060. * @param overlayRef Reference to the overlay in which the dialog resides.
  12061. * @param config The dialog configuration.
  12062. * @returns A promise resolving to the MatDialogRef that should be returned to the user.
  12063. */
  12064. /**
  12065. * Attaches the user-provided component to the already-created MatDialogContainer.
  12066. * @private
  12067. * @template T, R
  12068. * @param {?} componentOrTemplateRef The type of component being loaded into the dialog,
  12069. * or a TemplateRef to instantiate as the content.
  12070. * @param {?} dialogContainer Reference to the wrapping MatDialogContainer.
  12071. * @param {?} overlayRef Reference to the overlay in which the dialog resides.
  12072. * @param {?} config The dialog configuration.
  12073. * @return {?} A promise resolving to the MatDialogRef that should be returned to the user.
  12074. */
  12075. MatDialog.prototype._attachDialogContent = /**
  12076. * Attaches the user-provided component to the already-created MatDialogContainer.
  12077. * @private
  12078. * @template T, R
  12079. * @param {?} componentOrTemplateRef The type of component being loaded into the dialog,
  12080. * or a TemplateRef to instantiate as the content.
  12081. * @param {?} dialogContainer Reference to the wrapping MatDialogContainer.
  12082. * @param {?} overlayRef Reference to the overlay in which the dialog resides.
  12083. * @param {?} config The dialog configuration.
  12084. * @return {?} A promise resolving to the MatDialogRef that should be returned to the user.
  12085. */
  12086. function (componentOrTemplateRef, dialogContainer, overlayRef, config) {
  12087. // Create a reference to the dialog we're creating in order to give the user a handle
  12088. // to modify and close it.
  12089. /** @type {?} */
  12090. var dialogRef = new MatDialogRef(overlayRef, dialogContainer, this._location, config.id);
  12091. // When the dialog backdrop is clicked, we want to close it.
  12092. if (config.hasBackdrop) {
  12093. overlayRef.backdropClick().subscribe((/**
  12094. * @return {?}
  12095. */
  12096. function () {
  12097. if (!dialogRef.disableClose) {
  12098. dialogRef.close();
  12099. }
  12100. }));
  12101. }
  12102. if (componentOrTemplateRef instanceof core.TemplateRef) {
  12103. dialogContainer.attachTemplatePortal(new portal.TemplatePortal(componentOrTemplateRef, (/** @type {?} */ (null)), (/** @type {?} */ ({ $implicit: config.data, dialogRef: dialogRef }))));
  12104. }
  12105. else {
  12106. /** @type {?} */
  12107. var injector = this._createInjector(config, dialogRef, dialogContainer);
  12108. /** @type {?} */
  12109. var contentRef = dialogContainer.attachComponentPortal(new portal.ComponentPortal(componentOrTemplateRef, undefined, injector));
  12110. dialogRef.componentInstance = contentRef.instance;
  12111. }
  12112. dialogRef
  12113. .updateSize(config.width, config.height)
  12114. .updatePosition(config.position);
  12115. return dialogRef;
  12116. };
  12117. /**
  12118. * Creates a custom injector to be used inside the dialog. This allows a component loaded inside
  12119. * of a dialog to close itself and, optionally, to return a value.
  12120. * @param config Config object that is used to construct the dialog.
  12121. * @param dialogRef Reference to the dialog.
  12122. * @param container Dialog container element that wraps all of the contents.
  12123. * @returns The custom injector that can be used inside the dialog.
  12124. */
  12125. /**
  12126. * Creates a custom injector to be used inside the dialog. This allows a component loaded inside
  12127. * of a dialog to close itself and, optionally, to return a value.
  12128. * @private
  12129. * @template T
  12130. * @param {?} config Config object that is used to construct the dialog.
  12131. * @param {?} dialogRef Reference to the dialog.
  12132. * @param {?} dialogContainer
  12133. * @return {?} The custom injector that can be used inside the dialog.
  12134. */
  12135. MatDialog.prototype._createInjector = /**
  12136. * Creates a custom injector to be used inside the dialog. This allows a component loaded inside
  12137. * of a dialog to close itself and, optionally, to return a value.
  12138. * @private
  12139. * @template T
  12140. * @param {?} config Config object that is used to construct the dialog.
  12141. * @param {?} dialogRef Reference to the dialog.
  12142. * @param {?} dialogContainer
  12143. * @return {?} The custom injector that can be used inside the dialog.
  12144. */
  12145. function (config, dialogRef, dialogContainer) {
  12146. /** @type {?} */
  12147. var userInjector = config && config.viewContainerRef && config.viewContainerRef.injector;
  12148. // The MatDialogContainer is injected in the portal as the MatDialogContainer and the dialog's
  12149. // content are created out of the same ViewContainerRef and as such, are siblings for injector
  12150. // purposes. To allow the hierarchy that is expected, the MatDialogContainer is explicitly
  12151. // added to the injection tokens.
  12152. /** @type {?} */
  12153. var injectionTokens = new WeakMap([
  12154. [MatDialogContainer, dialogContainer],
  12155. [MAT_DIALOG_DATA, config.data],
  12156. [MatDialogRef, dialogRef]
  12157. ]);
  12158. if (config.direction &&
  12159. (!userInjector || !userInjector.get(bidi.Directionality, null))) {
  12160. injectionTokens.set(bidi.Directionality, {
  12161. value: config.direction,
  12162. change: rxjs.of()
  12163. });
  12164. }
  12165. return new portal.PortalInjector(userInjector || this._injector, injectionTokens);
  12166. };
  12167. /**
  12168. * Removes a dialog from the array of open dialogs.
  12169. * @param dialogRef Dialog to be removed.
  12170. */
  12171. /**
  12172. * Removes a dialog from the array of open dialogs.
  12173. * @private
  12174. * @param {?} dialogRef Dialog to be removed.
  12175. * @return {?}
  12176. */
  12177. MatDialog.prototype._removeOpenDialog = /**
  12178. * Removes a dialog from the array of open dialogs.
  12179. * @private
  12180. * @param {?} dialogRef Dialog to be removed.
  12181. * @return {?}
  12182. */
  12183. function (dialogRef) {
  12184. /** @type {?} */
  12185. var index = this.openDialogs.indexOf(dialogRef);
  12186. if (index > -1) {
  12187. this.openDialogs.splice(index, 1);
  12188. // If all the dialogs were closed, remove/restore the `aria-hidden`
  12189. // to a the siblings and emit to the `afterAllClosed` stream.
  12190. if (!this.openDialogs.length) {
  12191. this._ariaHiddenElements.forEach((/**
  12192. * @param {?} previousValue
  12193. * @param {?} element
  12194. * @return {?}
  12195. */
  12196. function (previousValue, element) {
  12197. if (previousValue) {
  12198. element.setAttribute('aria-hidden', previousValue);
  12199. }
  12200. else {
  12201. element.removeAttribute('aria-hidden');
  12202. }
  12203. }));
  12204. this._ariaHiddenElements.clear();
  12205. this._afterAllClosed.next();
  12206. }
  12207. }
  12208. };
  12209. /**
  12210. * Hides all of the content that isn't an overlay from assistive technology.
  12211. */
  12212. /**
  12213. * Hides all of the content that isn't an overlay from assistive technology.
  12214. * @private
  12215. * @return {?}
  12216. */
  12217. MatDialog.prototype._hideNonDialogContentFromAssistiveTechnology = /**
  12218. * Hides all of the content that isn't an overlay from assistive technology.
  12219. * @private
  12220. * @return {?}
  12221. */
  12222. function () {
  12223. /** @type {?} */
  12224. var overlayContainer = this._overlayContainer.getContainerElement();
  12225. // Ensure that the overlay container is attached to the DOM.
  12226. if (overlayContainer.parentElement) {
  12227. /** @type {?} */
  12228. var siblings = overlayContainer.parentElement.children;
  12229. for (var i = siblings.length - 1; i > -1; i--) {
  12230. /** @type {?} */
  12231. var sibling = siblings[i];
  12232. if (sibling !== overlayContainer &&
  12233. sibling.nodeName !== 'SCRIPT' &&
  12234. sibling.nodeName !== 'STYLE' &&
  12235. !sibling.hasAttribute('aria-live')) {
  12236. this._ariaHiddenElements.set(sibling, sibling.getAttribute('aria-hidden'));
  12237. sibling.setAttribute('aria-hidden', 'true');
  12238. }
  12239. }
  12240. }
  12241. };
  12242. /** Closes all of the dialogs in an array. */
  12243. /**
  12244. * Closes all of the dialogs in an array.
  12245. * @private
  12246. * @param {?} dialogs
  12247. * @return {?}
  12248. */
  12249. MatDialog.prototype._closeDialogs = /**
  12250. * Closes all of the dialogs in an array.
  12251. * @private
  12252. * @param {?} dialogs
  12253. * @return {?}
  12254. */
  12255. function (dialogs) {
  12256. /** @type {?} */
  12257. var i = dialogs.length;
  12258. while (i--) {
  12259. // The `_openDialogs` property isn't updated after close until the rxjs subscription
  12260. // runs on the next microtask, in addition to modifying the array as we're going
  12261. // through it. We loop through all of them and call close without assuming that
  12262. // they'll be removed from the list instantaneously.
  12263. dialogs[i].close();
  12264. }
  12265. };
  12266. MatDialog.decorators = [
  12267. { type: core.Injectable },
  12268. ];
  12269. /** @nocollapse */
  12270. MatDialog.ctorParameters = function () { return [
  12271. { type: overlay.Overlay },
  12272. { type: core.Injector },
  12273. { type: common.Location, decorators: [{ type: core.Optional }] },
  12274. { type: MatDialogConfig, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_DIALOG_DEFAULT_OPTIONS,] }] },
  12275. { type: undefined, decorators: [{ type: core.Inject, args: [MAT_DIALOG_SCROLL_STRATEGY,] }] },
  12276. { type: MatDialog, decorators: [{ type: core.Optional }, { type: core.SkipSelf }] },
  12277. { type: overlay.OverlayContainer }
  12278. ]; };
  12279. return MatDialog;
  12280. }());
  12281. /**
  12282. * Applies default options to the dialog config.
  12283. * @param {?=} config Config to be modified.
  12284. * @param {?=} defaultOptions Default options provided.
  12285. * @return {?} The new configuration object.
  12286. */
  12287. function _applyConfigDefaults$1(config, defaultOptions) {
  12288. return __assign({}, defaultOptions, config);
  12289. }
  12290. /**
  12291. * @fileoverview added by tsickle
  12292. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  12293. */
  12294. /**
  12295. * Counter used to generate unique IDs for dialog elements.
  12296. * @type {?}
  12297. */
  12298. var dialogElementUid = 0;
  12299. /**
  12300. * Button that will close the current dialog.
  12301. */
  12302. var MatDialogClose = /** @class */ (function () {
  12303. function MatDialogClose(dialogRef, _elementRef, _dialog) {
  12304. this.dialogRef = dialogRef;
  12305. this._elementRef = _elementRef;
  12306. this._dialog = _dialog;
  12307. }
  12308. /**
  12309. * @return {?}
  12310. */
  12311. MatDialogClose.prototype.ngOnInit = /**
  12312. * @return {?}
  12313. */
  12314. function () {
  12315. if (!this.dialogRef) {
  12316. // When this directive is included in a dialog via TemplateRef (rather than being
  12317. // in a Component), the DialogRef isn't available via injection because embedded
  12318. // views cannot be given a custom injector. Instead, we look up the DialogRef by
  12319. // ID. This must occur in `onInit`, as the ID binding for the dialog container won't
  12320. // be resolved at constructor time.
  12321. this.dialogRef = (/** @type {?} */ (getClosestDialog(this._elementRef, this._dialog.openDialogs)));
  12322. }
  12323. };
  12324. /**
  12325. * @param {?} changes
  12326. * @return {?}
  12327. */
  12328. MatDialogClose.prototype.ngOnChanges = /**
  12329. * @param {?} changes
  12330. * @return {?}
  12331. */
  12332. function (changes) {
  12333. /** @type {?} */
  12334. var proxiedChange = changes['_matDialogClose'] || changes['_matDialogCloseResult'];
  12335. if (proxiedChange) {
  12336. this.dialogResult = proxiedChange.currentValue;
  12337. }
  12338. };
  12339. MatDialogClose.decorators = [
  12340. { type: core.Directive, args: [{
  12341. selector: '[mat-dialog-close], [matDialogClose]',
  12342. exportAs: 'matDialogClose',
  12343. host: {
  12344. '(click)': 'dialogRef.close(dialogResult)',
  12345. '[attr.aria-label]': 'ariaLabel || null',
  12346. 'type': 'button',
  12347. }
  12348. },] },
  12349. ];
  12350. /** @nocollapse */
  12351. MatDialogClose.ctorParameters = function () { return [
  12352. { type: MatDialogRef, decorators: [{ type: core.Optional }] },
  12353. { type: core.ElementRef },
  12354. { type: MatDialog }
  12355. ]; };
  12356. MatDialogClose.propDecorators = {
  12357. ariaLabel: [{ type: core.Input, args: ['aria-label',] }],
  12358. dialogResult: [{ type: core.Input, args: ['mat-dialog-close',] }],
  12359. _matDialogClose: [{ type: core.Input, args: ['matDialogClose',] }]
  12360. };
  12361. return MatDialogClose;
  12362. }());
  12363. /**
  12364. * Title of a dialog element. Stays fixed to the top of the dialog when scrolling.
  12365. */
  12366. var MatDialogTitle = /** @class */ (function () {
  12367. function MatDialogTitle(_dialogRef, _elementRef, _dialog) {
  12368. this._dialogRef = _dialogRef;
  12369. this._elementRef = _elementRef;
  12370. this._dialog = _dialog;
  12371. this.id = "mat-dialog-title-" + dialogElementUid++;
  12372. }
  12373. /**
  12374. * @return {?}
  12375. */
  12376. MatDialogTitle.prototype.ngOnInit = /**
  12377. * @return {?}
  12378. */
  12379. function () {
  12380. var _this = this;
  12381. if (!this._dialogRef) {
  12382. this._dialogRef = (/** @type {?} */ (getClosestDialog(this._elementRef, this._dialog.openDialogs)));
  12383. }
  12384. if (this._dialogRef) {
  12385. Promise.resolve().then((/**
  12386. * @return {?}
  12387. */
  12388. function () {
  12389. /** @type {?} */
  12390. var container = _this._dialogRef._containerInstance;
  12391. if (container && !container._ariaLabelledBy) {
  12392. container._ariaLabelledBy = _this.id;
  12393. }
  12394. }));
  12395. }
  12396. };
  12397. MatDialogTitle.decorators = [
  12398. { type: core.Directive, args: [{
  12399. selector: '[mat-dialog-title], [matDialogTitle]',
  12400. exportAs: 'matDialogTitle',
  12401. host: {
  12402. 'class': 'mat-dialog-title',
  12403. '[id]': 'id',
  12404. },
  12405. },] },
  12406. ];
  12407. /** @nocollapse */
  12408. MatDialogTitle.ctorParameters = function () { return [
  12409. { type: MatDialogRef, decorators: [{ type: core.Optional }] },
  12410. { type: core.ElementRef },
  12411. { type: MatDialog }
  12412. ]; };
  12413. MatDialogTitle.propDecorators = {
  12414. id: [{ type: core.Input }]
  12415. };
  12416. return MatDialogTitle;
  12417. }());
  12418. /**
  12419. * Scrollable content container of a dialog.
  12420. */
  12421. var MatDialogContent = /** @class */ (function () {
  12422. function MatDialogContent() {
  12423. }
  12424. MatDialogContent.decorators = [
  12425. { type: core.Directive, args: [{
  12426. selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]",
  12427. host: { 'class': 'mat-dialog-content' }
  12428. },] },
  12429. ];
  12430. return MatDialogContent;
  12431. }());
  12432. /**
  12433. * Container for the bottom action buttons in a dialog.
  12434. * Stays fixed to the bottom when scrolling.
  12435. */
  12436. var MatDialogActions = /** @class */ (function () {
  12437. function MatDialogActions() {
  12438. }
  12439. MatDialogActions.decorators = [
  12440. { type: core.Directive, args: [{
  12441. selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]",
  12442. host: { 'class': 'mat-dialog-actions' }
  12443. },] },
  12444. ];
  12445. return MatDialogActions;
  12446. }());
  12447. /**
  12448. * Finds the closest MatDialogRef to an element by looking at the DOM.
  12449. * @param {?} element Element relative to which to look for a dialog.
  12450. * @param {?} openDialogs References to the currently-open dialogs.
  12451. * @return {?}
  12452. */
  12453. function getClosestDialog(element, openDialogs) {
  12454. /** @type {?} */
  12455. var parent = element.nativeElement.parentElement;
  12456. while (parent && !parent.classList.contains('mat-dialog-container')) {
  12457. parent = parent.parentElement;
  12458. }
  12459. return parent ? openDialogs.find((/**
  12460. * @param {?} dialog
  12461. * @return {?}
  12462. */
  12463. function (dialog) { return dialog.id === (/** @type {?} */ (parent)).id; })) : null;
  12464. }
  12465. /**
  12466. * @fileoverview added by tsickle
  12467. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  12468. */
  12469. var MatDialogModule = /** @class */ (function () {
  12470. function MatDialogModule() {
  12471. }
  12472. MatDialogModule.decorators = [
  12473. { type: core.NgModule, args: [{
  12474. imports: [
  12475. common.CommonModule,
  12476. overlay.OverlayModule,
  12477. portal.PortalModule,
  12478. MatCommonModule,
  12479. ],
  12480. exports: [
  12481. MatDialogContainer,
  12482. MatDialogClose,
  12483. MatDialogTitle,
  12484. MatDialogContent,
  12485. MatDialogActions,
  12486. MatCommonModule,
  12487. ],
  12488. declarations: [
  12489. MatDialogContainer,
  12490. MatDialogClose,
  12491. MatDialogTitle,
  12492. MatDialogActions,
  12493. MatDialogContent,
  12494. ],
  12495. providers: [
  12496. MatDialog,
  12497. MAT_DIALOG_SCROLL_STRATEGY_PROVIDER,
  12498. ],
  12499. entryComponents: [MatDialogContainer],
  12500. },] },
  12501. ];
  12502. return MatDialogModule;
  12503. }());
  12504. /**
  12505. * @fileoverview added by tsickle
  12506. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  12507. */
  12508. /**
  12509. * Directive to automatically resize a textarea to fit its content.
  12510. * @deprecated Use `cdkTextareaAutosize` from `\@angular/cdk/text-field` instead.
  12511. * \@breaking-change 8.0.0
  12512. */
  12513. var MatTextareaAutosize = /** @class */ (function (_super) {
  12514. __extends(MatTextareaAutosize, _super);
  12515. function MatTextareaAutosize() {
  12516. return _super !== null && _super.apply(this, arguments) || this;
  12517. }
  12518. Object.defineProperty(MatTextareaAutosize.prototype, "matAutosizeMinRows", {
  12519. get: /**
  12520. * @return {?}
  12521. */
  12522. function () { return this.minRows; },
  12523. set: /**
  12524. * @param {?} value
  12525. * @return {?}
  12526. */
  12527. function (value) { this.minRows = value; },
  12528. enumerable: true,
  12529. configurable: true
  12530. });
  12531. Object.defineProperty(MatTextareaAutosize.prototype, "matAutosizeMaxRows", {
  12532. get: /**
  12533. * @return {?}
  12534. */
  12535. function () { return this.maxRows; },
  12536. set: /**
  12537. * @param {?} value
  12538. * @return {?}
  12539. */
  12540. function (value) { this.maxRows = value; },
  12541. enumerable: true,
  12542. configurable: true
  12543. });
  12544. Object.defineProperty(MatTextareaAutosize.prototype, "matAutosize", {
  12545. get: /**
  12546. * @return {?}
  12547. */
  12548. function () { return this.enabled; },
  12549. set: /**
  12550. * @param {?} value
  12551. * @return {?}
  12552. */
  12553. function (value) { this.enabled = value; },
  12554. enumerable: true,
  12555. configurable: true
  12556. });
  12557. Object.defineProperty(MatTextareaAutosize.prototype, "matTextareaAutosize", {
  12558. get: /**
  12559. * @return {?}
  12560. */
  12561. function () { return this.enabled; },
  12562. set: /**
  12563. * @param {?} value
  12564. * @return {?}
  12565. */
  12566. function (value) { this.enabled = value; },
  12567. enumerable: true,
  12568. configurable: true
  12569. });
  12570. MatTextareaAutosize.decorators = [
  12571. { type: core.Directive, args: [{
  12572. selector: 'textarea[mat-autosize], textarea[matTextareaAutosize]',
  12573. exportAs: 'matTextareaAutosize',
  12574. inputs: ['cdkAutosizeMinRows', 'cdkAutosizeMaxRows'],
  12575. host: {
  12576. 'class': 'cdk-textarea-autosize mat-autosize',
  12577. // Textarea elements that have the directive applied should have a single row by default.
  12578. // Browsers normally show two rows by default and therefore this limits the minRows binding.
  12579. 'rows': '1',
  12580. '(input)': '_noopInputHandler()',
  12581. },
  12582. },] },
  12583. ];
  12584. MatTextareaAutosize.propDecorators = {
  12585. matAutosizeMinRows: [{ type: core.Input }],
  12586. matAutosizeMaxRows: [{ type: core.Input }],
  12587. matAutosize: [{ type: core.Input, args: ['mat-autosize',] }],
  12588. matTextareaAutosize: [{ type: core.Input }]
  12589. };
  12590. return MatTextareaAutosize;
  12591. }(textField.CdkTextareaAutosize));
  12592. /**
  12593. * @fileoverview added by tsickle
  12594. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  12595. */
  12596. /**
  12597. * \@docs-private
  12598. * @param {?} type
  12599. * @return {?}
  12600. */
  12601. function getMatInputUnsupportedTypeError(type) {
  12602. return Error("Input type \"" + type + "\" isn't supported by matInput.");
  12603. }
  12604. /**
  12605. * @fileoverview added by tsickle
  12606. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  12607. */
  12608. /**
  12609. * This token is used to inject the object whose value should be set into `MatInput`. If none is
  12610. * provided, the native `HTMLInputElement` is used. Directives like `MatDatepickerInput` can provide
  12611. * themselves for this token, in order to make `MatInput` delegate the getting and setting of the
  12612. * value to them.
  12613. * @type {?}
  12614. */
  12615. var MAT_INPUT_VALUE_ACCESSOR = new core.InjectionToken('MAT_INPUT_VALUE_ACCESSOR');
  12616. /**
  12617. * @fileoverview added by tsickle
  12618. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  12619. */
  12620. // Invalid input type. Using one of these will throw an MatInputUnsupportedTypeError.
  12621. /** @type {?} */
  12622. var MAT_INPUT_INVALID_TYPES = [
  12623. 'button',
  12624. 'checkbox',
  12625. 'file',
  12626. 'hidden',
  12627. 'image',
  12628. 'radio',
  12629. 'range',
  12630. 'reset',
  12631. 'submit'
  12632. ];
  12633. /** @type {?} */
  12634. var nextUniqueId$5 = 0;
  12635. // Boilerplate for applying mixins to MatInput.
  12636. /**
  12637. * \@docs-private
  12638. */
  12639. var
  12640. // Boilerplate for applying mixins to MatInput.
  12641. /**
  12642. * \@docs-private
  12643. */
  12644. MatInputBase = /** @class */ (function () {
  12645. function MatInputBase(_defaultErrorStateMatcher, _parentForm, _parentFormGroup, ngControl) {
  12646. this._defaultErrorStateMatcher = _defaultErrorStateMatcher;
  12647. this._parentForm = _parentForm;
  12648. this._parentFormGroup = _parentFormGroup;
  12649. this.ngControl = ngControl;
  12650. }
  12651. return MatInputBase;
  12652. }());
  12653. /** @type {?} */
  12654. var _MatInputMixinBase = mixinErrorState(MatInputBase);
  12655. /**
  12656. * Directive that allows a native input to work inside a `MatFormField`.
  12657. */
  12658. var MatInput = /** @class */ (function (_super) {
  12659. __extends(MatInput, _super);
  12660. function MatInput(_elementRef, _platform, ngControl, _parentForm, _parentFormGroup, _defaultErrorStateMatcher, inputValueAccessor, _autofillMonitor, ngZone) {
  12661. var _this = _super.call(this, _defaultErrorStateMatcher, _parentForm, _parentFormGroup, ngControl) || this;
  12662. _this._elementRef = _elementRef;
  12663. _this._platform = _platform;
  12664. _this.ngControl = ngControl;
  12665. _this._autofillMonitor = _autofillMonitor;
  12666. _this._uid = "mat-input-" + nextUniqueId$5++;
  12667. /**
  12668. * Whether the component is being rendered on the server.
  12669. */
  12670. _this._isServer = false;
  12671. /**
  12672. * Whether the component is a native html select.
  12673. */
  12674. _this._isNativeSelect = false;
  12675. /**
  12676. * Implemented as part of MatFormFieldControl.
  12677. * \@docs-private
  12678. */
  12679. _this.focused = false;
  12680. /**
  12681. * Implemented as part of MatFormFieldControl.
  12682. * \@docs-private
  12683. */
  12684. _this.stateChanges = new rxjs.Subject();
  12685. /**
  12686. * Implemented as part of MatFormFieldControl.
  12687. * \@docs-private
  12688. */
  12689. _this.controlType = 'mat-input';
  12690. /**
  12691. * Implemented as part of MatFormFieldControl.
  12692. * \@docs-private
  12693. */
  12694. _this.autofilled = false;
  12695. _this._disabled = false;
  12696. _this._required = false;
  12697. _this._type = 'text';
  12698. _this._readonly = false;
  12699. _this._neverEmptyInputTypes = [
  12700. 'date',
  12701. 'datetime',
  12702. 'datetime-local',
  12703. 'month',
  12704. 'time',
  12705. 'week'
  12706. ].filter((/**
  12707. * @param {?} t
  12708. * @return {?}
  12709. */
  12710. function (t) { return platform.getSupportedInputTypes().has(t); }));
  12711. /** @type {?} */
  12712. var element = _this._elementRef.nativeElement;
  12713. // If no input value accessor was explicitly specified, use the element as the input value
  12714. // accessor.
  12715. _this._inputValueAccessor = inputValueAccessor || element;
  12716. _this._previousNativeValue = _this.value;
  12717. // Force setter to be called in case id was not specified.
  12718. _this.id = _this.id;
  12719. // On some versions of iOS the caret gets stuck in the wrong place when holding down the delete
  12720. // key. In order to get around this we need to "jiggle" the caret loose. Since this bug only
  12721. // exists on iOS, we only bother to install the listener on iOS.
  12722. if (_platform.IOS) {
  12723. ngZone.runOutsideAngular((/**
  12724. * @return {?}
  12725. */
  12726. function () {
  12727. _elementRef.nativeElement.addEventListener('keyup', (/**
  12728. * @param {?} event
  12729. * @return {?}
  12730. */
  12731. function (event) {
  12732. /** @type {?} */
  12733. var el = (/** @type {?} */ (event.target));
  12734. if (!el.value && !el.selectionStart && !el.selectionEnd) {
  12735. // Note: Just setting `0, 0` doesn't fix the issue. Setting
  12736. // `1, 1` fixes it for the first time that you type text and
  12737. // then hold delete. Toggling to `1, 1` and then back to
  12738. // `0, 0` seems to completely fix it.
  12739. el.setSelectionRange(1, 1);
  12740. el.setSelectionRange(0, 0);
  12741. }
  12742. }));
  12743. }));
  12744. }
  12745. _this._isServer = !_this._platform.isBrowser;
  12746. _this._isNativeSelect = element.nodeName.toLowerCase() === 'select';
  12747. if (_this._isNativeSelect) {
  12748. _this.controlType = ((/** @type {?} */ (element))).multiple ? 'mat-native-select-multiple' :
  12749. 'mat-native-select';
  12750. }
  12751. return _this;
  12752. }
  12753. Object.defineProperty(MatInput.prototype, "disabled", {
  12754. /**
  12755. * Implemented as part of MatFormFieldControl.
  12756. * @docs-private
  12757. */
  12758. get: /**
  12759. * Implemented as part of MatFormFieldControl.
  12760. * \@docs-private
  12761. * @return {?}
  12762. */
  12763. function () {
  12764. if (this.ngControl && this.ngControl.disabled !== null) {
  12765. return this.ngControl.disabled;
  12766. }
  12767. return this._disabled;
  12768. },
  12769. set: /**
  12770. * @param {?} value
  12771. * @return {?}
  12772. */
  12773. function (value) {
  12774. this._disabled = coercion.coerceBooleanProperty(value);
  12775. // Browsers may not fire the blur event if the input is disabled too quickly.
  12776. // Reset from here to ensure that the element doesn't become stuck.
  12777. if (this.focused) {
  12778. this.focused = false;
  12779. this.stateChanges.next();
  12780. }
  12781. },
  12782. enumerable: true,
  12783. configurable: true
  12784. });
  12785. Object.defineProperty(MatInput.prototype, "id", {
  12786. /**
  12787. * Implemented as part of MatFormFieldControl.
  12788. * @docs-private
  12789. */
  12790. get: /**
  12791. * Implemented as part of MatFormFieldControl.
  12792. * \@docs-private
  12793. * @return {?}
  12794. */
  12795. function () { return this._id; },
  12796. set: /**
  12797. * @param {?} value
  12798. * @return {?}
  12799. */
  12800. function (value) { this._id = value || this._uid; },
  12801. enumerable: true,
  12802. configurable: true
  12803. });
  12804. Object.defineProperty(MatInput.prototype, "required", {
  12805. /**
  12806. * Implemented as part of MatFormFieldControl.
  12807. * @docs-private
  12808. */
  12809. get: /**
  12810. * Implemented as part of MatFormFieldControl.
  12811. * \@docs-private
  12812. * @return {?}
  12813. */
  12814. function () { return this._required; },
  12815. set: /**
  12816. * @param {?} value
  12817. * @return {?}
  12818. */
  12819. function (value) { this._required = coercion.coerceBooleanProperty(value); },
  12820. enumerable: true,
  12821. configurable: true
  12822. });
  12823. Object.defineProperty(MatInput.prototype, "type", {
  12824. /** Input type of the element. */
  12825. get: /**
  12826. * Input type of the element.
  12827. * @return {?}
  12828. */
  12829. function () { return this._type; },
  12830. set: /**
  12831. * @param {?} value
  12832. * @return {?}
  12833. */
  12834. function (value) {
  12835. this._type = value || 'text';
  12836. this._validateType();
  12837. // When using Angular inputs, developers are no longer able to set the properties on the native
  12838. // input element. To ensure that bindings for `type` work, we need to sync the setter
  12839. // with the native property. Textarea elements don't support the type property or attribute.
  12840. if (!this._isTextarea() && platform.getSupportedInputTypes().has(this._type)) {
  12841. ((/** @type {?} */ (this._elementRef.nativeElement))).type = this._type;
  12842. }
  12843. },
  12844. enumerable: true,
  12845. configurable: true
  12846. });
  12847. Object.defineProperty(MatInput.prototype, "value", {
  12848. /**
  12849. * Implemented as part of MatFormFieldControl.
  12850. * @docs-private
  12851. */
  12852. get: /**
  12853. * Implemented as part of MatFormFieldControl.
  12854. * \@docs-private
  12855. * @return {?}
  12856. */
  12857. function () { return this._inputValueAccessor.value; },
  12858. set: /**
  12859. * @param {?} value
  12860. * @return {?}
  12861. */
  12862. function (value) {
  12863. if (value !== this.value) {
  12864. this._inputValueAccessor.value = value;
  12865. this.stateChanges.next();
  12866. }
  12867. },
  12868. enumerable: true,
  12869. configurable: true
  12870. });
  12871. Object.defineProperty(MatInput.prototype, "readonly", {
  12872. /** Whether the element is readonly. */
  12873. get: /**
  12874. * Whether the element is readonly.
  12875. * @return {?}
  12876. */
  12877. function () { return this._readonly; },
  12878. set: /**
  12879. * @param {?} value
  12880. * @return {?}
  12881. */
  12882. function (value) { this._readonly = coercion.coerceBooleanProperty(value); },
  12883. enumerable: true,
  12884. configurable: true
  12885. });
  12886. /**
  12887. * @return {?}
  12888. */
  12889. MatInput.prototype.ngOnInit = /**
  12890. * @return {?}
  12891. */
  12892. function () {
  12893. var _this = this;
  12894. if (this._platform.isBrowser) {
  12895. this._autofillMonitor.monitor(this._elementRef.nativeElement).subscribe((/**
  12896. * @param {?} event
  12897. * @return {?}
  12898. */
  12899. function (event) {
  12900. _this.autofilled = event.isAutofilled;
  12901. _this.stateChanges.next();
  12902. }));
  12903. }
  12904. };
  12905. /**
  12906. * @return {?}
  12907. */
  12908. MatInput.prototype.ngOnChanges = /**
  12909. * @return {?}
  12910. */
  12911. function () {
  12912. this.stateChanges.next();
  12913. };
  12914. /**
  12915. * @return {?}
  12916. */
  12917. MatInput.prototype.ngOnDestroy = /**
  12918. * @return {?}
  12919. */
  12920. function () {
  12921. this.stateChanges.complete();
  12922. if (this._platform.isBrowser) {
  12923. this._autofillMonitor.stopMonitoring(this._elementRef.nativeElement);
  12924. }
  12925. };
  12926. /**
  12927. * @return {?}
  12928. */
  12929. MatInput.prototype.ngDoCheck = /**
  12930. * @return {?}
  12931. */
  12932. function () {
  12933. if (this.ngControl) {
  12934. // We need to re-evaluate this on every change detection cycle, because there are some
  12935. // error triggers that we can't subscribe to (e.g. parent form submissions). This means
  12936. // that whatever logic is in here has to be super lean or we risk destroying the performance.
  12937. this.updateErrorState();
  12938. }
  12939. // We need to dirty-check the native element's value, because there are some cases where
  12940. // we won't be notified when it changes (e.g. the consumer isn't using forms or they're
  12941. // updating the value using `emitEvent: false`).
  12942. this._dirtyCheckNativeValue();
  12943. };
  12944. /** Focuses the input. */
  12945. /**
  12946. * Focuses the input.
  12947. * @param {?=} options
  12948. * @return {?}
  12949. */
  12950. MatInput.prototype.focus = /**
  12951. * Focuses the input.
  12952. * @param {?=} options
  12953. * @return {?}
  12954. */
  12955. function (options) {
  12956. this._elementRef.nativeElement.focus(options);
  12957. };
  12958. /** Callback for the cases where the focused state of the input changes. */
  12959. /**
  12960. * Callback for the cases where the focused state of the input changes.
  12961. * @param {?} isFocused
  12962. * @return {?}
  12963. */
  12964. MatInput.prototype._focusChanged = /**
  12965. * Callback for the cases where the focused state of the input changes.
  12966. * @param {?} isFocused
  12967. * @return {?}
  12968. */
  12969. function (isFocused) {
  12970. if (isFocused !== this.focused && (!this.readonly || !isFocused)) {
  12971. this.focused = isFocused;
  12972. this.stateChanges.next();
  12973. }
  12974. };
  12975. /**
  12976. * @return {?}
  12977. */
  12978. MatInput.prototype._onInput = /**
  12979. * @return {?}
  12980. */
  12981. function () {
  12982. // This is a noop function and is used to let Angular know whenever the value changes.
  12983. // Angular will run a new change detection each time the `input` event has been dispatched.
  12984. // It's necessary that Angular recognizes the value change, because when floatingLabel
  12985. // is set to false and Angular forms aren't used, the placeholder won't recognize the
  12986. // value changes and will not disappear.
  12987. // Listening to the input event wouldn't be necessary when the input is using the
  12988. // FormsModule or ReactiveFormsModule, because Angular forms also listens to input events.
  12989. };
  12990. /** Does some manual dirty checking on the native input `value` property. */
  12991. /**
  12992. * Does some manual dirty checking on the native input `value` property.
  12993. * @protected
  12994. * @return {?}
  12995. */
  12996. MatInput.prototype._dirtyCheckNativeValue = /**
  12997. * Does some manual dirty checking on the native input `value` property.
  12998. * @protected
  12999. * @return {?}
  13000. */
  13001. function () {
  13002. /** @type {?} */
  13003. var newValue = this._elementRef.nativeElement.value;
  13004. if (this._previousNativeValue !== newValue) {
  13005. this._previousNativeValue = newValue;
  13006. this.stateChanges.next();
  13007. }
  13008. };
  13009. /** Make sure the input is a supported type. */
  13010. /**
  13011. * Make sure the input is a supported type.
  13012. * @protected
  13013. * @return {?}
  13014. */
  13015. MatInput.prototype._validateType = /**
  13016. * Make sure the input is a supported type.
  13017. * @protected
  13018. * @return {?}
  13019. */
  13020. function () {
  13021. if (MAT_INPUT_INVALID_TYPES.indexOf(this._type) > -1) {
  13022. throw getMatInputUnsupportedTypeError(this._type);
  13023. }
  13024. };
  13025. /** Checks whether the input type is one of the types that are never empty. */
  13026. /**
  13027. * Checks whether the input type is one of the types that are never empty.
  13028. * @protected
  13029. * @return {?}
  13030. */
  13031. MatInput.prototype._isNeverEmpty = /**
  13032. * Checks whether the input type is one of the types that are never empty.
  13033. * @protected
  13034. * @return {?}
  13035. */
  13036. function () {
  13037. return this._neverEmptyInputTypes.indexOf(this._type) > -1;
  13038. };
  13039. /** Checks whether the input is invalid based on the native validation. */
  13040. /**
  13041. * Checks whether the input is invalid based on the native validation.
  13042. * @protected
  13043. * @return {?}
  13044. */
  13045. MatInput.prototype._isBadInput = /**
  13046. * Checks whether the input is invalid based on the native validation.
  13047. * @protected
  13048. * @return {?}
  13049. */
  13050. function () {
  13051. // The `validity` property won't be present on platform-server.
  13052. /** @type {?} */
  13053. var validity = ((/** @type {?} */ (this._elementRef.nativeElement))).validity;
  13054. return validity && validity.badInput;
  13055. };
  13056. /** Determines if the component host is a textarea. */
  13057. /**
  13058. * Determines if the component host is a textarea.
  13059. * @protected
  13060. * @return {?}
  13061. */
  13062. MatInput.prototype._isTextarea = /**
  13063. * Determines if the component host is a textarea.
  13064. * @protected
  13065. * @return {?}
  13066. */
  13067. function () {
  13068. return this._elementRef.nativeElement.nodeName.toLowerCase() === 'textarea';
  13069. };
  13070. Object.defineProperty(MatInput.prototype, "empty", {
  13071. /**
  13072. * Implemented as part of MatFormFieldControl.
  13073. * @docs-private
  13074. */
  13075. get: /**
  13076. * Implemented as part of MatFormFieldControl.
  13077. * \@docs-private
  13078. * @return {?}
  13079. */
  13080. function () {
  13081. return !this._isNeverEmpty() && !this._elementRef.nativeElement.value && !this._isBadInput() &&
  13082. !this.autofilled;
  13083. },
  13084. enumerable: true,
  13085. configurable: true
  13086. });
  13087. Object.defineProperty(MatInput.prototype, "shouldLabelFloat", {
  13088. /**
  13089. * Implemented as part of MatFormFieldControl.
  13090. * @docs-private
  13091. */
  13092. get: /**
  13093. * Implemented as part of MatFormFieldControl.
  13094. * \@docs-private
  13095. * @return {?}
  13096. */
  13097. function () {
  13098. if (this._isNativeSelect) {
  13099. // For a single-selection `<select>`, the label should float when the selected option has
  13100. // a non-empty display value. For a `<select multiple>`, the label *always* floats to avoid
  13101. // overlapping the label with the options.
  13102. /** @type {?} */
  13103. var selectElement = (/** @type {?} */ (this._elementRef.nativeElement));
  13104. /** @type {?} */
  13105. var firstOption = selectElement.options[0];
  13106. // On most browsers the `selectedIndex` will always be 0, however on IE and Edge it'll be
  13107. // -1 if the `value` is set to something, that isn't in the list of options, at a later point.
  13108. return this.focused || selectElement.multiple || !this.empty ||
  13109. !!(selectElement.selectedIndex > -1 && firstOption && firstOption.label);
  13110. }
  13111. else {
  13112. return this.focused || !this.empty;
  13113. }
  13114. },
  13115. enumerable: true,
  13116. configurable: true
  13117. });
  13118. /**
  13119. * Implemented as part of MatFormFieldControl.
  13120. * @docs-private
  13121. */
  13122. /**
  13123. * Implemented as part of MatFormFieldControl.
  13124. * \@docs-private
  13125. * @param {?} ids
  13126. * @return {?}
  13127. */
  13128. MatInput.prototype.setDescribedByIds = /**
  13129. * Implemented as part of MatFormFieldControl.
  13130. * \@docs-private
  13131. * @param {?} ids
  13132. * @return {?}
  13133. */
  13134. function (ids) {
  13135. this._ariaDescribedby = ids.join(' ');
  13136. };
  13137. /**
  13138. * Implemented as part of MatFormFieldControl.
  13139. * @docs-private
  13140. */
  13141. /**
  13142. * Implemented as part of MatFormFieldControl.
  13143. * \@docs-private
  13144. * @return {?}
  13145. */
  13146. MatInput.prototype.onContainerClick = /**
  13147. * Implemented as part of MatFormFieldControl.
  13148. * \@docs-private
  13149. * @return {?}
  13150. */
  13151. function () {
  13152. // Do not re-focus the input element if the element is already focused. Otherwise it can happen
  13153. // that someone clicks on a time input and the cursor resets to the "hours" field while the
  13154. // "minutes" field was actually clicked. See: https://github.com/angular/components/issues/12849
  13155. if (!this.focused) {
  13156. this.focus();
  13157. }
  13158. };
  13159. MatInput.decorators = [
  13160. { type: core.Directive, args: [{
  13161. selector: "input[matInput], textarea[matInput], select[matNativeControl],\n input[matNativeControl], textarea[matNativeControl]",
  13162. exportAs: 'matInput',
  13163. host: {
  13164. /**
  13165. * \@breaking-change 8.0.0 remove .mat-form-field-autofill-control in favor of AutofillMonitor.
  13166. */
  13167. 'class': 'mat-input-element mat-form-field-autofill-control',
  13168. '[class.mat-input-server]': '_isServer',
  13169. // Native input properties that are overwritten by Angular inputs need to be synced with
  13170. // the native input element. Otherwise property bindings for those don't work.
  13171. '[attr.id]': 'id',
  13172. '[attr.placeholder]': 'placeholder',
  13173. '[disabled]': 'disabled',
  13174. '[required]': 'required',
  13175. '[attr.readonly]': 'readonly && !_isNativeSelect || null',
  13176. '[attr.aria-describedby]': '_ariaDescribedby || null',
  13177. '[attr.aria-invalid]': 'errorState',
  13178. '[attr.aria-required]': 'required.toString()',
  13179. '(blur)': '_focusChanged(false)',
  13180. '(focus)': '_focusChanged(true)',
  13181. '(input)': '_onInput()',
  13182. },
  13183. providers: [{ provide: MatFormFieldControl, useExisting: MatInput }],
  13184. },] },
  13185. ];
  13186. /** @nocollapse */
  13187. MatInput.ctorParameters = function () { return [
  13188. { type: core.ElementRef },
  13189. { type: platform.Platform },
  13190. { type: forms.NgControl, decorators: [{ type: core.Optional }, { type: core.Self }] },
  13191. { type: forms.NgForm, decorators: [{ type: core.Optional }] },
  13192. { type: forms.FormGroupDirective, decorators: [{ type: core.Optional }] },
  13193. { type: ErrorStateMatcher },
  13194. { type: undefined, decorators: [{ type: core.Optional }, { type: core.Self }, { type: core.Inject, args: [MAT_INPUT_VALUE_ACCESSOR,] }] },
  13195. { type: textField.AutofillMonitor },
  13196. { type: core.NgZone }
  13197. ]; };
  13198. MatInput.propDecorators = {
  13199. disabled: [{ type: core.Input }],
  13200. id: [{ type: core.Input }],
  13201. placeholder: [{ type: core.Input }],
  13202. required: [{ type: core.Input }],
  13203. type: [{ type: core.Input }],
  13204. errorStateMatcher: [{ type: core.Input }],
  13205. value: [{ type: core.Input }],
  13206. readonly: [{ type: core.Input }]
  13207. };
  13208. return MatInput;
  13209. }(_MatInputMixinBase));
  13210. /**
  13211. * @fileoverview added by tsickle
  13212. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  13213. */
  13214. var MatInputModule = /** @class */ (function () {
  13215. function MatInputModule() {
  13216. }
  13217. MatInputModule.decorators = [
  13218. { type: core.NgModule, args: [{
  13219. declarations: [MatInput, MatTextareaAutosize],
  13220. imports: [
  13221. common.CommonModule,
  13222. textField.TextFieldModule,
  13223. MatFormFieldModule,
  13224. ],
  13225. exports: [
  13226. textField.TextFieldModule,
  13227. // We re-export the `MatFormFieldModule` since `MatInput` will almost always
  13228. // be used together with `MatFormField`.
  13229. MatFormFieldModule,
  13230. MatInput,
  13231. MatTextareaAutosize,
  13232. ],
  13233. providers: [ErrorStateMatcher],
  13234. },] },
  13235. ];
  13236. return MatInputModule;
  13237. }());
  13238. /**
  13239. * @fileoverview added by tsickle
  13240. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  13241. */
  13242. /**
  13243. * \@docs-private
  13244. * @param {?} provider
  13245. * @return {?}
  13246. */
  13247. function createMissingDateImplError(provider) {
  13248. return Error("MatDatepicker: No provider found for " + provider + ". You must import one of the following " +
  13249. "modules at your application root: MatNativeDateModule, MatMomentDateModule, or provide a " +
  13250. "custom implementation.");
  13251. }
  13252. /**
  13253. * @fileoverview added by tsickle
  13254. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  13255. */
  13256. /**
  13257. * Datepicker data that requires internationalization.
  13258. */
  13259. var MatDatepickerIntl = /** @class */ (function () {
  13260. function MatDatepickerIntl() {
  13261. /**
  13262. * Stream that emits whenever the labels here are changed. Use this to notify
  13263. * components if the labels have changed after initialization.
  13264. */
  13265. this.changes = new rxjs.Subject();
  13266. /**
  13267. * A label for the calendar popup (used by screen readers).
  13268. */
  13269. this.calendarLabel = 'Calendar';
  13270. /**
  13271. * A label for the button used to open the calendar popup (used by screen readers).
  13272. */
  13273. this.openCalendarLabel = 'Open calendar';
  13274. /**
  13275. * A label for the previous month button (used by screen readers).
  13276. */
  13277. this.prevMonthLabel = 'Previous month';
  13278. /**
  13279. * A label for the next month button (used by screen readers).
  13280. */
  13281. this.nextMonthLabel = 'Next month';
  13282. /**
  13283. * A label for the previous year button (used by screen readers).
  13284. */
  13285. this.prevYearLabel = 'Previous year';
  13286. /**
  13287. * A label for the next year button (used by screen readers).
  13288. */
  13289. this.nextYearLabel = 'Next year';
  13290. /**
  13291. * A label for the previous multi-year button (used by screen readers).
  13292. */
  13293. this.prevMultiYearLabel = 'Previous 20 years';
  13294. /**
  13295. * A label for the next multi-year button (used by screen readers).
  13296. */
  13297. this.nextMultiYearLabel = 'Next 20 years';
  13298. /**
  13299. * A label for the 'switch to month view' button (used by screen readers).
  13300. */
  13301. this.switchToMonthViewLabel = 'Choose date';
  13302. /**
  13303. * A label for the 'switch to year view' button (used by screen readers).
  13304. */
  13305. this.switchToMultiYearViewLabel = 'Choose month and year';
  13306. }
  13307. MatDatepickerIntl.decorators = [
  13308. { type: core.Injectable, args: [{ providedIn: 'root' },] },
  13309. ];
  13310. /** @nocollapse */ MatDatepickerIntl.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function MatDatepickerIntl_Factory() { return new MatDatepickerIntl(); }, token: MatDatepickerIntl, providedIn: "root" });
  13311. return MatDatepickerIntl;
  13312. }());
  13313. /**
  13314. * @fileoverview added by tsickle
  13315. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  13316. */
  13317. /**
  13318. * An internal class that represents the data corresponding to a single calendar cell.
  13319. * \@docs-private
  13320. */
  13321. var /**
  13322. * An internal class that represents the data corresponding to a single calendar cell.
  13323. * \@docs-private
  13324. */
  13325. MatCalendarCell = /** @class */ (function () {
  13326. function MatCalendarCell(value, displayValue, ariaLabel, enabled, cssClasses) {
  13327. this.value = value;
  13328. this.displayValue = displayValue;
  13329. this.ariaLabel = ariaLabel;
  13330. this.enabled = enabled;
  13331. this.cssClasses = cssClasses;
  13332. }
  13333. return MatCalendarCell;
  13334. }());
  13335. /**
  13336. * An internal component used to display calendar data in a table.
  13337. * \@docs-private
  13338. */
  13339. var MatCalendarBody = /** @class */ (function () {
  13340. function MatCalendarBody(_elementRef, _ngZone) {
  13341. this._elementRef = _elementRef;
  13342. this._ngZone = _ngZone;
  13343. /**
  13344. * The number of columns in the table.
  13345. */
  13346. this.numCols = 7;
  13347. /**
  13348. * The cell number of the active cell in the table.
  13349. */
  13350. this.activeCell = 0;
  13351. /**
  13352. * The aspect ratio (width / height) to use for the cells in the table. This aspect ratio will be
  13353. * maintained even as the table resizes.
  13354. */
  13355. this.cellAspectRatio = 1;
  13356. /**
  13357. * Emits when a new value is selected.
  13358. */
  13359. this.selectedValueChange = new core.EventEmitter();
  13360. }
  13361. /**
  13362. * @param {?} cell
  13363. * @return {?}
  13364. */
  13365. MatCalendarBody.prototype._cellClicked = /**
  13366. * @param {?} cell
  13367. * @return {?}
  13368. */
  13369. function (cell) {
  13370. if (cell.enabled) {
  13371. this.selectedValueChange.emit(cell.value);
  13372. }
  13373. };
  13374. /**
  13375. * @param {?} changes
  13376. * @return {?}
  13377. */
  13378. MatCalendarBody.prototype.ngOnChanges = /**
  13379. * @param {?} changes
  13380. * @return {?}
  13381. */
  13382. function (changes) {
  13383. /** @type {?} */
  13384. var columnChanges = changes['numCols'];
  13385. var _a = this, rows = _a.rows, numCols = _a.numCols;
  13386. if (changes['rows'] || columnChanges) {
  13387. this._firstRowOffset = rows && rows.length && rows[0].length ? numCols - rows[0].length : 0;
  13388. }
  13389. if (changes['cellAspectRatio'] || columnChanges || !this._cellPadding) {
  13390. this._cellPadding = 50 * this.cellAspectRatio / numCols + "%";
  13391. }
  13392. if (columnChanges || !this._cellWidth) {
  13393. this._cellWidth = 100 / numCols + "%";
  13394. }
  13395. };
  13396. /**
  13397. * @param {?} rowIndex
  13398. * @param {?} colIndex
  13399. * @return {?}
  13400. */
  13401. MatCalendarBody.prototype._isActiveCell = /**
  13402. * @param {?} rowIndex
  13403. * @param {?} colIndex
  13404. * @return {?}
  13405. */
  13406. function (rowIndex, colIndex) {
  13407. /** @type {?} */
  13408. var cellNumber = rowIndex * this.numCols + colIndex;
  13409. // Account for the fact that the first row may not have as many cells.
  13410. if (rowIndex) {
  13411. cellNumber -= this._firstRowOffset;
  13412. }
  13413. return cellNumber == this.activeCell;
  13414. };
  13415. /** Focuses the active cell after the microtask queue is empty. */
  13416. /**
  13417. * Focuses the active cell after the microtask queue is empty.
  13418. * @return {?}
  13419. */
  13420. MatCalendarBody.prototype._focusActiveCell = /**
  13421. * Focuses the active cell after the microtask queue is empty.
  13422. * @return {?}
  13423. */
  13424. function () {
  13425. var _this = this;
  13426. this._ngZone.runOutsideAngular((/**
  13427. * @return {?}
  13428. */
  13429. function () {
  13430. _this._ngZone.onStable.asObservable().pipe(operators.take(1)).subscribe((/**
  13431. * @return {?}
  13432. */
  13433. function () {
  13434. /** @type {?} */
  13435. var activeCell = _this._elementRef.nativeElement.querySelector('.mat-calendar-body-active');
  13436. if (activeCell) {
  13437. activeCell.focus();
  13438. }
  13439. }));
  13440. }));
  13441. };
  13442. MatCalendarBody.decorators = [
  13443. { type: core.Component, args: [{selector: '[mat-calendar-body]',
  13444. template: "<tr *ngIf=\"_firstRowOffset < labelMinRequiredCells\" aria-hidden=\"true\"><td class=\"mat-calendar-body-label\" [attr.colspan]=\"numCols\" [style.paddingTop]=\"_cellPadding\" [style.paddingBottom]=\"_cellPadding\">{{label}}</td></tr><tr *ngFor=\"let row of rows; let rowIndex = index\" role=\"row\"><td *ngIf=\"rowIndex === 0 && _firstRowOffset\" aria-hidden=\"true\" class=\"mat-calendar-body-label\" [attr.colspan]=\"_firstRowOffset\" [style.paddingTop]=\"_cellPadding\" [style.paddingBottom]=\"_cellPadding\">{{_firstRowOffset >= labelMinRequiredCells ? label : ''}}</td><td *ngFor=\"let item of row; let colIndex = index\" role=\"gridcell\" class=\"mat-calendar-body-cell\" [ngClass]=\"item.cssClasses\" [tabindex]=\"_isActiveCell(rowIndex, colIndex) ? 0 : -1\" [class.mat-calendar-body-disabled]=\"!item.enabled\" [class.mat-calendar-body-active]=\"_isActiveCell(rowIndex, colIndex)\" [attr.aria-label]=\"item.ariaLabel\" [attr.aria-disabled]=\"!item.enabled || null\" [attr.aria-selected]=\"selectedValue === item.value\" (click)=\"_cellClicked(item)\" [style.width]=\"_cellWidth\" [style.paddingTop]=\"_cellPadding\" role=\"button\" [style.paddingBottom]=\"_cellPadding\"><div class=\"mat-calendar-body-cell-content\" [class.mat-calendar-body-selected]=\"selectedValue === item.value\" [class.mat-calendar-body-today]=\"todayValue === item.value\">{{item.displayValue}}</div></td></tr>",
  13445. styles: [".mat-calendar-body{min-width:224px}.mat-calendar-body-label{height:0;line-height:0;text-align:left;padding-left:4.71429%;padding-right:4.71429%}.mat-calendar-body-cell{position:relative;height:0;line-height:0;text-align:center;outline:0;cursor:pointer}.mat-calendar-body-disabled{cursor:default}.mat-calendar-body-cell-content{position:absolute;top:5%;left:5%;display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:90%;height:90%;line-height:1;border-width:1px;border-style:solid;border-radius:999px}@media (-ms-high-contrast:active){.mat-calendar-body-cell-content{border:none}}@media (-ms-high-contrast:active){.mat-calendar-body-selected,.mat-datepicker-popup:not(:empty){outline:solid 1px}.mat-calendar-body-today{outline:dotted 1px}.cdk-keyboard-focused .mat-calendar-body-active>.mat-calendar-body-cell-content:not(.mat-calendar-body-selected),.cdk-program-focused .mat-calendar-body-active>.mat-calendar-body-cell-content:not(.mat-calendar-body-selected){outline:dotted 2px}}[dir=rtl] .mat-calendar-body-label{text-align:right}"],
  13446. host: {
  13447. 'class': 'mat-calendar-body',
  13448. 'role': 'grid',
  13449. 'aria-readonly': 'true'
  13450. },
  13451. exportAs: 'matCalendarBody',
  13452. encapsulation: core.ViewEncapsulation.None,
  13453. changeDetection: core.ChangeDetectionStrategy.OnPush,
  13454. },] },
  13455. ];
  13456. /** @nocollapse */
  13457. MatCalendarBody.ctorParameters = function () { return [
  13458. { type: core.ElementRef },
  13459. { type: core.NgZone }
  13460. ]; };
  13461. MatCalendarBody.propDecorators = {
  13462. label: [{ type: core.Input }],
  13463. rows: [{ type: core.Input }],
  13464. todayValue: [{ type: core.Input }],
  13465. selectedValue: [{ type: core.Input }],
  13466. labelMinRequiredCells: [{ type: core.Input }],
  13467. numCols: [{ type: core.Input }],
  13468. activeCell: [{ type: core.Input }],
  13469. cellAspectRatio: [{ type: core.Input }],
  13470. selectedValueChange: [{ type: core.Output }]
  13471. };
  13472. return MatCalendarBody;
  13473. }());
  13474. /**
  13475. * @fileoverview added by tsickle
  13476. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  13477. */
  13478. /** @type {?} */
  13479. var DAYS_PER_WEEK = 7;
  13480. /**
  13481. * An internal component used to display a single month in the datepicker.
  13482. * \@docs-private
  13483. * @template D
  13484. */
  13485. var MatMonthView = /** @class */ (function () {
  13486. function MatMonthView(_changeDetectorRef, _dateFormats, _dateAdapter, _dir) {
  13487. this._changeDetectorRef = _changeDetectorRef;
  13488. this._dateFormats = _dateFormats;
  13489. this._dateAdapter = _dateAdapter;
  13490. this._dir = _dir;
  13491. /**
  13492. * Emits when a new date is selected.
  13493. */
  13494. this.selectedChange = new core.EventEmitter();
  13495. /**
  13496. * Emits when any date is selected.
  13497. */
  13498. this._userSelection = new core.EventEmitter();
  13499. /**
  13500. * Emits when any date is activated.
  13501. */
  13502. this.activeDateChange = new core.EventEmitter();
  13503. if (!this._dateAdapter) {
  13504. throw createMissingDateImplError('DateAdapter');
  13505. }
  13506. if (!this._dateFormats) {
  13507. throw createMissingDateImplError('MAT_DATE_FORMATS');
  13508. }
  13509. this._activeDate = this._dateAdapter.today();
  13510. }
  13511. Object.defineProperty(MatMonthView.prototype, "activeDate", {
  13512. /**
  13513. * The date to display in this month view (everything other than the month and year is ignored).
  13514. */
  13515. get: /**
  13516. * The date to display in this month view (everything other than the month and year is ignored).
  13517. * @return {?}
  13518. */
  13519. function () { return this._activeDate; },
  13520. set: /**
  13521. * @param {?} value
  13522. * @return {?}
  13523. */
  13524. function (value) {
  13525. /** @type {?} */
  13526. var oldActiveDate = this._activeDate;
  13527. /** @type {?} */
  13528. var validDate = this._getValidDateOrNull(this._dateAdapter.deserialize(value)) || this._dateAdapter.today();
  13529. this._activeDate = this._dateAdapter.clampDate(validDate, this.minDate, this.maxDate);
  13530. if (!this._hasSameMonthAndYear(oldActiveDate, this._activeDate)) {
  13531. this._init();
  13532. }
  13533. },
  13534. enumerable: true,
  13535. configurable: true
  13536. });
  13537. Object.defineProperty(MatMonthView.prototype, "selected", {
  13538. /** The currently selected date. */
  13539. get: /**
  13540. * The currently selected date.
  13541. * @return {?}
  13542. */
  13543. function () { return this._selected; },
  13544. set: /**
  13545. * @param {?} value
  13546. * @return {?}
  13547. */
  13548. function (value) {
  13549. this._selected = this._getValidDateOrNull(this._dateAdapter.deserialize(value));
  13550. this._selectedDate = this._getDateInCurrentMonth(this._selected);
  13551. },
  13552. enumerable: true,
  13553. configurable: true
  13554. });
  13555. Object.defineProperty(MatMonthView.prototype, "minDate", {
  13556. /** The minimum selectable date. */
  13557. get: /**
  13558. * The minimum selectable date.
  13559. * @return {?}
  13560. */
  13561. function () { return this._minDate; },
  13562. set: /**
  13563. * @param {?} value
  13564. * @return {?}
  13565. */
  13566. function (value) {
  13567. this._minDate = this._getValidDateOrNull(this._dateAdapter.deserialize(value));
  13568. },
  13569. enumerable: true,
  13570. configurable: true
  13571. });
  13572. Object.defineProperty(MatMonthView.prototype, "maxDate", {
  13573. /** The maximum selectable date. */
  13574. get: /**
  13575. * The maximum selectable date.
  13576. * @return {?}
  13577. */
  13578. function () { return this._maxDate; },
  13579. set: /**
  13580. * @param {?} value
  13581. * @return {?}
  13582. */
  13583. function (value) {
  13584. this._maxDate = this._getValidDateOrNull(this._dateAdapter.deserialize(value));
  13585. },
  13586. enumerable: true,
  13587. configurable: true
  13588. });
  13589. /**
  13590. * @return {?}
  13591. */
  13592. MatMonthView.prototype.ngAfterContentInit = /**
  13593. * @return {?}
  13594. */
  13595. function () {
  13596. this._init();
  13597. };
  13598. /** Handles when a new date is selected. */
  13599. /**
  13600. * Handles when a new date is selected.
  13601. * @param {?} date
  13602. * @return {?}
  13603. */
  13604. MatMonthView.prototype._dateSelected = /**
  13605. * Handles when a new date is selected.
  13606. * @param {?} date
  13607. * @return {?}
  13608. */
  13609. function (date) {
  13610. if (this._selectedDate != date) {
  13611. /** @type {?} */
  13612. var selectedYear = this._dateAdapter.getYear(this.activeDate);
  13613. /** @type {?} */
  13614. var selectedMonth = this._dateAdapter.getMonth(this.activeDate);
  13615. /** @type {?} */
  13616. var selectedDate = this._dateAdapter.createDate(selectedYear, selectedMonth, date);
  13617. this.selectedChange.emit(selectedDate);
  13618. }
  13619. this._userSelection.emit();
  13620. };
  13621. /** Handles keydown events on the calendar body when calendar is in month view. */
  13622. /**
  13623. * Handles keydown events on the calendar body when calendar is in month view.
  13624. * @param {?} event
  13625. * @return {?}
  13626. */
  13627. MatMonthView.prototype._handleCalendarBodyKeydown = /**
  13628. * Handles keydown events on the calendar body when calendar is in month view.
  13629. * @param {?} event
  13630. * @return {?}
  13631. */
  13632. function (event) {
  13633. // TODO(mmalerba): We currently allow keyboard navigation to disabled dates, but just prevent
  13634. // disabled ones from being selected. This may not be ideal, we should look into whether
  13635. // navigation should skip over disabled dates, and if so, how to implement that efficiently.
  13636. // TODO(mmalerba): We currently allow keyboard navigation to disabled dates, but just prevent
  13637. // disabled ones from being selected. This may not be ideal, we should look into whether
  13638. // navigation should skip over disabled dates, and if so, how to implement that efficiently.
  13639. /** @type {?} */
  13640. var oldActiveDate = this._activeDate;
  13641. /** @type {?} */
  13642. var isRtl = this._isRtl();
  13643. switch (event.keyCode) {
  13644. case keycodes.LEFT_ARROW:
  13645. this.activeDate = this._dateAdapter.addCalendarDays(this._activeDate, isRtl ? 1 : -1);
  13646. break;
  13647. case keycodes.RIGHT_ARROW:
  13648. this.activeDate = this._dateAdapter.addCalendarDays(this._activeDate, isRtl ? -1 : 1);
  13649. break;
  13650. case keycodes.UP_ARROW:
  13651. this.activeDate = this._dateAdapter.addCalendarDays(this._activeDate, -7);
  13652. break;
  13653. case keycodes.DOWN_ARROW:
  13654. this.activeDate = this._dateAdapter.addCalendarDays(this._activeDate, 7);
  13655. break;
  13656. case keycodes.HOME:
  13657. this.activeDate = this._dateAdapter.addCalendarDays(this._activeDate, 1 - this._dateAdapter.getDate(this._activeDate));
  13658. break;
  13659. case keycodes.END:
  13660. this.activeDate = this._dateAdapter.addCalendarDays(this._activeDate, (this._dateAdapter.getNumDaysInMonth(this._activeDate) -
  13661. this._dateAdapter.getDate(this._activeDate)));
  13662. break;
  13663. case keycodes.PAGE_UP:
  13664. this.activeDate = event.altKey ?
  13665. this._dateAdapter.addCalendarYears(this._activeDate, -1) :
  13666. this._dateAdapter.addCalendarMonths(this._activeDate, -1);
  13667. break;
  13668. case keycodes.PAGE_DOWN:
  13669. this.activeDate = event.altKey ?
  13670. this._dateAdapter.addCalendarYears(this._activeDate, 1) :
  13671. this._dateAdapter.addCalendarMonths(this._activeDate, 1);
  13672. break;
  13673. case keycodes.ENTER:
  13674. case keycodes.SPACE:
  13675. if (!this.dateFilter || this.dateFilter(this._activeDate)) {
  13676. this._dateSelected(this._dateAdapter.getDate(this._activeDate));
  13677. this._userSelection.emit();
  13678. // Prevent unexpected default actions such as form submission.
  13679. event.preventDefault();
  13680. }
  13681. return;
  13682. default:
  13683. // Don't prevent default or focus active cell on keys that we don't explicitly handle.
  13684. return;
  13685. }
  13686. if (this._dateAdapter.compareDate(oldActiveDate, this.activeDate)) {
  13687. this.activeDateChange.emit(this.activeDate);
  13688. }
  13689. this._focusActiveCell();
  13690. // Prevent unexpected default actions such as form submission.
  13691. event.preventDefault();
  13692. };
  13693. /** Initializes this month view. */
  13694. /**
  13695. * Initializes this month view.
  13696. * @return {?}
  13697. */
  13698. MatMonthView.prototype._init = /**
  13699. * Initializes this month view.
  13700. * @return {?}
  13701. */
  13702. function () {
  13703. this._selectedDate = this._getDateInCurrentMonth(this.selected);
  13704. this._todayDate = this._getDateInCurrentMonth(this._dateAdapter.today());
  13705. this._monthLabel =
  13706. this._dateAdapter.getMonthNames('short')[this._dateAdapter.getMonth(this.activeDate)]
  13707. .toLocaleUpperCase();
  13708. /** @type {?} */
  13709. var firstOfMonth = this._dateAdapter.createDate(this._dateAdapter.getYear(this.activeDate), this._dateAdapter.getMonth(this.activeDate), 1);
  13710. this._firstWeekOffset =
  13711. (DAYS_PER_WEEK + this._dateAdapter.getDayOfWeek(firstOfMonth) -
  13712. this._dateAdapter.getFirstDayOfWeek()) % DAYS_PER_WEEK;
  13713. this._initWeekdays();
  13714. this._createWeekCells();
  13715. this._changeDetectorRef.markForCheck();
  13716. };
  13717. /** Focuses the active cell after the microtask queue is empty. */
  13718. /**
  13719. * Focuses the active cell after the microtask queue is empty.
  13720. * @return {?}
  13721. */
  13722. MatMonthView.prototype._focusActiveCell = /**
  13723. * Focuses the active cell after the microtask queue is empty.
  13724. * @return {?}
  13725. */
  13726. function () {
  13727. this._matCalendarBody._focusActiveCell();
  13728. };
  13729. /** Initializes the weekdays. */
  13730. /**
  13731. * Initializes the weekdays.
  13732. * @private
  13733. * @return {?}
  13734. */
  13735. MatMonthView.prototype._initWeekdays = /**
  13736. * Initializes the weekdays.
  13737. * @private
  13738. * @return {?}
  13739. */
  13740. function () {
  13741. /** @type {?} */
  13742. var firstDayOfWeek = this._dateAdapter.getFirstDayOfWeek();
  13743. /** @type {?} */
  13744. var narrowWeekdays = this._dateAdapter.getDayOfWeekNames('narrow');
  13745. /** @type {?} */
  13746. var longWeekdays = this._dateAdapter.getDayOfWeekNames('long');
  13747. // Rotate the labels for days of the week based on the configured first day of the week.
  13748. /** @type {?} */
  13749. var weekdays = longWeekdays.map((/**
  13750. * @param {?} long
  13751. * @param {?} i
  13752. * @return {?}
  13753. */
  13754. function (long, i) {
  13755. return { long: long, narrow: narrowWeekdays[i] };
  13756. }));
  13757. this._weekdays = weekdays.slice(firstDayOfWeek).concat(weekdays.slice(0, firstDayOfWeek));
  13758. };
  13759. /** Creates MatCalendarCells for the dates in this month. */
  13760. /**
  13761. * Creates MatCalendarCells for the dates in this month.
  13762. * @private
  13763. * @return {?}
  13764. */
  13765. MatMonthView.prototype._createWeekCells = /**
  13766. * Creates MatCalendarCells for the dates in this month.
  13767. * @private
  13768. * @return {?}
  13769. */
  13770. function () {
  13771. /** @type {?} */
  13772. var daysInMonth = this._dateAdapter.getNumDaysInMonth(this.activeDate);
  13773. /** @type {?} */
  13774. var dateNames = this._dateAdapter.getDateNames();
  13775. this._weeks = [[]];
  13776. for (var i = 0, cell = this._firstWeekOffset; i < daysInMonth; i++, cell++) {
  13777. if (cell == DAYS_PER_WEEK) {
  13778. this._weeks.push([]);
  13779. cell = 0;
  13780. }
  13781. /** @type {?} */
  13782. var date = this._dateAdapter.createDate(this._dateAdapter.getYear(this.activeDate), this._dateAdapter.getMonth(this.activeDate), i + 1);
  13783. /** @type {?} */
  13784. var enabled = this._shouldEnableDate(date);
  13785. /** @type {?} */
  13786. var ariaLabel = this._dateAdapter.format(date, this._dateFormats.display.dateA11yLabel);
  13787. /** @type {?} */
  13788. var cellClasses = this.dateClass ? this.dateClass(date) : undefined;
  13789. this._weeks[this._weeks.length - 1]
  13790. .push(new MatCalendarCell(i + 1, dateNames[i], ariaLabel, enabled, cellClasses));
  13791. }
  13792. };
  13793. /** Date filter for the month */
  13794. /**
  13795. * Date filter for the month
  13796. * @private
  13797. * @param {?} date
  13798. * @return {?}
  13799. */
  13800. MatMonthView.prototype._shouldEnableDate = /**
  13801. * Date filter for the month
  13802. * @private
  13803. * @param {?} date
  13804. * @return {?}
  13805. */
  13806. function (date) {
  13807. return !!date &&
  13808. (!this.dateFilter || this.dateFilter(date)) &&
  13809. (!this.minDate || this._dateAdapter.compareDate(date, this.minDate) >= 0) &&
  13810. (!this.maxDate || this._dateAdapter.compareDate(date, this.maxDate) <= 0);
  13811. };
  13812. /**
  13813. * Gets the date in this month that the given Date falls on.
  13814. * Returns null if the given Date is in another month.
  13815. */
  13816. /**
  13817. * Gets the date in this month that the given Date falls on.
  13818. * Returns null if the given Date is in another month.
  13819. * @private
  13820. * @param {?} date
  13821. * @return {?}
  13822. */
  13823. MatMonthView.prototype._getDateInCurrentMonth = /**
  13824. * Gets the date in this month that the given Date falls on.
  13825. * Returns null if the given Date is in another month.
  13826. * @private
  13827. * @param {?} date
  13828. * @return {?}
  13829. */
  13830. function (date) {
  13831. return date && this._hasSameMonthAndYear(date, this.activeDate) ?
  13832. this._dateAdapter.getDate(date) : null;
  13833. };
  13834. /** Checks whether the 2 dates are non-null and fall within the same month of the same year. */
  13835. /**
  13836. * Checks whether the 2 dates are non-null and fall within the same month of the same year.
  13837. * @private
  13838. * @param {?} d1
  13839. * @param {?} d2
  13840. * @return {?}
  13841. */
  13842. MatMonthView.prototype._hasSameMonthAndYear = /**
  13843. * Checks whether the 2 dates are non-null and fall within the same month of the same year.
  13844. * @private
  13845. * @param {?} d1
  13846. * @param {?} d2
  13847. * @return {?}
  13848. */
  13849. function (d1, d2) {
  13850. return !!(d1 && d2 && this._dateAdapter.getMonth(d1) == this._dateAdapter.getMonth(d2) &&
  13851. this._dateAdapter.getYear(d1) == this._dateAdapter.getYear(d2));
  13852. };
  13853. /**
  13854. * @param obj The object to check.
  13855. * @returns The given object if it is both a date instance and valid, otherwise null.
  13856. */
  13857. /**
  13858. * @private
  13859. * @param {?} obj The object to check.
  13860. * @return {?} The given object if it is both a date instance and valid, otherwise null.
  13861. */
  13862. MatMonthView.prototype._getValidDateOrNull = /**
  13863. * @private
  13864. * @param {?} obj The object to check.
  13865. * @return {?} The given object if it is both a date instance and valid, otherwise null.
  13866. */
  13867. function (obj) {
  13868. return (this._dateAdapter.isDateInstance(obj) && this._dateAdapter.isValid(obj)) ? obj : null;
  13869. };
  13870. /** Determines whether the user has the RTL layout direction. */
  13871. /**
  13872. * Determines whether the user has the RTL layout direction.
  13873. * @private
  13874. * @return {?}
  13875. */
  13876. MatMonthView.prototype._isRtl = /**
  13877. * Determines whether the user has the RTL layout direction.
  13878. * @private
  13879. * @return {?}
  13880. */
  13881. function () {
  13882. return this._dir && this._dir.value === 'rtl';
  13883. };
  13884. MatMonthView.decorators = [
  13885. { type: core.Component, args: [{selector: 'mat-month-view',
  13886. template: "<table class=\"mat-calendar-table\" role=\"presentation\"><thead class=\"mat-calendar-table-header\"><tr><th *ngFor=\"let day of _weekdays\" [attr.aria-label]=\"day.long\">{{day.narrow}}</th></tr><tr><th class=\"mat-calendar-table-header-divider\" colspan=\"7\" aria-hidden=\"true\"></th></tr></thead><tbody mat-calendar-body [label]=\"_monthLabel\" [rows]=\"_weeks\" [todayValue]=\"_todayDate\" [selectedValue]=\"_selectedDate\" [labelMinRequiredCells]=\"3\" [activeCell]=\"_dateAdapter.getDate(activeDate) - 1\" (selectedValueChange)=\"_dateSelected($event)\" (keydown)=\"_handleCalendarBodyKeydown($event)\"></tbody></table>",
  13887. exportAs: 'matMonthView',
  13888. encapsulation: core.ViewEncapsulation.None,
  13889. changeDetection: core.ChangeDetectionStrategy.OnPush
  13890. },] },
  13891. ];
  13892. /** @nocollapse */
  13893. MatMonthView.ctorParameters = function () { return [
  13894. { type: core.ChangeDetectorRef },
  13895. { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_DATE_FORMATS,] }] },
  13896. { type: DateAdapter, decorators: [{ type: core.Optional }] },
  13897. { type: bidi.Directionality, decorators: [{ type: core.Optional }] }
  13898. ]; };
  13899. MatMonthView.propDecorators = {
  13900. activeDate: [{ type: core.Input }],
  13901. selected: [{ type: core.Input }],
  13902. minDate: [{ type: core.Input }],
  13903. maxDate: [{ type: core.Input }],
  13904. dateFilter: [{ type: core.Input }],
  13905. dateClass: [{ type: core.Input }],
  13906. selectedChange: [{ type: core.Output }],
  13907. _userSelection: [{ type: core.Output }],
  13908. activeDateChange: [{ type: core.Output }],
  13909. _matCalendarBody: [{ type: core.ViewChild, args: [MatCalendarBody, { static: false },] }]
  13910. };
  13911. return MatMonthView;
  13912. }());
  13913. /**
  13914. * @fileoverview added by tsickle
  13915. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  13916. */
  13917. /** @type {?} */
  13918. var yearsPerPage = 24;
  13919. /** @type {?} */
  13920. var yearsPerRow = 4;
  13921. /**
  13922. * An internal component used to display a year selector in the datepicker.
  13923. * \@docs-private
  13924. * @template D
  13925. */
  13926. var MatMultiYearView = /** @class */ (function () {
  13927. function MatMultiYearView(_changeDetectorRef, _dateAdapter, _dir) {
  13928. this._changeDetectorRef = _changeDetectorRef;
  13929. this._dateAdapter = _dateAdapter;
  13930. this._dir = _dir;
  13931. /**
  13932. * Emits when a new year is selected.
  13933. */
  13934. this.selectedChange = new core.EventEmitter();
  13935. /**
  13936. * Emits the selected year. This doesn't imply a change on the selected date
  13937. */
  13938. this.yearSelected = new core.EventEmitter();
  13939. /**
  13940. * Emits when any date is activated.
  13941. */
  13942. this.activeDateChange = new core.EventEmitter();
  13943. if (!this._dateAdapter) {
  13944. throw createMissingDateImplError('DateAdapter');
  13945. }
  13946. this._activeDate = this._dateAdapter.today();
  13947. }
  13948. Object.defineProperty(MatMultiYearView.prototype, "activeDate", {
  13949. /** The date to display in this multi-year view (everything other than the year is ignored). */
  13950. get: /**
  13951. * The date to display in this multi-year view (everything other than the year is ignored).
  13952. * @return {?}
  13953. */
  13954. function () { return this._activeDate; },
  13955. set: /**
  13956. * @param {?} value
  13957. * @return {?}
  13958. */
  13959. function (value) {
  13960. /** @type {?} */
  13961. var oldActiveDate = this._activeDate;
  13962. /** @type {?} */
  13963. var validDate = this._getValidDateOrNull(this._dateAdapter.deserialize(value)) || this._dateAdapter.today();
  13964. this._activeDate = this._dateAdapter.clampDate(validDate, this.minDate, this.maxDate);
  13965. if (!isSameMultiYearView(this._dateAdapter, oldActiveDate, this._activeDate, this.minDate, this.maxDate)) {
  13966. this._init();
  13967. }
  13968. },
  13969. enumerable: true,
  13970. configurable: true
  13971. });
  13972. Object.defineProperty(MatMultiYearView.prototype, "selected", {
  13973. /** The currently selected date. */
  13974. get: /**
  13975. * The currently selected date.
  13976. * @return {?}
  13977. */
  13978. function () { return this._selected; },
  13979. set: /**
  13980. * @param {?} value
  13981. * @return {?}
  13982. */
  13983. function (value) {
  13984. this._selected = this._getValidDateOrNull(this._dateAdapter.deserialize(value));
  13985. this._selectedYear = this._selected && this._dateAdapter.getYear(this._selected);
  13986. },
  13987. enumerable: true,
  13988. configurable: true
  13989. });
  13990. Object.defineProperty(MatMultiYearView.prototype, "minDate", {
  13991. /** The minimum selectable date. */
  13992. get: /**
  13993. * The minimum selectable date.
  13994. * @return {?}
  13995. */
  13996. function () { return this._minDate; },
  13997. set: /**
  13998. * @param {?} value
  13999. * @return {?}
  14000. */
  14001. function (value) {
  14002. this._minDate = this._getValidDateOrNull(this._dateAdapter.deserialize(value));
  14003. },
  14004. enumerable: true,
  14005. configurable: true
  14006. });
  14007. Object.defineProperty(MatMultiYearView.prototype, "maxDate", {
  14008. /** The maximum selectable date. */
  14009. get: /**
  14010. * The maximum selectable date.
  14011. * @return {?}
  14012. */
  14013. function () { return this._maxDate; },
  14014. set: /**
  14015. * @param {?} value
  14016. * @return {?}
  14017. */
  14018. function (value) {
  14019. this._maxDate = this._getValidDateOrNull(this._dateAdapter.deserialize(value));
  14020. },
  14021. enumerable: true,
  14022. configurable: true
  14023. });
  14024. /**
  14025. * @return {?}
  14026. */
  14027. MatMultiYearView.prototype.ngAfterContentInit = /**
  14028. * @return {?}
  14029. */
  14030. function () {
  14031. this._init();
  14032. };
  14033. /** Initializes this multi-year view. */
  14034. /**
  14035. * Initializes this multi-year view.
  14036. * @return {?}
  14037. */
  14038. MatMultiYearView.prototype._init = /**
  14039. * Initializes this multi-year view.
  14040. * @return {?}
  14041. */
  14042. function () {
  14043. var _this = this;
  14044. this._todayYear = this._dateAdapter.getYear(this._dateAdapter.today());
  14045. // We want a range years such that we maximize the number of
  14046. // enabled dates visible at once. This prevents issues where the minimum year
  14047. // is the last item of a page OR the maximum year is the first item of a page.
  14048. // The offset from the active year to the "slot" for the starting year is the
  14049. // *actual* first rendered year in the multi-year view.
  14050. /** @type {?} */
  14051. var activeYear = this._dateAdapter.getYear(this._activeDate);
  14052. /** @type {?} */
  14053. var minYearOfPage = activeYear - getActiveOffset(this._dateAdapter, this.activeDate, this.minDate, this.maxDate);
  14054. this._years = [];
  14055. for (var i = 0, row = []; i < yearsPerPage; i++) {
  14056. row.push(minYearOfPage + i);
  14057. if (row.length == yearsPerRow) {
  14058. this._years.push(row.map((/**
  14059. * @param {?} year
  14060. * @return {?}
  14061. */
  14062. function (year) { return _this._createCellForYear(year); })));
  14063. row = [];
  14064. }
  14065. }
  14066. this._changeDetectorRef.markForCheck();
  14067. };
  14068. /** Handles when a new year is selected. */
  14069. /**
  14070. * Handles when a new year is selected.
  14071. * @param {?} year
  14072. * @return {?}
  14073. */
  14074. MatMultiYearView.prototype._yearSelected = /**
  14075. * Handles when a new year is selected.
  14076. * @param {?} year
  14077. * @return {?}
  14078. */
  14079. function (year) {
  14080. this.yearSelected.emit(this._dateAdapter.createDate(year, 0, 1));
  14081. /** @type {?} */
  14082. var month = this._dateAdapter.getMonth(this.activeDate);
  14083. /** @type {?} */
  14084. var daysInMonth = this._dateAdapter.getNumDaysInMonth(this._dateAdapter.createDate(year, month, 1));
  14085. this.selectedChange.emit(this._dateAdapter.createDate(year, month, Math.min(this._dateAdapter.getDate(this.activeDate), daysInMonth)));
  14086. };
  14087. /** Handles keydown events on the calendar body when calendar is in multi-year view. */
  14088. /**
  14089. * Handles keydown events on the calendar body when calendar is in multi-year view.
  14090. * @param {?} event
  14091. * @return {?}
  14092. */
  14093. MatMultiYearView.prototype._handleCalendarBodyKeydown = /**
  14094. * Handles keydown events on the calendar body when calendar is in multi-year view.
  14095. * @param {?} event
  14096. * @return {?}
  14097. */
  14098. function (event) {
  14099. /** @type {?} */
  14100. var oldActiveDate = this._activeDate;
  14101. /** @type {?} */
  14102. var isRtl = this._isRtl();
  14103. switch (event.keyCode) {
  14104. case keycodes.LEFT_ARROW:
  14105. this.activeDate = this._dateAdapter.addCalendarYears(this._activeDate, isRtl ? 1 : -1);
  14106. break;
  14107. case keycodes.RIGHT_ARROW:
  14108. this.activeDate = this._dateAdapter.addCalendarYears(this._activeDate, isRtl ? -1 : 1);
  14109. break;
  14110. case keycodes.UP_ARROW:
  14111. this.activeDate = this._dateAdapter.addCalendarYears(this._activeDate, -yearsPerRow);
  14112. break;
  14113. case keycodes.DOWN_ARROW:
  14114. this.activeDate = this._dateAdapter.addCalendarYears(this._activeDate, yearsPerRow);
  14115. break;
  14116. case keycodes.HOME:
  14117. this.activeDate = this._dateAdapter.addCalendarYears(this._activeDate, -getActiveOffset(this._dateAdapter, this.activeDate, this.minDate, this.maxDate));
  14118. break;
  14119. case keycodes.END:
  14120. this.activeDate = this._dateAdapter.addCalendarYears(this._activeDate, yearsPerPage - getActiveOffset(this._dateAdapter, this.activeDate, this.minDate, this.maxDate) - 1);
  14121. break;
  14122. case keycodes.PAGE_UP:
  14123. this.activeDate =
  14124. this._dateAdapter.addCalendarYears(this._activeDate, event.altKey ? -yearsPerPage * 10 : -yearsPerPage);
  14125. break;
  14126. case keycodes.PAGE_DOWN:
  14127. this.activeDate =
  14128. this._dateAdapter.addCalendarYears(this._activeDate, event.altKey ? yearsPerPage * 10 : yearsPerPage);
  14129. break;
  14130. case keycodes.ENTER:
  14131. case keycodes.SPACE:
  14132. this._yearSelected(this._dateAdapter.getYear(this._activeDate));
  14133. break;
  14134. default:
  14135. // Don't prevent default or focus active cell on keys that we don't explicitly handle.
  14136. return;
  14137. }
  14138. if (this._dateAdapter.compareDate(oldActiveDate, this.activeDate)) {
  14139. this.activeDateChange.emit(this.activeDate);
  14140. }
  14141. this._focusActiveCell();
  14142. // Prevent unexpected default actions such as form submission.
  14143. event.preventDefault();
  14144. };
  14145. /**
  14146. * @return {?}
  14147. */
  14148. MatMultiYearView.prototype._getActiveCell = /**
  14149. * @return {?}
  14150. */
  14151. function () {
  14152. return getActiveOffset(this._dateAdapter, this.activeDate, this.minDate, this.maxDate);
  14153. };
  14154. /** Focuses the active cell after the microtask queue is empty. */
  14155. /**
  14156. * Focuses the active cell after the microtask queue is empty.
  14157. * @return {?}
  14158. */
  14159. MatMultiYearView.prototype._focusActiveCell = /**
  14160. * Focuses the active cell after the microtask queue is empty.
  14161. * @return {?}
  14162. */
  14163. function () {
  14164. this._matCalendarBody._focusActiveCell();
  14165. };
  14166. /** Creates an MatCalendarCell for the given year. */
  14167. /**
  14168. * Creates an MatCalendarCell for the given year.
  14169. * @private
  14170. * @param {?} year
  14171. * @return {?}
  14172. */
  14173. MatMultiYearView.prototype._createCellForYear = /**
  14174. * Creates an MatCalendarCell for the given year.
  14175. * @private
  14176. * @param {?} year
  14177. * @return {?}
  14178. */
  14179. function (year) {
  14180. /** @type {?} */
  14181. var yearName = this._dateAdapter.getYearName(this._dateAdapter.createDate(year, 0, 1));
  14182. return new MatCalendarCell(year, yearName, yearName, this._shouldEnableYear(year));
  14183. };
  14184. /** Whether the given year is enabled. */
  14185. /**
  14186. * Whether the given year is enabled.
  14187. * @private
  14188. * @param {?} year
  14189. * @return {?}
  14190. */
  14191. MatMultiYearView.prototype._shouldEnableYear = /**
  14192. * Whether the given year is enabled.
  14193. * @private
  14194. * @param {?} year
  14195. * @return {?}
  14196. */
  14197. function (year) {
  14198. // disable if the year is greater than maxDate lower than minDate
  14199. if (year === undefined || year === null ||
  14200. (this.maxDate && year > this._dateAdapter.getYear(this.maxDate)) ||
  14201. (this.minDate && year < this._dateAdapter.getYear(this.minDate))) {
  14202. return false;
  14203. }
  14204. // enable if it reaches here and there's no filter defined
  14205. if (!this.dateFilter) {
  14206. return true;
  14207. }
  14208. /** @type {?} */
  14209. var firstOfYear = this._dateAdapter.createDate(year, 0, 1);
  14210. // If any date in the year is enabled count the year as enabled.
  14211. for (var date = firstOfYear; this._dateAdapter.getYear(date) == year; date = this._dateAdapter.addCalendarDays(date, 1)) {
  14212. if (this.dateFilter(date)) {
  14213. return true;
  14214. }
  14215. }
  14216. return false;
  14217. };
  14218. /**
  14219. * @param obj The object to check.
  14220. * @returns The given object if it is both a date instance and valid, otherwise null.
  14221. */
  14222. /**
  14223. * @private
  14224. * @param {?} obj The object to check.
  14225. * @return {?} The given object if it is both a date instance and valid, otherwise null.
  14226. */
  14227. MatMultiYearView.prototype._getValidDateOrNull = /**
  14228. * @private
  14229. * @param {?} obj The object to check.
  14230. * @return {?} The given object if it is both a date instance and valid, otherwise null.
  14231. */
  14232. function (obj) {
  14233. return (this._dateAdapter.isDateInstance(obj) && this._dateAdapter.isValid(obj)) ? obj : null;
  14234. };
  14235. /** Determines whether the user has the RTL layout direction. */
  14236. /**
  14237. * Determines whether the user has the RTL layout direction.
  14238. * @private
  14239. * @return {?}
  14240. */
  14241. MatMultiYearView.prototype._isRtl = /**
  14242. * Determines whether the user has the RTL layout direction.
  14243. * @private
  14244. * @return {?}
  14245. */
  14246. function () {
  14247. return this._dir && this._dir.value === 'rtl';
  14248. };
  14249. MatMultiYearView.decorators = [
  14250. { type: core.Component, args: [{selector: 'mat-multi-year-view',
  14251. template: "<table class=\"mat-calendar-table\" role=\"presentation\"><thead class=\"mat-calendar-table-header\"><tr><th class=\"mat-calendar-table-header-divider\" colspan=\"4\"></th></tr></thead><tbody mat-calendar-body [rows]=\"_years\" [todayValue]=\"_todayYear\" [selectedValue]=\"_selectedYear\" [numCols]=\"4\" [cellAspectRatio]=\"4 / 7\" [activeCell]=\"_getActiveCell()\" (selectedValueChange)=\"_yearSelected($event)\" (keydown)=\"_handleCalendarBodyKeydown($event)\"></tbody></table>",
  14252. exportAs: 'matMultiYearView',
  14253. encapsulation: core.ViewEncapsulation.None,
  14254. changeDetection: core.ChangeDetectionStrategy.OnPush
  14255. },] },
  14256. ];
  14257. /** @nocollapse */
  14258. MatMultiYearView.ctorParameters = function () { return [
  14259. { type: core.ChangeDetectorRef },
  14260. { type: DateAdapter, decorators: [{ type: core.Optional }] },
  14261. { type: bidi.Directionality, decorators: [{ type: core.Optional }] }
  14262. ]; };
  14263. MatMultiYearView.propDecorators = {
  14264. activeDate: [{ type: core.Input }],
  14265. selected: [{ type: core.Input }],
  14266. minDate: [{ type: core.Input }],
  14267. maxDate: [{ type: core.Input }],
  14268. dateFilter: [{ type: core.Input }],
  14269. selectedChange: [{ type: core.Output }],
  14270. yearSelected: [{ type: core.Output }],
  14271. activeDateChange: [{ type: core.Output }],
  14272. _matCalendarBody: [{ type: core.ViewChild, args: [MatCalendarBody, { static: false },] }]
  14273. };
  14274. return MatMultiYearView;
  14275. }());
  14276. /**
  14277. * @template D
  14278. * @param {?} dateAdapter
  14279. * @param {?} date1
  14280. * @param {?} date2
  14281. * @param {?} minDate
  14282. * @param {?} maxDate
  14283. * @return {?}
  14284. */
  14285. function isSameMultiYearView(dateAdapter, date1, date2, minDate, maxDate) {
  14286. /** @type {?} */
  14287. var year1 = dateAdapter.getYear(date1);
  14288. /** @type {?} */
  14289. var year2 = dateAdapter.getYear(date2);
  14290. /** @type {?} */
  14291. var startingYear = getStartingYear(dateAdapter, minDate, maxDate);
  14292. return Math.floor((year1 - startingYear) / yearsPerPage) ===
  14293. Math.floor((year2 - startingYear) / yearsPerPage);
  14294. }
  14295. /**
  14296. * When the multi-year view is first opened, the active year will be in view.
  14297. * So we compute how many years are between the active year and the *slot* where our
  14298. * "startingYear" will render when paged into view.
  14299. * @template D
  14300. * @param {?} dateAdapter
  14301. * @param {?} activeDate
  14302. * @param {?} minDate
  14303. * @param {?} maxDate
  14304. * @return {?}
  14305. */
  14306. function getActiveOffset(dateAdapter, activeDate, minDate, maxDate) {
  14307. /** @type {?} */
  14308. var activeYear = dateAdapter.getYear(activeDate);
  14309. return euclideanModulo((activeYear - getStartingYear(dateAdapter, minDate, maxDate)), yearsPerPage);
  14310. }
  14311. /**
  14312. * We pick a "starting" year such that either the maximum year would be at the end
  14313. * or the minimum year would be at the beginning of a page.
  14314. * @template D
  14315. * @param {?} dateAdapter
  14316. * @param {?} minDate
  14317. * @param {?} maxDate
  14318. * @return {?}
  14319. */
  14320. function getStartingYear(dateAdapter, minDate, maxDate) {
  14321. /** @type {?} */
  14322. var startingYear = 0;
  14323. if (maxDate) {
  14324. /** @type {?} */
  14325. var maxYear = dateAdapter.getYear(maxDate);
  14326. startingYear = maxYear - yearsPerPage + 1;
  14327. }
  14328. else if (minDate) {
  14329. startingYear = dateAdapter.getYear(minDate);
  14330. }
  14331. return startingYear;
  14332. }
  14333. /**
  14334. * Gets remainder that is non-negative, even if first number is negative
  14335. * @param {?} a
  14336. * @param {?} b
  14337. * @return {?}
  14338. */
  14339. function euclideanModulo(a, b) {
  14340. return (a % b + b) % b;
  14341. }
  14342. /**
  14343. * @fileoverview added by tsickle
  14344. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  14345. */
  14346. /**
  14347. * An internal component used to display a single year in the datepicker.
  14348. * \@docs-private
  14349. * @template D
  14350. */
  14351. var MatYearView = /** @class */ (function () {
  14352. function MatYearView(_changeDetectorRef, _dateFormats, _dateAdapter, _dir) {
  14353. this._changeDetectorRef = _changeDetectorRef;
  14354. this._dateFormats = _dateFormats;
  14355. this._dateAdapter = _dateAdapter;
  14356. this._dir = _dir;
  14357. /**
  14358. * Emits when a new month is selected.
  14359. */
  14360. this.selectedChange = new core.EventEmitter();
  14361. /**
  14362. * Emits the selected month. This doesn't imply a change on the selected date
  14363. */
  14364. this.monthSelected = new core.EventEmitter();
  14365. /**
  14366. * Emits when any date is activated.
  14367. */
  14368. this.activeDateChange = new core.EventEmitter();
  14369. if (!this._dateAdapter) {
  14370. throw createMissingDateImplError('DateAdapter');
  14371. }
  14372. if (!this._dateFormats) {
  14373. throw createMissingDateImplError('MAT_DATE_FORMATS');
  14374. }
  14375. this._activeDate = this._dateAdapter.today();
  14376. }
  14377. Object.defineProperty(MatYearView.prototype, "activeDate", {
  14378. /** The date to display in this year view (everything other than the year is ignored). */
  14379. get: /**
  14380. * The date to display in this year view (everything other than the year is ignored).
  14381. * @return {?}
  14382. */
  14383. function () { return this._activeDate; },
  14384. set: /**
  14385. * @param {?} value
  14386. * @return {?}
  14387. */
  14388. function (value) {
  14389. /** @type {?} */
  14390. var oldActiveDate = this._activeDate;
  14391. /** @type {?} */
  14392. var validDate = this._getValidDateOrNull(this._dateAdapter.deserialize(value)) || this._dateAdapter.today();
  14393. this._activeDate = this._dateAdapter.clampDate(validDate, this.minDate, this.maxDate);
  14394. if (this._dateAdapter.getYear(oldActiveDate) !== this._dateAdapter.getYear(this._activeDate)) {
  14395. this._init();
  14396. }
  14397. },
  14398. enumerable: true,
  14399. configurable: true
  14400. });
  14401. Object.defineProperty(MatYearView.prototype, "selected", {
  14402. /** The currently selected date. */
  14403. get: /**
  14404. * The currently selected date.
  14405. * @return {?}
  14406. */
  14407. function () { return this._selected; },
  14408. set: /**
  14409. * @param {?} value
  14410. * @return {?}
  14411. */
  14412. function (value) {
  14413. this._selected = this._getValidDateOrNull(this._dateAdapter.deserialize(value));
  14414. this._selectedMonth = this._getMonthInCurrentYear(this._selected);
  14415. },
  14416. enumerable: true,
  14417. configurable: true
  14418. });
  14419. Object.defineProperty(MatYearView.prototype, "minDate", {
  14420. /** The minimum selectable date. */
  14421. get: /**
  14422. * The minimum selectable date.
  14423. * @return {?}
  14424. */
  14425. function () { return this._minDate; },
  14426. set: /**
  14427. * @param {?} value
  14428. * @return {?}
  14429. */
  14430. function (value) {
  14431. this._minDate = this._getValidDateOrNull(this._dateAdapter.deserialize(value));
  14432. },
  14433. enumerable: true,
  14434. configurable: true
  14435. });
  14436. Object.defineProperty(MatYearView.prototype, "maxDate", {
  14437. /** The maximum selectable date. */
  14438. get: /**
  14439. * The maximum selectable date.
  14440. * @return {?}
  14441. */
  14442. function () { return this._maxDate; },
  14443. set: /**
  14444. * @param {?} value
  14445. * @return {?}
  14446. */
  14447. function (value) {
  14448. this._maxDate = this._getValidDateOrNull(this._dateAdapter.deserialize(value));
  14449. },
  14450. enumerable: true,
  14451. configurable: true
  14452. });
  14453. /**
  14454. * @return {?}
  14455. */
  14456. MatYearView.prototype.ngAfterContentInit = /**
  14457. * @return {?}
  14458. */
  14459. function () {
  14460. this._init();
  14461. };
  14462. /** Handles when a new month is selected. */
  14463. /**
  14464. * Handles when a new month is selected.
  14465. * @param {?} month
  14466. * @return {?}
  14467. */
  14468. MatYearView.prototype._monthSelected = /**
  14469. * Handles when a new month is selected.
  14470. * @param {?} month
  14471. * @return {?}
  14472. */
  14473. function (month) {
  14474. /** @type {?} */
  14475. var normalizedDate = this._dateAdapter.createDate(this._dateAdapter.getYear(this.activeDate), month, 1);
  14476. this.monthSelected.emit(normalizedDate);
  14477. /** @type {?} */
  14478. var daysInMonth = this._dateAdapter.getNumDaysInMonth(normalizedDate);
  14479. this.selectedChange.emit(this._dateAdapter.createDate(this._dateAdapter.getYear(this.activeDate), month, Math.min(this._dateAdapter.getDate(this.activeDate), daysInMonth)));
  14480. };
  14481. /** Handles keydown events on the calendar body when calendar is in year view. */
  14482. /**
  14483. * Handles keydown events on the calendar body when calendar is in year view.
  14484. * @param {?} event
  14485. * @return {?}
  14486. */
  14487. MatYearView.prototype._handleCalendarBodyKeydown = /**
  14488. * Handles keydown events on the calendar body when calendar is in year view.
  14489. * @param {?} event
  14490. * @return {?}
  14491. */
  14492. function (event) {
  14493. // TODO(mmalerba): We currently allow keyboard navigation to disabled dates, but just prevent
  14494. // disabled ones from being selected. This may not be ideal, we should look into whether
  14495. // navigation should skip over disabled dates, and if so, how to implement that efficiently.
  14496. // TODO(mmalerba): We currently allow keyboard navigation to disabled dates, but just prevent
  14497. // disabled ones from being selected. This may not be ideal, we should look into whether
  14498. // navigation should skip over disabled dates, and if so, how to implement that efficiently.
  14499. /** @type {?} */
  14500. var oldActiveDate = this._activeDate;
  14501. /** @type {?} */
  14502. var isRtl = this._isRtl();
  14503. switch (event.keyCode) {
  14504. case keycodes.LEFT_ARROW:
  14505. this.activeDate = this._dateAdapter.addCalendarMonths(this._activeDate, isRtl ? 1 : -1);
  14506. break;
  14507. case keycodes.RIGHT_ARROW:
  14508. this.activeDate = this._dateAdapter.addCalendarMonths(this._activeDate, isRtl ? -1 : 1);
  14509. break;
  14510. case keycodes.UP_ARROW:
  14511. this.activeDate = this._dateAdapter.addCalendarMonths(this._activeDate, -4);
  14512. break;
  14513. case keycodes.DOWN_ARROW:
  14514. this.activeDate = this._dateAdapter.addCalendarMonths(this._activeDate, 4);
  14515. break;
  14516. case keycodes.HOME:
  14517. this.activeDate = this._dateAdapter.addCalendarMonths(this._activeDate, -this._dateAdapter.getMonth(this._activeDate));
  14518. break;
  14519. case keycodes.END:
  14520. this.activeDate = this._dateAdapter.addCalendarMonths(this._activeDate, 11 - this._dateAdapter.getMonth(this._activeDate));
  14521. break;
  14522. case keycodes.PAGE_UP:
  14523. this.activeDate =
  14524. this._dateAdapter.addCalendarYears(this._activeDate, event.altKey ? -10 : -1);
  14525. break;
  14526. case keycodes.PAGE_DOWN:
  14527. this.activeDate =
  14528. this._dateAdapter.addCalendarYears(this._activeDate, event.altKey ? 10 : 1);
  14529. break;
  14530. case keycodes.ENTER:
  14531. case keycodes.SPACE:
  14532. this._monthSelected(this._dateAdapter.getMonth(this._activeDate));
  14533. break;
  14534. default:
  14535. // Don't prevent default or focus active cell on keys that we don't explicitly handle.
  14536. return;
  14537. }
  14538. if (this._dateAdapter.compareDate(oldActiveDate, this.activeDate)) {
  14539. this.activeDateChange.emit(this.activeDate);
  14540. }
  14541. this._focusActiveCell();
  14542. // Prevent unexpected default actions such as form submission.
  14543. event.preventDefault();
  14544. };
  14545. /** Initializes this year view. */
  14546. /**
  14547. * Initializes this year view.
  14548. * @return {?}
  14549. */
  14550. MatYearView.prototype._init = /**
  14551. * Initializes this year view.
  14552. * @return {?}
  14553. */
  14554. function () {
  14555. var _this = this;
  14556. this._selectedMonth = this._getMonthInCurrentYear(this.selected);
  14557. this._todayMonth = this._getMonthInCurrentYear(this._dateAdapter.today());
  14558. this._yearLabel = this._dateAdapter.getYearName(this.activeDate);
  14559. /** @type {?} */
  14560. var monthNames = this._dateAdapter.getMonthNames('short');
  14561. // First row of months only contains 5 elements so we can fit the year label on the same row.
  14562. this._months = [[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11]].map((/**
  14563. * @param {?} row
  14564. * @return {?}
  14565. */
  14566. function (row) { return row.map((/**
  14567. * @param {?} month
  14568. * @return {?}
  14569. */
  14570. function (month) { return _this._createCellForMonth(month, monthNames[month]); })); }));
  14571. this._changeDetectorRef.markForCheck();
  14572. };
  14573. /** Focuses the active cell after the microtask queue is empty. */
  14574. /**
  14575. * Focuses the active cell after the microtask queue is empty.
  14576. * @return {?}
  14577. */
  14578. MatYearView.prototype._focusActiveCell = /**
  14579. * Focuses the active cell after the microtask queue is empty.
  14580. * @return {?}
  14581. */
  14582. function () {
  14583. this._matCalendarBody._focusActiveCell();
  14584. };
  14585. /**
  14586. * Gets the month in this year that the given Date falls on.
  14587. * Returns null if the given Date is in another year.
  14588. */
  14589. /**
  14590. * Gets the month in this year that the given Date falls on.
  14591. * Returns null if the given Date is in another year.
  14592. * @private
  14593. * @param {?} date
  14594. * @return {?}
  14595. */
  14596. MatYearView.prototype._getMonthInCurrentYear = /**
  14597. * Gets the month in this year that the given Date falls on.
  14598. * Returns null if the given Date is in another year.
  14599. * @private
  14600. * @param {?} date
  14601. * @return {?}
  14602. */
  14603. function (date) {
  14604. return date && this._dateAdapter.getYear(date) == this._dateAdapter.getYear(this.activeDate) ?
  14605. this._dateAdapter.getMonth(date) : null;
  14606. };
  14607. /** Creates an MatCalendarCell for the given month. */
  14608. /**
  14609. * Creates an MatCalendarCell for the given month.
  14610. * @private
  14611. * @param {?} month
  14612. * @param {?} monthName
  14613. * @return {?}
  14614. */
  14615. MatYearView.prototype._createCellForMonth = /**
  14616. * Creates an MatCalendarCell for the given month.
  14617. * @private
  14618. * @param {?} month
  14619. * @param {?} monthName
  14620. * @return {?}
  14621. */
  14622. function (month, monthName) {
  14623. /** @type {?} */
  14624. var ariaLabel = this._dateAdapter.format(this._dateAdapter.createDate(this._dateAdapter.getYear(this.activeDate), month, 1), this._dateFormats.display.monthYearA11yLabel);
  14625. return new MatCalendarCell(month, monthName.toLocaleUpperCase(), ariaLabel, this._shouldEnableMonth(month));
  14626. };
  14627. /** Whether the given month is enabled. */
  14628. /**
  14629. * Whether the given month is enabled.
  14630. * @private
  14631. * @param {?} month
  14632. * @return {?}
  14633. */
  14634. MatYearView.prototype._shouldEnableMonth = /**
  14635. * Whether the given month is enabled.
  14636. * @private
  14637. * @param {?} month
  14638. * @return {?}
  14639. */
  14640. function (month) {
  14641. /** @type {?} */
  14642. var activeYear = this._dateAdapter.getYear(this.activeDate);
  14643. if (month === undefined || month === null ||
  14644. this._isYearAndMonthAfterMaxDate(activeYear, month) ||
  14645. this._isYearAndMonthBeforeMinDate(activeYear, month)) {
  14646. return false;
  14647. }
  14648. if (!this.dateFilter) {
  14649. return true;
  14650. }
  14651. /** @type {?} */
  14652. var firstOfMonth = this._dateAdapter.createDate(activeYear, month, 1);
  14653. // If any date in the month is enabled count the month as enabled.
  14654. for (var date = firstOfMonth; this._dateAdapter.getMonth(date) == month; date = this._dateAdapter.addCalendarDays(date, 1)) {
  14655. if (this.dateFilter(date)) {
  14656. return true;
  14657. }
  14658. }
  14659. return false;
  14660. };
  14661. /**
  14662. * Tests whether the combination month/year is after this.maxDate, considering
  14663. * just the month and year of this.maxDate
  14664. */
  14665. /**
  14666. * Tests whether the combination month/year is after this.maxDate, considering
  14667. * just the month and year of this.maxDate
  14668. * @private
  14669. * @param {?} year
  14670. * @param {?} month
  14671. * @return {?}
  14672. */
  14673. MatYearView.prototype._isYearAndMonthAfterMaxDate = /**
  14674. * Tests whether the combination month/year is after this.maxDate, considering
  14675. * just the month and year of this.maxDate
  14676. * @private
  14677. * @param {?} year
  14678. * @param {?} month
  14679. * @return {?}
  14680. */
  14681. function (year, month) {
  14682. if (this.maxDate) {
  14683. /** @type {?} */
  14684. var maxYear = this._dateAdapter.getYear(this.maxDate);
  14685. /** @type {?} */
  14686. var maxMonth = this._dateAdapter.getMonth(this.maxDate);
  14687. return year > maxYear || (year === maxYear && month > maxMonth);
  14688. }
  14689. return false;
  14690. };
  14691. /**
  14692. * Tests whether the combination month/year is before this.minDate, considering
  14693. * just the month and year of this.minDate
  14694. */
  14695. /**
  14696. * Tests whether the combination month/year is before this.minDate, considering
  14697. * just the month and year of this.minDate
  14698. * @private
  14699. * @param {?} year
  14700. * @param {?} month
  14701. * @return {?}
  14702. */
  14703. MatYearView.prototype._isYearAndMonthBeforeMinDate = /**
  14704. * Tests whether the combination month/year is before this.minDate, considering
  14705. * just the month and year of this.minDate
  14706. * @private
  14707. * @param {?} year
  14708. * @param {?} month
  14709. * @return {?}
  14710. */
  14711. function (year, month) {
  14712. if (this.minDate) {
  14713. /** @type {?} */
  14714. var minYear = this._dateAdapter.getYear(this.minDate);
  14715. /** @type {?} */
  14716. var minMonth = this._dateAdapter.getMonth(this.minDate);
  14717. return year < minYear || (year === minYear && month < minMonth);
  14718. }
  14719. return false;
  14720. };
  14721. /**
  14722. * @param obj The object to check.
  14723. * @returns The given object if it is both a date instance and valid, otherwise null.
  14724. */
  14725. /**
  14726. * @private
  14727. * @param {?} obj The object to check.
  14728. * @return {?} The given object if it is both a date instance and valid, otherwise null.
  14729. */
  14730. MatYearView.prototype._getValidDateOrNull = /**
  14731. * @private
  14732. * @param {?} obj The object to check.
  14733. * @return {?} The given object if it is both a date instance and valid, otherwise null.
  14734. */
  14735. function (obj) {
  14736. return (this._dateAdapter.isDateInstance(obj) && this._dateAdapter.isValid(obj)) ? obj : null;
  14737. };
  14738. /** Determines whether the user has the RTL layout direction. */
  14739. /**
  14740. * Determines whether the user has the RTL layout direction.
  14741. * @private
  14742. * @return {?}
  14743. */
  14744. MatYearView.prototype._isRtl = /**
  14745. * Determines whether the user has the RTL layout direction.
  14746. * @private
  14747. * @return {?}
  14748. */
  14749. function () {
  14750. return this._dir && this._dir.value === 'rtl';
  14751. };
  14752. MatYearView.decorators = [
  14753. { type: core.Component, args: [{selector: 'mat-year-view',
  14754. template: "<table class=\"mat-calendar-table\" role=\"presentation\"><thead class=\"mat-calendar-table-header\"><tr><th class=\"mat-calendar-table-header-divider\" colspan=\"4\"></th></tr></thead><tbody mat-calendar-body [label]=\"_yearLabel\" [rows]=\"_months\" [todayValue]=\"_todayMonth\" [selectedValue]=\"_selectedMonth\" [labelMinRequiredCells]=\"2\" [numCols]=\"4\" [cellAspectRatio]=\"4 / 7\" [activeCell]=\"_dateAdapter.getMonth(activeDate)\" (selectedValueChange)=\"_monthSelected($event)\" (keydown)=\"_handleCalendarBodyKeydown($event)\"></tbody></table>",
  14755. exportAs: 'matYearView',
  14756. encapsulation: core.ViewEncapsulation.None,
  14757. changeDetection: core.ChangeDetectionStrategy.OnPush
  14758. },] },
  14759. ];
  14760. /** @nocollapse */
  14761. MatYearView.ctorParameters = function () { return [
  14762. { type: core.ChangeDetectorRef },
  14763. { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_DATE_FORMATS,] }] },
  14764. { type: DateAdapter, decorators: [{ type: core.Optional }] },
  14765. { type: bidi.Directionality, decorators: [{ type: core.Optional }] }
  14766. ]; };
  14767. MatYearView.propDecorators = {
  14768. activeDate: [{ type: core.Input }],
  14769. selected: [{ type: core.Input }],
  14770. minDate: [{ type: core.Input }],
  14771. maxDate: [{ type: core.Input }],
  14772. dateFilter: [{ type: core.Input }],
  14773. selectedChange: [{ type: core.Output }],
  14774. monthSelected: [{ type: core.Output }],
  14775. activeDateChange: [{ type: core.Output }],
  14776. _matCalendarBody: [{ type: core.ViewChild, args: [MatCalendarBody, { static: false },] }]
  14777. };
  14778. return MatYearView;
  14779. }());
  14780. /**
  14781. * @fileoverview added by tsickle
  14782. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  14783. */
  14784. /**
  14785. * Default header for MatCalendar
  14786. * @template D
  14787. */
  14788. var MatCalendarHeader = /** @class */ (function () {
  14789. function MatCalendarHeader(_intl, calendar, _dateAdapter, _dateFormats, changeDetectorRef) {
  14790. this._intl = _intl;
  14791. this.calendar = calendar;
  14792. this._dateAdapter = _dateAdapter;
  14793. this._dateFormats = _dateFormats;
  14794. this.calendar.stateChanges.subscribe((/**
  14795. * @return {?}
  14796. */
  14797. function () { return changeDetectorRef.markForCheck(); }));
  14798. }
  14799. Object.defineProperty(MatCalendarHeader.prototype, "periodButtonText", {
  14800. /** The label for the current calendar view. */
  14801. get: /**
  14802. * The label for the current calendar view.
  14803. * @return {?}
  14804. */
  14805. function () {
  14806. if (this.calendar.currentView == 'month') {
  14807. return this._dateAdapter
  14808. .format(this.calendar.activeDate, this._dateFormats.display.monthYearLabel)
  14809. .toLocaleUpperCase();
  14810. }
  14811. if (this.calendar.currentView == 'year') {
  14812. return this._dateAdapter.getYearName(this.calendar.activeDate);
  14813. }
  14814. // The offset from the active year to the "slot" for the starting year is the
  14815. // *actual* first rendered year in the multi-year view, and the last year is
  14816. // just yearsPerPage - 1 away.
  14817. /** @type {?} */
  14818. var activeYear = this._dateAdapter.getYear(this.calendar.activeDate);
  14819. /** @type {?} */
  14820. var minYearOfPage = activeYear - getActiveOffset(this._dateAdapter, this.calendar.activeDate, this.calendar.minDate, this.calendar.maxDate);
  14821. /** @type {?} */
  14822. var maxYearOfPage = minYearOfPage + yearsPerPage - 1;
  14823. return minYearOfPage + " \u2013 " + maxYearOfPage;
  14824. },
  14825. enumerable: true,
  14826. configurable: true
  14827. });
  14828. Object.defineProperty(MatCalendarHeader.prototype, "periodButtonLabel", {
  14829. get: /**
  14830. * @return {?}
  14831. */
  14832. function () {
  14833. return this.calendar.currentView == 'month' ?
  14834. this._intl.switchToMultiYearViewLabel : this._intl.switchToMonthViewLabel;
  14835. },
  14836. enumerable: true,
  14837. configurable: true
  14838. });
  14839. Object.defineProperty(MatCalendarHeader.prototype, "prevButtonLabel", {
  14840. /** The label for the previous button. */
  14841. get: /**
  14842. * The label for the previous button.
  14843. * @return {?}
  14844. */
  14845. function () {
  14846. return {
  14847. 'month': this._intl.prevMonthLabel,
  14848. 'year': this._intl.prevYearLabel,
  14849. 'multi-year': this._intl.prevMultiYearLabel
  14850. }[this.calendar.currentView];
  14851. },
  14852. enumerable: true,
  14853. configurable: true
  14854. });
  14855. Object.defineProperty(MatCalendarHeader.prototype, "nextButtonLabel", {
  14856. /** The label for the next button. */
  14857. get: /**
  14858. * The label for the next button.
  14859. * @return {?}
  14860. */
  14861. function () {
  14862. return {
  14863. 'month': this._intl.nextMonthLabel,
  14864. 'year': this._intl.nextYearLabel,
  14865. 'multi-year': this._intl.nextMultiYearLabel
  14866. }[this.calendar.currentView];
  14867. },
  14868. enumerable: true,
  14869. configurable: true
  14870. });
  14871. /** Handles user clicks on the period label. */
  14872. /**
  14873. * Handles user clicks on the period label.
  14874. * @return {?}
  14875. */
  14876. MatCalendarHeader.prototype.currentPeriodClicked = /**
  14877. * Handles user clicks on the period label.
  14878. * @return {?}
  14879. */
  14880. function () {
  14881. this.calendar.currentView = this.calendar.currentView == 'month' ? 'multi-year' : 'month';
  14882. };
  14883. /** Handles user clicks on the previous button. */
  14884. /**
  14885. * Handles user clicks on the previous button.
  14886. * @return {?}
  14887. */
  14888. MatCalendarHeader.prototype.previousClicked = /**
  14889. * Handles user clicks on the previous button.
  14890. * @return {?}
  14891. */
  14892. function () {
  14893. this.calendar.activeDate = this.calendar.currentView == 'month' ?
  14894. this._dateAdapter.addCalendarMonths(this.calendar.activeDate, -1) :
  14895. this._dateAdapter.addCalendarYears(this.calendar.activeDate, this.calendar.currentView == 'year' ? -1 : -yearsPerPage);
  14896. };
  14897. /** Handles user clicks on the next button. */
  14898. /**
  14899. * Handles user clicks on the next button.
  14900. * @return {?}
  14901. */
  14902. MatCalendarHeader.prototype.nextClicked = /**
  14903. * Handles user clicks on the next button.
  14904. * @return {?}
  14905. */
  14906. function () {
  14907. this.calendar.activeDate = this.calendar.currentView == 'month' ?
  14908. this._dateAdapter.addCalendarMonths(this.calendar.activeDate, 1) :
  14909. this._dateAdapter.addCalendarYears(this.calendar.activeDate, this.calendar.currentView == 'year' ? 1 : yearsPerPage);
  14910. };
  14911. /** Whether the previous period button is enabled. */
  14912. /**
  14913. * Whether the previous period button is enabled.
  14914. * @return {?}
  14915. */
  14916. MatCalendarHeader.prototype.previousEnabled = /**
  14917. * Whether the previous period button is enabled.
  14918. * @return {?}
  14919. */
  14920. function () {
  14921. if (!this.calendar.minDate) {
  14922. return true;
  14923. }
  14924. return !this.calendar.minDate ||
  14925. !this._isSameView(this.calendar.activeDate, this.calendar.minDate);
  14926. };
  14927. /** Whether the next period button is enabled. */
  14928. /**
  14929. * Whether the next period button is enabled.
  14930. * @return {?}
  14931. */
  14932. MatCalendarHeader.prototype.nextEnabled = /**
  14933. * Whether the next period button is enabled.
  14934. * @return {?}
  14935. */
  14936. function () {
  14937. return !this.calendar.maxDate ||
  14938. !this._isSameView(this.calendar.activeDate, this.calendar.maxDate);
  14939. };
  14940. /** Whether the two dates represent the same view in the current view mode (month or year). */
  14941. /**
  14942. * Whether the two dates represent the same view in the current view mode (month or year).
  14943. * @private
  14944. * @param {?} date1
  14945. * @param {?} date2
  14946. * @return {?}
  14947. */
  14948. MatCalendarHeader.prototype._isSameView = /**
  14949. * Whether the two dates represent the same view in the current view mode (month or year).
  14950. * @private
  14951. * @param {?} date1
  14952. * @param {?} date2
  14953. * @return {?}
  14954. */
  14955. function (date1, date2) {
  14956. if (this.calendar.currentView == 'month') {
  14957. return this._dateAdapter.getYear(date1) == this._dateAdapter.getYear(date2) &&
  14958. this._dateAdapter.getMonth(date1) == this._dateAdapter.getMonth(date2);
  14959. }
  14960. if (this.calendar.currentView == 'year') {
  14961. return this._dateAdapter.getYear(date1) == this._dateAdapter.getYear(date2);
  14962. }
  14963. // Otherwise we are in 'multi-year' view.
  14964. return isSameMultiYearView(this._dateAdapter, date1, date2, this.calendar.minDate, this.calendar.maxDate);
  14965. };
  14966. MatCalendarHeader.decorators = [
  14967. { type: core.Component, args: [{selector: 'mat-calendar-header',
  14968. template: "<div class=\"mat-calendar-header\"><div class=\"mat-calendar-controls\"><button mat-button type=\"button\" class=\"mat-calendar-period-button\" (click)=\"currentPeriodClicked()\" [attr.aria-label]=\"periodButtonLabel\" cdkAriaLive=\"polite\">{{periodButtonText}}<div class=\"mat-calendar-arrow\" [class.mat-calendar-invert]=\"calendar.currentView != 'month'\"></div></button><div class=\"mat-calendar-spacer\"></div><ng-content></ng-content><button mat-icon-button type=\"button\" class=\"mat-calendar-previous-button\" [disabled]=\"!previousEnabled()\" (click)=\"previousClicked()\" [attr.aria-label]=\"prevButtonLabel\"></button> <button mat-icon-button type=\"button\" class=\"mat-calendar-next-button\" [disabled]=\"!nextEnabled()\" (click)=\"nextClicked()\" [attr.aria-label]=\"nextButtonLabel\"></button></div></div>",
  14969. exportAs: 'matCalendarHeader',
  14970. encapsulation: core.ViewEncapsulation.None,
  14971. changeDetection: core.ChangeDetectionStrategy.OnPush,
  14972. },] },
  14973. ];
  14974. /** @nocollapse */
  14975. MatCalendarHeader.ctorParameters = function () { return [
  14976. { type: MatDatepickerIntl },
  14977. { type: MatCalendar, decorators: [{ type: core.Inject, args: [core.forwardRef((/**
  14978. * @return {?}
  14979. */
  14980. function () { return MatCalendar; })),] }] },
  14981. { type: DateAdapter, decorators: [{ type: core.Optional }] },
  14982. { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_DATE_FORMATS,] }] },
  14983. { type: core.ChangeDetectorRef }
  14984. ]; };
  14985. return MatCalendarHeader;
  14986. }());
  14987. /**
  14988. * A calendar that is used as part of the datepicker.
  14989. * \@docs-private
  14990. * @template D
  14991. */
  14992. var MatCalendar = /** @class */ (function () {
  14993. function MatCalendar(_intl, _dateAdapter, _dateFormats, _changeDetectorRef) {
  14994. var _this = this;
  14995. this._dateAdapter = _dateAdapter;
  14996. this._dateFormats = _dateFormats;
  14997. this._changeDetectorRef = _changeDetectorRef;
  14998. /**
  14999. * Used for scheduling that focus should be moved to the active cell on the next tick.
  15000. * We need to schedule it, rather than do it immediately, because we have to wait
  15001. * for Angular to re-evaluate the view children.
  15002. */
  15003. this._moveFocusOnNextTick = false;
  15004. /**
  15005. * Whether the calendar should be started in month or year view.
  15006. */
  15007. this.startView = 'month';
  15008. /**
  15009. * Emits when the currently selected date changes.
  15010. */
  15011. this.selectedChange = new core.EventEmitter();
  15012. /**
  15013. * Emits the year chosen in multiyear view.
  15014. * This doesn't imply a change on the selected date.
  15015. */
  15016. this.yearSelected = new core.EventEmitter();
  15017. /**
  15018. * Emits the month chosen in year view.
  15019. * This doesn't imply a change on the selected date.
  15020. */
  15021. this.monthSelected = new core.EventEmitter();
  15022. /**
  15023. * Emits when any date is selected.
  15024. */
  15025. this._userSelection = new core.EventEmitter();
  15026. /**
  15027. * Emits whenever there is a state change that the header may need to respond to.
  15028. */
  15029. this.stateChanges = new rxjs.Subject();
  15030. if (!this._dateAdapter) {
  15031. throw createMissingDateImplError('DateAdapter');
  15032. }
  15033. if (!this._dateFormats) {
  15034. throw createMissingDateImplError('MAT_DATE_FORMATS');
  15035. }
  15036. this._intlChanges = _intl.changes.subscribe((/**
  15037. * @return {?}
  15038. */
  15039. function () {
  15040. _changeDetectorRef.markForCheck();
  15041. _this.stateChanges.next();
  15042. }));
  15043. }
  15044. Object.defineProperty(MatCalendar.prototype, "startAt", {
  15045. /** A date representing the period (month or year) to start the calendar in. */
  15046. get: /**
  15047. * A date representing the period (month or year) to start the calendar in.
  15048. * @return {?}
  15049. */
  15050. function () { return this._startAt; },
  15051. set: /**
  15052. * @param {?} value
  15053. * @return {?}
  15054. */
  15055. function (value) {
  15056. this._startAt = this._getValidDateOrNull(this._dateAdapter.deserialize(value));
  15057. },
  15058. enumerable: true,
  15059. configurable: true
  15060. });
  15061. Object.defineProperty(MatCalendar.prototype, "selected", {
  15062. /** The currently selected date. */
  15063. get: /**
  15064. * The currently selected date.
  15065. * @return {?}
  15066. */
  15067. function () { return this._selected; },
  15068. set: /**
  15069. * @param {?} value
  15070. * @return {?}
  15071. */
  15072. function (value) {
  15073. this._selected = this._getValidDateOrNull(this._dateAdapter.deserialize(value));
  15074. },
  15075. enumerable: true,
  15076. configurable: true
  15077. });
  15078. Object.defineProperty(MatCalendar.prototype, "minDate", {
  15079. /** The minimum selectable date. */
  15080. get: /**
  15081. * The minimum selectable date.
  15082. * @return {?}
  15083. */
  15084. function () { return this._minDate; },
  15085. set: /**
  15086. * @param {?} value
  15087. * @return {?}
  15088. */
  15089. function (value) {
  15090. this._minDate = this._getValidDateOrNull(this._dateAdapter.deserialize(value));
  15091. },
  15092. enumerable: true,
  15093. configurable: true
  15094. });
  15095. Object.defineProperty(MatCalendar.prototype, "maxDate", {
  15096. /** The maximum selectable date. */
  15097. get: /**
  15098. * The maximum selectable date.
  15099. * @return {?}
  15100. */
  15101. function () { return this._maxDate; },
  15102. set: /**
  15103. * @param {?} value
  15104. * @return {?}
  15105. */
  15106. function (value) {
  15107. this._maxDate = this._getValidDateOrNull(this._dateAdapter.deserialize(value));
  15108. },
  15109. enumerable: true,
  15110. configurable: true
  15111. });
  15112. Object.defineProperty(MatCalendar.prototype, "activeDate", {
  15113. /**
  15114. * The current active date. This determines which time period is shown and which date is
  15115. * highlighted when using keyboard navigation.
  15116. */
  15117. get: /**
  15118. * The current active date. This determines which time period is shown and which date is
  15119. * highlighted when using keyboard navigation.
  15120. * @return {?}
  15121. */
  15122. function () { return this._clampedActiveDate; },
  15123. set: /**
  15124. * @param {?} value
  15125. * @return {?}
  15126. */
  15127. function (value) {
  15128. this._clampedActiveDate = this._dateAdapter.clampDate(value, this.minDate, this.maxDate);
  15129. this.stateChanges.next();
  15130. this._changeDetectorRef.markForCheck();
  15131. },
  15132. enumerable: true,
  15133. configurable: true
  15134. });
  15135. Object.defineProperty(MatCalendar.prototype, "currentView", {
  15136. /** Whether the calendar is in month view. */
  15137. get: /**
  15138. * Whether the calendar is in month view.
  15139. * @return {?}
  15140. */
  15141. function () { return this._currentView; },
  15142. set: /**
  15143. * @param {?} value
  15144. * @return {?}
  15145. */
  15146. function (value) {
  15147. this._currentView = value;
  15148. this._moveFocusOnNextTick = true;
  15149. this._changeDetectorRef.markForCheck();
  15150. },
  15151. enumerable: true,
  15152. configurable: true
  15153. });
  15154. /**
  15155. * @return {?}
  15156. */
  15157. MatCalendar.prototype.ngAfterContentInit = /**
  15158. * @return {?}
  15159. */
  15160. function () {
  15161. this._calendarHeaderPortal = new portal.ComponentPortal(this.headerComponent || MatCalendarHeader);
  15162. this.activeDate = this.startAt || this._dateAdapter.today();
  15163. // Assign to the private property since we don't want to move focus on init.
  15164. this._currentView = this.startView;
  15165. };
  15166. /**
  15167. * @return {?}
  15168. */
  15169. MatCalendar.prototype.ngAfterViewChecked = /**
  15170. * @return {?}
  15171. */
  15172. function () {
  15173. if (this._moveFocusOnNextTick) {
  15174. this._moveFocusOnNextTick = false;
  15175. this.focusActiveCell();
  15176. }
  15177. };
  15178. /**
  15179. * @return {?}
  15180. */
  15181. MatCalendar.prototype.ngOnDestroy = /**
  15182. * @return {?}
  15183. */
  15184. function () {
  15185. this._intlChanges.unsubscribe();
  15186. this.stateChanges.complete();
  15187. };
  15188. /**
  15189. * @param {?} changes
  15190. * @return {?}
  15191. */
  15192. MatCalendar.prototype.ngOnChanges = /**
  15193. * @param {?} changes
  15194. * @return {?}
  15195. */
  15196. function (changes) {
  15197. /** @type {?} */
  15198. var change = changes['minDate'] || changes['maxDate'] || changes['dateFilter'];
  15199. if (change && !change.firstChange) {
  15200. /** @type {?} */
  15201. var view = this._getCurrentViewComponent();
  15202. if (view) {
  15203. // We need to `detectChanges` manually here, because the `minDate`, `maxDate` etc. are
  15204. // passed down to the view via data bindings which won't be up-to-date when we call `_init`.
  15205. this._changeDetectorRef.detectChanges();
  15206. view._init();
  15207. }
  15208. }
  15209. this.stateChanges.next();
  15210. };
  15211. /**
  15212. * @return {?}
  15213. */
  15214. MatCalendar.prototype.focusActiveCell = /**
  15215. * @return {?}
  15216. */
  15217. function () {
  15218. this._getCurrentViewComponent()._focusActiveCell();
  15219. };
  15220. /** Updates today's date after an update of the active date */
  15221. /**
  15222. * Updates today's date after an update of the active date
  15223. * @return {?}
  15224. */
  15225. MatCalendar.prototype.updateTodaysDate = /**
  15226. * Updates today's date after an update of the active date
  15227. * @return {?}
  15228. */
  15229. function () {
  15230. /** @type {?} */
  15231. var view = this.currentView == 'month' ? this.monthView :
  15232. (this.currentView == 'year' ? this.yearView : this.multiYearView);
  15233. view.ngAfterContentInit();
  15234. };
  15235. /** Handles date selection in the month view. */
  15236. /**
  15237. * Handles date selection in the month view.
  15238. * @param {?} date
  15239. * @return {?}
  15240. */
  15241. MatCalendar.prototype._dateSelected = /**
  15242. * Handles date selection in the month view.
  15243. * @param {?} date
  15244. * @return {?}
  15245. */
  15246. function (date) {
  15247. if (!this._dateAdapter.sameDate(date, this.selected)) {
  15248. this.selectedChange.emit(date);
  15249. }
  15250. };
  15251. /** Handles year selection in the multiyear view. */
  15252. /**
  15253. * Handles year selection in the multiyear view.
  15254. * @param {?} normalizedYear
  15255. * @return {?}
  15256. */
  15257. MatCalendar.prototype._yearSelectedInMultiYearView = /**
  15258. * Handles year selection in the multiyear view.
  15259. * @param {?} normalizedYear
  15260. * @return {?}
  15261. */
  15262. function (normalizedYear) {
  15263. this.yearSelected.emit(normalizedYear);
  15264. };
  15265. /** Handles month selection in the year view. */
  15266. /**
  15267. * Handles month selection in the year view.
  15268. * @param {?} normalizedMonth
  15269. * @return {?}
  15270. */
  15271. MatCalendar.prototype._monthSelectedInYearView = /**
  15272. * Handles month selection in the year view.
  15273. * @param {?} normalizedMonth
  15274. * @return {?}
  15275. */
  15276. function (normalizedMonth) {
  15277. this.monthSelected.emit(normalizedMonth);
  15278. };
  15279. /**
  15280. * @return {?}
  15281. */
  15282. MatCalendar.prototype._userSelected = /**
  15283. * @return {?}
  15284. */
  15285. function () {
  15286. this._userSelection.emit();
  15287. };
  15288. /** Handles year/month selection in the multi-year/year views. */
  15289. /**
  15290. * Handles year/month selection in the multi-year/year views.
  15291. * @param {?} date
  15292. * @param {?} view
  15293. * @return {?}
  15294. */
  15295. MatCalendar.prototype._goToDateInView = /**
  15296. * Handles year/month selection in the multi-year/year views.
  15297. * @param {?} date
  15298. * @param {?} view
  15299. * @return {?}
  15300. */
  15301. function (date, view) {
  15302. this.activeDate = date;
  15303. this.currentView = view;
  15304. };
  15305. /**
  15306. * @param obj The object to check.
  15307. * @returns The given object if it is both a date instance and valid, otherwise null.
  15308. */
  15309. /**
  15310. * @private
  15311. * @param {?} obj The object to check.
  15312. * @return {?} The given object if it is both a date instance and valid, otherwise null.
  15313. */
  15314. MatCalendar.prototype._getValidDateOrNull = /**
  15315. * @private
  15316. * @param {?} obj The object to check.
  15317. * @return {?} The given object if it is both a date instance and valid, otherwise null.
  15318. */
  15319. function (obj) {
  15320. return (this._dateAdapter.isDateInstance(obj) && this._dateAdapter.isValid(obj)) ? obj : null;
  15321. };
  15322. /** Returns the component instance that corresponds to the current calendar view. */
  15323. /**
  15324. * Returns the component instance that corresponds to the current calendar view.
  15325. * @private
  15326. * @return {?}
  15327. */
  15328. MatCalendar.prototype._getCurrentViewComponent = /**
  15329. * Returns the component instance that corresponds to the current calendar view.
  15330. * @private
  15331. * @return {?}
  15332. */
  15333. function () {
  15334. return this.monthView || this.yearView || this.multiYearView;
  15335. };
  15336. MatCalendar.decorators = [
  15337. { type: core.Component, args: [{selector: 'mat-calendar',
  15338. template: "<ng-template [cdkPortalOutlet]=\"_calendarHeaderPortal\"></ng-template><div class=\"mat-calendar-content\" [ngSwitch]=\"currentView\" cdkMonitorSubtreeFocus tabindex=\"-1\"><mat-month-view *ngSwitchCase=\"'month'\" [(activeDate)]=\"activeDate\" [selected]=\"selected\" [dateFilter]=\"dateFilter\" [maxDate]=\"maxDate\" [minDate]=\"minDate\" [dateClass]=\"dateClass\" (selectedChange)=\"_dateSelected($event)\" (_userSelection)=\"_userSelected()\"></mat-month-view><mat-year-view *ngSwitchCase=\"'year'\" [(activeDate)]=\"activeDate\" [selected]=\"selected\" [dateFilter]=\"dateFilter\" [maxDate]=\"maxDate\" [minDate]=\"minDate\" (monthSelected)=\"_monthSelectedInYearView($event)\" (selectedChange)=\"_goToDateInView($event, 'month')\"></mat-year-view><mat-multi-year-view *ngSwitchCase=\"'multi-year'\" [(activeDate)]=\"activeDate\" [selected]=\"selected\" [dateFilter]=\"dateFilter\" [maxDate]=\"maxDate\" [minDate]=\"minDate\" (yearSelected)=\"_yearSelectedInMultiYearView($event)\" (selectedChange)=\"_goToDateInView($event, 'year')\"></mat-multi-year-view></div>",
  15339. styles: [".mat-calendar{display:block}.mat-calendar-header{padding:8px 8px 0 8px}.mat-calendar-content{padding:0 8px 8px 8px;outline:0}.mat-calendar-controls{display:flex;margin:5% calc(33% / 7 - 16px)}.mat-calendar-spacer{flex:1 1 auto}.mat-calendar-period-button{min-width:0}.mat-calendar-arrow{display:inline-block;width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-top-width:5px;border-top-style:solid;margin:0 0 0 5px;vertical-align:middle}.mat-calendar-arrow.mat-calendar-invert{transform:rotate(180deg)}[dir=rtl] .mat-calendar-arrow{margin:0 5px 0 0}.mat-calendar-next-button,.mat-calendar-previous-button{position:relative}.mat-calendar-next-button::after,.mat-calendar-previous-button::after{top:0;left:0;right:0;bottom:0;position:absolute;content:'';margin:15.5px;border:0 solid currentColor;border-top-width:2px}[dir=rtl] .mat-calendar-next-button,[dir=rtl] .mat-calendar-previous-button{transform:rotate(180deg)}.mat-calendar-previous-button::after{border-left-width:2px;transform:translateX(2px) rotate(-45deg)}.mat-calendar-next-button::after{border-right-width:2px;transform:translateX(-2px) rotate(45deg)}.mat-calendar-table{border-spacing:0;border-collapse:collapse;width:100%}.mat-calendar-table-header th{text-align:center;padding:0 0 8px 0}.mat-calendar-table-header-divider{position:relative;height:1px}.mat-calendar-table-header-divider::after{content:'';position:absolute;top:0;left:-8px;right:-8px;height:1px}"],
  15340. host: {
  15341. 'class': 'mat-calendar',
  15342. },
  15343. exportAs: 'matCalendar',
  15344. encapsulation: core.ViewEncapsulation.None,
  15345. changeDetection: core.ChangeDetectionStrategy.OnPush,
  15346. },] },
  15347. ];
  15348. /** @nocollapse */
  15349. MatCalendar.ctorParameters = function () { return [
  15350. { type: MatDatepickerIntl },
  15351. { type: DateAdapter, decorators: [{ type: core.Optional }] },
  15352. { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_DATE_FORMATS,] }] },
  15353. { type: core.ChangeDetectorRef }
  15354. ]; };
  15355. MatCalendar.propDecorators = {
  15356. headerComponent: [{ type: core.Input }],
  15357. startAt: [{ type: core.Input }],
  15358. startView: [{ type: core.Input }],
  15359. selected: [{ type: core.Input }],
  15360. minDate: [{ type: core.Input }],
  15361. maxDate: [{ type: core.Input }],
  15362. dateFilter: [{ type: core.Input }],
  15363. dateClass: [{ type: core.Input }],
  15364. selectedChange: [{ type: core.Output }],
  15365. yearSelected: [{ type: core.Output }],
  15366. monthSelected: [{ type: core.Output }],
  15367. _userSelection: [{ type: core.Output }],
  15368. monthView: [{ type: core.ViewChild, args: [MatMonthView, { static: false },] }],
  15369. yearView: [{ type: core.ViewChild, args: [MatYearView, { static: false },] }],
  15370. multiYearView: [{ type: core.ViewChild, args: [MatMultiYearView, { static: false },] }]
  15371. };
  15372. return MatCalendar;
  15373. }());
  15374. /**
  15375. * @fileoverview added by tsickle
  15376. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  15377. */
  15378. /**
  15379. * Animations used by the Material datepicker.
  15380. * \@docs-private
  15381. * @type {?}
  15382. */
  15383. var matDatepickerAnimations = {
  15384. /**
  15385. * Transforms the height of the datepicker's calendar.
  15386. */
  15387. transformPanel: animations$1.trigger('transformPanel', [
  15388. animations$1.state('void', animations$1.style({
  15389. opacity: 0,
  15390. transform: 'scale(1, 0.8)'
  15391. })),
  15392. animations$1.transition('void => enter', animations$1.animate('120ms cubic-bezier(0, 0, 0.2, 1)', animations$1.style({
  15393. opacity: 1,
  15394. transform: 'scale(1, 1)'
  15395. }))),
  15396. animations$1.transition('* => void', animations$1.animate('100ms linear', animations$1.style({ opacity: 0 })))
  15397. ]),
  15398. /**
  15399. * Fades in the content of the calendar.
  15400. */
  15401. fadeInCalendar: animations$1.trigger('fadeInCalendar', [
  15402. animations$1.state('void', animations$1.style({ opacity: 0 })),
  15403. animations$1.state('enter', animations$1.style({ opacity: 1 })),
  15404. // TODO(crisbeto): this animation should be removed since it isn't quite on spec, but we
  15405. // need to keep it until #12440 gets in, otherwise the exit animation will look glitchy.
  15406. animations$1.transition('void => *', animations$1.animate('120ms 100ms cubic-bezier(0.55, 0, 0.55, 0.2)'))
  15407. ])
  15408. };
  15409. /**
  15410. * @fileoverview added by tsickle
  15411. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  15412. */
  15413. /**
  15414. * Used to generate a unique ID for each datepicker instance.
  15415. * @type {?}
  15416. */
  15417. var datepickerUid = 0;
  15418. /**
  15419. * Injection token that determines the scroll handling while the calendar is open.
  15420. * @type {?}
  15421. */
  15422. var MAT_DATEPICKER_SCROLL_STRATEGY = new core.InjectionToken('mat-datepicker-scroll-strategy');
  15423. /**
  15424. * \@docs-private
  15425. * @param {?} overlay
  15426. * @return {?}
  15427. */
  15428. function MAT_DATEPICKER_SCROLL_STRATEGY_FACTORY(overlay$$1) {
  15429. return (/**
  15430. * @return {?}
  15431. */
  15432. function () { return overlay$$1.scrollStrategies.reposition(); });
  15433. }
  15434. /**
  15435. * \@docs-private
  15436. * @type {?}
  15437. */
  15438. var MAT_DATEPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER = {
  15439. provide: MAT_DATEPICKER_SCROLL_STRATEGY,
  15440. deps: [overlay.Overlay],
  15441. useFactory: MAT_DATEPICKER_SCROLL_STRATEGY_FACTORY,
  15442. };
  15443. // Boilerplate for applying mixins to MatDatepickerContent.
  15444. /**
  15445. * \@docs-private
  15446. */
  15447. var
  15448. // Boilerplate for applying mixins to MatDatepickerContent.
  15449. /**
  15450. * \@docs-private
  15451. */
  15452. MatDatepickerContentBase = /** @class */ (function () {
  15453. function MatDatepickerContentBase(_elementRef) {
  15454. this._elementRef = _elementRef;
  15455. }
  15456. return MatDatepickerContentBase;
  15457. }());
  15458. /** @type {?} */
  15459. var _MatDatepickerContentMixinBase = mixinColor(MatDatepickerContentBase);
  15460. /**
  15461. * Component used as the content for the datepicker dialog and popup. We use this instead of using
  15462. * MatCalendar directly as the content so we can control the initial focus. This also gives us a
  15463. * place to put additional features of the popup that are not part of the calendar itself in the
  15464. * future. (e.g. confirmation buttons).
  15465. * \@docs-private
  15466. * @template D
  15467. */
  15468. var MatDatepickerContent = /** @class */ (function (_super) {
  15469. __extends(MatDatepickerContent, _super);
  15470. function MatDatepickerContent(elementRef) {
  15471. return _super.call(this, elementRef) || this;
  15472. }
  15473. /**
  15474. * @return {?}
  15475. */
  15476. MatDatepickerContent.prototype.ngAfterViewInit = /**
  15477. * @return {?}
  15478. */
  15479. function () {
  15480. this._calendar.focusActiveCell();
  15481. };
  15482. MatDatepickerContent.decorators = [
  15483. { type: core.Component, args: [{selector: 'mat-datepicker-content',
  15484. template: "<mat-calendar cdkTrapFocus [id]=\"datepicker.id\" [ngClass]=\"datepicker.panelClass\" [startAt]=\"datepicker.startAt\" [startView]=\"datepicker.startView\" [minDate]=\"datepicker._minDate\" [maxDate]=\"datepicker._maxDate\" [dateFilter]=\"datepicker._dateFilter\" [headerComponent]=\"datepicker.calendarHeaderComponent\" [selected]=\"datepicker._selected\" [dateClass]=\"datepicker.dateClass\" [@fadeInCalendar]=\"'enter'\" (selectedChange)=\"datepicker.select($event)\" (yearSelected)=\"datepicker._selectYear($event)\" (monthSelected)=\"datepicker._selectMonth($event)\" (_userSelection)=\"datepicker.close()\"></mat-calendar>",
  15485. styles: [".mat-datepicker-content{display:block;border-radius:4px}.mat-datepicker-content .mat-calendar{width:296px;height:354px}.mat-datepicker-content-touch{display:block;max-height:80vh;overflow:auto;margin:-24px}.mat-datepicker-content-touch .mat-calendar{min-width:250px;min-height:312px;max-width:750px;max-height:788px}@media all and (orientation:landscape){.mat-datepicker-content-touch .mat-calendar{width:64vh;height:80vh}}@media all and (orientation:portrait){.mat-datepicker-content-touch .mat-calendar{width:80vw;height:100vw}}"],
  15486. host: {
  15487. 'class': 'mat-datepicker-content',
  15488. '[@transformPanel]': '"enter"',
  15489. '[class.mat-datepicker-content-touch]': 'datepicker.touchUi',
  15490. },
  15491. animations: [
  15492. matDatepickerAnimations.transformPanel,
  15493. matDatepickerAnimations.fadeInCalendar,
  15494. ],
  15495. exportAs: 'matDatepickerContent',
  15496. encapsulation: core.ViewEncapsulation.None,
  15497. changeDetection: core.ChangeDetectionStrategy.OnPush,
  15498. inputs: ['color'],
  15499. },] },
  15500. ];
  15501. /** @nocollapse */
  15502. MatDatepickerContent.ctorParameters = function () { return [
  15503. { type: core.ElementRef }
  15504. ]; };
  15505. MatDatepickerContent.propDecorators = {
  15506. _calendar: [{ type: core.ViewChild, args: [MatCalendar, { static: false },] }]
  15507. };
  15508. return MatDatepickerContent;
  15509. }(_MatDatepickerContentMixinBase));
  15510. // TODO(mmalerba): We use a component instead of a directive here so the user can use implicit
  15511. // template reference variables (e.g. #d vs #d="matDatepicker"). We can change this to a directive
  15512. // if angular adds support for `exportAs: '$implicit'` on directives.
  15513. /**
  15514. * Component responsible for managing the datepicker popup/dialog.
  15515. * @template D
  15516. */
  15517. var MatDatepicker = /** @class */ (function () {
  15518. function MatDatepicker(_dialog, _overlay, _ngZone, _viewContainerRef, scrollStrategy, _dateAdapter, _dir, _document) {
  15519. this._dialog = _dialog;
  15520. this._overlay = _overlay;
  15521. this._ngZone = _ngZone;
  15522. this._viewContainerRef = _viewContainerRef;
  15523. this._dateAdapter = _dateAdapter;
  15524. this._dir = _dir;
  15525. this._document = _document;
  15526. /**
  15527. * The view that the calendar should start in.
  15528. */
  15529. this.startView = 'month';
  15530. this._touchUi = false;
  15531. /**
  15532. * Emits selected year in multiyear view.
  15533. * This doesn't imply a change on the selected date.
  15534. */
  15535. this.yearSelected = new core.EventEmitter();
  15536. /**
  15537. * Emits selected month in year view.
  15538. * This doesn't imply a change on the selected date.
  15539. */
  15540. this.monthSelected = new core.EventEmitter();
  15541. /**
  15542. * Emits when the datepicker has been opened.
  15543. */
  15544. this.openedStream = new core.EventEmitter();
  15545. /**
  15546. * Emits when the datepicker has been closed.
  15547. */
  15548. this.closedStream = new core.EventEmitter();
  15549. this._opened = false;
  15550. /**
  15551. * The id for the datepicker calendar.
  15552. */
  15553. this.id = "mat-datepicker-" + datepickerUid++;
  15554. this._validSelected = null;
  15555. /**
  15556. * The element that was focused before the datepicker was opened.
  15557. */
  15558. this._focusedElementBeforeOpen = null;
  15559. /**
  15560. * Subscription to value changes in the associated input element.
  15561. */
  15562. this._inputSubscription = rxjs.Subscription.EMPTY;
  15563. /**
  15564. * Emits when the datepicker is disabled.
  15565. */
  15566. this._disabledChange = new rxjs.Subject();
  15567. /**
  15568. * Emits new selected date when selected date changes.
  15569. */
  15570. this._selectedChanged = new rxjs.Subject();
  15571. if (!this._dateAdapter) {
  15572. throw createMissingDateImplError('DateAdapter');
  15573. }
  15574. this._scrollStrategy = scrollStrategy;
  15575. }
  15576. Object.defineProperty(MatDatepicker.prototype, "startAt", {
  15577. /** The date to open the calendar to initially. */
  15578. get: /**
  15579. * The date to open the calendar to initially.
  15580. * @return {?}
  15581. */
  15582. function () {
  15583. // If an explicit startAt is set we start there, otherwise we start at whatever the currently
  15584. // selected value is.
  15585. return this._startAt || (this._datepickerInput ? this._datepickerInput.value : null);
  15586. },
  15587. set: /**
  15588. * @param {?} value
  15589. * @return {?}
  15590. */
  15591. function (value) {
  15592. this._startAt = this._getValidDateOrNull(this._dateAdapter.deserialize(value));
  15593. },
  15594. enumerable: true,
  15595. configurable: true
  15596. });
  15597. Object.defineProperty(MatDatepicker.prototype, "color", {
  15598. /** Color palette to use on the datepicker's calendar. */
  15599. get: /**
  15600. * Color palette to use on the datepicker's calendar.
  15601. * @return {?}
  15602. */
  15603. function () {
  15604. return this._color ||
  15605. (this._datepickerInput ? this._datepickerInput._getThemePalette() : undefined);
  15606. },
  15607. set: /**
  15608. * @param {?} value
  15609. * @return {?}
  15610. */
  15611. function (value) {
  15612. this._color = value;
  15613. },
  15614. enumerable: true,
  15615. configurable: true
  15616. });
  15617. Object.defineProperty(MatDatepicker.prototype, "touchUi", {
  15618. /**
  15619. * Whether the calendar UI is in touch mode. In touch mode the calendar opens in a dialog rather
  15620. * than a popup and elements have more padding to allow for bigger touch targets.
  15621. */
  15622. get: /**
  15623. * Whether the calendar UI is in touch mode. In touch mode the calendar opens in a dialog rather
  15624. * than a popup and elements have more padding to allow for bigger touch targets.
  15625. * @return {?}
  15626. */
  15627. function () { return this._touchUi; },
  15628. set: /**
  15629. * @param {?} value
  15630. * @return {?}
  15631. */
  15632. function (value) {
  15633. this._touchUi = coercion.coerceBooleanProperty(value);
  15634. },
  15635. enumerable: true,
  15636. configurable: true
  15637. });
  15638. Object.defineProperty(MatDatepicker.prototype, "disabled", {
  15639. /** Whether the datepicker pop-up should be disabled. */
  15640. get: /**
  15641. * Whether the datepicker pop-up should be disabled.
  15642. * @return {?}
  15643. */
  15644. function () {
  15645. return this._disabled === undefined && this._datepickerInput ?
  15646. this._datepickerInput.disabled : !!this._disabled;
  15647. },
  15648. set: /**
  15649. * @param {?} value
  15650. * @return {?}
  15651. */
  15652. function (value) {
  15653. /** @type {?} */
  15654. var newValue = coercion.coerceBooleanProperty(value);
  15655. if (newValue !== this._disabled) {
  15656. this._disabled = newValue;
  15657. this._disabledChange.next(newValue);
  15658. }
  15659. },
  15660. enumerable: true,
  15661. configurable: true
  15662. });
  15663. Object.defineProperty(MatDatepicker.prototype, "opened", {
  15664. /** Whether the calendar is open. */
  15665. get: /**
  15666. * Whether the calendar is open.
  15667. * @return {?}
  15668. */
  15669. function () { return this._opened; },
  15670. set: /**
  15671. * @param {?} value
  15672. * @return {?}
  15673. */
  15674. function (value) { value ? this.open() : this.close(); },
  15675. enumerable: true,
  15676. configurable: true
  15677. });
  15678. Object.defineProperty(MatDatepicker.prototype, "_selected", {
  15679. /** The currently selected date. */
  15680. get: /**
  15681. * The currently selected date.
  15682. * @return {?}
  15683. */
  15684. function () { return this._validSelected; },
  15685. set: /**
  15686. * @param {?} value
  15687. * @return {?}
  15688. */
  15689. function (value) { this._validSelected = value; },
  15690. enumerable: true,
  15691. configurable: true
  15692. });
  15693. Object.defineProperty(MatDatepicker.prototype, "_minDate", {
  15694. /** The minimum selectable date. */
  15695. get: /**
  15696. * The minimum selectable date.
  15697. * @return {?}
  15698. */
  15699. function () {
  15700. return this._datepickerInput && this._datepickerInput.min;
  15701. },
  15702. enumerable: true,
  15703. configurable: true
  15704. });
  15705. Object.defineProperty(MatDatepicker.prototype, "_maxDate", {
  15706. /** The maximum selectable date. */
  15707. get: /**
  15708. * The maximum selectable date.
  15709. * @return {?}
  15710. */
  15711. function () {
  15712. return this._datepickerInput && this._datepickerInput.max;
  15713. },
  15714. enumerable: true,
  15715. configurable: true
  15716. });
  15717. Object.defineProperty(MatDatepicker.prototype, "_dateFilter", {
  15718. get: /**
  15719. * @return {?}
  15720. */
  15721. function () {
  15722. return this._datepickerInput && this._datepickerInput._dateFilter;
  15723. },
  15724. enumerable: true,
  15725. configurable: true
  15726. });
  15727. /**
  15728. * @return {?}
  15729. */
  15730. MatDatepicker.prototype.ngOnDestroy = /**
  15731. * @return {?}
  15732. */
  15733. function () {
  15734. this.close();
  15735. this._inputSubscription.unsubscribe();
  15736. this._disabledChange.complete();
  15737. if (this._popupRef) {
  15738. this._popupRef.dispose();
  15739. this._popupComponentRef = null;
  15740. }
  15741. };
  15742. /** Selects the given date */
  15743. /**
  15744. * Selects the given date
  15745. * @param {?} date
  15746. * @return {?}
  15747. */
  15748. MatDatepicker.prototype.select = /**
  15749. * Selects the given date
  15750. * @param {?} date
  15751. * @return {?}
  15752. */
  15753. function (date) {
  15754. /** @type {?} */
  15755. var oldValue = this._selected;
  15756. this._selected = date;
  15757. if (!this._dateAdapter.sameDate(oldValue, this._selected)) {
  15758. this._selectedChanged.next(date);
  15759. }
  15760. };
  15761. /** Emits the selected year in multiyear view */
  15762. /**
  15763. * Emits the selected year in multiyear view
  15764. * @param {?} normalizedYear
  15765. * @return {?}
  15766. */
  15767. MatDatepicker.prototype._selectYear = /**
  15768. * Emits the selected year in multiyear view
  15769. * @param {?} normalizedYear
  15770. * @return {?}
  15771. */
  15772. function (normalizedYear) {
  15773. this.yearSelected.emit(normalizedYear);
  15774. };
  15775. /** Emits selected month in year view */
  15776. /**
  15777. * Emits selected month in year view
  15778. * @param {?} normalizedMonth
  15779. * @return {?}
  15780. */
  15781. MatDatepicker.prototype._selectMonth = /**
  15782. * Emits selected month in year view
  15783. * @param {?} normalizedMonth
  15784. * @return {?}
  15785. */
  15786. function (normalizedMonth) {
  15787. this.monthSelected.emit(normalizedMonth);
  15788. };
  15789. /**
  15790. * Register an input with this datepicker.
  15791. * @param input The datepicker input to register with this datepicker.
  15792. */
  15793. /**
  15794. * Register an input with this datepicker.
  15795. * @param {?} input The datepicker input to register with this datepicker.
  15796. * @return {?}
  15797. */
  15798. MatDatepicker.prototype._registerInput = /**
  15799. * Register an input with this datepicker.
  15800. * @param {?} input The datepicker input to register with this datepicker.
  15801. * @return {?}
  15802. */
  15803. function (input) {
  15804. var _this = this;
  15805. if (this._datepickerInput) {
  15806. throw Error('A MatDatepicker can only be associated with a single input.');
  15807. }
  15808. this._datepickerInput = input;
  15809. this._inputSubscription =
  15810. this._datepickerInput._valueChange.subscribe((/**
  15811. * @param {?} value
  15812. * @return {?}
  15813. */
  15814. function (value) { return _this._selected = value; }));
  15815. };
  15816. /** Open the calendar. */
  15817. /**
  15818. * Open the calendar.
  15819. * @return {?}
  15820. */
  15821. MatDatepicker.prototype.open = /**
  15822. * Open the calendar.
  15823. * @return {?}
  15824. */
  15825. function () {
  15826. if (this._opened || this.disabled) {
  15827. return;
  15828. }
  15829. if (!this._datepickerInput) {
  15830. throw Error('Attempted to open an MatDatepicker with no associated input.');
  15831. }
  15832. if (this._document) {
  15833. this._focusedElementBeforeOpen = this._document.activeElement;
  15834. }
  15835. this.touchUi ? this._openAsDialog() : this._openAsPopup();
  15836. this._opened = true;
  15837. this.openedStream.emit();
  15838. };
  15839. /** Close the calendar. */
  15840. /**
  15841. * Close the calendar.
  15842. * @return {?}
  15843. */
  15844. MatDatepicker.prototype.close = /**
  15845. * Close the calendar.
  15846. * @return {?}
  15847. */
  15848. function () {
  15849. var _this = this;
  15850. if (!this._opened) {
  15851. return;
  15852. }
  15853. if (this._popupRef && this._popupRef.hasAttached()) {
  15854. this._popupRef.detach();
  15855. }
  15856. if (this._dialogRef) {
  15857. this._dialogRef.close();
  15858. this._dialogRef = null;
  15859. }
  15860. if (this._calendarPortal && this._calendarPortal.isAttached) {
  15861. this._calendarPortal.detach();
  15862. }
  15863. /** @type {?} */
  15864. var completeClose = (/**
  15865. * @return {?}
  15866. */
  15867. function () {
  15868. // The `_opened` could've been reset already if
  15869. // we got two events in quick succession.
  15870. if (_this._opened) {
  15871. _this._opened = false;
  15872. _this.closedStream.emit();
  15873. _this._focusedElementBeforeOpen = null;
  15874. }
  15875. });
  15876. if (this._focusedElementBeforeOpen &&
  15877. typeof this._focusedElementBeforeOpen.focus === 'function') {
  15878. // Because IE moves focus asynchronously, we can't count on it being restored before we've
  15879. // marked the datepicker as closed. If the event fires out of sequence and the element that
  15880. // we're refocusing opens the datepicker on focus, the user could be stuck with not being
  15881. // able to close the calendar at all. We work around it by making the logic, that marks
  15882. // the datepicker as closed, async as well.
  15883. this._focusedElementBeforeOpen.focus();
  15884. setTimeout(completeClose);
  15885. }
  15886. else {
  15887. completeClose();
  15888. }
  15889. };
  15890. /** Open the calendar as a dialog. */
  15891. /**
  15892. * Open the calendar as a dialog.
  15893. * @private
  15894. * @return {?}
  15895. */
  15896. MatDatepicker.prototype._openAsDialog = /**
  15897. * Open the calendar as a dialog.
  15898. * @private
  15899. * @return {?}
  15900. */
  15901. function () {
  15902. var _this = this;
  15903. // Usually this would be handled by `open` which ensures that we can only have one overlay
  15904. // open at a time, however since we reset the variables in async handlers some overlays
  15905. // may slip through if the user opens and closes multiple times in quick succession (e.g.
  15906. // by holding down the enter key).
  15907. if (this._dialogRef) {
  15908. this._dialogRef.close();
  15909. }
  15910. this._dialogRef = this._dialog.open(MatDatepickerContent, {
  15911. direction: this._dir ? this._dir.value : 'ltr',
  15912. viewContainerRef: this._viewContainerRef,
  15913. panelClass: 'mat-datepicker-dialog',
  15914. });
  15915. this._dialogRef.afterClosed().subscribe((/**
  15916. * @return {?}
  15917. */
  15918. function () { return _this.close(); }));
  15919. this._dialogRef.componentInstance.datepicker = this;
  15920. this._setColor();
  15921. };
  15922. /** Open the calendar as a popup. */
  15923. /**
  15924. * Open the calendar as a popup.
  15925. * @private
  15926. * @return {?}
  15927. */
  15928. MatDatepicker.prototype._openAsPopup = /**
  15929. * Open the calendar as a popup.
  15930. * @private
  15931. * @return {?}
  15932. */
  15933. function () {
  15934. var _this = this;
  15935. if (!this._calendarPortal) {
  15936. this._calendarPortal = new portal.ComponentPortal(MatDatepickerContent, this._viewContainerRef);
  15937. }
  15938. if (!this._popupRef) {
  15939. this._createPopup();
  15940. }
  15941. if (!this._popupRef.hasAttached()) {
  15942. this._popupComponentRef = this._popupRef.attach(this._calendarPortal);
  15943. this._popupComponentRef.instance.datepicker = this;
  15944. this._setColor();
  15945. // Update the position once the calendar has rendered.
  15946. this._ngZone.onStable.asObservable().pipe(operators.take(1)).subscribe((/**
  15947. * @return {?}
  15948. */
  15949. function () {
  15950. _this._popupRef.updatePosition();
  15951. }));
  15952. }
  15953. };
  15954. /** Create the popup. */
  15955. /**
  15956. * Create the popup.
  15957. * @private
  15958. * @return {?}
  15959. */
  15960. MatDatepicker.prototype._createPopup = /**
  15961. * Create the popup.
  15962. * @private
  15963. * @return {?}
  15964. */
  15965. function () {
  15966. var _this = this;
  15967. /** @type {?} */
  15968. var overlayConfig = new overlay.OverlayConfig({
  15969. positionStrategy: this._createPopupPositionStrategy(),
  15970. hasBackdrop: true,
  15971. backdropClass: 'mat-overlay-transparent-backdrop',
  15972. direction: this._dir,
  15973. scrollStrategy: this._scrollStrategy(),
  15974. panelClass: 'mat-datepicker-popup',
  15975. });
  15976. this._popupRef = this._overlay.create(overlayConfig);
  15977. this._popupRef.overlayElement.setAttribute('role', 'dialog');
  15978. rxjs.merge(this._popupRef.backdropClick(), this._popupRef.detachments(), this._popupRef.keydownEvents().pipe(operators.filter((/**
  15979. * @param {?} event
  15980. * @return {?}
  15981. */
  15982. function (event) {
  15983. // Closing on alt + up is only valid when there's an input associated with the datepicker.
  15984. return event.keyCode === keycodes.ESCAPE ||
  15985. (_this._datepickerInput && event.altKey && event.keyCode === keycodes.UP_ARROW);
  15986. })))).subscribe((/**
  15987. * @param {?} event
  15988. * @return {?}
  15989. */
  15990. function (event) {
  15991. if (event) {
  15992. event.preventDefault();
  15993. }
  15994. _this.close();
  15995. }));
  15996. };
  15997. /** Create the popup PositionStrategy. */
  15998. /**
  15999. * Create the popup PositionStrategy.
  16000. * @private
  16001. * @return {?}
  16002. */
  16003. MatDatepicker.prototype._createPopupPositionStrategy = /**
  16004. * Create the popup PositionStrategy.
  16005. * @private
  16006. * @return {?}
  16007. */
  16008. function () {
  16009. return this._overlay.position()
  16010. .flexibleConnectedTo(this._datepickerInput.getConnectedOverlayOrigin())
  16011. .withTransformOriginOn('.mat-datepicker-content')
  16012. .withFlexibleDimensions(false)
  16013. .withViewportMargin(8)
  16014. .withLockedPosition()
  16015. .withPositions([
  16016. {
  16017. originX: 'start',
  16018. originY: 'bottom',
  16019. overlayX: 'start',
  16020. overlayY: 'top'
  16021. },
  16022. {
  16023. originX: 'start',
  16024. originY: 'top',
  16025. overlayX: 'start',
  16026. overlayY: 'bottom'
  16027. },
  16028. {
  16029. originX: 'end',
  16030. originY: 'bottom',
  16031. overlayX: 'end',
  16032. overlayY: 'top'
  16033. },
  16034. {
  16035. originX: 'end',
  16036. originY: 'top',
  16037. overlayX: 'end',
  16038. overlayY: 'bottom'
  16039. }
  16040. ]);
  16041. };
  16042. /**
  16043. * @param obj The object to check.
  16044. * @returns The given object if it is both a date instance and valid, otherwise null.
  16045. */
  16046. /**
  16047. * @private
  16048. * @param {?} obj The object to check.
  16049. * @return {?} The given object if it is both a date instance and valid, otherwise null.
  16050. */
  16051. MatDatepicker.prototype._getValidDateOrNull = /**
  16052. * @private
  16053. * @param {?} obj The object to check.
  16054. * @return {?} The given object if it is both a date instance and valid, otherwise null.
  16055. */
  16056. function (obj) {
  16057. return (this._dateAdapter.isDateInstance(obj) && this._dateAdapter.isValid(obj)) ? obj : null;
  16058. };
  16059. /** Passes the current theme color along to the calendar overlay. */
  16060. /**
  16061. * Passes the current theme color along to the calendar overlay.
  16062. * @private
  16063. * @return {?}
  16064. */
  16065. MatDatepicker.prototype._setColor = /**
  16066. * Passes the current theme color along to the calendar overlay.
  16067. * @private
  16068. * @return {?}
  16069. */
  16070. function () {
  16071. /** @type {?} */
  16072. var color = this.color;
  16073. if (this._popupComponentRef) {
  16074. this._popupComponentRef.instance.color = color;
  16075. }
  16076. if (this._dialogRef) {
  16077. this._dialogRef.componentInstance.color = color;
  16078. }
  16079. };
  16080. MatDatepicker.decorators = [
  16081. { type: core.Component, args: [{selector: 'mat-datepicker',
  16082. template: '',
  16083. exportAs: 'matDatepicker',
  16084. changeDetection: core.ChangeDetectionStrategy.OnPush,
  16085. encapsulation: core.ViewEncapsulation.None,
  16086. },] },
  16087. ];
  16088. /** @nocollapse */
  16089. MatDatepicker.ctorParameters = function () { return [
  16090. { type: MatDialog },
  16091. { type: overlay.Overlay },
  16092. { type: core.NgZone },
  16093. { type: core.ViewContainerRef },
  16094. { type: undefined, decorators: [{ type: core.Inject, args: [MAT_DATEPICKER_SCROLL_STRATEGY,] }] },
  16095. { type: DateAdapter, decorators: [{ type: core.Optional }] },
  16096. { type: bidi.Directionality, decorators: [{ type: core.Optional }] },
  16097. { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [common.DOCUMENT,] }] }
  16098. ]; };
  16099. MatDatepicker.propDecorators = {
  16100. calendarHeaderComponent: [{ type: core.Input }],
  16101. startAt: [{ type: core.Input }],
  16102. startView: [{ type: core.Input }],
  16103. color: [{ type: core.Input }],
  16104. touchUi: [{ type: core.Input }],
  16105. disabled: [{ type: core.Input }],
  16106. yearSelected: [{ type: core.Output }],
  16107. monthSelected: [{ type: core.Output }],
  16108. panelClass: [{ type: core.Input }],
  16109. dateClass: [{ type: core.Input }],
  16110. openedStream: [{ type: core.Output, args: ['opened',] }],
  16111. closedStream: [{ type: core.Output, args: ['closed',] }],
  16112. opened: [{ type: core.Input }]
  16113. };
  16114. return MatDatepicker;
  16115. }());
  16116. /**
  16117. * @fileoverview added by tsickle
  16118. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  16119. */
  16120. /**
  16121. * \@docs-private
  16122. * @type {?}
  16123. */
  16124. var MAT_DATEPICKER_VALUE_ACCESSOR = {
  16125. provide: forms.NG_VALUE_ACCESSOR,
  16126. useExisting: core.forwardRef((/**
  16127. * @return {?}
  16128. */
  16129. function () { return MatDatepickerInput; })),
  16130. multi: true
  16131. };
  16132. /**
  16133. * \@docs-private
  16134. * @type {?}
  16135. */
  16136. var MAT_DATEPICKER_VALIDATORS = {
  16137. provide: forms.NG_VALIDATORS,
  16138. useExisting: core.forwardRef((/**
  16139. * @return {?}
  16140. */
  16141. function () { return MatDatepickerInput; })),
  16142. multi: true
  16143. };
  16144. /**
  16145. * An event used for datepicker input and change events. We don't always have access to a native
  16146. * input or change event because the event may have been triggered by the user clicking on the
  16147. * calendar popup. For consistency, we always use MatDatepickerInputEvent instead.
  16148. * @template D
  16149. */
  16150. var /**
  16151. * An event used for datepicker input and change events. We don't always have access to a native
  16152. * input or change event because the event may have been triggered by the user clicking on the
  16153. * calendar popup. For consistency, we always use MatDatepickerInputEvent instead.
  16154. * @template D
  16155. */
  16156. MatDatepickerInputEvent = /** @class */ (function () {
  16157. function MatDatepickerInputEvent(target, targetElement) {
  16158. this.target = target;
  16159. this.targetElement = targetElement;
  16160. this.value = this.target.value;
  16161. }
  16162. return MatDatepickerInputEvent;
  16163. }());
  16164. /**
  16165. * Directive used to connect an input to a MatDatepicker.
  16166. * @template D
  16167. */
  16168. var MatDatepickerInput = /** @class */ (function () {
  16169. function MatDatepickerInput(_elementRef, _dateAdapter, _dateFormats, _formField) {
  16170. var _this = this;
  16171. this._elementRef = _elementRef;
  16172. this._dateAdapter = _dateAdapter;
  16173. this._dateFormats = _dateFormats;
  16174. this._formField = _formField;
  16175. /**
  16176. * Emits when a `change` event is fired on this `<input>`.
  16177. */
  16178. this.dateChange = new core.EventEmitter();
  16179. /**
  16180. * Emits when an `input` event is fired on this `<input>`.
  16181. */
  16182. this.dateInput = new core.EventEmitter();
  16183. /**
  16184. * Emits when the value changes (either due to user input or programmatic change).
  16185. */
  16186. this._valueChange = new core.EventEmitter();
  16187. /**
  16188. * Emits when the disabled state has changed
  16189. */
  16190. this._disabledChange = new core.EventEmitter();
  16191. this._onTouched = (/**
  16192. * @return {?}
  16193. */
  16194. function () { });
  16195. this._cvaOnChange = (/**
  16196. * @return {?}
  16197. */
  16198. function () { });
  16199. this._validatorOnChange = (/**
  16200. * @return {?}
  16201. */
  16202. function () { });
  16203. this._datepickerSubscription = rxjs.Subscription.EMPTY;
  16204. this._localeSubscription = rxjs.Subscription.EMPTY;
  16205. /**
  16206. * The form control validator for whether the input parses.
  16207. */
  16208. this._parseValidator = (/**
  16209. * @return {?}
  16210. */
  16211. function () {
  16212. return _this._lastValueValid ?
  16213. null : { 'matDatepickerParse': { 'text': _this._elementRef.nativeElement.value } };
  16214. });
  16215. /**
  16216. * The form control validator for the min date.
  16217. */
  16218. this._minValidator = (/**
  16219. * @param {?} control
  16220. * @return {?}
  16221. */
  16222. function (control) {
  16223. /** @type {?} */
  16224. var controlValue = _this._getValidDateOrNull(_this._dateAdapter.deserialize(control.value));
  16225. return (!_this.min || !controlValue ||
  16226. _this._dateAdapter.compareDate(_this.min, controlValue) <= 0) ?
  16227. null : { 'matDatepickerMin': { 'min': _this.min, 'actual': controlValue } };
  16228. });
  16229. /**
  16230. * The form control validator for the max date.
  16231. */
  16232. this._maxValidator = (/**
  16233. * @param {?} control
  16234. * @return {?}
  16235. */
  16236. function (control) {
  16237. /** @type {?} */
  16238. var controlValue = _this._getValidDateOrNull(_this._dateAdapter.deserialize(control.value));
  16239. return (!_this.max || !controlValue ||
  16240. _this._dateAdapter.compareDate(_this.max, controlValue) >= 0) ?
  16241. null : { 'matDatepickerMax': { 'max': _this.max, 'actual': controlValue } };
  16242. });
  16243. /**
  16244. * The form control validator for the date filter.
  16245. */
  16246. this._filterValidator = (/**
  16247. * @param {?} control
  16248. * @return {?}
  16249. */
  16250. function (control) {
  16251. /** @type {?} */
  16252. var controlValue = _this._getValidDateOrNull(_this._dateAdapter.deserialize(control.value));
  16253. return !_this._dateFilter || !controlValue || _this._dateFilter(controlValue) ?
  16254. null : { 'matDatepickerFilter': true };
  16255. });
  16256. /**
  16257. * The combined form control validator for this input.
  16258. */
  16259. this._validator = forms.Validators.compose([this._parseValidator, this._minValidator, this._maxValidator, this._filterValidator]);
  16260. /**
  16261. * Whether the last value set on the input was valid.
  16262. */
  16263. this._lastValueValid = false;
  16264. if (!this._dateAdapter) {
  16265. throw createMissingDateImplError('DateAdapter');
  16266. }
  16267. if (!this._dateFormats) {
  16268. throw createMissingDateImplError('MAT_DATE_FORMATS');
  16269. }
  16270. // Update the displayed date when the locale changes.
  16271. this._localeSubscription = _dateAdapter.localeChanges.subscribe((/**
  16272. * @return {?}
  16273. */
  16274. function () {
  16275. _this.value = _this.value;
  16276. }));
  16277. }
  16278. Object.defineProperty(MatDatepickerInput.prototype, "matDatepicker", {
  16279. /** The datepicker that this input is associated with. */
  16280. set: /**
  16281. * The datepicker that this input is associated with.
  16282. * @param {?} value
  16283. * @return {?}
  16284. */
  16285. function (value) {
  16286. var _this = this;
  16287. if (!value) {
  16288. return;
  16289. }
  16290. this._datepicker = value;
  16291. this._datepicker._registerInput(this);
  16292. this._datepickerSubscription.unsubscribe();
  16293. this._datepickerSubscription = this._datepicker._selectedChanged.subscribe((/**
  16294. * @param {?} selected
  16295. * @return {?}
  16296. */
  16297. function (selected) {
  16298. _this.value = selected;
  16299. _this._cvaOnChange(selected);
  16300. _this._onTouched();
  16301. _this.dateInput.emit(new MatDatepickerInputEvent(_this, _this._elementRef.nativeElement));
  16302. _this.dateChange.emit(new MatDatepickerInputEvent(_this, _this._elementRef.nativeElement));
  16303. }));
  16304. },
  16305. enumerable: true,
  16306. configurable: true
  16307. });
  16308. Object.defineProperty(MatDatepickerInput.prototype, "matDatepickerFilter", {
  16309. /** Function that can be used to filter out dates within the datepicker. */
  16310. set: /**
  16311. * Function that can be used to filter out dates within the datepicker.
  16312. * @param {?} value
  16313. * @return {?}
  16314. */
  16315. function (value) {
  16316. this._dateFilter = value;
  16317. this._validatorOnChange();
  16318. },
  16319. enumerable: true,
  16320. configurable: true
  16321. });
  16322. Object.defineProperty(MatDatepickerInput.prototype, "value", {
  16323. /** The value of the input. */
  16324. get: /**
  16325. * The value of the input.
  16326. * @return {?}
  16327. */
  16328. function () { return this._value; },
  16329. set: /**
  16330. * @param {?} value
  16331. * @return {?}
  16332. */
  16333. function (value) {
  16334. value = this._dateAdapter.deserialize(value);
  16335. this._lastValueValid = !value || this._dateAdapter.isValid(value);
  16336. value = this._getValidDateOrNull(value);
  16337. /** @type {?} */
  16338. var oldDate = this.value;
  16339. this._value = value;
  16340. this._formatValue(value);
  16341. if (!this._dateAdapter.sameDate(oldDate, value)) {
  16342. this._valueChange.emit(value);
  16343. }
  16344. },
  16345. enumerable: true,
  16346. configurable: true
  16347. });
  16348. Object.defineProperty(MatDatepickerInput.prototype, "min", {
  16349. /** The minimum valid date. */
  16350. get: /**
  16351. * The minimum valid date.
  16352. * @return {?}
  16353. */
  16354. function () { return this._min; },
  16355. set: /**
  16356. * @param {?} value
  16357. * @return {?}
  16358. */
  16359. function (value) {
  16360. this._min = this._getValidDateOrNull(this._dateAdapter.deserialize(value));
  16361. this._validatorOnChange();
  16362. },
  16363. enumerable: true,
  16364. configurable: true
  16365. });
  16366. Object.defineProperty(MatDatepickerInput.prototype, "max", {
  16367. /** The maximum valid date. */
  16368. get: /**
  16369. * The maximum valid date.
  16370. * @return {?}
  16371. */
  16372. function () { return this._max; },
  16373. set: /**
  16374. * @param {?} value
  16375. * @return {?}
  16376. */
  16377. function (value) {
  16378. this._max = this._getValidDateOrNull(this._dateAdapter.deserialize(value));
  16379. this._validatorOnChange();
  16380. },
  16381. enumerable: true,
  16382. configurable: true
  16383. });
  16384. Object.defineProperty(MatDatepickerInput.prototype, "disabled", {
  16385. /** Whether the datepicker-input is disabled. */
  16386. get: /**
  16387. * Whether the datepicker-input is disabled.
  16388. * @return {?}
  16389. */
  16390. function () { return !!this._disabled; },
  16391. set: /**
  16392. * @param {?} value
  16393. * @return {?}
  16394. */
  16395. function (value) {
  16396. /** @type {?} */
  16397. var newValue = coercion.coerceBooleanProperty(value);
  16398. /** @type {?} */
  16399. var element = this._elementRef.nativeElement;
  16400. if (this._disabled !== newValue) {
  16401. this._disabled = newValue;
  16402. this._disabledChange.emit(newValue);
  16403. }
  16404. // We need to null check the `blur` method, because it's undefined during SSR.
  16405. if (newValue && element.blur) {
  16406. // Normally, native input elements automatically blur if they turn disabled. This behavior
  16407. // is problematic, because it would mean that it triggers another change detection cycle,
  16408. // which then causes a changed after checked error if the input element was focused before.
  16409. element.blur();
  16410. }
  16411. },
  16412. enumerable: true,
  16413. configurable: true
  16414. });
  16415. /**
  16416. * @return {?}
  16417. */
  16418. MatDatepickerInput.prototype.ngOnDestroy = /**
  16419. * @return {?}
  16420. */
  16421. function () {
  16422. this._datepickerSubscription.unsubscribe();
  16423. this._localeSubscription.unsubscribe();
  16424. this._valueChange.complete();
  16425. this._disabledChange.complete();
  16426. };
  16427. /** @docs-private */
  16428. /**
  16429. * \@docs-private
  16430. * @param {?} fn
  16431. * @return {?}
  16432. */
  16433. MatDatepickerInput.prototype.registerOnValidatorChange = /**
  16434. * \@docs-private
  16435. * @param {?} fn
  16436. * @return {?}
  16437. */
  16438. function (fn) {
  16439. this._validatorOnChange = fn;
  16440. };
  16441. /** @docs-private */
  16442. /**
  16443. * \@docs-private
  16444. * @param {?} c
  16445. * @return {?}
  16446. */
  16447. MatDatepickerInput.prototype.validate = /**
  16448. * \@docs-private
  16449. * @param {?} c
  16450. * @return {?}
  16451. */
  16452. function (c) {
  16453. return this._validator ? this._validator(c) : null;
  16454. };
  16455. /**
  16456. * @deprecated
  16457. * @breaking-change 8.0.0 Use `getConnectedOverlayOrigin` instead
  16458. */
  16459. /**
  16460. * @deprecated
  16461. * \@breaking-change 8.0.0 Use `getConnectedOverlayOrigin` instead
  16462. * @return {?}
  16463. */
  16464. MatDatepickerInput.prototype.getPopupConnectionElementRef = /**
  16465. * @deprecated
  16466. * \@breaking-change 8.0.0 Use `getConnectedOverlayOrigin` instead
  16467. * @return {?}
  16468. */
  16469. function () {
  16470. return this.getConnectedOverlayOrigin();
  16471. };
  16472. /**
  16473. * Gets the element that the datepicker popup should be connected to.
  16474. * @return The element to connect the popup to.
  16475. */
  16476. /**
  16477. * Gets the element that the datepicker popup should be connected to.
  16478. * @return {?} The element to connect the popup to.
  16479. */
  16480. MatDatepickerInput.prototype.getConnectedOverlayOrigin = /**
  16481. * Gets the element that the datepicker popup should be connected to.
  16482. * @return {?} The element to connect the popup to.
  16483. */
  16484. function () {
  16485. return this._formField ? this._formField.getConnectedOverlayOrigin() : this._elementRef;
  16486. };
  16487. // Implemented as part of ControlValueAccessor.
  16488. // Implemented as part of ControlValueAccessor.
  16489. /**
  16490. * @param {?} value
  16491. * @return {?}
  16492. */
  16493. MatDatepickerInput.prototype.writeValue =
  16494. // Implemented as part of ControlValueAccessor.
  16495. /**
  16496. * @param {?} value
  16497. * @return {?}
  16498. */
  16499. function (value) {
  16500. this.value = value;
  16501. };
  16502. // Implemented as part of ControlValueAccessor.
  16503. // Implemented as part of ControlValueAccessor.
  16504. /**
  16505. * @param {?} fn
  16506. * @return {?}
  16507. */
  16508. MatDatepickerInput.prototype.registerOnChange =
  16509. // Implemented as part of ControlValueAccessor.
  16510. /**
  16511. * @param {?} fn
  16512. * @return {?}
  16513. */
  16514. function (fn) {
  16515. this._cvaOnChange = fn;
  16516. };
  16517. // Implemented as part of ControlValueAccessor.
  16518. // Implemented as part of ControlValueAccessor.
  16519. /**
  16520. * @param {?} fn
  16521. * @return {?}
  16522. */
  16523. MatDatepickerInput.prototype.registerOnTouched =
  16524. // Implemented as part of ControlValueAccessor.
  16525. /**
  16526. * @param {?} fn
  16527. * @return {?}
  16528. */
  16529. function (fn) {
  16530. this._onTouched = fn;
  16531. };
  16532. // Implemented as part of ControlValueAccessor.
  16533. // Implemented as part of ControlValueAccessor.
  16534. /**
  16535. * @param {?} isDisabled
  16536. * @return {?}
  16537. */
  16538. MatDatepickerInput.prototype.setDisabledState =
  16539. // Implemented as part of ControlValueAccessor.
  16540. /**
  16541. * @param {?} isDisabled
  16542. * @return {?}
  16543. */
  16544. function (isDisabled) {
  16545. this.disabled = isDisabled;
  16546. };
  16547. /**
  16548. * @param {?} event
  16549. * @return {?}
  16550. */
  16551. MatDatepickerInput.prototype._onKeydown = /**
  16552. * @param {?} event
  16553. * @return {?}
  16554. */
  16555. function (event) {
  16556. /** @type {?} */
  16557. var isAltDownArrow = event.altKey && event.keyCode === keycodes.DOWN_ARROW;
  16558. if (this._datepicker && isAltDownArrow && !this._elementRef.nativeElement.readOnly) {
  16559. this._datepicker.open();
  16560. event.preventDefault();
  16561. }
  16562. };
  16563. /**
  16564. * @param {?} value
  16565. * @return {?}
  16566. */
  16567. MatDatepickerInput.prototype._onInput = /**
  16568. * @param {?} value
  16569. * @return {?}
  16570. */
  16571. function (value) {
  16572. /** @type {?} */
  16573. var date = this._dateAdapter.parse(value, this._dateFormats.parse.dateInput);
  16574. this._lastValueValid = !date || this._dateAdapter.isValid(date);
  16575. date = this._getValidDateOrNull(date);
  16576. if (!this._dateAdapter.sameDate(date, this._value)) {
  16577. this._value = date;
  16578. this._cvaOnChange(date);
  16579. this._valueChange.emit(date);
  16580. this.dateInput.emit(new MatDatepickerInputEvent(this, this._elementRef.nativeElement));
  16581. }
  16582. else {
  16583. this._validatorOnChange();
  16584. }
  16585. };
  16586. /**
  16587. * @return {?}
  16588. */
  16589. MatDatepickerInput.prototype._onChange = /**
  16590. * @return {?}
  16591. */
  16592. function () {
  16593. this.dateChange.emit(new MatDatepickerInputEvent(this, this._elementRef.nativeElement));
  16594. };
  16595. /** Returns the palette used by the input's form field, if any. */
  16596. /**
  16597. * Returns the palette used by the input's form field, if any.
  16598. * @return {?}
  16599. */
  16600. MatDatepickerInput.prototype._getThemePalette = /**
  16601. * Returns the palette used by the input's form field, if any.
  16602. * @return {?}
  16603. */
  16604. function () {
  16605. return this._formField ? this._formField.color : undefined;
  16606. };
  16607. /** Handles blur events on the input. */
  16608. /**
  16609. * Handles blur events on the input.
  16610. * @return {?}
  16611. */
  16612. MatDatepickerInput.prototype._onBlur = /**
  16613. * Handles blur events on the input.
  16614. * @return {?}
  16615. */
  16616. function () {
  16617. // Reformat the input only if we have a valid value.
  16618. if (this.value) {
  16619. this._formatValue(this.value);
  16620. }
  16621. this._onTouched();
  16622. };
  16623. /** Formats a value and sets it on the input element. */
  16624. /**
  16625. * Formats a value and sets it on the input element.
  16626. * @private
  16627. * @param {?} value
  16628. * @return {?}
  16629. */
  16630. MatDatepickerInput.prototype._formatValue = /**
  16631. * Formats a value and sets it on the input element.
  16632. * @private
  16633. * @param {?} value
  16634. * @return {?}
  16635. */
  16636. function (value) {
  16637. this._elementRef.nativeElement.value =
  16638. value ? this._dateAdapter.format(value, this._dateFormats.display.dateInput) : '';
  16639. };
  16640. /**
  16641. * @param obj The object to check.
  16642. * @returns The given object if it is both a date instance and valid, otherwise null.
  16643. */
  16644. /**
  16645. * @private
  16646. * @param {?} obj The object to check.
  16647. * @return {?} The given object if it is both a date instance and valid, otherwise null.
  16648. */
  16649. MatDatepickerInput.prototype._getValidDateOrNull = /**
  16650. * @private
  16651. * @param {?} obj The object to check.
  16652. * @return {?} The given object if it is both a date instance and valid, otherwise null.
  16653. */
  16654. function (obj) {
  16655. return (this._dateAdapter.isDateInstance(obj) && this._dateAdapter.isValid(obj)) ? obj : null;
  16656. };
  16657. MatDatepickerInput.decorators = [
  16658. { type: core.Directive, args: [{
  16659. selector: 'input[matDatepicker]',
  16660. providers: [
  16661. MAT_DATEPICKER_VALUE_ACCESSOR,
  16662. MAT_DATEPICKER_VALIDATORS,
  16663. { provide: MAT_INPUT_VALUE_ACCESSOR, useExisting: MatDatepickerInput },
  16664. ],
  16665. host: {
  16666. '[attr.aria-haspopup]': '_datepicker ? "dialog" : null',
  16667. '[attr.aria-owns]': '(_datepicker?.opened && _datepicker.id) || null',
  16668. '[attr.min]': 'min ? _dateAdapter.toIso8601(min) : null',
  16669. '[attr.max]': 'max ? _dateAdapter.toIso8601(max) : null',
  16670. '[disabled]': 'disabled',
  16671. '(input)': '_onInput($event.target.value)',
  16672. '(change)': '_onChange()',
  16673. '(blur)': '_onBlur()',
  16674. '(keydown)': '_onKeydown($event)',
  16675. },
  16676. exportAs: 'matDatepickerInput',
  16677. },] },
  16678. ];
  16679. /** @nocollapse */
  16680. MatDatepickerInput.ctorParameters = function () { return [
  16681. { type: core.ElementRef },
  16682. { type: DateAdapter, decorators: [{ type: core.Optional }] },
  16683. { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_DATE_FORMATS,] }] },
  16684. { type: MatFormField, decorators: [{ type: core.Optional }] }
  16685. ]; };
  16686. MatDatepickerInput.propDecorators = {
  16687. matDatepicker: [{ type: core.Input }],
  16688. matDatepickerFilter: [{ type: core.Input }],
  16689. value: [{ type: core.Input }],
  16690. min: [{ type: core.Input }],
  16691. max: [{ type: core.Input }],
  16692. disabled: [{ type: core.Input }],
  16693. dateChange: [{ type: core.Output }],
  16694. dateInput: [{ type: core.Output }]
  16695. };
  16696. return MatDatepickerInput;
  16697. }());
  16698. /**
  16699. * @fileoverview added by tsickle
  16700. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  16701. */
  16702. /**
  16703. * Can be used to override the icon of a `matDatepickerToggle`.
  16704. */
  16705. var MatDatepickerToggleIcon = /** @class */ (function () {
  16706. function MatDatepickerToggleIcon() {
  16707. }
  16708. MatDatepickerToggleIcon.decorators = [
  16709. { type: core.Directive, args: [{
  16710. selector: '[matDatepickerToggleIcon]'
  16711. },] },
  16712. ];
  16713. return MatDatepickerToggleIcon;
  16714. }());
  16715. /**
  16716. * @template D
  16717. */
  16718. var MatDatepickerToggle = /** @class */ (function () {
  16719. function MatDatepickerToggle(_intl, _changeDetectorRef, defaultTabIndex) {
  16720. this._intl = _intl;
  16721. this._changeDetectorRef = _changeDetectorRef;
  16722. this._stateChanges = rxjs.Subscription.EMPTY;
  16723. /** @type {?} */
  16724. var parsedTabIndex = Number(defaultTabIndex);
  16725. this.tabIndex = (parsedTabIndex || parsedTabIndex === 0) ? parsedTabIndex : null;
  16726. }
  16727. Object.defineProperty(MatDatepickerToggle.prototype, "disabled", {
  16728. /** Whether the toggle button is disabled. */
  16729. get: /**
  16730. * Whether the toggle button is disabled.
  16731. * @return {?}
  16732. */
  16733. function () {
  16734. if (this._disabled === undefined && this.datepicker) {
  16735. return this.datepicker.disabled;
  16736. }
  16737. return !!this._disabled;
  16738. },
  16739. set: /**
  16740. * @param {?} value
  16741. * @return {?}
  16742. */
  16743. function (value) {
  16744. this._disabled = coercion.coerceBooleanProperty(value);
  16745. },
  16746. enumerable: true,
  16747. configurable: true
  16748. });
  16749. /**
  16750. * @param {?} changes
  16751. * @return {?}
  16752. */
  16753. MatDatepickerToggle.prototype.ngOnChanges = /**
  16754. * @param {?} changes
  16755. * @return {?}
  16756. */
  16757. function (changes) {
  16758. if (changes['datepicker']) {
  16759. this._watchStateChanges();
  16760. }
  16761. };
  16762. /**
  16763. * @return {?}
  16764. */
  16765. MatDatepickerToggle.prototype.ngOnDestroy = /**
  16766. * @return {?}
  16767. */
  16768. function () {
  16769. this._stateChanges.unsubscribe();
  16770. };
  16771. /**
  16772. * @return {?}
  16773. */
  16774. MatDatepickerToggle.prototype.ngAfterContentInit = /**
  16775. * @return {?}
  16776. */
  16777. function () {
  16778. this._watchStateChanges();
  16779. };
  16780. /**
  16781. * @param {?} event
  16782. * @return {?}
  16783. */
  16784. MatDatepickerToggle.prototype._open = /**
  16785. * @param {?} event
  16786. * @return {?}
  16787. */
  16788. function (event) {
  16789. if (this.datepicker && !this.disabled) {
  16790. this.datepicker.open();
  16791. event.stopPropagation();
  16792. }
  16793. };
  16794. /**
  16795. * @private
  16796. * @return {?}
  16797. */
  16798. MatDatepickerToggle.prototype._watchStateChanges = /**
  16799. * @private
  16800. * @return {?}
  16801. */
  16802. function () {
  16803. var _this = this;
  16804. /** @type {?} */
  16805. var datepickerDisabled = this.datepicker ? this.datepicker._disabledChange : rxjs.of();
  16806. /** @type {?} */
  16807. var inputDisabled = this.datepicker && this.datepicker._datepickerInput ?
  16808. this.datepicker._datepickerInput._disabledChange : rxjs.of();
  16809. /** @type {?} */
  16810. var datepickerToggled = this.datepicker ?
  16811. rxjs.merge(this.datepicker.openedStream, this.datepicker.closedStream) :
  16812. rxjs.of();
  16813. this._stateChanges.unsubscribe();
  16814. this._stateChanges = rxjs.merge(this._intl.changes, datepickerDisabled, inputDisabled, datepickerToggled).subscribe((/**
  16815. * @return {?}
  16816. */
  16817. function () { return _this._changeDetectorRef.markForCheck(); }));
  16818. };
  16819. MatDatepickerToggle.decorators = [
  16820. { type: core.Component, args: [{selector: 'mat-datepicker-toggle',
  16821. template: "<button #button mat-icon-button type=\"button\" [attr.aria-haspopup]=\"datepicker ? 'dialog' : null\" [attr.aria-label]=\"_intl.openCalendarLabel\" [attr.tabindex]=\"disabled ? -1 : tabIndex\" [disabled]=\"disabled\" [disableRipple]=\"disableRipple\" (click)=\"_open($event)\"><svg *ngIf=\"!_customIcon\" class=\"mat-datepicker-toggle-default-icon\" viewBox=\"0 0 24 24\" width=\"24px\" height=\"24px\" fill=\"currentColor\" focusable=\"false\"><path d=\"M19 3h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM7 10h5v5H7z\"/></svg><ng-content select=\"[matDatepickerToggleIcon]\"></ng-content></button>",
  16822. styles: [".mat-form-field-appearance-legacy .mat-form-field-prefix .mat-datepicker-toggle-default-icon,.mat-form-field-appearance-legacy .mat-form-field-suffix .mat-datepicker-toggle-default-icon{width:1em}.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-prefix .mat-datepicker-toggle-default-icon,.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-suffix .mat-datepicker-toggle-default-icon{display:block;width:1.5em;height:1.5em}.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-prefix .mat-icon-button .mat-datepicker-toggle-default-icon,.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-suffix .mat-icon-button .mat-datepicker-toggle-default-icon{margin:auto}"],
  16823. host: {
  16824. 'class': 'mat-datepicker-toggle',
  16825. // Always set the tabindex to -1 so that it doesn't overlap with any custom tabindex the
  16826. // consumer may have provided, while still being able to receive focus.
  16827. '[attr.tabindex]': '-1',
  16828. '[class.mat-datepicker-toggle-active]': 'datepicker && datepicker.opened',
  16829. '[class.mat-accent]': 'datepicker && datepicker.color === "accent"',
  16830. '[class.mat-warn]': 'datepicker && datepicker.color === "warn"',
  16831. '(focus)': '_button.focus()',
  16832. },
  16833. exportAs: 'matDatepickerToggle',
  16834. encapsulation: core.ViewEncapsulation.None,
  16835. changeDetection: core.ChangeDetectionStrategy.OnPush,
  16836. },] },
  16837. ];
  16838. /** @nocollapse */
  16839. MatDatepickerToggle.ctorParameters = function () { return [
  16840. { type: MatDatepickerIntl },
  16841. { type: core.ChangeDetectorRef },
  16842. { type: String, decorators: [{ type: core.Attribute, args: ['tabindex',] }] }
  16843. ]; };
  16844. MatDatepickerToggle.propDecorators = {
  16845. datepicker: [{ type: core.Input, args: ['for',] }],
  16846. tabIndex: [{ type: core.Input }],
  16847. disabled: [{ type: core.Input }],
  16848. disableRipple: [{ type: core.Input }],
  16849. _customIcon: [{ type: core.ContentChild, args: [MatDatepickerToggleIcon, { static: false },] }],
  16850. _button: [{ type: core.ViewChild, args: ['button', { static: false },] }]
  16851. };
  16852. return MatDatepickerToggle;
  16853. }());
  16854. /**
  16855. * @fileoverview added by tsickle
  16856. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  16857. */
  16858. var MatDatepickerModule = /** @class */ (function () {
  16859. function MatDatepickerModule() {
  16860. }
  16861. MatDatepickerModule.decorators = [
  16862. { type: core.NgModule, args: [{
  16863. imports: [
  16864. common.CommonModule,
  16865. MatButtonModule,
  16866. MatDialogModule,
  16867. overlay.OverlayModule,
  16868. a11y.A11yModule,
  16869. portal.PortalModule,
  16870. ],
  16871. exports: [
  16872. MatCalendar,
  16873. MatCalendarBody,
  16874. MatDatepicker,
  16875. MatDatepickerContent,
  16876. MatDatepickerInput,
  16877. MatDatepickerToggle,
  16878. MatDatepickerToggleIcon,
  16879. MatMonthView,
  16880. MatYearView,
  16881. MatMultiYearView,
  16882. MatCalendarHeader,
  16883. ],
  16884. declarations: [
  16885. MatCalendar,
  16886. MatCalendarBody,
  16887. MatDatepicker,
  16888. MatDatepickerContent,
  16889. MatDatepickerInput,
  16890. MatDatepickerToggle,
  16891. MatDatepickerToggleIcon,
  16892. MatMonthView,
  16893. MatYearView,
  16894. MatMultiYearView,
  16895. MatCalendarHeader,
  16896. ],
  16897. providers: [
  16898. MatDatepickerIntl,
  16899. MAT_DATEPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER,
  16900. ],
  16901. entryComponents: [
  16902. MatDatepickerContent,
  16903. MatCalendarHeader,
  16904. ]
  16905. },] },
  16906. ];
  16907. return MatDatepickerModule;
  16908. }());
  16909. /**
  16910. * @fileoverview added by tsickle
  16911. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  16912. */
  16913. var MatDivider = /** @class */ (function () {
  16914. function MatDivider() {
  16915. this._vertical = false;
  16916. this._inset = false;
  16917. }
  16918. Object.defineProperty(MatDivider.prototype, "vertical", {
  16919. /** Whether the divider is vertically aligned. */
  16920. get: /**
  16921. * Whether the divider is vertically aligned.
  16922. * @return {?}
  16923. */
  16924. function () { return this._vertical; },
  16925. set: /**
  16926. * @param {?} value
  16927. * @return {?}
  16928. */
  16929. function (value) { this._vertical = coercion.coerceBooleanProperty(value); },
  16930. enumerable: true,
  16931. configurable: true
  16932. });
  16933. Object.defineProperty(MatDivider.prototype, "inset", {
  16934. /** Whether the divider is an inset divider. */
  16935. get: /**
  16936. * Whether the divider is an inset divider.
  16937. * @return {?}
  16938. */
  16939. function () { return this._inset; },
  16940. set: /**
  16941. * @param {?} value
  16942. * @return {?}
  16943. */
  16944. function (value) { this._inset = coercion.coerceBooleanProperty(value); },
  16945. enumerable: true,
  16946. configurable: true
  16947. });
  16948. MatDivider.decorators = [
  16949. { type: core.Component, args: [{selector: 'mat-divider',
  16950. host: {
  16951. 'role': 'separator',
  16952. '[attr.aria-orientation]': 'vertical ? "vertical" : "horizontal"',
  16953. '[class.mat-divider-vertical]': 'vertical',
  16954. '[class.mat-divider-horizontal]': '!vertical',
  16955. '[class.mat-divider-inset]': 'inset',
  16956. 'class': 'mat-divider'
  16957. },
  16958. template: '',
  16959. styles: [".mat-divider{display:block;margin:0;border-top-width:1px;border-top-style:solid}.mat-divider.mat-divider-vertical{border-top:0;border-right-width:1px;border-right-style:solid}.mat-divider.mat-divider-inset{margin-left:80px}[dir=rtl] .mat-divider.mat-divider-inset{margin-left:auto;margin-right:80px}"],
  16960. encapsulation: core.ViewEncapsulation.None,
  16961. changeDetection: core.ChangeDetectionStrategy.OnPush,
  16962. },] },
  16963. ];
  16964. MatDivider.propDecorators = {
  16965. vertical: [{ type: core.Input }],
  16966. inset: [{ type: core.Input }]
  16967. };
  16968. return MatDivider;
  16969. }());
  16970. /**
  16971. * @fileoverview added by tsickle
  16972. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  16973. */
  16974. var MatDividerModule = /** @class */ (function () {
  16975. function MatDividerModule() {
  16976. }
  16977. MatDividerModule.decorators = [
  16978. { type: core.NgModule, args: [{
  16979. imports: [MatCommonModule, common.CommonModule],
  16980. exports: [MatDivider, MatCommonModule],
  16981. declarations: [MatDivider],
  16982. },] },
  16983. ];
  16984. return MatDividerModule;
  16985. }());
  16986. /**
  16987. * @fileoverview added by tsickle
  16988. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  16989. */
  16990. /**
  16991. * Token used to provide a `MatAccordion` to `MatExpansionPanel`.
  16992. * Used primarily to avoid circular imports between `MatAccordion` and `MatExpansionPanel`.
  16993. * @type {?}
  16994. */
  16995. var MAT_ACCORDION = new core.InjectionToken('MAT_ACCORDION');
  16996. /**
  16997. * @fileoverview added by tsickle
  16998. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  16999. */
  17000. /**
  17001. * Time and timing curve for expansion panel animations.
  17002. * @type {?}
  17003. */
  17004. var EXPANSION_PANEL_ANIMATION_TIMING = '225ms cubic-bezier(0.4,0.0,0.2,1)';
  17005. /**
  17006. * Animations used by the Material expansion panel.
  17007. *
  17008. * A bug in angular animation's `state` when ViewContainers are moved using ViewContainerRef.move()
  17009. * causes the animation state of moved components to become `void` upon exit, and not update again
  17010. * upon reentry into the DOM. This can lead a to situation for the expansion panel where the state
  17011. * of the panel is `expanded` or `collapsed` but the animation state is `void`.
  17012. *
  17013. * To correctly handle animating to the next state, we animate between `void` and `collapsed` which
  17014. * are defined to have the same styles. Since angular animates from the current styles to the
  17015. * destination state's style definition, in situations where we are moving from `void`'s styles to
  17016. * `collapsed` this acts a noop since no style values change.
  17017. *
  17018. * In the case where angular's animation state is out of sync with the expansion panel's state, the
  17019. * expansion panel being `expanded` and angular animations being `void`, the animation from the
  17020. * `expanded`'s effective styles (though in a `void` animation state) to the collapsed state will
  17021. * occur as expected.
  17022. *
  17023. * Angular Bug: https://github.com/angular/angular/issues/18847
  17024. *
  17025. * \@docs-private
  17026. * @type {?}
  17027. */
  17028. var matExpansionAnimations = {
  17029. /**
  17030. * Animation that rotates the indicator arrow.
  17031. */
  17032. indicatorRotate: animations$1.trigger('indicatorRotate', [
  17033. animations$1.state('collapsed, void', animations$1.style({ transform: 'rotate(0deg)' })),
  17034. animations$1.state('expanded', animations$1.style({ transform: 'rotate(180deg)' })),
  17035. animations$1.transition('expanded <=> collapsed, void => collapsed', animations$1.animate(EXPANSION_PANEL_ANIMATION_TIMING)),
  17036. ]),
  17037. /**
  17038. * Animation that expands and collapses the panel header height.
  17039. */
  17040. expansionHeaderHeight: animations$1.trigger('expansionHeight', [
  17041. animations$1.state('collapsed, void', animations$1.style({
  17042. height: '{{collapsedHeight}}',
  17043. }), {
  17044. params: { collapsedHeight: '48px' },
  17045. }),
  17046. animations$1.state('expanded', animations$1.style({
  17047. height: '{{expandedHeight}}'
  17048. }), {
  17049. params: { expandedHeight: '64px' }
  17050. }),
  17051. animations$1.transition('expanded <=> collapsed, void => collapsed', animations$1.group([
  17052. animations$1.query('@indicatorRotate', animations$1.animateChild(), { optional: true }),
  17053. animations$1.animate(EXPANSION_PANEL_ANIMATION_TIMING),
  17054. ])),
  17055. ]),
  17056. /**
  17057. * Animation that expands and collapses the panel content.
  17058. */
  17059. bodyExpansion: animations$1.trigger('bodyExpansion', [
  17060. animations$1.state('collapsed, void', animations$1.style({ height: '0px', visibility: 'hidden' })),
  17061. animations$1.state('expanded', animations$1.style({ height: '*', visibility: 'visible' })),
  17062. animations$1.transition('expanded <=> collapsed, void => collapsed', animations$1.animate(EXPANSION_PANEL_ANIMATION_TIMING)),
  17063. ])
  17064. };
  17065. /**
  17066. * @fileoverview added by tsickle
  17067. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  17068. */
  17069. /**
  17070. * Expansion panel content that will be rendered lazily
  17071. * after the panel is opened for the first time.
  17072. */
  17073. var MatExpansionPanelContent = /** @class */ (function () {
  17074. function MatExpansionPanelContent(_template) {
  17075. this._template = _template;
  17076. }
  17077. MatExpansionPanelContent.decorators = [
  17078. { type: core.Directive, args: [{
  17079. selector: 'ng-template[matExpansionPanelContent]'
  17080. },] },
  17081. ];
  17082. /** @nocollapse */
  17083. MatExpansionPanelContent.ctorParameters = function () { return [
  17084. { type: core.TemplateRef }
  17085. ]; };
  17086. return MatExpansionPanelContent;
  17087. }());
  17088. /**
  17089. * @fileoverview added by tsickle
  17090. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  17091. */
  17092. /**
  17093. * Counter for generating unique element ids.
  17094. * @type {?}
  17095. */
  17096. var uniqueId$1 = 0;
  17097. /**
  17098. * Injection token that can be used to configure the defalt
  17099. * options for the expansion panel component.
  17100. * @type {?}
  17101. */
  17102. var MAT_EXPANSION_PANEL_DEFAULT_OPTIONS = new core.InjectionToken('MAT_EXPANSION_PANEL_DEFAULT_OPTIONS');
  17103. var ɵ0$4 = undefined;
  17104. /**
  17105. * `<mat-expansion-panel>`
  17106. *
  17107. * This component can be used as a single element to show expandable content, or as one of
  17108. * multiple children of an element with the MatAccordion directive attached.
  17109. */
  17110. var MatExpansionPanel = /** @class */ (function (_super) {
  17111. __extends(MatExpansionPanel, _super);
  17112. function MatExpansionPanel(accordion$$1, _changeDetectorRef, _uniqueSelectionDispatcher, _viewContainerRef, _document, _animationMode, defaultOptions) {
  17113. var _this = _super.call(this, accordion$$1, _changeDetectorRef, _uniqueSelectionDispatcher) || this;
  17114. _this._viewContainerRef = _viewContainerRef;
  17115. _this._animationMode = _animationMode;
  17116. _this._hideToggle = false;
  17117. /**
  17118. * An event emitted after the body's expansion animation happens.
  17119. */
  17120. _this.afterExpand = new core.EventEmitter();
  17121. /**
  17122. * An event emitted after the body's collapse animation happens.
  17123. */
  17124. _this.afterCollapse = new core.EventEmitter();
  17125. /**
  17126. * Stream that emits for changes in `\@Input` properties.
  17127. */
  17128. _this._inputChanges = new rxjs.Subject();
  17129. /**
  17130. * ID for the associated header element. Used for a11y labelling.
  17131. */
  17132. _this._headerId = "mat-expansion-panel-header-" + uniqueId$1++;
  17133. /**
  17134. * Stream of body animation done events.
  17135. */
  17136. _this._bodyAnimationDone = new rxjs.Subject();
  17137. _this.accordion = accordion$$1;
  17138. _this._document = _document;
  17139. // We need a Subject with distinctUntilChanged, because the `done` event
  17140. // fires twice on some browsers. See https://github.com/angular/angular/issues/24084
  17141. _this._bodyAnimationDone.pipe(operators.distinctUntilChanged((/**
  17142. * @param {?} x
  17143. * @param {?} y
  17144. * @return {?}
  17145. */
  17146. function (x, y) {
  17147. return x.fromState === y.fromState && x.toState === y.toState;
  17148. }))).subscribe((/**
  17149. * @param {?} event
  17150. * @return {?}
  17151. */
  17152. function (event) {
  17153. if (event.fromState !== 'void') {
  17154. if (event.toState === 'expanded') {
  17155. _this.afterExpand.emit();
  17156. }
  17157. else if (event.toState === 'collapsed') {
  17158. _this.afterCollapse.emit();
  17159. }
  17160. }
  17161. }));
  17162. if (defaultOptions) {
  17163. _this.hideToggle = defaultOptions.hideToggle;
  17164. }
  17165. return _this;
  17166. }
  17167. Object.defineProperty(MatExpansionPanel.prototype, "hideToggle", {
  17168. /** Whether the toggle indicator should be hidden. */
  17169. get: /**
  17170. * Whether the toggle indicator should be hidden.
  17171. * @return {?}
  17172. */
  17173. function () {
  17174. return this._hideToggle || (this.accordion && this.accordion.hideToggle);
  17175. },
  17176. set: /**
  17177. * @param {?} value
  17178. * @return {?}
  17179. */
  17180. function (value) {
  17181. this._hideToggle = coercion.coerceBooleanProperty(value);
  17182. },
  17183. enumerable: true,
  17184. configurable: true
  17185. });
  17186. Object.defineProperty(MatExpansionPanel.prototype, "togglePosition", {
  17187. /** The position of the expansion indicator. */
  17188. get: /**
  17189. * The position of the expansion indicator.
  17190. * @return {?}
  17191. */
  17192. function () {
  17193. return this._togglePosition || (this.accordion && this.accordion.togglePosition);
  17194. },
  17195. set: /**
  17196. * @param {?} value
  17197. * @return {?}
  17198. */
  17199. function (value) {
  17200. this._togglePosition = value;
  17201. },
  17202. enumerable: true,
  17203. configurable: true
  17204. });
  17205. /** Determines whether the expansion panel should have spacing between it and its siblings. */
  17206. /**
  17207. * Determines whether the expansion panel should have spacing between it and its siblings.
  17208. * @return {?}
  17209. */
  17210. MatExpansionPanel.prototype._hasSpacing = /**
  17211. * Determines whether the expansion panel should have spacing between it and its siblings.
  17212. * @return {?}
  17213. */
  17214. function () {
  17215. if (this.accordion) {
  17216. // We don't need to subscribe to the `stateChanges` of the parent accordion because each time
  17217. // the [displayMode] input changes, the change detection will also cover the host bindings
  17218. // of this expansion panel.
  17219. return (this.expanded ? this.accordion.displayMode : this._getExpandedState()) === 'default';
  17220. }
  17221. return false;
  17222. };
  17223. /** Gets the expanded state string. */
  17224. /**
  17225. * Gets the expanded state string.
  17226. * @return {?}
  17227. */
  17228. MatExpansionPanel.prototype._getExpandedState = /**
  17229. * Gets the expanded state string.
  17230. * @return {?}
  17231. */
  17232. function () {
  17233. return this.expanded ? 'expanded' : 'collapsed';
  17234. };
  17235. /**
  17236. * @return {?}
  17237. */
  17238. MatExpansionPanel.prototype.ngAfterContentInit = /**
  17239. * @return {?}
  17240. */
  17241. function () {
  17242. var _this = this;
  17243. if (this._lazyContent) {
  17244. // Render the content as soon as the panel becomes open.
  17245. this.opened.pipe(operators.startWith((/** @type {?} */ (null))), operators.filter((/**
  17246. * @return {?}
  17247. */
  17248. function () { return _this.expanded && !_this._portal; })), operators.take(1)).subscribe((/**
  17249. * @return {?}
  17250. */
  17251. function () {
  17252. _this._portal = new portal.TemplatePortal(_this._lazyContent._template, _this._viewContainerRef);
  17253. }));
  17254. }
  17255. };
  17256. /**
  17257. * @param {?} changes
  17258. * @return {?}
  17259. */
  17260. MatExpansionPanel.prototype.ngOnChanges = /**
  17261. * @param {?} changes
  17262. * @return {?}
  17263. */
  17264. function (changes) {
  17265. this._inputChanges.next(changes);
  17266. };
  17267. /**
  17268. * @return {?}
  17269. */
  17270. MatExpansionPanel.prototype.ngOnDestroy = /**
  17271. * @return {?}
  17272. */
  17273. function () {
  17274. _super.prototype.ngOnDestroy.call(this);
  17275. this._bodyAnimationDone.complete();
  17276. this._inputChanges.complete();
  17277. };
  17278. /** Checks whether the expansion panel's content contains the currently-focused element. */
  17279. /**
  17280. * Checks whether the expansion panel's content contains the currently-focused element.
  17281. * @return {?}
  17282. */
  17283. MatExpansionPanel.prototype._containsFocus = /**
  17284. * Checks whether the expansion panel's content contains the currently-focused element.
  17285. * @return {?}
  17286. */
  17287. function () {
  17288. if (this._body) {
  17289. /** @type {?} */
  17290. var focusedElement = this._document.activeElement;
  17291. /** @type {?} */
  17292. var bodyElement = this._body.nativeElement;
  17293. return focusedElement === bodyElement || bodyElement.contains(focusedElement);
  17294. }
  17295. return false;
  17296. };
  17297. MatExpansionPanel.decorators = [
  17298. { type: core.Component, args: [{styles: [".mat-expansion-panel{box-sizing:content-box;display:block;margin:0;border-radius:4px;overflow:hidden;transition:margin 225ms cubic-bezier(.4,0,.2,1),box-shadow 280ms cubic-bezier(.4,0,.2,1)}.mat-accordion .mat-expansion-panel:not(.mat-expanded),.mat-accordion .mat-expansion-panel:not(.mat-expansion-panel-spacing){border-radius:0}.mat-accordion .mat-expansion-panel:first-of-type{border-top-right-radius:4px;border-top-left-radius:4px}.mat-accordion .mat-expansion-panel:last-of-type{border-bottom-right-radius:4px;border-bottom-left-radius:4px}@media (-ms-high-contrast:active){.mat-expansion-panel{outline:solid 1px}}.mat-expansion-panel._mat-animation-noopable,.mat-expansion-panel.ng-animate-disabled,.ng-animate-disabled .mat-expansion-panel{transition:none}.mat-expansion-panel-content{display:flex;flex-direction:column;overflow:visible}.mat-expansion-panel-body{padding:0 24px 16px}.mat-expansion-panel-spacing{margin:16px 0}.mat-accordion>.mat-expansion-panel-spacing:first-child,.mat-accordion>:first-child:not(.mat-expansion-panel) .mat-expansion-panel-spacing{margin-top:0}.mat-accordion>.mat-expansion-panel-spacing:last-child,.mat-accordion>:last-child:not(.mat-expansion-panel) .mat-expansion-panel-spacing{margin-bottom:0}.mat-action-row{border-top-style:solid;border-top-width:1px;display:flex;flex-direction:row;justify-content:flex-end;padding:16px 8px 16px 24px}.mat-action-row button.mat-button-base{margin-left:8px}[dir=rtl] .mat-action-row button.mat-button-base{margin-left:0;margin-right:8px}"],
  17299. selector: 'mat-expansion-panel',
  17300. exportAs: 'matExpansionPanel',
  17301. template: "<ng-content select=\"mat-expansion-panel-header\"></ng-content><div class=\"mat-expansion-panel-content\" role=\"region\" [@bodyExpansion]=\"_getExpandedState()\" (@bodyExpansion.done)=\"_bodyAnimationDone.next($event)\" [attr.aria-labelledby]=\"_headerId\" [id]=\"id\" #body><div class=\"mat-expansion-panel-body\"><ng-content></ng-content><ng-template [cdkPortalOutlet]=\"_portal\"></ng-template></div><ng-content select=\"mat-action-row\"></ng-content></div>",
  17302. encapsulation: core.ViewEncapsulation.None,
  17303. changeDetection: core.ChangeDetectionStrategy.OnPush,
  17304. inputs: ['disabled', 'expanded'],
  17305. outputs: ['opened', 'closed', 'expandedChange'],
  17306. animations: [matExpansionAnimations.bodyExpansion],
  17307. providers: [
  17308. // Provide MatAccordion as undefined to prevent nested expansion panels from registering
  17309. // to the same accordion.
  17310. { provide: MAT_ACCORDION, useValue: ɵ0$4 },
  17311. ],
  17312. host: {
  17313. 'class': 'mat-expansion-panel',
  17314. '[class.mat-expanded]': 'expanded',
  17315. '[class._mat-animation-noopable]': '_animationMode === "NoopAnimations"',
  17316. '[class.mat-expansion-panel-spacing]': '_hasSpacing()',
  17317. }
  17318. },] },
  17319. ];
  17320. /** @nocollapse */
  17321. MatExpansionPanel.ctorParameters = function () { return [
  17322. { type: undefined, decorators: [{ type: core.Optional }, { type: core.SkipSelf }, { type: core.Inject, args: [MAT_ACCORDION,] }] },
  17323. { type: core.ChangeDetectorRef },
  17324. { type: collections.UniqueSelectionDispatcher },
  17325. { type: core.ViewContainerRef },
  17326. { type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] },
  17327. { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] },
  17328. { type: undefined, decorators: [{ type: core.Inject, args: [MAT_EXPANSION_PANEL_DEFAULT_OPTIONS,] }, { type: core.Optional }] }
  17329. ]; };
  17330. MatExpansionPanel.propDecorators = {
  17331. hideToggle: [{ type: core.Input }],
  17332. togglePosition: [{ type: core.Input }],
  17333. afterExpand: [{ type: core.Output }],
  17334. afterCollapse: [{ type: core.Output }],
  17335. _lazyContent: [{ type: core.ContentChild, args: [MatExpansionPanelContent, { static: false },] }],
  17336. _body: [{ type: core.ViewChild, args: ['body', { static: false },] }]
  17337. };
  17338. return MatExpansionPanel;
  17339. }(accordion.CdkAccordionItem));
  17340. var MatExpansionPanelActionRow = /** @class */ (function () {
  17341. function MatExpansionPanelActionRow() {
  17342. }
  17343. MatExpansionPanelActionRow.decorators = [
  17344. { type: core.Directive, args: [{
  17345. selector: 'mat-action-row',
  17346. host: {
  17347. class: 'mat-action-row'
  17348. }
  17349. },] },
  17350. ];
  17351. return MatExpansionPanelActionRow;
  17352. }());
  17353. /**
  17354. * @fileoverview added by tsickle
  17355. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  17356. */
  17357. /**
  17358. * `<mat-expansion-panel-header>`
  17359. *
  17360. * This component corresponds to the header element of an `<mat-expansion-panel>`.
  17361. */
  17362. var MatExpansionPanelHeader = /** @class */ (function () {
  17363. function MatExpansionPanelHeader(panel, _element, _focusMonitor, _changeDetectorRef, defaultOptions) {
  17364. var _this = this;
  17365. this.panel = panel;
  17366. this._element = _element;
  17367. this._focusMonitor = _focusMonitor;
  17368. this._changeDetectorRef = _changeDetectorRef;
  17369. this._parentChangeSubscription = rxjs.Subscription.EMPTY;
  17370. /**
  17371. * Whether Angular animations in the panel header should be disabled.
  17372. */
  17373. this._animationsDisabled = true;
  17374. /** @type {?} */
  17375. var accordionHideToggleChange = panel.accordion ?
  17376. panel.accordion._stateChanges.pipe(operators.filter((/**
  17377. * @param {?} changes
  17378. * @return {?}
  17379. */
  17380. function (changes) { return !!(changes['hideToggle'] || changes['togglePosition']); }))) :
  17381. rxjs.EMPTY;
  17382. // Since the toggle state depends on an @Input on the panel, we
  17383. // need to subscribe and trigger change detection manually.
  17384. this._parentChangeSubscription =
  17385. rxjs.merge(panel.opened, panel.closed, accordionHideToggleChange, panel._inputChanges.pipe(operators.filter((/**
  17386. * @param {?} changes
  17387. * @return {?}
  17388. */
  17389. function (changes) {
  17390. return !!(changes['hideToggle'] ||
  17391. changes['disabled'] ||
  17392. changes['togglePosition']);
  17393. }))))
  17394. .subscribe((/**
  17395. * @return {?}
  17396. */
  17397. function () { return _this._changeDetectorRef.markForCheck(); }));
  17398. // Avoids focus being lost if the panel contained the focused element and was closed.
  17399. panel.closed
  17400. .pipe(operators.filter((/**
  17401. * @return {?}
  17402. */
  17403. function () { return panel._containsFocus(); })))
  17404. .subscribe((/**
  17405. * @return {?}
  17406. */
  17407. function () { return _focusMonitor.focusVia(_element, 'program'); }));
  17408. _focusMonitor.monitor(_element).subscribe((/**
  17409. * @param {?} origin
  17410. * @return {?}
  17411. */
  17412. function (origin) {
  17413. if (origin && panel.accordion) {
  17414. panel.accordion._handleHeaderFocus(_this);
  17415. }
  17416. }));
  17417. if (defaultOptions) {
  17418. this.expandedHeight = defaultOptions.expandedHeight;
  17419. this.collapsedHeight = defaultOptions.collapsedHeight;
  17420. }
  17421. }
  17422. /**
  17423. * @return {?}
  17424. */
  17425. MatExpansionPanelHeader.prototype._animationStarted = /**
  17426. * @return {?}
  17427. */
  17428. function () {
  17429. // Currently the `expansionHeight` animation has a `void => collapsed` transition which is
  17430. // there to work around a bug in Angular (see #13088), however this introduces a different
  17431. // issue. The new transition will cause the header to animate in on init (see #16067), if the
  17432. // consumer has set a header height that is different from the default one. We work around it
  17433. // by disabling animations on the header and re-enabling them after the first animation has run.
  17434. // Note that Angular dispatches animation events even if animations are disabled. Ideally this
  17435. // wouldn't be necessary if we remove the `void => collapsed` transition, but we have to wait
  17436. // for https://github.com/angular/angular/issues/18847 to be resolved.
  17437. this._animationsDisabled = false;
  17438. };
  17439. Object.defineProperty(MatExpansionPanelHeader.prototype, "disabled", {
  17440. /**
  17441. * Whether the associated panel is disabled. Implemented as a part of `FocusableOption`.
  17442. * @docs-private
  17443. */
  17444. get: /**
  17445. * Whether the associated panel is disabled. Implemented as a part of `FocusableOption`.
  17446. * \@docs-private
  17447. * @return {?}
  17448. */
  17449. function () {
  17450. return this.panel.disabled;
  17451. },
  17452. enumerable: true,
  17453. configurable: true
  17454. });
  17455. /** Toggles the expanded state of the panel. */
  17456. /**
  17457. * Toggles the expanded state of the panel.
  17458. * @return {?}
  17459. */
  17460. MatExpansionPanelHeader.prototype._toggle = /**
  17461. * Toggles the expanded state of the panel.
  17462. * @return {?}
  17463. */
  17464. function () {
  17465. this.panel.toggle();
  17466. };
  17467. /** Gets whether the panel is expanded. */
  17468. /**
  17469. * Gets whether the panel is expanded.
  17470. * @return {?}
  17471. */
  17472. MatExpansionPanelHeader.prototype._isExpanded = /**
  17473. * Gets whether the panel is expanded.
  17474. * @return {?}
  17475. */
  17476. function () {
  17477. return this.panel.expanded;
  17478. };
  17479. /** Gets the expanded state string of the panel. */
  17480. /**
  17481. * Gets the expanded state string of the panel.
  17482. * @return {?}
  17483. */
  17484. MatExpansionPanelHeader.prototype._getExpandedState = /**
  17485. * Gets the expanded state string of the panel.
  17486. * @return {?}
  17487. */
  17488. function () {
  17489. return this.panel._getExpandedState();
  17490. };
  17491. /** Gets the panel id. */
  17492. /**
  17493. * Gets the panel id.
  17494. * @return {?}
  17495. */
  17496. MatExpansionPanelHeader.prototype._getPanelId = /**
  17497. * Gets the panel id.
  17498. * @return {?}
  17499. */
  17500. function () {
  17501. return this.panel.id;
  17502. };
  17503. /** Gets the toggle position for the header. */
  17504. /**
  17505. * Gets the toggle position for the header.
  17506. * @return {?}
  17507. */
  17508. MatExpansionPanelHeader.prototype._getTogglePosition = /**
  17509. * Gets the toggle position for the header.
  17510. * @return {?}
  17511. */
  17512. function () {
  17513. return this.panel.togglePosition;
  17514. };
  17515. /** Gets whether the expand indicator should be shown. */
  17516. /**
  17517. * Gets whether the expand indicator should be shown.
  17518. * @return {?}
  17519. */
  17520. MatExpansionPanelHeader.prototype._showToggle = /**
  17521. * Gets whether the expand indicator should be shown.
  17522. * @return {?}
  17523. */
  17524. function () {
  17525. return !this.panel.hideToggle && !this.panel.disabled;
  17526. };
  17527. /** Handle keydown event calling to toggle() if appropriate. */
  17528. /**
  17529. * Handle keydown event calling to toggle() if appropriate.
  17530. * @param {?} event
  17531. * @return {?}
  17532. */
  17533. MatExpansionPanelHeader.prototype._keydown = /**
  17534. * Handle keydown event calling to toggle() if appropriate.
  17535. * @param {?} event
  17536. * @return {?}
  17537. */
  17538. function (event) {
  17539. switch (event.keyCode) {
  17540. // Toggle for space and enter keys.
  17541. case keycodes.SPACE:
  17542. case keycodes.ENTER:
  17543. if (!keycodes.hasModifierKey(event)) {
  17544. event.preventDefault();
  17545. this._toggle();
  17546. }
  17547. break;
  17548. default:
  17549. if (this.panel.accordion) {
  17550. this.panel.accordion._handleHeaderKeydown(event);
  17551. }
  17552. return;
  17553. }
  17554. };
  17555. /**
  17556. * Focuses the panel header. Implemented as a part of `FocusableOption`.
  17557. * @param origin Origin of the action that triggered the focus.
  17558. * @docs-private
  17559. */
  17560. /**
  17561. * Focuses the panel header. Implemented as a part of `FocusableOption`.
  17562. * \@docs-private
  17563. * @param {?=} origin Origin of the action that triggered the focus.
  17564. * @param {?=} options
  17565. * @return {?}
  17566. */
  17567. MatExpansionPanelHeader.prototype.focus = /**
  17568. * Focuses the panel header. Implemented as a part of `FocusableOption`.
  17569. * \@docs-private
  17570. * @param {?=} origin Origin of the action that triggered the focus.
  17571. * @param {?=} options
  17572. * @return {?}
  17573. */
  17574. function (origin, options) {
  17575. if (origin === void 0) { origin = 'program'; }
  17576. this._focusMonitor.focusVia(this._element, origin, options);
  17577. };
  17578. /**
  17579. * @return {?}
  17580. */
  17581. MatExpansionPanelHeader.prototype.ngOnDestroy = /**
  17582. * @return {?}
  17583. */
  17584. function () {
  17585. this._parentChangeSubscription.unsubscribe();
  17586. this._focusMonitor.stopMonitoring(this._element);
  17587. };
  17588. MatExpansionPanelHeader.decorators = [
  17589. { type: core.Component, args: [{selector: 'mat-expansion-panel-header',
  17590. styles: [".mat-expansion-panel-header{display:flex;flex-direction:row;align-items:center;padding:0 24px;border-radius:inherit}.mat-expansion-panel-header:focus,.mat-expansion-panel-header:hover{outline:0}.mat-expansion-panel-header.mat-expanded:focus,.mat-expansion-panel-header.mat-expanded:hover{background:inherit}.mat-expansion-panel-header:not([aria-disabled=true]){cursor:pointer}.mat-expansion-panel-header.mat-expansion-toggle-indicator-before{flex-direction:row-reverse}.mat-expansion-panel-header.mat-expansion-toggle-indicator-before .mat-expansion-indicator{margin:0 16px 0 0}[dir=rtl] .mat-expansion-panel-header.mat-expansion-toggle-indicator-before .mat-expansion-indicator{margin:0 0 0 16px}.mat-content{display:flex;flex:1;flex-direction:row;overflow:hidden}.mat-expansion-panel-header-description,.mat-expansion-panel-header-title{display:flex;flex-grow:1;margin-right:16px}[dir=rtl] .mat-expansion-panel-header-description,[dir=rtl] .mat-expansion-panel-header-title{margin-right:0;margin-left:16px}.mat-expansion-panel-header-description{flex-grow:2}.mat-expansion-indicator::after{border-style:solid;border-width:0 2px 2px 0;content:'';display:inline-block;padding:3px;transform:rotate(45deg);vertical-align:middle}"],
  17591. template: "<span class=\"mat-content\"><ng-content select=\"mat-panel-title\"></ng-content><ng-content select=\"mat-panel-description\"></ng-content><ng-content></ng-content></span><span [@indicatorRotate]=\"_getExpandedState()\" *ngIf=\"_showToggle()\" class=\"mat-expansion-indicator\"></span>",
  17592. encapsulation: core.ViewEncapsulation.None,
  17593. changeDetection: core.ChangeDetectionStrategy.OnPush,
  17594. animations: [
  17595. matExpansionAnimations.indicatorRotate,
  17596. matExpansionAnimations.expansionHeaderHeight
  17597. ],
  17598. host: {
  17599. 'class': 'mat-expansion-panel-header',
  17600. 'role': 'button',
  17601. '[attr.id]': 'panel._headerId',
  17602. '[attr.tabindex]': 'disabled ? -1 : 0',
  17603. '[attr.aria-controls]': '_getPanelId()',
  17604. '[attr.aria-expanded]': '_isExpanded()',
  17605. '[attr.aria-disabled]': 'panel.disabled',
  17606. '[class.mat-expanded]': '_isExpanded()',
  17607. '[class.mat-expansion-toggle-indicator-after]': "_getTogglePosition() === 'after'",
  17608. '[class.mat-expansion-toggle-indicator-before]': "_getTogglePosition() === 'before'",
  17609. '(click)': '_toggle()',
  17610. '(keydown)': '_keydown($event)',
  17611. '[@.disabled]': '_animationsDisabled',
  17612. '(@expansionHeight.start)': '_animationStarted()',
  17613. '[@expansionHeight]': "{\n value: _getExpandedState(),\n params: {\n collapsedHeight: collapsedHeight,\n expandedHeight: expandedHeight\n }\n }",
  17614. },
  17615. },] },
  17616. ];
  17617. /** @nocollapse */
  17618. MatExpansionPanelHeader.ctorParameters = function () { return [
  17619. { type: MatExpansionPanel, decorators: [{ type: core.Host }] },
  17620. { type: core.ElementRef },
  17621. { type: a11y.FocusMonitor },
  17622. { type: core.ChangeDetectorRef },
  17623. { type: undefined, decorators: [{ type: core.Inject, args: [MAT_EXPANSION_PANEL_DEFAULT_OPTIONS,] }, { type: core.Optional }] }
  17624. ]; };
  17625. MatExpansionPanelHeader.propDecorators = {
  17626. expandedHeight: [{ type: core.Input }],
  17627. collapsedHeight: [{ type: core.Input }]
  17628. };
  17629. return MatExpansionPanelHeader;
  17630. }());
  17631. /**
  17632. * `<mat-panel-description>`
  17633. *
  17634. * This directive is to be used inside of the MatExpansionPanelHeader component.
  17635. */
  17636. var MatExpansionPanelDescription = /** @class */ (function () {
  17637. function MatExpansionPanelDescription() {
  17638. }
  17639. MatExpansionPanelDescription.decorators = [
  17640. { type: core.Directive, args: [{
  17641. selector: 'mat-panel-description',
  17642. host: {
  17643. class: 'mat-expansion-panel-header-description'
  17644. }
  17645. },] },
  17646. ];
  17647. return MatExpansionPanelDescription;
  17648. }());
  17649. /**
  17650. * `<mat-panel-title>`
  17651. *
  17652. * This directive is to be used inside of the MatExpansionPanelHeader component.
  17653. */
  17654. var MatExpansionPanelTitle = /** @class */ (function () {
  17655. function MatExpansionPanelTitle() {
  17656. }
  17657. MatExpansionPanelTitle.decorators = [
  17658. { type: core.Directive, args: [{
  17659. selector: 'mat-panel-title',
  17660. host: {
  17661. class: 'mat-expansion-panel-header-title'
  17662. }
  17663. },] },
  17664. ];
  17665. return MatExpansionPanelTitle;
  17666. }());
  17667. /**
  17668. * @fileoverview added by tsickle
  17669. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  17670. */
  17671. /**
  17672. * Directive for a Material Design Accordion.
  17673. */
  17674. var MatAccordion = /** @class */ (function (_super) {
  17675. __extends(MatAccordion, _super);
  17676. function MatAccordion() {
  17677. var _this = _super !== null && _super.apply(this, arguments) || this;
  17678. _this._hideToggle = false;
  17679. /**
  17680. * Display mode used for all expansion panels in the accordion. Currently two display
  17681. * modes exist:
  17682. * default - a gutter-like spacing is placed around any expanded panel, placing the expanded
  17683. * panel at a different elevation from the rest of the accordion.
  17684. * flat - no spacing is placed around expanded panels, showing all panels at the same
  17685. * elevation.
  17686. */
  17687. _this.displayMode = 'default';
  17688. /**
  17689. * The position of the expansion indicator.
  17690. */
  17691. _this.togglePosition = 'after';
  17692. return _this;
  17693. }
  17694. Object.defineProperty(MatAccordion.prototype, "hideToggle", {
  17695. /** Whether the expansion indicator should be hidden. */
  17696. get: /**
  17697. * Whether the expansion indicator should be hidden.
  17698. * @return {?}
  17699. */
  17700. function () { return this._hideToggle; },
  17701. set: /**
  17702. * @param {?} show
  17703. * @return {?}
  17704. */
  17705. function (show) { this._hideToggle = coercion.coerceBooleanProperty(show); },
  17706. enumerable: true,
  17707. configurable: true
  17708. });
  17709. /**
  17710. * @return {?}
  17711. */
  17712. MatAccordion.prototype.ngAfterContentInit = /**
  17713. * @return {?}
  17714. */
  17715. function () {
  17716. this._keyManager = new a11y.FocusKeyManager(this._headers).withWrap();
  17717. };
  17718. /** Handles keyboard events coming in from the panel headers. */
  17719. /**
  17720. * Handles keyboard events coming in from the panel headers.
  17721. * @param {?} event
  17722. * @return {?}
  17723. */
  17724. MatAccordion.prototype._handleHeaderKeydown = /**
  17725. * Handles keyboard events coming in from the panel headers.
  17726. * @param {?} event
  17727. * @return {?}
  17728. */
  17729. function (event) {
  17730. var keyCode = event.keyCode;
  17731. /** @type {?} */
  17732. var manager = this._keyManager;
  17733. if (keyCode === keycodes.HOME) {
  17734. if (!keycodes.hasModifierKey(event)) {
  17735. manager.setFirstItemActive();
  17736. event.preventDefault();
  17737. }
  17738. }
  17739. else if (keyCode === keycodes.END) {
  17740. if (!keycodes.hasModifierKey(event)) {
  17741. manager.setLastItemActive();
  17742. event.preventDefault();
  17743. }
  17744. }
  17745. else {
  17746. this._keyManager.onKeydown(event);
  17747. }
  17748. };
  17749. /**
  17750. * @param {?} header
  17751. * @return {?}
  17752. */
  17753. MatAccordion.prototype._handleHeaderFocus = /**
  17754. * @param {?} header
  17755. * @return {?}
  17756. */
  17757. function (header) {
  17758. this._keyManager.updateActiveItem(header);
  17759. };
  17760. MatAccordion.decorators = [
  17761. { type: core.Directive, args: [{
  17762. selector: 'mat-accordion',
  17763. exportAs: 'matAccordion',
  17764. inputs: ['multi'],
  17765. providers: [{
  17766. provide: MAT_ACCORDION,
  17767. useExisting: MatAccordion
  17768. }],
  17769. host: {
  17770. class: 'mat-accordion'
  17771. }
  17772. },] },
  17773. ];
  17774. MatAccordion.propDecorators = {
  17775. _headers: [{ type: core.ContentChildren, args: [MatExpansionPanelHeader, { descendants: true },] }],
  17776. hideToggle: [{ type: core.Input }],
  17777. displayMode: [{ type: core.Input }],
  17778. togglePosition: [{ type: core.Input }]
  17779. };
  17780. return MatAccordion;
  17781. }(accordion.CdkAccordion));
  17782. /**
  17783. * @fileoverview added by tsickle
  17784. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  17785. */
  17786. var MatExpansionModule = /** @class */ (function () {
  17787. function MatExpansionModule() {
  17788. }
  17789. MatExpansionModule.decorators = [
  17790. { type: core.NgModule, args: [{
  17791. imports: [common.CommonModule, accordion.CdkAccordionModule, portal.PortalModule],
  17792. exports: [
  17793. MatAccordion,
  17794. MatExpansionPanel,
  17795. MatExpansionPanelActionRow,
  17796. MatExpansionPanelHeader,
  17797. MatExpansionPanelTitle,
  17798. MatExpansionPanelDescription,
  17799. MatExpansionPanelContent,
  17800. ],
  17801. declarations: [
  17802. MatAccordion,
  17803. MatExpansionPanel,
  17804. MatExpansionPanelActionRow,
  17805. MatExpansionPanelHeader,
  17806. MatExpansionPanelTitle,
  17807. MatExpansionPanelDescription,
  17808. MatExpansionPanelContent,
  17809. ],
  17810. },] },
  17811. ];
  17812. return MatExpansionModule;
  17813. }());
  17814. /**
  17815. * @fileoverview added by tsickle
  17816. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  17817. */
  17818. /**
  17819. * Injection token used to provide a grid list to a tile and to avoid circular imports.
  17820. * \@docs-private
  17821. * @type {?}
  17822. */
  17823. var MAT_GRID_LIST = new core.InjectionToken('MAT_GRID_LIST');
  17824. /**
  17825. * @fileoverview added by tsickle
  17826. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  17827. */
  17828. var MatGridTile = /** @class */ (function () {
  17829. function MatGridTile(_element, _gridList) {
  17830. this._element = _element;
  17831. this._gridList = _gridList;
  17832. this._rowspan = 1;
  17833. this._colspan = 1;
  17834. }
  17835. Object.defineProperty(MatGridTile.prototype, "rowspan", {
  17836. /** Amount of rows that the grid tile takes up. */
  17837. get: /**
  17838. * Amount of rows that the grid tile takes up.
  17839. * @return {?}
  17840. */
  17841. function () { return this._rowspan; },
  17842. set: /**
  17843. * @param {?} value
  17844. * @return {?}
  17845. */
  17846. function (value) { this._rowspan = Math.round(coercion.coerceNumberProperty(value)); },
  17847. enumerable: true,
  17848. configurable: true
  17849. });
  17850. Object.defineProperty(MatGridTile.prototype, "colspan", {
  17851. /** Amount of columns that the grid tile takes up. */
  17852. get: /**
  17853. * Amount of columns that the grid tile takes up.
  17854. * @return {?}
  17855. */
  17856. function () { return this._colspan; },
  17857. set: /**
  17858. * @param {?} value
  17859. * @return {?}
  17860. */
  17861. function (value) { this._colspan = Math.round(coercion.coerceNumberProperty(value)); },
  17862. enumerable: true,
  17863. configurable: true
  17864. });
  17865. /**
  17866. * Sets the style of the grid-tile element. Needs to be set manually to avoid
  17867. * "Changed after checked" errors that would occur with HostBinding.
  17868. */
  17869. /**
  17870. * Sets the style of the grid-tile element. Needs to be set manually to avoid
  17871. * "Changed after checked" errors that would occur with HostBinding.
  17872. * @param {?} property
  17873. * @param {?} value
  17874. * @return {?}
  17875. */
  17876. MatGridTile.prototype._setStyle = /**
  17877. * Sets the style of the grid-tile element. Needs to be set manually to avoid
  17878. * "Changed after checked" errors that would occur with HostBinding.
  17879. * @param {?} property
  17880. * @param {?} value
  17881. * @return {?}
  17882. */
  17883. function (property, value) {
  17884. ((/** @type {?} */ (this._element.nativeElement.style)))[property] = value;
  17885. };
  17886. MatGridTile.decorators = [
  17887. { type: core.Component, args: [{selector: 'mat-grid-tile',
  17888. exportAs: 'matGridTile',
  17889. host: {
  17890. 'class': 'mat-grid-tile',
  17891. },
  17892. template: "<figure class=\"mat-figure\"><ng-content></ng-content></figure>",
  17893. styles: [".mat-grid-list{display:block;position:relative}.mat-grid-tile{display:block;position:absolute;overflow:hidden}.mat-grid-tile .mat-figure{top:0;left:0;right:0;bottom:0;position:absolute;display:flex;align-items:center;justify-content:center;height:100%;padding:0;margin:0}.mat-grid-tile .mat-grid-tile-footer,.mat-grid-tile .mat-grid-tile-header{display:flex;align-items:center;height:48px;color:#fff;background:rgba(0,0,0,.38);overflow:hidden;padding:0 16px;position:absolute;left:0;right:0}.mat-grid-tile .mat-grid-tile-footer>*,.mat-grid-tile .mat-grid-tile-header>*{margin:0;padding:0;font-weight:400;font-size:inherit}.mat-grid-tile .mat-grid-tile-footer.mat-2-line,.mat-grid-tile .mat-grid-tile-header.mat-2-line{height:68px}.mat-grid-tile .mat-grid-list-text{display:flex;flex-direction:column;width:100%;box-sizing:border-box;overflow:hidden}.mat-grid-tile .mat-grid-list-text>*{margin:0;padding:0;font-weight:400;font-size:inherit}.mat-grid-tile .mat-grid-list-text:empty{display:none}.mat-grid-tile .mat-grid-tile-header{top:0}.mat-grid-tile .mat-grid-tile-footer{bottom:0}.mat-grid-tile .mat-grid-avatar{padding-right:16px}[dir=rtl] .mat-grid-tile .mat-grid-avatar{padding-right:0;padding-left:16px}.mat-grid-tile .mat-grid-avatar:empty{display:none}"],
  17894. encapsulation: core.ViewEncapsulation.None,
  17895. changeDetection: core.ChangeDetectionStrategy.OnPush,
  17896. },] },
  17897. ];
  17898. /** @nocollapse */
  17899. MatGridTile.ctorParameters = function () { return [
  17900. { type: core.ElementRef },
  17901. { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_GRID_LIST,] }] }
  17902. ]; };
  17903. MatGridTile.propDecorators = {
  17904. rowspan: [{ type: core.Input }],
  17905. colspan: [{ type: core.Input }]
  17906. };
  17907. return MatGridTile;
  17908. }());
  17909. var MatGridTileText = /** @class */ (function () {
  17910. function MatGridTileText(_element) {
  17911. this._element = _element;
  17912. }
  17913. /**
  17914. * @return {?}
  17915. */
  17916. MatGridTileText.prototype.ngAfterContentInit = /**
  17917. * @return {?}
  17918. */
  17919. function () {
  17920. setLines(this._lines, this._element);
  17921. };
  17922. MatGridTileText.decorators = [
  17923. { type: core.Component, args: [{selector: 'mat-grid-tile-header, mat-grid-tile-footer',
  17924. template: "<ng-content select=\"[mat-grid-avatar], [matGridAvatar]\"></ng-content><div class=\"mat-grid-list-text\"><ng-content select=\"[mat-line], [matLine]\"></ng-content></div><ng-content></ng-content>",
  17925. changeDetection: core.ChangeDetectionStrategy.OnPush,
  17926. encapsulation: core.ViewEncapsulation.None,
  17927. },] },
  17928. ];
  17929. /** @nocollapse */
  17930. MatGridTileText.ctorParameters = function () { return [
  17931. { type: core.ElementRef }
  17932. ]; };
  17933. MatGridTileText.propDecorators = {
  17934. _lines: [{ type: core.ContentChildren, args: [MatLine,] }]
  17935. };
  17936. return MatGridTileText;
  17937. }());
  17938. /**
  17939. * Directive whose purpose is to add the mat- CSS styling to this selector.
  17940. * \@docs-private
  17941. */
  17942. var MatGridAvatarCssMatStyler = /** @class */ (function () {
  17943. function MatGridAvatarCssMatStyler() {
  17944. }
  17945. MatGridAvatarCssMatStyler.decorators = [
  17946. { type: core.Directive, args: [{
  17947. selector: '[mat-grid-avatar], [matGridAvatar]',
  17948. host: { 'class': 'mat-grid-avatar' }
  17949. },] },
  17950. ];
  17951. return MatGridAvatarCssMatStyler;
  17952. }());
  17953. /**
  17954. * Directive whose purpose is to add the mat- CSS styling to this selector.
  17955. * \@docs-private
  17956. */
  17957. var MatGridTileHeaderCssMatStyler = /** @class */ (function () {
  17958. function MatGridTileHeaderCssMatStyler() {
  17959. }
  17960. MatGridTileHeaderCssMatStyler.decorators = [
  17961. { type: core.Directive, args: [{
  17962. selector: 'mat-grid-tile-header',
  17963. host: { 'class': 'mat-grid-tile-header' }
  17964. },] },
  17965. ];
  17966. return MatGridTileHeaderCssMatStyler;
  17967. }());
  17968. /**
  17969. * Directive whose purpose is to add the mat- CSS styling to this selector.
  17970. * \@docs-private
  17971. */
  17972. var MatGridTileFooterCssMatStyler = /** @class */ (function () {
  17973. function MatGridTileFooterCssMatStyler() {
  17974. }
  17975. MatGridTileFooterCssMatStyler.decorators = [
  17976. { type: core.Directive, args: [{
  17977. selector: 'mat-grid-tile-footer',
  17978. host: { 'class': 'mat-grid-tile-footer' }
  17979. },] },
  17980. ];
  17981. return MatGridTileFooterCssMatStyler;
  17982. }());
  17983. /**
  17984. * @fileoverview added by tsickle
  17985. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  17986. */
  17987. /**
  17988. * Class for determining, from a list of tiles, the (row, col) position of each of those tiles
  17989. * in the grid. This is necessary (rather than just rendering the tiles in normal document flow)
  17990. * because the tiles can have a rowspan.
  17991. *
  17992. * The positioning algorithm greedily places each tile as soon as it encounters a gap in the grid
  17993. * large enough to accommodate it so that the tiles still render in the same order in which they
  17994. * are given.
  17995. *
  17996. * The basis of the algorithm is the use of an array to track the already placed tiles. Each
  17997. * element of the array corresponds to a column, and the value indicates how many cells in that
  17998. * column are already occupied; zero indicates an empty cell. Moving "down" to the next row
  17999. * decrements each value in the tracking array (indicating that the column is one cell closer to
  18000. * being free).
  18001. *
  18002. * \@docs-private
  18003. */
  18004. var /**
  18005. * Class for determining, from a list of tiles, the (row, col) position of each of those tiles
  18006. * in the grid. This is necessary (rather than just rendering the tiles in normal document flow)
  18007. * because the tiles can have a rowspan.
  18008. *
  18009. * The positioning algorithm greedily places each tile as soon as it encounters a gap in the grid
  18010. * large enough to accommodate it so that the tiles still render in the same order in which they
  18011. * are given.
  18012. *
  18013. * The basis of the algorithm is the use of an array to track the already placed tiles. Each
  18014. * element of the array corresponds to a column, and the value indicates how many cells in that
  18015. * column are already occupied; zero indicates an empty cell. Moving "down" to the next row
  18016. * decrements each value in the tracking array (indicating that the column is one cell closer to
  18017. * being free).
  18018. *
  18019. * \@docs-private
  18020. */
  18021. TileCoordinator = /** @class */ (function () {
  18022. function TileCoordinator() {
  18023. /**
  18024. * Index at which the search for the next gap will start.
  18025. */
  18026. this.columnIndex = 0;
  18027. /**
  18028. * The current row index.
  18029. */
  18030. this.rowIndex = 0;
  18031. }
  18032. Object.defineProperty(TileCoordinator.prototype, "rowCount", {
  18033. /** Gets the total number of rows occupied by tiles */
  18034. get: /**
  18035. * Gets the total number of rows occupied by tiles
  18036. * @return {?}
  18037. */
  18038. function () { return this.rowIndex + 1; },
  18039. enumerable: true,
  18040. configurable: true
  18041. });
  18042. Object.defineProperty(TileCoordinator.prototype, "rowspan", {
  18043. /**
  18044. * Gets the total span of rows occupied by tiles.
  18045. * Ex: A list with 1 row that contains a tile with rowspan 2 will have a total rowspan of 2.
  18046. */
  18047. get: /**
  18048. * Gets the total span of rows occupied by tiles.
  18049. * Ex: A list with 1 row that contains a tile with rowspan 2 will have a total rowspan of 2.
  18050. * @return {?}
  18051. */
  18052. function () {
  18053. /** @type {?} */
  18054. var lastRowMax = Math.max.apply(Math, this.tracker);
  18055. // if any of the tiles has a rowspan that pushes it beyond the total row count,
  18056. // add the difference to the rowcount
  18057. return lastRowMax > 1 ? this.rowCount + lastRowMax - 1 : this.rowCount;
  18058. },
  18059. enumerable: true,
  18060. configurable: true
  18061. });
  18062. /**
  18063. * Updates the tile positions.
  18064. * @param numColumns Amount of columns in the grid.
  18065. */
  18066. /**
  18067. * Updates the tile positions.
  18068. * @param {?} numColumns Amount of columns in the grid.
  18069. * @param {?} tiles
  18070. * @return {?}
  18071. */
  18072. TileCoordinator.prototype.update = /**
  18073. * Updates the tile positions.
  18074. * @param {?} numColumns Amount of columns in the grid.
  18075. * @param {?} tiles
  18076. * @return {?}
  18077. */
  18078. function (numColumns, tiles) {
  18079. var _this = this;
  18080. this.columnIndex = 0;
  18081. this.rowIndex = 0;
  18082. this.tracker = new Array(numColumns);
  18083. this.tracker.fill(0, 0, this.tracker.length);
  18084. this.positions = tiles.map((/**
  18085. * @param {?} tile
  18086. * @return {?}
  18087. */
  18088. function (tile) { return _this._trackTile(tile); }));
  18089. };
  18090. /** Calculates the row and col position of a tile. */
  18091. /**
  18092. * Calculates the row and col position of a tile.
  18093. * @private
  18094. * @param {?} tile
  18095. * @return {?}
  18096. */
  18097. TileCoordinator.prototype._trackTile = /**
  18098. * Calculates the row and col position of a tile.
  18099. * @private
  18100. * @param {?} tile
  18101. * @return {?}
  18102. */
  18103. function (tile) {
  18104. // Find a gap large enough for this tile.
  18105. /** @type {?} */
  18106. var gapStartIndex = this._findMatchingGap(tile.colspan);
  18107. // Place tile in the resulting gap.
  18108. this._markTilePosition(gapStartIndex, tile);
  18109. // The next time we look for a gap, the search will start at columnIndex, which should be
  18110. // immediately after the tile that has just been placed.
  18111. this.columnIndex = gapStartIndex + tile.colspan;
  18112. return new TilePosition(this.rowIndex, gapStartIndex);
  18113. };
  18114. /** Finds the next available space large enough to fit the tile. */
  18115. /**
  18116. * Finds the next available space large enough to fit the tile.
  18117. * @private
  18118. * @param {?} tileCols
  18119. * @return {?}
  18120. */
  18121. TileCoordinator.prototype._findMatchingGap = /**
  18122. * Finds the next available space large enough to fit the tile.
  18123. * @private
  18124. * @param {?} tileCols
  18125. * @return {?}
  18126. */
  18127. function (tileCols) {
  18128. if (tileCols > this.tracker.length) {
  18129. throw Error("mat-grid-list: tile with colspan " + tileCols + " is wider than " +
  18130. ("grid with cols=\"" + this.tracker.length + "\"."));
  18131. }
  18132. // Start index is inclusive, end index is exclusive.
  18133. /** @type {?} */
  18134. var gapStartIndex = -1;
  18135. /** @type {?} */
  18136. var gapEndIndex = -1;
  18137. // Look for a gap large enough to fit the given tile. Empty spaces are marked with a zero.
  18138. do {
  18139. // If we've reached the end of the row, go to the next row.
  18140. if (this.columnIndex + tileCols > this.tracker.length) {
  18141. this._nextRow();
  18142. gapStartIndex = this.tracker.indexOf(0, this.columnIndex);
  18143. gapEndIndex = this._findGapEndIndex(gapStartIndex);
  18144. continue;
  18145. }
  18146. gapStartIndex = this.tracker.indexOf(0, this.columnIndex);
  18147. // If there are no more empty spaces in this row at all, move on to the next row.
  18148. if (gapStartIndex == -1) {
  18149. this._nextRow();
  18150. gapStartIndex = this.tracker.indexOf(0, this.columnIndex);
  18151. gapEndIndex = this._findGapEndIndex(gapStartIndex);
  18152. continue;
  18153. }
  18154. gapEndIndex = this._findGapEndIndex(gapStartIndex);
  18155. // If a gap large enough isn't found, we want to start looking immediately after the current
  18156. // gap on the next iteration.
  18157. this.columnIndex = gapStartIndex + 1;
  18158. // Continue iterating until we find a gap wide enough for this tile. Since gapEndIndex is
  18159. // exclusive, gapEndIndex is 0 means we didn't find a gap and should continue.
  18160. } while ((gapEndIndex - gapStartIndex < tileCols) || (gapEndIndex == 0));
  18161. // If we still didn't manage to find a gap, ensure that the index is
  18162. // at least zero so the tile doesn't get pulled out of the grid.
  18163. return Math.max(gapStartIndex, 0);
  18164. };
  18165. /** Move "down" to the next row. */
  18166. /**
  18167. * Move "down" to the next row.
  18168. * @private
  18169. * @return {?}
  18170. */
  18171. TileCoordinator.prototype._nextRow = /**
  18172. * Move "down" to the next row.
  18173. * @private
  18174. * @return {?}
  18175. */
  18176. function () {
  18177. this.columnIndex = 0;
  18178. this.rowIndex++;
  18179. // Decrement all spaces by one to reflect moving down one row.
  18180. for (var i = 0; i < this.tracker.length; i++) {
  18181. this.tracker[i] = Math.max(0, this.tracker[i] - 1);
  18182. }
  18183. };
  18184. /**
  18185. * Finds the end index (exclusive) of a gap given the index from which to start looking.
  18186. * The gap ends when a non-zero value is found.
  18187. */
  18188. /**
  18189. * Finds the end index (exclusive) of a gap given the index from which to start looking.
  18190. * The gap ends when a non-zero value is found.
  18191. * @private
  18192. * @param {?} gapStartIndex
  18193. * @return {?}
  18194. */
  18195. TileCoordinator.prototype._findGapEndIndex = /**
  18196. * Finds the end index (exclusive) of a gap given the index from which to start looking.
  18197. * The gap ends when a non-zero value is found.
  18198. * @private
  18199. * @param {?} gapStartIndex
  18200. * @return {?}
  18201. */
  18202. function (gapStartIndex) {
  18203. for (var i = gapStartIndex + 1; i < this.tracker.length; i++) {
  18204. if (this.tracker[i] != 0) {
  18205. return i;
  18206. }
  18207. }
  18208. // The gap ends with the end of the row.
  18209. return this.tracker.length;
  18210. };
  18211. /** Update the tile tracker to account for the given tile in the given space. */
  18212. /**
  18213. * Update the tile tracker to account for the given tile in the given space.
  18214. * @private
  18215. * @param {?} start
  18216. * @param {?} tile
  18217. * @return {?}
  18218. */
  18219. TileCoordinator.prototype._markTilePosition = /**
  18220. * Update the tile tracker to account for the given tile in the given space.
  18221. * @private
  18222. * @param {?} start
  18223. * @param {?} tile
  18224. * @return {?}
  18225. */
  18226. function (start, tile) {
  18227. for (var i = 0; i < tile.colspan; i++) {
  18228. this.tracker[start + i] = tile.rowspan;
  18229. }
  18230. };
  18231. return TileCoordinator;
  18232. }());
  18233. /**
  18234. * Simple data structure for tile position (row, col).
  18235. * \@docs-private
  18236. */
  18237. var /**
  18238. * Simple data structure for tile position (row, col).
  18239. * \@docs-private
  18240. */
  18241. TilePosition = /** @class */ (function () {
  18242. function TilePosition(row, col) {
  18243. this.row = row;
  18244. this.col = col;
  18245. }
  18246. return TilePosition;
  18247. }());
  18248. /**
  18249. * @fileoverview added by tsickle
  18250. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  18251. */
  18252. /**
  18253. * RegExp that can be used to check whether a value will
  18254. * be allowed inside a CSS `calc()` expression.
  18255. * @type {?}
  18256. */
  18257. var cssCalcAllowedValue = /^-?\d+((\.\d+)?[A-Za-z%$]?)+$/;
  18258. /**
  18259. * Sets the style properties for an individual tile, given the position calculated by the
  18260. * Tile Coordinator.
  18261. * \@docs-private
  18262. * @abstract
  18263. */
  18264. var /**
  18265. * Sets the style properties for an individual tile, given the position calculated by the
  18266. * Tile Coordinator.
  18267. * \@docs-private
  18268. * @abstract
  18269. */
  18270. TileStyler = /** @class */ (function () {
  18271. function TileStyler() {
  18272. this._rows = 0;
  18273. this._rowspan = 0;
  18274. }
  18275. /**
  18276. * Adds grid-list layout info once it is available. Cannot be processed in the constructor
  18277. * because these properties haven't been calculated by that point.
  18278. *
  18279. * @param gutterSize Size of the grid's gutter.
  18280. * @param tracker Instance of the TileCoordinator.
  18281. * @param cols Amount of columns in the grid.
  18282. * @param direction Layout direction of the grid.
  18283. */
  18284. /**
  18285. * Adds grid-list layout info once it is available. Cannot be processed in the constructor
  18286. * because these properties haven't been calculated by that point.
  18287. *
  18288. * @param {?} gutterSize Size of the grid's gutter.
  18289. * @param {?} tracker Instance of the TileCoordinator.
  18290. * @param {?} cols Amount of columns in the grid.
  18291. * @param {?} direction Layout direction of the grid.
  18292. * @return {?}
  18293. */
  18294. TileStyler.prototype.init = /**
  18295. * Adds grid-list layout info once it is available. Cannot be processed in the constructor
  18296. * because these properties haven't been calculated by that point.
  18297. *
  18298. * @param {?} gutterSize Size of the grid's gutter.
  18299. * @param {?} tracker Instance of the TileCoordinator.
  18300. * @param {?} cols Amount of columns in the grid.
  18301. * @param {?} direction Layout direction of the grid.
  18302. * @return {?}
  18303. */
  18304. function (gutterSize, tracker, cols, direction) {
  18305. this._gutterSize = normalizeUnits(gutterSize);
  18306. this._rows = tracker.rowCount;
  18307. this._rowspan = tracker.rowspan;
  18308. this._cols = cols;
  18309. this._direction = direction;
  18310. };
  18311. /**
  18312. * Computes the amount of space a single 1x1 tile would take up (width or height).
  18313. * Used as a basis for other calculations.
  18314. * @param sizePercent Percent of the total grid-list space that one 1x1 tile would take up.
  18315. * @param gutterFraction Fraction of the gutter size taken up by one 1x1 tile.
  18316. * @return The size of a 1x1 tile as an expression that can be evaluated via CSS calc().
  18317. */
  18318. /**
  18319. * Computes the amount of space a single 1x1 tile would take up (width or height).
  18320. * Used as a basis for other calculations.
  18321. * @param {?} sizePercent Percent of the total grid-list space that one 1x1 tile would take up.
  18322. * @param {?} gutterFraction Fraction of the gutter size taken up by one 1x1 tile.
  18323. * @return {?} The size of a 1x1 tile as an expression that can be evaluated via CSS calc().
  18324. */
  18325. TileStyler.prototype.getBaseTileSize = /**
  18326. * Computes the amount of space a single 1x1 tile would take up (width or height).
  18327. * Used as a basis for other calculations.
  18328. * @param {?} sizePercent Percent of the total grid-list space that one 1x1 tile would take up.
  18329. * @param {?} gutterFraction Fraction of the gutter size taken up by one 1x1 tile.
  18330. * @return {?} The size of a 1x1 tile as an expression that can be evaluated via CSS calc().
  18331. */
  18332. function (sizePercent, gutterFraction) {
  18333. // Take the base size percent (as would be if evenly dividing the size between cells),
  18334. // and then subtracting the size of one gutter. However, since there are no gutters on the
  18335. // edges, each tile only uses a fraction (gutterShare = numGutters / numCells) of the gutter
  18336. // size. (Imagine having one gutter per tile, and then breaking up the extra gutter on the
  18337. // edge evenly among the cells).
  18338. return "(" + sizePercent + "% - (" + this._gutterSize + " * " + gutterFraction + "))";
  18339. };
  18340. /**
  18341. * Gets The horizontal or vertical position of a tile, e.g., the 'top' or 'left' property value.
  18342. * @param offset Number of tiles that have already been rendered in the row/column.
  18343. * @param baseSize Base size of a 1x1 tile (as computed in getBaseTileSize).
  18344. * @return Position of the tile as a CSS calc() expression.
  18345. */
  18346. /**
  18347. * Gets The horizontal or vertical position of a tile, e.g., the 'top' or 'left' property value.
  18348. * @param {?} baseSize Base size of a 1x1 tile (as computed in getBaseTileSize).
  18349. * @param {?} offset Number of tiles that have already been rendered in the row/column.
  18350. * @return {?} Position of the tile as a CSS calc() expression.
  18351. */
  18352. TileStyler.prototype.getTilePosition = /**
  18353. * Gets The horizontal or vertical position of a tile, e.g., the 'top' or 'left' property value.
  18354. * @param {?} baseSize Base size of a 1x1 tile (as computed in getBaseTileSize).
  18355. * @param {?} offset Number of tiles that have already been rendered in the row/column.
  18356. * @return {?} Position of the tile as a CSS calc() expression.
  18357. */
  18358. function (baseSize, offset) {
  18359. // The position comes the size of a 1x1 tile plus gutter for each previous tile in the
  18360. // row/column (offset).
  18361. return offset === 0 ? '0' : calc("(" + baseSize + " + " + this._gutterSize + ") * " + offset);
  18362. };
  18363. /**
  18364. * Gets the actual size of a tile, e.g., width or height, taking rowspan or colspan into account.
  18365. * @param baseSize Base size of a 1x1 tile (as computed in getBaseTileSize).
  18366. * @param span The tile's rowspan or colspan.
  18367. * @return Size of the tile as a CSS calc() expression.
  18368. */
  18369. /**
  18370. * Gets the actual size of a tile, e.g., width or height, taking rowspan or colspan into account.
  18371. * @param {?} baseSize Base size of a 1x1 tile (as computed in getBaseTileSize).
  18372. * @param {?} span The tile's rowspan or colspan.
  18373. * @return {?} Size of the tile as a CSS calc() expression.
  18374. */
  18375. TileStyler.prototype.getTileSize = /**
  18376. * Gets the actual size of a tile, e.g., width or height, taking rowspan or colspan into account.
  18377. * @param {?} baseSize Base size of a 1x1 tile (as computed in getBaseTileSize).
  18378. * @param {?} span The tile's rowspan or colspan.
  18379. * @return {?} Size of the tile as a CSS calc() expression.
  18380. */
  18381. function (baseSize, span) {
  18382. return "(" + baseSize + " * " + span + ") + (" + (span - 1) + " * " + this._gutterSize + ")";
  18383. };
  18384. /**
  18385. * Sets the style properties to be applied to a tile for the given row and column index.
  18386. * @param tile Tile to which to apply the styling.
  18387. * @param rowIndex Index of the tile's row.
  18388. * @param colIndex Index of the tile's column.
  18389. */
  18390. /**
  18391. * Sets the style properties to be applied to a tile for the given row and column index.
  18392. * @param {?} tile Tile to which to apply the styling.
  18393. * @param {?} rowIndex Index of the tile's row.
  18394. * @param {?} colIndex Index of the tile's column.
  18395. * @return {?}
  18396. */
  18397. TileStyler.prototype.setStyle = /**
  18398. * Sets the style properties to be applied to a tile for the given row and column index.
  18399. * @param {?} tile Tile to which to apply the styling.
  18400. * @param {?} rowIndex Index of the tile's row.
  18401. * @param {?} colIndex Index of the tile's column.
  18402. * @return {?}
  18403. */
  18404. function (tile, rowIndex, colIndex) {
  18405. // Percent of the available horizontal space that one column takes up.
  18406. /** @type {?} */
  18407. var percentWidthPerTile = 100 / this._cols;
  18408. // Fraction of the vertical gutter size that each column takes up.
  18409. // For example, if there are 5 columns, each column uses 4/5 = 0.8 times the gutter width.
  18410. /** @type {?} */
  18411. var gutterWidthFractionPerTile = (this._cols - 1) / this._cols;
  18412. this.setColStyles(tile, colIndex, percentWidthPerTile, gutterWidthFractionPerTile);
  18413. this.setRowStyles(tile, rowIndex, percentWidthPerTile, gutterWidthFractionPerTile);
  18414. };
  18415. /** Sets the horizontal placement of the tile in the list. */
  18416. /**
  18417. * Sets the horizontal placement of the tile in the list.
  18418. * @param {?} tile
  18419. * @param {?} colIndex
  18420. * @param {?} percentWidth
  18421. * @param {?} gutterWidth
  18422. * @return {?}
  18423. */
  18424. TileStyler.prototype.setColStyles = /**
  18425. * Sets the horizontal placement of the tile in the list.
  18426. * @param {?} tile
  18427. * @param {?} colIndex
  18428. * @param {?} percentWidth
  18429. * @param {?} gutterWidth
  18430. * @return {?}
  18431. */
  18432. function (tile, colIndex, percentWidth, gutterWidth) {
  18433. // Base horizontal size of a column.
  18434. /** @type {?} */
  18435. var baseTileWidth = this.getBaseTileSize(percentWidth, gutterWidth);
  18436. // The width and horizontal position of each tile is always calculated the same way, but the
  18437. // height and vertical position depends on the rowMode.
  18438. /** @type {?} */
  18439. var side = this._direction === 'rtl' ? 'right' : 'left';
  18440. tile._setStyle(side, this.getTilePosition(baseTileWidth, colIndex));
  18441. tile._setStyle('width', calc(this.getTileSize(baseTileWidth, tile.colspan)));
  18442. };
  18443. /**
  18444. * Calculates the total size taken up by gutters across one axis of a list.
  18445. */
  18446. /**
  18447. * Calculates the total size taken up by gutters across one axis of a list.
  18448. * @return {?}
  18449. */
  18450. TileStyler.prototype.getGutterSpan = /**
  18451. * Calculates the total size taken up by gutters across one axis of a list.
  18452. * @return {?}
  18453. */
  18454. function () {
  18455. return this._gutterSize + " * (" + this._rowspan + " - 1)";
  18456. };
  18457. /**
  18458. * Calculates the total size taken up by tiles across one axis of a list.
  18459. * @param tileHeight Height of the tile.
  18460. */
  18461. /**
  18462. * Calculates the total size taken up by tiles across one axis of a list.
  18463. * @param {?} tileHeight Height of the tile.
  18464. * @return {?}
  18465. */
  18466. TileStyler.prototype.getTileSpan = /**
  18467. * Calculates the total size taken up by tiles across one axis of a list.
  18468. * @param {?} tileHeight Height of the tile.
  18469. * @return {?}
  18470. */
  18471. function (tileHeight) {
  18472. return this._rowspan + " * " + this.getTileSize(tileHeight, 1);
  18473. };
  18474. /**
  18475. * Calculates the computed height and returns the correct style property to set.
  18476. * This method can be implemented by each type of TileStyler.
  18477. * @docs-private
  18478. */
  18479. /**
  18480. * Calculates the computed height and returns the correct style property to set.
  18481. * This method can be implemented by each type of TileStyler.
  18482. * \@docs-private
  18483. * @return {?}
  18484. */
  18485. TileStyler.prototype.getComputedHeight = /**
  18486. * Calculates the computed height and returns the correct style property to set.
  18487. * This method can be implemented by each type of TileStyler.
  18488. * \@docs-private
  18489. * @return {?}
  18490. */
  18491. function () { return null; };
  18492. return TileStyler;
  18493. }());
  18494. /**
  18495. * This type of styler is instantiated when the user passes in a fixed row height.
  18496. * Example `<mat-grid-list cols="3" rowHeight="100px">`
  18497. * \@docs-private
  18498. */
  18499. var /**
  18500. * This type of styler is instantiated when the user passes in a fixed row height.
  18501. * Example `<mat-grid-list cols="3" rowHeight="100px">`
  18502. * \@docs-private
  18503. */
  18504. FixedTileStyler = /** @class */ (function (_super) {
  18505. __extends(FixedTileStyler, _super);
  18506. function FixedTileStyler(fixedRowHeight) {
  18507. var _this = _super.call(this) || this;
  18508. _this.fixedRowHeight = fixedRowHeight;
  18509. return _this;
  18510. }
  18511. /**
  18512. * @param {?} gutterSize
  18513. * @param {?} tracker
  18514. * @param {?} cols
  18515. * @param {?} direction
  18516. * @return {?}
  18517. */
  18518. FixedTileStyler.prototype.init = /**
  18519. * @param {?} gutterSize
  18520. * @param {?} tracker
  18521. * @param {?} cols
  18522. * @param {?} direction
  18523. * @return {?}
  18524. */
  18525. function (gutterSize, tracker, cols, direction) {
  18526. _super.prototype.init.call(this, gutterSize, tracker, cols, direction);
  18527. this.fixedRowHeight = normalizeUnits(this.fixedRowHeight);
  18528. if (!cssCalcAllowedValue.test(this.fixedRowHeight)) {
  18529. throw Error("Invalid value \"" + this.fixedRowHeight + "\" set as rowHeight.");
  18530. }
  18531. };
  18532. /**
  18533. * @param {?} tile
  18534. * @param {?} rowIndex
  18535. * @return {?}
  18536. */
  18537. FixedTileStyler.prototype.setRowStyles = /**
  18538. * @param {?} tile
  18539. * @param {?} rowIndex
  18540. * @return {?}
  18541. */
  18542. function (tile, rowIndex) {
  18543. tile._setStyle('top', this.getTilePosition(this.fixedRowHeight, rowIndex));
  18544. tile._setStyle('height', calc(this.getTileSize(this.fixedRowHeight, tile.rowspan)));
  18545. };
  18546. /**
  18547. * @return {?}
  18548. */
  18549. FixedTileStyler.prototype.getComputedHeight = /**
  18550. * @return {?}
  18551. */
  18552. function () {
  18553. return [
  18554. 'height', calc(this.getTileSpan(this.fixedRowHeight) + " + " + this.getGutterSpan())
  18555. ];
  18556. };
  18557. /**
  18558. * @param {?} list
  18559. * @return {?}
  18560. */
  18561. FixedTileStyler.prototype.reset = /**
  18562. * @param {?} list
  18563. * @return {?}
  18564. */
  18565. function (list) {
  18566. list._setListStyle(['height', null]);
  18567. if (list._tiles) {
  18568. list._tiles.forEach((/**
  18569. * @param {?} tile
  18570. * @return {?}
  18571. */
  18572. function (tile) {
  18573. tile._setStyle('top', null);
  18574. tile._setStyle('height', null);
  18575. }));
  18576. }
  18577. };
  18578. return FixedTileStyler;
  18579. }(TileStyler));
  18580. /**
  18581. * This type of styler is instantiated when the user passes in a width:height ratio
  18582. * for the row height. Example `<mat-grid-list cols="3" rowHeight="3:1">`
  18583. * \@docs-private
  18584. */
  18585. var /**
  18586. * This type of styler is instantiated when the user passes in a width:height ratio
  18587. * for the row height. Example `<mat-grid-list cols="3" rowHeight="3:1">`
  18588. * \@docs-private
  18589. */
  18590. RatioTileStyler = /** @class */ (function (_super) {
  18591. __extends(RatioTileStyler, _super);
  18592. function RatioTileStyler(value) {
  18593. var _this = _super.call(this) || this;
  18594. _this._parseRatio(value);
  18595. return _this;
  18596. }
  18597. /**
  18598. * @param {?} tile
  18599. * @param {?} rowIndex
  18600. * @param {?} percentWidth
  18601. * @param {?} gutterWidth
  18602. * @return {?}
  18603. */
  18604. RatioTileStyler.prototype.setRowStyles = /**
  18605. * @param {?} tile
  18606. * @param {?} rowIndex
  18607. * @param {?} percentWidth
  18608. * @param {?} gutterWidth
  18609. * @return {?}
  18610. */
  18611. function (tile, rowIndex, percentWidth, gutterWidth) {
  18612. /** @type {?} */
  18613. var percentHeightPerTile = percentWidth / this.rowHeightRatio;
  18614. this.baseTileHeight = this.getBaseTileSize(percentHeightPerTile, gutterWidth);
  18615. // Use padding-top and margin-top to maintain the given aspect ratio, as
  18616. // a percentage-based value for these properties is applied versus the *width* of the
  18617. // containing block. See http://www.w3.org/TR/CSS2/box.html#margin-properties
  18618. tile._setStyle('marginTop', this.getTilePosition(this.baseTileHeight, rowIndex));
  18619. tile._setStyle('paddingTop', calc(this.getTileSize(this.baseTileHeight, tile.rowspan)));
  18620. };
  18621. /**
  18622. * @return {?}
  18623. */
  18624. RatioTileStyler.prototype.getComputedHeight = /**
  18625. * @return {?}
  18626. */
  18627. function () {
  18628. return [
  18629. 'paddingBottom', calc(this.getTileSpan(this.baseTileHeight) + " + " + this.getGutterSpan())
  18630. ];
  18631. };
  18632. /**
  18633. * @param {?} list
  18634. * @return {?}
  18635. */
  18636. RatioTileStyler.prototype.reset = /**
  18637. * @param {?} list
  18638. * @return {?}
  18639. */
  18640. function (list) {
  18641. list._setListStyle(['paddingBottom', null]);
  18642. list._tiles.forEach((/**
  18643. * @param {?} tile
  18644. * @return {?}
  18645. */
  18646. function (tile) {
  18647. tile._setStyle('marginTop', null);
  18648. tile._setStyle('paddingTop', null);
  18649. }));
  18650. };
  18651. /**
  18652. * @private
  18653. * @param {?} value
  18654. * @return {?}
  18655. */
  18656. RatioTileStyler.prototype._parseRatio = /**
  18657. * @private
  18658. * @param {?} value
  18659. * @return {?}
  18660. */
  18661. function (value) {
  18662. /** @type {?} */
  18663. var ratioParts = value.split(':');
  18664. if (ratioParts.length !== 2) {
  18665. throw Error("mat-grid-list: invalid ratio given for row-height: \"" + value + "\"");
  18666. }
  18667. this.rowHeightRatio = parseFloat(ratioParts[0]) / parseFloat(ratioParts[1]);
  18668. };
  18669. return RatioTileStyler;
  18670. }(TileStyler));
  18671. /**
  18672. * This type of styler is instantiated when the user selects a "fit" row height mode.
  18673. * In other words, the row height will reflect the total height of the container divided
  18674. * by the number of rows. Example `<mat-grid-list cols="3" rowHeight="fit">`
  18675. *
  18676. * \@docs-private
  18677. */
  18678. var /**
  18679. * This type of styler is instantiated when the user selects a "fit" row height mode.
  18680. * In other words, the row height will reflect the total height of the container divided
  18681. * by the number of rows. Example `<mat-grid-list cols="3" rowHeight="fit">`
  18682. *
  18683. * \@docs-private
  18684. */
  18685. FitTileStyler = /** @class */ (function (_super) {
  18686. __extends(FitTileStyler, _super);
  18687. function FitTileStyler() {
  18688. return _super !== null && _super.apply(this, arguments) || this;
  18689. }
  18690. /**
  18691. * @param {?} tile
  18692. * @param {?} rowIndex
  18693. * @return {?}
  18694. */
  18695. FitTileStyler.prototype.setRowStyles = /**
  18696. * @param {?} tile
  18697. * @param {?} rowIndex
  18698. * @return {?}
  18699. */
  18700. function (tile, rowIndex) {
  18701. // Percent of the available vertical space that one row takes up.
  18702. /** @type {?} */
  18703. var percentHeightPerTile = 100 / this._rowspan;
  18704. // Fraction of the horizontal gutter size that each column takes up.
  18705. /** @type {?} */
  18706. var gutterHeightPerTile = (this._rows - 1) / this._rows;
  18707. // Base vertical size of a column.
  18708. /** @type {?} */
  18709. var baseTileHeight = this.getBaseTileSize(percentHeightPerTile, gutterHeightPerTile);
  18710. tile._setStyle('top', this.getTilePosition(baseTileHeight, rowIndex));
  18711. tile._setStyle('height', calc(this.getTileSize(baseTileHeight, tile.rowspan)));
  18712. };
  18713. /**
  18714. * @param {?} list
  18715. * @return {?}
  18716. */
  18717. FitTileStyler.prototype.reset = /**
  18718. * @param {?} list
  18719. * @return {?}
  18720. */
  18721. function (list) {
  18722. if (list._tiles) {
  18723. list._tiles.forEach((/**
  18724. * @param {?} tile
  18725. * @return {?}
  18726. */
  18727. function (tile) {
  18728. tile._setStyle('top', null);
  18729. tile._setStyle('height', null);
  18730. }));
  18731. }
  18732. };
  18733. return FitTileStyler;
  18734. }(TileStyler));
  18735. /**
  18736. * Wraps a CSS string in a calc function
  18737. * @param {?} exp
  18738. * @return {?}
  18739. */
  18740. function calc(exp) {
  18741. return "calc(" + exp + ")";
  18742. }
  18743. /**
  18744. * Appends pixels to a CSS string if no units are given.
  18745. * @param {?} value
  18746. * @return {?}
  18747. */
  18748. function normalizeUnits(value) {
  18749. return value.match(/([A-Za-z%]+)$/) ? value : value + "px";
  18750. }
  18751. /**
  18752. * @fileoverview added by tsickle
  18753. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  18754. */
  18755. // TODO(kara): Conditional (responsive) column count / row size.
  18756. // TODO(kara): Re-layout on window resize / media change (debounced).
  18757. // TODO(kara): gridTileHeader and gridTileFooter.
  18758. /** @type {?} */
  18759. var MAT_FIT_MODE = 'fit';
  18760. var MatGridList = /** @class */ (function () {
  18761. function MatGridList(_element, _dir) {
  18762. this._element = _element;
  18763. this._dir = _dir;
  18764. /**
  18765. * The amount of space between tiles. This will be something like '5px' or '2em'.
  18766. */
  18767. this._gutter = '1px';
  18768. }
  18769. Object.defineProperty(MatGridList.prototype, "cols", {
  18770. /** Amount of columns in the grid list. */
  18771. get: /**
  18772. * Amount of columns in the grid list.
  18773. * @return {?}
  18774. */
  18775. function () { return this._cols; },
  18776. set: /**
  18777. * @param {?} value
  18778. * @return {?}
  18779. */
  18780. function (value) {
  18781. this._cols = Math.max(1, Math.round(coercion.coerceNumberProperty(value)));
  18782. },
  18783. enumerable: true,
  18784. configurable: true
  18785. });
  18786. Object.defineProperty(MatGridList.prototype, "gutterSize", {
  18787. /** Size of the grid list's gutter in pixels. */
  18788. get: /**
  18789. * Size of the grid list's gutter in pixels.
  18790. * @return {?}
  18791. */
  18792. function () { return this._gutter; },
  18793. set: /**
  18794. * @param {?} value
  18795. * @return {?}
  18796. */
  18797. function (value) { this._gutter = "" + (value == null ? '' : value); },
  18798. enumerable: true,
  18799. configurable: true
  18800. });
  18801. Object.defineProperty(MatGridList.prototype, "rowHeight", {
  18802. /** Set internal representation of row height from the user-provided value. */
  18803. get: /**
  18804. * Set internal representation of row height from the user-provided value.
  18805. * @return {?}
  18806. */
  18807. function () { return this._rowHeight; },
  18808. set: /**
  18809. * @param {?} value
  18810. * @return {?}
  18811. */
  18812. function (value) {
  18813. /** @type {?} */
  18814. var newValue = "" + (value == null ? '' : value);
  18815. if (newValue !== this._rowHeight) {
  18816. this._rowHeight = newValue;
  18817. this._setTileStyler(this._rowHeight);
  18818. }
  18819. },
  18820. enumerable: true,
  18821. configurable: true
  18822. });
  18823. /**
  18824. * @return {?}
  18825. */
  18826. MatGridList.prototype.ngOnInit = /**
  18827. * @return {?}
  18828. */
  18829. function () {
  18830. this._checkCols();
  18831. this._checkRowHeight();
  18832. };
  18833. /**
  18834. * The layout calculation is fairly cheap if nothing changes, so there's little cost
  18835. * to run it frequently.
  18836. */
  18837. /**
  18838. * The layout calculation is fairly cheap if nothing changes, so there's little cost
  18839. * to run it frequently.
  18840. * @return {?}
  18841. */
  18842. MatGridList.prototype.ngAfterContentChecked = /**
  18843. * The layout calculation is fairly cheap if nothing changes, so there's little cost
  18844. * to run it frequently.
  18845. * @return {?}
  18846. */
  18847. function () {
  18848. this._layoutTiles();
  18849. };
  18850. /** Throw a friendly error if cols property is missing */
  18851. /**
  18852. * Throw a friendly error if cols property is missing
  18853. * @private
  18854. * @return {?}
  18855. */
  18856. MatGridList.prototype._checkCols = /**
  18857. * Throw a friendly error if cols property is missing
  18858. * @private
  18859. * @return {?}
  18860. */
  18861. function () {
  18862. if (!this.cols) {
  18863. throw Error("mat-grid-list: must pass in number of columns. " +
  18864. "Example: <mat-grid-list cols=\"3\">");
  18865. }
  18866. };
  18867. /** Default to equal width:height if rowHeight property is missing */
  18868. /**
  18869. * Default to equal width:height if rowHeight property is missing
  18870. * @private
  18871. * @return {?}
  18872. */
  18873. MatGridList.prototype._checkRowHeight = /**
  18874. * Default to equal width:height if rowHeight property is missing
  18875. * @private
  18876. * @return {?}
  18877. */
  18878. function () {
  18879. if (!this._rowHeight) {
  18880. this._setTileStyler('1:1');
  18881. }
  18882. };
  18883. /** Creates correct Tile Styler subtype based on rowHeight passed in by user */
  18884. /**
  18885. * Creates correct Tile Styler subtype based on rowHeight passed in by user
  18886. * @private
  18887. * @param {?} rowHeight
  18888. * @return {?}
  18889. */
  18890. MatGridList.prototype._setTileStyler = /**
  18891. * Creates correct Tile Styler subtype based on rowHeight passed in by user
  18892. * @private
  18893. * @param {?} rowHeight
  18894. * @return {?}
  18895. */
  18896. function (rowHeight) {
  18897. if (this._tileStyler) {
  18898. this._tileStyler.reset(this);
  18899. }
  18900. if (rowHeight === MAT_FIT_MODE) {
  18901. this._tileStyler = new FitTileStyler();
  18902. }
  18903. else if (rowHeight && rowHeight.indexOf(':') > -1) {
  18904. this._tileStyler = new RatioTileStyler(rowHeight);
  18905. }
  18906. else {
  18907. this._tileStyler = new FixedTileStyler(rowHeight);
  18908. }
  18909. };
  18910. /** Computes and applies the size and position for all children grid tiles. */
  18911. /**
  18912. * Computes and applies the size and position for all children grid tiles.
  18913. * @private
  18914. * @return {?}
  18915. */
  18916. MatGridList.prototype._layoutTiles = /**
  18917. * Computes and applies the size and position for all children grid tiles.
  18918. * @private
  18919. * @return {?}
  18920. */
  18921. function () {
  18922. var _this = this;
  18923. if (!this._tileCoordinator) {
  18924. this._tileCoordinator = new TileCoordinator();
  18925. }
  18926. /** @type {?} */
  18927. var tracker = this._tileCoordinator;
  18928. /** @type {?} */
  18929. var tiles = this._tiles.filter((/**
  18930. * @param {?} tile
  18931. * @return {?}
  18932. */
  18933. function (tile) { return !tile._gridList || tile._gridList === _this; }));
  18934. /** @type {?} */
  18935. var direction = this._dir ? this._dir.value : 'ltr';
  18936. this._tileCoordinator.update(this.cols, tiles);
  18937. this._tileStyler.init(this.gutterSize, tracker, this.cols, direction);
  18938. tiles.forEach((/**
  18939. * @param {?} tile
  18940. * @param {?} index
  18941. * @return {?}
  18942. */
  18943. function (tile, index) {
  18944. /** @type {?} */
  18945. var pos = tracker.positions[index];
  18946. _this._tileStyler.setStyle(tile, pos.row, pos.col);
  18947. }));
  18948. this._setListStyle(this._tileStyler.getComputedHeight());
  18949. };
  18950. /** Sets style on the main grid-list element, given the style name and value. */
  18951. /**
  18952. * Sets style on the main grid-list element, given the style name and value.
  18953. * @param {?} style
  18954. * @return {?}
  18955. */
  18956. MatGridList.prototype._setListStyle = /**
  18957. * Sets style on the main grid-list element, given the style name and value.
  18958. * @param {?} style
  18959. * @return {?}
  18960. */
  18961. function (style) {
  18962. if (style) {
  18963. ((/** @type {?} */ (this._element.nativeElement.style)))[style[0]] = style[1];
  18964. }
  18965. };
  18966. MatGridList.decorators = [
  18967. { type: core.Component, args: [{selector: 'mat-grid-list',
  18968. exportAs: 'matGridList',
  18969. template: "<div><ng-content></ng-content></div>",
  18970. styles: [".mat-grid-list{display:block;position:relative}.mat-grid-tile{display:block;position:absolute;overflow:hidden}.mat-grid-tile .mat-figure{top:0;left:0;right:0;bottom:0;position:absolute;display:flex;align-items:center;justify-content:center;height:100%;padding:0;margin:0}.mat-grid-tile .mat-grid-tile-footer,.mat-grid-tile .mat-grid-tile-header{display:flex;align-items:center;height:48px;color:#fff;background:rgba(0,0,0,.38);overflow:hidden;padding:0 16px;position:absolute;left:0;right:0}.mat-grid-tile .mat-grid-tile-footer>*,.mat-grid-tile .mat-grid-tile-header>*{margin:0;padding:0;font-weight:400;font-size:inherit}.mat-grid-tile .mat-grid-tile-footer.mat-2-line,.mat-grid-tile .mat-grid-tile-header.mat-2-line{height:68px}.mat-grid-tile .mat-grid-list-text{display:flex;flex-direction:column;width:100%;box-sizing:border-box;overflow:hidden}.mat-grid-tile .mat-grid-list-text>*{margin:0;padding:0;font-weight:400;font-size:inherit}.mat-grid-tile .mat-grid-list-text:empty{display:none}.mat-grid-tile .mat-grid-tile-header{top:0}.mat-grid-tile .mat-grid-tile-footer{bottom:0}.mat-grid-tile .mat-grid-avatar{padding-right:16px}[dir=rtl] .mat-grid-tile .mat-grid-avatar{padding-right:0;padding-left:16px}.mat-grid-tile .mat-grid-avatar:empty{display:none}"],
  18971. host: {
  18972. 'class': 'mat-grid-list',
  18973. },
  18974. providers: [{
  18975. provide: MAT_GRID_LIST,
  18976. useExisting: MatGridList
  18977. }],
  18978. changeDetection: core.ChangeDetectionStrategy.OnPush,
  18979. encapsulation: core.ViewEncapsulation.None,
  18980. },] },
  18981. ];
  18982. /** @nocollapse */
  18983. MatGridList.ctorParameters = function () { return [
  18984. { type: core.ElementRef },
  18985. { type: bidi.Directionality, decorators: [{ type: core.Optional }] }
  18986. ]; };
  18987. MatGridList.propDecorators = {
  18988. _tiles: [{ type: core.ContentChildren, args: [MatGridTile, { descendants: true },] }],
  18989. cols: [{ type: core.Input }],
  18990. gutterSize: [{ type: core.Input }],
  18991. rowHeight: [{ type: core.Input }]
  18992. };
  18993. return MatGridList;
  18994. }());
  18995. /**
  18996. * @fileoverview added by tsickle
  18997. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  18998. */
  18999. var MatGridListModule = /** @class */ (function () {
  19000. function MatGridListModule() {
  19001. }
  19002. MatGridListModule.decorators = [
  19003. { type: core.NgModule, args: [{
  19004. imports: [MatLineModule, MatCommonModule],
  19005. exports: [
  19006. MatGridList,
  19007. MatGridTile,
  19008. MatGridTileText,
  19009. MatLineModule,
  19010. MatCommonModule,
  19011. MatGridTileHeaderCssMatStyler,
  19012. MatGridTileFooterCssMatStyler,
  19013. MatGridAvatarCssMatStyler
  19014. ],
  19015. declarations: [
  19016. MatGridList,
  19017. MatGridTile,
  19018. MatGridTileText,
  19019. MatGridTileHeaderCssMatStyler,
  19020. MatGridTileFooterCssMatStyler,
  19021. MatGridAvatarCssMatStyler
  19022. ],
  19023. },] },
  19024. ];
  19025. return MatGridListModule;
  19026. }());
  19027. /**
  19028. * @fileoverview added by tsickle
  19029. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  19030. */
  19031. /**
  19032. * Returns an exception to be thrown in the case when attempting to
  19033. * load an icon with a name that cannot be found.
  19034. * \@docs-private
  19035. * @param {?} iconName
  19036. * @return {?}
  19037. */
  19038. function getMatIconNameNotFoundError(iconName) {
  19039. return Error("Unable to find icon with the name \"" + iconName + "\"");
  19040. }
  19041. /**
  19042. * Returns an exception to be thrown when the consumer attempts to use
  19043. * `<mat-icon>` without including \@angular/common/http.
  19044. * \@docs-private
  19045. * @return {?}
  19046. */
  19047. function getMatIconNoHttpProviderError() {
  19048. return Error('Could not find HttpClient provider for use with Angular Material icons. ' +
  19049. 'Please include the HttpClientModule from @angular/common/http in your ' +
  19050. 'app imports.');
  19051. }
  19052. /**
  19053. * Returns an exception to be thrown when a URL couldn't be sanitized.
  19054. * \@docs-private
  19055. * @param {?} url URL that was attempted to be sanitized.
  19056. * @return {?}
  19057. */
  19058. function getMatIconFailedToSanitizeUrlError(url) {
  19059. return Error("The URL provided to MatIconRegistry was not trusted as a resource URL " +
  19060. ("via Angular's DomSanitizer. Attempted URL was \"" + url + "\"."));
  19061. }
  19062. /**
  19063. * Returns an exception to be thrown when a HTML string couldn't be sanitized.
  19064. * \@docs-private
  19065. * @param {?} literal HTML that was attempted to be sanitized.
  19066. * @return {?}
  19067. */
  19068. function getMatIconFailedToSanitizeLiteralError(literal) {
  19069. return Error("The literal provided to MatIconRegistry was not trusted as safe HTML by " +
  19070. ("Angular's DomSanitizer. Attempted literal was \"" + literal + "\"."));
  19071. }
  19072. /**
  19073. * Configuration for an icon, including the URL and possibly the cached SVG element.
  19074. * \@docs-private
  19075. */
  19076. var /**
  19077. * Configuration for an icon, including the URL and possibly the cached SVG element.
  19078. * \@docs-private
  19079. */
  19080. SvgIconConfig = /** @class */ (function () {
  19081. function SvgIconConfig(data) {
  19082. // Note that we can't use `instanceof SVGElement` here,
  19083. // because it'll break during server-side rendering.
  19084. if (!!((/** @type {?} */ (data))).nodeName) {
  19085. this.svgElement = (/** @type {?} */ (data));
  19086. }
  19087. else {
  19088. this.url = (/** @type {?} */ (data));
  19089. }
  19090. }
  19091. return SvgIconConfig;
  19092. }());
  19093. /**
  19094. * Service to register and display icons used by the `<mat-icon>` component.
  19095. * - Registers icon URLs by namespace and name.
  19096. * - Registers icon set URLs by namespace.
  19097. * - Registers aliases for CSS classes, for use with icon fonts.
  19098. * - Loads icons from URLs and extracts individual icons from icon sets.
  19099. */
  19100. var MatIconRegistry = /** @class */ (function () {
  19101. function MatIconRegistry(_httpClient, _sanitizer, document) {
  19102. this._httpClient = _httpClient;
  19103. this._sanitizer = _sanitizer;
  19104. /**
  19105. * URLs and cached SVG elements for individual icons. Keys are of the format "[namespace]:[icon]".
  19106. */
  19107. this._svgIconConfigs = new Map();
  19108. /**
  19109. * SvgIconConfig objects and cached SVG elements for icon sets, keyed by namespace.
  19110. * Multiple icon sets can be registered under the same namespace.
  19111. */
  19112. this._iconSetConfigs = new Map();
  19113. /**
  19114. * Cache for icons loaded by direct URLs.
  19115. */
  19116. this._cachedIconsByUrl = new Map();
  19117. /**
  19118. * In-progress icon fetches. Used to coalesce multiple requests to the same URL.
  19119. */
  19120. this._inProgressUrlFetches = new Map();
  19121. /**
  19122. * Map from font identifiers to their CSS class names. Used for icon fonts.
  19123. */
  19124. this._fontCssClassesByAlias = new Map();
  19125. /**
  19126. * The CSS class to apply when an `<mat-icon>` component has no icon name, url, or font specified.
  19127. * The default 'material-icons' value assumes that the material icon font has been loaded as
  19128. * described at http://google.github.io/material-design-icons/#icon-font-for-the-web
  19129. */
  19130. this._defaultFontSetClass = 'material-icons';
  19131. this._document = document;
  19132. }
  19133. /**
  19134. * Registers an icon by URL in the default namespace.
  19135. * @param iconName Name under which the icon should be registered.
  19136. * @param url
  19137. */
  19138. /**
  19139. * Registers an icon by URL in the default namespace.
  19140. * @template THIS
  19141. * @this {THIS}
  19142. * @param {?} iconName Name under which the icon should be registered.
  19143. * @param {?} url
  19144. * @return {THIS}
  19145. */
  19146. MatIconRegistry.prototype.addSvgIcon = /**
  19147. * Registers an icon by URL in the default namespace.
  19148. * @template THIS
  19149. * @this {THIS}
  19150. * @param {?} iconName Name under which the icon should be registered.
  19151. * @param {?} url
  19152. * @return {THIS}
  19153. */
  19154. function (iconName, url) {
  19155. return (/** @type {?} */ (this)).addSvgIconInNamespace('', iconName, url);
  19156. };
  19157. /**
  19158. * Registers an icon using an HTML string in the default namespace.
  19159. * @param iconName Name under which the icon should be registered.
  19160. * @param literal SVG source of the icon.
  19161. */
  19162. /**
  19163. * Registers an icon using an HTML string in the default namespace.
  19164. * @template THIS
  19165. * @this {THIS}
  19166. * @param {?} iconName Name under which the icon should be registered.
  19167. * @param {?} literal SVG source of the icon.
  19168. * @return {THIS}
  19169. */
  19170. MatIconRegistry.prototype.addSvgIconLiteral = /**
  19171. * Registers an icon using an HTML string in the default namespace.
  19172. * @template THIS
  19173. * @this {THIS}
  19174. * @param {?} iconName Name under which the icon should be registered.
  19175. * @param {?} literal SVG source of the icon.
  19176. * @return {THIS}
  19177. */
  19178. function (iconName, literal) {
  19179. return (/** @type {?} */ (this)).addSvgIconLiteralInNamespace('', iconName, literal);
  19180. };
  19181. /**
  19182. * Registers an icon by URL in the specified namespace.
  19183. * @param namespace Namespace in which the icon should be registered.
  19184. * @param iconName Name under which the icon should be registered.
  19185. * @param url
  19186. */
  19187. /**
  19188. * Registers an icon by URL in the specified namespace.
  19189. * @template THIS
  19190. * @this {THIS}
  19191. * @param {?} namespace Namespace in which the icon should be registered.
  19192. * @param {?} iconName Name under which the icon should be registered.
  19193. * @param {?} url
  19194. * @return {THIS}
  19195. */
  19196. MatIconRegistry.prototype.addSvgIconInNamespace = /**
  19197. * Registers an icon by URL in the specified namespace.
  19198. * @template THIS
  19199. * @this {THIS}
  19200. * @param {?} namespace Namespace in which the icon should be registered.
  19201. * @param {?} iconName Name under which the icon should be registered.
  19202. * @param {?} url
  19203. * @return {THIS}
  19204. */
  19205. function (namespace, iconName, url) {
  19206. return (/** @type {?} */ (this))._addSvgIconConfig(namespace, iconName, new SvgIconConfig(url));
  19207. };
  19208. /**
  19209. * Registers an icon using an HTML string in the specified namespace.
  19210. * @param namespace Namespace in which the icon should be registered.
  19211. * @param iconName Name under which the icon should be registered.
  19212. * @param literal SVG source of the icon.
  19213. */
  19214. /**
  19215. * Registers an icon using an HTML string in the specified namespace.
  19216. * @template THIS
  19217. * @this {THIS}
  19218. * @param {?} namespace Namespace in which the icon should be registered.
  19219. * @param {?} iconName Name under which the icon should be registered.
  19220. * @param {?} literal SVG source of the icon.
  19221. * @return {THIS}
  19222. */
  19223. MatIconRegistry.prototype.addSvgIconLiteralInNamespace = /**
  19224. * Registers an icon using an HTML string in the specified namespace.
  19225. * @template THIS
  19226. * @this {THIS}
  19227. * @param {?} namespace Namespace in which the icon should be registered.
  19228. * @param {?} iconName Name under which the icon should be registered.
  19229. * @param {?} literal SVG source of the icon.
  19230. * @return {THIS}
  19231. */
  19232. function (namespace, iconName, literal) {
  19233. /** @type {?} */
  19234. var sanitizedLiteral = (/** @type {?} */ (this))._sanitizer.sanitize(core.SecurityContext.HTML, literal);
  19235. if (!sanitizedLiteral) {
  19236. throw getMatIconFailedToSanitizeLiteralError(literal);
  19237. }
  19238. /** @type {?} */
  19239. var svgElement = (/** @type {?} */ (this))._createSvgElementForSingleIcon(sanitizedLiteral);
  19240. return (/** @type {?} */ (this))._addSvgIconConfig(namespace, iconName, new SvgIconConfig(svgElement));
  19241. };
  19242. /**
  19243. * Registers an icon set by URL in the default namespace.
  19244. * @param url
  19245. */
  19246. /**
  19247. * Registers an icon set by URL in the default namespace.
  19248. * @template THIS
  19249. * @this {THIS}
  19250. * @param {?} url
  19251. * @return {THIS}
  19252. */
  19253. MatIconRegistry.prototype.addSvgIconSet = /**
  19254. * Registers an icon set by URL in the default namespace.
  19255. * @template THIS
  19256. * @this {THIS}
  19257. * @param {?} url
  19258. * @return {THIS}
  19259. */
  19260. function (url) {
  19261. return (/** @type {?} */ (this)).addSvgIconSetInNamespace('', url);
  19262. };
  19263. /**
  19264. * Registers an icon set using an HTML string in the default namespace.
  19265. * @param literal SVG source of the icon set.
  19266. */
  19267. /**
  19268. * Registers an icon set using an HTML string in the default namespace.
  19269. * @template THIS
  19270. * @this {THIS}
  19271. * @param {?} literal SVG source of the icon set.
  19272. * @return {THIS}
  19273. */
  19274. MatIconRegistry.prototype.addSvgIconSetLiteral = /**
  19275. * Registers an icon set using an HTML string in the default namespace.
  19276. * @template THIS
  19277. * @this {THIS}
  19278. * @param {?} literal SVG source of the icon set.
  19279. * @return {THIS}
  19280. */
  19281. function (literal) {
  19282. return (/** @type {?} */ (this)).addSvgIconSetLiteralInNamespace('', literal);
  19283. };
  19284. /**
  19285. * Registers an icon set by URL in the specified namespace.
  19286. * @param namespace Namespace in which to register the icon set.
  19287. * @param url
  19288. */
  19289. /**
  19290. * Registers an icon set by URL in the specified namespace.
  19291. * @template THIS
  19292. * @this {THIS}
  19293. * @param {?} namespace Namespace in which to register the icon set.
  19294. * @param {?} url
  19295. * @return {THIS}
  19296. */
  19297. MatIconRegistry.prototype.addSvgIconSetInNamespace = /**
  19298. * Registers an icon set by URL in the specified namespace.
  19299. * @template THIS
  19300. * @this {THIS}
  19301. * @param {?} namespace Namespace in which to register the icon set.
  19302. * @param {?} url
  19303. * @return {THIS}
  19304. */
  19305. function (namespace, url) {
  19306. return (/** @type {?} */ (this))._addSvgIconSetConfig(namespace, new SvgIconConfig(url));
  19307. };
  19308. /**
  19309. * Registers an icon set using an HTML string in the specified namespace.
  19310. * @param namespace Namespace in which to register the icon set.
  19311. * @param literal SVG source of the icon set.
  19312. */
  19313. /**
  19314. * Registers an icon set using an HTML string in the specified namespace.
  19315. * @template THIS
  19316. * @this {THIS}
  19317. * @param {?} namespace Namespace in which to register the icon set.
  19318. * @param {?} literal SVG source of the icon set.
  19319. * @return {THIS}
  19320. */
  19321. MatIconRegistry.prototype.addSvgIconSetLiteralInNamespace = /**
  19322. * Registers an icon set using an HTML string in the specified namespace.
  19323. * @template THIS
  19324. * @this {THIS}
  19325. * @param {?} namespace Namespace in which to register the icon set.
  19326. * @param {?} literal SVG source of the icon set.
  19327. * @return {THIS}
  19328. */
  19329. function (namespace, literal) {
  19330. /** @type {?} */
  19331. var sanitizedLiteral = (/** @type {?} */ (this))._sanitizer.sanitize(core.SecurityContext.HTML, literal);
  19332. if (!sanitizedLiteral) {
  19333. throw getMatIconFailedToSanitizeLiteralError(literal);
  19334. }
  19335. /** @type {?} */
  19336. var svgElement = (/** @type {?} */ (this))._svgElementFromString(sanitizedLiteral);
  19337. return (/** @type {?} */ (this))._addSvgIconSetConfig(namespace, new SvgIconConfig(svgElement));
  19338. };
  19339. /**
  19340. * Defines an alias for a CSS class name to be used for icon fonts. Creating an matIcon
  19341. * component with the alias as the fontSet input will cause the class name to be applied
  19342. * to the `<mat-icon>` element.
  19343. *
  19344. * @param alias Alias for the font.
  19345. * @param className Class name override to be used instead of the alias.
  19346. */
  19347. /**
  19348. * Defines an alias for a CSS class name to be used for icon fonts. Creating an matIcon
  19349. * component with the alias as the fontSet input will cause the class name to be applied
  19350. * to the `<mat-icon>` element.
  19351. *
  19352. * @template THIS
  19353. * @this {THIS}
  19354. * @param {?} alias Alias for the font.
  19355. * @param {?=} className Class name override to be used instead of the alias.
  19356. * @return {THIS}
  19357. */
  19358. MatIconRegistry.prototype.registerFontClassAlias = /**
  19359. * Defines an alias for a CSS class name to be used for icon fonts. Creating an matIcon
  19360. * component with the alias as the fontSet input will cause the class name to be applied
  19361. * to the `<mat-icon>` element.
  19362. *
  19363. * @template THIS
  19364. * @this {THIS}
  19365. * @param {?} alias Alias for the font.
  19366. * @param {?=} className Class name override to be used instead of the alias.
  19367. * @return {THIS}
  19368. */
  19369. function (alias, className) {
  19370. if (className === void 0) { className = alias; }
  19371. (/** @type {?} */ (this))._fontCssClassesByAlias.set(alias, className);
  19372. return (/** @type {?} */ (this));
  19373. };
  19374. /**
  19375. * Returns the CSS class name associated with the alias by a previous call to
  19376. * registerFontClassAlias. If no CSS class has been associated, returns the alias unmodified.
  19377. */
  19378. /**
  19379. * Returns the CSS class name associated with the alias by a previous call to
  19380. * registerFontClassAlias. If no CSS class has been associated, returns the alias unmodified.
  19381. * @param {?} alias
  19382. * @return {?}
  19383. */
  19384. MatIconRegistry.prototype.classNameForFontAlias = /**
  19385. * Returns the CSS class name associated with the alias by a previous call to
  19386. * registerFontClassAlias. If no CSS class has been associated, returns the alias unmodified.
  19387. * @param {?} alias
  19388. * @return {?}
  19389. */
  19390. function (alias) {
  19391. return this._fontCssClassesByAlias.get(alias) || alias;
  19392. };
  19393. /**
  19394. * Sets the CSS class name to be used for icon fonts when an `<mat-icon>` component does not
  19395. * have a fontSet input value, and is not loading an icon by name or URL.
  19396. *
  19397. * @param className
  19398. */
  19399. /**
  19400. * Sets the CSS class name to be used for icon fonts when an `<mat-icon>` component does not
  19401. * have a fontSet input value, and is not loading an icon by name or URL.
  19402. *
  19403. * @template THIS
  19404. * @this {THIS}
  19405. * @param {?} className
  19406. * @return {THIS}
  19407. */
  19408. MatIconRegistry.prototype.setDefaultFontSetClass = /**
  19409. * Sets the CSS class name to be used for icon fonts when an `<mat-icon>` component does not
  19410. * have a fontSet input value, and is not loading an icon by name or URL.
  19411. *
  19412. * @template THIS
  19413. * @this {THIS}
  19414. * @param {?} className
  19415. * @return {THIS}
  19416. */
  19417. function (className) {
  19418. (/** @type {?} */ (this))._defaultFontSetClass = className;
  19419. return (/** @type {?} */ (this));
  19420. };
  19421. /**
  19422. * Returns the CSS class name to be used for icon fonts when an `<mat-icon>` component does not
  19423. * have a fontSet input value, and is not loading an icon by name or URL.
  19424. */
  19425. /**
  19426. * Returns the CSS class name to be used for icon fonts when an `<mat-icon>` component does not
  19427. * have a fontSet input value, and is not loading an icon by name or URL.
  19428. * @return {?}
  19429. */
  19430. MatIconRegistry.prototype.getDefaultFontSetClass = /**
  19431. * Returns the CSS class name to be used for icon fonts when an `<mat-icon>` component does not
  19432. * have a fontSet input value, and is not loading an icon by name or URL.
  19433. * @return {?}
  19434. */
  19435. function () {
  19436. return this._defaultFontSetClass;
  19437. };
  19438. /**
  19439. * Returns an Observable that produces the icon (as an `<svg>` DOM element) from the given URL.
  19440. * The response from the URL may be cached so this will not always cause an HTTP request, but
  19441. * the produced element will always be a new copy of the originally fetched icon. (That is,
  19442. * it will not contain any modifications made to elements previously returned).
  19443. *
  19444. * @param safeUrl URL from which to fetch the SVG icon.
  19445. */
  19446. /**
  19447. * Returns an Observable that produces the icon (as an `<svg>` DOM element) from the given URL.
  19448. * The response from the URL may be cached so this will not always cause an HTTP request, but
  19449. * the produced element will always be a new copy of the originally fetched icon. (That is,
  19450. * it will not contain any modifications made to elements previously returned).
  19451. *
  19452. * @param {?} safeUrl URL from which to fetch the SVG icon.
  19453. * @return {?}
  19454. */
  19455. MatIconRegistry.prototype.getSvgIconFromUrl = /**
  19456. * Returns an Observable that produces the icon (as an `<svg>` DOM element) from the given URL.
  19457. * The response from the URL may be cached so this will not always cause an HTTP request, but
  19458. * the produced element will always be a new copy of the originally fetched icon. (That is,
  19459. * it will not contain any modifications made to elements previously returned).
  19460. *
  19461. * @param {?} safeUrl URL from which to fetch the SVG icon.
  19462. * @return {?}
  19463. */
  19464. function (safeUrl) {
  19465. var _this = this;
  19466. /** @type {?} */
  19467. var url = this._sanitizer.sanitize(core.SecurityContext.RESOURCE_URL, safeUrl);
  19468. if (!url) {
  19469. throw getMatIconFailedToSanitizeUrlError(safeUrl);
  19470. }
  19471. /** @type {?} */
  19472. var cachedIcon = this._cachedIconsByUrl.get(url);
  19473. if (cachedIcon) {
  19474. return rxjs.of(cloneSvg(cachedIcon));
  19475. }
  19476. return this._loadSvgIconFromConfig(new SvgIconConfig(safeUrl)).pipe(operators.tap((/**
  19477. * @param {?} svg
  19478. * @return {?}
  19479. */
  19480. function (svg) { return _this._cachedIconsByUrl.set((/** @type {?} */ (url)), svg); })), operators.map((/**
  19481. * @param {?} svg
  19482. * @return {?}
  19483. */
  19484. function (svg) { return cloneSvg(svg); })));
  19485. };
  19486. /**
  19487. * Returns an Observable that produces the icon (as an `<svg>` DOM element) with the given name
  19488. * and namespace. The icon must have been previously registered with addIcon or addIconSet;
  19489. * if not, the Observable will throw an error.
  19490. *
  19491. * @param name Name of the icon to be retrieved.
  19492. * @param namespace Namespace in which to look for the icon.
  19493. */
  19494. /**
  19495. * Returns an Observable that produces the icon (as an `<svg>` DOM element) with the given name
  19496. * and namespace. The icon must have been previously registered with addIcon or addIconSet;
  19497. * if not, the Observable will throw an error.
  19498. *
  19499. * @param {?} name Name of the icon to be retrieved.
  19500. * @param {?=} namespace Namespace in which to look for the icon.
  19501. * @return {?}
  19502. */
  19503. MatIconRegistry.prototype.getNamedSvgIcon = /**
  19504. * Returns an Observable that produces the icon (as an `<svg>` DOM element) with the given name
  19505. * and namespace. The icon must have been previously registered with addIcon or addIconSet;
  19506. * if not, the Observable will throw an error.
  19507. *
  19508. * @param {?} name Name of the icon to be retrieved.
  19509. * @param {?=} namespace Namespace in which to look for the icon.
  19510. * @return {?}
  19511. */
  19512. function (name, namespace) {
  19513. if (namespace === void 0) { namespace = ''; }
  19514. // Return (copy of) cached icon if possible.
  19515. /** @type {?} */
  19516. var key = iconKey(namespace, name);
  19517. /** @type {?} */
  19518. var config = this._svgIconConfigs.get(key);
  19519. if (config) {
  19520. return this._getSvgFromConfig(config);
  19521. }
  19522. // See if we have any icon sets registered for the namespace.
  19523. /** @type {?} */
  19524. var iconSetConfigs = this._iconSetConfigs.get(namespace);
  19525. if (iconSetConfigs) {
  19526. return this._getSvgFromIconSetConfigs(name, iconSetConfigs);
  19527. }
  19528. return rxjs.throwError(getMatIconNameNotFoundError(key));
  19529. };
  19530. /**
  19531. * @return {?}
  19532. */
  19533. MatIconRegistry.prototype.ngOnDestroy = /**
  19534. * @return {?}
  19535. */
  19536. function () {
  19537. this._svgIconConfigs.clear();
  19538. this._iconSetConfigs.clear();
  19539. this._cachedIconsByUrl.clear();
  19540. };
  19541. /**
  19542. * Returns the cached icon for a SvgIconConfig if available, or fetches it from its URL if not.
  19543. */
  19544. /**
  19545. * Returns the cached icon for a SvgIconConfig if available, or fetches it from its URL if not.
  19546. * @private
  19547. * @param {?} config
  19548. * @return {?}
  19549. */
  19550. MatIconRegistry.prototype._getSvgFromConfig = /**
  19551. * Returns the cached icon for a SvgIconConfig if available, or fetches it from its URL if not.
  19552. * @private
  19553. * @param {?} config
  19554. * @return {?}
  19555. */
  19556. function (config) {
  19557. if (config.svgElement) {
  19558. // We already have the SVG element for this icon, return a copy.
  19559. return rxjs.of(cloneSvg(config.svgElement));
  19560. }
  19561. else {
  19562. // Fetch the icon from the config's URL, cache it, and return a copy.
  19563. return this._loadSvgIconFromConfig(config).pipe(operators.tap((/**
  19564. * @param {?} svg
  19565. * @return {?}
  19566. */
  19567. function (svg) { return config.svgElement = svg; })), operators.map((/**
  19568. * @param {?} svg
  19569. * @return {?}
  19570. */
  19571. function (svg) { return cloneSvg(svg); })));
  19572. }
  19573. };
  19574. /**
  19575. * Attempts to find an icon with the specified name in any of the SVG icon sets.
  19576. * First searches the available cached icons for a nested element with a matching name, and
  19577. * if found copies the element to a new `<svg>` element. If not found, fetches all icon sets
  19578. * that have not been cached, and searches again after all fetches are completed.
  19579. * The returned Observable produces the SVG element if possible, and throws
  19580. * an error if no icon with the specified name can be found.
  19581. */
  19582. /**
  19583. * Attempts to find an icon with the specified name in any of the SVG icon sets.
  19584. * First searches the available cached icons for a nested element with a matching name, and
  19585. * if found copies the element to a new `<svg>` element. If not found, fetches all icon sets
  19586. * that have not been cached, and searches again after all fetches are completed.
  19587. * The returned Observable produces the SVG element if possible, and throws
  19588. * an error if no icon with the specified name can be found.
  19589. * @private
  19590. * @param {?} name
  19591. * @param {?} iconSetConfigs
  19592. * @return {?}
  19593. */
  19594. MatIconRegistry.prototype._getSvgFromIconSetConfigs = /**
  19595. * Attempts to find an icon with the specified name in any of the SVG icon sets.
  19596. * First searches the available cached icons for a nested element with a matching name, and
  19597. * if found copies the element to a new `<svg>` element. If not found, fetches all icon sets
  19598. * that have not been cached, and searches again after all fetches are completed.
  19599. * The returned Observable produces the SVG element if possible, and throws
  19600. * an error if no icon with the specified name can be found.
  19601. * @private
  19602. * @param {?} name
  19603. * @param {?} iconSetConfigs
  19604. * @return {?}
  19605. */
  19606. function (name, iconSetConfigs) {
  19607. var _this = this;
  19608. // For all the icon set SVG elements we've fetched, see if any contain an icon with the
  19609. // requested name.
  19610. /** @type {?} */
  19611. var namedIcon = this._extractIconWithNameFromAnySet(name, iconSetConfigs);
  19612. if (namedIcon) {
  19613. // We could cache namedIcon in _svgIconConfigs, but since we have to make a copy every
  19614. // time anyway, there's probably not much advantage compared to just always extracting
  19615. // it from the icon set.
  19616. return rxjs.of(namedIcon);
  19617. }
  19618. // Not found in any cached icon sets. If there are icon sets with URLs that we haven't
  19619. // fetched, fetch them now and look for iconName in the results.
  19620. /** @type {?} */
  19621. var iconSetFetchRequests = iconSetConfigs
  19622. .filter((/**
  19623. * @param {?} iconSetConfig
  19624. * @return {?}
  19625. */
  19626. function (iconSetConfig) { return !iconSetConfig.svgElement; }))
  19627. .map((/**
  19628. * @param {?} iconSetConfig
  19629. * @return {?}
  19630. */
  19631. function (iconSetConfig) {
  19632. return _this._loadSvgIconSetFromConfig(iconSetConfig).pipe(operators.catchError((/**
  19633. * @param {?} err
  19634. * @return {?}
  19635. */
  19636. function (err) {
  19637. /** @type {?} */
  19638. var url = _this._sanitizer.sanitize(core.SecurityContext.RESOURCE_URL, iconSetConfig.url);
  19639. // Swallow errors fetching individual URLs so the
  19640. // combined Observable won't necessarily fail.
  19641. console.error("Loading icon set URL: " + url + " failed: " + err.message);
  19642. return rxjs.of(null);
  19643. })));
  19644. }));
  19645. // Fetch all the icon set URLs. When the requests complete, every IconSet should have a
  19646. // cached SVG element (unless the request failed), and we can check again for the icon.
  19647. return rxjs.forkJoin(iconSetFetchRequests).pipe(operators.map((/**
  19648. * @return {?}
  19649. */
  19650. function () {
  19651. /** @type {?} */
  19652. var foundIcon = _this._extractIconWithNameFromAnySet(name, iconSetConfigs);
  19653. if (!foundIcon) {
  19654. throw getMatIconNameNotFoundError(name);
  19655. }
  19656. return foundIcon;
  19657. })));
  19658. };
  19659. /**
  19660. * Searches the cached SVG elements for the given icon sets for a nested icon element whose "id"
  19661. * tag matches the specified name. If found, copies the nested element to a new SVG element and
  19662. * returns it. Returns null if no matching element is found.
  19663. */
  19664. /**
  19665. * Searches the cached SVG elements for the given icon sets for a nested icon element whose "id"
  19666. * tag matches the specified name. If found, copies the nested element to a new SVG element and
  19667. * returns it. Returns null if no matching element is found.
  19668. * @private
  19669. * @param {?} iconName
  19670. * @param {?} iconSetConfigs
  19671. * @return {?}
  19672. */
  19673. MatIconRegistry.prototype._extractIconWithNameFromAnySet = /**
  19674. * Searches the cached SVG elements for the given icon sets for a nested icon element whose "id"
  19675. * tag matches the specified name. If found, copies the nested element to a new SVG element and
  19676. * returns it. Returns null if no matching element is found.
  19677. * @private
  19678. * @param {?} iconName
  19679. * @param {?} iconSetConfigs
  19680. * @return {?}
  19681. */
  19682. function (iconName, iconSetConfigs) {
  19683. // Iterate backwards, so icon sets added later have precedence.
  19684. for (var i = iconSetConfigs.length - 1; i >= 0; i--) {
  19685. /** @type {?} */
  19686. var config = iconSetConfigs[i];
  19687. if (config.svgElement) {
  19688. /** @type {?} */
  19689. var foundIcon = this._extractSvgIconFromSet(config.svgElement, iconName);
  19690. if (foundIcon) {
  19691. return foundIcon;
  19692. }
  19693. }
  19694. }
  19695. return null;
  19696. };
  19697. /**
  19698. * Loads the content of the icon URL specified in the SvgIconConfig and creates an SVG element
  19699. * from it.
  19700. */
  19701. /**
  19702. * Loads the content of the icon URL specified in the SvgIconConfig and creates an SVG element
  19703. * from it.
  19704. * @private
  19705. * @param {?} config
  19706. * @return {?}
  19707. */
  19708. MatIconRegistry.prototype._loadSvgIconFromConfig = /**
  19709. * Loads the content of the icon URL specified in the SvgIconConfig and creates an SVG element
  19710. * from it.
  19711. * @private
  19712. * @param {?} config
  19713. * @return {?}
  19714. */
  19715. function (config) {
  19716. var _this = this;
  19717. return this._fetchUrl(config.url)
  19718. .pipe(operators.map((/**
  19719. * @param {?} svgText
  19720. * @return {?}
  19721. */
  19722. function (svgText) { return _this._createSvgElementForSingleIcon(svgText); })));
  19723. };
  19724. /**
  19725. * Loads the content of the icon set URL specified in the SvgIconConfig and creates an SVG element
  19726. * from it.
  19727. */
  19728. /**
  19729. * Loads the content of the icon set URL specified in the SvgIconConfig and creates an SVG element
  19730. * from it.
  19731. * @private
  19732. * @param {?} config
  19733. * @return {?}
  19734. */
  19735. MatIconRegistry.prototype._loadSvgIconSetFromConfig = /**
  19736. * Loads the content of the icon set URL specified in the SvgIconConfig and creates an SVG element
  19737. * from it.
  19738. * @private
  19739. * @param {?} config
  19740. * @return {?}
  19741. */
  19742. function (config) {
  19743. var _this = this;
  19744. // If the SVG for this icon set has already been parsed, do nothing.
  19745. if (config.svgElement) {
  19746. return rxjs.of(config.svgElement);
  19747. }
  19748. return this._fetchUrl(config.url).pipe(operators.map((/**
  19749. * @param {?} svgText
  19750. * @return {?}
  19751. */
  19752. function (svgText) {
  19753. // It is possible that the icon set was parsed and cached by an earlier request, so parsing
  19754. // only needs to occur if the cache is yet unset.
  19755. if (!config.svgElement) {
  19756. config.svgElement = _this._svgElementFromString(svgText);
  19757. }
  19758. return config.svgElement;
  19759. })));
  19760. };
  19761. /**
  19762. * Creates a DOM element from the given SVG string, and adds default attributes.
  19763. */
  19764. /**
  19765. * Creates a DOM element from the given SVG string, and adds default attributes.
  19766. * @private
  19767. * @param {?} responseText
  19768. * @return {?}
  19769. */
  19770. MatIconRegistry.prototype._createSvgElementForSingleIcon = /**
  19771. * Creates a DOM element from the given SVG string, and adds default attributes.
  19772. * @private
  19773. * @param {?} responseText
  19774. * @return {?}
  19775. */
  19776. function (responseText) {
  19777. /** @type {?} */
  19778. var svg = this._svgElementFromString(responseText);
  19779. this._setSvgAttributes(svg);
  19780. return svg;
  19781. };
  19782. /**
  19783. * Searches the cached element of the given SvgIconConfig for a nested icon element whose "id"
  19784. * tag matches the specified name. If found, copies the nested element to a new SVG element and
  19785. * returns it. Returns null if no matching element is found.
  19786. */
  19787. /**
  19788. * Searches the cached element of the given SvgIconConfig for a nested icon element whose "id"
  19789. * tag matches the specified name. If found, copies the nested element to a new SVG element and
  19790. * returns it. Returns null if no matching element is found.
  19791. * @private
  19792. * @param {?} iconSet
  19793. * @param {?} iconName
  19794. * @return {?}
  19795. */
  19796. MatIconRegistry.prototype._extractSvgIconFromSet = /**
  19797. * Searches the cached element of the given SvgIconConfig for a nested icon element whose "id"
  19798. * tag matches the specified name. If found, copies the nested element to a new SVG element and
  19799. * returns it. Returns null if no matching element is found.
  19800. * @private
  19801. * @param {?} iconSet
  19802. * @param {?} iconName
  19803. * @return {?}
  19804. */
  19805. function (iconSet, iconName) {
  19806. // Use the `id="iconName"` syntax in order to escape special
  19807. // characters in the ID (versus using the #iconName syntax).
  19808. /** @type {?} */
  19809. var iconSource = iconSet.querySelector("[id=\"" + iconName + "\"]");
  19810. if (!iconSource) {
  19811. return null;
  19812. }
  19813. // Clone the element and remove the ID to prevent multiple elements from being added
  19814. // to the page with the same ID.
  19815. /** @type {?} */
  19816. var iconElement = (/** @type {?} */ (iconSource.cloneNode(true)));
  19817. iconElement.removeAttribute('id');
  19818. // If the icon node is itself an <svg> node, clone and return it directly. If not, set it as
  19819. // the content of a new <svg> node.
  19820. if (iconElement.nodeName.toLowerCase() === 'svg') {
  19821. return this._setSvgAttributes((/** @type {?} */ (iconElement)));
  19822. }
  19823. // If the node is a <symbol>, it won't be rendered so we have to convert it into <svg>. Note
  19824. // that the same could be achieved by referring to it via <use href="#id">, however the <use>
  19825. // tag is problematic on Firefox, because it needs to include the current page path.
  19826. if (iconElement.nodeName.toLowerCase() === 'symbol') {
  19827. return this._setSvgAttributes(this._toSvgElement(iconElement));
  19828. }
  19829. // createElement('SVG') doesn't work as expected; the DOM ends up with
  19830. // the correct nodes, but the SVG content doesn't render. Instead we
  19831. // have to create an empty SVG node using innerHTML and append its content.
  19832. // Elements created using DOMParser.parseFromString have the same problem.
  19833. // http://stackoverflow.com/questions/23003278/svg-innerhtml-in-firefox-can-not-display
  19834. /** @type {?} */
  19835. var svg = this._svgElementFromString('<svg></svg>');
  19836. // Clone the node so we don't remove it from the parent icon set element.
  19837. svg.appendChild(iconElement);
  19838. return this._setSvgAttributes(svg);
  19839. };
  19840. /**
  19841. * Creates a DOM element from the given SVG string.
  19842. */
  19843. /**
  19844. * Creates a DOM element from the given SVG string.
  19845. * @private
  19846. * @param {?} str
  19847. * @return {?}
  19848. */
  19849. MatIconRegistry.prototype._svgElementFromString = /**
  19850. * Creates a DOM element from the given SVG string.
  19851. * @private
  19852. * @param {?} str
  19853. * @return {?}
  19854. */
  19855. function (str) {
  19856. /** @type {?} */
  19857. var div = this._document.createElement('DIV');
  19858. div.innerHTML = str;
  19859. /** @type {?} */
  19860. var svg = (/** @type {?} */ (div.querySelector('svg')));
  19861. if (!svg) {
  19862. throw Error('<svg> tag not found');
  19863. }
  19864. return svg;
  19865. };
  19866. /**
  19867. * Converts an element into an SVG node by cloning all of its children.
  19868. */
  19869. /**
  19870. * Converts an element into an SVG node by cloning all of its children.
  19871. * @private
  19872. * @param {?} element
  19873. * @return {?}
  19874. */
  19875. MatIconRegistry.prototype._toSvgElement = /**
  19876. * Converts an element into an SVG node by cloning all of its children.
  19877. * @private
  19878. * @param {?} element
  19879. * @return {?}
  19880. */
  19881. function (element) {
  19882. /** @type {?} */
  19883. var svg = this._svgElementFromString('<svg></svg>');
  19884. for (var i = 0; i < element.childNodes.length; i++) {
  19885. if (element.childNodes[i].nodeType === this._document.ELEMENT_NODE) {
  19886. svg.appendChild(element.childNodes[i].cloneNode(true));
  19887. }
  19888. }
  19889. return svg;
  19890. };
  19891. /**
  19892. * Sets the default attributes for an SVG element to be used as an icon.
  19893. */
  19894. /**
  19895. * Sets the default attributes for an SVG element to be used as an icon.
  19896. * @private
  19897. * @param {?} svg
  19898. * @return {?}
  19899. */
  19900. MatIconRegistry.prototype._setSvgAttributes = /**
  19901. * Sets the default attributes for an SVG element to be used as an icon.
  19902. * @private
  19903. * @param {?} svg
  19904. * @return {?}
  19905. */
  19906. function (svg) {
  19907. svg.setAttribute('fit', '');
  19908. svg.setAttribute('height', '100%');
  19909. svg.setAttribute('width', '100%');
  19910. svg.setAttribute('preserveAspectRatio', 'xMidYMid meet');
  19911. svg.setAttribute('focusable', 'false'); // Disable IE11 default behavior to make SVGs focusable.
  19912. return svg;
  19913. };
  19914. /**
  19915. * Returns an Observable which produces the string contents of the given URL. Results may be
  19916. * cached, so future calls with the same URL may not cause another HTTP request.
  19917. */
  19918. /**
  19919. * Returns an Observable which produces the string contents of the given URL. Results may be
  19920. * cached, so future calls with the same URL may not cause another HTTP request.
  19921. * @private
  19922. * @param {?} safeUrl
  19923. * @return {?}
  19924. */
  19925. MatIconRegistry.prototype._fetchUrl = /**
  19926. * Returns an Observable which produces the string contents of the given URL. Results may be
  19927. * cached, so future calls with the same URL may not cause another HTTP request.
  19928. * @private
  19929. * @param {?} safeUrl
  19930. * @return {?}
  19931. */
  19932. function (safeUrl) {
  19933. var _this = this;
  19934. if (!this._httpClient) {
  19935. throw getMatIconNoHttpProviderError();
  19936. }
  19937. if (safeUrl == null) {
  19938. throw Error("Cannot fetch icon from URL \"" + safeUrl + "\".");
  19939. }
  19940. /** @type {?} */
  19941. var url = this._sanitizer.sanitize(core.SecurityContext.RESOURCE_URL, safeUrl);
  19942. if (!url) {
  19943. throw getMatIconFailedToSanitizeUrlError(safeUrl);
  19944. }
  19945. // Store in-progress fetches to avoid sending a duplicate request for a URL when there is
  19946. // already a request in progress for that URL. It's necessary to call share() on the
  19947. // Observable returned by http.get() so that multiple subscribers don't cause multiple XHRs.
  19948. /** @type {?} */
  19949. var inProgressFetch = this._inProgressUrlFetches.get(url);
  19950. if (inProgressFetch) {
  19951. return inProgressFetch;
  19952. }
  19953. // TODO(jelbourn): for some reason, the `finalize` operator "loses" the generic type on the
  19954. // Observable. Figure out why and fix it.
  19955. /** @type {?} */
  19956. var req = this._httpClient.get(url, { responseType: 'text' }).pipe(operators.finalize((/**
  19957. * @return {?}
  19958. */
  19959. function () { return _this._inProgressUrlFetches.delete(url); })), operators.share());
  19960. this._inProgressUrlFetches.set(url, req);
  19961. return req;
  19962. };
  19963. /**
  19964. * Registers an icon config by name in the specified namespace.
  19965. * @param namespace Namespace in which to register the icon config.
  19966. * @param iconName Name under which to register the config.
  19967. * @param config Config to be registered.
  19968. */
  19969. /**
  19970. * Registers an icon config by name in the specified namespace.
  19971. * @private
  19972. * @template THIS
  19973. * @this {THIS}
  19974. * @param {?} namespace Namespace in which to register the icon config.
  19975. * @param {?} iconName Name under which to register the config.
  19976. * @param {?} config Config to be registered.
  19977. * @return {THIS}
  19978. */
  19979. MatIconRegistry.prototype._addSvgIconConfig = /**
  19980. * Registers an icon config by name in the specified namespace.
  19981. * @private
  19982. * @template THIS
  19983. * @this {THIS}
  19984. * @param {?} namespace Namespace in which to register the icon config.
  19985. * @param {?} iconName Name under which to register the config.
  19986. * @param {?} config Config to be registered.
  19987. * @return {THIS}
  19988. */
  19989. function (namespace, iconName, config) {
  19990. (/** @type {?} */ (this))._svgIconConfigs.set(iconKey(namespace, iconName), config);
  19991. return (/** @type {?} */ (this));
  19992. };
  19993. /**
  19994. * Registers an icon set config in the specified namespace.
  19995. * @param namespace Namespace in which to register the icon config.
  19996. * @param config Config to be registered.
  19997. */
  19998. /**
  19999. * Registers an icon set config in the specified namespace.
  20000. * @private
  20001. * @template THIS
  20002. * @this {THIS}
  20003. * @param {?} namespace Namespace in which to register the icon config.
  20004. * @param {?} config Config to be registered.
  20005. * @return {THIS}
  20006. */
  20007. MatIconRegistry.prototype._addSvgIconSetConfig = /**
  20008. * Registers an icon set config in the specified namespace.
  20009. * @private
  20010. * @template THIS
  20011. * @this {THIS}
  20012. * @param {?} namespace Namespace in which to register the icon config.
  20013. * @param {?} config Config to be registered.
  20014. * @return {THIS}
  20015. */
  20016. function (namespace, config) {
  20017. /** @type {?} */
  20018. var configNamespace = (/** @type {?} */ (this))._iconSetConfigs.get(namespace);
  20019. if (configNamespace) {
  20020. configNamespace.push(config);
  20021. }
  20022. else {
  20023. (/** @type {?} */ (this))._iconSetConfigs.set(namespace, [config]);
  20024. }
  20025. return (/** @type {?} */ (this));
  20026. };
  20027. MatIconRegistry.decorators = [
  20028. { type: core.Injectable, args: [{ providedIn: 'root' },] },
  20029. ];
  20030. /** @nocollapse */
  20031. MatIconRegistry.ctorParameters = function () { return [
  20032. { type: http.HttpClient, decorators: [{ type: core.Optional }] },
  20033. { type: platformBrowser.DomSanitizer },
  20034. { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [common.DOCUMENT,] }] }
  20035. ]; };
  20036. /** @nocollapse */ MatIconRegistry.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function MatIconRegistry_Factory() { return new MatIconRegistry(core.ɵɵinject(http.HttpClient, 8), core.ɵɵinject(platformBrowser.DomSanitizer), core.ɵɵinject(common.DOCUMENT, 8)); }, token: MatIconRegistry, providedIn: "root" });
  20037. return MatIconRegistry;
  20038. }());
  20039. /**
  20040. * \@docs-private
  20041. * @param {?} parentRegistry
  20042. * @param {?} httpClient
  20043. * @param {?} sanitizer
  20044. * @param {?=} document
  20045. * @return {?}
  20046. */
  20047. function ICON_REGISTRY_PROVIDER_FACTORY(parentRegistry, httpClient, sanitizer, document) {
  20048. return parentRegistry || new MatIconRegistry(httpClient, sanitizer, document);
  20049. }
  20050. /**
  20051. * \@docs-private
  20052. * @type {?}
  20053. */
  20054. var ICON_REGISTRY_PROVIDER = {
  20055. // If there is already an MatIconRegistry available, use that. Otherwise, provide a new one.
  20056. provide: MatIconRegistry,
  20057. deps: [
  20058. [new core.Optional(), new core.SkipSelf(), MatIconRegistry],
  20059. [new core.Optional(), http.HttpClient],
  20060. platformBrowser.DomSanitizer,
  20061. [new core.Optional(), (/** @type {?} */ (common.DOCUMENT))],
  20062. ],
  20063. useFactory: ICON_REGISTRY_PROVIDER_FACTORY,
  20064. };
  20065. /**
  20066. * Clones an SVGElement while preserving type information.
  20067. * @param {?} svg
  20068. * @return {?}
  20069. */
  20070. function cloneSvg(svg) {
  20071. return (/** @type {?} */ (svg.cloneNode(true)));
  20072. }
  20073. /**
  20074. * Returns the cache key to use for an icon namespace and name.
  20075. * @param {?} namespace
  20076. * @param {?} name
  20077. * @return {?}
  20078. */
  20079. function iconKey(namespace, name) {
  20080. return namespace + ':' + name;
  20081. }
  20082. /**
  20083. * @fileoverview added by tsickle
  20084. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  20085. */
  20086. // Boilerplate for applying mixins to MatIcon.
  20087. /**
  20088. * \@docs-private
  20089. */
  20090. var
  20091. // Boilerplate for applying mixins to MatIcon.
  20092. /**
  20093. * \@docs-private
  20094. */
  20095. MatIconBase = /** @class */ (function () {
  20096. function MatIconBase(_elementRef) {
  20097. this._elementRef = _elementRef;
  20098. }
  20099. return MatIconBase;
  20100. }());
  20101. /** @type {?} */
  20102. var _MatIconMixinBase = mixinColor(MatIconBase);
  20103. /**
  20104. * Injection token used to provide the current location to `MatIcon`.
  20105. * Used to handle server-side rendering and to stub out during unit tests.
  20106. * \@docs-private
  20107. * @type {?}
  20108. */
  20109. var MAT_ICON_LOCATION = new core.InjectionToken('mat-icon-location', {
  20110. providedIn: 'root',
  20111. factory: MAT_ICON_LOCATION_FACTORY
  20112. });
  20113. /**
  20114. * \@docs-private
  20115. * @return {?}
  20116. */
  20117. function MAT_ICON_LOCATION_FACTORY() {
  20118. /** @type {?} */
  20119. var _document = core.inject(common.DOCUMENT);
  20120. /** @type {?} */
  20121. var _location = _document ? _document.location : null;
  20122. return {
  20123. // Note that this needs to be a function, rather than a property, because Angular
  20124. // will only resolve it once, but we want the current path on each call.
  20125. getPathname: (/**
  20126. * @return {?}
  20127. */
  20128. function () { return _location ? (_location.pathname + _location.search) : ''; })
  20129. };
  20130. }
  20131. /**
  20132. * SVG attributes that accept a FuncIRI (e.g. `url(<something>)`).
  20133. * @type {?}
  20134. */
  20135. var funcIriAttributes = [
  20136. 'clip-path',
  20137. 'color-profile',
  20138. 'src',
  20139. 'cursor',
  20140. 'fill',
  20141. 'filter',
  20142. 'marker',
  20143. 'marker-start',
  20144. 'marker-mid',
  20145. 'marker-end',
  20146. 'mask',
  20147. 'stroke'
  20148. ];
  20149. var ɵ0$5 = /**
  20150. * @param {?} attr
  20151. * @return {?}
  20152. */
  20153. function (attr) { return "[" + attr + "]"; };
  20154. /**
  20155. * Selector that can be used to find all elements that are using a `FuncIRI`.
  20156. * @type {?}
  20157. */
  20158. var funcIriAttributeSelector = funcIriAttributes.map((ɵ0$5)).join(', ');
  20159. /**
  20160. * Regex that can be used to extract the id out of a FuncIRI.
  20161. * @type {?}
  20162. */
  20163. var funcIriPattern = /^url\(['"]?#(.*?)['"]?\)$/;
  20164. /**
  20165. * Component to display an icon. It can be used in the following ways:
  20166. *
  20167. * - Specify the svgIcon input to load an SVG icon from a URL previously registered with the
  20168. * addSvgIcon, addSvgIconInNamespace, addSvgIconSet, or addSvgIconSetInNamespace methods of
  20169. * MatIconRegistry. If the svgIcon value contains a colon it is assumed to be in the format
  20170. * "[namespace]:[name]", if not the value will be the name of an icon in the default namespace.
  20171. * Examples:
  20172. * `<mat-icon svgIcon="left-arrow"></mat-icon>
  20173. * <mat-icon svgIcon="animals:cat"></mat-icon>`
  20174. *
  20175. * - Use a font ligature as an icon by putting the ligature text in the content of the `<mat-icon>`
  20176. * component. By default the Material icons font is used as described at
  20177. * http://google.github.io/material-design-icons/#icon-font-for-the-web. You can specify an
  20178. * alternate font by setting the fontSet input to either the CSS class to apply to use the
  20179. * desired font, or to an alias previously registered with MatIconRegistry.registerFontClassAlias.
  20180. * Examples:
  20181. * `<mat-icon>home</mat-icon>
  20182. * <mat-icon fontSet="myfont">sun</mat-icon>`
  20183. *
  20184. * - Specify a font glyph to be included via CSS rules by setting the fontSet input to specify the
  20185. * font, and the fontIcon input to specify the icon. Typically the fontIcon will specify a
  20186. * CSS class which causes the glyph to be displayed via a :before selector, as in
  20187. * https://fortawesome.github.io/Font-Awesome/examples/
  20188. * Example:
  20189. * `<mat-icon fontSet="fa" fontIcon="alarm"></mat-icon>`
  20190. */
  20191. var MatIcon = /** @class */ (function (_super) {
  20192. __extends(MatIcon, _super);
  20193. function MatIcon(elementRef, _iconRegistry, ariaHidden, _location) {
  20194. var _this = _super.call(this, elementRef) || this;
  20195. _this._iconRegistry = _iconRegistry;
  20196. _this._location = _location;
  20197. _this._inline = false;
  20198. // If the user has not explicitly set aria-hidden, mark the icon as hidden, as this is
  20199. // the right thing to do for the majority of icon use-cases.
  20200. if (!ariaHidden) {
  20201. elementRef.nativeElement.setAttribute('aria-hidden', 'true');
  20202. }
  20203. return _this;
  20204. }
  20205. Object.defineProperty(MatIcon.prototype, "inline", {
  20206. /**
  20207. * Whether the icon should be inlined, automatically sizing the icon to match the font size of
  20208. * the element the icon is contained in.
  20209. */
  20210. get: /**
  20211. * Whether the icon should be inlined, automatically sizing the icon to match the font size of
  20212. * the element the icon is contained in.
  20213. * @return {?}
  20214. */
  20215. function () {
  20216. return this._inline;
  20217. },
  20218. set: /**
  20219. * @param {?} inline
  20220. * @return {?}
  20221. */
  20222. function (inline) {
  20223. this._inline = coercion.coerceBooleanProperty(inline);
  20224. },
  20225. enumerable: true,
  20226. configurable: true
  20227. });
  20228. Object.defineProperty(MatIcon.prototype, "fontSet", {
  20229. /** Font set that the icon is a part of. */
  20230. get: /**
  20231. * Font set that the icon is a part of.
  20232. * @return {?}
  20233. */
  20234. function () { return this._fontSet; },
  20235. set: /**
  20236. * @param {?} value
  20237. * @return {?}
  20238. */
  20239. function (value) {
  20240. this._fontSet = this._cleanupFontValue(value);
  20241. },
  20242. enumerable: true,
  20243. configurable: true
  20244. });
  20245. Object.defineProperty(MatIcon.prototype, "fontIcon", {
  20246. /** Name of an icon within a font set. */
  20247. get: /**
  20248. * Name of an icon within a font set.
  20249. * @return {?}
  20250. */
  20251. function () { return this._fontIcon; },
  20252. set: /**
  20253. * @param {?} value
  20254. * @return {?}
  20255. */
  20256. function (value) {
  20257. this._fontIcon = this._cleanupFontValue(value);
  20258. },
  20259. enumerable: true,
  20260. configurable: true
  20261. });
  20262. /**
  20263. * Splits an svgIcon binding value into its icon set and icon name components.
  20264. * Returns a 2-element array of [(icon set), (icon name)].
  20265. * The separator for the two fields is ':'. If there is no separator, an empty
  20266. * string is returned for the icon set and the entire value is returned for
  20267. * the icon name. If the argument is falsy, returns an array of two empty strings.
  20268. * Throws an error if the name contains two or more ':' separators.
  20269. * Examples:
  20270. * `'social:cake' -> ['social', 'cake']
  20271. * 'penguin' -> ['', 'penguin']
  20272. * null -> ['', '']
  20273. * 'a:b:c' -> (throws Error)`
  20274. */
  20275. /**
  20276. * Splits an svgIcon binding value into its icon set and icon name components.
  20277. * Returns a 2-element array of [(icon set), (icon name)].
  20278. * The separator for the two fields is ':'. If there is no separator, an empty
  20279. * string is returned for the icon set and the entire value is returned for
  20280. * the icon name. If the argument is falsy, returns an array of two empty strings.
  20281. * Throws an error if the name contains two or more ':' separators.
  20282. * Examples:
  20283. * `'social:cake' -> ['social', 'cake']
  20284. * 'penguin' -> ['', 'penguin']
  20285. * null -> ['', '']
  20286. * 'a:b:c' -> (throws Error)`
  20287. * @private
  20288. * @param {?} iconName
  20289. * @return {?}
  20290. */
  20291. MatIcon.prototype._splitIconName = /**
  20292. * Splits an svgIcon binding value into its icon set and icon name components.
  20293. * Returns a 2-element array of [(icon set), (icon name)].
  20294. * The separator for the two fields is ':'. If there is no separator, an empty
  20295. * string is returned for the icon set and the entire value is returned for
  20296. * the icon name. If the argument is falsy, returns an array of two empty strings.
  20297. * Throws an error if the name contains two or more ':' separators.
  20298. * Examples:
  20299. * `'social:cake' -> ['social', 'cake']
  20300. * 'penguin' -> ['', 'penguin']
  20301. * null -> ['', '']
  20302. * 'a:b:c' -> (throws Error)`
  20303. * @private
  20304. * @param {?} iconName
  20305. * @return {?}
  20306. */
  20307. function (iconName) {
  20308. if (!iconName) {
  20309. return ['', ''];
  20310. }
  20311. /** @type {?} */
  20312. var parts = iconName.split(':');
  20313. switch (parts.length) {
  20314. case 1: return ['', parts[0]]; // Use default namespace.
  20315. case 2: return (/** @type {?} */ (parts));
  20316. default: throw Error("Invalid icon name: \"" + iconName + "\"");
  20317. }
  20318. };
  20319. /**
  20320. * @param {?} changes
  20321. * @return {?}
  20322. */
  20323. MatIcon.prototype.ngOnChanges = /**
  20324. * @param {?} changes
  20325. * @return {?}
  20326. */
  20327. function (changes) {
  20328. var _this = this;
  20329. // Only update the inline SVG icon if the inputs changed, to avoid unnecessary DOM operations.
  20330. /** @type {?} */
  20331. var svgIconChanges = changes['svgIcon'];
  20332. if (svgIconChanges) {
  20333. if (this.svgIcon) {
  20334. var _a = this._splitIconName(this.svgIcon), namespace = _a[0], iconName = _a[1];
  20335. this._iconRegistry.getNamedSvgIcon(iconName, namespace).pipe(operators.take(1)).subscribe((/**
  20336. * @param {?} svg
  20337. * @return {?}
  20338. */
  20339. function (svg) { return _this._setSvgElement(svg); }), (/**
  20340. * @param {?} err
  20341. * @return {?}
  20342. */
  20343. function (err) { return console.log("Error retrieving icon: " + err.message); }));
  20344. }
  20345. else if (svgIconChanges.previousValue) {
  20346. this._clearSvgElement();
  20347. }
  20348. }
  20349. if (this._usingFontIcon()) {
  20350. this._updateFontIconClasses();
  20351. }
  20352. };
  20353. /**
  20354. * @return {?}
  20355. */
  20356. MatIcon.prototype.ngOnInit = /**
  20357. * @return {?}
  20358. */
  20359. function () {
  20360. // Update font classes because ngOnChanges won't be called if none of the inputs are present,
  20361. // e.g. <mat-icon>arrow</mat-icon> In this case we need to add a CSS class for the default font.
  20362. if (this._usingFontIcon()) {
  20363. this._updateFontIconClasses();
  20364. }
  20365. };
  20366. /**
  20367. * @return {?}
  20368. */
  20369. MatIcon.prototype.ngAfterViewChecked = /**
  20370. * @return {?}
  20371. */
  20372. function () {
  20373. /** @type {?} */
  20374. var cachedElements = this._elementsWithExternalReferences;
  20375. if (cachedElements && this._location && cachedElements.size) {
  20376. /** @type {?} */
  20377. var newPath = this._location.getPathname();
  20378. // We need to check whether the URL has changed on each change detection since
  20379. // the browser doesn't have an API that will let us react on link clicks and
  20380. // we can't depend on the Angular router. The references need to be updated,
  20381. // because while most browsers don't care whether the URL is correct after
  20382. // the first render, Safari will break if the user navigates to a different
  20383. // page and the SVG isn't re-rendered.
  20384. if (newPath !== this._previousPath) {
  20385. this._previousPath = newPath;
  20386. this._prependPathToReferences(newPath);
  20387. }
  20388. }
  20389. };
  20390. /**
  20391. * @return {?}
  20392. */
  20393. MatIcon.prototype.ngOnDestroy = /**
  20394. * @return {?}
  20395. */
  20396. function () {
  20397. if (this._elementsWithExternalReferences) {
  20398. this._elementsWithExternalReferences.clear();
  20399. }
  20400. };
  20401. /**
  20402. * @private
  20403. * @return {?}
  20404. */
  20405. MatIcon.prototype._usingFontIcon = /**
  20406. * @private
  20407. * @return {?}
  20408. */
  20409. function () {
  20410. return !this.svgIcon;
  20411. };
  20412. /**
  20413. * @private
  20414. * @param {?} svg
  20415. * @return {?}
  20416. */
  20417. MatIcon.prototype._setSvgElement = /**
  20418. * @private
  20419. * @param {?} svg
  20420. * @return {?}
  20421. */
  20422. function (svg) {
  20423. this._clearSvgElement();
  20424. // Workaround for IE11 and Edge ignoring `style` tags inside dynamically-created SVGs.
  20425. // See: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/10898469/
  20426. // Do this before inserting the element into the DOM, in order to avoid a style recalculation.
  20427. /** @type {?} */
  20428. var styleTags = (/** @type {?} */ (svg.querySelectorAll('style')));
  20429. for (var i = 0; i < styleTags.length; i++) {
  20430. styleTags[i].textContent += ' ';
  20431. }
  20432. // Note: we do this fix here, rather than the icon registry, because the
  20433. // references have to point to the URL at the time that the icon was created.
  20434. if (this._location) {
  20435. /** @type {?} */
  20436. var path = this._location.getPathname();
  20437. this._previousPath = path;
  20438. this._cacheChildrenWithExternalReferences(svg);
  20439. this._prependPathToReferences(path);
  20440. }
  20441. this._elementRef.nativeElement.appendChild(svg);
  20442. };
  20443. /**
  20444. * @private
  20445. * @return {?}
  20446. */
  20447. MatIcon.prototype._clearSvgElement = /**
  20448. * @private
  20449. * @return {?}
  20450. */
  20451. function () {
  20452. /** @type {?} */
  20453. var layoutElement = this._elementRef.nativeElement;
  20454. /** @type {?} */
  20455. var childCount = layoutElement.childNodes.length;
  20456. if (this._elementsWithExternalReferences) {
  20457. this._elementsWithExternalReferences.clear();
  20458. }
  20459. // Remove existing non-element child nodes and SVGs, and add the new SVG element. Note that
  20460. // we can't use innerHTML, because IE will throw if the element has a data binding.
  20461. while (childCount--) {
  20462. /** @type {?} */
  20463. var child = layoutElement.childNodes[childCount];
  20464. // 1 corresponds to Node.ELEMENT_NODE. We remove all non-element nodes in order to get rid
  20465. // of any loose text nodes, as well as any SVG elements in order to remove any old icons.
  20466. if (child.nodeType !== 1 || child.nodeName.toLowerCase() === 'svg') {
  20467. layoutElement.removeChild(child);
  20468. }
  20469. }
  20470. };
  20471. /**
  20472. * @private
  20473. * @return {?}
  20474. */
  20475. MatIcon.prototype._updateFontIconClasses = /**
  20476. * @private
  20477. * @return {?}
  20478. */
  20479. function () {
  20480. if (!this._usingFontIcon()) {
  20481. return;
  20482. }
  20483. /** @type {?} */
  20484. var elem = this._elementRef.nativeElement;
  20485. /** @type {?} */
  20486. var fontSetClass = this.fontSet ?
  20487. this._iconRegistry.classNameForFontAlias(this.fontSet) :
  20488. this._iconRegistry.getDefaultFontSetClass();
  20489. if (fontSetClass != this._previousFontSetClass) {
  20490. if (this._previousFontSetClass) {
  20491. elem.classList.remove(this._previousFontSetClass);
  20492. }
  20493. if (fontSetClass) {
  20494. elem.classList.add(fontSetClass);
  20495. }
  20496. this._previousFontSetClass = fontSetClass;
  20497. }
  20498. if (this.fontIcon != this._previousFontIconClass) {
  20499. if (this._previousFontIconClass) {
  20500. elem.classList.remove(this._previousFontIconClass);
  20501. }
  20502. if (this.fontIcon) {
  20503. elem.classList.add(this.fontIcon);
  20504. }
  20505. this._previousFontIconClass = this.fontIcon;
  20506. }
  20507. };
  20508. /**
  20509. * Cleans up a value to be used as a fontIcon or fontSet.
  20510. * Since the value ends up being assigned as a CSS class, we
  20511. * have to trim the value and omit space-separated values.
  20512. */
  20513. /**
  20514. * Cleans up a value to be used as a fontIcon or fontSet.
  20515. * Since the value ends up being assigned as a CSS class, we
  20516. * have to trim the value and omit space-separated values.
  20517. * @private
  20518. * @param {?} value
  20519. * @return {?}
  20520. */
  20521. MatIcon.prototype._cleanupFontValue = /**
  20522. * Cleans up a value to be used as a fontIcon or fontSet.
  20523. * Since the value ends up being assigned as a CSS class, we
  20524. * have to trim the value and omit space-separated values.
  20525. * @private
  20526. * @param {?} value
  20527. * @return {?}
  20528. */
  20529. function (value) {
  20530. return typeof value === 'string' ? value.trim().split(' ')[0] : value;
  20531. };
  20532. /**
  20533. * Prepends the current path to all elements that have an attribute pointing to a `FuncIRI`
  20534. * reference. This is required because WebKit browsers require references to be prefixed with
  20535. * the current path, if the page has a `base` tag.
  20536. */
  20537. /**
  20538. * Prepends the current path to all elements that have an attribute pointing to a `FuncIRI`
  20539. * reference. This is required because WebKit browsers require references to be prefixed with
  20540. * the current path, if the page has a `base` tag.
  20541. * @private
  20542. * @param {?} path
  20543. * @return {?}
  20544. */
  20545. MatIcon.prototype._prependPathToReferences = /**
  20546. * Prepends the current path to all elements that have an attribute pointing to a `FuncIRI`
  20547. * reference. This is required because WebKit browsers require references to be prefixed with
  20548. * the current path, if the page has a `base` tag.
  20549. * @private
  20550. * @param {?} path
  20551. * @return {?}
  20552. */
  20553. function (path) {
  20554. /** @type {?} */
  20555. var elements = this._elementsWithExternalReferences;
  20556. if (elements) {
  20557. elements.forEach((/**
  20558. * @param {?} attrs
  20559. * @param {?} element
  20560. * @return {?}
  20561. */
  20562. function (attrs, element) {
  20563. attrs.forEach((/**
  20564. * @param {?} attr
  20565. * @return {?}
  20566. */
  20567. function (attr) {
  20568. element.setAttribute(attr.name, "url('" + path + "#" + attr.value + "')");
  20569. }));
  20570. }));
  20571. }
  20572. };
  20573. /**
  20574. * Caches the children of an SVG element that have `url()`
  20575. * references that we need to prefix with the current path.
  20576. */
  20577. /**
  20578. * Caches the children of an SVG element that have `url()`
  20579. * references that we need to prefix with the current path.
  20580. * @private
  20581. * @param {?} element
  20582. * @return {?}
  20583. */
  20584. MatIcon.prototype._cacheChildrenWithExternalReferences = /**
  20585. * Caches the children of an SVG element that have `url()`
  20586. * references that we need to prefix with the current path.
  20587. * @private
  20588. * @param {?} element
  20589. * @return {?}
  20590. */
  20591. function (element) {
  20592. /** @type {?} */
  20593. var elementsWithFuncIri = element.querySelectorAll(funcIriAttributeSelector);
  20594. /** @type {?} */
  20595. var elements = this._elementsWithExternalReferences =
  20596. this._elementsWithExternalReferences || new Map();
  20597. var _loop_1 = function (i) {
  20598. funcIriAttributes.forEach((/**
  20599. * @param {?} attr
  20600. * @return {?}
  20601. */
  20602. function (attr) {
  20603. /** @type {?} */
  20604. var elementWithReference = elementsWithFuncIri[i];
  20605. /** @type {?} */
  20606. var value = elementWithReference.getAttribute(attr);
  20607. /** @type {?} */
  20608. var match = value ? value.match(funcIriPattern) : null;
  20609. if (match) {
  20610. /** @type {?} */
  20611. var attributes = elements.get(elementWithReference);
  20612. if (!attributes) {
  20613. attributes = [];
  20614. elements.set(elementWithReference, attributes);
  20615. }
  20616. (/** @type {?} */ (attributes)).push({ name: attr, value: match[1] });
  20617. }
  20618. }));
  20619. };
  20620. for (var i = 0; i < elementsWithFuncIri.length; i++) {
  20621. _loop_1(i);
  20622. }
  20623. };
  20624. MatIcon.decorators = [
  20625. { type: core.Component, args: [{template: '<ng-content></ng-content>',
  20626. selector: 'mat-icon',
  20627. exportAs: 'matIcon',
  20628. styles: [".mat-icon{background-repeat:no-repeat;display:inline-block;fill:currentColor;height:24px;width:24px}.mat-icon.mat-icon-inline{font-size:inherit;height:inherit;line-height:inherit;width:inherit}[dir=rtl] .mat-icon-rtl-mirror{transform:scale(-1,1)}.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-prefix .mat-icon,.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-suffix .mat-icon{display:block}.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-prefix .mat-icon-button .mat-icon,.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-suffix .mat-icon-button .mat-icon{margin:auto}"],
  20629. inputs: ['color'],
  20630. host: {
  20631. 'role': 'img',
  20632. 'class': 'mat-icon notranslate',
  20633. '[class.mat-icon-inline]': 'inline',
  20634. '[class.mat-icon-no-color]': 'color !== "primary" && color !== "accent" && color !== "warn"',
  20635. },
  20636. encapsulation: core.ViewEncapsulation.None,
  20637. changeDetection: core.ChangeDetectionStrategy.OnPush,
  20638. },] },
  20639. ];
  20640. /** @nocollapse */
  20641. MatIcon.ctorParameters = function () { return [
  20642. { type: core.ElementRef },
  20643. { type: MatIconRegistry },
  20644. { type: String, decorators: [{ type: core.Attribute, args: ['aria-hidden',] }] },
  20645. { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_ICON_LOCATION,] }] }
  20646. ]; };
  20647. MatIcon.propDecorators = {
  20648. inline: [{ type: core.Input }],
  20649. svgIcon: [{ type: core.Input }],
  20650. fontSet: [{ type: core.Input }],
  20651. fontIcon: [{ type: core.Input }]
  20652. };
  20653. return MatIcon;
  20654. }(_MatIconMixinBase));
  20655. /**
  20656. * @fileoverview added by tsickle
  20657. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  20658. */
  20659. var MatIconModule = /** @class */ (function () {
  20660. function MatIconModule() {
  20661. }
  20662. MatIconModule.decorators = [
  20663. { type: core.NgModule, args: [{
  20664. imports: [MatCommonModule],
  20665. exports: [MatIcon, MatCommonModule],
  20666. declarations: [MatIcon],
  20667. },] },
  20668. ];
  20669. return MatIconModule;
  20670. }());
  20671. /**
  20672. * @fileoverview added by tsickle
  20673. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  20674. */
  20675. // Boilerplate for applying mixins to MatList.
  20676. /**
  20677. * \@docs-private
  20678. */
  20679. var
  20680. // Boilerplate for applying mixins to MatList.
  20681. /**
  20682. * \@docs-private
  20683. */
  20684. MatListBase = /** @class */ (function () {
  20685. function MatListBase() {
  20686. }
  20687. return MatListBase;
  20688. }());
  20689. /** @type {?} */
  20690. var _MatListMixinBase = mixinDisableRipple(MatListBase);
  20691. // Boilerplate for applying mixins to MatListItem.
  20692. /**
  20693. * \@docs-private
  20694. */
  20695. var
  20696. // Boilerplate for applying mixins to MatListItem.
  20697. /**
  20698. * \@docs-private
  20699. */
  20700. MatListItemBase = /** @class */ (function () {
  20701. function MatListItemBase() {
  20702. }
  20703. return MatListItemBase;
  20704. }());
  20705. /** @type {?} */
  20706. var _MatListItemMixinBase = mixinDisableRipple(MatListItemBase);
  20707. var MatNavList = /** @class */ (function (_super) {
  20708. __extends(MatNavList, _super);
  20709. function MatNavList() {
  20710. var _this = _super !== null && _super.apply(this, arguments) || this;
  20711. /**
  20712. * Emits when the state of the list changes.
  20713. */
  20714. _this._stateChanges = new rxjs.Subject();
  20715. return _this;
  20716. }
  20717. /**
  20718. * @return {?}
  20719. */
  20720. MatNavList.prototype.ngOnChanges = /**
  20721. * @return {?}
  20722. */
  20723. function () {
  20724. this._stateChanges.next();
  20725. };
  20726. /**
  20727. * @return {?}
  20728. */
  20729. MatNavList.prototype.ngOnDestroy = /**
  20730. * @return {?}
  20731. */
  20732. function () {
  20733. this._stateChanges.complete();
  20734. };
  20735. MatNavList.decorators = [
  20736. { type: core.Component, args: [{selector: 'mat-nav-list',
  20737. exportAs: 'matNavList',
  20738. host: {
  20739. 'role': 'navigation',
  20740. 'class': 'mat-nav-list mat-list-base'
  20741. },
  20742. template: "<ng-content></ng-content>",
  20743. styles: [".mat-subheader{display:flex;box-sizing:border-box;padding:16px;align-items:center}.mat-list-base .mat-subheader{margin:0}.mat-list-base{padding-top:8px;display:block;-webkit-tap-highlight-color:transparent}.mat-list-base .mat-subheader{height:48px;line-height:16px}.mat-list-base .mat-subheader:first-child{margin-top:-8px}.mat-list-base .mat-list-item,.mat-list-base .mat-list-option{display:block;height:48px;-webkit-tap-highlight-color:transparent;width:100%;padding:0}.mat-list-base .mat-list-item .mat-list-item-content,.mat-list-base .mat-list-option .mat-list-item-content{display:flex;flex-direction:row;align-items:center;box-sizing:border-box;padding:0 16px;position:relative;height:inherit}.mat-list-base .mat-list-item .mat-list-item-content-reverse,.mat-list-base .mat-list-option .mat-list-item-content-reverse{display:flex;align-items:center;padding:0 16px;flex-direction:row-reverse;justify-content:space-around}.mat-list-base .mat-list-item .mat-list-item-ripple,.mat-list-base .mat-list-option .mat-list-item-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}.mat-list-base .mat-list-item.mat-list-item-with-avatar,.mat-list-base .mat-list-option.mat-list-item-with-avatar{height:56px}.mat-list-base .mat-list-item.mat-2-line,.mat-list-base .mat-list-option.mat-2-line{height:72px}.mat-list-base .mat-list-item.mat-3-line,.mat-list-base .mat-list-option.mat-3-line{height:88px}.mat-list-base .mat-list-item.mat-multi-line,.mat-list-base .mat-list-option.mat-multi-line{height:auto}.mat-list-base .mat-list-item.mat-multi-line .mat-list-item-content,.mat-list-base .mat-list-option.mat-multi-line .mat-list-item-content{padding-top:16px;padding-bottom:16px}.mat-list-base .mat-list-item .mat-list-text,.mat-list-base .mat-list-option .mat-list-text{display:flex;flex-direction:column;width:100%;box-sizing:border-box;overflow:hidden;padding:0}.mat-list-base .mat-list-item .mat-list-text>*,.mat-list-base .mat-list-option .mat-list-text>*{margin:0;padding:0;font-weight:400;font-size:inherit}.mat-list-base .mat-list-item .mat-list-text:empty,.mat-list-base .mat-list-option .mat-list-text:empty{display:none}.mat-list-base .mat-list-item.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,.mat-list-base .mat-list-item.mat-list-option .mat-list-item-content .mat-list-text,.mat-list-base .mat-list-option.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,.mat-list-base .mat-list-option.mat-list-option .mat-list-item-content .mat-list-text{padding-right:0;padding-left:16px}[dir=rtl] .mat-list-base .mat-list-item.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,[dir=rtl] .mat-list-base .mat-list-item.mat-list-option .mat-list-item-content .mat-list-text,[dir=rtl] .mat-list-base .mat-list-option.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,[dir=rtl] .mat-list-base .mat-list-option.mat-list-option .mat-list-item-content .mat-list-text{padding-right:16px;padding-left:0}.mat-list-base .mat-list-item.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,.mat-list-base .mat-list-item.mat-list-option .mat-list-item-content-reverse .mat-list-text,.mat-list-base .mat-list-option.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,.mat-list-base .mat-list-option.mat-list-option .mat-list-item-content-reverse .mat-list-text{padding-left:0;padding-right:16px}[dir=rtl] .mat-list-base .mat-list-item.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,[dir=rtl] .mat-list-base .mat-list-item.mat-list-option .mat-list-item-content-reverse .mat-list-text,[dir=rtl] .mat-list-base .mat-list-option.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,[dir=rtl] .mat-list-base .mat-list-option.mat-list-option .mat-list-item-content-reverse .mat-list-text{padding-right:0;padding-left:16px}.mat-list-base .mat-list-item.mat-list-item-with-avatar.mat-list-option .mat-list-item-content .mat-list-text,.mat-list-base .mat-list-item.mat-list-item-with-avatar.mat-list-option .mat-list-item-content-reverse .mat-list-text,.mat-list-base .mat-list-option.mat-list-item-with-avatar.mat-list-option .mat-list-item-content .mat-list-text,.mat-list-base .mat-list-option.mat-list-item-with-avatar.mat-list-option .mat-list-item-content-reverse .mat-list-text{padding-right:16px;padding-left:16px}.mat-list-base .mat-list-item .mat-list-avatar,.mat-list-base .mat-list-option .mat-list-avatar{flex-shrink:0;width:40px;height:40px;border-radius:50%;object-fit:cover}.mat-list-base .mat-list-item .mat-list-avatar~.mat-divider-inset,.mat-list-base .mat-list-option .mat-list-avatar~.mat-divider-inset{margin-left:72px;width:calc(100% - 72px)}[dir=rtl] .mat-list-base .mat-list-item .mat-list-avatar~.mat-divider-inset,[dir=rtl] .mat-list-base .mat-list-option .mat-list-avatar~.mat-divider-inset{margin-left:auto;margin-right:72px}.mat-list-base .mat-list-item .mat-list-icon,.mat-list-base .mat-list-option .mat-list-icon{flex-shrink:0;width:24px;height:24px;font-size:24px;box-sizing:content-box;border-radius:50%;padding:4px}.mat-list-base .mat-list-item .mat-list-icon~.mat-divider-inset,.mat-list-base .mat-list-option .mat-list-icon~.mat-divider-inset{margin-left:64px;width:calc(100% - 64px)}[dir=rtl] .mat-list-base .mat-list-item .mat-list-icon~.mat-divider-inset,[dir=rtl] .mat-list-base .mat-list-option .mat-list-icon~.mat-divider-inset{margin-left:auto;margin-right:64px}.mat-list-base .mat-list-item .mat-divider,.mat-list-base .mat-list-option .mat-divider{position:absolute;bottom:0;left:0;width:100%;margin:0}[dir=rtl] .mat-list-base .mat-list-item .mat-divider,[dir=rtl] .mat-list-base .mat-list-option .mat-divider{margin-left:auto;margin-right:0}.mat-list-base .mat-list-item .mat-divider.mat-divider-inset,.mat-list-base .mat-list-option .mat-divider.mat-divider-inset{position:absolute}.mat-list-base[dense]{padding-top:4px;display:block}.mat-list-base[dense] .mat-subheader{height:40px;line-height:8px}.mat-list-base[dense] .mat-subheader:first-child{margin-top:-4px}.mat-list-base[dense] .mat-list-item,.mat-list-base[dense] .mat-list-option{display:block;height:40px;-webkit-tap-highlight-color:transparent;width:100%;padding:0}.mat-list-base[dense] .mat-list-item .mat-list-item-content,.mat-list-base[dense] .mat-list-option .mat-list-item-content{display:flex;flex-direction:row;align-items:center;box-sizing:border-box;padding:0 16px;position:relative;height:inherit}.mat-list-base[dense] .mat-list-item .mat-list-item-content-reverse,.mat-list-base[dense] .mat-list-option .mat-list-item-content-reverse{display:flex;align-items:center;padding:0 16px;flex-direction:row-reverse;justify-content:space-around}.mat-list-base[dense] .mat-list-item .mat-list-item-ripple,.mat-list-base[dense] .mat-list-option .mat-list-item-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}.mat-list-base[dense] .mat-list-item.mat-list-item-with-avatar,.mat-list-base[dense] .mat-list-option.mat-list-item-with-avatar{height:48px}.mat-list-base[dense] .mat-list-item.mat-2-line,.mat-list-base[dense] .mat-list-option.mat-2-line{height:60px}.mat-list-base[dense] .mat-list-item.mat-3-line,.mat-list-base[dense] .mat-list-option.mat-3-line{height:76px}.mat-list-base[dense] .mat-list-item.mat-multi-line,.mat-list-base[dense] .mat-list-option.mat-multi-line{height:auto}.mat-list-base[dense] .mat-list-item.mat-multi-line .mat-list-item-content,.mat-list-base[dense] .mat-list-option.mat-multi-line .mat-list-item-content{padding-top:16px;padding-bottom:16px}.mat-list-base[dense] .mat-list-item .mat-list-text,.mat-list-base[dense] .mat-list-option .mat-list-text{display:flex;flex-direction:column;width:100%;box-sizing:border-box;overflow:hidden;padding:0}.mat-list-base[dense] .mat-list-item .mat-list-text>*,.mat-list-base[dense] .mat-list-option .mat-list-text>*{margin:0;padding:0;font-weight:400;font-size:inherit}.mat-list-base[dense] .mat-list-item .mat-list-text:empty,.mat-list-base[dense] .mat-list-option .mat-list-text:empty{display:none}.mat-list-base[dense] .mat-list-item.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,.mat-list-base[dense] .mat-list-item.mat-list-option .mat-list-item-content .mat-list-text,.mat-list-base[dense] .mat-list-option.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,.mat-list-base[dense] .mat-list-option.mat-list-option .mat-list-item-content .mat-list-text{padding-right:0;padding-left:16px}[dir=rtl] .mat-list-base[dense] .mat-list-item.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,[dir=rtl] .mat-list-base[dense] .mat-list-item.mat-list-option .mat-list-item-content .mat-list-text,[dir=rtl] .mat-list-base[dense] .mat-list-option.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,[dir=rtl] .mat-list-base[dense] .mat-list-option.mat-list-option .mat-list-item-content .mat-list-text{padding-right:16px;padding-left:0}.mat-list-base[dense] .mat-list-item.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,.mat-list-base[dense] .mat-list-item.mat-list-option .mat-list-item-content-reverse .mat-list-text,.mat-list-base[dense] .mat-list-option.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,.mat-list-base[dense] .mat-list-option.mat-list-option .mat-list-item-content-reverse .mat-list-text{padding-left:0;padding-right:16px}[dir=rtl] .mat-list-base[dense] .mat-list-item.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,[dir=rtl] .mat-list-base[dense] .mat-list-item.mat-list-option .mat-list-item-content-reverse .mat-list-text,[dir=rtl] .mat-list-base[dense] .mat-list-option.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,[dir=rtl] .mat-list-base[dense] .mat-list-option.mat-list-option .mat-list-item-content-reverse .mat-list-text{padding-right:0;padding-left:16px}.mat-list-base[dense] .mat-list-item.mat-list-item-with-avatar.mat-list-option .mat-list-item-content .mat-list-text,.mat-list-base[dense] .mat-list-item.mat-list-item-with-avatar.mat-list-option .mat-list-item-content-reverse .mat-list-text,.mat-list-base[dense] .mat-list-option.mat-list-item-with-avatar.mat-list-option .mat-list-item-content .mat-list-text,.mat-list-base[dense] .mat-list-option.mat-list-item-with-avatar.mat-list-option .mat-list-item-content-reverse .mat-list-text{padding-right:16px;padding-left:16px}.mat-list-base[dense] .mat-list-item .mat-list-avatar,.mat-list-base[dense] .mat-list-option .mat-list-avatar{flex-shrink:0;width:36px;height:36px;border-radius:50%;object-fit:cover}.mat-list-base[dense] .mat-list-item .mat-list-avatar~.mat-divider-inset,.mat-list-base[dense] .mat-list-option .mat-list-avatar~.mat-divider-inset{margin-left:68px;width:calc(100% - 68px)}[dir=rtl] .mat-list-base[dense] .mat-list-item .mat-list-avatar~.mat-divider-inset,[dir=rtl] .mat-list-base[dense] .mat-list-option .mat-list-avatar~.mat-divider-inset{margin-left:auto;margin-right:68px}.mat-list-base[dense] .mat-list-item .mat-list-icon,.mat-list-base[dense] .mat-list-option .mat-list-icon{flex-shrink:0;width:20px;height:20px;font-size:20px;box-sizing:content-box;border-radius:50%;padding:4px}.mat-list-base[dense] .mat-list-item .mat-list-icon~.mat-divider-inset,.mat-list-base[dense] .mat-list-option .mat-list-icon~.mat-divider-inset{margin-left:60px;width:calc(100% - 60px)}[dir=rtl] .mat-list-base[dense] .mat-list-item .mat-list-icon~.mat-divider-inset,[dir=rtl] .mat-list-base[dense] .mat-list-option .mat-list-icon~.mat-divider-inset{margin-left:auto;margin-right:60px}.mat-list-base[dense] .mat-list-item .mat-divider,.mat-list-base[dense] .mat-list-option .mat-divider{position:absolute;bottom:0;left:0;width:100%;margin:0}[dir=rtl] .mat-list-base[dense] .mat-list-item .mat-divider,[dir=rtl] .mat-list-base[dense] .mat-list-option .mat-divider{margin-left:auto;margin-right:0}.mat-list-base[dense] .mat-list-item .mat-divider.mat-divider-inset,.mat-list-base[dense] .mat-list-option .mat-divider.mat-divider-inset{position:absolute}.mat-nav-list a{text-decoration:none;color:inherit}.mat-nav-list .mat-list-item{cursor:pointer;outline:0}mat-action-list button{background:0 0;color:inherit;border:none;font:inherit;outline:inherit;-webkit-tap-highlight-color:transparent;text-align:left}[dir=rtl] mat-action-list button{text-align:right}mat-action-list button::-moz-focus-inner{border:0}mat-action-list .mat-list-item{cursor:pointer;outline:inherit}.mat-list-option:not(.mat-list-item-disabled){cursor:pointer;outline:0}@media (-ms-high-contrast:active){.mat-selection-list:focus{outline-style:dotted}.mat-list-option:focus,.mat-list-option:hover,.mat-nav-list .mat-list-item:focus,.mat-nav-list .mat-list-item:hover,mat-action-list .mat-list-item:focus,mat-action-list .mat-list-item:hover{outline:dotted 1px}}@media (hover:none){.mat-action-list .mat-list-item:not(.mat-list-item-disabled):hover,.mat-list-option:not(.mat-list-item-disabled):hover,.mat-nav-list .mat-list-item:not(.mat-list-item-disabled):hover{background:0 0}}"],
  20744. inputs: ['disableRipple'],
  20745. encapsulation: core.ViewEncapsulation.None,
  20746. changeDetection: core.ChangeDetectionStrategy.OnPush,
  20747. },] },
  20748. ];
  20749. return MatNavList;
  20750. }(_MatListMixinBase));
  20751. var MatList = /** @class */ (function (_super) {
  20752. __extends(MatList, _super);
  20753. function MatList(_elementRef) {
  20754. var _this = _super.call(this) || this;
  20755. _this._elementRef = _elementRef;
  20756. /**
  20757. * Emits when the state of the list changes.
  20758. */
  20759. _this._stateChanges = new rxjs.Subject();
  20760. if (_this._getListType() === 'action-list') {
  20761. _elementRef.nativeElement.classList.add('mat-action-list');
  20762. }
  20763. return _this;
  20764. }
  20765. /**
  20766. * @return {?}
  20767. */
  20768. MatList.prototype._getListType = /**
  20769. * @return {?}
  20770. */
  20771. function () {
  20772. /** @type {?} */
  20773. var nodeName = this._elementRef.nativeElement.nodeName.toLowerCase();
  20774. if (nodeName === 'mat-list') {
  20775. return 'list';
  20776. }
  20777. if (nodeName === 'mat-action-list') {
  20778. return 'action-list';
  20779. }
  20780. return null;
  20781. };
  20782. /**
  20783. * @return {?}
  20784. */
  20785. MatList.prototype.ngOnChanges = /**
  20786. * @return {?}
  20787. */
  20788. function () {
  20789. this._stateChanges.next();
  20790. };
  20791. /**
  20792. * @return {?}
  20793. */
  20794. MatList.prototype.ngOnDestroy = /**
  20795. * @return {?}
  20796. */
  20797. function () {
  20798. this._stateChanges.complete();
  20799. };
  20800. MatList.decorators = [
  20801. { type: core.Component, args: [{selector: 'mat-list, mat-action-list',
  20802. exportAs: 'matList',
  20803. template: "<ng-content></ng-content>",
  20804. host: {
  20805. 'class': 'mat-list mat-list-base'
  20806. },
  20807. styles: [".mat-subheader{display:flex;box-sizing:border-box;padding:16px;align-items:center}.mat-list-base .mat-subheader{margin:0}.mat-list-base{padding-top:8px;display:block;-webkit-tap-highlight-color:transparent}.mat-list-base .mat-subheader{height:48px;line-height:16px}.mat-list-base .mat-subheader:first-child{margin-top:-8px}.mat-list-base .mat-list-item,.mat-list-base .mat-list-option{display:block;height:48px;-webkit-tap-highlight-color:transparent;width:100%;padding:0}.mat-list-base .mat-list-item .mat-list-item-content,.mat-list-base .mat-list-option .mat-list-item-content{display:flex;flex-direction:row;align-items:center;box-sizing:border-box;padding:0 16px;position:relative;height:inherit}.mat-list-base .mat-list-item .mat-list-item-content-reverse,.mat-list-base .mat-list-option .mat-list-item-content-reverse{display:flex;align-items:center;padding:0 16px;flex-direction:row-reverse;justify-content:space-around}.mat-list-base .mat-list-item .mat-list-item-ripple,.mat-list-base .mat-list-option .mat-list-item-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}.mat-list-base .mat-list-item.mat-list-item-with-avatar,.mat-list-base .mat-list-option.mat-list-item-with-avatar{height:56px}.mat-list-base .mat-list-item.mat-2-line,.mat-list-base .mat-list-option.mat-2-line{height:72px}.mat-list-base .mat-list-item.mat-3-line,.mat-list-base .mat-list-option.mat-3-line{height:88px}.mat-list-base .mat-list-item.mat-multi-line,.mat-list-base .mat-list-option.mat-multi-line{height:auto}.mat-list-base .mat-list-item.mat-multi-line .mat-list-item-content,.mat-list-base .mat-list-option.mat-multi-line .mat-list-item-content{padding-top:16px;padding-bottom:16px}.mat-list-base .mat-list-item .mat-list-text,.mat-list-base .mat-list-option .mat-list-text{display:flex;flex-direction:column;width:100%;box-sizing:border-box;overflow:hidden;padding:0}.mat-list-base .mat-list-item .mat-list-text>*,.mat-list-base .mat-list-option .mat-list-text>*{margin:0;padding:0;font-weight:400;font-size:inherit}.mat-list-base .mat-list-item .mat-list-text:empty,.mat-list-base .mat-list-option .mat-list-text:empty{display:none}.mat-list-base .mat-list-item.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,.mat-list-base .mat-list-item.mat-list-option .mat-list-item-content .mat-list-text,.mat-list-base .mat-list-option.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,.mat-list-base .mat-list-option.mat-list-option .mat-list-item-content .mat-list-text{padding-right:0;padding-left:16px}[dir=rtl] .mat-list-base .mat-list-item.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,[dir=rtl] .mat-list-base .mat-list-item.mat-list-option .mat-list-item-content .mat-list-text,[dir=rtl] .mat-list-base .mat-list-option.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,[dir=rtl] .mat-list-base .mat-list-option.mat-list-option .mat-list-item-content .mat-list-text{padding-right:16px;padding-left:0}.mat-list-base .mat-list-item.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,.mat-list-base .mat-list-item.mat-list-option .mat-list-item-content-reverse .mat-list-text,.mat-list-base .mat-list-option.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,.mat-list-base .mat-list-option.mat-list-option .mat-list-item-content-reverse .mat-list-text{padding-left:0;padding-right:16px}[dir=rtl] .mat-list-base .mat-list-item.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,[dir=rtl] .mat-list-base .mat-list-item.mat-list-option .mat-list-item-content-reverse .mat-list-text,[dir=rtl] .mat-list-base .mat-list-option.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,[dir=rtl] .mat-list-base .mat-list-option.mat-list-option .mat-list-item-content-reverse .mat-list-text{padding-right:0;padding-left:16px}.mat-list-base .mat-list-item.mat-list-item-with-avatar.mat-list-option .mat-list-item-content .mat-list-text,.mat-list-base .mat-list-item.mat-list-item-with-avatar.mat-list-option .mat-list-item-content-reverse .mat-list-text,.mat-list-base .mat-list-option.mat-list-item-with-avatar.mat-list-option .mat-list-item-content .mat-list-text,.mat-list-base .mat-list-option.mat-list-item-with-avatar.mat-list-option .mat-list-item-content-reverse .mat-list-text{padding-right:16px;padding-left:16px}.mat-list-base .mat-list-item .mat-list-avatar,.mat-list-base .mat-list-option .mat-list-avatar{flex-shrink:0;width:40px;height:40px;border-radius:50%;object-fit:cover}.mat-list-base .mat-list-item .mat-list-avatar~.mat-divider-inset,.mat-list-base .mat-list-option .mat-list-avatar~.mat-divider-inset{margin-left:72px;width:calc(100% - 72px)}[dir=rtl] .mat-list-base .mat-list-item .mat-list-avatar~.mat-divider-inset,[dir=rtl] .mat-list-base .mat-list-option .mat-list-avatar~.mat-divider-inset{margin-left:auto;margin-right:72px}.mat-list-base .mat-list-item .mat-list-icon,.mat-list-base .mat-list-option .mat-list-icon{flex-shrink:0;width:24px;height:24px;font-size:24px;box-sizing:content-box;border-radius:50%;padding:4px}.mat-list-base .mat-list-item .mat-list-icon~.mat-divider-inset,.mat-list-base .mat-list-option .mat-list-icon~.mat-divider-inset{margin-left:64px;width:calc(100% - 64px)}[dir=rtl] .mat-list-base .mat-list-item .mat-list-icon~.mat-divider-inset,[dir=rtl] .mat-list-base .mat-list-option .mat-list-icon~.mat-divider-inset{margin-left:auto;margin-right:64px}.mat-list-base .mat-list-item .mat-divider,.mat-list-base .mat-list-option .mat-divider{position:absolute;bottom:0;left:0;width:100%;margin:0}[dir=rtl] .mat-list-base .mat-list-item .mat-divider,[dir=rtl] .mat-list-base .mat-list-option .mat-divider{margin-left:auto;margin-right:0}.mat-list-base .mat-list-item .mat-divider.mat-divider-inset,.mat-list-base .mat-list-option .mat-divider.mat-divider-inset{position:absolute}.mat-list-base[dense]{padding-top:4px;display:block}.mat-list-base[dense] .mat-subheader{height:40px;line-height:8px}.mat-list-base[dense] .mat-subheader:first-child{margin-top:-4px}.mat-list-base[dense] .mat-list-item,.mat-list-base[dense] .mat-list-option{display:block;height:40px;-webkit-tap-highlight-color:transparent;width:100%;padding:0}.mat-list-base[dense] .mat-list-item .mat-list-item-content,.mat-list-base[dense] .mat-list-option .mat-list-item-content{display:flex;flex-direction:row;align-items:center;box-sizing:border-box;padding:0 16px;position:relative;height:inherit}.mat-list-base[dense] .mat-list-item .mat-list-item-content-reverse,.mat-list-base[dense] .mat-list-option .mat-list-item-content-reverse{display:flex;align-items:center;padding:0 16px;flex-direction:row-reverse;justify-content:space-around}.mat-list-base[dense] .mat-list-item .mat-list-item-ripple,.mat-list-base[dense] .mat-list-option .mat-list-item-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}.mat-list-base[dense] .mat-list-item.mat-list-item-with-avatar,.mat-list-base[dense] .mat-list-option.mat-list-item-with-avatar{height:48px}.mat-list-base[dense] .mat-list-item.mat-2-line,.mat-list-base[dense] .mat-list-option.mat-2-line{height:60px}.mat-list-base[dense] .mat-list-item.mat-3-line,.mat-list-base[dense] .mat-list-option.mat-3-line{height:76px}.mat-list-base[dense] .mat-list-item.mat-multi-line,.mat-list-base[dense] .mat-list-option.mat-multi-line{height:auto}.mat-list-base[dense] .mat-list-item.mat-multi-line .mat-list-item-content,.mat-list-base[dense] .mat-list-option.mat-multi-line .mat-list-item-content{padding-top:16px;padding-bottom:16px}.mat-list-base[dense] .mat-list-item .mat-list-text,.mat-list-base[dense] .mat-list-option .mat-list-text{display:flex;flex-direction:column;width:100%;box-sizing:border-box;overflow:hidden;padding:0}.mat-list-base[dense] .mat-list-item .mat-list-text>*,.mat-list-base[dense] .mat-list-option .mat-list-text>*{margin:0;padding:0;font-weight:400;font-size:inherit}.mat-list-base[dense] .mat-list-item .mat-list-text:empty,.mat-list-base[dense] .mat-list-option .mat-list-text:empty{display:none}.mat-list-base[dense] .mat-list-item.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,.mat-list-base[dense] .mat-list-item.mat-list-option .mat-list-item-content .mat-list-text,.mat-list-base[dense] .mat-list-option.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,.mat-list-base[dense] .mat-list-option.mat-list-option .mat-list-item-content .mat-list-text{padding-right:0;padding-left:16px}[dir=rtl] .mat-list-base[dense] .mat-list-item.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,[dir=rtl] .mat-list-base[dense] .mat-list-item.mat-list-option .mat-list-item-content .mat-list-text,[dir=rtl] .mat-list-base[dense] .mat-list-option.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,[dir=rtl] .mat-list-base[dense] .mat-list-option.mat-list-option .mat-list-item-content .mat-list-text{padding-right:16px;padding-left:0}.mat-list-base[dense] .mat-list-item.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,.mat-list-base[dense] .mat-list-item.mat-list-option .mat-list-item-content-reverse .mat-list-text,.mat-list-base[dense] .mat-list-option.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,.mat-list-base[dense] .mat-list-option.mat-list-option .mat-list-item-content-reverse .mat-list-text{padding-left:0;padding-right:16px}[dir=rtl] .mat-list-base[dense] .mat-list-item.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,[dir=rtl] .mat-list-base[dense] .mat-list-item.mat-list-option .mat-list-item-content-reverse .mat-list-text,[dir=rtl] .mat-list-base[dense] .mat-list-option.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,[dir=rtl] .mat-list-base[dense] .mat-list-option.mat-list-option .mat-list-item-content-reverse .mat-list-text{padding-right:0;padding-left:16px}.mat-list-base[dense] .mat-list-item.mat-list-item-with-avatar.mat-list-option .mat-list-item-content .mat-list-text,.mat-list-base[dense] .mat-list-item.mat-list-item-with-avatar.mat-list-option .mat-list-item-content-reverse .mat-list-text,.mat-list-base[dense] .mat-list-option.mat-list-item-with-avatar.mat-list-option .mat-list-item-content .mat-list-text,.mat-list-base[dense] .mat-list-option.mat-list-item-with-avatar.mat-list-option .mat-list-item-content-reverse .mat-list-text{padding-right:16px;padding-left:16px}.mat-list-base[dense] .mat-list-item .mat-list-avatar,.mat-list-base[dense] .mat-list-option .mat-list-avatar{flex-shrink:0;width:36px;height:36px;border-radius:50%;object-fit:cover}.mat-list-base[dense] .mat-list-item .mat-list-avatar~.mat-divider-inset,.mat-list-base[dense] .mat-list-option .mat-list-avatar~.mat-divider-inset{margin-left:68px;width:calc(100% - 68px)}[dir=rtl] .mat-list-base[dense] .mat-list-item .mat-list-avatar~.mat-divider-inset,[dir=rtl] .mat-list-base[dense] .mat-list-option .mat-list-avatar~.mat-divider-inset{margin-left:auto;margin-right:68px}.mat-list-base[dense] .mat-list-item .mat-list-icon,.mat-list-base[dense] .mat-list-option .mat-list-icon{flex-shrink:0;width:20px;height:20px;font-size:20px;box-sizing:content-box;border-radius:50%;padding:4px}.mat-list-base[dense] .mat-list-item .mat-list-icon~.mat-divider-inset,.mat-list-base[dense] .mat-list-option .mat-list-icon~.mat-divider-inset{margin-left:60px;width:calc(100% - 60px)}[dir=rtl] .mat-list-base[dense] .mat-list-item .mat-list-icon~.mat-divider-inset,[dir=rtl] .mat-list-base[dense] .mat-list-option .mat-list-icon~.mat-divider-inset{margin-left:auto;margin-right:60px}.mat-list-base[dense] .mat-list-item .mat-divider,.mat-list-base[dense] .mat-list-option .mat-divider{position:absolute;bottom:0;left:0;width:100%;margin:0}[dir=rtl] .mat-list-base[dense] .mat-list-item .mat-divider,[dir=rtl] .mat-list-base[dense] .mat-list-option .mat-divider{margin-left:auto;margin-right:0}.mat-list-base[dense] .mat-list-item .mat-divider.mat-divider-inset,.mat-list-base[dense] .mat-list-option .mat-divider.mat-divider-inset{position:absolute}.mat-nav-list a{text-decoration:none;color:inherit}.mat-nav-list .mat-list-item{cursor:pointer;outline:0}mat-action-list button{background:0 0;color:inherit;border:none;font:inherit;outline:inherit;-webkit-tap-highlight-color:transparent;text-align:left}[dir=rtl] mat-action-list button{text-align:right}mat-action-list button::-moz-focus-inner{border:0}mat-action-list .mat-list-item{cursor:pointer;outline:inherit}.mat-list-option:not(.mat-list-item-disabled){cursor:pointer;outline:0}@media (-ms-high-contrast:active){.mat-selection-list:focus{outline-style:dotted}.mat-list-option:focus,.mat-list-option:hover,.mat-nav-list .mat-list-item:focus,.mat-nav-list .mat-list-item:hover,mat-action-list .mat-list-item:focus,mat-action-list .mat-list-item:hover{outline:dotted 1px}}@media (hover:none){.mat-action-list .mat-list-item:not(.mat-list-item-disabled):hover,.mat-list-option:not(.mat-list-item-disabled):hover,.mat-nav-list .mat-list-item:not(.mat-list-item-disabled):hover{background:0 0}}"],
  20808. inputs: ['disableRipple'],
  20809. encapsulation: core.ViewEncapsulation.None,
  20810. changeDetection: core.ChangeDetectionStrategy.OnPush,
  20811. },] },
  20812. ];
  20813. /** @nocollapse */
  20814. MatList.ctorParameters = function () { return [
  20815. { type: core.ElementRef }
  20816. ]; };
  20817. return MatList;
  20818. }(_MatListMixinBase));
  20819. /**
  20820. * Directive whose purpose is to add the mat- CSS styling to this selector.
  20821. * \@docs-private
  20822. */
  20823. var MatListAvatarCssMatStyler = /** @class */ (function () {
  20824. function MatListAvatarCssMatStyler() {
  20825. }
  20826. MatListAvatarCssMatStyler.decorators = [
  20827. { type: core.Directive, args: [{
  20828. selector: '[mat-list-avatar], [matListAvatar]',
  20829. host: { 'class': 'mat-list-avatar' }
  20830. },] },
  20831. ];
  20832. return MatListAvatarCssMatStyler;
  20833. }());
  20834. /**
  20835. * Directive whose purpose is to add the mat- CSS styling to this selector.
  20836. * \@docs-private
  20837. */
  20838. var MatListIconCssMatStyler = /** @class */ (function () {
  20839. function MatListIconCssMatStyler() {
  20840. }
  20841. MatListIconCssMatStyler.decorators = [
  20842. { type: core.Directive, args: [{
  20843. selector: '[mat-list-icon], [matListIcon]',
  20844. host: { 'class': 'mat-list-icon' }
  20845. },] },
  20846. ];
  20847. return MatListIconCssMatStyler;
  20848. }());
  20849. /**
  20850. * Directive whose purpose is to add the mat- CSS styling to this selector.
  20851. * \@docs-private
  20852. */
  20853. var MatListSubheaderCssMatStyler = /** @class */ (function () {
  20854. function MatListSubheaderCssMatStyler() {
  20855. }
  20856. MatListSubheaderCssMatStyler.decorators = [
  20857. { type: core.Directive, args: [{
  20858. selector: '[mat-subheader], [matSubheader]',
  20859. host: { 'class': 'mat-subheader' }
  20860. },] },
  20861. ];
  20862. return MatListSubheaderCssMatStyler;
  20863. }());
  20864. /**
  20865. * An item within a Material Design list.
  20866. */
  20867. var MatListItem = /** @class */ (function (_super) {
  20868. __extends(MatListItem, _super);
  20869. function MatListItem(_element, _changeDetectorRef, navList, list) {
  20870. var _this = _super.call(this) || this;
  20871. _this._element = _element;
  20872. _this._isInteractiveList = false;
  20873. _this._destroyed = new rxjs.Subject();
  20874. _this._isInteractiveList = !!(navList || (list && list._getListType() === 'action-list'));
  20875. _this._list = navList || list;
  20876. // If no type attributed is specified for <button>, set it to "button".
  20877. // If a type attribute is already specified, do nothing.
  20878. /** @type {?} */
  20879. var element = _this._getHostElement();
  20880. if (element.nodeName.toLowerCase() === 'button' && !element.hasAttribute('type')) {
  20881. element.setAttribute('type', 'button');
  20882. }
  20883. if (_this._list) {
  20884. // React to changes in the state of the parent list since
  20885. // some of the item's properties depend on it (e.g. `disableRipple`).
  20886. _this._list._stateChanges.pipe(operators.takeUntil(_this._destroyed)).subscribe((/**
  20887. * @return {?}
  20888. */
  20889. function () {
  20890. _changeDetectorRef.markForCheck();
  20891. }));
  20892. }
  20893. return _this;
  20894. }
  20895. /**
  20896. * @return {?}
  20897. */
  20898. MatListItem.prototype.ngAfterContentInit = /**
  20899. * @return {?}
  20900. */
  20901. function () {
  20902. setLines(this._lines, this._element);
  20903. };
  20904. /**
  20905. * @return {?}
  20906. */
  20907. MatListItem.prototype.ngOnDestroy = /**
  20908. * @return {?}
  20909. */
  20910. function () {
  20911. this._destroyed.next();
  20912. this._destroyed.complete();
  20913. };
  20914. /** Whether this list item should show a ripple effect when clicked. */
  20915. /**
  20916. * Whether this list item should show a ripple effect when clicked.
  20917. * @return {?}
  20918. */
  20919. MatListItem.prototype._isRippleDisabled = /**
  20920. * Whether this list item should show a ripple effect when clicked.
  20921. * @return {?}
  20922. */
  20923. function () {
  20924. return !this._isInteractiveList || this.disableRipple ||
  20925. !!(this._list && this._list.disableRipple);
  20926. };
  20927. /** Retrieves the DOM element of the component host. */
  20928. /**
  20929. * Retrieves the DOM element of the component host.
  20930. * @return {?}
  20931. */
  20932. MatListItem.prototype._getHostElement = /**
  20933. * Retrieves the DOM element of the component host.
  20934. * @return {?}
  20935. */
  20936. function () {
  20937. return this._element.nativeElement;
  20938. };
  20939. MatListItem.decorators = [
  20940. { type: core.Component, args: [{selector: 'mat-list-item, a[mat-list-item], button[mat-list-item]',
  20941. exportAs: 'matListItem',
  20942. host: {
  20943. 'class': 'mat-list-item',
  20944. // @breaking-change 8.0.0 Remove `mat-list-item-avatar` in favor of `mat-list-item-with-avatar`.
  20945. '[class.mat-list-item-avatar]': '_avatar || _icon',
  20946. '[class.mat-list-item-with-avatar]': '_avatar || _icon',
  20947. },
  20948. inputs: ['disableRipple'],
  20949. template: "<div class=\"mat-list-item-content\"><div class=\"mat-list-item-ripple\" mat-ripple [matRippleTrigger]=\"_getHostElement()\" [matRippleDisabled]=\"_isRippleDisabled()\"></div><ng-content select=\"[mat-list-avatar], [mat-list-icon], [matListAvatar], [matListIcon]\"></ng-content><div class=\"mat-list-text\"><ng-content select=\"[mat-line], [matLine]\"></ng-content></div><ng-content></ng-content></div>",
  20950. encapsulation: core.ViewEncapsulation.None,
  20951. changeDetection: core.ChangeDetectionStrategy.OnPush,
  20952. },] },
  20953. ];
  20954. /** @nocollapse */
  20955. MatListItem.ctorParameters = function () { return [
  20956. { type: core.ElementRef },
  20957. { type: core.ChangeDetectorRef },
  20958. { type: MatNavList, decorators: [{ type: core.Optional }] },
  20959. { type: MatList, decorators: [{ type: core.Optional }] }
  20960. ]; };
  20961. MatListItem.propDecorators = {
  20962. _lines: [{ type: core.ContentChildren, args: [MatLine, { descendants: true },] }],
  20963. _avatar: [{ type: core.ContentChild, args: [MatListAvatarCssMatStyler, { static: false },] }],
  20964. _icon: [{ type: core.ContentChild, args: [MatListIconCssMatStyler, { static: false },] }]
  20965. };
  20966. return MatListItem;
  20967. }(_MatListItemMixinBase));
  20968. /**
  20969. * @fileoverview added by tsickle
  20970. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  20971. */
  20972. /**
  20973. * \@docs-private
  20974. */
  20975. var /**
  20976. * \@docs-private
  20977. */
  20978. MatSelectionListBase = /** @class */ (function () {
  20979. function MatSelectionListBase() {
  20980. }
  20981. return MatSelectionListBase;
  20982. }());
  20983. /** @type {?} */
  20984. var _MatSelectionListMixinBase = mixinDisableRipple(MatSelectionListBase);
  20985. /**
  20986. * \@docs-private
  20987. */
  20988. var /**
  20989. * \@docs-private
  20990. */
  20991. MatListOptionBase = /** @class */ (function () {
  20992. function MatListOptionBase() {
  20993. }
  20994. return MatListOptionBase;
  20995. }());
  20996. /** @type {?} */
  20997. var _MatListOptionMixinBase = mixinDisableRipple(MatListOptionBase);
  20998. /**
  20999. * \@docs-private
  21000. * @type {?}
  21001. */
  21002. var MAT_SELECTION_LIST_VALUE_ACCESSOR = {
  21003. provide: forms.NG_VALUE_ACCESSOR,
  21004. useExisting: core.forwardRef((/**
  21005. * @return {?}
  21006. */
  21007. function () { return MatSelectionList; })),
  21008. multi: true
  21009. };
  21010. /**
  21011. * Change event that is being fired whenever the selected state of an option changes.
  21012. */
  21013. var /**
  21014. * Change event that is being fired whenever the selected state of an option changes.
  21015. */
  21016. MatSelectionListChange = /** @class */ (function () {
  21017. function MatSelectionListChange(source, option) {
  21018. this.source = source;
  21019. this.option = option;
  21020. }
  21021. return MatSelectionListChange;
  21022. }());
  21023. /**
  21024. * Component for list-options of selection-list. Each list-option can automatically
  21025. * generate a checkbox and can put current item into the selectionModel of selection-list
  21026. * if the current item is selected.
  21027. */
  21028. var MatListOption = /** @class */ (function (_super) {
  21029. __extends(MatListOption, _super);
  21030. function MatListOption(_element, _changeDetector, selectionList) {
  21031. var _this = _super.call(this) || this;
  21032. _this._element = _element;
  21033. _this._changeDetector = _changeDetector;
  21034. _this.selectionList = selectionList;
  21035. _this._selected = false;
  21036. _this._disabled = false;
  21037. _this._hasFocus = false;
  21038. /**
  21039. * Whether the label should appear before or after the checkbox. Defaults to 'after'
  21040. */
  21041. _this.checkboxPosition = 'after';
  21042. return _this;
  21043. }
  21044. Object.defineProperty(MatListOption.prototype, "color", {
  21045. /** Theme color of the list option. This sets the color of the checkbox. */
  21046. get: /**
  21047. * Theme color of the list option. This sets the color of the checkbox.
  21048. * @return {?}
  21049. */
  21050. function () { return this._color || this.selectionList.color; },
  21051. set: /**
  21052. * @param {?} newValue
  21053. * @return {?}
  21054. */
  21055. function (newValue) { this._color = newValue; },
  21056. enumerable: true,
  21057. configurable: true
  21058. });
  21059. Object.defineProperty(MatListOption.prototype, "value", {
  21060. /** Value of the option */
  21061. get: /**
  21062. * Value of the option
  21063. * @return {?}
  21064. */
  21065. function () { return this._value; },
  21066. set: /**
  21067. * @param {?} newValue
  21068. * @return {?}
  21069. */
  21070. function (newValue) {
  21071. if (this.selected && newValue !== this.value) {
  21072. this.selected = false;
  21073. }
  21074. this._value = newValue;
  21075. },
  21076. enumerable: true,
  21077. configurable: true
  21078. });
  21079. Object.defineProperty(MatListOption.prototype, "disabled", {
  21080. /** Whether the option is disabled. */
  21081. get: /**
  21082. * Whether the option is disabled.
  21083. * @return {?}
  21084. */
  21085. function () { return this._disabled || (this.selectionList && this.selectionList.disabled); },
  21086. set: /**
  21087. * @param {?} value
  21088. * @return {?}
  21089. */
  21090. function (value) {
  21091. /** @type {?} */
  21092. var newValue = coercion.coerceBooleanProperty(value);
  21093. if (newValue !== this._disabled) {
  21094. this._disabled = newValue;
  21095. this._changeDetector.markForCheck();
  21096. }
  21097. },
  21098. enumerable: true,
  21099. configurable: true
  21100. });
  21101. Object.defineProperty(MatListOption.prototype, "selected", {
  21102. /** Whether the option is selected. */
  21103. get: /**
  21104. * Whether the option is selected.
  21105. * @return {?}
  21106. */
  21107. function () { return this.selectionList.selectedOptions.isSelected(this); },
  21108. set: /**
  21109. * @param {?} value
  21110. * @return {?}
  21111. */
  21112. function (value) {
  21113. /** @type {?} */
  21114. var isSelected = coercion.coerceBooleanProperty(value);
  21115. if (isSelected !== this._selected) {
  21116. this._setSelected(isSelected);
  21117. this.selectionList._reportValueChange();
  21118. }
  21119. },
  21120. enumerable: true,
  21121. configurable: true
  21122. });
  21123. /**
  21124. * @return {?}
  21125. */
  21126. MatListOption.prototype.ngOnInit = /**
  21127. * @return {?}
  21128. */
  21129. function () {
  21130. var _this = this;
  21131. /** @type {?} */
  21132. var list = this.selectionList;
  21133. if (list._value && list._value.some((/**
  21134. * @param {?} value
  21135. * @return {?}
  21136. */
  21137. function (value) { return list.compareWith(value, _this._value); }))) {
  21138. this._setSelected(true);
  21139. }
  21140. /** @type {?} */
  21141. var wasSelected = this._selected;
  21142. // List options that are selected at initialization can't be reported properly to the form
  21143. // control. This is because it takes some time until the selection-list knows about all
  21144. // available options. Also it can happen that the ControlValueAccessor has an initial value
  21145. // that should be used instead. Deferring the value change report to the next tick ensures
  21146. // that the form control value is not being overwritten.
  21147. Promise.resolve().then((/**
  21148. * @return {?}
  21149. */
  21150. function () {
  21151. if (_this._selected || wasSelected) {
  21152. _this.selected = true;
  21153. _this._changeDetector.markForCheck();
  21154. }
  21155. }));
  21156. };
  21157. /**
  21158. * @return {?}
  21159. */
  21160. MatListOption.prototype.ngAfterContentInit = /**
  21161. * @return {?}
  21162. */
  21163. function () {
  21164. setLines(this._lines, this._element);
  21165. };
  21166. /**
  21167. * @return {?}
  21168. */
  21169. MatListOption.prototype.ngOnDestroy = /**
  21170. * @return {?}
  21171. */
  21172. function () {
  21173. var _this = this;
  21174. if (this.selected) {
  21175. // We have to delay this until the next tick in order
  21176. // to avoid changed after checked errors.
  21177. Promise.resolve().then((/**
  21178. * @return {?}
  21179. */
  21180. function () {
  21181. _this.selected = false;
  21182. }));
  21183. }
  21184. /** @type {?} */
  21185. var hadFocus = this._hasFocus;
  21186. /** @type {?} */
  21187. var newActiveItem = this.selectionList._removeOptionFromList(this);
  21188. // Only move focus if this option was focused at the time it was destroyed.
  21189. if (hadFocus && newActiveItem) {
  21190. newActiveItem.focus();
  21191. }
  21192. };
  21193. /** Toggles the selection state of the option. */
  21194. /**
  21195. * Toggles the selection state of the option.
  21196. * @return {?}
  21197. */
  21198. MatListOption.prototype.toggle = /**
  21199. * Toggles the selection state of the option.
  21200. * @return {?}
  21201. */
  21202. function () {
  21203. this.selected = !this.selected;
  21204. };
  21205. /** Allows for programmatic focusing of the option. */
  21206. /**
  21207. * Allows for programmatic focusing of the option.
  21208. * @return {?}
  21209. */
  21210. MatListOption.prototype.focus = /**
  21211. * Allows for programmatic focusing of the option.
  21212. * @return {?}
  21213. */
  21214. function () {
  21215. this._element.nativeElement.focus();
  21216. };
  21217. /**
  21218. * Returns the list item's text label. Implemented as a part of the FocusKeyManager.
  21219. * @docs-private
  21220. */
  21221. /**
  21222. * Returns the list item's text label. Implemented as a part of the FocusKeyManager.
  21223. * \@docs-private
  21224. * @return {?}
  21225. */
  21226. MatListOption.prototype.getLabel = /**
  21227. * Returns the list item's text label. Implemented as a part of the FocusKeyManager.
  21228. * \@docs-private
  21229. * @return {?}
  21230. */
  21231. function () {
  21232. return this._text ? (this._text.nativeElement.textContent || '') : '';
  21233. };
  21234. /** Whether this list item should show a ripple effect when clicked. */
  21235. /**
  21236. * Whether this list item should show a ripple effect when clicked.
  21237. * @return {?}
  21238. */
  21239. MatListOption.prototype._isRippleDisabled = /**
  21240. * Whether this list item should show a ripple effect when clicked.
  21241. * @return {?}
  21242. */
  21243. function () {
  21244. return this.disabled || this.disableRipple || this.selectionList.disableRipple;
  21245. };
  21246. /**
  21247. * @return {?}
  21248. */
  21249. MatListOption.prototype._handleClick = /**
  21250. * @return {?}
  21251. */
  21252. function () {
  21253. if (!this.disabled) {
  21254. this.toggle();
  21255. // Emit a change event if the selected state of the option changed through user interaction.
  21256. this.selectionList._emitChangeEvent(this);
  21257. }
  21258. };
  21259. /**
  21260. * @return {?}
  21261. */
  21262. MatListOption.prototype._handleFocus = /**
  21263. * @return {?}
  21264. */
  21265. function () {
  21266. this.selectionList._setFocusedOption(this);
  21267. this._hasFocus = true;
  21268. };
  21269. /**
  21270. * @return {?}
  21271. */
  21272. MatListOption.prototype._handleBlur = /**
  21273. * @return {?}
  21274. */
  21275. function () {
  21276. this.selectionList._onTouched();
  21277. this._hasFocus = false;
  21278. };
  21279. /** Retrieves the DOM element of the component host. */
  21280. /**
  21281. * Retrieves the DOM element of the component host.
  21282. * @return {?}
  21283. */
  21284. MatListOption.prototype._getHostElement = /**
  21285. * Retrieves the DOM element of the component host.
  21286. * @return {?}
  21287. */
  21288. function () {
  21289. return this._element.nativeElement;
  21290. };
  21291. /** Sets the selected state of the option. Returns whether the value has changed. */
  21292. /**
  21293. * Sets the selected state of the option. Returns whether the value has changed.
  21294. * @param {?} selected
  21295. * @return {?}
  21296. */
  21297. MatListOption.prototype._setSelected = /**
  21298. * Sets the selected state of the option. Returns whether the value has changed.
  21299. * @param {?} selected
  21300. * @return {?}
  21301. */
  21302. function (selected) {
  21303. if (selected === this._selected) {
  21304. return false;
  21305. }
  21306. this._selected = selected;
  21307. if (selected) {
  21308. this.selectionList.selectedOptions.select(this);
  21309. }
  21310. else {
  21311. this.selectionList.selectedOptions.deselect(this);
  21312. }
  21313. this._changeDetector.markForCheck();
  21314. return true;
  21315. };
  21316. /**
  21317. * Notifies Angular that the option needs to be checked in the next change detection run. Mainly
  21318. * used to trigger an update of the list option if the disabled state of the selection list
  21319. * changed.
  21320. */
  21321. /**
  21322. * Notifies Angular that the option needs to be checked in the next change detection run. Mainly
  21323. * used to trigger an update of the list option if the disabled state of the selection list
  21324. * changed.
  21325. * @return {?}
  21326. */
  21327. MatListOption.prototype._markForCheck = /**
  21328. * Notifies Angular that the option needs to be checked in the next change detection run. Mainly
  21329. * used to trigger an update of the list option if the disabled state of the selection list
  21330. * changed.
  21331. * @return {?}
  21332. */
  21333. function () {
  21334. this._changeDetector.markForCheck();
  21335. };
  21336. MatListOption.decorators = [
  21337. { type: core.Component, args: [{selector: 'mat-list-option',
  21338. exportAs: 'matListOption',
  21339. inputs: ['disableRipple'],
  21340. host: {
  21341. 'role': 'option',
  21342. 'class': 'mat-list-item mat-list-option',
  21343. '(focus)': '_handleFocus()',
  21344. '(blur)': '_handleBlur()',
  21345. '(click)': '_handleClick()',
  21346. 'tabindex': '-1',
  21347. '[class.mat-list-item-disabled]': 'disabled',
  21348. '[class.mat-list-item-with-avatar]': '_avatar || _icon',
  21349. // Manually set the "primary" or "warn" class if the color has been explicitly
  21350. // set to "primary" or "warn". The pseudo checkbox picks up these classes for
  21351. // its theme. The accent theme palette is the default and doesn't need to be set.
  21352. '[class.mat-primary]': 'color === "primary"',
  21353. '[class.mat-warn]': 'color === "warn"',
  21354. '[attr.aria-selected]': 'selected',
  21355. '[attr.aria-disabled]': 'disabled',
  21356. },
  21357. template: "<div class=\"mat-list-item-content\" [class.mat-list-item-content-reverse]=\"checkboxPosition == 'after'\"><div mat-ripple class=\"mat-list-item-ripple\" [matRippleTrigger]=\"_getHostElement()\" [matRippleDisabled]=\"_isRippleDisabled()\"></div><mat-pseudo-checkbox [state]=\"selected ? 'checked' : 'unchecked'\" [disabled]=\"disabled\"></mat-pseudo-checkbox><div class=\"mat-list-text\" #text><ng-content></ng-content></div><ng-content select=\"[mat-list-avatar], [mat-list-icon], [matListAvatar], [matListIcon]\"></ng-content></div>",
  21358. encapsulation: core.ViewEncapsulation.None,
  21359. changeDetection: core.ChangeDetectionStrategy.OnPush,
  21360. },] },
  21361. ];
  21362. /** @nocollapse */
  21363. MatListOption.ctorParameters = function () { return [
  21364. { type: core.ElementRef },
  21365. { type: core.ChangeDetectorRef },
  21366. { type: MatSelectionList, decorators: [{ type: core.Inject, args: [core.forwardRef((/**
  21367. * @return {?}
  21368. */
  21369. function () { return MatSelectionList; })),] }] }
  21370. ]; };
  21371. MatListOption.propDecorators = {
  21372. _avatar: [{ type: core.ContentChild, args: [MatListAvatarCssMatStyler, { static: false },] }],
  21373. _icon: [{ type: core.ContentChild, args: [MatListIconCssMatStyler, { static: false },] }],
  21374. _lines: [{ type: core.ContentChildren, args: [MatLine,] }],
  21375. _text: [{ type: core.ViewChild, args: ['text', { static: false },] }],
  21376. checkboxPosition: [{ type: core.Input }],
  21377. color: [{ type: core.Input }],
  21378. value: [{ type: core.Input }],
  21379. disabled: [{ type: core.Input }],
  21380. selected: [{ type: core.Input }]
  21381. };
  21382. return MatListOption;
  21383. }(_MatListOptionMixinBase));
  21384. /**
  21385. * Material Design list component where each item is a selectable option. Behaves as a listbox.
  21386. */
  21387. var MatSelectionList = /** @class */ (function (_super) {
  21388. __extends(MatSelectionList, _super);
  21389. function MatSelectionList(_element, tabIndex) {
  21390. var _this = _super.call(this) || this;
  21391. _this._element = _element;
  21392. /**
  21393. * Emits a change event whenever the selected state of an option changes.
  21394. */
  21395. _this.selectionChange = new core.EventEmitter();
  21396. /**
  21397. * Tabindex of the selection list.
  21398. */
  21399. _this.tabIndex = 0;
  21400. /**
  21401. * Theme color of the selection list. This sets the checkbox color for all list options.
  21402. */
  21403. _this.color = 'accent';
  21404. /**
  21405. * Function used for comparing an option against the selected value when determining which
  21406. * options should appear as selected. The first argument is the value of an options. The second
  21407. * one is a value from the selected value. A boolean must be returned.
  21408. */
  21409. _this.compareWith = (/**
  21410. * @param {?} a1
  21411. * @param {?} a2
  21412. * @return {?}
  21413. */
  21414. function (a1, a2) { return a1 === a2; });
  21415. _this._disabled = false;
  21416. /**
  21417. * The currently selected options.
  21418. */
  21419. _this.selectedOptions = new collections.SelectionModel(true);
  21420. /**
  21421. * View to model callback that should be called whenever the selected options change.
  21422. */
  21423. _this._onChange = (/**
  21424. * @param {?} _
  21425. * @return {?}
  21426. */
  21427. function (_) { });
  21428. /**
  21429. * Emits when the list has been destroyed.
  21430. */
  21431. _this._destroyed = new rxjs.Subject();
  21432. /**
  21433. * View to model callback that should be called if the list or its options lost focus.
  21434. */
  21435. _this._onTouched = (/**
  21436. * @return {?}
  21437. */
  21438. function () { });
  21439. _this.tabIndex = parseInt(tabIndex) || 0;
  21440. return _this;
  21441. }
  21442. Object.defineProperty(MatSelectionList.prototype, "disabled", {
  21443. /** Whether the selection list is disabled. */
  21444. get: /**
  21445. * Whether the selection list is disabled.
  21446. * @return {?}
  21447. */
  21448. function () { return this._disabled; },
  21449. set: /**
  21450. * @param {?} value
  21451. * @return {?}
  21452. */
  21453. function (value) {
  21454. this._disabled = coercion.coerceBooleanProperty(value);
  21455. // The `MatSelectionList` and `MatListOption` are using the `OnPush` change detection
  21456. // strategy. Therefore the options will not check for any changes if the `MatSelectionList`
  21457. // changed its state. Since we know that a change to `disabled` property of the list affects
  21458. // the state of the options, we manually mark each option for check.
  21459. this._markOptionsForCheck();
  21460. },
  21461. enumerable: true,
  21462. configurable: true
  21463. });
  21464. /**
  21465. * @return {?}
  21466. */
  21467. MatSelectionList.prototype.ngAfterContentInit = /**
  21468. * @return {?}
  21469. */
  21470. function () {
  21471. this._keyManager = new a11y.FocusKeyManager(this.options)
  21472. .withWrap()
  21473. .withTypeAhead()
  21474. // Allow disabled items to be focusable. For accessibility reasons, there must be a way for
  21475. // screenreader users, that allows reading the different options of the list.
  21476. .skipPredicate((/**
  21477. * @return {?}
  21478. */
  21479. function () { return false; }))
  21480. .withAllowedModifierKeys(['shiftKey']);
  21481. if (this._value) {
  21482. this._setOptionsFromValues(this._value);
  21483. }
  21484. // Sync external changes to the model back to the options.
  21485. this.selectedOptions.onChange.pipe(operators.takeUntil(this._destroyed)).subscribe((/**
  21486. * @param {?} event
  21487. * @return {?}
  21488. */
  21489. function (event) {
  21490. if (event.added) {
  21491. for (var _i = 0, _a = event.added; _i < _a.length; _i++) {
  21492. var item = _a[_i];
  21493. item.selected = true;
  21494. }
  21495. }
  21496. if (event.removed) {
  21497. for (var _b = 0, _c = event.removed; _b < _c.length; _b++) {
  21498. var item = _c[_b];
  21499. item.selected = false;
  21500. }
  21501. }
  21502. }));
  21503. };
  21504. /**
  21505. * @param {?} changes
  21506. * @return {?}
  21507. */
  21508. MatSelectionList.prototype.ngOnChanges = /**
  21509. * @param {?} changes
  21510. * @return {?}
  21511. */
  21512. function (changes) {
  21513. /** @type {?} */
  21514. var disableRippleChanges = changes['disableRipple'];
  21515. /** @type {?} */
  21516. var colorChanges = changes['color'];
  21517. if ((disableRippleChanges && !disableRippleChanges.firstChange) ||
  21518. (colorChanges && !colorChanges.firstChange)) {
  21519. this._markOptionsForCheck();
  21520. }
  21521. };
  21522. /**
  21523. * @return {?}
  21524. */
  21525. MatSelectionList.prototype.ngOnDestroy = /**
  21526. * @return {?}
  21527. */
  21528. function () {
  21529. this._destroyed.next();
  21530. this._destroyed.complete();
  21531. this._isDestroyed = true;
  21532. };
  21533. /** Focuses the selection list. */
  21534. /**
  21535. * Focuses the selection list.
  21536. * @param {?=} options
  21537. * @return {?}
  21538. */
  21539. MatSelectionList.prototype.focus = /**
  21540. * Focuses the selection list.
  21541. * @param {?=} options
  21542. * @return {?}
  21543. */
  21544. function (options) {
  21545. this._element.nativeElement.focus(options);
  21546. };
  21547. /** Selects all of the options. */
  21548. /**
  21549. * Selects all of the options.
  21550. * @return {?}
  21551. */
  21552. MatSelectionList.prototype.selectAll = /**
  21553. * Selects all of the options.
  21554. * @return {?}
  21555. */
  21556. function () {
  21557. this._setAllOptionsSelected(true);
  21558. };
  21559. /** Deselects all of the options. */
  21560. /**
  21561. * Deselects all of the options.
  21562. * @return {?}
  21563. */
  21564. MatSelectionList.prototype.deselectAll = /**
  21565. * Deselects all of the options.
  21566. * @return {?}
  21567. */
  21568. function () {
  21569. this._setAllOptionsSelected(false);
  21570. };
  21571. /** Sets the focused option of the selection-list. */
  21572. /**
  21573. * Sets the focused option of the selection-list.
  21574. * @param {?} option
  21575. * @return {?}
  21576. */
  21577. MatSelectionList.prototype._setFocusedOption = /**
  21578. * Sets the focused option of the selection-list.
  21579. * @param {?} option
  21580. * @return {?}
  21581. */
  21582. function (option) {
  21583. this._keyManager.updateActiveItem(option);
  21584. };
  21585. /**
  21586. * Removes an option from the selection list and updates the active item.
  21587. * @returns Currently-active item.
  21588. */
  21589. /**
  21590. * Removes an option from the selection list and updates the active item.
  21591. * @param {?} option
  21592. * @return {?} Currently-active item.
  21593. */
  21594. MatSelectionList.prototype._removeOptionFromList = /**
  21595. * Removes an option from the selection list and updates the active item.
  21596. * @param {?} option
  21597. * @return {?} Currently-active item.
  21598. */
  21599. function (option) {
  21600. /** @type {?} */
  21601. var optionIndex = this._getOptionIndex(option);
  21602. if (optionIndex > -1 && this._keyManager.activeItemIndex === optionIndex) {
  21603. // Check whether the option is the last item
  21604. if (optionIndex > 0) {
  21605. this._keyManager.updateActiveItem(optionIndex - 1);
  21606. }
  21607. else if (optionIndex === 0 && this.options.length > 1) {
  21608. this._keyManager.updateActiveItem(Math.min(optionIndex + 1, this.options.length - 1));
  21609. }
  21610. }
  21611. return this._keyManager.activeItem;
  21612. };
  21613. /** Passes relevant key presses to our key manager. */
  21614. /**
  21615. * Passes relevant key presses to our key manager.
  21616. * @param {?} event
  21617. * @return {?}
  21618. */
  21619. MatSelectionList.prototype._keydown = /**
  21620. * Passes relevant key presses to our key manager.
  21621. * @param {?} event
  21622. * @return {?}
  21623. */
  21624. function (event) {
  21625. /** @type {?} */
  21626. var keyCode = event.keyCode;
  21627. /** @type {?} */
  21628. var manager = this._keyManager;
  21629. /** @type {?} */
  21630. var previousFocusIndex = manager.activeItemIndex;
  21631. /** @type {?} */
  21632. var hasModifier = keycodes.hasModifierKey(event);
  21633. switch (keyCode) {
  21634. case keycodes.SPACE:
  21635. case keycodes.ENTER:
  21636. if (!hasModifier) {
  21637. this._toggleFocusedOption();
  21638. // Always prevent space from scrolling the page since the list has focus
  21639. event.preventDefault();
  21640. }
  21641. break;
  21642. case keycodes.HOME:
  21643. case keycodes.END:
  21644. if (!hasModifier) {
  21645. keyCode === keycodes.HOME ? manager.setFirstItemActive() : manager.setLastItemActive();
  21646. event.preventDefault();
  21647. }
  21648. break;
  21649. case keycodes.A:
  21650. if (keycodes.hasModifierKey(event, 'ctrlKey')) {
  21651. this.options.find((/**
  21652. * @param {?} option
  21653. * @return {?}
  21654. */
  21655. function (option) { return !option.selected; })) ? this.selectAll() : this.deselectAll();
  21656. event.preventDefault();
  21657. }
  21658. break;
  21659. default:
  21660. manager.onKeydown(event);
  21661. }
  21662. if ((keyCode === keycodes.UP_ARROW || keyCode === keycodes.DOWN_ARROW) && event.shiftKey &&
  21663. manager.activeItemIndex !== previousFocusIndex) {
  21664. this._toggleFocusedOption();
  21665. }
  21666. };
  21667. /** Reports a value change to the ControlValueAccessor */
  21668. /**
  21669. * Reports a value change to the ControlValueAccessor
  21670. * @return {?}
  21671. */
  21672. MatSelectionList.prototype._reportValueChange = /**
  21673. * Reports a value change to the ControlValueAccessor
  21674. * @return {?}
  21675. */
  21676. function () {
  21677. // Stop reporting value changes after the list has been destroyed. This avoids
  21678. // cases where the list might wrongly reset its value once it is removed, but
  21679. // the form control is still live.
  21680. if (this.options && !this._isDestroyed) {
  21681. /** @type {?} */
  21682. var value = this._getSelectedOptionValues();
  21683. this._onChange(value);
  21684. this._value = value;
  21685. }
  21686. };
  21687. /** Emits a change event if the selected state of an option changed. */
  21688. /**
  21689. * Emits a change event if the selected state of an option changed.
  21690. * @param {?} option
  21691. * @return {?}
  21692. */
  21693. MatSelectionList.prototype._emitChangeEvent = /**
  21694. * Emits a change event if the selected state of an option changed.
  21695. * @param {?} option
  21696. * @return {?}
  21697. */
  21698. function (option) {
  21699. this.selectionChange.emit(new MatSelectionListChange(this, option));
  21700. };
  21701. /** Implemented as part of ControlValueAccessor. */
  21702. /**
  21703. * Implemented as part of ControlValueAccessor.
  21704. * @param {?} values
  21705. * @return {?}
  21706. */
  21707. MatSelectionList.prototype.writeValue = /**
  21708. * Implemented as part of ControlValueAccessor.
  21709. * @param {?} values
  21710. * @return {?}
  21711. */
  21712. function (values) {
  21713. this._value = values;
  21714. if (this.options) {
  21715. this._setOptionsFromValues(values || []);
  21716. }
  21717. };
  21718. /** Implemented as a part of ControlValueAccessor. */
  21719. /**
  21720. * Implemented as a part of ControlValueAccessor.
  21721. * @param {?} isDisabled
  21722. * @return {?}
  21723. */
  21724. MatSelectionList.prototype.setDisabledState = /**
  21725. * Implemented as a part of ControlValueAccessor.
  21726. * @param {?} isDisabled
  21727. * @return {?}
  21728. */
  21729. function (isDisabled) {
  21730. this.disabled = isDisabled;
  21731. };
  21732. /** Implemented as part of ControlValueAccessor. */
  21733. /**
  21734. * Implemented as part of ControlValueAccessor.
  21735. * @param {?} fn
  21736. * @return {?}
  21737. */
  21738. MatSelectionList.prototype.registerOnChange = /**
  21739. * Implemented as part of ControlValueAccessor.
  21740. * @param {?} fn
  21741. * @return {?}
  21742. */
  21743. function (fn) {
  21744. this._onChange = fn;
  21745. };
  21746. /** Implemented as part of ControlValueAccessor. */
  21747. /**
  21748. * Implemented as part of ControlValueAccessor.
  21749. * @param {?} fn
  21750. * @return {?}
  21751. */
  21752. MatSelectionList.prototype.registerOnTouched = /**
  21753. * Implemented as part of ControlValueAccessor.
  21754. * @param {?} fn
  21755. * @return {?}
  21756. */
  21757. function (fn) {
  21758. this._onTouched = fn;
  21759. };
  21760. /** Sets the selected options based on the specified values. */
  21761. /**
  21762. * Sets the selected options based on the specified values.
  21763. * @private
  21764. * @param {?} values
  21765. * @return {?}
  21766. */
  21767. MatSelectionList.prototype._setOptionsFromValues = /**
  21768. * Sets the selected options based on the specified values.
  21769. * @private
  21770. * @param {?} values
  21771. * @return {?}
  21772. */
  21773. function (values) {
  21774. var _this = this;
  21775. this.options.forEach((/**
  21776. * @param {?} option
  21777. * @return {?}
  21778. */
  21779. function (option) { return option._setSelected(false); }));
  21780. values.forEach((/**
  21781. * @param {?} value
  21782. * @return {?}
  21783. */
  21784. function (value) {
  21785. /** @type {?} */
  21786. var correspondingOption = _this.options.find((/**
  21787. * @param {?} option
  21788. * @return {?}
  21789. */
  21790. function (option) {
  21791. // Skip options that are already in the model. This allows us to handle cases
  21792. // where the same primitive value is selected multiple times.
  21793. return option.selected ? false : _this.compareWith(option.value, value);
  21794. }));
  21795. if (correspondingOption) {
  21796. correspondingOption._setSelected(true);
  21797. }
  21798. }));
  21799. };
  21800. /** Returns the values of the selected options. */
  21801. /**
  21802. * Returns the values of the selected options.
  21803. * @private
  21804. * @return {?}
  21805. */
  21806. MatSelectionList.prototype._getSelectedOptionValues = /**
  21807. * Returns the values of the selected options.
  21808. * @private
  21809. * @return {?}
  21810. */
  21811. function () {
  21812. return this.options.filter((/**
  21813. * @param {?} option
  21814. * @return {?}
  21815. */
  21816. function (option) { return option.selected; })).map((/**
  21817. * @param {?} option
  21818. * @return {?}
  21819. */
  21820. function (option) { return option.value; }));
  21821. };
  21822. /** Toggles the state of the currently focused option if enabled. */
  21823. /**
  21824. * Toggles the state of the currently focused option if enabled.
  21825. * @private
  21826. * @return {?}
  21827. */
  21828. MatSelectionList.prototype._toggleFocusedOption = /**
  21829. * Toggles the state of the currently focused option if enabled.
  21830. * @private
  21831. * @return {?}
  21832. */
  21833. function () {
  21834. /** @type {?} */
  21835. var focusedIndex = this._keyManager.activeItemIndex;
  21836. if (focusedIndex != null && this._isValidIndex(focusedIndex)) {
  21837. /** @type {?} */
  21838. var focusedOption = this.options.toArray()[focusedIndex];
  21839. if (focusedOption && !focusedOption.disabled) {
  21840. focusedOption.toggle();
  21841. // Emit a change event because the focused option changed its state through user
  21842. // interaction.
  21843. this._emitChangeEvent(focusedOption);
  21844. }
  21845. }
  21846. };
  21847. /**
  21848. * Sets the selected state on all of the options
  21849. * and emits an event if anything changed.
  21850. */
  21851. /**
  21852. * Sets the selected state on all of the options
  21853. * and emits an event if anything changed.
  21854. * @private
  21855. * @param {?} isSelected
  21856. * @return {?}
  21857. */
  21858. MatSelectionList.prototype._setAllOptionsSelected = /**
  21859. * Sets the selected state on all of the options
  21860. * and emits an event if anything changed.
  21861. * @private
  21862. * @param {?} isSelected
  21863. * @return {?}
  21864. */
  21865. function (isSelected) {
  21866. // Keep track of whether anything changed, because we only want to
  21867. // emit the changed event when something actually changed.
  21868. /** @type {?} */
  21869. var hasChanged = false;
  21870. this.options.forEach((/**
  21871. * @param {?} option
  21872. * @return {?}
  21873. */
  21874. function (option) {
  21875. if (option._setSelected(isSelected)) {
  21876. hasChanged = true;
  21877. }
  21878. }));
  21879. if (hasChanged) {
  21880. this._reportValueChange();
  21881. }
  21882. };
  21883. /**
  21884. * Utility to ensure all indexes are valid.
  21885. * @param index The index to be checked.
  21886. * @returns True if the index is valid for our list of options.
  21887. */
  21888. /**
  21889. * Utility to ensure all indexes are valid.
  21890. * @private
  21891. * @param {?} index The index to be checked.
  21892. * @return {?} True if the index is valid for our list of options.
  21893. */
  21894. MatSelectionList.prototype._isValidIndex = /**
  21895. * Utility to ensure all indexes are valid.
  21896. * @private
  21897. * @param {?} index The index to be checked.
  21898. * @return {?} True if the index is valid for our list of options.
  21899. */
  21900. function (index) {
  21901. return index >= 0 && index < this.options.length;
  21902. };
  21903. /** Returns the index of the specified list option. */
  21904. /**
  21905. * Returns the index of the specified list option.
  21906. * @private
  21907. * @param {?} option
  21908. * @return {?}
  21909. */
  21910. MatSelectionList.prototype._getOptionIndex = /**
  21911. * Returns the index of the specified list option.
  21912. * @private
  21913. * @param {?} option
  21914. * @return {?}
  21915. */
  21916. function (option) {
  21917. return this.options.toArray().indexOf(option);
  21918. };
  21919. /** Marks all the options to be checked in the next change detection run. */
  21920. /**
  21921. * Marks all the options to be checked in the next change detection run.
  21922. * @private
  21923. * @return {?}
  21924. */
  21925. MatSelectionList.prototype._markOptionsForCheck = /**
  21926. * Marks all the options to be checked in the next change detection run.
  21927. * @private
  21928. * @return {?}
  21929. */
  21930. function () {
  21931. if (this.options) {
  21932. this.options.forEach((/**
  21933. * @param {?} option
  21934. * @return {?}
  21935. */
  21936. function (option) { return option._markForCheck(); }));
  21937. }
  21938. };
  21939. MatSelectionList.decorators = [
  21940. { type: core.Component, args: [{selector: 'mat-selection-list',
  21941. exportAs: 'matSelectionList',
  21942. inputs: ['disableRipple'],
  21943. host: {
  21944. 'role': 'listbox',
  21945. '[tabIndex]': 'tabIndex',
  21946. 'class': 'mat-selection-list mat-list-base',
  21947. '(blur)': '_onTouched()',
  21948. '(keydown)': '_keydown($event)',
  21949. 'aria-multiselectable': 'true',
  21950. '[attr.aria-disabled]': 'disabled.toString()',
  21951. },
  21952. template: '<ng-content></ng-content>',
  21953. styles: [".mat-subheader{display:flex;box-sizing:border-box;padding:16px;align-items:center}.mat-list-base .mat-subheader{margin:0}.mat-list-base{padding-top:8px;display:block;-webkit-tap-highlight-color:transparent}.mat-list-base .mat-subheader{height:48px;line-height:16px}.mat-list-base .mat-subheader:first-child{margin-top:-8px}.mat-list-base .mat-list-item,.mat-list-base .mat-list-option{display:block;height:48px;-webkit-tap-highlight-color:transparent;width:100%;padding:0}.mat-list-base .mat-list-item .mat-list-item-content,.mat-list-base .mat-list-option .mat-list-item-content{display:flex;flex-direction:row;align-items:center;box-sizing:border-box;padding:0 16px;position:relative;height:inherit}.mat-list-base .mat-list-item .mat-list-item-content-reverse,.mat-list-base .mat-list-option .mat-list-item-content-reverse{display:flex;align-items:center;padding:0 16px;flex-direction:row-reverse;justify-content:space-around}.mat-list-base .mat-list-item .mat-list-item-ripple,.mat-list-base .mat-list-option .mat-list-item-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}.mat-list-base .mat-list-item.mat-list-item-with-avatar,.mat-list-base .mat-list-option.mat-list-item-with-avatar{height:56px}.mat-list-base .mat-list-item.mat-2-line,.mat-list-base .mat-list-option.mat-2-line{height:72px}.mat-list-base .mat-list-item.mat-3-line,.mat-list-base .mat-list-option.mat-3-line{height:88px}.mat-list-base .mat-list-item.mat-multi-line,.mat-list-base .mat-list-option.mat-multi-line{height:auto}.mat-list-base .mat-list-item.mat-multi-line .mat-list-item-content,.mat-list-base .mat-list-option.mat-multi-line .mat-list-item-content{padding-top:16px;padding-bottom:16px}.mat-list-base .mat-list-item .mat-list-text,.mat-list-base .mat-list-option .mat-list-text{display:flex;flex-direction:column;width:100%;box-sizing:border-box;overflow:hidden;padding:0}.mat-list-base .mat-list-item .mat-list-text>*,.mat-list-base .mat-list-option .mat-list-text>*{margin:0;padding:0;font-weight:400;font-size:inherit}.mat-list-base .mat-list-item .mat-list-text:empty,.mat-list-base .mat-list-option .mat-list-text:empty{display:none}.mat-list-base .mat-list-item.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,.mat-list-base .mat-list-item.mat-list-option .mat-list-item-content .mat-list-text,.mat-list-base .mat-list-option.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,.mat-list-base .mat-list-option.mat-list-option .mat-list-item-content .mat-list-text{padding-right:0;padding-left:16px}[dir=rtl] .mat-list-base .mat-list-item.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,[dir=rtl] .mat-list-base .mat-list-item.mat-list-option .mat-list-item-content .mat-list-text,[dir=rtl] .mat-list-base .mat-list-option.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,[dir=rtl] .mat-list-base .mat-list-option.mat-list-option .mat-list-item-content .mat-list-text{padding-right:16px;padding-left:0}.mat-list-base .mat-list-item.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,.mat-list-base .mat-list-item.mat-list-option .mat-list-item-content-reverse .mat-list-text,.mat-list-base .mat-list-option.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,.mat-list-base .mat-list-option.mat-list-option .mat-list-item-content-reverse .mat-list-text{padding-left:0;padding-right:16px}[dir=rtl] .mat-list-base .mat-list-item.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,[dir=rtl] .mat-list-base .mat-list-item.mat-list-option .mat-list-item-content-reverse .mat-list-text,[dir=rtl] .mat-list-base .mat-list-option.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,[dir=rtl] .mat-list-base .mat-list-option.mat-list-option .mat-list-item-content-reverse .mat-list-text{padding-right:0;padding-left:16px}.mat-list-base .mat-list-item.mat-list-item-with-avatar.mat-list-option .mat-list-item-content .mat-list-text,.mat-list-base .mat-list-item.mat-list-item-with-avatar.mat-list-option .mat-list-item-content-reverse .mat-list-text,.mat-list-base .mat-list-option.mat-list-item-with-avatar.mat-list-option .mat-list-item-content .mat-list-text,.mat-list-base .mat-list-option.mat-list-item-with-avatar.mat-list-option .mat-list-item-content-reverse .mat-list-text{padding-right:16px;padding-left:16px}.mat-list-base .mat-list-item .mat-list-avatar,.mat-list-base .mat-list-option .mat-list-avatar{flex-shrink:0;width:40px;height:40px;border-radius:50%;object-fit:cover}.mat-list-base .mat-list-item .mat-list-avatar~.mat-divider-inset,.mat-list-base .mat-list-option .mat-list-avatar~.mat-divider-inset{margin-left:72px;width:calc(100% - 72px)}[dir=rtl] .mat-list-base .mat-list-item .mat-list-avatar~.mat-divider-inset,[dir=rtl] .mat-list-base .mat-list-option .mat-list-avatar~.mat-divider-inset{margin-left:auto;margin-right:72px}.mat-list-base .mat-list-item .mat-list-icon,.mat-list-base .mat-list-option .mat-list-icon{flex-shrink:0;width:24px;height:24px;font-size:24px;box-sizing:content-box;border-radius:50%;padding:4px}.mat-list-base .mat-list-item .mat-list-icon~.mat-divider-inset,.mat-list-base .mat-list-option .mat-list-icon~.mat-divider-inset{margin-left:64px;width:calc(100% - 64px)}[dir=rtl] .mat-list-base .mat-list-item .mat-list-icon~.mat-divider-inset,[dir=rtl] .mat-list-base .mat-list-option .mat-list-icon~.mat-divider-inset{margin-left:auto;margin-right:64px}.mat-list-base .mat-list-item .mat-divider,.mat-list-base .mat-list-option .mat-divider{position:absolute;bottom:0;left:0;width:100%;margin:0}[dir=rtl] .mat-list-base .mat-list-item .mat-divider,[dir=rtl] .mat-list-base .mat-list-option .mat-divider{margin-left:auto;margin-right:0}.mat-list-base .mat-list-item .mat-divider.mat-divider-inset,.mat-list-base .mat-list-option .mat-divider.mat-divider-inset{position:absolute}.mat-list-base[dense]{padding-top:4px;display:block}.mat-list-base[dense] .mat-subheader{height:40px;line-height:8px}.mat-list-base[dense] .mat-subheader:first-child{margin-top:-4px}.mat-list-base[dense] .mat-list-item,.mat-list-base[dense] .mat-list-option{display:block;height:40px;-webkit-tap-highlight-color:transparent;width:100%;padding:0}.mat-list-base[dense] .mat-list-item .mat-list-item-content,.mat-list-base[dense] .mat-list-option .mat-list-item-content{display:flex;flex-direction:row;align-items:center;box-sizing:border-box;padding:0 16px;position:relative;height:inherit}.mat-list-base[dense] .mat-list-item .mat-list-item-content-reverse,.mat-list-base[dense] .mat-list-option .mat-list-item-content-reverse{display:flex;align-items:center;padding:0 16px;flex-direction:row-reverse;justify-content:space-around}.mat-list-base[dense] .mat-list-item .mat-list-item-ripple,.mat-list-base[dense] .mat-list-option .mat-list-item-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}.mat-list-base[dense] .mat-list-item.mat-list-item-with-avatar,.mat-list-base[dense] .mat-list-option.mat-list-item-with-avatar{height:48px}.mat-list-base[dense] .mat-list-item.mat-2-line,.mat-list-base[dense] .mat-list-option.mat-2-line{height:60px}.mat-list-base[dense] .mat-list-item.mat-3-line,.mat-list-base[dense] .mat-list-option.mat-3-line{height:76px}.mat-list-base[dense] .mat-list-item.mat-multi-line,.mat-list-base[dense] .mat-list-option.mat-multi-line{height:auto}.mat-list-base[dense] .mat-list-item.mat-multi-line .mat-list-item-content,.mat-list-base[dense] .mat-list-option.mat-multi-line .mat-list-item-content{padding-top:16px;padding-bottom:16px}.mat-list-base[dense] .mat-list-item .mat-list-text,.mat-list-base[dense] .mat-list-option .mat-list-text{display:flex;flex-direction:column;width:100%;box-sizing:border-box;overflow:hidden;padding:0}.mat-list-base[dense] .mat-list-item .mat-list-text>*,.mat-list-base[dense] .mat-list-option .mat-list-text>*{margin:0;padding:0;font-weight:400;font-size:inherit}.mat-list-base[dense] .mat-list-item .mat-list-text:empty,.mat-list-base[dense] .mat-list-option .mat-list-text:empty{display:none}.mat-list-base[dense] .mat-list-item.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,.mat-list-base[dense] .mat-list-item.mat-list-option .mat-list-item-content .mat-list-text,.mat-list-base[dense] .mat-list-option.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,.mat-list-base[dense] .mat-list-option.mat-list-option .mat-list-item-content .mat-list-text{padding-right:0;padding-left:16px}[dir=rtl] .mat-list-base[dense] .mat-list-item.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,[dir=rtl] .mat-list-base[dense] .mat-list-item.mat-list-option .mat-list-item-content .mat-list-text,[dir=rtl] .mat-list-base[dense] .mat-list-option.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,[dir=rtl] .mat-list-base[dense] .mat-list-option.mat-list-option .mat-list-item-content .mat-list-text{padding-right:16px;padding-left:0}.mat-list-base[dense] .mat-list-item.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,.mat-list-base[dense] .mat-list-item.mat-list-option .mat-list-item-content-reverse .mat-list-text,.mat-list-base[dense] .mat-list-option.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,.mat-list-base[dense] .mat-list-option.mat-list-option .mat-list-item-content-reverse .mat-list-text{padding-left:0;padding-right:16px}[dir=rtl] .mat-list-base[dense] .mat-list-item.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,[dir=rtl] .mat-list-base[dense] .mat-list-item.mat-list-option .mat-list-item-content-reverse .mat-list-text,[dir=rtl] .mat-list-base[dense] .mat-list-option.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,[dir=rtl] .mat-list-base[dense] .mat-list-option.mat-list-option .mat-list-item-content-reverse .mat-list-text{padding-right:0;padding-left:16px}.mat-list-base[dense] .mat-list-item.mat-list-item-with-avatar.mat-list-option .mat-list-item-content .mat-list-text,.mat-list-base[dense] .mat-list-item.mat-list-item-with-avatar.mat-list-option .mat-list-item-content-reverse .mat-list-text,.mat-list-base[dense] .mat-list-option.mat-list-item-with-avatar.mat-list-option .mat-list-item-content .mat-list-text,.mat-list-base[dense] .mat-list-option.mat-list-item-with-avatar.mat-list-option .mat-list-item-content-reverse .mat-list-text{padding-right:16px;padding-left:16px}.mat-list-base[dense] .mat-list-item .mat-list-avatar,.mat-list-base[dense] .mat-list-option .mat-list-avatar{flex-shrink:0;width:36px;height:36px;border-radius:50%;object-fit:cover}.mat-list-base[dense] .mat-list-item .mat-list-avatar~.mat-divider-inset,.mat-list-base[dense] .mat-list-option .mat-list-avatar~.mat-divider-inset{margin-left:68px;width:calc(100% - 68px)}[dir=rtl] .mat-list-base[dense] .mat-list-item .mat-list-avatar~.mat-divider-inset,[dir=rtl] .mat-list-base[dense] .mat-list-option .mat-list-avatar~.mat-divider-inset{margin-left:auto;margin-right:68px}.mat-list-base[dense] .mat-list-item .mat-list-icon,.mat-list-base[dense] .mat-list-option .mat-list-icon{flex-shrink:0;width:20px;height:20px;font-size:20px;box-sizing:content-box;border-radius:50%;padding:4px}.mat-list-base[dense] .mat-list-item .mat-list-icon~.mat-divider-inset,.mat-list-base[dense] .mat-list-option .mat-list-icon~.mat-divider-inset{margin-left:60px;width:calc(100% - 60px)}[dir=rtl] .mat-list-base[dense] .mat-list-item .mat-list-icon~.mat-divider-inset,[dir=rtl] .mat-list-base[dense] .mat-list-option .mat-list-icon~.mat-divider-inset{margin-left:auto;margin-right:60px}.mat-list-base[dense] .mat-list-item .mat-divider,.mat-list-base[dense] .mat-list-option .mat-divider{position:absolute;bottom:0;left:0;width:100%;margin:0}[dir=rtl] .mat-list-base[dense] .mat-list-item .mat-divider,[dir=rtl] .mat-list-base[dense] .mat-list-option .mat-divider{margin-left:auto;margin-right:0}.mat-list-base[dense] .mat-list-item .mat-divider.mat-divider-inset,.mat-list-base[dense] .mat-list-option .mat-divider.mat-divider-inset{position:absolute}.mat-nav-list a{text-decoration:none;color:inherit}.mat-nav-list .mat-list-item{cursor:pointer;outline:0}mat-action-list button{background:0 0;color:inherit;border:none;font:inherit;outline:inherit;-webkit-tap-highlight-color:transparent;text-align:left}[dir=rtl] mat-action-list button{text-align:right}mat-action-list button::-moz-focus-inner{border:0}mat-action-list .mat-list-item{cursor:pointer;outline:inherit}.mat-list-option:not(.mat-list-item-disabled){cursor:pointer;outline:0}@media (-ms-high-contrast:active){.mat-selection-list:focus{outline-style:dotted}.mat-list-option:focus,.mat-list-option:hover,.mat-nav-list .mat-list-item:focus,.mat-nav-list .mat-list-item:hover,mat-action-list .mat-list-item:focus,mat-action-list .mat-list-item:hover{outline:dotted 1px}}@media (hover:none){.mat-action-list .mat-list-item:not(.mat-list-item-disabled):hover,.mat-list-option:not(.mat-list-item-disabled):hover,.mat-nav-list .mat-list-item:not(.mat-list-item-disabled):hover{background:0 0}}"],
  21954. encapsulation: core.ViewEncapsulation.None,
  21955. providers: [MAT_SELECTION_LIST_VALUE_ACCESSOR],
  21956. changeDetection: core.ChangeDetectionStrategy.OnPush
  21957. },] },
  21958. ];
  21959. /** @nocollapse */
  21960. MatSelectionList.ctorParameters = function () { return [
  21961. { type: core.ElementRef },
  21962. { type: String, decorators: [{ type: core.Attribute, args: ['tabindex',] }] }
  21963. ]; };
  21964. MatSelectionList.propDecorators = {
  21965. options: [{ type: core.ContentChildren, args: [MatListOption, { descendants: true },] }],
  21966. selectionChange: [{ type: core.Output }],
  21967. tabIndex: [{ type: core.Input }],
  21968. color: [{ type: core.Input }],
  21969. compareWith: [{ type: core.Input }],
  21970. disabled: [{ type: core.Input }]
  21971. };
  21972. return MatSelectionList;
  21973. }(_MatSelectionListMixinBase));
  21974. /**
  21975. * @fileoverview added by tsickle
  21976. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  21977. */
  21978. var MatListModule = /** @class */ (function () {
  21979. function MatListModule() {
  21980. }
  21981. MatListModule.decorators = [
  21982. { type: core.NgModule, args: [{
  21983. imports: [MatLineModule, MatRippleModule, MatCommonModule, MatPseudoCheckboxModule, common.CommonModule],
  21984. exports: [
  21985. MatList,
  21986. MatNavList,
  21987. MatListItem,
  21988. MatListAvatarCssMatStyler,
  21989. MatLineModule,
  21990. MatCommonModule,
  21991. MatListIconCssMatStyler,
  21992. MatListSubheaderCssMatStyler,
  21993. MatPseudoCheckboxModule,
  21994. MatSelectionList,
  21995. MatListOption,
  21996. MatDividerModule
  21997. ],
  21998. declarations: [
  21999. MatList,
  22000. MatNavList,
  22001. MatListItem,
  22002. MatListAvatarCssMatStyler,
  22003. MatListIconCssMatStyler,
  22004. MatListSubheaderCssMatStyler,
  22005. MatSelectionList,
  22006. MatListOption
  22007. ],
  22008. },] },
  22009. ];
  22010. return MatListModule;
  22011. }());
  22012. /**
  22013. * @fileoverview added by tsickle
  22014. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  22015. */
  22016. /**
  22017. * Animations used by the mat-menu component.
  22018. * Animation duration and timing values are based on:
  22019. * https://material.io/guidelines/components/menus.html#menus-usage
  22020. * \@docs-private
  22021. * @type {?}
  22022. */
  22023. var matMenuAnimations = {
  22024. /**
  22025. * This animation controls the menu panel's entry and exit from the page.
  22026. *
  22027. * When the menu panel is added to the DOM, it scales in and fades in its border.
  22028. *
  22029. * When the menu panel is removed from the DOM, it simply fades out after a brief
  22030. * delay to display the ripple.
  22031. */
  22032. transformMenu: animations$1.trigger('transformMenu', [
  22033. animations$1.state('void', animations$1.style({
  22034. opacity: 0,
  22035. transform: 'scale(0.8)'
  22036. })),
  22037. animations$1.transition('void => enter', animations$1.group([
  22038. animations$1.query('.mat-menu-content, .mat-mdc-menu-content', animations$1.animate('100ms linear', animations$1.style({
  22039. opacity: 1
  22040. }))),
  22041. animations$1.animate('120ms cubic-bezier(0, 0, 0.2, 1)', animations$1.style({ transform: 'scale(1)' })),
  22042. ])),
  22043. animations$1.transition('* => void', animations$1.animate('100ms 25ms linear', animations$1.style({ opacity: 0 })))
  22044. ]),
  22045. /**
  22046. * This animation fades in the background color and content of the menu panel
  22047. * after its containing element is scaled in.
  22048. */
  22049. fadeInItems: animations$1.trigger('fadeInItems', [
  22050. // TODO(crisbeto): this is inside the `transformMenu`
  22051. // now. Remove next time we do breaking changes.
  22052. animations$1.state('showing', animations$1.style({ opacity: 1 })),
  22053. animations$1.transition('void => *', [
  22054. animations$1.style({ opacity: 0 }),
  22055. animations$1.animate('400ms 100ms cubic-bezier(0.55, 0, 0.55, 0.2)')
  22056. ])
  22057. ])
  22058. };
  22059. /**
  22060. * @deprecated
  22061. * \@breaking-change 8.0.0
  22062. * \@docs-private
  22063. * @type {?}
  22064. */
  22065. var fadeInItems = matMenuAnimations.fadeInItems;
  22066. /**
  22067. * @deprecated
  22068. * \@breaking-change 8.0.0
  22069. * \@docs-private
  22070. * @type {?}
  22071. */
  22072. var transformMenu = matMenuAnimations.transformMenu;
  22073. /**
  22074. * @fileoverview added by tsickle
  22075. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  22076. */
  22077. /**
  22078. * Menu content that will be rendered lazily once the menu is opened.
  22079. */
  22080. var MatMenuContent = /** @class */ (function () {
  22081. function MatMenuContent(_template, _componentFactoryResolver, _appRef, _injector, _viewContainerRef, _document, _changeDetectorRef) {
  22082. this._template = _template;
  22083. this._componentFactoryResolver = _componentFactoryResolver;
  22084. this._appRef = _appRef;
  22085. this._injector = _injector;
  22086. this._viewContainerRef = _viewContainerRef;
  22087. this._document = _document;
  22088. this._changeDetectorRef = _changeDetectorRef;
  22089. /**
  22090. * Emits when the menu content has been attached.
  22091. */
  22092. this._attached = new rxjs.Subject();
  22093. }
  22094. /**
  22095. * Attaches the content with a particular context.
  22096. * @docs-private
  22097. */
  22098. /**
  22099. * Attaches the content with a particular context.
  22100. * \@docs-private
  22101. * @param {?=} context
  22102. * @return {?}
  22103. */
  22104. MatMenuContent.prototype.attach = /**
  22105. * Attaches the content with a particular context.
  22106. * \@docs-private
  22107. * @param {?=} context
  22108. * @return {?}
  22109. */
  22110. function (context) {
  22111. if (context === void 0) { context = {}; }
  22112. if (!this._portal) {
  22113. this._portal = new portal.TemplatePortal(this._template, this._viewContainerRef);
  22114. }
  22115. this.detach();
  22116. if (!this._outlet) {
  22117. this._outlet = new portal.DomPortalOutlet(this._document.createElement('div'), this._componentFactoryResolver, this._appRef, this._injector);
  22118. }
  22119. /** @type {?} */
  22120. var element = this._template.elementRef.nativeElement;
  22121. // Because we support opening the same menu from different triggers (which in turn have their
  22122. // own `OverlayRef` panel), we have to re-insert the host element every time, otherwise we
  22123. // risk it staying attached to a pane that's no longer in the DOM.
  22124. (/** @type {?} */ (element.parentNode)).insertBefore(this._outlet.outletElement, element);
  22125. // When `MatMenuContent` is used in an `OnPush` component, the insertion of the menu
  22126. // content via `createEmbeddedView` does not cause the content to be seen as "dirty"
  22127. // by Angular. This causes the `@ContentChildren` for menu items within the menu to
  22128. // not be updated by Angular. By explicitly marking for check here, we tell Angular that
  22129. // it needs to check for new menu items and update the `@ContentChild` in `MatMenu`.
  22130. // @breaking-change 9.0.0 Make change detector ref required
  22131. if (this._changeDetectorRef) {
  22132. this._changeDetectorRef.markForCheck();
  22133. }
  22134. this._portal.attach(this._outlet, context);
  22135. this._attached.next();
  22136. };
  22137. /**
  22138. * Detaches the content.
  22139. * @docs-private
  22140. */
  22141. /**
  22142. * Detaches the content.
  22143. * \@docs-private
  22144. * @return {?}
  22145. */
  22146. MatMenuContent.prototype.detach = /**
  22147. * Detaches the content.
  22148. * \@docs-private
  22149. * @return {?}
  22150. */
  22151. function () {
  22152. if (this._portal.isAttached) {
  22153. this._portal.detach();
  22154. }
  22155. };
  22156. /**
  22157. * @return {?}
  22158. */
  22159. MatMenuContent.prototype.ngOnDestroy = /**
  22160. * @return {?}
  22161. */
  22162. function () {
  22163. if (this._outlet) {
  22164. this._outlet.dispose();
  22165. }
  22166. };
  22167. MatMenuContent.decorators = [
  22168. { type: core.Directive, args: [{
  22169. selector: 'ng-template[matMenuContent]'
  22170. },] },
  22171. ];
  22172. /** @nocollapse */
  22173. MatMenuContent.ctorParameters = function () { return [
  22174. { type: core.TemplateRef },
  22175. { type: core.ComponentFactoryResolver },
  22176. { type: core.ApplicationRef },
  22177. { type: core.Injector },
  22178. { type: core.ViewContainerRef },
  22179. { type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] },
  22180. { type: core.ChangeDetectorRef }
  22181. ]; };
  22182. return MatMenuContent;
  22183. }());
  22184. /**
  22185. * @fileoverview added by tsickle
  22186. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  22187. */
  22188. /**
  22189. * Throws an exception for the case when menu trigger doesn't have a valid mat-menu instance
  22190. * \@docs-private
  22191. * @return {?}
  22192. */
  22193. function throwMatMenuMissingError() {
  22194. throw Error("matMenuTriggerFor: must pass in an mat-menu instance.\n\n Example:\n <mat-menu #menu=\"matMenu\"></mat-menu>\n <button [matMenuTriggerFor]=\"menu\"></button>");
  22195. }
  22196. /**
  22197. * Throws an exception for the case when menu's x-position value isn't valid.
  22198. * In other words, it doesn't match 'before' or 'after'.
  22199. * \@docs-private
  22200. * @return {?}
  22201. */
  22202. function throwMatMenuInvalidPositionX() {
  22203. throw Error("xPosition value must be either 'before' or after'.\n Example: <mat-menu xPosition=\"before\" #menu=\"matMenu\"></mat-menu>");
  22204. }
  22205. /**
  22206. * Throws an exception for the case when menu's y-position value isn't valid.
  22207. * In other words, it doesn't match 'above' or 'below'.
  22208. * \@docs-private
  22209. * @return {?}
  22210. */
  22211. function throwMatMenuInvalidPositionY() {
  22212. throw Error("yPosition value must be either 'above' or below'.\n Example: <mat-menu yPosition=\"above\" #menu=\"matMenu\"></mat-menu>");
  22213. }
  22214. /**
  22215. * @fileoverview added by tsickle
  22216. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  22217. */
  22218. /**
  22219. * Injection token used to provide the parent menu to menu-specific components.
  22220. * \@docs-private
  22221. * @type {?}
  22222. */
  22223. var MAT_MENU_PANEL = new core.InjectionToken('MAT_MENU_PANEL');
  22224. /**
  22225. * @fileoverview added by tsickle
  22226. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  22227. */
  22228. // Boilerplate for applying mixins to MatMenuItem.
  22229. /**
  22230. * \@docs-private
  22231. */
  22232. var
  22233. // Boilerplate for applying mixins to MatMenuItem.
  22234. /**
  22235. * \@docs-private
  22236. */
  22237. MatMenuItemBase = /** @class */ (function () {
  22238. function MatMenuItemBase() {
  22239. }
  22240. return MatMenuItemBase;
  22241. }());
  22242. /** @type {?} */
  22243. var _MatMenuItemMixinBase = mixinDisableRipple(mixinDisabled(MatMenuItemBase));
  22244. /**
  22245. * This directive is intended to be used inside an mat-menu tag.
  22246. * It exists mostly to set the role attribute.
  22247. */
  22248. var MatMenuItem = /** @class */ (function (_super) {
  22249. __extends(MatMenuItem, _super);
  22250. function MatMenuItem(_elementRef, document, _focusMonitor, _parentMenu) {
  22251. var _this =
  22252. // @breaking-change 8.0.0 make `_focusMonitor` and `document` required params.
  22253. _super.call(this) || this;
  22254. _this._elementRef = _elementRef;
  22255. _this._focusMonitor = _focusMonitor;
  22256. _this._parentMenu = _parentMenu;
  22257. /**
  22258. * ARIA role for the menu item.
  22259. */
  22260. _this.role = 'menuitem';
  22261. /**
  22262. * Stream that emits when the menu item is hovered.
  22263. */
  22264. _this._hovered = new rxjs.Subject();
  22265. /**
  22266. * Whether the menu item is highlighted.
  22267. */
  22268. _this._highlighted = false;
  22269. /**
  22270. * Whether the menu item acts as a trigger for a sub-menu.
  22271. */
  22272. _this._triggersSubmenu = false;
  22273. if (_focusMonitor) {
  22274. // Start monitoring the element so it gets the appropriate focused classes. We want
  22275. // to show the focus style for menu items only when the focus was not caused by a
  22276. // mouse or touch interaction.
  22277. _focusMonitor.monitor(_this._elementRef, false);
  22278. }
  22279. if (_parentMenu && _parentMenu.addItem) {
  22280. _parentMenu.addItem(_this);
  22281. }
  22282. _this._document = document;
  22283. return _this;
  22284. }
  22285. /** Focuses the menu item. */
  22286. /**
  22287. * Focuses the menu item.
  22288. * @param {?=} origin
  22289. * @param {?=} options
  22290. * @return {?}
  22291. */
  22292. MatMenuItem.prototype.focus = /**
  22293. * Focuses the menu item.
  22294. * @param {?=} origin
  22295. * @param {?=} options
  22296. * @return {?}
  22297. */
  22298. function (origin, options) {
  22299. if (origin === void 0) { origin = 'program'; }
  22300. if (this._focusMonitor) {
  22301. this._focusMonitor.focusVia(this._getHostElement(), origin, options);
  22302. }
  22303. else {
  22304. this._getHostElement().focus(options);
  22305. }
  22306. };
  22307. /**
  22308. * @return {?}
  22309. */
  22310. MatMenuItem.prototype.ngOnDestroy = /**
  22311. * @return {?}
  22312. */
  22313. function () {
  22314. if (this._focusMonitor) {
  22315. this._focusMonitor.stopMonitoring(this._elementRef);
  22316. }
  22317. if (this._parentMenu && this._parentMenu.removeItem) {
  22318. this._parentMenu.removeItem(this);
  22319. }
  22320. this._hovered.complete();
  22321. };
  22322. /** Used to set the `tabindex`. */
  22323. /**
  22324. * Used to set the `tabindex`.
  22325. * @return {?}
  22326. */
  22327. MatMenuItem.prototype._getTabIndex = /**
  22328. * Used to set the `tabindex`.
  22329. * @return {?}
  22330. */
  22331. function () {
  22332. return this.disabled ? '-1' : '0';
  22333. };
  22334. /** Returns the host DOM element. */
  22335. /**
  22336. * Returns the host DOM element.
  22337. * @return {?}
  22338. */
  22339. MatMenuItem.prototype._getHostElement = /**
  22340. * Returns the host DOM element.
  22341. * @return {?}
  22342. */
  22343. function () {
  22344. return this._elementRef.nativeElement;
  22345. };
  22346. /** Prevents the default element actions if it is disabled. */
  22347. // We have to use a `HostListener` here in order to support both Ivy and ViewEngine.
  22348. // In Ivy the `host` bindings will be merged when this class is extended, whereas in
  22349. // ViewEngine they're overwritten.
  22350. // TODO(crisbeto): we move this back into `host` once Ivy is turned on by default.
  22351. // tslint:disable-next-line:no-host-decorator-in-concrete
  22352. /**
  22353. * Prevents the default element actions if it is disabled.
  22354. * @param {?} event
  22355. * @return {?}
  22356. */
  22357. // We have to use a `HostListener` here in order to support both Ivy and ViewEngine.
  22358. // In Ivy the `host` bindings will be merged when this class is extended, whereas in
  22359. // ViewEngine they're overwritten.
  22360. // TODO(crisbeto): we move this back into `host` once Ivy is turned on by default.
  22361. // tslint:disable-next-line:no-host-decorator-in-concrete
  22362. MatMenuItem.prototype._checkDisabled = /**
  22363. * Prevents the default element actions if it is disabled.
  22364. * @param {?} event
  22365. * @return {?}
  22366. */
  22367. // We have to use a `HostListener` here in order to support both Ivy and ViewEngine.
  22368. // In Ivy the `host` bindings will be merged when this class is extended, whereas in
  22369. // ViewEngine they're overwritten.
  22370. // TODO(crisbeto): we move this back into `host` once Ivy is turned on by default.
  22371. // tslint:disable-next-line:no-host-decorator-in-concrete
  22372. function (event) {
  22373. if (this.disabled) {
  22374. event.preventDefault();
  22375. event.stopPropagation();
  22376. }
  22377. };
  22378. /** Emits to the hover stream. */
  22379. // We have to use a `HostListener` here in order to support both Ivy and ViewEngine.
  22380. // In Ivy the `host` bindings will be merged when this class is extended, whereas in
  22381. // ViewEngine they're overwritten.
  22382. // TODO(crisbeto): we move this back into `host` once Ivy is turned on by default.
  22383. // tslint:disable-next-line:no-host-decorator-in-concrete
  22384. /**
  22385. * Emits to the hover stream.
  22386. * @return {?}
  22387. */
  22388. // We have to use a `HostListener` here in order to support both Ivy and ViewEngine.
  22389. // In Ivy the `host` bindings will be merged when this class is extended, whereas in
  22390. // ViewEngine they're overwritten.
  22391. // TODO(crisbeto): we move this back into `host` once Ivy is turned on by default.
  22392. // tslint:disable-next-line:no-host-decorator-in-concrete
  22393. MatMenuItem.prototype._handleMouseEnter = /**
  22394. * Emits to the hover stream.
  22395. * @return {?}
  22396. */
  22397. // We have to use a `HostListener` here in order to support both Ivy and ViewEngine.
  22398. // In Ivy the `host` bindings will be merged when this class is extended, whereas in
  22399. // ViewEngine they're overwritten.
  22400. // TODO(crisbeto): we move this back into `host` once Ivy is turned on by default.
  22401. // tslint:disable-next-line:no-host-decorator-in-concrete
  22402. function () {
  22403. this._hovered.next(this);
  22404. };
  22405. /** Gets the label to be used when determining whether the option should be focused. */
  22406. /**
  22407. * Gets the label to be used when determining whether the option should be focused.
  22408. * @return {?}
  22409. */
  22410. MatMenuItem.prototype.getLabel = /**
  22411. * Gets the label to be used when determining whether the option should be focused.
  22412. * @return {?}
  22413. */
  22414. function () {
  22415. /** @type {?} */
  22416. var element = this._elementRef.nativeElement;
  22417. /** @type {?} */
  22418. var textNodeType = this._document ? this._document.TEXT_NODE : 3;
  22419. /** @type {?} */
  22420. var output = '';
  22421. if (element.childNodes) {
  22422. /** @type {?} */
  22423. var length_1 = element.childNodes.length;
  22424. // Go through all the top-level text nodes and extract their text.
  22425. // We skip anything that's not a text node to prevent the text from
  22426. // being thrown off by something like an icon.
  22427. for (var i = 0; i < length_1; i++) {
  22428. if (element.childNodes[i].nodeType === textNodeType) {
  22429. output += element.childNodes[i].textContent;
  22430. }
  22431. }
  22432. }
  22433. return output.trim();
  22434. };
  22435. MatMenuItem.decorators = [
  22436. { type: core.Component, args: [{selector: '[mat-menu-item]',
  22437. exportAs: 'matMenuItem',
  22438. inputs: ['disabled', 'disableRipple'],
  22439. host: {
  22440. '[attr.role]': 'role',
  22441. 'class': 'mat-menu-item',
  22442. '[class.mat-menu-item-highlighted]': '_highlighted',
  22443. '[class.mat-menu-item-submenu-trigger]': '_triggersSubmenu',
  22444. '[attr.tabindex]': '_getTabIndex()',
  22445. '[attr.aria-disabled]': 'disabled.toString()',
  22446. '[attr.disabled]': 'disabled || null',
  22447. },
  22448. changeDetection: core.ChangeDetectionStrategy.OnPush,
  22449. encapsulation: core.ViewEncapsulation.None,
  22450. template: "<ng-content></ng-content><div class=\"mat-menu-ripple\" matRipple [matRippleDisabled]=\"disableRipple || disabled\" [matRippleTrigger]=\"_getHostElement()\"></div>",
  22451. },] },
  22452. ];
  22453. /** @nocollapse */
  22454. MatMenuItem.ctorParameters = function () { return [
  22455. { type: core.ElementRef },
  22456. { type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] },
  22457. { type: a11y.FocusMonitor },
  22458. { type: undefined, decorators: [{ type: core.Inject, args: [MAT_MENU_PANEL,] }, { type: core.Optional }] }
  22459. ]; };
  22460. MatMenuItem.propDecorators = {
  22461. role: [{ type: core.Input }],
  22462. _checkDisabled: [{ type: core.HostListener, args: ['click', ['$event'],] }],
  22463. _handleMouseEnter: [{ type: core.HostListener, args: ['mouseenter',] }]
  22464. };
  22465. return MatMenuItem;
  22466. }(_MatMenuItemMixinBase));
  22467. /**
  22468. * @fileoverview added by tsickle
  22469. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  22470. */
  22471. /**
  22472. * Injection token to be used to override the default options for `mat-menu`.
  22473. * @type {?}
  22474. */
  22475. var MAT_MENU_DEFAULT_OPTIONS = new core.InjectionToken('mat-menu-default-options', {
  22476. providedIn: 'root',
  22477. factory: MAT_MENU_DEFAULT_OPTIONS_FACTORY
  22478. });
  22479. /**
  22480. * \@docs-private
  22481. * @return {?}
  22482. */
  22483. function MAT_MENU_DEFAULT_OPTIONS_FACTORY() {
  22484. return {
  22485. overlapTrigger: false,
  22486. xPosition: 'after',
  22487. yPosition: 'below',
  22488. backdropClass: 'cdk-overlay-transparent-backdrop',
  22489. };
  22490. }
  22491. /**
  22492. * Start elevation for the menu panel.
  22493. * \@docs-private
  22494. * @type {?}
  22495. */
  22496. var MAT_MENU_BASE_ELEVATION = 4;
  22497. /**
  22498. * Base class with all of the `MatMenu` functionality.
  22499. */
  22500. // tslint:disable-next-line:class-name
  22501. var _MatMenuBase = /** @class */ (function () {
  22502. function _MatMenuBase(_elementRef, _ngZone, _defaultOptions) {
  22503. this._elementRef = _elementRef;
  22504. this._ngZone = _ngZone;
  22505. this._defaultOptions = _defaultOptions;
  22506. this._xPosition = this._defaultOptions.xPosition;
  22507. this._yPosition = this._defaultOptions.yPosition;
  22508. /**
  22509. * Only the direct descendant menu items.
  22510. */
  22511. this._directDescendantItems = new core.QueryList();
  22512. /**
  22513. * Subscription to tab events on the menu panel
  22514. */
  22515. this._tabSubscription = rxjs.Subscription.EMPTY;
  22516. /**
  22517. * Config object to be passed into the menu's ngClass
  22518. */
  22519. this._classList = {};
  22520. /**
  22521. * Current state of the panel animation.
  22522. */
  22523. this._panelAnimationState = 'void';
  22524. /**
  22525. * Emits whenever an animation on the menu completes.
  22526. */
  22527. this._animationDone = new rxjs.Subject();
  22528. /**
  22529. * Class to be added to the backdrop element.
  22530. */
  22531. this.backdropClass = this._defaultOptions.backdropClass;
  22532. this._overlapTrigger = this._defaultOptions.overlapTrigger;
  22533. this._hasBackdrop = this._defaultOptions.hasBackdrop;
  22534. /**
  22535. * Event emitted when the menu is closed.
  22536. */
  22537. this.closed = new core.EventEmitter();
  22538. /**
  22539. * Event emitted when the menu is closed.
  22540. * @deprecated Switch to `closed` instead
  22541. * \@breaking-change 8.0.0
  22542. */
  22543. this.close = this.closed;
  22544. }
  22545. Object.defineProperty(_MatMenuBase.prototype, "xPosition", {
  22546. /** Position of the menu in the X axis. */
  22547. get: /**
  22548. * Position of the menu in the X axis.
  22549. * @return {?}
  22550. */
  22551. function () { return this._xPosition; },
  22552. set: /**
  22553. * @param {?} value
  22554. * @return {?}
  22555. */
  22556. function (value) {
  22557. if (value !== 'before' && value !== 'after') {
  22558. throwMatMenuInvalidPositionX();
  22559. }
  22560. this._xPosition = value;
  22561. this.setPositionClasses();
  22562. },
  22563. enumerable: true,
  22564. configurable: true
  22565. });
  22566. Object.defineProperty(_MatMenuBase.prototype, "yPosition", {
  22567. /** Position of the menu in the Y axis. */
  22568. get: /**
  22569. * Position of the menu in the Y axis.
  22570. * @return {?}
  22571. */
  22572. function () { return this._yPosition; },
  22573. set: /**
  22574. * @param {?} value
  22575. * @return {?}
  22576. */
  22577. function (value) {
  22578. if (value !== 'above' && value !== 'below') {
  22579. throwMatMenuInvalidPositionY();
  22580. }
  22581. this._yPosition = value;
  22582. this.setPositionClasses();
  22583. },
  22584. enumerable: true,
  22585. configurable: true
  22586. });
  22587. Object.defineProperty(_MatMenuBase.prototype, "overlapTrigger", {
  22588. /** Whether the menu should overlap its trigger. */
  22589. get: /**
  22590. * Whether the menu should overlap its trigger.
  22591. * @return {?}
  22592. */
  22593. function () { return this._overlapTrigger; },
  22594. set: /**
  22595. * @param {?} value
  22596. * @return {?}
  22597. */
  22598. function (value) {
  22599. this._overlapTrigger = coercion.coerceBooleanProperty(value);
  22600. },
  22601. enumerable: true,
  22602. configurable: true
  22603. });
  22604. Object.defineProperty(_MatMenuBase.prototype, "hasBackdrop", {
  22605. /** Whether the menu has a backdrop. */
  22606. get: /**
  22607. * Whether the menu has a backdrop.
  22608. * @return {?}
  22609. */
  22610. function () { return this._hasBackdrop; },
  22611. set: /**
  22612. * @param {?} value
  22613. * @return {?}
  22614. */
  22615. function (value) {
  22616. this._hasBackdrop = coercion.coerceBooleanProperty(value);
  22617. },
  22618. enumerable: true,
  22619. configurable: true
  22620. });
  22621. Object.defineProperty(_MatMenuBase.prototype, "panelClass", {
  22622. /**
  22623. * This method takes classes set on the host mat-menu element and applies them on the
  22624. * menu template that displays in the overlay container. Otherwise, it's difficult
  22625. * to style the containing menu from outside the component.
  22626. * @param classes list of class names
  22627. */
  22628. set: /**
  22629. * This method takes classes set on the host mat-menu element and applies them on the
  22630. * menu template that displays in the overlay container. Otherwise, it's difficult
  22631. * to style the containing menu from outside the component.
  22632. * @param {?} classes list of class names
  22633. * @return {?}
  22634. */
  22635. function (classes) {
  22636. var _this = this;
  22637. /** @type {?} */
  22638. var previousPanelClass = this._previousPanelClass;
  22639. if (previousPanelClass && previousPanelClass.length) {
  22640. previousPanelClass.split(' ').forEach((/**
  22641. * @param {?} className
  22642. * @return {?}
  22643. */
  22644. function (className) {
  22645. _this._classList[className] = false;
  22646. }));
  22647. }
  22648. this._previousPanelClass = classes;
  22649. if (classes && classes.length) {
  22650. classes.split(' ').forEach((/**
  22651. * @param {?} className
  22652. * @return {?}
  22653. */
  22654. function (className) {
  22655. _this._classList[className] = true;
  22656. }));
  22657. this._elementRef.nativeElement.className = '';
  22658. }
  22659. },
  22660. enumerable: true,
  22661. configurable: true
  22662. });
  22663. Object.defineProperty(_MatMenuBase.prototype, "classList", {
  22664. /**
  22665. * This method takes classes set on the host mat-menu element and applies them on the
  22666. * menu template that displays in the overlay container. Otherwise, it's difficult
  22667. * to style the containing menu from outside the component.
  22668. * @deprecated Use `panelClass` instead.
  22669. * @breaking-change 8.0.0
  22670. */
  22671. get: /**
  22672. * This method takes classes set on the host mat-menu element and applies them on the
  22673. * menu template that displays in the overlay container. Otherwise, it's difficult
  22674. * to style the containing menu from outside the component.
  22675. * @deprecated Use `panelClass` instead.
  22676. * \@breaking-change 8.0.0
  22677. * @return {?}
  22678. */
  22679. function () { return this.panelClass; },
  22680. set: /**
  22681. * @param {?} classes
  22682. * @return {?}
  22683. */
  22684. function (classes) { this.panelClass = classes; },
  22685. enumerable: true,
  22686. configurable: true
  22687. });
  22688. /**
  22689. * @return {?}
  22690. */
  22691. _MatMenuBase.prototype.ngOnInit = /**
  22692. * @return {?}
  22693. */
  22694. function () {
  22695. this.setPositionClasses();
  22696. };
  22697. /**
  22698. * @return {?}
  22699. */
  22700. _MatMenuBase.prototype.ngAfterContentInit = /**
  22701. * @return {?}
  22702. */
  22703. function () {
  22704. var _this = this;
  22705. this._updateDirectDescendants();
  22706. this._keyManager = new a11y.FocusKeyManager(this._directDescendantItems).withWrap().withTypeAhead();
  22707. this._tabSubscription = this._keyManager.tabOut.subscribe((/**
  22708. * @return {?}
  22709. */
  22710. function () { return _this.closed.emit('tab'); }));
  22711. };
  22712. /**
  22713. * @return {?}
  22714. */
  22715. _MatMenuBase.prototype.ngOnDestroy = /**
  22716. * @return {?}
  22717. */
  22718. function () {
  22719. this._directDescendantItems.destroy();
  22720. this._tabSubscription.unsubscribe();
  22721. this.closed.complete();
  22722. };
  22723. /** Stream that emits whenever the hovered menu item changes. */
  22724. /**
  22725. * Stream that emits whenever the hovered menu item changes.
  22726. * @return {?}
  22727. */
  22728. _MatMenuBase.prototype._hovered = /**
  22729. * Stream that emits whenever the hovered menu item changes.
  22730. * @return {?}
  22731. */
  22732. function () {
  22733. // Coerce the `changes` property because Angular types it as `Observable<any>`
  22734. /** @type {?} */
  22735. var itemChanges = (/** @type {?} */ (this._directDescendantItems.changes));
  22736. return itemChanges.pipe(operators.startWith(this._directDescendantItems), operators.switchMap((/**
  22737. * @param {?} items
  22738. * @return {?}
  22739. */
  22740. function (items) { return rxjs.merge.apply(void 0, items.map((/**
  22741. * @param {?} item
  22742. * @return {?}
  22743. */
  22744. function (item) { return item._hovered; }))); })));
  22745. };
  22746. /*
  22747. * Registers a menu item with the menu.
  22748. * @docs-private
  22749. * @deprecated No longer being used. To be removed.
  22750. * @breaking-change 9.0.0
  22751. */
  22752. /*
  22753. * Registers a menu item with the menu.
  22754. * @docs-private
  22755. * @deprecated No longer being used. To be removed.
  22756. * @breaking-change 9.0.0
  22757. */
  22758. /**
  22759. * @param {?} _item
  22760. * @return {?}
  22761. */
  22762. _MatMenuBase.prototype.addItem = /*
  22763. * Registers a menu item with the menu.
  22764. * @docs-private
  22765. * @deprecated No longer being used. To be removed.
  22766. * @breaking-change 9.0.0
  22767. */
  22768. /**
  22769. * @param {?} _item
  22770. * @return {?}
  22771. */
  22772. function (_item) { };
  22773. /**
  22774. * Removes an item from the menu.
  22775. * @docs-private
  22776. * @deprecated No longer being used. To be removed.
  22777. * @breaking-change 9.0.0
  22778. */
  22779. /**
  22780. * Removes an item from the menu.
  22781. * \@docs-private
  22782. * @deprecated No longer being used. To be removed.
  22783. * \@breaking-change 9.0.0
  22784. * @param {?} _item
  22785. * @return {?}
  22786. */
  22787. _MatMenuBase.prototype.removeItem = /**
  22788. * Removes an item from the menu.
  22789. * \@docs-private
  22790. * @deprecated No longer being used. To be removed.
  22791. * \@breaking-change 9.0.0
  22792. * @param {?} _item
  22793. * @return {?}
  22794. */
  22795. function (_item) { };
  22796. /** Handle a keyboard event from the menu, delegating to the appropriate action. */
  22797. /**
  22798. * Handle a keyboard event from the menu, delegating to the appropriate action.
  22799. * @param {?} event
  22800. * @return {?}
  22801. */
  22802. _MatMenuBase.prototype._handleKeydown = /**
  22803. * Handle a keyboard event from the menu, delegating to the appropriate action.
  22804. * @param {?} event
  22805. * @return {?}
  22806. */
  22807. function (event) {
  22808. /** @type {?} */
  22809. var keyCode = event.keyCode;
  22810. /** @type {?} */
  22811. var manager = this._keyManager;
  22812. switch (keyCode) {
  22813. case keycodes.ESCAPE:
  22814. if (!keycodes.hasModifierKey(event)) {
  22815. event.preventDefault();
  22816. this.closed.emit('keydown');
  22817. }
  22818. break;
  22819. case keycodes.LEFT_ARROW:
  22820. if (this.parentMenu && this.direction === 'ltr') {
  22821. this.closed.emit('keydown');
  22822. }
  22823. break;
  22824. case keycodes.RIGHT_ARROW:
  22825. if (this.parentMenu && this.direction === 'rtl') {
  22826. this.closed.emit('keydown');
  22827. }
  22828. break;
  22829. case keycodes.HOME:
  22830. case keycodes.END:
  22831. if (!keycodes.hasModifierKey(event)) {
  22832. keyCode === keycodes.HOME ? manager.setFirstItemActive() : manager.setLastItemActive();
  22833. event.preventDefault();
  22834. }
  22835. break;
  22836. default:
  22837. if (keyCode === keycodes.UP_ARROW || keyCode === keycodes.DOWN_ARROW) {
  22838. manager.setFocusOrigin('keyboard');
  22839. }
  22840. manager.onKeydown(event);
  22841. }
  22842. };
  22843. /**
  22844. * Focus the first item in the menu.
  22845. * @param origin Action from which the focus originated. Used to set the correct styling.
  22846. */
  22847. /**
  22848. * Focus the first item in the menu.
  22849. * @param {?=} origin Action from which the focus originated. Used to set the correct styling.
  22850. * @return {?}
  22851. */
  22852. _MatMenuBase.prototype.focusFirstItem = /**
  22853. * Focus the first item in the menu.
  22854. * @param {?=} origin Action from which the focus originated. Used to set the correct styling.
  22855. * @return {?}
  22856. */
  22857. function (origin) {
  22858. var _this = this;
  22859. if (origin === void 0) { origin = 'program'; }
  22860. // When the content is rendered lazily, it takes a bit before the items are inside the DOM.
  22861. if (this.lazyContent) {
  22862. this._ngZone.onStable.asObservable()
  22863. .pipe(operators.take(1))
  22864. .subscribe((/**
  22865. * @return {?}
  22866. */
  22867. function () { return _this._keyManager.setFocusOrigin(origin).setFirstItemActive(); }));
  22868. }
  22869. else {
  22870. this._keyManager.setFocusOrigin(origin).setFirstItemActive();
  22871. }
  22872. };
  22873. /**
  22874. * Resets the active item in the menu. This is used when the menu is opened, allowing
  22875. * the user to start from the first option when pressing the down arrow.
  22876. */
  22877. /**
  22878. * Resets the active item in the menu. This is used when the menu is opened, allowing
  22879. * the user to start from the first option when pressing the down arrow.
  22880. * @return {?}
  22881. */
  22882. _MatMenuBase.prototype.resetActiveItem = /**
  22883. * Resets the active item in the menu. This is used when the menu is opened, allowing
  22884. * the user to start from the first option when pressing the down arrow.
  22885. * @return {?}
  22886. */
  22887. function () {
  22888. this._keyManager.setActiveItem(-1);
  22889. };
  22890. /**
  22891. * Sets the menu panel elevation.
  22892. * @param depth Number of parent menus that come before the menu.
  22893. */
  22894. /**
  22895. * Sets the menu panel elevation.
  22896. * @param {?} depth Number of parent menus that come before the menu.
  22897. * @return {?}
  22898. */
  22899. _MatMenuBase.prototype.setElevation = /**
  22900. * Sets the menu panel elevation.
  22901. * @param {?} depth Number of parent menus that come before the menu.
  22902. * @return {?}
  22903. */
  22904. function (depth) {
  22905. // The elevation starts at the base and increases by one for each level.
  22906. /** @type {?} */
  22907. var newElevation = "mat-elevation-z" + (MAT_MENU_BASE_ELEVATION + depth);
  22908. /** @type {?} */
  22909. var customElevation = Object.keys(this._classList).find((/**
  22910. * @param {?} c
  22911. * @return {?}
  22912. */
  22913. function (c) { return c.startsWith('mat-elevation-z'); }));
  22914. if (!customElevation || customElevation === this._previousElevation) {
  22915. if (this._previousElevation) {
  22916. this._classList[this._previousElevation] = false;
  22917. }
  22918. this._classList[newElevation] = true;
  22919. this._previousElevation = newElevation;
  22920. }
  22921. };
  22922. /**
  22923. * Adds classes to the menu panel based on its position. Can be used by
  22924. * consumers to add specific styling based on the position.
  22925. * @param posX Position of the menu along the x axis.
  22926. * @param posY Position of the menu along the y axis.
  22927. * @docs-private
  22928. */
  22929. /**
  22930. * Adds classes to the menu panel based on its position. Can be used by
  22931. * consumers to add specific styling based on the position.
  22932. * \@docs-private
  22933. * @param {?=} posX Position of the menu along the x axis.
  22934. * @param {?=} posY Position of the menu along the y axis.
  22935. * @return {?}
  22936. */
  22937. _MatMenuBase.prototype.setPositionClasses = /**
  22938. * Adds classes to the menu panel based on its position. Can be used by
  22939. * consumers to add specific styling based on the position.
  22940. * \@docs-private
  22941. * @param {?=} posX Position of the menu along the x axis.
  22942. * @param {?=} posY Position of the menu along the y axis.
  22943. * @return {?}
  22944. */
  22945. function (posX, posY) {
  22946. if (posX === void 0) { posX = this.xPosition; }
  22947. if (posY === void 0) { posY = this.yPosition; }
  22948. /** @type {?} */
  22949. var classes = this._classList;
  22950. classes['mat-menu-before'] = posX === 'before';
  22951. classes['mat-menu-after'] = posX === 'after';
  22952. classes['mat-menu-above'] = posY === 'above';
  22953. classes['mat-menu-below'] = posY === 'below';
  22954. };
  22955. /** Starts the enter animation. */
  22956. /**
  22957. * Starts the enter animation.
  22958. * @return {?}
  22959. */
  22960. _MatMenuBase.prototype._startAnimation = /**
  22961. * Starts the enter animation.
  22962. * @return {?}
  22963. */
  22964. function () {
  22965. // @breaking-change 8.0.0 Combine with _resetAnimation.
  22966. this._panelAnimationState = 'enter';
  22967. };
  22968. /** Resets the panel animation to its initial state. */
  22969. /**
  22970. * Resets the panel animation to its initial state.
  22971. * @return {?}
  22972. */
  22973. _MatMenuBase.prototype._resetAnimation = /**
  22974. * Resets the panel animation to its initial state.
  22975. * @return {?}
  22976. */
  22977. function () {
  22978. // @breaking-change 8.0.0 Combine with _startAnimation.
  22979. this._panelAnimationState = 'void';
  22980. };
  22981. /** Callback that is invoked when the panel animation completes. */
  22982. /**
  22983. * Callback that is invoked when the panel animation completes.
  22984. * @param {?} event
  22985. * @return {?}
  22986. */
  22987. _MatMenuBase.prototype._onAnimationDone = /**
  22988. * Callback that is invoked when the panel animation completes.
  22989. * @param {?} event
  22990. * @return {?}
  22991. */
  22992. function (event) {
  22993. this._animationDone.next(event);
  22994. this._isAnimating = false;
  22995. };
  22996. /**
  22997. * @param {?} event
  22998. * @return {?}
  22999. */
  23000. _MatMenuBase.prototype._onAnimationStart = /**
  23001. * @param {?} event
  23002. * @return {?}
  23003. */
  23004. function (event) {
  23005. this._isAnimating = true;
  23006. // Scroll the content element to the top as soon as the animation starts. This is necessary,
  23007. // because we move focus to the first item while it's still being animated, which can throw
  23008. // the browser off when it determines the scroll position. Alternatively we can move focus
  23009. // when the animation is done, however moving focus asynchronously will interrupt screen
  23010. // readers which are in the process of reading out the menu already. We take the `element`
  23011. // from the `event` since we can't use a `ViewChild` to access the pane.
  23012. if (event.toState === 'enter' && this._keyManager.activeItemIndex === 0) {
  23013. event.element.scrollTop = 0;
  23014. }
  23015. };
  23016. /**
  23017. * Sets up a stream that will keep track of any newly-added menu items and will update the list
  23018. * of direct descendants. We collect the descendants this way, because `_allItems` can include
  23019. * items that are part of child menus, and using a custom way of registering items is unreliable
  23020. * when it comes to maintaining the item order.
  23021. */
  23022. /**
  23023. * Sets up a stream that will keep track of any newly-added menu items and will update the list
  23024. * of direct descendants. We collect the descendants this way, because `_allItems` can include
  23025. * items that are part of child menus, and using a custom way of registering items is unreliable
  23026. * when it comes to maintaining the item order.
  23027. * @private
  23028. * @return {?}
  23029. */
  23030. _MatMenuBase.prototype._updateDirectDescendants = /**
  23031. * Sets up a stream that will keep track of any newly-added menu items and will update the list
  23032. * of direct descendants. We collect the descendants this way, because `_allItems` can include
  23033. * items that are part of child menus, and using a custom way of registering items is unreliable
  23034. * when it comes to maintaining the item order.
  23035. * @private
  23036. * @return {?}
  23037. */
  23038. function () {
  23039. var _this = this;
  23040. this._allItems.changes
  23041. .pipe(operators.startWith(this._allItems))
  23042. .subscribe((/**
  23043. * @param {?} items
  23044. * @return {?}
  23045. */
  23046. function (items) {
  23047. _this._directDescendantItems.reset(items.filter((/**
  23048. * @param {?} item
  23049. * @return {?}
  23050. */
  23051. function (item) { return item._parentMenu === _this; })));
  23052. _this._directDescendantItems.notifyOnChanges();
  23053. }));
  23054. };
  23055. /** @nocollapse */
  23056. _MatMenuBase.ctorParameters = function () { return [
  23057. { type: core.ElementRef },
  23058. { type: core.NgZone },
  23059. { type: undefined, decorators: [{ type: core.Inject, args: [MAT_MENU_DEFAULT_OPTIONS,] }] }
  23060. ]; };
  23061. _MatMenuBase.propDecorators = {
  23062. _allItems: [{ type: core.ContentChildren, args: [MatMenuItem, { descendants: true },] }],
  23063. backdropClass: [{ type: core.Input }],
  23064. xPosition: [{ type: core.Input }],
  23065. yPosition: [{ type: core.Input }],
  23066. templateRef: [{ type: core.ViewChild, args: [core.TemplateRef, { static: false },] }],
  23067. items: [{ type: core.ContentChildren, args: [MatMenuItem,] }],
  23068. lazyContent: [{ type: core.ContentChild, args: [MatMenuContent, { static: false },] }],
  23069. overlapTrigger: [{ type: core.Input }],
  23070. hasBackdrop: [{ type: core.Input }],
  23071. panelClass: [{ type: core.Input, args: ['class',] }],
  23072. classList: [{ type: core.Input }],
  23073. closed: [{ type: core.Output }],
  23074. close: [{ type: core.Output }]
  23075. };
  23076. return _MatMenuBase;
  23077. }());
  23078. /**
  23079. * \@docs-private We show the "_MatMenu" class as "MatMenu" in the docs.
  23080. */
  23081. var /**
  23082. * \@docs-private We show the "_MatMenu" class as "MatMenu" in the docs.
  23083. */
  23084. MatMenu = /** @class */ (function (_super) {
  23085. __extends(MatMenu, _super);
  23086. function MatMenu() {
  23087. return _super !== null && _super.apply(this, arguments) || this;
  23088. }
  23089. return MatMenu;
  23090. }(_MatMenuBase));
  23091. // Note on the weird inheritance setup: we need three classes, because the MDC-based menu has to
  23092. // extend `MatMenu`, however keeping a reference to it will cause the inlined template and styles
  23093. // to be retained as well. The MDC menu also has to provide itself as a `MatMenu` in order for
  23094. // queries and DI to work correctly, while still not referencing the actual menu class.
  23095. // Class responsibility is split up as follows:
  23096. // * _MatMenuBase - provides all the functionality without any of the Angular metadata.
  23097. // * MatMenu - keeps the same name symbol name as the current menu and
  23098. // is used as a provider for DI and query purposes.
  23099. // * _MatMenu - the actual menu component implementation with the Angular metadata that should
  23100. // be tree shaken away for MDC.
  23101. /**
  23102. * \@docs-public MatMenu
  23103. */
  23104. var _MatMenu = /** @class */ (function (_super) {
  23105. __extends(_MatMenu, _super);
  23106. function _MatMenu(elementRef, ngZone, defaultOptions) {
  23107. return _super.call(this, elementRef, ngZone, defaultOptions) || this;
  23108. }
  23109. _MatMenu.decorators = [
  23110. { type: core.Component, args: [{selector: 'mat-menu',
  23111. template: "<ng-template><div class=\"mat-menu-panel\" [ngClass]=\"_classList\" (keydown)=\"_handleKeydown($event)\" (click)=\"closed.emit('click')\" [@transformMenu]=\"_panelAnimationState\" (@transformMenu.start)=\"_onAnimationStart($event)\" (@transformMenu.done)=\"_onAnimationDone($event)\" tabindex=\"-1\" role=\"menu\"><div class=\"mat-menu-content\"><ng-content></ng-content></div></div></ng-template>",
  23112. styles: [".mat-menu-panel{min-width:112px;max-width:280px;overflow:auto;-webkit-overflow-scrolling:touch;max-height:calc(100vh - 48px);border-radius:4px;outline:0;min-height:64px}.mat-menu-panel.ng-animating{pointer-events:none}@media (-ms-high-contrast:active){.mat-menu-panel{outline:solid 1px}}.mat-menu-content:not(:empty){padding-top:8px;padding-bottom:8px}.mat-menu-item{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer;outline:0;border:none;-webkit-tap-highlight-color:transparent;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}.mat-menu-item::-moz-focus-inner{border:0}.mat-menu-item[disabled]{cursor:default}[dir=rtl] .mat-menu-item{text-align:right}.mat-menu-item .mat-icon{margin-right:16px;vertical-align:middle}.mat-menu-item .mat-icon svg{vertical-align:top}[dir=rtl] .mat-menu-item .mat-icon{margin-left:16px;margin-right:0}.mat-menu-item[disabled]{pointer-events:none}@media (-ms-high-contrast:active){.mat-menu-item-highlighted,.mat-menu-item.cdk-keyboard-focused,.mat-menu-item.cdk-program-focused{outline:dotted 1px}}.mat-menu-item-submenu-trigger{padding-right:32px}.mat-menu-item-submenu-trigger::after{width:0;height:0;border-style:solid;border-width:5px 0 5px 5px;border-color:transparent transparent transparent currentColor;content:'';display:inline-block;position:absolute;top:50%;right:16px;transform:translateY(-50%)}[dir=rtl] .mat-menu-item-submenu-trigger{padding-right:16px;padding-left:32px}[dir=rtl] .mat-menu-item-submenu-trigger::after{right:auto;left:16px;transform:rotateY(180deg) translateY(-50%)}button.mat-menu-item{width:100%}.mat-menu-item .mat-menu-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}"],
  23113. changeDetection: core.ChangeDetectionStrategy.OnPush,
  23114. encapsulation: core.ViewEncapsulation.None,
  23115. exportAs: 'matMenu',
  23116. animations: [
  23117. matMenuAnimations.transformMenu,
  23118. matMenuAnimations.fadeInItems
  23119. ],
  23120. providers: [
  23121. { provide: MAT_MENU_PANEL, useExisting: MatMenu },
  23122. { provide: MatMenu, useExisting: _MatMenu }
  23123. ]
  23124. },] },
  23125. ];
  23126. /** @nocollapse */
  23127. _MatMenu.ctorParameters = function () { return [
  23128. { type: core.ElementRef },
  23129. { type: core.NgZone },
  23130. { type: undefined, decorators: [{ type: core.Inject, args: [MAT_MENU_DEFAULT_OPTIONS,] }] }
  23131. ]; };
  23132. return _MatMenu;
  23133. }(MatMenu));
  23134. /**
  23135. * @fileoverview added by tsickle
  23136. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  23137. */
  23138. /**
  23139. * Injection token that determines the scroll handling while the menu is open.
  23140. * @type {?}
  23141. */
  23142. var MAT_MENU_SCROLL_STRATEGY = new core.InjectionToken('mat-menu-scroll-strategy');
  23143. /**
  23144. * \@docs-private
  23145. * @param {?} overlay
  23146. * @return {?}
  23147. */
  23148. function MAT_MENU_SCROLL_STRATEGY_FACTORY(overlay$$1) {
  23149. return (/**
  23150. * @return {?}
  23151. */
  23152. function () { return overlay$$1.scrollStrategies.reposition(); });
  23153. }
  23154. /**
  23155. * \@docs-private
  23156. * @type {?}
  23157. */
  23158. var MAT_MENU_SCROLL_STRATEGY_FACTORY_PROVIDER = {
  23159. provide: MAT_MENU_SCROLL_STRATEGY,
  23160. deps: [overlay.Overlay],
  23161. useFactory: MAT_MENU_SCROLL_STRATEGY_FACTORY,
  23162. };
  23163. /**
  23164. * Default top padding of the menu panel.
  23165. * @type {?}
  23166. */
  23167. var MENU_PANEL_TOP_PADDING = 8;
  23168. /**
  23169. * Options for binding a passive event listener.
  23170. * @type {?}
  23171. */
  23172. var passiveEventListenerOptions = platform.normalizePassiveListenerOptions({ passive: true });
  23173. // TODO(andrewseguin): Remove the kebab versions in favor of camelCased attribute selectors
  23174. /**
  23175. * This directive is intended to be used in conjunction with an mat-menu tag. It is
  23176. * responsible for toggling the display of the provided menu instance.
  23177. */
  23178. var MatMenuTrigger = /** @class */ (function () {
  23179. function MatMenuTrigger(_overlay, _element, _viewContainerRef, scrollStrategy, _parentMenu, _menuItemInstance, _dir, _focusMonitor) {
  23180. var _this = this;
  23181. this._overlay = _overlay;
  23182. this._element = _element;
  23183. this._viewContainerRef = _viewContainerRef;
  23184. this._parentMenu = _parentMenu;
  23185. this._menuItemInstance = _menuItemInstance;
  23186. this._dir = _dir;
  23187. this._focusMonitor = _focusMonitor;
  23188. this._overlayRef = null;
  23189. this._menuOpen = false;
  23190. this._closingActionsSubscription = rxjs.Subscription.EMPTY;
  23191. this._hoverSubscription = rxjs.Subscription.EMPTY;
  23192. this._menuCloseSubscription = rxjs.Subscription.EMPTY;
  23193. /**
  23194. * Handles touch start events on the trigger.
  23195. * Needs to be an arrow function so we can easily use addEventListener and removeEventListener.
  23196. */
  23197. this._handleTouchStart = (/**
  23198. * @return {?}
  23199. */
  23200. function () { return _this._openedBy = 'touch'; });
  23201. // Tracking input type is necessary so it's possible to only auto-focus
  23202. // the first item of the list when the menu is opened via the keyboard
  23203. this._openedBy = null;
  23204. /**
  23205. * Whether focus should be restored when the menu is closed.
  23206. * Note that disabling this option can have accessibility implications
  23207. * and it's up to you to manage focus, if you decide to turn it off.
  23208. */
  23209. this.restoreFocus = true;
  23210. /**
  23211. * Event emitted when the associated menu is opened.
  23212. */
  23213. this.menuOpened = new core.EventEmitter();
  23214. /**
  23215. * Event emitted when the associated menu is opened.
  23216. * @deprecated Switch to `menuOpened` instead
  23217. * \@breaking-change 8.0.0
  23218. */
  23219. // tslint:disable-next-line:no-output-on-prefix
  23220. this.onMenuOpen = this.menuOpened;
  23221. /**
  23222. * Event emitted when the associated menu is closed.
  23223. */
  23224. this.menuClosed = new core.EventEmitter();
  23225. /**
  23226. * Event emitted when the associated menu is closed.
  23227. * @deprecated Switch to `menuClosed` instead
  23228. * \@breaking-change 8.0.0
  23229. */
  23230. // tslint:disable-next-line:no-output-on-prefix
  23231. this.onMenuClose = this.menuClosed;
  23232. _element.nativeElement.addEventListener('touchstart', this._handleTouchStart, passiveEventListenerOptions);
  23233. if (_menuItemInstance) {
  23234. _menuItemInstance._triggersSubmenu = this.triggersSubmenu();
  23235. }
  23236. this._scrollStrategy = scrollStrategy;
  23237. }
  23238. Object.defineProperty(MatMenuTrigger.prototype, "_deprecatedMatMenuTriggerFor", {
  23239. /**
  23240. * @deprecated
  23241. * @breaking-change 8.0.0
  23242. */
  23243. get: /**
  23244. * @deprecated
  23245. * \@breaking-change 8.0.0
  23246. * @return {?}
  23247. */
  23248. function () { return this.menu; },
  23249. set: /**
  23250. * @param {?} v
  23251. * @return {?}
  23252. */
  23253. function (v) {
  23254. this.menu = v;
  23255. },
  23256. enumerable: true,
  23257. configurable: true
  23258. });
  23259. Object.defineProperty(MatMenuTrigger.prototype, "menu", {
  23260. /** References the menu instance that the trigger is associated with. */
  23261. get: /**
  23262. * References the menu instance that the trigger is associated with.
  23263. * @return {?}
  23264. */
  23265. function () { return this._menu; },
  23266. set: /**
  23267. * @param {?} menu
  23268. * @return {?}
  23269. */
  23270. function (menu) {
  23271. var _this = this;
  23272. if (menu === this._menu) {
  23273. return;
  23274. }
  23275. this._menu = menu;
  23276. this._menuCloseSubscription.unsubscribe();
  23277. if (menu) {
  23278. this._menuCloseSubscription = menu.close.asObservable().subscribe((/**
  23279. * @param {?} reason
  23280. * @return {?}
  23281. */
  23282. function (reason) {
  23283. _this._destroyMenu();
  23284. // If a click closed the menu, we should close the entire chain of nested menus.
  23285. if ((reason === 'click' || reason === 'tab') && _this._parentMenu) {
  23286. _this._parentMenu.closed.emit(reason);
  23287. }
  23288. }));
  23289. }
  23290. },
  23291. enumerable: true,
  23292. configurable: true
  23293. });
  23294. /**
  23295. * @return {?}
  23296. */
  23297. MatMenuTrigger.prototype.ngAfterContentInit = /**
  23298. * @return {?}
  23299. */
  23300. function () {
  23301. this._checkMenu();
  23302. this._handleHover();
  23303. };
  23304. /**
  23305. * @return {?}
  23306. */
  23307. MatMenuTrigger.prototype.ngOnDestroy = /**
  23308. * @return {?}
  23309. */
  23310. function () {
  23311. if (this._overlayRef) {
  23312. this._overlayRef.dispose();
  23313. this._overlayRef = null;
  23314. }
  23315. this._element.nativeElement.removeEventListener('touchstart', this._handleTouchStart, passiveEventListenerOptions);
  23316. this._menuCloseSubscription.unsubscribe();
  23317. this._closingActionsSubscription.unsubscribe();
  23318. this._hoverSubscription.unsubscribe();
  23319. };
  23320. Object.defineProperty(MatMenuTrigger.prototype, "menuOpen", {
  23321. /** Whether the menu is open. */
  23322. get: /**
  23323. * Whether the menu is open.
  23324. * @return {?}
  23325. */
  23326. function () {
  23327. return this._menuOpen;
  23328. },
  23329. enumerable: true,
  23330. configurable: true
  23331. });
  23332. Object.defineProperty(MatMenuTrigger.prototype, "dir", {
  23333. /** The text direction of the containing app. */
  23334. get: /**
  23335. * The text direction of the containing app.
  23336. * @return {?}
  23337. */
  23338. function () {
  23339. return this._dir && this._dir.value === 'rtl' ? 'rtl' : 'ltr';
  23340. },
  23341. enumerable: true,
  23342. configurable: true
  23343. });
  23344. /** Whether the menu triggers a sub-menu or a top-level one. */
  23345. /**
  23346. * Whether the menu triggers a sub-menu or a top-level one.
  23347. * @return {?}
  23348. */
  23349. MatMenuTrigger.prototype.triggersSubmenu = /**
  23350. * Whether the menu triggers a sub-menu or a top-level one.
  23351. * @return {?}
  23352. */
  23353. function () {
  23354. return !!(this._menuItemInstance && this._parentMenu);
  23355. };
  23356. /** Toggles the menu between the open and closed states. */
  23357. /**
  23358. * Toggles the menu between the open and closed states.
  23359. * @return {?}
  23360. */
  23361. MatMenuTrigger.prototype.toggleMenu = /**
  23362. * Toggles the menu between the open and closed states.
  23363. * @return {?}
  23364. */
  23365. function () {
  23366. return this._menuOpen ? this.closeMenu() : this.openMenu();
  23367. };
  23368. /** Opens the menu. */
  23369. /**
  23370. * Opens the menu.
  23371. * @return {?}
  23372. */
  23373. MatMenuTrigger.prototype.openMenu = /**
  23374. * Opens the menu.
  23375. * @return {?}
  23376. */
  23377. function () {
  23378. var _this = this;
  23379. if (this._menuOpen) {
  23380. return;
  23381. }
  23382. this._checkMenu();
  23383. /** @type {?} */
  23384. var overlayRef = this._createOverlay();
  23385. /** @type {?} */
  23386. var overlayConfig = overlayRef.getConfig();
  23387. this._setPosition((/** @type {?} */ (overlayConfig.positionStrategy)));
  23388. overlayConfig.hasBackdrop = this.menu.hasBackdrop == null ? !this.triggersSubmenu() :
  23389. this.menu.hasBackdrop;
  23390. overlayRef.attach(this._getPortal());
  23391. if (this.menu.lazyContent) {
  23392. this.menu.lazyContent.attach(this.menuData);
  23393. }
  23394. this._closingActionsSubscription = this._menuClosingActions().subscribe((/**
  23395. * @return {?}
  23396. */
  23397. function () { return _this.closeMenu(); }));
  23398. this._initMenu();
  23399. if (this.menu instanceof MatMenu) {
  23400. this.menu._startAnimation();
  23401. }
  23402. };
  23403. /** Closes the menu. */
  23404. /**
  23405. * Closes the menu.
  23406. * @return {?}
  23407. */
  23408. MatMenuTrigger.prototype.closeMenu = /**
  23409. * Closes the menu.
  23410. * @return {?}
  23411. */
  23412. function () {
  23413. this.menu.close.emit();
  23414. };
  23415. /**
  23416. * Focuses the menu trigger.
  23417. * @param origin Source of the menu trigger's focus.
  23418. */
  23419. /**
  23420. * Focuses the menu trigger.
  23421. * @param {?=} origin Source of the menu trigger's focus.
  23422. * @param {?=} options
  23423. * @return {?}
  23424. */
  23425. MatMenuTrigger.prototype.focus = /**
  23426. * Focuses the menu trigger.
  23427. * @param {?=} origin Source of the menu trigger's focus.
  23428. * @param {?=} options
  23429. * @return {?}
  23430. */
  23431. function (origin, options) {
  23432. if (origin === void 0) { origin = 'program'; }
  23433. if (this._focusMonitor) {
  23434. this._focusMonitor.focusVia(this._element, origin, options);
  23435. }
  23436. else {
  23437. this._element.nativeElement.focus(options);
  23438. }
  23439. };
  23440. /** Closes the menu and does the necessary cleanup. */
  23441. /**
  23442. * Closes the menu and does the necessary cleanup.
  23443. * @private
  23444. * @return {?}
  23445. */
  23446. MatMenuTrigger.prototype._destroyMenu = /**
  23447. * Closes the menu and does the necessary cleanup.
  23448. * @private
  23449. * @return {?}
  23450. */
  23451. function () {
  23452. var _this = this;
  23453. if (!this._overlayRef || !this.menuOpen) {
  23454. return;
  23455. }
  23456. /** @type {?} */
  23457. var menu = this.menu;
  23458. this._closingActionsSubscription.unsubscribe();
  23459. this._overlayRef.detach();
  23460. if (menu instanceof MatMenu) {
  23461. menu._resetAnimation();
  23462. if (menu.lazyContent) {
  23463. // Wait for the exit animation to finish before detaching the content.
  23464. menu._animationDone
  23465. .pipe(operators.filter((/**
  23466. * @param {?} event
  23467. * @return {?}
  23468. */
  23469. function (event) { return event.toState === 'void'; })), operators.take(1),
  23470. // Interrupt if the content got re-attached.
  23471. operators.takeUntil(menu.lazyContent._attached))
  23472. .subscribe({
  23473. next: (/**
  23474. * @return {?}
  23475. */
  23476. function () { return (/** @type {?} */ (menu.lazyContent)).detach(); }),
  23477. // No matter whether the content got re-attached, reset the menu.
  23478. complete: (/**
  23479. * @return {?}
  23480. */
  23481. function () { return _this._resetMenu(); })
  23482. });
  23483. }
  23484. else {
  23485. this._resetMenu();
  23486. }
  23487. }
  23488. else {
  23489. this._resetMenu();
  23490. if (menu.lazyContent) {
  23491. menu.lazyContent.detach();
  23492. }
  23493. }
  23494. };
  23495. /**
  23496. * This method sets the menu state to open and focuses the first item if
  23497. * the menu was opened via the keyboard.
  23498. */
  23499. /**
  23500. * This method sets the menu state to open and focuses the first item if
  23501. * the menu was opened via the keyboard.
  23502. * @private
  23503. * @return {?}
  23504. */
  23505. MatMenuTrigger.prototype._initMenu = /**
  23506. * This method sets the menu state to open and focuses the first item if
  23507. * the menu was opened via the keyboard.
  23508. * @private
  23509. * @return {?}
  23510. */
  23511. function () {
  23512. this.menu.parentMenu = this.triggersSubmenu() ? this._parentMenu : undefined;
  23513. this.menu.direction = this.dir;
  23514. this._setMenuElevation();
  23515. this._setIsMenuOpen(true);
  23516. this.menu.focusFirstItem(this._openedBy || 'program');
  23517. };
  23518. /** Updates the menu elevation based on the amount of parent menus that it has. */
  23519. /**
  23520. * Updates the menu elevation based on the amount of parent menus that it has.
  23521. * @private
  23522. * @return {?}
  23523. */
  23524. MatMenuTrigger.prototype._setMenuElevation = /**
  23525. * Updates the menu elevation based on the amount of parent menus that it has.
  23526. * @private
  23527. * @return {?}
  23528. */
  23529. function () {
  23530. if (this.menu.setElevation) {
  23531. /** @type {?} */
  23532. var depth = 0;
  23533. /** @type {?} */
  23534. var parentMenu = this.menu.parentMenu;
  23535. while (parentMenu) {
  23536. depth++;
  23537. parentMenu = parentMenu.parentMenu;
  23538. }
  23539. this.menu.setElevation(depth);
  23540. }
  23541. };
  23542. /**
  23543. * This method resets the menu when it's closed, most importantly restoring
  23544. * focus to the menu trigger if the menu was opened via the keyboard.
  23545. */
  23546. /**
  23547. * This method resets the menu when it's closed, most importantly restoring
  23548. * focus to the menu trigger if the menu was opened via the keyboard.
  23549. * @private
  23550. * @return {?}
  23551. */
  23552. MatMenuTrigger.prototype._resetMenu = /**
  23553. * This method resets the menu when it's closed, most importantly restoring
  23554. * focus to the menu trigger if the menu was opened via the keyboard.
  23555. * @private
  23556. * @return {?}
  23557. */
  23558. function () {
  23559. this._setIsMenuOpen(false);
  23560. // We should reset focus if the user is navigating using a keyboard or
  23561. // if we have a top-level trigger which might cause focus to be lost
  23562. // when clicking on the backdrop.
  23563. if (this.restoreFocus) {
  23564. if (!this._openedBy) {
  23565. // Note that the focus style will show up both for `program` and
  23566. // `keyboard` so we don't have to specify which one it is.
  23567. this.focus();
  23568. }
  23569. else if (!this.triggersSubmenu()) {
  23570. this.focus(this._openedBy);
  23571. }
  23572. }
  23573. this._openedBy = null;
  23574. };
  23575. // set state rather than toggle to support triggers sharing a menu
  23576. // set state rather than toggle to support triggers sharing a menu
  23577. /**
  23578. * @private
  23579. * @param {?} isOpen
  23580. * @return {?}
  23581. */
  23582. MatMenuTrigger.prototype._setIsMenuOpen =
  23583. // set state rather than toggle to support triggers sharing a menu
  23584. /**
  23585. * @private
  23586. * @param {?} isOpen
  23587. * @return {?}
  23588. */
  23589. function (isOpen) {
  23590. this._menuOpen = isOpen;
  23591. this._menuOpen ? this.menuOpened.emit() : this.menuClosed.emit();
  23592. if (this.triggersSubmenu()) {
  23593. this._menuItemInstance._highlighted = isOpen;
  23594. }
  23595. };
  23596. /**
  23597. * This method checks that a valid instance of MatMenu has been passed into
  23598. * matMenuTriggerFor. If not, an exception is thrown.
  23599. */
  23600. /**
  23601. * This method checks that a valid instance of MatMenu has been passed into
  23602. * matMenuTriggerFor. If not, an exception is thrown.
  23603. * @private
  23604. * @return {?}
  23605. */
  23606. MatMenuTrigger.prototype._checkMenu = /**
  23607. * This method checks that a valid instance of MatMenu has been passed into
  23608. * matMenuTriggerFor. If not, an exception is thrown.
  23609. * @private
  23610. * @return {?}
  23611. */
  23612. function () {
  23613. if (!this.menu) {
  23614. throwMatMenuMissingError();
  23615. }
  23616. };
  23617. /**
  23618. * This method creates the overlay from the provided menu's template and saves its
  23619. * OverlayRef so that it can be attached to the DOM when openMenu is called.
  23620. */
  23621. /**
  23622. * This method creates the overlay from the provided menu's template and saves its
  23623. * OverlayRef so that it can be attached to the DOM when openMenu is called.
  23624. * @private
  23625. * @return {?}
  23626. */
  23627. MatMenuTrigger.prototype._createOverlay = /**
  23628. * This method creates the overlay from the provided menu's template and saves its
  23629. * OverlayRef so that it can be attached to the DOM when openMenu is called.
  23630. * @private
  23631. * @return {?}
  23632. */
  23633. function () {
  23634. if (!this._overlayRef) {
  23635. /** @type {?} */
  23636. var config = this._getOverlayConfig();
  23637. this._subscribeToPositions((/** @type {?} */ (config.positionStrategy)));
  23638. this._overlayRef = this._overlay.create(config);
  23639. // Consume the `keydownEvents` in order to prevent them from going to another overlay.
  23640. // Ideally we'd also have our keyboard event logic in here, however doing so will
  23641. // break anybody that may have implemented the `MatMenuPanel` themselves.
  23642. this._overlayRef.keydownEvents().subscribe();
  23643. }
  23644. return this._overlayRef;
  23645. };
  23646. /**
  23647. * This method builds the configuration object needed to create the overlay, the OverlayState.
  23648. * @returns OverlayConfig
  23649. */
  23650. /**
  23651. * This method builds the configuration object needed to create the overlay, the OverlayState.
  23652. * @private
  23653. * @return {?} OverlayConfig
  23654. */
  23655. MatMenuTrigger.prototype._getOverlayConfig = /**
  23656. * This method builds the configuration object needed to create the overlay, the OverlayState.
  23657. * @private
  23658. * @return {?} OverlayConfig
  23659. */
  23660. function () {
  23661. return new overlay.OverlayConfig({
  23662. positionStrategy: this._overlay.position()
  23663. .flexibleConnectedTo(this._element)
  23664. .withLockedPosition()
  23665. .withTransformOriginOn('.mat-menu-panel, .mat-mdc-menu-panel'),
  23666. backdropClass: this.menu.backdropClass || 'cdk-overlay-transparent-backdrop',
  23667. scrollStrategy: this._scrollStrategy(),
  23668. direction: this._dir
  23669. });
  23670. };
  23671. /**
  23672. * Listens to changes in the position of the overlay and sets the correct classes
  23673. * on the menu based on the new position. This ensures the animation origin is always
  23674. * correct, even if a fallback position is used for the overlay.
  23675. */
  23676. /**
  23677. * Listens to changes in the position of the overlay and sets the correct classes
  23678. * on the menu based on the new position. This ensures the animation origin is always
  23679. * correct, even if a fallback position is used for the overlay.
  23680. * @private
  23681. * @param {?} position
  23682. * @return {?}
  23683. */
  23684. MatMenuTrigger.prototype._subscribeToPositions = /**
  23685. * Listens to changes in the position of the overlay and sets the correct classes
  23686. * on the menu based on the new position. This ensures the animation origin is always
  23687. * correct, even if a fallback position is used for the overlay.
  23688. * @private
  23689. * @param {?} position
  23690. * @return {?}
  23691. */
  23692. function (position) {
  23693. var _this = this;
  23694. if (this.menu.setPositionClasses) {
  23695. position.positionChanges.subscribe((/**
  23696. * @param {?} change
  23697. * @return {?}
  23698. */
  23699. function (change) {
  23700. /** @type {?} */
  23701. var posX = change.connectionPair.overlayX === 'start' ? 'after' : 'before';
  23702. /** @type {?} */
  23703. var posY = change.connectionPair.overlayY === 'top' ? 'below' : 'above';
  23704. (/** @type {?} */ (_this.menu.setPositionClasses))(posX, posY);
  23705. }));
  23706. }
  23707. };
  23708. /**
  23709. * Sets the appropriate positions on a position strategy
  23710. * so the overlay connects with the trigger correctly.
  23711. * @param positionStrategy Strategy whose position to update.
  23712. */
  23713. /**
  23714. * Sets the appropriate positions on a position strategy
  23715. * so the overlay connects with the trigger correctly.
  23716. * @private
  23717. * @param {?} positionStrategy Strategy whose position to update.
  23718. * @return {?}
  23719. */
  23720. MatMenuTrigger.prototype._setPosition = /**
  23721. * Sets the appropriate positions on a position strategy
  23722. * so the overlay connects with the trigger correctly.
  23723. * @private
  23724. * @param {?} positionStrategy Strategy whose position to update.
  23725. * @return {?}
  23726. */
  23727. function (positionStrategy) {
  23728. var _a = this.menu.xPosition === 'before' ? ['end', 'start'] : ['start', 'end'], originX = _a[0], originFallbackX = _a[1];
  23729. var _b = this.menu.yPosition === 'above' ? ['bottom', 'top'] : ['top', 'bottom'], overlayY = _b[0], overlayFallbackY = _b[1];
  23730. var _c = [overlayY, overlayFallbackY], originY = _c[0], originFallbackY = _c[1];
  23731. var _d = [originX, originFallbackX], overlayX = _d[0], overlayFallbackX = _d[1];
  23732. /** @type {?} */
  23733. var offsetY = 0;
  23734. if (this.triggersSubmenu()) {
  23735. // When the menu is a sub-menu, it should always align itself
  23736. // to the edges of the trigger, instead of overlapping it.
  23737. overlayFallbackX = originX = this.menu.xPosition === 'before' ? 'start' : 'end';
  23738. originFallbackX = overlayX = originX === 'end' ? 'start' : 'end';
  23739. offsetY = overlayY === 'bottom' ? MENU_PANEL_TOP_PADDING : -MENU_PANEL_TOP_PADDING;
  23740. }
  23741. else if (!this.menu.overlapTrigger) {
  23742. originY = overlayY === 'top' ? 'bottom' : 'top';
  23743. originFallbackY = overlayFallbackY === 'top' ? 'bottom' : 'top';
  23744. }
  23745. positionStrategy.withPositions([
  23746. { originX: originX, originY: originY, overlayX: overlayX, overlayY: overlayY, offsetY: offsetY },
  23747. { originX: originFallbackX, originY: originY, overlayX: overlayFallbackX, overlayY: overlayY, offsetY: offsetY },
  23748. {
  23749. originX: originX,
  23750. originY: originFallbackY,
  23751. overlayX: overlayX,
  23752. overlayY: overlayFallbackY,
  23753. offsetY: -offsetY
  23754. },
  23755. {
  23756. originX: originFallbackX,
  23757. originY: originFallbackY,
  23758. overlayX: overlayFallbackX,
  23759. overlayY: overlayFallbackY,
  23760. offsetY: -offsetY
  23761. }
  23762. ]);
  23763. };
  23764. /** Returns a stream that emits whenever an action that should close the menu occurs. */
  23765. /**
  23766. * Returns a stream that emits whenever an action that should close the menu occurs.
  23767. * @private
  23768. * @return {?}
  23769. */
  23770. MatMenuTrigger.prototype._menuClosingActions = /**
  23771. * Returns a stream that emits whenever an action that should close the menu occurs.
  23772. * @private
  23773. * @return {?}
  23774. */
  23775. function () {
  23776. var _this = this;
  23777. /** @type {?} */
  23778. var backdrop = (/** @type {?} */ (this._overlayRef)).backdropClick();
  23779. /** @type {?} */
  23780. var detachments = (/** @type {?} */ (this._overlayRef)).detachments();
  23781. /** @type {?} */
  23782. var parentClose = this._parentMenu ? this._parentMenu.closed : rxjs.of();
  23783. /** @type {?} */
  23784. var hover = this._parentMenu ? this._parentMenu._hovered().pipe(operators.filter((/**
  23785. * @param {?} active
  23786. * @return {?}
  23787. */
  23788. function (active) { return active !== _this._menuItemInstance; })), operators.filter((/**
  23789. * @return {?}
  23790. */
  23791. function () { return _this._menuOpen; }))) : rxjs.of();
  23792. return rxjs.merge(backdrop, parentClose, hover, detachments);
  23793. };
  23794. /** Handles mouse presses on the trigger. */
  23795. /**
  23796. * Handles mouse presses on the trigger.
  23797. * @param {?} event
  23798. * @return {?}
  23799. */
  23800. MatMenuTrigger.prototype._handleMousedown = /**
  23801. * Handles mouse presses on the trigger.
  23802. * @param {?} event
  23803. * @return {?}
  23804. */
  23805. function (event) {
  23806. if (!a11y.isFakeMousedownFromScreenReader(event)) {
  23807. // Since right or middle button clicks won't trigger the `click` event,
  23808. // we shouldn't consider the menu as opened by mouse in those cases.
  23809. this._openedBy = event.button === 0 ? 'mouse' : null;
  23810. // Since clicking on the trigger won't close the menu if it opens a sub-menu,
  23811. // we should prevent focus from moving onto it via click to avoid the
  23812. // highlight from lingering on the menu item.
  23813. if (this.triggersSubmenu()) {
  23814. event.preventDefault();
  23815. }
  23816. }
  23817. };
  23818. /** Handles key presses on the trigger. */
  23819. /**
  23820. * Handles key presses on the trigger.
  23821. * @param {?} event
  23822. * @return {?}
  23823. */
  23824. MatMenuTrigger.prototype._handleKeydown = /**
  23825. * Handles key presses on the trigger.
  23826. * @param {?} event
  23827. * @return {?}
  23828. */
  23829. function (event) {
  23830. /** @type {?} */
  23831. var keyCode = event.keyCode;
  23832. if (this.triggersSubmenu() && ((keyCode === keycodes.RIGHT_ARROW && this.dir === 'ltr') ||
  23833. (keyCode === keycodes.LEFT_ARROW && this.dir === 'rtl'))) {
  23834. this.openMenu();
  23835. }
  23836. };
  23837. /** Handles click events on the trigger. */
  23838. /**
  23839. * Handles click events on the trigger.
  23840. * @param {?} event
  23841. * @return {?}
  23842. */
  23843. MatMenuTrigger.prototype._handleClick = /**
  23844. * Handles click events on the trigger.
  23845. * @param {?} event
  23846. * @return {?}
  23847. */
  23848. function (event) {
  23849. if (this.triggersSubmenu()) {
  23850. // Stop event propagation to avoid closing the parent menu.
  23851. event.stopPropagation();
  23852. this.openMenu();
  23853. }
  23854. else {
  23855. this.toggleMenu();
  23856. }
  23857. };
  23858. /** Handles the cases where the user hovers over the trigger. */
  23859. /**
  23860. * Handles the cases where the user hovers over the trigger.
  23861. * @private
  23862. * @return {?}
  23863. */
  23864. MatMenuTrigger.prototype._handleHover = /**
  23865. * Handles the cases where the user hovers over the trigger.
  23866. * @private
  23867. * @return {?}
  23868. */
  23869. function () {
  23870. var _this = this;
  23871. // Subscribe to changes in the hovered item in order to toggle the panel.
  23872. if (!this.triggersSubmenu()) {
  23873. return;
  23874. }
  23875. this._hoverSubscription = this._parentMenu._hovered()
  23876. // Since we might have multiple competing triggers for the same menu (e.g. a sub-menu
  23877. // with different data and triggers), we have to delay it by a tick to ensure that
  23878. // it won't be closed immediately after it is opened.
  23879. .pipe(operators.filter((/**
  23880. * @param {?} active
  23881. * @return {?}
  23882. */
  23883. function (active) { return active === _this._menuItemInstance && !active.disabled; })), operators.delay(0, rxjs.asapScheduler))
  23884. .subscribe((/**
  23885. * @return {?}
  23886. */
  23887. function () {
  23888. _this._openedBy = 'mouse';
  23889. // If the same menu is used between multiple triggers, it might still be animating
  23890. // while the new trigger tries to re-open it. Wait for the animation to finish
  23891. // before doing so. Also interrupt if the user moves to another item.
  23892. if (_this.menu instanceof MatMenu && _this.menu._isAnimating) {
  23893. // We need the `delay(0)` here in order to avoid
  23894. // 'changed after checked' errors in some cases. See #12194.
  23895. _this.menu._animationDone
  23896. .pipe(operators.take(1), operators.delay(0, rxjs.asapScheduler), operators.takeUntil(_this._parentMenu._hovered()))
  23897. .subscribe((/**
  23898. * @return {?}
  23899. */
  23900. function () { return _this.openMenu(); }));
  23901. }
  23902. else {
  23903. _this.openMenu();
  23904. }
  23905. }));
  23906. };
  23907. /** Gets the portal that should be attached to the overlay. */
  23908. /**
  23909. * Gets the portal that should be attached to the overlay.
  23910. * @private
  23911. * @return {?}
  23912. */
  23913. MatMenuTrigger.prototype._getPortal = /**
  23914. * Gets the portal that should be attached to the overlay.
  23915. * @private
  23916. * @return {?}
  23917. */
  23918. function () {
  23919. // Note that we can avoid this check by keeping the portal on the menu panel.
  23920. // While it would be cleaner, we'd have to introduce another required method on
  23921. // `MatMenuPanel`, making it harder to consume.
  23922. if (!this._portal || this._portal.templateRef !== this.menu.templateRef) {
  23923. this._portal = new portal.TemplatePortal(this.menu.templateRef, this._viewContainerRef);
  23924. }
  23925. return this._portal;
  23926. };
  23927. MatMenuTrigger.decorators = [
  23928. { type: core.Directive, args: [{
  23929. selector: "[mat-menu-trigger-for], [matMenuTriggerFor]",
  23930. host: {
  23931. 'class': 'mat-menu-trigger',
  23932. 'aria-haspopup': 'true',
  23933. '[attr.aria-expanded]': 'menuOpen || null',
  23934. '(mousedown)': '_handleMousedown($event)',
  23935. '(keydown)': '_handleKeydown($event)',
  23936. '(click)': '_handleClick($event)',
  23937. },
  23938. exportAs: 'matMenuTrigger'
  23939. },] },
  23940. ];
  23941. /** @nocollapse */
  23942. MatMenuTrigger.ctorParameters = function () { return [
  23943. { type: overlay.Overlay },
  23944. { type: core.ElementRef },
  23945. { type: core.ViewContainerRef },
  23946. { type: undefined, decorators: [{ type: core.Inject, args: [MAT_MENU_SCROLL_STRATEGY,] }] },
  23947. { type: MatMenu, decorators: [{ type: core.Optional }] },
  23948. { type: MatMenuItem, decorators: [{ type: core.Optional }, { type: core.Self }] },
  23949. { type: bidi.Directionality, decorators: [{ type: core.Optional }] },
  23950. { type: a11y.FocusMonitor }
  23951. ]; };
  23952. MatMenuTrigger.propDecorators = {
  23953. _deprecatedMatMenuTriggerFor: [{ type: core.Input, args: ['mat-menu-trigger-for',] }],
  23954. menu: [{ type: core.Input, args: ['matMenuTriggerFor',] }],
  23955. menuData: [{ type: core.Input, args: ['matMenuTriggerData',] }],
  23956. restoreFocus: [{ type: core.Input, args: ['matMenuTriggerRestoreFocus',] }],
  23957. menuOpened: [{ type: core.Output }],
  23958. onMenuOpen: [{ type: core.Output }],
  23959. menuClosed: [{ type: core.Output }],
  23960. onMenuClose: [{ type: core.Output }]
  23961. };
  23962. return MatMenuTrigger;
  23963. }());
  23964. /**
  23965. * @fileoverview added by tsickle
  23966. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  23967. */
  23968. /**
  23969. * Used by both the current `MatMenuModule` and the MDC `MatMenuModule`
  23970. * to declare the menu-related directives.
  23971. */
  23972. var _MatMenuDirectivesModule = /** @class */ (function () {
  23973. function _MatMenuDirectivesModule() {
  23974. }
  23975. _MatMenuDirectivesModule.decorators = [
  23976. { type: core.NgModule, args: [{
  23977. exports: [MatMenuTrigger, MatMenuContent, MatCommonModule],
  23978. declarations: [MatMenuTrigger, MatMenuContent],
  23979. providers: [MAT_MENU_SCROLL_STRATEGY_FACTORY_PROVIDER]
  23980. },] },
  23981. ];
  23982. return _MatMenuDirectivesModule;
  23983. }());
  23984. var MatMenuModule = /** @class */ (function () {
  23985. function MatMenuModule() {
  23986. }
  23987. MatMenuModule.decorators = [
  23988. { type: core.NgModule, args: [{
  23989. imports: [
  23990. common.CommonModule,
  23991. MatCommonModule,
  23992. MatRippleModule,
  23993. overlay.OverlayModule,
  23994. _MatMenuDirectivesModule,
  23995. ],
  23996. exports: [_MatMenu, MatMenuItem, _MatMenuDirectivesModule],
  23997. declarations: [_MatMenu, MatMenuItem],
  23998. providers: [MAT_MENU_SCROLL_STRATEGY_FACTORY_PROVIDER]
  23999. },] },
  24000. ];
  24001. return MatMenuModule;
  24002. }());
  24003. /**
  24004. * @fileoverview added by tsickle
  24005. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  24006. */
  24007. /**
  24008. * The following are all the animations for the mat-select component, with each
  24009. * const containing the metadata for one animation.
  24010. *
  24011. * The values below match the implementation of the AngularJS Material mat-select animation.
  24012. * \@docs-private
  24013. * @type {?}
  24014. */
  24015. var matSelectAnimations = {
  24016. /**
  24017. * This animation ensures the select's overlay panel animation (transformPanel) is called when
  24018. * closing the select.
  24019. * This is needed due to https://github.com/angular/angular/issues/23302
  24020. */
  24021. transformPanelWrap: animations$1.trigger('transformPanelWrap', [
  24022. animations$1.transition('* => void', animations$1.query('@transformPanel', [animations$1.animateChild()], { optional: true }))
  24023. ]),
  24024. /**
  24025. * This animation transforms the select's overlay panel on and off the page.
  24026. *
  24027. * When the panel is attached to the DOM, it expands its width by the amount of padding, scales it
  24028. * up to 100% on the Y axis, fades in its border, and translates slightly up and to the
  24029. * side to ensure the option text correctly overlaps the trigger text.
  24030. *
  24031. * When the panel is removed from the DOM, it simply fades out linearly.
  24032. */
  24033. transformPanel: animations$1.trigger('transformPanel', [
  24034. animations$1.state('void', animations$1.style({
  24035. transform: 'scaleY(0.8)',
  24036. minWidth: '100%',
  24037. opacity: 0
  24038. })),
  24039. animations$1.state('showing', animations$1.style({
  24040. opacity: 1,
  24041. minWidth: 'calc(100% + 32px)',
  24042. // 32px = 2 * 16px padding
  24043. transform: 'scaleY(1)'
  24044. })),
  24045. animations$1.state('showing-multiple', animations$1.style({
  24046. opacity: 1,
  24047. minWidth: 'calc(100% + 64px)',
  24048. // 64px = 48px padding on the left + 16px padding on the right
  24049. transform: 'scaleY(1)'
  24050. })),
  24051. animations$1.transition('void => *', animations$1.animate('120ms cubic-bezier(0, 0, 0.2, 1)')),
  24052. animations$1.transition('* => void', animations$1.animate('100ms 25ms linear', animations$1.style({ opacity: 0 })))
  24053. ]),
  24054. /**
  24055. * This animation fades in the background color and text content of the
  24056. * select's options. It is time delayed to occur 100ms after the overlay
  24057. * panel has transformed in.
  24058. * @deprecated Not used anymore. To be removed.
  24059. * \@breaking-change 8.0.0
  24060. */
  24061. fadeInContent: animations$1.trigger('fadeInContent', [
  24062. animations$1.state('showing', animations$1.style({ opacity: 1 })),
  24063. animations$1.transition('void => showing', [
  24064. animations$1.style({ opacity: 0 }),
  24065. animations$1.animate('150ms 100ms cubic-bezier(0.55, 0, 0.55, 0.2)')
  24066. ])
  24067. ])
  24068. };
  24069. /**
  24070. * @deprecated
  24071. * \@breaking-change 8.0.0
  24072. * \@docs-private
  24073. * @type {?}
  24074. */
  24075. var transformPanel = matSelectAnimations.transformPanel;
  24076. /**
  24077. * @deprecated
  24078. * \@breaking-change 8.0.0
  24079. * \@docs-private
  24080. * @type {?}
  24081. */
  24082. var fadeInContent = matSelectAnimations.fadeInContent;
  24083. /**
  24084. * @fileoverview added by tsickle
  24085. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  24086. */
  24087. /**
  24088. * Returns an exception to be thrown when attempting to change a select's `multiple` option
  24089. * after initialization.
  24090. * \@docs-private
  24091. * @return {?}
  24092. */
  24093. function getMatSelectDynamicMultipleError() {
  24094. return Error('Cannot change `multiple` mode of select after initialization.');
  24095. }
  24096. /**
  24097. * Returns an exception to be thrown when attempting to assign a non-array value to a select
  24098. * in `multiple` mode. Note that `undefined` and `null` are still valid values to allow for
  24099. * resetting the value.
  24100. * \@docs-private
  24101. * @return {?}
  24102. */
  24103. function getMatSelectNonArrayValueError() {
  24104. return Error('Value must be an array in multiple-selection mode.');
  24105. }
  24106. /**
  24107. * Returns an exception to be thrown when assigning a non-function value to the comparator
  24108. * used to determine if a value corresponds to an option. Note that whether the function
  24109. * actually takes two values and returns a boolean is not checked.
  24110. * @return {?}
  24111. */
  24112. function getMatSelectNonFunctionValueError() {
  24113. return Error('`compareWith` must be a function.');
  24114. }
  24115. /**
  24116. * @fileoverview added by tsickle
  24117. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  24118. */
  24119. /** @type {?} */
  24120. var nextUniqueId$6 = 0;
  24121. /**
  24122. * The max height of the select's overlay panel
  24123. * @type {?}
  24124. */
  24125. var SELECT_PANEL_MAX_HEIGHT = 256;
  24126. /**
  24127. * The panel's padding on the x-axis
  24128. * @type {?}
  24129. */
  24130. var SELECT_PANEL_PADDING_X = 16;
  24131. /**
  24132. * The panel's x axis padding if it is indented (e.g. there is an option group).
  24133. * @type {?}
  24134. */
  24135. var SELECT_PANEL_INDENT_PADDING_X = SELECT_PANEL_PADDING_X * 2;
  24136. /**
  24137. * The height of the select items in `em` units.
  24138. * @type {?}
  24139. */
  24140. var SELECT_ITEM_HEIGHT_EM = 3;
  24141. // TODO(josephperrott): Revert to a constant after 2018 spec updates are fully merged.
  24142. /**
  24143. * Distance between the panel edge and the option text in
  24144. * multi-selection mode.
  24145. *
  24146. * Calculated as:
  24147. * (SELECT_PANEL_PADDING_X * 1.5) + 16 = 40
  24148. * The padding is multiplied by 1.5 because the checkbox's margin is half the padding.
  24149. * The checkbox width is 16px.
  24150. * @type {?}
  24151. */
  24152. var SELECT_MULTIPLE_PANEL_PADDING_X = SELECT_PANEL_PADDING_X * 1.5 + 16;
  24153. /**
  24154. * The select panel will only "fit" inside the viewport if it is positioned at
  24155. * this value or more away from the viewport boundary.
  24156. * @type {?}
  24157. */
  24158. var SELECT_PANEL_VIEWPORT_PADDING = 8;
  24159. /**
  24160. * Injection token that determines the scroll handling while a select is open.
  24161. * @type {?}
  24162. */
  24163. var MAT_SELECT_SCROLL_STRATEGY = new core.InjectionToken('mat-select-scroll-strategy');
  24164. /**
  24165. * \@docs-private
  24166. * @param {?} overlay
  24167. * @return {?}
  24168. */
  24169. function MAT_SELECT_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay$$1) {
  24170. return (/**
  24171. * @return {?}
  24172. */
  24173. function () { return overlay$$1.scrollStrategies.reposition(); });
  24174. }
  24175. /**
  24176. * \@docs-private
  24177. * @type {?}
  24178. */
  24179. var MAT_SELECT_SCROLL_STRATEGY_PROVIDER = {
  24180. provide: MAT_SELECT_SCROLL_STRATEGY,
  24181. deps: [overlay.Overlay],
  24182. useFactory: MAT_SELECT_SCROLL_STRATEGY_PROVIDER_FACTORY,
  24183. };
  24184. /**
  24185. * Change event object that is emitted when the select value has changed.
  24186. */
  24187. var /**
  24188. * Change event object that is emitted when the select value has changed.
  24189. */
  24190. MatSelectChange = /** @class */ (function () {
  24191. function MatSelectChange(source, value) {
  24192. this.source = source;
  24193. this.value = value;
  24194. }
  24195. return MatSelectChange;
  24196. }());
  24197. // Boilerplate for applying mixins to MatSelect.
  24198. /**
  24199. * \@docs-private
  24200. */
  24201. var
  24202. // Boilerplate for applying mixins to MatSelect.
  24203. /**
  24204. * \@docs-private
  24205. */
  24206. MatSelectBase = /** @class */ (function () {
  24207. function MatSelectBase(_elementRef, _defaultErrorStateMatcher, _parentForm, _parentFormGroup, ngControl) {
  24208. this._elementRef = _elementRef;
  24209. this._defaultErrorStateMatcher = _defaultErrorStateMatcher;
  24210. this._parentForm = _parentForm;
  24211. this._parentFormGroup = _parentFormGroup;
  24212. this.ngControl = ngControl;
  24213. }
  24214. return MatSelectBase;
  24215. }());
  24216. /** @type {?} */
  24217. var _MatSelectMixinBase = mixinDisableRipple(mixinTabIndex(mixinDisabled(mixinErrorState(MatSelectBase))));
  24218. /**
  24219. * Allows the user to customize the trigger that is displayed when the select has a value.
  24220. */
  24221. var MatSelectTrigger = /** @class */ (function () {
  24222. function MatSelectTrigger() {
  24223. }
  24224. MatSelectTrigger.decorators = [
  24225. { type: core.Directive, args: [{
  24226. selector: 'mat-select-trigger'
  24227. },] },
  24228. ];
  24229. return MatSelectTrigger;
  24230. }());
  24231. var MatSelect = /** @class */ (function (_super) {
  24232. __extends(MatSelect, _super);
  24233. function MatSelect(_viewportRuler, _changeDetectorRef, _ngZone, _defaultErrorStateMatcher, elementRef, _dir, _parentForm, _parentFormGroup, _parentFormField, ngControl, tabIndex, scrollStrategyFactory, _liveAnnouncer) {
  24234. var _this = _super.call(this, elementRef, _defaultErrorStateMatcher, _parentForm, _parentFormGroup, ngControl) || this;
  24235. _this._viewportRuler = _viewportRuler;
  24236. _this._changeDetectorRef = _changeDetectorRef;
  24237. _this._ngZone = _ngZone;
  24238. _this._dir = _dir;
  24239. _this._parentFormField = _parentFormField;
  24240. _this.ngControl = ngControl;
  24241. _this._liveAnnouncer = _liveAnnouncer;
  24242. /**
  24243. * Whether or not the overlay panel is open.
  24244. */
  24245. _this._panelOpen = false;
  24246. /**
  24247. * Whether filling out the select is required in the form.
  24248. */
  24249. _this._required = false;
  24250. /**
  24251. * The scroll position of the overlay panel, calculated to center the selected option.
  24252. */
  24253. _this._scrollTop = 0;
  24254. /**
  24255. * Whether the component is in multiple selection mode.
  24256. */
  24257. _this._multiple = false;
  24258. /**
  24259. * Comparison function to specify which option is displayed. Defaults to object equality.
  24260. */
  24261. _this._compareWith = (/**
  24262. * @param {?} o1
  24263. * @param {?} o2
  24264. * @return {?}
  24265. */
  24266. function (o1, o2) { return o1 === o2; });
  24267. /**
  24268. * Unique id for this input.
  24269. */
  24270. _this._uid = "mat-select-" + nextUniqueId$6++;
  24271. /**
  24272. * Emits whenever the component is destroyed.
  24273. */
  24274. _this._destroy = new rxjs.Subject();
  24275. /**
  24276. * The cached font-size of the trigger element.
  24277. */
  24278. _this._triggerFontSize = 0;
  24279. /**
  24280. * `View -> model callback called when value changes`
  24281. */
  24282. _this._onChange = (/**
  24283. * @return {?}
  24284. */
  24285. function () { });
  24286. /**
  24287. * `View -> model callback called when select has been touched`
  24288. */
  24289. _this._onTouched = (/**
  24290. * @return {?}
  24291. */
  24292. function () { });
  24293. /**
  24294. * The IDs of child options to be passed to the aria-owns attribute.
  24295. */
  24296. _this._optionIds = '';
  24297. /**
  24298. * The value of the select panel's transform-origin property.
  24299. */
  24300. _this._transformOrigin = 'top';
  24301. /**
  24302. * Emits when the panel element is finished transforming in.
  24303. */
  24304. _this._panelDoneAnimatingStream = new rxjs.Subject();
  24305. /**
  24306. * The y-offset of the overlay panel in relation to the trigger's top start corner.
  24307. * This must be adjusted to align the selected option text over the trigger text.
  24308. * when the panel opens. Will change based on the y-position of the selected option.
  24309. */
  24310. _this._offsetY = 0;
  24311. /**
  24312. * This position config ensures that the top "start" corner of the overlay
  24313. * is aligned with with the top "start" of the origin by default (overlapping
  24314. * the trigger completely). If the panel cannot fit below the trigger, it
  24315. * will fall back to a position above the trigger.
  24316. */
  24317. _this._positions = [
  24318. {
  24319. originX: 'start',
  24320. originY: 'top',
  24321. overlayX: 'start',
  24322. overlayY: 'top',
  24323. },
  24324. {
  24325. originX: 'start',
  24326. originY: 'bottom',
  24327. overlayX: 'start',
  24328. overlayY: 'bottom',
  24329. },
  24330. ];
  24331. /**
  24332. * Whether the component is disabling centering of the active option over the trigger.
  24333. */
  24334. _this._disableOptionCentering = false;
  24335. _this._focused = false;
  24336. /**
  24337. * A name for this control that can be used by `mat-form-field`.
  24338. */
  24339. _this.controlType = 'mat-select';
  24340. /**
  24341. * Aria label of the select. If not specified, the placeholder will be used as label.
  24342. */
  24343. _this.ariaLabel = '';
  24344. /**
  24345. * Combined stream of all of the child options' change events.
  24346. */
  24347. _this.optionSelectionChanges = (/** @type {?} */ (rxjs.defer((/**
  24348. * @return {?}
  24349. */
  24350. function () {
  24351. /** @type {?} */
  24352. var options = _this.options;
  24353. if (options) {
  24354. return options.changes.pipe(operators.startWith(options), operators.switchMap((/**
  24355. * @return {?}
  24356. */
  24357. function () { return rxjs.merge.apply(void 0, options.map((/**
  24358. * @param {?} option
  24359. * @return {?}
  24360. */
  24361. function (option) { return option.onSelectionChange; }))); })));
  24362. }
  24363. return _this._ngZone.onStable
  24364. .asObservable()
  24365. .pipe(operators.take(1), operators.switchMap((/**
  24366. * @return {?}
  24367. */
  24368. function () { return _this.optionSelectionChanges; })));
  24369. }))));
  24370. /**
  24371. * Event emitted when the select panel has been toggled.
  24372. */
  24373. _this.openedChange = new core.EventEmitter();
  24374. /**
  24375. * Event emitted when the select has been opened.
  24376. */
  24377. _this._openedStream = _this.openedChange.pipe(operators.filter((/**
  24378. * @param {?} o
  24379. * @return {?}
  24380. */
  24381. function (o) { return o; })), operators.map((/**
  24382. * @return {?}
  24383. */
  24384. function () { })));
  24385. /**
  24386. * Event emitted when the select has been closed.
  24387. */
  24388. _this._closedStream = _this.openedChange.pipe(operators.filter((/**
  24389. * @param {?} o
  24390. * @return {?}
  24391. */
  24392. function (o) { return !o; })), operators.map((/**
  24393. * @return {?}
  24394. */
  24395. function () { })));
  24396. /**
  24397. * Event emitted when the selected value has been changed by the user.
  24398. */
  24399. _this.selectionChange = new core.EventEmitter();
  24400. /**
  24401. * Event that emits whenever the raw value of the select changes. This is here primarily
  24402. * to facilitate the two-way binding for the `value` input.
  24403. * \@docs-private
  24404. */
  24405. _this.valueChange = new core.EventEmitter();
  24406. if (_this.ngControl) {
  24407. // Note: we provide the value accessor through here, instead of
  24408. // the `providers` to avoid running into a circular import.
  24409. _this.ngControl.valueAccessor = _this;
  24410. }
  24411. _this._scrollStrategyFactory = scrollStrategyFactory;
  24412. _this._scrollStrategy = _this._scrollStrategyFactory();
  24413. _this.tabIndex = parseInt(tabIndex) || 0;
  24414. // Force setter to be called in case id was not specified.
  24415. _this.id = _this.id;
  24416. return _this;
  24417. }
  24418. Object.defineProperty(MatSelect.prototype, "focused", {
  24419. /** Whether the select is focused. */
  24420. get: /**
  24421. * Whether the select is focused.
  24422. * @return {?}
  24423. */
  24424. function () {
  24425. return this._focused || this._panelOpen;
  24426. },
  24427. /**
  24428. * @deprecated Setter to be removed as this property is intended to be readonly.
  24429. * @breaking-change 8.0.0
  24430. */
  24431. set: /**
  24432. * @deprecated Setter to be removed as this property is intended to be readonly.
  24433. * \@breaking-change 8.0.0
  24434. * @param {?} value
  24435. * @return {?}
  24436. */
  24437. function (value) {
  24438. this._focused = value;
  24439. },
  24440. enumerable: true,
  24441. configurable: true
  24442. });
  24443. Object.defineProperty(MatSelect.prototype, "placeholder", {
  24444. /** Placeholder to be shown if no value has been selected. */
  24445. get: /**
  24446. * Placeholder to be shown if no value has been selected.
  24447. * @return {?}
  24448. */
  24449. function () { return this._placeholder; },
  24450. set: /**
  24451. * @param {?} value
  24452. * @return {?}
  24453. */
  24454. function (value) {
  24455. this._placeholder = value;
  24456. this.stateChanges.next();
  24457. },
  24458. enumerable: true,
  24459. configurable: true
  24460. });
  24461. Object.defineProperty(MatSelect.prototype, "required", {
  24462. /** Whether the component is required. */
  24463. get: /**
  24464. * Whether the component is required.
  24465. * @return {?}
  24466. */
  24467. function () { return this._required; },
  24468. set: /**
  24469. * @param {?} value
  24470. * @return {?}
  24471. */
  24472. function (value) {
  24473. this._required = coercion.coerceBooleanProperty(value);
  24474. this.stateChanges.next();
  24475. },
  24476. enumerable: true,
  24477. configurable: true
  24478. });
  24479. Object.defineProperty(MatSelect.prototype, "multiple", {
  24480. /** Whether the user should be allowed to select multiple options. */
  24481. get: /**
  24482. * Whether the user should be allowed to select multiple options.
  24483. * @return {?}
  24484. */
  24485. function () { return this._multiple; },
  24486. set: /**
  24487. * @param {?} value
  24488. * @return {?}
  24489. */
  24490. function (value) {
  24491. if (this._selectionModel) {
  24492. throw getMatSelectDynamicMultipleError();
  24493. }
  24494. this._multiple = coercion.coerceBooleanProperty(value);
  24495. },
  24496. enumerable: true,
  24497. configurable: true
  24498. });
  24499. Object.defineProperty(MatSelect.prototype, "disableOptionCentering", {
  24500. /** Whether to center the active option over the trigger. */
  24501. get: /**
  24502. * Whether to center the active option over the trigger.
  24503. * @return {?}
  24504. */
  24505. function () { return this._disableOptionCentering; },
  24506. set: /**
  24507. * @param {?} value
  24508. * @return {?}
  24509. */
  24510. function (value) {
  24511. this._disableOptionCentering = coercion.coerceBooleanProperty(value);
  24512. },
  24513. enumerable: true,
  24514. configurable: true
  24515. });
  24516. Object.defineProperty(MatSelect.prototype, "compareWith", {
  24517. /**
  24518. * Function to compare the option values with the selected values. The first argument
  24519. * is a value from an option. The second is a value from the selection. A boolean
  24520. * should be returned.
  24521. */
  24522. get: /**
  24523. * Function to compare the option values with the selected values. The first argument
  24524. * is a value from an option. The second is a value from the selection. A boolean
  24525. * should be returned.
  24526. * @return {?}
  24527. */
  24528. function () { return this._compareWith; },
  24529. set: /**
  24530. * @param {?} fn
  24531. * @return {?}
  24532. */
  24533. function (fn) {
  24534. if (typeof fn !== 'function') {
  24535. throw getMatSelectNonFunctionValueError();
  24536. }
  24537. this._compareWith = fn;
  24538. if (this._selectionModel) {
  24539. // A different comparator means the selection could change.
  24540. this._initializeSelection();
  24541. }
  24542. },
  24543. enumerable: true,
  24544. configurable: true
  24545. });
  24546. Object.defineProperty(MatSelect.prototype, "value", {
  24547. /** Value of the select control. */
  24548. get: /**
  24549. * Value of the select control.
  24550. * @return {?}
  24551. */
  24552. function () { return this._value; },
  24553. set: /**
  24554. * @param {?} newValue
  24555. * @return {?}
  24556. */
  24557. function (newValue) {
  24558. if (newValue !== this._value) {
  24559. this.writeValue(newValue);
  24560. this._value = newValue;
  24561. }
  24562. },
  24563. enumerable: true,
  24564. configurable: true
  24565. });
  24566. Object.defineProperty(MatSelect.prototype, "id", {
  24567. /** Unique id of the element. */
  24568. get: /**
  24569. * Unique id of the element.
  24570. * @return {?}
  24571. */
  24572. function () { return this._id; },
  24573. set: /**
  24574. * @param {?} value
  24575. * @return {?}
  24576. */
  24577. function (value) {
  24578. this._id = value || this._uid;
  24579. this.stateChanges.next();
  24580. },
  24581. enumerable: true,
  24582. configurable: true
  24583. });
  24584. /**
  24585. * @return {?}
  24586. */
  24587. MatSelect.prototype.ngOnInit = /**
  24588. * @return {?}
  24589. */
  24590. function () {
  24591. var _this = this;
  24592. this._selectionModel = new collections.SelectionModel(this.multiple);
  24593. this.stateChanges.next();
  24594. // We need `distinctUntilChanged` here, because some browsers will
  24595. // fire the animation end event twice for the same animation. See:
  24596. // https://github.com/angular/angular/issues/24084
  24597. this._panelDoneAnimatingStream
  24598. .pipe(operators.distinctUntilChanged(), operators.takeUntil(this._destroy))
  24599. .subscribe((/**
  24600. * @return {?}
  24601. */
  24602. function () {
  24603. if (_this.panelOpen) {
  24604. _this._scrollTop = 0;
  24605. _this.openedChange.emit(true);
  24606. }
  24607. else {
  24608. _this.openedChange.emit(false);
  24609. _this.overlayDir.offsetX = 0;
  24610. _this._changeDetectorRef.markForCheck();
  24611. }
  24612. }));
  24613. this._viewportRuler.change()
  24614. .pipe(operators.takeUntil(this._destroy))
  24615. .subscribe((/**
  24616. * @return {?}
  24617. */
  24618. function () {
  24619. if (_this._panelOpen) {
  24620. _this._triggerRect = _this.trigger.nativeElement.getBoundingClientRect();
  24621. _this._changeDetectorRef.markForCheck();
  24622. }
  24623. }));
  24624. };
  24625. /**
  24626. * @return {?}
  24627. */
  24628. MatSelect.prototype.ngAfterContentInit = /**
  24629. * @return {?}
  24630. */
  24631. function () {
  24632. var _this = this;
  24633. this._initKeyManager();
  24634. this._selectionModel.onChange.pipe(operators.takeUntil(this._destroy)).subscribe((/**
  24635. * @param {?} event
  24636. * @return {?}
  24637. */
  24638. function (event) {
  24639. event.added.forEach((/**
  24640. * @param {?} option
  24641. * @return {?}
  24642. */
  24643. function (option) { return option.select(); }));
  24644. event.removed.forEach((/**
  24645. * @param {?} option
  24646. * @return {?}
  24647. */
  24648. function (option) { return option.deselect(); }));
  24649. }));
  24650. this.options.changes.pipe(operators.startWith(null), operators.takeUntil(this._destroy)).subscribe((/**
  24651. * @return {?}
  24652. */
  24653. function () {
  24654. _this._resetOptions();
  24655. _this._initializeSelection();
  24656. }));
  24657. };
  24658. /**
  24659. * @return {?}
  24660. */
  24661. MatSelect.prototype.ngDoCheck = /**
  24662. * @return {?}
  24663. */
  24664. function () {
  24665. if (this.ngControl) {
  24666. this.updateErrorState();
  24667. }
  24668. };
  24669. /**
  24670. * @param {?} changes
  24671. * @return {?}
  24672. */
  24673. MatSelect.prototype.ngOnChanges = /**
  24674. * @param {?} changes
  24675. * @return {?}
  24676. */
  24677. function (changes) {
  24678. // Updating the disabled state is handled by `mixinDisabled`, but we need to additionally let
  24679. // the parent form field know to run change detection when the disabled state changes.
  24680. if (changes['disabled']) {
  24681. this.stateChanges.next();
  24682. }
  24683. };
  24684. /**
  24685. * @return {?}
  24686. */
  24687. MatSelect.prototype.ngOnDestroy = /**
  24688. * @return {?}
  24689. */
  24690. function () {
  24691. this._destroy.next();
  24692. this._destroy.complete();
  24693. this.stateChanges.complete();
  24694. };
  24695. /** Toggles the overlay panel open or closed. */
  24696. /**
  24697. * Toggles the overlay panel open or closed.
  24698. * @return {?}
  24699. */
  24700. MatSelect.prototype.toggle = /**
  24701. * Toggles the overlay panel open or closed.
  24702. * @return {?}
  24703. */
  24704. function () {
  24705. this.panelOpen ? this.close() : this.open();
  24706. };
  24707. /** Opens the overlay panel. */
  24708. /**
  24709. * Opens the overlay panel.
  24710. * @return {?}
  24711. */
  24712. MatSelect.prototype.open = /**
  24713. * Opens the overlay panel.
  24714. * @return {?}
  24715. */
  24716. function () {
  24717. var _this = this;
  24718. if (this.disabled || !this.options || !this.options.length || this._panelOpen) {
  24719. return;
  24720. }
  24721. this._triggerRect = this.trigger.nativeElement.getBoundingClientRect();
  24722. // Note: The computed font-size will be a string pixel value (e.g. "16px").
  24723. // `parseInt` ignores the trailing 'px' and converts this to a number.
  24724. this._triggerFontSize = parseInt(getComputedStyle(this.trigger.nativeElement).fontSize || '0');
  24725. this._panelOpen = true;
  24726. this._keyManager.withHorizontalOrientation(null);
  24727. this._calculateOverlayPosition();
  24728. this._highlightCorrectOption();
  24729. this._changeDetectorRef.markForCheck();
  24730. // Set the font size on the panel element once it exists.
  24731. this._ngZone.onStable.asObservable().pipe(operators.take(1)).subscribe((/**
  24732. * @return {?}
  24733. */
  24734. function () {
  24735. if (_this._triggerFontSize && _this.overlayDir.overlayRef &&
  24736. _this.overlayDir.overlayRef.overlayElement) {
  24737. _this.overlayDir.overlayRef.overlayElement.style.fontSize = _this._triggerFontSize + "px";
  24738. }
  24739. }));
  24740. };
  24741. /** Closes the overlay panel and focuses the host element. */
  24742. /**
  24743. * Closes the overlay panel and focuses the host element.
  24744. * @return {?}
  24745. */
  24746. MatSelect.prototype.close = /**
  24747. * Closes the overlay panel and focuses the host element.
  24748. * @return {?}
  24749. */
  24750. function () {
  24751. if (this._panelOpen) {
  24752. this._panelOpen = false;
  24753. this._keyManager.withHorizontalOrientation(this._isRtl() ? 'rtl' : 'ltr');
  24754. this._changeDetectorRef.markForCheck();
  24755. this._onTouched();
  24756. }
  24757. };
  24758. /**
  24759. * Sets the select's value. Part of the ControlValueAccessor interface
  24760. * required to integrate with Angular's core forms API.
  24761. *
  24762. * @param value New value to be written to the model.
  24763. */
  24764. /**
  24765. * Sets the select's value. Part of the ControlValueAccessor interface
  24766. * required to integrate with Angular's core forms API.
  24767. *
  24768. * @param {?} value New value to be written to the model.
  24769. * @return {?}
  24770. */
  24771. MatSelect.prototype.writeValue = /**
  24772. * Sets the select's value. Part of the ControlValueAccessor interface
  24773. * required to integrate with Angular's core forms API.
  24774. *
  24775. * @param {?} value New value to be written to the model.
  24776. * @return {?}
  24777. */
  24778. function (value) {
  24779. if (this.options) {
  24780. this._setSelectionByValue(value);
  24781. }
  24782. };
  24783. /**
  24784. * Saves a callback function to be invoked when the select's value
  24785. * changes from user input. Part of the ControlValueAccessor interface
  24786. * required to integrate with Angular's core forms API.
  24787. *
  24788. * @param fn Callback to be triggered when the value changes.
  24789. */
  24790. /**
  24791. * Saves a callback function to be invoked when the select's value
  24792. * changes from user input. Part of the ControlValueAccessor interface
  24793. * required to integrate with Angular's core forms API.
  24794. *
  24795. * @param {?} fn Callback to be triggered when the value changes.
  24796. * @return {?}
  24797. */
  24798. MatSelect.prototype.registerOnChange = /**
  24799. * Saves a callback function to be invoked when the select's value
  24800. * changes from user input. Part of the ControlValueAccessor interface
  24801. * required to integrate with Angular's core forms API.
  24802. *
  24803. * @param {?} fn Callback to be triggered when the value changes.
  24804. * @return {?}
  24805. */
  24806. function (fn) {
  24807. this._onChange = fn;
  24808. };
  24809. /**
  24810. * Saves a callback function to be invoked when the select is blurred
  24811. * by the user. Part of the ControlValueAccessor interface required
  24812. * to integrate with Angular's core forms API.
  24813. *
  24814. * @param fn Callback to be triggered when the component has been touched.
  24815. */
  24816. /**
  24817. * Saves a callback function to be invoked when the select is blurred
  24818. * by the user. Part of the ControlValueAccessor interface required
  24819. * to integrate with Angular's core forms API.
  24820. *
  24821. * @param {?} fn Callback to be triggered when the component has been touched.
  24822. * @return {?}
  24823. */
  24824. MatSelect.prototype.registerOnTouched = /**
  24825. * Saves a callback function to be invoked when the select is blurred
  24826. * by the user. Part of the ControlValueAccessor interface required
  24827. * to integrate with Angular's core forms API.
  24828. *
  24829. * @param {?} fn Callback to be triggered when the component has been touched.
  24830. * @return {?}
  24831. */
  24832. function (fn) {
  24833. this._onTouched = fn;
  24834. };
  24835. /**
  24836. * Disables the select. Part of the ControlValueAccessor interface required
  24837. * to integrate with Angular's core forms API.
  24838. *
  24839. * @param isDisabled Sets whether the component is disabled.
  24840. */
  24841. /**
  24842. * Disables the select. Part of the ControlValueAccessor interface required
  24843. * to integrate with Angular's core forms API.
  24844. *
  24845. * @param {?} isDisabled Sets whether the component is disabled.
  24846. * @return {?}
  24847. */
  24848. MatSelect.prototype.setDisabledState = /**
  24849. * Disables the select. Part of the ControlValueAccessor interface required
  24850. * to integrate with Angular's core forms API.
  24851. *
  24852. * @param {?} isDisabled Sets whether the component is disabled.
  24853. * @return {?}
  24854. */
  24855. function (isDisabled) {
  24856. this.disabled = isDisabled;
  24857. this._changeDetectorRef.markForCheck();
  24858. this.stateChanges.next();
  24859. };
  24860. Object.defineProperty(MatSelect.prototype, "panelOpen", {
  24861. /** Whether or not the overlay panel is open. */
  24862. get: /**
  24863. * Whether or not the overlay panel is open.
  24864. * @return {?}
  24865. */
  24866. function () {
  24867. return this._panelOpen;
  24868. },
  24869. enumerable: true,
  24870. configurable: true
  24871. });
  24872. Object.defineProperty(MatSelect.prototype, "selected", {
  24873. /** The currently selected option. */
  24874. get: /**
  24875. * The currently selected option.
  24876. * @return {?}
  24877. */
  24878. function () {
  24879. return this.multiple ? this._selectionModel.selected : this._selectionModel.selected[0];
  24880. },
  24881. enumerable: true,
  24882. configurable: true
  24883. });
  24884. Object.defineProperty(MatSelect.prototype, "triggerValue", {
  24885. /** The value displayed in the trigger. */
  24886. get: /**
  24887. * The value displayed in the trigger.
  24888. * @return {?}
  24889. */
  24890. function () {
  24891. if (this.empty) {
  24892. return '';
  24893. }
  24894. if (this._multiple) {
  24895. /** @type {?} */
  24896. var selectedOptions = this._selectionModel.selected.map((/**
  24897. * @param {?} option
  24898. * @return {?}
  24899. */
  24900. function (option) { return option.viewValue; }));
  24901. if (this._isRtl()) {
  24902. selectedOptions.reverse();
  24903. }
  24904. // TODO(crisbeto): delimiter should be configurable for proper localization.
  24905. return selectedOptions.join(', ');
  24906. }
  24907. return this._selectionModel.selected[0].viewValue;
  24908. },
  24909. enumerable: true,
  24910. configurable: true
  24911. });
  24912. /** Whether the element is in RTL mode. */
  24913. /**
  24914. * Whether the element is in RTL mode.
  24915. * @return {?}
  24916. */
  24917. MatSelect.prototype._isRtl = /**
  24918. * Whether the element is in RTL mode.
  24919. * @return {?}
  24920. */
  24921. function () {
  24922. return this._dir ? this._dir.value === 'rtl' : false;
  24923. };
  24924. /** Handles all keydown events on the select. */
  24925. /**
  24926. * Handles all keydown events on the select.
  24927. * @param {?} event
  24928. * @return {?}
  24929. */
  24930. MatSelect.prototype._handleKeydown = /**
  24931. * Handles all keydown events on the select.
  24932. * @param {?} event
  24933. * @return {?}
  24934. */
  24935. function (event) {
  24936. if (!this.disabled) {
  24937. this.panelOpen ? this._handleOpenKeydown(event) : this._handleClosedKeydown(event);
  24938. }
  24939. };
  24940. /** Handles keyboard events while the select is closed. */
  24941. /**
  24942. * Handles keyboard events while the select is closed.
  24943. * @private
  24944. * @param {?} event
  24945. * @return {?}
  24946. */
  24947. MatSelect.prototype._handleClosedKeydown = /**
  24948. * Handles keyboard events while the select is closed.
  24949. * @private
  24950. * @param {?} event
  24951. * @return {?}
  24952. */
  24953. function (event) {
  24954. /** @type {?} */
  24955. var keyCode = event.keyCode;
  24956. /** @type {?} */
  24957. var isArrowKey = keyCode === keycodes.DOWN_ARROW || keyCode === keycodes.UP_ARROW ||
  24958. keyCode === keycodes.LEFT_ARROW || keyCode === keycodes.RIGHT_ARROW;
  24959. /** @type {?} */
  24960. var isOpenKey = keyCode === keycodes.ENTER || keyCode === keycodes.SPACE;
  24961. /** @type {?} */
  24962. var manager = this._keyManager;
  24963. // Open the select on ALT + arrow key to match the native <select>
  24964. if ((isOpenKey && !keycodes.hasModifierKey(event)) || ((this.multiple || event.altKey) && isArrowKey)) {
  24965. event.preventDefault(); // prevents the page from scrolling down when pressing space
  24966. this.open();
  24967. }
  24968. else if (!this.multiple) {
  24969. /** @type {?} */
  24970. var previouslySelectedOption = this.selected;
  24971. if (keyCode === keycodes.HOME || keyCode === keycodes.END) {
  24972. keyCode === keycodes.HOME ? manager.setFirstItemActive() : manager.setLastItemActive();
  24973. event.preventDefault();
  24974. }
  24975. else {
  24976. manager.onKeydown(event);
  24977. }
  24978. /** @type {?} */
  24979. var selectedOption = this.selected;
  24980. // Since the value has changed, we need to announce it ourselves.
  24981. // @breaking-change 8.0.0 remove null check for _liveAnnouncer.
  24982. if (this._liveAnnouncer && selectedOption && previouslySelectedOption !== selectedOption) {
  24983. // We set a duration on the live announcement, because we want the live element to be
  24984. // cleared after a while so that users can't navigate to it using the arrow keys.
  24985. this._liveAnnouncer.announce(((/** @type {?} */ (selectedOption))).viewValue, 10000);
  24986. }
  24987. }
  24988. };
  24989. /** Handles keyboard events when the selected is open. */
  24990. /**
  24991. * Handles keyboard events when the selected is open.
  24992. * @private
  24993. * @param {?} event
  24994. * @return {?}
  24995. */
  24996. MatSelect.prototype._handleOpenKeydown = /**
  24997. * Handles keyboard events when the selected is open.
  24998. * @private
  24999. * @param {?} event
  25000. * @return {?}
  25001. */
  25002. function (event) {
  25003. /** @type {?} */
  25004. var keyCode = event.keyCode;
  25005. /** @type {?} */
  25006. var isArrowKey = keyCode === keycodes.DOWN_ARROW || keyCode === keycodes.UP_ARROW;
  25007. /** @type {?} */
  25008. var manager = this._keyManager;
  25009. if (keyCode === keycodes.HOME || keyCode === keycodes.END) {
  25010. event.preventDefault();
  25011. keyCode === keycodes.HOME ? manager.setFirstItemActive() : manager.setLastItemActive();
  25012. }
  25013. else if (isArrowKey && event.altKey) {
  25014. // Close the select on ALT + arrow key to match the native <select>
  25015. event.preventDefault();
  25016. this.close();
  25017. }
  25018. else if ((keyCode === keycodes.ENTER || keyCode === keycodes.SPACE) && manager.activeItem &&
  25019. !keycodes.hasModifierKey(event)) {
  25020. event.preventDefault();
  25021. manager.activeItem._selectViaInteraction();
  25022. }
  25023. else if (this._multiple && keyCode === keycodes.A && event.ctrlKey) {
  25024. event.preventDefault();
  25025. /** @type {?} */
  25026. var hasDeselectedOptions_1 = this.options.some((/**
  25027. * @param {?} opt
  25028. * @return {?}
  25029. */
  25030. function (opt) { return !opt.disabled && !opt.selected; }));
  25031. this.options.forEach((/**
  25032. * @param {?} option
  25033. * @return {?}
  25034. */
  25035. function (option) {
  25036. if (!option.disabled) {
  25037. hasDeselectedOptions_1 ? option.select() : option.deselect();
  25038. }
  25039. }));
  25040. }
  25041. else {
  25042. /** @type {?} */
  25043. var previouslyFocusedIndex = manager.activeItemIndex;
  25044. manager.onKeydown(event);
  25045. if (this._multiple && isArrowKey && event.shiftKey && manager.activeItem &&
  25046. manager.activeItemIndex !== previouslyFocusedIndex) {
  25047. manager.activeItem._selectViaInteraction();
  25048. }
  25049. }
  25050. };
  25051. /**
  25052. * @return {?}
  25053. */
  25054. MatSelect.prototype._onFocus = /**
  25055. * @return {?}
  25056. */
  25057. function () {
  25058. if (!this.disabled) {
  25059. this._focused = true;
  25060. this.stateChanges.next();
  25061. }
  25062. };
  25063. /**
  25064. * Calls the touched callback only if the panel is closed. Otherwise, the trigger will
  25065. * "blur" to the panel when it opens, causing a false positive.
  25066. */
  25067. /**
  25068. * Calls the touched callback only if the panel is closed. Otherwise, the trigger will
  25069. * "blur" to the panel when it opens, causing a false positive.
  25070. * @return {?}
  25071. */
  25072. MatSelect.prototype._onBlur = /**
  25073. * Calls the touched callback only if the panel is closed. Otherwise, the trigger will
  25074. * "blur" to the panel when it opens, causing a false positive.
  25075. * @return {?}
  25076. */
  25077. function () {
  25078. this._focused = false;
  25079. if (!this.disabled && !this.panelOpen) {
  25080. this._onTouched();
  25081. this._changeDetectorRef.markForCheck();
  25082. this.stateChanges.next();
  25083. }
  25084. };
  25085. /**
  25086. * Callback that is invoked when the overlay panel has been attached.
  25087. */
  25088. /**
  25089. * Callback that is invoked when the overlay panel has been attached.
  25090. * @return {?}
  25091. */
  25092. MatSelect.prototype._onAttached = /**
  25093. * Callback that is invoked when the overlay panel has been attached.
  25094. * @return {?}
  25095. */
  25096. function () {
  25097. var _this = this;
  25098. this.overlayDir.positionChange.pipe(operators.take(1)).subscribe((/**
  25099. * @return {?}
  25100. */
  25101. function () {
  25102. _this._changeDetectorRef.detectChanges();
  25103. _this._calculateOverlayOffsetX();
  25104. _this.panel.nativeElement.scrollTop = _this._scrollTop;
  25105. }));
  25106. };
  25107. /** Returns the theme to be used on the panel. */
  25108. /**
  25109. * Returns the theme to be used on the panel.
  25110. * @return {?}
  25111. */
  25112. MatSelect.prototype._getPanelTheme = /**
  25113. * Returns the theme to be used on the panel.
  25114. * @return {?}
  25115. */
  25116. function () {
  25117. return this._parentFormField ? "mat-" + this._parentFormField.color : '';
  25118. };
  25119. Object.defineProperty(MatSelect.prototype, "empty", {
  25120. /** Whether the select has a value. */
  25121. get: /**
  25122. * Whether the select has a value.
  25123. * @return {?}
  25124. */
  25125. function () {
  25126. return !this._selectionModel || this._selectionModel.isEmpty();
  25127. },
  25128. enumerable: true,
  25129. configurable: true
  25130. });
  25131. /**
  25132. * @private
  25133. * @return {?}
  25134. */
  25135. MatSelect.prototype._initializeSelection = /**
  25136. * @private
  25137. * @return {?}
  25138. */
  25139. function () {
  25140. var _this = this;
  25141. // Defer setting the value in order to avoid the "Expression
  25142. // has changed after it was checked" errors from Angular.
  25143. Promise.resolve().then((/**
  25144. * @return {?}
  25145. */
  25146. function () {
  25147. _this._setSelectionByValue(_this.ngControl ? _this.ngControl.value : _this._value);
  25148. _this.stateChanges.next();
  25149. }));
  25150. };
  25151. /**
  25152. * Sets the selected option based on a value. If no option can be
  25153. * found with the designated value, the select trigger is cleared.
  25154. */
  25155. /**
  25156. * Sets the selected option based on a value. If no option can be
  25157. * found with the designated value, the select trigger is cleared.
  25158. * @private
  25159. * @param {?} value
  25160. * @return {?}
  25161. */
  25162. MatSelect.prototype._setSelectionByValue = /**
  25163. * Sets the selected option based on a value. If no option can be
  25164. * found with the designated value, the select trigger is cleared.
  25165. * @private
  25166. * @param {?} value
  25167. * @return {?}
  25168. */
  25169. function (value) {
  25170. var _this = this;
  25171. if (this.multiple && value) {
  25172. if (!Array.isArray(value)) {
  25173. throw getMatSelectNonArrayValueError();
  25174. }
  25175. this._selectionModel.clear();
  25176. value.forEach((/**
  25177. * @param {?} currentValue
  25178. * @return {?}
  25179. */
  25180. function (currentValue) { return _this._selectValue(currentValue); }));
  25181. this._sortValues();
  25182. }
  25183. else {
  25184. this._selectionModel.clear();
  25185. /** @type {?} */
  25186. var correspondingOption = this._selectValue(value);
  25187. // Shift focus to the active item. Note that we shouldn't do this in multiple
  25188. // mode, because we don't know what option the user interacted with last.
  25189. if (correspondingOption) {
  25190. this._keyManager.setActiveItem(correspondingOption);
  25191. }
  25192. }
  25193. this._changeDetectorRef.markForCheck();
  25194. };
  25195. /**
  25196. * Finds and selects and option based on its value.
  25197. * @returns Option that has the corresponding value.
  25198. */
  25199. /**
  25200. * Finds and selects and option based on its value.
  25201. * @private
  25202. * @param {?} value
  25203. * @return {?} Option that has the corresponding value.
  25204. */
  25205. MatSelect.prototype._selectValue = /**
  25206. * Finds and selects and option based on its value.
  25207. * @private
  25208. * @param {?} value
  25209. * @return {?} Option that has the corresponding value.
  25210. */
  25211. function (value) {
  25212. var _this = this;
  25213. /** @type {?} */
  25214. var correspondingOption = this.options.find((/**
  25215. * @param {?} option
  25216. * @return {?}
  25217. */
  25218. function (option) {
  25219. try {
  25220. // Treat null as a special reset value.
  25221. return option.value != null && _this._compareWith(option.value, value);
  25222. }
  25223. catch (error) {
  25224. if (core.isDevMode()) {
  25225. // Notify developers of errors in their comparator.
  25226. console.warn(error);
  25227. }
  25228. return false;
  25229. }
  25230. }));
  25231. if (correspondingOption) {
  25232. this._selectionModel.select(correspondingOption);
  25233. }
  25234. return correspondingOption;
  25235. };
  25236. /** Sets up a key manager to listen to keyboard events on the overlay panel. */
  25237. /**
  25238. * Sets up a key manager to listen to keyboard events on the overlay panel.
  25239. * @private
  25240. * @return {?}
  25241. */
  25242. MatSelect.prototype._initKeyManager = /**
  25243. * Sets up a key manager to listen to keyboard events on the overlay panel.
  25244. * @private
  25245. * @return {?}
  25246. */
  25247. function () {
  25248. var _this = this;
  25249. this._keyManager = new a11y.ActiveDescendantKeyManager(this.options)
  25250. .withTypeAhead()
  25251. .withVerticalOrientation()
  25252. .withHorizontalOrientation(this._isRtl() ? 'rtl' : 'ltr')
  25253. .withAllowedModifierKeys(['shiftKey']);
  25254. this._keyManager.tabOut.pipe(operators.takeUntil(this._destroy)).subscribe((/**
  25255. * @return {?}
  25256. */
  25257. function () {
  25258. // Restore focus to the trigger before closing. Ensures that the focus
  25259. // position won't be lost if the user got focus into the overlay.
  25260. _this.focus();
  25261. _this.close();
  25262. }));
  25263. this._keyManager.change.pipe(operators.takeUntil(this._destroy)).subscribe((/**
  25264. * @return {?}
  25265. */
  25266. function () {
  25267. if (_this._panelOpen && _this.panel) {
  25268. _this._scrollActiveOptionIntoView();
  25269. }
  25270. else if (!_this._panelOpen && !_this.multiple && _this._keyManager.activeItem) {
  25271. _this._keyManager.activeItem._selectViaInteraction();
  25272. }
  25273. }));
  25274. };
  25275. /** Drops current option subscriptions and IDs and resets from scratch. */
  25276. /**
  25277. * Drops current option subscriptions and IDs and resets from scratch.
  25278. * @private
  25279. * @return {?}
  25280. */
  25281. MatSelect.prototype._resetOptions = /**
  25282. * Drops current option subscriptions and IDs and resets from scratch.
  25283. * @private
  25284. * @return {?}
  25285. */
  25286. function () {
  25287. var _this = this;
  25288. /** @type {?} */
  25289. var changedOrDestroyed = rxjs.merge(this.options.changes, this._destroy);
  25290. this.optionSelectionChanges.pipe(operators.takeUntil(changedOrDestroyed)).subscribe((/**
  25291. * @param {?} event
  25292. * @return {?}
  25293. */
  25294. function (event) {
  25295. _this._onSelect(event.source, event.isUserInput);
  25296. if (event.isUserInput && !_this.multiple && _this._panelOpen) {
  25297. _this.close();
  25298. _this.focus();
  25299. }
  25300. }));
  25301. // Listen to changes in the internal state of the options and react accordingly.
  25302. // Handles cases like the labels of the selected options changing.
  25303. rxjs.merge.apply(void 0, this.options.map((/**
  25304. * @param {?} option
  25305. * @return {?}
  25306. */
  25307. function (option) { return option._stateChanges; }))).pipe(operators.takeUntil(changedOrDestroyed))
  25308. .subscribe((/**
  25309. * @return {?}
  25310. */
  25311. function () {
  25312. _this._changeDetectorRef.markForCheck();
  25313. _this.stateChanges.next();
  25314. }));
  25315. this._setOptionIds();
  25316. };
  25317. /** Invoked when an option is clicked. */
  25318. /**
  25319. * Invoked when an option is clicked.
  25320. * @private
  25321. * @param {?} option
  25322. * @param {?} isUserInput
  25323. * @return {?}
  25324. */
  25325. MatSelect.prototype._onSelect = /**
  25326. * Invoked when an option is clicked.
  25327. * @private
  25328. * @param {?} option
  25329. * @param {?} isUserInput
  25330. * @return {?}
  25331. */
  25332. function (option, isUserInput) {
  25333. /** @type {?} */
  25334. var wasSelected = this._selectionModel.isSelected(option);
  25335. if (option.value == null && !this._multiple) {
  25336. option.deselect();
  25337. this._selectionModel.clear();
  25338. this._propagateChanges(option.value);
  25339. }
  25340. else {
  25341. option.selected ? this._selectionModel.select(option) : this._selectionModel.deselect(option);
  25342. if (isUserInput) {
  25343. this._keyManager.setActiveItem(option);
  25344. }
  25345. if (this.multiple) {
  25346. this._sortValues();
  25347. if (isUserInput) {
  25348. // In case the user selected the option with their mouse, we
  25349. // want to restore focus back to the trigger, in order to
  25350. // prevent the select keyboard controls from clashing with
  25351. // the ones from `mat-option`.
  25352. this.focus();
  25353. }
  25354. }
  25355. }
  25356. if (wasSelected !== this._selectionModel.isSelected(option)) {
  25357. this._propagateChanges();
  25358. }
  25359. this.stateChanges.next();
  25360. };
  25361. /** Sorts the selected values in the selected based on their order in the panel. */
  25362. /**
  25363. * Sorts the selected values in the selected based on their order in the panel.
  25364. * @private
  25365. * @return {?}
  25366. */
  25367. MatSelect.prototype._sortValues = /**
  25368. * Sorts the selected values in the selected based on their order in the panel.
  25369. * @private
  25370. * @return {?}
  25371. */
  25372. function () {
  25373. var _this = this;
  25374. if (this.multiple) {
  25375. /** @type {?} */
  25376. var options_1 = this.options.toArray();
  25377. this._selectionModel.sort((/**
  25378. * @param {?} a
  25379. * @param {?} b
  25380. * @return {?}
  25381. */
  25382. function (a, b) {
  25383. return _this.sortComparator ? _this.sortComparator(a, b, options_1) :
  25384. options_1.indexOf(a) - options_1.indexOf(b);
  25385. }));
  25386. this.stateChanges.next();
  25387. }
  25388. };
  25389. /** Emits change event to set the model value. */
  25390. /**
  25391. * Emits change event to set the model value.
  25392. * @private
  25393. * @param {?=} fallbackValue
  25394. * @return {?}
  25395. */
  25396. MatSelect.prototype._propagateChanges = /**
  25397. * Emits change event to set the model value.
  25398. * @private
  25399. * @param {?=} fallbackValue
  25400. * @return {?}
  25401. */
  25402. function (fallbackValue) {
  25403. /** @type {?} */
  25404. var valueToEmit = null;
  25405. if (this.multiple) {
  25406. valueToEmit = ((/** @type {?} */ (this.selected))).map((/**
  25407. * @param {?} option
  25408. * @return {?}
  25409. */
  25410. function (option) { return option.value; }));
  25411. }
  25412. else {
  25413. valueToEmit = this.selected ? ((/** @type {?} */ (this.selected))).value : fallbackValue;
  25414. }
  25415. this._value = valueToEmit;
  25416. this.valueChange.emit(valueToEmit);
  25417. this._onChange(valueToEmit);
  25418. this.selectionChange.emit(new MatSelectChange(this, valueToEmit));
  25419. this._changeDetectorRef.markForCheck();
  25420. };
  25421. /** Records option IDs to pass to the aria-owns property. */
  25422. /**
  25423. * Records option IDs to pass to the aria-owns property.
  25424. * @private
  25425. * @return {?}
  25426. */
  25427. MatSelect.prototype._setOptionIds = /**
  25428. * Records option IDs to pass to the aria-owns property.
  25429. * @private
  25430. * @return {?}
  25431. */
  25432. function () {
  25433. this._optionIds = this.options.map((/**
  25434. * @param {?} option
  25435. * @return {?}
  25436. */
  25437. function (option) { return option.id; })).join(' ');
  25438. };
  25439. /**
  25440. * Highlights the selected item. If no option is selected, it will highlight
  25441. * the first item instead.
  25442. */
  25443. /**
  25444. * Highlights the selected item. If no option is selected, it will highlight
  25445. * the first item instead.
  25446. * @private
  25447. * @return {?}
  25448. */
  25449. MatSelect.prototype._highlightCorrectOption = /**
  25450. * Highlights the selected item. If no option is selected, it will highlight
  25451. * the first item instead.
  25452. * @private
  25453. * @return {?}
  25454. */
  25455. function () {
  25456. if (this._keyManager) {
  25457. if (this.empty) {
  25458. this._keyManager.setFirstItemActive();
  25459. }
  25460. else {
  25461. this._keyManager.setActiveItem(this._selectionModel.selected[0]);
  25462. }
  25463. }
  25464. };
  25465. /** Scrolls the active option into view. */
  25466. /**
  25467. * Scrolls the active option into view.
  25468. * @private
  25469. * @return {?}
  25470. */
  25471. MatSelect.prototype._scrollActiveOptionIntoView = /**
  25472. * Scrolls the active option into view.
  25473. * @private
  25474. * @return {?}
  25475. */
  25476. function () {
  25477. /** @type {?} */
  25478. var activeOptionIndex = this._keyManager.activeItemIndex || 0;
  25479. /** @type {?} */
  25480. var labelCount = _countGroupLabelsBeforeOption(activeOptionIndex, this.options, this.optionGroups);
  25481. this.panel.nativeElement.scrollTop = _getOptionScrollPosition(activeOptionIndex + labelCount, this._getItemHeight(), this.panel.nativeElement.scrollTop, SELECT_PANEL_MAX_HEIGHT);
  25482. };
  25483. /** Focuses the select element. */
  25484. /**
  25485. * Focuses the select element.
  25486. * @param {?=} options
  25487. * @return {?}
  25488. */
  25489. MatSelect.prototype.focus = /**
  25490. * Focuses the select element.
  25491. * @param {?=} options
  25492. * @return {?}
  25493. */
  25494. function (options) {
  25495. this._elementRef.nativeElement.focus(options);
  25496. };
  25497. /** Gets the index of the provided option in the option list. */
  25498. /**
  25499. * Gets the index of the provided option in the option list.
  25500. * @private
  25501. * @param {?} option
  25502. * @return {?}
  25503. */
  25504. MatSelect.prototype._getOptionIndex = /**
  25505. * Gets the index of the provided option in the option list.
  25506. * @private
  25507. * @param {?} option
  25508. * @return {?}
  25509. */
  25510. function (option) {
  25511. return this.options.reduce((/**
  25512. * @param {?} result
  25513. * @param {?} current
  25514. * @param {?} index
  25515. * @return {?}
  25516. */
  25517. function (result, current, index) {
  25518. return result === undefined ? (option === current ? index : undefined) : result;
  25519. }), undefined);
  25520. };
  25521. /** Calculates the scroll position and x- and y-offsets of the overlay panel. */
  25522. /**
  25523. * Calculates the scroll position and x- and y-offsets of the overlay panel.
  25524. * @private
  25525. * @return {?}
  25526. */
  25527. MatSelect.prototype._calculateOverlayPosition = /**
  25528. * Calculates the scroll position and x- and y-offsets of the overlay panel.
  25529. * @private
  25530. * @return {?}
  25531. */
  25532. function () {
  25533. /** @type {?} */
  25534. var itemHeight = this._getItemHeight();
  25535. /** @type {?} */
  25536. var items = this._getItemCount();
  25537. /** @type {?} */
  25538. var panelHeight = Math.min(items * itemHeight, SELECT_PANEL_MAX_HEIGHT);
  25539. /** @type {?} */
  25540. var scrollContainerHeight = items * itemHeight;
  25541. // The farthest the panel can be scrolled before it hits the bottom
  25542. /** @type {?} */
  25543. var maxScroll = scrollContainerHeight - panelHeight;
  25544. // If no value is selected we open the popup to the first item.
  25545. /** @type {?} */
  25546. var selectedOptionOffset = this.empty ? 0 : (/** @type {?} */ (this._getOptionIndex(this._selectionModel.selected[0])));
  25547. selectedOptionOffset += _countGroupLabelsBeforeOption(selectedOptionOffset, this.options, this.optionGroups);
  25548. // We must maintain a scroll buffer so the selected option will be scrolled to the
  25549. // center of the overlay panel rather than the top.
  25550. /** @type {?} */
  25551. var scrollBuffer = panelHeight / 2;
  25552. this._scrollTop = this._calculateOverlayScroll(selectedOptionOffset, scrollBuffer, maxScroll);
  25553. this._offsetY = this._calculateOverlayOffsetY(selectedOptionOffset, scrollBuffer, maxScroll);
  25554. this._checkOverlayWithinViewport(maxScroll);
  25555. };
  25556. /**
  25557. * Calculates the scroll position of the select's overlay panel.
  25558. *
  25559. * Attempts to center the selected option in the panel. If the option is
  25560. * too high or too low in the panel to be scrolled to the center, it clamps the
  25561. * scroll position to the min or max scroll positions respectively.
  25562. */
  25563. /**
  25564. * Calculates the scroll position of the select's overlay panel.
  25565. *
  25566. * Attempts to center the selected option in the panel. If the option is
  25567. * too high or too low in the panel to be scrolled to the center, it clamps the
  25568. * scroll position to the min or max scroll positions respectively.
  25569. * @param {?} selectedIndex
  25570. * @param {?} scrollBuffer
  25571. * @param {?} maxScroll
  25572. * @return {?}
  25573. */
  25574. MatSelect.prototype._calculateOverlayScroll = /**
  25575. * Calculates the scroll position of the select's overlay panel.
  25576. *
  25577. * Attempts to center the selected option in the panel. If the option is
  25578. * too high or too low in the panel to be scrolled to the center, it clamps the
  25579. * scroll position to the min or max scroll positions respectively.
  25580. * @param {?} selectedIndex
  25581. * @param {?} scrollBuffer
  25582. * @param {?} maxScroll
  25583. * @return {?}
  25584. */
  25585. function (selectedIndex, scrollBuffer, maxScroll) {
  25586. /** @type {?} */
  25587. var itemHeight = this._getItemHeight();
  25588. /** @type {?} */
  25589. var optionOffsetFromScrollTop = itemHeight * selectedIndex;
  25590. /** @type {?} */
  25591. var halfOptionHeight = itemHeight / 2;
  25592. // Starts at the optionOffsetFromScrollTop, which scrolls the option to the top of the
  25593. // scroll container, then subtracts the scroll buffer to scroll the option down to
  25594. // the center of the overlay panel. Half the option height must be re-added to the
  25595. // scrollTop so the option is centered based on its middle, not its top edge.
  25596. /** @type {?} */
  25597. var optimalScrollPosition = optionOffsetFromScrollTop - scrollBuffer + halfOptionHeight;
  25598. return Math.min(Math.max(0, optimalScrollPosition), maxScroll);
  25599. };
  25600. /** Returns the aria-label of the select component. */
  25601. /**
  25602. * Returns the aria-label of the select component.
  25603. * @return {?}
  25604. */
  25605. MatSelect.prototype._getAriaLabel = /**
  25606. * Returns the aria-label of the select component.
  25607. * @return {?}
  25608. */
  25609. function () {
  25610. // If an ariaLabelledby value has been set by the consumer, the select should not overwrite the
  25611. // `aria-labelledby` value by setting the ariaLabel to the placeholder.
  25612. return this.ariaLabelledby ? null : this.ariaLabel || this.placeholder;
  25613. };
  25614. /** Returns the aria-labelledby of the select component. */
  25615. /**
  25616. * Returns the aria-labelledby of the select component.
  25617. * @return {?}
  25618. */
  25619. MatSelect.prototype._getAriaLabelledby = /**
  25620. * Returns the aria-labelledby of the select component.
  25621. * @return {?}
  25622. */
  25623. function () {
  25624. if (this.ariaLabelledby) {
  25625. return this.ariaLabelledby;
  25626. }
  25627. // Note: we use `_getAriaLabel` here, because we want to check whether there's a
  25628. // computed label. `this.ariaLabel` is only the user-specified label.
  25629. if (!this._parentFormField || !this._parentFormField._hasFloatingLabel() ||
  25630. this._getAriaLabel()) {
  25631. return null;
  25632. }
  25633. return this._parentFormField._labelId || null;
  25634. };
  25635. /** Determines the `aria-activedescendant` to be set on the host. */
  25636. /**
  25637. * Determines the `aria-activedescendant` to be set on the host.
  25638. * @return {?}
  25639. */
  25640. MatSelect.prototype._getAriaActiveDescendant = /**
  25641. * Determines the `aria-activedescendant` to be set on the host.
  25642. * @return {?}
  25643. */
  25644. function () {
  25645. if (this.panelOpen && this._keyManager && this._keyManager.activeItem) {
  25646. return this._keyManager.activeItem.id;
  25647. }
  25648. return null;
  25649. };
  25650. /**
  25651. * Sets the x-offset of the overlay panel in relation to the trigger's top start corner.
  25652. * This must be adjusted to align the selected option text over the trigger text when
  25653. * the panel opens. Will change based on LTR or RTL text direction. Note that the offset
  25654. * can't be calculated until the panel has been attached, because we need to know the
  25655. * content width in order to constrain the panel within the viewport.
  25656. */
  25657. /**
  25658. * Sets the x-offset of the overlay panel in relation to the trigger's top start corner.
  25659. * This must be adjusted to align the selected option text over the trigger text when
  25660. * the panel opens. Will change based on LTR or RTL text direction. Note that the offset
  25661. * can't be calculated until the panel has been attached, because we need to know the
  25662. * content width in order to constrain the panel within the viewport.
  25663. * @private
  25664. * @return {?}
  25665. */
  25666. MatSelect.prototype._calculateOverlayOffsetX = /**
  25667. * Sets the x-offset of the overlay panel in relation to the trigger's top start corner.
  25668. * This must be adjusted to align the selected option text over the trigger text when
  25669. * the panel opens. Will change based on LTR or RTL text direction. Note that the offset
  25670. * can't be calculated until the panel has been attached, because we need to know the
  25671. * content width in order to constrain the panel within the viewport.
  25672. * @private
  25673. * @return {?}
  25674. */
  25675. function () {
  25676. /** @type {?} */
  25677. var overlayRect = this.overlayDir.overlayRef.overlayElement.getBoundingClientRect();
  25678. /** @type {?} */
  25679. var viewportSize = this._viewportRuler.getViewportSize();
  25680. /** @type {?} */
  25681. var isRtl = this._isRtl();
  25682. /** @type {?} */
  25683. var paddingWidth = this.multiple ? SELECT_MULTIPLE_PANEL_PADDING_X + SELECT_PANEL_PADDING_X :
  25684. SELECT_PANEL_PADDING_X * 2;
  25685. /** @type {?} */
  25686. var offsetX;
  25687. // Adjust the offset, depending on the option padding.
  25688. if (this.multiple) {
  25689. offsetX = SELECT_MULTIPLE_PANEL_PADDING_X;
  25690. }
  25691. else {
  25692. /** @type {?} */
  25693. var selected = this._selectionModel.selected[0] || this.options.first;
  25694. offsetX = selected && selected.group ? SELECT_PANEL_INDENT_PADDING_X : SELECT_PANEL_PADDING_X;
  25695. }
  25696. // Invert the offset in LTR.
  25697. if (!isRtl) {
  25698. offsetX *= -1;
  25699. }
  25700. // Determine how much the select overflows on each side.
  25701. /** @type {?} */
  25702. var leftOverflow = 0 - (overlayRect.left + offsetX - (isRtl ? paddingWidth : 0));
  25703. /** @type {?} */
  25704. var rightOverflow = overlayRect.right + offsetX - viewportSize.width
  25705. + (isRtl ? 0 : paddingWidth);
  25706. // If the element overflows on either side, reduce the offset to allow it to fit.
  25707. if (leftOverflow > 0) {
  25708. offsetX += leftOverflow + SELECT_PANEL_VIEWPORT_PADDING;
  25709. }
  25710. else if (rightOverflow > 0) {
  25711. offsetX -= rightOverflow + SELECT_PANEL_VIEWPORT_PADDING;
  25712. }
  25713. // Set the offset directly in order to avoid having to go through change detection and
  25714. // potentially triggering "changed after it was checked" errors. Round the value to avoid
  25715. // blurry content in some browsers.
  25716. this.overlayDir.offsetX = Math.round(offsetX);
  25717. this.overlayDir.overlayRef.updatePosition();
  25718. };
  25719. /**
  25720. * Calculates the y-offset of the select's overlay panel in relation to the
  25721. * top start corner of the trigger. It has to be adjusted in order for the
  25722. * selected option to be aligned over the trigger when the panel opens.
  25723. */
  25724. /**
  25725. * Calculates the y-offset of the select's overlay panel in relation to the
  25726. * top start corner of the trigger. It has to be adjusted in order for the
  25727. * selected option to be aligned over the trigger when the panel opens.
  25728. * @private
  25729. * @param {?} selectedIndex
  25730. * @param {?} scrollBuffer
  25731. * @param {?} maxScroll
  25732. * @return {?}
  25733. */
  25734. MatSelect.prototype._calculateOverlayOffsetY = /**
  25735. * Calculates the y-offset of the select's overlay panel in relation to the
  25736. * top start corner of the trigger. It has to be adjusted in order for the
  25737. * selected option to be aligned over the trigger when the panel opens.
  25738. * @private
  25739. * @param {?} selectedIndex
  25740. * @param {?} scrollBuffer
  25741. * @param {?} maxScroll
  25742. * @return {?}
  25743. */
  25744. function (selectedIndex, scrollBuffer, maxScroll) {
  25745. /** @type {?} */
  25746. var itemHeight = this._getItemHeight();
  25747. /** @type {?} */
  25748. var optionHeightAdjustment = (itemHeight - this._triggerRect.height) / 2;
  25749. /** @type {?} */
  25750. var maxOptionsDisplayed = Math.floor(SELECT_PANEL_MAX_HEIGHT / itemHeight);
  25751. /** @type {?} */
  25752. var optionOffsetFromPanelTop;
  25753. // Disable offset if requested by user by returning 0 as value to offset
  25754. if (this._disableOptionCentering) {
  25755. return 0;
  25756. }
  25757. if (this._scrollTop === 0) {
  25758. optionOffsetFromPanelTop = selectedIndex * itemHeight;
  25759. }
  25760. else if (this._scrollTop === maxScroll) {
  25761. /** @type {?} */
  25762. var firstDisplayedIndex = this._getItemCount() - maxOptionsDisplayed;
  25763. /** @type {?} */
  25764. var selectedDisplayIndex = selectedIndex - firstDisplayedIndex;
  25765. // The first item is partially out of the viewport. Therefore we need to calculate what
  25766. // portion of it is shown in the viewport and account for it in our offset.
  25767. /** @type {?} */
  25768. var partialItemHeight = itemHeight - (this._getItemCount() * itemHeight - SELECT_PANEL_MAX_HEIGHT) % itemHeight;
  25769. // Because the panel height is longer than the height of the options alone,
  25770. // there is always extra padding at the top or bottom of the panel. When
  25771. // scrolled to the very bottom, this padding is at the top of the panel and
  25772. // must be added to the offset.
  25773. optionOffsetFromPanelTop = selectedDisplayIndex * itemHeight + partialItemHeight;
  25774. }
  25775. else {
  25776. // If the option was scrolled to the middle of the panel using a scroll buffer,
  25777. // its offset will be the scroll buffer minus the half height that was added to
  25778. // center it.
  25779. optionOffsetFromPanelTop = scrollBuffer - itemHeight / 2;
  25780. }
  25781. // The final offset is the option's offset from the top, adjusted for the height difference,
  25782. // multiplied by -1 to ensure that the overlay moves in the correct direction up the page.
  25783. // The value is rounded to prevent some browsers from blurring the content.
  25784. return Math.round(optionOffsetFromPanelTop * -1 - optionHeightAdjustment);
  25785. };
  25786. /**
  25787. * Checks that the attempted overlay position will fit within the viewport.
  25788. * If it will not fit, tries to adjust the scroll position and the associated
  25789. * y-offset so the panel can open fully on-screen. If it still won't fit,
  25790. * sets the offset back to 0 to allow the fallback position to take over.
  25791. */
  25792. /**
  25793. * Checks that the attempted overlay position will fit within the viewport.
  25794. * If it will not fit, tries to adjust the scroll position and the associated
  25795. * y-offset so the panel can open fully on-screen. If it still won't fit,
  25796. * sets the offset back to 0 to allow the fallback position to take over.
  25797. * @private
  25798. * @param {?} maxScroll
  25799. * @return {?}
  25800. */
  25801. MatSelect.prototype._checkOverlayWithinViewport = /**
  25802. * Checks that the attempted overlay position will fit within the viewport.
  25803. * If it will not fit, tries to adjust the scroll position and the associated
  25804. * y-offset so the panel can open fully on-screen. If it still won't fit,
  25805. * sets the offset back to 0 to allow the fallback position to take over.
  25806. * @private
  25807. * @param {?} maxScroll
  25808. * @return {?}
  25809. */
  25810. function (maxScroll) {
  25811. /** @type {?} */
  25812. var itemHeight = this._getItemHeight();
  25813. /** @type {?} */
  25814. var viewportSize = this._viewportRuler.getViewportSize();
  25815. /** @type {?} */
  25816. var topSpaceAvailable = this._triggerRect.top - SELECT_PANEL_VIEWPORT_PADDING;
  25817. /** @type {?} */
  25818. var bottomSpaceAvailable = viewportSize.height - this._triggerRect.bottom - SELECT_PANEL_VIEWPORT_PADDING;
  25819. /** @type {?} */
  25820. var panelHeightTop = Math.abs(this._offsetY);
  25821. /** @type {?} */
  25822. var totalPanelHeight = Math.min(this._getItemCount() * itemHeight, SELECT_PANEL_MAX_HEIGHT);
  25823. /** @type {?} */
  25824. var panelHeightBottom = totalPanelHeight - panelHeightTop - this._triggerRect.height;
  25825. if (panelHeightBottom > bottomSpaceAvailable) {
  25826. this._adjustPanelUp(panelHeightBottom, bottomSpaceAvailable);
  25827. }
  25828. else if (panelHeightTop > topSpaceAvailable) {
  25829. this._adjustPanelDown(panelHeightTop, topSpaceAvailable, maxScroll);
  25830. }
  25831. else {
  25832. this._transformOrigin = this._getOriginBasedOnOption();
  25833. }
  25834. };
  25835. /** Adjusts the overlay panel up to fit in the viewport. */
  25836. /**
  25837. * Adjusts the overlay panel up to fit in the viewport.
  25838. * @private
  25839. * @param {?} panelHeightBottom
  25840. * @param {?} bottomSpaceAvailable
  25841. * @return {?}
  25842. */
  25843. MatSelect.prototype._adjustPanelUp = /**
  25844. * Adjusts the overlay panel up to fit in the viewport.
  25845. * @private
  25846. * @param {?} panelHeightBottom
  25847. * @param {?} bottomSpaceAvailable
  25848. * @return {?}
  25849. */
  25850. function (panelHeightBottom, bottomSpaceAvailable) {
  25851. // Browsers ignore fractional scroll offsets, so we need to round.
  25852. /** @type {?} */
  25853. var distanceBelowViewport = Math.round(panelHeightBottom - bottomSpaceAvailable);
  25854. // Scrolls the panel up by the distance it was extending past the boundary, then
  25855. // adjusts the offset by that amount to move the panel up into the viewport.
  25856. this._scrollTop -= distanceBelowViewport;
  25857. this._offsetY -= distanceBelowViewport;
  25858. this._transformOrigin = this._getOriginBasedOnOption();
  25859. // If the panel is scrolled to the very top, it won't be able to fit the panel
  25860. // by scrolling, so set the offset to 0 to allow the fallback position to take
  25861. // effect.
  25862. if (this._scrollTop <= 0) {
  25863. this._scrollTop = 0;
  25864. this._offsetY = 0;
  25865. this._transformOrigin = "50% bottom 0px";
  25866. }
  25867. };
  25868. /** Adjusts the overlay panel down to fit in the viewport. */
  25869. /**
  25870. * Adjusts the overlay panel down to fit in the viewport.
  25871. * @private
  25872. * @param {?} panelHeightTop
  25873. * @param {?} topSpaceAvailable
  25874. * @param {?} maxScroll
  25875. * @return {?}
  25876. */
  25877. MatSelect.prototype._adjustPanelDown = /**
  25878. * Adjusts the overlay panel down to fit in the viewport.
  25879. * @private
  25880. * @param {?} panelHeightTop
  25881. * @param {?} topSpaceAvailable
  25882. * @param {?} maxScroll
  25883. * @return {?}
  25884. */
  25885. function (panelHeightTop, topSpaceAvailable, maxScroll) {
  25886. // Browsers ignore fractional scroll offsets, so we need to round.
  25887. /** @type {?} */
  25888. var distanceAboveViewport = Math.round(panelHeightTop - topSpaceAvailable);
  25889. // Scrolls the panel down by the distance it was extending past the boundary, then
  25890. // adjusts the offset by that amount to move the panel down into the viewport.
  25891. this._scrollTop += distanceAboveViewport;
  25892. this._offsetY += distanceAboveViewport;
  25893. this._transformOrigin = this._getOriginBasedOnOption();
  25894. // If the panel is scrolled to the very bottom, it won't be able to fit the
  25895. // panel by scrolling, so set the offset to 0 to allow the fallback position
  25896. // to take effect.
  25897. if (this._scrollTop >= maxScroll) {
  25898. this._scrollTop = maxScroll;
  25899. this._offsetY = 0;
  25900. this._transformOrigin = "50% top 0px";
  25901. return;
  25902. }
  25903. };
  25904. /** Sets the transform origin point based on the selected option. */
  25905. /**
  25906. * Sets the transform origin point based on the selected option.
  25907. * @private
  25908. * @return {?}
  25909. */
  25910. MatSelect.prototype._getOriginBasedOnOption = /**
  25911. * Sets the transform origin point based on the selected option.
  25912. * @private
  25913. * @return {?}
  25914. */
  25915. function () {
  25916. /** @type {?} */
  25917. var itemHeight = this._getItemHeight();
  25918. /** @type {?} */
  25919. var optionHeightAdjustment = (itemHeight - this._triggerRect.height) / 2;
  25920. /** @type {?} */
  25921. var originY = Math.abs(this._offsetY) - optionHeightAdjustment + itemHeight / 2;
  25922. return "50% " + originY + "px 0px";
  25923. };
  25924. /** Calculates the amount of items in the select. This includes options and group labels. */
  25925. /**
  25926. * Calculates the amount of items in the select. This includes options and group labels.
  25927. * @private
  25928. * @return {?}
  25929. */
  25930. MatSelect.prototype._getItemCount = /**
  25931. * Calculates the amount of items in the select. This includes options and group labels.
  25932. * @private
  25933. * @return {?}
  25934. */
  25935. function () {
  25936. return this.options.length + this.optionGroups.length;
  25937. };
  25938. /** Calculates the height of the select's options. */
  25939. /**
  25940. * Calculates the height of the select's options.
  25941. * @private
  25942. * @return {?}
  25943. */
  25944. MatSelect.prototype._getItemHeight = /**
  25945. * Calculates the height of the select's options.
  25946. * @private
  25947. * @return {?}
  25948. */
  25949. function () {
  25950. return this._triggerFontSize * SELECT_ITEM_HEIGHT_EM;
  25951. };
  25952. /**
  25953. * Implemented as part of MatFormFieldControl.
  25954. * @docs-private
  25955. */
  25956. /**
  25957. * Implemented as part of MatFormFieldControl.
  25958. * \@docs-private
  25959. * @param {?} ids
  25960. * @return {?}
  25961. */
  25962. MatSelect.prototype.setDescribedByIds = /**
  25963. * Implemented as part of MatFormFieldControl.
  25964. * \@docs-private
  25965. * @param {?} ids
  25966. * @return {?}
  25967. */
  25968. function (ids) {
  25969. this._ariaDescribedby = ids.join(' ');
  25970. };
  25971. /**
  25972. * Implemented as part of MatFormFieldControl.
  25973. * @docs-private
  25974. */
  25975. /**
  25976. * Implemented as part of MatFormFieldControl.
  25977. * \@docs-private
  25978. * @return {?}
  25979. */
  25980. MatSelect.prototype.onContainerClick = /**
  25981. * Implemented as part of MatFormFieldControl.
  25982. * \@docs-private
  25983. * @return {?}
  25984. */
  25985. function () {
  25986. this.focus();
  25987. this.open();
  25988. };
  25989. Object.defineProperty(MatSelect.prototype, "shouldLabelFloat", {
  25990. /**
  25991. * Implemented as part of MatFormFieldControl.
  25992. * @docs-private
  25993. */
  25994. get: /**
  25995. * Implemented as part of MatFormFieldControl.
  25996. * \@docs-private
  25997. * @return {?}
  25998. */
  25999. function () {
  26000. return this._panelOpen || !this.empty;
  26001. },
  26002. enumerable: true,
  26003. configurable: true
  26004. });
  26005. MatSelect.decorators = [
  26006. { type: core.Component, args: [{selector: 'mat-select',
  26007. exportAs: 'matSelect',
  26008. template: "<div cdk-overlay-origin class=\"mat-select-trigger\" aria-hidden=\"true\" (click)=\"toggle()\" #origin=\"cdkOverlayOrigin\" #trigger><div class=\"mat-select-value\" [ngSwitch]=\"empty\"><span class=\"mat-select-placeholder\" *ngSwitchCase=\"true\">{{placeholder || '\u00A0'}}</span> <span class=\"mat-select-value-text\" *ngSwitchCase=\"false\" [ngSwitch]=\"!!customTrigger\"><span *ngSwitchDefault>{{triggerValue || '\u00A0'}}</span><ng-content select=\"mat-select-trigger\" *ngSwitchCase=\"true\"></ng-content></span></div><div class=\"mat-select-arrow-wrapper\"><div class=\"mat-select-arrow\"></div></div></div><ng-template cdk-connected-overlay cdkConnectedOverlayLockPosition cdkConnectedOverlayHasBackdrop cdkConnectedOverlayBackdropClass=\"cdk-overlay-transparent-backdrop\" [cdkConnectedOverlayScrollStrategy]=\"_scrollStrategy\" [cdkConnectedOverlayOrigin]=\"origin\" [cdkConnectedOverlayOpen]=\"panelOpen\" [cdkConnectedOverlayPositions]=\"_positions\" [cdkConnectedOverlayMinWidth]=\"_triggerRect?.width\" [cdkConnectedOverlayOffsetY]=\"_offsetY\" (backdropClick)=\"close()\" (attach)=\"_onAttached()\" (detach)=\"close()\"><div class=\"mat-select-panel-wrap\" [@transformPanelWrap]><div #panel class=\"mat-select-panel {{ _getPanelTheme() }}\" [ngClass]=\"panelClass\" [@transformPanel]=\"multiple ? 'showing-multiple' : 'showing'\" (@transformPanel.done)=\"_panelDoneAnimatingStream.next($event.toState)\" [style.transformOrigin]=\"_transformOrigin\" [style.font-size.px]=\"_triggerFontSize\" (keydown)=\"_handleKeydown($event)\"><ng-content></ng-content></div></div></ng-template>",
  26009. styles: [".mat-select{display:inline-block;width:100%;outline:0}.mat-select-trigger{display:inline-table;cursor:pointer;position:relative;box-sizing:border-box}.mat-select-disabled .mat-select-trigger{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.mat-select-value{display:table-cell;max-width:0;width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.mat-select-value-text{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mat-select-arrow-wrapper{display:table-cell;vertical-align:middle}.mat-form-field-appearance-fill .mat-select-arrow-wrapper{transform:translateY(-50%)}.mat-form-field-appearance-outline .mat-select-arrow-wrapper{transform:translateY(-25%)}.mat-form-field-appearance-standard.mat-form-field-has-label .mat-select:not(.mat-select-empty) .mat-select-arrow-wrapper{transform:translateY(-50%)}.mat-form-field-appearance-standard .mat-select.mat-select-empty .mat-select-arrow-wrapper{transition:transform .4s cubic-bezier(.25,.8,.25,1)}._mat-animation-noopable.mat-form-field-appearance-standard .mat-select.mat-select-empty .mat-select-arrow-wrapper{transition:none}.mat-select-arrow{width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-top:5px solid;margin:0 4px}.mat-select-panel-wrap{flex-basis:100%}.mat-select-panel{min-width:112px;max-width:280px;overflow:auto;-webkit-overflow-scrolling:touch;padding-top:0;padding-bottom:0;max-height:256px;min-width:100%;border-radius:4px}@media (-ms-high-contrast:active){.mat-select-panel{outline:solid 1px}}.mat-select-panel .mat-optgroup-label,.mat-select-panel .mat-option{font-size:inherit;line-height:3em;height:3em}.mat-form-field-type-mat-select:not(.mat-form-field-disabled) .mat-form-field-flex{cursor:pointer}.mat-form-field-type-mat-select .mat-form-field-label{width:calc(100% - 18px)}.mat-select-placeholder{transition:color .4s .133s cubic-bezier(.25,.8,.25,1)}._mat-animation-noopable .mat-select-placeholder{transition:none}.mat-form-field-hide-placeholder .mat-select-placeholder{color:transparent;-webkit-text-fill-color:transparent;transition:none;display:block}"],
  26010. inputs: ['disabled', 'disableRipple', 'tabIndex'],
  26011. encapsulation: core.ViewEncapsulation.None,
  26012. changeDetection: core.ChangeDetectionStrategy.OnPush,
  26013. host: {
  26014. 'role': 'listbox',
  26015. '[attr.id]': 'id',
  26016. '[attr.tabindex]': 'tabIndex',
  26017. '[attr.aria-label]': '_getAriaLabel()',
  26018. '[attr.aria-labelledby]': '_getAriaLabelledby()',
  26019. '[attr.aria-required]': 'required.toString()',
  26020. '[attr.aria-disabled]': 'disabled.toString()',
  26021. '[attr.aria-invalid]': 'errorState',
  26022. '[attr.aria-owns]': 'panelOpen ? _optionIds : null',
  26023. '[attr.aria-multiselectable]': 'multiple',
  26024. '[attr.aria-describedby]': '_ariaDescribedby || null',
  26025. '[attr.aria-activedescendant]': '_getAriaActiveDescendant()',
  26026. '[class.mat-select-disabled]': 'disabled',
  26027. '[class.mat-select-invalid]': 'errorState',
  26028. '[class.mat-select-required]': 'required',
  26029. '[class.mat-select-empty]': 'empty',
  26030. 'class': 'mat-select',
  26031. '(keydown)': '_handleKeydown($event)',
  26032. '(focus)': '_onFocus()',
  26033. '(blur)': '_onBlur()',
  26034. },
  26035. animations: [
  26036. matSelectAnimations.transformPanelWrap,
  26037. matSelectAnimations.transformPanel
  26038. ],
  26039. providers: [
  26040. { provide: MatFormFieldControl, useExisting: MatSelect },
  26041. { provide: MAT_OPTION_PARENT_COMPONENT, useExisting: MatSelect }
  26042. ],
  26043. },] },
  26044. ];
  26045. /** @nocollapse */
  26046. MatSelect.ctorParameters = function () { return [
  26047. { type: scrolling.ViewportRuler },
  26048. { type: core.ChangeDetectorRef },
  26049. { type: core.NgZone },
  26050. { type: ErrorStateMatcher },
  26051. { type: core.ElementRef },
  26052. { type: bidi.Directionality, decorators: [{ type: core.Optional }] },
  26053. { type: forms.NgForm, decorators: [{ type: core.Optional }] },
  26054. { type: forms.FormGroupDirective, decorators: [{ type: core.Optional }] },
  26055. { type: MatFormField, decorators: [{ type: core.Optional }] },
  26056. { type: forms.NgControl, decorators: [{ type: core.Self }, { type: core.Optional }] },
  26057. { type: String, decorators: [{ type: core.Attribute, args: ['tabindex',] }] },
  26058. { type: undefined, decorators: [{ type: core.Inject, args: [MAT_SELECT_SCROLL_STRATEGY,] }] },
  26059. { type: a11y.LiveAnnouncer }
  26060. ]; };
  26061. MatSelect.propDecorators = {
  26062. trigger: [{ type: core.ViewChild, args: ['trigger', { static: false },] }],
  26063. panel: [{ type: core.ViewChild, args: ['panel', { static: false },] }],
  26064. overlayDir: [{ type: core.ViewChild, args: [overlay.CdkConnectedOverlay, { static: false },] }],
  26065. options: [{ type: core.ContentChildren, args: [MatOption, { descendants: true },] }],
  26066. optionGroups: [{ type: core.ContentChildren, args: [MatOptgroup,] }],
  26067. panelClass: [{ type: core.Input }],
  26068. customTrigger: [{ type: core.ContentChild, args: [MatSelectTrigger, { static: false },] }],
  26069. placeholder: [{ type: core.Input }],
  26070. required: [{ type: core.Input }],
  26071. multiple: [{ type: core.Input }],
  26072. disableOptionCentering: [{ type: core.Input }],
  26073. compareWith: [{ type: core.Input }],
  26074. value: [{ type: core.Input }],
  26075. ariaLabel: [{ type: core.Input, args: ['aria-label',] }],
  26076. ariaLabelledby: [{ type: core.Input, args: ['aria-labelledby',] }],
  26077. errorStateMatcher: [{ type: core.Input }],
  26078. sortComparator: [{ type: core.Input }],
  26079. id: [{ type: core.Input }],
  26080. openedChange: [{ type: core.Output }],
  26081. _openedStream: [{ type: core.Output, args: ['opened',] }],
  26082. _closedStream: [{ type: core.Output, args: ['closed',] }],
  26083. selectionChange: [{ type: core.Output }],
  26084. valueChange: [{ type: core.Output }]
  26085. };
  26086. return MatSelect;
  26087. }(_MatSelectMixinBase));
  26088. /**
  26089. * @fileoverview added by tsickle
  26090. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  26091. */
  26092. var MatSelectModule = /** @class */ (function () {
  26093. function MatSelectModule() {
  26094. }
  26095. MatSelectModule.decorators = [
  26096. { type: core.NgModule, args: [{
  26097. imports: [
  26098. common.CommonModule,
  26099. overlay.OverlayModule,
  26100. MatOptionModule,
  26101. MatCommonModule,
  26102. ],
  26103. exports: [MatFormFieldModule, MatSelect, MatSelectTrigger, MatOptionModule, MatCommonModule],
  26104. declarations: [MatSelect, MatSelectTrigger],
  26105. providers: [MAT_SELECT_SCROLL_STRATEGY_PROVIDER]
  26106. },] },
  26107. ];
  26108. return MatSelectModule;
  26109. }());
  26110. /**
  26111. * @fileoverview added by tsickle
  26112. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  26113. */
  26114. /**
  26115. * Animations used by MatTooltip.
  26116. * \@docs-private
  26117. * @type {?}
  26118. */
  26119. var matTooltipAnimations = {
  26120. /**
  26121. * Animation that transitions a tooltip in and out.
  26122. */
  26123. tooltipState: animations$1.trigger('state', [
  26124. animations$1.state('initial, void, hidden', animations$1.style({ opacity: 0, transform: 'scale(0)' })),
  26125. animations$1.state('visible', animations$1.style({ transform: 'scale(1)' })),
  26126. animations$1.transition('* => visible', animations$1.animate('200ms cubic-bezier(0, 0, 0.2, 1)', animations$1.keyframes([
  26127. animations$1.style({ opacity: 0, transform: 'scale(0)', offset: 0 }),
  26128. animations$1.style({ opacity: 0.5, transform: 'scale(0.99)', offset: 0.5 }),
  26129. animations$1.style({ opacity: 1, transform: 'scale(1)', offset: 1 })
  26130. ]))),
  26131. animations$1.transition('* => hidden', animations$1.animate('100ms cubic-bezier(0, 0, 0.2, 1)', animations$1.style({ opacity: 0 }))),
  26132. ])
  26133. };
  26134. /**
  26135. * @fileoverview added by tsickle
  26136. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  26137. */
  26138. /**
  26139. * Time in ms to throttle repositioning after scroll events.
  26140. * @type {?}
  26141. */
  26142. var SCROLL_THROTTLE_MS = 20;
  26143. /**
  26144. * CSS class that will be attached to the overlay panel.
  26145. * @type {?}
  26146. */
  26147. var TOOLTIP_PANEL_CLASS = 'mat-tooltip-panel';
  26148. /**
  26149. * Creates an error to be thrown if the user supplied an invalid tooltip position.
  26150. * \@docs-private
  26151. * @param {?} position
  26152. * @return {?}
  26153. */
  26154. function getMatTooltipInvalidPositionError(position) {
  26155. return Error("Tooltip position \"" + position + "\" is invalid.");
  26156. }
  26157. /**
  26158. * Injection token that determines the scroll handling while a tooltip is visible.
  26159. * @type {?}
  26160. */
  26161. var MAT_TOOLTIP_SCROLL_STRATEGY = new core.InjectionToken('mat-tooltip-scroll-strategy');
  26162. /**
  26163. * \@docs-private
  26164. * @param {?} overlay
  26165. * @return {?}
  26166. */
  26167. function MAT_TOOLTIP_SCROLL_STRATEGY_FACTORY(overlay$$1) {
  26168. return (/**
  26169. * @return {?}
  26170. */
  26171. function () { return overlay$$1.scrollStrategies.reposition({ scrollThrottle: SCROLL_THROTTLE_MS }); });
  26172. }
  26173. /**
  26174. * \@docs-private
  26175. * @type {?}
  26176. */
  26177. var MAT_TOOLTIP_SCROLL_STRATEGY_FACTORY_PROVIDER = {
  26178. provide: MAT_TOOLTIP_SCROLL_STRATEGY,
  26179. deps: [overlay.Overlay],
  26180. useFactory: MAT_TOOLTIP_SCROLL_STRATEGY_FACTORY,
  26181. };
  26182. /**
  26183. * Injection token to be used to override the default options for `matTooltip`.
  26184. * @type {?}
  26185. */
  26186. var MAT_TOOLTIP_DEFAULT_OPTIONS = new core.InjectionToken('mat-tooltip-default-options', {
  26187. providedIn: 'root',
  26188. factory: MAT_TOOLTIP_DEFAULT_OPTIONS_FACTORY
  26189. });
  26190. /**
  26191. * \@docs-private
  26192. * @return {?}
  26193. */
  26194. function MAT_TOOLTIP_DEFAULT_OPTIONS_FACTORY() {
  26195. return {
  26196. showDelay: 0,
  26197. hideDelay: 0,
  26198. touchendHideDelay: 1500,
  26199. };
  26200. }
  26201. /**
  26202. * Directive that attaches a material design tooltip to the host element. Animates the showing and
  26203. * hiding of a tooltip provided position (defaults to below the element).
  26204. *
  26205. * https://material.io/design/components/tooltips.html
  26206. */
  26207. var MatTooltip = /** @class */ (function () {
  26208. function MatTooltip(_overlay, _elementRef, _scrollDispatcher, _viewContainerRef, _ngZone, platform$$1, _ariaDescriber, _focusMonitor, scrollStrategy, _dir, _defaultOptions, hammerLoader) {
  26209. var _this = this;
  26210. this._overlay = _overlay;
  26211. this._elementRef = _elementRef;
  26212. this._scrollDispatcher = _scrollDispatcher;
  26213. this._viewContainerRef = _viewContainerRef;
  26214. this._ngZone = _ngZone;
  26215. this._ariaDescriber = _ariaDescriber;
  26216. this._focusMonitor = _focusMonitor;
  26217. this._dir = _dir;
  26218. this._defaultOptions = _defaultOptions;
  26219. this._position = 'below';
  26220. this._disabled = false;
  26221. /**
  26222. * The default delay in ms before showing the tooltip after show is called
  26223. */
  26224. this.showDelay = this._defaultOptions.showDelay;
  26225. /**
  26226. * The default delay in ms before hiding the tooltip after hide is called
  26227. */
  26228. this.hideDelay = this._defaultOptions.hideDelay;
  26229. this._message = '';
  26230. this._manualListeners = new Map();
  26231. /**
  26232. * Emits when the component is destroyed.
  26233. */
  26234. this._destroyed = new rxjs.Subject();
  26235. this._scrollStrategy = scrollStrategy;
  26236. /** @type {?} */
  26237. var element = _elementRef.nativeElement;
  26238. /** @type {?} */
  26239. var hasGestures = typeof window === 'undefined' || ((/** @type {?} */ (window))).Hammer || hammerLoader;
  26240. // The mouse events shouldn't be bound on mobile devices, because they can prevent the
  26241. // first tap from firing its click event or can cause the tooltip to open for clicks.
  26242. if (!platform$$1.IOS && !platform$$1.ANDROID) {
  26243. this._manualListeners
  26244. .set('mouseenter', (/**
  26245. * @return {?}
  26246. */
  26247. function () { return _this.show(); }))
  26248. .set('mouseleave', (/**
  26249. * @return {?}
  26250. */
  26251. function () { return _this.hide(); }));
  26252. }
  26253. else if (!hasGestures) {
  26254. // If Hammerjs isn't loaded, fall back to showing on `touchstart`, otherwise
  26255. // there's no way for the user to trigger the tooltip on a touch device.
  26256. this._manualListeners.set('touchstart', (/**
  26257. * @return {?}
  26258. */
  26259. function () { return _this.show(); }));
  26260. }
  26261. this._manualListeners.forEach((/**
  26262. * @param {?} listener
  26263. * @param {?} event
  26264. * @return {?}
  26265. */
  26266. function (listener, event) { return element.addEventListener(event, listener); }));
  26267. _focusMonitor.monitor(_elementRef).pipe(operators.takeUntil(this._destroyed)).subscribe((/**
  26268. * @param {?} origin
  26269. * @return {?}
  26270. */
  26271. function (origin) {
  26272. // Note that the focus monitor runs outside the Angular zone.
  26273. if (!origin) {
  26274. _ngZone.run((/**
  26275. * @return {?}
  26276. */
  26277. function () { return _this.hide(0); }));
  26278. }
  26279. else if (origin === 'keyboard') {
  26280. _ngZone.run((/**
  26281. * @return {?}
  26282. */
  26283. function () { return _this.show(); }));
  26284. }
  26285. }));
  26286. if (_defaultOptions && _defaultOptions.position) {
  26287. this.position = _defaultOptions.position;
  26288. }
  26289. }
  26290. Object.defineProperty(MatTooltip.prototype, "position", {
  26291. /** Allows the user to define the position of the tooltip relative to the parent element */
  26292. get: /**
  26293. * Allows the user to define the position of the tooltip relative to the parent element
  26294. * @return {?}
  26295. */
  26296. function () { return this._position; },
  26297. set: /**
  26298. * @param {?} value
  26299. * @return {?}
  26300. */
  26301. function (value) {
  26302. if (value !== this._position) {
  26303. this._position = value;
  26304. if (this._overlayRef) {
  26305. this._updatePosition();
  26306. if (this._tooltipInstance) {
  26307. (/** @type {?} */ (this._tooltipInstance)).show(0);
  26308. }
  26309. this._overlayRef.updatePosition();
  26310. }
  26311. }
  26312. },
  26313. enumerable: true,
  26314. configurable: true
  26315. });
  26316. Object.defineProperty(MatTooltip.prototype, "disabled", {
  26317. /** Disables the display of the tooltip. */
  26318. get: /**
  26319. * Disables the display of the tooltip.
  26320. * @return {?}
  26321. */
  26322. function () { return this._disabled; },
  26323. set: /**
  26324. * @param {?} value
  26325. * @return {?}
  26326. */
  26327. function (value) {
  26328. this._disabled = coercion.coerceBooleanProperty(value);
  26329. // If tooltip is disabled, hide immediately.
  26330. if (this._disabled) {
  26331. this.hide(0);
  26332. }
  26333. },
  26334. enumerable: true,
  26335. configurable: true
  26336. });
  26337. Object.defineProperty(MatTooltip.prototype, "message", {
  26338. /** The message to be displayed in the tooltip */
  26339. get: /**
  26340. * The message to be displayed in the tooltip
  26341. * @return {?}
  26342. */
  26343. function () { return this._message; },
  26344. set: /**
  26345. * @param {?} value
  26346. * @return {?}
  26347. */
  26348. function (value) {
  26349. this._ariaDescriber.removeDescription(this._elementRef.nativeElement, this._message);
  26350. // If the message is not a string (e.g. number), convert it to a string and trim it.
  26351. this._message = value != null ? ("" + value).trim() : '';
  26352. if (!this._message && this._isTooltipVisible()) {
  26353. this.hide(0);
  26354. }
  26355. else {
  26356. this._updateTooltipMessage();
  26357. this._ariaDescriber.describe(this._elementRef.nativeElement, this.message);
  26358. }
  26359. },
  26360. enumerable: true,
  26361. configurable: true
  26362. });
  26363. Object.defineProperty(MatTooltip.prototype, "tooltipClass", {
  26364. /** Classes to be passed to the tooltip. Supports the same syntax as `ngClass`. */
  26365. get: /**
  26366. * Classes to be passed to the tooltip. Supports the same syntax as `ngClass`.
  26367. * @return {?}
  26368. */
  26369. function () { return this._tooltipClass; },
  26370. set: /**
  26371. * @param {?} value
  26372. * @return {?}
  26373. */
  26374. function (value) {
  26375. this._tooltipClass = value;
  26376. if (this._tooltipInstance) {
  26377. this._setTooltipClass(this._tooltipClass);
  26378. }
  26379. },
  26380. enumerable: true,
  26381. configurable: true
  26382. });
  26383. /**
  26384. * Setup styling-specific things
  26385. */
  26386. /**
  26387. * Setup styling-specific things
  26388. * @return {?}
  26389. */
  26390. MatTooltip.prototype.ngOnInit = /**
  26391. * Setup styling-specific things
  26392. * @return {?}
  26393. */
  26394. function () {
  26395. /** @type {?} */
  26396. var element = this._elementRef.nativeElement;
  26397. /** @type {?} */
  26398. var elementStyle = (/** @type {?} */ (element.style));
  26399. if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
  26400. // When we bind a gesture event on an element (in this case `longpress`), HammerJS
  26401. // will add some inline styles by default, including `user-select: none`. This is
  26402. // problematic on iOS and in Safari, because it will prevent users from typing in inputs.
  26403. // Since `user-select: none` is not needed for the `longpress` event and can cause unexpected
  26404. // behavior for text fields, we always clear the `user-select` to avoid such issues.
  26405. elementStyle.webkitUserSelect = elementStyle.userSelect = elementStyle.msUserSelect = '';
  26406. }
  26407. // Hammer applies `-webkit-user-drag: none` on all elements by default,
  26408. // which breaks the native drag&drop. If the consumer explicitly made
  26409. // the element draggable, clear the `-webkit-user-drag`.
  26410. if (element.draggable && elementStyle.webkitUserDrag === 'none') {
  26411. elementStyle.webkitUserDrag = '';
  26412. }
  26413. };
  26414. /**
  26415. * Dispose the tooltip when destroyed.
  26416. */
  26417. /**
  26418. * Dispose the tooltip when destroyed.
  26419. * @return {?}
  26420. */
  26421. MatTooltip.prototype.ngOnDestroy = /**
  26422. * Dispose the tooltip when destroyed.
  26423. * @return {?}
  26424. */
  26425. function () {
  26426. var _this = this;
  26427. if (this._overlayRef) {
  26428. this._overlayRef.dispose();
  26429. this._tooltipInstance = null;
  26430. }
  26431. // Clean up the event listeners set in the constructor
  26432. this._manualListeners.forEach((/**
  26433. * @param {?} listener
  26434. * @param {?} event
  26435. * @return {?}
  26436. */
  26437. function (listener, event) {
  26438. _this._elementRef.nativeElement.removeEventListener(event, listener);
  26439. }));
  26440. this._manualListeners.clear();
  26441. this._destroyed.next();
  26442. this._destroyed.complete();
  26443. this._ariaDescriber.removeDescription(this._elementRef.nativeElement, this.message);
  26444. this._focusMonitor.stopMonitoring(this._elementRef);
  26445. };
  26446. /** Shows the tooltip after the delay in ms, defaults to tooltip-delay-show or 0ms if no input */
  26447. /**
  26448. * Shows the tooltip after the delay in ms, defaults to tooltip-delay-show or 0ms if no input
  26449. * @param {?=} delay
  26450. * @return {?}
  26451. */
  26452. MatTooltip.prototype.show = /**
  26453. * Shows the tooltip after the delay in ms, defaults to tooltip-delay-show or 0ms if no input
  26454. * @param {?=} delay
  26455. * @return {?}
  26456. */
  26457. function (delay) {
  26458. var _this = this;
  26459. if (delay === void 0) { delay = this.showDelay; }
  26460. if (this.disabled || !this.message || (this._isTooltipVisible() &&
  26461. !(/** @type {?} */ (this._tooltipInstance))._showTimeoutId && !(/** @type {?} */ (this._tooltipInstance))._hideTimeoutId)) {
  26462. return;
  26463. }
  26464. /** @type {?} */
  26465. var overlayRef = this._createOverlay();
  26466. this._detach();
  26467. this._portal = this._portal || new portal.ComponentPortal(TooltipComponent, this._viewContainerRef);
  26468. this._tooltipInstance = overlayRef.attach(this._portal).instance;
  26469. this._tooltipInstance.afterHidden()
  26470. .pipe(operators.takeUntil(this._destroyed))
  26471. .subscribe((/**
  26472. * @return {?}
  26473. */
  26474. function () { return _this._detach(); }));
  26475. this._setTooltipClass(this._tooltipClass);
  26476. this._updateTooltipMessage();
  26477. (/** @type {?} */ (this._tooltipInstance)).show(delay);
  26478. };
  26479. /** Hides the tooltip after the delay in ms, defaults to tooltip-delay-hide or 0ms if no input */
  26480. /**
  26481. * Hides the tooltip after the delay in ms, defaults to tooltip-delay-hide or 0ms if no input
  26482. * @param {?=} delay
  26483. * @return {?}
  26484. */
  26485. MatTooltip.prototype.hide = /**
  26486. * Hides the tooltip after the delay in ms, defaults to tooltip-delay-hide or 0ms if no input
  26487. * @param {?=} delay
  26488. * @return {?}
  26489. */
  26490. function (delay) {
  26491. if (delay === void 0) { delay = this.hideDelay; }
  26492. if (this._tooltipInstance) {
  26493. this._tooltipInstance.hide(delay);
  26494. }
  26495. };
  26496. /** Shows/hides the tooltip */
  26497. /**
  26498. * Shows/hides the tooltip
  26499. * @return {?}
  26500. */
  26501. MatTooltip.prototype.toggle = /**
  26502. * Shows/hides the tooltip
  26503. * @return {?}
  26504. */
  26505. function () {
  26506. this._isTooltipVisible() ? this.hide() : this.show();
  26507. };
  26508. /** Returns true if the tooltip is currently visible to the user */
  26509. /**
  26510. * Returns true if the tooltip is currently visible to the user
  26511. * @return {?}
  26512. */
  26513. MatTooltip.prototype._isTooltipVisible = /**
  26514. * Returns true if the tooltip is currently visible to the user
  26515. * @return {?}
  26516. */
  26517. function () {
  26518. return !!this._tooltipInstance && this._tooltipInstance.isVisible();
  26519. };
  26520. /** Handles the keydown events on the host element. */
  26521. /**
  26522. * Handles the keydown events on the host element.
  26523. * @param {?} e
  26524. * @return {?}
  26525. */
  26526. MatTooltip.prototype._handleKeydown = /**
  26527. * Handles the keydown events on the host element.
  26528. * @param {?} e
  26529. * @return {?}
  26530. */
  26531. function (e) {
  26532. if (this._isTooltipVisible() && e.keyCode === keycodes.ESCAPE && !keycodes.hasModifierKey(e)) {
  26533. e.preventDefault();
  26534. e.stopPropagation();
  26535. this.hide(0);
  26536. }
  26537. };
  26538. /** Handles the touchend events on the host element. */
  26539. /**
  26540. * Handles the touchend events on the host element.
  26541. * @return {?}
  26542. */
  26543. MatTooltip.prototype._handleTouchend = /**
  26544. * Handles the touchend events on the host element.
  26545. * @return {?}
  26546. */
  26547. function () {
  26548. this.hide(this._defaultOptions.touchendHideDelay);
  26549. };
  26550. /** Create the overlay config and position strategy */
  26551. /**
  26552. * Create the overlay config and position strategy
  26553. * @private
  26554. * @return {?}
  26555. */
  26556. MatTooltip.prototype._createOverlay = /**
  26557. * Create the overlay config and position strategy
  26558. * @private
  26559. * @return {?}
  26560. */
  26561. function () {
  26562. var _this = this;
  26563. if (this._overlayRef) {
  26564. return this._overlayRef;
  26565. }
  26566. /** @type {?} */
  26567. var scrollableAncestors = this._scrollDispatcher.getAncestorScrollContainers(this._elementRef);
  26568. // Create connected position strategy that listens for scroll events to reposition.
  26569. /** @type {?} */
  26570. var strategy = this._overlay.position()
  26571. .flexibleConnectedTo(this._elementRef)
  26572. .withTransformOriginOn('.mat-tooltip')
  26573. .withFlexibleDimensions(false)
  26574. .withViewportMargin(8)
  26575. .withScrollableContainers(scrollableAncestors);
  26576. strategy.positionChanges.pipe(operators.takeUntil(this._destroyed)).subscribe((/**
  26577. * @param {?} change
  26578. * @return {?}
  26579. */
  26580. function (change) {
  26581. if (_this._tooltipInstance) {
  26582. if (change.scrollableViewProperties.isOverlayClipped && _this._tooltipInstance.isVisible()) {
  26583. // After position changes occur and the overlay is clipped by
  26584. // a parent scrollable then close the tooltip.
  26585. _this._ngZone.run((/**
  26586. * @return {?}
  26587. */
  26588. function () { return _this.hide(0); }));
  26589. }
  26590. }
  26591. }));
  26592. this._overlayRef = this._overlay.create({
  26593. direction: this._dir,
  26594. positionStrategy: strategy,
  26595. panelClass: TOOLTIP_PANEL_CLASS,
  26596. scrollStrategy: this._scrollStrategy()
  26597. });
  26598. this._updatePosition();
  26599. this._overlayRef.detachments()
  26600. .pipe(operators.takeUntil(this._destroyed))
  26601. .subscribe((/**
  26602. * @return {?}
  26603. */
  26604. function () { return _this._detach(); }));
  26605. return this._overlayRef;
  26606. };
  26607. /** Detaches the currently-attached tooltip. */
  26608. /**
  26609. * Detaches the currently-attached tooltip.
  26610. * @private
  26611. * @return {?}
  26612. */
  26613. MatTooltip.prototype._detach = /**
  26614. * Detaches the currently-attached tooltip.
  26615. * @private
  26616. * @return {?}
  26617. */
  26618. function () {
  26619. if (this._overlayRef && this._overlayRef.hasAttached()) {
  26620. this._overlayRef.detach();
  26621. }
  26622. this._tooltipInstance = null;
  26623. };
  26624. /** Updates the position of the current tooltip. */
  26625. /**
  26626. * Updates the position of the current tooltip.
  26627. * @private
  26628. * @return {?}
  26629. */
  26630. MatTooltip.prototype._updatePosition = /**
  26631. * Updates the position of the current tooltip.
  26632. * @private
  26633. * @return {?}
  26634. */
  26635. function () {
  26636. /** @type {?} */
  26637. var position = (/** @type {?} */ ((/** @type {?} */ (this._overlayRef)).getConfig().positionStrategy));
  26638. /** @type {?} */
  26639. var origin = this._getOrigin();
  26640. /** @type {?} */
  26641. var overlay$$1 = this._getOverlayPosition();
  26642. position.withPositions([
  26643. __assign({}, origin.main, overlay$$1.main),
  26644. __assign({}, origin.fallback, overlay$$1.fallback)
  26645. ]);
  26646. };
  26647. /**
  26648. * Returns the origin position and a fallback position based on the user's position preference.
  26649. * The fallback position is the inverse of the origin (e.g. `'below' -> 'above'`).
  26650. */
  26651. /**
  26652. * Returns the origin position and a fallback position based on the user's position preference.
  26653. * The fallback position is the inverse of the origin (e.g. `'below' -> 'above'`).
  26654. * @return {?}
  26655. */
  26656. MatTooltip.prototype._getOrigin = /**
  26657. * Returns the origin position and a fallback position based on the user's position preference.
  26658. * The fallback position is the inverse of the origin (e.g. `'below' -> 'above'`).
  26659. * @return {?}
  26660. */
  26661. function () {
  26662. /** @type {?} */
  26663. var isLtr = !this._dir || this._dir.value == 'ltr';
  26664. /** @type {?} */
  26665. var position = this.position;
  26666. /** @type {?} */
  26667. var originPosition;
  26668. if (position == 'above' || position == 'below') {
  26669. originPosition = { originX: 'center', originY: position == 'above' ? 'top' : 'bottom' };
  26670. }
  26671. else if (position == 'before' ||
  26672. (position == 'left' && isLtr) ||
  26673. (position == 'right' && !isLtr)) {
  26674. originPosition = { originX: 'start', originY: 'center' };
  26675. }
  26676. else if (position == 'after' ||
  26677. (position == 'right' && isLtr) ||
  26678. (position == 'left' && !isLtr)) {
  26679. originPosition = { originX: 'end', originY: 'center' };
  26680. }
  26681. else {
  26682. throw getMatTooltipInvalidPositionError(position);
  26683. }
  26684. var _a = this._invertPosition(originPosition.originX, originPosition.originY), x = _a.x, y = _a.y;
  26685. return {
  26686. main: originPosition,
  26687. fallback: { originX: x, originY: y }
  26688. };
  26689. };
  26690. /** Returns the overlay position and a fallback position based on the user's preference */
  26691. /**
  26692. * Returns the overlay position and a fallback position based on the user's preference
  26693. * @return {?}
  26694. */
  26695. MatTooltip.prototype._getOverlayPosition = /**
  26696. * Returns the overlay position and a fallback position based on the user's preference
  26697. * @return {?}
  26698. */
  26699. function () {
  26700. /** @type {?} */
  26701. var isLtr = !this._dir || this._dir.value == 'ltr';
  26702. /** @type {?} */
  26703. var position = this.position;
  26704. /** @type {?} */
  26705. var overlayPosition;
  26706. if (position == 'above') {
  26707. overlayPosition = { overlayX: 'center', overlayY: 'bottom' };
  26708. }
  26709. else if (position == 'below') {
  26710. overlayPosition = { overlayX: 'center', overlayY: 'top' };
  26711. }
  26712. else if (position == 'before' ||
  26713. (position == 'left' && isLtr) ||
  26714. (position == 'right' && !isLtr)) {
  26715. overlayPosition = { overlayX: 'end', overlayY: 'center' };
  26716. }
  26717. else if (position == 'after' ||
  26718. (position == 'right' && isLtr) ||
  26719. (position == 'left' && !isLtr)) {
  26720. overlayPosition = { overlayX: 'start', overlayY: 'center' };
  26721. }
  26722. else {
  26723. throw getMatTooltipInvalidPositionError(position);
  26724. }
  26725. var _a = this._invertPosition(overlayPosition.overlayX, overlayPosition.overlayY), x = _a.x, y = _a.y;
  26726. return {
  26727. main: overlayPosition,
  26728. fallback: { overlayX: x, overlayY: y }
  26729. };
  26730. };
  26731. /** Updates the tooltip message and repositions the overlay according to the new message length */
  26732. /**
  26733. * Updates the tooltip message and repositions the overlay according to the new message length
  26734. * @private
  26735. * @return {?}
  26736. */
  26737. MatTooltip.prototype._updateTooltipMessage = /**
  26738. * Updates the tooltip message and repositions the overlay according to the new message length
  26739. * @private
  26740. * @return {?}
  26741. */
  26742. function () {
  26743. var _this = this;
  26744. // Must wait for the message to be painted to the tooltip so that the overlay can properly
  26745. // calculate the correct positioning based on the size of the text.
  26746. if (this._tooltipInstance) {
  26747. this._tooltipInstance.message = this.message;
  26748. this._tooltipInstance._markForCheck();
  26749. this._ngZone.onMicrotaskEmpty.asObservable().pipe(operators.take(1), operators.takeUntil(this._destroyed)).subscribe((/**
  26750. * @return {?}
  26751. */
  26752. function () {
  26753. if (_this._tooltipInstance) {
  26754. (/** @type {?} */ (_this._overlayRef)).updatePosition();
  26755. }
  26756. }));
  26757. }
  26758. };
  26759. /** Updates the tooltip class */
  26760. /**
  26761. * Updates the tooltip class
  26762. * @private
  26763. * @param {?} tooltipClass
  26764. * @return {?}
  26765. */
  26766. MatTooltip.prototype._setTooltipClass = /**
  26767. * Updates the tooltip class
  26768. * @private
  26769. * @param {?} tooltipClass
  26770. * @return {?}
  26771. */
  26772. function (tooltipClass) {
  26773. if (this._tooltipInstance) {
  26774. this._tooltipInstance.tooltipClass = tooltipClass;
  26775. this._tooltipInstance._markForCheck();
  26776. }
  26777. };
  26778. /** Inverts an overlay position. */
  26779. /**
  26780. * Inverts an overlay position.
  26781. * @private
  26782. * @param {?} x
  26783. * @param {?} y
  26784. * @return {?}
  26785. */
  26786. MatTooltip.prototype._invertPosition = /**
  26787. * Inverts an overlay position.
  26788. * @private
  26789. * @param {?} x
  26790. * @param {?} y
  26791. * @return {?}
  26792. */
  26793. function (x, y) {
  26794. if (this.position === 'above' || this.position === 'below') {
  26795. if (y === 'top') {
  26796. y = 'bottom';
  26797. }
  26798. else if (y === 'bottom') {
  26799. y = 'top';
  26800. }
  26801. }
  26802. else {
  26803. if (x === 'end') {
  26804. x = 'start';
  26805. }
  26806. else if (x === 'start') {
  26807. x = 'end';
  26808. }
  26809. }
  26810. return { x: x, y: y };
  26811. };
  26812. MatTooltip.decorators = [
  26813. { type: core.Directive, args: [{
  26814. selector: '[matTooltip]',
  26815. exportAs: 'matTooltip',
  26816. host: {
  26817. '(longpress)': 'show()',
  26818. '(keydown)': '_handleKeydown($event)',
  26819. '(touchend)': '_handleTouchend()',
  26820. },
  26821. },] },
  26822. ];
  26823. /** @nocollapse */
  26824. MatTooltip.ctorParameters = function () { return [
  26825. { type: overlay.Overlay },
  26826. { type: core.ElementRef },
  26827. { type: scrolling.ScrollDispatcher },
  26828. { type: core.ViewContainerRef },
  26829. { type: core.NgZone },
  26830. { type: platform.Platform },
  26831. { type: a11y.AriaDescriber },
  26832. { type: a11y.FocusMonitor },
  26833. { type: undefined, decorators: [{ type: core.Inject, args: [MAT_TOOLTIP_SCROLL_STRATEGY,] }] },
  26834. { type: bidi.Directionality, decorators: [{ type: core.Optional }] },
  26835. { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_TOOLTIP_DEFAULT_OPTIONS,] }] },
  26836. { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [platformBrowser.HAMMER_LOADER,] }] }
  26837. ]; };
  26838. MatTooltip.propDecorators = {
  26839. position: [{ type: core.Input, args: ['matTooltipPosition',] }],
  26840. disabled: [{ type: core.Input, args: ['matTooltipDisabled',] }],
  26841. showDelay: [{ type: core.Input, args: ['matTooltipShowDelay',] }],
  26842. hideDelay: [{ type: core.Input, args: ['matTooltipHideDelay',] }],
  26843. message: [{ type: core.Input, args: ['matTooltip',] }],
  26844. tooltipClass: [{ type: core.Input, args: ['matTooltipClass',] }]
  26845. };
  26846. return MatTooltip;
  26847. }());
  26848. /**
  26849. * Internal component that wraps the tooltip's content.
  26850. * \@docs-private
  26851. */
  26852. var TooltipComponent = /** @class */ (function () {
  26853. function TooltipComponent(_changeDetectorRef, _breakpointObserver) {
  26854. this._changeDetectorRef = _changeDetectorRef;
  26855. this._breakpointObserver = _breakpointObserver;
  26856. /**
  26857. * Property watched by the animation framework to show or hide the tooltip
  26858. */
  26859. this._visibility = 'initial';
  26860. /**
  26861. * Whether interactions on the page should close the tooltip
  26862. */
  26863. this._closeOnInteraction = false;
  26864. /**
  26865. * Subject for notifying that the tooltip has been hidden from the view
  26866. */
  26867. this._onHide = new rxjs.Subject();
  26868. /**
  26869. * Stream that emits whether the user has a handset-sized display.
  26870. */
  26871. this._isHandset = this._breakpointObserver.observe(layout.Breakpoints.Handset);
  26872. }
  26873. /**
  26874. * Shows the tooltip with an animation originating from the provided origin
  26875. * @param delay Amount of milliseconds to the delay showing the tooltip.
  26876. */
  26877. /**
  26878. * Shows the tooltip with an animation originating from the provided origin
  26879. * @param {?} delay Amount of milliseconds to the delay showing the tooltip.
  26880. * @return {?}
  26881. */
  26882. TooltipComponent.prototype.show = /**
  26883. * Shows the tooltip with an animation originating from the provided origin
  26884. * @param {?} delay Amount of milliseconds to the delay showing the tooltip.
  26885. * @return {?}
  26886. */
  26887. function (delay) {
  26888. var _this = this;
  26889. // Cancel the delayed hide if it is scheduled
  26890. if (this._hideTimeoutId) {
  26891. clearTimeout(this._hideTimeoutId);
  26892. this._hideTimeoutId = null;
  26893. }
  26894. // Body interactions should cancel the tooltip if there is a delay in showing.
  26895. this._closeOnInteraction = true;
  26896. this._showTimeoutId = setTimeout((/**
  26897. * @return {?}
  26898. */
  26899. function () {
  26900. _this._visibility = 'visible';
  26901. _this._showTimeoutId = null;
  26902. // Mark for check so if any parent component has set the
  26903. // ChangeDetectionStrategy to OnPush it will be checked anyways
  26904. _this._markForCheck();
  26905. }), delay);
  26906. };
  26907. /**
  26908. * Begins the animation to hide the tooltip after the provided delay in ms.
  26909. * @param delay Amount of milliseconds to delay showing the tooltip.
  26910. */
  26911. /**
  26912. * Begins the animation to hide the tooltip after the provided delay in ms.
  26913. * @param {?} delay Amount of milliseconds to delay showing the tooltip.
  26914. * @return {?}
  26915. */
  26916. TooltipComponent.prototype.hide = /**
  26917. * Begins the animation to hide the tooltip after the provided delay in ms.
  26918. * @param {?} delay Amount of milliseconds to delay showing the tooltip.
  26919. * @return {?}
  26920. */
  26921. function (delay) {
  26922. var _this = this;
  26923. // Cancel the delayed show if it is scheduled
  26924. if (this._showTimeoutId) {
  26925. clearTimeout(this._showTimeoutId);
  26926. this._showTimeoutId = null;
  26927. }
  26928. this._hideTimeoutId = setTimeout((/**
  26929. * @return {?}
  26930. */
  26931. function () {
  26932. _this._visibility = 'hidden';
  26933. _this._hideTimeoutId = null;
  26934. // Mark for check so if any parent component has set the
  26935. // ChangeDetectionStrategy to OnPush it will be checked anyways
  26936. _this._markForCheck();
  26937. }), delay);
  26938. };
  26939. /** Returns an observable that notifies when the tooltip has been hidden from view. */
  26940. /**
  26941. * Returns an observable that notifies when the tooltip has been hidden from view.
  26942. * @return {?}
  26943. */
  26944. TooltipComponent.prototype.afterHidden = /**
  26945. * Returns an observable that notifies when the tooltip has been hidden from view.
  26946. * @return {?}
  26947. */
  26948. function () {
  26949. return this._onHide.asObservable();
  26950. };
  26951. /** Whether the tooltip is being displayed. */
  26952. /**
  26953. * Whether the tooltip is being displayed.
  26954. * @return {?}
  26955. */
  26956. TooltipComponent.prototype.isVisible = /**
  26957. * Whether the tooltip is being displayed.
  26958. * @return {?}
  26959. */
  26960. function () {
  26961. return this._visibility === 'visible';
  26962. };
  26963. /**
  26964. * @return {?}
  26965. */
  26966. TooltipComponent.prototype.ngOnDestroy = /**
  26967. * @return {?}
  26968. */
  26969. function () {
  26970. this._onHide.complete();
  26971. };
  26972. /**
  26973. * @return {?}
  26974. */
  26975. TooltipComponent.prototype._animationStart = /**
  26976. * @return {?}
  26977. */
  26978. function () {
  26979. this._closeOnInteraction = false;
  26980. };
  26981. /**
  26982. * @param {?} event
  26983. * @return {?}
  26984. */
  26985. TooltipComponent.prototype._animationDone = /**
  26986. * @param {?} event
  26987. * @return {?}
  26988. */
  26989. function (event) {
  26990. /** @type {?} */
  26991. var toState = (/** @type {?} */ (event.toState));
  26992. if (toState === 'hidden' && !this.isVisible()) {
  26993. this._onHide.next();
  26994. }
  26995. if (toState === 'visible' || toState === 'hidden') {
  26996. this._closeOnInteraction = true;
  26997. }
  26998. };
  26999. /**
  27000. * Interactions on the HTML body should close the tooltip immediately as defined in the
  27001. * material design spec.
  27002. * https://material.io/design/components/tooltips.html#behavior
  27003. */
  27004. /**
  27005. * Interactions on the HTML body should close the tooltip immediately as defined in the
  27006. * material design spec.
  27007. * https://material.io/design/components/tooltips.html#behavior
  27008. * @return {?}
  27009. */
  27010. TooltipComponent.prototype._handleBodyInteraction = /**
  27011. * Interactions on the HTML body should close the tooltip immediately as defined in the
  27012. * material design spec.
  27013. * https://material.io/design/components/tooltips.html#behavior
  27014. * @return {?}
  27015. */
  27016. function () {
  27017. if (this._closeOnInteraction) {
  27018. this.hide(0);
  27019. }
  27020. };
  27021. /**
  27022. * Marks that the tooltip needs to be checked in the next change detection run.
  27023. * Mainly used for rendering the initial text before positioning a tooltip, which
  27024. * can be problematic in components with OnPush change detection.
  27025. */
  27026. /**
  27027. * Marks that the tooltip needs to be checked in the next change detection run.
  27028. * Mainly used for rendering the initial text before positioning a tooltip, which
  27029. * can be problematic in components with OnPush change detection.
  27030. * @return {?}
  27031. */
  27032. TooltipComponent.prototype._markForCheck = /**
  27033. * Marks that the tooltip needs to be checked in the next change detection run.
  27034. * Mainly used for rendering the initial text before positioning a tooltip, which
  27035. * can be problematic in components with OnPush change detection.
  27036. * @return {?}
  27037. */
  27038. function () {
  27039. this._changeDetectorRef.markForCheck();
  27040. };
  27041. TooltipComponent.decorators = [
  27042. { type: core.Component, args: [{selector: 'mat-tooltip-component',
  27043. template: "<div class=\"mat-tooltip\" [ngClass]=\"tooltipClass\" [class.mat-tooltip-handset]=\"(_isHandset | async)?.matches\" [@state]=\"_visibility\" (@state.start)=\"_animationStart()\" (@state.done)=\"_animationDone($event)\">{{message}}</div>",
  27044. styles: [".mat-tooltip-panel{pointer-events:none!important}.mat-tooltip{color:#fff;border-radius:4px;margin:14px;max-width:250px;padding-left:8px;padding-right:8px;overflow:hidden;text-overflow:ellipsis}@media (-ms-high-contrast:active){.mat-tooltip{outline:solid 1px}}.mat-tooltip-handset{margin:24px;padding-left:16px;padding-right:16px}"],
  27045. encapsulation: core.ViewEncapsulation.None,
  27046. changeDetection: core.ChangeDetectionStrategy.OnPush,
  27047. animations: [matTooltipAnimations.tooltipState],
  27048. host: {
  27049. // Forces the element to have a layout in IE and Edge. This fixes issues where the element
  27050. // won't be rendered if the animations are disabled or there is no web animations polyfill.
  27051. '[style.zoom]': '_visibility === "visible" ? 1 : null',
  27052. '(body:click)': 'this._handleBodyInteraction()',
  27053. 'aria-hidden': 'true',
  27054. }
  27055. },] },
  27056. ];
  27057. /** @nocollapse */
  27058. TooltipComponent.ctorParameters = function () { return [
  27059. { type: core.ChangeDetectorRef },
  27060. { type: layout.BreakpointObserver }
  27061. ]; };
  27062. return TooltipComponent;
  27063. }());
  27064. /**
  27065. * @fileoverview added by tsickle
  27066. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  27067. */
  27068. var MatTooltipModule = /** @class */ (function () {
  27069. function MatTooltipModule() {
  27070. }
  27071. MatTooltipModule.decorators = [
  27072. { type: core.NgModule, args: [{
  27073. imports: [
  27074. a11y.A11yModule,
  27075. common.CommonModule,
  27076. overlay.OverlayModule,
  27077. MatCommonModule,
  27078. ],
  27079. exports: [MatTooltip, TooltipComponent, MatCommonModule],
  27080. declarations: [MatTooltip, TooltipComponent],
  27081. entryComponents: [TooltipComponent],
  27082. providers: [
  27083. MAT_TOOLTIP_SCROLL_STRATEGY_FACTORY_PROVIDER,
  27084. { provide: platformBrowser.HAMMER_GESTURE_CONFIG, useClass: GestureConfig },
  27085. ]
  27086. },] },
  27087. ];
  27088. return MatTooltipModule;
  27089. }());
  27090. /**
  27091. * @fileoverview added by tsickle
  27092. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  27093. */
  27094. /**
  27095. * To modify the labels and text displayed, create a new instance of MatPaginatorIntl and
  27096. * include it in a custom provider
  27097. */
  27098. var MatPaginatorIntl = /** @class */ (function () {
  27099. function MatPaginatorIntl() {
  27100. /**
  27101. * Stream to emit from when labels are changed. Use this to notify components when the labels have
  27102. * changed after initialization.
  27103. */
  27104. this.changes = new rxjs.Subject();
  27105. /**
  27106. * A label for the page size selector.
  27107. */
  27108. this.itemsPerPageLabel = 'Items per page:';
  27109. /**
  27110. * A label for the button that increments the current page.
  27111. */
  27112. this.nextPageLabel = 'Next page';
  27113. /**
  27114. * A label for the button that decrements the current page.
  27115. */
  27116. this.previousPageLabel = 'Previous page';
  27117. /**
  27118. * A label for the button that moves to the first page.
  27119. */
  27120. this.firstPageLabel = 'First page';
  27121. /**
  27122. * A label for the button that moves to the last page.
  27123. */
  27124. this.lastPageLabel = 'Last page';
  27125. /**
  27126. * A label for the range of items within the current page and the length of the whole list.
  27127. */
  27128. this.getRangeLabel = (/**
  27129. * @param {?} page
  27130. * @param {?} pageSize
  27131. * @param {?} length
  27132. * @return {?}
  27133. */
  27134. function (page, pageSize, length) {
  27135. if (length == 0 || pageSize == 0) {
  27136. return "0 of " + length;
  27137. }
  27138. length = Math.max(length, 0);
  27139. /** @type {?} */
  27140. var startIndex = page * pageSize;
  27141. // If the start index exceeds the list length, do not try and fix the end index to the end.
  27142. /** @type {?} */
  27143. var endIndex = startIndex < length ?
  27144. Math.min(startIndex + pageSize, length) :
  27145. startIndex + pageSize;
  27146. return startIndex + 1 + " - " + endIndex + " of " + length;
  27147. });
  27148. }
  27149. MatPaginatorIntl.decorators = [
  27150. { type: core.Injectable, args: [{ providedIn: 'root' },] },
  27151. ];
  27152. /** @nocollapse */ MatPaginatorIntl.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function MatPaginatorIntl_Factory() { return new MatPaginatorIntl(); }, token: MatPaginatorIntl, providedIn: "root" });
  27153. return MatPaginatorIntl;
  27154. }());
  27155. /**
  27156. * \@docs-private
  27157. * @param {?} parentIntl
  27158. * @return {?}
  27159. */
  27160. function MAT_PAGINATOR_INTL_PROVIDER_FACTORY(parentIntl) {
  27161. return parentIntl || new MatPaginatorIntl();
  27162. }
  27163. /**
  27164. * \@docs-private
  27165. * @type {?}
  27166. */
  27167. var MAT_PAGINATOR_INTL_PROVIDER = {
  27168. // If there is already an MatPaginatorIntl available, use that. Otherwise, provide a new one.
  27169. provide: MatPaginatorIntl,
  27170. deps: [[new core.Optional(), new core.SkipSelf(), MatPaginatorIntl]],
  27171. useFactory: MAT_PAGINATOR_INTL_PROVIDER_FACTORY
  27172. };
  27173. /**
  27174. * @fileoverview added by tsickle
  27175. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  27176. */
  27177. /**
  27178. * The default page size if there is no page size and there are no provided page size options.
  27179. * @type {?}
  27180. */
  27181. var DEFAULT_PAGE_SIZE = 50;
  27182. /**
  27183. * Change event object that is emitted when the user selects a
  27184. * different page size or navigates to another page.
  27185. */
  27186. var /**
  27187. * Change event object that is emitted when the user selects a
  27188. * different page size or navigates to another page.
  27189. */
  27190. PageEvent = /** @class */ (function () {
  27191. function PageEvent() {
  27192. }
  27193. return PageEvent;
  27194. }());
  27195. // Boilerplate for applying mixins to MatPaginator.
  27196. /**
  27197. * \@docs-private
  27198. */
  27199. var
  27200. // Boilerplate for applying mixins to MatPaginator.
  27201. /**
  27202. * \@docs-private
  27203. */
  27204. MatPaginatorBase = /** @class */ (function () {
  27205. function MatPaginatorBase() {
  27206. }
  27207. return MatPaginatorBase;
  27208. }());
  27209. /** @type {?} */
  27210. var _MatPaginatorBase = mixinDisabled(mixinInitialized(MatPaginatorBase));
  27211. /**
  27212. * Component to provide navigation between paged information. Displays the size of the current
  27213. * page, user-selectable options to change that size, what items are being shown, and
  27214. * navigational button to go to the previous or next page.
  27215. */
  27216. var MatPaginator = /** @class */ (function (_super) {
  27217. __extends(MatPaginator, _super);
  27218. function MatPaginator(_intl, _changeDetectorRef) {
  27219. var _this = _super.call(this) || this;
  27220. _this._intl = _intl;
  27221. _this._changeDetectorRef = _changeDetectorRef;
  27222. _this._pageIndex = 0;
  27223. _this._length = 0;
  27224. _this._pageSizeOptions = [];
  27225. _this._hidePageSize = false;
  27226. _this._showFirstLastButtons = false;
  27227. /**
  27228. * Event emitted when the paginator changes the page size or page index.
  27229. */
  27230. _this.page = new core.EventEmitter();
  27231. _this._intlChanges = _intl.changes.subscribe((/**
  27232. * @return {?}
  27233. */
  27234. function () { return _this._changeDetectorRef.markForCheck(); }));
  27235. return _this;
  27236. }
  27237. Object.defineProperty(MatPaginator.prototype, "pageIndex", {
  27238. /** The zero-based page index of the displayed list of items. Defaulted to 0. */
  27239. get: /**
  27240. * The zero-based page index of the displayed list of items. Defaulted to 0.
  27241. * @return {?}
  27242. */
  27243. function () { return this._pageIndex; },
  27244. set: /**
  27245. * @param {?} value
  27246. * @return {?}
  27247. */
  27248. function (value) {
  27249. this._pageIndex = Math.max(coercion.coerceNumberProperty(value), 0);
  27250. this._changeDetectorRef.markForCheck();
  27251. },
  27252. enumerable: true,
  27253. configurable: true
  27254. });
  27255. Object.defineProperty(MatPaginator.prototype, "length", {
  27256. /** The length of the total number of items that are being paginated. Defaulted to 0. */
  27257. get: /**
  27258. * The length of the total number of items that are being paginated. Defaulted to 0.
  27259. * @return {?}
  27260. */
  27261. function () { return this._length; },
  27262. set: /**
  27263. * @param {?} value
  27264. * @return {?}
  27265. */
  27266. function (value) {
  27267. this._length = coercion.coerceNumberProperty(value);
  27268. this._changeDetectorRef.markForCheck();
  27269. },
  27270. enumerable: true,
  27271. configurable: true
  27272. });
  27273. Object.defineProperty(MatPaginator.prototype, "pageSize", {
  27274. /** Number of items to display on a page. By default set to 50. */
  27275. get: /**
  27276. * Number of items to display on a page. By default set to 50.
  27277. * @return {?}
  27278. */
  27279. function () { return this._pageSize; },
  27280. set: /**
  27281. * @param {?} value
  27282. * @return {?}
  27283. */
  27284. function (value) {
  27285. this._pageSize = Math.max(coercion.coerceNumberProperty(value), 0);
  27286. this._updateDisplayedPageSizeOptions();
  27287. },
  27288. enumerable: true,
  27289. configurable: true
  27290. });
  27291. Object.defineProperty(MatPaginator.prototype, "pageSizeOptions", {
  27292. /** The set of provided page size options to display to the user. */
  27293. get: /**
  27294. * The set of provided page size options to display to the user.
  27295. * @return {?}
  27296. */
  27297. function () { return this._pageSizeOptions; },
  27298. set: /**
  27299. * @param {?} value
  27300. * @return {?}
  27301. */
  27302. function (value) {
  27303. this._pageSizeOptions = (value || []).map((/**
  27304. * @param {?} p
  27305. * @return {?}
  27306. */
  27307. function (p) { return coercion.coerceNumberProperty(p); }));
  27308. this._updateDisplayedPageSizeOptions();
  27309. },
  27310. enumerable: true,
  27311. configurable: true
  27312. });
  27313. Object.defineProperty(MatPaginator.prototype, "hidePageSize", {
  27314. /** Whether to hide the page size selection UI from the user. */
  27315. get: /**
  27316. * Whether to hide the page size selection UI from the user.
  27317. * @return {?}
  27318. */
  27319. function () { return this._hidePageSize; },
  27320. set: /**
  27321. * @param {?} value
  27322. * @return {?}
  27323. */
  27324. function (value) {
  27325. this._hidePageSize = coercion.coerceBooleanProperty(value);
  27326. },
  27327. enumerable: true,
  27328. configurable: true
  27329. });
  27330. Object.defineProperty(MatPaginator.prototype, "showFirstLastButtons", {
  27331. /** Whether to show the first/last buttons UI to the user. */
  27332. get: /**
  27333. * Whether to show the first/last buttons UI to the user.
  27334. * @return {?}
  27335. */
  27336. function () { return this._showFirstLastButtons; },
  27337. set: /**
  27338. * @param {?} value
  27339. * @return {?}
  27340. */
  27341. function (value) {
  27342. this._showFirstLastButtons = coercion.coerceBooleanProperty(value);
  27343. },
  27344. enumerable: true,
  27345. configurable: true
  27346. });
  27347. /**
  27348. * @return {?}
  27349. */
  27350. MatPaginator.prototype.ngOnInit = /**
  27351. * @return {?}
  27352. */
  27353. function () {
  27354. this._initialized = true;
  27355. this._updateDisplayedPageSizeOptions();
  27356. this._markInitialized();
  27357. };
  27358. /**
  27359. * @return {?}
  27360. */
  27361. MatPaginator.prototype.ngOnDestroy = /**
  27362. * @return {?}
  27363. */
  27364. function () {
  27365. this._intlChanges.unsubscribe();
  27366. };
  27367. /** Advances to the next page if it exists. */
  27368. /**
  27369. * Advances to the next page if it exists.
  27370. * @return {?}
  27371. */
  27372. MatPaginator.prototype.nextPage = /**
  27373. * Advances to the next page if it exists.
  27374. * @return {?}
  27375. */
  27376. function () {
  27377. if (!this.hasNextPage()) {
  27378. return;
  27379. }
  27380. /** @type {?} */
  27381. var previousPageIndex = this.pageIndex;
  27382. this.pageIndex++;
  27383. this._emitPageEvent(previousPageIndex);
  27384. };
  27385. /** Move back to the previous page if it exists. */
  27386. /**
  27387. * Move back to the previous page if it exists.
  27388. * @return {?}
  27389. */
  27390. MatPaginator.prototype.previousPage = /**
  27391. * Move back to the previous page if it exists.
  27392. * @return {?}
  27393. */
  27394. function () {
  27395. if (!this.hasPreviousPage()) {
  27396. return;
  27397. }
  27398. /** @type {?} */
  27399. var previousPageIndex = this.pageIndex;
  27400. this.pageIndex--;
  27401. this._emitPageEvent(previousPageIndex);
  27402. };
  27403. /** Move to the first page if not already there. */
  27404. /**
  27405. * Move to the first page if not already there.
  27406. * @return {?}
  27407. */
  27408. MatPaginator.prototype.firstPage = /**
  27409. * Move to the first page if not already there.
  27410. * @return {?}
  27411. */
  27412. function () {
  27413. // hasPreviousPage being false implies at the start
  27414. if (!this.hasPreviousPage()) {
  27415. return;
  27416. }
  27417. /** @type {?} */
  27418. var previousPageIndex = this.pageIndex;
  27419. this.pageIndex = 0;
  27420. this._emitPageEvent(previousPageIndex);
  27421. };
  27422. /** Move to the last page if not already there. */
  27423. /**
  27424. * Move to the last page if not already there.
  27425. * @return {?}
  27426. */
  27427. MatPaginator.prototype.lastPage = /**
  27428. * Move to the last page if not already there.
  27429. * @return {?}
  27430. */
  27431. function () {
  27432. // hasNextPage being false implies at the end
  27433. if (!this.hasNextPage()) {
  27434. return;
  27435. }
  27436. /** @type {?} */
  27437. var previousPageIndex = this.pageIndex;
  27438. this.pageIndex = this.getNumberOfPages() - 1;
  27439. this._emitPageEvent(previousPageIndex);
  27440. };
  27441. /** Whether there is a previous page. */
  27442. /**
  27443. * Whether there is a previous page.
  27444. * @return {?}
  27445. */
  27446. MatPaginator.prototype.hasPreviousPage = /**
  27447. * Whether there is a previous page.
  27448. * @return {?}
  27449. */
  27450. function () {
  27451. return this.pageIndex >= 1 && this.pageSize != 0;
  27452. };
  27453. /** Whether there is a next page. */
  27454. /**
  27455. * Whether there is a next page.
  27456. * @return {?}
  27457. */
  27458. MatPaginator.prototype.hasNextPage = /**
  27459. * Whether there is a next page.
  27460. * @return {?}
  27461. */
  27462. function () {
  27463. /** @type {?} */
  27464. var maxPageIndex = this.getNumberOfPages() - 1;
  27465. return this.pageIndex < maxPageIndex && this.pageSize != 0;
  27466. };
  27467. /** Calculate the number of pages */
  27468. /**
  27469. * Calculate the number of pages
  27470. * @return {?}
  27471. */
  27472. MatPaginator.prototype.getNumberOfPages = /**
  27473. * Calculate the number of pages
  27474. * @return {?}
  27475. */
  27476. function () {
  27477. if (!this.pageSize) {
  27478. return 0;
  27479. }
  27480. return Math.ceil(this.length / this.pageSize);
  27481. };
  27482. /**
  27483. * Changes the page size so that the first item displayed on the page will still be
  27484. * displayed using the new page size.
  27485. *
  27486. * For example, if the page size is 10 and on the second page (items indexed 10-19) then
  27487. * switching so that the page size is 5 will set the third page as the current page so
  27488. * that the 10th item will still be displayed.
  27489. */
  27490. /**
  27491. * Changes the page size so that the first item displayed on the page will still be
  27492. * displayed using the new page size.
  27493. *
  27494. * For example, if the page size is 10 and on the second page (items indexed 10-19) then
  27495. * switching so that the page size is 5 will set the third page as the current page so
  27496. * that the 10th item will still be displayed.
  27497. * @param {?} pageSize
  27498. * @return {?}
  27499. */
  27500. MatPaginator.prototype._changePageSize = /**
  27501. * Changes the page size so that the first item displayed on the page will still be
  27502. * displayed using the new page size.
  27503. *
  27504. * For example, if the page size is 10 and on the second page (items indexed 10-19) then
  27505. * switching so that the page size is 5 will set the third page as the current page so
  27506. * that the 10th item will still be displayed.
  27507. * @param {?} pageSize
  27508. * @return {?}
  27509. */
  27510. function (pageSize) {
  27511. // Current page needs to be updated to reflect the new page size. Navigate to the page
  27512. // containing the previous page's first item.
  27513. /** @type {?} */
  27514. var startIndex = this.pageIndex * this.pageSize;
  27515. /** @type {?} */
  27516. var previousPageIndex = this.pageIndex;
  27517. this.pageIndex = Math.floor(startIndex / pageSize) || 0;
  27518. this.pageSize = pageSize;
  27519. this._emitPageEvent(previousPageIndex);
  27520. };
  27521. /** Checks whether the buttons for going forwards should be disabled. */
  27522. /**
  27523. * Checks whether the buttons for going forwards should be disabled.
  27524. * @return {?}
  27525. */
  27526. MatPaginator.prototype._nextButtonsDisabled = /**
  27527. * Checks whether the buttons for going forwards should be disabled.
  27528. * @return {?}
  27529. */
  27530. function () {
  27531. return this.disabled || !this.hasNextPage();
  27532. };
  27533. /** Checks whether the buttons for going backwards should be disabled. */
  27534. /**
  27535. * Checks whether the buttons for going backwards should be disabled.
  27536. * @return {?}
  27537. */
  27538. MatPaginator.prototype._previousButtonsDisabled = /**
  27539. * Checks whether the buttons for going backwards should be disabled.
  27540. * @return {?}
  27541. */
  27542. function () {
  27543. return this.disabled || !this.hasPreviousPage();
  27544. };
  27545. /**
  27546. * Updates the list of page size options to display to the user. Includes making sure that
  27547. * the page size is an option and that the list is sorted.
  27548. */
  27549. /**
  27550. * Updates the list of page size options to display to the user. Includes making sure that
  27551. * the page size is an option and that the list is sorted.
  27552. * @private
  27553. * @return {?}
  27554. */
  27555. MatPaginator.prototype._updateDisplayedPageSizeOptions = /**
  27556. * Updates the list of page size options to display to the user. Includes making sure that
  27557. * the page size is an option and that the list is sorted.
  27558. * @private
  27559. * @return {?}
  27560. */
  27561. function () {
  27562. if (!this._initialized) {
  27563. return;
  27564. }
  27565. // If no page size is provided, use the first page size option or the default page size.
  27566. if (!this.pageSize) {
  27567. this._pageSize = this.pageSizeOptions.length != 0 ?
  27568. this.pageSizeOptions[0] :
  27569. DEFAULT_PAGE_SIZE;
  27570. }
  27571. this._displayedPageSizeOptions = this.pageSizeOptions.slice();
  27572. if (this._displayedPageSizeOptions.indexOf(this.pageSize) === -1) {
  27573. this._displayedPageSizeOptions.push(this.pageSize);
  27574. }
  27575. // Sort the numbers using a number-specific sort function.
  27576. this._displayedPageSizeOptions.sort((/**
  27577. * @param {?} a
  27578. * @param {?} b
  27579. * @return {?}
  27580. */
  27581. function (a, b) { return a - b; }));
  27582. this._changeDetectorRef.markForCheck();
  27583. };
  27584. /** Emits an event notifying that a change of the paginator's properties has been triggered. */
  27585. /**
  27586. * Emits an event notifying that a change of the paginator's properties has been triggered.
  27587. * @private
  27588. * @param {?} previousPageIndex
  27589. * @return {?}
  27590. */
  27591. MatPaginator.prototype._emitPageEvent = /**
  27592. * Emits an event notifying that a change of the paginator's properties has been triggered.
  27593. * @private
  27594. * @param {?} previousPageIndex
  27595. * @return {?}
  27596. */
  27597. function (previousPageIndex) {
  27598. this.page.emit({
  27599. previousPageIndex: previousPageIndex,
  27600. pageIndex: this.pageIndex,
  27601. pageSize: this.pageSize,
  27602. length: this.length
  27603. });
  27604. };
  27605. MatPaginator.decorators = [
  27606. { type: core.Component, args: [{selector: 'mat-paginator',
  27607. exportAs: 'matPaginator',
  27608. template: "<div class=\"mat-paginator-outer-container\"><div class=\"mat-paginator-container\"><div class=\"mat-paginator-page-size\" *ngIf=\"!hidePageSize\"><div class=\"mat-paginator-page-size-label\">{{_intl.itemsPerPageLabel}}</div><mat-form-field *ngIf=\"_displayedPageSizeOptions.length > 1\" [color]=\"color\" class=\"mat-paginator-page-size-select\"><mat-select [value]=\"pageSize\" [disabled]=\"disabled\" [aria-label]=\"_intl.itemsPerPageLabel\" (selectionChange)=\"_changePageSize($event.value)\"><mat-option *ngFor=\"let pageSizeOption of _displayedPageSizeOptions\" [value]=\"pageSizeOption\">{{pageSizeOption}}</mat-option></mat-select></mat-form-field><div *ngIf=\"_displayedPageSizeOptions.length <= 1\">{{pageSize}}</div></div><div class=\"mat-paginator-range-actions\"><div class=\"mat-paginator-range-label\">{{_intl.getRangeLabel(pageIndex, pageSize, length)}}</div><button mat-icon-button type=\"button\" class=\"mat-paginator-navigation-first\" (click)=\"firstPage()\" [attr.aria-label]=\"_intl.firstPageLabel\" [matTooltip]=\"_intl.firstPageLabel\" [matTooltipDisabled]=\"_previousButtonsDisabled()\" [matTooltipPosition]=\"'above'\" [disabled]=\"_previousButtonsDisabled()\" *ngIf=\"showFirstLastButtons\"><svg class=\"mat-paginator-icon\" viewBox=\"0 0 24 24\" focusable=\"false\"><path d=\"M18.41 16.59L13.82 12l4.59-4.59L17 6l-6 6 6 6zM6 6h2v12H6z\"/></svg></button> <button mat-icon-button type=\"button\" class=\"mat-paginator-navigation-previous\" (click)=\"previousPage()\" [attr.aria-label]=\"_intl.previousPageLabel\" [matTooltip]=\"_intl.previousPageLabel\" [matTooltipDisabled]=\"_previousButtonsDisabled()\" [matTooltipPosition]=\"'above'\" [disabled]=\"_previousButtonsDisabled()\"><svg class=\"mat-paginator-icon\" viewBox=\"0 0 24 24\" focusable=\"false\"><path d=\"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z\"/></svg></button> <button mat-icon-button type=\"button\" class=\"mat-paginator-navigation-next\" (click)=\"nextPage()\" [attr.aria-label]=\"_intl.nextPageLabel\" [matTooltip]=\"_intl.nextPageLabel\" [matTooltipDisabled]=\"_nextButtonsDisabled()\" [matTooltipPosition]=\"'above'\" [disabled]=\"_nextButtonsDisabled()\"><svg class=\"mat-paginator-icon\" viewBox=\"0 0 24 24\" focusable=\"false\"><path d=\"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z\"/></svg></button> <button mat-icon-button type=\"button\" class=\"mat-paginator-navigation-last\" (click)=\"lastPage()\" [attr.aria-label]=\"_intl.lastPageLabel\" [matTooltip]=\"_intl.lastPageLabel\" [matTooltipDisabled]=\"_nextButtonsDisabled()\" [matTooltipPosition]=\"'above'\" [disabled]=\"_nextButtonsDisabled()\" *ngIf=\"showFirstLastButtons\"><svg class=\"mat-paginator-icon\" viewBox=\"0 0 24 24\" focusable=\"false\"><path d=\"M5.59 7.41L10.18 12l-4.59 4.59L7 18l6-6-6-6zM16 6h2v12h-2z\"/></svg></button></div></div></div>",
  27609. styles: [".mat-paginator{display:block}.mat-paginator-outer-container{display:flex}.mat-paginator-container{display:flex;align-items:center;justify-content:flex-end;min-height:56px;padding:0 8px;flex-wrap:wrap-reverse;width:100%}.mat-paginator-page-size{display:flex;align-items:baseline;margin-right:8px}[dir=rtl] .mat-paginator-page-size{margin-right:0;margin-left:8px}.mat-paginator-page-size-label{margin:0 4px}.mat-paginator-page-size-select{margin:6px 4px 0 4px;width:56px}.mat-paginator-page-size-select.mat-form-field-appearance-outline{width:64px}.mat-paginator-page-size-select.mat-form-field-appearance-fill{width:64px}.mat-paginator-range-label{margin:0 32px 0 24px}.mat-paginator-range-actions{display:flex;align-items:center}.mat-paginator-icon{width:28px;fill:currentColor}[dir=rtl] .mat-paginator-icon{transform:rotate(180deg)}"],
  27610. inputs: ['disabled'],
  27611. host: {
  27612. 'class': 'mat-paginator',
  27613. },
  27614. changeDetection: core.ChangeDetectionStrategy.OnPush,
  27615. encapsulation: core.ViewEncapsulation.None,
  27616. },] },
  27617. ];
  27618. /** @nocollapse */
  27619. MatPaginator.ctorParameters = function () { return [
  27620. { type: MatPaginatorIntl },
  27621. { type: core.ChangeDetectorRef }
  27622. ]; };
  27623. MatPaginator.propDecorators = {
  27624. color: [{ type: core.Input }],
  27625. pageIndex: [{ type: core.Input }],
  27626. length: [{ type: core.Input }],
  27627. pageSize: [{ type: core.Input }],
  27628. pageSizeOptions: [{ type: core.Input }],
  27629. hidePageSize: [{ type: core.Input }],
  27630. showFirstLastButtons: [{ type: core.Input }],
  27631. page: [{ type: core.Output }]
  27632. };
  27633. return MatPaginator;
  27634. }(_MatPaginatorBase));
  27635. /**
  27636. * @fileoverview added by tsickle
  27637. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  27638. */
  27639. var MatPaginatorModule = /** @class */ (function () {
  27640. function MatPaginatorModule() {
  27641. }
  27642. MatPaginatorModule.decorators = [
  27643. { type: core.NgModule, args: [{
  27644. imports: [
  27645. common.CommonModule,
  27646. MatButtonModule,
  27647. MatSelectModule,
  27648. MatTooltipModule,
  27649. ],
  27650. exports: [MatPaginator],
  27651. declarations: [MatPaginator],
  27652. providers: [MAT_PAGINATOR_INTL_PROVIDER],
  27653. },] },
  27654. ];
  27655. return MatPaginatorModule;
  27656. }());
  27657. /**
  27658. * @fileoverview added by tsickle
  27659. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  27660. */
  27661. // Boilerplate for applying mixins to MatProgressBar.
  27662. /**
  27663. * \@docs-private
  27664. */
  27665. var
  27666. // Boilerplate for applying mixins to MatProgressBar.
  27667. /**
  27668. * \@docs-private
  27669. */
  27670. MatProgressBarBase = /** @class */ (function () {
  27671. function MatProgressBarBase(_elementRef) {
  27672. this._elementRef = _elementRef;
  27673. }
  27674. return MatProgressBarBase;
  27675. }());
  27676. /** @type {?} */
  27677. var _MatProgressBarMixinBase = mixinColor(MatProgressBarBase, 'primary');
  27678. /**
  27679. * Injection token used to provide the current location to `MatProgressBar`.
  27680. * Used to handle server-side rendering and to stub out during unit tests.
  27681. * \@docs-private
  27682. * @type {?}
  27683. */
  27684. var MAT_PROGRESS_BAR_LOCATION = new core.InjectionToken('mat-progress-bar-location', { providedIn: 'root', factory: MAT_PROGRESS_BAR_LOCATION_FACTORY });
  27685. /**
  27686. * \@docs-private
  27687. * @return {?}
  27688. */
  27689. function MAT_PROGRESS_BAR_LOCATION_FACTORY() {
  27690. /** @type {?} */
  27691. var _document = core.inject(common.DOCUMENT);
  27692. /** @type {?} */
  27693. var _location = _document ? _document.location : null;
  27694. return {
  27695. // Note that this needs to be a function, rather than a property, because Angular
  27696. // will only resolve it once, but we want the current path on each call.
  27697. getPathname: (/**
  27698. * @return {?}
  27699. */
  27700. function () { return _location ? (_location.pathname + _location.search) : ''; })
  27701. };
  27702. }
  27703. /**
  27704. * Counter used to generate unique IDs for progress bars.
  27705. * @type {?}
  27706. */
  27707. var progressbarId = 0;
  27708. /**
  27709. * `<mat-progress-bar>` component.
  27710. */
  27711. var MatProgressBar = /** @class */ (function (_super) {
  27712. __extends(MatProgressBar, _super);
  27713. function MatProgressBar(_elementRef, _ngZone, _animationMode,
  27714. /**
  27715. * @deprecated `location` parameter to be made required.
  27716. * @breaking-change 8.0.0
  27717. */
  27718. location) {
  27719. var _this = _super.call(this, _elementRef) || this;
  27720. _this._elementRef = _elementRef;
  27721. _this._ngZone = _ngZone;
  27722. _this._animationMode = _animationMode;
  27723. /**
  27724. * Flag that indicates whether NoopAnimations mode is set to true.
  27725. */
  27726. _this._isNoopAnimation = false;
  27727. _this._value = 0;
  27728. _this._bufferValue = 0;
  27729. /**
  27730. * Event emitted when animation of the primary progress bar completes. This event will not
  27731. * be emitted when animations are disabled, nor will it be emitted for modes with continuous
  27732. * animations (indeterminate and query).
  27733. */
  27734. _this.animationEnd = new core.EventEmitter();
  27735. /**
  27736. * Reference to animation end subscription to be unsubscribed on destroy.
  27737. */
  27738. _this._animationEndSubscription = rxjs.Subscription.EMPTY;
  27739. /**
  27740. * Mode of the progress bar.
  27741. *
  27742. * Input must be one of these values: determinate, indeterminate, buffer, query, defaults to
  27743. * 'determinate'.
  27744. * Mirrored to mode attribute.
  27745. */
  27746. _this.mode = 'determinate';
  27747. /**
  27748. * ID of the progress bar.
  27749. */
  27750. _this.progressbarId = "mat-progress-bar-" + progressbarId++;
  27751. // We need to prefix the SVG reference with the current path, otherwise they won't work
  27752. // in Safari if the page has a `<base>` tag. Note that we need quotes inside the `url()`,
  27753. // because named route URLs can contain parentheses (see #12338). Also we don't use since
  27754. // we can't tell the difference between whether
  27755. // the consumer is using the hash location strategy or not, because `Location` normalizes
  27756. // both `/#/foo/bar` and `/foo/bar` to the same thing.
  27757. /** @type {?} */
  27758. var path = location ? location.getPathname().split('#')[0] : '';
  27759. _this._rectangleFillValue = "url('" + path + "#" + _this.progressbarId + "')";
  27760. _this._isNoopAnimation = _animationMode === 'NoopAnimations';
  27761. return _this;
  27762. }
  27763. Object.defineProperty(MatProgressBar.prototype, "value", {
  27764. /** Value of the progress bar. Defaults to zero. Mirrored to aria-valuenow. */
  27765. get: /**
  27766. * Value of the progress bar. Defaults to zero. Mirrored to aria-valuenow.
  27767. * @return {?}
  27768. */
  27769. function () { return this._value; },
  27770. set: /**
  27771. * @param {?} v
  27772. * @return {?}
  27773. */
  27774. function (v) {
  27775. this._value = clamp(v || 0);
  27776. // When noop animation is set to true, trigger animationEnd directly.
  27777. if (this._isNoopAnimation) {
  27778. this._emitAnimationEnd();
  27779. }
  27780. },
  27781. enumerable: true,
  27782. configurable: true
  27783. });
  27784. Object.defineProperty(MatProgressBar.prototype, "bufferValue", {
  27785. /** Buffer value of the progress bar. Defaults to zero. */
  27786. get: /**
  27787. * Buffer value of the progress bar. Defaults to zero.
  27788. * @return {?}
  27789. */
  27790. function () { return this._bufferValue; },
  27791. set: /**
  27792. * @param {?} v
  27793. * @return {?}
  27794. */
  27795. function (v) { this._bufferValue = clamp(v || 0); },
  27796. enumerable: true,
  27797. configurable: true
  27798. });
  27799. /** Gets the current transform value for the progress bar's primary indicator. */
  27800. /**
  27801. * Gets the current transform value for the progress bar's primary indicator.
  27802. * @return {?}
  27803. */
  27804. MatProgressBar.prototype._primaryTransform = /**
  27805. * Gets the current transform value for the progress bar's primary indicator.
  27806. * @return {?}
  27807. */
  27808. function () {
  27809. /** @type {?} */
  27810. var scale = this.value / 100;
  27811. return { transform: "scaleX(" + scale + ")" };
  27812. };
  27813. /**
  27814. * Gets the current transform value for the progress bar's buffer indicator. Only used if the
  27815. * progress mode is set to buffer, otherwise returns an undefined, causing no transformation.
  27816. */
  27817. /**
  27818. * Gets the current transform value for the progress bar's buffer indicator. Only used if the
  27819. * progress mode is set to buffer, otherwise returns an undefined, causing no transformation.
  27820. * @return {?}
  27821. */
  27822. MatProgressBar.prototype._bufferTransform = /**
  27823. * Gets the current transform value for the progress bar's buffer indicator. Only used if the
  27824. * progress mode is set to buffer, otherwise returns an undefined, causing no transformation.
  27825. * @return {?}
  27826. */
  27827. function () {
  27828. if (this.mode === 'buffer') {
  27829. /** @type {?} */
  27830. var scale = this.bufferValue / 100;
  27831. return { transform: "scaleX(" + scale + ")" };
  27832. }
  27833. return undefined;
  27834. };
  27835. /**
  27836. * @return {?}
  27837. */
  27838. MatProgressBar.prototype.ngAfterViewInit = /**
  27839. * @return {?}
  27840. */
  27841. function () {
  27842. var _this = this;
  27843. if (!this._isNoopAnimation) {
  27844. // Run outside angular so change detection didn't get triggered on every transition end
  27845. // instead only on the animation that we care about (primary value bar's transitionend)
  27846. this._ngZone.runOutsideAngular(((/**
  27847. * @return {?}
  27848. */
  27849. function () {
  27850. /** @type {?} */
  27851. var element = _this._primaryValueBar.nativeElement;
  27852. _this._animationEndSubscription =
  27853. ((/** @type {?} */ (rxjs.fromEvent(element, 'transitionend'))))
  27854. .pipe(operators.filter(((/**
  27855. * @param {?} e
  27856. * @return {?}
  27857. */
  27858. function (e) { return e.target === element; }))))
  27859. .subscribe((/**
  27860. * @return {?}
  27861. */
  27862. function () { return _this._ngZone.run((/**
  27863. * @return {?}
  27864. */
  27865. function () { return _this._emitAnimationEnd(); })); }));
  27866. })));
  27867. }
  27868. };
  27869. /**
  27870. * @return {?}
  27871. */
  27872. MatProgressBar.prototype.ngOnDestroy = /**
  27873. * @return {?}
  27874. */
  27875. function () {
  27876. this._animationEndSubscription.unsubscribe();
  27877. };
  27878. /** Emit an animationEnd event if in determinate or buffer mode. */
  27879. /**
  27880. * Emit an animationEnd event if in determinate or buffer mode.
  27881. * @private
  27882. * @return {?}
  27883. */
  27884. MatProgressBar.prototype._emitAnimationEnd = /**
  27885. * Emit an animationEnd event if in determinate or buffer mode.
  27886. * @private
  27887. * @return {?}
  27888. */
  27889. function () {
  27890. if (this.mode === 'determinate' || this.mode === 'buffer') {
  27891. this.animationEnd.next({ value: this.value });
  27892. }
  27893. };
  27894. MatProgressBar.decorators = [
  27895. { type: core.Component, args: [{selector: 'mat-progress-bar',
  27896. exportAs: 'matProgressBar',
  27897. host: {
  27898. 'role': 'progressbar',
  27899. 'aria-valuemin': '0',
  27900. 'aria-valuemax': '100',
  27901. '[attr.aria-valuenow]': '(mode === "indeterminate" || mode === "query") ? null : value',
  27902. '[attr.mode]': 'mode',
  27903. 'class': 'mat-progress-bar',
  27904. '[class._mat-animation-noopable]': '_isNoopAnimation',
  27905. },
  27906. inputs: ['color'],
  27907. template: "<svg width=\"100%\" height=\"4\" focusable=\"false\" class=\"mat-progress-bar-background mat-progress-bar-element\"><defs><pattern [id]=\"progressbarId\" x=\"4\" y=\"0\" width=\"8\" height=\"4\" patternUnits=\"userSpaceOnUse\"><circle cx=\"2\" cy=\"2\" r=\"2\"/></pattern></defs><rect [attr.fill]=\"_rectangleFillValue\" width=\"100%\" height=\"100%\"/></svg><div class=\"mat-progress-bar-buffer mat-progress-bar-element\" [ngStyle]=\"_bufferTransform()\"></div><div class=\"mat-progress-bar-primary mat-progress-bar-fill mat-progress-bar-element\" [ngStyle]=\"_primaryTransform()\" #primaryValueBar></div><div class=\"mat-progress-bar-secondary mat-progress-bar-fill mat-progress-bar-element\"></div>",
  27908. styles: [".mat-progress-bar{display:block;height:4px;overflow:hidden;position:relative;transition:opacity 250ms linear;width:100%}._mat-animation-noopable.mat-progress-bar{transition:none;animation:none}.mat-progress-bar .mat-progress-bar-element,.mat-progress-bar .mat-progress-bar-fill::after{height:100%;position:absolute;width:100%}.mat-progress-bar .mat-progress-bar-background{width:calc(100% + 10px)}@media (-ms-high-contrast:active){.mat-progress-bar .mat-progress-bar-background{display:none}}.mat-progress-bar .mat-progress-bar-buffer{transform-origin:top left;transition:transform 250ms ease}@media (-ms-high-contrast:active){.mat-progress-bar .mat-progress-bar-buffer{border-top:solid 5px;opacity:.5}}.mat-progress-bar .mat-progress-bar-secondary{display:none}.mat-progress-bar .mat-progress-bar-fill{animation:none;transform-origin:top left;transition:transform 250ms ease}@media (-ms-high-contrast:active){.mat-progress-bar .mat-progress-bar-fill{border-top:solid 4px}}.mat-progress-bar .mat-progress-bar-fill::after{animation:none;content:'';display:inline-block;left:0}.mat-progress-bar[dir=rtl],[dir=rtl] .mat-progress-bar{transform:rotateY(180deg)}.mat-progress-bar[mode=query]{transform:rotateZ(180deg)}.mat-progress-bar[mode=query][dir=rtl],[dir=rtl] .mat-progress-bar[mode=query]{transform:rotateZ(180deg) rotateY(180deg)}.mat-progress-bar[mode=indeterminate] .mat-progress-bar-fill,.mat-progress-bar[mode=query] .mat-progress-bar-fill{transition:none}.mat-progress-bar[mode=indeterminate] .mat-progress-bar-primary,.mat-progress-bar[mode=query] .mat-progress-bar-primary{-webkit-backface-visibility:hidden;backface-visibility:hidden;animation:mat-progress-bar-primary-indeterminate-translate 2s infinite linear;left:-145.166611%}.mat-progress-bar[mode=indeterminate] .mat-progress-bar-primary.mat-progress-bar-fill::after,.mat-progress-bar[mode=query] .mat-progress-bar-primary.mat-progress-bar-fill::after{-webkit-backface-visibility:hidden;backface-visibility:hidden;animation:mat-progress-bar-primary-indeterminate-scale 2s infinite linear}.mat-progress-bar[mode=indeterminate] .mat-progress-bar-secondary,.mat-progress-bar[mode=query] .mat-progress-bar-secondary{-webkit-backface-visibility:hidden;backface-visibility:hidden;animation:mat-progress-bar-secondary-indeterminate-translate 2s infinite linear;left:-54.888891%;display:block}.mat-progress-bar[mode=indeterminate] .mat-progress-bar-secondary.mat-progress-bar-fill::after,.mat-progress-bar[mode=query] .mat-progress-bar-secondary.mat-progress-bar-fill::after{-webkit-backface-visibility:hidden;backface-visibility:hidden;animation:mat-progress-bar-secondary-indeterminate-scale 2s infinite linear}.mat-progress-bar[mode=buffer] .mat-progress-bar-background{-webkit-backface-visibility:hidden;backface-visibility:hidden;animation:mat-progress-bar-background-scroll 250ms infinite linear;display:block}.mat-progress-bar._mat-animation-noopable .mat-progress-bar-background,.mat-progress-bar._mat-animation-noopable .mat-progress-bar-buffer,.mat-progress-bar._mat-animation-noopable .mat-progress-bar-fill,.mat-progress-bar._mat-animation-noopable .mat-progress-bar-fill::after,.mat-progress-bar._mat-animation-noopable .mat-progress-bar-primary,.mat-progress-bar._mat-animation-noopable .mat-progress-bar-primary.mat-progress-bar-fill::after,.mat-progress-bar._mat-animation-noopable .mat-progress-bar-secondary,.mat-progress-bar._mat-animation-noopable .mat-progress-bar-secondary.mat-progress-bar-fill::after{animation:none;transition:none}@keyframes mat-progress-bar-primary-indeterminate-translate{0%{transform:translateX(0)}20%{animation-timing-function:cubic-bezier(.5,0,.70173,.49582);transform:translateX(0)}59.15%{animation-timing-function:cubic-bezier(.30244,.38135,.55,.95635);transform:translateX(83.67142%)}100%{transform:translateX(200.61106%)}}@keyframes mat-progress-bar-primary-indeterminate-scale{0%{transform:scaleX(.08)}36.65%{animation-timing-function:cubic-bezier(.33473,.12482,.78584,1);transform:scaleX(.08)}69.15%{animation-timing-function:cubic-bezier(.06,.11,.6,1);transform:scaleX(.66148)}100%{transform:scaleX(.08)}}@keyframes mat-progress-bar-secondary-indeterminate-translate{0%{animation-timing-function:cubic-bezier(.15,0,.51506,.40969);transform:translateX(0)}25%{animation-timing-function:cubic-bezier(.31033,.28406,.8,.73371);transform:translateX(37.65191%)}48.35%{animation-timing-function:cubic-bezier(.4,.62704,.6,.90203);transform:translateX(84.38617%)}100%{transform:translateX(160.27778%)}}@keyframes mat-progress-bar-secondary-indeterminate-scale{0%{animation-timing-function:cubic-bezier(.15,0,.51506,.40969);transform:scaleX(.08)}19.15%{animation-timing-function:cubic-bezier(.31033,.28406,.8,.73371);transform:scaleX(.4571)}44.15%{animation-timing-function:cubic-bezier(.4,.62704,.6,.90203);transform:scaleX(.72796)}100%{transform:scaleX(.08)}}@keyframes mat-progress-bar-background-scroll{to{transform:translateX(-8px)}}"],
  27909. changeDetection: core.ChangeDetectionStrategy.OnPush,
  27910. encapsulation: core.ViewEncapsulation.None,
  27911. },] },
  27912. ];
  27913. /** @nocollapse */
  27914. MatProgressBar.ctorParameters = function () { return [
  27915. { type: core.ElementRef },
  27916. { type: core.NgZone },
  27917. { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] },
  27918. { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_PROGRESS_BAR_LOCATION,] }] }
  27919. ]; };
  27920. MatProgressBar.propDecorators = {
  27921. value: [{ type: core.Input }],
  27922. bufferValue: [{ type: core.Input }],
  27923. _primaryValueBar: [{ type: core.ViewChild, args: ['primaryValueBar', { static: false },] }],
  27924. animationEnd: [{ type: core.Output }],
  27925. mode: [{ type: core.Input }]
  27926. };
  27927. return MatProgressBar;
  27928. }(_MatProgressBarMixinBase));
  27929. /**
  27930. * Clamps a value to be between two numbers, by default 0 and 100.
  27931. * @param {?} v
  27932. * @param {?=} min
  27933. * @param {?=} max
  27934. * @return {?}
  27935. */
  27936. function clamp(v, min, max) {
  27937. if (min === void 0) { min = 0; }
  27938. if (max === void 0) { max = 100; }
  27939. return Math.max(min, Math.min(max, v));
  27940. }
  27941. /**
  27942. * @fileoverview added by tsickle
  27943. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  27944. */
  27945. var MatProgressBarModule = /** @class */ (function () {
  27946. function MatProgressBarModule() {
  27947. }
  27948. MatProgressBarModule.decorators = [
  27949. { type: core.NgModule, args: [{
  27950. imports: [common.CommonModule, MatCommonModule],
  27951. exports: [MatProgressBar, MatCommonModule],
  27952. declarations: [MatProgressBar],
  27953. },] },
  27954. ];
  27955. return MatProgressBarModule;
  27956. }());
  27957. /**
  27958. * @fileoverview added by tsickle
  27959. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  27960. */
  27961. /**
  27962. * Base reference size of the spinner.
  27963. * \@docs-private
  27964. * @type {?}
  27965. */
  27966. var BASE_SIZE = 100;
  27967. /**
  27968. * Base reference stroke width of the spinner.
  27969. * \@docs-private
  27970. * @type {?}
  27971. */
  27972. var BASE_STROKE_WIDTH = 10;
  27973. // Boilerplate for applying mixins to MatProgressSpinner.
  27974. /**
  27975. * \@docs-private
  27976. */
  27977. var
  27978. // Boilerplate for applying mixins to MatProgressSpinner.
  27979. /**
  27980. * \@docs-private
  27981. */
  27982. MatProgressSpinnerBase = /** @class */ (function () {
  27983. function MatProgressSpinnerBase(_elementRef) {
  27984. this._elementRef = _elementRef;
  27985. }
  27986. return MatProgressSpinnerBase;
  27987. }());
  27988. /** @type {?} */
  27989. var _MatProgressSpinnerMixinBase = mixinColor(MatProgressSpinnerBase, 'primary');
  27990. /**
  27991. * Injection token to be used to override the default options for `mat-progress-spinner`.
  27992. * @type {?}
  27993. */
  27994. var MAT_PROGRESS_SPINNER_DEFAULT_OPTIONS = new core.InjectionToken('mat-progress-spinner-default-options', {
  27995. providedIn: 'root',
  27996. factory: MAT_PROGRESS_SPINNER_DEFAULT_OPTIONS_FACTORY,
  27997. });
  27998. /**
  27999. * \@docs-private
  28000. * @return {?}
  28001. */
  28002. function MAT_PROGRESS_SPINNER_DEFAULT_OPTIONS_FACTORY() {
  28003. return { diameter: BASE_SIZE };
  28004. }
  28005. // .0001 percentage difference is necessary in order to avoid unwanted animation frames
  28006. // for example because the animation duration is 4 seconds, .1% accounts to 4ms
  28007. // which are enough to see the flicker described in
  28008. // https://github.com/angular/components/issues/8984
  28009. /** @type {?} */
  28010. var INDETERMINATE_ANIMATION_TEMPLATE = "\n @keyframes mat-progress-spinner-stroke-rotate-DIAMETER {\n 0% { stroke-dashoffset: START_VALUE; transform: rotate(0); }\n 12.5% { stroke-dashoffset: END_VALUE; transform: rotate(0); }\n 12.5001% { stroke-dashoffset: END_VALUE; transform: rotateX(180deg) rotate(72.5deg); }\n 25% { stroke-dashoffset: START_VALUE; transform: rotateX(180deg) rotate(72.5deg); }\n\n 25.0001% { stroke-dashoffset: START_VALUE; transform: rotate(270deg); }\n 37.5% { stroke-dashoffset: END_VALUE; transform: rotate(270deg); }\n 37.5001% { stroke-dashoffset: END_VALUE; transform: rotateX(180deg) rotate(161.5deg); }\n 50% { stroke-dashoffset: START_VALUE; transform: rotateX(180deg) rotate(161.5deg); }\n\n 50.0001% { stroke-dashoffset: START_VALUE; transform: rotate(180deg); }\n 62.5% { stroke-dashoffset: END_VALUE; transform: rotate(180deg); }\n 62.5001% { stroke-dashoffset: END_VALUE; transform: rotateX(180deg) rotate(251.5deg); }\n 75% { stroke-dashoffset: START_VALUE; transform: rotateX(180deg) rotate(251.5deg); }\n\n 75.0001% { stroke-dashoffset: START_VALUE; transform: rotate(90deg); }\n 87.5% { stroke-dashoffset: END_VALUE; transform: rotate(90deg); }\n 87.5001% { stroke-dashoffset: END_VALUE; transform: rotateX(180deg) rotate(341.5deg); }\n 100% { stroke-dashoffset: START_VALUE; transform: rotateX(180deg) rotate(341.5deg); }\n }\n";
  28011. /**
  28012. * `<mat-progress-spinner>` component.
  28013. */
  28014. var MatProgressSpinner = /** @class */ (function (_super) {
  28015. __extends(MatProgressSpinner, _super);
  28016. function MatProgressSpinner(_elementRef, platform$$1, _document, animationMode, defaults) {
  28017. var _this = _super.call(this, _elementRef) || this;
  28018. _this._elementRef = _elementRef;
  28019. _this._document = _document;
  28020. _this._diameter = BASE_SIZE;
  28021. _this._value = 0;
  28022. _this._fallbackAnimation = false;
  28023. /**
  28024. * Mode of the progress circle
  28025. */
  28026. _this.mode = 'determinate';
  28027. /** @type {?} */
  28028. var trackedDiameters = MatProgressSpinner._diameters;
  28029. // The base size is already inserted via the component's structural styles. We still
  28030. // need to track it so we don't end up adding the same styles again.
  28031. if (!trackedDiameters.has(_document.head)) {
  28032. trackedDiameters.set(_document.head, new Set([BASE_SIZE]));
  28033. }
  28034. _this._styleRoot = _getShadowRoot(_elementRef.nativeElement, _document) || _document.head;
  28035. _this._fallbackAnimation = platform$$1.EDGE || platform$$1.TRIDENT;
  28036. _this._noopAnimations = animationMode === 'NoopAnimations' &&
  28037. (!!defaults && !defaults._forceAnimations);
  28038. if (defaults) {
  28039. if (defaults.diameter) {
  28040. _this.diameter = defaults.diameter;
  28041. }
  28042. if (defaults.strokeWidth) {
  28043. _this.strokeWidth = defaults.strokeWidth;
  28044. }
  28045. }
  28046. // On IE and Edge, we can't animate the `stroke-dashoffset`
  28047. // reliably so we fall back to a non-spec animation.
  28048. /** @type {?} */
  28049. var animationClass = "mat-progress-spinner-indeterminate" + (_this._fallbackAnimation ? '-fallback' : '') + "-animation";
  28050. _elementRef.nativeElement.classList.add(animationClass);
  28051. return _this;
  28052. }
  28053. Object.defineProperty(MatProgressSpinner.prototype, "diameter", {
  28054. /** The diameter of the progress spinner (will set width and height of svg). */
  28055. get: /**
  28056. * The diameter of the progress spinner (will set width and height of svg).
  28057. * @return {?}
  28058. */
  28059. function () { return this._diameter; },
  28060. set: /**
  28061. * @param {?} size
  28062. * @return {?}
  28063. */
  28064. function (size) {
  28065. this._diameter = coercion.coerceNumberProperty(size);
  28066. if (!this._fallbackAnimation) {
  28067. /** @type {?} */
  28068. var trackedDiameters = MatProgressSpinner._diameters;
  28069. /** @type {?} */
  28070. var diametersForElement = trackedDiameters.get(this._styleRoot);
  28071. if (!diametersForElement || !diametersForElement.has(this._diameter)) {
  28072. this._attachStyleNode();
  28073. }
  28074. }
  28075. },
  28076. enumerable: true,
  28077. configurable: true
  28078. });
  28079. Object.defineProperty(MatProgressSpinner.prototype, "strokeWidth", {
  28080. /** Stroke width of the progress spinner. */
  28081. get: /**
  28082. * Stroke width of the progress spinner.
  28083. * @return {?}
  28084. */
  28085. function () {
  28086. return this._strokeWidth || this.diameter / 10;
  28087. },
  28088. set: /**
  28089. * @param {?} value
  28090. * @return {?}
  28091. */
  28092. function (value) {
  28093. this._strokeWidth = coercion.coerceNumberProperty(value);
  28094. },
  28095. enumerable: true,
  28096. configurable: true
  28097. });
  28098. Object.defineProperty(MatProgressSpinner.prototype, "value", {
  28099. /** Value of the progress circle. */
  28100. get: /**
  28101. * Value of the progress circle.
  28102. * @return {?}
  28103. */
  28104. function () {
  28105. return this.mode === 'determinate' ? this._value : 0;
  28106. },
  28107. set: /**
  28108. * @param {?} newValue
  28109. * @return {?}
  28110. */
  28111. function (newValue) {
  28112. this._value = Math.max(0, Math.min(100, coercion.coerceNumberProperty(newValue)));
  28113. },
  28114. enumerable: true,
  28115. configurable: true
  28116. });
  28117. Object.defineProperty(MatProgressSpinner.prototype, "_circleRadius", {
  28118. /** The radius of the spinner, adjusted for stroke width. */
  28119. get: /**
  28120. * The radius of the spinner, adjusted for stroke width.
  28121. * @return {?}
  28122. */
  28123. function () {
  28124. return (this.diameter - BASE_STROKE_WIDTH) / 2;
  28125. },
  28126. enumerable: true,
  28127. configurable: true
  28128. });
  28129. Object.defineProperty(MatProgressSpinner.prototype, "_viewBox", {
  28130. /** The view box of the spinner's svg element. */
  28131. get: /**
  28132. * The view box of the spinner's svg element.
  28133. * @return {?}
  28134. */
  28135. function () {
  28136. /** @type {?} */
  28137. var viewBox = this._circleRadius * 2 + this.strokeWidth;
  28138. return "0 0 " + viewBox + " " + viewBox;
  28139. },
  28140. enumerable: true,
  28141. configurable: true
  28142. });
  28143. Object.defineProperty(MatProgressSpinner.prototype, "_strokeCircumference", {
  28144. /** The stroke circumference of the svg circle. */
  28145. get: /**
  28146. * The stroke circumference of the svg circle.
  28147. * @return {?}
  28148. */
  28149. function () {
  28150. return 2 * Math.PI * this._circleRadius;
  28151. },
  28152. enumerable: true,
  28153. configurable: true
  28154. });
  28155. Object.defineProperty(MatProgressSpinner.prototype, "_strokeDashOffset", {
  28156. /** The dash offset of the svg circle. */
  28157. get: /**
  28158. * The dash offset of the svg circle.
  28159. * @return {?}
  28160. */
  28161. function () {
  28162. if (this.mode === 'determinate') {
  28163. return this._strokeCircumference * (100 - this._value) / 100;
  28164. }
  28165. // In fallback mode set the circle to 80% and rotate it with CSS.
  28166. if (this._fallbackAnimation && this.mode === 'indeterminate') {
  28167. return this._strokeCircumference * 0.2;
  28168. }
  28169. return null;
  28170. },
  28171. enumerable: true,
  28172. configurable: true
  28173. });
  28174. Object.defineProperty(MatProgressSpinner.prototype, "_circleStrokeWidth", {
  28175. /** Stroke width of the circle in percent. */
  28176. get: /**
  28177. * Stroke width of the circle in percent.
  28178. * @return {?}
  28179. */
  28180. function () {
  28181. return this.strokeWidth / this.diameter * 100;
  28182. },
  28183. enumerable: true,
  28184. configurable: true
  28185. });
  28186. /** Dynamically generates a style tag containing the correct animation for this diameter. */
  28187. /**
  28188. * Dynamically generates a style tag containing the correct animation for this diameter.
  28189. * @private
  28190. * @return {?}
  28191. */
  28192. MatProgressSpinner.prototype._attachStyleNode = /**
  28193. * Dynamically generates a style tag containing the correct animation for this diameter.
  28194. * @private
  28195. * @return {?}
  28196. */
  28197. function () {
  28198. /** @type {?} */
  28199. var styleTag = this._document.createElement('style');
  28200. /** @type {?} */
  28201. var styleRoot = this._styleRoot;
  28202. /** @type {?} */
  28203. var currentDiameter = this._diameter;
  28204. /** @type {?} */
  28205. var diameters = MatProgressSpinner._diameters;
  28206. /** @type {?} */
  28207. var diametersForElement = diameters.get(styleRoot);
  28208. styleTag.setAttribute('mat-spinner-animation', currentDiameter + '');
  28209. styleTag.textContent = this._getAnimationText();
  28210. styleRoot.appendChild(styleTag);
  28211. if (!diametersForElement) {
  28212. diametersForElement = new Set();
  28213. diameters.set(styleRoot, diametersForElement);
  28214. }
  28215. diametersForElement.add(currentDiameter);
  28216. };
  28217. /** Generates animation styles adjusted for the spinner's diameter. */
  28218. /**
  28219. * Generates animation styles adjusted for the spinner's diameter.
  28220. * @private
  28221. * @return {?}
  28222. */
  28223. MatProgressSpinner.prototype._getAnimationText = /**
  28224. * Generates animation styles adjusted for the spinner's diameter.
  28225. * @private
  28226. * @return {?}
  28227. */
  28228. function () {
  28229. return INDETERMINATE_ANIMATION_TEMPLATE
  28230. // Animation should begin at 5% and end at 80%
  28231. .replace(/START_VALUE/g, "" + 0.95 * this._strokeCircumference)
  28232. .replace(/END_VALUE/g, "" + 0.2 * this._strokeCircumference)
  28233. .replace(/DIAMETER/g, "" + this.diameter);
  28234. };
  28235. /**
  28236. * Tracks diameters of existing instances to de-dupe generated styles (default d = 100).
  28237. * We need to keep track of which elements the diameters were attached to, because for
  28238. * elements in the Shadow DOM the style tags are attached to the shadow root, rather
  28239. * than the document head.
  28240. */
  28241. MatProgressSpinner._diameters = new WeakMap();
  28242. MatProgressSpinner.decorators = [
  28243. { type: core.Component, args: [{selector: 'mat-progress-spinner',
  28244. exportAs: 'matProgressSpinner',
  28245. host: {
  28246. 'role': 'progressbar',
  28247. 'class': 'mat-progress-spinner',
  28248. '[class._mat-animation-noopable]': "_noopAnimations",
  28249. '[style.width.px]': 'diameter',
  28250. '[style.height.px]': 'diameter',
  28251. '[attr.aria-valuemin]': 'mode === "determinate" ? 0 : null',
  28252. '[attr.aria-valuemax]': 'mode === "determinate" ? 100 : null',
  28253. '[attr.aria-valuenow]': 'mode === "determinate" ? value : null',
  28254. '[attr.mode]': 'mode',
  28255. },
  28256. inputs: ['color'],
  28257. template: "<svg [style.width.px]=\"diameter\" [style.height.px]=\"diameter\" [attr.viewBox]=\"_viewBox\" preserveAspectRatio=\"xMidYMid meet\" focusable=\"false\" [ngSwitch]=\"mode === 'indeterminate'\"><circle *ngSwitchCase=\"true\" cx=\"50%\" cy=\"50%\" [attr.r]=\"_circleRadius\" [style.animation-name]=\"'mat-progress-spinner-stroke-rotate-' + diameter\" [style.stroke-dashoffset.px]=\"_strokeDashOffset\" [style.stroke-dasharray.px]=\"_strokeCircumference\" [style.stroke-width.%]=\"_circleStrokeWidth\"></circle><circle *ngSwitchCase=\"false\" cx=\"50%\" cy=\"50%\" [attr.r]=\"_circleRadius\" [style.stroke-dashoffset.px]=\"_strokeDashOffset\" [style.stroke-dasharray.px]=\"_strokeCircumference\" [style.stroke-width.%]=\"_circleStrokeWidth\"></circle></svg>",
  28258. styles: [".mat-progress-spinner{display:block;position:relative}.mat-progress-spinner svg{position:absolute;transform:rotate(-90deg);top:0;left:0;transform-origin:center;overflow:visible}.mat-progress-spinner circle{fill:transparent;transform-origin:center;transition:stroke-dashoffset 225ms linear}._mat-animation-noopable.mat-progress-spinner circle{transition:none;animation:none}.mat-progress-spinner.mat-progress-spinner-indeterminate-animation[mode=indeterminate]{animation:mat-progress-spinner-linear-rotate 2s linear infinite}._mat-animation-noopable.mat-progress-spinner.mat-progress-spinner-indeterminate-animation[mode=indeterminate]{transition:none;animation:none}.mat-progress-spinner.mat-progress-spinner-indeterminate-animation[mode=indeterminate] circle{transition-property:stroke;animation-duration:4s;animation-timing-function:cubic-bezier(.35,0,.25,1);animation-iteration-count:infinite}._mat-animation-noopable.mat-progress-spinner.mat-progress-spinner-indeterminate-animation[mode=indeterminate] circle{transition:none;animation:none}.mat-progress-spinner.mat-progress-spinner-indeterminate-fallback-animation[mode=indeterminate]{animation:mat-progress-spinner-stroke-rotate-fallback 10s cubic-bezier(.87,.03,.33,1) infinite}._mat-animation-noopable.mat-progress-spinner.mat-progress-spinner-indeterminate-fallback-animation[mode=indeterminate]{transition:none;animation:none}.mat-progress-spinner.mat-progress-spinner-indeterminate-fallback-animation[mode=indeterminate] circle{transition-property:stroke}._mat-animation-noopable.mat-progress-spinner.mat-progress-spinner-indeterminate-fallback-animation[mode=indeterminate] circle{transition:none;animation:none}@keyframes mat-progress-spinner-linear-rotate{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}@keyframes mat-progress-spinner-stroke-rotate-100{0%{stroke-dashoffset:268.60617px;transform:rotate(0)}12.5%{stroke-dashoffset:56.54867px;transform:rotate(0)}12.5001%{stroke-dashoffset:56.54867px;transform:rotateX(180deg) rotate(72.5deg)}25%{stroke-dashoffset:268.60617px;transform:rotateX(180deg) rotate(72.5deg)}25.0001%{stroke-dashoffset:268.60617px;transform:rotate(270deg)}37.5%{stroke-dashoffset:56.54867px;transform:rotate(270deg)}37.5001%{stroke-dashoffset:56.54867px;transform:rotateX(180deg) rotate(161.5deg)}50%{stroke-dashoffset:268.60617px;transform:rotateX(180deg) rotate(161.5deg)}50.0001%{stroke-dashoffset:268.60617px;transform:rotate(180deg)}62.5%{stroke-dashoffset:56.54867px;transform:rotate(180deg)}62.5001%{stroke-dashoffset:56.54867px;transform:rotateX(180deg) rotate(251.5deg)}75%{stroke-dashoffset:268.60617px;transform:rotateX(180deg) rotate(251.5deg)}75.0001%{stroke-dashoffset:268.60617px;transform:rotate(90deg)}87.5%{stroke-dashoffset:56.54867px;transform:rotate(90deg)}87.5001%{stroke-dashoffset:56.54867px;transform:rotateX(180deg) rotate(341.5deg)}100%{stroke-dashoffset:268.60617px;transform:rotateX(180deg) rotate(341.5deg)}}@keyframes mat-progress-spinner-stroke-rotate-fallback{0%{transform:rotate(0)}25%{transform:rotate(1170deg)}50%{transform:rotate(2340deg)}75%{transform:rotate(3510deg)}100%{transform:rotate(4680deg)}}"],
  28259. changeDetection: core.ChangeDetectionStrategy.OnPush,
  28260. encapsulation: core.ViewEncapsulation.None,
  28261. },] },
  28262. ];
  28263. /** @nocollapse */
  28264. MatProgressSpinner.ctorParameters = function () { return [
  28265. { type: core.ElementRef },
  28266. { type: platform.Platform },
  28267. { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [common.DOCUMENT,] }] },
  28268. { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] },
  28269. { type: undefined, decorators: [{ type: core.Inject, args: [MAT_PROGRESS_SPINNER_DEFAULT_OPTIONS,] }] }
  28270. ]; };
  28271. MatProgressSpinner.propDecorators = {
  28272. diameter: [{ type: core.Input }],
  28273. strokeWidth: [{ type: core.Input }],
  28274. mode: [{ type: core.Input }],
  28275. value: [{ type: core.Input }]
  28276. };
  28277. return MatProgressSpinner;
  28278. }(_MatProgressSpinnerMixinBase));
  28279. /**
  28280. * `<mat-spinner>` component.
  28281. *
  28282. * This is a component definition to be used as a convenience reference to create an
  28283. * indeterminate `<mat-progress-spinner>` instance.
  28284. */
  28285. var MatSpinner = /** @class */ (function (_super) {
  28286. __extends(MatSpinner, _super);
  28287. function MatSpinner(elementRef, platform$$1, document, animationMode, defaults) {
  28288. var _this = _super.call(this, elementRef, platform$$1, document, animationMode, defaults) || this;
  28289. _this.mode = 'indeterminate';
  28290. return _this;
  28291. }
  28292. MatSpinner.decorators = [
  28293. { type: core.Component, args: [{selector: 'mat-spinner',
  28294. host: {
  28295. 'role': 'progressbar',
  28296. 'mode': 'indeterminate',
  28297. 'class': 'mat-spinner mat-progress-spinner',
  28298. '[class._mat-animation-noopable]': "_noopAnimations",
  28299. '[style.width.px]': 'diameter',
  28300. '[style.height.px]': 'diameter',
  28301. },
  28302. inputs: ['color'],
  28303. template: "<svg [style.width.px]=\"diameter\" [style.height.px]=\"diameter\" [attr.viewBox]=\"_viewBox\" preserveAspectRatio=\"xMidYMid meet\" focusable=\"false\" [ngSwitch]=\"mode === 'indeterminate'\"><circle *ngSwitchCase=\"true\" cx=\"50%\" cy=\"50%\" [attr.r]=\"_circleRadius\" [style.animation-name]=\"'mat-progress-spinner-stroke-rotate-' + diameter\" [style.stroke-dashoffset.px]=\"_strokeDashOffset\" [style.stroke-dasharray.px]=\"_strokeCircumference\" [style.stroke-width.%]=\"_circleStrokeWidth\"></circle><circle *ngSwitchCase=\"false\" cx=\"50%\" cy=\"50%\" [attr.r]=\"_circleRadius\" [style.stroke-dashoffset.px]=\"_strokeDashOffset\" [style.stroke-dasharray.px]=\"_strokeCircumference\" [style.stroke-width.%]=\"_circleStrokeWidth\"></circle></svg>",
  28304. styles: [".mat-progress-spinner{display:block;position:relative}.mat-progress-spinner svg{position:absolute;transform:rotate(-90deg);top:0;left:0;transform-origin:center;overflow:visible}.mat-progress-spinner circle{fill:transparent;transform-origin:center;transition:stroke-dashoffset 225ms linear}._mat-animation-noopable.mat-progress-spinner circle{transition:none;animation:none}.mat-progress-spinner.mat-progress-spinner-indeterminate-animation[mode=indeterminate]{animation:mat-progress-spinner-linear-rotate 2s linear infinite}._mat-animation-noopable.mat-progress-spinner.mat-progress-spinner-indeterminate-animation[mode=indeterminate]{transition:none;animation:none}.mat-progress-spinner.mat-progress-spinner-indeterminate-animation[mode=indeterminate] circle{transition-property:stroke;animation-duration:4s;animation-timing-function:cubic-bezier(.35,0,.25,1);animation-iteration-count:infinite}._mat-animation-noopable.mat-progress-spinner.mat-progress-spinner-indeterminate-animation[mode=indeterminate] circle{transition:none;animation:none}.mat-progress-spinner.mat-progress-spinner-indeterminate-fallback-animation[mode=indeterminate]{animation:mat-progress-spinner-stroke-rotate-fallback 10s cubic-bezier(.87,.03,.33,1) infinite}._mat-animation-noopable.mat-progress-spinner.mat-progress-spinner-indeterminate-fallback-animation[mode=indeterminate]{transition:none;animation:none}.mat-progress-spinner.mat-progress-spinner-indeterminate-fallback-animation[mode=indeterminate] circle{transition-property:stroke}._mat-animation-noopable.mat-progress-spinner.mat-progress-spinner-indeterminate-fallback-animation[mode=indeterminate] circle{transition:none;animation:none}@keyframes mat-progress-spinner-linear-rotate{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}@keyframes mat-progress-spinner-stroke-rotate-100{0%{stroke-dashoffset:268.60617px;transform:rotate(0)}12.5%{stroke-dashoffset:56.54867px;transform:rotate(0)}12.5001%{stroke-dashoffset:56.54867px;transform:rotateX(180deg) rotate(72.5deg)}25%{stroke-dashoffset:268.60617px;transform:rotateX(180deg) rotate(72.5deg)}25.0001%{stroke-dashoffset:268.60617px;transform:rotate(270deg)}37.5%{stroke-dashoffset:56.54867px;transform:rotate(270deg)}37.5001%{stroke-dashoffset:56.54867px;transform:rotateX(180deg) rotate(161.5deg)}50%{stroke-dashoffset:268.60617px;transform:rotateX(180deg) rotate(161.5deg)}50.0001%{stroke-dashoffset:268.60617px;transform:rotate(180deg)}62.5%{stroke-dashoffset:56.54867px;transform:rotate(180deg)}62.5001%{stroke-dashoffset:56.54867px;transform:rotateX(180deg) rotate(251.5deg)}75%{stroke-dashoffset:268.60617px;transform:rotateX(180deg) rotate(251.5deg)}75.0001%{stroke-dashoffset:268.60617px;transform:rotate(90deg)}87.5%{stroke-dashoffset:56.54867px;transform:rotate(90deg)}87.5001%{stroke-dashoffset:56.54867px;transform:rotateX(180deg) rotate(341.5deg)}100%{stroke-dashoffset:268.60617px;transform:rotateX(180deg) rotate(341.5deg)}}@keyframes mat-progress-spinner-stroke-rotate-fallback{0%{transform:rotate(0)}25%{transform:rotate(1170deg)}50%{transform:rotate(2340deg)}75%{transform:rotate(3510deg)}100%{transform:rotate(4680deg)}}"],
  28305. changeDetection: core.ChangeDetectionStrategy.OnPush,
  28306. encapsulation: core.ViewEncapsulation.None,
  28307. },] },
  28308. ];
  28309. /** @nocollapse */
  28310. MatSpinner.ctorParameters = function () { return [
  28311. { type: core.ElementRef },
  28312. { type: platform.Platform },
  28313. { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [common.DOCUMENT,] }] },
  28314. { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] },
  28315. { type: undefined, decorators: [{ type: core.Inject, args: [MAT_PROGRESS_SPINNER_DEFAULT_OPTIONS,] }] }
  28316. ]; };
  28317. return MatSpinner;
  28318. }(MatProgressSpinner));
  28319. /**
  28320. * Gets the shadow root of an element, if supported and the element is inside the Shadow DOM.
  28321. * @param {?} element
  28322. * @param {?} _document
  28323. * @return {?}
  28324. */
  28325. function _getShadowRoot(element, _document) {
  28326. // TODO(crisbeto): see whether we should move this into the CDK
  28327. // feature detection utilities once #15616 gets merged in.
  28328. if (typeof window !== 'undefined') {
  28329. /** @type {?} */
  28330. var head = _document.head;
  28331. // Check whether the browser supports Shadow DOM.
  28332. if (head && (((/** @type {?} */ (head))).createShadowRoot || head.attachShadow)) {
  28333. /** @type {?} */
  28334. var rootNode = element.getRootNode ? element.getRootNode() : null;
  28335. // We need to take the `ShadowRoot` off of `window`, because the built-in types are
  28336. // incorrect. See https://github.com/Microsoft/TypeScript/issues/27929.
  28337. if (rootNode instanceof ((/** @type {?} */ (window))).ShadowRoot) {
  28338. return rootNode;
  28339. }
  28340. }
  28341. }
  28342. return null;
  28343. }
  28344. /**
  28345. * @fileoverview added by tsickle
  28346. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  28347. */
  28348. var MatProgressSpinnerModule = /** @class */ (function () {
  28349. function MatProgressSpinnerModule() {
  28350. }
  28351. MatProgressSpinnerModule.decorators = [
  28352. { type: core.NgModule, args: [{
  28353. imports: [MatCommonModule, common.CommonModule],
  28354. exports: [
  28355. MatProgressSpinner,
  28356. MatSpinner,
  28357. MatCommonModule
  28358. ],
  28359. declarations: [
  28360. MatProgressSpinner,
  28361. MatSpinner
  28362. ],
  28363. },] },
  28364. ];
  28365. return MatProgressSpinnerModule;
  28366. }());
  28367. /**
  28368. * @fileoverview added by tsickle
  28369. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  28370. */
  28371. /** @type {?} */
  28372. var MAT_RADIO_DEFAULT_OPTIONS = new core.InjectionToken('mat-radio-default-options', {
  28373. providedIn: 'root',
  28374. factory: MAT_RADIO_DEFAULT_OPTIONS_FACTORY
  28375. });
  28376. /**
  28377. * @return {?}
  28378. */
  28379. function MAT_RADIO_DEFAULT_OPTIONS_FACTORY() {
  28380. return {
  28381. color: 'accent'
  28382. };
  28383. }
  28384. // Increasing integer for generating unique ids for radio components.
  28385. /** @type {?} */
  28386. var nextUniqueId$7 = 0;
  28387. /**
  28388. * Provider Expression that allows mat-radio-group to register as a ControlValueAccessor. This
  28389. * allows it to support [(ngModel)] and ngControl.
  28390. * \@docs-private
  28391. * @type {?}
  28392. */
  28393. var MAT_RADIO_GROUP_CONTROL_VALUE_ACCESSOR = {
  28394. provide: forms.NG_VALUE_ACCESSOR,
  28395. useExisting: core.forwardRef((/**
  28396. * @return {?}
  28397. */
  28398. function () { return MatRadioGroup; })),
  28399. multi: true
  28400. };
  28401. /**
  28402. * Change event object emitted by MatRadio and MatRadioGroup.
  28403. */
  28404. var /**
  28405. * Change event object emitted by MatRadio and MatRadioGroup.
  28406. */
  28407. MatRadioChange = /** @class */ (function () {
  28408. function MatRadioChange(source, value) {
  28409. this.source = source;
  28410. this.value = value;
  28411. }
  28412. return MatRadioChange;
  28413. }());
  28414. /**
  28415. * A group of radio buttons. May contain one or more `<mat-radio-button>` elements.
  28416. */
  28417. var MatRadioGroup = /** @class */ (function () {
  28418. function MatRadioGroup(_changeDetector) {
  28419. this._changeDetector = _changeDetector;
  28420. /**
  28421. * Selected value for the radio group.
  28422. */
  28423. this._value = null;
  28424. /**
  28425. * The HTML name attribute applied to radio buttons in this group.
  28426. */
  28427. this._name = "mat-radio-group-" + nextUniqueId$7++;
  28428. /**
  28429. * The currently selected radio button. Should match value.
  28430. */
  28431. this._selected = null;
  28432. /**
  28433. * Whether the `value` has been set to its initial value.
  28434. */
  28435. this._isInitialized = false;
  28436. /**
  28437. * Whether the labels should appear after or before the radio-buttons. Defaults to 'after'
  28438. */
  28439. this._labelPosition = 'after';
  28440. /**
  28441. * Whether the radio group is disabled.
  28442. */
  28443. this._disabled = false;
  28444. /**
  28445. * Whether the radio group is required.
  28446. */
  28447. this._required = false;
  28448. /**
  28449. * The method to be called in order to update ngModel
  28450. */
  28451. this._controlValueAccessorChangeFn = (/**
  28452. * @return {?}
  28453. */
  28454. function () { });
  28455. /**
  28456. * onTouch function registered via registerOnTouch (ControlValueAccessor).
  28457. * \@docs-private
  28458. */
  28459. this.onTouched = (/**
  28460. * @return {?}
  28461. */
  28462. function () { });
  28463. /**
  28464. * Event emitted when the group value changes.
  28465. * Change events are only emitted when the value changes due to user interaction with
  28466. * a radio button (the same behavior as `<input type-"radio">`).
  28467. */
  28468. this.change = new core.EventEmitter();
  28469. }
  28470. Object.defineProperty(MatRadioGroup.prototype, "name", {
  28471. /** Name of the radio button group. All radio buttons inside this group will use this name. */
  28472. get: /**
  28473. * Name of the radio button group. All radio buttons inside this group will use this name.
  28474. * @return {?}
  28475. */
  28476. function () { return this._name; },
  28477. set: /**
  28478. * @param {?} value
  28479. * @return {?}
  28480. */
  28481. function (value) {
  28482. this._name = value;
  28483. this._updateRadioButtonNames();
  28484. },
  28485. enumerable: true,
  28486. configurable: true
  28487. });
  28488. Object.defineProperty(MatRadioGroup.prototype, "labelPosition", {
  28489. /** Whether the labels should appear after or before the radio-buttons. Defaults to 'after' */
  28490. get: /**
  28491. * Whether the labels should appear after or before the radio-buttons. Defaults to 'after'
  28492. * @return {?}
  28493. */
  28494. function () {
  28495. return this._labelPosition;
  28496. },
  28497. set: /**
  28498. * @param {?} v
  28499. * @return {?}
  28500. */
  28501. function (v) {
  28502. this._labelPosition = v === 'before' ? 'before' : 'after';
  28503. this._markRadiosForCheck();
  28504. },
  28505. enumerable: true,
  28506. configurable: true
  28507. });
  28508. Object.defineProperty(MatRadioGroup.prototype, "value", {
  28509. /**
  28510. * Value for the radio-group. Should equal the value of the selected radio button if there is
  28511. * a corresponding radio button with a matching value. If there is not such a corresponding
  28512. * radio button, this value persists to be applied in case a new radio button is added with a
  28513. * matching value.
  28514. */
  28515. get: /**
  28516. * Value for the radio-group. Should equal the value of the selected radio button if there is
  28517. * a corresponding radio button with a matching value. If there is not such a corresponding
  28518. * radio button, this value persists to be applied in case a new radio button is added with a
  28519. * matching value.
  28520. * @return {?}
  28521. */
  28522. function () { return this._value; },
  28523. set: /**
  28524. * @param {?} newValue
  28525. * @return {?}
  28526. */
  28527. function (newValue) {
  28528. if (this._value !== newValue) {
  28529. // Set this before proceeding to ensure no circular loop occurs with selection.
  28530. this._value = newValue;
  28531. this._updateSelectedRadioFromValue();
  28532. this._checkSelectedRadioButton();
  28533. }
  28534. },
  28535. enumerable: true,
  28536. configurable: true
  28537. });
  28538. /**
  28539. * @return {?}
  28540. */
  28541. MatRadioGroup.prototype._checkSelectedRadioButton = /**
  28542. * @return {?}
  28543. */
  28544. function () {
  28545. if (this._selected && !this._selected.checked) {
  28546. this._selected.checked = true;
  28547. }
  28548. };
  28549. Object.defineProperty(MatRadioGroup.prototype, "selected", {
  28550. /**
  28551. * The currently selected radio button. If set to a new radio button, the radio group value
  28552. * will be updated to match the new selected button.
  28553. */
  28554. get: /**
  28555. * The currently selected radio button. If set to a new radio button, the radio group value
  28556. * will be updated to match the new selected button.
  28557. * @return {?}
  28558. */
  28559. function () { return this._selected; },
  28560. set: /**
  28561. * @param {?} selected
  28562. * @return {?}
  28563. */
  28564. function (selected) {
  28565. this._selected = selected;
  28566. this.value = selected ? selected.value : null;
  28567. this._checkSelectedRadioButton();
  28568. },
  28569. enumerable: true,
  28570. configurable: true
  28571. });
  28572. Object.defineProperty(MatRadioGroup.prototype, "disabled", {
  28573. /** Whether the radio group is disabled */
  28574. get: /**
  28575. * Whether the radio group is disabled
  28576. * @return {?}
  28577. */
  28578. function () { return this._disabled; },
  28579. set: /**
  28580. * @param {?} value
  28581. * @return {?}
  28582. */
  28583. function (value) {
  28584. this._disabled = coercion.coerceBooleanProperty(value);
  28585. this._markRadiosForCheck();
  28586. },
  28587. enumerable: true,
  28588. configurable: true
  28589. });
  28590. Object.defineProperty(MatRadioGroup.prototype, "required", {
  28591. /** Whether the radio group is required */
  28592. get: /**
  28593. * Whether the radio group is required
  28594. * @return {?}
  28595. */
  28596. function () { return this._required; },
  28597. set: /**
  28598. * @param {?} value
  28599. * @return {?}
  28600. */
  28601. function (value) {
  28602. this._required = coercion.coerceBooleanProperty(value);
  28603. this._markRadiosForCheck();
  28604. },
  28605. enumerable: true,
  28606. configurable: true
  28607. });
  28608. /**
  28609. * Initialize properties once content children are available.
  28610. * This allows us to propagate relevant attributes to associated buttons.
  28611. */
  28612. /**
  28613. * Initialize properties once content children are available.
  28614. * This allows us to propagate relevant attributes to associated buttons.
  28615. * @return {?}
  28616. */
  28617. MatRadioGroup.prototype.ngAfterContentInit = /**
  28618. * Initialize properties once content children are available.
  28619. * This allows us to propagate relevant attributes to associated buttons.
  28620. * @return {?}
  28621. */
  28622. function () {
  28623. // Mark this component as initialized in AfterContentInit because the initial value can
  28624. // possibly be set by NgModel on MatRadioGroup, and it is possible that the OnInit of the
  28625. // NgModel occurs *after* the OnInit of the MatRadioGroup.
  28626. this._isInitialized = true;
  28627. };
  28628. /**
  28629. * Mark this group as being "touched" (for ngModel). Meant to be called by the contained
  28630. * radio buttons upon their blur.
  28631. */
  28632. /**
  28633. * Mark this group as being "touched" (for ngModel). Meant to be called by the contained
  28634. * radio buttons upon their blur.
  28635. * @return {?}
  28636. */
  28637. MatRadioGroup.prototype._touch = /**
  28638. * Mark this group as being "touched" (for ngModel). Meant to be called by the contained
  28639. * radio buttons upon their blur.
  28640. * @return {?}
  28641. */
  28642. function () {
  28643. if (this.onTouched) {
  28644. this.onTouched();
  28645. }
  28646. };
  28647. /**
  28648. * @private
  28649. * @return {?}
  28650. */
  28651. MatRadioGroup.prototype._updateRadioButtonNames = /**
  28652. * @private
  28653. * @return {?}
  28654. */
  28655. function () {
  28656. var _this = this;
  28657. if (this._radios) {
  28658. this._radios.forEach((/**
  28659. * @param {?} radio
  28660. * @return {?}
  28661. */
  28662. function (radio) {
  28663. radio.name = _this.name;
  28664. radio._markForCheck();
  28665. }));
  28666. }
  28667. };
  28668. /** Updates the `selected` radio button from the internal _value state. */
  28669. /**
  28670. * Updates the `selected` radio button from the internal _value state.
  28671. * @private
  28672. * @return {?}
  28673. */
  28674. MatRadioGroup.prototype._updateSelectedRadioFromValue = /**
  28675. * Updates the `selected` radio button from the internal _value state.
  28676. * @private
  28677. * @return {?}
  28678. */
  28679. function () {
  28680. var _this = this;
  28681. // If the value already matches the selected radio, do nothing.
  28682. /** @type {?} */
  28683. var isAlreadySelected = this._selected !== null && this._selected.value === this._value;
  28684. if (this._radios && !isAlreadySelected) {
  28685. this._selected = null;
  28686. this._radios.forEach((/**
  28687. * @param {?} radio
  28688. * @return {?}
  28689. */
  28690. function (radio) {
  28691. radio.checked = _this.value === radio.value;
  28692. if (radio.checked) {
  28693. _this._selected = radio;
  28694. }
  28695. }));
  28696. }
  28697. };
  28698. /** Dispatch change event with current selection and group value. */
  28699. /**
  28700. * Dispatch change event with current selection and group value.
  28701. * @return {?}
  28702. */
  28703. MatRadioGroup.prototype._emitChangeEvent = /**
  28704. * Dispatch change event with current selection and group value.
  28705. * @return {?}
  28706. */
  28707. function () {
  28708. if (this._isInitialized) {
  28709. this.change.emit(new MatRadioChange((/** @type {?} */ (this._selected)), this._value));
  28710. }
  28711. };
  28712. /**
  28713. * @return {?}
  28714. */
  28715. MatRadioGroup.prototype._markRadiosForCheck = /**
  28716. * @return {?}
  28717. */
  28718. function () {
  28719. if (this._radios) {
  28720. this._radios.forEach((/**
  28721. * @param {?} radio
  28722. * @return {?}
  28723. */
  28724. function (radio) { return radio._markForCheck(); }));
  28725. }
  28726. };
  28727. /**
  28728. * Sets the model value. Implemented as part of ControlValueAccessor.
  28729. * @param value
  28730. */
  28731. /**
  28732. * Sets the model value. Implemented as part of ControlValueAccessor.
  28733. * @param {?} value
  28734. * @return {?}
  28735. */
  28736. MatRadioGroup.prototype.writeValue = /**
  28737. * Sets the model value. Implemented as part of ControlValueAccessor.
  28738. * @param {?} value
  28739. * @return {?}
  28740. */
  28741. function (value) {
  28742. this.value = value;
  28743. this._changeDetector.markForCheck();
  28744. };
  28745. /**
  28746. * Registers a callback to be triggered when the model value changes.
  28747. * Implemented as part of ControlValueAccessor.
  28748. * @param fn Callback to be registered.
  28749. */
  28750. /**
  28751. * Registers a callback to be triggered when the model value changes.
  28752. * Implemented as part of ControlValueAccessor.
  28753. * @param {?} fn Callback to be registered.
  28754. * @return {?}
  28755. */
  28756. MatRadioGroup.prototype.registerOnChange = /**
  28757. * Registers a callback to be triggered when the model value changes.
  28758. * Implemented as part of ControlValueAccessor.
  28759. * @param {?} fn Callback to be registered.
  28760. * @return {?}
  28761. */
  28762. function (fn) {
  28763. this._controlValueAccessorChangeFn = fn;
  28764. };
  28765. /**
  28766. * Registers a callback to be triggered when the control is touched.
  28767. * Implemented as part of ControlValueAccessor.
  28768. * @param fn Callback to be registered.
  28769. */
  28770. /**
  28771. * Registers a callback to be triggered when the control is touched.
  28772. * Implemented as part of ControlValueAccessor.
  28773. * @param {?} fn Callback to be registered.
  28774. * @return {?}
  28775. */
  28776. MatRadioGroup.prototype.registerOnTouched = /**
  28777. * Registers a callback to be triggered when the control is touched.
  28778. * Implemented as part of ControlValueAccessor.
  28779. * @param {?} fn Callback to be registered.
  28780. * @return {?}
  28781. */
  28782. function (fn) {
  28783. this.onTouched = fn;
  28784. };
  28785. /**
  28786. * Sets the disabled state of the control. Implemented as a part of ControlValueAccessor.
  28787. * @param isDisabled Whether the control should be disabled.
  28788. */
  28789. /**
  28790. * Sets the disabled state of the control. Implemented as a part of ControlValueAccessor.
  28791. * @param {?} isDisabled Whether the control should be disabled.
  28792. * @return {?}
  28793. */
  28794. MatRadioGroup.prototype.setDisabledState = /**
  28795. * Sets the disabled state of the control. Implemented as a part of ControlValueAccessor.
  28796. * @param {?} isDisabled Whether the control should be disabled.
  28797. * @return {?}
  28798. */
  28799. function (isDisabled) {
  28800. this.disabled = isDisabled;
  28801. this._changeDetector.markForCheck();
  28802. };
  28803. MatRadioGroup.decorators = [
  28804. { type: core.Directive, args: [{
  28805. selector: 'mat-radio-group',
  28806. exportAs: 'matRadioGroup',
  28807. providers: [MAT_RADIO_GROUP_CONTROL_VALUE_ACCESSOR],
  28808. host: {
  28809. 'role': 'radiogroup',
  28810. 'class': 'mat-radio-group',
  28811. },
  28812. },] },
  28813. ];
  28814. /** @nocollapse */
  28815. MatRadioGroup.ctorParameters = function () { return [
  28816. { type: core.ChangeDetectorRef }
  28817. ]; };
  28818. MatRadioGroup.propDecorators = {
  28819. change: [{ type: core.Output }],
  28820. _radios: [{ type: core.ContentChildren, args: [core.forwardRef((/**
  28821. * @return {?}
  28822. */
  28823. function () { return MatRadioButton; })), { descendants: true },] }],
  28824. color: [{ type: core.Input }],
  28825. name: [{ type: core.Input }],
  28826. labelPosition: [{ type: core.Input }],
  28827. value: [{ type: core.Input }],
  28828. selected: [{ type: core.Input }],
  28829. disabled: [{ type: core.Input }],
  28830. required: [{ type: core.Input }]
  28831. };
  28832. return MatRadioGroup;
  28833. }());
  28834. // Boilerplate for applying mixins to MatRadioButton.
  28835. /**
  28836. * \@docs-private
  28837. */
  28838. var
  28839. // Boilerplate for applying mixins to MatRadioButton.
  28840. /**
  28841. * \@docs-private
  28842. */
  28843. MatRadioButtonBase = /** @class */ (function () {
  28844. function MatRadioButtonBase(_elementRef) {
  28845. this._elementRef = _elementRef;
  28846. }
  28847. return MatRadioButtonBase;
  28848. }());
  28849. // As per Material design specifications the selection control radio should use the accent color
  28850. // palette by default. https://material.io/guidelines/components/selection-controls.html
  28851. /** @type {?} */
  28852. var _MatRadioButtonMixinBase = mixinDisableRipple(mixinTabIndex(MatRadioButtonBase));
  28853. /**
  28854. * A Material design radio-button. Typically placed inside of `<mat-radio-group>` elements.
  28855. */
  28856. var MatRadioButton = /** @class */ (function (_super) {
  28857. __extends(MatRadioButton, _super);
  28858. function MatRadioButton(radioGroup, elementRef, _changeDetector, _focusMonitor, _radioDispatcher, _animationMode, _providerOverride) {
  28859. var _this = _super.call(this, elementRef) || this;
  28860. _this._changeDetector = _changeDetector;
  28861. _this._focusMonitor = _focusMonitor;
  28862. _this._radioDispatcher = _radioDispatcher;
  28863. _this._animationMode = _animationMode;
  28864. _this._providerOverride = _providerOverride;
  28865. _this._uniqueId = "mat-radio-" + ++nextUniqueId$7;
  28866. /**
  28867. * The unique ID for the radio button.
  28868. */
  28869. _this.id = _this._uniqueId;
  28870. /**
  28871. * Event emitted when the checked state of this radio button changes.
  28872. * Change events are only emitted when the value changes due to user interaction with
  28873. * the radio button (the same behavior as `<input type-"radio">`).
  28874. */
  28875. _this.change = new core.EventEmitter();
  28876. /**
  28877. * Whether this radio is checked.
  28878. */
  28879. _this._checked = false;
  28880. /**
  28881. * Value assigned to this radio.
  28882. */
  28883. _this._value = null;
  28884. /**
  28885. * Unregister function for _radioDispatcher
  28886. */
  28887. _this._removeUniqueSelectionListener = (/**
  28888. * @return {?}
  28889. */
  28890. function () { });
  28891. // Assertions. Ideally these should be stripped out by the compiler.
  28892. // TODO(jelbourn): Assert that there's no name binding AND a parent radio group.
  28893. _this.radioGroup = radioGroup;
  28894. _this._removeUniqueSelectionListener =
  28895. _radioDispatcher.listen((/**
  28896. * @param {?} id
  28897. * @param {?} name
  28898. * @return {?}
  28899. */
  28900. function (id, name) {
  28901. if (id !== _this.id && name === _this.name) {
  28902. _this.checked = false;
  28903. }
  28904. }));
  28905. return _this;
  28906. }
  28907. Object.defineProperty(MatRadioButton.prototype, "checked", {
  28908. /** Whether this radio button is checked. */
  28909. get: /**
  28910. * Whether this radio button is checked.
  28911. * @return {?}
  28912. */
  28913. function () { return this._checked; },
  28914. set: /**
  28915. * @param {?} value
  28916. * @return {?}
  28917. */
  28918. function (value) {
  28919. /** @type {?} */
  28920. var newCheckedState = coercion.coerceBooleanProperty(value);
  28921. if (this._checked !== newCheckedState) {
  28922. this._checked = newCheckedState;
  28923. if (newCheckedState && this.radioGroup && this.radioGroup.value !== this.value) {
  28924. this.radioGroup.selected = this;
  28925. }
  28926. else if (!newCheckedState && this.radioGroup && this.radioGroup.value === this.value) {
  28927. // When unchecking the selected radio button, update the selected radio
  28928. // property on the group.
  28929. this.radioGroup.selected = null;
  28930. }
  28931. if (newCheckedState) {
  28932. // Notify all radio buttons with the same name to un-check.
  28933. this._radioDispatcher.notify(this.id, this.name);
  28934. }
  28935. this._changeDetector.markForCheck();
  28936. }
  28937. },
  28938. enumerable: true,
  28939. configurable: true
  28940. });
  28941. Object.defineProperty(MatRadioButton.prototype, "value", {
  28942. /** The value of this radio button. */
  28943. get: /**
  28944. * The value of this radio button.
  28945. * @return {?}
  28946. */
  28947. function () { return this._value; },
  28948. set: /**
  28949. * @param {?} value
  28950. * @return {?}
  28951. */
  28952. function (value) {
  28953. if (this._value !== value) {
  28954. this._value = value;
  28955. if (this.radioGroup !== null) {
  28956. if (!this.checked) {
  28957. // Update checked when the value changed to match the radio group's value
  28958. this.checked = this.radioGroup.value === value;
  28959. }
  28960. if (this.checked) {
  28961. this.radioGroup.selected = this;
  28962. }
  28963. }
  28964. }
  28965. },
  28966. enumerable: true,
  28967. configurable: true
  28968. });
  28969. Object.defineProperty(MatRadioButton.prototype, "labelPosition", {
  28970. /** Whether the label should appear after or before the radio button. Defaults to 'after' */
  28971. get: /**
  28972. * Whether the label should appear after or before the radio button. Defaults to 'after'
  28973. * @return {?}
  28974. */
  28975. function () {
  28976. return this._labelPosition || (this.radioGroup && this.radioGroup.labelPosition) || 'after';
  28977. },
  28978. set: /**
  28979. * @param {?} value
  28980. * @return {?}
  28981. */
  28982. function (value) {
  28983. this._labelPosition = value;
  28984. },
  28985. enumerable: true,
  28986. configurable: true
  28987. });
  28988. Object.defineProperty(MatRadioButton.prototype, "disabled", {
  28989. /** Whether the radio button is disabled. */
  28990. get: /**
  28991. * Whether the radio button is disabled.
  28992. * @return {?}
  28993. */
  28994. function () {
  28995. return this._disabled || (this.radioGroup !== null && this.radioGroup.disabled);
  28996. },
  28997. set: /**
  28998. * @param {?} value
  28999. * @return {?}
  29000. */
  29001. function (value) {
  29002. /** @type {?} */
  29003. var newDisabledState = coercion.coerceBooleanProperty(value);
  29004. if (this._disabled !== newDisabledState) {
  29005. this._disabled = newDisabledState;
  29006. this._changeDetector.markForCheck();
  29007. }
  29008. },
  29009. enumerable: true,
  29010. configurable: true
  29011. });
  29012. Object.defineProperty(MatRadioButton.prototype, "required", {
  29013. /** Whether the radio button is required. */
  29014. get: /**
  29015. * Whether the radio button is required.
  29016. * @return {?}
  29017. */
  29018. function () {
  29019. return this._required || (this.radioGroup && this.radioGroup.required);
  29020. },
  29021. set: /**
  29022. * @param {?} value
  29023. * @return {?}
  29024. */
  29025. function (value) {
  29026. this._required = coercion.coerceBooleanProperty(value);
  29027. },
  29028. enumerable: true,
  29029. configurable: true
  29030. });
  29031. Object.defineProperty(MatRadioButton.prototype, "color", {
  29032. /** Theme color of the radio button. */
  29033. get: /**
  29034. * Theme color of the radio button.
  29035. * @return {?}
  29036. */
  29037. function () {
  29038. return this._color ||
  29039. (this.radioGroup && this.radioGroup.color) ||
  29040. this._providerOverride && this._providerOverride.color || 'accent';
  29041. },
  29042. set: /**
  29043. * @param {?} newValue
  29044. * @return {?}
  29045. */
  29046. function (newValue) { this._color = newValue; },
  29047. enumerable: true,
  29048. configurable: true
  29049. });
  29050. Object.defineProperty(MatRadioButton.prototype, "inputId", {
  29051. /** ID of the native input element inside `<mat-radio-button>` */
  29052. get: /**
  29053. * ID of the native input element inside `<mat-radio-button>`
  29054. * @return {?}
  29055. */
  29056. function () { return (this.id || this._uniqueId) + "-input"; },
  29057. enumerable: true,
  29058. configurable: true
  29059. });
  29060. /** Focuses the radio button. */
  29061. /**
  29062. * Focuses the radio button.
  29063. * @param {?=} options
  29064. * @return {?}
  29065. */
  29066. MatRadioButton.prototype.focus = /**
  29067. * Focuses the radio button.
  29068. * @param {?=} options
  29069. * @return {?}
  29070. */
  29071. function (options) {
  29072. this._focusMonitor.focusVia(this._inputElement, 'keyboard', options);
  29073. };
  29074. /**
  29075. * Marks the radio button as needing checking for change detection.
  29076. * This method is exposed because the parent radio group will directly
  29077. * update bound properties of the radio button.
  29078. */
  29079. /**
  29080. * Marks the radio button as needing checking for change detection.
  29081. * This method is exposed because the parent radio group will directly
  29082. * update bound properties of the radio button.
  29083. * @return {?}
  29084. */
  29085. MatRadioButton.prototype._markForCheck = /**
  29086. * Marks the radio button as needing checking for change detection.
  29087. * This method is exposed because the parent radio group will directly
  29088. * update bound properties of the radio button.
  29089. * @return {?}
  29090. */
  29091. function () {
  29092. // When group value changes, the button will not be notified. Use `markForCheck` to explicit
  29093. // update radio button's status
  29094. this._changeDetector.markForCheck();
  29095. };
  29096. /**
  29097. * @return {?}
  29098. */
  29099. MatRadioButton.prototype.ngOnInit = /**
  29100. * @return {?}
  29101. */
  29102. function () {
  29103. if (this.radioGroup) {
  29104. // If the radio is inside a radio group, determine if it should be checked
  29105. this.checked = this.radioGroup.value === this._value;
  29106. // Copy name from parent radio group
  29107. this.name = this.radioGroup.name;
  29108. }
  29109. };
  29110. /**
  29111. * @return {?}
  29112. */
  29113. MatRadioButton.prototype.ngAfterViewInit = /**
  29114. * @return {?}
  29115. */
  29116. function () {
  29117. var _this = this;
  29118. this._focusMonitor
  29119. .monitor(this._elementRef, true)
  29120. .subscribe((/**
  29121. * @param {?} focusOrigin
  29122. * @return {?}
  29123. */
  29124. function (focusOrigin) {
  29125. if (!focusOrigin && _this.radioGroup) {
  29126. _this.radioGroup._touch();
  29127. }
  29128. }));
  29129. };
  29130. /**
  29131. * @return {?}
  29132. */
  29133. MatRadioButton.prototype.ngOnDestroy = /**
  29134. * @return {?}
  29135. */
  29136. function () {
  29137. this._focusMonitor.stopMonitoring(this._elementRef);
  29138. this._removeUniqueSelectionListener();
  29139. };
  29140. /** Dispatch change event with current value. */
  29141. /**
  29142. * Dispatch change event with current value.
  29143. * @private
  29144. * @return {?}
  29145. */
  29146. MatRadioButton.prototype._emitChangeEvent = /**
  29147. * Dispatch change event with current value.
  29148. * @private
  29149. * @return {?}
  29150. */
  29151. function () {
  29152. this.change.emit(new MatRadioChange(this, this._value));
  29153. };
  29154. /**
  29155. * @return {?}
  29156. */
  29157. MatRadioButton.prototype._isRippleDisabled = /**
  29158. * @return {?}
  29159. */
  29160. function () {
  29161. return this.disableRipple || this.disabled;
  29162. };
  29163. /**
  29164. * @param {?} event
  29165. * @return {?}
  29166. */
  29167. MatRadioButton.prototype._onInputClick = /**
  29168. * @param {?} event
  29169. * @return {?}
  29170. */
  29171. function (event) {
  29172. // We have to stop propagation for click events on the visual hidden input element.
  29173. // By default, when a user clicks on a label element, a generated click event will be
  29174. // dispatched on the associated input element. Since we are using a label element as our
  29175. // root container, the click event on the `radio-button` will be executed twice.
  29176. // The real click event will bubble up, and the generated click event also tries to bubble up.
  29177. // This will lead to multiple click events.
  29178. // Preventing bubbling for the second event will solve that issue.
  29179. event.stopPropagation();
  29180. };
  29181. /**
  29182. * Triggered when the radio button received a click or the input recognized any change.
  29183. * Clicking on a label element, will trigger a change event on the associated input.
  29184. */
  29185. /**
  29186. * Triggered when the radio button received a click or the input recognized any change.
  29187. * Clicking on a label element, will trigger a change event on the associated input.
  29188. * @param {?} event
  29189. * @return {?}
  29190. */
  29191. MatRadioButton.prototype._onInputChange = /**
  29192. * Triggered when the radio button received a click or the input recognized any change.
  29193. * Clicking on a label element, will trigger a change event on the associated input.
  29194. * @param {?} event
  29195. * @return {?}
  29196. */
  29197. function (event) {
  29198. // We always have to stop propagation on the change event.
  29199. // Otherwise the change event, from the input element, will bubble up and
  29200. // emit its event object to the `change` output.
  29201. event.stopPropagation();
  29202. /** @type {?} */
  29203. var groupValueChanged = this.radioGroup && this.value !== this.radioGroup.value;
  29204. this.checked = true;
  29205. this._emitChangeEvent();
  29206. if (this.radioGroup) {
  29207. this.radioGroup._controlValueAccessorChangeFn(this.value);
  29208. if (groupValueChanged) {
  29209. this.radioGroup._emitChangeEvent();
  29210. }
  29211. }
  29212. };
  29213. MatRadioButton.decorators = [
  29214. { type: core.Component, args: [{selector: 'mat-radio-button',
  29215. template: "<label [attr.for]=\"inputId\" class=\"mat-radio-label\" #label><div class=\"mat-radio-container\"><div class=\"mat-radio-outer-circle\"></div><div class=\"mat-radio-inner-circle\"></div><div mat-ripple class=\"mat-radio-ripple\" [matRippleTrigger]=\"label\" [matRippleDisabled]=\"_isRippleDisabled()\" [matRippleCentered]=\"true\" [matRippleRadius]=\"20\" [matRippleAnimation]=\"{enterDuration: 150}\"><div class=\"mat-ripple-element mat-radio-persistent-ripple\"></div></div><input #input class=\"mat-radio-input cdk-visually-hidden\" type=\"radio\" [id]=\"inputId\" [checked]=\"checked\" [disabled]=\"disabled\" [tabIndex]=\"tabIndex\" [attr.name]=\"name\" [attr.value]=\"value\" [required]=\"required\" [attr.aria-label]=\"ariaLabel\" [attr.aria-labelledby]=\"ariaLabelledby\" [attr.aria-describedby]=\"ariaDescribedby\" (change)=\"_onInputChange($event)\" (click)=\"_onInputClick($event)\"></div><div class=\"mat-radio-label-content\" [class.mat-radio-label-before]=\"labelPosition == 'before'\"><span style=\"display:none\">&nbsp;</span><ng-content></ng-content></div></label>",
  29216. styles: [".mat-radio-button{display:inline-block;-webkit-tap-highlight-color:transparent;outline:0}.mat-radio-label{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer;display:inline-flex;align-items:center;white-space:nowrap;vertical-align:middle;width:100%}.mat-radio-container{box-sizing:border-box;display:inline-block;position:relative;width:20px;height:20px;flex-shrink:0}.mat-radio-outer-circle{box-sizing:border-box;height:20px;left:0;position:absolute;top:0;transition:border-color ease 280ms;width:20px;border-width:2px;border-style:solid;border-radius:50%}._mat-animation-noopable .mat-radio-outer-circle{transition:none}.mat-radio-inner-circle{border-radius:50%;box-sizing:border-box;height:20px;left:0;position:absolute;top:0;transition:transform ease 280ms,background-color ease 280ms;width:20px;transform:scale(.001)}._mat-animation-noopable .mat-radio-inner-circle{transition:none}.mat-radio-checked .mat-radio-inner-circle{transform:scale(.5)}@media (-ms-high-contrast:active){.mat-radio-checked .mat-radio-inner-circle{border:solid 10px}}.mat-radio-label-content{-webkit-user-select:auto;-moz-user-select:auto;-ms-user-select:auto;user-select:auto;display:inline-block;order:0;line-height:inherit;padding-left:8px;padding-right:0}[dir=rtl] .mat-radio-label-content{padding-right:8px;padding-left:0}.mat-radio-label-content.mat-radio-label-before{order:-1;padding-left:0;padding-right:8px}[dir=rtl] .mat-radio-label-content.mat-radio-label-before{padding-right:0;padding-left:8px}.mat-radio-disabled,.mat-radio-disabled .mat-radio-label{cursor:default}.mat-radio-button .mat-radio-ripple{position:absolute;left:calc(50% - 20px);top:calc(50% - 20px);height:40px;width:40px;z-index:1;pointer-events:none}.mat-radio-button .mat-radio-ripple .mat-ripple-element:not(.mat-radio-persistent-ripple){opacity:.16}.mat-radio-persistent-ripple{width:100%;height:100%;transform:none}.mat-radio-container:hover .mat-radio-persistent-ripple{opacity:.04}.mat-radio-button:not(.mat-radio-disabled).cdk-keyboard-focused .mat-radio-persistent-ripple,.mat-radio-button:not(.mat-radio-disabled).cdk-program-focused .mat-radio-persistent-ripple{opacity:.12}.mat-radio-disabled .mat-radio-container:hover .mat-radio-persistent-ripple,.mat-radio-persistent-ripple{opacity:0}@media (hover:none){.mat-radio-container:hover .mat-radio-persistent-ripple{display:none}}.mat-radio-input{bottom:0;left:50%}@media (-ms-high-contrast:active){.mat-radio-disabled{opacity:.5}}"],
  29217. inputs: ['disableRipple', 'tabIndex'],
  29218. encapsulation: core.ViewEncapsulation.None,
  29219. exportAs: 'matRadioButton',
  29220. host: {
  29221. 'class': 'mat-radio-button',
  29222. '[class.mat-radio-checked]': 'checked',
  29223. '[class.mat-radio-disabled]': 'disabled',
  29224. '[class._mat-animation-noopable]': '_animationMode === "NoopAnimations"',
  29225. '[class.mat-primary]': 'color === "primary"',
  29226. '[class.mat-accent]': 'color === "accent"',
  29227. '[class.mat-warn]': 'color === "warn"',
  29228. // Needs to be -1 so the `focus` event still fires.
  29229. '[attr.tabindex]': '-1',
  29230. '[attr.id]': 'id',
  29231. // Note: under normal conditions focus shouldn't land on this element, however it may be
  29232. // programmatically set, for example inside of a focus trap, in this case we want to forward
  29233. // the focus to the native element.
  29234. '(focus)': '_inputElement.nativeElement.focus()',
  29235. },
  29236. changeDetection: core.ChangeDetectionStrategy.OnPush,
  29237. },] },
  29238. ];
  29239. /** @nocollapse */
  29240. MatRadioButton.ctorParameters = function () { return [
  29241. { type: MatRadioGroup, decorators: [{ type: core.Optional }] },
  29242. { type: core.ElementRef },
  29243. { type: core.ChangeDetectorRef },
  29244. { type: a11y.FocusMonitor },
  29245. { type: collections.UniqueSelectionDispatcher },
  29246. { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] },
  29247. { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_RADIO_DEFAULT_OPTIONS,] }] }
  29248. ]; };
  29249. MatRadioButton.propDecorators = {
  29250. id: [{ type: core.Input }],
  29251. name: [{ type: core.Input }],
  29252. ariaLabel: [{ type: core.Input, args: ['aria-label',] }],
  29253. ariaLabelledby: [{ type: core.Input, args: ['aria-labelledby',] }],
  29254. ariaDescribedby: [{ type: core.Input, args: ['aria-describedby',] }],
  29255. checked: [{ type: core.Input }],
  29256. value: [{ type: core.Input }],
  29257. labelPosition: [{ type: core.Input }],
  29258. disabled: [{ type: core.Input }],
  29259. required: [{ type: core.Input }],
  29260. color: [{ type: core.Input }],
  29261. change: [{ type: core.Output }],
  29262. _inputElement: [{ type: core.ViewChild, args: ['input', { static: false },] }]
  29263. };
  29264. return MatRadioButton;
  29265. }(_MatRadioButtonMixinBase));
  29266. /**
  29267. * @fileoverview added by tsickle
  29268. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  29269. */
  29270. var MatRadioModule = /** @class */ (function () {
  29271. function MatRadioModule() {
  29272. }
  29273. MatRadioModule.decorators = [
  29274. { type: core.NgModule, args: [{
  29275. imports: [common.CommonModule, MatRippleModule, MatCommonModule],
  29276. exports: [MatRadioGroup, MatRadioButton, MatCommonModule],
  29277. declarations: [MatRadioGroup, MatRadioButton],
  29278. },] },
  29279. ];
  29280. return MatRadioModule;
  29281. }());
  29282. /**
  29283. * @fileoverview added by tsickle
  29284. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  29285. */
  29286. /**
  29287. * Animations used by the Material drawers.
  29288. * \@docs-private
  29289. * @type {?}
  29290. */
  29291. var matDrawerAnimations = {
  29292. /**
  29293. * Animation that slides a drawer in and out.
  29294. */
  29295. transformDrawer: animations$1.trigger('transform', [
  29296. // We remove the `transform` here completely, rather than setting it to zero, because:
  29297. // 1. Having a transform can cause elements with ripples or an animated
  29298. // transform to shift around in Chrome with an RTL layout (see #10023).
  29299. // 2. 3d transforms causes text to appear blurry on IE and Edge.
  29300. animations$1.state('open, open-instant', animations$1.style({
  29301. 'transform': 'none',
  29302. 'visibility': 'visible',
  29303. })),
  29304. animations$1.state('void', animations$1.style({
  29305. // Avoids the shadow showing up when closed in SSR.
  29306. 'box-shadow': 'none',
  29307. 'visibility': 'hidden',
  29308. })),
  29309. animations$1.transition('void => open-instant', animations$1.animate('0ms')),
  29310. animations$1.transition('void <=> open, open-instant => void', animations$1.animate('400ms cubic-bezier(0.25, 0.8, 0.25, 1)'))
  29311. ])
  29312. };
  29313. /**
  29314. * @fileoverview added by tsickle
  29315. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  29316. */
  29317. /**
  29318. * Throws an exception when two MatDrawer are matching the same position.
  29319. * \@docs-private
  29320. * @param {?} position
  29321. * @return {?}
  29322. */
  29323. function throwMatDuplicatedDrawerError(position) {
  29324. throw Error("A drawer was already declared for 'position=\"" + position + "\"'");
  29325. }
  29326. /**
  29327. * Configures whether drawers should use auto sizing by default.
  29328. * @type {?}
  29329. */
  29330. var MAT_DRAWER_DEFAULT_AUTOSIZE = new core.InjectionToken('MAT_DRAWER_DEFAULT_AUTOSIZE', {
  29331. providedIn: 'root',
  29332. factory: MAT_DRAWER_DEFAULT_AUTOSIZE_FACTORY,
  29333. });
  29334. /**
  29335. * \@docs-private
  29336. * @return {?}
  29337. */
  29338. function MAT_DRAWER_DEFAULT_AUTOSIZE_FACTORY() {
  29339. return false;
  29340. }
  29341. var MatDrawerContent = /** @class */ (function (_super) {
  29342. __extends(MatDrawerContent, _super);
  29343. function MatDrawerContent(_changeDetectorRef, _container, elementRef, scrollDispatcher, ngZone) {
  29344. var _this = _super.call(this, elementRef, scrollDispatcher, ngZone) || this;
  29345. _this._changeDetectorRef = _changeDetectorRef;
  29346. _this._container = _container;
  29347. return _this;
  29348. }
  29349. /**
  29350. * @return {?}
  29351. */
  29352. MatDrawerContent.prototype.ngAfterContentInit = /**
  29353. * @return {?}
  29354. */
  29355. function () {
  29356. var _this = this;
  29357. this._container._contentMarginChanges.subscribe((/**
  29358. * @return {?}
  29359. */
  29360. function () {
  29361. _this._changeDetectorRef.markForCheck();
  29362. }));
  29363. };
  29364. MatDrawerContent.decorators = [
  29365. { type: core.Component, args: [{selector: 'mat-drawer-content',
  29366. template: '<ng-content></ng-content>',
  29367. host: {
  29368. 'class': 'mat-drawer-content',
  29369. '[style.margin-left.px]': '_container._contentMargins.left',
  29370. '[style.margin-right.px]': '_container._contentMargins.right',
  29371. },
  29372. changeDetection: core.ChangeDetectionStrategy.OnPush,
  29373. encapsulation: core.ViewEncapsulation.None,
  29374. },] },
  29375. ];
  29376. /** @nocollapse */
  29377. MatDrawerContent.ctorParameters = function () { return [
  29378. { type: core.ChangeDetectorRef },
  29379. { type: MatDrawerContainer, decorators: [{ type: core.Inject, args: [core.forwardRef((/**
  29380. * @return {?}
  29381. */
  29382. function () { return MatDrawerContainer; })),] }] },
  29383. { type: core.ElementRef },
  29384. { type: scrolling.ScrollDispatcher },
  29385. { type: core.NgZone }
  29386. ]; };
  29387. return MatDrawerContent;
  29388. }(scrolling.CdkScrollable));
  29389. /**
  29390. * This component corresponds to a drawer that can be opened on the drawer container.
  29391. */
  29392. var MatDrawer = /** @class */ (function () {
  29393. function MatDrawer(_elementRef, _focusTrapFactory, _focusMonitor, _platform, _ngZone, _doc) {
  29394. var _this = this;
  29395. this._elementRef = _elementRef;
  29396. this._focusTrapFactory = _focusTrapFactory;
  29397. this._focusMonitor = _focusMonitor;
  29398. this._platform = _platform;
  29399. this._ngZone = _ngZone;
  29400. this._doc = _doc;
  29401. this._elementFocusedBeforeDrawerWasOpened = null;
  29402. /**
  29403. * Whether the drawer is initialized. Used for disabling the initial animation.
  29404. */
  29405. this._enableAnimations = false;
  29406. this._position = 'start';
  29407. this._mode = 'over';
  29408. this._disableClose = false;
  29409. this._autoFocus = true;
  29410. /**
  29411. * Emits whenever the drawer has started animating.
  29412. */
  29413. this._animationStarted = new rxjs.Subject();
  29414. /**
  29415. * Emits whenever the drawer is done animating.
  29416. */
  29417. this._animationEnd = new rxjs.Subject();
  29418. /**
  29419. * Current state of the sidenav animation.
  29420. */
  29421. // @HostBinding is used in the class as it is expected to be extended. Since @Component decorator
  29422. // metadata is not inherited by child classes, instead the host binding data is defined in a way
  29423. // that can be inherited.
  29424. // tslint:disable:no-host-decorator-in-concrete
  29425. this._animationState = 'void';
  29426. /**
  29427. * Event emitted when the drawer open state is changed.
  29428. */
  29429. this.openedChange =
  29430. // Note this has to be async in order to avoid some issues with two-bindings (see #8872).
  29431. new core.EventEmitter(/* isAsync */ true);
  29432. /**
  29433. * Emits when the component is destroyed.
  29434. */
  29435. this._destroyed = new rxjs.Subject();
  29436. /**
  29437. * Event emitted when the drawer's position changes.
  29438. */
  29439. // tslint:disable-next-line:no-output-on-prefix
  29440. this.onPositionChanged = new core.EventEmitter();
  29441. /**
  29442. * An observable that emits when the drawer mode changes. This is used by the drawer container to
  29443. * to know when to when the mode changes so it can adapt the margins on the content.
  29444. */
  29445. this._modeChanged = new rxjs.Subject();
  29446. this._opened = false;
  29447. this.openedChange.subscribe((/**
  29448. * @param {?} opened
  29449. * @return {?}
  29450. */
  29451. function (opened) {
  29452. if (opened) {
  29453. if (_this._doc) {
  29454. _this._elementFocusedBeforeDrawerWasOpened = (/** @type {?} */ (_this._doc.activeElement));
  29455. }
  29456. if (_this._isFocusTrapEnabled && _this._focusTrap) {
  29457. _this._trapFocus();
  29458. }
  29459. }
  29460. else {
  29461. _this._restoreFocus();
  29462. }
  29463. }));
  29464. /**
  29465. * Listen to `keydown` events outside the zone so that change detection is not run every
  29466. * time a key is pressed. Instead we re-enter the zone only if the `ESC` key is pressed
  29467. * and we don't have close disabled.
  29468. */
  29469. this._ngZone.runOutsideAngular((/**
  29470. * @return {?}
  29471. */
  29472. function () {
  29473. ((/** @type {?} */ (rxjs.fromEvent(_this._elementRef.nativeElement, 'keydown')))).pipe(operators.filter((/**
  29474. * @param {?} event
  29475. * @return {?}
  29476. */
  29477. function (event) {
  29478. return event.keyCode === keycodes.ESCAPE && !_this.disableClose && !keycodes.hasModifierKey(event);
  29479. })), operators.takeUntil(_this._destroyed)).subscribe((/**
  29480. * @param {?} event
  29481. * @return {?}
  29482. */
  29483. function (event) { return _this._ngZone.run((/**
  29484. * @return {?}
  29485. */
  29486. function () {
  29487. _this.close();
  29488. event.stopPropagation();
  29489. event.preventDefault();
  29490. })); }));
  29491. }));
  29492. // We need a Subject with distinctUntilChanged, because the `done` event
  29493. // fires twice on some browsers. See https://github.com/angular/angular/issues/24084
  29494. this._animationEnd.pipe(operators.distinctUntilChanged((/**
  29495. * @param {?} x
  29496. * @param {?} y
  29497. * @return {?}
  29498. */
  29499. function (x, y) {
  29500. return x.fromState === y.fromState && x.toState === y.toState;
  29501. }))).subscribe((/**
  29502. * @param {?} event
  29503. * @return {?}
  29504. */
  29505. function (event) {
  29506. var fromState = event.fromState, toState = event.toState;
  29507. if ((toState.indexOf('open') === 0 && fromState === 'void') ||
  29508. (toState === 'void' && fromState.indexOf('open') === 0)) {
  29509. _this.openedChange.emit(_this._opened);
  29510. }
  29511. }));
  29512. }
  29513. Object.defineProperty(MatDrawer.prototype, "position", {
  29514. /** The side that the drawer is attached to. */
  29515. get: /**
  29516. * The side that the drawer is attached to.
  29517. * @return {?}
  29518. */
  29519. function () { return this._position; },
  29520. set: /**
  29521. * @param {?} value
  29522. * @return {?}
  29523. */
  29524. function (value) {
  29525. // Make sure we have a valid value.
  29526. value = value === 'end' ? 'end' : 'start';
  29527. if (value != this._position) {
  29528. this._position = value;
  29529. this.onPositionChanged.emit();
  29530. }
  29531. },
  29532. enumerable: true,
  29533. configurable: true
  29534. });
  29535. Object.defineProperty(MatDrawer.prototype, "mode", {
  29536. /** Mode of the drawer; one of 'over', 'push' or 'side'. */
  29537. get: /**
  29538. * Mode of the drawer; one of 'over', 'push' or 'side'.
  29539. * @return {?}
  29540. */
  29541. function () { return this._mode; },
  29542. set: /**
  29543. * @param {?} value
  29544. * @return {?}
  29545. */
  29546. function (value) {
  29547. this._mode = value;
  29548. this._updateFocusTrapState();
  29549. this._modeChanged.next();
  29550. },
  29551. enumerable: true,
  29552. configurable: true
  29553. });
  29554. Object.defineProperty(MatDrawer.prototype, "disableClose", {
  29555. /** Whether the drawer can be closed with the escape key or by clicking on the backdrop. */
  29556. get: /**
  29557. * Whether the drawer can be closed with the escape key or by clicking on the backdrop.
  29558. * @return {?}
  29559. */
  29560. function () { return this._disableClose; },
  29561. set: /**
  29562. * @param {?} value
  29563. * @return {?}
  29564. */
  29565. function (value) { this._disableClose = coercion.coerceBooleanProperty(value); },
  29566. enumerable: true,
  29567. configurable: true
  29568. });
  29569. Object.defineProperty(MatDrawer.prototype, "autoFocus", {
  29570. /** Whether the drawer should focus the first focusable element automatically when opened. */
  29571. get: /**
  29572. * Whether the drawer should focus the first focusable element automatically when opened.
  29573. * @return {?}
  29574. */
  29575. function () { return this._autoFocus; },
  29576. set: /**
  29577. * @param {?} value
  29578. * @return {?}
  29579. */
  29580. function (value) { this._autoFocus = coercion.coerceBooleanProperty(value); },
  29581. enumerable: true,
  29582. configurable: true
  29583. });
  29584. Object.defineProperty(MatDrawer.prototype, "_openedStream", {
  29585. /** Event emitted when the drawer has been opened. */
  29586. get: /**
  29587. * Event emitted when the drawer has been opened.
  29588. * @return {?}
  29589. */
  29590. function () {
  29591. return this.openedChange.pipe(operators.filter((/**
  29592. * @param {?} o
  29593. * @return {?}
  29594. */
  29595. function (o) { return o; })), operators.map((/**
  29596. * @return {?}
  29597. */
  29598. function () { })));
  29599. },
  29600. enumerable: true,
  29601. configurable: true
  29602. });
  29603. Object.defineProperty(MatDrawer.prototype, "openedStart", {
  29604. /** Event emitted when the drawer has started opening. */
  29605. get: /**
  29606. * Event emitted when the drawer has started opening.
  29607. * @return {?}
  29608. */
  29609. function () {
  29610. return this._animationStarted.pipe(operators.filter((/**
  29611. * @param {?} e
  29612. * @return {?}
  29613. */
  29614. function (e) { return e.fromState !== e.toState && e.toState.indexOf('open') === 0; })), operators.map((/**
  29615. * @return {?}
  29616. */
  29617. function () { })));
  29618. },
  29619. enumerable: true,
  29620. configurable: true
  29621. });
  29622. Object.defineProperty(MatDrawer.prototype, "_closedStream", {
  29623. /** Event emitted when the drawer has been closed. */
  29624. get: /**
  29625. * Event emitted when the drawer has been closed.
  29626. * @return {?}
  29627. */
  29628. function () {
  29629. return this.openedChange.pipe(operators.filter((/**
  29630. * @param {?} o
  29631. * @return {?}
  29632. */
  29633. function (o) { return !o; })), operators.map((/**
  29634. * @return {?}
  29635. */
  29636. function () { })));
  29637. },
  29638. enumerable: true,
  29639. configurable: true
  29640. });
  29641. Object.defineProperty(MatDrawer.prototype, "closedStart", {
  29642. /** Event emitted when the drawer has started closing. */
  29643. get: /**
  29644. * Event emitted when the drawer has started closing.
  29645. * @return {?}
  29646. */
  29647. function () {
  29648. return this._animationStarted.pipe(operators.filter((/**
  29649. * @param {?} e
  29650. * @return {?}
  29651. */
  29652. function (e) { return e.fromState !== e.toState && e.toState === 'void'; })), operators.map((/**
  29653. * @return {?}
  29654. */
  29655. function () { })));
  29656. },
  29657. enumerable: true,
  29658. configurable: true
  29659. });
  29660. Object.defineProperty(MatDrawer.prototype, "_isFocusTrapEnabled", {
  29661. get: /**
  29662. * @return {?}
  29663. */
  29664. function () {
  29665. // The focus trap is only enabled when the drawer is open in any mode other than side.
  29666. return this.opened && this.mode !== 'side';
  29667. },
  29668. enumerable: true,
  29669. configurable: true
  29670. });
  29671. /** Traps focus inside the drawer. */
  29672. /**
  29673. * Traps focus inside the drawer.
  29674. * @private
  29675. * @return {?}
  29676. */
  29677. MatDrawer.prototype._trapFocus = /**
  29678. * Traps focus inside the drawer.
  29679. * @private
  29680. * @return {?}
  29681. */
  29682. function () {
  29683. var _this = this;
  29684. if (!this.autoFocus) {
  29685. return;
  29686. }
  29687. this._focusTrap.focusInitialElementWhenReady().then((/**
  29688. * @param {?} hasMovedFocus
  29689. * @return {?}
  29690. */
  29691. function (hasMovedFocus) {
  29692. // If there were no focusable elements, focus the sidenav itself so the keyboard navigation
  29693. // still works. We need to check that `focus` is a function due to Universal.
  29694. if (!hasMovedFocus && typeof _this._elementRef.nativeElement.focus === 'function') {
  29695. _this._elementRef.nativeElement.focus();
  29696. }
  29697. }));
  29698. };
  29699. /**
  29700. * If focus is currently inside the drawer, restores it to where it was before the drawer
  29701. * opened.
  29702. */
  29703. /**
  29704. * If focus is currently inside the drawer, restores it to where it was before the drawer
  29705. * opened.
  29706. * @private
  29707. * @return {?}
  29708. */
  29709. MatDrawer.prototype._restoreFocus = /**
  29710. * If focus is currently inside the drawer, restores it to where it was before the drawer
  29711. * opened.
  29712. * @private
  29713. * @return {?}
  29714. */
  29715. function () {
  29716. if (!this.autoFocus) {
  29717. return;
  29718. }
  29719. /** @type {?} */
  29720. var activeEl = this._doc && this._doc.activeElement;
  29721. if (activeEl && this._elementRef.nativeElement.contains(activeEl)) {
  29722. if (this._elementFocusedBeforeDrawerWasOpened instanceof HTMLElement) {
  29723. this._focusMonitor.focusVia(this._elementFocusedBeforeDrawerWasOpened, this._openedVia);
  29724. }
  29725. else {
  29726. this._elementRef.nativeElement.blur();
  29727. }
  29728. }
  29729. this._elementFocusedBeforeDrawerWasOpened = null;
  29730. this._openedVia = null;
  29731. };
  29732. /**
  29733. * @return {?}
  29734. */
  29735. MatDrawer.prototype.ngAfterContentInit = /**
  29736. * @return {?}
  29737. */
  29738. function () {
  29739. this._focusTrap = this._focusTrapFactory.create(this._elementRef.nativeElement);
  29740. this._updateFocusTrapState();
  29741. };
  29742. /**
  29743. * @return {?}
  29744. */
  29745. MatDrawer.prototype.ngAfterContentChecked = /**
  29746. * @return {?}
  29747. */
  29748. function () {
  29749. // Enable the animations after the lifecycle hooks have run, in order to avoid animating
  29750. // drawers that are open by default. When we're on the server, we shouldn't enable the
  29751. // animations, because we don't want the drawer to animate the first time the user sees
  29752. // the page.
  29753. if (this._platform.isBrowser) {
  29754. this._enableAnimations = true;
  29755. }
  29756. };
  29757. /**
  29758. * @return {?}
  29759. */
  29760. MatDrawer.prototype.ngOnDestroy = /**
  29761. * @return {?}
  29762. */
  29763. function () {
  29764. if (this._focusTrap) {
  29765. this._focusTrap.destroy();
  29766. }
  29767. this._animationStarted.complete();
  29768. this._animationEnd.complete();
  29769. this._modeChanged.complete();
  29770. this._destroyed.next();
  29771. this._destroyed.complete();
  29772. };
  29773. Object.defineProperty(MatDrawer.prototype, "opened", {
  29774. /**
  29775. * Whether the drawer is opened. We overload this because we trigger an event when it
  29776. * starts or end.
  29777. */
  29778. get: /**
  29779. * Whether the drawer is opened. We overload this because we trigger an event when it
  29780. * starts or end.
  29781. * @return {?}
  29782. */
  29783. function () { return this._opened; },
  29784. set: /**
  29785. * @param {?} value
  29786. * @return {?}
  29787. */
  29788. function (value) { this.toggle(coercion.coerceBooleanProperty(value)); },
  29789. enumerable: true,
  29790. configurable: true
  29791. });
  29792. /**
  29793. * Open the drawer.
  29794. * @param openedVia Whether the drawer was opened by a key press, mouse click or programmatically.
  29795. * Used for focus management after the sidenav is closed.
  29796. */
  29797. /**
  29798. * Open the drawer.
  29799. * @param {?=} openedVia Whether the drawer was opened by a key press, mouse click or programmatically.
  29800. * Used for focus management after the sidenav is closed.
  29801. * @return {?}
  29802. */
  29803. MatDrawer.prototype.open = /**
  29804. * Open the drawer.
  29805. * @param {?=} openedVia Whether the drawer was opened by a key press, mouse click or programmatically.
  29806. * Used for focus management after the sidenav is closed.
  29807. * @return {?}
  29808. */
  29809. function (openedVia) {
  29810. return this.toggle(true, openedVia);
  29811. };
  29812. /** Close the drawer. */
  29813. /**
  29814. * Close the drawer.
  29815. * @return {?}
  29816. */
  29817. MatDrawer.prototype.close = /**
  29818. * Close the drawer.
  29819. * @return {?}
  29820. */
  29821. function () {
  29822. return this.toggle(false);
  29823. };
  29824. /**
  29825. * Toggle this drawer.
  29826. * @param isOpen Whether the drawer should be open.
  29827. * @param openedVia Whether the drawer was opened by a key press, mouse click or programmatically.
  29828. * Used for focus management after the sidenav is closed.
  29829. */
  29830. /**
  29831. * Toggle this drawer.
  29832. * @param {?=} isOpen Whether the drawer should be open.
  29833. * @param {?=} openedVia Whether the drawer was opened by a key press, mouse click or programmatically.
  29834. * Used for focus management after the sidenav is closed.
  29835. * @return {?}
  29836. */
  29837. MatDrawer.prototype.toggle = /**
  29838. * Toggle this drawer.
  29839. * @param {?=} isOpen Whether the drawer should be open.
  29840. * @param {?=} openedVia Whether the drawer was opened by a key press, mouse click or programmatically.
  29841. * Used for focus management after the sidenav is closed.
  29842. * @return {?}
  29843. */
  29844. function (isOpen, openedVia) {
  29845. var _this = this;
  29846. if (isOpen === void 0) { isOpen = !this.opened; }
  29847. if (openedVia === void 0) { openedVia = 'program'; }
  29848. this._opened = isOpen;
  29849. if (isOpen) {
  29850. this._animationState = this._enableAnimations ? 'open' : 'open-instant';
  29851. this._openedVia = openedVia;
  29852. }
  29853. else {
  29854. this._animationState = 'void';
  29855. this._restoreFocus();
  29856. }
  29857. this._updateFocusTrapState();
  29858. return new Promise((/**
  29859. * @param {?} resolve
  29860. * @return {?}
  29861. */
  29862. function (resolve) {
  29863. _this.openedChange.pipe(operators.take(1)).subscribe((/**
  29864. * @param {?} open
  29865. * @return {?}
  29866. */
  29867. function (open) { return resolve(open ? 'open' : 'close'); }));
  29868. }));
  29869. };
  29870. Object.defineProperty(MatDrawer.prototype, "_width", {
  29871. get: /**
  29872. * @return {?}
  29873. */
  29874. function () {
  29875. return this._elementRef.nativeElement ? (this._elementRef.nativeElement.offsetWidth || 0) : 0;
  29876. },
  29877. enumerable: true,
  29878. configurable: true
  29879. });
  29880. /** Updates the enabled state of the focus trap. */
  29881. /**
  29882. * Updates the enabled state of the focus trap.
  29883. * @private
  29884. * @return {?}
  29885. */
  29886. MatDrawer.prototype._updateFocusTrapState = /**
  29887. * Updates the enabled state of the focus trap.
  29888. * @private
  29889. * @return {?}
  29890. */
  29891. function () {
  29892. if (this._focusTrap) {
  29893. this._focusTrap.enabled = this._isFocusTrapEnabled;
  29894. }
  29895. };
  29896. // We have to use a `HostListener` here in order to support both Ivy and ViewEngine.
  29897. // In Ivy the `host` bindings will be merged when this class is extended, whereas in
  29898. // ViewEngine they're overwritten.
  29899. // TODO(crisbeto): we move this back into `host` once Ivy is turned on by default.
  29900. // tslint:disable-next-line:no-host-decorator-in-concrete
  29901. // We have to use a `HostListener` here in order to support both Ivy and ViewEngine.
  29902. // In Ivy the `host` bindings will be merged when this class is extended, whereas in
  29903. // ViewEngine they're overwritten.
  29904. // TODO(crisbeto): we move this back into `host` once Ivy is turned on by default.
  29905. // tslint:disable-next-line:no-host-decorator-in-concrete
  29906. /**
  29907. * @param {?} event
  29908. * @return {?}
  29909. */
  29910. MatDrawer.prototype._animationStartListener =
  29911. // We have to use a `HostListener` here in order to support both Ivy and ViewEngine.
  29912. // In Ivy the `host` bindings will be merged when this class is extended, whereas in
  29913. // ViewEngine they're overwritten.
  29914. // TODO(crisbeto): we move this back into `host` once Ivy is turned on by default.
  29915. // tslint:disable-next-line:no-host-decorator-in-concrete
  29916. /**
  29917. * @param {?} event
  29918. * @return {?}
  29919. */
  29920. function (event) {
  29921. this._animationStarted.next(event);
  29922. };
  29923. // We have to use a `HostListener` here in order to support both Ivy and ViewEngine.
  29924. // In Ivy the `host` bindings will be merged when this class is extended, whereas in
  29925. // ViewEngine they're overwritten.
  29926. // TODO(crisbeto): we move this back into `host` once Ivy is turned on by default.
  29927. // tslint:disable-next-line:no-host-decorator-in-concrete
  29928. // We have to use a `HostListener` here in order to support both Ivy and ViewEngine.
  29929. // In Ivy the `host` bindings will be merged when this class is extended, whereas in
  29930. // ViewEngine they're overwritten.
  29931. // TODO(crisbeto): we move this back into `host` once Ivy is turned on by default.
  29932. // tslint:disable-next-line:no-host-decorator-in-concrete
  29933. /**
  29934. * @param {?} event
  29935. * @return {?}
  29936. */
  29937. MatDrawer.prototype._animationDoneListener =
  29938. // We have to use a `HostListener` here in order to support both Ivy and ViewEngine.
  29939. // In Ivy the `host` bindings will be merged when this class is extended, whereas in
  29940. // ViewEngine they're overwritten.
  29941. // TODO(crisbeto): we move this back into `host` once Ivy is turned on by default.
  29942. // tslint:disable-next-line:no-host-decorator-in-concrete
  29943. /**
  29944. * @param {?} event
  29945. * @return {?}
  29946. */
  29947. function (event) {
  29948. this._animationEnd.next(event);
  29949. };
  29950. MatDrawer.decorators = [
  29951. { type: core.Component, args: [{selector: 'mat-drawer',
  29952. exportAs: 'matDrawer',
  29953. template: "<div class=\"mat-drawer-inner-container\"><ng-content></ng-content></div>",
  29954. animations: [matDrawerAnimations.transformDrawer],
  29955. host: {
  29956. 'class': 'mat-drawer',
  29957. // must prevent the browser from aligning text based on value
  29958. '[attr.align]': 'null',
  29959. '[class.mat-drawer-end]': 'position === "end"',
  29960. '[class.mat-drawer-over]': 'mode === "over"',
  29961. '[class.mat-drawer-push]': 'mode === "push"',
  29962. '[class.mat-drawer-side]': 'mode === "side"',
  29963. '[class.mat-drawer-opened]': 'opened',
  29964. 'tabIndex': '-1',
  29965. },
  29966. changeDetection: core.ChangeDetectionStrategy.OnPush,
  29967. encapsulation: core.ViewEncapsulation.None,
  29968. },] },
  29969. ];
  29970. /** @nocollapse */
  29971. MatDrawer.ctorParameters = function () { return [
  29972. { type: core.ElementRef },
  29973. { type: a11y.FocusTrapFactory },
  29974. { type: a11y.FocusMonitor },
  29975. { type: platform.Platform },
  29976. { type: core.NgZone },
  29977. { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [common.DOCUMENT,] }] }
  29978. ]; };
  29979. MatDrawer.propDecorators = {
  29980. position: [{ type: core.Input }],
  29981. mode: [{ type: core.Input }],
  29982. disableClose: [{ type: core.Input }],
  29983. autoFocus: [{ type: core.Input }],
  29984. _animationState: [{ type: core.HostBinding, args: ['@transform',] }],
  29985. openedChange: [{ type: core.Output }],
  29986. _openedStream: [{ type: core.Output, args: ['opened',] }],
  29987. openedStart: [{ type: core.Output }],
  29988. _closedStream: [{ type: core.Output, args: ['closed',] }],
  29989. closedStart: [{ type: core.Output }],
  29990. onPositionChanged: [{ type: core.Output, args: ['positionChanged',] }],
  29991. opened: [{ type: core.Input }],
  29992. _animationStartListener: [{ type: core.HostListener, args: ['@transform.start', ['$event'],] }],
  29993. _animationDoneListener: [{ type: core.HostListener, args: ['@transform.done', ['$event'],] }]
  29994. };
  29995. return MatDrawer;
  29996. }());
  29997. /**
  29998. * `<mat-drawer-container>` component.
  29999. *
  30000. * This is the parent component to one or two `<mat-drawer>`s that validates the state internally
  30001. * and coordinates the backdrop and content styling.
  30002. */
  30003. var MatDrawerContainer = /** @class */ (function () {
  30004. function MatDrawerContainer(_dir, _element, _ngZone, _changeDetectorRef, viewportRuler, defaultAutosize, _animationMode) {
  30005. var _this = this;
  30006. if (defaultAutosize === void 0) { defaultAutosize = false; }
  30007. this._dir = _dir;
  30008. this._element = _element;
  30009. this._ngZone = _ngZone;
  30010. this._changeDetectorRef = _changeDetectorRef;
  30011. this._animationMode = _animationMode;
  30012. /**
  30013. * Event emitted when the drawer backdrop is clicked.
  30014. */
  30015. this.backdropClick = new core.EventEmitter();
  30016. /**
  30017. * Emits when the component is destroyed.
  30018. */
  30019. this._destroyed = new rxjs.Subject();
  30020. /**
  30021. * Emits on every ngDoCheck. Used for debouncing reflows.
  30022. */
  30023. this._doCheckSubject = new rxjs.Subject();
  30024. /**
  30025. * Margins to be applied to the content. These are used to push / shrink the drawer content when a
  30026. * drawer is open. We use margin rather than transform even for push mode because transform breaks
  30027. * fixed position elements inside of the transformed element.
  30028. */
  30029. this._contentMargins = { left: null, right: null };
  30030. this._contentMarginChanges = new rxjs.Subject();
  30031. // If a `Dir` directive exists up the tree, listen direction changes
  30032. // and update the left/right properties to point to the proper start/end.
  30033. if (_dir) {
  30034. _dir.change.pipe(operators.takeUntil(this._destroyed)).subscribe((/**
  30035. * @return {?}
  30036. */
  30037. function () {
  30038. _this._validateDrawers();
  30039. _this.updateContentMargins();
  30040. }));
  30041. }
  30042. // Since the minimum width of the sidenav depends on the viewport width,
  30043. // we need to recompute the margins if the viewport changes.
  30044. viewportRuler.change()
  30045. .pipe(operators.takeUntil(this._destroyed))
  30046. .subscribe((/**
  30047. * @return {?}
  30048. */
  30049. function () { return _this.updateContentMargins(); }));
  30050. this._autosize = defaultAutosize;
  30051. }
  30052. Object.defineProperty(MatDrawerContainer.prototype, "start", {
  30053. /** The drawer child with the `start` position. */
  30054. get: /**
  30055. * The drawer child with the `start` position.
  30056. * @return {?}
  30057. */
  30058. function () { return this._start; },
  30059. enumerable: true,
  30060. configurable: true
  30061. });
  30062. Object.defineProperty(MatDrawerContainer.prototype, "end", {
  30063. /** The drawer child with the `end` position. */
  30064. get: /**
  30065. * The drawer child with the `end` position.
  30066. * @return {?}
  30067. */
  30068. function () { return this._end; },
  30069. enumerable: true,
  30070. configurable: true
  30071. });
  30072. Object.defineProperty(MatDrawerContainer.prototype, "autosize", {
  30073. /**
  30074. * Whether to automatically resize the container whenever
  30075. * the size of any of its drawers changes.
  30076. *
  30077. * **Use at your own risk!** Enabling this option can cause layout thrashing by measuring
  30078. * the drawers on every change detection cycle. Can be configured globally via the
  30079. * `MAT_DRAWER_DEFAULT_AUTOSIZE` token.
  30080. */
  30081. get: /**
  30082. * Whether to automatically resize the container whenever
  30083. * the size of any of its drawers changes.
  30084. *
  30085. * **Use at your own risk!** Enabling this option can cause layout thrashing by measuring
  30086. * the drawers on every change detection cycle. Can be configured globally via the
  30087. * `MAT_DRAWER_DEFAULT_AUTOSIZE` token.
  30088. * @return {?}
  30089. */
  30090. function () { return this._autosize; },
  30091. set: /**
  30092. * @param {?} value
  30093. * @return {?}
  30094. */
  30095. function (value) { this._autosize = coercion.coerceBooleanProperty(value); },
  30096. enumerable: true,
  30097. configurable: true
  30098. });
  30099. Object.defineProperty(MatDrawerContainer.prototype, "hasBackdrop", {
  30100. /**
  30101. * Whether the drawer container should have a backdrop while one of the sidenavs is open.
  30102. * If explicitly set to `true`, the backdrop will be enabled for drawers in the `side`
  30103. * mode as well.
  30104. */
  30105. get: /**
  30106. * Whether the drawer container should have a backdrop while one of the sidenavs is open.
  30107. * If explicitly set to `true`, the backdrop will be enabled for drawers in the `side`
  30108. * mode as well.
  30109. * @return {?}
  30110. */
  30111. function () {
  30112. if (this._backdropOverride == null) {
  30113. return !this._start || this._start.mode !== 'side' || !this._end || this._end.mode !== 'side';
  30114. }
  30115. return this._backdropOverride;
  30116. },
  30117. set: /**
  30118. * @param {?} value
  30119. * @return {?}
  30120. */
  30121. function (value) {
  30122. this._backdropOverride = value == null ? null : coercion.coerceBooleanProperty(value);
  30123. },
  30124. enumerable: true,
  30125. configurable: true
  30126. });
  30127. Object.defineProperty(MatDrawerContainer.prototype, "scrollable", {
  30128. /** Reference to the CdkScrollable instance that wraps the scrollable content. */
  30129. get: /**
  30130. * Reference to the CdkScrollable instance that wraps the scrollable content.
  30131. * @return {?}
  30132. */
  30133. function () {
  30134. return this._userContent || this._content;
  30135. },
  30136. enumerable: true,
  30137. configurable: true
  30138. });
  30139. /**
  30140. * @return {?}
  30141. */
  30142. MatDrawerContainer.prototype.ngAfterContentInit = /**
  30143. * @return {?}
  30144. */
  30145. function () {
  30146. var _this = this;
  30147. this._drawers.changes.pipe(operators.startWith(null)).subscribe((/**
  30148. * @return {?}
  30149. */
  30150. function () {
  30151. _this._validateDrawers();
  30152. _this._drawers.forEach((/**
  30153. * @param {?} drawer
  30154. * @return {?}
  30155. */
  30156. function (drawer) {
  30157. _this._watchDrawerToggle(drawer);
  30158. _this._watchDrawerPosition(drawer);
  30159. _this._watchDrawerMode(drawer);
  30160. }));
  30161. if (!_this._drawers.length ||
  30162. _this._isDrawerOpen(_this._start) ||
  30163. _this._isDrawerOpen(_this._end)) {
  30164. _this.updateContentMargins();
  30165. }
  30166. _this._changeDetectorRef.markForCheck();
  30167. }));
  30168. this._doCheckSubject.pipe(operators.debounceTime(10), // Arbitrary debounce time, less than a frame at 60fps
  30169. operators.takeUntil(this._destroyed)).subscribe((/**
  30170. * @return {?}
  30171. */
  30172. function () { return _this.updateContentMargins(); }));
  30173. };
  30174. /**
  30175. * @return {?}
  30176. */
  30177. MatDrawerContainer.prototype.ngOnDestroy = /**
  30178. * @return {?}
  30179. */
  30180. function () {
  30181. this._contentMarginChanges.complete();
  30182. this._doCheckSubject.complete();
  30183. this._destroyed.next();
  30184. this._destroyed.complete();
  30185. };
  30186. /** Calls `open` of both start and end drawers */
  30187. /**
  30188. * Calls `open` of both start and end drawers
  30189. * @return {?}
  30190. */
  30191. MatDrawerContainer.prototype.open = /**
  30192. * Calls `open` of both start and end drawers
  30193. * @return {?}
  30194. */
  30195. function () {
  30196. this._drawers.forEach((/**
  30197. * @param {?} drawer
  30198. * @return {?}
  30199. */
  30200. function (drawer) { return drawer.open(); }));
  30201. };
  30202. /** Calls `close` of both start and end drawers */
  30203. /**
  30204. * Calls `close` of both start and end drawers
  30205. * @return {?}
  30206. */
  30207. MatDrawerContainer.prototype.close = /**
  30208. * Calls `close` of both start and end drawers
  30209. * @return {?}
  30210. */
  30211. function () {
  30212. this._drawers.forEach((/**
  30213. * @param {?} drawer
  30214. * @return {?}
  30215. */
  30216. function (drawer) { return drawer.close(); }));
  30217. };
  30218. /**
  30219. * Recalculates and updates the inline styles for the content. Note that this should be used
  30220. * sparingly, because it causes a reflow.
  30221. */
  30222. /**
  30223. * Recalculates and updates the inline styles for the content. Note that this should be used
  30224. * sparingly, because it causes a reflow.
  30225. * @return {?}
  30226. */
  30227. MatDrawerContainer.prototype.updateContentMargins = /**
  30228. * Recalculates and updates the inline styles for the content. Note that this should be used
  30229. * sparingly, because it causes a reflow.
  30230. * @return {?}
  30231. */
  30232. function () {
  30233. var _this = this;
  30234. // 1. For drawers in `over` mode, they don't affect the content.
  30235. // 2. For drawers in `side` mode they should shrink the content. We do this by adding to the
  30236. // left margin (for left drawer) or right margin (for right the drawer).
  30237. // 3. For drawers in `push` mode the should shift the content without resizing it. We do this by
  30238. // adding to the left or right margin and simultaneously subtracting the same amount of
  30239. // margin from the other side.
  30240. /** @type {?} */
  30241. var left = 0;
  30242. /** @type {?} */
  30243. var right = 0;
  30244. if (this._left && this._left.opened) {
  30245. if (this._left.mode == 'side') {
  30246. left += this._left._width;
  30247. }
  30248. else if (this._left.mode == 'push') {
  30249. /** @type {?} */
  30250. var width = this._left._width;
  30251. left += width;
  30252. right -= width;
  30253. }
  30254. }
  30255. if (this._right && this._right.opened) {
  30256. if (this._right.mode == 'side') {
  30257. right += this._right._width;
  30258. }
  30259. else if (this._right.mode == 'push') {
  30260. /** @type {?} */
  30261. var width = this._right._width;
  30262. right += width;
  30263. left -= width;
  30264. }
  30265. }
  30266. // If either `right` or `left` is zero, don't set a style to the element. This
  30267. // allows users to specify a custom size via CSS class in SSR scenarios where the
  30268. // measured widths will always be zero. Note that we reset to `null` here, rather
  30269. // than below, in order to ensure that the types in the `if` below are consistent.
  30270. left = left || (/** @type {?} */ (null));
  30271. right = right || (/** @type {?} */ (null));
  30272. if (left !== this._contentMargins.left || right !== this._contentMargins.right) {
  30273. this._contentMargins = { left: left, right: right };
  30274. // Pull back into the NgZone since in some cases we could be outside. We need to be careful
  30275. // to do it only when something changed, otherwise we can end up hitting the zone too often.
  30276. this._ngZone.run((/**
  30277. * @return {?}
  30278. */
  30279. function () { return _this._contentMarginChanges.next(_this._contentMargins); }));
  30280. }
  30281. };
  30282. /**
  30283. * @return {?}
  30284. */
  30285. MatDrawerContainer.prototype.ngDoCheck = /**
  30286. * @return {?}
  30287. */
  30288. function () {
  30289. var _this = this;
  30290. // If users opted into autosizing, do a check every change detection cycle.
  30291. if (this._autosize && this._isPushed()) {
  30292. // Run outside the NgZone, otherwise the debouncer will throw us into an infinite loop.
  30293. this._ngZone.runOutsideAngular((/**
  30294. * @return {?}
  30295. */
  30296. function () { return _this._doCheckSubject.next(); }));
  30297. }
  30298. };
  30299. /**
  30300. * Subscribes to drawer events in order to set a class on the main container element when the
  30301. * drawer is open and the backdrop is visible. This ensures any overflow on the container element
  30302. * is properly hidden.
  30303. */
  30304. /**
  30305. * Subscribes to drawer events in order to set a class on the main container element when the
  30306. * drawer is open and the backdrop is visible. This ensures any overflow on the container element
  30307. * is properly hidden.
  30308. * @private
  30309. * @param {?} drawer
  30310. * @return {?}
  30311. */
  30312. MatDrawerContainer.prototype._watchDrawerToggle = /**
  30313. * Subscribes to drawer events in order to set a class on the main container element when the
  30314. * drawer is open and the backdrop is visible. This ensures any overflow on the container element
  30315. * is properly hidden.
  30316. * @private
  30317. * @param {?} drawer
  30318. * @return {?}
  30319. */
  30320. function (drawer) {
  30321. var _this = this;
  30322. drawer._animationStarted.pipe(operators.filter((/**
  30323. * @param {?} event
  30324. * @return {?}
  30325. */
  30326. function (event) { return event.fromState !== event.toState; })), operators.takeUntil(this._drawers.changes))
  30327. .subscribe((/**
  30328. * @param {?} event
  30329. * @return {?}
  30330. */
  30331. function (event) {
  30332. // Set the transition class on the container so that the animations occur. This should not
  30333. // be set initially because animations should only be triggered via a change in state.
  30334. if (event.toState !== 'open-instant' && _this._animationMode !== 'NoopAnimations') {
  30335. _this._element.nativeElement.classList.add('mat-drawer-transition');
  30336. }
  30337. _this.updateContentMargins();
  30338. _this._changeDetectorRef.markForCheck();
  30339. }));
  30340. if (drawer.mode !== 'side') {
  30341. drawer.openedChange.pipe(operators.takeUntil(this._drawers.changes)).subscribe((/**
  30342. * @return {?}
  30343. */
  30344. function () {
  30345. return _this._setContainerClass(drawer.opened);
  30346. }));
  30347. }
  30348. };
  30349. /**
  30350. * Subscribes to drawer onPositionChanged event in order to
  30351. * re-validate drawers when the position changes.
  30352. */
  30353. /**
  30354. * Subscribes to drawer onPositionChanged event in order to
  30355. * re-validate drawers when the position changes.
  30356. * @private
  30357. * @param {?} drawer
  30358. * @return {?}
  30359. */
  30360. MatDrawerContainer.prototype._watchDrawerPosition = /**
  30361. * Subscribes to drawer onPositionChanged event in order to
  30362. * re-validate drawers when the position changes.
  30363. * @private
  30364. * @param {?} drawer
  30365. * @return {?}
  30366. */
  30367. function (drawer) {
  30368. var _this = this;
  30369. if (!drawer) {
  30370. return;
  30371. }
  30372. // NOTE: We need to wait for the microtask queue to be empty before validating,
  30373. // since both drawers may be swapping positions at the same time.
  30374. drawer.onPositionChanged.pipe(operators.takeUntil(this._drawers.changes)).subscribe((/**
  30375. * @return {?}
  30376. */
  30377. function () {
  30378. _this._ngZone.onMicrotaskEmpty.asObservable().pipe(operators.take(1)).subscribe((/**
  30379. * @return {?}
  30380. */
  30381. function () {
  30382. _this._validateDrawers();
  30383. }));
  30384. }));
  30385. };
  30386. /** Subscribes to changes in drawer mode so we can run change detection. */
  30387. /**
  30388. * Subscribes to changes in drawer mode so we can run change detection.
  30389. * @private
  30390. * @param {?} drawer
  30391. * @return {?}
  30392. */
  30393. MatDrawerContainer.prototype._watchDrawerMode = /**
  30394. * Subscribes to changes in drawer mode so we can run change detection.
  30395. * @private
  30396. * @param {?} drawer
  30397. * @return {?}
  30398. */
  30399. function (drawer) {
  30400. var _this = this;
  30401. if (drawer) {
  30402. drawer._modeChanged.pipe(operators.takeUntil(rxjs.merge(this._drawers.changes, this._destroyed)))
  30403. .subscribe((/**
  30404. * @return {?}
  30405. */
  30406. function () {
  30407. _this.updateContentMargins();
  30408. _this._changeDetectorRef.markForCheck();
  30409. }));
  30410. }
  30411. };
  30412. /** Toggles the 'mat-drawer-opened' class on the main 'mat-drawer-container' element. */
  30413. /**
  30414. * Toggles the 'mat-drawer-opened' class on the main 'mat-drawer-container' element.
  30415. * @private
  30416. * @param {?} isAdd
  30417. * @return {?}
  30418. */
  30419. MatDrawerContainer.prototype._setContainerClass = /**
  30420. * Toggles the 'mat-drawer-opened' class on the main 'mat-drawer-container' element.
  30421. * @private
  30422. * @param {?} isAdd
  30423. * @return {?}
  30424. */
  30425. function (isAdd) {
  30426. /** @type {?} */
  30427. var classList = this._element.nativeElement.classList;
  30428. /** @type {?} */
  30429. var className = 'mat-drawer-container-has-open';
  30430. if (isAdd) {
  30431. classList.add(className);
  30432. }
  30433. else {
  30434. classList.remove(className);
  30435. }
  30436. };
  30437. /** Validate the state of the drawer children components. */
  30438. /**
  30439. * Validate the state of the drawer children components.
  30440. * @private
  30441. * @return {?}
  30442. */
  30443. MatDrawerContainer.prototype._validateDrawers = /**
  30444. * Validate the state of the drawer children components.
  30445. * @private
  30446. * @return {?}
  30447. */
  30448. function () {
  30449. var _this = this;
  30450. this._start = this._end = null;
  30451. // Ensure that we have at most one start and one end drawer.
  30452. this._drawers.forEach((/**
  30453. * @param {?} drawer
  30454. * @return {?}
  30455. */
  30456. function (drawer) {
  30457. if (drawer.position == 'end') {
  30458. if (_this._end != null) {
  30459. throwMatDuplicatedDrawerError('end');
  30460. }
  30461. _this._end = drawer;
  30462. }
  30463. else {
  30464. if (_this._start != null) {
  30465. throwMatDuplicatedDrawerError('start');
  30466. }
  30467. _this._start = drawer;
  30468. }
  30469. }));
  30470. this._right = this._left = null;
  30471. // Detect if we're LTR or RTL.
  30472. if (this._dir && this._dir.value === 'rtl') {
  30473. this._left = this._end;
  30474. this._right = this._start;
  30475. }
  30476. else {
  30477. this._left = this._start;
  30478. this._right = this._end;
  30479. }
  30480. };
  30481. /** Whether the container is being pushed to the side by one of the drawers. */
  30482. /**
  30483. * Whether the container is being pushed to the side by one of the drawers.
  30484. * @private
  30485. * @return {?}
  30486. */
  30487. MatDrawerContainer.prototype._isPushed = /**
  30488. * Whether the container is being pushed to the side by one of the drawers.
  30489. * @private
  30490. * @return {?}
  30491. */
  30492. function () {
  30493. return (this._isDrawerOpen(this._start) && this._start.mode != 'over') ||
  30494. (this._isDrawerOpen(this._end) && this._end.mode != 'over');
  30495. };
  30496. /**
  30497. * @return {?}
  30498. */
  30499. MatDrawerContainer.prototype._onBackdropClicked = /**
  30500. * @return {?}
  30501. */
  30502. function () {
  30503. this.backdropClick.emit();
  30504. this._closeModalDrawer();
  30505. };
  30506. /**
  30507. * @return {?}
  30508. */
  30509. MatDrawerContainer.prototype._closeModalDrawer = /**
  30510. * @return {?}
  30511. */
  30512. function () {
  30513. var _this = this;
  30514. // Close all open drawers where closing is not disabled and the mode is not `side`.
  30515. [this._start, this._end]
  30516. .filter((/**
  30517. * @param {?} drawer
  30518. * @return {?}
  30519. */
  30520. function (drawer) { return drawer && !drawer.disableClose && _this._canHaveBackdrop(drawer); }))
  30521. .forEach((/**
  30522. * @param {?} drawer
  30523. * @return {?}
  30524. */
  30525. function (drawer) { return (/** @type {?} */ (drawer)).close(); }));
  30526. };
  30527. /**
  30528. * @return {?}
  30529. */
  30530. MatDrawerContainer.prototype._isShowingBackdrop = /**
  30531. * @return {?}
  30532. */
  30533. function () {
  30534. return (this._isDrawerOpen(this._start) && this._canHaveBackdrop(this._start)) ||
  30535. (this._isDrawerOpen(this._end) && this._canHaveBackdrop(this._end));
  30536. };
  30537. /**
  30538. * @private
  30539. * @param {?} drawer
  30540. * @return {?}
  30541. */
  30542. MatDrawerContainer.prototype._canHaveBackdrop = /**
  30543. * @private
  30544. * @param {?} drawer
  30545. * @return {?}
  30546. */
  30547. function (drawer) {
  30548. return drawer.mode !== 'side' || !!this._backdropOverride;
  30549. };
  30550. /**
  30551. * @private
  30552. * @param {?} drawer
  30553. * @return {?}
  30554. */
  30555. MatDrawerContainer.prototype._isDrawerOpen = /**
  30556. * @private
  30557. * @param {?} drawer
  30558. * @return {?}
  30559. */
  30560. function (drawer) {
  30561. return drawer != null && drawer.opened;
  30562. };
  30563. MatDrawerContainer.decorators = [
  30564. { type: core.Component, args: [{selector: 'mat-drawer-container',
  30565. exportAs: 'matDrawerContainer',
  30566. template: "<div class=\"mat-drawer-backdrop\" (click)=\"_onBackdropClicked()\" *ngIf=\"hasBackdrop\" [class.mat-drawer-shown]=\"_isShowingBackdrop()\"></div><ng-content select=\"mat-drawer\"></ng-content><ng-content select=\"mat-drawer-content\"></ng-content><mat-drawer-content *ngIf=\"!_content\"><ng-content></ng-content></mat-drawer-content>",
  30567. styles: [".mat-drawer-container{position:relative;z-index:1;box-sizing:border-box;-webkit-overflow-scrolling:touch;display:block;overflow:hidden}.mat-drawer-container[fullscreen]{top:0;left:0;right:0;bottom:0;position:absolute}.mat-drawer-container[fullscreen].mat-drawer-container-has-open{overflow:hidden}.mat-drawer-container.mat-drawer-container-explicit-backdrop .mat-drawer-side{z-index:3}.mat-drawer-container.ng-animate-disabled .mat-drawer-backdrop,.mat-drawer-container.ng-animate-disabled .mat-drawer-content,.ng-animate-disabled .mat-drawer-container .mat-drawer-backdrop,.ng-animate-disabled .mat-drawer-container .mat-drawer-content{transition:none}.mat-drawer-backdrop{top:0;left:0;right:0;bottom:0;position:absolute;display:block;z-index:3;visibility:hidden}.mat-drawer-backdrop.mat-drawer-shown{visibility:visible}.mat-drawer-transition .mat-drawer-backdrop{transition-duration:.4s;transition-timing-function:cubic-bezier(.25,.8,.25,1);transition-property:background-color,visibility}@media (-ms-high-contrast:active){.mat-drawer-backdrop{opacity:.5}}.mat-drawer-content{position:relative;z-index:1;display:block;height:100%;overflow:auto}.mat-drawer-transition .mat-drawer-content{transition-duration:.4s;transition-timing-function:cubic-bezier(.25,.8,.25,1);transition-property:transform,margin-left,margin-right}.mat-drawer{position:relative;z-index:4;display:block;position:absolute;top:0;bottom:0;z-index:3;outline:0;box-sizing:border-box;overflow-y:auto;transform:translate3d(-100%,0,0)}@media (-ms-high-contrast:active){.mat-drawer,[dir=rtl] .mat-drawer.mat-drawer-end{border-right:solid 1px currentColor}}@media (-ms-high-contrast:active){.mat-drawer.mat-drawer-end,[dir=rtl] .mat-drawer{border-left:solid 1px currentColor;border-right:none}}.mat-drawer.mat-drawer-side{z-index:2}.mat-drawer.mat-drawer-end{right:0;transform:translate3d(100%,0,0)}[dir=rtl] .mat-drawer{transform:translate3d(100%,0,0)}[dir=rtl] .mat-drawer.mat-drawer-end{left:0;right:auto;transform:translate3d(-100%,0,0)}.mat-drawer-inner-container{width:100%;height:100%;overflow:auto;-webkit-overflow-scrolling:touch}.mat-sidenav-fixed{position:fixed}"],
  30568. host: {
  30569. 'class': 'mat-drawer-container',
  30570. '[class.mat-drawer-container-explicit-backdrop]': '_backdropOverride',
  30571. },
  30572. changeDetection: core.ChangeDetectionStrategy.OnPush,
  30573. encapsulation: core.ViewEncapsulation.None,
  30574. },] },
  30575. ];
  30576. /** @nocollapse */
  30577. MatDrawerContainer.ctorParameters = function () { return [
  30578. { type: bidi.Directionality, decorators: [{ type: core.Optional }] },
  30579. { type: core.ElementRef },
  30580. { type: core.NgZone },
  30581. { type: core.ChangeDetectorRef },
  30582. { type: scrolling.ViewportRuler },
  30583. { type: undefined, decorators: [{ type: core.Inject, args: [MAT_DRAWER_DEFAULT_AUTOSIZE,] }] },
  30584. { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
  30585. ]; };
  30586. MatDrawerContainer.propDecorators = {
  30587. _drawers: [{ type: core.ContentChildren, args: [MatDrawer,] }],
  30588. _content: [{ type: core.ContentChild, args: [MatDrawerContent, { static: false },] }],
  30589. _userContent: [{ type: core.ViewChild, args: [MatDrawerContent, { static: false },] }],
  30590. autosize: [{ type: core.Input }],
  30591. hasBackdrop: [{ type: core.Input }],
  30592. backdropClick: [{ type: core.Output }]
  30593. };
  30594. return MatDrawerContainer;
  30595. }());
  30596. /**
  30597. * @fileoverview added by tsickle
  30598. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  30599. */
  30600. var MatSidenavContent = /** @class */ (function (_super) {
  30601. __extends(MatSidenavContent, _super);
  30602. function MatSidenavContent(changeDetectorRef, container, elementRef, scrollDispatcher, ngZone) {
  30603. return _super.call(this, changeDetectorRef, container, elementRef, scrollDispatcher, ngZone) || this;
  30604. }
  30605. MatSidenavContent.decorators = [
  30606. { type: core.Component, args: [{selector: 'mat-sidenav-content',
  30607. template: '<ng-content></ng-content>',
  30608. host: {
  30609. 'class': 'mat-drawer-content mat-sidenav-content',
  30610. '[style.margin-left.px]': '_container._contentMargins.left',
  30611. '[style.margin-right.px]': '_container._contentMargins.right',
  30612. },
  30613. changeDetection: core.ChangeDetectionStrategy.OnPush,
  30614. encapsulation: core.ViewEncapsulation.None,
  30615. },] },
  30616. ];
  30617. /** @nocollapse */
  30618. MatSidenavContent.ctorParameters = function () { return [
  30619. { type: core.ChangeDetectorRef },
  30620. { type: MatSidenavContainer, decorators: [{ type: core.Inject, args: [core.forwardRef((/**
  30621. * @return {?}
  30622. */
  30623. function () { return MatSidenavContainer; })),] }] },
  30624. { type: core.ElementRef },
  30625. { type: scrolling.ScrollDispatcher },
  30626. { type: core.NgZone }
  30627. ]; };
  30628. return MatSidenavContent;
  30629. }(MatDrawerContent));
  30630. var MatSidenav = /** @class */ (function (_super) {
  30631. __extends(MatSidenav, _super);
  30632. function MatSidenav() {
  30633. var _this = _super !== null && _super.apply(this, arguments) || this;
  30634. _this._fixedInViewport = false;
  30635. _this._fixedTopGap = 0;
  30636. _this._fixedBottomGap = 0;
  30637. return _this;
  30638. }
  30639. Object.defineProperty(MatSidenav.prototype, "fixedInViewport", {
  30640. /** Whether the sidenav is fixed in the viewport. */
  30641. get: /**
  30642. * Whether the sidenav is fixed in the viewport.
  30643. * @return {?}
  30644. */
  30645. function () { return this._fixedInViewport; },
  30646. set: /**
  30647. * @param {?} value
  30648. * @return {?}
  30649. */
  30650. function (value) { this._fixedInViewport = coercion.coerceBooleanProperty(value); },
  30651. enumerable: true,
  30652. configurable: true
  30653. });
  30654. Object.defineProperty(MatSidenav.prototype, "fixedTopGap", {
  30655. /**
  30656. * The gap between the top of the sidenav and the top of the viewport when the sidenav is in fixed
  30657. * mode.
  30658. */
  30659. get: /**
  30660. * The gap between the top of the sidenav and the top of the viewport when the sidenav is in fixed
  30661. * mode.
  30662. * @return {?}
  30663. */
  30664. function () { return this._fixedTopGap; },
  30665. set: /**
  30666. * @param {?} value
  30667. * @return {?}
  30668. */
  30669. function (value) { this._fixedTopGap = coercion.coerceNumberProperty(value); },
  30670. enumerable: true,
  30671. configurable: true
  30672. });
  30673. Object.defineProperty(MatSidenav.prototype, "fixedBottomGap", {
  30674. /**
  30675. * The gap between the bottom of the sidenav and the bottom of the viewport when the sidenav is in
  30676. * fixed mode.
  30677. */
  30678. get: /**
  30679. * The gap between the bottom of the sidenav and the bottom of the viewport when the sidenav is in
  30680. * fixed mode.
  30681. * @return {?}
  30682. */
  30683. function () { return this._fixedBottomGap; },
  30684. set: /**
  30685. * @param {?} value
  30686. * @return {?}
  30687. */
  30688. function (value) { this._fixedBottomGap = coercion.coerceNumberProperty(value); },
  30689. enumerable: true,
  30690. configurable: true
  30691. });
  30692. MatSidenav.decorators = [
  30693. { type: core.Component, args: [{selector: 'mat-sidenav',
  30694. exportAs: 'matSidenav',
  30695. template: "<div class=\"mat-drawer-inner-container\"><ng-content></ng-content></div>",
  30696. animations: [matDrawerAnimations.transformDrawer],
  30697. host: {
  30698. 'class': 'mat-drawer mat-sidenav',
  30699. 'tabIndex': '-1',
  30700. // must prevent the browser from aligning text based on value
  30701. '[attr.align]': 'null',
  30702. '[class.mat-drawer-end]': 'position === "end"',
  30703. '[class.mat-drawer-over]': 'mode === "over"',
  30704. '[class.mat-drawer-push]': 'mode === "push"',
  30705. '[class.mat-drawer-side]': 'mode === "side"',
  30706. '[class.mat-drawer-opened]': 'opened',
  30707. '[class.mat-sidenav-fixed]': 'fixedInViewport',
  30708. '[style.top.px]': 'fixedInViewport ? fixedTopGap : null',
  30709. '[style.bottom.px]': 'fixedInViewport ? fixedBottomGap : null',
  30710. },
  30711. changeDetection: core.ChangeDetectionStrategy.OnPush,
  30712. encapsulation: core.ViewEncapsulation.None,
  30713. },] },
  30714. ];
  30715. MatSidenav.propDecorators = {
  30716. fixedInViewport: [{ type: core.Input }],
  30717. fixedTopGap: [{ type: core.Input }],
  30718. fixedBottomGap: [{ type: core.Input }]
  30719. };
  30720. return MatSidenav;
  30721. }(MatDrawer));
  30722. var MatSidenavContainer = /** @class */ (function (_super) {
  30723. __extends(MatSidenavContainer, _super);
  30724. function MatSidenavContainer() {
  30725. return _super !== null && _super.apply(this, arguments) || this;
  30726. }
  30727. MatSidenavContainer.decorators = [
  30728. { type: core.Component, args: [{selector: 'mat-sidenav-container',
  30729. exportAs: 'matSidenavContainer',
  30730. template: "<div class=\"mat-drawer-backdrop\" (click)=\"_onBackdropClicked()\" *ngIf=\"hasBackdrop\" [class.mat-drawer-shown]=\"_isShowingBackdrop()\"></div><ng-content select=\"mat-sidenav\"></ng-content><ng-content select=\"mat-sidenav-content\"></ng-content><mat-sidenav-content *ngIf=\"!_content\" cdkScrollable><ng-content></ng-content></mat-sidenav-content>",
  30731. styles: [".mat-drawer-container{position:relative;z-index:1;box-sizing:border-box;-webkit-overflow-scrolling:touch;display:block;overflow:hidden}.mat-drawer-container[fullscreen]{top:0;left:0;right:0;bottom:0;position:absolute}.mat-drawer-container[fullscreen].mat-drawer-container-has-open{overflow:hidden}.mat-drawer-container.mat-drawer-container-explicit-backdrop .mat-drawer-side{z-index:3}.mat-drawer-container.ng-animate-disabled .mat-drawer-backdrop,.mat-drawer-container.ng-animate-disabled .mat-drawer-content,.ng-animate-disabled .mat-drawer-container .mat-drawer-backdrop,.ng-animate-disabled .mat-drawer-container .mat-drawer-content{transition:none}.mat-drawer-backdrop{top:0;left:0;right:0;bottom:0;position:absolute;display:block;z-index:3;visibility:hidden}.mat-drawer-backdrop.mat-drawer-shown{visibility:visible}.mat-drawer-transition .mat-drawer-backdrop{transition-duration:.4s;transition-timing-function:cubic-bezier(.25,.8,.25,1);transition-property:background-color,visibility}@media (-ms-high-contrast:active){.mat-drawer-backdrop{opacity:.5}}.mat-drawer-content{position:relative;z-index:1;display:block;height:100%;overflow:auto}.mat-drawer-transition .mat-drawer-content{transition-duration:.4s;transition-timing-function:cubic-bezier(.25,.8,.25,1);transition-property:transform,margin-left,margin-right}.mat-drawer{position:relative;z-index:4;display:block;position:absolute;top:0;bottom:0;z-index:3;outline:0;box-sizing:border-box;overflow-y:auto;transform:translate3d(-100%,0,0)}@media (-ms-high-contrast:active){.mat-drawer,[dir=rtl] .mat-drawer.mat-drawer-end{border-right:solid 1px currentColor}}@media (-ms-high-contrast:active){.mat-drawer.mat-drawer-end,[dir=rtl] .mat-drawer{border-left:solid 1px currentColor;border-right:none}}.mat-drawer.mat-drawer-side{z-index:2}.mat-drawer.mat-drawer-end{right:0;transform:translate3d(100%,0,0)}[dir=rtl] .mat-drawer{transform:translate3d(100%,0,0)}[dir=rtl] .mat-drawer.mat-drawer-end{left:0;right:auto;transform:translate3d(-100%,0,0)}.mat-drawer-inner-container{width:100%;height:100%;overflow:auto;-webkit-overflow-scrolling:touch}.mat-sidenav-fixed{position:fixed}"],
  30732. host: {
  30733. 'class': 'mat-drawer-container mat-sidenav-container',
  30734. '[class.mat-drawer-container-explicit-backdrop]': '_backdropOverride',
  30735. },
  30736. changeDetection: core.ChangeDetectionStrategy.OnPush,
  30737. encapsulation: core.ViewEncapsulation.None,
  30738. },] },
  30739. ];
  30740. MatSidenavContainer.propDecorators = {
  30741. _drawers: [{ type: core.ContentChildren, args: [MatSidenav,] }],
  30742. _content: [{ type: core.ContentChild, args: [MatSidenavContent, { static: false },] }]
  30743. };
  30744. return MatSidenavContainer;
  30745. }(MatDrawerContainer));
  30746. /**
  30747. * @fileoverview added by tsickle
  30748. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  30749. */
  30750. var MatSidenavModule = /** @class */ (function () {
  30751. function MatSidenavModule() {
  30752. }
  30753. MatSidenavModule.decorators = [
  30754. { type: core.NgModule, args: [{
  30755. imports: [
  30756. common.CommonModule,
  30757. MatCommonModule,
  30758. scrolling.ScrollingModule,
  30759. platform.PlatformModule,
  30760. ],
  30761. exports: [
  30762. MatCommonModule,
  30763. MatDrawer,
  30764. MatDrawerContainer,
  30765. MatDrawerContent,
  30766. MatSidenav,
  30767. MatSidenavContainer,
  30768. MatSidenavContent,
  30769. ],
  30770. declarations: [
  30771. MatDrawer,
  30772. MatDrawerContainer,
  30773. MatDrawerContent,
  30774. MatSidenav,
  30775. MatSidenavContainer,
  30776. MatSidenavContent,
  30777. ],
  30778. },] },
  30779. ];
  30780. return MatSidenavModule;
  30781. }());
  30782. /**
  30783. * @fileoverview added by tsickle
  30784. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  30785. */
  30786. /**
  30787. * Injection token to be used to override the default options for `mat-slide-toggle`.
  30788. * @type {?}
  30789. */
  30790. var MAT_SLIDE_TOGGLE_DEFAULT_OPTIONS = new core.InjectionToken('mat-slide-toggle-default-options', {
  30791. providedIn: 'root',
  30792. factory: (/**
  30793. * @return {?}
  30794. */
  30795. function () { return ({ disableToggleValue: false, disableDragValue: false }); })
  30796. });
  30797. /**
  30798. * @fileoverview added by tsickle
  30799. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  30800. */
  30801. // Increasing integer for generating unique ids for slide-toggle components.
  30802. /** @type {?} */
  30803. var nextUniqueId$8 = 0;
  30804. /**
  30805. * \@docs-private
  30806. * @type {?}
  30807. */
  30808. var MAT_SLIDE_TOGGLE_VALUE_ACCESSOR = {
  30809. provide: forms.NG_VALUE_ACCESSOR,
  30810. useExisting: core.forwardRef((/**
  30811. * @return {?}
  30812. */
  30813. function () { return MatSlideToggle; })),
  30814. multi: true
  30815. };
  30816. /**
  30817. * Change event object emitted by a MatSlideToggle.
  30818. */
  30819. var /**
  30820. * Change event object emitted by a MatSlideToggle.
  30821. */
  30822. MatSlideToggleChange = /** @class */ (function () {
  30823. function MatSlideToggleChange(source, checked) {
  30824. this.source = source;
  30825. this.checked = checked;
  30826. }
  30827. return MatSlideToggleChange;
  30828. }());
  30829. // Boilerplate for applying mixins to MatSlideToggle.
  30830. /**
  30831. * \@docs-private
  30832. */
  30833. var
  30834. // Boilerplate for applying mixins to MatSlideToggle.
  30835. /**
  30836. * \@docs-private
  30837. */
  30838. MatSlideToggleBase = /** @class */ (function () {
  30839. function MatSlideToggleBase(_elementRef) {
  30840. this._elementRef = _elementRef;
  30841. }
  30842. return MatSlideToggleBase;
  30843. }());
  30844. /** @type {?} */
  30845. var _MatSlideToggleMixinBase = mixinTabIndex(mixinColor(mixinDisableRipple(mixinDisabled(MatSlideToggleBase)), 'accent'));
  30846. /**
  30847. * Represents a slidable "switch" toggle that can be moved between on and off.
  30848. */
  30849. var MatSlideToggle = /** @class */ (function (_super) {
  30850. __extends(MatSlideToggle, _super);
  30851. function MatSlideToggle(elementRef, _focusMonitor, _changeDetectorRef, tabIndex, _ngZone, defaults, _animationMode, _dir) {
  30852. var _this = _super.call(this, elementRef) || this;
  30853. _this._focusMonitor = _focusMonitor;
  30854. _this._changeDetectorRef = _changeDetectorRef;
  30855. _this._ngZone = _ngZone;
  30856. _this.defaults = defaults;
  30857. _this._animationMode = _animationMode;
  30858. _this._dir = _dir;
  30859. _this._onChange = (/**
  30860. * @param {?} _
  30861. * @return {?}
  30862. */
  30863. function (_) { });
  30864. _this._onTouched = (/**
  30865. * @return {?}
  30866. */
  30867. function () { });
  30868. _this._uniqueId = "mat-slide-toggle-" + ++nextUniqueId$8;
  30869. _this._required = false;
  30870. _this._checked = false;
  30871. /**
  30872. * Whether the thumb is currently being dragged.
  30873. */
  30874. _this._dragging = false;
  30875. /**
  30876. * Name value will be applied to the input element if present.
  30877. */
  30878. _this.name = null;
  30879. /**
  30880. * A unique id for the slide-toggle input. If none is supplied, it will be auto-generated.
  30881. */
  30882. _this.id = _this._uniqueId;
  30883. /**
  30884. * Whether the label should appear after or before the slide-toggle. Defaults to 'after'.
  30885. */
  30886. _this.labelPosition = 'after';
  30887. /**
  30888. * Used to set the aria-label attribute on the underlying input element.
  30889. */
  30890. _this.ariaLabel = null;
  30891. /**
  30892. * Used to set the aria-labelledby attribute on the underlying input element.
  30893. */
  30894. _this.ariaLabelledby = null;
  30895. /**
  30896. * An event will be dispatched each time the slide-toggle changes its value.
  30897. */
  30898. _this.change = new core.EventEmitter();
  30899. /**
  30900. * An event will be dispatched each time the slide-toggle input is toggled.
  30901. * This event is always emitted when the user toggles the slide toggle, but this does not mean
  30902. * the slide toggle's value has changed. The event does not fire when the user drags to change
  30903. * the slide toggle value.
  30904. */
  30905. _this.toggleChange = new core.EventEmitter();
  30906. /**
  30907. * An event will be dispatched each time the slide-toggle is dragged.
  30908. * This event is always emitted when the user drags the slide toggle to make a change greater
  30909. * than 50%. It does not mean the slide toggle's value is changed. The event is not emitted when
  30910. * the user toggles the slide toggle to change its value.
  30911. */
  30912. _this.dragChange = new core.EventEmitter();
  30913. _this.tabIndex = parseInt(tabIndex) || 0;
  30914. return _this;
  30915. }
  30916. Object.defineProperty(MatSlideToggle.prototype, "required", {
  30917. /** Whether the slide-toggle is required. */
  30918. get: /**
  30919. * Whether the slide-toggle is required.
  30920. * @return {?}
  30921. */
  30922. function () { return this._required; },
  30923. set: /**
  30924. * @param {?} value
  30925. * @return {?}
  30926. */
  30927. function (value) { this._required = coercion.coerceBooleanProperty(value); },
  30928. enumerable: true,
  30929. configurable: true
  30930. });
  30931. Object.defineProperty(MatSlideToggle.prototype, "checked", {
  30932. /** Whether the slide-toggle element is checked or not. */
  30933. get: /**
  30934. * Whether the slide-toggle element is checked or not.
  30935. * @return {?}
  30936. */
  30937. function () { return this._checked; },
  30938. set: /**
  30939. * @param {?} value
  30940. * @return {?}
  30941. */
  30942. function (value) {
  30943. this._checked = coercion.coerceBooleanProperty(value);
  30944. this._changeDetectorRef.markForCheck();
  30945. },
  30946. enumerable: true,
  30947. configurable: true
  30948. });
  30949. Object.defineProperty(MatSlideToggle.prototype, "inputId", {
  30950. /** Returns the unique id for the visual hidden input. */
  30951. get: /**
  30952. * Returns the unique id for the visual hidden input.
  30953. * @return {?}
  30954. */
  30955. function () { return (this.id || this._uniqueId) + "-input"; },
  30956. enumerable: true,
  30957. configurable: true
  30958. });
  30959. /**
  30960. * @return {?}
  30961. */
  30962. MatSlideToggle.prototype.ngAfterContentInit = /**
  30963. * @return {?}
  30964. */
  30965. function () {
  30966. var _this = this;
  30967. this._focusMonitor
  30968. .monitor(this._elementRef, true)
  30969. .subscribe((/**
  30970. * @param {?} focusOrigin
  30971. * @return {?}
  30972. */
  30973. function (focusOrigin) {
  30974. if (!focusOrigin) {
  30975. // When a focused element becomes disabled, the browser *immediately* fires a blur event.
  30976. // Angular does not expect events to be raised during change detection, so any state
  30977. // change (such as a form control's 'ng-touched') will cause a changed-after-checked
  30978. // error. See https://github.com/angular/angular/issues/17793. To work around this,
  30979. // we defer telling the form control it has been touched until the next tick.
  30980. Promise.resolve().then((/**
  30981. * @return {?}
  30982. */
  30983. function () { return _this._onTouched(); }));
  30984. }
  30985. }));
  30986. };
  30987. /**
  30988. * @return {?}
  30989. */
  30990. MatSlideToggle.prototype.ngOnDestroy = /**
  30991. * @return {?}
  30992. */
  30993. function () {
  30994. this._focusMonitor.stopMonitoring(this._elementRef);
  30995. };
  30996. /** Method being called whenever the underlying input emits a change event. */
  30997. /**
  30998. * Method being called whenever the underlying input emits a change event.
  30999. * @param {?} event
  31000. * @return {?}
  31001. */
  31002. MatSlideToggle.prototype._onChangeEvent = /**
  31003. * Method being called whenever the underlying input emits a change event.
  31004. * @param {?} event
  31005. * @return {?}
  31006. */
  31007. function (event) {
  31008. // We always have to stop propagation on the change event.
  31009. // Otherwise the change event, from the input element, will bubble up and
  31010. // emit its event object to the component's `change` output.
  31011. event.stopPropagation();
  31012. if (!this._dragging) {
  31013. this.toggleChange.emit();
  31014. }
  31015. // Releasing the pointer over the `<label>` element while dragging triggers another
  31016. // click event on the `<label>` element. This means that the checked state of the underlying
  31017. // input changed unintentionally and needs to be changed back. Or when the slide toggle's config
  31018. // disabled toggle change event by setting `disableToggleValue: true`, the slide toggle's value
  31019. // does not change, and the checked state of the underlying input needs to be changed back.
  31020. if (this._dragging || this.defaults.disableToggleValue) {
  31021. this._inputElement.nativeElement.checked = this.checked;
  31022. return;
  31023. }
  31024. // Sync the value from the underlying input element with the component instance.
  31025. this.checked = this._inputElement.nativeElement.checked;
  31026. // Emit our custom change event only if the underlying input emitted one. This ensures that
  31027. // there is no change event, when the checked state changes programmatically.
  31028. this._emitChangeEvent();
  31029. };
  31030. /** Method being called whenever the slide-toggle has been clicked. */
  31031. /**
  31032. * Method being called whenever the slide-toggle has been clicked.
  31033. * @param {?} event
  31034. * @return {?}
  31035. */
  31036. MatSlideToggle.prototype._onInputClick = /**
  31037. * Method being called whenever the slide-toggle has been clicked.
  31038. * @param {?} event
  31039. * @return {?}
  31040. */
  31041. function (event) {
  31042. // We have to stop propagation for click events on the visual hidden input element.
  31043. // By default, when a user clicks on a label element, a generated click event will be
  31044. // dispatched on the associated input element. Since we are using a label element as our
  31045. // root container, the click event on the `slide-toggle` will be executed twice.
  31046. // The real click event will bubble up, and the generated click event also tries to bubble up.
  31047. // This will lead to multiple click events.
  31048. // Preventing bubbling for the second event will solve that issue.
  31049. event.stopPropagation();
  31050. };
  31051. /** Implemented as part of ControlValueAccessor. */
  31052. /**
  31053. * Implemented as part of ControlValueAccessor.
  31054. * @param {?} value
  31055. * @return {?}
  31056. */
  31057. MatSlideToggle.prototype.writeValue = /**
  31058. * Implemented as part of ControlValueAccessor.
  31059. * @param {?} value
  31060. * @return {?}
  31061. */
  31062. function (value) {
  31063. this.checked = !!value;
  31064. };
  31065. /** Implemented as part of ControlValueAccessor. */
  31066. /**
  31067. * Implemented as part of ControlValueAccessor.
  31068. * @param {?} fn
  31069. * @return {?}
  31070. */
  31071. MatSlideToggle.prototype.registerOnChange = /**
  31072. * Implemented as part of ControlValueAccessor.
  31073. * @param {?} fn
  31074. * @return {?}
  31075. */
  31076. function (fn) {
  31077. this._onChange = fn;
  31078. };
  31079. /** Implemented as part of ControlValueAccessor. */
  31080. /**
  31081. * Implemented as part of ControlValueAccessor.
  31082. * @param {?} fn
  31083. * @return {?}
  31084. */
  31085. MatSlideToggle.prototype.registerOnTouched = /**
  31086. * Implemented as part of ControlValueAccessor.
  31087. * @param {?} fn
  31088. * @return {?}
  31089. */
  31090. function (fn) {
  31091. this._onTouched = fn;
  31092. };
  31093. /** Implemented as a part of ControlValueAccessor. */
  31094. /**
  31095. * Implemented as a part of ControlValueAccessor.
  31096. * @param {?} isDisabled
  31097. * @return {?}
  31098. */
  31099. MatSlideToggle.prototype.setDisabledState = /**
  31100. * Implemented as a part of ControlValueAccessor.
  31101. * @param {?} isDisabled
  31102. * @return {?}
  31103. */
  31104. function (isDisabled) {
  31105. this.disabled = isDisabled;
  31106. this._changeDetectorRef.markForCheck();
  31107. };
  31108. /** Focuses the slide-toggle. */
  31109. /**
  31110. * Focuses the slide-toggle.
  31111. * @param {?=} options
  31112. * @return {?}
  31113. */
  31114. MatSlideToggle.prototype.focus = /**
  31115. * Focuses the slide-toggle.
  31116. * @param {?=} options
  31117. * @return {?}
  31118. */
  31119. function (options) {
  31120. this._focusMonitor.focusVia(this._inputElement, 'keyboard', options);
  31121. };
  31122. /** Toggles the checked state of the slide-toggle. */
  31123. /**
  31124. * Toggles the checked state of the slide-toggle.
  31125. * @return {?}
  31126. */
  31127. MatSlideToggle.prototype.toggle = /**
  31128. * Toggles the checked state of the slide-toggle.
  31129. * @return {?}
  31130. */
  31131. function () {
  31132. this.checked = !this.checked;
  31133. this._onChange(this.checked);
  31134. };
  31135. /**
  31136. * Emits a change event on the `change` output. Also notifies the FormControl about the change.
  31137. */
  31138. /**
  31139. * Emits a change event on the `change` output. Also notifies the FormControl about the change.
  31140. * @private
  31141. * @return {?}
  31142. */
  31143. MatSlideToggle.prototype._emitChangeEvent = /**
  31144. * Emits a change event on the `change` output. Also notifies the FormControl about the change.
  31145. * @private
  31146. * @return {?}
  31147. */
  31148. function () {
  31149. this._onChange(this.checked);
  31150. this.change.emit(new MatSlideToggleChange(this, this.checked));
  31151. };
  31152. /** Retrieves the percentage of thumb from the moved distance. Percentage as fraction of 100. */
  31153. /**
  31154. * Retrieves the percentage of thumb from the moved distance. Percentage as fraction of 100.
  31155. * @private
  31156. * @param {?} distance
  31157. * @return {?}
  31158. */
  31159. MatSlideToggle.prototype._getDragPercentage = /**
  31160. * Retrieves the percentage of thumb from the moved distance. Percentage as fraction of 100.
  31161. * @private
  31162. * @param {?} distance
  31163. * @return {?}
  31164. */
  31165. function (distance) {
  31166. /** @type {?} */
  31167. var percentage = (distance / this._thumbBarWidth) * 100;
  31168. // When the toggle was initially checked, then we have to start the drag at the end.
  31169. if (this._previousChecked) {
  31170. percentage += 100;
  31171. }
  31172. return Math.max(0, Math.min(percentage, 100));
  31173. };
  31174. /**
  31175. * @return {?}
  31176. */
  31177. MatSlideToggle.prototype._onDragStart = /**
  31178. * @return {?}
  31179. */
  31180. function () {
  31181. if (!this.disabled && !this._dragging) {
  31182. /** @type {?} */
  31183. var thumbEl = this._thumbEl.nativeElement;
  31184. this._thumbBarWidth = this._thumbBarEl.nativeElement.clientWidth - thumbEl.clientWidth;
  31185. thumbEl.classList.add('mat-dragging');
  31186. this._previousChecked = this.checked;
  31187. this._dragging = true;
  31188. }
  31189. };
  31190. /**
  31191. * @param {?} event
  31192. * @return {?}
  31193. */
  31194. MatSlideToggle.prototype._onDrag = /**
  31195. * @param {?} event
  31196. * @return {?}
  31197. */
  31198. function (event) {
  31199. if (this._dragging) {
  31200. /** @type {?} */
  31201. var direction = this._dir && this._dir.value === 'rtl' ? -1 : 1;
  31202. this._dragPercentage = this._getDragPercentage(event.deltaX * direction);
  31203. // Calculate the moved distance based on the thumb bar width.
  31204. /** @type {?} */
  31205. var dragX = (this._dragPercentage / 100) * this._thumbBarWidth * direction;
  31206. this._thumbEl.nativeElement.style.transform = "translate3d(" + dragX + "px, 0, 0)";
  31207. }
  31208. };
  31209. /**
  31210. * @return {?}
  31211. */
  31212. MatSlideToggle.prototype._onDragEnd = /**
  31213. * @return {?}
  31214. */
  31215. function () {
  31216. var _this = this;
  31217. if (this._dragging) {
  31218. /** @type {?} */
  31219. var newCheckedValue = this._dragPercentage > 50;
  31220. if (newCheckedValue !== this.checked) {
  31221. this.dragChange.emit();
  31222. if (!this.defaults.disableDragValue) {
  31223. this.checked = newCheckedValue;
  31224. this._emitChangeEvent();
  31225. }
  31226. }
  31227. // The drag should be stopped outside of the current event handler, otherwise the
  31228. // click event will be fired before it and will revert the drag change.
  31229. this._ngZone.runOutsideAngular((/**
  31230. * @return {?}
  31231. */
  31232. function () { return setTimeout((/**
  31233. * @return {?}
  31234. */
  31235. function () {
  31236. if (_this._dragging) {
  31237. _this._dragging = false;
  31238. _this._thumbEl.nativeElement.classList.remove('mat-dragging');
  31239. // Reset the transform because the component will take care
  31240. // of the thumb position after drag.
  31241. _this._thumbEl.nativeElement.style.transform = '';
  31242. }
  31243. })); }));
  31244. }
  31245. };
  31246. /** Method being called whenever the label text changes. */
  31247. /**
  31248. * Method being called whenever the label text changes.
  31249. * @return {?}
  31250. */
  31251. MatSlideToggle.prototype._onLabelTextChange = /**
  31252. * Method being called whenever the label text changes.
  31253. * @return {?}
  31254. */
  31255. function () {
  31256. // Since the event of the `cdkObserveContent` directive runs outside of the zone, the
  31257. // slide-toggle component will be only marked for check, but no actual change detection runs
  31258. // automatically. Instead of going back into the zone in order to trigger a change detection
  31259. // which causes *all* components to be checked (if explicitly marked or not using OnPush),
  31260. // we only trigger an explicit change detection for the slide-toggle view and it's children.
  31261. this._changeDetectorRef.detectChanges();
  31262. };
  31263. MatSlideToggle.decorators = [
  31264. { type: core.Component, args: [{selector: 'mat-slide-toggle',
  31265. exportAs: 'matSlideToggle',
  31266. host: {
  31267. 'class': 'mat-slide-toggle',
  31268. '[id]': 'id',
  31269. // Needs to be `-1` so it can still receive programmatic focus.
  31270. '[attr.tabindex]': 'disabled ? null : -1',
  31271. '[class.mat-checked]': 'checked',
  31272. '[class.mat-disabled]': 'disabled',
  31273. '[class.mat-slide-toggle-label-before]': 'labelPosition == "before"',
  31274. '[class._mat-animation-noopable]': '_animationMode === "NoopAnimations"',
  31275. '(focus)': '_inputElement.nativeElement.focus()',
  31276. },
  31277. template: "<label [attr.for]=\"inputId\" class=\"mat-slide-toggle-label\" #label><div #toggleBar class=\"mat-slide-toggle-bar\" [class.mat-slide-toggle-bar-no-side-margin]=\"!labelContent.textContent || !labelContent.textContent.trim()\"><input #input class=\"mat-slide-toggle-input cdk-visually-hidden\" type=\"checkbox\" role=\"switch\" [id]=\"inputId\" [required]=\"required\" [tabIndex]=\"tabIndex\" [checked]=\"checked\" [disabled]=\"disabled\" [attr.name]=\"name\" [attr.aria-checked]=\"checked.toString()\" [attr.aria-label]=\"ariaLabel\" [attr.aria-labelledby]=\"ariaLabelledby\" (change)=\"_onChangeEvent($event)\" (click)=\"_onInputClick($event)\"><div class=\"mat-slide-toggle-thumb-container\" #thumbContainer (slidestart)=\"_onDragStart()\" (slide)=\"_onDrag($event)\" (slideend)=\"_onDragEnd()\"><div class=\"mat-slide-toggle-thumb\"></div><div class=\"mat-slide-toggle-ripple\" mat-ripple [matRippleTrigger]=\"label\" [matRippleDisabled]=\"disableRipple || disabled\" [matRippleCentered]=\"true\" [matRippleRadius]=\"20\" [matRippleAnimation]=\"{enterDuration: 150}\"><div class=\"mat-ripple-element mat-slide-toggle-persistent-ripple\"></div></div></div></div><span class=\"mat-slide-toggle-content\" #labelContent (cdkObserveContent)=\"_onLabelTextChange()\"><span style=\"display:none\">&nbsp;</span><ng-content></ng-content></span></label>",
  31278. styles: [".mat-slide-toggle{display:inline-block;height:24px;max-width:100%;line-height:24px;white-space:nowrap;outline:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}.mat-slide-toggle.mat-checked .mat-slide-toggle-thumb-container{transform:translate3d(16px,0,0)}[dir=rtl] .mat-slide-toggle.mat-checked .mat-slide-toggle-thumb-container{transform:translate3d(-16px,0,0)}.mat-slide-toggle.mat-disabled{opacity:.38}.mat-slide-toggle.mat-disabled .mat-slide-toggle-label,.mat-slide-toggle.mat-disabled .mat-slide-toggle-thumb-container{cursor:default}.mat-slide-toggle-label{display:flex;flex:1;flex-direction:row;align-items:center;height:inherit;cursor:pointer}.mat-slide-toggle-content{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mat-slide-toggle-label-before .mat-slide-toggle-label{order:1}.mat-slide-toggle-label-before .mat-slide-toggle-bar{order:2}.mat-slide-toggle-bar,[dir=rtl] .mat-slide-toggle-label-before .mat-slide-toggle-bar{margin-right:8px;margin-left:0}.mat-slide-toggle-label-before .mat-slide-toggle-bar,[dir=rtl] .mat-slide-toggle-bar{margin-left:8px;margin-right:0}.mat-slide-toggle-bar-no-side-margin{margin-left:0;margin-right:0}.mat-slide-toggle-thumb-container{position:absolute;z-index:1;width:20px;height:20px;top:-3px;left:0;transform:translate3d(0,0,0);transition:all 80ms linear;transition-property:transform;cursor:-webkit-grab;cursor:grab}.mat-slide-toggle-thumb-container.mat-dragging{transition-duration:0s}.mat-slide-toggle-thumb-container:active{cursor:-webkit-grabbing;cursor:grabbing}._mat-animation-noopable .mat-slide-toggle-thumb-container{transition:none}[dir=rtl] .mat-slide-toggle-thumb-container{left:auto;right:0}.mat-slide-toggle-thumb{height:20px;width:20px;border-radius:50%}.mat-slide-toggle-bar{position:relative;width:36px;height:14px;flex-shrink:0;border-radius:8px}.mat-slide-toggle-input{bottom:0;left:10px}[dir=rtl] .mat-slide-toggle-input{left:auto;right:10px}.mat-slide-toggle-bar,.mat-slide-toggle-thumb{transition:all 80ms linear;transition-property:background-color;transition-delay:50ms}._mat-animation-noopable .mat-slide-toggle-bar,._mat-animation-noopable .mat-slide-toggle-thumb{transition:none}.mat-slide-toggle .mat-slide-toggle-ripple{position:absolute;top:calc(50% - 20px);left:calc(50% - 20px);height:40px;width:40px;z-index:1;pointer-events:none}.mat-slide-toggle .mat-slide-toggle-ripple .mat-ripple-element:not(.mat-slide-toggle-persistent-ripple){opacity:.12}.mat-slide-toggle-persistent-ripple{width:100%;height:100%;transform:none}.mat-slide-toggle-bar:hover .mat-slide-toggle-persistent-ripple{opacity:.04}.mat-slide-toggle:not(.mat-disabled).cdk-keyboard-focused .mat-slide-toggle-persistent-ripple{opacity:.12}.mat-slide-toggle-persistent-ripple,.mat-slide-toggle.mat-disabled .mat-slide-toggle-bar:hover .mat-slide-toggle-persistent-ripple{opacity:0}@media (hover:none){.mat-slide-toggle-bar:hover .mat-slide-toggle-persistent-ripple{display:none}}@media (-ms-high-contrast:active){.mat-slide-toggle-thumb{background:#fff;border:1px solid #000}.mat-slide-toggle.mat-checked .mat-slide-toggle-thumb{background:#000;border:1px solid #fff}.mat-slide-toggle-bar{background:#fff}.mat-slide-toggle.cdk-keyboard-focused .mat-slide-toggle-bar{outline:1px dotted;outline-offset:5px}}@media (-ms-high-contrast:black-on-white){.mat-slide-toggle-bar{border:1px solid #000}}"],
  31279. providers: [MAT_SLIDE_TOGGLE_VALUE_ACCESSOR],
  31280. inputs: ['disabled', 'disableRipple', 'color', 'tabIndex'],
  31281. encapsulation: core.ViewEncapsulation.None,
  31282. changeDetection: core.ChangeDetectionStrategy.OnPush,
  31283. },] },
  31284. ];
  31285. /** @nocollapse */
  31286. MatSlideToggle.ctorParameters = function () { return [
  31287. { type: core.ElementRef },
  31288. { type: a11y.FocusMonitor },
  31289. { type: core.ChangeDetectorRef },
  31290. { type: String, decorators: [{ type: core.Attribute, args: ['tabindex',] }] },
  31291. { type: core.NgZone },
  31292. { type: undefined, decorators: [{ type: core.Inject, args: [MAT_SLIDE_TOGGLE_DEFAULT_OPTIONS,] }] },
  31293. { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] },
  31294. { type: bidi.Directionality, decorators: [{ type: core.Optional }] }
  31295. ]; };
  31296. MatSlideToggle.propDecorators = {
  31297. _thumbEl: [{ type: core.ViewChild, args: ['thumbContainer', { static: false },] }],
  31298. _thumbBarEl: [{ type: core.ViewChild, args: ['toggleBar', { static: false },] }],
  31299. name: [{ type: core.Input }],
  31300. id: [{ type: core.Input }],
  31301. labelPosition: [{ type: core.Input }],
  31302. ariaLabel: [{ type: core.Input, args: ['aria-label',] }],
  31303. ariaLabelledby: [{ type: core.Input, args: ['aria-labelledby',] }],
  31304. required: [{ type: core.Input }],
  31305. checked: [{ type: core.Input }],
  31306. change: [{ type: core.Output }],
  31307. toggleChange: [{ type: core.Output }],
  31308. dragChange: [{ type: core.Output }],
  31309. _inputElement: [{ type: core.ViewChild, args: ['input', { static: false },] }]
  31310. };
  31311. return MatSlideToggle;
  31312. }(_MatSlideToggleMixinBase));
  31313. /**
  31314. * @fileoverview added by tsickle
  31315. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  31316. */
  31317. /** @type {?} */
  31318. var MAT_SLIDE_TOGGLE_REQUIRED_VALIDATOR = {
  31319. provide: forms.NG_VALIDATORS,
  31320. useExisting: core.forwardRef((/**
  31321. * @return {?}
  31322. */
  31323. function () { return MatSlideToggleRequiredValidator; })),
  31324. multi: true
  31325. };
  31326. /**
  31327. * Validator for Material slide-toggle components with the required attribute in a
  31328. * template-driven form. The default validator for required form controls asserts
  31329. * that the control value is not undefined but that is not appropriate for a slide-toggle
  31330. * where the value is always defined.
  31331. *
  31332. * Required slide-toggle form controls are valid when checked.
  31333. */
  31334. var MatSlideToggleRequiredValidator = /** @class */ (function (_super) {
  31335. __extends(MatSlideToggleRequiredValidator, _super);
  31336. function MatSlideToggleRequiredValidator() {
  31337. return _super !== null && _super.apply(this, arguments) || this;
  31338. }
  31339. MatSlideToggleRequiredValidator.decorators = [
  31340. { type: core.Directive, args: [{
  31341. selector: "mat-slide-toggle[required][formControlName],\n mat-slide-toggle[required][formControl], mat-slide-toggle[required][ngModel]",
  31342. providers: [MAT_SLIDE_TOGGLE_REQUIRED_VALIDATOR],
  31343. },] },
  31344. ];
  31345. return MatSlideToggleRequiredValidator;
  31346. }(forms.CheckboxRequiredValidator));
  31347. /**
  31348. * @fileoverview added by tsickle
  31349. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  31350. */
  31351. /**
  31352. * This module is used by both original and MDC-based slide-toggle implementations.
  31353. */
  31354. var _MatSlideToggleRequiredValidatorModule = /** @class */ (function () {
  31355. function _MatSlideToggleRequiredValidatorModule() {
  31356. }
  31357. _MatSlideToggleRequiredValidatorModule.decorators = [
  31358. { type: core.NgModule, args: [{
  31359. exports: [MatSlideToggleRequiredValidator],
  31360. declarations: [MatSlideToggleRequiredValidator],
  31361. },] },
  31362. ];
  31363. return _MatSlideToggleRequiredValidatorModule;
  31364. }());
  31365. var MatSlideToggleModule = /** @class */ (function () {
  31366. function MatSlideToggleModule() {
  31367. }
  31368. MatSlideToggleModule.decorators = [
  31369. { type: core.NgModule, args: [{
  31370. imports: [
  31371. _MatSlideToggleRequiredValidatorModule,
  31372. MatRippleModule,
  31373. MatCommonModule,
  31374. observers.ObserversModule,
  31375. ],
  31376. exports: [
  31377. _MatSlideToggleRequiredValidatorModule,
  31378. MatSlideToggle,
  31379. MatCommonModule
  31380. ],
  31381. declarations: [MatSlideToggle],
  31382. providers: [
  31383. { provide: platformBrowser.HAMMER_GESTURE_CONFIG, useClass: GestureConfig }
  31384. ],
  31385. },] },
  31386. ];
  31387. return MatSlideToggleModule;
  31388. }());
  31389. /**
  31390. * @fileoverview added by tsickle
  31391. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  31392. */
  31393. /**
  31394. * Visually, a 30px separation between tick marks looks best. This is very subjective but it is
  31395. * the default separation we chose.
  31396. * @type {?}
  31397. */
  31398. var MIN_AUTO_TICK_SEPARATION = 30;
  31399. /**
  31400. * The thumb gap size for a disabled slider.
  31401. * @type {?}
  31402. */
  31403. var DISABLED_THUMB_GAP = 7;
  31404. /**
  31405. * The thumb gap size for a non-active slider at its minimum value.
  31406. * @type {?}
  31407. */
  31408. var MIN_VALUE_NONACTIVE_THUMB_GAP = 7;
  31409. /**
  31410. * The thumb gap size for an active slider at its minimum value.
  31411. * @type {?}
  31412. */
  31413. var MIN_VALUE_ACTIVE_THUMB_GAP = 10;
  31414. /**
  31415. * Provider Expression that allows mat-slider to register as a ControlValueAccessor.
  31416. * This allows it to support [(ngModel)] and [formControl].
  31417. * \@docs-private
  31418. * @type {?}
  31419. */
  31420. var MAT_SLIDER_VALUE_ACCESSOR = {
  31421. provide: forms.NG_VALUE_ACCESSOR,
  31422. useExisting: core.forwardRef((/**
  31423. * @return {?}
  31424. */
  31425. function () { return MatSlider; })),
  31426. multi: true
  31427. };
  31428. /**
  31429. * A simple change event emitted by the MatSlider component.
  31430. */
  31431. var /**
  31432. * A simple change event emitted by the MatSlider component.
  31433. */
  31434. MatSliderChange = /** @class */ (function () {
  31435. function MatSliderChange() {
  31436. }
  31437. return MatSliderChange;
  31438. }());
  31439. // Boilerplate for applying mixins to MatSlider.
  31440. /**
  31441. * \@docs-private
  31442. */
  31443. var
  31444. // Boilerplate for applying mixins to MatSlider.
  31445. /**
  31446. * \@docs-private
  31447. */
  31448. MatSliderBase = /** @class */ (function () {
  31449. function MatSliderBase(_elementRef) {
  31450. this._elementRef = _elementRef;
  31451. }
  31452. return MatSliderBase;
  31453. }());
  31454. /** @type {?} */
  31455. var _MatSliderMixinBase = mixinTabIndex(mixinColor(mixinDisabled(MatSliderBase), 'accent'));
  31456. /**
  31457. * Allows users to select from a range of values by moving the slider thumb. It is similar in
  31458. * behavior to the native `<input type="range">` element.
  31459. */
  31460. var MatSlider = /** @class */ (function (_super) {
  31461. __extends(MatSlider, _super);
  31462. function MatSlider(elementRef, _focusMonitor, _changeDetectorRef, _dir, tabIndex, _animationMode) {
  31463. var _this = _super.call(this, elementRef) || this;
  31464. _this._focusMonitor = _focusMonitor;
  31465. _this._changeDetectorRef = _changeDetectorRef;
  31466. _this._dir = _dir;
  31467. _this._animationMode = _animationMode;
  31468. _this._invert = false;
  31469. _this._max = 100;
  31470. _this._min = 0;
  31471. _this._step = 1;
  31472. _this._thumbLabel = false;
  31473. _this._tickInterval = 0;
  31474. _this._value = null;
  31475. _this._vertical = false;
  31476. /**
  31477. * Event emitted when the slider value has changed.
  31478. */
  31479. _this.change = new core.EventEmitter();
  31480. /**
  31481. * Event emitted when the slider thumb moves.
  31482. */
  31483. _this.input = new core.EventEmitter();
  31484. /**
  31485. * Emits when the raw value of the slider changes. This is here primarily
  31486. * to facilitate the two-way binding for the `value` input.
  31487. * \@docs-private
  31488. */
  31489. _this.valueChange = new core.EventEmitter();
  31490. /**
  31491. * onTouch function registered via registerOnTouch (ControlValueAccessor).
  31492. */
  31493. _this.onTouched = (/**
  31494. * @return {?}
  31495. */
  31496. function () { });
  31497. _this._percent = 0;
  31498. /**
  31499. * Whether or not the thumb is sliding.
  31500. * Used to determine if there should be a transition for the thumb and fill track.
  31501. */
  31502. _this._isSliding = false;
  31503. /**
  31504. * Whether or not the slider is active (clicked or sliding).
  31505. * Used to shrink and grow the thumb as according to the Material Design spec.
  31506. */
  31507. _this._isActive = false;
  31508. /**
  31509. * The size of a tick interval as a percentage of the size of the track.
  31510. */
  31511. _this._tickIntervalPercent = 0;
  31512. /**
  31513. * The dimensions of the slider.
  31514. */
  31515. _this._sliderDimensions = null;
  31516. _this._controlValueAccessorChangeFn = (/**
  31517. * @return {?}
  31518. */
  31519. function () { });
  31520. /**
  31521. * Subscription to the Directionality change EventEmitter.
  31522. */
  31523. _this._dirChangeSubscription = rxjs.Subscription.EMPTY;
  31524. _this.tabIndex = parseInt(tabIndex) || 0;
  31525. return _this;
  31526. }
  31527. Object.defineProperty(MatSlider.prototype, "invert", {
  31528. /** Whether the slider is inverted. */
  31529. get: /**
  31530. * Whether the slider is inverted.
  31531. * @return {?}
  31532. */
  31533. function () { return this._invert; },
  31534. set: /**
  31535. * @param {?} value
  31536. * @return {?}
  31537. */
  31538. function (value) {
  31539. this._invert = coercion.coerceBooleanProperty(value);
  31540. },
  31541. enumerable: true,
  31542. configurable: true
  31543. });
  31544. Object.defineProperty(MatSlider.prototype, "max", {
  31545. /** The maximum value that the slider can have. */
  31546. get: /**
  31547. * The maximum value that the slider can have.
  31548. * @return {?}
  31549. */
  31550. function () { return this._max; },
  31551. set: /**
  31552. * @param {?} v
  31553. * @return {?}
  31554. */
  31555. function (v) {
  31556. this._max = coercion.coerceNumberProperty(v, this._max);
  31557. this._percent = this._calculatePercentage(this._value);
  31558. // Since this also modifies the percentage, we need to let the change detection know.
  31559. this._changeDetectorRef.markForCheck();
  31560. },
  31561. enumerable: true,
  31562. configurable: true
  31563. });
  31564. Object.defineProperty(MatSlider.prototype, "min", {
  31565. /** The minimum value that the slider can have. */
  31566. get: /**
  31567. * The minimum value that the slider can have.
  31568. * @return {?}
  31569. */
  31570. function () { return this._min; },
  31571. set: /**
  31572. * @param {?} v
  31573. * @return {?}
  31574. */
  31575. function (v) {
  31576. this._min = coercion.coerceNumberProperty(v, this._min);
  31577. // If the value wasn't explicitly set by the user, set it to the min.
  31578. if (this._value === null) {
  31579. this.value = this._min;
  31580. }
  31581. this._percent = this._calculatePercentage(this._value);
  31582. // Since this also modifies the percentage, we need to let the change detection know.
  31583. this._changeDetectorRef.markForCheck();
  31584. },
  31585. enumerable: true,
  31586. configurable: true
  31587. });
  31588. Object.defineProperty(MatSlider.prototype, "step", {
  31589. /** The values at which the thumb will snap. */
  31590. get: /**
  31591. * The values at which the thumb will snap.
  31592. * @return {?}
  31593. */
  31594. function () { return this._step; },
  31595. set: /**
  31596. * @param {?} v
  31597. * @return {?}
  31598. */
  31599. function (v) {
  31600. this._step = coercion.coerceNumberProperty(v, this._step);
  31601. if (this._step % 1 !== 0) {
  31602. this._roundToDecimal = (/** @type {?} */ (this._step.toString().split('.').pop())).length;
  31603. }
  31604. // Since this could modify the label, we need to notify the change detection.
  31605. this._changeDetectorRef.markForCheck();
  31606. },
  31607. enumerable: true,
  31608. configurable: true
  31609. });
  31610. Object.defineProperty(MatSlider.prototype, "thumbLabel", {
  31611. /** Whether or not to show the thumb label. */
  31612. get: /**
  31613. * Whether or not to show the thumb label.
  31614. * @return {?}
  31615. */
  31616. function () { return this._thumbLabel; },
  31617. set: /**
  31618. * @param {?} value
  31619. * @return {?}
  31620. */
  31621. function (value) { this._thumbLabel = coercion.coerceBooleanProperty(value); },
  31622. enumerable: true,
  31623. configurable: true
  31624. });
  31625. Object.defineProperty(MatSlider.prototype, "tickInterval", {
  31626. /**
  31627. * How often to show ticks. Relative to the step so that a tick always appears on a step.
  31628. * Ex: Tick interval of 4 with a step of 3 will draw a tick every 4 steps (every 12 values).
  31629. */
  31630. get: /**
  31631. * How often to show ticks. Relative to the step so that a tick always appears on a step.
  31632. * Ex: Tick interval of 4 with a step of 3 will draw a tick every 4 steps (every 12 values).
  31633. * @return {?}
  31634. */
  31635. function () { return this._tickInterval; },
  31636. set: /**
  31637. * @param {?} value
  31638. * @return {?}
  31639. */
  31640. function (value) {
  31641. if (value === 'auto') {
  31642. this._tickInterval = 'auto';
  31643. }
  31644. else if (typeof value === 'number' || typeof value === 'string') {
  31645. this._tickInterval = coercion.coerceNumberProperty(value, (/** @type {?} */ (this._tickInterval)));
  31646. }
  31647. else {
  31648. this._tickInterval = 0;
  31649. }
  31650. },
  31651. enumerable: true,
  31652. configurable: true
  31653. });
  31654. Object.defineProperty(MatSlider.prototype, "value", {
  31655. /** Value of the slider. */
  31656. get: /**
  31657. * Value of the slider.
  31658. * @return {?}
  31659. */
  31660. function () {
  31661. // If the value needs to be read and it is still uninitialized, initialize it to the min.
  31662. if (this._value === null) {
  31663. this.value = this._min;
  31664. }
  31665. return this._value;
  31666. },
  31667. set: /**
  31668. * @param {?} v
  31669. * @return {?}
  31670. */
  31671. function (v) {
  31672. if (v !== this._value) {
  31673. /** @type {?} */
  31674. var value = coercion.coerceNumberProperty(v);
  31675. // While incrementing by a decimal we can end up with values like 33.300000000000004.
  31676. // Truncate it to ensure that it matches the label and to make it easier to work with.
  31677. if (this._roundToDecimal) {
  31678. value = parseFloat(value.toFixed(this._roundToDecimal));
  31679. }
  31680. this._value = value;
  31681. this._percent = this._calculatePercentage(this._value);
  31682. // Since this also modifies the percentage, we need to let the change detection know.
  31683. this._changeDetectorRef.markForCheck();
  31684. }
  31685. },
  31686. enumerable: true,
  31687. configurable: true
  31688. });
  31689. Object.defineProperty(MatSlider.prototype, "vertical", {
  31690. /** Whether the slider is vertical. */
  31691. get: /**
  31692. * Whether the slider is vertical.
  31693. * @return {?}
  31694. */
  31695. function () { return this._vertical; },
  31696. set: /**
  31697. * @param {?} value
  31698. * @return {?}
  31699. */
  31700. function (value) {
  31701. this._vertical = coercion.coerceBooleanProperty(value);
  31702. },
  31703. enumerable: true,
  31704. configurable: true
  31705. });
  31706. Object.defineProperty(MatSlider.prototype, "displayValue", {
  31707. /** The value to be used for display purposes. */
  31708. get: /**
  31709. * The value to be used for display purposes.
  31710. * @return {?}
  31711. */
  31712. function () {
  31713. if (this.displayWith) {
  31714. return this.displayWith(this.value);
  31715. }
  31716. // Note that this could be improved further by rounding something like 0.999 to 1 or
  31717. // 0.899 to 0.9, however it is very performance sensitive, because it gets called on
  31718. // every change detection cycle.
  31719. if (this._roundToDecimal && this.value && this.value % 1 !== 0) {
  31720. return this.value.toFixed(this._roundToDecimal);
  31721. }
  31722. return this.value || 0;
  31723. },
  31724. enumerable: true,
  31725. configurable: true
  31726. });
  31727. /** set focus to the host element */
  31728. /**
  31729. * set focus to the host element
  31730. * @param {?=} options
  31731. * @return {?}
  31732. */
  31733. MatSlider.prototype.focus = /**
  31734. * set focus to the host element
  31735. * @param {?=} options
  31736. * @return {?}
  31737. */
  31738. function (options) {
  31739. this._focusHostElement(options);
  31740. };
  31741. /** blur the host element */
  31742. /**
  31743. * blur the host element
  31744. * @return {?}
  31745. */
  31746. MatSlider.prototype.blur = /**
  31747. * blur the host element
  31748. * @return {?}
  31749. */
  31750. function () {
  31751. this._blurHostElement();
  31752. };
  31753. Object.defineProperty(MatSlider.prototype, "percent", {
  31754. /** The percentage of the slider that coincides with the value. */
  31755. get: /**
  31756. * The percentage of the slider that coincides with the value.
  31757. * @return {?}
  31758. */
  31759. function () { return this._clamp(this._percent); },
  31760. enumerable: true,
  31761. configurable: true
  31762. });
  31763. Object.defineProperty(MatSlider.prototype, "_invertAxis", {
  31764. /**
  31765. * Whether the axis of the slider is inverted.
  31766. * (i.e. whether moving the thumb in the positive x or y direction decreases the slider's value).
  31767. */
  31768. get: /**
  31769. * Whether the axis of the slider is inverted.
  31770. * (i.e. whether moving the thumb in the positive x or y direction decreases the slider's value).
  31771. * @return {?}
  31772. */
  31773. function () {
  31774. // Standard non-inverted mode for a vertical slider should be dragging the thumb from bottom to
  31775. // top. However from a y-axis standpoint this is inverted.
  31776. return this.vertical ? !this.invert : this.invert;
  31777. },
  31778. enumerable: true,
  31779. configurable: true
  31780. });
  31781. Object.defineProperty(MatSlider.prototype, "_isMinValue", {
  31782. /** Whether the slider is at its minimum value. */
  31783. get: /**
  31784. * Whether the slider is at its minimum value.
  31785. * @return {?}
  31786. */
  31787. function () {
  31788. return this.percent === 0;
  31789. },
  31790. enumerable: true,
  31791. configurable: true
  31792. });
  31793. Object.defineProperty(MatSlider.prototype, "_thumbGap", {
  31794. /**
  31795. * The amount of space to leave between the slider thumb and the track fill & track background
  31796. * elements.
  31797. */
  31798. get: /**
  31799. * The amount of space to leave between the slider thumb and the track fill & track background
  31800. * elements.
  31801. * @return {?}
  31802. */
  31803. function () {
  31804. if (this.disabled) {
  31805. return DISABLED_THUMB_GAP;
  31806. }
  31807. if (this._isMinValue && !this.thumbLabel) {
  31808. return this._isActive ? MIN_VALUE_ACTIVE_THUMB_GAP : MIN_VALUE_NONACTIVE_THUMB_GAP;
  31809. }
  31810. return 0;
  31811. },
  31812. enumerable: true,
  31813. configurable: true
  31814. });
  31815. Object.defineProperty(MatSlider.prototype, "_trackBackgroundStyles", {
  31816. /** CSS styles for the track background element. */
  31817. get: /**
  31818. * CSS styles for the track background element.
  31819. * @return {?}
  31820. */
  31821. function () {
  31822. /** @type {?} */
  31823. var axis = this.vertical ? 'Y' : 'X';
  31824. /** @type {?} */
  31825. var scale = this.vertical ? "1, " + (1 - this.percent) + ", 1" : 1 - this.percent + ", 1, 1";
  31826. /** @type {?} */
  31827. var sign = this._shouldInvertMouseCoords() ? '-' : '';
  31828. return {
  31829. // scale3d avoids some rendering issues in Chrome. See #12071.
  31830. transform: "translate" + axis + "(" + sign + this._thumbGap + "px) scale3d(" + scale + ")"
  31831. };
  31832. },
  31833. enumerable: true,
  31834. configurable: true
  31835. });
  31836. Object.defineProperty(MatSlider.prototype, "_trackFillStyles", {
  31837. /** CSS styles for the track fill element. */
  31838. get: /**
  31839. * CSS styles for the track fill element.
  31840. * @return {?}
  31841. */
  31842. function () {
  31843. /** @type {?} */
  31844. var axis = this.vertical ? 'Y' : 'X';
  31845. /** @type {?} */
  31846. var scale = this.vertical ? "1, " + this.percent + ", 1" : this.percent + ", 1, 1";
  31847. /** @type {?} */
  31848. var sign = this._shouldInvertMouseCoords() ? '' : '-';
  31849. return {
  31850. // scale3d avoids some rendering issues in Chrome. See #12071.
  31851. transform: "translate" + axis + "(" + sign + this._thumbGap + "px) scale3d(" + scale + ")"
  31852. };
  31853. },
  31854. enumerable: true,
  31855. configurable: true
  31856. });
  31857. Object.defineProperty(MatSlider.prototype, "_ticksContainerStyles", {
  31858. /** CSS styles for the ticks container element. */
  31859. get: /**
  31860. * CSS styles for the ticks container element.
  31861. * @return {?}
  31862. */
  31863. function () {
  31864. /** @type {?} */
  31865. var axis = this.vertical ? 'Y' : 'X';
  31866. // For a horizontal slider in RTL languages we push the ticks container off the left edge
  31867. // instead of the right edge to avoid causing a horizontal scrollbar to appear.
  31868. /** @type {?} */
  31869. var sign = !this.vertical && this._getDirection() == 'rtl' ? '' : '-';
  31870. /** @type {?} */
  31871. var offset = this._tickIntervalPercent / 2 * 100;
  31872. return {
  31873. 'transform': "translate" + axis + "(" + sign + offset + "%)"
  31874. };
  31875. },
  31876. enumerable: true,
  31877. configurable: true
  31878. });
  31879. Object.defineProperty(MatSlider.prototype, "_ticksStyles", {
  31880. /** CSS styles for the ticks element. */
  31881. get: /**
  31882. * CSS styles for the ticks element.
  31883. * @return {?}
  31884. */
  31885. function () {
  31886. /** @type {?} */
  31887. var tickSize = this._tickIntervalPercent * 100;
  31888. /** @type {?} */
  31889. var backgroundSize = this.vertical ? "2px " + tickSize + "%" : tickSize + "% 2px";
  31890. /** @type {?} */
  31891. var axis = this.vertical ? 'Y' : 'X';
  31892. // Depending on the direction we pushed the ticks container, push the ticks the opposite
  31893. // direction to re-center them but clip off the end edge. In RTL languages we need to flip the
  31894. // ticks 180 degrees so we're really cutting off the end edge abd not the start.
  31895. /** @type {?} */
  31896. var sign = !this.vertical && this._getDirection() == 'rtl' ? '-' : '';
  31897. /** @type {?} */
  31898. var rotate = !this.vertical && this._getDirection() == 'rtl' ? ' rotate(180deg)' : '';
  31899. /** @type {?} */
  31900. var styles = {
  31901. 'backgroundSize': backgroundSize,
  31902. // Without translateZ ticks sometimes jitter as the slider moves on Chrome & Firefox.
  31903. 'transform': "translateZ(0) translate" + axis + "(" + sign + tickSize / 2 + "%)" + rotate
  31904. };
  31905. if (this._isMinValue && this._thumbGap) {
  31906. /** @type {?} */
  31907. var side = this.vertical ?
  31908. (this._invertAxis ? 'Bottom' : 'Top') :
  31909. (this._invertAxis ? 'Right' : 'Left');
  31910. styles["padding" + side] = this._thumbGap + "px";
  31911. }
  31912. return styles;
  31913. },
  31914. enumerable: true,
  31915. configurable: true
  31916. });
  31917. Object.defineProperty(MatSlider.prototype, "_thumbContainerStyles", {
  31918. get: /**
  31919. * @return {?}
  31920. */
  31921. function () {
  31922. /** @type {?} */
  31923. var axis = this.vertical ? 'Y' : 'X';
  31924. // For a horizontal slider in RTL languages we push the thumb container off the left edge
  31925. // instead of the right edge to avoid causing a horizontal scrollbar to appear.
  31926. /** @type {?} */
  31927. var invertOffset = (this._getDirection() == 'rtl' && !this.vertical) ? !this._invertAxis : this._invertAxis;
  31928. /** @type {?} */
  31929. var offset = (invertOffset ? this.percent : 1 - this.percent) * 100;
  31930. return {
  31931. 'transform': "translate" + axis + "(-" + offset + "%)"
  31932. };
  31933. },
  31934. enumerable: true,
  31935. configurable: true
  31936. });
  31937. /**
  31938. * Whether mouse events should be converted to a slider position by calculating their distance
  31939. * from the right or bottom edge of the slider as opposed to the top or left.
  31940. */
  31941. /**
  31942. * Whether mouse events should be converted to a slider position by calculating their distance
  31943. * from the right or bottom edge of the slider as opposed to the top or left.
  31944. * @private
  31945. * @return {?}
  31946. */
  31947. MatSlider.prototype._shouldInvertMouseCoords = /**
  31948. * Whether mouse events should be converted to a slider position by calculating their distance
  31949. * from the right or bottom edge of the slider as opposed to the top or left.
  31950. * @private
  31951. * @return {?}
  31952. */
  31953. function () {
  31954. return (this._getDirection() == 'rtl' && !this.vertical) ? !this._invertAxis : this._invertAxis;
  31955. };
  31956. /** The language direction for this slider element. */
  31957. /**
  31958. * The language direction for this slider element.
  31959. * @private
  31960. * @return {?}
  31961. */
  31962. MatSlider.prototype._getDirection = /**
  31963. * The language direction for this slider element.
  31964. * @private
  31965. * @return {?}
  31966. */
  31967. function () {
  31968. return (this._dir && this._dir.value == 'rtl') ? 'rtl' : 'ltr';
  31969. };
  31970. /**
  31971. * @return {?}
  31972. */
  31973. MatSlider.prototype.ngOnInit = /**
  31974. * @return {?}
  31975. */
  31976. function () {
  31977. var _this = this;
  31978. this._focusMonitor
  31979. .monitor(this._elementRef, true)
  31980. .subscribe((/**
  31981. * @param {?} origin
  31982. * @return {?}
  31983. */
  31984. function (origin) {
  31985. _this._isActive = !!origin && origin !== 'keyboard';
  31986. _this._changeDetectorRef.detectChanges();
  31987. }));
  31988. if (this._dir) {
  31989. this._dirChangeSubscription = this._dir.change.subscribe((/**
  31990. * @return {?}
  31991. */
  31992. function () {
  31993. _this._changeDetectorRef.markForCheck();
  31994. }));
  31995. }
  31996. };
  31997. /**
  31998. * @return {?}
  31999. */
  32000. MatSlider.prototype.ngOnDestroy = /**
  32001. * @return {?}
  32002. */
  32003. function () {
  32004. this._focusMonitor.stopMonitoring(this._elementRef);
  32005. this._dirChangeSubscription.unsubscribe();
  32006. };
  32007. /**
  32008. * @return {?}
  32009. */
  32010. MatSlider.prototype._onMouseenter = /**
  32011. * @return {?}
  32012. */
  32013. function () {
  32014. if (this.disabled) {
  32015. return;
  32016. }
  32017. // We save the dimensions of the slider here so we can use them to update the spacing of the
  32018. // ticks and determine where on the slider click and slide events happen.
  32019. this._sliderDimensions = this._getSliderDimensions();
  32020. this._updateTickIntervalPercent();
  32021. };
  32022. /**
  32023. * @param {?} event
  32024. * @return {?}
  32025. */
  32026. MatSlider.prototype._onMousedown = /**
  32027. * @param {?} event
  32028. * @return {?}
  32029. */
  32030. function (event) {
  32031. // Don't do anything if the slider is disabled or the
  32032. // user is using anything other than the main mouse button.
  32033. if (this.disabled || event.button !== 0) {
  32034. return;
  32035. }
  32036. /** @type {?} */
  32037. var oldValue = this.value;
  32038. this._isSliding = false;
  32039. this._focusHostElement();
  32040. this._updateValueFromPosition({ x: event.clientX, y: event.clientY });
  32041. // Emit a change and input event if the value changed.
  32042. if (oldValue != this.value) {
  32043. this._emitInputEvent();
  32044. this._emitChangeEvent();
  32045. }
  32046. };
  32047. /**
  32048. * @param {?} event
  32049. * @return {?}
  32050. */
  32051. MatSlider.prototype._onSlide = /**
  32052. * @param {?} event
  32053. * @return {?}
  32054. */
  32055. function (event) {
  32056. if (this.disabled) {
  32057. return;
  32058. }
  32059. // The slide start event sometimes fails to fire on iOS, so if we're not already in the sliding
  32060. // state, call the slide start handler manually.
  32061. if (!this._isSliding) {
  32062. this._onSlideStart(null);
  32063. }
  32064. // Prevent the slide from selecting anything else.
  32065. event.preventDefault();
  32066. /** @type {?} */
  32067. var oldValue = this.value;
  32068. this._updateValueFromPosition({ x: event.center.x, y: event.center.y });
  32069. // Native range elements always emit `input` events when the value changed while sliding.
  32070. if (oldValue != this.value) {
  32071. this._emitInputEvent();
  32072. }
  32073. };
  32074. /**
  32075. * @param {?} event
  32076. * @return {?}
  32077. */
  32078. MatSlider.prototype._onSlideStart = /**
  32079. * @param {?} event
  32080. * @return {?}
  32081. */
  32082. function (event) {
  32083. if (this.disabled || this._isSliding) {
  32084. return;
  32085. }
  32086. // Simulate mouseenter in case this is a mobile device.
  32087. this._onMouseenter();
  32088. this._isSliding = true;
  32089. this._focusHostElement();
  32090. this._valueOnSlideStart = this.value;
  32091. if (event) {
  32092. this._updateValueFromPosition({ x: event.center.x, y: event.center.y });
  32093. event.preventDefault();
  32094. }
  32095. };
  32096. /**
  32097. * @return {?}
  32098. */
  32099. MatSlider.prototype._onSlideEnd = /**
  32100. * @return {?}
  32101. */
  32102. function () {
  32103. this._isSliding = false;
  32104. if (this._valueOnSlideStart != this.value && !this.disabled) {
  32105. this._emitChangeEvent();
  32106. }
  32107. this._valueOnSlideStart = null;
  32108. };
  32109. /**
  32110. * @return {?}
  32111. */
  32112. MatSlider.prototype._onFocus = /**
  32113. * @return {?}
  32114. */
  32115. function () {
  32116. // We save the dimensions of the slider here so we can use them to update the spacing of the
  32117. // ticks and determine where on the slider click and slide events happen.
  32118. this._sliderDimensions = this._getSliderDimensions();
  32119. this._updateTickIntervalPercent();
  32120. };
  32121. /**
  32122. * @return {?}
  32123. */
  32124. MatSlider.prototype._onBlur = /**
  32125. * @return {?}
  32126. */
  32127. function () {
  32128. this.onTouched();
  32129. };
  32130. /**
  32131. * @param {?} event
  32132. * @return {?}
  32133. */
  32134. MatSlider.prototype._onKeydown = /**
  32135. * @param {?} event
  32136. * @return {?}
  32137. */
  32138. function (event) {
  32139. if (this.disabled || keycodes.hasModifierKey(event)) {
  32140. return;
  32141. }
  32142. /** @type {?} */
  32143. var oldValue = this.value;
  32144. switch (event.keyCode) {
  32145. case keycodes.PAGE_UP:
  32146. this._increment(10);
  32147. break;
  32148. case keycodes.PAGE_DOWN:
  32149. this._increment(-10);
  32150. break;
  32151. case keycodes.END:
  32152. this.value = this.max;
  32153. break;
  32154. case keycodes.HOME:
  32155. this.value = this.min;
  32156. break;
  32157. case keycodes.LEFT_ARROW:
  32158. // NOTE: For a sighted user it would make more sense that when they press an arrow key on an
  32159. // inverted slider the thumb moves in that direction. However for a blind user, nothing
  32160. // about the slider indicates that it is inverted. They will expect left to be decrement,
  32161. // regardless of how it appears on the screen. For speakers ofRTL languages, they probably
  32162. // expect left to mean increment. Therefore we flip the meaning of the side arrow keys for
  32163. // RTL. For inverted sliders we prefer a good a11y experience to having it "look right" for
  32164. // sighted users, therefore we do not swap the meaning.
  32165. this._increment(this._getDirection() == 'rtl' ? 1 : -1);
  32166. break;
  32167. case keycodes.UP_ARROW:
  32168. this._increment(1);
  32169. break;
  32170. case keycodes.RIGHT_ARROW:
  32171. // See comment on LEFT_ARROW about the conditions under which we flip the meaning.
  32172. this._increment(this._getDirection() == 'rtl' ? -1 : 1);
  32173. break;
  32174. case keycodes.DOWN_ARROW:
  32175. this._increment(-1);
  32176. break;
  32177. default:
  32178. // Return if the key is not one that we explicitly handle to avoid calling preventDefault on
  32179. // it.
  32180. return;
  32181. }
  32182. if (oldValue != this.value) {
  32183. this._emitInputEvent();
  32184. this._emitChangeEvent();
  32185. }
  32186. this._isSliding = true;
  32187. event.preventDefault();
  32188. };
  32189. /**
  32190. * @return {?}
  32191. */
  32192. MatSlider.prototype._onKeyup = /**
  32193. * @return {?}
  32194. */
  32195. function () {
  32196. this._isSliding = false;
  32197. };
  32198. /** Increments the slider by the given number of steps (negative number decrements). */
  32199. /**
  32200. * Increments the slider by the given number of steps (negative number decrements).
  32201. * @private
  32202. * @param {?} numSteps
  32203. * @return {?}
  32204. */
  32205. MatSlider.prototype._increment = /**
  32206. * Increments the slider by the given number of steps (negative number decrements).
  32207. * @private
  32208. * @param {?} numSteps
  32209. * @return {?}
  32210. */
  32211. function (numSteps) {
  32212. this.value = this._clamp((this.value || 0) + this.step * numSteps, this.min, this.max);
  32213. };
  32214. /** Calculate the new value from the new physical location. The value will always be snapped. */
  32215. /**
  32216. * Calculate the new value from the new physical location. The value will always be snapped.
  32217. * @private
  32218. * @param {?} pos
  32219. * @return {?}
  32220. */
  32221. MatSlider.prototype._updateValueFromPosition = /**
  32222. * Calculate the new value from the new physical location. The value will always be snapped.
  32223. * @private
  32224. * @param {?} pos
  32225. * @return {?}
  32226. */
  32227. function (pos) {
  32228. if (!this._sliderDimensions) {
  32229. return;
  32230. }
  32231. /** @type {?} */
  32232. var offset = this.vertical ? this._sliderDimensions.top : this._sliderDimensions.left;
  32233. /** @type {?} */
  32234. var size = this.vertical ? this._sliderDimensions.height : this._sliderDimensions.width;
  32235. /** @type {?} */
  32236. var posComponent = this.vertical ? pos.y : pos.x;
  32237. // The exact value is calculated from the event and used to find the closest snap value.
  32238. /** @type {?} */
  32239. var percent = this._clamp((posComponent - offset) / size);
  32240. if (this._shouldInvertMouseCoords()) {
  32241. percent = 1 - percent;
  32242. }
  32243. // Since the steps may not divide cleanly into the max value, if the user
  32244. // slid to 0 or 100 percent, we jump to the min/max value. This approach
  32245. // is slightly more intuitive than using `Math.ceil` below, because it
  32246. // follows the user's pointer closer.
  32247. if (percent === 0) {
  32248. this.value = this.min;
  32249. }
  32250. else if (percent === 1) {
  32251. this.value = this.max;
  32252. }
  32253. else {
  32254. /** @type {?} */
  32255. var exactValue = this._calculateValue(percent);
  32256. // This calculation finds the closest step by finding the closest
  32257. // whole number divisible by the step relative to the min.
  32258. /** @type {?} */
  32259. var closestValue = Math.round((exactValue - this.min) / this.step) * this.step + this.min;
  32260. // The value needs to snap to the min and max.
  32261. this.value = this._clamp(closestValue, this.min, this.max);
  32262. }
  32263. };
  32264. /** Emits a change event if the current value is different from the last emitted value. */
  32265. /**
  32266. * Emits a change event if the current value is different from the last emitted value.
  32267. * @private
  32268. * @return {?}
  32269. */
  32270. MatSlider.prototype._emitChangeEvent = /**
  32271. * Emits a change event if the current value is different from the last emitted value.
  32272. * @private
  32273. * @return {?}
  32274. */
  32275. function () {
  32276. this._controlValueAccessorChangeFn(this.value);
  32277. this.valueChange.emit(this.value);
  32278. this.change.emit(this._createChangeEvent());
  32279. };
  32280. /** Emits an input event when the current value is different from the last emitted value. */
  32281. /**
  32282. * Emits an input event when the current value is different from the last emitted value.
  32283. * @private
  32284. * @return {?}
  32285. */
  32286. MatSlider.prototype._emitInputEvent = /**
  32287. * Emits an input event when the current value is different from the last emitted value.
  32288. * @private
  32289. * @return {?}
  32290. */
  32291. function () {
  32292. this.input.emit(this._createChangeEvent());
  32293. };
  32294. /** Updates the amount of space between ticks as a percentage of the width of the slider. */
  32295. /**
  32296. * Updates the amount of space between ticks as a percentage of the width of the slider.
  32297. * @private
  32298. * @return {?}
  32299. */
  32300. MatSlider.prototype._updateTickIntervalPercent = /**
  32301. * Updates the amount of space between ticks as a percentage of the width of the slider.
  32302. * @private
  32303. * @return {?}
  32304. */
  32305. function () {
  32306. if (!this.tickInterval || !this._sliderDimensions) {
  32307. return;
  32308. }
  32309. if (this.tickInterval == 'auto') {
  32310. /** @type {?} */
  32311. var trackSize = this.vertical ? this._sliderDimensions.height : this._sliderDimensions.width;
  32312. /** @type {?} */
  32313. var pixelsPerStep = trackSize * this.step / (this.max - this.min);
  32314. /** @type {?} */
  32315. var stepsPerTick = Math.ceil(MIN_AUTO_TICK_SEPARATION / pixelsPerStep);
  32316. /** @type {?} */
  32317. var pixelsPerTick = stepsPerTick * this.step;
  32318. this._tickIntervalPercent = pixelsPerTick / trackSize;
  32319. }
  32320. else {
  32321. this._tickIntervalPercent = this.tickInterval * this.step / (this.max - this.min);
  32322. }
  32323. };
  32324. /** Creates a slider change object from the specified value. */
  32325. /**
  32326. * Creates a slider change object from the specified value.
  32327. * @private
  32328. * @param {?=} value
  32329. * @return {?}
  32330. */
  32331. MatSlider.prototype._createChangeEvent = /**
  32332. * Creates a slider change object from the specified value.
  32333. * @private
  32334. * @param {?=} value
  32335. * @return {?}
  32336. */
  32337. function (value) {
  32338. if (value === void 0) { value = this.value; }
  32339. /** @type {?} */
  32340. var event = new MatSliderChange();
  32341. event.source = this;
  32342. event.value = value;
  32343. return event;
  32344. };
  32345. /** Calculates the percentage of the slider that a value is. */
  32346. /**
  32347. * Calculates the percentage of the slider that a value is.
  32348. * @private
  32349. * @param {?} value
  32350. * @return {?}
  32351. */
  32352. MatSlider.prototype._calculatePercentage = /**
  32353. * Calculates the percentage of the slider that a value is.
  32354. * @private
  32355. * @param {?} value
  32356. * @return {?}
  32357. */
  32358. function (value) {
  32359. return ((value || 0) - this.min) / (this.max - this.min);
  32360. };
  32361. /** Calculates the value a percentage of the slider corresponds to. */
  32362. /**
  32363. * Calculates the value a percentage of the slider corresponds to.
  32364. * @private
  32365. * @param {?} percentage
  32366. * @return {?}
  32367. */
  32368. MatSlider.prototype._calculateValue = /**
  32369. * Calculates the value a percentage of the slider corresponds to.
  32370. * @private
  32371. * @param {?} percentage
  32372. * @return {?}
  32373. */
  32374. function (percentage) {
  32375. return this.min + percentage * (this.max - this.min);
  32376. };
  32377. /** Return a number between two numbers. */
  32378. /**
  32379. * Return a number between two numbers.
  32380. * @private
  32381. * @param {?} value
  32382. * @param {?=} min
  32383. * @param {?=} max
  32384. * @return {?}
  32385. */
  32386. MatSlider.prototype._clamp = /**
  32387. * Return a number between two numbers.
  32388. * @private
  32389. * @param {?} value
  32390. * @param {?=} min
  32391. * @param {?=} max
  32392. * @return {?}
  32393. */
  32394. function (value, min, max) {
  32395. if (min === void 0) { min = 0; }
  32396. if (max === void 0) { max = 1; }
  32397. return Math.max(min, Math.min(value, max));
  32398. };
  32399. /**
  32400. * Get the bounding client rect of the slider track element.
  32401. * The track is used rather than the native element to ignore the extra space that the thumb can
  32402. * take up.
  32403. */
  32404. /**
  32405. * Get the bounding client rect of the slider track element.
  32406. * The track is used rather than the native element to ignore the extra space that the thumb can
  32407. * take up.
  32408. * @private
  32409. * @return {?}
  32410. */
  32411. MatSlider.prototype._getSliderDimensions = /**
  32412. * Get the bounding client rect of the slider track element.
  32413. * The track is used rather than the native element to ignore the extra space that the thumb can
  32414. * take up.
  32415. * @private
  32416. * @return {?}
  32417. */
  32418. function () {
  32419. return this._sliderWrapper ? this._sliderWrapper.nativeElement.getBoundingClientRect() : null;
  32420. };
  32421. /**
  32422. * Focuses the native element.
  32423. * Currently only used to allow a blur event to fire but will be used with keyboard input later.
  32424. */
  32425. /**
  32426. * Focuses the native element.
  32427. * Currently only used to allow a blur event to fire but will be used with keyboard input later.
  32428. * @private
  32429. * @param {?=} options
  32430. * @return {?}
  32431. */
  32432. MatSlider.prototype._focusHostElement = /**
  32433. * Focuses the native element.
  32434. * Currently only used to allow a blur event to fire but will be used with keyboard input later.
  32435. * @private
  32436. * @param {?=} options
  32437. * @return {?}
  32438. */
  32439. function (options) {
  32440. this._elementRef.nativeElement.focus(options);
  32441. };
  32442. /** Blurs the native element. */
  32443. /**
  32444. * Blurs the native element.
  32445. * @private
  32446. * @return {?}
  32447. */
  32448. MatSlider.prototype._blurHostElement = /**
  32449. * Blurs the native element.
  32450. * @private
  32451. * @return {?}
  32452. */
  32453. function () {
  32454. this._elementRef.nativeElement.blur();
  32455. };
  32456. /**
  32457. * Sets the model value. Implemented as part of ControlValueAccessor.
  32458. * @param value
  32459. */
  32460. /**
  32461. * Sets the model value. Implemented as part of ControlValueAccessor.
  32462. * @param {?} value
  32463. * @return {?}
  32464. */
  32465. MatSlider.prototype.writeValue = /**
  32466. * Sets the model value. Implemented as part of ControlValueAccessor.
  32467. * @param {?} value
  32468. * @return {?}
  32469. */
  32470. function (value) {
  32471. this.value = value;
  32472. };
  32473. /**
  32474. * Registers a callback to be triggered when the value has changed.
  32475. * Implemented as part of ControlValueAccessor.
  32476. * @param fn Callback to be registered.
  32477. */
  32478. /**
  32479. * Registers a callback to be triggered when the value has changed.
  32480. * Implemented as part of ControlValueAccessor.
  32481. * @param {?} fn Callback to be registered.
  32482. * @return {?}
  32483. */
  32484. MatSlider.prototype.registerOnChange = /**
  32485. * Registers a callback to be triggered when the value has changed.
  32486. * Implemented as part of ControlValueAccessor.
  32487. * @param {?} fn Callback to be registered.
  32488. * @return {?}
  32489. */
  32490. function (fn) {
  32491. this._controlValueAccessorChangeFn = fn;
  32492. };
  32493. /**
  32494. * Registers a callback to be triggered when the component is touched.
  32495. * Implemented as part of ControlValueAccessor.
  32496. * @param fn Callback to be registered.
  32497. */
  32498. /**
  32499. * Registers a callback to be triggered when the component is touched.
  32500. * Implemented as part of ControlValueAccessor.
  32501. * @param {?} fn Callback to be registered.
  32502. * @return {?}
  32503. */
  32504. MatSlider.prototype.registerOnTouched = /**
  32505. * Registers a callback to be triggered when the component is touched.
  32506. * Implemented as part of ControlValueAccessor.
  32507. * @param {?} fn Callback to be registered.
  32508. * @return {?}
  32509. */
  32510. function (fn) {
  32511. this.onTouched = fn;
  32512. };
  32513. /**
  32514. * Sets whether the component should be disabled.
  32515. * Implemented as part of ControlValueAccessor.
  32516. * @param isDisabled
  32517. */
  32518. /**
  32519. * Sets whether the component should be disabled.
  32520. * Implemented as part of ControlValueAccessor.
  32521. * @param {?} isDisabled
  32522. * @return {?}
  32523. */
  32524. MatSlider.prototype.setDisabledState = /**
  32525. * Sets whether the component should be disabled.
  32526. * Implemented as part of ControlValueAccessor.
  32527. * @param {?} isDisabled
  32528. * @return {?}
  32529. */
  32530. function (isDisabled) {
  32531. this.disabled = isDisabled;
  32532. };
  32533. MatSlider.decorators = [
  32534. { type: core.Component, args: [{selector: 'mat-slider',
  32535. exportAs: 'matSlider',
  32536. providers: [MAT_SLIDER_VALUE_ACCESSOR],
  32537. host: {
  32538. '(focus)': '_onFocus()',
  32539. '(blur)': '_onBlur()',
  32540. '(mousedown)': '_onMousedown($event)',
  32541. '(keydown)': '_onKeydown($event)',
  32542. '(keyup)': '_onKeyup()',
  32543. '(mouseenter)': '_onMouseenter()',
  32544. '(slide)': '_onSlide($event)',
  32545. '(slideend)': '_onSlideEnd()',
  32546. '(slidestart)': '_onSlideStart($event)',
  32547. // On Safari starting to slide temporarily triggers text selection mode which
  32548. // show the wrong cursor. We prevent it by stopping the `selectstart` event.
  32549. '(selectstart)': '$event.preventDefault()',
  32550. 'class': 'mat-slider',
  32551. 'role': 'slider',
  32552. '[tabIndex]': 'tabIndex',
  32553. '[attr.aria-disabled]': 'disabled',
  32554. '[attr.aria-valuemax]': 'max',
  32555. '[attr.aria-valuemin]': 'min',
  32556. '[attr.aria-valuenow]': 'value',
  32557. '[attr.aria-orientation]': 'vertical ? "vertical" : "horizontal"',
  32558. '[class.mat-slider-disabled]': 'disabled',
  32559. '[class.mat-slider-has-ticks]': 'tickInterval',
  32560. '[class.mat-slider-horizontal]': '!vertical',
  32561. '[class.mat-slider-axis-inverted]': '_invertAxis',
  32562. '[class.mat-slider-sliding]': '_isSliding',
  32563. '[class.mat-slider-thumb-label-showing]': 'thumbLabel',
  32564. '[class.mat-slider-vertical]': 'vertical',
  32565. '[class.mat-slider-min-value]': '_isMinValue',
  32566. '[class.mat-slider-hide-last-tick]': 'disabled || _isMinValue && _thumbGap && _invertAxis',
  32567. '[class._mat-animation-noopable]': '_animationMode === "NoopAnimations"',
  32568. },
  32569. template: "<div class=\"mat-slider-wrapper\" #sliderWrapper><div class=\"mat-slider-track-wrapper\"><div class=\"mat-slider-track-background\" [ngStyle]=\"_trackBackgroundStyles\"></div><div class=\"mat-slider-track-fill\" [ngStyle]=\"_trackFillStyles\"></div></div><div class=\"mat-slider-ticks-container\" [ngStyle]=\"_ticksContainerStyles\"><div class=\"mat-slider-ticks\" [ngStyle]=\"_ticksStyles\"></div></div><div class=\"mat-slider-thumb-container\" [ngStyle]=\"_thumbContainerStyles\"><div class=\"mat-slider-focus-ring\"></div><div class=\"mat-slider-thumb\"></div><div class=\"mat-slider-thumb-label\"><span class=\"mat-slider-thumb-label-text\">{{displayValue}}</span></div></div></div>",
  32570. styles: [".mat-slider{display:inline-block;position:relative;box-sizing:border-box;padding:8px;outline:0;vertical-align:middle}.mat-slider.mat-slider-sliding:not(.mat-slider-disabled),.mat-slider:not(.mat-slider-disabled):active{cursor:-webkit-grabbing;cursor:grabbing}.mat-slider-wrapper{position:absolute}.mat-slider-track-wrapper{position:absolute;top:0;left:0;overflow:hidden}.mat-slider-track-fill{position:absolute;transform-origin:0 0;transition:transform .4s cubic-bezier(.25,.8,.25,1),background-color .4s cubic-bezier(.25,.8,.25,1)}.mat-slider-track-background{position:absolute;transform-origin:100% 100%;transition:transform .4s cubic-bezier(.25,.8,.25,1),background-color .4s cubic-bezier(.25,.8,.25,1)}.mat-slider-ticks-container{position:absolute;left:0;top:0;overflow:hidden}.mat-slider-ticks{background-repeat:repeat;background-clip:content-box;box-sizing:border-box;opacity:0;transition:opacity .4s cubic-bezier(.25,.8,.25,1)}.mat-slider-thumb-container{position:absolute;z-index:1;transition:transform .4s cubic-bezier(.25,.8,.25,1)}.mat-slider-focus-ring{position:absolute;width:30px;height:30px;border-radius:50%;transform:scale(0);opacity:0;transition:transform .4s cubic-bezier(.25,.8,.25,1),background-color .4s cubic-bezier(.25,.8,.25,1),opacity .4s cubic-bezier(.25,.8,.25,1)}.mat-slider.cdk-keyboard-focused .mat-slider-focus-ring,.mat-slider.cdk-program-focused .mat-slider-focus-ring{transform:scale(1);opacity:1}.mat-slider:not(.mat-slider-disabled):not(.mat-slider-sliding) .mat-slider-thumb,.mat-slider:not(.mat-slider-disabled):not(.mat-slider-sliding) .mat-slider-thumb-label{cursor:-webkit-grab;cursor:grab}.mat-slider-thumb{position:absolute;right:-10px;bottom:-10px;box-sizing:border-box;width:20px;height:20px;border:3px solid transparent;border-radius:50%;transform:scale(.7);transition:transform .4s cubic-bezier(.25,.8,.25,1),background-color .4s cubic-bezier(.25,.8,.25,1),border-color .4s cubic-bezier(.25,.8,.25,1)}.mat-slider-thumb-label{display:none;align-items:center;justify-content:center;position:absolute;width:28px;height:28px;border-radius:50%;transition:transform .4s cubic-bezier(.25,.8,.25,1),border-radius .4s cubic-bezier(.25,.8,.25,1),background-color .4s cubic-bezier(.25,.8,.25,1)}@media (-ms-high-contrast:active){.mat-slider-thumb-label{outline:solid 1px}}.mat-slider-thumb-label-text{z-index:1;opacity:0;transition:opacity .4s cubic-bezier(.25,.8,.25,1)}.mat-slider-sliding .mat-slider-thumb-container,.mat-slider-sliding .mat-slider-track-background,.mat-slider-sliding .mat-slider-track-fill{transition-duration:0s}.mat-slider-has-ticks .mat-slider-wrapper::after{content:'';position:absolute;border-width:0;border-style:solid;opacity:0;transition:opacity .4s cubic-bezier(.25,.8,.25,1)}.mat-slider-has-ticks.cdk-focused:not(.mat-slider-hide-last-tick) .mat-slider-wrapper::after,.mat-slider-has-ticks:hover:not(.mat-slider-hide-last-tick) .mat-slider-wrapper::after{opacity:1}.mat-slider-has-ticks.cdk-focused:not(.mat-slider-disabled) .mat-slider-ticks,.mat-slider-has-ticks:hover:not(.mat-slider-disabled) .mat-slider-ticks{opacity:1}.mat-slider-thumb-label-showing .mat-slider-focus-ring{display:none}.mat-slider-thumb-label-showing .mat-slider-thumb-label{display:flex}.mat-slider-axis-inverted .mat-slider-track-fill{transform-origin:100% 100%}.mat-slider-axis-inverted .mat-slider-track-background{transform-origin:0 0}.mat-slider:not(.mat-slider-disabled).cdk-focused.mat-slider-thumb-label-showing .mat-slider-thumb{transform:scale(0)}.mat-slider:not(.mat-slider-disabled).cdk-focused .mat-slider-thumb-label{border-radius:50% 50% 0}.mat-slider:not(.mat-slider-disabled).cdk-focused .mat-slider-thumb-label-text{opacity:1}.mat-slider:not(.mat-slider-disabled).cdk-mouse-focused .mat-slider-thumb,.mat-slider:not(.mat-slider-disabled).cdk-program-focused .mat-slider-thumb,.mat-slider:not(.mat-slider-disabled).cdk-touch-focused .mat-slider-thumb{border-width:2px;transform:scale(1)}.mat-slider-disabled .mat-slider-focus-ring{transform:scale(0);opacity:0}.mat-slider-disabled .mat-slider-thumb{border-width:4px;transform:scale(.5)}.mat-slider-disabled .mat-slider-thumb-label{display:none}.mat-slider-horizontal{height:48px;min-width:128px}.mat-slider-horizontal .mat-slider-wrapper{height:2px;top:23px;left:8px;right:8px}.mat-slider-horizontal .mat-slider-wrapper::after{height:2px;border-left-width:2px;right:0;top:0}.mat-slider-horizontal .mat-slider-track-wrapper{height:2px;width:100%}.mat-slider-horizontal .mat-slider-track-fill{height:2px;width:100%;transform:scaleX(0)}.mat-slider-horizontal .mat-slider-track-background{height:2px;width:100%;transform:scaleX(1)}.mat-slider-horizontal .mat-slider-ticks-container{height:2px;width:100%}@media (-ms-high-contrast:active){.mat-slider-horizontal .mat-slider-ticks-container{height:0;outline:solid 2px;top:1px}}.mat-slider-horizontal .mat-slider-ticks{height:2px;width:100%}.mat-slider-horizontal .mat-slider-thumb-container{width:100%;height:0;top:50%}.mat-slider-horizontal .mat-slider-focus-ring{top:-15px;right:-15px}.mat-slider-horizontal .mat-slider-thumb-label{right:-14px;top:-40px;transform:translateY(26px) scale(.01) rotate(45deg)}.mat-slider-horizontal .mat-slider-thumb-label-text{transform:rotate(-45deg)}.mat-slider-horizontal.cdk-focused .mat-slider-thumb-label{transform:rotate(45deg)}@media (-ms-high-contrast:active){.mat-slider-horizontal.cdk-focused .mat-slider-thumb-label,.mat-slider-horizontal.cdk-focused .mat-slider-thumb-label-text{transform:none}}.mat-slider-vertical{width:48px;min-height:128px}.mat-slider-vertical .mat-slider-wrapper{width:2px;top:8px;bottom:8px;left:23px}.mat-slider-vertical .mat-slider-wrapper::after{width:2px;border-top-width:2px;bottom:0;left:0}.mat-slider-vertical .mat-slider-track-wrapper{height:100%;width:2px}.mat-slider-vertical .mat-slider-track-fill{height:100%;width:2px;transform:scaleY(0)}.mat-slider-vertical .mat-slider-track-background{height:100%;width:2px;transform:scaleY(1)}.mat-slider-vertical .mat-slider-ticks-container{width:2px;height:100%}@media (-ms-high-contrast:active){.mat-slider-vertical .mat-slider-ticks-container{width:0;outline:solid 2px;left:1px}}.mat-slider-vertical .mat-slider-focus-ring{bottom:-15px;left:-15px}.mat-slider-vertical .mat-slider-ticks{width:2px;height:100%}.mat-slider-vertical .mat-slider-thumb-container{height:100%;width:0;left:50%}.mat-slider-vertical .mat-slider-thumb{-webkit-backface-visibility:hidden;backface-visibility:hidden}.mat-slider-vertical .mat-slider-thumb-label{bottom:-14px;left:-40px;transform:translateX(26px) scale(.01) rotate(-45deg)}.mat-slider-vertical .mat-slider-thumb-label-text{transform:rotate(45deg)}.mat-slider-vertical.cdk-focused .mat-slider-thumb-label{transform:rotate(-45deg)}[dir=rtl] .mat-slider-wrapper::after{left:0;right:auto}[dir=rtl] .mat-slider-horizontal .mat-slider-track-fill{transform-origin:100% 100%}[dir=rtl] .mat-slider-horizontal .mat-slider-track-background{transform-origin:0 0}[dir=rtl] .mat-slider-horizontal.mat-slider-axis-inverted .mat-slider-track-fill{transform-origin:0 0}[dir=rtl] .mat-slider-horizontal.mat-slider-axis-inverted .mat-slider-track-background{transform-origin:100% 100%}.mat-slider._mat-animation-noopable .mat-slider-focus-ring,.mat-slider._mat-animation-noopable .mat-slider-has-ticks .mat-slider-wrapper::after,.mat-slider._mat-animation-noopable .mat-slider-thumb,.mat-slider._mat-animation-noopable .mat-slider-thumb-container,.mat-slider._mat-animation-noopable .mat-slider-thumb-label,.mat-slider._mat-animation-noopable .mat-slider-thumb-label-text,.mat-slider._mat-animation-noopable .mat-slider-ticks,.mat-slider._mat-animation-noopable .mat-slider-track-background,.mat-slider._mat-animation-noopable .mat-slider-track-fill{transition:none}"],
  32571. inputs: ['disabled', 'color', 'tabIndex'],
  32572. encapsulation: core.ViewEncapsulation.None,
  32573. changeDetection: core.ChangeDetectionStrategy.OnPush,
  32574. },] },
  32575. ];
  32576. /** @nocollapse */
  32577. MatSlider.ctorParameters = function () { return [
  32578. { type: core.ElementRef },
  32579. { type: a11y.FocusMonitor },
  32580. { type: core.ChangeDetectorRef },
  32581. { type: bidi.Directionality, decorators: [{ type: core.Optional }] },
  32582. { type: String, decorators: [{ type: core.Attribute, args: ['tabindex',] }] },
  32583. { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
  32584. ]; };
  32585. MatSlider.propDecorators = {
  32586. invert: [{ type: core.Input }],
  32587. max: [{ type: core.Input }],
  32588. min: [{ type: core.Input }],
  32589. step: [{ type: core.Input }],
  32590. thumbLabel: [{ type: core.Input }],
  32591. tickInterval: [{ type: core.Input }],
  32592. value: [{ type: core.Input }],
  32593. displayWith: [{ type: core.Input }],
  32594. vertical: [{ type: core.Input }],
  32595. change: [{ type: core.Output }],
  32596. input: [{ type: core.Output }],
  32597. valueChange: [{ type: core.Output }],
  32598. _sliderWrapper: [{ type: core.ViewChild, args: ['sliderWrapper', { static: false },] }]
  32599. };
  32600. return MatSlider;
  32601. }(_MatSliderMixinBase));
  32602. /**
  32603. * @fileoverview added by tsickle
  32604. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  32605. */
  32606. var MatSliderModule = /** @class */ (function () {
  32607. function MatSliderModule() {
  32608. }
  32609. MatSliderModule.decorators = [
  32610. { type: core.NgModule, args: [{
  32611. imports: [common.CommonModule, MatCommonModule],
  32612. exports: [MatSlider, MatCommonModule],
  32613. declarations: [MatSlider],
  32614. providers: [{ provide: platformBrowser.HAMMER_GESTURE_CONFIG, useClass: GestureConfig }]
  32615. },] },
  32616. ];
  32617. return MatSliderModule;
  32618. }());
  32619. /**
  32620. * @fileoverview added by tsickle
  32621. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  32622. */
  32623. /**
  32624. * Reference to a snack bar dispatched from the snack bar service.
  32625. * @template T
  32626. */
  32627. var /**
  32628. * Reference to a snack bar dispatched from the snack bar service.
  32629. * @template T
  32630. */
  32631. MatSnackBarRef = /** @class */ (function () {
  32632. function MatSnackBarRef(containerInstance, _overlayRef) {
  32633. var _this = this;
  32634. this._overlayRef = _overlayRef;
  32635. /**
  32636. * Subject for notifying the user that the snack bar has been dismissed.
  32637. */
  32638. this._afterDismissed = new rxjs.Subject();
  32639. /**
  32640. * Subject for notifying the user that the snack bar has opened and appeared.
  32641. */
  32642. this._afterOpened = new rxjs.Subject();
  32643. /**
  32644. * Subject for notifying the user that the snack bar action was called.
  32645. */
  32646. this._onAction = new rxjs.Subject();
  32647. /**
  32648. * Whether the snack bar was dismissed using the action button.
  32649. */
  32650. this._dismissedByAction = false;
  32651. this.containerInstance = containerInstance;
  32652. // Dismiss snackbar on action.
  32653. this.onAction().subscribe((/**
  32654. * @return {?}
  32655. */
  32656. function () { return _this.dismiss(); }));
  32657. containerInstance._onExit.subscribe((/**
  32658. * @return {?}
  32659. */
  32660. function () { return _this._finishDismiss(); }));
  32661. }
  32662. /** Dismisses the snack bar. */
  32663. /**
  32664. * Dismisses the snack bar.
  32665. * @return {?}
  32666. */
  32667. MatSnackBarRef.prototype.dismiss = /**
  32668. * Dismisses the snack bar.
  32669. * @return {?}
  32670. */
  32671. function () {
  32672. if (!this._afterDismissed.closed) {
  32673. this.containerInstance.exit();
  32674. }
  32675. clearTimeout(this._durationTimeoutId);
  32676. };
  32677. /** Marks the snackbar action clicked. */
  32678. /**
  32679. * Marks the snackbar action clicked.
  32680. * @return {?}
  32681. */
  32682. MatSnackBarRef.prototype.dismissWithAction = /**
  32683. * Marks the snackbar action clicked.
  32684. * @return {?}
  32685. */
  32686. function () {
  32687. if (!this._onAction.closed) {
  32688. this._dismissedByAction = true;
  32689. this._onAction.next();
  32690. this._onAction.complete();
  32691. }
  32692. };
  32693. /**
  32694. * Marks the snackbar action clicked.
  32695. * @deprecated Use `dismissWithAction` instead.
  32696. * @breaking-change 8.0.0
  32697. */
  32698. /**
  32699. * Marks the snackbar action clicked.
  32700. * @deprecated Use `dismissWithAction` instead.
  32701. * \@breaking-change 8.0.0
  32702. * @return {?}
  32703. */
  32704. MatSnackBarRef.prototype.closeWithAction = /**
  32705. * Marks the snackbar action clicked.
  32706. * @deprecated Use `dismissWithAction` instead.
  32707. * \@breaking-change 8.0.0
  32708. * @return {?}
  32709. */
  32710. function () {
  32711. this.dismissWithAction();
  32712. };
  32713. /** Dismisses the snack bar after some duration */
  32714. /**
  32715. * Dismisses the snack bar after some duration
  32716. * @param {?} duration
  32717. * @return {?}
  32718. */
  32719. MatSnackBarRef.prototype._dismissAfter = /**
  32720. * Dismisses the snack bar after some duration
  32721. * @param {?} duration
  32722. * @return {?}
  32723. */
  32724. function (duration) {
  32725. var _this = this;
  32726. this._durationTimeoutId = setTimeout((/**
  32727. * @return {?}
  32728. */
  32729. function () { return _this.dismiss(); }), duration);
  32730. };
  32731. /** Marks the snackbar as opened */
  32732. /**
  32733. * Marks the snackbar as opened
  32734. * @return {?}
  32735. */
  32736. MatSnackBarRef.prototype._open = /**
  32737. * Marks the snackbar as opened
  32738. * @return {?}
  32739. */
  32740. function () {
  32741. if (!this._afterOpened.closed) {
  32742. this._afterOpened.next();
  32743. this._afterOpened.complete();
  32744. }
  32745. };
  32746. /** Cleans up the DOM after closing. */
  32747. /**
  32748. * Cleans up the DOM after closing.
  32749. * @private
  32750. * @return {?}
  32751. */
  32752. MatSnackBarRef.prototype._finishDismiss = /**
  32753. * Cleans up the DOM after closing.
  32754. * @private
  32755. * @return {?}
  32756. */
  32757. function () {
  32758. this._overlayRef.dispose();
  32759. if (!this._onAction.closed) {
  32760. this._onAction.complete();
  32761. }
  32762. this._afterDismissed.next({ dismissedByAction: this._dismissedByAction });
  32763. this._afterDismissed.complete();
  32764. this._dismissedByAction = false;
  32765. };
  32766. /** Gets an observable that is notified when the snack bar is finished closing. */
  32767. /**
  32768. * Gets an observable that is notified when the snack bar is finished closing.
  32769. * @return {?}
  32770. */
  32771. MatSnackBarRef.prototype.afterDismissed = /**
  32772. * Gets an observable that is notified when the snack bar is finished closing.
  32773. * @return {?}
  32774. */
  32775. function () {
  32776. return this._afterDismissed.asObservable();
  32777. };
  32778. /** Gets an observable that is notified when the snack bar has opened and appeared. */
  32779. /**
  32780. * Gets an observable that is notified when the snack bar has opened and appeared.
  32781. * @return {?}
  32782. */
  32783. MatSnackBarRef.prototype.afterOpened = /**
  32784. * Gets an observable that is notified when the snack bar has opened and appeared.
  32785. * @return {?}
  32786. */
  32787. function () {
  32788. return this.containerInstance._onEnter;
  32789. };
  32790. /** Gets an observable that is notified when the snack bar action is called. */
  32791. /**
  32792. * Gets an observable that is notified when the snack bar action is called.
  32793. * @return {?}
  32794. */
  32795. MatSnackBarRef.prototype.onAction = /**
  32796. * Gets an observable that is notified when the snack bar action is called.
  32797. * @return {?}
  32798. */
  32799. function () {
  32800. return this._onAction.asObservable();
  32801. };
  32802. return MatSnackBarRef;
  32803. }());
  32804. /**
  32805. * @fileoverview added by tsickle
  32806. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  32807. */
  32808. /**
  32809. * Injection token that can be used to access the data that was passed in to a snack bar.
  32810. * @type {?}
  32811. */
  32812. var MAT_SNACK_BAR_DATA = new core.InjectionToken('MatSnackBarData');
  32813. /**
  32814. * Configuration used when opening a snack-bar.
  32815. * @template D
  32816. */
  32817. var /**
  32818. * Configuration used when opening a snack-bar.
  32819. * @template D
  32820. */
  32821. MatSnackBarConfig = /** @class */ (function () {
  32822. function MatSnackBarConfig() {
  32823. /**
  32824. * The politeness level for the MatAriaLiveAnnouncer announcement.
  32825. */
  32826. this.politeness = 'assertive';
  32827. /**
  32828. * Message to be announced by the LiveAnnouncer. When opening a snackbar without a custom
  32829. * component or template, the announcement message will default to the specified message.
  32830. */
  32831. this.announcementMessage = '';
  32832. /**
  32833. * The length of time in milliseconds to wait before automatically dismissing the snack bar.
  32834. */
  32835. this.duration = 0;
  32836. /**
  32837. * Data being injected into the child component.
  32838. */
  32839. this.data = null;
  32840. /**
  32841. * The horizontal position to place the snack bar.
  32842. */
  32843. this.horizontalPosition = 'center';
  32844. /**
  32845. * The vertical position to place the snack bar.
  32846. */
  32847. this.verticalPosition = 'bottom';
  32848. }
  32849. return MatSnackBarConfig;
  32850. }());
  32851. /**
  32852. * @fileoverview added by tsickle
  32853. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  32854. */
  32855. /**
  32856. * A component used to open as the default snack bar, matching material spec.
  32857. * This should only be used internally by the snack bar service.
  32858. */
  32859. var SimpleSnackBar = /** @class */ (function () {
  32860. function SimpleSnackBar(snackBarRef, data) {
  32861. this.snackBarRef = snackBarRef;
  32862. this.data = data;
  32863. }
  32864. /** Performs the action on the snack bar. */
  32865. /**
  32866. * Performs the action on the snack bar.
  32867. * @return {?}
  32868. */
  32869. SimpleSnackBar.prototype.action = /**
  32870. * Performs the action on the snack bar.
  32871. * @return {?}
  32872. */
  32873. function () {
  32874. this.snackBarRef.dismissWithAction();
  32875. };
  32876. Object.defineProperty(SimpleSnackBar.prototype, "hasAction", {
  32877. /** If the action button should be shown. */
  32878. get: /**
  32879. * If the action button should be shown.
  32880. * @return {?}
  32881. */
  32882. function () {
  32883. return !!this.data.action;
  32884. },
  32885. enumerable: true,
  32886. configurable: true
  32887. });
  32888. SimpleSnackBar.decorators = [
  32889. { type: core.Component, args: [{selector: 'simple-snack-bar',
  32890. template: "<span>{{data.message}}</span><div class=\"mat-simple-snackbar-action\" *ngIf=\"hasAction\"><button mat-button (click)=\"action()\">{{data.action}}</button></div>",
  32891. styles: [".mat-simple-snackbar{display:flex;justify-content:space-between;align-items:center;height:100%;line-height:20px;opacity:1}.mat-simple-snackbar-action{flex-shrink:0;margin:-8px -8px -8px 8px}.mat-simple-snackbar-action button{max-height:36px;min-width:0}[dir=rtl] .mat-simple-snackbar-action{margin-left:-8px;margin-right:8px}"],
  32892. encapsulation: core.ViewEncapsulation.None,
  32893. changeDetection: core.ChangeDetectionStrategy.OnPush,
  32894. host: {
  32895. 'class': 'mat-simple-snackbar',
  32896. }
  32897. },] },
  32898. ];
  32899. /** @nocollapse */
  32900. SimpleSnackBar.ctorParameters = function () { return [
  32901. { type: MatSnackBarRef },
  32902. { type: undefined, decorators: [{ type: core.Inject, args: [MAT_SNACK_BAR_DATA,] }] }
  32903. ]; };
  32904. return SimpleSnackBar;
  32905. }());
  32906. /**
  32907. * @fileoverview added by tsickle
  32908. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  32909. */
  32910. /**
  32911. * Animations used by the Material snack bar.
  32912. * \@docs-private
  32913. * @type {?}
  32914. */
  32915. var matSnackBarAnimations = {
  32916. /**
  32917. * Animation that shows and hides a snack bar.
  32918. */
  32919. snackBarState: animations$1.trigger('state', [
  32920. animations$1.state('void, hidden', animations$1.style({
  32921. transform: 'scale(0.8)',
  32922. opacity: 0,
  32923. })),
  32924. animations$1.state('visible', animations$1.style({
  32925. transform: 'scale(1)',
  32926. opacity: 1,
  32927. })),
  32928. animations$1.transition('* => visible', animations$1.animate('150ms cubic-bezier(0, 0, 0.2, 1)')),
  32929. animations$1.transition('* => void, * => hidden', animations$1.animate('75ms cubic-bezier(0.4, 0.0, 1, 1)', animations$1.style({
  32930. opacity: 0
  32931. }))),
  32932. ])
  32933. };
  32934. /**
  32935. * @fileoverview added by tsickle
  32936. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  32937. */
  32938. /**
  32939. * Internal component that wraps user-provided snack bar content.
  32940. * \@docs-private
  32941. */
  32942. var MatSnackBarContainer = /** @class */ (function (_super) {
  32943. __extends(MatSnackBarContainer, _super);
  32944. function MatSnackBarContainer(_ngZone, _elementRef, _changeDetectorRef, snackBarConfig) {
  32945. var _this = _super.call(this) || this;
  32946. _this._ngZone = _ngZone;
  32947. _this._elementRef = _elementRef;
  32948. _this._changeDetectorRef = _changeDetectorRef;
  32949. _this.snackBarConfig = snackBarConfig;
  32950. /**
  32951. * Whether the component has been destroyed.
  32952. */
  32953. _this._destroyed = false;
  32954. /**
  32955. * Subject for notifying that the snack bar has exited from view.
  32956. */
  32957. _this._onExit = new rxjs.Subject();
  32958. /**
  32959. * Subject for notifying that the snack bar has finished entering the view.
  32960. */
  32961. _this._onEnter = new rxjs.Subject();
  32962. /**
  32963. * The state of the snack bar animations.
  32964. */
  32965. _this._animationState = 'void';
  32966. // Based on the ARIA spec, `alert` and `status` roles have an
  32967. // implicit `assertive` and `polite` politeness respectively.
  32968. if (snackBarConfig.politeness === 'assertive' && !snackBarConfig.announcementMessage) {
  32969. _this._role = 'alert';
  32970. }
  32971. else if (snackBarConfig.politeness === 'off') {
  32972. _this._role = null;
  32973. }
  32974. else {
  32975. _this._role = 'status';
  32976. }
  32977. return _this;
  32978. }
  32979. /** Attach a component portal as content to this snack bar container. */
  32980. /**
  32981. * Attach a component portal as content to this snack bar container.
  32982. * @template T
  32983. * @param {?} portal
  32984. * @return {?}
  32985. */
  32986. MatSnackBarContainer.prototype.attachComponentPortal = /**
  32987. * Attach a component portal as content to this snack bar container.
  32988. * @template T
  32989. * @param {?} portal
  32990. * @return {?}
  32991. */
  32992. function (portal$$1) {
  32993. this._assertNotAttached();
  32994. this._applySnackBarClasses();
  32995. return this._portalOutlet.attachComponentPortal(portal$$1);
  32996. };
  32997. /** Attach a template portal as content to this snack bar container. */
  32998. /**
  32999. * Attach a template portal as content to this snack bar container.
  33000. * @template C
  33001. * @param {?} portal
  33002. * @return {?}
  33003. */
  33004. MatSnackBarContainer.prototype.attachTemplatePortal = /**
  33005. * Attach a template portal as content to this snack bar container.
  33006. * @template C
  33007. * @param {?} portal
  33008. * @return {?}
  33009. */
  33010. function (portal$$1) {
  33011. this._assertNotAttached();
  33012. this._applySnackBarClasses();
  33013. return this._portalOutlet.attachTemplatePortal(portal$$1);
  33014. };
  33015. /** Handle end of animations, updating the state of the snackbar. */
  33016. /**
  33017. * Handle end of animations, updating the state of the snackbar.
  33018. * @param {?} event
  33019. * @return {?}
  33020. */
  33021. MatSnackBarContainer.prototype.onAnimationEnd = /**
  33022. * Handle end of animations, updating the state of the snackbar.
  33023. * @param {?} event
  33024. * @return {?}
  33025. */
  33026. function (event) {
  33027. var fromState = event.fromState, toState = event.toState;
  33028. if ((toState === 'void' && fromState !== 'void') || toState === 'hidden') {
  33029. this._completeExit();
  33030. }
  33031. if (toState === 'visible') {
  33032. // Note: we shouldn't use `this` inside the zone callback,
  33033. // because it can cause a memory leak.
  33034. /** @type {?} */
  33035. var onEnter_1 = this._onEnter;
  33036. this._ngZone.run((/**
  33037. * @return {?}
  33038. */
  33039. function () {
  33040. onEnter_1.next();
  33041. onEnter_1.complete();
  33042. }));
  33043. }
  33044. };
  33045. /** Begin animation of snack bar entrance into view. */
  33046. /**
  33047. * Begin animation of snack bar entrance into view.
  33048. * @return {?}
  33049. */
  33050. MatSnackBarContainer.prototype.enter = /**
  33051. * Begin animation of snack bar entrance into view.
  33052. * @return {?}
  33053. */
  33054. function () {
  33055. if (!this._destroyed) {
  33056. this._animationState = 'visible';
  33057. this._changeDetectorRef.detectChanges();
  33058. }
  33059. };
  33060. /** Begin animation of the snack bar exiting from view. */
  33061. /**
  33062. * Begin animation of the snack bar exiting from view.
  33063. * @return {?}
  33064. */
  33065. MatSnackBarContainer.prototype.exit = /**
  33066. * Begin animation of the snack bar exiting from view.
  33067. * @return {?}
  33068. */
  33069. function () {
  33070. // Note: this one transitions to `hidden`, rather than `void`, in order to handle the case
  33071. // where multiple snack bars are opened in quick succession (e.g. two consecutive calls to
  33072. // `MatSnackBar.open`).
  33073. this._animationState = 'hidden';
  33074. return this._onExit;
  33075. };
  33076. /** Makes sure the exit callbacks have been invoked when the element is destroyed. */
  33077. /**
  33078. * Makes sure the exit callbacks have been invoked when the element is destroyed.
  33079. * @return {?}
  33080. */
  33081. MatSnackBarContainer.prototype.ngOnDestroy = /**
  33082. * Makes sure the exit callbacks have been invoked when the element is destroyed.
  33083. * @return {?}
  33084. */
  33085. function () {
  33086. this._destroyed = true;
  33087. this._completeExit();
  33088. };
  33089. /**
  33090. * Waits for the zone to settle before removing the element. Helps prevent
  33091. * errors where we end up removing an element which is in the middle of an animation.
  33092. */
  33093. /**
  33094. * Waits for the zone to settle before removing the element. Helps prevent
  33095. * errors where we end up removing an element which is in the middle of an animation.
  33096. * @private
  33097. * @return {?}
  33098. */
  33099. MatSnackBarContainer.prototype._completeExit = /**
  33100. * Waits for the zone to settle before removing the element. Helps prevent
  33101. * errors where we end up removing an element which is in the middle of an animation.
  33102. * @private
  33103. * @return {?}
  33104. */
  33105. function () {
  33106. var _this = this;
  33107. this._ngZone.onMicrotaskEmpty.asObservable().pipe(operators.take(1)).subscribe((/**
  33108. * @return {?}
  33109. */
  33110. function () {
  33111. _this._onExit.next();
  33112. _this._onExit.complete();
  33113. }));
  33114. };
  33115. /** Applies the various positioning and user-configured CSS classes to the snack bar. */
  33116. /**
  33117. * Applies the various positioning and user-configured CSS classes to the snack bar.
  33118. * @private
  33119. * @return {?}
  33120. */
  33121. MatSnackBarContainer.prototype._applySnackBarClasses = /**
  33122. * Applies the various positioning and user-configured CSS classes to the snack bar.
  33123. * @private
  33124. * @return {?}
  33125. */
  33126. function () {
  33127. /** @type {?} */
  33128. var element = this._elementRef.nativeElement;
  33129. /** @type {?} */
  33130. var panelClasses = this.snackBarConfig.panelClass;
  33131. if (panelClasses) {
  33132. if (Array.isArray(panelClasses)) {
  33133. // Note that we can't use a spread here, because IE doesn't support multiple arguments.
  33134. panelClasses.forEach((/**
  33135. * @param {?} cssClass
  33136. * @return {?}
  33137. */
  33138. function (cssClass) { return element.classList.add(cssClass); }));
  33139. }
  33140. else {
  33141. element.classList.add(panelClasses);
  33142. }
  33143. }
  33144. if (this.snackBarConfig.horizontalPosition === 'center') {
  33145. element.classList.add('mat-snack-bar-center');
  33146. }
  33147. if (this.snackBarConfig.verticalPosition === 'top') {
  33148. element.classList.add('mat-snack-bar-top');
  33149. }
  33150. };
  33151. /** Asserts that no content is already attached to the container. */
  33152. /**
  33153. * Asserts that no content is already attached to the container.
  33154. * @private
  33155. * @return {?}
  33156. */
  33157. MatSnackBarContainer.prototype._assertNotAttached = /**
  33158. * Asserts that no content is already attached to the container.
  33159. * @private
  33160. * @return {?}
  33161. */
  33162. function () {
  33163. if (this._portalOutlet.hasAttached()) {
  33164. throw Error('Attempting to attach snack bar content after content is already attached');
  33165. }
  33166. };
  33167. MatSnackBarContainer.decorators = [
  33168. { type: core.Component, args: [{selector: 'snack-bar-container',
  33169. template: "<ng-template cdkPortalOutlet></ng-template>",
  33170. styles: [".mat-snack-bar-container{border-radius:4px;box-sizing:border-box;display:block;margin:24px;max-width:33vw;min-width:344px;padding:14px 16px;min-height:48px;transform-origin:center}@media (-ms-high-contrast:active){.mat-snack-bar-container{border:solid 1px}}.mat-snack-bar-handset{width:100%}.mat-snack-bar-handset .mat-snack-bar-container{margin:8px;max-width:100%;min-width:0;width:100%}"],
  33171. // In Ivy embedded views will be change detected from their declaration place, rather than
  33172. // where they were stamped out. This means that we can't have the snack bar container be OnPush,
  33173. // because it might cause snack bars that were opened from a template not to be out of date.
  33174. // tslint:disable-next-line:validate-decorators
  33175. changeDetection: core.ChangeDetectionStrategy.Default,
  33176. encapsulation: core.ViewEncapsulation.None,
  33177. animations: [matSnackBarAnimations.snackBarState],
  33178. host: {
  33179. '[attr.role]': '_role',
  33180. 'class': 'mat-snack-bar-container',
  33181. '[@state]': '_animationState',
  33182. '(@state.done)': 'onAnimationEnd($event)'
  33183. },
  33184. },] },
  33185. ];
  33186. /** @nocollapse */
  33187. MatSnackBarContainer.ctorParameters = function () { return [
  33188. { type: core.NgZone },
  33189. { type: core.ElementRef },
  33190. { type: core.ChangeDetectorRef },
  33191. { type: MatSnackBarConfig }
  33192. ]; };
  33193. MatSnackBarContainer.propDecorators = {
  33194. _portalOutlet: [{ type: core.ViewChild, args: [portal.CdkPortalOutlet, { static: true },] }]
  33195. };
  33196. return MatSnackBarContainer;
  33197. }(portal.BasePortalOutlet));
  33198. /**
  33199. * @fileoverview added by tsickle
  33200. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  33201. */
  33202. var MatSnackBarModule = /** @class */ (function () {
  33203. function MatSnackBarModule() {
  33204. }
  33205. MatSnackBarModule.decorators = [
  33206. { type: core.NgModule, args: [{
  33207. imports: [
  33208. overlay.OverlayModule,
  33209. portal.PortalModule,
  33210. common.CommonModule,
  33211. MatButtonModule,
  33212. MatCommonModule,
  33213. ],
  33214. exports: [MatSnackBarContainer, MatCommonModule],
  33215. declarations: [MatSnackBarContainer, SimpleSnackBar],
  33216. entryComponents: [MatSnackBarContainer, SimpleSnackBar],
  33217. },] },
  33218. ];
  33219. return MatSnackBarModule;
  33220. }());
  33221. /**
  33222. * @fileoverview added by tsickle
  33223. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  33224. */
  33225. /**
  33226. * Injection token that can be used to specify default snack bar.
  33227. * @type {?}
  33228. */
  33229. var MAT_SNACK_BAR_DEFAULT_OPTIONS = new core.InjectionToken('mat-snack-bar-default-options', {
  33230. providedIn: 'root',
  33231. factory: MAT_SNACK_BAR_DEFAULT_OPTIONS_FACTORY,
  33232. });
  33233. /**
  33234. * \@docs-private
  33235. * @return {?}
  33236. */
  33237. function MAT_SNACK_BAR_DEFAULT_OPTIONS_FACTORY() {
  33238. return new MatSnackBarConfig();
  33239. }
  33240. /**
  33241. * Service to dispatch Material Design snack bar messages.
  33242. */
  33243. var MatSnackBar = /** @class */ (function () {
  33244. function MatSnackBar(_overlay, _live, _injector, _breakpointObserver, _parentSnackBar, _defaultConfig) {
  33245. this._overlay = _overlay;
  33246. this._live = _live;
  33247. this._injector = _injector;
  33248. this._breakpointObserver = _breakpointObserver;
  33249. this._parentSnackBar = _parentSnackBar;
  33250. this._defaultConfig = _defaultConfig;
  33251. /**
  33252. * Reference to the current snack bar in the view *at this level* (in the Angular injector tree).
  33253. * If there is a parent snack-bar service, all operations should delegate to that parent
  33254. * via `_openedSnackBarRef`.
  33255. */
  33256. this._snackBarRefAtThisLevel = null;
  33257. }
  33258. Object.defineProperty(MatSnackBar.prototype, "_openedSnackBarRef", {
  33259. /** Reference to the currently opened snackbar at *any* level. */
  33260. get: /**
  33261. * Reference to the currently opened snackbar at *any* level.
  33262. * @return {?}
  33263. */
  33264. function () {
  33265. /** @type {?} */
  33266. var parent = this._parentSnackBar;
  33267. return parent ? parent._openedSnackBarRef : this._snackBarRefAtThisLevel;
  33268. },
  33269. set: /**
  33270. * @param {?} value
  33271. * @return {?}
  33272. */
  33273. function (value) {
  33274. if (this._parentSnackBar) {
  33275. this._parentSnackBar._openedSnackBarRef = value;
  33276. }
  33277. else {
  33278. this._snackBarRefAtThisLevel = value;
  33279. }
  33280. },
  33281. enumerable: true,
  33282. configurable: true
  33283. });
  33284. /**
  33285. * Creates and dispatches a snack bar with a custom component for the content, removing any
  33286. * currently opened snack bars.
  33287. *
  33288. * @param component Component to be instantiated.
  33289. * @param config Extra configuration for the snack bar.
  33290. */
  33291. /**
  33292. * Creates and dispatches a snack bar with a custom component for the content, removing any
  33293. * currently opened snack bars.
  33294. *
  33295. * @template T
  33296. * @param {?} component Component to be instantiated.
  33297. * @param {?=} config Extra configuration for the snack bar.
  33298. * @return {?}
  33299. */
  33300. MatSnackBar.prototype.openFromComponent = /**
  33301. * Creates and dispatches a snack bar with a custom component for the content, removing any
  33302. * currently opened snack bars.
  33303. *
  33304. * @template T
  33305. * @param {?} component Component to be instantiated.
  33306. * @param {?=} config Extra configuration for the snack bar.
  33307. * @return {?}
  33308. */
  33309. function (component, config) {
  33310. return (/** @type {?} */ (this._attach(component, config)));
  33311. };
  33312. /**
  33313. * Creates and dispatches a snack bar with a custom template for the content, removing any
  33314. * currently opened snack bars.
  33315. *
  33316. * @param template Template to be instantiated.
  33317. * @param config Extra configuration for the snack bar.
  33318. */
  33319. /**
  33320. * Creates and dispatches a snack bar with a custom template for the content, removing any
  33321. * currently opened snack bars.
  33322. *
  33323. * @param {?} template Template to be instantiated.
  33324. * @param {?=} config Extra configuration for the snack bar.
  33325. * @return {?}
  33326. */
  33327. MatSnackBar.prototype.openFromTemplate = /**
  33328. * Creates and dispatches a snack bar with a custom template for the content, removing any
  33329. * currently opened snack bars.
  33330. *
  33331. * @param {?} template Template to be instantiated.
  33332. * @param {?=} config Extra configuration for the snack bar.
  33333. * @return {?}
  33334. */
  33335. function (template, config) {
  33336. return this._attach(template, config);
  33337. };
  33338. /**
  33339. * Opens a snackbar with a message and an optional action.
  33340. * @param message The message to show in the snackbar.
  33341. * @param action The label for the snackbar action.
  33342. * @param config Additional configuration options for the snackbar.
  33343. */
  33344. /**
  33345. * Opens a snackbar with a message and an optional action.
  33346. * @param {?} message The message to show in the snackbar.
  33347. * @param {?=} action The label for the snackbar action.
  33348. * @param {?=} config Additional configuration options for the snackbar.
  33349. * @return {?}
  33350. */
  33351. MatSnackBar.prototype.open = /**
  33352. * Opens a snackbar with a message and an optional action.
  33353. * @param {?} message The message to show in the snackbar.
  33354. * @param {?=} action The label for the snackbar action.
  33355. * @param {?=} config Additional configuration options for the snackbar.
  33356. * @return {?}
  33357. */
  33358. function (message, action, config) {
  33359. if (action === void 0) { action = ''; }
  33360. /** @type {?} */
  33361. var _config = __assign({}, this._defaultConfig, config);
  33362. // Since the user doesn't have access to the component, we can
  33363. // override the data to pass in our own message and action.
  33364. _config.data = { message: message, action: action };
  33365. if (!_config.announcementMessage) {
  33366. _config.announcementMessage = message;
  33367. }
  33368. return this.openFromComponent(SimpleSnackBar, _config);
  33369. };
  33370. /**
  33371. * Dismisses the currently-visible snack bar.
  33372. */
  33373. /**
  33374. * Dismisses the currently-visible snack bar.
  33375. * @return {?}
  33376. */
  33377. MatSnackBar.prototype.dismiss = /**
  33378. * Dismisses the currently-visible snack bar.
  33379. * @return {?}
  33380. */
  33381. function () {
  33382. if (this._openedSnackBarRef) {
  33383. this._openedSnackBarRef.dismiss();
  33384. }
  33385. };
  33386. /**
  33387. * @return {?}
  33388. */
  33389. MatSnackBar.prototype.ngOnDestroy = /**
  33390. * @return {?}
  33391. */
  33392. function () {
  33393. // Only dismiss the snack bar at the current level on destroy.
  33394. if (this._snackBarRefAtThisLevel) {
  33395. this._snackBarRefAtThisLevel.dismiss();
  33396. }
  33397. };
  33398. /**
  33399. * Attaches the snack bar container component to the overlay.
  33400. */
  33401. /**
  33402. * Attaches the snack bar container component to the overlay.
  33403. * @private
  33404. * @param {?} overlayRef
  33405. * @param {?} config
  33406. * @return {?}
  33407. */
  33408. MatSnackBar.prototype._attachSnackBarContainer = /**
  33409. * Attaches the snack bar container component to the overlay.
  33410. * @private
  33411. * @param {?} overlayRef
  33412. * @param {?} config
  33413. * @return {?}
  33414. */
  33415. function (overlayRef, config) {
  33416. /** @type {?} */
  33417. var userInjector = config && config.viewContainerRef && config.viewContainerRef.injector;
  33418. /** @type {?} */
  33419. var injector = new portal.PortalInjector(userInjector || this._injector, new WeakMap([
  33420. [MatSnackBarConfig, config]
  33421. ]));
  33422. /** @type {?} */
  33423. var containerPortal = new portal.ComponentPortal(MatSnackBarContainer, config.viewContainerRef, injector);
  33424. /** @type {?} */
  33425. var containerRef = overlayRef.attach(containerPortal);
  33426. containerRef.instance.snackBarConfig = config;
  33427. return containerRef.instance;
  33428. };
  33429. /**
  33430. * Places a new component or a template as the content of the snack bar container.
  33431. */
  33432. /**
  33433. * Places a new component or a template as the content of the snack bar container.
  33434. * @private
  33435. * @template T
  33436. * @param {?} content
  33437. * @param {?=} userConfig
  33438. * @return {?}
  33439. */
  33440. MatSnackBar.prototype._attach = /**
  33441. * Places a new component or a template as the content of the snack bar container.
  33442. * @private
  33443. * @template T
  33444. * @param {?} content
  33445. * @param {?=} userConfig
  33446. * @return {?}
  33447. */
  33448. function (content, userConfig) {
  33449. /** @type {?} */
  33450. var config = __assign({}, new MatSnackBarConfig(), this._defaultConfig, userConfig);
  33451. /** @type {?} */
  33452. var overlayRef = this._createOverlay(config);
  33453. /** @type {?} */
  33454. var container = this._attachSnackBarContainer(overlayRef, config);
  33455. /** @type {?} */
  33456. var snackBarRef = new MatSnackBarRef(container, overlayRef);
  33457. if (content instanceof core.TemplateRef) {
  33458. /** @type {?} */
  33459. var portal$$1 = new portal.TemplatePortal(content, (/** @type {?} */ (null)), (/** @type {?} */ ({
  33460. $implicit: config.data,
  33461. snackBarRef: snackBarRef
  33462. })));
  33463. snackBarRef.instance = container.attachTemplatePortal(portal$$1);
  33464. }
  33465. else {
  33466. /** @type {?} */
  33467. var injector = this._createInjector(config, snackBarRef);
  33468. /** @type {?} */
  33469. var portal$$1 = new portal.ComponentPortal(content, undefined, injector);
  33470. /** @type {?} */
  33471. var contentRef = container.attachComponentPortal(portal$$1);
  33472. // We can't pass this via the injector, because the injector is created earlier.
  33473. snackBarRef.instance = contentRef.instance;
  33474. }
  33475. // Subscribe to the breakpoint observer and attach the mat-snack-bar-handset class as
  33476. // appropriate. This class is applied to the overlay element because the overlay must expand to
  33477. // fill the width of the screen for full width snackbars.
  33478. this._breakpointObserver.observe(layout.Breakpoints.Handset).pipe(operators.takeUntil(overlayRef.detachments().pipe(operators.take(1)))).subscribe((/**
  33479. * @param {?} state
  33480. * @return {?}
  33481. */
  33482. function (state$$1) {
  33483. if (state$$1.matches) {
  33484. overlayRef.overlayElement.classList.add('mat-snack-bar-handset');
  33485. }
  33486. else {
  33487. overlayRef.overlayElement.classList.remove('mat-snack-bar-handset');
  33488. }
  33489. }));
  33490. this._animateSnackBar(snackBarRef, config);
  33491. this._openedSnackBarRef = snackBarRef;
  33492. return this._openedSnackBarRef;
  33493. };
  33494. /** Animates the old snack bar out and the new one in. */
  33495. /**
  33496. * Animates the old snack bar out and the new one in.
  33497. * @private
  33498. * @param {?} snackBarRef
  33499. * @param {?} config
  33500. * @return {?}
  33501. */
  33502. MatSnackBar.prototype._animateSnackBar = /**
  33503. * Animates the old snack bar out and the new one in.
  33504. * @private
  33505. * @param {?} snackBarRef
  33506. * @param {?} config
  33507. * @return {?}
  33508. */
  33509. function (snackBarRef, config) {
  33510. var _this = this;
  33511. // When the snackbar is dismissed, clear the reference to it.
  33512. snackBarRef.afterDismissed().subscribe((/**
  33513. * @return {?}
  33514. */
  33515. function () {
  33516. // Clear the snackbar ref if it hasn't already been replaced by a newer snackbar.
  33517. if (_this._openedSnackBarRef == snackBarRef) {
  33518. _this._openedSnackBarRef = null;
  33519. }
  33520. if (config.announcementMessage) {
  33521. _this._live.clear();
  33522. }
  33523. }));
  33524. if (this._openedSnackBarRef) {
  33525. // If a snack bar is already in view, dismiss it and enter the
  33526. // new snack bar after exit animation is complete.
  33527. this._openedSnackBarRef.afterDismissed().subscribe((/**
  33528. * @return {?}
  33529. */
  33530. function () {
  33531. snackBarRef.containerInstance.enter();
  33532. }));
  33533. this._openedSnackBarRef.dismiss();
  33534. }
  33535. else {
  33536. // If no snack bar is in view, enter the new snack bar.
  33537. snackBarRef.containerInstance.enter();
  33538. }
  33539. // If a dismiss timeout is provided, set up dismiss based on after the snackbar is opened.
  33540. if (config.duration && config.duration > 0) {
  33541. snackBarRef.afterOpened().subscribe((/**
  33542. * @return {?}
  33543. */
  33544. function () { return snackBarRef._dismissAfter((/** @type {?} */ (config.duration))); }));
  33545. }
  33546. if (config.announcementMessage) {
  33547. this._live.announce(config.announcementMessage, config.politeness);
  33548. }
  33549. };
  33550. /**
  33551. * Creates a new overlay and places it in the correct location.
  33552. * @param config The user-specified snack bar config.
  33553. */
  33554. /**
  33555. * Creates a new overlay and places it in the correct location.
  33556. * @private
  33557. * @param {?} config The user-specified snack bar config.
  33558. * @return {?}
  33559. */
  33560. MatSnackBar.prototype._createOverlay = /**
  33561. * Creates a new overlay and places it in the correct location.
  33562. * @private
  33563. * @param {?} config The user-specified snack bar config.
  33564. * @return {?}
  33565. */
  33566. function (config) {
  33567. /** @type {?} */
  33568. var overlayConfig = new overlay.OverlayConfig();
  33569. overlayConfig.direction = config.direction;
  33570. /** @type {?} */
  33571. var positionStrategy = this._overlay.position().global();
  33572. // Set horizontal position.
  33573. /** @type {?} */
  33574. var isRtl = config.direction === 'rtl';
  33575. /** @type {?} */
  33576. var isLeft = (config.horizontalPosition === 'left' ||
  33577. (config.horizontalPosition === 'start' && !isRtl) ||
  33578. (config.horizontalPosition === 'end' && isRtl));
  33579. /** @type {?} */
  33580. var isRight = !isLeft && config.horizontalPosition !== 'center';
  33581. if (isLeft) {
  33582. positionStrategy.left('0');
  33583. }
  33584. else if (isRight) {
  33585. positionStrategy.right('0');
  33586. }
  33587. else {
  33588. positionStrategy.centerHorizontally();
  33589. }
  33590. // Set horizontal position.
  33591. if (config.verticalPosition === 'top') {
  33592. positionStrategy.top('0');
  33593. }
  33594. else {
  33595. positionStrategy.bottom('0');
  33596. }
  33597. overlayConfig.positionStrategy = positionStrategy;
  33598. return this._overlay.create(overlayConfig);
  33599. };
  33600. /**
  33601. * Creates an injector to be used inside of a snack bar component.
  33602. * @param config Config that was used to create the snack bar.
  33603. * @param snackBarRef Reference to the snack bar.
  33604. */
  33605. /**
  33606. * Creates an injector to be used inside of a snack bar component.
  33607. * @private
  33608. * @template T
  33609. * @param {?} config Config that was used to create the snack bar.
  33610. * @param {?} snackBarRef Reference to the snack bar.
  33611. * @return {?}
  33612. */
  33613. MatSnackBar.prototype._createInjector = /**
  33614. * Creates an injector to be used inside of a snack bar component.
  33615. * @private
  33616. * @template T
  33617. * @param {?} config Config that was used to create the snack bar.
  33618. * @param {?} snackBarRef Reference to the snack bar.
  33619. * @return {?}
  33620. */
  33621. function (config, snackBarRef) {
  33622. /** @type {?} */
  33623. var userInjector = config && config.viewContainerRef && config.viewContainerRef.injector;
  33624. return new portal.PortalInjector(userInjector || this._injector, new WeakMap([
  33625. [MatSnackBarRef, snackBarRef],
  33626. [MAT_SNACK_BAR_DATA, config.data]
  33627. ]));
  33628. };
  33629. MatSnackBar.decorators = [
  33630. { type: core.Injectable, args: [{ providedIn: MatSnackBarModule },] },
  33631. ];
  33632. /** @nocollapse */
  33633. MatSnackBar.ctorParameters = function () { return [
  33634. { type: overlay.Overlay },
  33635. { type: a11y.LiveAnnouncer },
  33636. { type: core.Injector },
  33637. { type: layout.BreakpointObserver },
  33638. { type: MatSnackBar, decorators: [{ type: core.Optional }, { type: core.SkipSelf }] },
  33639. { type: MatSnackBarConfig, decorators: [{ type: core.Inject, args: [MAT_SNACK_BAR_DEFAULT_OPTIONS,] }] }
  33640. ]; };
  33641. /** @nocollapse */ MatSnackBar.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function MatSnackBar_Factory() { return new MatSnackBar(core.ɵɵinject(overlay.Overlay), core.ɵɵinject(a11y.LiveAnnouncer), core.ɵɵinject(core.INJECTOR), core.ɵɵinject(layout.BreakpointObserver), core.ɵɵinject(MatSnackBar, 12), core.ɵɵinject(MAT_SNACK_BAR_DEFAULT_OPTIONS)); }, token: MatSnackBar, providedIn: MatSnackBarModule });
  33642. return MatSnackBar;
  33643. }());
  33644. /**
  33645. * @fileoverview added by tsickle
  33646. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  33647. */
  33648. /**
  33649. * \@docs-private
  33650. * @param {?} id
  33651. * @return {?}
  33652. */
  33653. function getSortDuplicateSortableIdError(id) {
  33654. return Error("Cannot have two MatSortables with the same id (" + id + ").");
  33655. }
  33656. /**
  33657. * \@docs-private
  33658. * @return {?}
  33659. */
  33660. function getSortHeaderNotContainedWithinSortError() {
  33661. return Error("MatSortHeader must be placed within a parent element with the MatSort directive.");
  33662. }
  33663. /**
  33664. * \@docs-private
  33665. * @return {?}
  33666. */
  33667. function getSortHeaderMissingIdError() {
  33668. return Error("MatSortHeader must be provided with a unique id.");
  33669. }
  33670. /**
  33671. * \@docs-private
  33672. * @param {?} direction
  33673. * @return {?}
  33674. */
  33675. function getSortInvalidDirectionError(direction) {
  33676. return Error(direction + " is not a valid sort direction ('asc' or 'desc').");
  33677. }
  33678. /**
  33679. * @fileoverview added by tsickle
  33680. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  33681. */
  33682. // Boilerplate for applying mixins to MatSort.
  33683. /**
  33684. * \@docs-private
  33685. */
  33686. var
  33687. // Boilerplate for applying mixins to MatSort.
  33688. /**
  33689. * \@docs-private
  33690. */
  33691. MatSortBase = /** @class */ (function () {
  33692. function MatSortBase() {
  33693. }
  33694. return MatSortBase;
  33695. }());
  33696. /** @type {?} */
  33697. var _MatSortMixinBase = mixinInitialized(mixinDisabled(MatSortBase));
  33698. /**
  33699. * Container for MatSortables to manage the sort state and provide default sort parameters.
  33700. */
  33701. var MatSort = /** @class */ (function (_super) {
  33702. __extends(MatSort, _super);
  33703. function MatSort() {
  33704. var _this = _super !== null && _super.apply(this, arguments) || this;
  33705. /**
  33706. * Collection of all registered sortables that this directive manages.
  33707. */
  33708. _this.sortables = new Map();
  33709. /**
  33710. * Used to notify any child components listening to state changes.
  33711. */
  33712. _this._stateChanges = new rxjs.Subject();
  33713. /**
  33714. * The direction to set when an MatSortable is initially sorted.
  33715. * May be overriden by the MatSortable's sort start.
  33716. */
  33717. _this.start = 'asc';
  33718. _this._direction = '';
  33719. /**
  33720. * Event emitted when the user changes either the active sort or sort direction.
  33721. */
  33722. _this.sortChange = new core.EventEmitter();
  33723. return _this;
  33724. }
  33725. Object.defineProperty(MatSort.prototype, "direction", {
  33726. /** The sort direction of the currently active MatSortable. */
  33727. get: /**
  33728. * The sort direction of the currently active MatSortable.
  33729. * @return {?}
  33730. */
  33731. function () { return this._direction; },
  33732. set: /**
  33733. * @param {?} direction
  33734. * @return {?}
  33735. */
  33736. function (direction) {
  33737. if (core.isDevMode() && direction && direction !== 'asc' && direction !== 'desc') {
  33738. throw getSortInvalidDirectionError(direction);
  33739. }
  33740. this._direction = direction;
  33741. },
  33742. enumerable: true,
  33743. configurable: true
  33744. });
  33745. Object.defineProperty(MatSort.prototype, "disableClear", {
  33746. /**
  33747. * Whether to disable the user from clearing the sort by finishing the sort direction cycle.
  33748. * May be overriden by the MatSortable's disable clear input.
  33749. */
  33750. get: /**
  33751. * Whether to disable the user from clearing the sort by finishing the sort direction cycle.
  33752. * May be overriden by the MatSortable's disable clear input.
  33753. * @return {?}
  33754. */
  33755. function () { return this._disableClear; },
  33756. set: /**
  33757. * @param {?} v
  33758. * @return {?}
  33759. */
  33760. function (v) { this._disableClear = coercion.coerceBooleanProperty(v); },
  33761. enumerable: true,
  33762. configurable: true
  33763. });
  33764. /**
  33765. * Register function to be used by the contained MatSortables. Adds the MatSortable to the
  33766. * collection of MatSortables.
  33767. */
  33768. /**
  33769. * Register function to be used by the contained MatSortables. Adds the MatSortable to the
  33770. * collection of MatSortables.
  33771. * @param {?} sortable
  33772. * @return {?}
  33773. */
  33774. MatSort.prototype.register = /**
  33775. * Register function to be used by the contained MatSortables. Adds the MatSortable to the
  33776. * collection of MatSortables.
  33777. * @param {?} sortable
  33778. * @return {?}
  33779. */
  33780. function (sortable) {
  33781. if (!sortable.id) {
  33782. throw getSortHeaderMissingIdError();
  33783. }
  33784. if (this.sortables.has(sortable.id)) {
  33785. throw getSortDuplicateSortableIdError(sortable.id);
  33786. }
  33787. this.sortables.set(sortable.id, sortable);
  33788. };
  33789. /**
  33790. * Unregister function to be used by the contained MatSortables. Removes the MatSortable from the
  33791. * collection of contained MatSortables.
  33792. */
  33793. /**
  33794. * Unregister function to be used by the contained MatSortables. Removes the MatSortable from the
  33795. * collection of contained MatSortables.
  33796. * @param {?} sortable
  33797. * @return {?}
  33798. */
  33799. MatSort.prototype.deregister = /**
  33800. * Unregister function to be used by the contained MatSortables. Removes the MatSortable from the
  33801. * collection of contained MatSortables.
  33802. * @param {?} sortable
  33803. * @return {?}
  33804. */
  33805. function (sortable) {
  33806. this.sortables.delete(sortable.id);
  33807. };
  33808. /** Sets the active sort id and determines the new sort direction. */
  33809. /**
  33810. * Sets the active sort id and determines the new sort direction.
  33811. * @param {?} sortable
  33812. * @return {?}
  33813. */
  33814. MatSort.prototype.sort = /**
  33815. * Sets the active sort id and determines the new sort direction.
  33816. * @param {?} sortable
  33817. * @return {?}
  33818. */
  33819. function (sortable) {
  33820. if (this.active != sortable.id) {
  33821. this.active = sortable.id;
  33822. this.direction = sortable.start ? sortable.start : this.start;
  33823. }
  33824. else {
  33825. this.direction = this.getNextSortDirection(sortable);
  33826. }
  33827. this.sortChange.emit({ active: this.active, direction: this.direction });
  33828. };
  33829. /** Returns the next sort direction of the active sortable, checking for potential overrides. */
  33830. /**
  33831. * Returns the next sort direction of the active sortable, checking for potential overrides.
  33832. * @param {?} sortable
  33833. * @return {?}
  33834. */
  33835. MatSort.prototype.getNextSortDirection = /**
  33836. * Returns the next sort direction of the active sortable, checking for potential overrides.
  33837. * @param {?} sortable
  33838. * @return {?}
  33839. */
  33840. function (sortable) {
  33841. if (!sortable) {
  33842. return '';
  33843. }
  33844. // Get the sort direction cycle with the potential sortable overrides.
  33845. /** @type {?} */
  33846. var disableClear = sortable.disableClear != null ? sortable.disableClear : this.disableClear;
  33847. /** @type {?} */
  33848. var sortDirectionCycle = getSortDirectionCycle(sortable.start || this.start, disableClear);
  33849. // Get and return the next direction in the cycle
  33850. /** @type {?} */
  33851. var nextDirectionIndex = sortDirectionCycle.indexOf(this.direction) + 1;
  33852. if (nextDirectionIndex >= sortDirectionCycle.length) {
  33853. nextDirectionIndex = 0;
  33854. }
  33855. return sortDirectionCycle[nextDirectionIndex];
  33856. };
  33857. /**
  33858. * @return {?}
  33859. */
  33860. MatSort.prototype.ngOnInit = /**
  33861. * @return {?}
  33862. */
  33863. function () {
  33864. this._markInitialized();
  33865. };
  33866. /**
  33867. * @return {?}
  33868. */
  33869. MatSort.prototype.ngOnChanges = /**
  33870. * @return {?}
  33871. */
  33872. function () {
  33873. this._stateChanges.next();
  33874. };
  33875. /**
  33876. * @return {?}
  33877. */
  33878. MatSort.prototype.ngOnDestroy = /**
  33879. * @return {?}
  33880. */
  33881. function () {
  33882. this._stateChanges.complete();
  33883. };
  33884. MatSort.decorators = [
  33885. { type: core.Directive, args: [{
  33886. selector: '[matSort]',
  33887. exportAs: 'matSort',
  33888. inputs: ['disabled: matSortDisabled']
  33889. },] },
  33890. ];
  33891. MatSort.propDecorators = {
  33892. active: [{ type: core.Input, args: ['matSortActive',] }],
  33893. start: [{ type: core.Input, args: ['matSortStart',] }],
  33894. direction: [{ type: core.Input, args: ['matSortDirection',] }],
  33895. disableClear: [{ type: core.Input, args: ['matSortDisableClear',] }],
  33896. sortChange: [{ type: core.Output, args: ['matSortChange',] }]
  33897. };
  33898. return MatSort;
  33899. }(_MatSortMixinBase));
  33900. /**
  33901. * Returns the sort direction cycle to use given the provided parameters of order and clear.
  33902. * @param {?} start
  33903. * @param {?} disableClear
  33904. * @return {?}
  33905. */
  33906. function getSortDirectionCycle(start, disableClear) {
  33907. /** @type {?} */
  33908. var sortOrder = ['asc', 'desc'];
  33909. if (start == 'desc') {
  33910. sortOrder.reverse();
  33911. }
  33912. if (!disableClear) {
  33913. sortOrder.push('');
  33914. }
  33915. return sortOrder;
  33916. }
  33917. /**
  33918. * @fileoverview added by tsickle
  33919. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  33920. */
  33921. /** @type {?} */
  33922. var SORT_ANIMATION_TRANSITION = AnimationDurations.ENTERING + ' ' +
  33923. AnimationCurves.STANDARD_CURVE;
  33924. /**
  33925. * Animations used by MatSort.
  33926. * \@docs-private
  33927. * @type {?}
  33928. */
  33929. var matSortAnimations = {
  33930. /**
  33931. * Animation that moves the sort indicator.
  33932. */
  33933. indicator: animations$1.trigger('indicator', [
  33934. animations$1.state('active-asc, asc', animations$1.style({ transform: 'translateY(0px)' })),
  33935. // 10px is the height of the sort indicator, minus the width of the pointers
  33936. animations$1.state('active-desc, desc', animations$1.style({ transform: 'translateY(10px)' })),
  33937. animations$1.transition('active-asc <=> active-desc', animations$1.animate(SORT_ANIMATION_TRANSITION))
  33938. ]),
  33939. /**
  33940. * Animation that rotates the left pointer of the indicator based on the sorting direction.
  33941. */
  33942. leftPointer: animations$1.trigger('leftPointer', [
  33943. animations$1.state('active-asc, asc', animations$1.style({ transform: 'rotate(-45deg)' })),
  33944. animations$1.state('active-desc, desc', animations$1.style({ transform: 'rotate(45deg)' })),
  33945. animations$1.transition('active-asc <=> active-desc', animations$1.animate(SORT_ANIMATION_TRANSITION))
  33946. ]),
  33947. /**
  33948. * Animation that rotates the right pointer of the indicator based on the sorting direction.
  33949. */
  33950. rightPointer: animations$1.trigger('rightPointer', [
  33951. animations$1.state('active-asc, asc', animations$1.style({ transform: 'rotate(45deg)' })),
  33952. animations$1.state('active-desc, desc', animations$1.style({ transform: 'rotate(-45deg)' })),
  33953. animations$1.transition('active-asc <=> active-desc', animations$1.animate(SORT_ANIMATION_TRANSITION))
  33954. ]),
  33955. /**
  33956. * Animation that controls the arrow opacity.
  33957. */
  33958. arrowOpacity: animations$1.trigger('arrowOpacity', [
  33959. animations$1.state('desc-to-active, asc-to-active, active', animations$1.style({ opacity: 1 })),
  33960. animations$1.state('desc-to-hint, asc-to-hint, hint', animations$1.style({ opacity: .54 })),
  33961. animations$1.state('hint-to-desc, active-to-desc, desc, hint-to-asc, active-to-asc, asc, void', animations$1.style({ opacity: 0 })),
  33962. // Transition between all states except for immediate transitions
  33963. animations$1.transition('* => asc, * => desc, * => active, * => hint, * => void', animations$1.animate('0ms')),
  33964. animations$1.transition('* <=> *', animations$1.animate(SORT_ANIMATION_TRANSITION)),
  33965. ]),
  33966. /**
  33967. * Animation for the translation of the arrow as a whole. States are separated into two
  33968. * groups: ones with animations and others that are immediate. Immediate states are asc, desc,
  33969. * peek, and active. The other states define a specific animation (source-to-destination)
  33970. * and are determined as a function of their prev user-perceived state and what the next state
  33971. * should be.
  33972. */
  33973. arrowPosition: animations$1.trigger('arrowPosition', [
  33974. // Hidden Above => Hint Center
  33975. animations$1.transition('* => desc-to-hint, * => desc-to-active', animations$1.animate(SORT_ANIMATION_TRANSITION, animations$1.keyframes([
  33976. animations$1.style({ transform: 'translateY(-25%)' }),
  33977. animations$1.style({ transform: 'translateY(0)' })
  33978. ]))),
  33979. // Hint Center => Hidden Below
  33980. animations$1.transition('* => hint-to-desc, * => active-to-desc', animations$1.animate(SORT_ANIMATION_TRANSITION, animations$1.keyframes([
  33981. animations$1.style({ transform: 'translateY(0)' }),
  33982. animations$1.style({ transform: 'translateY(25%)' })
  33983. ]))),
  33984. // Hidden Below => Hint Center
  33985. animations$1.transition('* => asc-to-hint, * => asc-to-active', animations$1.animate(SORT_ANIMATION_TRANSITION, animations$1.keyframes([
  33986. animations$1.style({ transform: 'translateY(25%)' }),
  33987. animations$1.style({ transform: 'translateY(0)' })
  33988. ]))),
  33989. // Hint Center => Hidden Above
  33990. animations$1.transition('* => hint-to-asc, * => active-to-asc', animations$1.animate(SORT_ANIMATION_TRANSITION, animations$1.keyframes([
  33991. animations$1.style({ transform: 'translateY(0)' }),
  33992. animations$1.style({ transform: 'translateY(-25%)' })
  33993. ]))),
  33994. animations$1.state('desc-to-hint, asc-to-hint, hint, desc-to-active, asc-to-active, active', animations$1.style({ transform: 'translateY(0)' })),
  33995. animations$1.state('hint-to-desc, active-to-desc, desc', animations$1.style({ transform: 'translateY(-25%)' })),
  33996. animations$1.state('hint-to-asc, active-to-asc, asc', animations$1.style({ transform: 'translateY(25%)' })),
  33997. ]),
  33998. /**
  33999. * Necessary trigger that calls animate on children animations.
  34000. */
  34001. allowChildren: animations$1.trigger('allowChildren', [
  34002. animations$1.transition('* <=> *', [
  34003. animations$1.query('@*', animations$1.animateChild(), { optional: true })
  34004. ])
  34005. ]),
  34006. };
  34007. /**
  34008. * @fileoverview added by tsickle
  34009. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  34010. */
  34011. /**
  34012. * To modify the labels and text displayed, create a new instance of MatSortHeaderIntl and
  34013. * include it in a custom provider.
  34014. */
  34015. var MatSortHeaderIntl = /** @class */ (function () {
  34016. function MatSortHeaderIntl() {
  34017. /**
  34018. * Stream that emits whenever the labels here are changed. Use this to notify
  34019. * components if the labels have changed after initialization.
  34020. */
  34021. this.changes = new rxjs.Subject();
  34022. /**
  34023. * ARIA label for the sorting button.
  34024. */
  34025. this.sortButtonLabel = (/**
  34026. * @param {?} id
  34027. * @return {?}
  34028. */
  34029. function (id) {
  34030. return "Change sorting for " + id;
  34031. });
  34032. }
  34033. MatSortHeaderIntl.decorators = [
  34034. { type: core.Injectable, args: [{ providedIn: 'root' },] },
  34035. ];
  34036. /** @nocollapse */ MatSortHeaderIntl.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function MatSortHeaderIntl_Factory() { return new MatSortHeaderIntl(); }, token: MatSortHeaderIntl, providedIn: "root" });
  34037. return MatSortHeaderIntl;
  34038. }());
  34039. /**
  34040. * \@docs-private
  34041. * @param {?} parentIntl
  34042. * @return {?}
  34043. */
  34044. function MAT_SORT_HEADER_INTL_PROVIDER_FACTORY(parentIntl) {
  34045. return parentIntl || new MatSortHeaderIntl();
  34046. }
  34047. /**
  34048. * \@docs-private
  34049. * @type {?}
  34050. */
  34051. var MAT_SORT_HEADER_INTL_PROVIDER = {
  34052. // If there is already an MatSortHeaderIntl available, use that. Otherwise, provide a new one.
  34053. provide: MatSortHeaderIntl,
  34054. deps: [[new core.Optional(), new core.SkipSelf(), MatSortHeaderIntl]],
  34055. useFactory: MAT_SORT_HEADER_INTL_PROVIDER_FACTORY
  34056. };
  34057. /**
  34058. * @fileoverview added by tsickle
  34059. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  34060. */
  34061. // Boilerplate for applying mixins to the sort header.
  34062. /**
  34063. * \@docs-private
  34064. */
  34065. var
  34066. // Boilerplate for applying mixins to the sort header.
  34067. /**
  34068. * \@docs-private
  34069. */
  34070. MatSortHeaderBase = /** @class */ (function () {
  34071. function MatSortHeaderBase() {
  34072. }
  34073. return MatSortHeaderBase;
  34074. }());
  34075. /** @type {?} */
  34076. var _MatSortHeaderMixinBase = mixinDisabled(MatSortHeaderBase);
  34077. /**
  34078. * Applies sorting behavior (click to change sort) and styles to an element, including an
  34079. * arrow to display the current sort direction.
  34080. *
  34081. * Must be provided with an id and contained within a parent MatSort directive.
  34082. *
  34083. * If used on header cells in a CdkTable, it will automatically default its id from its containing
  34084. * column definition.
  34085. */
  34086. var MatSortHeader = /** @class */ (function (_super) {
  34087. __extends(MatSortHeader, _super);
  34088. function MatSortHeader(_intl, changeDetectorRef, _sort, _columnDef) {
  34089. var _this =
  34090. // Note that we use a string token for the `_columnDef`, because the value is provided both by
  34091. // `material/table` and `cdk/table` and we can't have the CDK depending on Material,
  34092. // and we want to avoid having the sort header depending on the CDK table because
  34093. // of this single reference.
  34094. _super.call(this) || this;
  34095. _this._intl = _intl;
  34096. _this._sort = _sort;
  34097. _this._columnDef = _columnDef;
  34098. /**
  34099. * Flag set to true when the indicator should be displayed while the sort is not active. Used to
  34100. * provide an affordance that the header is sortable by showing on focus and hover.
  34101. */
  34102. _this._showIndicatorHint = false;
  34103. /**
  34104. * The direction the arrow should be facing according to the current state.
  34105. */
  34106. _this._arrowDirection = '';
  34107. /**
  34108. * Whether the view state animation should show the transition between the `from` and `to` states.
  34109. */
  34110. _this._disableViewStateAnimation = false;
  34111. /**
  34112. * Sets the position of the arrow that displays when sorted.
  34113. */
  34114. _this.arrowPosition = 'after';
  34115. if (!_sort) {
  34116. throw getSortHeaderNotContainedWithinSortError();
  34117. }
  34118. _this._rerenderSubscription = rxjs.merge(_sort.sortChange, _sort._stateChanges, _intl.changes)
  34119. .subscribe((/**
  34120. * @return {?}
  34121. */
  34122. function () {
  34123. if (_this._isSorted()) {
  34124. _this._updateArrowDirection();
  34125. }
  34126. // If this header was recently active and now no longer sorted, animate away the arrow.
  34127. if (!_this._isSorted() && _this._viewState && _this._viewState.toState === 'active') {
  34128. _this._disableViewStateAnimation = false;
  34129. _this._setAnimationTransitionState({ fromState: 'active', toState: _this._arrowDirection });
  34130. }
  34131. changeDetectorRef.markForCheck();
  34132. }));
  34133. return _this;
  34134. }
  34135. Object.defineProperty(MatSortHeader.prototype, "disableClear", {
  34136. /** Overrides the disable clear value of the containing MatSort for this MatSortable. */
  34137. get: /**
  34138. * Overrides the disable clear value of the containing MatSort for this MatSortable.
  34139. * @return {?}
  34140. */
  34141. function () { return this._disableClear; },
  34142. set: /**
  34143. * @param {?} v
  34144. * @return {?}
  34145. */
  34146. function (v) { this._disableClear = coercion.coerceBooleanProperty(v); },
  34147. enumerable: true,
  34148. configurable: true
  34149. });
  34150. /**
  34151. * @return {?}
  34152. */
  34153. MatSortHeader.prototype.ngOnInit = /**
  34154. * @return {?}
  34155. */
  34156. function () {
  34157. if (!this.id && this._columnDef) {
  34158. this.id = this._columnDef.name;
  34159. }
  34160. // Initialize the direction of the arrow and set the view state to be immediately that state.
  34161. this._updateArrowDirection();
  34162. this._setAnimationTransitionState({ toState: this._isSorted() ? 'active' : this._arrowDirection });
  34163. this._sort.register(this);
  34164. };
  34165. /**
  34166. * @return {?}
  34167. */
  34168. MatSortHeader.prototype.ngOnDestroy = /**
  34169. * @return {?}
  34170. */
  34171. function () {
  34172. this._sort.deregister(this);
  34173. this._rerenderSubscription.unsubscribe();
  34174. };
  34175. /**
  34176. * Sets the "hint" state such that the arrow will be semi-transparently displayed as a hint to the
  34177. * user showing what the active sort will become. If set to false, the arrow will fade away.
  34178. */
  34179. /**
  34180. * Sets the "hint" state such that the arrow will be semi-transparently displayed as a hint to the
  34181. * user showing what the active sort will become. If set to false, the arrow will fade away.
  34182. * @param {?} visible
  34183. * @return {?}
  34184. */
  34185. MatSortHeader.prototype._setIndicatorHintVisible = /**
  34186. * Sets the "hint" state such that the arrow will be semi-transparently displayed as a hint to the
  34187. * user showing what the active sort will become. If set to false, the arrow will fade away.
  34188. * @param {?} visible
  34189. * @return {?}
  34190. */
  34191. function (visible) {
  34192. // No-op if the sort header is disabled - should not make the hint visible.
  34193. if (this._isDisabled() && visible) {
  34194. return;
  34195. }
  34196. this._showIndicatorHint = visible;
  34197. if (!this._isSorted()) {
  34198. this._updateArrowDirection();
  34199. if (this._showIndicatorHint) {
  34200. this._setAnimationTransitionState({ fromState: this._arrowDirection, toState: 'hint' });
  34201. }
  34202. else {
  34203. this._setAnimationTransitionState({ fromState: 'hint', toState: this._arrowDirection });
  34204. }
  34205. }
  34206. };
  34207. /**
  34208. * Sets the animation transition view state for the arrow's position and opacity. If the
  34209. * `disableViewStateAnimation` flag is set to true, the `fromState` will be ignored so that
  34210. * no animation appears.
  34211. */
  34212. /**
  34213. * Sets the animation transition view state for the arrow's position and opacity. If the
  34214. * `disableViewStateAnimation` flag is set to true, the `fromState` will be ignored so that
  34215. * no animation appears.
  34216. * @param {?} viewState
  34217. * @return {?}
  34218. */
  34219. MatSortHeader.prototype._setAnimationTransitionState = /**
  34220. * Sets the animation transition view state for the arrow's position and opacity. If the
  34221. * `disableViewStateAnimation` flag is set to true, the `fromState` will be ignored so that
  34222. * no animation appears.
  34223. * @param {?} viewState
  34224. * @return {?}
  34225. */
  34226. function (viewState) {
  34227. this._viewState = viewState;
  34228. // If the animation for arrow position state (opacity/translation) should be disabled,
  34229. // remove the fromState so that it jumps right to the toState.
  34230. if (this._disableViewStateAnimation) {
  34231. this._viewState = { toState: viewState.toState };
  34232. }
  34233. };
  34234. /** Triggers the sort on this sort header and removes the indicator hint. */
  34235. /**
  34236. * Triggers the sort on this sort header and removes the indicator hint.
  34237. * @return {?}
  34238. */
  34239. MatSortHeader.prototype._handleClick = /**
  34240. * Triggers the sort on this sort header and removes the indicator hint.
  34241. * @return {?}
  34242. */
  34243. function () {
  34244. if (this._isDisabled()) {
  34245. return;
  34246. }
  34247. this._sort.sort(this);
  34248. // Do not show the animation if the header was already shown in the right position.
  34249. if (this._viewState.toState === 'hint' || this._viewState.toState === 'active') {
  34250. this._disableViewStateAnimation = true;
  34251. }
  34252. // If the arrow is now sorted, animate the arrow into place. Otherwise, animate it away into
  34253. // the direction it is facing.
  34254. /** @type {?} */
  34255. var viewState = this._isSorted() ?
  34256. { fromState: this._arrowDirection, toState: 'active' } :
  34257. { fromState: 'active', toState: this._arrowDirection };
  34258. this._setAnimationTransitionState(viewState);
  34259. this._showIndicatorHint = false;
  34260. };
  34261. /** Whether this MatSortHeader is currently sorted in either ascending or descending order. */
  34262. /**
  34263. * Whether this MatSortHeader is currently sorted in either ascending or descending order.
  34264. * @return {?}
  34265. */
  34266. MatSortHeader.prototype._isSorted = /**
  34267. * Whether this MatSortHeader is currently sorted in either ascending or descending order.
  34268. * @return {?}
  34269. */
  34270. function () {
  34271. return this._sort.active == this.id &&
  34272. (this._sort.direction === 'asc' || this._sort.direction === 'desc');
  34273. };
  34274. /** Returns the animation state for the arrow direction (indicator and pointers). */
  34275. /**
  34276. * Returns the animation state for the arrow direction (indicator and pointers).
  34277. * @return {?}
  34278. */
  34279. MatSortHeader.prototype._getArrowDirectionState = /**
  34280. * Returns the animation state for the arrow direction (indicator and pointers).
  34281. * @return {?}
  34282. */
  34283. function () {
  34284. return "" + (this._isSorted() ? 'active-' : '') + this._arrowDirection;
  34285. };
  34286. /** Returns the arrow position state (opacity, translation). */
  34287. /**
  34288. * Returns the arrow position state (opacity, translation).
  34289. * @return {?}
  34290. */
  34291. MatSortHeader.prototype._getArrowViewState = /**
  34292. * Returns the arrow position state (opacity, translation).
  34293. * @return {?}
  34294. */
  34295. function () {
  34296. /** @type {?} */
  34297. var fromState = this._viewState.fromState;
  34298. return (fromState ? fromState + "-to-" : '') + this._viewState.toState;
  34299. };
  34300. /**
  34301. * Updates the direction the arrow should be pointing. If it is not sorted, the arrow should be
  34302. * facing the start direction. Otherwise if it is sorted, the arrow should point in the currently
  34303. * active sorted direction. The reason this is updated through a function is because the direction
  34304. * should only be changed at specific times - when deactivated but the hint is displayed and when
  34305. * the sort is active and the direction changes. Otherwise the arrow's direction should linger
  34306. * in cases such as the sort becoming deactivated but we want to animate the arrow away while
  34307. * preserving its direction, even though the next sort direction is actually different and should
  34308. * only be changed once the arrow displays again (hint or activation).
  34309. */
  34310. /**
  34311. * Updates the direction the arrow should be pointing. If it is not sorted, the arrow should be
  34312. * facing the start direction. Otherwise if it is sorted, the arrow should point in the currently
  34313. * active sorted direction. The reason this is updated through a function is because the direction
  34314. * should only be changed at specific times - when deactivated but the hint is displayed and when
  34315. * the sort is active and the direction changes. Otherwise the arrow's direction should linger
  34316. * in cases such as the sort becoming deactivated but we want to animate the arrow away while
  34317. * preserving its direction, even though the next sort direction is actually different and should
  34318. * only be changed once the arrow displays again (hint or activation).
  34319. * @return {?}
  34320. */
  34321. MatSortHeader.prototype._updateArrowDirection = /**
  34322. * Updates the direction the arrow should be pointing. If it is not sorted, the arrow should be
  34323. * facing the start direction. Otherwise if it is sorted, the arrow should point in the currently
  34324. * active sorted direction. The reason this is updated through a function is because the direction
  34325. * should only be changed at specific times - when deactivated but the hint is displayed and when
  34326. * the sort is active and the direction changes. Otherwise the arrow's direction should linger
  34327. * in cases such as the sort becoming deactivated but we want to animate the arrow away while
  34328. * preserving its direction, even though the next sort direction is actually different and should
  34329. * only be changed once the arrow displays again (hint or activation).
  34330. * @return {?}
  34331. */
  34332. function () {
  34333. this._arrowDirection = this._isSorted() ?
  34334. this._sort.direction :
  34335. (this.start || this._sort.start);
  34336. };
  34337. /**
  34338. * @return {?}
  34339. */
  34340. MatSortHeader.prototype._isDisabled = /**
  34341. * @return {?}
  34342. */
  34343. function () {
  34344. return this._sort.disabled || this.disabled;
  34345. };
  34346. /**
  34347. * Gets the aria-sort attribute that should be applied to this sort header. If this header
  34348. * is not sorted, returns null so that the attribute is removed from the host element. Aria spec
  34349. * says that the aria-sort property should only be present on one header at a time, so removing
  34350. * ensures this is true.
  34351. */
  34352. /**
  34353. * Gets the aria-sort attribute that should be applied to this sort header. If this header
  34354. * is not sorted, returns null so that the attribute is removed from the host element. Aria spec
  34355. * says that the aria-sort property should only be present on one header at a time, so removing
  34356. * ensures this is true.
  34357. * @return {?}
  34358. */
  34359. MatSortHeader.prototype._getAriaSortAttribute = /**
  34360. * Gets the aria-sort attribute that should be applied to this sort header. If this header
  34361. * is not sorted, returns null so that the attribute is removed from the host element. Aria spec
  34362. * says that the aria-sort property should only be present on one header at a time, so removing
  34363. * ensures this is true.
  34364. * @return {?}
  34365. */
  34366. function () {
  34367. if (!this._isSorted()) {
  34368. return null;
  34369. }
  34370. return this._sort.direction == 'asc' ? 'ascending' : 'descending';
  34371. };
  34372. /** Whether the arrow inside the sort header should be rendered. */
  34373. /**
  34374. * Whether the arrow inside the sort header should be rendered.
  34375. * @return {?}
  34376. */
  34377. MatSortHeader.prototype._renderArrow = /**
  34378. * Whether the arrow inside the sort header should be rendered.
  34379. * @return {?}
  34380. */
  34381. function () {
  34382. return !this._isDisabled() || this._isSorted();
  34383. };
  34384. MatSortHeader.decorators = [
  34385. { type: core.Component, args: [{selector: '[mat-sort-header]',
  34386. exportAs: 'matSortHeader',
  34387. template: "<div class=\"mat-sort-header-container\" [class.mat-sort-header-sorted]=\"_isSorted()\" [class.mat-sort-header-position-before]=\"arrowPosition == 'before'\"><button class=\"mat-sort-header-button\" type=\"button\" [attr.disabled]=\"_isDisabled() || null\" [attr.aria-label]=\"_intl.sortButtonLabel(id)\" (focus)=\"_setIndicatorHintVisible(true)\" (blur)=\"_setIndicatorHintVisible(false)\"><ng-content></ng-content></button><div class=\"mat-sort-header-arrow\" *ngIf=\"_renderArrow()\" [@arrowOpacity]=\"_getArrowViewState()\" [@arrowPosition]=\"_getArrowViewState()\" [@allowChildren]=\"_getArrowDirectionState()\" (@arrowPosition.start)=\"_disableViewStateAnimation = true\" (@arrowPosition.done)=\"_disableViewStateAnimation = false\"><div class=\"mat-sort-header-stem\"></div><div class=\"mat-sort-header-indicator\" [@indicator]=\"_getArrowDirectionState()\"><div class=\"mat-sort-header-pointer-left\" [@leftPointer]=\"_getArrowDirectionState()\"></div><div class=\"mat-sort-header-pointer-right\" [@rightPointer]=\"_getArrowDirectionState()\"></div><div class=\"mat-sort-header-pointer-middle\"></div></div></div></div>",
  34388. styles: [".mat-sort-header-container{display:flex;cursor:pointer;align-items:center}.mat-sort-header-disabled .mat-sort-header-container{cursor:default}.mat-sort-header-position-before{flex-direction:row-reverse}.mat-sort-header-button{border:none;background:0 0;display:flex;align-items:center;padding:0;cursor:inherit;outline:0;font:inherit;color:currentColor}.mat-sort-header-button::-moz-focus-inner{border:0}.mat-sort-header-arrow{height:12px;width:12px;min-width:12px;position:relative;display:flex;opacity:0}.mat-sort-header-arrow,[dir=rtl] .mat-sort-header-position-before .mat-sort-header-arrow{margin:0 0 0 6px}.mat-sort-header-position-before .mat-sort-header-arrow,[dir=rtl] .mat-sort-header-arrow{margin:0 6px 0 0}.mat-sort-header-stem{background:currentColor;height:10px;width:2px;margin:auto;display:flex;align-items:center}@media (-ms-high-contrast:active){.mat-sort-header-stem{width:0;border-left:solid 2px}}.mat-sort-header-indicator{width:100%;height:2px;display:flex;align-items:center;position:absolute;top:0;left:0}.mat-sort-header-pointer-middle{margin:auto;height:2px;width:2px;background:currentColor;transform:rotate(45deg)}@media (-ms-high-contrast:active){.mat-sort-header-pointer-middle{width:0;height:0;border-top:solid 2px;border-left:solid 2px}}.mat-sort-header-pointer-left,.mat-sort-header-pointer-right{background:currentColor;width:6px;height:2px;position:absolute;top:0}@media (-ms-high-contrast:active){.mat-sort-header-pointer-left,.mat-sort-header-pointer-right{width:0;height:0;border-left:solid 6px;border-top:solid 2px}}.mat-sort-header-pointer-left{transform-origin:right;left:0}.mat-sort-header-pointer-right{transform-origin:left;right:0}"],
  34389. host: {
  34390. '(click)': '_handleClick()',
  34391. '(mouseenter)': '_setIndicatorHintVisible(true)',
  34392. '(longpress)': '_setIndicatorHintVisible(true)',
  34393. '(mouseleave)': '_setIndicatorHintVisible(false)',
  34394. '[attr.aria-sort]': '_getAriaSortAttribute()',
  34395. '[class.mat-sort-header-disabled]': '_isDisabled()',
  34396. },
  34397. encapsulation: core.ViewEncapsulation.None,
  34398. changeDetection: core.ChangeDetectionStrategy.OnPush,
  34399. inputs: ['disabled'],
  34400. animations: [
  34401. matSortAnimations.indicator,
  34402. matSortAnimations.leftPointer,
  34403. matSortAnimations.rightPointer,
  34404. matSortAnimations.arrowOpacity,
  34405. matSortAnimations.arrowPosition,
  34406. matSortAnimations.allowChildren,
  34407. ]
  34408. },] },
  34409. ];
  34410. /** @nocollapse */
  34411. MatSortHeader.ctorParameters = function () { return [
  34412. { type: MatSortHeaderIntl },
  34413. { type: core.ChangeDetectorRef },
  34414. { type: MatSort, decorators: [{ type: core.Optional }] },
  34415. { type: undefined, decorators: [{ type: core.Inject, args: ['MAT_SORT_HEADER_COLUMN_DEF',] }, { type: core.Optional }] }
  34416. ]; };
  34417. MatSortHeader.propDecorators = {
  34418. id: [{ type: core.Input, args: ['mat-sort-header',] }],
  34419. arrowPosition: [{ type: core.Input }],
  34420. start: [{ type: core.Input }],
  34421. disableClear: [{ type: core.Input }]
  34422. };
  34423. return MatSortHeader;
  34424. }(_MatSortHeaderMixinBase));
  34425. /**
  34426. * @fileoverview added by tsickle
  34427. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  34428. */
  34429. var MatSortModule = /** @class */ (function () {
  34430. function MatSortModule() {
  34431. }
  34432. MatSortModule.decorators = [
  34433. { type: core.NgModule, args: [{
  34434. imports: [common.CommonModule],
  34435. exports: [MatSort, MatSortHeader],
  34436. declarations: [MatSort, MatSortHeader],
  34437. providers: [MAT_SORT_HEADER_INTL_PROVIDER]
  34438. },] },
  34439. ];
  34440. return MatSortModule;
  34441. }());
  34442. /**
  34443. * @fileoverview added by tsickle
  34444. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  34445. */
  34446. var MatStepLabel = /** @class */ (function (_super) {
  34447. __extends(MatStepLabel, _super);
  34448. function MatStepLabel() {
  34449. return _super !== null && _super.apply(this, arguments) || this;
  34450. }
  34451. MatStepLabel.decorators = [
  34452. { type: core.Directive, args: [{
  34453. selector: '[matStepLabel]',
  34454. },] },
  34455. ];
  34456. return MatStepLabel;
  34457. }(stepper.CdkStepLabel));
  34458. /**
  34459. * @fileoverview added by tsickle
  34460. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  34461. */
  34462. /**
  34463. * Stepper data that is required for internationalization.
  34464. */
  34465. var MatStepperIntl = /** @class */ (function () {
  34466. function MatStepperIntl() {
  34467. /**
  34468. * Stream that emits whenever the labels here are changed. Use this to notify
  34469. * components if the labels have changed after initialization.
  34470. */
  34471. this.changes = new rxjs.Subject();
  34472. /**
  34473. * Label that is rendered below optional steps.
  34474. */
  34475. this.optionalLabel = 'Optional';
  34476. }
  34477. MatStepperIntl.decorators = [
  34478. { type: core.Injectable, args: [{ providedIn: 'root' },] },
  34479. ];
  34480. /** @nocollapse */ MatStepperIntl.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function MatStepperIntl_Factory() { return new MatStepperIntl(); }, token: MatStepperIntl, providedIn: "root" });
  34481. return MatStepperIntl;
  34482. }());
  34483. /**
  34484. * \@docs-private
  34485. * @param {?} parentIntl
  34486. * @return {?}
  34487. */
  34488. function MAT_STEPPER_INTL_PROVIDER_FACTORY(parentIntl) {
  34489. return parentIntl || new MatStepperIntl();
  34490. }
  34491. /**
  34492. * \@docs-private
  34493. * @type {?}
  34494. */
  34495. var MAT_STEPPER_INTL_PROVIDER = {
  34496. provide: MatStepperIntl,
  34497. deps: [[new core.Optional(), new core.SkipSelf(), MatStepperIntl]],
  34498. useFactory: MAT_STEPPER_INTL_PROVIDER_FACTORY
  34499. };
  34500. /**
  34501. * @fileoverview added by tsickle
  34502. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  34503. */
  34504. var MatStepHeader = /** @class */ (function (_super) {
  34505. __extends(MatStepHeader, _super);
  34506. function MatStepHeader(_intl, _focusMonitor, _elementRef, changeDetectorRef) {
  34507. var _this = _super.call(this, _elementRef) || this;
  34508. _this._intl = _intl;
  34509. _this._focusMonitor = _focusMonitor;
  34510. _focusMonitor.monitor(_elementRef, true);
  34511. _this._intlSubscription = _intl.changes.subscribe((/**
  34512. * @return {?}
  34513. */
  34514. function () { return changeDetectorRef.markForCheck(); }));
  34515. return _this;
  34516. }
  34517. /**
  34518. * @return {?}
  34519. */
  34520. MatStepHeader.prototype.ngOnDestroy = /**
  34521. * @return {?}
  34522. */
  34523. function () {
  34524. this._intlSubscription.unsubscribe();
  34525. this._focusMonitor.stopMonitoring(this._elementRef);
  34526. };
  34527. /** Focuses the step header. */
  34528. /**
  34529. * Focuses the step header.
  34530. * @return {?}
  34531. */
  34532. MatStepHeader.prototype.focus = /**
  34533. * Focuses the step header.
  34534. * @return {?}
  34535. */
  34536. function () {
  34537. this._focusMonitor.focusVia(this._elementRef, 'program');
  34538. };
  34539. /** Returns string label of given step if it is a text label. */
  34540. /**
  34541. * Returns string label of given step if it is a text label.
  34542. * @return {?}
  34543. */
  34544. MatStepHeader.prototype._stringLabel = /**
  34545. * Returns string label of given step if it is a text label.
  34546. * @return {?}
  34547. */
  34548. function () {
  34549. return this.label instanceof MatStepLabel ? null : this.label;
  34550. };
  34551. /** Returns MatStepLabel if the label of given step is a template label. */
  34552. /**
  34553. * Returns MatStepLabel if the label of given step is a template label.
  34554. * @return {?}
  34555. */
  34556. MatStepHeader.prototype._templateLabel = /**
  34557. * Returns MatStepLabel if the label of given step is a template label.
  34558. * @return {?}
  34559. */
  34560. function () {
  34561. return this.label instanceof MatStepLabel ? this.label : null;
  34562. };
  34563. /** Returns the host HTML element. */
  34564. /**
  34565. * Returns the host HTML element.
  34566. * @return {?}
  34567. */
  34568. MatStepHeader.prototype._getHostElement = /**
  34569. * Returns the host HTML element.
  34570. * @return {?}
  34571. */
  34572. function () {
  34573. return this._elementRef.nativeElement;
  34574. };
  34575. /** Template context variables that are exposed to the `matStepperIcon` instances. */
  34576. /**
  34577. * Template context variables that are exposed to the `matStepperIcon` instances.
  34578. * @return {?}
  34579. */
  34580. MatStepHeader.prototype._getIconContext = /**
  34581. * Template context variables that are exposed to the `matStepperIcon` instances.
  34582. * @return {?}
  34583. */
  34584. function () {
  34585. return {
  34586. index: this.index,
  34587. active: this.active,
  34588. optional: this.optional
  34589. };
  34590. };
  34591. /**
  34592. * @param {?} state
  34593. * @return {?}
  34594. */
  34595. MatStepHeader.prototype._getDefaultTextForState = /**
  34596. * @param {?} state
  34597. * @return {?}
  34598. */
  34599. function (state$$1) {
  34600. if (state$$1 == 'number') {
  34601. return "" + (this.index + 1);
  34602. }
  34603. if (state$$1 == 'edit') {
  34604. return 'create';
  34605. }
  34606. if (state$$1 == 'error') {
  34607. return 'warning';
  34608. }
  34609. return state$$1;
  34610. };
  34611. MatStepHeader.decorators = [
  34612. { type: core.Component, args: [{selector: 'mat-step-header',
  34613. template: "<div class=\"mat-step-header-ripple\" matRipple [matRippleTrigger]=\"_getHostElement()\" [matRippleDisabled]=\"disableRipple\"></div><div class=\"mat-step-icon-state-{{state}} mat-step-icon\" [class.mat-step-icon-selected]=\"selected\"><div class=\"mat-step-icon-content\" [ngSwitch]=\"!!(iconOverrides && iconOverrides[state])\"><ng-container *ngSwitchCase=\"true\" [ngTemplateOutlet]=\"iconOverrides[state]\" [ngTemplateOutletContext]=\"_getIconContext()\"></ng-container><ng-container *ngSwitchDefault [ngSwitch]=\"state\"><span *ngSwitchCase=\"'number'\">{{_getDefaultTextForState(state)}}</span><mat-icon *ngSwitchDefault>{{_getDefaultTextForState(state)}}</mat-icon></ng-container></div></div><div class=\"mat-step-label\" [class.mat-step-label-active]=\"active\" [class.mat-step-label-selected]=\"selected\" [class.mat-step-label-error]=\"state == 'error'\"><ng-container *ngIf=\"_templateLabel()\" [ngTemplateOutlet]=\"_templateLabel()!.template\"></ng-container><div class=\"mat-step-text-label\" *ngIf=\"_stringLabel()\">{{label}}</div><div class=\"mat-step-optional\" *ngIf=\"optional && state != 'error'\">{{_intl.optionalLabel}}</div><div class=\"mat-step-sub-label-error\" *ngIf=\"state == 'error'\">{{errorMessage}}</div></div>",
  34614. styles: [".mat-step-header{overflow:hidden;outline:0;cursor:pointer;position:relative;box-sizing:content-box;-webkit-tap-highlight-color:transparent}.mat-step-optional,.mat-step-sub-label-error{font-size:12px}.mat-step-icon{border-radius:50%;height:24px;width:24px;flex-shrink:0;position:relative}.mat-step-icon .mat-icon,.mat-step-icon-content{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.mat-step-icon .mat-icon{font-size:16px;height:16px;width:16px}.mat-step-icon-state-error .mat-icon{font-size:24px;height:24px;width:24px}.mat-step-label{display:inline-block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:50px;vertical-align:middle}.mat-step-text-label{text-overflow:ellipsis;overflow:hidden}.mat-step-header .mat-step-header-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}"],
  34615. host: {
  34616. 'class': 'mat-step-header',
  34617. 'role': 'tab',
  34618. },
  34619. encapsulation: core.ViewEncapsulation.None,
  34620. changeDetection: core.ChangeDetectionStrategy.OnPush,
  34621. },] },
  34622. ];
  34623. /** @nocollapse */
  34624. MatStepHeader.ctorParameters = function () { return [
  34625. { type: MatStepperIntl },
  34626. { type: a11y.FocusMonitor },
  34627. { type: core.ElementRef },
  34628. { type: core.ChangeDetectorRef }
  34629. ]; };
  34630. MatStepHeader.propDecorators = {
  34631. state: [{ type: core.Input }],
  34632. label: [{ type: core.Input }],
  34633. errorMessage: [{ type: core.Input }],
  34634. iconOverrides: [{ type: core.Input }],
  34635. index: [{ type: core.Input }],
  34636. selected: [{ type: core.Input }],
  34637. active: [{ type: core.Input }],
  34638. optional: [{ type: core.Input }],
  34639. disableRipple: [{ type: core.Input }]
  34640. };
  34641. return MatStepHeader;
  34642. }(stepper.CdkStepHeader));
  34643. /**
  34644. * @fileoverview added by tsickle
  34645. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  34646. */
  34647. /**
  34648. * Animations used by the Material steppers.
  34649. * \@docs-private
  34650. * @type {?}
  34651. */
  34652. var matStepperAnimations = {
  34653. /**
  34654. * Animation that transitions the step along the X axis in a horizontal stepper.
  34655. */
  34656. horizontalStepTransition: animations$1.trigger('stepTransition', [
  34657. animations$1.state('previous', animations$1.style({ transform: 'translate3d(-100%, 0, 0)', visibility: 'hidden' })),
  34658. animations$1.state('current', animations$1.style({ transform: 'none', visibility: 'visible' })),
  34659. animations$1.state('next', animations$1.style({ transform: 'translate3d(100%, 0, 0)', visibility: 'hidden' })),
  34660. animations$1.transition('* => *', animations$1.animate('500ms cubic-bezier(0.35, 0, 0.25, 1)'))
  34661. ]),
  34662. /**
  34663. * Animation that transitions the step along the Y axis in a vertical stepper.
  34664. */
  34665. verticalStepTransition: animations$1.trigger('stepTransition', [
  34666. animations$1.state('previous', animations$1.style({ height: '0px', visibility: 'hidden' })),
  34667. animations$1.state('next', animations$1.style({ height: '0px', visibility: 'hidden' })),
  34668. animations$1.state('current', animations$1.style({ height: '*', visibility: 'visible' })),
  34669. animations$1.transition('* <=> current', animations$1.animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)'))
  34670. ])
  34671. };
  34672. /**
  34673. * @fileoverview added by tsickle
  34674. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  34675. */
  34676. /**
  34677. * Template to be used to override the icons inside the step header.
  34678. */
  34679. var MatStepperIcon = /** @class */ (function () {
  34680. function MatStepperIcon(templateRef) {
  34681. this.templateRef = templateRef;
  34682. }
  34683. MatStepperIcon.decorators = [
  34684. { type: core.Directive, args: [{
  34685. selector: 'ng-template[matStepperIcon]',
  34686. },] },
  34687. ];
  34688. /** @nocollapse */
  34689. MatStepperIcon.ctorParameters = function () { return [
  34690. { type: core.TemplateRef }
  34691. ]; };
  34692. MatStepperIcon.propDecorators = {
  34693. name: [{ type: core.Input, args: ['matStepperIcon',] }]
  34694. };
  34695. return MatStepperIcon;
  34696. }());
  34697. /**
  34698. * @fileoverview added by tsickle
  34699. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  34700. */
  34701. var MatStep = /** @class */ (function (_super) {
  34702. __extends(MatStep, _super);
  34703. /** @breaking-change 8.0.0 remove the `?` after `stepperOptions` */
  34704. function MatStep(stepper$$1, _errorStateMatcher, stepperOptions) {
  34705. var _this = _super.call(this, stepper$$1, stepperOptions) || this;
  34706. _this._errorStateMatcher = _errorStateMatcher;
  34707. return _this;
  34708. }
  34709. /** Custom error state matcher that additionally checks for validity of interacted form. */
  34710. /**
  34711. * Custom error state matcher that additionally checks for validity of interacted form.
  34712. * @param {?} control
  34713. * @param {?} form
  34714. * @return {?}
  34715. */
  34716. MatStep.prototype.isErrorState = /**
  34717. * Custom error state matcher that additionally checks for validity of interacted form.
  34718. * @param {?} control
  34719. * @param {?} form
  34720. * @return {?}
  34721. */
  34722. function (control, form) {
  34723. /** @type {?} */
  34724. var originalErrorState = this._errorStateMatcher.isErrorState(control, form);
  34725. // Custom error state checks for the validity of form that is not submitted or touched
  34726. // since user can trigger a form change by calling for another step without directly
  34727. // interacting with the current form.
  34728. /** @type {?} */
  34729. var customErrorState = !!(control && control.invalid && this.interacted);
  34730. return originalErrorState || customErrorState;
  34731. };
  34732. MatStep.decorators = [
  34733. { type: core.Component, args: [{selector: 'mat-step',
  34734. template: "<ng-template><ng-content></ng-content></ng-template>",
  34735. providers: [{ provide: ErrorStateMatcher, useExisting: MatStep }],
  34736. encapsulation: core.ViewEncapsulation.None,
  34737. exportAs: 'matStep',
  34738. changeDetection: core.ChangeDetectionStrategy.OnPush,
  34739. },] },
  34740. ];
  34741. /** @nocollapse */
  34742. MatStep.ctorParameters = function () { return [
  34743. { type: MatStepper, decorators: [{ type: core.Inject, args: [core.forwardRef((/**
  34744. * @return {?}
  34745. */
  34746. function () { return MatStepper; })),] }] },
  34747. { type: ErrorStateMatcher, decorators: [{ type: core.SkipSelf }] },
  34748. { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [stepper.STEPPER_GLOBAL_OPTIONS,] }] }
  34749. ]; };
  34750. MatStep.propDecorators = {
  34751. stepLabel: [{ type: core.ContentChild, args: [MatStepLabel, { static: false },] }]
  34752. };
  34753. return MatStep;
  34754. }(stepper.CdkStep));
  34755. var MatStepper = /** @class */ (function (_super) {
  34756. __extends(MatStepper, _super);
  34757. function MatStepper() {
  34758. var _this = _super !== null && _super.apply(this, arguments) || this;
  34759. /**
  34760. * Event emitted when the current step is done transitioning in.
  34761. */
  34762. _this.animationDone = new core.EventEmitter();
  34763. /**
  34764. * Consumer-specified template-refs to be used to override the header icons.
  34765. */
  34766. _this._iconOverrides = {};
  34767. /**
  34768. * Stream of animation `done` events when the body expands/collapses.
  34769. */
  34770. _this._animationDone = new rxjs.Subject();
  34771. return _this;
  34772. }
  34773. /**
  34774. * @return {?}
  34775. */
  34776. MatStepper.prototype.ngAfterContentInit = /**
  34777. * @return {?}
  34778. */
  34779. function () {
  34780. var _this = this;
  34781. this._icons.forEach((/**
  34782. * @param {?} __0
  34783. * @return {?}
  34784. */
  34785. function (_a) {
  34786. var name = _a.name, templateRef = _a.templateRef;
  34787. return _this._iconOverrides[name] = templateRef;
  34788. }));
  34789. // Mark the component for change detection whenever the content children query changes
  34790. this._steps.changes.pipe(operators.takeUntil(this._destroyed)).subscribe((/**
  34791. * @return {?}
  34792. */
  34793. function () { return _this._stateChanged(); }));
  34794. this._animationDone.pipe(
  34795. // This needs a `distinctUntilChanged` in order to avoid emitting the same event twice due
  34796. // to a bug in animations where the `.done` callback gets invoked twice on some browsers.
  34797. // See https://github.com/angular/angular/issues/24084
  34798. operators.distinctUntilChanged((/**
  34799. * @param {?} x
  34800. * @param {?} y
  34801. * @return {?}
  34802. */
  34803. function (x, y) { return x.fromState === y.fromState && x.toState === y.toState; })), operators.takeUntil(this._destroyed)).subscribe((/**
  34804. * @param {?} event
  34805. * @return {?}
  34806. */
  34807. function (event) {
  34808. if (((/** @type {?} */ (event.toState))) === 'current') {
  34809. _this.animationDone.emit();
  34810. }
  34811. }));
  34812. };
  34813. MatStepper.decorators = [
  34814. { type: core.Directive, args: [{ selector: '[matStepper]', providers: [{ provide: stepper.CdkStepper, useExisting: MatStepper }] },] },
  34815. ];
  34816. MatStepper.propDecorators = {
  34817. _stepHeader: [{ type: core.ViewChildren, args: [MatStepHeader,] }],
  34818. _steps: [{ type: core.ContentChildren, args: [MatStep,] }],
  34819. _icons: [{ type: core.ContentChildren, args: [MatStepperIcon,] }],
  34820. animationDone: [{ type: core.Output }],
  34821. disableRipple: [{ type: core.Input }]
  34822. };
  34823. return MatStepper;
  34824. }(stepper.CdkStepper));
  34825. var MatHorizontalStepper = /** @class */ (function (_super) {
  34826. __extends(MatHorizontalStepper, _super);
  34827. function MatHorizontalStepper() {
  34828. var _this = _super !== null && _super.apply(this, arguments) || this;
  34829. /**
  34830. * Whether the label should display in bottom or end position.
  34831. */
  34832. _this.labelPosition = 'end';
  34833. return _this;
  34834. }
  34835. MatHorizontalStepper.decorators = [
  34836. { type: core.Component, args: [{selector: 'mat-horizontal-stepper',
  34837. exportAs: 'matHorizontalStepper',
  34838. template: "<div class=\"mat-horizontal-stepper-header-container\"><ng-container *ngFor=\"let step of steps; let i = index; let isLast = last\"><mat-step-header class=\"mat-horizontal-stepper-header\" (click)=\"step.select()\" (keydown)=\"_onKeydown($event)\" [tabIndex]=\"_getFocusIndex() === i ? 0 : -1\" [id]=\"_getStepLabelId(i)\" [attr.aria-posinset]=\"i + 1\" [attr.aria-setsize]=\"steps.length\" [attr.aria-controls]=\"_getStepContentId(i)\" [attr.aria-selected]=\"selectedIndex == i\" [attr.aria-label]=\"step.ariaLabel || null\" [attr.aria-labelledby]=\"(!step.ariaLabel && step.ariaLabelledby) ? step.ariaLabelledby : null\" [index]=\"i\" [state]=\"_getIndicatorType(i, step.state)\" [label]=\"step.stepLabel || step.label\" [selected]=\"selectedIndex === i\" [active]=\"step.completed || selectedIndex === i || !linear\" [optional]=\"step.optional\" [errorMessage]=\"step.errorMessage\" [iconOverrides]=\"_iconOverrides\" [disableRipple]=\"disableRipple\"></mat-step-header><div *ngIf=\"!isLast\" class=\"mat-stepper-horizontal-line\"></div></ng-container></div><div class=\"mat-horizontal-content-container\"><div *ngFor=\"let step of steps; let i = index\" [attr.tabindex]=\"selectedIndex === i ? 0 : null\" class=\"mat-horizontal-stepper-content\" role=\"tabpanel\" [@stepTransition]=\"_getAnimationDirection(i)\" (@stepTransition.done)=\"_animationDone.next($event)\" [id]=\"_getStepContentId(i)\" [attr.aria-labelledby]=\"_getStepLabelId(i)\" [attr.aria-expanded]=\"selectedIndex === i\"><ng-container [ngTemplateOutlet]=\"step.content\"></ng-container></div></div>",
  34839. styles: [".mat-stepper-horizontal,.mat-stepper-vertical{display:block}.mat-horizontal-stepper-header-container{white-space:nowrap;display:flex;align-items:center}.mat-stepper-label-position-bottom .mat-horizontal-stepper-header-container{align-items:flex-start}.mat-stepper-horizontal-line{border-top-width:1px;border-top-style:solid;flex:auto;height:0;margin:0 -16px;min-width:32px}.mat-stepper-label-position-bottom .mat-stepper-horizontal-line{margin:0;min-width:0;position:relative;top:36px}.mat-stepper-label-position-bottom .mat-horizontal-stepper-header:not(:first-child)::before,.mat-stepper-label-position-bottom .mat-horizontal-stepper-header:not(:last-child)::after,[dir=rtl] .mat-stepper-label-position-bottom .mat-horizontal-stepper-header:not(:first-child)::after,[dir=rtl] .mat-stepper-label-position-bottom .mat-horizontal-stepper-header:not(:last-child)::before{border-top-width:1px;border-top-style:solid;content:'';display:inline-block;height:0;position:absolute;top:36px;width:calc(50% - 20px)}.mat-horizontal-stepper-header{display:flex;height:72px;overflow:hidden;align-items:center;padding:0 24px}.mat-horizontal-stepper-header .mat-step-icon{margin-right:8px;flex:none}[dir=rtl] .mat-horizontal-stepper-header .mat-step-icon{margin-right:0;margin-left:8px}.mat-stepper-label-position-bottom .mat-horizontal-stepper-header{box-sizing:border-box;flex-direction:column;height:auto;padding:24px}.mat-stepper-label-position-bottom .mat-horizontal-stepper-header:not(:last-child)::after,[dir=rtl] .mat-stepper-label-position-bottom .mat-horizontal-stepper-header:not(:first-child)::after{right:0}.mat-stepper-label-position-bottom .mat-horizontal-stepper-header:not(:first-child)::before,[dir=rtl] .mat-stepper-label-position-bottom .mat-horizontal-stepper-header:not(:last-child)::before{left:0}[dir=rtl] .mat-stepper-label-position-bottom .mat-horizontal-stepper-header:first-child::after,[dir=rtl] .mat-stepper-label-position-bottom .mat-horizontal-stepper-header:last-child::before{display:none}.mat-stepper-label-position-bottom .mat-horizontal-stepper-header .mat-step-icon{margin-right:0;margin-left:0}.mat-stepper-label-position-bottom .mat-horizontal-stepper-header .mat-step-label{padding:16px 0 0 0;text-align:center;width:100%}.mat-vertical-stepper-header{display:flex;align-items:center;padding:24px;height:24px}.mat-vertical-stepper-header .mat-step-icon{margin-right:12px}[dir=rtl] .mat-vertical-stepper-header .mat-step-icon{margin-right:0;margin-left:12px}.mat-horizontal-stepper-content{outline:0}.mat-horizontal-stepper-content[aria-expanded=false]{height:0;overflow:hidden}.mat-horizontal-content-container{overflow:hidden;padding:0 24px 24px 24px}.mat-vertical-content-container{margin-left:36px;border:0;position:relative}[dir=rtl] .mat-vertical-content-container{margin-left:0;margin-right:36px}.mat-stepper-vertical-line::before{content:'';position:absolute;top:-16px;bottom:-16px;left:0;border-left-width:1px;border-left-style:solid}[dir=rtl] .mat-stepper-vertical-line::before{left:auto;right:0}.mat-vertical-stepper-content{overflow:hidden;outline:0}.mat-vertical-content{padding:0 24px 24px 24px}.mat-step:last-child .mat-vertical-content-container{border:none}"],
  34840. inputs: ['selectedIndex'],
  34841. host: {
  34842. 'class': 'mat-stepper-horizontal',
  34843. '[class.mat-stepper-label-position-end]': 'labelPosition == "end"',
  34844. '[class.mat-stepper-label-position-bottom]': 'labelPosition == "bottom"',
  34845. 'aria-orientation': 'horizontal',
  34846. 'role': 'tablist',
  34847. },
  34848. animations: [matStepperAnimations.horizontalStepTransition],
  34849. providers: [
  34850. { provide: MatStepper, useExisting: MatHorizontalStepper },
  34851. { provide: stepper.CdkStepper, useExisting: MatHorizontalStepper }
  34852. ],
  34853. encapsulation: core.ViewEncapsulation.None,
  34854. changeDetection: core.ChangeDetectionStrategy.OnPush,
  34855. },] },
  34856. ];
  34857. MatHorizontalStepper.propDecorators = {
  34858. labelPosition: [{ type: core.Input }]
  34859. };
  34860. return MatHorizontalStepper;
  34861. }(MatStepper));
  34862. var MatVerticalStepper = /** @class */ (function (_super) {
  34863. __extends(MatVerticalStepper, _super);
  34864. function MatVerticalStepper(dir, changeDetectorRef,
  34865. // @breaking-change 8.0.0 `elementRef` and `_document` parameters to become required.
  34866. elementRef, _document) {
  34867. var _this = _super.call(this, dir, changeDetectorRef, elementRef, _document) || this;
  34868. _this._orientation = 'vertical';
  34869. return _this;
  34870. }
  34871. MatVerticalStepper.decorators = [
  34872. { type: core.Component, args: [{selector: 'mat-vertical-stepper',
  34873. exportAs: 'matVerticalStepper',
  34874. template: "<div class=\"mat-step\" *ngFor=\"let step of steps; let i = index; let isLast = last\"><mat-step-header class=\"mat-vertical-stepper-header\" (click)=\"step.select()\" (keydown)=\"_onKeydown($event)\" [tabIndex]=\"_getFocusIndex() == i ? 0 : -1\" [id]=\"_getStepLabelId(i)\" [attr.aria-posinset]=\"i + 1\" [attr.aria-setsize]=\"steps.length\" [attr.aria-controls]=\"_getStepContentId(i)\" [attr.aria-selected]=\"selectedIndex === i\" [attr.aria-label]=\"step.ariaLabel || null\" [attr.aria-labelledby]=\"(!step.ariaLabel && step.ariaLabelledby) ? step.ariaLabelledby : null\" [index]=\"i\" [state]=\"_getIndicatorType(i, step.state)\" [label]=\"step.stepLabel || step.label\" [selected]=\"selectedIndex === i\" [active]=\"step.completed || selectedIndex === i || !linear\" [optional]=\"step.optional\" [errorMessage]=\"step.errorMessage\" [iconOverrides]=\"_iconOverrides\" [disableRipple]=\"disableRipple\"></mat-step-header><div class=\"mat-vertical-content-container\" [class.mat-stepper-vertical-line]=\"!isLast\"><div class=\"mat-vertical-stepper-content\" role=\"tabpanel\" [attr.tabindex]=\"selectedIndex === i ? 0 : null\" [@stepTransition]=\"_getAnimationDirection(i)\" (@stepTransition.done)=\"_animationDone.next($event)\" [id]=\"_getStepContentId(i)\" [attr.aria-labelledby]=\"_getStepLabelId(i)\" [attr.aria-expanded]=\"selectedIndex === i\"><div class=\"mat-vertical-content\"><ng-container [ngTemplateOutlet]=\"step.content\"></ng-container></div></div></div></div>",
  34875. styles: [".mat-stepper-horizontal,.mat-stepper-vertical{display:block}.mat-horizontal-stepper-header-container{white-space:nowrap;display:flex;align-items:center}.mat-stepper-label-position-bottom .mat-horizontal-stepper-header-container{align-items:flex-start}.mat-stepper-horizontal-line{border-top-width:1px;border-top-style:solid;flex:auto;height:0;margin:0 -16px;min-width:32px}.mat-stepper-label-position-bottom .mat-stepper-horizontal-line{margin:0;min-width:0;position:relative;top:36px}.mat-stepper-label-position-bottom .mat-horizontal-stepper-header:not(:first-child)::before,.mat-stepper-label-position-bottom .mat-horizontal-stepper-header:not(:last-child)::after,[dir=rtl] .mat-stepper-label-position-bottom .mat-horizontal-stepper-header:not(:first-child)::after,[dir=rtl] .mat-stepper-label-position-bottom .mat-horizontal-stepper-header:not(:last-child)::before{border-top-width:1px;border-top-style:solid;content:'';display:inline-block;height:0;position:absolute;top:36px;width:calc(50% - 20px)}.mat-horizontal-stepper-header{display:flex;height:72px;overflow:hidden;align-items:center;padding:0 24px}.mat-horizontal-stepper-header .mat-step-icon{margin-right:8px;flex:none}[dir=rtl] .mat-horizontal-stepper-header .mat-step-icon{margin-right:0;margin-left:8px}.mat-stepper-label-position-bottom .mat-horizontal-stepper-header{box-sizing:border-box;flex-direction:column;height:auto;padding:24px}.mat-stepper-label-position-bottom .mat-horizontal-stepper-header:not(:last-child)::after,[dir=rtl] .mat-stepper-label-position-bottom .mat-horizontal-stepper-header:not(:first-child)::after{right:0}.mat-stepper-label-position-bottom .mat-horizontal-stepper-header:not(:first-child)::before,[dir=rtl] .mat-stepper-label-position-bottom .mat-horizontal-stepper-header:not(:last-child)::before{left:0}[dir=rtl] .mat-stepper-label-position-bottom .mat-horizontal-stepper-header:first-child::after,[dir=rtl] .mat-stepper-label-position-bottom .mat-horizontal-stepper-header:last-child::before{display:none}.mat-stepper-label-position-bottom .mat-horizontal-stepper-header .mat-step-icon{margin-right:0;margin-left:0}.mat-stepper-label-position-bottom .mat-horizontal-stepper-header .mat-step-label{padding:16px 0 0 0;text-align:center;width:100%}.mat-vertical-stepper-header{display:flex;align-items:center;padding:24px;height:24px}.mat-vertical-stepper-header .mat-step-icon{margin-right:12px}[dir=rtl] .mat-vertical-stepper-header .mat-step-icon{margin-right:0;margin-left:12px}.mat-horizontal-stepper-content{outline:0}.mat-horizontal-stepper-content[aria-expanded=false]{height:0;overflow:hidden}.mat-horizontal-content-container{overflow:hidden;padding:0 24px 24px 24px}.mat-vertical-content-container{margin-left:36px;border:0;position:relative}[dir=rtl] .mat-vertical-content-container{margin-left:0;margin-right:36px}.mat-stepper-vertical-line::before{content:'';position:absolute;top:-16px;bottom:-16px;left:0;border-left-width:1px;border-left-style:solid}[dir=rtl] .mat-stepper-vertical-line::before{left:auto;right:0}.mat-vertical-stepper-content{overflow:hidden;outline:0}.mat-vertical-content{padding:0 24px 24px 24px}.mat-step:last-child .mat-vertical-content-container{border:none}"],
  34876. inputs: ['selectedIndex'],
  34877. host: {
  34878. 'class': 'mat-stepper-vertical',
  34879. 'aria-orientation': 'vertical',
  34880. 'role': 'tablist',
  34881. },
  34882. animations: [matStepperAnimations.verticalStepTransition],
  34883. providers: [
  34884. { provide: MatStepper, useExisting: MatVerticalStepper },
  34885. { provide: stepper.CdkStepper, useExisting: MatVerticalStepper }
  34886. ],
  34887. encapsulation: core.ViewEncapsulation.None,
  34888. changeDetection: core.ChangeDetectionStrategy.OnPush,
  34889. },] },
  34890. ];
  34891. /** @nocollapse */
  34892. MatVerticalStepper.ctorParameters = function () { return [
  34893. { type: bidi.Directionality, decorators: [{ type: core.Optional }] },
  34894. { type: core.ChangeDetectorRef },
  34895. { type: core.ElementRef },
  34896. { type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] }
  34897. ]; };
  34898. return MatVerticalStepper;
  34899. }(MatStepper));
  34900. /**
  34901. * @fileoverview added by tsickle
  34902. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  34903. */
  34904. /**
  34905. * Button that moves to the next step in a stepper workflow.
  34906. */
  34907. var MatStepperNext = /** @class */ (function (_super) {
  34908. __extends(MatStepperNext, _super);
  34909. function MatStepperNext() {
  34910. return _super !== null && _super.apply(this, arguments) || this;
  34911. }
  34912. MatStepperNext.decorators = [
  34913. { type: core.Directive, args: [{
  34914. selector: 'button[matStepperNext]',
  34915. host: {
  34916. '[type]': 'type',
  34917. },
  34918. inputs: ['type']
  34919. },] },
  34920. ];
  34921. return MatStepperNext;
  34922. }(stepper.CdkStepperNext));
  34923. /**
  34924. * Button that moves to the previous step in a stepper workflow.
  34925. */
  34926. var MatStepperPrevious = /** @class */ (function (_super) {
  34927. __extends(MatStepperPrevious, _super);
  34928. function MatStepperPrevious() {
  34929. return _super !== null && _super.apply(this, arguments) || this;
  34930. }
  34931. MatStepperPrevious.decorators = [
  34932. { type: core.Directive, args: [{
  34933. selector: 'button[matStepperPrevious]',
  34934. host: {
  34935. '[type]': 'type',
  34936. },
  34937. inputs: ['type']
  34938. },] },
  34939. ];
  34940. return MatStepperPrevious;
  34941. }(stepper.CdkStepperPrevious));
  34942. /**
  34943. * @fileoverview added by tsickle
  34944. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  34945. */
  34946. var MatStepperModule = /** @class */ (function () {
  34947. function MatStepperModule() {
  34948. }
  34949. MatStepperModule.decorators = [
  34950. { type: core.NgModule, args: [{
  34951. imports: [
  34952. MatCommonModule,
  34953. common.CommonModule,
  34954. portal.PortalModule,
  34955. MatButtonModule,
  34956. stepper.CdkStepperModule,
  34957. MatIconModule,
  34958. MatRippleModule,
  34959. ],
  34960. exports: [
  34961. MatCommonModule,
  34962. MatHorizontalStepper,
  34963. MatVerticalStepper,
  34964. MatStep,
  34965. MatStepLabel,
  34966. MatStepper,
  34967. MatStepperNext,
  34968. MatStepperPrevious,
  34969. MatStepHeader,
  34970. MatStepperIcon,
  34971. ],
  34972. declarations: [
  34973. MatHorizontalStepper,
  34974. MatVerticalStepper,
  34975. MatStep,
  34976. MatStepLabel,
  34977. MatStepper,
  34978. MatStepperNext,
  34979. MatStepperPrevious,
  34980. MatStepHeader,
  34981. MatStepperIcon,
  34982. ],
  34983. providers: [MAT_STEPPER_INTL_PROVIDER, ErrorStateMatcher],
  34984. },] },
  34985. ];
  34986. return MatStepperModule;
  34987. }());
  34988. /**
  34989. * @fileoverview added by tsickle
  34990. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  34991. */
  34992. /**
  34993. * Wrapper for the CdkTable with Material design styles.
  34994. * @template T
  34995. */
  34996. var MatTable = /** @class */ (function (_super) {
  34997. __extends(MatTable, _super);
  34998. function MatTable() {
  34999. var _this = _super !== null && _super.apply(this, arguments) || this;
  35000. /**
  35001. * Overrides the sticky CSS class set by the `CdkTable`.
  35002. */
  35003. _this.stickyCssClass = 'mat-table-sticky';
  35004. return _this;
  35005. }
  35006. MatTable.decorators = [
  35007. { type: core.Component, args: [{selector: 'mat-table, table[mat-table]',
  35008. exportAs: 'matTable',
  35009. template: table.CDK_TABLE_TEMPLATE,
  35010. styles: ["mat-table{display:block}mat-header-row{min-height:56px}mat-footer-row,mat-row{min-height:48px}mat-footer-row,mat-header-row,mat-row{display:flex;border-width:0;border-bottom-width:1px;border-style:solid;align-items:center;box-sizing:border-box}mat-footer-row::after,mat-header-row::after,mat-row::after{display:inline-block;min-height:inherit;content:''}mat-cell:first-of-type,mat-footer-cell:first-of-type,mat-header-cell:first-of-type{padding-left:24px}[dir=rtl] mat-cell:first-of-type,[dir=rtl] mat-footer-cell:first-of-type,[dir=rtl] mat-header-cell:first-of-type{padding-left:0;padding-right:24px}mat-cell:last-of-type,mat-footer-cell:last-of-type,mat-header-cell:last-of-type{padding-right:24px}[dir=rtl] mat-cell:last-of-type,[dir=rtl] mat-footer-cell:last-of-type,[dir=rtl] mat-header-cell:last-of-type{padding-right:0;padding-left:24px}mat-cell,mat-footer-cell,mat-header-cell{flex:1;display:flex;align-items:center;overflow:hidden;word-wrap:break-word;min-height:inherit}table.mat-table{border-spacing:0}tr.mat-header-row{height:56px}tr.mat-footer-row,tr.mat-row{height:48px}th.mat-header-cell{text-align:left}[dir=rtl] th.mat-header-cell{text-align:right}td.mat-cell,td.mat-footer-cell,th.mat-header-cell{padding:0;border-bottom-width:1px;border-bottom-style:solid}td.mat-cell:first-of-type,td.mat-footer-cell:first-of-type,th.mat-header-cell:first-of-type{padding-left:24px}[dir=rtl] td.mat-cell:first-of-type,[dir=rtl] td.mat-footer-cell:first-of-type,[dir=rtl] th.mat-header-cell:first-of-type{padding-left:0;padding-right:24px}td.mat-cell:last-of-type,td.mat-footer-cell:last-of-type,th.mat-header-cell:last-of-type{padding-right:24px}[dir=rtl] td.mat-cell:last-of-type,[dir=rtl] td.mat-footer-cell:last-of-type,[dir=rtl] th.mat-header-cell:last-of-type{padding-right:0;padding-left:24px}"],
  35011. host: {
  35012. 'class': 'mat-table',
  35013. },
  35014. providers: [{ provide: table.CdkTable, useExisting: MatTable }],
  35015. encapsulation: core.ViewEncapsulation.None,
  35016. // See note on CdkTable for explanation on why this uses the default change detection strategy.
  35017. // tslint:disable-next-line:validate-decorators
  35018. changeDetection: core.ChangeDetectionStrategy.Default,
  35019. },] },
  35020. ];
  35021. return MatTable;
  35022. }(table.CdkTable));
  35023. /**
  35024. * @fileoverview added by tsickle
  35025. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  35026. */
  35027. /**
  35028. * Cell definition for the mat-table.
  35029. * Captures the template of a column's data row cell as well as cell-specific properties.
  35030. */
  35031. var MatCellDef = /** @class */ (function (_super) {
  35032. __extends(MatCellDef, _super);
  35033. function MatCellDef() {
  35034. return _super !== null && _super.apply(this, arguments) || this;
  35035. }
  35036. MatCellDef.decorators = [
  35037. { type: core.Directive, args: [{
  35038. selector: '[matCellDef]',
  35039. providers: [{ provide: table.CdkCellDef, useExisting: MatCellDef }]
  35040. },] },
  35041. ];
  35042. return MatCellDef;
  35043. }(table.CdkCellDef));
  35044. /**
  35045. * Header cell definition for the mat-table.
  35046. * Captures the template of a column's header cell and as well as cell-specific properties.
  35047. */
  35048. var MatHeaderCellDef = /** @class */ (function (_super) {
  35049. __extends(MatHeaderCellDef, _super);
  35050. function MatHeaderCellDef() {
  35051. return _super !== null && _super.apply(this, arguments) || this;
  35052. }
  35053. MatHeaderCellDef.decorators = [
  35054. { type: core.Directive, args: [{
  35055. selector: '[matHeaderCellDef]',
  35056. providers: [{ provide: table.CdkHeaderCellDef, useExisting: MatHeaderCellDef }]
  35057. },] },
  35058. ];
  35059. return MatHeaderCellDef;
  35060. }(table.CdkHeaderCellDef));
  35061. /**
  35062. * Footer cell definition for the mat-table.
  35063. * Captures the template of a column's footer cell and as well as cell-specific properties.
  35064. */
  35065. var MatFooterCellDef = /** @class */ (function (_super) {
  35066. __extends(MatFooterCellDef, _super);
  35067. function MatFooterCellDef() {
  35068. return _super !== null && _super.apply(this, arguments) || this;
  35069. }
  35070. MatFooterCellDef.decorators = [
  35071. { type: core.Directive, args: [{
  35072. selector: '[matFooterCellDef]',
  35073. providers: [{ provide: table.CdkFooterCellDef, useExisting: MatFooterCellDef }]
  35074. },] },
  35075. ];
  35076. return MatFooterCellDef;
  35077. }(table.CdkFooterCellDef));
  35078. /**
  35079. * Column definition for the mat-table.
  35080. * Defines a set of cells available for a table column.
  35081. */
  35082. var MatColumnDef = /** @class */ (function (_super) {
  35083. __extends(MatColumnDef, _super);
  35084. function MatColumnDef() {
  35085. return _super !== null && _super.apply(this, arguments) || this;
  35086. }
  35087. MatColumnDef.decorators = [
  35088. { type: core.Directive, args: [{
  35089. selector: '[matColumnDef]',
  35090. providers: [
  35091. { provide: table.CdkColumnDef, useExisting: MatColumnDef },
  35092. { provide: 'MAT_SORT_HEADER_COLUMN_DEF', useExisting: MatColumnDef }
  35093. ],
  35094. },] },
  35095. ];
  35096. MatColumnDef.propDecorators = {
  35097. name: [{ type: core.Input, args: ['matColumnDef',] }],
  35098. sticky: [{ type: core.Input }],
  35099. stickyEnd: [{ type: core.Input }]
  35100. };
  35101. return MatColumnDef;
  35102. }(table.CdkColumnDef));
  35103. /**
  35104. * Header cell template container that adds the right classes and role.
  35105. */
  35106. var MatHeaderCell = /** @class */ (function (_super) {
  35107. __extends(MatHeaderCell, _super);
  35108. function MatHeaderCell(columnDef, elementRef) {
  35109. var _this = _super.call(this, columnDef, elementRef) || this;
  35110. elementRef.nativeElement.classList.add("mat-column-" + columnDef.cssClassFriendlyName);
  35111. return _this;
  35112. }
  35113. MatHeaderCell.decorators = [
  35114. { type: core.Directive, args: [{
  35115. selector: 'mat-header-cell, th[mat-header-cell]',
  35116. host: {
  35117. 'class': 'mat-header-cell',
  35118. 'role': 'columnheader',
  35119. },
  35120. },] },
  35121. ];
  35122. /** @nocollapse */
  35123. MatHeaderCell.ctorParameters = function () { return [
  35124. { type: table.CdkColumnDef },
  35125. { type: core.ElementRef }
  35126. ]; };
  35127. return MatHeaderCell;
  35128. }(table.CdkHeaderCell));
  35129. /**
  35130. * Footer cell template container that adds the right classes and role.
  35131. */
  35132. var MatFooterCell = /** @class */ (function (_super) {
  35133. __extends(MatFooterCell, _super);
  35134. function MatFooterCell(columnDef, elementRef) {
  35135. var _this = _super.call(this, columnDef, elementRef) || this;
  35136. elementRef.nativeElement.classList.add("mat-column-" + columnDef.cssClassFriendlyName);
  35137. return _this;
  35138. }
  35139. MatFooterCell.decorators = [
  35140. { type: core.Directive, args: [{
  35141. selector: 'mat-footer-cell, td[mat-footer-cell]',
  35142. host: {
  35143. 'class': 'mat-footer-cell',
  35144. 'role': 'gridcell',
  35145. },
  35146. },] },
  35147. ];
  35148. /** @nocollapse */
  35149. MatFooterCell.ctorParameters = function () { return [
  35150. { type: table.CdkColumnDef },
  35151. { type: core.ElementRef }
  35152. ]; };
  35153. return MatFooterCell;
  35154. }(table.CdkFooterCell));
  35155. /**
  35156. * Cell template container that adds the right classes and role.
  35157. */
  35158. var MatCell = /** @class */ (function (_super) {
  35159. __extends(MatCell, _super);
  35160. function MatCell(columnDef, elementRef) {
  35161. var _this = _super.call(this, columnDef, elementRef) || this;
  35162. elementRef.nativeElement.classList.add("mat-column-" + columnDef.cssClassFriendlyName);
  35163. return _this;
  35164. }
  35165. MatCell.decorators = [
  35166. { type: core.Directive, args: [{
  35167. selector: 'mat-cell, td[mat-cell]',
  35168. host: {
  35169. 'class': 'mat-cell',
  35170. 'role': 'gridcell',
  35171. },
  35172. },] },
  35173. ];
  35174. /** @nocollapse */
  35175. MatCell.ctorParameters = function () { return [
  35176. { type: table.CdkColumnDef },
  35177. { type: core.ElementRef }
  35178. ]; };
  35179. return MatCell;
  35180. }(table.CdkCell));
  35181. /**
  35182. * @fileoverview added by tsickle
  35183. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  35184. */
  35185. /**
  35186. * Header row definition for the mat-table.
  35187. * Captures the header row's template and other header properties such as the columns to display.
  35188. */
  35189. var MatHeaderRowDef = /** @class */ (function (_super) {
  35190. __extends(MatHeaderRowDef, _super);
  35191. function MatHeaderRowDef() {
  35192. return _super !== null && _super.apply(this, arguments) || this;
  35193. }
  35194. MatHeaderRowDef.decorators = [
  35195. { type: core.Directive, args: [{
  35196. selector: '[matHeaderRowDef]',
  35197. providers: [{ provide: table.CdkHeaderRowDef, useExisting: MatHeaderRowDef }],
  35198. inputs: ['columns: matHeaderRowDef', 'sticky: matHeaderRowDefSticky'],
  35199. },] },
  35200. ];
  35201. return MatHeaderRowDef;
  35202. }(table.CdkHeaderRowDef));
  35203. /**
  35204. * Footer row definition for the mat-table.
  35205. * Captures the footer row's template and other footer properties such as the columns to display.
  35206. */
  35207. var MatFooterRowDef = /** @class */ (function (_super) {
  35208. __extends(MatFooterRowDef, _super);
  35209. function MatFooterRowDef() {
  35210. return _super !== null && _super.apply(this, arguments) || this;
  35211. }
  35212. MatFooterRowDef.decorators = [
  35213. { type: core.Directive, args: [{
  35214. selector: '[matFooterRowDef]',
  35215. providers: [{ provide: table.CdkFooterRowDef, useExisting: MatFooterRowDef }],
  35216. inputs: ['columns: matFooterRowDef', 'sticky: matFooterRowDefSticky'],
  35217. },] },
  35218. ];
  35219. return MatFooterRowDef;
  35220. }(table.CdkFooterRowDef));
  35221. /**
  35222. * Data row definition for the mat-table.
  35223. * Captures the data row's template and other properties such as the columns to display and
  35224. * a when predicate that describes when this row should be used.
  35225. * @template T
  35226. */
  35227. var MatRowDef = /** @class */ (function (_super) {
  35228. __extends(MatRowDef, _super);
  35229. function MatRowDef() {
  35230. return _super !== null && _super.apply(this, arguments) || this;
  35231. }
  35232. MatRowDef.decorators = [
  35233. { type: core.Directive, args: [{
  35234. selector: '[matRowDef]',
  35235. providers: [{ provide: table.CdkRowDef, useExisting: MatRowDef }],
  35236. inputs: ['columns: matRowDefColumns', 'when: matRowDefWhen'],
  35237. },] },
  35238. ];
  35239. return MatRowDef;
  35240. }(table.CdkRowDef));
  35241. /**
  35242. * Footer template container that contains the cell outlet. Adds the right class and role.
  35243. */
  35244. var MatHeaderRow = /** @class */ (function (_super) {
  35245. __extends(MatHeaderRow, _super);
  35246. function MatHeaderRow() {
  35247. return _super !== null && _super.apply(this, arguments) || this;
  35248. }
  35249. MatHeaderRow.decorators = [
  35250. { type: core.Component, args: [{selector: 'mat-header-row, tr[mat-header-row]',
  35251. template: table.CDK_ROW_TEMPLATE,
  35252. host: {
  35253. 'class': 'mat-header-row',
  35254. 'role': 'row',
  35255. },
  35256. // See note on CdkTable for explanation on why this uses the default change detection strategy.
  35257. // tslint:disable-next-line:validate-decorators
  35258. changeDetection: core.ChangeDetectionStrategy.Default,
  35259. encapsulation: core.ViewEncapsulation.None,
  35260. exportAs: 'matHeaderRow',
  35261. providers: [{ provide: table.CdkHeaderRow, useExisting: MatHeaderRow }],
  35262. },] },
  35263. ];
  35264. return MatHeaderRow;
  35265. }(table.CdkHeaderRow));
  35266. /**
  35267. * Footer template container that contains the cell outlet. Adds the right class and role.
  35268. */
  35269. var MatFooterRow = /** @class */ (function (_super) {
  35270. __extends(MatFooterRow, _super);
  35271. function MatFooterRow() {
  35272. return _super !== null && _super.apply(this, arguments) || this;
  35273. }
  35274. MatFooterRow.decorators = [
  35275. { type: core.Component, args: [{selector: 'mat-footer-row, tr[mat-footer-row]',
  35276. template: table.CDK_ROW_TEMPLATE,
  35277. host: {
  35278. 'class': 'mat-footer-row',
  35279. 'role': 'row',
  35280. },
  35281. // See note on CdkTable for explanation on why this uses the default change detection strategy.
  35282. // tslint:disable-next-line:validate-decorators
  35283. changeDetection: core.ChangeDetectionStrategy.Default,
  35284. encapsulation: core.ViewEncapsulation.None,
  35285. exportAs: 'matFooterRow',
  35286. providers: [{ provide: table.CdkFooterRow, useExisting: MatFooterRow }],
  35287. },] },
  35288. ];
  35289. return MatFooterRow;
  35290. }(table.CdkFooterRow));
  35291. /**
  35292. * Data row template container that contains the cell outlet. Adds the right class and role.
  35293. */
  35294. var MatRow = /** @class */ (function (_super) {
  35295. __extends(MatRow, _super);
  35296. function MatRow() {
  35297. return _super !== null && _super.apply(this, arguments) || this;
  35298. }
  35299. MatRow.decorators = [
  35300. { type: core.Component, args: [{selector: 'mat-row, tr[mat-row]',
  35301. template: table.CDK_ROW_TEMPLATE,
  35302. host: {
  35303. 'class': 'mat-row',
  35304. 'role': 'row',
  35305. },
  35306. // See note on CdkTable for explanation on why this uses the default change detection strategy.
  35307. // tslint:disable-next-line:validate-decorators
  35308. changeDetection: core.ChangeDetectionStrategy.Default,
  35309. encapsulation: core.ViewEncapsulation.None,
  35310. exportAs: 'matRow',
  35311. providers: [{ provide: table.CdkRow, useExisting: MatRow }],
  35312. },] },
  35313. ];
  35314. return MatRow;
  35315. }(table.CdkRow));
  35316. /**
  35317. * @fileoverview added by tsickle
  35318. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  35319. */
  35320. /**
  35321. * Column that simply shows text content for the header and row cells. Assumes that the table
  35322. * is using the native table implementation (`<table>`).
  35323. *
  35324. * By default, the name of this column will be the header text and data property accessor.
  35325. * The header text can be overridden with the `headerText` input. Cell values can be overridden with
  35326. * the `dataAccessor` input. Change the text justification to the start or end using the `justify`
  35327. * input.
  35328. * @template T
  35329. */
  35330. var MatTextColumn = /** @class */ (function (_super) {
  35331. __extends(MatTextColumn, _super);
  35332. function MatTextColumn() {
  35333. return _super !== null && _super.apply(this, arguments) || this;
  35334. }
  35335. MatTextColumn.decorators = [
  35336. { type: core.Component, args: [{selector: 'mat-text-column',
  35337. template: "\n <ng-container matColumnDef>\n <th mat-header-cell *matHeaderCellDef [style.text-align]=\"justify\">\n {{headerText}}\n </th>\n <td mat-cell *matCellDef=\"let data\" [style.text-align]=\"justify\">\n {{dataAccessor(data, name)}}\n </td>\n </ng-container>\n ",
  35338. encapsulation: core.ViewEncapsulation.None,
  35339. // Change detection is intentionally not set to OnPush. This component's template will be provided
  35340. // to the table to be inserted into its view. This is problematic when change detection runs since
  35341. // the bindings in this template will be evaluated _after_ the table's view is evaluated, which
  35342. // mean's the template in the table's view will not have the updated value (and in fact will cause
  35343. // an ExpressionChangedAfterItHasBeenCheckedError).
  35344. // tslint:disable-next-line:validate-decorators
  35345. changeDetection: core.ChangeDetectionStrategy.Default,
  35346. },] },
  35347. ];
  35348. return MatTextColumn;
  35349. }(table.CdkTextColumn));
  35350. /**
  35351. * @fileoverview added by tsickle
  35352. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  35353. */
  35354. /** @type {?} */
  35355. var EXPORTED_DECLARATIONS = [
  35356. // Table
  35357. MatTable,
  35358. // Template defs
  35359. MatHeaderCellDef,
  35360. MatHeaderRowDef,
  35361. MatColumnDef,
  35362. MatCellDef,
  35363. MatRowDef,
  35364. MatFooterCellDef,
  35365. MatFooterRowDef,
  35366. // Cell directives
  35367. MatHeaderCell,
  35368. MatCell,
  35369. MatFooterCell,
  35370. // Row directives
  35371. MatHeaderRow,
  35372. MatRow,
  35373. MatFooterRow,
  35374. MatTextColumn,
  35375. ];
  35376. var MatTableModule = /** @class */ (function () {
  35377. function MatTableModule() {
  35378. }
  35379. MatTableModule.decorators = [
  35380. { type: core.NgModule, args: [{
  35381. imports: [
  35382. table.CdkTableModule,
  35383. common.CommonModule,
  35384. MatCommonModule,
  35385. ],
  35386. exports: EXPORTED_DECLARATIONS,
  35387. declarations: EXPORTED_DECLARATIONS,
  35388. },] },
  35389. ];
  35390. return MatTableModule;
  35391. }());
  35392. /**
  35393. * @fileoverview added by tsickle
  35394. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  35395. */
  35396. /**
  35397. * Corresponds to `Number.MAX_SAFE_INTEGER`. Moved out into a variable here due to
  35398. * flaky browser support and the value not being defined in Closure's typings.
  35399. * @type {?}
  35400. */
  35401. var MAX_SAFE_INTEGER = 9007199254740991;
  35402. /**
  35403. * Data source that accepts a client-side data array and includes native support of filtering,
  35404. * sorting (using MatSort), and pagination (using MatPaginator).
  35405. *
  35406. * Allows for sort customization by overriding sortingDataAccessor, which defines how data
  35407. * properties are accessed. Also allows for filter customization by overriding filterTermAccessor,
  35408. * which defines how row data is converted to a string for filter matching.
  35409. * @template T
  35410. */
  35411. var /**
  35412. * Data source that accepts a client-side data array and includes native support of filtering,
  35413. * sorting (using MatSort), and pagination (using MatPaginator).
  35414. *
  35415. * Allows for sort customization by overriding sortingDataAccessor, which defines how data
  35416. * properties are accessed. Also allows for filter customization by overriding filterTermAccessor,
  35417. * which defines how row data is converted to a string for filter matching.
  35418. * @template T
  35419. */
  35420. MatTableDataSource = /** @class */ (function (_super) {
  35421. __extends(MatTableDataSource, _super);
  35422. function MatTableDataSource(initialData) {
  35423. if (initialData === void 0) { initialData = []; }
  35424. var _this = _super.call(this) || this;
  35425. /**
  35426. * Stream emitting render data to the table (depends on ordered data changes).
  35427. */
  35428. _this._renderData = new rxjs.BehaviorSubject([]);
  35429. /**
  35430. * Stream that emits when a new filter string is set on the data source.
  35431. */
  35432. _this._filter = new rxjs.BehaviorSubject('');
  35433. /**
  35434. * Used to react to internal changes of the paginator that are made by the data source itself.
  35435. */
  35436. _this._internalPageChanges = new rxjs.Subject();
  35437. /**
  35438. * Subscription to the changes that should trigger an update to the table's rendered rows, such
  35439. * as filtering, sorting, pagination, or base data changes.
  35440. */
  35441. _this._renderChangesSubscription = rxjs.Subscription.EMPTY;
  35442. /**
  35443. * Data accessor function that is used for accessing data properties for sorting through
  35444. * the default sortData function.
  35445. * This default function assumes that the sort header IDs (which defaults to the column name)
  35446. * matches the data's properties (e.g. column Xyz represents data['Xyz']).
  35447. * May be set to a custom function for different behavior.
  35448. * @param data Data object that is being accessed.
  35449. * @param sortHeaderId The name of the column that represents the data.
  35450. */
  35451. _this.sortingDataAccessor = (/**
  35452. * @param {?} data
  35453. * @param {?} sortHeaderId
  35454. * @return {?}
  35455. */
  35456. function (data, sortHeaderId) {
  35457. /** @type {?} */
  35458. var value = ((/** @type {?} */ (data)))[sortHeaderId];
  35459. if (coercion._isNumberValue(value)) {
  35460. /** @type {?} */
  35461. var numberValue = Number(value);
  35462. // Numbers beyond `MAX_SAFE_INTEGER` can't be compared reliably so we
  35463. // leave them as strings. For more info: https://goo.gl/y5vbSg
  35464. return numberValue < MAX_SAFE_INTEGER ? numberValue : value;
  35465. }
  35466. return value;
  35467. });
  35468. /**
  35469. * Gets a sorted copy of the data array based on the state of the MatSort. Called
  35470. * after changes are made to the filtered data or when sort changes are emitted from MatSort.
  35471. * By default, the function retrieves the active sort and its direction and compares data
  35472. * by retrieving data using the sortingDataAccessor. May be overridden for a custom implementation
  35473. * of data ordering.
  35474. * @param data The array of data that should be sorted.
  35475. * @param sort The connected MatSort that holds the current sort state.
  35476. */
  35477. _this.sortData = (/**
  35478. * @param {?} data
  35479. * @param {?} sort
  35480. * @return {?}
  35481. */
  35482. function (data, sort) {
  35483. /** @type {?} */
  35484. var active = sort.active;
  35485. /** @type {?} */
  35486. var direction = sort.direction;
  35487. if (!active || direction == '') {
  35488. return data;
  35489. }
  35490. return data.sort((/**
  35491. * @param {?} a
  35492. * @param {?} b
  35493. * @return {?}
  35494. */
  35495. function (a, b) {
  35496. /** @type {?} */
  35497. var valueA = _this.sortingDataAccessor(a, active);
  35498. /** @type {?} */
  35499. var valueB = _this.sortingDataAccessor(b, active);
  35500. // If both valueA and valueB exist (truthy), then compare the two. Otherwise, check if
  35501. // one value exists while the other doesn't. In this case, existing value should come first.
  35502. // This avoids inconsistent results when comparing values to undefined/null.
  35503. // If neither value exists, return 0 (equal).
  35504. /** @type {?} */
  35505. var comparatorResult = 0;
  35506. if (valueA != null && valueB != null) {
  35507. // Check if one value is greater than the other; if equal, comparatorResult should remain 0.
  35508. if (valueA > valueB) {
  35509. comparatorResult = 1;
  35510. }
  35511. else if (valueA < valueB) {
  35512. comparatorResult = -1;
  35513. }
  35514. }
  35515. else if (valueA != null) {
  35516. comparatorResult = 1;
  35517. }
  35518. else if (valueB != null) {
  35519. comparatorResult = -1;
  35520. }
  35521. return comparatorResult * (direction == 'asc' ? 1 : -1);
  35522. }));
  35523. });
  35524. /**
  35525. * Checks if a data object matches the data source's filter string. By default, each data object
  35526. * is converted to a string of its properties and returns true if the filter has
  35527. * at least one occurrence in that string. By default, the filter string has its whitespace
  35528. * trimmed and the match is case-insensitive. May be overridden for a custom implementation of
  35529. * filter matching.
  35530. * @param data Data object used to check against the filter.
  35531. * @param filter Filter string that has been set on the data source.
  35532. * @return Whether the filter matches against the data
  35533. */
  35534. _this.filterPredicate = (/**
  35535. * @param {?} data
  35536. * @param {?} filter
  35537. * @return {?}
  35538. */
  35539. function (data, filter) {
  35540. // Transform the data into a lowercase string of all property values.
  35541. /** @type {?} */
  35542. var dataStr = Object.keys(data).reduce((/**
  35543. * @param {?} currentTerm
  35544. * @param {?} key
  35545. * @return {?}
  35546. */
  35547. function (currentTerm, key) {
  35548. // Use an obscure Unicode character to delimit the words in the concatenated string.
  35549. // This avoids matches where the values of two columns combined will match the user's query
  35550. // (e.g. `Flute` and `Stop` will match `Test`). The character is intended to be something
  35551. // that has a very low chance of being typed in by somebody in a text field. This one in
  35552. // particular is "White up-pointing triangle with dot" from
  35553. // https://en.wikipedia.org/wiki/List_of_Unicode_characters
  35554. return currentTerm + ((/** @type {?} */ (data)))[key] + '◬';
  35555. }), '').toLowerCase();
  35556. // Transform the filter by converting it to lowercase and removing whitespace.
  35557. /** @type {?} */
  35558. var transformedFilter = filter.trim().toLowerCase();
  35559. return dataStr.indexOf(transformedFilter) != -1;
  35560. });
  35561. _this._data = new rxjs.BehaviorSubject(initialData);
  35562. _this._updateChangeSubscription();
  35563. return _this;
  35564. }
  35565. Object.defineProperty(MatTableDataSource.prototype, "data", {
  35566. /** Array of data that should be rendered by the table, where each object represents one row. */
  35567. get: /**
  35568. * Array of data that should be rendered by the table, where each object represents one row.
  35569. * @return {?}
  35570. */
  35571. function () { return this._data.value; },
  35572. set: /**
  35573. * @param {?} data
  35574. * @return {?}
  35575. */
  35576. function (data) { this._data.next(data); },
  35577. enumerable: true,
  35578. configurable: true
  35579. });
  35580. Object.defineProperty(MatTableDataSource.prototype, "filter", {
  35581. /**
  35582. * Filter term that should be used to filter out objects from the data array. To override how
  35583. * data objects match to this filter string, provide a custom function for filterPredicate.
  35584. */
  35585. get: /**
  35586. * Filter term that should be used to filter out objects from the data array. To override how
  35587. * data objects match to this filter string, provide a custom function for filterPredicate.
  35588. * @return {?}
  35589. */
  35590. function () { return this._filter.value; },
  35591. set: /**
  35592. * @param {?} filter
  35593. * @return {?}
  35594. */
  35595. function (filter) { this._filter.next(filter); },
  35596. enumerable: true,
  35597. configurable: true
  35598. });
  35599. Object.defineProperty(MatTableDataSource.prototype, "sort", {
  35600. /**
  35601. * Instance of the MatSort directive used by the table to control its sorting. Sort changes
  35602. * emitted by the MatSort will trigger an update to the table's rendered data.
  35603. */
  35604. get: /**
  35605. * Instance of the MatSort directive used by the table to control its sorting. Sort changes
  35606. * emitted by the MatSort will trigger an update to the table's rendered data.
  35607. * @return {?}
  35608. */
  35609. function () { return this._sort; },
  35610. set: /**
  35611. * @param {?} sort
  35612. * @return {?}
  35613. */
  35614. function (sort) {
  35615. this._sort = sort;
  35616. this._updateChangeSubscription();
  35617. },
  35618. enumerable: true,
  35619. configurable: true
  35620. });
  35621. Object.defineProperty(MatTableDataSource.prototype, "paginator", {
  35622. /**
  35623. * Instance of the MatPaginator component used by the table to control what page of the data is
  35624. * displayed. Page changes emitted by the MatPaginator will trigger an update to the
  35625. * table's rendered data.
  35626. *
  35627. * Note that the data source uses the paginator's properties to calculate which page of data
  35628. * should be displayed. If the paginator receives its properties as template inputs,
  35629. * e.g. `[pageLength]=100` or `[pageIndex]=1`, then be sure that the paginator's view has been
  35630. * initialized before assigning it to this data source.
  35631. */
  35632. get: /**
  35633. * Instance of the MatPaginator component used by the table to control what page of the data is
  35634. * displayed. Page changes emitted by the MatPaginator will trigger an update to the
  35635. * table's rendered data.
  35636. *
  35637. * Note that the data source uses the paginator's properties to calculate which page of data
  35638. * should be displayed. If the paginator receives its properties as template inputs,
  35639. * e.g. `[pageLength]=100` or `[pageIndex]=1`, then be sure that the paginator's view has been
  35640. * initialized before assigning it to this data source.
  35641. * @return {?}
  35642. */
  35643. function () { return this._paginator; },
  35644. set: /**
  35645. * @param {?} paginator
  35646. * @return {?}
  35647. */
  35648. function (paginator) {
  35649. this._paginator = paginator;
  35650. this._updateChangeSubscription();
  35651. },
  35652. enumerable: true,
  35653. configurable: true
  35654. });
  35655. /**
  35656. * Subscribe to changes that should trigger an update to the table's rendered rows. When the
  35657. * changes occur, process the current state of the filter, sort, and pagination along with
  35658. * the provided base data and send it to the table for rendering.
  35659. */
  35660. /**
  35661. * Subscribe to changes that should trigger an update to the table's rendered rows. When the
  35662. * changes occur, process the current state of the filter, sort, and pagination along with
  35663. * the provided base data and send it to the table for rendering.
  35664. * @return {?}
  35665. */
  35666. MatTableDataSource.prototype._updateChangeSubscription = /**
  35667. * Subscribe to changes that should trigger an update to the table's rendered rows. When the
  35668. * changes occur, process the current state of the filter, sort, and pagination along with
  35669. * the provided base data and send it to the table for rendering.
  35670. * @return {?}
  35671. */
  35672. function () {
  35673. var _this = this;
  35674. // Sorting and/or pagination should be watched if MatSort and/or MatPaginator are provided.
  35675. // The events should emit whenever the component emits a change or initializes, or if no
  35676. // component is provided, a stream with just a null event should be provided.
  35677. // The `sortChange` and `pageChange` acts as a signal to the combineLatests below so that the
  35678. // pipeline can progress to the next step. Note that the value from these streams are not used,
  35679. // they purely act as a signal to progress in the pipeline.
  35680. /** @type {?} */
  35681. var sortChange = this._sort ?
  35682. (/** @type {?} */ (rxjs.merge(this._sort.sortChange, this._sort.initialized))) :
  35683. rxjs.of(null);
  35684. /** @type {?} */
  35685. var pageChange = this._paginator ?
  35686. (/** @type {?} */ (rxjs.merge(this._paginator.page, this._internalPageChanges, this._paginator.initialized))) :
  35687. rxjs.of(null);
  35688. /** @type {?} */
  35689. var dataStream = this._data;
  35690. // Watch for base data or filter changes to provide a filtered set of data.
  35691. /** @type {?} */
  35692. var filteredData = rxjs.combineLatest(dataStream, this._filter)
  35693. .pipe(operators.map((/**
  35694. * @param {?} __0
  35695. * @return {?}
  35696. */
  35697. function (_a) {
  35698. var data = _a[0];
  35699. return _this._filterData(data);
  35700. })));
  35701. // Watch for filtered data or sort changes to provide an ordered set of data.
  35702. /** @type {?} */
  35703. var orderedData = rxjs.combineLatest(filteredData, sortChange)
  35704. .pipe(operators.map((/**
  35705. * @param {?} __0
  35706. * @return {?}
  35707. */
  35708. function (_a) {
  35709. var data = _a[0];
  35710. return _this._orderData(data);
  35711. })));
  35712. // Watch for ordered data or page changes to provide a paged set of data.
  35713. /** @type {?} */
  35714. var paginatedData = rxjs.combineLatest(orderedData, pageChange)
  35715. .pipe(operators.map((/**
  35716. * @param {?} __0
  35717. * @return {?}
  35718. */
  35719. function (_a) {
  35720. var data = _a[0];
  35721. return _this._pageData(data);
  35722. })));
  35723. // Watched for paged data changes and send the result to the table to render.
  35724. this._renderChangesSubscription.unsubscribe();
  35725. this._renderChangesSubscription = paginatedData.subscribe((/**
  35726. * @param {?} data
  35727. * @return {?}
  35728. */
  35729. function (data) { return _this._renderData.next(data); }));
  35730. };
  35731. /**
  35732. * Returns a filtered data array where each filter object contains the filter string within
  35733. * the result of the filterTermAccessor function. If no filter is set, returns the data array
  35734. * as provided.
  35735. */
  35736. /**
  35737. * Returns a filtered data array where each filter object contains the filter string within
  35738. * the result of the filterTermAccessor function. If no filter is set, returns the data array
  35739. * as provided.
  35740. * @param {?} data
  35741. * @return {?}
  35742. */
  35743. MatTableDataSource.prototype._filterData = /**
  35744. * Returns a filtered data array where each filter object contains the filter string within
  35745. * the result of the filterTermAccessor function. If no filter is set, returns the data array
  35746. * as provided.
  35747. * @param {?} data
  35748. * @return {?}
  35749. */
  35750. function (data) {
  35751. var _this = this;
  35752. // If there is a filter string, filter out data that does not contain it.
  35753. // Each data object is converted to a string using the function defined by filterTermAccessor.
  35754. // May be overridden for customization.
  35755. this.filteredData =
  35756. !this.filter ? data : data.filter((/**
  35757. * @param {?} obj
  35758. * @return {?}
  35759. */
  35760. function (obj) { return _this.filterPredicate(obj, _this.filter); }));
  35761. if (this.paginator) {
  35762. this._updatePaginator(this.filteredData.length);
  35763. }
  35764. return this.filteredData;
  35765. };
  35766. /**
  35767. * Returns a sorted copy of the data if MatSort has a sort applied, otherwise just returns the
  35768. * data array as provided. Uses the default data accessor for data lookup, unless a
  35769. * sortDataAccessor function is defined.
  35770. */
  35771. /**
  35772. * Returns a sorted copy of the data if MatSort has a sort applied, otherwise just returns the
  35773. * data array as provided. Uses the default data accessor for data lookup, unless a
  35774. * sortDataAccessor function is defined.
  35775. * @param {?} data
  35776. * @return {?}
  35777. */
  35778. MatTableDataSource.prototype._orderData = /**
  35779. * Returns a sorted copy of the data if MatSort has a sort applied, otherwise just returns the
  35780. * data array as provided. Uses the default data accessor for data lookup, unless a
  35781. * sortDataAccessor function is defined.
  35782. * @param {?} data
  35783. * @return {?}
  35784. */
  35785. function (data) {
  35786. // If there is no active sort or direction, return the data without trying to sort.
  35787. if (!this.sort) {
  35788. return data;
  35789. }
  35790. return this.sortData(data.slice(), this.sort);
  35791. };
  35792. /**
  35793. * Returns a paged slice of the provided data array according to the provided MatPaginator's page
  35794. * index and length. If there is no paginator provided, returns the data array as provided.
  35795. */
  35796. /**
  35797. * Returns a paged slice of the provided data array according to the provided MatPaginator's page
  35798. * index and length. If there is no paginator provided, returns the data array as provided.
  35799. * @param {?} data
  35800. * @return {?}
  35801. */
  35802. MatTableDataSource.prototype._pageData = /**
  35803. * Returns a paged slice of the provided data array according to the provided MatPaginator's page
  35804. * index and length. If there is no paginator provided, returns the data array as provided.
  35805. * @param {?} data
  35806. * @return {?}
  35807. */
  35808. function (data) {
  35809. if (!this.paginator) {
  35810. return data;
  35811. }
  35812. /** @type {?} */
  35813. var startIndex = this.paginator.pageIndex * this.paginator.pageSize;
  35814. return data.slice(startIndex, startIndex + this.paginator.pageSize);
  35815. };
  35816. /**
  35817. * Updates the paginator to reflect the length of the filtered data, and makes sure that the page
  35818. * index does not exceed the paginator's last page. Values are changed in a resolved promise to
  35819. * guard against making property changes within a round of change detection.
  35820. */
  35821. /**
  35822. * Updates the paginator to reflect the length of the filtered data, and makes sure that the page
  35823. * index does not exceed the paginator's last page. Values are changed in a resolved promise to
  35824. * guard against making property changes within a round of change detection.
  35825. * @param {?} filteredDataLength
  35826. * @return {?}
  35827. */
  35828. MatTableDataSource.prototype._updatePaginator = /**
  35829. * Updates the paginator to reflect the length of the filtered data, and makes sure that the page
  35830. * index does not exceed the paginator's last page. Values are changed in a resolved promise to
  35831. * guard against making property changes within a round of change detection.
  35832. * @param {?} filteredDataLength
  35833. * @return {?}
  35834. */
  35835. function (filteredDataLength) {
  35836. var _this = this;
  35837. Promise.resolve().then((/**
  35838. * @return {?}
  35839. */
  35840. function () {
  35841. /** @type {?} */
  35842. var paginator = _this.paginator;
  35843. if (!paginator) {
  35844. return;
  35845. }
  35846. paginator.length = filteredDataLength;
  35847. // If the page index is set beyond the page, reduce it to the last page.
  35848. if (paginator.pageIndex > 0) {
  35849. /** @type {?} */
  35850. var lastPageIndex = Math.ceil(paginator.length / paginator.pageSize) - 1 || 0;
  35851. /** @type {?} */
  35852. var newPageIndex = Math.min(paginator.pageIndex, lastPageIndex);
  35853. if (newPageIndex !== paginator.pageIndex) {
  35854. paginator.pageIndex = newPageIndex;
  35855. // Since the paginator only emits after user-generated changes,
  35856. // we need our own stream so we know to should re-render the data.
  35857. _this._internalPageChanges.next();
  35858. }
  35859. }
  35860. }));
  35861. };
  35862. /**
  35863. * Used by the MatTable. Called when it connects to the data source.
  35864. * @docs-private
  35865. */
  35866. /**
  35867. * Used by the MatTable. Called when it connects to the data source.
  35868. * \@docs-private
  35869. * @return {?}
  35870. */
  35871. MatTableDataSource.prototype.connect = /**
  35872. * Used by the MatTable. Called when it connects to the data source.
  35873. * \@docs-private
  35874. * @return {?}
  35875. */
  35876. function () { return this._renderData; };
  35877. /**
  35878. * Used by the MatTable. Called when it is destroyed. No-op.
  35879. * @docs-private
  35880. */
  35881. /**
  35882. * Used by the MatTable. Called when it is destroyed. No-op.
  35883. * \@docs-private
  35884. * @return {?}
  35885. */
  35886. MatTableDataSource.prototype.disconnect = /**
  35887. * Used by the MatTable. Called when it is destroyed. No-op.
  35888. * \@docs-private
  35889. * @return {?}
  35890. */
  35891. function () { };
  35892. return MatTableDataSource;
  35893. }(table.DataSource));
  35894. /**
  35895. * @fileoverview added by tsickle
  35896. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  35897. */
  35898. /**
  35899. * Injection token for the MatInkBar's Positioner.
  35900. * @type {?}
  35901. */
  35902. var _MAT_INK_BAR_POSITIONER = new core.InjectionToken('MatInkBarPositioner', {
  35903. providedIn: 'root',
  35904. factory: _MAT_INK_BAR_POSITIONER_FACTORY
  35905. });
  35906. /**
  35907. * The default positioner function for the MatInkBar.
  35908. * \@docs-private
  35909. * @return {?}
  35910. */
  35911. function _MAT_INK_BAR_POSITIONER_FACTORY() {
  35912. /** @type {?} */
  35913. var method = (/**
  35914. * @param {?} element
  35915. * @return {?}
  35916. */
  35917. function (element) { return ({
  35918. left: element ? (element.offsetLeft || 0) + 'px' : '0',
  35919. width: element ? (element.offsetWidth || 0) + 'px' : '0',
  35920. }); });
  35921. return method;
  35922. }
  35923. /**
  35924. * The ink-bar is used to display and animate the line underneath the current active tab label.
  35925. * \@docs-private
  35926. */
  35927. var MatInkBar = /** @class */ (function () {
  35928. function MatInkBar(_elementRef, _ngZone, _inkBarPositioner, _animationMode) {
  35929. this._elementRef = _elementRef;
  35930. this._ngZone = _ngZone;
  35931. this._inkBarPositioner = _inkBarPositioner;
  35932. this._animationMode = _animationMode;
  35933. }
  35934. /**
  35935. * Calculates the styles from the provided element in order to align the ink-bar to that element.
  35936. * Shows the ink bar if previously set as hidden.
  35937. * @param element
  35938. */
  35939. /**
  35940. * Calculates the styles from the provided element in order to align the ink-bar to that element.
  35941. * Shows the ink bar if previously set as hidden.
  35942. * @param {?} element
  35943. * @return {?}
  35944. */
  35945. MatInkBar.prototype.alignToElement = /**
  35946. * Calculates the styles from the provided element in order to align the ink-bar to that element.
  35947. * Shows the ink bar if previously set as hidden.
  35948. * @param {?} element
  35949. * @return {?}
  35950. */
  35951. function (element) {
  35952. var _this = this;
  35953. this.show();
  35954. if (typeof requestAnimationFrame !== 'undefined') {
  35955. this._ngZone.runOutsideAngular((/**
  35956. * @return {?}
  35957. */
  35958. function () {
  35959. requestAnimationFrame((/**
  35960. * @return {?}
  35961. */
  35962. function () { return _this._setStyles(element); }));
  35963. }));
  35964. }
  35965. else {
  35966. this._setStyles(element);
  35967. }
  35968. };
  35969. /** Shows the ink bar. */
  35970. /**
  35971. * Shows the ink bar.
  35972. * @return {?}
  35973. */
  35974. MatInkBar.prototype.show = /**
  35975. * Shows the ink bar.
  35976. * @return {?}
  35977. */
  35978. function () {
  35979. this._elementRef.nativeElement.style.visibility = 'visible';
  35980. };
  35981. /** Hides the ink bar. */
  35982. /**
  35983. * Hides the ink bar.
  35984. * @return {?}
  35985. */
  35986. MatInkBar.prototype.hide = /**
  35987. * Hides the ink bar.
  35988. * @return {?}
  35989. */
  35990. function () {
  35991. this._elementRef.nativeElement.style.visibility = 'hidden';
  35992. };
  35993. /**
  35994. * Sets the proper styles to the ink bar element.
  35995. * @param element
  35996. */
  35997. /**
  35998. * Sets the proper styles to the ink bar element.
  35999. * @private
  36000. * @param {?} element
  36001. * @return {?}
  36002. */
  36003. MatInkBar.prototype._setStyles = /**
  36004. * Sets the proper styles to the ink bar element.
  36005. * @private
  36006. * @param {?} element
  36007. * @return {?}
  36008. */
  36009. function (element) {
  36010. /** @type {?} */
  36011. var positions = this._inkBarPositioner(element);
  36012. /** @type {?} */
  36013. var inkBar = this._elementRef.nativeElement;
  36014. inkBar.style.left = positions.left;
  36015. inkBar.style.width = positions.width;
  36016. };
  36017. MatInkBar.decorators = [
  36018. { type: core.Directive, args: [{
  36019. selector: 'mat-ink-bar',
  36020. host: {
  36021. 'class': 'mat-ink-bar',
  36022. '[class._mat-animation-noopable]': "_animationMode === 'NoopAnimations'",
  36023. },
  36024. },] },
  36025. ];
  36026. /** @nocollapse */
  36027. MatInkBar.ctorParameters = function () { return [
  36028. { type: core.ElementRef },
  36029. { type: core.NgZone },
  36030. { type: undefined, decorators: [{ type: core.Inject, args: [_MAT_INK_BAR_POSITIONER,] }] },
  36031. { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
  36032. ]; };
  36033. return MatInkBar;
  36034. }());
  36035. /**
  36036. * @fileoverview added by tsickle
  36037. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  36038. */
  36039. /**
  36040. * Decorates the `ng-template` tags and reads out the template from it.
  36041. */
  36042. var MatTabContent = /** @class */ (function () {
  36043. function MatTabContent(template) {
  36044. this.template = template;
  36045. }
  36046. MatTabContent.decorators = [
  36047. { type: core.Directive, args: [{ selector: '[matTabContent]' },] },
  36048. ];
  36049. /** @nocollapse */
  36050. MatTabContent.ctorParameters = function () { return [
  36051. { type: core.TemplateRef }
  36052. ]; };
  36053. return MatTabContent;
  36054. }());
  36055. /**
  36056. * @fileoverview added by tsickle
  36057. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  36058. */
  36059. /**
  36060. * Used to flag tab labels for use with the portal directive
  36061. */
  36062. var MatTabLabel = /** @class */ (function (_super) {
  36063. __extends(MatTabLabel, _super);
  36064. function MatTabLabel() {
  36065. return _super !== null && _super.apply(this, arguments) || this;
  36066. }
  36067. MatTabLabel.decorators = [
  36068. { type: core.Directive, args: [{
  36069. selector: '[mat-tab-label], [matTabLabel]',
  36070. },] },
  36071. ];
  36072. return MatTabLabel;
  36073. }(portal.CdkPortal));
  36074. /**
  36075. * @fileoverview added by tsickle
  36076. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  36077. */
  36078. // Boilerplate for applying mixins to MatTab.
  36079. /**
  36080. * \@docs-private
  36081. */
  36082. var
  36083. // Boilerplate for applying mixins to MatTab.
  36084. /**
  36085. * \@docs-private
  36086. */
  36087. MatTabBase = /** @class */ (function () {
  36088. function MatTabBase() {
  36089. }
  36090. return MatTabBase;
  36091. }());
  36092. /** @type {?} */
  36093. var _MatTabMixinBase = mixinDisabled(MatTabBase);
  36094. var MatTab = /** @class */ (function (_super) {
  36095. __extends(MatTab, _super);
  36096. function MatTab(_viewContainerRef) {
  36097. var _this = _super.call(this) || this;
  36098. _this._viewContainerRef = _viewContainerRef;
  36099. /**
  36100. * Plain text label for the tab, used when there is no template label.
  36101. */
  36102. _this.textLabel = '';
  36103. /**
  36104. * Portal that will be the hosted content of the tab
  36105. */
  36106. _this._contentPortal = null;
  36107. /**
  36108. * Emits whenever the internal state of the tab changes.
  36109. */
  36110. _this._stateChanges = new rxjs.Subject();
  36111. /**
  36112. * The relatively indexed position where 0 represents the center, negative is left, and positive
  36113. * represents the right.
  36114. */
  36115. _this.position = null;
  36116. /**
  36117. * The initial relatively index origin of the tab if it was created and selected after there
  36118. * was already a selected tab. Provides context of what position the tab should originate from.
  36119. */
  36120. _this.origin = null;
  36121. /**
  36122. * Whether the tab is currently active.
  36123. */
  36124. _this.isActive = false;
  36125. return _this;
  36126. }
  36127. Object.defineProperty(MatTab.prototype, "content", {
  36128. /** @docs-private */
  36129. get: /**
  36130. * \@docs-private
  36131. * @return {?}
  36132. */
  36133. function () {
  36134. return this._contentPortal;
  36135. },
  36136. enumerable: true,
  36137. configurable: true
  36138. });
  36139. /**
  36140. * @param {?} changes
  36141. * @return {?}
  36142. */
  36143. MatTab.prototype.ngOnChanges = /**
  36144. * @param {?} changes
  36145. * @return {?}
  36146. */
  36147. function (changes) {
  36148. if (changes.hasOwnProperty('textLabel') || changes.hasOwnProperty('disabled')) {
  36149. this._stateChanges.next();
  36150. }
  36151. };
  36152. /**
  36153. * @return {?}
  36154. */
  36155. MatTab.prototype.ngOnDestroy = /**
  36156. * @return {?}
  36157. */
  36158. function () {
  36159. this._stateChanges.complete();
  36160. };
  36161. /**
  36162. * @return {?}
  36163. */
  36164. MatTab.prototype.ngOnInit = /**
  36165. * @return {?}
  36166. */
  36167. function () {
  36168. this._contentPortal = new portal.TemplatePortal(this._explicitContent || this._implicitContent, this._viewContainerRef);
  36169. };
  36170. MatTab.decorators = [
  36171. { type: core.Component, args: [{selector: 'mat-tab',
  36172. template: "<ng-template><ng-content></ng-content></ng-template>",
  36173. inputs: ['disabled'],
  36174. changeDetection: core.ChangeDetectionStrategy.OnPush,
  36175. encapsulation: core.ViewEncapsulation.None,
  36176. exportAs: 'matTab',
  36177. },] },
  36178. ];
  36179. /** @nocollapse */
  36180. MatTab.ctorParameters = function () { return [
  36181. { type: core.ViewContainerRef }
  36182. ]; };
  36183. MatTab.propDecorators = {
  36184. templateLabel: [{ type: core.ContentChild, args: [MatTabLabel, { static: false },] }],
  36185. _explicitContent: [{ type: core.ContentChild, args: [MatTabContent, { read: core.TemplateRef, static: true },] }],
  36186. _implicitContent: [{ type: core.ViewChild, args: [core.TemplateRef, { static: true },] }],
  36187. textLabel: [{ type: core.Input, args: ['label',] }],
  36188. ariaLabel: [{ type: core.Input, args: ['aria-label',] }],
  36189. ariaLabelledby: [{ type: core.Input, args: ['aria-labelledby',] }]
  36190. };
  36191. return MatTab;
  36192. }(_MatTabMixinBase));
  36193. /**
  36194. * @fileoverview added by tsickle
  36195. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  36196. */
  36197. /**
  36198. * Animations used by the Material tabs.
  36199. * \@docs-private
  36200. * @type {?}
  36201. */
  36202. var matTabsAnimations = {
  36203. /**
  36204. * Animation translates a tab along the X axis.
  36205. */
  36206. translateTab: animations$1.trigger('translateTab', [
  36207. // Note: transitions to `none` instead of 0, because some browsers might blur the content.
  36208. animations$1.state('center, void, left-origin-center, right-origin-center', animations$1.style({ transform: 'none' })),
  36209. // If the tab is either on the left or right, we additionally add a `min-height` of 1px
  36210. // in order to ensure that the element has a height before its state changes. This is
  36211. // necessary because Chrome does seem to skip the transition in RTL mode if the element does
  36212. // not have a static height and is not rendered. See related issue: #9465
  36213. animations$1.state('left', animations$1.style({ transform: 'translate3d(-100%, 0, 0)', minHeight: '1px' })),
  36214. animations$1.state('right', animations$1.style({ transform: 'translate3d(100%, 0, 0)', minHeight: '1px' })),
  36215. animations$1.transition('* => left, * => right, left => center, right => center', animations$1.animate('{{animationDuration}} cubic-bezier(0.35, 0, 0.25, 1)')),
  36216. animations$1.transition('void => left-origin-center', [
  36217. animations$1.style({ transform: 'translate3d(-100%, 0, 0)' }),
  36218. animations$1.animate('{{animationDuration}} cubic-bezier(0.35, 0, 0.25, 1)')
  36219. ]),
  36220. animations$1.transition('void => right-origin-center', [
  36221. animations$1.style({ transform: 'translate3d(100%, 0, 0)' }),
  36222. animations$1.animate('{{animationDuration}} cubic-bezier(0.35, 0, 0.25, 1)')
  36223. ])
  36224. ])
  36225. };
  36226. /**
  36227. * @fileoverview added by tsickle
  36228. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  36229. */
  36230. /**
  36231. * The portal host directive for the contents of the tab.
  36232. * \@docs-private
  36233. */
  36234. var MatTabBodyPortal = /** @class */ (function (_super) {
  36235. __extends(MatTabBodyPortal, _super);
  36236. function MatTabBodyPortal(componentFactoryResolver, viewContainerRef, _host) {
  36237. var _this = _super.call(this, componentFactoryResolver, viewContainerRef) || this;
  36238. _this._host = _host;
  36239. /**
  36240. * Subscription to events for when the tab body begins centering.
  36241. */
  36242. _this._centeringSub = rxjs.Subscription.EMPTY;
  36243. /**
  36244. * Subscription to events for when the tab body finishes leaving from center position.
  36245. */
  36246. _this._leavingSub = rxjs.Subscription.EMPTY;
  36247. return _this;
  36248. }
  36249. /** Set initial visibility or set up subscription for changing visibility. */
  36250. /**
  36251. * Set initial visibility or set up subscription for changing visibility.
  36252. * @return {?}
  36253. */
  36254. MatTabBodyPortal.prototype.ngOnInit = /**
  36255. * Set initial visibility or set up subscription for changing visibility.
  36256. * @return {?}
  36257. */
  36258. function () {
  36259. var _this = this;
  36260. _super.prototype.ngOnInit.call(this);
  36261. this._centeringSub = this._host._beforeCentering
  36262. .pipe(operators.startWith(this._host._isCenterPosition(this._host._position)))
  36263. .subscribe((/**
  36264. * @param {?} isCentering
  36265. * @return {?}
  36266. */
  36267. function (isCentering) {
  36268. if (isCentering && !_this.hasAttached()) {
  36269. _this.attach(_this._host._content);
  36270. }
  36271. }));
  36272. this._leavingSub = this._host._afterLeavingCenter.subscribe((/**
  36273. * @return {?}
  36274. */
  36275. function () {
  36276. _this.detach();
  36277. }));
  36278. };
  36279. /** Clean up centering subscription. */
  36280. /**
  36281. * Clean up centering subscription.
  36282. * @return {?}
  36283. */
  36284. MatTabBodyPortal.prototype.ngOnDestroy = /**
  36285. * Clean up centering subscription.
  36286. * @return {?}
  36287. */
  36288. function () {
  36289. _super.prototype.ngOnDestroy.call(this);
  36290. this._centeringSub.unsubscribe();
  36291. this._leavingSub.unsubscribe();
  36292. };
  36293. MatTabBodyPortal.decorators = [
  36294. { type: core.Directive, args: [{
  36295. selector: '[matTabBodyHost]'
  36296. },] },
  36297. ];
  36298. /** @nocollapse */
  36299. MatTabBodyPortal.ctorParameters = function () { return [
  36300. { type: core.ComponentFactoryResolver },
  36301. { type: core.ViewContainerRef },
  36302. { type: MatTabBody, decorators: [{ type: core.Inject, args: [core.forwardRef((/**
  36303. * @return {?}
  36304. */
  36305. function () { return MatTabBody; })),] }] }
  36306. ]; };
  36307. return MatTabBodyPortal;
  36308. }(portal.CdkPortalOutlet));
  36309. /**
  36310. * Wrapper for the contents of a tab.
  36311. * \@docs-private
  36312. */
  36313. var MatTabBody = /** @class */ (function () {
  36314. function MatTabBody(_elementRef, _dir, changeDetectorRef) {
  36315. var _this = this;
  36316. this._elementRef = _elementRef;
  36317. this._dir = _dir;
  36318. /**
  36319. * Subscription to the directionality change observable.
  36320. */
  36321. this._dirChangeSubscription = rxjs.Subscription.EMPTY;
  36322. /**
  36323. * Emits when an animation on the tab is complete.
  36324. */
  36325. this._translateTabComplete = new rxjs.Subject();
  36326. /**
  36327. * Event emitted when the tab begins to animate towards the center as the active tab.
  36328. */
  36329. this._onCentering = new core.EventEmitter();
  36330. /**
  36331. * Event emitted before the centering of the tab begins.
  36332. */
  36333. this._beforeCentering = new core.EventEmitter();
  36334. /**
  36335. * Event emitted before the centering of the tab begins.
  36336. */
  36337. this._afterLeavingCenter = new core.EventEmitter();
  36338. /**
  36339. * Event emitted when the tab completes its animation towards the center.
  36340. */
  36341. this._onCentered = new core.EventEmitter(true);
  36342. // Note that the default value will always be overwritten by `MatTabBody`, but we need one
  36343. // anyway to prevent the animations module from throwing an error if the body is used on its own.
  36344. /**
  36345. * Duration for the tab's animation.
  36346. */
  36347. this.animationDuration = '500ms';
  36348. if (_dir) {
  36349. this._dirChangeSubscription = _dir.change.subscribe((/**
  36350. * @param {?} dir
  36351. * @return {?}
  36352. */
  36353. function (dir) {
  36354. _this._computePositionAnimationState(dir);
  36355. changeDetectorRef.markForCheck();
  36356. }));
  36357. }
  36358. // Ensure that we get unique animation events, because the `.done` callback can get
  36359. // invoked twice in some browsers. See https://github.com/angular/angular/issues/24084.
  36360. this._translateTabComplete.pipe(operators.distinctUntilChanged((/**
  36361. * @param {?} x
  36362. * @param {?} y
  36363. * @return {?}
  36364. */
  36365. function (x, y) {
  36366. return x.fromState === y.fromState && x.toState === y.toState;
  36367. }))).subscribe((/**
  36368. * @param {?} event
  36369. * @return {?}
  36370. */
  36371. function (event) {
  36372. // If the transition to the center is complete, emit an event.
  36373. if (_this._isCenterPosition(event.toState) && _this._isCenterPosition(_this._position)) {
  36374. _this._onCentered.emit();
  36375. }
  36376. if (_this._isCenterPosition(event.fromState) && !_this._isCenterPosition(_this._position)) {
  36377. _this._afterLeavingCenter.emit();
  36378. }
  36379. }));
  36380. }
  36381. Object.defineProperty(MatTabBody.prototype, "position", {
  36382. /** The shifted index position of the tab body, where zero represents the active center tab. */
  36383. set: /**
  36384. * The shifted index position of the tab body, where zero represents the active center tab.
  36385. * @param {?} position
  36386. * @return {?}
  36387. */
  36388. function (position) {
  36389. this._positionIndex = position;
  36390. this._computePositionAnimationState();
  36391. },
  36392. enumerable: true,
  36393. configurable: true
  36394. });
  36395. /**
  36396. * After initialized, check if the content is centered and has an origin. If so, set the
  36397. * special position states that transition the tab from the left or right before centering.
  36398. */
  36399. /**
  36400. * After initialized, check if the content is centered and has an origin. If so, set the
  36401. * special position states that transition the tab from the left or right before centering.
  36402. * @return {?}
  36403. */
  36404. MatTabBody.prototype.ngOnInit = /**
  36405. * After initialized, check if the content is centered and has an origin. If so, set the
  36406. * special position states that transition the tab from the left or right before centering.
  36407. * @return {?}
  36408. */
  36409. function () {
  36410. if (this._position == 'center' && this.origin != null) {
  36411. this._position = this._computePositionFromOrigin();
  36412. }
  36413. };
  36414. /**
  36415. * @return {?}
  36416. */
  36417. MatTabBody.prototype.ngOnDestroy = /**
  36418. * @return {?}
  36419. */
  36420. function () {
  36421. this._dirChangeSubscription.unsubscribe();
  36422. this._translateTabComplete.complete();
  36423. };
  36424. /**
  36425. * @param {?} event
  36426. * @return {?}
  36427. */
  36428. MatTabBody.prototype._onTranslateTabStarted = /**
  36429. * @param {?} event
  36430. * @return {?}
  36431. */
  36432. function (event) {
  36433. /** @type {?} */
  36434. var isCentering = this._isCenterPosition(event.toState);
  36435. this._beforeCentering.emit(isCentering);
  36436. if (isCentering) {
  36437. this._onCentering.emit(this._elementRef.nativeElement.clientHeight);
  36438. }
  36439. };
  36440. /** The text direction of the containing app. */
  36441. /**
  36442. * The text direction of the containing app.
  36443. * @return {?}
  36444. */
  36445. MatTabBody.prototype._getLayoutDirection = /**
  36446. * The text direction of the containing app.
  36447. * @return {?}
  36448. */
  36449. function () {
  36450. return this._dir && this._dir.value === 'rtl' ? 'rtl' : 'ltr';
  36451. };
  36452. /** Whether the provided position state is considered center, regardless of origin. */
  36453. /**
  36454. * Whether the provided position state is considered center, regardless of origin.
  36455. * @param {?} position
  36456. * @return {?}
  36457. */
  36458. MatTabBody.prototype._isCenterPosition = /**
  36459. * Whether the provided position state is considered center, regardless of origin.
  36460. * @param {?} position
  36461. * @return {?}
  36462. */
  36463. function (position) {
  36464. return position == 'center' ||
  36465. position == 'left-origin-center' ||
  36466. position == 'right-origin-center';
  36467. };
  36468. /** Computes the position state that will be used for the tab-body animation trigger. */
  36469. /**
  36470. * Computes the position state that will be used for the tab-body animation trigger.
  36471. * @private
  36472. * @param {?=} dir
  36473. * @return {?}
  36474. */
  36475. MatTabBody.prototype._computePositionAnimationState = /**
  36476. * Computes the position state that will be used for the tab-body animation trigger.
  36477. * @private
  36478. * @param {?=} dir
  36479. * @return {?}
  36480. */
  36481. function (dir) {
  36482. if (dir === void 0) { dir = this._getLayoutDirection(); }
  36483. if (this._positionIndex < 0) {
  36484. this._position = dir == 'ltr' ? 'left' : 'right';
  36485. }
  36486. else if (this._positionIndex > 0) {
  36487. this._position = dir == 'ltr' ? 'right' : 'left';
  36488. }
  36489. else {
  36490. this._position = 'center';
  36491. }
  36492. };
  36493. /**
  36494. * Computes the position state based on the specified origin position. This is used if the
  36495. * tab is becoming visible immediately after creation.
  36496. */
  36497. /**
  36498. * Computes the position state based on the specified origin position. This is used if the
  36499. * tab is becoming visible immediately after creation.
  36500. * @private
  36501. * @return {?}
  36502. */
  36503. MatTabBody.prototype._computePositionFromOrigin = /**
  36504. * Computes the position state based on the specified origin position. This is used if the
  36505. * tab is becoming visible immediately after creation.
  36506. * @private
  36507. * @return {?}
  36508. */
  36509. function () {
  36510. /** @type {?} */
  36511. var dir = this._getLayoutDirection();
  36512. if ((dir == 'ltr' && this.origin <= 0) || (dir == 'rtl' && this.origin > 0)) {
  36513. return 'left-origin-center';
  36514. }
  36515. return 'right-origin-center';
  36516. };
  36517. MatTabBody.decorators = [
  36518. { type: core.Component, args: [{selector: 'mat-tab-body',
  36519. template: "<div class=\"mat-tab-body-content\" #content [@translateTab]=\"{ value: _position, params: {animationDuration: animationDuration} }\" (@translateTab.start)=\"_onTranslateTabStarted($event)\" (@translateTab.done)=\"_translateTabComplete.next($event)\"><ng-template matTabBodyHost></ng-template></div>",
  36520. styles: [".mat-tab-body-content{height:100%;overflow:auto}.mat-tab-group-dynamic-height .mat-tab-body-content{overflow:hidden}"],
  36521. encapsulation: core.ViewEncapsulation.None,
  36522. changeDetection: core.ChangeDetectionStrategy.OnPush,
  36523. animations: [matTabsAnimations.translateTab],
  36524. host: {
  36525. 'class': 'mat-tab-body',
  36526. },
  36527. },] },
  36528. ];
  36529. /** @nocollapse */
  36530. MatTabBody.ctorParameters = function () { return [
  36531. { type: core.ElementRef },
  36532. { type: bidi.Directionality, decorators: [{ type: core.Optional }] },
  36533. { type: core.ChangeDetectorRef }
  36534. ]; };
  36535. MatTabBody.propDecorators = {
  36536. _onCentering: [{ type: core.Output }],
  36537. _beforeCentering: [{ type: core.Output }],
  36538. _afterLeavingCenter: [{ type: core.Output }],
  36539. _onCentered: [{ type: core.Output }],
  36540. _portalHost: [{ type: core.ViewChild, args: [portal.PortalHostDirective, { static: false },] }],
  36541. _content: [{ type: core.Input, args: ['content',] }],
  36542. origin: [{ type: core.Input }],
  36543. animationDuration: [{ type: core.Input }],
  36544. position: [{ type: core.Input }]
  36545. };
  36546. return MatTabBody;
  36547. }());
  36548. /**
  36549. * @fileoverview added by tsickle
  36550. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  36551. */
  36552. // Boilerplate for applying mixins to MatTabLabelWrapper.
  36553. /**
  36554. * \@docs-private
  36555. */
  36556. var
  36557. // Boilerplate for applying mixins to MatTabLabelWrapper.
  36558. /**
  36559. * \@docs-private
  36560. */
  36561. MatTabLabelWrapperBase = /** @class */ (function () {
  36562. function MatTabLabelWrapperBase() {
  36563. }
  36564. return MatTabLabelWrapperBase;
  36565. }());
  36566. /** @type {?} */
  36567. var _MatTabLabelWrapperMixinBase = mixinDisabled(MatTabLabelWrapperBase);
  36568. /**
  36569. * Used in the `mat-tab-group` view to display tab labels.
  36570. * \@docs-private
  36571. */
  36572. var MatTabLabelWrapper = /** @class */ (function (_super) {
  36573. __extends(MatTabLabelWrapper, _super);
  36574. function MatTabLabelWrapper(elementRef) {
  36575. var _this = _super.call(this) || this;
  36576. _this.elementRef = elementRef;
  36577. return _this;
  36578. }
  36579. /** Sets focus on the wrapper element */
  36580. /**
  36581. * Sets focus on the wrapper element
  36582. * @return {?}
  36583. */
  36584. MatTabLabelWrapper.prototype.focus = /**
  36585. * Sets focus on the wrapper element
  36586. * @return {?}
  36587. */
  36588. function () {
  36589. this.elementRef.nativeElement.focus();
  36590. };
  36591. /**
  36592. * @return {?}
  36593. */
  36594. MatTabLabelWrapper.prototype.getOffsetLeft = /**
  36595. * @return {?}
  36596. */
  36597. function () {
  36598. return this.elementRef.nativeElement.offsetLeft;
  36599. };
  36600. /**
  36601. * @return {?}
  36602. */
  36603. MatTabLabelWrapper.prototype.getOffsetWidth = /**
  36604. * @return {?}
  36605. */
  36606. function () {
  36607. return this.elementRef.nativeElement.offsetWidth;
  36608. };
  36609. MatTabLabelWrapper.decorators = [
  36610. { type: core.Directive, args: [{
  36611. selector: '[matTabLabelWrapper]',
  36612. inputs: ['disabled'],
  36613. host: {
  36614. '[class.mat-tab-disabled]': 'disabled',
  36615. '[attr.aria-disabled]': '!!disabled',
  36616. }
  36617. },] },
  36618. ];
  36619. /** @nocollapse */
  36620. MatTabLabelWrapper.ctorParameters = function () { return [
  36621. { type: core.ElementRef }
  36622. ]; };
  36623. return MatTabLabelWrapper;
  36624. }(_MatTabLabelWrapperMixinBase));
  36625. /**
  36626. * @fileoverview added by tsickle
  36627. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  36628. */
  36629. /**
  36630. * Config used to bind passive event listeners
  36631. * @type {?}
  36632. */
  36633. var passiveEventListenerOptions$1 = (/** @type {?} */ (platform.normalizePassiveListenerOptions({ passive: true })));
  36634. /**
  36635. * The distance in pixels that will be overshot when scrolling a tab label into view. This helps
  36636. * provide a small affordance to the label next to it.
  36637. * @type {?}
  36638. */
  36639. var EXAGGERATED_OVERSCROLL = 60;
  36640. /**
  36641. * Amount of milliseconds to wait before starting to scroll the header automatically.
  36642. * Set a little conservatively in order to handle fake events dispatched on touch devices.
  36643. * @type {?}
  36644. */
  36645. var HEADER_SCROLL_DELAY = 650;
  36646. /**
  36647. * Interval in milliseconds at which to scroll the header
  36648. * while the user is holding their pointer.
  36649. * @type {?}
  36650. */
  36651. var HEADER_SCROLL_INTERVAL = 100;
  36652. /**
  36653. * Base class for a tab header that supported pagination.
  36654. * @abstract
  36655. */
  36656. var MatPaginatedTabHeader = /** @class */ (function () {
  36657. function MatPaginatedTabHeader(_elementRef, _changeDetectorRef, _viewportRuler, _dir, _ngZone, _platform, _animationMode) {
  36658. var _this = this;
  36659. this._elementRef = _elementRef;
  36660. this._changeDetectorRef = _changeDetectorRef;
  36661. this._viewportRuler = _viewportRuler;
  36662. this._dir = _dir;
  36663. this._ngZone = _ngZone;
  36664. this._platform = _platform;
  36665. this._animationMode = _animationMode;
  36666. /**
  36667. * The distance in pixels that the tab labels should be translated to the left.
  36668. */
  36669. this._scrollDistance = 0;
  36670. /**
  36671. * Whether the header should scroll to the selected index after the view has been checked.
  36672. */
  36673. this._selectedIndexChanged = false;
  36674. /**
  36675. * Emits when the component is destroyed.
  36676. */
  36677. this._destroyed = new rxjs.Subject();
  36678. /**
  36679. * Whether the controls for pagination should be displayed
  36680. */
  36681. this._showPaginationControls = false;
  36682. /**
  36683. * Whether the tab list can be scrolled more towards the end of the tab label list.
  36684. */
  36685. this._disableScrollAfter = true;
  36686. /**
  36687. * Whether the tab list can be scrolled more towards the beginning of the tab label list.
  36688. */
  36689. this._disableScrollBefore = true;
  36690. /**
  36691. * Stream that will stop the automated scrolling.
  36692. */
  36693. this._stopScrolling = new rxjs.Subject();
  36694. this._selectedIndex = 0;
  36695. /**
  36696. * Event emitted when the option is selected.
  36697. */
  36698. this.selectFocusedIndex = new core.EventEmitter();
  36699. /**
  36700. * Event emitted when a label is focused.
  36701. */
  36702. this.indexFocused = new core.EventEmitter();
  36703. // Bind the `mouseleave` event on the outside since it doesn't change anything in the view.
  36704. _ngZone.runOutsideAngular((/**
  36705. * @return {?}
  36706. */
  36707. function () {
  36708. rxjs.fromEvent(_elementRef.nativeElement, 'mouseleave')
  36709. .pipe(operators.takeUntil(_this._destroyed))
  36710. .subscribe((/**
  36711. * @return {?}
  36712. */
  36713. function () {
  36714. _this._stopInterval();
  36715. }));
  36716. }));
  36717. }
  36718. Object.defineProperty(MatPaginatedTabHeader.prototype, "selectedIndex", {
  36719. /** The index of the active tab. */
  36720. get: /**
  36721. * The index of the active tab.
  36722. * @return {?}
  36723. */
  36724. function () { return this._selectedIndex; },
  36725. set: /**
  36726. * @param {?} value
  36727. * @return {?}
  36728. */
  36729. function (value) {
  36730. value = coercion.coerceNumberProperty(value);
  36731. if (this._selectedIndex != value) {
  36732. this._selectedIndexChanged = true;
  36733. this._selectedIndex = value;
  36734. if (this._keyManager) {
  36735. this._keyManager.updateActiveItemIndex(value);
  36736. }
  36737. }
  36738. },
  36739. enumerable: true,
  36740. configurable: true
  36741. });
  36742. /**
  36743. * @return {?}
  36744. */
  36745. MatPaginatedTabHeader.prototype.ngAfterViewInit = /**
  36746. * @return {?}
  36747. */
  36748. function () {
  36749. var _this = this;
  36750. // We need to handle these events manually, because we want to bind passive event listeners.
  36751. rxjs.fromEvent(this._previousPaginator.nativeElement, 'touchstart', passiveEventListenerOptions$1)
  36752. .pipe(operators.takeUntil(this._destroyed))
  36753. .subscribe((/**
  36754. * @return {?}
  36755. */
  36756. function () {
  36757. _this._handlePaginatorPress('before');
  36758. }));
  36759. rxjs.fromEvent(this._nextPaginator.nativeElement, 'touchstart', passiveEventListenerOptions$1)
  36760. .pipe(operators.takeUntil(this._destroyed))
  36761. .subscribe((/**
  36762. * @return {?}
  36763. */
  36764. function () {
  36765. _this._handlePaginatorPress('after');
  36766. }));
  36767. };
  36768. /**
  36769. * @return {?}
  36770. */
  36771. MatPaginatedTabHeader.prototype.ngAfterContentInit = /**
  36772. * @return {?}
  36773. */
  36774. function () {
  36775. var _this = this;
  36776. /** @type {?} */
  36777. var dirChange = this._dir ? this._dir.change : rxjs.of(null);
  36778. /** @type {?} */
  36779. var resize = this._viewportRuler.change(150);
  36780. /** @type {?} */
  36781. var realign = (/**
  36782. * @return {?}
  36783. */
  36784. function () {
  36785. _this.updatePagination();
  36786. _this._alignInkBarToSelectedTab();
  36787. });
  36788. this._keyManager = new a11y.FocusKeyManager(this._items)
  36789. .withHorizontalOrientation(this._getLayoutDirection())
  36790. .withWrap();
  36791. this._keyManager.updateActiveItem(0);
  36792. // Defer the first call in order to allow for slower browsers to lay out the elements.
  36793. // This helps in cases where the user lands directly on a page with paginated tabs.
  36794. typeof requestAnimationFrame !== 'undefined' ? requestAnimationFrame(realign) : realign();
  36795. // On dir change or window resize, realign the ink bar and update the orientation of
  36796. // the key manager if the direction has changed.
  36797. rxjs.merge(dirChange, resize, this._items.changes).pipe(operators.takeUntil(this._destroyed)).subscribe((/**
  36798. * @return {?}
  36799. */
  36800. function () {
  36801. realign();
  36802. _this._keyManager.withHorizontalOrientation(_this._getLayoutDirection());
  36803. }));
  36804. // If there is a change in the focus key manager we need to emit the `indexFocused`
  36805. // event in order to provide a public event that notifies about focus changes. Also we realign
  36806. // the tabs container by scrolling the new focused tab into the visible section.
  36807. this._keyManager.change.pipe(operators.takeUntil(this._destroyed)).subscribe((/**
  36808. * @param {?} newFocusIndex
  36809. * @return {?}
  36810. */
  36811. function (newFocusIndex) {
  36812. _this.indexFocused.emit(newFocusIndex);
  36813. _this._setTabFocus(newFocusIndex);
  36814. }));
  36815. };
  36816. /**
  36817. * @return {?}
  36818. */
  36819. MatPaginatedTabHeader.prototype.ngAfterContentChecked = /**
  36820. * @return {?}
  36821. */
  36822. function () {
  36823. // If the number of tab labels have changed, check if scrolling should be enabled
  36824. if (this._tabLabelCount != this._items.length) {
  36825. this.updatePagination();
  36826. this._tabLabelCount = this._items.length;
  36827. this._changeDetectorRef.markForCheck();
  36828. }
  36829. // If the selected index has changed, scroll to the label and check if the scrolling controls
  36830. // should be disabled.
  36831. if (this._selectedIndexChanged) {
  36832. this._scrollToLabel(this._selectedIndex);
  36833. this._checkScrollingControls();
  36834. this._alignInkBarToSelectedTab();
  36835. this._selectedIndexChanged = false;
  36836. this._changeDetectorRef.markForCheck();
  36837. }
  36838. // If the scroll distance has been changed (tab selected, focused, scroll controls activated),
  36839. // then translate the header to reflect this.
  36840. if (this._scrollDistanceChanged) {
  36841. this._updateTabScrollPosition();
  36842. this._scrollDistanceChanged = false;
  36843. this._changeDetectorRef.markForCheck();
  36844. }
  36845. };
  36846. /**
  36847. * @return {?}
  36848. */
  36849. MatPaginatedTabHeader.prototype.ngOnDestroy = /**
  36850. * @return {?}
  36851. */
  36852. function () {
  36853. this._destroyed.next();
  36854. this._destroyed.complete();
  36855. this._stopScrolling.complete();
  36856. };
  36857. /** Handles keyboard events on the header. */
  36858. /**
  36859. * Handles keyboard events on the header.
  36860. * @param {?} event
  36861. * @return {?}
  36862. */
  36863. MatPaginatedTabHeader.prototype._handleKeydown = /**
  36864. * Handles keyboard events on the header.
  36865. * @param {?} event
  36866. * @return {?}
  36867. */
  36868. function (event) {
  36869. // We don't handle any key bindings with a modifier key.
  36870. if (keycodes.hasModifierKey(event)) {
  36871. return;
  36872. }
  36873. switch (event.keyCode) {
  36874. case keycodes.HOME:
  36875. this._keyManager.setFirstItemActive();
  36876. event.preventDefault();
  36877. break;
  36878. case keycodes.END:
  36879. this._keyManager.setLastItemActive();
  36880. event.preventDefault();
  36881. break;
  36882. case keycodes.ENTER:
  36883. case keycodes.SPACE:
  36884. this.selectFocusedIndex.emit(this.focusIndex);
  36885. this._itemSelected(event);
  36886. break;
  36887. default:
  36888. this._keyManager.onKeydown(event);
  36889. }
  36890. };
  36891. /**
  36892. * Callback for when the MutationObserver detects that the content has changed.
  36893. */
  36894. /**
  36895. * Callback for when the MutationObserver detects that the content has changed.
  36896. * @return {?}
  36897. */
  36898. MatPaginatedTabHeader.prototype._onContentChanges = /**
  36899. * Callback for when the MutationObserver detects that the content has changed.
  36900. * @return {?}
  36901. */
  36902. function () {
  36903. var _this = this;
  36904. /** @type {?} */
  36905. var textContent = this._elementRef.nativeElement.textContent;
  36906. // We need to diff the text content of the header, because the MutationObserver callback
  36907. // will fire even if the text content didn't change which is inefficient and is prone
  36908. // to infinite loops if a poorly constructed expression is passed in (see #14249).
  36909. if (textContent !== this._currentTextContent) {
  36910. this._currentTextContent = textContent || '';
  36911. // The content observer runs outside the `NgZone` by default, which
  36912. // means that we need to bring the callback back in ourselves.
  36913. this._ngZone.run((/**
  36914. * @return {?}
  36915. */
  36916. function () {
  36917. _this.updatePagination();
  36918. _this._alignInkBarToSelectedTab();
  36919. _this._changeDetectorRef.markForCheck();
  36920. }));
  36921. }
  36922. };
  36923. /**
  36924. * Updates the view whether pagination should be enabled or not.
  36925. *
  36926. * WARNING: Calling this method can be very costly in terms of performance. It should be called
  36927. * as infrequently as possible from outside of the Tabs component as it causes a reflow of the
  36928. * page.
  36929. */
  36930. /**
  36931. * Updates the view whether pagination should be enabled or not.
  36932. *
  36933. * WARNING: Calling this method can be very costly in terms of performance. It should be called
  36934. * as infrequently as possible from outside of the Tabs component as it causes a reflow of the
  36935. * page.
  36936. * @return {?}
  36937. */
  36938. MatPaginatedTabHeader.prototype.updatePagination = /**
  36939. * Updates the view whether pagination should be enabled or not.
  36940. *
  36941. * WARNING: Calling this method can be very costly in terms of performance. It should be called
  36942. * as infrequently as possible from outside of the Tabs component as it causes a reflow of the
  36943. * page.
  36944. * @return {?}
  36945. */
  36946. function () {
  36947. this._checkPaginationEnabled();
  36948. this._checkScrollingControls();
  36949. this._updateTabScrollPosition();
  36950. };
  36951. Object.defineProperty(MatPaginatedTabHeader.prototype, "focusIndex", {
  36952. /** Tracks which element has focus; used for keyboard navigation */
  36953. get: /**
  36954. * Tracks which element has focus; used for keyboard navigation
  36955. * @return {?}
  36956. */
  36957. function () {
  36958. return this._keyManager ? (/** @type {?} */ (this._keyManager.activeItemIndex)) : 0;
  36959. },
  36960. /** When the focus index is set, we must manually send focus to the correct label */
  36961. set: /**
  36962. * When the focus index is set, we must manually send focus to the correct label
  36963. * @param {?} value
  36964. * @return {?}
  36965. */
  36966. function (value) {
  36967. if (!this._isValidIndex(value) || this.focusIndex === value || !this._keyManager) {
  36968. return;
  36969. }
  36970. this._keyManager.setActiveItem(value);
  36971. },
  36972. enumerable: true,
  36973. configurable: true
  36974. });
  36975. /**
  36976. * Determines if an index is valid. If the tabs are not ready yet, we assume that the user is
  36977. * providing a valid index and return true.
  36978. */
  36979. /**
  36980. * Determines if an index is valid. If the tabs are not ready yet, we assume that the user is
  36981. * providing a valid index and return true.
  36982. * @param {?} index
  36983. * @return {?}
  36984. */
  36985. MatPaginatedTabHeader.prototype._isValidIndex = /**
  36986. * Determines if an index is valid. If the tabs are not ready yet, we assume that the user is
  36987. * providing a valid index and return true.
  36988. * @param {?} index
  36989. * @return {?}
  36990. */
  36991. function (index) {
  36992. if (!this._items) {
  36993. return true;
  36994. }
  36995. /** @type {?} */
  36996. var tab = this._items ? this._items.toArray()[index] : null;
  36997. return !!tab && !tab.disabled;
  36998. };
  36999. /**
  37000. * Sets focus on the HTML element for the label wrapper and scrolls it into the view if
  37001. * scrolling is enabled.
  37002. */
  37003. /**
  37004. * Sets focus on the HTML element for the label wrapper and scrolls it into the view if
  37005. * scrolling is enabled.
  37006. * @param {?} tabIndex
  37007. * @return {?}
  37008. */
  37009. MatPaginatedTabHeader.prototype._setTabFocus = /**
  37010. * Sets focus on the HTML element for the label wrapper and scrolls it into the view if
  37011. * scrolling is enabled.
  37012. * @param {?} tabIndex
  37013. * @return {?}
  37014. */
  37015. function (tabIndex) {
  37016. if (this._showPaginationControls) {
  37017. this._scrollToLabel(tabIndex);
  37018. }
  37019. if (this._items && this._items.length) {
  37020. this._items.toArray()[tabIndex].focus();
  37021. // Do not let the browser manage scrolling to focus the element, this will be handled
  37022. // by using translation. In LTR, the scroll left should be 0. In RTL, the scroll width
  37023. // should be the full width minus the offset width.
  37024. /** @type {?} */
  37025. var containerEl = this._tabListContainer.nativeElement;
  37026. /** @type {?} */
  37027. var dir = this._getLayoutDirection();
  37028. if (dir == 'ltr') {
  37029. containerEl.scrollLeft = 0;
  37030. }
  37031. else {
  37032. containerEl.scrollLeft = containerEl.scrollWidth - containerEl.offsetWidth;
  37033. }
  37034. }
  37035. };
  37036. /** The layout direction of the containing app. */
  37037. /**
  37038. * The layout direction of the containing app.
  37039. * @return {?}
  37040. */
  37041. MatPaginatedTabHeader.prototype._getLayoutDirection = /**
  37042. * The layout direction of the containing app.
  37043. * @return {?}
  37044. */
  37045. function () {
  37046. return this._dir && this._dir.value === 'rtl' ? 'rtl' : 'ltr';
  37047. };
  37048. /** Performs the CSS transformation on the tab list that will cause the list to scroll. */
  37049. /**
  37050. * Performs the CSS transformation on the tab list that will cause the list to scroll.
  37051. * @return {?}
  37052. */
  37053. MatPaginatedTabHeader.prototype._updateTabScrollPosition = /**
  37054. * Performs the CSS transformation on the tab list that will cause the list to scroll.
  37055. * @return {?}
  37056. */
  37057. function () {
  37058. /** @type {?} */
  37059. var scrollDistance = this.scrollDistance;
  37060. /** @type {?} */
  37061. var platform$$1 = this._platform;
  37062. /** @type {?} */
  37063. var translateX = this._getLayoutDirection() === 'ltr' ? -scrollDistance : scrollDistance;
  37064. // Don't use `translate3d` here because we don't want to create a new layer. A new layer
  37065. // seems to cause flickering and overflow in Internet Explorer. For example, the ink bar
  37066. // and ripples will exceed the boundaries of the visible tab bar.
  37067. // See: https://github.com/angular/components/issues/10276
  37068. // We round the `transform` here, because transforms with sub-pixel precision cause some
  37069. // browsers to blur the content of the element.
  37070. this._tabList.nativeElement.style.transform = "translateX(" + Math.round(translateX) + "px)";
  37071. // Setting the `transform` on IE will change the scroll offset of the parent, causing the
  37072. // position to be thrown off in some cases. We have to reset it ourselves to ensure that
  37073. // it doesn't get thrown off. Note that we scope it only to IE and Edge, because messing
  37074. // with the scroll position throws off Chrome 71+ in RTL mode (see #14689).
  37075. // @breaking-change 9.0.0 Remove null check for `platform` after it can no longer be undefined.
  37076. if (platform$$1 && (platform$$1.TRIDENT || platform$$1.EDGE)) {
  37077. this._tabListContainer.nativeElement.scrollLeft = 0;
  37078. }
  37079. };
  37080. Object.defineProperty(MatPaginatedTabHeader.prototype, "scrollDistance", {
  37081. /** Sets the distance in pixels that the tab header should be transformed in the X-axis. */
  37082. get: /**
  37083. * Sets the distance in pixels that the tab header should be transformed in the X-axis.
  37084. * @return {?}
  37085. */
  37086. function () { return this._scrollDistance; },
  37087. set: /**
  37088. * @param {?} value
  37089. * @return {?}
  37090. */
  37091. function (value) {
  37092. this._scrollTo(value);
  37093. },
  37094. enumerable: true,
  37095. configurable: true
  37096. });
  37097. /**
  37098. * Moves the tab list in the 'before' or 'after' direction (towards the beginning of the list or
  37099. * the end of the list, respectively). The distance to scroll is computed to be a third of the
  37100. * length of the tab list view window.
  37101. *
  37102. * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
  37103. * should be called sparingly.
  37104. */
  37105. /**
  37106. * Moves the tab list in the 'before' or 'after' direction (towards the beginning of the list or
  37107. * the end of the list, respectively). The distance to scroll is computed to be a third of the
  37108. * length of the tab list view window.
  37109. *
  37110. * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
  37111. * should be called sparingly.
  37112. * @param {?} direction
  37113. * @return {?}
  37114. */
  37115. MatPaginatedTabHeader.prototype._scrollHeader = /**
  37116. * Moves the tab list in the 'before' or 'after' direction (towards the beginning of the list or
  37117. * the end of the list, respectively). The distance to scroll is computed to be a third of the
  37118. * length of the tab list view window.
  37119. *
  37120. * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
  37121. * should be called sparingly.
  37122. * @param {?} direction
  37123. * @return {?}
  37124. */
  37125. function (direction) {
  37126. /** @type {?} */
  37127. var viewLength = this._tabListContainer.nativeElement.offsetWidth;
  37128. // Move the scroll distance one-third the length of the tab list's viewport.
  37129. /** @type {?} */
  37130. var scrollAmount = (direction == 'before' ? -1 : 1) * viewLength / 3;
  37131. return this._scrollTo(this._scrollDistance + scrollAmount);
  37132. };
  37133. /** Handles click events on the pagination arrows. */
  37134. /**
  37135. * Handles click events on the pagination arrows.
  37136. * @param {?} direction
  37137. * @return {?}
  37138. */
  37139. MatPaginatedTabHeader.prototype._handlePaginatorClick = /**
  37140. * Handles click events on the pagination arrows.
  37141. * @param {?} direction
  37142. * @return {?}
  37143. */
  37144. function (direction) {
  37145. this._stopInterval();
  37146. this._scrollHeader(direction);
  37147. };
  37148. /**
  37149. * Moves the tab list such that the desired tab label (marked by index) is moved into view.
  37150. *
  37151. * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
  37152. * should be called sparingly.
  37153. */
  37154. /**
  37155. * Moves the tab list such that the desired tab label (marked by index) is moved into view.
  37156. *
  37157. * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
  37158. * should be called sparingly.
  37159. * @param {?} labelIndex
  37160. * @return {?}
  37161. */
  37162. MatPaginatedTabHeader.prototype._scrollToLabel = /**
  37163. * Moves the tab list such that the desired tab label (marked by index) is moved into view.
  37164. *
  37165. * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
  37166. * should be called sparingly.
  37167. * @param {?} labelIndex
  37168. * @return {?}
  37169. */
  37170. function (labelIndex) {
  37171. /** @type {?} */
  37172. var selectedLabel = this._items ? this._items.toArray()[labelIndex] : null;
  37173. if (!selectedLabel) {
  37174. return;
  37175. }
  37176. // The view length is the visible width of the tab labels.
  37177. /** @type {?} */
  37178. var viewLength = this._tabListContainer.nativeElement.offsetWidth;
  37179. var _a = selectedLabel.elementRef.nativeElement, offsetLeft = _a.offsetLeft, offsetWidth = _a.offsetWidth;
  37180. /** @type {?} */
  37181. var labelBeforePos;
  37182. /** @type {?} */
  37183. var labelAfterPos;
  37184. if (this._getLayoutDirection() == 'ltr') {
  37185. labelBeforePos = offsetLeft;
  37186. labelAfterPos = labelBeforePos + offsetWidth;
  37187. }
  37188. else {
  37189. labelAfterPos = this._tabList.nativeElement.offsetWidth - offsetLeft;
  37190. labelBeforePos = labelAfterPos - offsetWidth;
  37191. }
  37192. /** @type {?} */
  37193. var beforeVisiblePos = this.scrollDistance;
  37194. /** @type {?} */
  37195. var afterVisiblePos = this.scrollDistance + viewLength;
  37196. if (labelBeforePos < beforeVisiblePos) {
  37197. // Scroll header to move label to the before direction
  37198. this.scrollDistance -= beforeVisiblePos - labelBeforePos + EXAGGERATED_OVERSCROLL;
  37199. }
  37200. else if (labelAfterPos > afterVisiblePos) {
  37201. // Scroll header to move label to the after direction
  37202. this.scrollDistance += labelAfterPos - afterVisiblePos + EXAGGERATED_OVERSCROLL;
  37203. }
  37204. };
  37205. /**
  37206. * Evaluate whether the pagination controls should be displayed. If the scroll width of the
  37207. * tab list is wider than the size of the header container, then the pagination controls should
  37208. * be shown.
  37209. *
  37210. * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
  37211. * should be called sparingly.
  37212. */
  37213. /**
  37214. * Evaluate whether the pagination controls should be displayed. If the scroll width of the
  37215. * tab list is wider than the size of the header container, then the pagination controls should
  37216. * be shown.
  37217. *
  37218. * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
  37219. * should be called sparingly.
  37220. * @return {?}
  37221. */
  37222. MatPaginatedTabHeader.prototype._checkPaginationEnabled = /**
  37223. * Evaluate whether the pagination controls should be displayed. If the scroll width of the
  37224. * tab list is wider than the size of the header container, then the pagination controls should
  37225. * be shown.
  37226. *
  37227. * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
  37228. * should be called sparingly.
  37229. * @return {?}
  37230. */
  37231. function () {
  37232. /** @type {?} */
  37233. var isEnabled = this._tabList.nativeElement.scrollWidth > this._elementRef.nativeElement.offsetWidth;
  37234. if (!isEnabled) {
  37235. this.scrollDistance = 0;
  37236. }
  37237. if (isEnabled !== this._showPaginationControls) {
  37238. this._changeDetectorRef.markForCheck();
  37239. }
  37240. this._showPaginationControls = isEnabled;
  37241. };
  37242. /**
  37243. * Evaluate whether the before and after controls should be enabled or disabled.
  37244. * If the header is at the beginning of the list (scroll distance is equal to 0) then disable the
  37245. * before button. If the header is at the end of the list (scroll distance is equal to the
  37246. * maximum distance we can scroll), then disable the after button.
  37247. *
  37248. * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
  37249. * should be called sparingly.
  37250. */
  37251. /**
  37252. * Evaluate whether the before and after controls should be enabled or disabled.
  37253. * If the header is at the beginning of the list (scroll distance is equal to 0) then disable the
  37254. * before button. If the header is at the end of the list (scroll distance is equal to the
  37255. * maximum distance we can scroll), then disable the after button.
  37256. *
  37257. * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
  37258. * should be called sparingly.
  37259. * @return {?}
  37260. */
  37261. MatPaginatedTabHeader.prototype._checkScrollingControls = /**
  37262. * Evaluate whether the before and after controls should be enabled or disabled.
  37263. * If the header is at the beginning of the list (scroll distance is equal to 0) then disable the
  37264. * before button. If the header is at the end of the list (scroll distance is equal to the
  37265. * maximum distance we can scroll), then disable the after button.
  37266. *
  37267. * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
  37268. * should be called sparingly.
  37269. * @return {?}
  37270. */
  37271. function () {
  37272. // Check if the pagination arrows should be activated.
  37273. this._disableScrollBefore = this.scrollDistance == 0;
  37274. this._disableScrollAfter = this.scrollDistance == this._getMaxScrollDistance();
  37275. this._changeDetectorRef.markForCheck();
  37276. };
  37277. /**
  37278. * Determines what is the maximum length in pixels that can be set for the scroll distance. This
  37279. * is equal to the difference in width between the tab list container and tab header container.
  37280. *
  37281. * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
  37282. * should be called sparingly.
  37283. */
  37284. /**
  37285. * Determines what is the maximum length in pixels that can be set for the scroll distance. This
  37286. * is equal to the difference in width between the tab list container and tab header container.
  37287. *
  37288. * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
  37289. * should be called sparingly.
  37290. * @return {?}
  37291. */
  37292. MatPaginatedTabHeader.prototype._getMaxScrollDistance = /**
  37293. * Determines what is the maximum length in pixels that can be set for the scroll distance. This
  37294. * is equal to the difference in width between the tab list container and tab header container.
  37295. *
  37296. * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
  37297. * should be called sparingly.
  37298. * @return {?}
  37299. */
  37300. function () {
  37301. /** @type {?} */
  37302. var lengthOfTabList = this._tabList.nativeElement.scrollWidth;
  37303. /** @type {?} */
  37304. var viewLength = this._tabListContainer.nativeElement.offsetWidth;
  37305. return (lengthOfTabList - viewLength) || 0;
  37306. };
  37307. /** Tells the ink-bar to align itself to the current label wrapper */
  37308. /**
  37309. * Tells the ink-bar to align itself to the current label wrapper
  37310. * @return {?}
  37311. */
  37312. MatPaginatedTabHeader.prototype._alignInkBarToSelectedTab = /**
  37313. * Tells the ink-bar to align itself to the current label wrapper
  37314. * @return {?}
  37315. */
  37316. function () {
  37317. /** @type {?} */
  37318. var selectedItem = this._items && this._items.length ?
  37319. this._items.toArray()[this.selectedIndex] : null;
  37320. /** @type {?} */
  37321. var selectedLabelWrapper = selectedItem ? selectedItem.elementRef.nativeElement : null;
  37322. if (selectedLabelWrapper) {
  37323. this._inkBar.alignToElement(selectedLabelWrapper);
  37324. }
  37325. else {
  37326. this._inkBar.hide();
  37327. }
  37328. };
  37329. /** Stops the currently-running paginator interval. */
  37330. /**
  37331. * Stops the currently-running paginator interval.
  37332. * @return {?}
  37333. */
  37334. MatPaginatedTabHeader.prototype._stopInterval = /**
  37335. * Stops the currently-running paginator interval.
  37336. * @return {?}
  37337. */
  37338. function () {
  37339. this._stopScrolling.next();
  37340. };
  37341. /**
  37342. * Handles the user pressing down on one of the paginators.
  37343. * Starts scrolling the header after a certain amount of time.
  37344. * @param direction In which direction the paginator should be scrolled.
  37345. */
  37346. /**
  37347. * Handles the user pressing down on one of the paginators.
  37348. * Starts scrolling the header after a certain amount of time.
  37349. * @param {?} direction In which direction the paginator should be scrolled.
  37350. * @return {?}
  37351. */
  37352. MatPaginatedTabHeader.prototype._handlePaginatorPress = /**
  37353. * Handles the user pressing down on one of the paginators.
  37354. * Starts scrolling the header after a certain amount of time.
  37355. * @param {?} direction In which direction the paginator should be scrolled.
  37356. * @return {?}
  37357. */
  37358. function (direction) {
  37359. var _this = this;
  37360. // Avoid overlapping timers.
  37361. this._stopInterval();
  37362. // Start a timer after the delay and keep firing based on the interval.
  37363. rxjs.timer(HEADER_SCROLL_DELAY, HEADER_SCROLL_INTERVAL)
  37364. // Keep the timer going until something tells it to stop or the component is destroyed.
  37365. .pipe(operators.takeUntil(rxjs.merge(this._stopScrolling, this._destroyed)))
  37366. .subscribe((/**
  37367. * @return {?}
  37368. */
  37369. function () {
  37370. var _a = _this._scrollHeader(direction), maxScrollDistance = _a.maxScrollDistance, distance = _a.distance;
  37371. // Stop the timer if we've reached the start or the end.
  37372. if (distance === 0 || distance >= maxScrollDistance) {
  37373. _this._stopInterval();
  37374. }
  37375. }));
  37376. };
  37377. /**
  37378. * Scrolls the header to a given position.
  37379. * @param position Position to which to scroll.
  37380. * @returns Information on the current scroll distance and the maximum.
  37381. */
  37382. /**
  37383. * Scrolls the header to a given position.
  37384. * @private
  37385. * @param {?} position Position to which to scroll.
  37386. * @return {?} Information on the current scroll distance and the maximum.
  37387. */
  37388. MatPaginatedTabHeader.prototype._scrollTo = /**
  37389. * Scrolls the header to a given position.
  37390. * @private
  37391. * @param {?} position Position to which to scroll.
  37392. * @return {?} Information on the current scroll distance and the maximum.
  37393. */
  37394. function (position) {
  37395. /** @type {?} */
  37396. var maxScrollDistance = this._getMaxScrollDistance();
  37397. this._scrollDistance = Math.max(0, Math.min(maxScrollDistance, position));
  37398. // Mark that the scroll distance has changed so that after the view is checked, the CSS
  37399. // transformation can move the header.
  37400. this._scrollDistanceChanged = true;
  37401. this._checkScrollingControls();
  37402. return { maxScrollDistance: maxScrollDistance, distance: this._scrollDistance };
  37403. };
  37404. /** @nocollapse */
  37405. MatPaginatedTabHeader.ctorParameters = function () { return [
  37406. { type: core.ElementRef },
  37407. { type: core.ChangeDetectorRef },
  37408. { type: scrolling.ViewportRuler },
  37409. { type: bidi.Directionality, decorators: [{ type: core.Optional }] },
  37410. { type: core.NgZone },
  37411. { type: platform.Platform },
  37412. { type: String }
  37413. ]; };
  37414. return MatPaginatedTabHeader;
  37415. }());
  37416. /**
  37417. * @fileoverview added by tsickle
  37418. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  37419. */
  37420. /**
  37421. * The header of the tab group which displays a list of all the tabs in the tab group. Includes
  37422. * an ink bar that follows the currently selected tab. When the tabs list's width exceeds the
  37423. * width of the header container, then arrows will be displayed to allow the user to scroll
  37424. * left and right across the header.
  37425. * \@docs-private
  37426. */
  37427. var MatTabHeader = /** @class */ (function (_super) {
  37428. __extends(MatTabHeader, _super);
  37429. function MatTabHeader(elementRef, changeDetectorRef, viewportRuler, dir, ngZone, platform$$1,
  37430. // @breaking-change 9.0.0 `_animationMode` parameter to be made required.
  37431. animationMode) {
  37432. var _this = _super.call(this, elementRef, changeDetectorRef, viewportRuler, dir, ngZone, platform$$1, animationMode) || this;
  37433. _this._disableRipple = false;
  37434. return _this;
  37435. }
  37436. Object.defineProperty(MatTabHeader.prototype, "disableRipple", {
  37437. /** Whether the ripple effect is disabled or not. */
  37438. get: /**
  37439. * Whether the ripple effect is disabled or not.
  37440. * @return {?}
  37441. */
  37442. function () { return this._disableRipple; },
  37443. set: /**
  37444. * @param {?} value
  37445. * @return {?}
  37446. */
  37447. function (value) { this._disableRipple = coercion.coerceBooleanProperty(value); },
  37448. enumerable: true,
  37449. configurable: true
  37450. });
  37451. /**
  37452. * @protected
  37453. * @param {?} event
  37454. * @return {?}
  37455. */
  37456. MatTabHeader.prototype._itemSelected = /**
  37457. * @protected
  37458. * @param {?} event
  37459. * @return {?}
  37460. */
  37461. function (event) {
  37462. event.preventDefault();
  37463. };
  37464. MatTabHeader.decorators = [
  37465. { type: core.Component, args: [{selector: 'mat-tab-header',
  37466. template: "<div class=\"mat-tab-header-pagination mat-tab-header-pagination-before mat-elevation-z4\" #previousPaginator aria-hidden=\"true\" mat-ripple [matRippleDisabled]=\"_disableScrollBefore || disableRipple\" [class.mat-tab-header-pagination-disabled]=\"_disableScrollBefore\" (click)=\"_handlePaginatorClick('before')\" (mousedown)=\"_handlePaginatorPress('before')\" (touchend)=\"_stopInterval()\"><div class=\"mat-tab-header-pagination-chevron\"></div></div><div class=\"mat-tab-label-container\" #tabListContainer (keydown)=\"_handleKeydown($event)\"><div #tabList class=\"mat-tab-list\" [class._mat-animation-noopable]=\"_animationMode === 'NoopAnimations'\" role=\"tablist\" (cdkObserveContent)=\"_onContentChanges()\"><div class=\"mat-tab-labels\"><ng-content></ng-content></div><mat-ink-bar></mat-ink-bar></div></div><div class=\"mat-tab-header-pagination mat-tab-header-pagination-after mat-elevation-z4\" #nextPaginator aria-hidden=\"true\" mat-ripple [matRippleDisabled]=\"_disableScrollAfter || disableRipple\" [class.mat-tab-header-pagination-disabled]=\"_disableScrollAfter\" (mousedown)=\"_handlePaginatorPress('after')\" (click)=\"_handlePaginatorClick('after')\" (touchend)=\"_stopInterval()\"><div class=\"mat-tab-header-pagination-chevron\"></div></div>",
  37467. styles: [".mat-tab-header{display:flex;overflow:hidden;position:relative;flex-shrink:0}.mat-tab-header-pagination{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;position:relative;display:none;justify-content:center;align-items:center;min-width:32px;cursor:pointer;z-index:2;-webkit-tap-highlight-color:transparent;touch-action:none}.mat-tab-header-pagination-controls-enabled .mat-tab-header-pagination{display:flex}.mat-tab-header-pagination-before,.mat-tab-header-rtl .mat-tab-header-pagination-after{padding-left:4px}.mat-tab-header-pagination-before .mat-tab-header-pagination-chevron,.mat-tab-header-rtl .mat-tab-header-pagination-after .mat-tab-header-pagination-chevron{transform:rotate(-135deg)}.mat-tab-header-pagination-after,.mat-tab-header-rtl .mat-tab-header-pagination-before{padding-right:4px}.mat-tab-header-pagination-after .mat-tab-header-pagination-chevron,.mat-tab-header-rtl .mat-tab-header-pagination-before .mat-tab-header-pagination-chevron{transform:rotate(45deg)}.mat-tab-header-pagination-chevron{border-style:solid;border-width:2px 2px 0 0;content:'';height:8px;width:8px}.mat-tab-header-pagination-disabled{box-shadow:none;cursor:default}.mat-tab-list{flex-grow:1;position:relative;transition:transform .5s cubic-bezier(.35,0,.25,1)}.mat-ink-bar{position:absolute;bottom:0;height:2px;transition:.5s cubic-bezier(.35,0,.25,1)}._mat-animation-noopable.mat-ink-bar{transition:none;animation:none}.mat-tab-group-inverted-header .mat-ink-bar{bottom:auto;top:0}@media (-ms-high-contrast:active){.mat-ink-bar{outline:solid 2px;height:0}}.mat-tab-labels{display:flex}[mat-align-tabs=center] .mat-tab-labels{justify-content:center}[mat-align-tabs=end] .mat-tab-labels{justify-content:flex-end}.mat-tab-label-container{display:flex;flex-grow:1;overflow:hidden;z-index:1}._mat-animation-noopable.mat-tab-list{transition:none;animation:none}.mat-tab-label{height:48px;padding:0 24px;cursor:pointer;box-sizing:border-box;opacity:.6;min-width:160px;text-align:center;display:inline-flex;justify-content:center;align-items:center;white-space:nowrap;position:relative}.mat-tab-label:focus{outline:0}.mat-tab-label:focus:not(.mat-tab-disabled){opacity:1}@media (-ms-high-contrast:active){.mat-tab-label:focus{outline:dotted 2px}}.mat-tab-label.mat-tab-disabled{cursor:default}@media (-ms-high-contrast:active){.mat-tab-label.mat-tab-disabled{opacity:.5}}.mat-tab-label .mat-tab-label-content{display:inline-flex;justify-content:center;align-items:center;white-space:nowrap}@media (-ms-high-contrast:active){.mat-tab-label{opacity:1}}@media (max-width:599px){.mat-tab-label{min-width:72px}}"],
  37468. inputs: ['selectedIndex'],
  37469. outputs: ['selectFocusedIndex', 'indexFocused'],
  37470. encapsulation: core.ViewEncapsulation.None,
  37471. changeDetection: core.ChangeDetectionStrategy.OnPush,
  37472. host: {
  37473. 'class': 'mat-tab-header',
  37474. '[class.mat-tab-header-pagination-controls-enabled]': '_showPaginationControls',
  37475. '[class.mat-tab-header-rtl]': "_getLayoutDirection() == 'rtl'",
  37476. },
  37477. },] },
  37478. ];
  37479. /** @nocollapse */
  37480. MatTabHeader.ctorParameters = function () { return [
  37481. { type: core.ElementRef },
  37482. { type: core.ChangeDetectorRef },
  37483. { type: scrolling.ViewportRuler },
  37484. { type: bidi.Directionality, decorators: [{ type: core.Optional }] },
  37485. { type: core.NgZone },
  37486. { type: platform.Platform },
  37487. { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
  37488. ]; };
  37489. MatTabHeader.propDecorators = {
  37490. _items: [{ type: core.ContentChildren, args: [MatTabLabelWrapper,] }],
  37491. _inkBar: [{ type: core.ViewChild, args: [MatInkBar, { static: true },] }],
  37492. _tabListContainer: [{ type: core.ViewChild, args: ['tabListContainer', { static: true },] }],
  37493. _tabList: [{ type: core.ViewChild, args: ['tabList', { static: true },] }],
  37494. _nextPaginator: [{ type: core.ViewChild, args: ['nextPaginator', { static: false },] }],
  37495. _previousPaginator: [{ type: core.ViewChild, args: ['previousPaginator', { static: false },] }],
  37496. disableRipple: [{ type: core.Input }]
  37497. };
  37498. return MatTabHeader;
  37499. }(MatPaginatedTabHeader));
  37500. /**
  37501. * @fileoverview added by tsickle
  37502. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  37503. */
  37504. /**
  37505. * Used to generate unique ID's for each tab component
  37506. * @type {?}
  37507. */
  37508. var nextId$1 = 0;
  37509. /**
  37510. * A simple change event emitted on focus or selection changes.
  37511. */
  37512. var /**
  37513. * A simple change event emitted on focus or selection changes.
  37514. */
  37515. MatTabChangeEvent = /** @class */ (function () {
  37516. function MatTabChangeEvent() {
  37517. }
  37518. return MatTabChangeEvent;
  37519. }());
  37520. /**
  37521. * Injection token that can be used to provide the default options the tabs module.
  37522. * @type {?}
  37523. */
  37524. var MAT_TABS_CONFIG = new core.InjectionToken('MAT_TABS_CONFIG');
  37525. // Boilerplate for applying mixins to MatTabGroup.
  37526. /**
  37527. * \@docs-private
  37528. */
  37529. var
  37530. // Boilerplate for applying mixins to MatTabGroup.
  37531. /**
  37532. * \@docs-private
  37533. */
  37534. MatTabGroupBase = /** @class */ (function () {
  37535. function MatTabGroupBase(_elementRef) {
  37536. this._elementRef = _elementRef;
  37537. }
  37538. return MatTabGroupBase;
  37539. }());
  37540. /** @type {?} */
  37541. var _MatTabGroupMixinBase = mixinColor(mixinDisableRipple(MatTabGroupBase), 'primary');
  37542. /**
  37543. * Material design tab-group component. Supports basic tab pairs (label + content) and includes
  37544. * animated ink-bar, keyboard navigation, and screen reader.
  37545. * See: https://material.io/design/components/tabs.html
  37546. */
  37547. var MatTabGroup = /** @class */ (function (_super) {
  37548. __extends(MatTabGroup, _super);
  37549. function MatTabGroup(elementRef, _changeDetectorRef, defaultConfig, _animationMode) {
  37550. var _this = _super.call(this, elementRef) || this;
  37551. _this._changeDetectorRef = _changeDetectorRef;
  37552. _this._animationMode = _animationMode;
  37553. /**
  37554. * The tab index that should be selected after the content has been checked.
  37555. */
  37556. _this._indexToSelect = 0;
  37557. /**
  37558. * Snapshot of the height of the tab body wrapper before another tab is activated.
  37559. */
  37560. _this._tabBodyWrapperHeight = 0;
  37561. /**
  37562. * Subscription to tabs being added/removed.
  37563. */
  37564. _this._tabsSubscription = rxjs.Subscription.EMPTY;
  37565. /**
  37566. * Subscription to changes in the tab labels.
  37567. */
  37568. _this._tabLabelSubscription = rxjs.Subscription.EMPTY;
  37569. _this._dynamicHeight = false;
  37570. _this._selectedIndex = null;
  37571. /**
  37572. * Position of the tab header.
  37573. */
  37574. _this.headerPosition = 'above';
  37575. /**
  37576. * Output to enable support for two-way binding on `[(selectedIndex)]`
  37577. */
  37578. _this.selectedIndexChange = new core.EventEmitter();
  37579. /**
  37580. * Event emitted when focus has changed within a tab group.
  37581. */
  37582. _this.focusChange = new core.EventEmitter();
  37583. /**
  37584. * Event emitted when the body animation has completed
  37585. */
  37586. _this.animationDone = new core.EventEmitter();
  37587. /**
  37588. * Event emitted when the tab selection has changed.
  37589. */
  37590. _this.selectedTabChange = new core.EventEmitter(true);
  37591. _this._groupId = nextId$1++;
  37592. _this.animationDuration = defaultConfig && defaultConfig.animationDuration ?
  37593. defaultConfig.animationDuration : '500ms';
  37594. return _this;
  37595. }
  37596. Object.defineProperty(MatTabGroup.prototype, "dynamicHeight", {
  37597. /** Whether the tab group should grow to the size of the active tab. */
  37598. get: /**
  37599. * Whether the tab group should grow to the size of the active tab.
  37600. * @return {?}
  37601. */
  37602. function () { return this._dynamicHeight; },
  37603. set: /**
  37604. * @param {?} value
  37605. * @return {?}
  37606. */
  37607. function (value) { this._dynamicHeight = coercion.coerceBooleanProperty(value); },
  37608. enumerable: true,
  37609. configurable: true
  37610. });
  37611. Object.defineProperty(MatTabGroup.prototype, "selectedIndex", {
  37612. /** The index of the active tab. */
  37613. get: /**
  37614. * The index of the active tab.
  37615. * @return {?}
  37616. */
  37617. function () { return this._selectedIndex; },
  37618. set: /**
  37619. * @param {?} value
  37620. * @return {?}
  37621. */
  37622. function (value) {
  37623. this._indexToSelect = coercion.coerceNumberProperty(value, null);
  37624. },
  37625. enumerable: true,
  37626. configurable: true
  37627. });
  37628. Object.defineProperty(MatTabGroup.prototype, "animationDuration", {
  37629. /** Duration for the tab animation. Will be normalized to milliseconds if no units are set. */
  37630. get: /**
  37631. * Duration for the tab animation. Will be normalized to milliseconds if no units are set.
  37632. * @return {?}
  37633. */
  37634. function () { return this._animationDuration; },
  37635. set: /**
  37636. * @param {?} value
  37637. * @return {?}
  37638. */
  37639. function (value) {
  37640. this._animationDuration = /^\d+$/.test(value) ? value + 'ms' : value;
  37641. },
  37642. enumerable: true,
  37643. configurable: true
  37644. });
  37645. Object.defineProperty(MatTabGroup.prototype, "backgroundColor", {
  37646. /** Background color of the tab group. */
  37647. get: /**
  37648. * Background color of the tab group.
  37649. * @return {?}
  37650. */
  37651. function () { return this._backgroundColor; },
  37652. set: /**
  37653. * @param {?} value
  37654. * @return {?}
  37655. */
  37656. function (value) {
  37657. /** @type {?} */
  37658. var nativeElement = this._elementRef.nativeElement;
  37659. nativeElement.classList.remove("mat-background-" + this.backgroundColor);
  37660. if (value) {
  37661. nativeElement.classList.add("mat-background-" + value);
  37662. }
  37663. this._backgroundColor = value;
  37664. },
  37665. enumerable: true,
  37666. configurable: true
  37667. });
  37668. /**
  37669. * After the content is checked, this component knows what tabs have been defined
  37670. * and what the selected index should be. This is where we can know exactly what position
  37671. * each tab should be in according to the new selected index, and additionally we know how
  37672. * a new selected tab should transition in (from the left or right).
  37673. */
  37674. /**
  37675. * After the content is checked, this component knows what tabs have been defined
  37676. * and what the selected index should be. This is where we can know exactly what position
  37677. * each tab should be in according to the new selected index, and additionally we know how
  37678. * a new selected tab should transition in (from the left or right).
  37679. * @return {?}
  37680. */
  37681. MatTabGroup.prototype.ngAfterContentChecked = /**
  37682. * After the content is checked, this component knows what tabs have been defined
  37683. * and what the selected index should be. This is where we can know exactly what position
  37684. * each tab should be in according to the new selected index, and additionally we know how
  37685. * a new selected tab should transition in (from the left or right).
  37686. * @return {?}
  37687. */
  37688. function () {
  37689. var _this = this;
  37690. // Don't clamp the `indexToSelect` immediately in the setter because it can happen that
  37691. // the amount of tabs changes before the actual change detection runs.
  37692. /** @type {?} */
  37693. var indexToSelect = this._indexToSelect = this._clampTabIndex(this._indexToSelect);
  37694. // If there is a change in selected index, emit a change event. Should not trigger if
  37695. // the selected index has not yet been initialized.
  37696. if (this._selectedIndex != indexToSelect) {
  37697. /** @type {?} */
  37698. var isFirstRun_1 = this._selectedIndex == null;
  37699. if (!isFirstRun_1) {
  37700. this.selectedTabChange.emit(this._createChangeEvent(indexToSelect));
  37701. }
  37702. // Changing these values after change detection has run
  37703. // since the checked content may contain references to them.
  37704. Promise.resolve().then((/**
  37705. * @return {?}
  37706. */
  37707. function () {
  37708. _this._tabs.forEach((/**
  37709. * @param {?} tab
  37710. * @param {?} index
  37711. * @return {?}
  37712. */
  37713. function (tab, index) { return tab.isActive = index === indexToSelect; }));
  37714. if (!isFirstRun_1) {
  37715. _this.selectedIndexChange.emit(indexToSelect);
  37716. }
  37717. }));
  37718. }
  37719. // Setup the position for each tab and optionally setup an origin on the next selected tab.
  37720. this._tabs.forEach((/**
  37721. * @param {?} tab
  37722. * @param {?} index
  37723. * @return {?}
  37724. */
  37725. function (tab, index) {
  37726. tab.position = index - indexToSelect;
  37727. // If there is already a selected tab, then set up an origin for the next selected tab
  37728. // if it doesn't have one already.
  37729. if (_this._selectedIndex != null && tab.position == 0 && !tab.origin) {
  37730. tab.origin = indexToSelect - _this._selectedIndex;
  37731. }
  37732. }));
  37733. if (this._selectedIndex !== indexToSelect) {
  37734. this._selectedIndex = indexToSelect;
  37735. this._changeDetectorRef.markForCheck();
  37736. }
  37737. };
  37738. /**
  37739. * @return {?}
  37740. */
  37741. MatTabGroup.prototype.ngAfterContentInit = /**
  37742. * @return {?}
  37743. */
  37744. function () {
  37745. var _this = this;
  37746. this._subscribeToTabLabels();
  37747. // Subscribe to changes in the amount of tabs, in order to be
  37748. // able to re-render the content as new tabs are added or removed.
  37749. this._tabsSubscription = this._tabs.changes.subscribe((/**
  37750. * @return {?}
  37751. */
  37752. function () {
  37753. /** @type {?} */
  37754. var indexToSelect = _this._clampTabIndex(_this._indexToSelect);
  37755. // Maintain the previously-selected tab if a new tab is added or removed and there is no
  37756. // explicit change that selects a different tab.
  37757. if (indexToSelect === _this._selectedIndex) {
  37758. /** @type {?} */
  37759. var tabs = _this._tabs.toArray();
  37760. for (var i = 0; i < tabs.length; i++) {
  37761. if (tabs[i].isActive) {
  37762. // Assign both to the `_indexToSelect` and `_selectedIndex` so we don't fire a changed
  37763. // event, otherwise the consumer may end up in an infinite loop in some edge cases like
  37764. // adding a tab within the `selectedIndexChange` event.
  37765. _this._indexToSelect = _this._selectedIndex = i;
  37766. break;
  37767. }
  37768. }
  37769. }
  37770. _this._subscribeToTabLabels();
  37771. _this._changeDetectorRef.markForCheck();
  37772. }));
  37773. };
  37774. /**
  37775. * @return {?}
  37776. */
  37777. MatTabGroup.prototype.ngOnDestroy = /**
  37778. * @return {?}
  37779. */
  37780. function () {
  37781. this._tabsSubscription.unsubscribe();
  37782. this._tabLabelSubscription.unsubscribe();
  37783. };
  37784. /** Re-aligns the ink bar to the selected tab element. */
  37785. /**
  37786. * Re-aligns the ink bar to the selected tab element.
  37787. * @return {?}
  37788. */
  37789. MatTabGroup.prototype.realignInkBar = /**
  37790. * Re-aligns the ink bar to the selected tab element.
  37791. * @return {?}
  37792. */
  37793. function () {
  37794. if (this._tabHeader) {
  37795. this._tabHeader._alignInkBarToSelectedTab();
  37796. }
  37797. };
  37798. /**
  37799. * @param {?} index
  37800. * @return {?}
  37801. */
  37802. MatTabGroup.prototype._focusChanged = /**
  37803. * @param {?} index
  37804. * @return {?}
  37805. */
  37806. function (index) {
  37807. this.focusChange.emit(this._createChangeEvent(index));
  37808. };
  37809. /**
  37810. * @private
  37811. * @param {?} index
  37812. * @return {?}
  37813. */
  37814. MatTabGroup.prototype._createChangeEvent = /**
  37815. * @private
  37816. * @param {?} index
  37817. * @return {?}
  37818. */
  37819. function (index) {
  37820. /** @type {?} */
  37821. var event = new MatTabChangeEvent;
  37822. event.index = index;
  37823. if (this._tabs && this._tabs.length) {
  37824. event.tab = this._tabs.toArray()[index];
  37825. }
  37826. return event;
  37827. };
  37828. /**
  37829. * Subscribes to changes in the tab labels. This is needed, because the @Input for the label is
  37830. * on the MatTab component, whereas the data binding is inside the MatTabGroup. In order for the
  37831. * binding to be updated, we need to subscribe to changes in it and trigger change detection
  37832. * manually.
  37833. */
  37834. /**
  37835. * Subscribes to changes in the tab labels. This is needed, because the \@Input for the label is
  37836. * on the MatTab component, whereas the data binding is inside the MatTabGroup. In order for the
  37837. * binding to be updated, we need to subscribe to changes in it and trigger change detection
  37838. * manually.
  37839. * @private
  37840. * @return {?}
  37841. */
  37842. MatTabGroup.prototype._subscribeToTabLabels = /**
  37843. * Subscribes to changes in the tab labels. This is needed, because the \@Input for the label is
  37844. * on the MatTab component, whereas the data binding is inside the MatTabGroup. In order for the
  37845. * binding to be updated, we need to subscribe to changes in it and trigger change detection
  37846. * manually.
  37847. * @private
  37848. * @return {?}
  37849. */
  37850. function () {
  37851. var _this = this;
  37852. if (this._tabLabelSubscription) {
  37853. this._tabLabelSubscription.unsubscribe();
  37854. }
  37855. this._tabLabelSubscription = rxjs.merge.apply(void 0, this._tabs.map((/**
  37856. * @param {?} tab
  37857. * @return {?}
  37858. */
  37859. function (tab) { return tab._stateChanges; }))).subscribe((/**
  37860. * @return {?}
  37861. */
  37862. function () { return _this._changeDetectorRef.markForCheck(); }));
  37863. };
  37864. /** Clamps the given index to the bounds of 0 and the tabs length. */
  37865. /**
  37866. * Clamps the given index to the bounds of 0 and the tabs length.
  37867. * @private
  37868. * @param {?} index
  37869. * @return {?}
  37870. */
  37871. MatTabGroup.prototype._clampTabIndex = /**
  37872. * Clamps the given index to the bounds of 0 and the tabs length.
  37873. * @private
  37874. * @param {?} index
  37875. * @return {?}
  37876. */
  37877. function (index) {
  37878. // Note the `|| 0`, which ensures that values like NaN can't get through
  37879. // and which would otherwise throw the component into an infinite loop
  37880. // (since Math.max(NaN, 0) === NaN).
  37881. return Math.min(this._tabs.length - 1, Math.max(index || 0, 0));
  37882. };
  37883. /** Returns a unique id for each tab label element */
  37884. /**
  37885. * Returns a unique id for each tab label element
  37886. * @param {?} i
  37887. * @return {?}
  37888. */
  37889. MatTabGroup.prototype._getTabLabelId = /**
  37890. * Returns a unique id for each tab label element
  37891. * @param {?} i
  37892. * @return {?}
  37893. */
  37894. function (i) {
  37895. return "mat-tab-label-" + this._groupId + "-" + i;
  37896. };
  37897. /** Returns a unique id for each tab content element */
  37898. /**
  37899. * Returns a unique id for each tab content element
  37900. * @param {?} i
  37901. * @return {?}
  37902. */
  37903. MatTabGroup.prototype._getTabContentId = /**
  37904. * Returns a unique id for each tab content element
  37905. * @param {?} i
  37906. * @return {?}
  37907. */
  37908. function (i) {
  37909. return "mat-tab-content-" + this._groupId + "-" + i;
  37910. };
  37911. /**
  37912. * Sets the height of the body wrapper to the height of the activating tab if dynamic
  37913. * height property is true.
  37914. */
  37915. /**
  37916. * Sets the height of the body wrapper to the height of the activating tab if dynamic
  37917. * height property is true.
  37918. * @param {?} tabHeight
  37919. * @return {?}
  37920. */
  37921. MatTabGroup.prototype._setTabBodyWrapperHeight = /**
  37922. * Sets the height of the body wrapper to the height of the activating tab if dynamic
  37923. * height property is true.
  37924. * @param {?} tabHeight
  37925. * @return {?}
  37926. */
  37927. function (tabHeight) {
  37928. if (!this._dynamicHeight || !this._tabBodyWrapperHeight) {
  37929. return;
  37930. }
  37931. /** @type {?} */
  37932. var wrapper = this._tabBodyWrapper.nativeElement;
  37933. wrapper.style.height = this._tabBodyWrapperHeight + 'px';
  37934. // This conditional forces the browser to paint the height so that
  37935. // the animation to the new height can have an origin.
  37936. if (this._tabBodyWrapper.nativeElement.offsetHeight) {
  37937. wrapper.style.height = tabHeight + 'px';
  37938. }
  37939. };
  37940. /** Removes the height of the tab body wrapper. */
  37941. /**
  37942. * Removes the height of the tab body wrapper.
  37943. * @return {?}
  37944. */
  37945. MatTabGroup.prototype._removeTabBodyWrapperHeight = /**
  37946. * Removes the height of the tab body wrapper.
  37947. * @return {?}
  37948. */
  37949. function () {
  37950. /** @type {?} */
  37951. var wrapper = this._tabBodyWrapper.nativeElement;
  37952. this._tabBodyWrapperHeight = wrapper.clientHeight;
  37953. wrapper.style.height = '';
  37954. this.animationDone.emit();
  37955. };
  37956. /** Handle click events, setting new selected index if appropriate. */
  37957. /**
  37958. * Handle click events, setting new selected index if appropriate.
  37959. * @param {?} tab
  37960. * @param {?} tabHeader
  37961. * @param {?} index
  37962. * @return {?}
  37963. */
  37964. MatTabGroup.prototype._handleClick = /**
  37965. * Handle click events, setting new selected index if appropriate.
  37966. * @param {?} tab
  37967. * @param {?} tabHeader
  37968. * @param {?} index
  37969. * @return {?}
  37970. */
  37971. function (tab, tabHeader, index) {
  37972. if (!tab.disabled) {
  37973. this.selectedIndex = tabHeader.focusIndex = index;
  37974. }
  37975. };
  37976. /** Retrieves the tabindex for the tab. */
  37977. /**
  37978. * Retrieves the tabindex for the tab.
  37979. * @param {?} tab
  37980. * @param {?} idx
  37981. * @return {?}
  37982. */
  37983. MatTabGroup.prototype._getTabIndex = /**
  37984. * Retrieves the tabindex for the tab.
  37985. * @param {?} tab
  37986. * @param {?} idx
  37987. * @return {?}
  37988. */
  37989. function (tab, idx) {
  37990. if (tab.disabled) {
  37991. return null;
  37992. }
  37993. return this.selectedIndex === idx ? 0 : -1;
  37994. };
  37995. MatTabGroup.decorators = [
  37996. { type: core.Component, args: [{selector: 'mat-tab-group',
  37997. exportAs: 'matTabGroup',
  37998. template: "<mat-tab-header #tabHeader [selectedIndex]=\"selectedIndex\" [disableRipple]=\"disableRipple\" (indexFocused)=\"_focusChanged($event)\" (selectFocusedIndex)=\"selectedIndex = $event\"><div class=\"mat-tab-label\" role=\"tab\" matTabLabelWrapper mat-ripple cdkMonitorElementFocus *ngFor=\"let tab of _tabs; let i = index\" [id]=\"_getTabLabelId(i)\" [attr.tabIndex]=\"_getTabIndex(tab, i)\" [attr.aria-posinset]=\"i + 1\" [attr.aria-setsize]=\"_tabs.length\" [attr.aria-controls]=\"_getTabContentId(i)\" [attr.aria-selected]=\"selectedIndex == i\" [attr.aria-label]=\"tab.ariaLabel || null\" [attr.aria-labelledby]=\"(!tab.ariaLabel && tab.ariaLabelledby) ? tab.ariaLabelledby : null\" [class.mat-tab-label-active]=\"selectedIndex == i\" [disabled]=\"tab.disabled\" [matRippleDisabled]=\"tab.disabled || disableRipple\" (click)=\"_handleClick(tab, tabHeader, i)\"><div class=\"mat-tab-label-content\"><ng-template [ngIf]=\"tab.templateLabel\"><ng-template [cdkPortalOutlet]=\"tab.templateLabel\"></ng-template></ng-template><ng-template [ngIf]=\"!tab.templateLabel\">{{tab.textLabel}}</ng-template></div></div></mat-tab-header><div class=\"mat-tab-body-wrapper\" [class._mat-animation-noopable]=\"_animationMode === 'NoopAnimations'\" #tabBodyWrapper><mat-tab-body role=\"tabpanel\" *ngFor=\"let tab of _tabs; let i = index\" [id]=\"_getTabContentId(i)\" [attr.aria-labelledby]=\"_getTabLabelId(i)\" [class.mat-tab-body-active]=\"selectedIndex == i\" [content]=\"tab.content\" [position]=\"tab.position\" [origin]=\"tab.origin\" [animationDuration]=\"animationDuration\" (_onCentered)=\"_removeTabBodyWrapperHeight()\" (_onCentering)=\"_setTabBodyWrapperHeight($event)\"></mat-tab-body></div>",
  37999. styles: [".mat-tab-group{display:flex;flex-direction:column}.mat-tab-group.mat-tab-group-inverted-header{flex-direction:column-reverse}.mat-tab-label{height:48px;padding:0 24px;cursor:pointer;box-sizing:border-box;opacity:.6;min-width:160px;text-align:center;display:inline-flex;justify-content:center;align-items:center;white-space:nowrap;position:relative}.mat-tab-label:focus{outline:0}.mat-tab-label:focus:not(.mat-tab-disabled){opacity:1}@media (-ms-high-contrast:active){.mat-tab-label:focus{outline:dotted 2px}}.mat-tab-label.mat-tab-disabled{cursor:default}@media (-ms-high-contrast:active){.mat-tab-label.mat-tab-disabled{opacity:.5}}.mat-tab-label .mat-tab-label-content{display:inline-flex;justify-content:center;align-items:center;white-space:nowrap}@media (-ms-high-contrast:active){.mat-tab-label{opacity:1}}@media (max-width:599px){.mat-tab-label{padding:0 12px}}@media (max-width:959px){.mat-tab-label{padding:0 12px}}.mat-tab-group[mat-stretch-tabs]>.mat-tab-header .mat-tab-label{flex-basis:0;flex-grow:1}.mat-tab-body-wrapper{position:relative;overflow:hidden;display:flex;transition:height .5s cubic-bezier(.35,0,.25,1)}._mat-animation-noopable.mat-tab-body-wrapper{transition:none;animation:none}.mat-tab-body{top:0;left:0;right:0;bottom:0;position:absolute;display:block;overflow:hidden;flex-basis:100%}.mat-tab-body.mat-tab-body-active{position:relative;overflow-x:hidden;overflow-y:auto;z-index:1;flex-grow:1}.mat-tab-group.mat-tab-group-dynamic-height .mat-tab-body.mat-tab-body-active{overflow-y:hidden}"],
  38000. encapsulation: core.ViewEncapsulation.None,
  38001. changeDetection: core.ChangeDetectionStrategy.OnPush,
  38002. inputs: ['color', 'disableRipple'],
  38003. host: {
  38004. 'class': 'mat-tab-group',
  38005. '[class.mat-tab-group-dynamic-height]': 'dynamicHeight',
  38006. '[class.mat-tab-group-inverted-header]': 'headerPosition === "below"',
  38007. },
  38008. },] },
  38009. ];
  38010. /** @nocollapse */
  38011. MatTabGroup.ctorParameters = function () { return [
  38012. { type: core.ElementRef },
  38013. { type: core.ChangeDetectorRef },
  38014. { type: undefined, decorators: [{ type: core.Inject, args: [MAT_TABS_CONFIG,] }, { type: core.Optional }] },
  38015. { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
  38016. ]; };
  38017. MatTabGroup.propDecorators = {
  38018. _tabs: [{ type: core.ContentChildren, args: [MatTab,] }],
  38019. _tabBodyWrapper: [{ type: core.ViewChild, args: ['tabBodyWrapper', { static: false },] }],
  38020. _tabHeader: [{ type: core.ViewChild, args: ['tabHeader', { static: false },] }],
  38021. dynamicHeight: [{ type: core.Input }],
  38022. selectedIndex: [{ type: core.Input }],
  38023. headerPosition: [{ type: core.Input }],
  38024. animationDuration: [{ type: core.Input }],
  38025. backgroundColor: [{ type: core.Input }],
  38026. selectedIndexChange: [{ type: core.Output }],
  38027. focusChange: [{ type: core.Output }],
  38028. animationDone: [{ type: core.Output }],
  38029. selectedTabChange: [{ type: core.Output }]
  38030. };
  38031. return MatTabGroup;
  38032. }(_MatTabGroupMixinBase));
  38033. /**
  38034. * @fileoverview added by tsickle
  38035. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  38036. */
  38037. /**
  38038. * Navigation component matching the styles of the tab group header.
  38039. * Provides anchored navigation with animated ink bar.
  38040. */
  38041. var MatTabNav = /** @class */ (function (_super) {
  38042. __extends(MatTabNav, _super);
  38043. function MatTabNav(elementRef, dir, ngZone, changeDetectorRef, viewportRuler,
  38044. /**
  38045. * @deprecated @breaking-change 9.0.0 `platform` parameter to become required.
  38046. */
  38047. platform$$1, animationMode) {
  38048. var _this = _super.call(this, elementRef, changeDetectorRef, viewportRuler, dir, ngZone, platform$$1, animationMode) || this;
  38049. _this._disableRipple = false;
  38050. /**
  38051. * Theme color of the nav bar.
  38052. */
  38053. _this.color = 'primary';
  38054. return _this;
  38055. }
  38056. Object.defineProperty(MatTabNav.prototype, "backgroundColor", {
  38057. /** Background color of the tab nav. */
  38058. get: /**
  38059. * Background color of the tab nav.
  38060. * @return {?}
  38061. */
  38062. function () { return this._backgroundColor; },
  38063. set: /**
  38064. * @param {?} value
  38065. * @return {?}
  38066. */
  38067. function (value) {
  38068. /** @type {?} */
  38069. var classList = this._elementRef.nativeElement.classList;
  38070. classList.remove("mat-background-" + this.backgroundColor);
  38071. if (value) {
  38072. classList.add("mat-background-" + value);
  38073. }
  38074. this._backgroundColor = value;
  38075. },
  38076. enumerable: true,
  38077. configurable: true
  38078. });
  38079. Object.defineProperty(MatTabNav.prototype, "disableRipple", {
  38080. /** Whether the ripple effect is disabled or not. */
  38081. get: /**
  38082. * Whether the ripple effect is disabled or not.
  38083. * @return {?}
  38084. */
  38085. function () { return this._disableRipple; },
  38086. set: /**
  38087. * @param {?} value
  38088. * @return {?}
  38089. */
  38090. function (value) { this._disableRipple = coercion.coerceBooleanProperty(value); },
  38091. enumerable: true,
  38092. configurable: true
  38093. });
  38094. /**
  38095. * @protected
  38096. * @return {?}
  38097. */
  38098. MatTabNav.prototype._itemSelected = /**
  38099. * @protected
  38100. * @return {?}
  38101. */
  38102. function () {
  38103. // noop
  38104. };
  38105. /**
  38106. * @return {?}
  38107. */
  38108. MatTabNav.prototype.ngAfterContentInit = /**
  38109. * @return {?}
  38110. */
  38111. function () {
  38112. this.updateActiveLink();
  38113. _super.prototype.ngAfterContentInit.call(this);
  38114. };
  38115. /**
  38116. * Notifies the component that the active link has been changed.
  38117. * @breaking-change 8.0.0 `element` parameter to be removed.
  38118. */
  38119. /**
  38120. * Notifies the component that the active link has been changed.
  38121. * \@breaking-change 8.0.0 `element` parameter to be removed.
  38122. * @param {?=} _element
  38123. * @return {?}
  38124. */
  38125. MatTabNav.prototype.updateActiveLink = /**
  38126. * Notifies the component that the active link has been changed.
  38127. * \@breaking-change 8.0.0 `element` parameter to be removed.
  38128. * @param {?=} _element
  38129. * @return {?}
  38130. */
  38131. function (_element) {
  38132. if (!this._items) {
  38133. return;
  38134. }
  38135. /** @type {?} */
  38136. var items = this._items.toArray();
  38137. for (var i = 0; i < items.length; i++) {
  38138. if (items[i].active) {
  38139. this.selectedIndex = i;
  38140. this._changeDetectorRef.markForCheck();
  38141. return;
  38142. }
  38143. }
  38144. // The ink bar should hide itself if no items are active.
  38145. this.selectedIndex = -1;
  38146. this._inkBar.hide();
  38147. };
  38148. MatTabNav.decorators = [
  38149. { type: core.Component, args: [{selector: '[mat-tab-nav-bar]',
  38150. exportAs: 'matTabNavBar, matTabNav',
  38151. inputs: ['color'],
  38152. template: "<div class=\"mat-tab-header-pagination mat-tab-header-pagination-before mat-elevation-z4\" #previousPaginator aria-hidden=\"true\" mat-ripple [matRippleDisabled]=\"_disableScrollBefore || disableRipple\" [class.mat-tab-header-pagination-disabled]=\"_disableScrollBefore\" (click)=\"_handlePaginatorClick('before')\" (mousedown)=\"_handlePaginatorPress('before')\" (touchend)=\"_stopInterval()\"><div class=\"mat-tab-header-pagination-chevron\"></div></div><div class=\"mat-tab-link-container\" #tabListContainer (keydown)=\"_handleKeydown($event)\"><div class=\"mat-tab-list\" #tabList (cdkObserveContent)=\"_onContentChanges()\"><div class=\"mat-tab-links\"><ng-content></ng-content></div><mat-ink-bar></mat-ink-bar></div></div><div class=\"mat-tab-header-pagination mat-tab-header-pagination-after mat-elevation-z4\" #nextPaginator aria-hidden=\"true\" mat-ripple [matRippleDisabled]=\"_disableScrollAfter || disableRipple\" [class.mat-tab-header-pagination-disabled]=\"_disableScrollAfter\" (mousedown)=\"_handlePaginatorPress('after')\" (click)=\"_handlePaginatorClick('after')\" (touchend)=\"_stopInterval()\"><div class=\"mat-tab-header-pagination-chevron\"></div></div>",
  38153. styles: [".mat-tab-header{display:flex;overflow:hidden;position:relative;flex-shrink:0}.mat-tab-header-pagination{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;position:relative;display:none;justify-content:center;align-items:center;min-width:32px;cursor:pointer;z-index:2;-webkit-tap-highlight-color:transparent;touch-action:none}.mat-tab-header-pagination-controls-enabled .mat-tab-header-pagination{display:flex}.mat-tab-header-pagination-before,.mat-tab-header-rtl .mat-tab-header-pagination-after{padding-left:4px}.mat-tab-header-pagination-before .mat-tab-header-pagination-chevron,.mat-tab-header-rtl .mat-tab-header-pagination-after .mat-tab-header-pagination-chevron{transform:rotate(-135deg)}.mat-tab-header-pagination-after,.mat-tab-header-rtl .mat-tab-header-pagination-before{padding-right:4px}.mat-tab-header-pagination-after .mat-tab-header-pagination-chevron,.mat-tab-header-rtl .mat-tab-header-pagination-before .mat-tab-header-pagination-chevron{transform:rotate(45deg)}.mat-tab-header-pagination-chevron{border-style:solid;border-width:2px 2px 0 0;content:'';height:8px;width:8px}.mat-tab-header-pagination-disabled{box-shadow:none;cursor:default}.mat-tab-list{flex-grow:1;position:relative;transition:transform .5s cubic-bezier(.35,0,.25,1)}.mat-tab-links{display:flex}[mat-align-tabs=center] .mat-tab-links{justify-content:center}[mat-align-tabs=end] .mat-tab-links{justify-content:flex-end}.mat-ink-bar{position:absolute;bottom:0;height:2px;transition:.5s cubic-bezier(.35,0,.25,1)}._mat-animation-noopable.mat-ink-bar{transition:none;animation:none}.mat-tab-group-inverted-header .mat-ink-bar{bottom:auto;top:0}@media (-ms-high-contrast:active){.mat-ink-bar{outline:solid 2px;height:0}}.mat-tab-link-container{display:flex;flex-grow:1;overflow:hidden;z-index:1}.mat-tab-link{height:48px;padding:0 24px;cursor:pointer;box-sizing:border-box;opacity:.6;min-width:160px;text-align:center;display:inline-flex;justify-content:center;align-items:center;white-space:nowrap;vertical-align:top;text-decoration:none;position:relative;overflow:hidden;-webkit-tap-highlight-color:transparent}.mat-tab-link:focus{outline:0}.mat-tab-link:focus:not(.mat-tab-disabled){opacity:1}@media (-ms-high-contrast:active){.mat-tab-link:focus{outline:dotted 2px}}.mat-tab-link.mat-tab-disabled{cursor:default}@media (-ms-high-contrast:active){.mat-tab-link.mat-tab-disabled{opacity:.5}}.mat-tab-link .mat-tab-label-content{display:inline-flex;justify-content:center;align-items:center;white-space:nowrap}@media (-ms-high-contrast:active){.mat-tab-link{opacity:1}}[mat-stretch-tabs] .mat-tab-link{flex-basis:0;flex-grow:1}.mat-tab-link.mat-tab-disabled{pointer-events:none}@media (max-width:599px){.mat-tab-link{min-width:72px}}"],
  38154. host: {
  38155. 'class': 'mat-tab-nav-bar mat-tab-header',
  38156. '[class.mat-tab-header-pagination-controls-enabled]': '_showPaginationControls',
  38157. '[class.mat-tab-header-rtl]': "_getLayoutDirection() == 'rtl'",
  38158. '[class.mat-primary]': 'color !== "warn" && color !== "accent"',
  38159. '[class.mat-accent]': 'color === "accent"',
  38160. '[class.mat-warn]': 'color === "warn"',
  38161. },
  38162. encapsulation: core.ViewEncapsulation.None,
  38163. changeDetection: core.ChangeDetectionStrategy.OnPush,
  38164. },] },
  38165. ];
  38166. /** @nocollapse */
  38167. MatTabNav.ctorParameters = function () { return [
  38168. { type: core.ElementRef },
  38169. { type: bidi.Directionality, decorators: [{ type: core.Optional }] },
  38170. { type: core.NgZone },
  38171. { type: core.ChangeDetectorRef },
  38172. { type: scrolling.ViewportRuler },
  38173. { type: platform.Platform, decorators: [{ type: core.Optional }] },
  38174. { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
  38175. ]; };
  38176. MatTabNav.propDecorators = {
  38177. _items: [{ type: core.ContentChildren, args: [core.forwardRef((/**
  38178. * @return {?}
  38179. */
  38180. function () { return MatTabLink; })), { descendants: true },] }],
  38181. _inkBar: [{ type: core.ViewChild, args: [MatInkBar, { static: true },] }],
  38182. _tabListContainer: [{ type: core.ViewChild, args: ['tabListContainer', { static: true },] }],
  38183. _tabList: [{ type: core.ViewChild, args: ['tabList', { static: true },] }],
  38184. _nextPaginator: [{ type: core.ViewChild, args: ['nextPaginator', { static: false },] }],
  38185. _previousPaginator: [{ type: core.ViewChild, args: ['previousPaginator', { static: false },] }],
  38186. backgroundColor: [{ type: core.Input }],
  38187. disableRipple: [{ type: core.Input }],
  38188. color: [{ type: core.Input }]
  38189. };
  38190. return MatTabNav;
  38191. }(MatPaginatedTabHeader));
  38192. // Boilerplate for applying mixins to MatTabLink.
  38193. var
  38194. // Boilerplate for applying mixins to MatTabLink.
  38195. MatTabLinkBase = /** @class */ (function () {
  38196. function MatTabLinkBase() {
  38197. }
  38198. return MatTabLinkBase;
  38199. }());
  38200. /** @type {?} */
  38201. var _MatTabLinkMixinBase = mixinTabIndex(mixinDisableRipple(mixinDisabled(MatTabLinkBase)));
  38202. /**
  38203. * Link inside of a `mat-tab-nav-bar`.
  38204. */
  38205. var MatTabLink = /** @class */ (function (_super) {
  38206. __extends(MatTabLink, _super);
  38207. function MatTabLink(_tabNavBar, elementRef, ngZone, platform$$1, globalRippleOptions, tabIndex, _focusMonitor, animationMode) {
  38208. var _this = _super.call(this) || this;
  38209. _this._tabNavBar = _tabNavBar;
  38210. _this.elementRef = elementRef;
  38211. _this._focusMonitor = _focusMonitor;
  38212. /**
  38213. * Whether the tab link is active or not.
  38214. */
  38215. _this._isActive = false;
  38216. _this._tabLinkRipple = new RippleRenderer(_this, ngZone, elementRef, platform$$1);
  38217. _this._tabLinkRipple.setupTriggerEvents(elementRef.nativeElement);
  38218. _this.rippleConfig = globalRippleOptions || {};
  38219. _this.tabIndex = parseInt(tabIndex) || 0;
  38220. if (animationMode === 'NoopAnimations') {
  38221. _this.rippleConfig.animation = { enterDuration: 0, exitDuration: 0 };
  38222. }
  38223. _focusMonitor.monitor(elementRef);
  38224. return _this;
  38225. }
  38226. Object.defineProperty(MatTabLink.prototype, "active", {
  38227. /** Whether the link is active. */
  38228. get: /**
  38229. * Whether the link is active.
  38230. * @return {?}
  38231. */
  38232. function () { return this._isActive; },
  38233. set: /**
  38234. * @param {?} value
  38235. * @return {?}
  38236. */
  38237. function (value) {
  38238. if (value !== this._isActive) {
  38239. this._isActive = value;
  38240. this._tabNavBar.updateActiveLink(this.elementRef);
  38241. }
  38242. },
  38243. enumerable: true,
  38244. configurable: true
  38245. });
  38246. Object.defineProperty(MatTabLink.prototype, "rippleDisabled", {
  38247. /**
  38248. * Whether ripples are disabled on interaction.
  38249. * @docs-private
  38250. */
  38251. get: /**
  38252. * Whether ripples are disabled on interaction.
  38253. * \@docs-private
  38254. * @return {?}
  38255. */
  38256. function () {
  38257. return this.disabled || this.disableRipple || this._tabNavBar.disableRipple ||
  38258. !!this.rippleConfig.disabled;
  38259. },
  38260. enumerable: true,
  38261. configurable: true
  38262. });
  38263. /**
  38264. * @return {?}
  38265. */
  38266. MatTabLink.prototype.focus = /**
  38267. * @return {?}
  38268. */
  38269. function () {
  38270. this.elementRef.nativeElement.focus();
  38271. };
  38272. /**
  38273. * @return {?}
  38274. */
  38275. MatTabLink.prototype.ngOnDestroy = /**
  38276. * @return {?}
  38277. */
  38278. function () {
  38279. this._tabLinkRipple._removeTriggerEvents();
  38280. this._focusMonitor.stopMonitoring(this.elementRef);
  38281. };
  38282. MatTabLink.decorators = [
  38283. { type: core.Directive, args: [{
  38284. selector: '[mat-tab-link], [matTabLink]',
  38285. exportAs: 'matTabLink',
  38286. inputs: ['disabled', 'disableRipple', 'tabIndex'],
  38287. host: {
  38288. 'class': 'mat-tab-link',
  38289. '[attr.aria-current]': 'active ? "page" : null',
  38290. '[attr.aria-disabled]': 'disabled',
  38291. '[attr.tabIndex]': 'tabIndex',
  38292. '[class.mat-tab-disabled]': 'disabled',
  38293. '[class.mat-tab-label-active]': 'active',
  38294. }
  38295. },] },
  38296. ];
  38297. /** @nocollapse */
  38298. MatTabLink.ctorParameters = function () { return [
  38299. { type: MatTabNav },
  38300. { type: core.ElementRef },
  38301. { type: core.NgZone },
  38302. { type: platform.Platform },
  38303. { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_RIPPLE_GLOBAL_OPTIONS,] }] },
  38304. { type: String, decorators: [{ type: core.Attribute, args: ['tabindex',] }] },
  38305. { type: a11y.FocusMonitor },
  38306. { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
  38307. ]; };
  38308. MatTabLink.propDecorators = {
  38309. active: [{ type: core.Input }]
  38310. };
  38311. return MatTabLink;
  38312. }(_MatTabLinkMixinBase));
  38313. /**
  38314. * @fileoverview added by tsickle
  38315. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  38316. */
  38317. var MatTabsModule = /** @class */ (function () {
  38318. function MatTabsModule() {
  38319. }
  38320. MatTabsModule.decorators = [
  38321. { type: core.NgModule, args: [{
  38322. imports: [
  38323. common.CommonModule,
  38324. MatCommonModule,
  38325. portal.PortalModule,
  38326. MatRippleModule,
  38327. observers.ObserversModule,
  38328. a11y.A11yModule,
  38329. ],
  38330. // Don't export all components because some are only to be used internally.
  38331. exports: [
  38332. MatCommonModule,
  38333. MatTabGroup,
  38334. MatTabLabel,
  38335. MatTab,
  38336. MatTabNav,
  38337. MatTabLink,
  38338. MatTabContent,
  38339. ],
  38340. declarations: [
  38341. MatTabGroup,
  38342. MatTabLabel,
  38343. MatTab,
  38344. MatInkBar,
  38345. MatTabLabelWrapper,
  38346. MatTabNav,
  38347. MatTabLink,
  38348. MatTabBody,
  38349. MatTabBodyPortal,
  38350. MatTabHeader,
  38351. MatTabContent,
  38352. ],
  38353. },] },
  38354. ];
  38355. return MatTabsModule;
  38356. }());
  38357. /**
  38358. * @fileoverview added by tsickle
  38359. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  38360. */
  38361. // Boilerplate for applying mixins to MatToolbar.
  38362. /**
  38363. * \@docs-private
  38364. */
  38365. var
  38366. // Boilerplate for applying mixins to MatToolbar.
  38367. /**
  38368. * \@docs-private
  38369. */
  38370. MatToolbarBase = /** @class */ (function () {
  38371. function MatToolbarBase(_elementRef) {
  38372. this._elementRef = _elementRef;
  38373. }
  38374. return MatToolbarBase;
  38375. }());
  38376. /** @type {?} */
  38377. var _MatToolbarMixinBase = mixinColor(MatToolbarBase);
  38378. var MatToolbarRow = /** @class */ (function () {
  38379. function MatToolbarRow() {
  38380. }
  38381. MatToolbarRow.decorators = [
  38382. { type: core.Directive, args: [{
  38383. selector: 'mat-toolbar-row',
  38384. exportAs: 'matToolbarRow',
  38385. host: { 'class': 'mat-toolbar-row' },
  38386. },] },
  38387. ];
  38388. return MatToolbarRow;
  38389. }());
  38390. var MatToolbar = /** @class */ (function (_super) {
  38391. __extends(MatToolbar, _super);
  38392. function MatToolbar(elementRef, _platform, document) {
  38393. var _this = _super.call(this, elementRef) || this;
  38394. _this._platform = _platform;
  38395. // TODO: make the document a required param when doing breaking changes.
  38396. _this._document = document;
  38397. return _this;
  38398. }
  38399. /**
  38400. * @return {?}
  38401. */
  38402. MatToolbar.prototype.ngAfterViewInit = /**
  38403. * @return {?}
  38404. */
  38405. function () {
  38406. var _this = this;
  38407. if (!core.isDevMode() || !this._platform.isBrowser) {
  38408. return;
  38409. }
  38410. this._checkToolbarMixedModes();
  38411. this._toolbarRows.changes.subscribe((/**
  38412. * @return {?}
  38413. */
  38414. function () { return _this._checkToolbarMixedModes(); }));
  38415. };
  38416. /**
  38417. * Throws an exception when developers are attempting to combine the different toolbar row modes.
  38418. */
  38419. /**
  38420. * Throws an exception when developers are attempting to combine the different toolbar row modes.
  38421. * @private
  38422. * @return {?}
  38423. */
  38424. MatToolbar.prototype._checkToolbarMixedModes = /**
  38425. * Throws an exception when developers are attempting to combine the different toolbar row modes.
  38426. * @private
  38427. * @return {?}
  38428. */
  38429. function () {
  38430. var _this = this;
  38431. if (!this._toolbarRows.length) {
  38432. return;
  38433. }
  38434. // Check if there are any other DOM nodes that can display content but aren't inside of
  38435. // a <mat-toolbar-row> element.
  38436. /** @type {?} */
  38437. var isCombinedUsage = Array.from(this._elementRef.nativeElement.childNodes)
  38438. .filter((/**
  38439. * @param {?} node
  38440. * @return {?}
  38441. */
  38442. function (node) { return !(node.classList && node.classList.contains('mat-toolbar-row')); }))
  38443. .filter((/**
  38444. * @param {?} node
  38445. * @return {?}
  38446. */
  38447. function (node) { return node.nodeType !== (_this._document ? _this._document.COMMENT_NODE : 8); }))
  38448. .some((/**
  38449. * @param {?} node
  38450. * @return {?}
  38451. */
  38452. function (node) { return !!(node.textContent && node.textContent.trim()); }));
  38453. if (isCombinedUsage) {
  38454. throwToolbarMixedModesError();
  38455. }
  38456. };
  38457. MatToolbar.decorators = [
  38458. { type: core.Component, args: [{selector: 'mat-toolbar',
  38459. exportAs: 'matToolbar',
  38460. template: "<ng-content></ng-content><ng-content select=\"mat-toolbar-row\"></ng-content>",
  38461. styles: ["@media (-ms-high-contrast:active){.mat-toolbar{outline:solid 1px}}.mat-toolbar-row,.mat-toolbar-single-row{display:flex;box-sizing:border-box;padding:0 16px;width:100%;flex-direction:row;align-items:center;white-space:nowrap}.mat-toolbar-multiple-rows{display:flex;box-sizing:border-box;flex-direction:column;width:100%}.mat-toolbar-multiple-rows{min-height:64px}.mat-toolbar-row,.mat-toolbar-single-row{height:64px}@media (max-width:599px){.mat-toolbar-multiple-rows{min-height:56px}.mat-toolbar-row,.mat-toolbar-single-row{height:56px}}"],
  38462. inputs: ['color'],
  38463. host: {
  38464. 'class': 'mat-toolbar',
  38465. '[class.mat-toolbar-multiple-rows]': '_toolbarRows.length > 0',
  38466. '[class.mat-toolbar-single-row]': '_toolbarRows.length === 0',
  38467. },
  38468. changeDetection: core.ChangeDetectionStrategy.OnPush,
  38469. encapsulation: core.ViewEncapsulation.None,
  38470. },] },
  38471. ];
  38472. /** @nocollapse */
  38473. MatToolbar.ctorParameters = function () { return [
  38474. { type: core.ElementRef },
  38475. { type: platform.Platform },
  38476. { type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] }
  38477. ]; };
  38478. MatToolbar.propDecorators = {
  38479. _toolbarRows: [{ type: core.ContentChildren, args: [MatToolbarRow,] }]
  38480. };
  38481. return MatToolbar;
  38482. }(_MatToolbarMixinBase));
  38483. /**
  38484. * Throws an exception when attempting to combine the different toolbar row modes.
  38485. * \@docs-private
  38486. * @return {?}
  38487. */
  38488. function throwToolbarMixedModesError() {
  38489. throw Error('MatToolbar: Attempting to combine different toolbar modes. ' +
  38490. 'Either specify multiple `<mat-toolbar-row>` elements explicitly or just place content ' +
  38491. 'inside of a `<mat-toolbar>` for a single row.');
  38492. }
  38493. /**
  38494. * @fileoverview added by tsickle
  38495. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  38496. */
  38497. var MatToolbarModule = /** @class */ (function () {
  38498. function MatToolbarModule() {
  38499. }
  38500. MatToolbarModule.decorators = [
  38501. { type: core.NgModule, args: [{
  38502. imports: [MatCommonModule],
  38503. exports: [MatToolbar, MatToolbarRow, MatCommonModule],
  38504. declarations: [MatToolbar, MatToolbarRow],
  38505. },] },
  38506. ];
  38507. return MatToolbarModule;
  38508. }());
  38509. /**
  38510. * @fileoverview added by tsickle
  38511. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  38512. */
  38513. /** @type {?} */
  38514. var _MatTreeNodeMixinBase = mixinTabIndex(mixinDisabled(tree.CdkTreeNode));
  38515. /**
  38516. * Wrapper for the CdkTree node with Material design styles.
  38517. * @template T
  38518. */
  38519. var MatTreeNode = /** @class */ (function (_super) {
  38520. __extends(MatTreeNode, _super);
  38521. function MatTreeNode(_elementRef, _tree, tabIndex) {
  38522. var _this = _super.call(this, _elementRef, _tree) || this;
  38523. _this._elementRef = _elementRef;
  38524. _this._tree = _tree;
  38525. _this.role = 'treeitem';
  38526. _this.tabIndex = Number(tabIndex) || 0;
  38527. return _this;
  38528. }
  38529. MatTreeNode.decorators = [
  38530. { type: core.Directive, args: [{
  38531. selector: 'mat-tree-node',
  38532. exportAs: 'matTreeNode',
  38533. inputs: ['disabled', 'tabIndex'],
  38534. host: {
  38535. '[attr.aria-expanded]': 'isExpanded',
  38536. '[attr.aria-level]': 'role === "treeitem" ? level : null',
  38537. '[attr.role]': 'role',
  38538. 'class': 'mat-tree-node'
  38539. },
  38540. providers: [{ provide: tree.CdkTreeNode, useExisting: MatTreeNode }]
  38541. },] },
  38542. ];
  38543. /** @nocollapse */
  38544. MatTreeNode.ctorParameters = function () { return [
  38545. { type: core.ElementRef },
  38546. { type: tree.CdkTree },
  38547. { type: String, decorators: [{ type: core.Attribute, args: ['tabindex',] }] }
  38548. ]; };
  38549. MatTreeNode.propDecorators = {
  38550. role: [{ type: core.Input }]
  38551. };
  38552. return MatTreeNode;
  38553. }(_MatTreeNodeMixinBase));
  38554. /**
  38555. * Wrapper for the CdkTree node definition with Material design styles.
  38556. * @template T
  38557. */
  38558. var MatTreeNodeDef = /** @class */ (function (_super) {
  38559. __extends(MatTreeNodeDef, _super);
  38560. function MatTreeNodeDef() {
  38561. return _super !== null && _super.apply(this, arguments) || this;
  38562. }
  38563. MatTreeNodeDef.decorators = [
  38564. { type: core.Directive, args: [{
  38565. selector: '[matTreeNodeDef]',
  38566. inputs: [
  38567. 'when: matTreeNodeDefWhen'
  38568. ],
  38569. providers: [{ provide: tree.CdkTreeNodeDef, useExisting: MatTreeNodeDef }]
  38570. },] },
  38571. ];
  38572. MatTreeNodeDef.propDecorators = {
  38573. data: [{ type: core.Input, args: ['matTreeNode',] }]
  38574. };
  38575. return MatTreeNodeDef;
  38576. }(tree.CdkTreeNodeDef));
  38577. /**
  38578. * Wrapper for the CdkTree nested node with Material design styles.
  38579. * @template T
  38580. */
  38581. var MatNestedTreeNode = /** @class */ (function (_super) {
  38582. __extends(MatNestedTreeNode, _super);
  38583. function MatNestedTreeNode(_elementRef, _tree, _differs, tabIndex) {
  38584. var _this = _super.call(this, _elementRef, _tree, _differs) || this;
  38585. _this._elementRef = _elementRef;
  38586. _this._tree = _tree;
  38587. _this._differs = _differs;
  38588. _this._disabled = false;
  38589. _this.tabIndex = Number(tabIndex) || 0;
  38590. return _this;
  38591. }
  38592. Object.defineProperty(MatNestedTreeNode.prototype, "disabled", {
  38593. /** Whether the node is disabled. */
  38594. get: /**
  38595. * Whether the node is disabled.
  38596. * @return {?}
  38597. */
  38598. function () { return this._disabled; },
  38599. set: /**
  38600. * @param {?} value
  38601. * @return {?}
  38602. */
  38603. function (value) { this._disabled = coercion.coerceBooleanProperty(value); },
  38604. enumerable: true,
  38605. configurable: true
  38606. });
  38607. Object.defineProperty(MatNestedTreeNode.prototype, "tabIndex", {
  38608. /** Tabindex for the node. */
  38609. get: /**
  38610. * Tabindex for the node.
  38611. * @return {?}
  38612. */
  38613. function () { return this.disabled ? -1 : this._tabIndex; },
  38614. set: /**
  38615. * @param {?} value
  38616. * @return {?}
  38617. */
  38618. function (value) {
  38619. // If the specified tabIndex value is null or undefined, fall back to the default value.
  38620. this._tabIndex = value != null ? value : 0;
  38621. },
  38622. enumerable: true,
  38623. configurable: true
  38624. });
  38625. // This is a workaround for https://github.com/angular/angular/issues/23091
  38626. // In aot mode, the lifecycle hooks from parent class are not called.
  38627. // TODO(tinayuangao): Remove when the angular issue #23091 is fixed
  38628. // This is a workaround for https://github.com/angular/angular/issues/23091
  38629. // In aot mode, the lifecycle hooks from parent class are not called.
  38630. // TODO(tinayuangao): Remove when the angular issue #23091 is fixed
  38631. /**
  38632. * @return {?}
  38633. */
  38634. MatNestedTreeNode.prototype.ngAfterContentInit =
  38635. // This is a workaround for https://github.com/angular/angular/issues/23091
  38636. // In aot mode, the lifecycle hooks from parent class are not called.
  38637. // TODO(tinayuangao): Remove when the angular issue #23091 is fixed
  38638. /**
  38639. * @return {?}
  38640. */
  38641. function () {
  38642. _super.prototype.ngAfterContentInit.call(this);
  38643. };
  38644. /**
  38645. * @return {?}
  38646. */
  38647. MatNestedTreeNode.prototype.ngOnDestroy = /**
  38648. * @return {?}
  38649. */
  38650. function () {
  38651. _super.prototype.ngOnDestroy.call(this);
  38652. };
  38653. MatNestedTreeNode.decorators = [
  38654. { type: core.Directive, args: [{
  38655. selector: 'mat-nested-tree-node',
  38656. exportAs: 'matNestedTreeNode',
  38657. host: {
  38658. '[attr.aria-expanded]': 'isExpanded',
  38659. '[attr.role]': 'role',
  38660. 'class': 'mat-nested-tree-node',
  38661. },
  38662. providers: [
  38663. { provide: tree.CdkNestedTreeNode, useExisting: MatNestedTreeNode },
  38664. { provide: tree.CdkTreeNode, useExisting: MatNestedTreeNode },
  38665. { provide: tree.CDK_TREE_NODE_OUTLET_NODE, useExisting: MatNestedTreeNode }
  38666. ]
  38667. },] },
  38668. ];
  38669. /** @nocollapse */
  38670. MatNestedTreeNode.ctorParameters = function () { return [
  38671. { type: core.ElementRef },
  38672. { type: tree.CdkTree },
  38673. { type: core.IterableDiffers },
  38674. { type: String, decorators: [{ type: core.Attribute, args: ['tabindex',] }] }
  38675. ]; };
  38676. MatNestedTreeNode.propDecorators = {
  38677. node: [{ type: core.Input, args: ['matNestedTreeNode',] }],
  38678. disabled: [{ type: core.Input }],
  38679. tabIndex: [{ type: core.Input }]
  38680. };
  38681. return MatNestedTreeNode;
  38682. }(tree.CdkNestedTreeNode));
  38683. /**
  38684. * @fileoverview added by tsickle
  38685. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  38686. */
  38687. /**
  38688. * Wrapper for the CdkTree padding with Material design styles.
  38689. * @template T
  38690. */
  38691. var MatTreeNodePadding = /** @class */ (function (_super) {
  38692. __extends(MatTreeNodePadding, _super);
  38693. function MatTreeNodePadding() {
  38694. return _super !== null && _super.apply(this, arguments) || this;
  38695. }
  38696. MatTreeNodePadding.decorators = [
  38697. { type: core.Directive, args: [{
  38698. selector: '[matTreeNodePadding]',
  38699. providers: [{ provide: tree.CdkTreeNodePadding, useExisting: MatTreeNodePadding }]
  38700. },] },
  38701. ];
  38702. MatTreeNodePadding.propDecorators = {
  38703. level: [{ type: core.Input, args: ['matTreeNodePadding',] }],
  38704. indent: [{ type: core.Input, args: ['matTreeNodePaddingIndent',] }]
  38705. };
  38706. return MatTreeNodePadding;
  38707. }(tree.CdkTreeNodePadding));
  38708. /**
  38709. * @fileoverview added by tsickle
  38710. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  38711. */
  38712. /**
  38713. * Outlet for nested CdkNode. Put `[matTreeNodeOutlet]` on a tag to place children dataNodes
  38714. * inside the outlet.
  38715. */
  38716. var MatTreeNodeOutlet = /** @class */ (function () {
  38717. function MatTreeNodeOutlet(viewContainer, _node) {
  38718. this.viewContainer = viewContainer;
  38719. this._node = _node;
  38720. }
  38721. MatTreeNodeOutlet.decorators = [
  38722. { type: core.Directive, args: [{
  38723. selector: '[matTreeNodeOutlet]',
  38724. providers: [{
  38725. provide: tree.CdkTreeNodeOutlet,
  38726. useExisting: MatTreeNodeOutlet
  38727. }]
  38728. },] },
  38729. ];
  38730. /** @nocollapse */
  38731. MatTreeNodeOutlet.ctorParameters = function () { return [
  38732. { type: core.ViewContainerRef },
  38733. { type: undefined, decorators: [{ type: core.Inject, args: [tree.CDK_TREE_NODE_OUTLET_NODE,] }, { type: core.Optional }] }
  38734. ]; };
  38735. return MatTreeNodeOutlet;
  38736. }());
  38737. /**
  38738. * @fileoverview added by tsickle
  38739. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  38740. */
  38741. /**
  38742. * Wrapper for the CdkTable with Material design styles.
  38743. * @template T
  38744. */
  38745. var MatTree = /** @class */ (function (_super) {
  38746. __extends(MatTree, _super);
  38747. function MatTree() {
  38748. return _super !== null && _super.apply(this, arguments) || this;
  38749. }
  38750. MatTree.decorators = [
  38751. { type: core.Component, args: [{selector: 'mat-tree',
  38752. exportAs: 'matTree',
  38753. template: "<ng-container matTreeNodeOutlet></ng-container>",
  38754. host: {
  38755. 'class': 'mat-tree',
  38756. 'role': 'tree',
  38757. },
  38758. styles: [".mat-tree{display:block}.mat-tree-node{display:flex;align-items:center;min-height:48px;flex:1;overflow:hidden;word-wrap:break-word}.mat-nested-tree-ndoe{border-bottom-width:0}"],
  38759. encapsulation: core.ViewEncapsulation.None,
  38760. // See note on CdkTree for explanation on why this uses the default change detection strategy.
  38761. // tslint:disable-next-line:validate-decorators
  38762. changeDetection: core.ChangeDetectionStrategy.Default,
  38763. providers: [{ provide: tree.CdkTree, useExisting: MatTree }]
  38764. },] },
  38765. ];
  38766. MatTree.propDecorators = {
  38767. _nodeOutlet: [{ type: core.ViewChild, args: [MatTreeNodeOutlet, { static: true },] }]
  38768. };
  38769. return MatTree;
  38770. }(tree.CdkTree));
  38771. /**
  38772. * @fileoverview added by tsickle
  38773. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  38774. */
  38775. /**
  38776. * Wrapper for the CdkTree's toggle with Material design styles.
  38777. * @template T
  38778. */
  38779. var MatTreeNodeToggle = /** @class */ (function (_super) {
  38780. __extends(MatTreeNodeToggle, _super);
  38781. function MatTreeNodeToggle() {
  38782. var _this = _super !== null && _super.apply(this, arguments) || this;
  38783. _this.recursive = false;
  38784. return _this;
  38785. }
  38786. MatTreeNodeToggle.decorators = [
  38787. { type: core.Directive, args: [{
  38788. selector: '[matTreeNodeToggle]',
  38789. providers: [{ provide: tree.CdkTreeNodeToggle, useExisting: MatTreeNodeToggle }]
  38790. },] },
  38791. ];
  38792. MatTreeNodeToggle.propDecorators = {
  38793. recursive: [{ type: core.Input, args: ['matTreeNodeToggleRecursive',] }]
  38794. };
  38795. return MatTreeNodeToggle;
  38796. }(tree.CdkTreeNodeToggle));
  38797. /**
  38798. * @fileoverview added by tsickle
  38799. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  38800. */
  38801. /** @type {?} */
  38802. var MAT_TREE_DIRECTIVES = [
  38803. MatNestedTreeNode,
  38804. MatTreeNodeDef,
  38805. MatTreeNodePadding,
  38806. MatTreeNodeToggle,
  38807. MatTree,
  38808. MatTreeNode,
  38809. MatTreeNodeOutlet
  38810. ];
  38811. var MatTreeModule = /** @class */ (function () {
  38812. function MatTreeModule() {
  38813. }
  38814. MatTreeModule.decorators = [
  38815. { type: core.NgModule, args: [{
  38816. imports: [tree.CdkTreeModule, common.CommonModule, MatCommonModule],
  38817. exports: MAT_TREE_DIRECTIVES,
  38818. declarations: MAT_TREE_DIRECTIVES,
  38819. },] },
  38820. ];
  38821. return MatTreeModule;
  38822. }());
  38823. /**
  38824. * @fileoverview added by tsickle
  38825. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  38826. */
  38827. /**
  38828. * Tree flattener to convert a normal type of node to node with children & level information.
  38829. * Transform nested nodes of type `T` to flattened nodes of type `F`.
  38830. *
  38831. * For example, the input data of type `T` is nested, and contains its children data:
  38832. * SomeNode: {
  38833. * key: 'Fruits',
  38834. * children: [
  38835. * NodeOne: {
  38836. * key: 'Apple',
  38837. * },
  38838. * NodeTwo: {
  38839. * key: 'Pear',
  38840. * }
  38841. * ]
  38842. * }
  38843. * After flattener flatten the tree, the structure will become
  38844. * SomeNode: {
  38845. * key: 'Fruits',
  38846. * expandable: true,
  38847. * level: 1
  38848. * },
  38849. * NodeOne: {
  38850. * key: 'Apple',
  38851. * expandable: false,
  38852. * level: 2
  38853. * },
  38854. * NodeTwo: {
  38855. * key: 'Pear',
  38856. * expandable: false,
  38857. * level: 2
  38858. * }
  38859. * and the output flattened type is `F` with additional information.
  38860. * @template T, F
  38861. */
  38862. var /**
  38863. * Tree flattener to convert a normal type of node to node with children & level information.
  38864. * Transform nested nodes of type `T` to flattened nodes of type `F`.
  38865. *
  38866. * For example, the input data of type `T` is nested, and contains its children data:
  38867. * SomeNode: {
  38868. * key: 'Fruits',
  38869. * children: [
  38870. * NodeOne: {
  38871. * key: 'Apple',
  38872. * },
  38873. * NodeTwo: {
  38874. * key: 'Pear',
  38875. * }
  38876. * ]
  38877. * }
  38878. * After flattener flatten the tree, the structure will become
  38879. * SomeNode: {
  38880. * key: 'Fruits',
  38881. * expandable: true,
  38882. * level: 1
  38883. * },
  38884. * NodeOne: {
  38885. * key: 'Apple',
  38886. * expandable: false,
  38887. * level: 2
  38888. * },
  38889. * NodeTwo: {
  38890. * key: 'Pear',
  38891. * expandable: false,
  38892. * level: 2
  38893. * }
  38894. * and the output flattened type is `F` with additional information.
  38895. * @template T, F
  38896. */
  38897. MatTreeFlattener = /** @class */ (function () {
  38898. function MatTreeFlattener(transformFunction, getLevel, isExpandable, getChildren) {
  38899. this.transformFunction = transformFunction;
  38900. this.getLevel = getLevel;
  38901. this.isExpandable = isExpandable;
  38902. this.getChildren = getChildren;
  38903. }
  38904. /**
  38905. * @param {?} node
  38906. * @param {?} level
  38907. * @param {?} resultNodes
  38908. * @param {?} parentMap
  38909. * @return {?}
  38910. */
  38911. MatTreeFlattener.prototype._flattenNode = /**
  38912. * @param {?} node
  38913. * @param {?} level
  38914. * @param {?} resultNodes
  38915. * @param {?} parentMap
  38916. * @return {?}
  38917. */
  38918. function (node, level, resultNodes, parentMap) {
  38919. var _this = this;
  38920. /** @type {?} */
  38921. var flatNode = this.transformFunction(node, level);
  38922. resultNodes.push(flatNode);
  38923. if (this.isExpandable(flatNode)) {
  38924. /** @type {?} */
  38925. var childrenNodes = this.getChildren(node);
  38926. if (childrenNodes) {
  38927. if (Array.isArray(childrenNodes)) {
  38928. this._flattenChildren(childrenNodes, level, resultNodes, parentMap);
  38929. }
  38930. else {
  38931. childrenNodes.pipe(operators.take(1)).subscribe((/**
  38932. * @param {?} children
  38933. * @return {?}
  38934. */
  38935. function (children) {
  38936. _this._flattenChildren(children, level, resultNodes, parentMap);
  38937. }));
  38938. }
  38939. }
  38940. }
  38941. return resultNodes;
  38942. };
  38943. /**
  38944. * @param {?} children
  38945. * @param {?} level
  38946. * @param {?} resultNodes
  38947. * @param {?} parentMap
  38948. * @return {?}
  38949. */
  38950. MatTreeFlattener.prototype._flattenChildren = /**
  38951. * @param {?} children
  38952. * @param {?} level
  38953. * @param {?} resultNodes
  38954. * @param {?} parentMap
  38955. * @return {?}
  38956. */
  38957. function (children, level, resultNodes, parentMap) {
  38958. var _this = this;
  38959. children.forEach((/**
  38960. * @param {?} child
  38961. * @param {?} index
  38962. * @return {?}
  38963. */
  38964. function (child, index) {
  38965. /** @type {?} */
  38966. var childParentMap = parentMap.slice();
  38967. childParentMap.push(index != children.length - 1);
  38968. _this._flattenNode(child, level + 1, resultNodes, childParentMap);
  38969. }));
  38970. };
  38971. /**
  38972. * Flatten a list of node type T to flattened version of node F.
  38973. * Please note that type T may be nested, and the length of `structuredData` may be different
  38974. * from that of returned list `F[]`.
  38975. */
  38976. /**
  38977. * Flatten a list of node type T to flattened version of node F.
  38978. * Please note that type T may be nested, and the length of `structuredData` may be different
  38979. * from that of returned list `F[]`.
  38980. * @param {?} structuredData
  38981. * @return {?}
  38982. */
  38983. MatTreeFlattener.prototype.flattenNodes = /**
  38984. * Flatten a list of node type T to flattened version of node F.
  38985. * Please note that type T may be nested, and the length of `structuredData` may be different
  38986. * from that of returned list `F[]`.
  38987. * @param {?} structuredData
  38988. * @return {?}
  38989. */
  38990. function (structuredData) {
  38991. var _this = this;
  38992. /** @type {?} */
  38993. var resultNodes = [];
  38994. structuredData.forEach((/**
  38995. * @param {?} node
  38996. * @return {?}
  38997. */
  38998. function (node) { return _this._flattenNode(node, 0, resultNodes, []); }));
  38999. return resultNodes;
  39000. };
  39001. /**
  39002. * Expand flattened node with current expansion status.
  39003. * The returned list may have different length.
  39004. */
  39005. /**
  39006. * Expand flattened node with current expansion status.
  39007. * The returned list may have different length.
  39008. * @param {?} nodes
  39009. * @param {?} treeControl
  39010. * @return {?}
  39011. */
  39012. MatTreeFlattener.prototype.expandFlattenedNodes = /**
  39013. * Expand flattened node with current expansion status.
  39014. * The returned list may have different length.
  39015. * @param {?} nodes
  39016. * @param {?} treeControl
  39017. * @return {?}
  39018. */
  39019. function (nodes, treeControl) {
  39020. var _this = this;
  39021. /** @type {?} */
  39022. var results = [];
  39023. /** @type {?} */
  39024. var currentExpand = [];
  39025. currentExpand[0] = true;
  39026. nodes.forEach((/**
  39027. * @param {?} node
  39028. * @return {?}
  39029. */
  39030. function (node) {
  39031. /** @type {?} */
  39032. var expand = true;
  39033. for (var i = 0; i <= _this.getLevel(node); i++) {
  39034. expand = expand && currentExpand[i];
  39035. }
  39036. if (expand) {
  39037. results.push(node);
  39038. }
  39039. if (_this.isExpandable(node)) {
  39040. currentExpand[_this.getLevel(node) + 1] = treeControl.isExpanded(node);
  39041. }
  39042. }));
  39043. return results;
  39044. };
  39045. return MatTreeFlattener;
  39046. }());
  39047. /**
  39048. * Data source for flat tree.
  39049. * The data source need to handle expansion/collapsion of the tree node and change the data feed
  39050. * to `MatTree`.
  39051. * The nested tree nodes of type `T` are flattened through `MatTreeFlattener`, and converted
  39052. * to type `F` for `MatTree` to consume.
  39053. * @template T, F
  39054. */
  39055. var /**
  39056. * Data source for flat tree.
  39057. * The data source need to handle expansion/collapsion of the tree node and change the data feed
  39058. * to `MatTree`.
  39059. * The nested tree nodes of type `T` are flattened through `MatTreeFlattener`, and converted
  39060. * to type `F` for `MatTree` to consume.
  39061. * @template T, F
  39062. */
  39063. MatTreeFlatDataSource = /** @class */ (function (_super) {
  39064. __extends(MatTreeFlatDataSource, _super);
  39065. function MatTreeFlatDataSource(_treeControl, _treeFlattener, initialData) {
  39066. if (initialData === void 0) { initialData = []; }
  39067. var _this = _super.call(this) || this;
  39068. _this._treeControl = _treeControl;
  39069. _this._treeFlattener = _treeFlattener;
  39070. _this._flattenedData = new rxjs.BehaviorSubject([]);
  39071. _this._expandedData = new rxjs.BehaviorSubject([]);
  39072. _this._data = new rxjs.BehaviorSubject(initialData);
  39073. return _this;
  39074. }
  39075. Object.defineProperty(MatTreeFlatDataSource.prototype, "data", {
  39076. get: /**
  39077. * @return {?}
  39078. */
  39079. function () { return this._data.value; },
  39080. set: /**
  39081. * @param {?} value
  39082. * @return {?}
  39083. */
  39084. function (value) {
  39085. this._data.next(value);
  39086. this._flattenedData.next(this._treeFlattener.flattenNodes(this.data));
  39087. this._treeControl.dataNodes = this._flattenedData.value;
  39088. },
  39089. enumerable: true,
  39090. configurable: true
  39091. });
  39092. /**
  39093. * @param {?} collectionViewer
  39094. * @return {?}
  39095. */
  39096. MatTreeFlatDataSource.prototype.connect = /**
  39097. * @param {?} collectionViewer
  39098. * @return {?}
  39099. */
  39100. function (collectionViewer) {
  39101. var _this = this;
  39102. /** @type {?} */
  39103. var changes = [
  39104. collectionViewer.viewChange,
  39105. this._treeControl.expansionModel.onChange,
  39106. this._flattenedData
  39107. ];
  39108. return rxjs.merge.apply(void 0, changes).pipe(operators.map((/**
  39109. * @return {?}
  39110. */
  39111. function () {
  39112. _this._expandedData.next(_this._treeFlattener.expandFlattenedNodes(_this._flattenedData.value, _this._treeControl));
  39113. return _this._expandedData.value;
  39114. })));
  39115. };
  39116. /**
  39117. * @return {?}
  39118. */
  39119. MatTreeFlatDataSource.prototype.disconnect = /**
  39120. * @return {?}
  39121. */
  39122. function () {
  39123. // no op
  39124. };
  39125. return MatTreeFlatDataSource;
  39126. }(collections.DataSource));
  39127. /**
  39128. * @fileoverview added by tsickle
  39129. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  39130. */
  39131. /**
  39132. * Data source for nested tree.
  39133. *
  39134. * The data source for nested tree doesn't have to consider node flattener, or the way to expand
  39135. * or collapse. The expansion/collapsion will be handled by TreeControl and each non-leaf node.
  39136. * @template T
  39137. */
  39138. var /**
  39139. * Data source for nested tree.
  39140. *
  39141. * The data source for nested tree doesn't have to consider node flattener, or the way to expand
  39142. * or collapse. The expansion/collapsion will be handled by TreeControl and each non-leaf node.
  39143. * @template T
  39144. */
  39145. MatTreeNestedDataSource = /** @class */ (function (_super) {
  39146. __extends(MatTreeNestedDataSource, _super);
  39147. function MatTreeNestedDataSource() {
  39148. var _this = _super !== null && _super.apply(this, arguments) || this;
  39149. _this._data = new rxjs.BehaviorSubject([]);
  39150. return _this;
  39151. }
  39152. Object.defineProperty(MatTreeNestedDataSource.prototype, "data", {
  39153. /**
  39154. * Data for the nested tree
  39155. */
  39156. get: /**
  39157. * Data for the nested tree
  39158. * @return {?}
  39159. */
  39160. function () { return this._data.value; },
  39161. set: /**
  39162. * @param {?} value
  39163. * @return {?}
  39164. */
  39165. function (value) { this._data.next(value); },
  39166. enumerable: true,
  39167. configurable: true
  39168. });
  39169. /**
  39170. * @param {?} collectionViewer
  39171. * @return {?}
  39172. */
  39173. MatTreeNestedDataSource.prototype.connect = /**
  39174. * @param {?} collectionViewer
  39175. * @return {?}
  39176. */
  39177. function (collectionViewer) {
  39178. var _this = this;
  39179. return rxjs.merge.apply(void 0, [collectionViewer.viewChange, this._data]).pipe(operators.map((/**
  39180. * @return {?}
  39181. */
  39182. function () {
  39183. return _this.data;
  39184. })));
  39185. };
  39186. /**
  39187. * @return {?}
  39188. */
  39189. MatTreeNestedDataSource.prototype.disconnect = /**
  39190. * @return {?}
  39191. */
  39192. function () {
  39193. // no op
  39194. };
  39195. return MatTreeNestedDataSource;
  39196. }(collections.DataSource));
  39197. /**
  39198. * @fileoverview added by tsickle
  39199. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  39200. */
  39201. /**
  39202. * @fileoverview added by tsickle
  39203. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  39204. */
  39205. exports.MAT_AUTOCOMPLETE_DEFAULT_OPTIONS_FACTORY = MAT_AUTOCOMPLETE_DEFAULT_OPTIONS_FACTORY;
  39206. exports.MatAutocompleteSelectedEvent = MatAutocompleteSelectedEvent;
  39207. exports.MAT_AUTOCOMPLETE_DEFAULT_OPTIONS = MAT_AUTOCOMPLETE_DEFAULT_OPTIONS;
  39208. exports.MatAutocomplete = MatAutocomplete;
  39209. exports.MatAutocompleteModule = MatAutocompleteModule;
  39210. exports.MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY = MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY;
  39211. exports.getMatAutocompleteMissingPanelError = getMatAutocompleteMissingPanelError;
  39212. exports.AUTOCOMPLETE_OPTION_HEIGHT = AUTOCOMPLETE_OPTION_HEIGHT;
  39213. exports.AUTOCOMPLETE_PANEL_HEIGHT = AUTOCOMPLETE_PANEL_HEIGHT;
  39214. exports.MAT_AUTOCOMPLETE_SCROLL_STRATEGY = MAT_AUTOCOMPLETE_SCROLL_STRATEGY;
  39215. exports.MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY_PROVIDER = MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY_PROVIDER;
  39216. exports.MAT_AUTOCOMPLETE_VALUE_ACCESSOR = MAT_AUTOCOMPLETE_VALUE_ACCESSOR;
  39217. exports.MatAutocompleteTrigger = MatAutocompleteTrigger;
  39218. exports.MatAutocompleteOrigin = MatAutocompleteOrigin;
  39219. exports.MatBadgeModule = MatBadgeModule;
  39220. exports.MatBadge = MatBadge;
  39221. exports.MatBottomSheetModule = MatBottomSheetModule;
  39222. exports.MAT_BOTTOM_SHEET_DEFAULT_OPTIONS = MAT_BOTTOM_SHEET_DEFAULT_OPTIONS;
  39223. exports.MatBottomSheet = MatBottomSheet;
  39224. exports.MAT_BOTTOM_SHEET_DATA = MAT_BOTTOM_SHEET_DATA;
  39225. exports.MatBottomSheetConfig = MatBottomSheetConfig;
  39226. exports.MatBottomSheetContainer = MatBottomSheetContainer;
  39227. exports.matBottomSheetAnimations = matBottomSheetAnimations;
  39228. exports.MatBottomSheetRef = MatBottomSheetRef;
  39229. exports.MatButtonModule = MatButtonModule;
  39230. exports.MatButton = MatButton;
  39231. exports.MatAnchor = MatAnchor;
  39232. exports.MAT_BUTTON_TOGGLE_DEFAULT_OPTIONS = MAT_BUTTON_TOGGLE_DEFAULT_OPTIONS;
  39233. exports.MAT_BUTTON_TOGGLE_GROUP_VALUE_ACCESSOR = MAT_BUTTON_TOGGLE_GROUP_VALUE_ACCESSOR;
  39234. exports.MatButtonToggleGroupMultiple = MatButtonToggleGroupMultiple;
  39235. exports.MatButtonToggleChange = MatButtonToggleChange;
  39236. exports.MatButtonToggleGroup = MatButtonToggleGroup;
  39237. exports.MatButtonToggle = MatButtonToggle;
  39238. exports.MatButtonToggleModule = MatButtonToggleModule;
  39239. exports.MatCardContent = MatCardContent;
  39240. exports.MatCardTitle = MatCardTitle;
  39241. exports.MatCardSubtitle = MatCardSubtitle;
  39242. exports.MatCardActions = MatCardActions;
  39243. exports.MatCardFooter = MatCardFooter;
  39244. exports.MatCardImage = MatCardImage;
  39245. exports.MatCardSmImage = MatCardSmImage;
  39246. exports.MatCardMdImage = MatCardMdImage;
  39247. exports.MatCardLgImage = MatCardLgImage;
  39248. exports.MatCardXlImage = MatCardXlImage;
  39249. exports.MatCardAvatar = MatCardAvatar;
  39250. exports.MatCard = MatCard;
  39251. exports.MatCardHeader = MatCardHeader;
  39252. exports.MatCardTitleGroup = MatCardTitleGroup;
  39253. exports.MatCardModule = MatCardModule;
  39254. exports.MAT_CHECKBOX_CONTROL_VALUE_ACCESSOR = MAT_CHECKBOX_CONTROL_VALUE_ACCESSOR;
  39255. exports.TransitionCheckState = TransitionCheckState;
  39256. exports.MatCheckboxChange = MatCheckboxChange;
  39257. exports.MatCheckbox = MatCheckbox;
  39258. exports.MAT_CHECKBOX_CLICK_ACTION = MAT_CHECKBOX_CLICK_ACTION;
  39259. exports._MatCheckboxRequiredValidatorModule = _MatCheckboxRequiredValidatorModule;
  39260. exports.MatCheckboxModule = MatCheckboxModule;
  39261. exports.MAT_CHECKBOX_REQUIRED_VALIDATOR = MAT_CHECKBOX_REQUIRED_VALIDATOR;
  39262. exports.MatCheckboxRequiredValidator = MatCheckboxRequiredValidator;
  39263. exports.MatChipsModule = MatChipsModule;
  39264. exports.MatChipListChange = MatChipListChange;
  39265. exports.MatChipList = MatChipList;
  39266. exports.MatChipSelectionChange = MatChipSelectionChange;
  39267. exports.MatChipAvatar = MatChipAvatar;
  39268. exports.MatChipTrailingIcon = MatChipTrailingIcon;
  39269. exports.MatChip = MatChip;
  39270. exports.MatChipRemove = MatChipRemove;
  39271. exports.MatChipInput = MatChipInput;
  39272. exports.MAT_CHIPS_DEFAULT_OPTIONS = MAT_CHIPS_DEFAULT_OPTIONS;
  39273. exports.ɵa1 = MATERIAL_SANITY_CHECKS_FACTORY;
  39274. exports.VERSION = VERSION$1;
  39275. exports.AnimationCurves = AnimationCurves;
  39276. exports.AnimationDurations = AnimationDurations;
  39277. exports.MatCommonModule = MatCommonModule;
  39278. exports.MATERIAL_SANITY_CHECKS = MATERIAL_SANITY_CHECKS;
  39279. exports.mixinDisabled = mixinDisabled;
  39280. exports.mixinColor = mixinColor;
  39281. exports.mixinDisableRipple = mixinDisableRipple;
  39282. exports.mixinTabIndex = mixinTabIndex;
  39283. exports.mixinErrorState = mixinErrorState;
  39284. exports.mixinInitialized = mixinInitialized;
  39285. exports.NativeDateModule = NativeDateModule;
  39286. exports.MatNativeDateModule = MatNativeDateModule;
  39287. exports.MAT_DATE_LOCALE_FACTORY = MAT_DATE_LOCALE_FACTORY;
  39288. exports.MAT_DATE_LOCALE = MAT_DATE_LOCALE;
  39289. exports.MAT_DATE_LOCALE_PROVIDER = MAT_DATE_LOCALE_PROVIDER;
  39290. exports.DateAdapter = DateAdapter;
  39291. exports.MAT_DATE_FORMATS = MAT_DATE_FORMATS;
  39292. exports.NativeDateAdapter = NativeDateAdapter;
  39293. exports.MAT_NATIVE_DATE_FORMATS = MAT_NATIVE_DATE_FORMATS;
  39294. exports.ShowOnDirtyErrorStateMatcher = ShowOnDirtyErrorStateMatcher;
  39295. exports.ErrorStateMatcher = ErrorStateMatcher;
  39296. exports.MAT_HAMMER_OPTIONS = MAT_HAMMER_OPTIONS;
  39297. exports.GestureConfig = GestureConfig;
  39298. exports.setLines = setLines;
  39299. exports.MatLine = MatLine;
  39300. exports.MatLineSetter = MatLineSetter;
  39301. exports.MatLineModule = MatLineModule;
  39302. exports.MatOptionModule = MatOptionModule;
  39303. exports._countGroupLabelsBeforeOption = _countGroupLabelsBeforeOption;
  39304. exports._getOptionScrollPosition = _getOptionScrollPosition;
  39305. exports.MatOptionSelectionChange = MatOptionSelectionChange;
  39306. exports.MAT_OPTION_PARENT_COMPONENT = MAT_OPTION_PARENT_COMPONENT;
  39307. exports.MatOption = MatOption;
  39308. exports.MatOptgroup = MatOptgroup;
  39309. exports.MAT_LABEL_GLOBAL_OPTIONS = MAT_LABEL_GLOBAL_OPTIONS;
  39310. exports.MatRippleModule = MatRippleModule;
  39311. exports.MAT_RIPPLE_GLOBAL_OPTIONS = MAT_RIPPLE_GLOBAL_OPTIONS;
  39312. exports.MatRipple = MatRipple;
  39313. exports.RippleState = RippleState;
  39314. exports.RippleRef = RippleRef;
  39315. exports.defaultRippleAnimationConfig = defaultRippleAnimationConfig;
  39316. exports.RippleRenderer = RippleRenderer;
  39317. exports.MatPseudoCheckboxModule = MatPseudoCheckboxModule;
  39318. exports.MatPseudoCheckbox = MatPseudoCheckbox;
  39319. exports.JAN = JAN;
  39320. exports.FEB = FEB;
  39321. exports.MAR = MAR;
  39322. exports.APR = APR;
  39323. exports.MAY = MAY;
  39324. exports.JUN = JUN;
  39325. exports.JUL = JUL;
  39326. exports.AUG = AUG;
  39327. exports.SEP = SEP;
  39328. exports.OCT = OCT;
  39329. exports.NOV = NOV;
  39330. exports.DEC = DEC;
  39331. exports.MatMultiYearView = MatMultiYearView;
  39332. exports.yearsPerPage = yearsPerPage;
  39333. exports.yearsPerRow = yearsPerRow;
  39334. exports.MatDatepickerModule = MatDatepickerModule;
  39335. exports.MatCalendarHeader = MatCalendarHeader;
  39336. exports.MatCalendar = MatCalendar;
  39337. exports.MatCalendarCell = MatCalendarCell;
  39338. exports.MatCalendarBody = MatCalendarBody;
  39339. exports.MAT_DATEPICKER_SCROLL_STRATEGY_FACTORY = MAT_DATEPICKER_SCROLL_STRATEGY_FACTORY;
  39340. exports.MAT_DATEPICKER_SCROLL_STRATEGY = MAT_DATEPICKER_SCROLL_STRATEGY;
  39341. exports.MAT_DATEPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER = MAT_DATEPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER;
  39342. exports.MatDatepickerContent = MatDatepickerContent;
  39343. exports.MatDatepicker = MatDatepicker;
  39344. exports.matDatepickerAnimations = matDatepickerAnimations;
  39345. exports.MAT_DATEPICKER_VALUE_ACCESSOR = MAT_DATEPICKER_VALUE_ACCESSOR;
  39346. exports.MAT_DATEPICKER_VALIDATORS = MAT_DATEPICKER_VALIDATORS;
  39347. exports.MatDatepickerInputEvent = MatDatepickerInputEvent;
  39348. exports.MatDatepickerInput = MatDatepickerInput;
  39349. exports.MatDatepickerIntl = MatDatepickerIntl;
  39350. exports.MatDatepickerToggleIcon = MatDatepickerToggleIcon;
  39351. exports.MatDatepickerToggle = MatDatepickerToggle;
  39352. exports.MatMonthView = MatMonthView;
  39353. exports.MatYearView = MatYearView;
  39354. exports.MatDialogModule = MatDialogModule;
  39355. exports.MAT_DIALOG_SCROLL_STRATEGY_FACTORY = MAT_DIALOG_SCROLL_STRATEGY_FACTORY;
  39356. exports.MAT_DIALOG_SCROLL_STRATEGY_PROVIDER_FACTORY = MAT_DIALOG_SCROLL_STRATEGY_PROVIDER_FACTORY;
  39357. exports.MAT_DIALOG_DATA = MAT_DIALOG_DATA;
  39358. exports.MAT_DIALOG_DEFAULT_OPTIONS = MAT_DIALOG_DEFAULT_OPTIONS;
  39359. exports.MAT_DIALOG_SCROLL_STRATEGY = MAT_DIALOG_SCROLL_STRATEGY;
  39360. exports.MAT_DIALOG_SCROLL_STRATEGY_PROVIDER = MAT_DIALOG_SCROLL_STRATEGY_PROVIDER;
  39361. exports.MatDialog = MatDialog;
  39362. exports.throwMatDialogContentAlreadyAttachedError = throwMatDialogContentAlreadyAttachedError;
  39363. exports.MatDialogContainer = MatDialogContainer;
  39364. exports.MatDialogClose = MatDialogClose;
  39365. exports.MatDialogTitle = MatDialogTitle;
  39366. exports.MatDialogContent = MatDialogContent;
  39367. exports.MatDialogActions = MatDialogActions;
  39368. exports.MatDialogConfig = MatDialogConfig;
  39369. exports.MatDialogRef = MatDialogRef;
  39370. exports.matDialogAnimations = matDialogAnimations;
  39371. exports.MatDivider = MatDivider;
  39372. exports.MatDividerModule = MatDividerModule;
  39373. exports.MatExpansionModule = MatExpansionModule;
  39374. exports.MatAccordion = MatAccordion;
  39375. exports.MAT_ACCORDION = MAT_ACCORDION;
  39376. exports.MAT_EXPANSION_PANEL_DEFAULT_OPTIONS = MAT_EXPANSION_PANEL_DEFAULT_OPTIONS;
  39377. exports.MatExpansionPanel = MatExpansionPanel;
  39378. exports.MatExpansionPanelActionRow = MatExpansionPanelActionRow;
  39379. exports.MatExpansionPanelHeader = MatExpansionPanelHeader;
  39380. exports.MatExpansionPanelDescription = MatExpansionPanelDescription;
  39381. exports.MatExpansionPanelTitle = MatExpansionPanelTitle;
  39382. exports.MatExpansionPanelContent = MatExpansionPanelContent;
  39383. exports.EXPANSION_PANEL_ANIMATION_TIMING = EXPANSION_PANEL_ANIMATION_TIMING;
  39384. exports.matExpansionAnimations = matExpansionAnimations;
  39385. exports.MatFormFieldModule = MatFormFieldModule;
  39386. exports.MatError = MatError;
  39387. exports.MAT_FORM_FIELD_DEFAULT_OPTIONS = MAT_FORM_FIELD_DEFAULT_OPTIONS;
  39388. exports.MatFormField = MatFormField;
  39389. exports.MatFormFieldControl = MatFormFieldControl;
  39390. exports.getMatFormFieldPlaceholderConflictError = getMatFormFieldPlaceholderConflictError;
  39391. exports.getMatFormFieldDuplicatedHintError = getMatFormFieldDuplicatedHintError;
  39392. exports.getMatFormFieldMissingControlError = getMatFormFieldMissingControlError;
  39393. exports.MatHint = MatHint;
  39394. exports.MatPlaceholder = MatPlaceholder;
  39395. exports.MatPrefix = MatPrefix;
  39396. exports.MatSuffix = MatSuffix;
  39397. exports.MatLabel = MatLabel;
  39398. exports.matFormFieldAnimations = matFormFieldAnimations;
  39399. exports.ɵa6 = MAT_GRID_LIST;
  39400. exports.MatGridListModule = MatGridListModule;
  39401. exports.MatGridList = MatGridList;
  39402. exports.MatGridTile = MatGridTile;
  39403. exports.MatGridTileText = MatGridTileText;
  39404. exports.MatGridAvatarCssMatStyler = MatGridAvatarCssMatStyler;
  39405. exports.MatGridTileHeaderCssMatStyler = MatGridTileHeaderCssMatStyler;
  39406. exports.MatGridTileFooterCssMatStyler = MatGridTileFooterCssMatStyler;
  39407. exports.MatIconModule = MatIconModule;
  39408. exports.MAT_ICON_LOCATION_FACTORY = MAT_ICON_LOCATION_FACTORY;
  39409. exports.MAT_ICON_LOCATION = MAT_ICON_LOCATION;
  39410. exports.MatIcon = MatIcon;
  39411. exports.getMatIconNameNotFoundError = getMatIconNameNotFoundError;
  39412. exports.getMatIconNoHttpProviderError = getMatIconNoHttpProviderError;
  39413. exports.getMatIconFailedToSanitizeUrlError = getMatIconFailedToSanitizeUrlError;
  39414. exports.getMatIconFailedToSanitizeLiteralError = getMatIconFailedToSanitizeLiteralError;
  39415. exports.ICON_REGISTRY_PROVIDER_FACTORY = ICON_REGISTRY_PROVIDER_FACTORY;
  39416. exports.MatIconRegistry = MatIconRegistry;
  39417. exports.ICON_REGISTRY_PROVIDER = ICON_REGISTRY_PROVIDER;
  39418. exports.MatTextareaAutosize = MatTextareaAutosize;
  39419. exports.MatInput = MatInput;
  39420. exports.getMatInputUnsupportedTypeError = getMatInputUnsupportedTypeError;
  39421. exports.MatInputModule = MatInputModule;
  39422. exports.MAT_INPUT_VALUE_ACCESSOR = MAT_INPUT_VALUE_ACCESSOR;
  39423. exports.MatListModule = MatListModule;
  39424. exports.MatNavList = MatNavList;
  39425. exports.MatList = MatList;
  39426. exports.MatListAvatarCssMatStyler = MatListAvatarCssMatStyler;
  39427. exports.MatListIconCssMatStyler = MatListIconCssMatStyler;
  39428. exports.MatListSubheaderCssMatStyler = MatListSubheaderCssMatStyler;
  39429. exports.MatListItem = MatListItem;
  39430. exports.MAT_SELECTION_LIST_VALUE_ACCESSOR = MAT_SELECTION_LIST_VALUE_ACCESSOR;
  39431. exports.MatSelectionListChange = MatSelectionListChange;
  39432. exports.MatListOption = MatListOption;
  39433. exports.MatSelectionList = MatSelectionList;
  39434. exports.ɵa24 = MAT_MENU_DEFAULT_OPTIONS_FACTORY;
  39435. exports.ɵb24 = MAT_MENU_SCROLL_STRATEGY_FACTORY;
  39436. exports.ɵc24 = MAT_MENU_SCROLL_STRATEGY_FACTORY_PROVIDER;
  39437. exports.MatMenu = MatMenu;
  39438. exports.MAT_MENU_DEFAULT_OPTIONS = MAT_MENU_DEFAULT_OPTIONS;
  39439. exports._MatMenu = _MatMenu;
  39440. exports._MatMenuBase = _MatMenuBase;
  39441. exports.MatMenuItem = MatMenuItem;
  39442. exports.MatMenuTrigger = MatMenuTrigger;
  39443. exports.MAT_MENU_SCROLL_STRATEGY = MAT_MENU_SCROLL_STRATEGY;
  39444. exports.MAT_MENU_PANEL = MAT_MENU_PANEL;
  39445. exports._MatMenuDirectivesModule = _MatMenuDirectivesModule;
  39446. exports.MatMenuModule = MatMenuModule;
  39447. exports.matMenuAnimations = matMenuAnimations;
  39448. exports.fadeInItems = fadeInItems;
  39449. exports.transformMenu = transformMenu;
  39450. exports.MatMenuContent = MatMenuContent;
  39451. exports.MatPaginatorModule = MatPaginatorModule;
  39452. exports.PageEvent = PageEvent;
  39453. exports.MatPaginator = MatPaginator;
  39454. exports.MAT_PAGINATOR_INTL_PROVIDER_FACTORY = MAT_PAGINATOR_INTL_PROVIDER_FACTORY;
  39455. exports.MatPaginatorIntl = MatPaginatorIntl;
  39456. exports.MAT_PAGINATOR_INTL_PROVIDER = MAT_PAGINATOR_INTL_PROVIDER;
  39457. exports.MatProgressBarModule = MatProgressBarModule;
  39458. exports.MAT_PROGRESS_BAR_LOCATION_FACTORY = MAT_PROGRESS_BAR_LOCATION_FACTORY;
  39459. exports.MAT_PROGRESS_BAR_LOCATION = MAT_PROGRESS_BAR_LOCATION;
  39460. exports.MatProgressBar = MatProgressBar;
  39461. exports.MatProgressSpinner = MatProgressSpinner;
  39462. exports.MatSpinner = MatSpinner;
  39463. exports.MAT_PROGRESS_SPINNER_DEFAULT_OPTIONS = MAT_PROGRESS_SPINNER_DEFAULT_OPTIONS;
  39464. exports.MAT_PROGRESS_SPINNER_DEFAULT_OPTIONS_FACTORY = MAT_PROGRESS_SPINNER_DEFAULT_OPTIONS_FACTORY;
  39465. exports.MatProgressSpinnerModule = MatProgressSpinnerModule;
  39466. exports.MatRadioModule = MatRadioModule;
  39467. exports.MAT_RADIO_DEFAULT_OPTIONS_FACTORY = MAT_RADIO_DEFAULT_OPTIONS_FACTORY;
  39468. exports.MAT_RADIO_DEFAULT_OPTIONS = MAT_RADIO_DEFAULT_OPTIONS;
  39469. exports.MAT_RADIO_GROUP_CONTROL_VALUE_ACCESSOR = MAT_RADIO_GROUP_CONTROL_VALUE_ACCESSOR;
  39470. exports.MatRadioChange = MatRadioChange;
  39471. exports.MatRadioGroup = MatRadioGroup;
  39472. exports.MatRadioButton = MatRadioButton;
  39473. exports.MatSelectModule = MatSelectModule;
  39474. exports.MAT_SELECT_SCROLL_STRATEGY_PROVIDER_FACTORY = MAT_SELECT_SCROLL_STRATEGY_PROVIDER_FACTORY;
  39475. exports.SELECT_PANEL_MAX_HEIGHT = SELECT_PANEL_MAX_HEIGHT;
  39476. exports.SELECT_PANEL_PADDING_X = SELECT_PANEL_PADDING_X;
  39477. exports.SELECT_PANEL_INDENT_PADDING_X = SELECT_PANEL_INDENT_PADDING_X;
  39478. exports.SELECT_ITEM_HEIGHT_EM = SELECT_ITEM_HEIGHT_EM;
  39479. exports.SELECT_MULTIPLE_PANEL_PADDING_X = SELECT_MULTIPLE_PANEL_PADDING_X;
  39480. exports.SELECT_PANEL_VIEWPORT_PADDING = SELECT_PANEL_VIEWPORT_PADDING;
  39481. exports.MAT_SELECT_SCROLL_STRATEGY = MAT_SELECT_SCROLL_STRATEGY;
  39482. exports.MAT_SELECT_SCROLL_STRATEGY_PROVIDER = MAT_SELECT_SCROLL_STRATEGY_PROVIDER;
  39483. exports.MatSelectChange = MatSelectChange;
  39484. exports.MatSelectTrigger = MatSelectTrigger;
  39485. exports.MatSelect = MatSelect;
  39486. exports.matSelectAnimations = matSelectAnimations;
  39487. exports.transformPanel = transformPanel;
  39488. exports.fadeInContent = fadeInContent;
  39489. exports.MatSidenavModule = MatSidenavModule;
  39490. exports.throwMatDuplicatedDrawerError = throwMatDuplicatedDrawerError;
  39491. exports.MAT_DRAWER_DEFAULT_AUTOSIZE_FACTORY = MAT_DRAWER_DEFAULT_AUTOSIZE_FACTORY;
  39492. exports.MAT_DRAWER_DEFAULT_AUTOSIZE = MAT_DRAWER_DEFAULT_AUTOSIZE;
  39493. exports.MatDrawerContent = MatDrawerContent;
  39494. exports.MatDrawer = MatDrawer;
  39495. exports.MatDrawerContainer = MatDrawerContainer;
  39496. exports.MatSidenavContent = MatSidenavContent;
  39497. exports.MatSidenav = MatSidenav;
  39498. exports.MatSidenavContainer = MatSidenavContainer;
  39499. exports.matDrawerAnimations = matDrawerAnimations;
  39500. exports._MatSlideToggleRequiredValidatorModule = _MatSlideToggleRequiredValidatorModule;
  39501. exports.MatSlideToggleModule = MatSlideToggleModule;
  39502. exports.MAT_SLIDE_TOGGLE_VALUE_ACCESSOR = MAT_SLIDE_TOGGLE_VALUE_ACCESSOR;
  39503. exports.MatSlideToggleChange = MatSlideToggleChange;
  39504. exports.MatSlideToggle = MatSlideToggle;
  39505. exports.MAT_SLIDE_TOGGLE_DEFAULT_OPTIONS = MAT_SLIDE_TOGGLE_DEFAULT_OPTIONS;
  39506. exports.MAT_SLIDE_TOGGLE_REQUIRED_VALIDATOR = MAT_SLIDE_TOGGLE_REQUIRED_VALIDATOR;
  39507. exports.MatSlideToggleRequiredValidator = MatSlideToggleRequiredValidator;
  39508. exports.MatSliderModule = MatSliderModule;
  39509. exports.MAT_SLIDER_VALUE_ACCESSOR = MAT_SLIDER_VALUE_ACCESSOR;
  39510. exports.MatSliderChange = MatSliderChange;
  39511. exports.MatSlider = MatSlider;
  39512. exports.MatSnackBarModule = MatSnackBarModule;
  39513. exports.MAT_SNACK_BAR_DEFAULT_OPTIONS_FACTORY = MAT_SNACK_BAR_DEFAULT_OPTIONS_FACTORY;
  39514. exports.MAT_SNACK_BAR_DEFAULT_OPTIONS = MAT_SNACK_BAR_DEFAULT_OPTIONS;
  39515. exports.MatSnackBar = MatSnackBar;
  39516. exports.MatSnackBarContainer = MatSnackBarContainer;
  39517. exports.MAT_SNACK_BAR_DATA = MAT_SNACK_BAR_DATA;
  39518. exports.MatSnackBarConfig = MatSnackBarConfig;
  39519. exports.MatSnackBarRef = MatSnackBarRef;
  39520. exports.SimpleSnackBar = SimpleSnackBar;
  39521. exports.matSnackBarAnimations = matSnackBarAnimations;
  39522. exports.MatSortModule = MatSortModule;
  39523. exports.MatSortHeader = MatSortHeader;
  39524. exports.MAT_SORT_HEADER_INTL_PROVIDER_FACTORY = MAT_SORT_HEADER_INTL_PROVIDER_FACTORY;
  39525. exports.MatSortHeaderIntl = MatSortHeaderIntl;
  39526. exports.MAT_SORT_HEADER_INTL_PROVIDER = MAT_SORT_HEADER_INTL_PROVIDER;
  39527. exports.MatSort = MatSort;
  39528. exports.matSortAnimations = matSortAnimations;
  39529. exports.MatStepperModule = MatStepperModule;
  39530. exports.MatStepLabel = MatStepLabel;
  39531. exports.MatStep = MatStep;
  39532. exports.MatStepper = MatStepper;
  39533. exports.MatHorizontalStepper = MatHorizontalStepper;
  39534. exports.MatVerticalStepper = MatVerticalStepper;
  39535. exports.MatStepperNext = MatStepperNext;
  39536. exports.MatStepperPrevious = MatStepperPrevious;
  39537. exports.MatStepHeader = MatStepHeader;
  39538. exports.MAT_STEPPER_INTL_PROVIDER_FACTORY = MAT_STEPPER_INTL_PROVIDER_FACTORY;
  39539. exports.MatStepperIntl = MatStepperIntl;
  39540. exports.MAT_STEPPER_INTL_PROVIDER = MAT_STEPPER_INTL_PROVIDER;
  39541. exports.matStepperAnimations = matStepperAnimations;
  39542. exports.MatStepperIcon = MatStepperIcon;
  39543. exports.MatTableModule = MatTableModule;
  39544. exports.MatCellDef = MatCellDef;
  39545. exports.MatHeaderCellDef = MatHeaderCellDef;
  39546. exports.MatFooterCellDef = MatFooterCellDef;
  39547. exports.MatColumnDef = MatColumnDef;
  39548. exports.MatHeaderCell = MatHeaderCell;
  39549. exports.MatFooterCell = MatFooterCell;
  39550. exports.MatCell = MatCell;
  39551. exports.MatTable = MatTable;
  39552. exports.MatHeaderRowDef = MatHeaderRowDef;
  39553. exports.MatFooterRowDef = MatFooterRowDef;
  39554. exports.MatRowDef = MatRowDef;
  39555. exports.MatHeaderRow = MatHeaderRow;
  39556. exports.MatFooterRow = MatFooterRow;
  39557. exports.MatRow = MatRow;
  39558. exports.MatTableDataSource = MatTableDataSource;
  39559. exports.MatTextColumn = MatTextColumn;
  39560. exports.ɵa23 = _MAT_INK_BAR_POSITIONER_FACTORY;
  39561. exports.ɵb23 = MatPaginatedTabHeader;
  39562. exports.MatInkBar = MatInkBar;
  39563. exports._MAT_INK_BAR_POSITIONER = _MAT_INK_BAR_POSITIONER;
  39564. exports.MatTabBody = MatTabBody;
  39565. exports.MatTabBodyPortal = MatTabBodyPortal;
  39566. exports.MatTabHeader = MatTabHeader;
  39567. exports.MatTabLabelWrapper = MatTabLabelWrapper;
  39568. exports.MatTab = MatTab;
  39569. exports.MatTabLabel = MatTabLabel;
  39570. exports.MatTabNav = MatTabNav;
  39571. exports.MatTabLink = MatTabLink;
  39572. exports.MatTabContent = MatTabContent;
  39573. exports.MatTabsModule = MatTabsModule;
  39574. exports.MatTabChangeEvent = MatTabChangeEvent;
  39575. exports.MAT_TABS_CONFIG = MAT_TABS_CONFIG;
  39576. exports.MatTabGroup = MatTabGroup;
  39577. exports.matTabsAnimations = matTabsAnimations;
  39578. exports.MatToolbarModule = MatToolbarModule;
  39579. exports.throwToolbarMixedModesError = throwToolbarMixedModesError;
  39580. exports.MatToolbarRow = MatToolbarRow;
  39581. exports.MatToolbar = MatToolbar;
  39582. exports.MatTooltipModule = MatTooltipModule;
  39583. exports.getMatTooltipInvalidPositionError = getMatTooltipInvalidPositionError;
  39584. exports.MAT_TOOLTIP_SCROLL_STRATEGY_FACTORY = MAT_TOOLTIP_SCROLL_STRATEGY_FACTORY;
  39585. exports.MAT_TOOLTIP_DEFAULT_OPTIONS_FACTORY = MAT_TOOLTIP_DEFAULT_OPTIONS_FACTORY;
  39586. exports.SCROLL_THROTTLE_MS = SCROLL_THROTTLE_MS;
  39587. exports.TOOLTIP_PANEL_CLASS = TOOLTIP_PANEL_CLASS;
  39588. exports.MAT_TOOLTIP_SCROLL_STRATEGY = MAT_TOOLTIP_SCROLL_STRATEGY;
  39589. exports.MAT_TOOLTIP_SCROLL_STRATEGY_FACTORY_PROVIDER = MAT_TOOLTIP_SCROLL_STRATEGY_FACTORY_PROVIDER;
  39590. exports.MAT_TOOLTIP_DEFAULT_OPTIONS = MAT_TOOLTIP_DEFAULT_OPTIONS;
  39591. exports.MatTooltip = MatTooltip;
  39592. exports.TooltipComponent = TooltipComponent;
  39593. exports.matTooltipAnimations = matTooltipAnimations;
  39594. exports.MatTreeNode = MatTreeNode;
  39595. exports.MatTreeNodeDef = MatTreeNodeDef;
  39596. exports.MatNestedTreeNode = MatNestedTreeNode;
  39597. exports.MatTreeNodePadding = MatTreeNodePadding;
  39598. exports.MatTree = MatTree;
  39599. exports.MatTreeModule = MatTreeModule;
  39600. exports.MatTreeNodeToggle = MatTreeNodeToggle;
  39601. exports.MatTreeNodeOutlet = MatTreeNodeOutlet;
  39602. exports.MatTreeFlattener = MatTreeFlattener;
  39603. exports.MatTreeFlatDataSource = MatTreeFlatDataSource;
  39604. exports.MatTreeNestedDataSource = MatTreeNestedDataSource;
  39605. Object.defineProperty(exports, '__esModule', { value: true });
  39606. })));
  39607. //# sourceMappingURL=material.umd.js.map