| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827 |
- /**
- * @license
- * Copyright Google LLC All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- (function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/platform-browser'), require('@angular/cdk/bidi'), require('@angular/cdk'), require('@angular/cdk/coercion'), require('rxjs'), require('@angular/cdk/platform'), require('rxjs/operators'), require('@angular/cdk/a11y'), require('@angular/platform-browser/animations'), require('@angular/cdk/keycodes'), require('@angular/common'), 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')) :
- 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) :
- (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));
- }(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';
- /*! *****************************************************************************
- Copyright (c) Microsoft Corporation. All rights reserved.
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
- this file except in compliance with the License. You may obtain a copy of the
- License at http://www.apache.org/licenses/LICENSE-2.0
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
- MERCHANTABLITY OR NON-INFRINGEMENT.
- See the Apache Version 2.0 License for specific language governing permissions
- and limitations under the License.
- ***************************************************************************** */
- /* global Reflect, Promise */
- var extendStatics = function(d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- function __extends(d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- }
- var __assign = function() {
- __assign = Object.assign || function __assign(t) {
- for (var s, i = 1, n = arguments.length; i < n; i++) {
- s = arguments[i];
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
- }
- return t;
- };
- return __assign.apply(this, arguments);
- };
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Current version of Angular Material.
- * @type {?}
- */
- var VERSION$1 = new core.Version('8.1.4');
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * \@docs-private
- */
- var AnimationCurves = /** @class */ (function () {
- function AnimationCurves() {
- }
- AnimationCurves.STANDARD_CURVE = 'cubic-bezier(0.4,0.0,0.2,1)';
- AnimationCurves.DECELERATION_CURVE = 'cubic-bezier(0.0,0.0,0.2,1)';
- AnimationCurves.ACCELERATION_CURVE = 'cubic-bezier(0.4,0.0,1,1)';
- AnimationCurves.SHARP_CURVE = 'cubic-bezier(0.4,0.0,0.6,1)';
- return AnimationCurves;
- }());
- /**
- * \@docs-private
- */
- var AnimationDurations = /** @class */ (function () {
- function AnimationDurations() {
- }
- AnimationDurations.COMPLEX = '375ms';
- AnimationDurations.ENTERING = '225ms';
- AnimationDurations.EXITING = '195ms';
- return AnimationDurations;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- // Private version constant to circumvent test/build issues,
- // i.e. avoid core to depend on the @angular/material primary entry-point
- // Can be removed once the Material primary entry-point no longer
- // re-exports all secondary entry-points
- /** @type {?} */
- var VERSION$2 = new core.Version('8.1.4');
- /**
- * Injection token that configures whether the Material sanity checks are enabled.
- * @type {?}
- */
- var MATERIAL_SANITY_CHECKS = new core.InjectionToken('mat-sanity-checks', {
- providedIn: 'root',
- factory: MATERIAL_SANITY_CHECKS_FACTORY,
- });
- /**
- * \@docs-private
- * @return {?}
- */
- function MATERIAL_SANITY_CHECKS_FACTORY() {
- return true;
- }
- /**
- * Module that captures anything that should be loaded and/or run for *all* Angular Material
- * components. This includes Bidi, etc.
- *
- * This module should be imported to each top-level component module (e.g., MatTabsModule).
- */
- var MatCommonModule = /** @class */ (function () {
- function MatCommonModule(_sanityChecksEnabled, _hammerLoader) {
- this._sanityChecksEnabled = _sanityChecksEnabled;
- this._hammerLoader = _hammerLoader;
- /**
- * Whether we've done the global sanity checks (e.g. a theme is loaded, there is a doctype).
- */
- this._hasDoneGlobalChecks = false;
- /**
- * Whether we've already checked for HammerJs availability.
- */
- this._hasCheckedHammer = false;
- /**
- * Reference to the global `document` object.
- */
- this._document = typeof document === 'object' && document ? document : null;
- /**
- * Reference to the global 'window' object.
- */
- this._window = typeof window === 'object' && window ? window : null;
- if (this._areChecksEnabled() && !this._hasDoneGlobalChecks) {
- this._checkDoctypeIsDefined();
- this._checkThemeIsPresent();
- this._checkCdkVersionMatch();
- this._hasDoneGlobalChecks = true;
- }
- }
- /** Whether any sanity checks are enabled */
- /**
- * Whether any sanity checks are enabled
- * @private
- * @return {?}
- */
- MatCommonModule.prototype._areChecksEnabled = /**
- * Whether any sanity checks are enabled
- * @private
- * @return {?}
- */
- function () {
- return this._sanityChecksEnabled && core.isDevMode() && !this._isTestEnv();
- };
- /** Whether the code is running in tests. */
- /**
- * Whether the code is running in tests.
- * @private
- * @return {?}
- */
- MatCommonModule.prototype._isTestEnv = /**
- * Whether the code is running in tests.
- * @private
- * @return {?}
- */
- function () {
- /** @type {?} */
- var window = (/** @type {?} */ (this._window));
- return window && (window.__karma__ || window.jasmine);
- };
- /**
- * @private
- * @return {?}
- */
- MatCommonModule.prototype._checkDoctypeIsDefined = /**
- * @private
- * @return {?}
- */
- function () {
- if (this._document && !this._document.doctype) {
- console.warn('Current document does not have a doctype. This may cause ' +
- 'some Angular Material components not to behave as expected.');
- }
- };
- /**
- * @private
- * @return {?}
- */
- MatCommonModule.prototype._checkThemeIsPresent = /**
- * @private
- * @return {?}
- */
- function () {
- // We need to assert that the `body` is defined, because these checks run very early
- // and the `body` won't be defined if the consumer put their scripts in the `head`.
- if (!this._document || !this._document.body || typeof getComputedStyle !== 'function') {
- return;
- }
- /** @type {?} */
- var testElement = this._document.createElement('div');
- testElement.classList.add('mat-theme-loaded-marker');
- this._document.body.appendChild(testElement);
- /** @type {?} */
- var computedStyle = getComputedStyle(testElement);
- // In some situations the computed style of the test element can be null. For example in
- // Firefox, the computed style is null if an application is running inside of a hidden iframe.
- // See: https://bugzilla.mozilla.org/show_bug.cgi?id=548397
- if (computedStyle && computedStyle.display !== 'none') {
- console.warn('Could not find Angular Material core theme. Most Material ' +
- 'components may not work as expected. For more info refer ' +
- 'to the theming guide: https://material.angular.io/guide/theming');
- }
- this._document.body.removeChild(testElement);
- };
- /** Checks whether the material version matches the cdk version */
- /**
- * Checks whether the material version matches the cdk version
- * @private
- * @return {?}
- */
- MatCommonModule.prototype._checkCdkVersionMatch = /**
- * Checks whether the material version matches the cdk version
- * @private
- * @return {?}
- */
- function () {
- if (VERSION$2.full !== cdk.VERSION.full) {
- console.warn('The Angular Material version (' + VERSION$2.full + ') does not match ' +
- 'the Angular CDK version (' + cdk.VERSION.full + ').\n' +
- 'Please ensure the versions of these two packages exactly match.');
- }
- };
- /** Checks whether HammerJS is available. */
- /**
- * Checks whether HammerJS is available.
- * @return {?}
- */
- MatCommonModule.prototype._checkHammerIsAvailable = /**
- * Checks whether HammerJS is available.
- * @return {?}
- */
- function () {
- if (this._hasCheckedHammer || !this._window) {
- return;
- }
- if (this._areChecksEnabled() && !((/** @type {?} */ (this._window)))['Hammer'] && !this._hammerLoader) {
- console.warn('Could not find HammerJS. Certain Angular Material components may not work correctly.');
- }
- this._hasCheckedHammer = true;
- };
- MatCommonModule.decorators = [
- { type: core.NgModule, args: [{
- imports: [bidi.BidiModule],
- exports: [bidi.BidiModule],
- },] },
- ];
- /** @nocollapse */
- MatCommonModule.ctorParameters = function () { return [
- { type: Boolean, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MATERIAL_SANITY_CHECKS,] }] },
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [platformBrowser.HAMMER_LOADER,] }] }
- ]; };
- return MatCommonModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Mixin to augment a directive with a `disabled` property.
- * @template T
- * @param {?} base
- * @return {?}
- */
- function mixinDisabled(base) {
- return /** @class */ (function (_super) {
- __extends(class_1, _super);
- function class_1() {
- var args = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- args[_i] = arguments[_i];
- }
- var _this = _super.apply(this, args) || this;
- _this._disabled = false;
- return _this;
- }
- Object.defineProperty(class_1.prototype, "disabled", {
- get: /**
- * @return {?}
- */
- function () { return this._disabled; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) { this._disabled = coercion.coerceBooleanProperty(value); },
- enumerable: true,
- configurable: true
- });
- return class_1;
- }(base));
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Mixin to augment a directive with a `color` property.
- * @template T
- * @param {?} base
- * @param {?=} defaultColor
- * @return {?}
- */
- function mixinColor(base, defaultColor) {
- return /** @class */ (function (_super) {
- __extends(class_1, _super);
- function class_1() {
- var args = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- args[_i] = arguments[_i];
- }
- var _this = _super.apply(this, args) || this;
- // Set the default color that can be specified from the mixin.
- _this.color = defaultColor;
- return _this;
- }
- Object.defineProperty(class_1.prototype, "color", {
- get: /**
- * @return {?}
- */
- function () { return this._color; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- /** @type {?} */
- var colorPalette = value || defaultColor;
- if (colorPalette !== this._color) {
- if (this._color) {
- this._elementRef.nativeElement.classList.remove("mat-" + this._color);
- }
- if (colorPalette) {
- this._elementRef.nativeElement.classList.add("mat-" + colorPalette);
- }
- this._color = colorPalette;
- }
- },
- enumerable: true,
- configurable: true
- });
- return class_1;
- }(base));
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Mixin to augment a directive with a `disableRipple` property.
- * @template T
- * @param {?} base
- * @return {?}
- */
- function mixinDisableRipple(base) {
- return /** @class */ (function (_super) {
- __extends(class_1, _super);
- function class_1() {
- var args = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- args[_i] = arguments[_i];
- }
- var _this = _super.apply(this, args) || this;
- _this._disableRipple = false;
- return _this;
- }
- Object.defineProperty(class_1.prototype, "disableRipple", {
- /** Whether the ripple effect is disabled or not. */
- get: /**
- * Whether the ripple effect is disabled or not.
- * @return {?}
- */
- function () { return this._disableRipple; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) { this._disableRipple = coercion.coerceBooleanProperty(value); },
- enumerable: true,
- configurable: true
- });
- return class_1;
- }(base));
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Mixin to augment a directive with a `tabIndex` property.
- * @template T
- * @param {?} base
- * @param {?=} defaultTabIndex
- * @return {?}
- */
- function mixinTabIndex(base, defaultTabIndex) {
- if (defaultTabIndex === void 0) { defaultTabIndex = 0; }
- return /** @class */ (function (_super) {
- __extends(class_1, _super);
- function class_1() {
- var args = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- args[_i] = arguments[_i];
- }
- var _this = _super.apply(this, args) || this;
- _this._tabIndex = defaultTabIndex;
- return _this;
- }
- Object.defineProperty(class_1.prototype, "tabIndex", {
- get: /**
- * @return {?}
- */
- function () { return this.disabled ? -1 : this._tabIndex; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- // If the specified tabIndex value is null or undefined, fall back to the default value.
- this._tabIndex = value != null ? value : defaultTabIndex;
- },
- enumerable: true,
- configurable: true
- });
- return class_1;
- }(base));
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Mixin to augment a directive with updateErrorState method.
- * For component with `errorState` and need to update `errorState`.
- * @template T
- * @param {?} base
- * @return {?}
- */
- function mixinErrorState(base) {
- return /** @class */ (function (_super) {
- __extends(class_1, _super);
- function class_1() {
- var args = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- args[_i] = arguments[_i];
- }
- var _this = _super.apply(this, args) || this;
- /**
- * Whether the component is in an error state.
- */
- _this.errorState = false;
- /**
- * Stream that emits whenever the state of the input changes such that the wrapping
- * `MatFormField` needs to run change detection.
- */
- _this.stateChanges = new rxjs.Subject();
- return _this;
- }
- /**
- * @return {?}
- */
- class_1.prototype.updateErrorState = /**
- * @return {?}
- */
- function () {
- /** @type {?} */
- var oldState = this.errorState;
- /** @type {?} */
- var parent = this._parentFormGroup || this._parentForm;
- /** @type {?} */
- var matcher = this.errorStateMatcher || this._defaultErrorStateMatcher;
- /** @type {?} */
- var control = this.ngControl ? (/** @type {?} */ (this.ngControl.control)) : null;
- /** @type {?} */
- var newState = matcher.isErrorState(control, parent);
- if (newState !== oldState) {
- this.errorState = newState;
- this.stateChanges.next();
- }
- };
- return class_1;
- }(base));
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Mixin to augment a directive with an initialized property that will emits when ngOnInit ends.
- * @template T
- * @param {?} base
- * @return {?}
- */
- function mixinInitialized(base) {
- return /** @class */ (function (_super) {
- __extends(class_1, _super);
- function class_1() {
- var args = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- args[_i] = arguments[_i];
- }
- var _this = _super.apply(this, args) || this;
- /**
- * Whether this directive has been marked as initialized.
- */
- _this._isInitialized = false;
- /**
- * List of subscribers that subscribed before the directive was initialized. Should be notified
- * during _markInitialized. Set to null after pending subscribers are notified, and should
- * not expect to be populated after.
- */
- _this._pendingSubscribers = [];
- /**
- * Observable stream that emits when the directive initializes. If already initialized, the
- * subscriber is stored to be notified once _markInitialized is called.
- */
- _this.initialized = new rxjs.Observable((/**
- * @param {?} subscriber
- * @return {?}
- */
- function (subscriber) {
- // If initialized, immediately notify the subscriber. Otherwise store the subscriber to notify
- // when _markInitialized is called.
- if (_this._isInitialized) {
- _this._notifySubscriber(subscriber);
- }
- else {
- (/** @type {?} */ (_this._pendingSubscribers)).push(subscriber);
- }
- }));
- return _this;
- }
- /**
- * Marks the state as initialized and notifies pending subscribers. Should be called at the end
- * of ngOnInit.
- * @docs-private
- */
- /**
- * Marks the state as initialized and notifies pending subscribers. Should be called at the end
- * of ngOnInit.
- * \@docs-private
- * @return {?}
- */
- class_1.prototype._markInitialized = /**
- * Marks the state as initialized and notifies pending subscribers. Should be called at the end
- * of ngOnInit.
- * \@docs-private
- * @return {?}
- */
- function () {
- if (this._isInitialized) {
- throw Error('This directive has already been marked as initialized and ' +
- 'should not be called twice.');
- }
- this._isInitialized = true;
- (/** @type {?} */ (this._pendingSubscribers)).forEach(this._notifySubscriber);
- this._pendingSubscribers = null;
- };
- /** Emits and completes the subscriber stream (should only emit once). */
- /**
- * Emits and completes the subscriber stream (should only emit once).
- * @param {?} subscriber
- * @return {?}
- */
- class_1.prototype._notifySubscriber = /**
- * Emits and completes the subscriber stream (should only emit once).
- * @param {?} subscriber
- * @return {?}
- */
- function (subscriber) {
- subscriber.next();
- subscriber.complete();
- };
- return class_1;
- }(base));
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * InjectionToken for datepicker that can be used to override default locale code.
- * @type {?}
- */
- var MAT_DATE_LOCALE = new core.InjectionToken('MAT_DATE_LOCALE', {
- providedIn: 'root',
- factory: MAT_DATE_LOCALE_FACTORY,
- });
- /**
- * \@docs-private
- * @return {?}
- */
- function MAT_DATE_LOCALE_FACTORY() {
- return core.inject(core.LOCALE_ID);
- }
- /**
- * No longer needed since MAT_DATE_LOCALE has been changed to a scoped injectable.
- * If you are importing and providing this in your code you can simply remove it.
- * @deprecated
- * \@breaking-change 8.0.0
- * @type {?}
- */
- var MAT_DATE_LOCALE_PROVIDER = { provide: MAT_DATE_LOCALE, useExisting: core.LOCALE_ID };
- /**
- * Adapts type `D` to be usable as a date by cdk-based components that work with dates.
- * @abstract
- * @template D
- */
- var /**
- * Adapts type `D` to be usable as a date by cdk-based components that work with dates.
- * @abstract
- * @template D
- */
- DateAdapter = /** @class */ (function () {
- function DateAdapter() {
- this._localeChanges = new rxjs.Subject();
- }
- Object.defineProperty(DateAdapter.prototype, "localeChanges", {
- /** A stream that emits when the locale changes. */
- get: /**
- * A stream that emits when the locale changes.
- * @return {?}
- */
- function () { return this._localeChanges; },
- enumerable: true,
- configurable: true
- });
- /**
- * Attempts to deserialize a value to a valid date object. This is different from parsing in that
- * deserialize should only accept non-ambiguous, locale-independent formats (e.g. a ISO 8601
- * string). The default implementation does not allow any deserialization, it simply checks that
- * the given value is already a valid date object or null. The `<mat-datepicker>` will call this
- * method on all of it's `@Input()` properties that accept dates. It is therefore possible to
- * support passing values from your backend directly to these properties by overriding this method
- * to also deserialize the format used by your backend.
- * @param value The value to be deserialized into a date object.
- * @returns The deserialized date object, either a valid date, null if the value can be
- * deserialized into a null date (e.g. the empty string), or an invalid date.
- */
- /**
- * Attempts to deserialize a value to a valid date object. This is different from parsing in that
- * deserialize should only accept non-ambiguous, locale-independent formats (e.g. a ISO 8601
- * string). The default implementation does not allow any deserialization, it simply checks that
- * the given value is already a valid date object or null. The `<mat-datepicker>` will call this
- * method on all of it's `\@Input()` properties that accept dates. It is therefore possible to
- * support passing values from your backend directly to these properties by overriding this method
- * to also deserialize the format used by your backend.
- * @param {?} value The value to be deserialized into a date object.
- * @return {?} The deserialized date object, either a valid date, null if the value can be
- * deserialized into a null date (e.g. the empty string), or an invalid date.
- */
- DateAdapter.prototype.deserialize = /**
- * Attempts to deserialize a value to a valid date object. This is different from parsing in that
- * deserialize should only accept non-ambiguous, locale-independent formats (e.g. a ISO 8601
- * string). The default implementation does not allow any deserialization, it simply checks that
- * the given value is already a valid date object or null. The `<mat-datepicker>` will call this
- * method on all of it's `\@Input()` properties that accept dates. It is therefore possible to
- * support passing values from your backend directly to these properties by overriding this method
- * to also deserialize the format used by your backend.
- * @param {?} value The value to be deserialized into a date object.
- * @return {?} The deserialized date object, either a valid date, null if the value can be
- * deserialized into a null date (e.g. the empty string), or an invalid date.
- */
- function (value) {
- if (value == null || this.isDateInstance(value) && this.isValid(value)) {
- return value;
- }
- return this.invalid();
- };
- /**
- * Sets the locale used for all dates.
- * @param locale The new locale.
- */
- /**
- * Sets the locale used for all dates.
- * @param {?} locale The new locale.
- * @return {?}
- */
- DateAdapter.prototype.setLocale = /**
- * Sets the locale used for all dates.
- * @param {?} locale The new locale.
- * @return {?}
- */
- function (locale) {
- this.locale = locale;
- this._localeChanges.next();
- };
- /**
- * Compares two dates.
- * @param first The first date to compare.
- * @param second The second date to compare.
- * @returns 0 if the dates are equal, a number less than 0 if the first date is earlier,
- * a number greater than 0 if the first date is later.
- */
- /**
- * Compares two dates.
- * @param {?} first The first date to compare.
- * @param {?} second The second date to compare.
- * @return {?} 0 if the dates are equal, a number less than 0 if the first date is earlier,
- * a number greater than 0 if the first date is later.
- */
- DateAdapter.prototype.compareDate = /**
- * Compares two dates.
- * @param {?} first The first date to compare.
- * @param {?} second The second date to compare.
- * @return {?} 0 if the dates are equal, a number less than 0 if the first date is earlier,
- * a number greater than 0 if the first date is later.
- */
- function (first, second) {
- return this.getYear(first) - this.getYear(second) ||
- this.getMonth(first) - this.getMonth(second) ||
- this.getDate(first) - this.getDate(second);
- };
- /**
- * Checks if two dates are equal.
- * @param first The first date to check.
- * @param second The second date to check.
- * @returns Whether the two dates are equal.
- * Null dates are considered equal to other null dates.
- */
- /**
- * Checks if two dates are equal.
- * @param {?} first The first date to check.
- * @param {?} second The second date to check.
- * @return {?} Whether the two dates are equal.
- * Null dates are considered equal to other null dates.
- */
- DateAdapter.prototype.sameDate = /**
- * Checks if two dates are equal.
- * @param {?} first The first date to check.
- * @param {?} second The second date to check.
- * @return {?} Whether the two dates are equal.
- * Null dates are considered equal to other null dates.
- */
- function (first, second) {
- if (first && second) {
- /** @type {?} */
- var firstValid = this.isValid(first);
- /** @type {?} */
- var secondValid = this.isValid(second);
- if (firstValid && secondValid) {
- return !this.compareDate(first, second);
- }
- return firstValid == secondValid;
- }
- return first == second;
- };
- /**
- * Clamp the given date between min and max dates.
- * @param date The date to clamp.
- * @param min The minimum value to allow. If null or omitted no min is enforced.
- * @param max The maximum value to allow. If null or omitted no max is enforced.
- * @returns `min` if `date` is less than `min`, `max` if date is greater than `max`,
- * otherwise `date`.
- */
- /**
- * Clamp the given date between min and max dates.
- * @param {?} date The date to clamp.
- * @param {?=} min The minimum value to allow. If null or omitted no min is enforced.
- * @param {?=} max The maximum value to allow. If null or omitted no max is enforced.
- * @return {?} `min` if `date` is less than `min`, `max` if date is greater than `max`,
- * otherwise `date`.
- */
- DateAdapter.prototype.clampDate = /**
- * Clamp the given date between min and max dates.
- * @param {?} date The date to clamp.
- * @param {?=} min The minimum value to allow. If null or omitted no min is enforced.
- * @param {?=} max The maximum value to allow. If null or omitted no max is enforced.
- * @return {?} `min` if `date` is less than `min`, `max` if date is greater than `max`,
- * otherwise `date`.
- */
- function (date, min, max) {
- if (min && this.compareDate(date, min) < 0) {
- return min;
- }
- if (max && this.compareDate(date, max) > 0) {
- return max;
- }
- return date;
- };
- return DateAdapter;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /** @type {?} */
- var MAT_DATE_FORMATS = new core.InjectionToken('mat-date-formats');
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- // TODO(mmalerba): Remove when we no longer support safari 9.
- /**
- * Whether the browser supports the Intl API.
- * @type {?}
- */
- var SUPPORTS_INTL_API;
- // We need a try/catch around the reference to `Intl`, because accessing it in some cases can
- // cause IE to throw. These cases are tied to particular versions of Windows and can happen if
- // the consumer is providing a polyfilled `Map`. See:
- // https://github.com/Microsoft/ChakraCore/issues/3189
- // https://github.com/angular/components/issues/15687
- try {
- SUPPORTS_INTL_API = typeof Intl != 'undefined';
- }
- catch (_a) {
- SUPPORTS_INTL_API = false;
- }
- /**
- * The default month names to use if Intl API is not available.
- * @type {?}
- */
- var DEFAULT_MONTH_NAMES = {
- 'long': [
- 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September',
- 'October', 'November', 'December'
- ],
- 'short': ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
- 'narrow': ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D']
- };
- var ɵ0 = /**
- * @param {?} i
- * @return {?}
- */
- function (i) { return String(i + 1); };
- /**
- * The default date names to use if Intl API is not available.
- * @type {?}
- */
- var DEFAULT_DATE_NAMES = range(31, (ɵ0));
- /**
- * The default day of the week names to use if Intl API is not available.
- * @type {?}
- */
- var DEFAULT_DAY_OF_WEEK_NAMES = {
- 'long': ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
- 'short': ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
- 'narrow': ['S', 'M', 'T', 'W', 'T', 'F', 'S']
- };
- /**
- * Matches strings that have the form of a valid RFC 3339 string
- * (https://tools.ietf.org/html/rfc3339). Note that the string may not actually be a valid date
- * because the regex will match strings an with out of bounds month, date, etc.
- * @type {?}
- */
- var ISO_8601_REGEX = /^\d{4}-\d{2}-\d{2}(?:T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|(?:(?:\+|-)\d{2}:\d{2}))?)?$/;
- /**
- * Creates an array and fills it with values.
- * @template T
- * @param {?} length
- * @param {?} valueFunction
- * @return {?}
- */
- function range(length, valueFunction) {
- /** @type {?} */
- var valuesArray = Array(length);
- for (var i = 0; i < length; i++) {
- valuesArray[i] = valueFunction(i);
- }
- return valuesArray;
- }
- /**
- * Adapts the native JS Date for use with cdk-based components that work with dates.
- */
- var NativeDateAdapter = /** @class */ (function (_super) {
- __extends(NativeDateAdapter, _super);
- function NativeDateAdapter(matDateLocale, platform$$1) {
- var _this = _super.call(this) || this;
- /**
- * Whether to use `timeZone: 'utc'` with `Intl.DateTimeFormat` when formatting dates.
- * Without this `Intl.DateTimeFormat` sometimes chooses the wrong timeZone, which can throw off
- * the result. (e.g. in the en-US locale `new Date(1800, 7, 14).toLocaleDateString()`
- * will produce `'8/13/1800'`.
- *
- * TODO(mmalerba): drop this variable. It's not being used in the code right now. We're now
- * getting the string representation of a Date object from it's utc representation. We're keeping
- * it here for sometime, just for precaution, in case we decide to revert some of these changes
- * though.
- */
- _this.useUtcForDisplay = true;
- _super.prototype.setLocale.call(_this, matDateLocale);
- // IE does its own time zone correction, so we disable this on IE.
- _this.useUtcForDisplay = !platform$$1.TRIDENT;
- _this._clampDate = platform$$1.TRIDENT || platform$$1.EDGE;
- return _this;
- }
- /**
- * @param {?} date
- * @return {?}
- */
- NativeDateAdapter.prototype.getYear = /**
- * @param {?} date
- * @return {?}
- */
- function (date) {
- return date.getFullYear();
- };
- /**
- * @param {?} date
- * @return {?}
- */
- NativeDateAdapter.prototype.getMonth = /**
- * @param {?} date
- * @return {?}
- */
- function (date) {
- return date.getMonth();
- };
- /**
- * @param {?} date
- * @return {?}
- */
- NativeDateAdapter.prototype.getDate = /**
- * @param {?} date
- * @return {?}
- */
- function (date) {
- return date.getDate();
- };
- /**
- * @param {?} date
- * @return {?}
- */
- NativeDateAdapter.prototype.getDayOfWeek = /**
- * @param {?} date
- * @return {?}
- */
- function (date) {
- return date.getDay();
- };
- /**
- * @param {?} style
- * @return {?}
- */
- NativeDateAdapter.prototype.getMonthNames = /**
- * @param {?} style
- * @return {?}
- */
- function (style) {
- var _this = this;
- if (SUPPORTS_INTL_API) {
- /** @type {?} */
- var dtf_1 = new Intl.DateTimeFormat(this.locale, { month: style, timeZone: 'utc' });
- return range(12, (/**
- * @param {?} i
- * @return {?}
- */
- function (i) {
- return _this._stripDirectionalityCharacters(_this._format(dtf_1, new Date(2017, i, 1)));
- }));
- }
- return DEFAULT_MONTH_NAMES[style];
- };
- /**
- * @return {?}
- */
- NativeDateAdapter.prototype.getDateNames = /**
- * @return {?}
- */
- function () {
- var _this = this;
- if (SUPPORTS_INTL_API) {
- /** @type {?} */
- var dtf_2 = new Intl.DateTimeFormat(this.locale, { day: 'numeric', timeZone: 'utc' });
- return range(31, (/**
- * @param {?} i
- * @return {?}
- */
- function (i) { return _this._stripDirectionalityCharacters(_this._format(dtf_2, new Date(2017, 0, i + 1))); }));
- }
- return DEFAULT_DATE_NAMES;
- };
- /**
- * @param {?} style
- * @return {?}
- */
- NativeDateAdapter.prototype.getDayOfWeekNames = /**
- * @param {?} style
- * @return {?}
- */
- function (style) {
- var _this = this;
- if (SUPPORTS_INTL_API) {
- /** @type {?} */
- var dtf_3 = new Intl.DateTimeFormat(this.locale, { weekday: style, timeZone: 'utc' });
- return range(7, (/**
- * @param {?} i
- * @return {?}
- */
- function (i) { return _this._stripDirectionalityCharacters(_this._format(dtf_3, new Date(2017, 0, i + 1))); }));
- }
- return DEFAULT_DAY_OF_WEEK_NAMES[style];
- };
- /**
- * @param {?} date
- * @return {?}
- */
- NativeDateAdapter.prototype.getYearName = /**
- * @param {?} date
- * @return {?}
- */
- function (date) {
- if (SUPPORTS_INTL_API) {
- /** @type {?} */
- var dtf = new Intl.DateTimeFormat(this.locale, { year: 'numeric', timeZone: 'utc' });
- return this._stripDirectionalityCharacters(this._format(dtf, date));
- }
- return String(this.getYear(date));
- };
- /**
- * @return {?}
- */
- NativeDateAdapter.prototype.getFirstDayOfWeek = /**
- * @return {?}
- */
- function () {
- // We can't tell using native JS Date what the first day of the week is, we default to Sunday.
- return 0;
- };
- /**
- * @param {?} date
- * @return {?}
- */
- NativeDateAdapter.prototype.getNumDaysInMonth = /**
- * @param {?} date
- * @return {?}
- */
- function (date) {
- return this.getDate(this._createDateWithOverflow(this.getYear(date), this.getMonth(date) + 1, 0));
- };
- /**
- * @param {?} date
- * @return {?}
- */
- NativeDateAdapter.prototype.clone = /**
- * @param {?} date
- * @return {?}
- */
- function (date) {
- return new Date(date.getTime());
- };
- /**
- * @param {?} year
- * @param {?} month
- * @param {?} date
- * @return {?}
- */
- NativeDateAdapter.prototype.createDate = /**
- * @param {?} year
- * @param {?} month
- * @param {?} date
- * @return {?}
- */
- function (year, month, date) {
- // Check for invalid month and date (except upper bound on date which we have to check after
- // creating the Date).
- if (month < 0 || month > 11) {
- throw Error("Invalid month index \"" + month + "\". Month index has to be between 0 and 11.");
- }
- if (date < 1) {
- throw Error("Invalid date \"" + date + "\". Date has to be greater than 0.");
- }
- /** @type {?} */
- var result = this._createDateWithOverflow(year, month, date);
- // Check that the date wasn't above the upper bound for the month, causing the month to overflow
- if (result.getMonth() != month) {
- throw Error("Invalid date \"" + date + "\" for month with index \"" + month + "\".");
- }
- return result;
- };
- /**
- * @return {?}
- */
- NativeDateAdapter.prototype.today = /**
- * @return {?}
- */
- function () {
- return new Date();
- };
- /**
- * @param {?} value
- * @return {?}
- */
- NativeDateAdapter.prototype.parse = /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- // We have no way using the native JS Date to set the parse format or locale, so we ignore these
- // parameters.
- if (typeof value == 'number') {
- return new Date(value);
- }
- return value ? new Date(Date.parse(value)) : null;
- };
- /**
- * @param {?} date
- * @param {?} displayFormat
- * @return {?}
- */
- NativeDateAdapter.prototype.format = /**
- * @param {?} date
- * @param {?} displayFormat
- * @return {?}
- */
- function (date, displayFormat) {
- if (!this.isValid(date)) {
- throw Error('NativeDateAdapter: Cannot format invalid date.');
- }
- if (SUPPORTS_INTL_API) {
- // On IE and Edge the i18n API will throw a hard error that can crash the entire app
- // if we attempt to format a date whose year is less than 1 or greater than 9999.
- if (this._clampDate && (date.getFullYear() < 1 || date.getFullYear() > 9999)) {
- date = this.clone(date);
- date.setFullYear(Math.max(1, Math.min(9999, date.getFullYear())));
- }
- displayFormat = __assign({}, displayFormat, { timeZone: 'utc' });
- /** @type {?} */
- var dtf = new Intl.DateTimeFormat(this.locale, displayFormat);
- return this._stripDirectionalityCharacters(this._format(dtf, date));
- }
- return this._stripDirectionalityCharacters(date.toDateString());
- };
- /**
- * @param {?} date
- * @param {?} years
- * @return {?}
- */
- NativeDateAdapter.prototype.addCalendarYears = /**
- * @param {?} date
- * @param {?} years
- * @return {?}
- */
- function (date, years) {
- return this.addCalendarMonths(date, years * 12);
- };
- /**
- * @param {?} date
- * @param {?} months
- * @return {?}
- */
- NativeDateAdapter.prototype.addCalendarMonths = /**
- * @param {?} date
- * @param {?} months
- * @return {?}
- */
- function (date, months) {
- /** @type {?} */
- var newDate = this._createDateWithOverflow(this.getYear(date), this.getMonth(date) + months, this.getDate(date));
- // It's possible to wind up in the wrong month if the original month has more days than the new
- // month. In this case we want to go to the last day of the desired month.
- // Note: the additional + 12 % 12 ensures we end up with a positive number, since JS % doesn't
- // guarantee this.
- if (this.getMonth(newDate) != ((this.getMonth(date) + months) % 12 + 12) % 12) {
- newDate = this._createDateWithOverflow(this.getYear(newDate), this.getMonth(newDate), 0);
- }
- return newDate;
- };
- /**
- * @param {?} date
- * @param {?} days
- * @return {?}
- */
- NativeDateAdapter.prototype.addCalendarDays = /**
- * @param {?} date
- * @param {?} days
- * @return {?}
- */
- function (date, days) {
- return this._createDateWithOverflow(this.getYear(date), this.getMonth(date), this.getDate(date) + days);
- };
- /**
- * @param {?} date
- * @return {?}
- */
- NativeDateAdapter.prototype.toIso8601 = /**
- * @param {?} date
- * @return {?}
- */
- function (date) {
- return [
- date.getUTCFullYear(),
- this._2digit(date.getUTCMonth() + 1),
- this._2digit(date.getUTCDate())
- ].join('-');
- };
- /**
- * Returns the given value if given a valid Date or null. Deserializes valid ISO 8601 strings
- * (https://www.ietf.org/rfc/rfc3339.txt) into valid Dates and empty string into null. Returns an
- * invalid date for all other values.
- */
- /**
- * Returns the given value if given a valid Date or null. Deserializes valid ISO 8601 strings
- * (https://www.ietf.org/rfc/rfc3339.txt) into valid Dates and empty string into null. Returns an
- * invalid date for all other values.
- * @param {?} value
- * @return {?}
- */
- NativeDateAdapter.prototype.deserialize = /**
- * Returns the given value if given a valid Date or null. Deserializes valid ISO 8601 strings
- * (https://www.ietf.org/rfc/rfc3339.txt) into valid Dates and empty string into null. Returns an
- * invalid date for all other values.
- * @param {?} value
- * @return {?}
- */
- function (value) {
- if (typeof value === 'string') {
- if (!value) {
- return null;
- }
- // The `Date` constructor accepts formats other than ISO 8601, so we need to make sure the
- // string is the right format first.
- if (ISO_8601_REGEX.test(value)) {
- /** @type {?} */
- var date = new Date(value);
- if (this.isValid(date)) {
- return date;
- }
- }
- }
- return _super.prototype.deserialize.call(this, value);
- };
- /**
- * @param {?} obj
- * @return {?}
- */
- NativeDateAdapter.prototype.isDateInstance = /**
- * @param {?} obj
- * @return {?}
- */
- function (obj) {
- return obj instanceof Date;
- };
- /**
- * @param {?} date
- * @return {?}
- */
- NativeDateAdapter.prototype.isValid = /**
- * @param {?} date
- * @return {?}
- */
- function (date) {
- return !isNaN(date.getTime());
- };
- /**
- * @return {?}
- */
- NativeDateAdapter.prototype.invalid = /**
- * @return {?}
- */
- function () {
- return new Date(NaN);
- };
- /** Creates a date but allows the month and date to overflow. */
- /**
- * Creates a date but allows the month and date to overflow.
- * @private
- * @param {?} year
- * @param {?} month
- * @param {?} date
- * @return {?}
- */
- NativeDateAdapter.prototype._createDateWithOverflow = /**
- * Creates a date but allows the month and date to overflow.
- * @private
- * @param {?} year
- * @param {?} month
- * @param {?} date
- * @return {?}
- */
- function (year, month, date) {
- /** @type {?} */
- var result = new Date(year, month, date);
- // We need to correct for the fact that JS native Date treats years in range [0, 99] as
- // abbreviations for 19xx.
- if (year >= 0 && year < 100) {
- result.setFullYear(this.getYear(result) - 1900);
- }
- return result;
- };
- /**
- * Pads a number to make it two digits.
- * @param n The number to pad.
- * @returns The padded number.
- */
- /**
- * Pads a number to make it two digits.
- * @private
- * @param {?} n The number to pad.
- * @return {?} The padded number.
- */
- NativeDateAdapter.prototype._2digit = /**
- * Pads a number to make it two digits.
- * @private
- * @param {?} n The number to pad.
- * @return {?} The padded number.
- */
- function (n) {
- return ('00' + n).slice(-2);
- };
- /**
- * Strip out unicode LTR and RTL characters. Edge and IE insert these into formatted dates while
- * other browsers do not. We remove them to make output consistent and because they interfere with
- * date parsing.
- * @param str The string to strip direction characters from.
- * @returns The stripped string.
- */
- /**
- * Strip out unicode LTR and RTL characters. Edge and IE insert these into formatted dates while
- * other browsers do not. We remove them to make output consistent and because they interfere with
- * date parsing.
- * @private
- * @param {?} str The string to strip direction characters from.
- * @return {?} The stripped string.
- */
- NativeDateAdapter.prototype._stripDirectionalityCharacters = /**
- * Strip out unicode LTR and RTL characters. Edge and IE insert these into formatted dates while
- * other browsers do not. We remove them to make output consistent and because they interfere with
- * date parsing.
- * @private
- * @param {?} str The string to strip direction characters from.
- * @return {?} The stripped string.
- */
- function (str) {
- return str.replace(/[\u200e\u200f]/g, '');
- };
- /**
- * When converting Date object to string, javascript built-in functions may return wrong
- * results because it applies its internal DST rules. The DST rules around the world change
- * very frequently, and the current valid rule is not always valid in previous years though.
- * We work around this problem building a new Date object which has its internal UTC
- * representation with the local date and time.
- * @param dtf Intl.DateTimeFormat object, containg the desired string format. It must have
- * timeZone set to 'utc' to work fine.
- * @param date Date from which we want to get the string representation according to dtf
- * @returns A Date object with its UTC representation based on the passed in date info
- */
- /**
- * When converting Date object to string, javascript built-in functions may return wrong
- * results because it applies its internal DST rules. The DST rules around the world change
- * very frequently, and the current valid rule is not always valid in previous years though.
- * We work around this problem building a new Date object which has its internal UTC
- * representation with the local date and time.
- * @private
- * @param {?} dtf Intl.DateTimeFormat object, containg the desired string format. It must have
- * timeZone set to 'utc' to work fine.
- * @param {?} date Date from which we want to get the string representation according to dtf
- * @return {?} A Date object with its UTC representation based on the passed in date info
- */
- NativeDateAdapter.prototype._format = /**
- * When converting Date object to string, javascript built-in functions may return wrong
- * results because it applies its internal DST rules. The DST rules around the world change
- * very frequently, and the current valid rule is not always valid in previous years though.
- * We work around this problem building a new Date object which has its internal UTC
- * representation with the local date and time.
- * @private
- * @param {?} dtf Intl.DateTimeFormat object, containg the desired string format. It must have
- * timeZone set to 'utc' to work fine.
- * @param {?} date Date from which we want to get the string representation according to dtf
- * @return {?} A Date object with its UTC representation based on the passed in date info
- */
- function (dtf, date) {
- /** @type {?} */
- var d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
- return dtf.format(d);
- };
- NativeDateAdapter.decorators = [
- { type: core.Injectable },
- ];
- /** @nocollapse */
- NativeDateAdapter.ctorParameters = function () { return [
- { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_DATE_LOCALE,] }] },
- { type: platform.Platform }
- ]; };
- return NativeDateAdapter;
- }(DateAdapter));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /** @type {?} */
- var MAT_NATIVE_DATE_FORMATS = {
- parse: {
- dateInput: null,
- },
- display: {
- dateInput: { year: 'numeric', month: 'numeric', day: 'numeric' },
- monthYearLabel: { year: 'numeric', month: 'short' },
- dateA11yLabel: { year: 'numeric', month: 'long', day: 'numeric' },
- monthYearA11yLabel: { year: 'numeric', month: 'long' },
- }
- };
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var NativeDateModule = /** @class */ (function () {
- function NativeDateModule() {
- }
- NativeDateModule.decorators = [
- { type: core.NgModule, args: [{
- imports: [platform.PlatformModule],
- providers: [
- { provide: DateAdapter, useClass: NativeDateAdapter },
- ],
- },] },
- ];
- return NativeDateModule;
- }());
- var ɵ0$1 = MAT_NATIVE_DATE_FORMATS;
- var MatNativeDateModule = /** @class */ (function () {
- function MatNativeDateModule() {
- }
- MatNativeDateModule.decorators = [
- { type: core.NgModule, args: [{
- imports: [NativeDateModule],
- providers: [{ provide: MAT_DATE_FORMATS, useValue: ɵ0$1 }],
- },] },
- ];
- return MatNativeDateModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Error state matcher that matches when a control is invalid and dirty.
- */
- var ShowOnDirtyErrorStateMatcher = /** @class */ (function () {
- function ShowOnDirtyErrorStateMatcher() {
- }
- /**
- * @param {?} control
- * @param {?} form
- * @return {?}
- */
- ShowOnDirtyErrorStateMatcher.prototype.isErrorState = /**
- * @param {?} control
- * @param {?} form
- * @return {?}
- */
- function (control, form) {
- return !!(control && control.invalid && (control.dirty || (form && form.submitted)));
- };
- ShowOnDirtyErrorStateMatcher.decorators = [
- { type: core.Injectable },
- ];
- return ShowOnDirtyErrorStateMatcher;
- }());
- /**
- * Provider that defines how form controls behave with regards to displaying error messages.
- */
- var ErrorStateMatcher = /** @class */ (function () {
- function ErrorStateMatcher() {
- }
- /**
- * @param {?} control
- * @param {?} form
- * @return {?}
- */
- ErrorStateMatcher.prototype.isErrorState = /**
- * @param {?} control
- * @param {?} form
- * @return {?}
- */
- function (control, form) {
- return !!(control && control.invalid && (control.touched || (form && form.submitted)));
- };
- ErrorStateMatcher.decorators = [
- { type: core.Injectable, args: [{ providedIn: 'root' },] },
- ];
- /** @nocollapse */ ErrorStateMatcher.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function ErrorStateMatcher_Factory() { return new ErrorStateMatcher(); }, token: ErrorStateMatcher, providedIn: "root" });
- return ErrorStateMatcher;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Injection token that can be used to provide options to the Hammerjs instance.
- * More info at http://hammerjs.github.io/api/.
- * @type {?}
- */
- var MAT_HAMMER_OPTIONS = new core.InjectionToken('MAT_HAMMER_OPTIONS');
- /** @type {?} */
- var ANGULAR_MATERIAL_SUPPORTED_HAMMER_GESTURES = [
- 'longpress',
- 'slide',
- 'slidestart',
- 'slideend',
- 'slideright',
- 'slideleft'
- ];
- var ɵ0$2 = /**
- * @return {?}
- */
- function () { }, ɵ1 = /**
- * @return {?}
- */
- function () { };
- /**
- * Fake HammerInstance that is used when a Hammer instance is requested when HammerJS has not
- * been loaded on the page.
- * @type {?}
- */
- var noopHammerInstance = {
- on: (ɵ0$2),
- off: (ɵ1),
- };
- /**
- * Adjusts configuration of our gesture library, Hammer.
- */
- var GestureConfig = /** @class */ (function (_super) {
- __extends(GestureConfig, _super);
- function GestureConfig(_hammerOptions, commonModule) {
- var _this = _super.call(this) || this;
- _this._hammerOptions = _hammerOptions;
- /**
- * List of new event names to add to the gesture support list
- */
- _this.events = ANGULAR_MATERIAL_SUPPORTED_HAMMER_GESTURES;
- if (commonModule) {
- commonModule._checkHammerIsAvailable();
- }
- return _this;
- }
- /**
- * Builds Hammer instance manually to add custom recognizers that match the Material Design spec.
- *
- * Our gesture names come from the Material Design gestures spec:
- * https://material.io/design/#gestures-touch-mechanics
- *
- * More information on default recognizers can be found in Hammer docs:
- * http://hammerjs.github.io/recognizer-pan/
- * http://hammerjs.github.io/recognizer-press/
- *
- * @param element Element to which to assign the new HammerJS gestures.
- * @returns Newly-created HammerJS instance.
- */
- /**
- * Builds Hammer instance manually to add custom recognizers that match the Material Design spec.
- *
- * Our gesture names come from the Material Design gestures spec:
- * https://material.io/design/#gestures-touch-mechanics
- *
- * More information on default recognizers can be found in Hammer docs:
- * http://hammerjs.github.io/recognizer-pan/
- * http://hammerjs.github.io/recognizer-press/
- *
- * @param {?} element Element to which to assign the new HammerJS gestures.
- * @return {?} Newly-created HammerJS instance.
- */
- GestureConfig.prototype.buildHammer = /**
- * Builds Hammer instance manually to add custom recognizers that match the Material Design spec.
- *
- * Our gesture names come from the Material Design gestures spec:
- * https://material.io/design/#gestures-touch-mechanics
- *
- * More information on default recognizers can be found in Hammer docs:
- * http://hammerjs.github.io/recognizer-pan/
- * http://hammerjs.github.io/recognizer-press/
- *
- * @param {?} element Element to which to assign the new HammerJS gestures.
- * @return {?} Newly-created HammerJS instance.
- */
- function (element) {
- /** @type {?} */
- var hammer = typeof window !== 'undefined' ? ((/** @type {?} */ (window))).Hammer : null;
- if (!hammer) {
- // If HammerJS is not loaded here, return the noop HammerInstance. This is necessary to
- // ensure that omitting HammerJS completely will not cause any errors while *also* supporting
- // the lazy-loading of HammerJS via the HAMMER_LOADER token introduced in Angular 6.1.
- // Because we can't depend on HAMMER_LOADER's existance until 7.0, we have to always set
- // `this.events` to the set we support, instead of conditionally setting it to `[]` if
- // `HAMMER_LOADER` is present (and then throwing an Error here if `window.Hammer` is
- // undefined).
- // @breaking-change 8.0.0
- return noopHammerInstance;
- }
- /** @type {?} */
- var mc = new hammer(element, this._hammerOptions || undefined);
- // Default Hammer Recognizers.
- /** @type {?} */
- var pan = new hammer.Pan();
- /** @type {?} */
- var swipe = new hammer.Swipe();
- /** @type {?} */
- var press = new hammer.Press();
- // Notice that a HammerJS recognizer can only depend on one other recognizer once.
- // Otherwise the previous `recognizeWith` will be dropped.
- // TODO: Confirm threshold numbers with Material Design UX Team
- /** @type {?} */
- var slide = this._createRecognizer(pan, { event: 'slide', threshold: 0 }, swipe);
- /** @type {?} */
- var longpress = this._createRecognizer(press, { event: 'longpress', time: 500 });
- // Overwrite the default `pan` event to use the swipe event.
- pan.recognizeWith(swipe);
- // Since the slide event threshold is set to zero, the slide recognizer can fire and
- // accidentally reset the longpress recognizer. In order to make sure that the two
- // recognizers can run simultaneously but don't affect each other, we allow the slide
- // recognizer to recognize while a longpress is being processed.
- // See: https://github.com/hammerjs/hammer.js/blob/master/src/manager.js#L123-L124
- longpress.recognizeWith(slide);
- // Add customized gestures to Hammer manager
- mc.add([swipe, press, pan, slide, longpress]);
- return (/** @type {?} */ (mc));
- };
- /** Creates a new recognizer, without affecting the default recognizers of HammerJS */
- /**
- * Creates a new recognizer, without affecting the default recognizers of HammerJS
- * @private
- * @param {?} base
- * @param {?} options
- * @param {...?} inheritances
- * @return {?}
- */
- GestureConfig.prototype._createRecognizer = /**
- * Creates a new recognizer, without affecting the default recognizers of HammerJS
- * @private
- * @param {?} base
- * @param {?} options
- * @param {...?} inheritances
- * @return {?}
- */
- function (base, options) {
- var inheritances = [];
- for (var _i = 2; _i < arguments.length; _i++) {
- inheritances[_i - 2] = arguments[_i];
- }
- /** @type {?} */
- var recognizer = new ((/** @type {?} */ (base.constructor)))(options);
- inheritances.push(base);
- inheritances.forEach((/**
- * @param {?} item
- * @return {?}
- */
- function (item) { return recognizer.recognizeWith(item); }));
- return recognizer;
- };
- GestureConfig.decorators = [
- { type: core.Injectable },
- ];
- /** @nocollapse */
- GestureConfig.ctorParameters = function () { return [
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_HAMMER_OPTIONS,] }] },
- { type: MatCommonModule, decorators: [{ type: core.Optional }] }
- ]; };
- return GestureConfig;
- }(platformBrowser.HammerGestureConfig));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Shared directive to count lines inside a text area, such as a list item.
- * Line elements can be extracted with a \@ContentChildren(MatLine) query, then
- * counted by checking the query list's length.
- */
- var MatLine = /** @class */ (function () {
- function MatLine() {
- }
- MatLine.decorators = [
- { type: core.Directive, args: [{
- selector: '[mat-line], [matLine]',
- host: { 'class': 'mat-line' }
- },] },
- ];
- return MatLine;
- }());
- /**
- * Helper that takes a query list of lines and sets the correct class on the host.
- * \@docs-private
- * @param {?} lines
- * @param {?} element
- * @return {?}
- */
- function setLines(lines, element) {
- // Note: doesn't need to unsubscribe, because `changes`
- // gets completed by Angular when the view is destroyed.
- lines.changes.pipe(operators.startWith(lines)).subscribe((/**
- * @param {?} __0
- * @return {?}
- */
- function (_a) {
- var length = _a.length;
- setClass(element, 'mat-2-line', false);
- setClass(element, 'mat-3-line', false);
- setClass(element, 'mat-multi-line', false);
- if (length === 2 || length === 3) {
- setClass(element, "mat-" + length + "-line", true);
- }
- else if (length > 3) {
- setClass(element, "mat-multi-line", true);
- }
- }));
- }
- /**
- * Adds or removes a class from an element.
- * @param {?} element
- * @param {?} className
- * @param {?} isAdd
- * @return {?}
- */
- function setClass(element, className, isAdd) {
- /** @type {?} */
- var classList = element.nativeElement.classList;
- isAdd ? classList.add(className) : classList.remove(className);
- }
- /**
- * Helper that takes a query list of lines and sets the correct class on the host.
- * \@docs-private
- * @deprecated Use `setLines` instead.
- * \@breaking-change 8.0.0
- */
- var /**
- * Helper that takes a query list of lines and sets the correct class on the host.
- * \@docs-private
- * @deprecated Use `setLines` instead.
- * \@breaking-change 8.0.0
- */
- MatLineSetter = /** @class */ (function () {
- function MatLineSetter(lines, element) {
- setLines(lines, element);
- }
- return MatLineSetter;
- }());
- var MatLineModule = /** @class */ (function () {
- function MatLineModule() {
- }
- MatLineModule.decorators = [
- { type: core.NgModule, args: [{
- imports: [MatCommonModule],
- exports: [MatLine, MatCommonModule],
- declarations: [MatLine],
- },] },
- ];
- return MatLineModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /** @enum {number} */
- var RippleState = {
- FADING_IN: 0, VISIBLE: 1, FADING_OUT: 2, HIDDEN: 3,
- };
- RippleState[RippleState.FADING_IN] = 'FADING_IN';
- RippleState[RippleState.VISIBLE] = 'VISIBLE';
- RippleState[RippleState.FADING_OUT] = 'FADING_OUT';
- RippleState[RippleState.HIDDEN] = 'HIDDEN';
- /**
- * Reference to a previously launched ripple element.
- */
- var /**
- * Reference to a previously launched ripple element.
- */
- RippleRef = /** @class */ (function () {
- function RippleRef(_renderer, element, config) {
- this._renderer = _renderer;
- this.element = element;
- this.config = config;
- /**
- * Current state of the ripple.
- */
- this.state = RippleState.HIDDEN;
- }
- /** Fades out the ripple element. */
- /**
- * Fades out the ripple element.
- * @return {?}
- */
- RippleRef.prototype.fadeOut = /**
- * Fades out the ripple element.
- * @return {?}
- */
- function () {
- this._renderer.fadeOutRipple(this);
- };
- return RippleRef;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Default ripple animation configuration for ripples without an explicit
- * animation config specified.
- * @type {?}
- */
- var defaultRippleAnimationConfig = {
- enterDuration: 450,
- exitDuration: 400
- };
- /**
- * Timeout for ignoring mouse events. Mouse events will be temporary ignored after touch
- * events to avoid synthetic mouse events.
- * @type {?}
- */
- var ignoreMouseEventsTimeout = 800;
- /**
- * Options that apply to all the event listeners that are bound by the ripple renderer.
- * @type {?}
- */
- var passiveEventOptions = platform.normalizePassiveListenerOptions({ passive: true });
- /**
- * Helper service that performs DOM manipulations. Not intended to be used outside this module.
- * The constructor takes a reference to the ripple directive's host element and a map of DOM
- * event handlers to be installed on the element that triggers ripple animations.
- * This will eventually become a custom renderer once Angular support exists.
- * \@docs-private
- */
- var /**
- * Helper service that performs DOM manipulations. Not intended to be used outside this module.
- * The constructor takes a reference to the ripple directive's host element and a map of DOM
- * event handlers to be installed on the element that triggers ripple animations.
- * This will eventually become a custom renderer once Angular support exists.
- * \@docs-private
- */
- RippleRenderer = /** @class */ (function () {
- function RippleRenderer(_target, _ngZone, elementRef, platform$$1) {
- var _this = this;
- this._target = _target;
- this._ngZone = _ngZone;
- /**
- * Whether the pointer is currently down or not.
- */
- this._isPointerDown = false;
- /**
- * Events to be registered on the trigger element.
- */
- this._triggerEvents = new Map();
- /**
- * Set of currently active ripple references.
- */
- this._activeRipples = new Set();
- /**
- * Function being called whenever the trigger is being pressed using mouse.
- */
- this._onMousedown = (/**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- // Screen readers will fire fake mouse events for space/enter. Skip launching a
- // ripple in this case for consistency with the non-screen-reader experience.
- /** @type {?} */
- var isFakeMousedown = a11y.isFakeMousedownFromScreenReader(event);
- /** @type {?} */
- var isSyntheticEvent = _this._lastTouchStartEvent &&
- Date.now() < _this._lastTouchStartEvent + ignoreMouseEventsTimeout;
- if (!_this._target.rippleDisabled && !isFakeMousedown && !isSyntheticEvent) {
- _this._isPointerDown = true;
- _this.fadeInRipple(event.clientX, event.clientY, _this._target.rippleConfig);
- }
- });
- /**
- * Function being called whenever the trigger is being pressed using touch.
- */
- this._onTouchStart = (/**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- if (!_this._target.rippleDisabled) {
- // Some browsers fire mouse events after a `touchstart` event. Those synthetic mouse
- // events will launch a second ripple if we don't ignore mouse events for a specific
- // time after a touchstart event.
- _this._lastTouchStartEvent = Date.now();
- _this._isPointerDown = true;
- // Use `changedTouches` so we skip any touches where the user put
- // their finger down, but used another finger to tap the element again.
- /** @type {?} */
- var touches = event.changedTouches;
- for (var i = 0; i < touches.length; i++) {
- _this.fadeInRipple(touches[i].clientX, touches[i].clientY, _this._target.rippleConfig);
- }
- }
- });
- /**
- * Function being called whenever the trigger is being released.
- */
- this._onPointerUp = (/**
- * @return {?}
- */
- function () {
- if (!_this._isPointerDown) {
- return;
- }
- _this._isPointerDown = false;
- // Fade-out all ripples that are visible and not persistent.
- _this._activeRipples.forEach((/**
- * @param {?} ripple
- * @return {?}
- */
- function (ripple) {
- // By default, only ripples that are completely visible will fade out on pointer release.
- // If the `terminateOnPointerUp` option is set, ripples that still fade in will also fade out.
- /** @type {?} */
- var isVisible = ripple.state === RippleState.VISIBLE ||
- ripple.config.terminateOnPointerUp && ripple.state === RippleState.FADING_IN;
- if (!ripple.config.persistent && isVisible) {
- ripple.fadeOut();
- }
- }));
- });
- // Only do anything if we're on the browser.
- if (platform$$1.isBrowser) {
- this._containerElement = elementRef.nativeElement;
- // Specify events which need to be registered on the trigger.
- this._triggerEvents
- .set('mousedown', this._onMousedown)
- .set('mouseup', this._onPointerUp)
- .set('mouseleave', this._onPointerUp)
- .set('touchstart', this._onTouchStart)
- .set('touchend', this._onPointerUp)
- .set('touchcancel', this._onPointerUp);
- }
- }
- /**
- * Fades in a ripple at the given coordinates.
- * @param x Coordinate within the element, along the X axis at which to start the ripple.
- * @param y Coordinate within the element, along the Y axis at which to start the ripple.
- * @param config Extra ripple options.
- */
- /**
- * Fades in a ripple at the given coordinates.
- * @param {?} x Coordinate within the element, along the X axis at which to start the ripple.
- * @param {?} y Coordinate within the element, along the Y axis at which to start the ripple.
- * @param {?=} config Extra ripple options.
- * @return {?}
- */
- RippleRenderer.prototype.fadeInRipple = /**
- * Fades in a ripple at the given coordinates.
- * @param {?} x Coordinate within the element, along the X axis at which to start the ripple.
- * @param {?} y Coordinate within the element, along the Y axis at which to start the ripple.
- * @param {?=} config Extra ripple options.
- * @return {?}
- */
- function (x, y, config) {
- var _this = this;
- if (config === void 0) { config = {}; }
- /** @type {?} */
- var containerRect = this._containerRect =
- this._containerRect || this._containerElement.getBoundingClientRect();
- /** @type {?} */
- var animationConfig = __assign({}, defaultRippleAnimationConfig, config.animation);
- if (config.centered) {
- x = containerRect.left + containerRect.width / 2;
- y = containerRect.top + containerRect.height / 2;
- }
- /** @type {?} */
- var radius = config.radius || distanceToFurthestCorner(x, y, containerRect);
- /** @type {?} */
- var offsetX = x - containerRect.left;
- /** @type {?} */
- var offsetY = y - containerRect.top;
- /** @type {?} */
- var duration = animationConfig.enterDuration;
- /** @type {?} */
- var ripple = document.createElement('div');
- ripple.classList.add('mat-ripple-element');
- ripple.style.left = offsetX - radius + "px";
- ripple.style.top = offsetY - radius + "px";
- ripple.style.height = radius * 2 + "px";
- ripple.style.width = radius * 2 + "px";
- // If the color is not set, the default CSS color will be used.
- ripple.style.backgroundColor = config.color || null;
- ripple.style.transitionDuration = duration + "ms";
- this._containerElement.appendChild(ripple);
- // By default the browser does not recalculate the styles of dynamically created
- // ripple elements. This is critical because then the `scale` would not animate properly.
- enforceStyleRecalculation(ripple);
- ripple.style.transform = 'scale(1)';
- // Exposed reference to the ripple that will be returned.
- /** @type {?} */
- var rippleRef = new RippleRef(this, ripple, config);
- rippleRef.state = RippleState.FADING_IN;
- // Add the ripple reference to the list of all active ripples.
- this._activeRipples.add(rippleRef);
- if (!config.persistent) {
- this._mostRecentTransientRipple = rippleRef;
- }
- // Wait for the ripple element to be completely faded in.
- // Once it's faded in, the ripple can be hidden immediately if the mouse is released.
- this._runTimeoutOutsideZone((/**
- * @return {?}
- */
- function () {
- /** @type {?} */
- var isMostRecentTransientRipple = rippleRef === _this._mostRecentTransientRipple;
- rippleRef.state = RippleState.VISIBLE;
- // When the timer runs out while the user has kept their pointer down, we want to
- // keep only the persistent ripples and the latest transient ripple. We do this,
- // because we don't want stacked transient ripples to appear after their enter
- // animation has finished.
- if (!config.persistent && (!isMostRecentTransientRipple || !_this._isPointerDown)) {
- rippleRef.fadeOut();
- }
- }), duration);
- return rippleRef;
- };
- /** Fades out a ripple reference. */
- /**
- * Fades out a ripple reference.
- * @param {?} rippleRef
- * @return {?}
- */
- RippleRenderer.prototype.fadeOutRipple = /**
- * Fades out a ripple reference.
- * @param {?} rippleRef
- * @return {?}
- */
- function (rippleRef) {
- /** @type {?} */
- var wasActive = this._activeRipples.delete(rippleRef);
- if (rippleRef === this._mostRecentTransientRipple) {
- this._mostRecentTransientRipple = null;
- }
- // Clear out the cached bounding rect if we have no more ripples.
- if (!this._activeRipples.size) {
- this._containerRect = null;
- }
- // For ripples that are not active anymore, don't re-run the fade-out animation.
- if (!wasActive) {
- return;
- }
- /** @type {?} */
- var rippleEl = rippleRef.element;
- /** @type {?} */
- var animationConfig = __assign({}, defaultRippleAnimationConfig, rippleRef.config.animation);
- rippleEl.style.transitionDuration = animationConfig.exitDuration + "ms";
- rippleEl.style.opacity = '0';
- rippleRef.state = RippleState.FADING_OUT;
- // Once the ripple faded out, the ripple can be safely removed from the DOM.
- this._runTimeoutOutsideZone((/**
- * @return {?}
- */
- function () {
- rippleRef.state = RippleState.HIDDEN;
- (/** @type {?} */ (rippleEl.parentNode)).removeChild(rippleEl);
- }), animationConfig.exitDuration);
- };
- /** Fades out all currently active ripples. */
- /**
- * Fades out all currently active ripples.
- * @return {?}
- */
- RippleRenderer.prototype.fadeOutAll = /**
- * Fades out all currently active ripples.
- * @return {?}
- */
- function () {
- this._activeRipples.forEach((/**
- * @param {?} ripple
- * @return {?}
- */
- function (ripple) { return ripple.fadeOut(); }));
- };
- /** Sets up the trigger event listeners */
- /**
- * Sets up the trigger event listeners
- * @param {?} element
- * @return {?}
- */
- RippleRenderer.prototype.setupTriggerEvents = /**
- * Sets up the trigger event listeners
- * @param {?} element
- * @return {?}
- */
- function (element) {
- var _this = this;
- if (!element || element === this._triggerElement) {
- return;
- }
- // Remove all previously registered event listeners from the trigger element.
- this._removeTriggerEvents();
- this._ngZone.runOutsideAngular((/**
- * @return {?}
- */
- function () {
- _this._triggerEvents.forEach((/**
- * @param {?} fn
- * @param {?} type
- * @return {?}
- */
- function (fn, type) {
- element.addEventListener(type, fn, passiveEventOptions);
- }));
- }));
- this._triggerElement = element;
- };
- /** Runs a timeout outside of the Angular zone to avoid triggering the change detection. */
- /**
- * Runs a timeout outside of the Angular zone to avoid triggering the change detection.
- * @private
- * @param {?} fn
- * @param {?=} delay
- * @return {?}
- */
- RippleRenderer.prototype._runTimeoutOutsideZone = /**
- * Runs a timeout outside of the Angular zone to avoid triggering the change detection.
- * @private
- * @param {?} fn
- * @param {?=} delay
- * @return {?}
- */
- function (fn, delay) {
- if (delay === void 0) { delay = 0; }
- this._ngZone.runOutsideAngular((/**
- * @return {?}
- */
- function () { return setTimeout(fn, delay); }));
- };
- /** Removes previously registered event listeners from the trigger element. */
- /**
- * Removes previously registered event listeners from the trigger element.
- * @return {?}
- */
- RippleRenderer.prototype._removeTriggerEvents = /**
- * Removes previously registered event listeners from the trigger element.
- * @return {?}
- */
- function () {
- var _this = this;
- if (this._triggerElement) {
- this._triggerEvents.forEach((/**
- * @param {?} fn
- * @param {?} type
- * @return {?}
- */
- function (fn, type) {
- (/** @type {?} */ (_this._triggerElement)).removeEventListener(type, fn, passiveEventOptions);
- }));
- }
- };
- return RippleRenderer;
- }());
- /**
- * Enforces a style recalculation of a DOM element by computing its styles.
- * @param {?} element
- * @return {?}
- */
- function enforceStyleRecalculation(element) {
- // Enforce a style recalculation by calling `getComputedStyle` and accessing any property.
- // Calling `getPropertyValue` is important to let optimizers know that this is not a noop.
- // See: https://gist.github.com/paulirish/5d52fb081b3570c81e3a
- window.getComputedStyle(element).getPropertyValue('opacity');
- }
- /**
- * Returns the distance from the point (x, y) to the furthest corner of a rectangle.
- * @param {?} x
- * @param {?} y
- * @param {?} rect
- * @return {?}
- */
- function distanceToFurthestCorner(x, y, rect) {
- /** @type {?} */
- var distX = Math.max(Math.abs(x - rect.left), Math.abs(x - rect.right));
- /** @type {?} */
- var distY = Math.max(Math.abs(y - rect.top), Math.abs(y - rect.bottom));
- return Math.sqrt(distX * distX + distY * distY);
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Injection token that can be used to specify the global ripple options.
- * @type {?}
- */
- var MAT_RIPPLE_GLOBAL_OPTIONS = new core.InjectionToken('mat-ripple-global-options');
- var MatRipple = /** @class */ (function () {
- function MatRipple(_elementRef, ngZone, platform$$1, globalOptions, animationMode) {
- this._elementRef = _elementRef;
- /**
- * If set, the radius in pixels of foreground ripples when fully expanded. If unset, the radius
- * will be the distance from the center of the ripple to the furthest corner of the host element's
- * bounding rectangle.
- */
- this.radius = 0;
- this._disabled = false;
- /**
- * Whether ripple directive is initialized and the input bindings are set.
- */
- this._isInitialized = false;
- this._globalOptions = globalOptions || {};
- this._rippleRenderer = new RippleRenderer(this, ngZone, _elementRef, platform$$1);
- if (animationMode === 'NoopAnimations') {
- this._globalOptions.animation = { enterDuration: 0, exitDuration: 0 };
- }
- }
- Object.defineProperty(MatRipple.prototype, "disabled", {
- /**
- * Whether click events will not trigger the ripple. Ripples can be still launched manually
- * by using the `launch()` method.
- */
- get: /**
- * Whether click events will not trigger the ripple. Ripples can be still launched manually
- * by using the `launch()` method.
- * @return {?}
- */
- function () { return this._disabled; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._disabled = value;
- this._setupTriggerEventsIfEnabled();
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatRipple.prototype, "trigger", {
- /**
- * The element that triggers the ripple when click events are received.
- * Defaults to the directive's host element.
- */
- get: /**
- * The element that triggers the ripple when click events are received.
- * Defaults to the directive's host element.
- * @return {?}
- */
- function () { return this._trigger || this._elementRef.nativeElement; },
- set: /**
- * @param {?} trigger
- * @return {?}
- */
- function (trigger) {
- this._trigger = trigger;
- this._setupTriggerEventsIfEnabled();
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- MatRipple.prototype.ngOnInit = /**
- * @return {?}
- */
- function () {
- this._isInitialized = true;
- this._setupTriggerEventsIfEnabled();
- };
- /**
- * @return {?}
- */
- MatRipple.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- this._rippleRenderer._removeTriggerEvents();
- };
- /** Fades out all currently showing ripple elements. */
- /**
- * Fades out all currently showing ripple elements.
- * @return {?}
- */
- MatRipple.prototype.fadeOutAll = /**
- * Fades out all currently showing ripple elements.
- * @return {?}
- */
- function () {
- this._rippleRenderer.fadeOutAll();
- };
- Object.defineProperty(MatRipple.prototype, "rippleConfig", {
- /**
- * Ripple configuration from the directive's input values.
- * @docs-private Implemented as part of RippleTarget
- */
- get: /**
- * Ripple configuration from the directive's input values.
- * \@docs-private Implemented as part of RippleTarget
- * @return {?}
- */
- function () {
- return {
- centered: this.centered,
- radius: this.radius,
- color: this.color,
- animation: __assign({}, this._globalOptions.animation, this.animation),
- terminateOnPointerUp: this._globalOptions.terminateOnPointerUp,
- };
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatRipple.prototype, "rippleDisabled", {
- /**
- * Whether ripples on pointer-down are disabled or not.
- * @docs-private Implemented as part of RippleTarget
- */
- get: /**
- * Whether ripples on pointer-down are disabled or not.
- * \@docs-private Implemented as part of RippleTarget
- * @return {?}
- */
- function () {
- return this.disabled || !!this._globalOptions.disabled;
- },
- enumerable: true,
- configurable: true
- });
- /** Sets up the trigger event listeners if ripples are enabled. */
- /**
- * Sets up the trigger event listeners if ripples are enabled.
- * @private
- * @return {?}
- */
- MatRipple.prototype._setupTriggerEventsIfEnabled = /**
- * Sets up the trigger event listeners if ripples are enabled.
- * @private
- * @return {?}
- */
- function () {
- if (!this.disabled && this._isInitialized) {
- this._rippleRenderer.setupTriggerEvents(this.trigger);
- }
- };
- /** Launches a manual ripple at the specified coordinated or just by the ripple config. */
- /**
- * Launches a manual ripple at the specified coordinated or just by the ripple config.
- * @param {?} configOrX
- * @param {?=} y
- * @param {?=} config
- * @return {?}
- */
- MatRipple.prototype.launch = /**
- * Launches a manual ripple at the specified coordinated or just by the ripple config.
- * @param {?} configOrX
- * @param {?=} y
- * @param {?=} config
- * @return {?}
- */
- function (configOrX, y, config) {
- if (y === void 0) { y = 0; }
- if (typeof configOrX === 'number') {
- return this._rippleRenderer.fadeInRipple(configOrX, y, __assign({}, this.rippleConfig, config));
- }
- else {
- return this._rippleRenderer.fadeInRipple(0, 0, __assign({}, this.rippleConfig, configOrX));
- }
- };
- MatRipple.decorators = [
- { type: core.Directive, args: [{
- selector: '[mat-ripple], [matRipple]',
- exportAs: 'matRipple',
- host: {
- 'class': 'mat-ripple',
- '[class.mat-ripple-unbounded]': 'unbounded'
- }
- },] },
- ];
- /** @nocollapse */
- MatRipple.ctorParameters = function () { return [
- { type: core.ElementRef },
- { type: core.NgZone },
- { type: platform.Platform },
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_RIPPLE_GLOBAL_OPTIONS,] }] },
- { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
- ]; };
- MatRipple.propDecorators = {
- color: [{ type: core.Input, args: ['matRippleColor',] }],
- unbounded: [{ type: core.Input, args: ['matRippleUnbounded',] }],
- centered: [{ type: core.Input, args: ['matRippleCentered',] }],
- radius: [{ type: core.Input, args: ['matRippleRadius',] }],
- animation: [{ type: core.Input, args: ['matRippleAnimation',] }],
- disabled: [{ type: core.Input, args: ['matRippleDisabled',] }],
- trigger: [{ type: core.Input, args: ['matRippleTrigger',] }]
- };
- return MatRipple;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var MatRippleModule = /** @class */ (function () {
- function MatRippleModule() {
- }
- MatRippleModule.decorators = [
- { type: core.NgModule, args: [{
- imports: [MatCommonModule, platform.PlatformModule],
- exports: [MatRipple, MatCommonModule],
- declarations: [MatRipple],
- },] },
- ];
- return MatRippleModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Component that shows a simplified checkbox without including any kind of "real" checkbox.
- * Meant to be used when the checkbox is purely decorative and a large number of them will be
- * included, such as for the options in a multi-select. Uses no SVGs or complex animations.
- * Note that theming is meant to be handled by the parent element, e.g.
- * `mat-primary .mat-pseudo-checkbox`.
- *
- * Note that this component will be completely invisible to screen-reader users. This is *not*
- * interchangeable with `<mat-checkbox>` and should *not* be used if the user would directly
- * interact with the checkbox. The pseudo-checkbox should only be used as an implementation detail
- * of more complex components that appropriately handle selected / checked state.
- * \@docs-private
- */
- var MatPseudoCheckbox = /** @class */ (function () {
- function MatPseudoCheckbox(_animationMode) {
- this._animationMode = _animationMode;
- /**
- * Display state of the checkbox.
- */
- this.state = 'unchecked';
- /**
- * Whether the checkbox is disabled.
- */
- this.disabled = false;
- }
- MatPseudoCheckbox.decorators = [
- { type: core.Component, args: [{encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- selector: 'mat-pseudo-checkbox',
- styles: [".mat-pseudo-checkbox{width:16px;height:16px;border:2px solid;border-radius:2px;cursor:pointer;display:inline-block;vertical-align:middle;box-sizing:border-box;position:relative;flex-shrink:0;transition:border-color 90ms cubic-bezier(0,0,.2,.1),background-color 90ms cubic-bezier(0,0,.2,.1)}.mat-pseudo-checkbox::after{position:absolute;opacity:0;content:'';border-bottom:2px solid currentColor;transition:opacity 90ms cubic-bezier(0,0,.2,.1)}.mat-pseudo-checkbox.mat-pseudo-checkbox-checked,.mat-pseudo-checkbox.mat-pseudo-checkbox-indeterminate{border-color:transparent}._mat-animation-noopable.mat-pseudo-checkbox{transition:none;animation:none}._mat-animation-noopable.mat-pseudo-checkbox::after{transition:none}.mat-pseudo-checkbox-disabled{cursor:default}.mat-pseudo-checkbox-indeterminate::after{top:5px;left:1px;width:10px;opacity:1;border-radius:2px}.mat-pseudo-checkbox-checked::after{top:2.4px;left:1px;width:8px;height:3px;border-left:2px solid currentColor;transform:rotate(-45deg);opacity:1;box-sizing:content-box}"],
- template: '',
- host: {
- 'class': 'mat-pseudo-checkbox',
- '[class.mat-pseudo-checkbox-indeterminate]': 'state === "indeterminate"',
- '[class.mat-pseudo-checkbox-checked]': 'state === "checked"',
- '[class.mat-pseudo-checkbox-disabled]': 'disabled',
- '[class._mat-animation-noopable]': '_animationMode === "NoopAnimations"',
- },
- },] },
- ];
- /** @nocollapse */
- MatPseudoCheckbox.ctorParameters = function () { return [
- { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
- ]; };
- MatPseudoCheckbox.propDecorators = {
- state: [{ type: core.Input }],
- disabled: [{ type: core.Input }]
- };
- return MatPseudoCheckbox;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var MatPseudoCheckboxModule = /** @class */ (function () {
- function MatPseudoCheckboxModule() {
- }
- MatPseudoCheckboxModule.decorators = [
- { type: core.NgModule, args: [{
- exports: [MatPseudoCheckbox],
- declarations: [MatPseudoCheckbox]
- },] },
- ];
- return MatPseudoCheckboxModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- // Boilerplate for applying mixins to MatOptgroup.
- /**
- * \@docs-private
- */
- var
- // Boilerplate for applying mixins to MatOptgroup.
- /**
- * \@docs-private
- */
- MatOptgroupBase = /** @class */ (function () {
- function MatOptgroupBase() {
- }
- return MatOptgroupBase;
- }());
- /** @type {?} */
- var _MatOptgroupMixinBase = mixinDisabled(MatOptgroupBase);
- // Counter for unique group ids.
- /** @type {?} */
- var _uniqueOptgroupIdCounter = 0;
- /**
- * Component that is used to group instances of `mat-option`.
- */
- var MatOptgroup = /** @class */ (function (_super) {
- __extends(MatOptgroup, _super);
- function MatOptgroup() {
- var _this = _super !== null && _super.apply(this, arguments) || this;
- /**
- * Unique id for the underlying label.
- */
- _this._labelId = "mat-optgroup-label-" + _uniqueOptgroupIdCounter++;
- return _this;
- }
- MatOptgroup.decorators = [
- { type: core.Component, args: [{selector: 'mat-optgroup',
- exportAs: 'matOptgroup',
- template: "<label class=\"mat-optgroup-label\" [id]=\"_labelId\">{{ label }}<ng-content></ng-content></label><ng-content select=\"mat-option, ng-container\"></ng-content>",
- encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- inputs: ['disabled'],
- styles: [".mat-optgroup-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block;line-height:48px;height:48px;padding:0 16px;text-align:left;text-decoration:none;max-width:100%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.mat-optgroup-label[disabled]{cursor:default}[dir=rtl] .mat-optgroup-label{text-align:right}.mat-optgroup-label .mat-icon{margin-right:16px;vertical-align:middle}.mat-optgroup-label .mat-icon svg{vertical-align:top}[dir=rtl] .mat-optgroup-label .mat-icon{margin-left:16px;margin-right:0}"],
- host: {
- 'class': 'mat-optgroup',
- 'role': 'group',
- '[class.mat-optgroup-disabled]': 'disabled',
- '[attr.aria-disabled]': 'disabled.toString()',
- '[attr.aria-labelledby]': '_labelId',
- }
- },] },
- ];
- MatOptgroup.propDecorators = {
- label: [{ type: core.Input }]
- };
- return MatOptgroup;
- }(_MatOptgroupMixinBase));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Option IDs need to be unique across components, so this counter exists outside of
- * the component definition.
- * @type {?}
- */
- var _uniqueIdCounter = 0;
- /**
- * Event object emitted by MatOption when selected or deselected.
- */
- var /**
- * Event object emitted by MatOption when selected or deselected.
- */
- MatOptionSelectionChange = /** @class */ (function () {
- function MatOptionSelectionChange(source, isUserInput) {
- if (isUserInput === void 0) { isUserInput = false; }
- this.source = source;
- this.isUserInput = isUserInput;
- }
- return MatOptionSelectionChange;
- }());
- /**
- * Injection token used to provide the parent component to options.
- * @type {?}
- */
- var MAT_OPTION_PARENT_COMPONENT = new core.InjectionToken('MAT_OPTION_PARENT_COMPONENT');
- /**
- * Single option inside of a `<mat-select>` element.
- */
- var MatOption = /** @class */ (function () {
- function MatOption(_element, _changeDetectorRef, _parent, group) {
- this._element = _element;
- this._changeDetectorRef = _changeDetectorRef;
- this._parent = _parent;
- this.group = group;
- this._selected = false;
- this._active = false;
- this._disabled = false;
- this._mostRecentViewValue = '';
- /**
- * The unique ID of the option.
- */
- this.id = "mat-option-" + _uniqueIdCounter++;
- /**
- * Event emitted when the option is selected or deselected.
- */
- // tslint:disable-next-line:no-output-on-prefix
- this.onSelectionChange = new core.EventEmitter();
- /**
- * Emits when the state of the option changes and any parents have to be notified.
- */
- this._stateChanges = new rxjs.Subject();
- }
- Object.defineProperty(MatOption.prototype, "multiple", {
- /** Whether the wrapping component is in multiple selection mode. */
- get: /**
- * Whether the wrapping component is in multiple selection mode.
- * @return {?}
- */
- function () { return this._parent && this._parent.multiple; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatOption.prototype, "selected", {
- /** Whether or not the option is currently selected. */
- get: /**
- * Whether or not the option is currently selected.
- * @return {?}
- */
- function () { return this._selected; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatOption.prototype, "disabled", {
- /** Whether the option is disabled. */
- get: /**
- * Whether the option is disabled.
- * @return {?}
- */
- function () { return (this.group && this.group.disabled) || this._disabled; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) { this._disabled = coercion.coerceBooleanProperty(value); },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatOption.prototype, "disableRipple", {
- /** Whether ripples for the option are disabled. */
- get: /**
- * Whether ripples for the option are disabled.
- * @return {?}
- */
- function () { return this._parent && this._parent.disableRipple; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatOption.prototype, "active", {
- /**
- * Whether or not the option is currently active and ready to be selected.
- * An active option displays styles as if it is focused, but the
- * focus is actually retained somewhere else. This comes in handy
- * for components like autocomplete where focus must remain on the input.
- */
- get: /**
- * Whether or not the option is currently active and ready to be selected.
- * An active option displays styles as if it is focused, but the
- * focus is actually retained somewhere else. This comes in handy
- * for components like autocomplete where focus must remain on the input.
- * @return {?}
- */
- function () {
- return this._active;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatOption.prototype, "viewValue", {
- /**
- * The displayed value of the option. It is necessary to show the selected option in the
- * select's trigger.
- */
- get: /**
- * The displayed value of the option. It is necessary to show the selected option in the
- * select's trigger.
- * @return {?}
- */
- function () {
- // TODO(kara): Add input property alternative for node envs.
- return (this._getHostElement().textContent || '').trim();
- },
- enumerable: true,
- configurable: true
- });
- /** Selects the option. */
- /**
- * Selects the option.
- * @return {?}
- */
- MatOption.prototype.select = /**
- * Selects the option.
- * @return {?}
- */
- function () {
- if (!this._selected) {
- this._selected = true;
- this._changeDetectorRef.markForCheck();
- this._emitSelectionChangeEvent();
- }
- };
- /** Deselects the option. */
- /**
- * Deselects the option.
- * @return {?}
- */
- MatOption.prototype.deselect = /**
- * Deselects the option.
- * @return {?}
- */
- function () {
- if (this._selected) {
- this._selected = false;
- this._changeDetectorRef.markForCheck();
- this._emitSelectionChangeEvent();
- }
- };
- /** Sets focus onto this option. */
- /**
- * Sets focus onto this option.
- * @param {?=} _origin
- * @param {?=} options
- * @return {?}
- */
- MatOption.prototype.focus = /**
- * Sets focus onto this option.
- * @param {?=} _origin
- * @param {?=} options
- * @return {?}
- */
- function (_origin, options) {
- // Note that we aren't using `_origin`, but we need to keep it because some internal consumers
- // use `MatOption` in a `FocusKeyManager` and we need it to match `FocusableOption`.
- /** @type {?} */
- var element = this._getHostElement();
- if (typeof element.focus === 'function') {
- element.focus(options);
- }
- };
- /**
- * This method sets display styles on the option to make it appear
- * active. This is used by the ActiveDescendantKeyManager so key
- * events will display the proper options as active on arrow key events.
- */
- /**
- * This method sets display styles on the option to make it appear
- * active. This is used by the ActiveDescendantKeyManager so key
- * events will display the proper options as active on arrow key events.
- * @return {?}
- */
- MatOption.prototype.setActiveStyles = /**
- * This method sets display styles on the option to make it appear
- * active. This is used by the ActiveDescendantKeyManager so key
- * events will display the proper options as active on arrow key events.
- * @return {?}
- */
- function () {
- if (!this._active) {
- this._active = true;
- this._changeDetectorRef.markForCheck();
- }
- };
- /**
- * This method removes display styles on the option that made it appear
- * active. This is used by the ActiveDescendantKeyManager so key
- * events will display the proper options as active on arrow key events.
- */
- /**
- * This method removes display styles on the option that made it appear
- * active. This is used by the ActiveDescendantKeyManager so key
- * events will display the proper options as active on arrow key events.
- * @return {?}
- */
- MatOption.prototype.setInactiveStyles = /**
- * This method removes display styles on the option that made it appear
- * active. This is used by the ActiveDescendantKeyManager so key
- * events will display the proper options as active on arrow key events.
- * @return {?}
- */
- function () {
- if (this._active) {
- this._active = false;
- this._changeDetectorRef.markForCheck();
- }
- };
- /** Gets the label to be used when determining whether the option should be focused. */
- /**
- * Gets the label to be used when determining whether the option should be focused.
- * @return {?}
- */
- MatOption.prototype.getLabel = /**
- * Gets the label to be used when determining whether the option should be focused.
- * @return {?}
- */
- function () {
- return this.viewValue;
- };
- /** Ensures the option is selected when activated from the keyboard. */
- /**
- * Ensures the option is selected when activated from the keyboard.
- * @param {?} event
- * @return {?}
- */
- MatOption.prototype._handleKeydown = /**
- * Ensures the option is selected when activated from the keyboard.
- * @param {?} event
- * @return {?}
- */
- function (event) {
- if ((event.keyCode === keycodes.ENTER || event.keyCode === keycodes.SPACE) && !keycodes.hasModifierKey(event)) {
- this._selectViaInteraction();
- // Prevent the page from scrolling down and form submits.
- event.preventDefault();
- }
- };
- /**
- * `Selects the option while indicating the selection came from the user. Used to
- * determine if the select's view -> model callback should be invoked.`
- */
- /**
- * `Selects the option while indicating the selection came from the user. Used to
- * determine if the select's view -> model callback should be invoked.`
- * @return {?}
- */
- MatOption.prototype._selectViaInteraction = /**
- * `Selects the option while indicating the selection came from the user. Used to
- * determine if the select's view -> model callback should be invoked.`
- * @return {?}
- */
- function () {
- if (!this.disabled) {
- this._selected = this.multiple ? !this._selected : true;
- this._changeDetectorRef.markForCheck();
- this._emitSelectionChangeEvent(true);
- }
- };
- /**
- * Gets the `aria-selected` value for the option. We explicitly omit the `aria-selected`
- * attribute from single-selection, unselected options. Including the `aria-selected="false"`
- * attributes adds a significant amount of noise to screen-reader users without providing useful
- * information.
- */
- /**
- * Gets the `aria-selected` value for the option. We explicitly omit the `aria-selected`
- * attribute from single-selection, unselected options. Including the `aria-selected="false"`
- * attributes adds a significant amount of noise to screen-reader users without providing useful
- * information.
- * @return {?}
- */
- MatOption.prototype._getAriaSelected = /**
- * Gets the `aria-selected` value for the option. We explicitly omit the `aria-selected`
- * attribute from single-selection, unselected options. Including the `aria-selected="false"`
- * attributes adds a significant amount of noise to screen-reader users without providing useful
- * information.
- * @return {?}
- */
- function () {
- return this.selected || (this.multiple ? false : null);
- };
- /** Returns the correct tabindex for the option depending on disabled state. */
- /**
- * Returns the correct tabindex for the option depending on disabled state.
- * @return {?}
- */
- MatOption.prototype._getTabIndex = /**
- * Returns the correct tabindex for the option depending on disabled state.
- * @return {?}
- */
- function () {
- return this.disabled ? '-1' : '0';
- };
- /** Gets the host DOM element. */
- /**
- * Gets the host DOM element.
- * @return {?}
- */
- MatOption.prototype._getHostElement = /**
- * Gets the host DOM element.
- * @return {?}
- */
- function () {
- return this._element.nativeElement;
- };
- /**
- * @return {?}
- */
- MatOption.prototype.ngAfterViewChecked = /**
- * @return {?}
- */
- function () {
- // Since parent components could be using the option's label to display the selected values
- // (e.g. `mat-select`) and they don't have a way of knowing if the option's label has changed
- // we have to check for changes in the DOM ourselves and dispatch an event. These checks are
- // relatively cheap, however we still limit them only to selected options in order to avoid
- // hitting the DOM too often.
- if (this._selected) {
- /** @type {?} */
- var viewValue = this.viewValue;
- if (viewValue !== this._mostRecentViewValue) {
- this._mostRecentViewValue = viewValue;
- this._stateChanges.next();
- }
- }
- };
- /**
- * @return {?}
- */
- MatOption.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- this._stateChanges.complete();
- };
- /** Emits the selection change event. */
- /**
- * Emits the selection change event.
- * @private
- * @param {?=} isUserInput
- * @return {?}
- */
- MatOption.prototype._emitSelectionChangeEvent = /**
- * Emits the selection change event.
- * @private
- * @param {?=} isUserInput
- * @return {?}
- */
- function (isUserInput) {
- if (isUserInput === void 0) { isUserInput = false; }
- this.onSelectionChange.emit(new MatOptionSelectionChange(this, isUserInput));
- };
- MatOption.decorators = [
- { type: core.Component, args: [{selector: 'mat-option',
- exportAs: 'matOption',
- host: {
- 'role': 'option',
- '[attr.tabindex]': '_getTabIndex()',
- '[class.mat-selected]': 'selected',
- '[class.mat-option-multiple]': 'multiple',
- '[class.mat-active]': 'active',
- '[id]': 'id',
- '[attr.aria-selected]': '_getAriaSelected()',
- '[attr.aria-disabled]': 'disabled.toString()',
- '[class.mat-option-disabled]': 'disabled',
- '(click)': '_selectViaInteraction()',
- '(keydown)': '_handleKeydown($event)',
- 'class': 'mat-option',
- },
- styles: [".mat-option{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block;line-height:48px;height:48px;padding:0 16px;text-align:left;text-decoration:none;max-width:100%;position:relative;cursor:pointer;outline:0;display:flex;flex-direction:row;max-width:100%;box-sizing:border-box;align-items:center;-webkit-tap-highlight-color:transparent}.mat-option[disabled]{cursor:default}[dir=rtl] .mat-option{text-align:right}.mat-option .mat-icon{margin-right:16px;vertical-align:middle}.mat-option .mat-icon svg{vertical-align:top}[dir=rtl] .mat-option .mat-icon{margin-left:16px;margin-right:0}.mat-option[aria-disabled=true]{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.mat-optgroup .mat-option:not(.mat-option-multiple){padding-left:32px}[dir=rtl] .mat-optgroup .mat-option:not(.mat-option-multiple){padding-left:16px;padding-right:32px}@media (-ms-high-contrast:active){.mat-option{margin:0 1px}.mat-option.mat-active{border:solid 1px currentColor;margin:0}}.mat-option-text{display:inline-block;flex-grow:1;overflow:hidden;text-overflow:ellipsis}.mat-option .mat-option-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}@media (-ms-high-contrast:active){.mat-option .mat-option-ripple{opacity:.5}}.mat-option-pseudo-checkbox{margin-right:8px}[dir=rtl] .mat-option-pseudo-checkbox{margin-left:8px;margin-right:0}"],
- template: "<mat-pseudo-checkbox *ngIf=\"multiple\" class=\"mat-option-pseudo-checkbox\" [state]=\"selected ? 'checked' : ''\" [disabled]=\"disabled\"></mat-pseudo-checkbox><span class=\"mat-option-text\"><ng-content></ng-content></span><div class=\"mat-option-ripple\" mat-ripple [matRippleTrigger]=\"_getHostElement()\" [matRippleDisabled]=\"disabled || disableRipple\"></div>",
- encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- },] },
- ];
- /** @nocollapse */
- MatOption.ctorParameters = function () { return [
- { type: core.ElementRef },
- { type: core.ChangeDetectorRef },
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_OPTION_PARENT_COMPONENT,] }] },
- { type: MatOptgroup, decorators: [{ type: core.Optional }] }
- ]; };
- MatOption.propDecorators = {
- value: [{ type: core.Input }],
- id: [{ type: core.Input }],
- disabled: [{ type: core.Input }],
- onSelectionChange: [{ type: core.Output }]
- };
- return MatOption;
- }());
- /**
- * Counts the amount of option group labels that precede the specified option.
- * \@docs-private
- * @param {?} optionIndex Index of the option at which to start counting.
- * @param {?} options Flat list of all of the options.
- * @param {?} optionGroups Flat list of all of the option groups.
- * @return {?}
- */
- function _countGroupLabelsBeforeOption(optionIndex, options, optionGroups) {
- if (optionGroups.length) {
- /** @type {?} */
- var optionsArray = options.toArray();
- /** @type {?} */
- var groups = optionGroups.toArray();
- /** @type {?} */
- var groupCounter = 0;
- for (var i = 0; i < optionIndex + 1; i++) {
- if (optionsArray[i].group && optionsArray[i].group === groups[groupCounter]) {
- groupCounter++;
- }
- }
- return groupCounter;
- }
- return 0;
- }
- /**
- * Determines the position to which to scroll a panel in order for an option to be into view.
- * \@docs-private
- * @param {?} optionIndex Index of the option to be scrolled into the view.
- * @param {?} optionHeight Height of the options.
- * @param {?} currentScrollPosition Current scroll position of the panel.
- * @param {?} panelHeight Height of the panel.
- * @return {?}
- */
- function _getOptionScrollPosition(optionIndex, optionHeight, currentScrollPosition, panelHeight) {
- /** @type {?} */
- var optionOffset = optionIndex * optionHeight;
- if (optionOffset < currentScrollPosition) {
- return optionOffset;
- }
- if (optionOffset + optionHeight > currentScrollPosition + panelHeight) {
- return Math.max(0, optionOffset - panelHeight + optionHeight);
- }
- return currentScrollPosition;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var MatOptionModule = /** @class */ (function () {
- function MatOptionModule() {
- }
- MatOptionModule.decorators = [
- { type: core.NgModule, args: [{
- imports: [MatRippleModule, common.CommonModule, MatPseudoCheckboxModule],
- exports: [MatOption, MatOptgroup],
- declarations: [MatOption, MatOptgroup]
- },] },
- ];
- return MatOptionModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * InjectionToken that can be used to specify the global label options.
- * @type {?}
- */
- var MAT_LABEL_GLOBAL_OPTIONS = new core.InjectionToken('mat-label-global-options');
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * When constructing a Date, the month is zero-based. This can be confusing, since people are
- * used to seeing them one-based. So we create these aliases to make writing the tests easier.
- * \@docs-private
- * \@breaking-change 8.0.0 Remove this with V8 since it was only targeted for testing.
- * @type {?}
- */
- var JAN = 0;
- /** @type {?} */
- var FEB = 1;
- /** @type {?} */
- var MAR = 2;
- /** @type {?} */
- var APR = 3;
- /** @type {?} */
- var MAY = 4;
- /** @type {?} */
- var JUN = 5;
- /** @type {?} */
- var JUL = 6;
- /** @type {?} */
- var AUG = 7;
- /** @type {?} */
- var SEP = 8;
- /** @type {?} */
- var OCT = 9;
- /** @type {?} */
- var NOV = 10;
- /** @type {?} */
- var DEC = 11;
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /** @type {?} */
- var nextUniqueId = 0;
- /**
- * Single error message to be shown underneath the form field.
- */
- var MatError = /** @class */ (function () {
- function MatError() {
- this.id = "mat-error-" + nextUniqueId++;
- }
- MatError.decorators = [
- { type: core.Directive, args: [{
- selector: 'mat-error',
- host: {
- 'class': 'mat-error',
- 'role': 'alert',
- '[attr.id]': 'id',
- }
- },] },
- ];
- MatError.propDecorators = {
- id: [{ type: core.Input }]
- };
- return MatError;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Animations used by the MatFormField.
- * \@docs-private
- * @type {?}
- */
- var matFormFieldAnimations = {
- /**
- * Animation that transitions the form field's error and hint messages.
- */
- transitionMessages: animations$1.trigger('transitionMessages', [
- // TODO(mmalerba): Use angular animations for label animation as well.
- animations$1.state('enter', animations$1.style({ opacity: 1, transform: 'translateY(0%)' })),
- animations$1.transition('void => enter', [
- animations$1.style({ opacity: 0, transform: 'translateY(-100%)' }),
- animations$1.animate('300ms cubic-bezier(0.55, 0, 0.55, 0.2)'),
- ]),
- ])
- };
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * An interface which allows a control to work inside of a `MatFormField`.
- * @abstract
- * @template T
- */
- var /**
- * An interface which allows a control to work inside of a `MatFormField`.
- * @abstract
- * @template T
- */
- MatFormFieldControl = /** @class */ (function () {
- function MatFormFieldControl() {
- }
- return MatFormFieldControl;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * \@docs-private
- * @return {?}
- */
- function getMatFormFieldPlaceholderConflictError() {
- return Error('Placeholder attribute and child element were both specified.');
- }
- /**
- * \@docs-private
- * @param {?} align
- * @return {?}
- */
- function getMatFormFieldDuplicatedHintError(align) {
- return Error("A hint was already declared for 'align=\"" + align + "\"'.");
- }
- /**
- * \@docs-private
- * @return {?}
- */
- function getMatFormFieldMissingControlError() {
- return Error('mat-form-field must contain a MatFormFieldControl.');
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /** @type {?} */
- var nextUniqueId$1 = 0;
- /**
- * Hint text to be shown underneath the form field control.
- */
- var MatHint = /** @class */ (function () {
- function MatHint() {
- /**
- * Whether to align the hint label at the start or end of the line.
- */
- this.align = 'start';
- /**
- * Unique ID for the hint. Used for the aria-describedby on the form field control.
- */
- this.id = "mat-hint-" + nextUniqueId$1++;
- }
- MatHint.decorators = [
- { type: core.Directive, args: [{
- selector: 'mat-hint',
- host: {
- 'class': 'mat-hint',
- '[class.mat-right]': 'align == "end"',
- '[attr.id]': 'id',
- // Remove align attribute to prevent it from interfering with layout.
- '[attr.align]': 'null',
- }
- },] },
- ];
- MatHint.propDecorators = {
- align: [{ type: core.Input }],
- id: [{ type: core.Input }]
- };
- return MatHint;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * The floating label for a `mat-form-field`.
- */
- var MatLabel = /** @class */ (function () {
- function MatLabel() {
- }
- MatLabel.decorators = [
- { type: core.Directive, args: [{
- selector: 'mat-label'
- },] },
- ];
- return MatLabel;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * The placeholder text for an `MatFormField`.
- * @deprecated Use `<mat-label>` to specify the label and the `placeholder` attribute to specify the
- * placeholder.
- * \@breaking-change 8.0.0
- */
- var MatPlaceholder = /** @class */ (function () {
- function MatPlaceholder() {
- }
- MatPlaceholder.decorators = [
- { type: core.Directive, args: [{
- selector: 'mat-placeholder'
- },] },
- ];
- return MatPlaceholder;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Prefix to be placed in front of the form field.
- */
- var MatPrefix = /** @class */ (function () {
- function MatPrefix() {
- }
- MatPrefix.decorators = [
- { type: core.Directive, args: [{
- selector: '[matPrefix]',
- },] },
- ];
- return MatPrefix;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Suffix to be placed at the end of the form field.
- */
- var MatSuffix = /** @class */ (function () {
- function MatSuffix() {
- }
- MatSuffix.decorators = [
- { type: core.Directive, args: [{
- selector: '[matSuffix]',
- },] },
- ];
- return MatSuffix;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /** @type {?} */
- var nextUniqueId$2 = 0;
- /** @type {?} */
- var floatingLabelScale = 0.75;
- /** @type {?} */
- var outlineGapPadding = 5;
- /**
- * Boilerplate for applying mixins to MatFormField.
- * \@docs-private
- */
- var /**
- * Boilerplate for applying mixins to MatFormField.
- * \@docs-private
- */
- MatFormFieldBase = /** @class */ (function () {
- function MatFormFieldBase(_elementRef) {
- this._elementRef = _elementRef;
- }
- return MatFormFieldBase;
- }());
- /**
- * Base class to which we're applying the form field mixins.
- * \@docs-private
- * @type {?}
- */
- var _MatFormFieldMixinBase = mixinColor(MatFormFieldBase, 'primary');
- /**
- * Injection token that can be used to configure the
- * default options for all form field within an app.
- * @type {?}
- */
- var MAT_FORM_FIELD_DEFAULT_OPTIONS = new core.InjectionToken('MAT_FORM_FIELD_DEFAULT_OPTIONS');
- /**
- * Container for form controls that applies Material Design styling and behavior.
- */
- var MatFormField = /** @class */ (function (_super) {
- __extends(MatFormField, _super);
- function MatFormField(_elementRef, _changeDetectorRef, labelOptions, _dir, _defaults, _platform, _ngZone, _animationMode) {
- var _this = _super.call(this, _elementRef) || this;
- _this._elementRef = _elementRef;
- _this._changeDetectorRef = _changeDetectorRef;
- _this._dir = _dir;
- _this._defaults = _defaults;
- _this._platform = _platform;
- _this._ngZone = _ngZone;
- /**
- * Whether the outline gap needs to be calculated
- * immediately on the next change detection run.
- */
- _this._outlineGapCalculationNeededImmediately = false;
- /**
- * Whether the outline gap needs to be calculated next time the zone has stabilized.
- */
- _this._outlineGapCalculationNeededOnStable = false;
- _this._destroyed = new rxjs.Subject();
- /**
- * Override for the logic that disables the label animation in certain cases.
- */
- _this._showAlwaysAnimate = false;
- /**
- * State of the mat-hint and mat-error animations.
- */
- _this._subscriptAnimationState = '';
- _this._hintLabel = '';
- // Unique id for the hint label.
- _this._hintLabelId = "mat-hint-" + nextUniqueId$2++;
- // Unique id for the internal form field label.
- _this._labelId = "mat-form-field-label-" + nextUniqueId$2++;
- _this._labelOptions = labelOptions ? labelOptions : {};
- _this.floatLabel = _this._labelOptions.float || 'auto';
- _this._animationsEnabled = _animationMode !== 'NoopAnimations';
- // Set the default through here so we invoke the setter on the first run.
- _this.appearance = (_defaults && _defaults.appearance) ? _defaults.appearance : 'legacy';
- return _this;
- }
- Object.defineProperty(MatFormField.prototype, "appearance", {
- /** The form-field appearance style. */
- get: /**
- * The form-field appearance style.
- * @return {?}
- */
- function () { return this._appearance; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- /** @type {?} */
- var oldValue = this._appearance;
- this._appearance = value || (this._defaults && this._defaults.appearance) || 'legacy';
- if (this._appearance === 'outline' && oldValue !== value) {
- this._outlineGapCalculationNeededOnStable = true;
- }
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatFormField.prototype, "hideRequiredMarker", {
- /** Whether the required marker should be hidden. */
- get: /**
- * Whether the required marker should be hidden.
- * @return {?}
- */
- function () { return this._hideRequiredMarker; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._hideRequiredMarker = coercion.coerceBooleanProperty(value);
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatFormField.prototype, "_shouldAlwaysFloat", {
- /** Whether the floating label should always float or not. */
- get: /**
- * Whether the floating label should always float or not.
- * @return {?}
- */
- function () {
- return this.floatLabel === 'always' && !this._showAlwaysAnimate;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatFormField.prototype, "_canLabelFloat", {
- /** Whether the label can float or not. */
- get: /**
- * Whether the label can float or not.
- * @return {?}
- */
- function () { return this.floatLabel !== 'never'; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatFormField.prototype, "hintLabel", {
- /** Text for the form field hint. */
- get: /**
- * Text for the form field hint.
- * @return {?}
- */
- function () { return this._hintLabel; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._hintLabel = value;
- this._processHints();
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatFormField.prototype, "floatLabel", {
- /**
- * Whether the label should always float, never float or float as the user types.
- *
- * Note: only the legacy appearance supports the `never` option. `never` was originally added as a
- * way to make the floating label emulate the behavior of a standard input placeholder. However
- * the form field now supports both floating labels and placeholders. Therefore in the non-legacy
- * appearances the `never` option has been disabled in favor of just using the placeholder.
- */
- get: /**
- * Whether the label should always float, never float or float as the user types.
- *
- * Note: only the legacy appearance supports the `never` option. `never` was originally added as a
- * way to make the floating label emulate the behavior of a standard input placeholder. However
- * the form field now supports both floating labels and placeholders. Therefore in the non-legacy
- * appearances the `never` option has been disabled in favor of just using the placeholder.
- * @return {?}
- */
- function () {
- return this.appearance !== 'legacy' && this._floatLabel === 'never' ? 'auto' : this._floatLabel;
- },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- if (value !== this._floatLabel) {
- this._floatLabel = value || this._labelOptions.float || 'auto';
- this._changeDetectorRef.markForCheck();
- }
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatFormField.prototype, "_control", {
- get: /**
- * @return {?}
- */
- function () {
- // TODO(crisbeto): we need this hacky workaround in order to support both Ivy
- // and ViewEngine. We should clean this up once Ivy is the default renderer.
- return this._explicitFormFieldControl || this._controlNonStatic || this._controlStatic;
- },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._explicitFormFieldControl = value;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatFormField.prototype, "_labelChild", {
- get: /**
- * @return {?}
- */
- function () {
- return this._labelChildNonStatic || this._labelChildStatic;
- },
- enumerable: true,
- configurable: true
- });
- /**
- * Gets an ElementRef for the element that a overlay attached to the form-field should be
- * positioned relative to.
- */
- /**
- * Gets an ElementRef for the element that a overlay attached to the form-field should be
- * positioned relative to.
- * @return {?}
- */
- MatFormField.prototype.getConnectedOverlayOrigin = /**
- * Gets an ElementRef for the element that a overlay attached to the form-field should be
- * positioned relative to.
- * @return {?}
- */
- function () {
- return this._connectionContainerRef || this._elementRef;
- };
- /**
- * @return {?}
- */
- MatFormField.prototype.ngAfterContentInit = /**
- * @return {?}
- */
- function () {
- var _this = this;
- this._validateControlChild();
- /** @type {?} */
- var control = this._control;
- if (control.controlType) {
- this._elementRef.nativeElement.classList.add("mat-form-field-type-" + control.controlType);
- }
- // Subscribe to changes in the child control state in order to update the form field UI.
- control.stateChanges.pipe(operators.startWith((/** @type {?} */ (null)))).subscribe((/**
- * @return {?}
- */
- function () {
- _this._validatePlaceholders();
- _this._syncDescribedByIds();
- _this._changeDetectorRef.markForCheck();
- }));
- // Run change detection if the value changes.
- if (control.ngControl && control.ngControl.valueChanges) {
- control.ngControl.valueChanges
- .pipe(operators.takeUntil(this._destroyed))
- .subscribe((/**
- * @return {?}
- */
- function () { return _this._changeDetectorRef.markForCheck(); }));
- }
- // Note that we have to run outside of the `NgZone` explicitly,
- // in order to avoid throwing users into an infinite loop
- // if `zone-patch-rxjs` is included.
- this._ngZone.runOutsideAngular((/**
- * @return {?}
- */
- function () {
- _this._ngZone.onStable.asObservable().pipe(operators.takeUntil(_this._destroyed)).subscribe((/**
- * @return {?}
- */
- function () {
- if (_this._outlineGapCalculationNeededOnStable) {
- _this.updateOutlineGap();
- }
- }));
- }));
- // Run change detection and update the outline if the suffix or prefix changes.
- rxjs.merge(this._prefixChildren.changes, this._suffixChildren.changes).subscribe((/**
- * @return {?}
- */
- function () {
- _this._outlineGapCalculationNeededOnStable = true;
- _this._changeDetectorRef.markForCheck();
- }));
- // Re-validate when the number of hints changes.
- this._hintChildren.changes.pipe(operators.startWith(null)).subscribe((/**
- * @return {?}
- */
- function () {
- _this._processHints();
- _this._changeDetectorRef.markForCheck();
- }));
- // Update the aria-described by when the number of errors changes.
- this._errorChildren.changes.pipe(operators.startWith(null)).subscribe((/**
- * @return {?}
- */
- function () {
- _this._syncDescribedByIds();
- _this._changeDetectorRef.markForCheck();
- }));
- if (this._dir) {
- this._dir.change.pipe(operators.takeUntil(this._destroyed)).subscribe((/**
- * @return {?}
- */
- function () { return _this.updateOutlineGap(); }));
- }
- };
- /**
- * @return {?}
- */
- MatFormField.prototype.ngAfterContentChecked = /**
- * @return {?}
- */
- function () {
- this._validateControlChild();
- if (this._outlineGapCalculationNeededImmediately) {
- this.updateOutlineGap();
- }
- };
- /**
- * @return {?}
- */
- MatFormField.prototype.ngAfterViewInit = /**
- * @return {?}
- */
- function () {
- // Avoid animations on load.
- this._subscriptAnimationState = 'enter';
- this._changeDetectorRef.detectChanges();
- };
- /**
- * @return {?}
- */
- MatFormField.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- this._destroyed.next();
- this._destroyed.complete();
- };
- /** Determines whether a class from the NgControl should be forwarded to the host element. */
- /**
- * Determines whether a class from the NgControl should be forwarded to the host element.
- * @param {?} prop
- * @return {?}
- */
- MatFormField.prototype._shouldForward = /**
- * Determines whether a class from the NgControl should be forwarded to the host element.
- * @param {?} prop
- * @return {?}
- */
- function (prop) {
- /** @type {?} */
- var ngControl = this._control ? this._control.ngControl : null;
- return ngControl && ngControl[prop];
- };
- /**
- * @return {?}
- */
- MatFormField.prototype._hasPlaceholder = /**
- * @return {?}
- */
- function () {
- return !!(this._control && this._control.placeholder || this._placeholderChild);
- };
- /**
- * @return {?}
- */
- MatFormField.prototype._hasLabel = /**
- * @return {?}
- */
- function () {
- return !!this._labelChild;
- };
- /**
- * @return {?}
- */
- MatFormField.prototype._shouldLabelFloat = /**
- * @return {?}
- */
- function () {
- return this._canLabelFloat && (this._control.shouldLabelFloat || this._shouldAlwaysFloat);
- };
- /**
- * @return {?}
- */
- MatFormField.prototype._hideControlPlaceholder = /**
- * @return {?}
- */
- function () {
- // In the legacy appearance the placeholder is promoted to a label if no label is given.
- return this.appearance === 'legacy' && !this._hasLabel() ||
- this._hasLabel() && !this._shouldLabelFloat();
- };
- /**
- * @return {?}
- */
- MatFormField.prototype._hasFloatingLabel = /**
- * @return {?}
- */
- function () {
- // In the legacy appearance the placeholder is promoted to a label if no label is given.
- return this._hasLabel() || this.appearance === 'legacy' && this._hasPlaceholder();
- };
- /** Determines whether to display hints or errors. */
- /**
- * Determines whether to display hints or errors.
- * @return {?}
- */
- MatFormField.prototype._getDisplayedMessages = /**
- * Determines whether to display hints or errors.
- * @return {?}
- */
- function () {
- return (this._errorChildren && this._errorChildren.length > 0 &&
- this._control.errorState) ? 'error' : 'hint';
- };
- /** Animates the placeholder up and locks it in position. */
- /**
- * Animates the placeholder up and locks it in position.
- * @return {?}
- */
- MatFormField.prototype._animateAndLockLabel = /**
- * Animates the placeholder up and locks it in position.
- * @return {?}
- */
- function () {
- var _this = this;
- if (this._hasFloatingLabel() && this._canLabelFloat) {
- // If animations are disabled, we shouldn't go in here,
- // because the `transitionend` will never fire.
- if (this._animationsEnabled) {
- this._showAlwaysAnimate = true;
- rxjs.fromEvent(this._label.nativeElement, 'transitionend').pipe(operators.take(1)).subscribe((/**
- * @return {?}
- */
- function () {
- _this._showAlwaysAnimate = false;
- }));
- }
- this.floatLabel = 'always';
- this._changeDetectorRef.markForCheck();
- }
- };
- /**
- * Ensure that there is only one placeholder (either `placeholder` attribute on the child control
- * or child element with the `mat-placeholder` directive).
- */
- /**
- * Ensure that there is only one placeholder (either `placeholder` attribute on the child control
- * or child element with the `mat-placeholder` directive).
- * @private
- * @return {?}
- */
- MatFormField.prototype._validatePlaceholders = /**
- * Ensure that there is only one placeholder (either `placeholder` attribute on the child control
- * or child element with the `mat-placeholder` directive).
- * @private
- * @return {?}
- */
- function () {
- if (this._control.placeholder && this._placeholderChild) {
- throw getMatFormFieldPlaceholderConflictError();
- }
- };
- /** Does any extra processing that is required when handling the hints. */
- /**
- * Does any extra processing that is required when handling the hints.
- * @private
- * @return {?}
- */
- MatFormField.prototype._processHints = /**
- * Does any extra processing that is required when handling the hints.
- * @private
- * @return {?}
- */
- function () {
- this._validateHints();
- this._syncDescribedByIds();
- };
- /**
- * Ensure that there is a maximum of one of each `<mat-hint>` alignment specified, with the
- * attribute being considered as `align="start"`.
- */
- /**
- * Ensure that there is a maximum of one of each `<mat-hint>` alignment specified, with the
- * attribute being considered as `align="start"`.
- * @private
- * @return {?}
- */
- MatFormField.prototype._validateHints = /**
- * Ensure that there is a maximum of one of each `<mat-hint>` alignment specified, with the
- * attribute being considered as `align="start"`.
- * @private
- * @return {?}
- */
- function () {
- var _this = this;
- if (this._hintChildren) {
- /** @type {?} */
- var startHint_1;
- /** @type {?} */
- var endHint_1;
- this._hintChildren.forEach((/**
- * @param {?} hint
- * @return {?}
- */
- function (hint) {
- if (hint.align === 'start') {
- if (startHint_1 || _this.hintLabel) {
- throw getMatFormFieldDuplicatedHintError('start');
- }
- startHint_1 = hint;
- }
- else if (hint.align === 'end') {
- if (endHint_1) {
- throw getMatFormFieldDuplicatedHintError('end');
- }
- endHint_1 = hint;
- }
- }));
- }
- };
- /**
- * Sets the list of element IDs that describe the child control. This allows the control to update
- * its `aria-describedby` attribute accordingly.
- */
- /**
- * Sets the list of element IDs that describe the child control. This allows the control to update
- * its `aria-describedby` attribute accordingly.
- * @private
- * @return {?}
- */
- MatFormField.prototype._syncDescribedByIds = /**
- * Sets the list of element IDs that describe the child control. This allows the control to update
- * its `aria-describedby` attribute accordingly.
- * @private
- * @return {?}
- */
- function () {
- if (this._control) {
- /** @type {?} */
- var ids = [];
- if (this._getDisplayedMessages() === 'hint') {
- /** @type {?} */
- var startHint = this._hintChildren ?
- this._hintChildren.find((/**
- * @param {?} hint
- * @return {?}
- */
- function (hint) { return hint.align === 'start'; })) : null;
- /** @type {?} */
- var endHint = this._hintChildren ?
- this._hintChildren.find((/**
- * @param {?} hint
- * @return {?}
- */
- function (hint) { return hint.align === 'end'; })) : null;
- if (startHint) {
- ids.push(startHint.id);
- }
- else if (this._hintLabel) {
- ids.push(this._hintLabelId);
- }
- if (endHint) {
- ids.push(endHint.id);
- }
- }
- else if (this._errorChildren) {
- ids = this._errorChildren.map((/**
- * @param {?} error
- * @return {?}
- */
- function (error) { return error.id; }));
- }
- this._control.setDescribedByIds(ids);
- }
- };
- /** Throws an error if the form field's control is missing. */
- /**
- * Throws an error if the form field's control is missing.
- * @protected
- * @return {?}
- */
- MatFormField.prototype._validateControlChild = /**
- * Throws an error if the form field's control is missing.
- * @protected
- * @return {?}
- */
- function () {
- if (!this._control) {
- throw getMatFormFieldMissingControlError();
- }
- };
- /**
- * Updates the width and position of the gap in the outline. Only relevant for the outline
- * appearance.
- */
- /**
- * Updates the width and position of the gap in the outline. Only relevant for the outline
- * appearance.
- * @return {?}
- */
- MatFormField.prototype.updateOutlineGap = /**
- * Updates the width and position of the gap in the outline. Only relevant for the outline
- * appearance.
- * @return {?}
- */
- function () {
- /** @type {?} */
- var labelEl = this._label ? this._label.nativeElement : null;
- if (this.appearance !== 'outline' || !labelEl || !labelEl.children.length ||
- !labelEl.textContent.trim()) {
- return;
- }
- if (!this._platform.isBrowser) {
- // getBoundingClientRect isn't available on the server.
- return;
- }
- // If the element is not present in the DOM, the outline gap will need to be calculated
- // the next time it is checked and in the DOM.
- if (!(/** @type {?} */ (document.documentElement)).contains(this._elementRef.nativeElement)) {
- this._outlineGapCalculationNeededImmediately = true;
- return;
- }
- /** @type {?} */
- var startWidth = 0;
- /** @type {?} */
- var gapWidth = 0;
- /** @type {?} */
- var container = this._connectionContainerRef.nativeElement;
- /** @type {?} */
- var startEls = container.querySelectorAll('.mat-form-field-outline-start');
- /** @type {?} */
- var gapEls = container.querySelectorAll('.mat-form-field-outline-gap');
- if (this._label && this._label.nativeElement.children.length) {
- /** @type {?} */
- var containerRect = container.getBoundingClientRect();
- // If the container's width and height are zero, it means that the element is
- // invisible and we can't calculate the outline gap. Mark the element as needing
- // to be checked the next time the zone stabilizes. We can't do this immediately
- // on the next change detection, because even if the element becomes visible,
- // the `ClientRect` won't be reclaculated immediately. We reset the
- // `_outlineGapCalculationNeededImmediately` flag some we don't run the checks twice.
- if (containerRect.width === 0 && containerRect.height === 0) {
- this._outlineGapCalculationNeededOnStable = true;
- this._outlineGapCalculationNeededImmediately = false;
- return;
- }
- /** @type {?} */
- var containerStart = this._getStartEnd(containerRect);
- /** @type {?} */
- var labelStart = this._getStartEnd(labelEl.children[0].getBoundingClientRect());
- /** @type {?} */
- var labelWidth = 0;
- for (var _i = 0, _a = labelEl.children; _i < _a.length; _i++) {
- var child = _a[_i];
- labelWidth += child.offsetWidth;
- }
- startWidth = labelStart - containerStart - outlineGapPadding;
- gapWidth = labelWidth > 0 ? labelWidth * floatingLabelScale + outlineGapPadding * 2 : 0;
- }
- for (var i = 0; i < startEls.length; i++) {
- startEls.item(i).style.width = startWidth + "px";
- }
- for (var i = 0; i < gapEls.length; i++) {
- gapEls.item(i).style.width = gapWidth + "px";
- }
- this._outlineGapCalculationNeededOnStable =
- this._outlineGapCalculationNeededImmediately = false;
- };
- /** Gets the start end of the rect considering the current directionality. */
- /**
- * Gets the start end of the rect considering the current directionality.
- * @private
- * @param {?} rect
- * @return {?}
- */
- MatFormField.prototype._getStartEnd = /**
- * Gets the start end of the rect considering the current directionality.
- * @private
- * @param {?} rect
- * @return {?}
- */
- function (rect) {
- return this._dir && this._dir.value === 'rtl' ? rect.right : rect.left;
- };
- MatFormField.decorators = [
- { type: core.Component, args: [{selector: 'mat-form-field',
- exportAs: 'matFormField',
- 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\"> *</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>",
- // MatInput is a directive and can't have styles, so we need to include its styles here
- // in form-field-input.css. The MatInput styles are fairly minimal so it shouldn't be a
- // big deal for people who aren't using MatInput.
- 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}"],
- animations: [matFormFieldAnimations.transitionMessages],
- host: {
- 'class': 'mat-form-field',
- '[class.mat-form-field-appearance-standard]': 'appearance == "standard"',
- '[class.mat-form-field-appearance-fill]': 'appearance == "fill"',
- '[class.mat-form-field-appearance-outline]': 'appearance == "outline"',
- '[class.mat-form-field-appearance-legacy]': 'appearance == "legacy"',
- '[class.mat-form-field-invalid]': '_control.errorState',
- '[class.mat-form-field-can-float]': '_canLabelFloat',
- '[class.mat-form-field-should-float]': '_shouldLabelFloat()',
- '[class.mat-form-field-has-label]': '_hasFloatingLabel()',
- '[class.mat-form-field-hide-placeholder]': '_hideControlPlaceholder()',
- '[class.mat-form-field-disabled]': '_control.disabled',
- '[class.mat-form-field-autofilled]': '_control.autofilled',
- '[class.mat-focused]': '_control.focused',
- '[class.mat-accent]': 'color == "accent"',
- '[class.mat-warn]': 'color == "warn"',
- '[class.ng-untouched]': '_shouldForward("untouched")',
- '[class.ng-touched]': '_shouldForward("touched")',
- '[class.ng-pristine]': '_shouldForward("pristine")',
- '[class.ng-dirty]': '_shouldForward("dirty")',
- '[class.ng-valid]': '_shouldForward("valid")',
- '[class.ng-invalid]': '_shouldForward("invalid")',
- '[class.ng-pending]': '_shouldForward("pending")',
- '[class._mat-animation-noopable]': '!_animationsEnabled',
- },
- inputs: ['color'],
- encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- },] },
- ];
- /** @nocollapse */
- MatFormField.ctorParameters = function () { return [
- { type: core.ElementRef },
- { type: core.ChangeDetectorRef },
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_LABEL_GLOBAL_OPTIONS,] }] },
- { type: bidi.Directionality, decorators: [{ type: core.Optional }] },
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_FORM_FIELD_DEFAULT_OPTIONS,] }] },
- { type: platform.Platform },
- { type: core.NgZone },
- { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
- ]; };
- MatFormField.propDecorators = {
- appearance: [{ type: core.Input }],
- hideRequiredMarker: [{ type: core.Input }],
- hintLabel: [{ type: core.Input }],
- floatLabel: [{ type: core.Input }],
- underlineRef: [{ type: core.ViewChild, args: ['underline', { static: false },] }],
- _connectionContainerRef: [{ type: core.ViewChild, args: ['connectionContainer', { static: true },] }],
- _inputContainerRef: [{ type: core.ViewChild, args: ['inputContainer', { static: false },] }],
- _label: [{ type: core.ViewChild, args: ['label', { static: false },] }],
- _controlNonStatic: [{ type: core.ContentChild, args: [MatFormFieldControl, { static: false },] }],
- _controlStatic: [{ type: core.ContentChild, args: [MatFormFieldControl, { static: true },] }],
- _labelChildNonStatic: [{ type: core.ContentChild, args: [MatLabel, { static: false },] }],
- _labelChildStatic: [{ type: core.ContentChild, args: [MatLabel, { static: true },] }],
- _placeholderChild: [{ type: core.ContentChild, args: [MatPlaceholder, { static: false },] }],
- _errorChildren: [{ type: core.ContentChildren, args: [MatError,] }],
- _hintChildren: [{ type: core.ContentChildren, args: [MatHint,] }],
- _prefixChildren: [{ type: core.ContentChildren, args: [MatPrefix,] }],
- _suffixChildren: [{ type: core.ContentChildren, args: [MatSuffix,] }]
- };
- return MatFormField;
- }(_MatFormFieldMixinBase));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var MatFormFieldModule = /** @class */ (function () {
- function MatFormFieldModule() {
- }
- MatFormFieldModule.decorators = [
- { type: core.NgModule, args: [{
- declarations: [
- MatError,
- MatFormField,
- MatHint,
- MatLabel,
- MatPlaceholder,
- MatPrefix,
- MatSuffix,
- ],
- imports: [
- common.CommonModule,
- observers.ObserversModule,
- ],
- exports: [
- MatError,
- MatFormField,
- MatHint,
- MatLabel,
- MatPlaceholder,
- MatPrefix,
- MatSuffix,
- ],
- },] },
- ];
- return MatFormFieldModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Autocomplete IDs need to be unique across components, so this counter exists outside of
- * the component definition.
- * @type {?}
- */
- var _uniqueAutocompleteIdCounter = 0;
- /**
- * Event object that is emitted when an autocomplete option is selected.
- */
- var /**
- * Event object that is emitted when an autocomplete option is selected.
- */
- MatAutocompleteSelectedEvent = /** @class */ (function () {
- function MatAutocompleteSelectedEvent(source, option) {
- this.source = source;
- this.option = option;
- }
- return MatAutocompleteSelectedEvent;
- }());
- // Boilerplate for applying mixins to MatAutocomplete.
- /**
- * \@docs-private
- */
- var
- // Boilerplate for applying mixins to MatAutocomplete.
- /**
- * \@docs-private
- */
- MatAutocompleteBase = /** @class */ (function () {
- function MatAutocompleteBase() {
- }
- return MatAutocompleteBase;
- }());
- /** @type {?} */
- var _MatAutocompleteMixinBase = mixinDisableRipple(MatAutocompleteBase);
- /**
- * Injection token to be used to override the default options for `mat-autocomplete`.
- * @type {?}
- */
- var MAT_AUTOCOMPLETE_DEFAULT_OPTIONS = new core.InjectionToken('mat-autocomplete-default-options', {
- providedIn: 'root',
- factory: MAT_AUTOCOMPLETE_DEFAULT_OPTIONS_FACTORY,
- });
- /**
- * \@docs-private
- * @return {?}
- */
- function MAT_AUTOCOMPLETE_DEFAULT_OPTIONS_FACTORY() {
- return { autoActiveFirstOption: false };
- }
- var MatAutocomplete = /** @class */ (function (_super) {
- __extends(MatAutocomplete, _super);
- function MatAutocomplete(_changeDetectorRef, _elementRef, defaults) {
- var _this = _super.call(this) || this;
- _this._changeDetectorRef = _changeDetectorRef;
- _this._elementRef = _elementRef;
- /**
- * Whether the autocomplete panel should be visible, depending on option length.
- */
- _this.showPanel = false;
- _this._isOpen = false;
- /**
- * Function that maps an option's control value to its display value in the trigger.
- */
- _this.displayWith = null;
- /**
- * Event that is emitted whenever an option from the list is selected.
- */
- _this.optionSelected = new core.EventEmitter();
- /**
- * Event that is emitted when the autocomplete panel is opened.
- */
- _this.opened = new core.EventEmitter();
- /**
- * Event that is emitted when the autocomplete panel is closed.
- */
- _this.closed = new core.EventEmitter();
- _this._classList = {};
- /**
- * Unique ID to be used by autocomplete trigger's "aria-owns" property.
- */
- _this.id = "mat-autocomplete-" + _uniqueAutocompleteIdCounter++;
- _this._autoActiveFirstOption = !!defaults.autoActiveFirstOption;
- return _this;
- }
- Object.defineProperty(MatAutocomplete.prototype, "isOpen", {
- /** Whether the autocomplete panel is open. */
- get: /**
- * Whether the autocomplete panel is open.
- * @return {?}
- */
- function () { return this._isOpen && this.showPanel; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatAutocomplete.prototype, "autoActiveFirstOption", {
- /**
- * Whether the first option should be highlighted when the autocomplete panel is opened.
- * Can be configured globally through the `MAT_AUTOCOMPLETE_DEFAULT_OPTIONS` token.
- */
- get: /**
- * Whether the first option should be highlighted when the autocomplete panel is opened.
- * Can be configured globally through the `MAT_AUTOCOMPLETE_DEFAULT_OPTIONS` token.
- * @return {?}
- */
- function () { return this._autoActiveFirstOption; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._autoActiveFirstOption = coercion.coerceBooleanProperty(value);
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatAutocomplete.prototype, "classList", {
- /**
- * Takes classes set on the host mat-autocomplete element and applies them to the panel
- * inside the overlay container to allow for easy styling.
- */
- set: /**
- * Takes classes set on the host mat-autocomplete element and applies them to the panel
- * inside the overlay container to allow for easy styling.
- * @param {?} value
- * @return {?}
- */
- function (value) {
- if (value && value.length) {
- this._classList = value.split(' ').reduce((/**
- * @param {?} classList
- * @param {?} className
- * @return {?}
- */
- function (classList, className) {
- classList[className.trim()] = true;
- return classList;
- }), (/** @type {?} */ ({})));
- }
- else {
- this._classList = {};
- }
- this._setVisibilityClasses(this._classList);
- this._elementRef.nativeElement.className = '';
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- MatAutocomplete.prototype.ngAfterContentInit = /**
- * @return {?}
- */
- function () {
- this._keyManager = new a11y.ActiveDescendantKeyManager(this.options).withWrap();
- // Set the initial visibility state.
- this._setVisibility();
- };
- /**
- * Sets the panel scrollTop. This allows us to manually scroll to display options
- * above or below the fold, as they are not actually being focused when active.
- */
- /**
- * Sets the panel scrollTop. This allows us to manually scroll to display options
- * above or below the fold, as they are not actually being focused when active.
- * @param {?} scrollTop
- * @return {?}
- */
- MatAutocomplete.prototype._setScrollTop = /**
- * Sets the panel scrollTop. This allows us to manually scroll to display options
- * above or below the fold, as they are not actually being focused when active.
- * @param {?} scrollTop
- * @return {?}
- */
- function (scrollTop) {
- if (this.panel) {
- this.panel.nativeElement.scrollTop = scrollTop;
- }
- };
- /** Returns the panel's scrollTop. */
- /**
- * Returns the panel's scrollTop.
- * @return {?}
- */
- MatAutocomplete.prototype._getScrollTop = /**
- * Returns the panel's scrollTop.
- * @return {?}
- */
- function () {
- return this.panel ? this.panel.nativeElement.scrollTop : 0;
- };
- /** Panel should hide itself when the option list is empty. */
- /**
- * Panel should hide itself when the option list is empty.
- * @return {?}
- */
- MatAutocomplete.prototype._setVisibility = /**
- * Panel should hide itself when the option list is empty.
- * @return {?}
- */
- function () {
- this.showPanel = !!this.options.length;
- this._setVisibilityClasses(this._classList);
- this._changeDetectorRef.markForCheck();
- };
- /** Emits the `select` event. */
- /**
- * Emits the `select` event.
- * @param {?} option
- * @return {?}
- */
- MatAutocomplete.prototype._emitSelectEvent = /**
- * Emits the `select` event.
- * @param {?} option
- * @return {?}
- */
- function (option) {
- /** @type {?} */
- var event = new MatAutocompleteSelectedEvent(this, option);
- this.optionSelected.emit(event);
- };
- /** Sets the autocomplete visibility classes on a classlist based on the panel is visible. */
- /**
- * Sets the autocomplete visibility classes on a classlist based on the panel is visible.
- * @private
- * @param {?} classList
- * @return {?}
- */
- MatAutocomplete.prototype._setVisibilityClasses = /**
- * Sets the autocomplete visibility classes on a classlist based on the panel is visible.
- * @private
- * @param {?} classList
- * @return {?}
- */
- function (classList) {
- classList['mat-autocomplete-visible'] = this.showPanel;
- classList['mat-autocomplete-hidden'] = !this.showPanel;
- };
- MatAutocomplete.decorators = [
- { type: core.Component, args: [{selector: 'mat-autocomplete',
- template: "<ng-template><div class=\"mat-autocomplete-panel\" role=\"listbox\" [id]=\"id\" [ngClass]=\"_classList\" #panel><ng-content></ng-content></div></ng-template>",
- 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}}"],
- encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- exportAs: 'matAutocomplete',
- inputs: ['disableRipple'],
- host: {
- 'class': 'mat-autocomplete'
- },
- providers: [
- { provide: MAT_OPTION_PARENT_COMPONENT, useExisting: MatAutocomplete }
- ]
- },] },
- ];
- /** @nocollapse */
- MatAutocomplete.ctorParameters = function () { return [
- { type: core.ChangeDetectorRef },
- { type: core.ElementRef },
- { type: undefined, decorators: [{ type: core.Inject, args: [MAT_AUTOCOMPLETE_DEFAULT_OPTIONS,] }] }
- ]; };
- MatAutocomplete.propDecorators = {
- template: [{ type: core.ViewChild, args: [core.TemplateRef, { static: true },] }],
- panel: [{ type: core.ViewChild, args: ['panel', { static: false },] }],
- options: [{ type: core.ContentChildren, args: [MatOption, { descendants: true },] }],
- optionGroups: [{ type: core.ContentChildren, args: [MatOptgroup,] }],
- displayWith: [{ type: core.Input }],
- autoActiveFirstOption: [{ type: core.Input }],
- panelWidth: [{ type: core.Input }],
- optionSelected: [{ type: core.Output }],
- opened: [{ type: core.Output }],
- closed: [{ type: core.Output }],
- classList: [{ type: core.Input, args: ['class',] }]
- };
- return MatAutocomplete;
- }(_MatAutocompleteMixinBase));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Directive applied to an element to make it usable
- * as a connection point for an autocomplete panel.
- */
- var MatAutocompleteOrigin = /** @class */ (function () {
- function MatAutocompleteOrigin(elementRef) {
- this.elementRef = elementRef;
- }
- MatAutocompleteOrigin.decorators = [
- { type: core.Directive, args: [{
- selector: '[matAutocompleteOrigin]',
- exportAs: 'matAutocompleteOrigin',
- },] },
- ];
- /** @nocollapse */
- MatAutocompleteOrigin.ctorParameters = function () { return [
- { type: core.ElementRef }
- ]; };
- return MatAutocompleteOrigin;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * The height of each autocomplete option.
- * @type {?}
- */
- var AUTOCOMPLETE_OPTION_HEIGHT = 48;
- /**
- * The total height of the autocomplete panel.
- * @type {?}
- */
- var AUTOCOMPLETE_PANEL_HEIGHT = 256;
- /**
- * Injection token that determines the scroll handling while the autocomplete panel is open.
- * @type {?}
- */
- var MAT_AUTOCOMPLETE_SCROLL_STRATEGY = new core.InjectionToken('mat-autocomplete-scroll-strategy');
- /**
- * \@docs-private
- * @param {?} overlay
- * @return {?}
- */
- function MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY(overlay$$1) {
- return (/**
- * @return {?}
- */
- function () { return overlay$$1.scrollStrategies.reposition(); });
- }
- /**
- * \@docs-private
- * @type {?}
- */
- var MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY_PROVIDER = {
- provide: MAT_AUTOCOMPLETE_SCROLL_STRATEGY,
- deps: [overlay.Overlay],
- useFactory: MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY,
- };
- /**
- * Provider that allows the autocomplete to register as a ControlValueAccessor.
- * \@docs-private
- * @type {?}
- */
- var MAT_AUTOCOMPLETE_VALUE_ACCESSOR = {
- provide: forms.NG_VALUE_ACCESSOR,
- useExisting: core.forwardRef((/**
- * @return {?}
- */
- function () { return MatAutocompleteTrigger; })),
- multi: true
- };
- /**
- * Creates an error to be thrown when attempting to use an autocomplete trigger without a panel.
- * \@docs-private
- * @return {?}
- */
- function getMatAutocompleteMissingPanelError() {
- return Error('Attempting to open an undefined instance of `mat-autocomplete`. ' +
- 'Make sure that the id passed to the `matAutocomplete` is correct and that ' +
- 'you\'re attempting to open it after the ngAfterContentInit hook.');
- }
- var MatAutocompleteTrigger = /** @class */ (function () {
- function MatAutocompleteTrigger(_element, _overlay, _viewContainerRef, _zone, _changeDetectorRef, scrollStrategy, _dir, _formField, _document, _viewportRuler) {
- var _this = this;
- this._element = _element;
- this._overlay = _overlay;
- this._viewContainerRef = _viewContainerRef;
- this._zone = _zone;
- this._changeDetectorRef = _changeDetectorRef;
- this._dir = _dir;
- this._formField = _formField;
- this._document = _document;
- this._viewportRuler = _viewportRuler;
- this._componentDestroyed = false;
- this._autocompleteDisabled = false;
- /**
- * Whether or not the label state is being overridden.
- */
- this._manuallyFloatingLabel = false;
- /**
- * Subscription to viewport size changes.
- */
- this._viewportSubscription = rxjs.Subscription.EMPTY;
- /**
- * Whether the autocomplete can open the next time it is focused. Used to prevent a focused,
- * closed autocomplete from being reopened if the user switches to another browser tab and then
- * comes back.
- */
- this._canOpenOnNextFocus = true;
- /**
- * Stream of keyboard events that can close the panel.
- */
- this._closeKeyEventStream = new rxjs.Subject();
- /**
- * Event handler for when the window is blurred. Needs to be an
- * arrow function in order to preserve the context.
- */
- this._windowBlurHandler = (/**
- * @return {?}
- */
- function () {
- // If the user blurred the window while the autocomplete is focused, it means that it'll be
- // refocused when they come back. In this case we want to skip the first focus event, if the
- // pane was closed, in order to avoid reopening it unintentionally.
- _this._canOpenOnNextFocus =
- _this._document.activeElement !== _this._element.nativeElement || _this.panelOpen;
- });
- /**
- * `View -> model callback called when value changes`
- */
- this._onChange = (/**
- * @return {?}
- */
- function () { });
- /**
- * `View -> model callback called when autocomplete has been touched`
- */
- this._onTouched = (/**
- * @return {?}
- */
- function () { });
- /**
- * Position of the autocomplete panel relative to the trigger element. A position of `auto`
- * will render the panel underneath the trigger if there is enough space for it to fit in
- * the viewport, otherwise the panel will be shown above it. If the position is set to
- * `above` or `below`, the panel will always be shown above or below the trigger. no matter
- * whether it fits completely in the viewport.
- */
- this.position = 'auto';
- /**
- * `autocomplete` attribute to be set on the input element.
- * \@docs-private
- */
- this.autocompleteAttribute = 'off';
- this._overlayAttached = false;
- /**
- * Stream of autocomplete option selections.
- */
- this.optionSelections = (/** @type {?} */ (rxjs.defer((/**
- * @return {?}
- */
- function () {
- if (_this.autocomplete && _this.autocomplete.options) {
- return rxjs.merge.apply(void 0, _this.autocomplete.options.map((/**
- * @param {?} option
- * @return {?}
- */
- function (option) { return option.onSelectionChange; })));
- }
- // If there are any subscribers before `ngAfterViewInit`, the `autocomplete` will be undefined.
- // Return a stream that we'll replace with the real one once everything is in place.
- return _this._zone.onStable
- .asObservable()
- .pipe(operators.take(1), operators.switchMap((/**
- * @return {?}
- */
- function () { return _this.optionSelections; })));
- }))));
- if (typeof window !== 'undefined') {
- _zone.runOutsideAngular((/**
- * @return {?}
- */
- function () {
- window.addEventListener('blur', _this._windowBlurHandler);
- }));
- }
- this._scrollStrategy = scrollStrategy;
- }
- Object.defineProperty(MatAutocompleteTrigger.prototype, "autocompleteDisabled", {
- /**
- * Whether the autocomplete is disabled. When disabled, the element will
- * act as a regular input and the user won't be able to open the panel.
- */
- get: /**
- * Whether the autocomplete is disabled. When disabled, the element will
- * act as a regular input and the user won't be able to open the panel.
- * @return {?}
- */
- function () { return this._autocompleteDisabled; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._autocompleteDisabled = coercion.coerceBooleanProperty(value);
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @param {?} changes
- * @return {?}
- */
- MatAutocompleteTrigger.prototype.ngOnChanges = /**
- * @param {?} changes
- * @return {?}
- */
- function (changes) {
- if (changes['position'] && this._positionStrategy) {
- this._setStrategyPositions(this._positionStrategy);
- if (this.panelOpen) {
- (/** @type {?} */ (this._overlayRef)).updatePosition();
- }
- }
- };
- /**
- * @return {?}
- */
- MatAutocompleteTrigger.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- if (typeof window !== 'undefined') {
- window.removeEventListener('blur', this._windowBlurHandler);
- }
- this._viewportSubscription.unsubscribe();
- this._componentDestroyed = true;
- this._destroyPanel();
- this._closeKeyEventStream.complete();
- };
- Object.defineProperty(MatAutocompleteTrigger.prototype, "panelOpen", {
- /** Whether or not the autocomplete panel is open. */
- get: /**
- * Whether or not the autocomplete panel is open.
- * @return {?}
- */
- function () {
- return this._overlayAttached && this.autocomplete.showPanel;
- },
- enumerable: true,
- configurable: true
- });
- /** Opens the autocomplete suggestion panel. */
- /**
- * Opens the autocomplete suggestion panel.
- * @return {?}
- */
- MatAutocompleteTrigger.prototype.openPanel = /**
- * Opens the autocomplete suggestion panel.
- * @return {?}
- */
- function () {
- this._attachOverlay();
- this._floatLabel();
- };
- /** Closes the autocomplete suggestion panel. */
- /**
- * Closes the autocomplete suggestion panel.
- * @return {?}
- */
- MatAutocompleteTrigger.prototype.closePanel = /**
- * Closes the autocomplete suggestion panel.
- * @return {?}
- */
- function () {
- this._resetLabel();
- if (!this._overlayAttached) {
- return;
- }
- if (this.panelOpen) {
- // Only emit if the panel was visible.
- this.autocomplete.closed.emit();
- }
- this.autocomplete._isOpen = this._overlayAttached = false;
- if (this._overlayRef && this._overlayRef.hasAttached()) {
- this._overlayRef.detach();
- this._closingActionsSubscription.unsubscribe();
- }
- // Note that in some cases this can end up being called after the component is destroyed.
- // Add a check to ensure that we don't try to run change detection on a destroyed view.
- if (!this._componentDestroyed) {
- // We need to trigger change detection manually, because
- // `fromEvent` doesn't seem to do it at the proper time.
- // This ensures that the label is reset when the
- // user clicks outside.
- this._changeDetectorRef.detectChanges();
- }
- };
- /**
- * Updates the position of the autocomplete suggestion panel to ensure that it fits all options
- * within the viewport.
- */
- /**
- * Updates the position of the autocomplete suggestion panel to ensure that it fits all options
- * within the viewport.
- * @return {?}
- */
- MatAutocompleteTrigger.prototype.updatePosition = /**
- * Updates the position of the autocomplete suggestion panel to ensure that it fits all options
- * within the viewport.
- * @return {?}
- */
- function () {
- if (this._overlayAttached) {
- (/** @type {?} */ (this._overlayRef)).updatePosition();
- }
- };
- Object.defineProperty(MatAutocompleteTrigger.prototype, "panelClosingActions", {
- /**
- * A stream of actions that should close the autocomplete panel, including
- * when an option is selected, on blur, and when TAB is pressed.
- */
- get: /**
- * A stream of actions that should close the autocomplete panel, including
- * when an option is selected, on blur, and when TAB is pressed.
- * @return {?}
- */
- function () {
- var _this = this;
- return rxjs.merge(this.optionSelections, this.autocomplete._keyManager.tabOut.pipe(operators.filter((/**
- * @return {?}
- */
- function () { return _this._overlayAttached; }))), this._closeKeyEventStream, this._getOutsideClickStream(), this._overlayRef ?
- this._overlayRef.detachments().pipe(operators.filter((/**
- * @return {?}
- */
- function () { return _this._overlayAttached; }))) :
- rxjs.of()).pipe(
- // Normalize the output so we return a consistent type.
- operators.map((/**
- * @param {?} event
- * @return {?}
- */
- function (event) { return event instanceof MatOptionSelectionChange ? event : null; })));
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatAutocompleteTrigger.prototype, "activeOption", {
- /** The currently active option, coerced to MatOption type. */
- get: /**
- * The currently active option, coerced to MatOption type.
- * @return {?}
- */
- function () {
- if (this.autocomplete && this.autocomplete._keyManager) {
- return this.autocomplete._keyManager.activeItem;
- }
- return null;
- },
- enumerable: true,
- configurable: true
- });
- /** Stream of clicks outside of the autocomplete panel. */
- /**
- * Stream of clicks outside of the autocomplete panel.
- * @private
- * @return {?}
- */
- MatAutocompleteTrigger.prototype._getOutsideClickStream = /**
- * Stream of clicks outside of the autocomplete panel.
- * @private
- * @return {?}
- */
- function () {
- var _this = this;
- return rxjs.merge((/** @type {?} */ (rxjs.fromEvent(this._document, 'click'))), (/** @type {?} */ (rxjs.fromEvent(this._document, 'touchend'))))
- .pipe(operators.filter((/**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- /** @type {?} */
- var clickTarget = (/** @type {?} */ (event.target));
- /** @type {?} */
- var formField = _this._formField ?
- _this._formField._elementRef.nativeElement : null;
- return _this._overlayAttached &&
- clickTarget !== _this._element.nativeElement &&
- (!formField || !formField.contains(clickTarget)) &&
- (!!_this._overlayRef && !_this._overlayRef.overlayElement.contains(clickTarget));
- })));
- };
- // Implemented as part of ControlValueAccessor.
- // Implemented as part of ControlValueAccessor.
- /**
- * @param {?} value
- * @return {?}
- */
- MatAutocompleteTrigger.prototype.writeValue =
- // Implemented as part of ControlValueAccessor.
- /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- var _this = this;
- Promise.resolve(null).then((/**
- * @return {?}
- */
- function () { return _this._setTriggerValue(value); }));
- };
- // Implemented as part of ControlValueAccessor.
- // Implemented as part of ControlValueAccessor.
- /**
- * @param {?} fn
- * @return {?}
- */
- MatAutocompleteTrigger.prototype.registerOnChange =
- // Implemented as part of ControlValueAccessor.
- /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- this._onChange = fn;
- };
- // Implemented as part of ControlValueAccessor.
- // Implemented as part of ControlValueAccessor.
- /**
- * @param {?} fn
- * @return {?}
- */
- MatAutocompleteTrigger.prototype.registerOnTouched =
- // Implemented as part of ControlValueAccessor.
- /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- this._onTouched = fn;
- };
- // Implemented as part of ControlValueAccessor.
- // Implemented as part of ControlValueAccessor.
- /**
- * @param {?} isDisabled
- * @return {?}
- */
- MatAutocompleteTrigger.prototype.setDisabledState =
- // Implemented as part of ControlValueAccessor.
- /**
- * @param {?} isDisabled
- * @return {?}
- */
- function (isDisabled) {
- this._element.nativeElement.disabled = isDisabled;
- };
- /**
- * @param {?} event
- * @return {?}
- */
- MatAutocompleteTrigger.prototype._handleKeydown = /**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- /** @type {?} */
- var keyCode = event.keyCode;
- // Prevent the default action on all escape key presses. This is here primarily to bring IE
- // in line with other browsers. By default, pressing escape on IE will cause it to revert
- // the input value to the one that it had on focus, however it won't dispatch any events
- // which means that the model value will be out of sync with the view.
- if (keyCode === keycodes.ESCAPE) {
- event.preventDefault();
- }
- if (this.activeOption && keyCode === keycodes.ENTER && this.panelOpen) {
- this.activeOption._selectViaInteraction();
- this._resetActiveItem();
- event.preventDefault();
- }
- else if (this.autocomplete) {
- /** @type {?} */
- var prevActiveItem = this.autocomplete._keyManager.activeItem;
- /** @type {?} */
- var isArrowKey = keyCode === keycodes.UP_ARROW || keyCode === keycodes.DOWN_ARROW;
- if (this.panelOpen || keyCode === keycodes.TAB) {
- this.autocomplete._keyManager.onKeydown(event);
- }
- else if (isArrowKey && this._canOpen()) {
- this.openPanel();
- }
- if (isArrowKey || this.autocomplete._keyManager.activeItem !== prevActiveItem) {
- this._scrollToOption();
- }
- }
- };
- /**
- * @param {?} event
- * @return {?}
- */
- MatAutocompleteTrigger.prototype._handleInput = /**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- /** @type {?} */
- var target = (/** @type {?} */ (event.target));
- /** @type {?} */
- var value = target.value;
- // Based on `NumberValueAccessor` from forms.
- if (target.type === 'number') {
- value = value == '' ? null : parseFloat(value);
- }
- // If the input has a placeholder, IE will fire the `input` event on page load,
- // focus and blur, in addition to when the user actually changed the value. To
- // filter out all of the extra events, we save the value on focus and between
- // `input` events, and we check whether it changed.
- // See: https://connect.microsoft.com/IE/feedback/details/885747/
- if (this._previousValue !== value) {
- this._previousValue = value;
- this._onChange(value);
- if (this._canOpen() && this._document.activeElement === event.target) {
- this.openPanel();
- }
- }
- };
- /**
- * @return {?}
- */
- MatAutocompleteTrigger.prototype._handleFocus = /**
- * @return {?}
- */
- function () {
- if (!this._canOpenOnNextFocus) {
- this._canOpenOnNextFocus = true;
- }
- else if (this._canOpen()) {
- this._previousValue = this._element.nativeElement.value;
- this._attachOverlay();
- this._floatLabel(true);
- }
- };
- /**
- * In "auto" mode, the label will animate down as soon as focus is lost.
- * This causes the value to jump when selecting an option with the mouse.
- * This method manually floats the label until the panel can be closed.
- * @param shouldAnimate Whether the label should be animated when it is floated.
- */
- /**
- * In "auto" mode, the label will animate down as soon as focus is lost.
- * This causes the value to jump when selecting an option with the mouse.
- * This method manually floats the label until the panel can be closed.
- * @private
- * @param {?=} shouldAnimate Whether the label should be animated when it is floated.
- * @return {?}
- */
- MatAutocompleteTrigger.prototype._floatLabel = /**
- * In "auto" mode, the label will animate down as soon as focus is lost.
- * This causes the value to jump when selecting an option with the mouse.
- * This method manually floats the label until the panel can be closed.
- * @private
- * @param {?=} shouldAnimate Whether the label should be animated when it is floated.
- * @return {?}
- */
- function (shouldAnimate) {
- if (shouldAnimate === void 0) { shouldAnimate = false; }
- if (this._formField && this._formField.floatLabel === 'auto') {
- if (shouldAnimate) {
- this._formField._animateAndLockLabel();
- }
- else {
- this._formField.floatLabel = 'always';
- }
- this._manuallyFloatingLabel = true;
- }
- };
- /** If the label has been manually elevated, return it to its normal state. */
- /**
- * If the label has been manually elevated, return it to its normal state.
- * @private
- * @return {?}
- */
- MatAutocompleteTrigger.prototype._resetLabel = /**
- * If the label has been manually elevated, return it to its normal state.
- * @private
- * @return {?}
- */
- function () {
- if (this._manuallyFloatingLabel) {
- this._formField.floatLabel = 'auto';
- this._manuallyFloatingLabel = false;
- }
- };
- /**
- * Given that we are not actually focusing active options, we must manually adjust scroll
- * to reveal options below the fold. First, we find the offset of the option from the top
- * of the panel. If that offset is below the fold, the new scrollTop will be the offset -
- * the panel height + the option height, so the active option will be just visible at the
- * bottom of the panel. If that offset is above the top of the visible panel, the new scrollTop
- * will become the offset. If that offset is visible within the panel already, the scrollTop is
- * not adjusted.
- */
- /**
- * Given that we are not actually focusing active options, we must manually adjust scroll
- * to reveal options below the fold. First, we find the offset of the option from the top
- * of the panel. If that offset is below the fold, the new scrollTop will be the offset -
- * the panel height + the option height, so the active option will be just visible at the
- * bottom of the panel. If that offset is above the top of the visible panel, the new scrollTop
- * will become the offset. If that offset is visible within the panel already, the scrollTop is
- * not adjusted.
- * @private
- * @return {?}
- */
- MatAutocompleteTrigger.prototype._scrollToOption = /**
- * Given that we are not actually focusing active options, we must manually adjust scroll
- * to reveal options below the fold. First, we find the offset of the option from the top
- * of the panel. If that offset is below the fold, the new scrollTop will be the offset -
- * the panel height + the option height, so the active option will be just visible at the
- * bottom of the panel. If that offset is above the top of the visible panel, the new scrollTop
- * will become the offset. If that offset is visible within the panel already, the scrollTop is
- * not adjusted.
- * @private
- * @return {?}
- */
- function () {
- /** @type {?} */
- var index = this.autocomplete._keyManager.activeItemIndex || 0;
- /** @type {?} */
- var labelCount = _countGroupLabelsBeforeOption(index, this.autocomplete.options, this.autocomplete.optionGroups);
- /** @type {?} */
- var newScrollPosition = _getOptionScrollPosition(index + labelCount, AUTOCOMPLETE_OPTION_HEIGHT, this.autocomplete._getScrollTop(), AUTOCOMPLETE_PANEL_HEIGHT);
- this.autocomplete._setScrollTop(newScrollPosition);
- };
- /**
- * This method listens to a stream of panel closing actions and resets the
- * stream every time the option list changes.
- */
- /**
- * This method listens to a stream of panel closing actions and resets the
- * stream every time the option list changes.
- * @private
- * @return {?}
- */
- MatAutocompleteTrigger.prototype._subscribeToClosingActions = /**
- * This method listens to a stream of panel closing actions and resets the
- * stream every time the option list changes.
- * @private
- * @return {?}
- */
- function () {
- var _this = this;
- /** @type {?} */
- var firstStable = this._zone.onStable.asObservable().pipe(operators.take(1));
- /** @type {?} */
- var optionChanges = this.autocomplete.options.changes.pipe(operators.tap((/**
- * @return {?}
- */
- function () { return _this._positionStrategy.reapplyLastPosition(); })),
- // Defer emitting to the stream until the next tick, because changing
- // bindings in here will cause "changed after checked" errors.
- operators.delay(0));
- // When the zone is stable initially, and when the option list changes...
- return rxjs.merge(firstStable, optionChanges)
- .pipe(
- // create a new stream of panelClosingActions, replacing any previous streams
- // that were created, and flatten it so our stream only emits closing events...
- operators.switchMap((/**
- * @return {?}
- */
- function () {
- /** @type {?} */
- var wasOpen = _this.panelOpen;
- _this._resetActiveItem();
- _this.autocomplete._setVisibility();
- if (_this.panelOpen) {
- (/** @type {?} */ (_this._overlayRef)).updatePosition();
- // If the `panelOpen` state changed, we need to make sure to emit the `opened`
- // event, because we may not have emitted it when the panel was attached. This
- // can happen if the users opens the panel and there are no options, but the
- // options come in slightly later or as a result of the value changing.
- if (wasOpen !== _this.panelOpen) {
- _this.autocomplete.opened.emit();
- }
- }
- return _this.panelClosingActions;
- })),
- // when the first closing event occurs...
- operators.take(1))
- // set the value, close the panel, and complete.
- .subscribe((/**
- * @param {?} event
- * @return {?}
- */
- function (event) { return _this._setValueAndClose(event); }));
- };
- /** Destroys the autocomplete suggestion panel. */
- /**
- * Destroys the autocomplete suggestion panel.
- * @private
- * @return {?}
- */
- MatAutocompleteTrigger.prototype._destroyPanel = /**
- * Destroys the autocomplete suggestion panel.
- * @private
- * @return {?}
- */
- function () {
- if (this._overlayRef) {
- this.closePanel();
- this._overlayRef.dispose();
- this._overlayRef = null;
- }
- };
- /**
- * @private
- * @param {?} value
- * @return {?}
- */
- MatAutocompleteTrigger.prototype._setTriggerValue = /**
- * @private
- * @param {?} value
- * @return {?}
- */
- function (value) {
- /** @type {?} */
- var toDisplay = this.autocomplete && this.autocomplete.displayWith ?
- this.autocomplete.displayWith(value) :
- value;
- // Simply falling back to an empty string if the display value is falsy does not work properly.
- // The display value can also be the number zero and shouldn't fall back to an empty string.
- /** @type {?} */
- var inputValue = toDisplay != null ? toDisplay : '';
- // If it's used within a `MatFormField`, we should set it through the property so it can go
- // through change detection.
- if (this._formField) {
- this._formField._control.value = inputValue;
- }
- else {
- this._element.nativeElement.value = inputValue;
- }
- this._previousValue = inputValue;
- };
- /**
- * This method closes the panel, and if a value is specified, also sets the associated
- * control to that value. It will also mark the control as dirty if this interaction
- * stemmed from the user.
- */
- /**
- * This method closes the panel, and if a value is specified, also sets the associated
- * control to that value. It will also mark the control as dirty if this interaction
- * stemmed from the user.
- * @private
- * @param {?} event
- * @return {?}
- */
- MatAutocompleteTrigger.prototype._setValueAndClose = /**
- * This method closes the panel, and if a value is specified, also sets the associated
- * control to that value. It will also mark the control as dirty if this interaction
- * stemmed from the user.
- * @private
- * @param {?} event
- * @return {?}
- */
- function (event) {
- if (event && event.source) {
- this._clearPreviousSelectedOption(event.source);
- this._setTriggerValue(event.source.value);
- this._onChange(event.source.value);
- this._element.nativeElement.focus();
- this.autocomplete._emitSelectEvent(event.source);
- }
- this.closePanel();
- };
- /**
- * Clear any previous selected option and emit a selection change event for this option
- */
- /**
- * Clear any previous selected option and emit a selection change event for this option
- * @private
- * @param {?} skip
- * @return {?}
- */
- MatAutocompleteTrigger.prototype._clearPreviousSelectedOption = /**
- * Clear any previous selected option and emit a selection change event for this option
- * @private
- * @param {?} skip
- * @return {?}
- */
- function (skip) {
- this.autocomplete.options.forEach((/**
- * @param {?} option
- * @return {?}
- */
- function (option) {
- if (option != skip && option.selected) {
- option.deselect();
- }
- }));
- };
- /**
- * @private
- * @return {?}
- */
- MatAutocompleteTrigger.prototype._attachOverlay = /**
- * @private
- * @return {?}
- */
- function () {
- var _this = this;
- if (!this.autocomplete) {
- throw getMatAutocompleteMissingPanelError();
- }
- /** @type {?} */
- var overlayRef = this._overlayRef;
- if (!overlayRef) {
- this._portal = new portal.TemplatePortal(this.autocomplete.template, this._viewContainerRef);
- overlayRef = this._overlay.create(this._getOverlayConfig());
- this._overlayRef = overlayRef;
- // Use the `keydownEvents` in order to take advantage of
- // the overlay event targeting provided by the CDK overlay.
- overlayRef.keydownEvents().subscribe((/**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- // Close when pressing ESCAPE or ALT + UP_ARROW, based on the a11y guidelines.
- // See: https://www.w3.org/TR/wai-aria-practices-1.1/#textbox-keyboard-interaction
- if (event.keyCode === keycodes.ESCAPE || (event.keyCode === keycodes.UP_ARROW && event.altKey)) {
- _this._resetActiveItem();
- _this._closeKeyEventStream.next();
- // We need to stop propagation, otherwise the event will eventually
- // reach the input itself and cause the overlay to be reopened.
- event.stopPropagation();
- event.preventDefault();
- }
- }));
- if (this._viewportRuler) {
- this._viewportSubscription = this._viewportRuler.change().subscribe((/**
- * @return {?}
- */
- function () {
- if (_this.panelOpen && overlayRef) {
- overlayRef.updateSize({ width: _this._getPanelWidth() });
- }
- }));
- }
- }
- else {
- // Update the trigger, panel width and direction, in case anything has changed.
- this._positionStrategy.setOrigin(this._getConnectedElement());
- overlayRef.updateSize({ width: this._getPanelWidth() });
- }
- if (overlayRef && !overlayRef.hasAttached()) {
- overlayRef.attach(this._portal);
- this._closingActionsSubscription = this._subscribeToClosingActions();
- }
- /** @type {?} */
- var wasOpen = this.panelOpen;
- this.autocomplete._setVisibility();
- this.autocomplete._isOpen = this._overlayAttached = true;
- // We need to do an extra `panelOpen` check in here, because the
- // autocomplete won't be shown if there are no options.
- if (this.panelOpen && wasOpen !== this.panelOpen) {
- this.autocomplete.opened.emit();
- }
- };
- /**
- * @private
- * @return {?}
- */
- MatAutocompleteTrigger.prototype._getOverlayConfig = /**
- * @private
- * @return {?}
- */
- function () {
- return new overlay.OverlayConfig({
- positionStrategy: this._getOverlayPosition(),
- scrollStrategy: this._scrollStrategy(),
- width: this._getPanelWidth(),
- direction: this._dir
- });
- };
- /**
- * @private
- * @return {?}
- */
- MatAutocompleteTrigger.prototype._getOverlayPosition = /**
- * @private
- * @return {?}
- */
- function () {
- /** @type {?} */
- var strategy = this._overlay.position()
- .flexibleConnectedTo(this._getConnectedElement())
- .withFlexibleDimensions(false)
- .withPush(false);
- this._setStrategyPositions(strategy);
- this._positionStrategy = strategy;
- return strategy;
- };
- /** Sets the positions on a position strategy based on the directive's input state. */
- /**
- * Sets the positions on a position strategy based on the directive's input state.
- * @private
- * @param {?} positionStrategy
- * @return {?}
- */
- MatAutocompleteTrigger.prototype._setStrategyPositions = /**
- * Sets the positions on a position strategy based on the directive's input state.
- * @private
- * @param {?} positionStrategy
- * @return {?}
- */
- function (positionStrategy) {
- /** @type {?} */
- var belowPosition = {
- originX: 'start',
- originY: 'bottom',
- overlayX: 'start',
- overlayY: 'top'
- };
- /** @type {?} */
- var abovePosition = {
- originX: 'start',
- originY: 'top',
- overlayX: 'start',
- overlayY: 'bottom',
- // The overlay edge connected to the trigger should have squared corners, while
- // the opposite end has rounded corners. We apply a CSS class to swap the
- // border-radius based on the overlay position.
- panelClass: 'mat-autocomplete-panel-above'
- };
- /** @type {?} */
- var positions;
- if (this.position === 'above') {
- positions = [abovePosition];
- }
- else if (this.position === 'below') {
- positions = [belowPosition];
- }
- else {
- positions = [belowPosition, abovePosition];
- }
- positionStrategy.withPositions(positions);
- };
- /**
- * @private
- * @return {?}
- */
- MatAutocompleteTrigger.prototype._getConnectedElement = /**
- * @private
- * @return {?}
- */
- function () {
- if (this.connectedTo) {
- return this.connectedTo.elementRef;
- }
- return this._formField ? this._formField.getConnectedOverlayOrigin() : this._element;
- };
- /**
- * @private
- * @return {?}
- */
- MatAutocompleteTrigger.prototype._getPanelWidth = /**
- * @private
- * @return {?}
- */
- function () {
- return this.autocomplete.panelWidth || this._getHostWidth();
- };
- /** Returns the width of the input element, so the panel width can match it. */
- /**
- * Returns the width of the input element, so the panel width can match it.
- * @private
- * @return {?}
- */
- MatAutocompleteTrigger.prototype._getHostWidth = /**
- * Returns the width of the input element, so the panel width can match it.
- * @private
- * @return {?}
- */
- function () {
- return this._getConnectedElement().nativeElement.getBoundingClientRect().width;
- };
- /**
- * Resets the active item to -1 so arrow events will activate the
- * correct options, or to 0 if the consumer opted into it.
- */
- /**
- * Resets the active item to -1 so arrow events will activate the
- * correct options, or to 0 if the consumer opted into it.
- * @private
- * @return {?}
- */
- MatAutocompleteTrigger.prototype._resetActiveItem = /**
- * Resets the active item to -1 so arrow events will activate the
- * correct options, or to 0 if the consumer opted into it.
- * @private
- * @return {?}
- */
- function () {
- this.autocomplete._keyManager.setActiveItem(this.autocomplete.autoActiveFirstOption ? 0 : -1);
- };
- /** Determines whether the panel can be opened. */
- /**
- * Determines whether the panel can be opened.
- * @private
- * @return {?}
- */
- MatAutocompleteTrigger.prototype._canOpen = /**
- * Determines whether the panel can be opened.
- * @private
- * @return {?}
- */
- function () {
- /** @type {?} */
- var element = this._element.nativeElement;
- return !element.readOnly && !element.disabled && !this._autocompleteDisabled;
- };
- MatAutocompleteTrigger.decorators = [
- { type: core.Directive, args: [{
- selector: "input[matAutocomplete], textarea[matAutocomplete]",
- host: {
- '[attr.autocomplete]': 'autocompleteAttribute',
- '[attr.role]': 'autocompleteDisabled ? null : "combobox"',
- '[attr.aria-autocomplete]': 'autocompleteDisabled ? null : "list"',
- '[attr.aria-activedescendant]': '(panelOpen && activeOption) ? activeOption.id : null',
- '[attr.aria-expanded]': 'autocompleteDisabled ? null : panelOpen.toString()',
- '[attr.aria-owns]': '(autocompleteDisabled || !panelOpen) ? null : autocomplete?.id',
- '[attr.aria-haspopup]': '!autocompleteDisabled',
- // Note: we use `focusin`, as opposed to `focus`, in order to open the panel
- // a little earlier. This avoids issues where IE delays the focusing of the input.
- '(focusin)': '_handleFocus()',
- '(blur)': '_onTouched()',
- '(input)': '_handleInput($event)',
- '(keydown)': '_handleKeydown($event)',
- },
- exportAs: 'matAutocompleteTrigger',
- providers: [MAT_AUTOCOMPLETE_VALUE_ACCESSOR]
- },] },
- ];
- /** @nocollapse */
- MatAutocompleteTrigger.ctorParameters = function () { return [
- { type: core.ElementRef },
- { type: overlay.Overlay },
- { type: core.ViewContainerRef },
- { type: core.NgZone },
- { type: core.ChangeDetectorRef },
- { type: undefined, decorators: [{ type: core.Inject, args: [MAT_AUTOCOMPLETE_SCROLL_STRATEGY,] }] },
- { type: bidi.Directionality, decorators: [{ type: core.Optional }] },
- { type: MatFormField, decorators: [{ type: core.Optional }, { type: core.Host }] },
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [common.DOCUMENT,] }] },
- { type: scrolling.ViewportRuler }
- ]; };
- MatAutocompleteTrigger.propDecorators = {
- autocomplete: [{ type: core.Input, args: ['matAutocomplete',] }],
- position: [{ type: core.Input, args: ['matAutocompletePosition',] }],
- connectedTo: [{ type: core.Input, args: ['matAutocompleteConnectedTo',] }],
- autocompleteAttribute: [{ type: core.Input, args: ['autocomplete',] }],
- autocompleteDisabled: [{ type: core.Input, args: ['matAutocompleteDisabled',] }]
- };
- return MatAutocompleteTrigger;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var MatAutocompleteModule = /** @class */ (function () {
- function MatAutocompleteModule() {
- }
- MatAutocompleteModule.decorators = [
- { type: core.NgModule, args: [{
- imports: [MatOptionModule, overlay.OverlayModule, MatCommonModule, common.CommonModule],
- exports: [
- MatAutocomplete,
- MatOptionModule,
- MatAutocompleteTrigger,
- MatAutocompleteOrigin,
- MatCommonModule
- ],
- declarations: [MatAutocomplete, MatAutocompleteTrigger, MatAutocompleteOrigin],
- providers: [MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY_PROVIDER],
- },] },
- ];
- return MatAutocompleteModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /** @type {?} */
- var nextId = 0;
- // Boilerplate for applying mixins to MatBadge.
- /**
- * \@docs-private
- */
- var
- // Boilerplate for applying mixins to MatBadge.
- /**
- * \@docs-private
- */
- MatBadgeBase = /** @class */ (function () {
- function MatBadgeBase() {
- }
- return MatBadgeBase;
- }());
- /** @type {?} */
- var _MatBadgeMixinBase = mixinDisabled(MatBadgeBase);
- /**
- * Directive to display a text badge.
- */
- var MatBadge = /** @class */ (function (_super) {
- __extends(MatBadge, _super);
- function MatBadge(_ngZone, _elementRef, _ariaDescriber, _renderer, _animationMode) {
- var _this = _super.call(this) || this;
- _this._ngZone = _ngZone;
- _this._elementRef = _elementRef;
- _this._ariaDescriber = _ariaDescriber;
- _this._renderer = _renderer;
- _this._animationMode = _animationMode;
- /**
- * Whether the badge has any content.
- */
- _this._hasContent = false;
- _this._color = 'primary';
- _this._overlap = true;
- /**
- * Position the badge should reside.
- * Accepts any combination of 'above'|'below' and 'before'|'after'
- */
- _this.position = 'above after';
- /**
- * Size of the badge. Can be 'small', 'medium', or 'large'.
- */
- _this.size = 'medium';
- /**
- * Unique id for the badge
- */
- _this._id = nextId++;
- if (core.isDevMode()) {
- /** @type {?} */
- var nativeElement = _elementRef.nativeElement;
- if (nativeElement.nodeType !== nativeElement.ELEMENT_NODE) {
- throw Error('matBadge must be attached to an element node.');
- }
- }
- return _this;
- }
- Object.defineProperty(MatBadge.prototype, "color", {
- /** The color of the badge. Can be `primary`, `accent`, or `warn`. */
- get: /**
- * The color of the badge. Can be `primary`, `accent`, or `warn`.
- * @return {?}
- */
- function () { return this._color; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._setColor(value);
- this._color = value;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatBadge.prototype, "overlap", {
- /** Whether the badge should overlap its contents or not */
- get: /**
- * Whether the badge should overlap its contents or not
- * @return {?}
- */
- function () { return this._overlap; },
- set: /**
- * @param {?} val
- * @return {?}
- */
- function (val) {
- this._overlap = coercion.coerceBooleanProperty(val);
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatBadge.prototype, "description", {
- /** Message used to describe the decorated element via aria-describedby */
- get: /**
- * Message used to describe the decorated element via aria-describedby
- * @return {?}
- */
- function () { return this._description; },
- set: /**
- * @param {?} newDescription
- * @return {?}
- */
- function (newDescription) {
- if (newDescription !== this._description) {
- /** @type {?} */
- var badgeElement = this._badgeElement;
- this._updateHostAriaDescription(newDescription, this._description);
- this._description = newDescription;
- if (badgeElement) {
- newDescription ? badgeElement.setAttribute('aria-label', newDescription) :
- badgeElement.removeAttribute('aria-label');
- }
- }
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatBadge.prototype, "hidden", {
- /** Whether the badge is hidden. */
- get: /**
- * Whether the badge is hidden.
- * @return {?}
- */
- function () { return this._hidden; },
- set: /**
- * @param {?} val
- * @return {?}
- */
- function (val) {
- this._hidden = coercion.coerceBooleanProperty(val);
- },
- enumerable: true,
- configurable: true
- });
- /** Whether the badge is above the host or not */
- /**
- * Whether the badge is above the host or not
- * @return {?}
- */
- MatBadge.prototype.isAbove = /**
- * Whether the badge is above the host or not
- * @return {?}
- */
- function () {
- return this.position.indexOf('below') === -1;
- };
- /** Whether the badge is after the host or not */
- /**
- * Whether the badge is after the host or not
- * @return {?}
- */
- MatBadge.prototype.isAfter = /**
- * Whether the badge is after the host or not
- * @return {?}
- */
- function () {
- return this.position.indexOf('before') === -1;
- };
- /**
- * @param {?} changes
- * @return {?}
- */
- MatBadge.prototype.ngOnChanges = /**
- * @param {?} changes
- * @return {?}
- */
- function (changes) {
- /** @type {?} */
- var contentChange = changes['content'];
- if (contentChange) {
- /** @type {?} */
- var value = contentChange.currentValue;
- this._hasContent = value != null && ("" + value).trim().length > 0;
- this._updateTextContent();
- }
- };
- /**
- * @return {?}
- */
- MatBadge.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- /** @type {?} */
- var badgeElement = this._badgeElement;
- if (badgeElement) {
- if (this.description) {
- this._ariaDescriber.removeDescription(badgeElement, this.description);
- }
- // When creating a badge through the Renderer, Angular will keep it in an index.
- // We have to destroy it ourselves, otherwise it'll be retained in memory.
- if (this._renderer.destroyNode) {
- this._renderer.destroyNode(badgeElement);
- }
- }
- };
- /**
- * Gets the element into which the badge's content is being rendered.
- * Undefined if the element hasn't been created (e.g. if the badge doesn't have content).
- */
- /**
- * Gets the element into which the badge's content is being rendered.
- * Undefined if the element hasn't been created (e.g. if the badge doesn't have content).
- * @return {?}
- */
- MatBadge.prototype.getBadgeElement = /**
- * Gets the element into which the badge's content is being rendered.
- * Undefined if the element hasn't been created (e.g. if the badge doesn't have content).
- * @return {?}
- */
- function () {
- return this._badgeElement;
- };
- /** Injects a span element into the DOM with the content. */
- /**
- * Injects a span element into the DOM with the content.
- * @private
- * @return {?}
- */
- MatBadge.prototype._updateTextContent = /**
- * Injects a span element into the DOM with the content.
- * @private
- * @return {?}
- */
- function () {
- if (!this._badgeElement) {
- this._badgeElement = this._createBadgeElement();
- }
- else {
- this._badgeElement.textContent = this.content;
- }
- return this._badgeElement;
- };
- /** Creates the badge element */
- /**
- * Creates the badge element
- * @private
- * @return {?}
- */
- MatBadge.prototype._createBadgeElement = /**
- * Creates the badge element
- * @private
- * @return {?}
- */
- function () {
- /** @type {?} */
- var badgeElement = this._renderer.createElement('span');
- /** @type {?} */
- var activeClass = 'mat-badge-active';
- /** @type {?} */
- var contentClass = 'mat-badge-content';
- // Clear any existing badges which may have persisted from a server-side render.
- this._clearExistingBadges(contentClass);
- badgeElement.setAttribute('id', "mat-badge-content-" + this._id);
- badgeElement.classList.add(contentClass);
- badgeElement.textContent = this.content;
- if (this._animationMode === 'NoopAnimations') {
- badgeElement.classList.add('_mat-animation-noopable');
- }
- if (this.description) {
- badgeElement.setAttribute('aria-label', this.description);
- }
- this._elementRef.nativeElement.appendChild(badgeElement);
- // animate in after insertion
- if (typeof requestAnimationFrame === 'function' && this._animationMode !== 'NoopAnimations') {
- this._ngZone.runOutsideAngular((/**
- * @return {?}
- */
- function () {
- requestAnimationFrame((/**
- * @return {?}
- */
- function () {
- badgeElement.classList.add(activeClass);
- }));
- }));
- }
- else {
- badgeElement.classList.add(activeClass);
- }
- return badgeElement;
- };
- /** Sets the aria-label property on the element */
- /**
- * Sets the aria-label property on the element
- * @private
- * @param {?} newDescription
- * @param {?} oldDescription
- * @return {?}
- */
- MatBadge.prototype._updateHostAriaDescription = /**
- * Sets the aria-label property on the element
- * @private
- * @param {?} newDescription
- * @param {?} oldDescription
- * @return {?}
- */
- function (newDescription, oldDescription) {
- // ensure content available before setting label
- /** @type {?} */
- var content = this._updateTextContent();
- if (oldDescription) {
- this._ariaDescriber.removeDescription(content, oldDescription);
- }
- if (newDescription) {
- this._ariaDescriber.describe(content, newDescription);
- }
- };
- /** Adds css theme class given the color to the component host */
- /**
- * Adds css theme class given the color to the component host
- * @private
- * @param {?} colorPalette
- * @return {?}
- */
- MatBadge.prototype._setColor = /**
- * Adds css theme class given the color to the component host
- * @private
- * @param {?} colorPalette
- * @return {?}
- */
- function (colorPalette) {
- if (colorPalette !== this._color) {
- if (this._color) {
- this._elementRef.nativeElement.classList.remove("mat-badge-" + this._color);
- }
- if (colorPalette) {
- this._elementRef.nativeElement.classList.add("mat-badge-" + colorPalette);
- }
- }
- };
- /** Clears any existing badges that might be left over from server-side rendering. */
- /**
- * Clears any existing badges that might be left over from server-side rendering.
- * @private
- * @param {?} cssClass
- * @return {?}
- */
- MatBadge.prototype._clearExistingBadges = /**
- * Clears any existing badges that might be left over from server-side rendering.
- * @private
- * @param {?} cssClass
- * @return {?}
- */
- function (cssClass) {
- /** @type {?} */
- var element = this._elementRef.nativeElement;
- /** @type {?} */
- var childCount = element.children.length;
- // Use a reverse while, because we'll be removing elements from the list as we're iterating.
- while (childCount--) {
- /** @type {?} */
- var currentChild = element.children[childCount];
- if (currentChild.classList.contains(cssClass)) {
- element.removeChild(currentChild);
- }
- }
- };
- MatBadge.decorators = [
- { type: core.Directive, args: [{
- selector: '[matBadge]',
- inputs: ['disabled: matBadgeDisabled'],
- host: {
- 'class': 'mat-badge',
- '[class.mat-badge-overlap]': 'overlap',
- '[class.mat-badge-above]': 'isAbove()',
- '[class.mat-badge-below]': '!isAbove()',
- '[class.mat-badge-before]': '!isAfter()',
- '[class.mat-badge-after]': 'isAfter()',
- '[class.mat-badge-small]': 'size === "small"',
- '[class.mat-badge-medium]': 'size === "medium"',
- '[class.mat-badge-large]': 'size === "large"',
- '[class.mat-badge-hidden]': 'hidden || !_hasContent',
- '[class.mat-badge-disabled]': 'disabled',
- },
- },] },
- ];
- /** @nocollapse */
- MatBadge.ctorParameters = function () { return [
- { type: core.NgZone },
- { type: core.ElementRef },
- { type: a11y.AriaDescriber },
- { type: core.Renderer2 },
- { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
- ]; };
- MatBadge.propDecorators = {
- color: [{ type: core.Input, args: ['matBadgeColor',] }],
- overlap: [{ type: core.Input, args: ['matBadgeOverlap',] }],
- position: [{ type: core.Input, args: ['matBadgePosition',] }],
- content: [{ type: core.Input, args: ['matBadge',] }],
- description: [{ type: core.Input, args: ['matBadgeDescription',] }],
- size: [{ type: core.Input, args: ['matBadgeSize',] }],
- hidden: [{ type: core.Input, args: ['matBadgeHidden',] }]
- };
- return MatBadge;
- }(_MatBadgeMixinBase));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var MatBadgeModule = /** @class */ (function () {
- function MatBadgeModule() {
- }
- MatBadgeModule.decorators = [
- { type: core.NgModule, args: [{
- imports: [
- a11y.A11yModule,
- MatCommonModule
- ],
- exports: [MatBadge],
- declarations: [MatBadge],
- },] },
- ];
- return MatBadgeModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Injection token that can be used to access the data that was passed in to a bottom sheet.
- * @type {?}
- */
- var MAT_BOTTOM_SHEET_DATA = new core.InjectionToken('MatBottomSheetData');
- /**
- * Configuration used when opening a bottom sheet.
- * @template D
- */
- var /**
- * Configuration used when opening a bottom sheet.
- * @template D
- */
- MatBottomSheetConfig = /** @class */ (function () {
- function MatBottomSheetConfig() {
- /**
- * Data being injected into the child component.
- */
- this.data = null;
- /**
- * Whether the bottom sheet has a backdrop.
- */
- this.hasBackdrop = true;
- /**
- * Whether the user can use escape or clicking outside to close the bottom sheet.
- */
- this.disableClose = false;
- /**
- * Aria label to assign to the bottom sheet element.
- */
- this.ariaLabel = null;
- /**
- * Whether the bottom sheet should close when the user goes backwards/forwards in history.
- * Note that this usually doesn't include clicking on links (unless the user is using
- * the `HashLocationStrategy`).
- */
- this.closeOnNavigation = true;
- // Note that this is disabled by default, because while the a11y recommendations are to focus
- // the first focusable element, doing so prevents screen readers from reading out the
- // rest of the bottom sheet content.
- /**
- * Whether the bottom sheet should focus the first focusable element on open.
- */
- this.autoFocus = false;
- /**
- * Whether the bottom sheet should restore focus to the
- * previously-focused element, after it's closed.
- */
- this.restoreFocus = true;
- }
- return MatBottomSheetConfig;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Animations used by the Material bottom sheet.
- * @type {?}
- */
- var matBottomSheetAnimations = {
- /**
- * Animation that shows and hides a bottom sheet.
- */
- bottomSheetState: animations$1.trigger('state', [
- animations$1.state('void, hidden', animations$1.style({ transform: 'translateY(100%)' })),
- animations$1.state('visible', animations$1.style({ transform: 'translateY(0%)' })),
- animations$1.transition('visible => void, visible => hidden', animations$1.animate(AnimationDurations.COMPLEX + " " + AnimationCurves.ACCELERATION_CURVE)),
- animations$1.transition('void => visible', animations$1.animate(AnimationDurations.EXITING + " " + AnimationCurves.DECELERATION_CURVE)),
- ])
- };
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- // TODO(crisbeto): consolidate some logic between this, MatDialog and MatSnackBar
- /**
- * Internal component that wraps user-provided bottom sheet content.
- * \@docs-private
- */
- var MatBottomSheetContainer = /** @class */ (function (_super) {
- __extends(MatBottomSheetContainer, _super);
- function MatBottomSheetContainer(_elementRef, _changeDetectorRef, _focusTrapFactory, breakpointObserver, document, bottomSheetConfig) {
- var _this = _super.call(this) || this;
- _this._elementRef = _elementRef;
- _this._changeDetectorRef = _changeDetectorRef;
- _this._focusTrapFactory = _focusTrapFactory;
- _this.bottomSheetConfig = bottomSheetConfig;
- /**
- * The state of the bottom sheet animations.
- */
- _this._animationState = 'void';
- /**
- * Emits whenever the state of the animation changes.
- */
- _this._animationStateChanged = new core.EventEmitter();
- /**
- * Element that was focused before the bottom sheet was opened.
- */
- _this._elementFocusedBeforeOpened = null;
- _this._document = document;
- _this._breakpointSubscription = breakpointObserver
- .observe([layout.Breakpoints.Medium, layout.Breakpoints.Large, layout.Breakpoints.XLarge])
- .subscribe((/**
- * @return {?}
- */
- function () {
- _this._toggleClass('mat-bottom-sheet-container-medium', breakpointObserver.isMatched(layout.Breakpoints.Medium));
- _this._toggleClass('mat-bottom-sheet-container-large', breakpointObserver.isMatched(layout.Breakpoints.Large));
- _this._toggleClass('mat-bottom-sheet-container-xlarge', breakpointObserver.isMatched(layout.Breakpoints.XLarge));
- }));
- return _this;
- }
- /** Attach a component portal as content to this bottom sheet container. */
- /**
- * Attach a component portal as content to this bottom sheet container.
- * @template T
- * @param {?} portal
- * @return {?}
- */
- MatBottomSheetContainer.prototype.attachComponentPortal = /**
- * Attach a component portal as content to this bottom sheet container.
- * @template T
- * @param {?} portal
- * @return {?}
- */
- function (portal$$1) {
- this._validatePortalAttached();
- this._setPanelClass();
- this._savePreviouslyFocusedElement();
- return this._portalOutlet.attachComponentPortal(portal$$1);
- };
- /** Attach a template portal as content to this bottom sheet container. */
- /**
- * Attach a template portal as content to this bottom sheet container.
- * @template C
- * @param {?} portal
- * @return {?}
- */
- MatBottomSheetContainer.prototype.attachTemplatePortal = /**
- * Attach a template portal as content to this bottom sheet container.
- * @template C
- * @param {?} portal
- * @return {?}
- */
- function (portal$$1) {
- this._validatePortalAttached();
- this._setPanelClass();
- this._savePreviouslyFocusedElement();
- return this._portalOutlet.attachTemplatePortal(portal$$1);
- };
- /** Begin animation of bottom sheet entrance into view. */
- /**
- * Begin animation of bottom sheet entrance into view.
- * @return {?}
- */
- MatBottomSheetContainer.prototype.enter = /**
- * Begin animation of bottom sheet entrance into view.
- * @return {?}
- */
- function () {
- if (!this._destroyed) {
- this._animationState = 'visible';
- this._changeDetectorRef.detectChanges();
- }
- };
- /** Begin animation of the bottom sheet exiting from view. */
- /**
- * Begin animation of the bottom sheet exiting from view.
- * @return {?}
- */
- MatBottomSheetContainer.prototype.exit = /**
- * Begin animation of the bottom sheet exiting from view.
- * @return {?}
- */
- function () {
- if (!this._destroyed) {
- this._animationState = 'hidden';
- this._changeDetectorRef.markForCheck();
- }
- };
- /**
- * @return {?}
- */
- MatBottomSheetContainer.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- this._breakpointSubscription.unsubscribe();
- this._destroyed = true;
- };
- /**
- * @param {?} event
- * @return {?}
- */
- MatBottomSheetContainer.prototype._onAnimationDone = /**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- if (event.toState === 'hidden') {
- this._restoreFocus();
- }
- else if (event.toState === 'visible') {
- this._trapFocus();
- }
- this._animationStateChanged.emit(event);
- };
- /**
- * @param {?} event
- * @return {?}
- */
- MatBottomSheetContainer.prototype._onAnimationStart = /**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- this._animationStateChanged.emit(event);
- };
- /**
- * @private
- * @param {?} cssClass
- * @param {?} add
- * @return {?}
- */
- MatBottomSheetContainer.prototype._toggleClass = /**
- * @private
- * @param {?} cssClass
- * @param {?} add
- * @return {?}
- */
- function (cssClass, add) {
- /** @type {?} */
- var classList = this._elementRef.nativeElement.classList;
- add ? classList.add(cssClass) : classList.remove(cssClass);
- };
- /**
- * @private
- * @return {?}
- */
- MatBottomSheetContainer.prototype._validatePortalAttached = /**
- * @private
- * @return {?}
- */
- function () {
- if (this._portalOutlet.hasAttached()) {
- throw Error('Attempting to attach bottom sheet content after content is already attached');
- }
- };
- /**
- * @private
- * @return {?}
- */
- MatBottomSheetContainer.prototype._setPanelClass = /**
- * @private
- * @return {?}
- */
- function () {
- /** @type {?} */
- var element = this._elementRef.nativeElement;
- /** @type {?} */
- var panelClass = this.bottomSheetConfig.panelClass;
- if (Array.isArray(panelClass)) {
- // Note that we can't use a spread here, because IE doesn't support multiple arguments.
- panelClass.forEach((/**
- * @param {?} cssClass
- * @return {?}
- */
- function (cssClass) { return element.classList.add(cssClass); }));
- }
- else if (panelClass) {
- element.classList.add(panelClass);
- }
- };
- /** Moves the focus inside the focus trap. */
- /**
- * Moves the focus inside the focus trap.
- * @private
- * @return {?}
- */
- MatBottomSheetContainer.prototype._trapFocus = /**
- * Moves the focus inside the focus trap.
- * @private
- * @return {?}
- */
- function () {
- /** @type {?} */
- var element = this._elementRef.nativeElement;
- if (!this._focusTrap) {
- this._focusTrap = this._focusTrapFactory.create(element);
- }
- if (this.bottomSheetConfig.autoFocus) {
- this._focusTrap.focusInitialElementWhenReady();
- }
- else {
- /** @type {?} */
- var activeElement = this._document.activeElement;
- // Otherwise ensure that focus is on the container. It's possible that a different
- // component tried to move focus while the open animation was running. See:
- // https://github.com/angular/components/issues/16215. Note that we only want to do this
- // if the focus isn't inside the bottom sheet already, because it's possible that the
- // consumer turned off `autoFocus` in order to move focus themselves.
- if (activeElement !== element && !element.contains(activeElement)) {
- element.focus();
- }
- }
- };
- /** Restores focus to the element that was focused before the bottom sheet was opened. */
- /**
- * Restores focus to the element that was focused before the bottom sheet was opened.
- * @private
- * @return {?}
- */
- MatBottomSheetContainer.prototype._restoreFocus = /**
- * Restores focus to the element that was focused before the bottom sheet was opened.
- * @private
- * @return {?}
- */
- function () {
- /** @type {?} */
- var toFocus = this._elementFocusedBeforeOpened;
- // We need the extra check, because IE can set the `activeElement` to null in some cases.
- if (this.bottomSheetConfig.restoreFocus && toFocus && typeof toFocus.focus === 'function') {
- toFocus.focus();
- }
- if (this._focusTrap) {
- this._focusTrap.destroy();
- }
- };
- /** Saves a reference to the element that was focused before the bottom sheet was opened. */
- /**
- * Saves a reference to the element that was focused before the bottom sheet was opened.
- * @private
- * @return {?}
- */
- MatBottomSheetContainer.prototype._savePreviouslyFocusedElement = /**
- * Saves a reference to the element that was focused before the bottom sheet was opened.
- * @private
- * @return {?}
- */
- function () {
- var _this = this;
- this._elementFocusedBeforeOpened = (/** @type {?} */ (this._document.activeElement));
- // The `focus` method isn't available during server-side rendering.
- if (this._elementRef.nativeElement.focus) {
- Promise.resolve().then((/**
- * @return {?}
- */
- function () { return _this._elementRef.nativeElement.focus(); }));
- }
- };
- MatBottomSheetContainer.decorators = [
- { type: core.Component, args: [{selector: 'mat-bottom-sheet-container',
- template: "<ng-template cdkPortalOutlet></ng-template>",
- 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)}"],
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- encapsulation: core.ViewEncapsulation.None,
- animations: [matBottomSheetAnimations.bottomSheetState],
- host: {
- 'class': 'mat-bottom-sheet-container',
- 'tabindex': '-1',
- 'role': 'dialog',
- 'aria-modal': 'true',
- '[attr.aria-label]': 'bottomSheetConfig?.ariaLabel',
- '[@state]': '_animationState',
- '(@state.start)': '_onAnimationStart($event)',
- '(@state.done)': '_onAnimationDone($event)'
- },
- },] },
- ];
- /** @nocollapse */
- MatBottomSheetContainer.ctorParameters = function () { return [
- { type: core.ElementRef },
- { type: core.ChangeDetectorRef },
- { type: a11y.FocusTrapFactory },
- { type: layout.BreakpointObserver },
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [common.DOCUMENT,] }] },
- { type: MatBottomSheetConfig }
- ]; };
- MatBottomSheetContainer.propDecorators = {
- _portalOutlet: [{ type: core.ViewChild, args: [portal.CdkPortalOutlet, { static: true },] }]
- };
- return MatBottomSheetContainer;
- }(portal.BasePortalOutlet));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var MatBottomSheetModule = /** @class */ (function () {
- function MatBottomSheetModule() {
- }
- MatBottomSheetModule.decorators = [
- { type: core.NgModule, args: [{
- imports: [
- common.CommonModule,
- overlay.OverlayModule,
- MatCommonModule,
- portal.PortalModule,
- ],
- exports: [MatBottomSheetContainer, MatCommonModule],
- declarations: [MatBottomSheetContainer],
- entryComponents: [MatBottomSheetContainer],
- },] },
- ];
- return MatBottomSheetModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Reference to a bottom sheet dispatched from the bottom sheet service.
- * @template T, R
- */
- var /**
- * Reference to a bottom sheet dispatched from the bottom sheet service.
- * @template T, R
- */
- MatBottomSheetRef = /** @class */ (function () {
- function MatBottomSheetRef(containerInstance, _overlayRef,
- // @breaking-change 8.0.0 `_location` parameter to be removed.
- _location) {
- var _this = this;
- this._overlayRef = _overlayRef;
- /**
- * Subject for notifying the user that the bottom sheet has been dismissed.
- */
- this._afterDismissed = new rxjs.Subject();
- /**
- * Subject for notifying the user that the bottom sheet has opened and appeared.
- */
- this._afterOpened = new rxjs.Subject();
- this.containerInstance = containerInstance;
- this.disableClose = containerInstance.bottomSheetConfig.disableClose;
- // Emit when opening animation completes
- containerInstance._animationStateChanged.pipe(operators.filter((/**
- * @param {?} event
- * @return {?}
- */
- function (event) { return event.phaseName === 'done' && event.toState === 'visible'; })), operators.take(1))
- .subscribe((/**
- * @return {?}
- */
- function () {
- _this._afterOpened.next();
- _this._afterOpened.complete();
- }));
- // Dispose overlay when closing animation is complete
- containerInstance._animationStateChanged
- .pipe(operators.filter((/**
- * @param {?} event
- * @return {?}
- */
- function (event) { return event.phaseName === 'done' && event.toState === 'hidden'; })), operators.take(1))
- .subscribe((/**
- * @return {?}
- */
- function () {
- clearTimeout(_this._closeFallbackTimeout);
- _overlayRef.dispose();
- }));
- _overlayRef.detachments().pipe(operators.take(1)).subscribe((/**
- * @return {?}
- */
- function () {
- _this._afterDismissed.next(_this._result);
- _this._afterDismissed.complete();
- }));
- rxjs.merge(_overlayRef.backdropClick(), _overlayRef.keydownEvents().pipe(operators.filter((/**
- * @param {?} event
- * @return {?}
- */
- function (event) { return event.keyCode === keycodes.ESCAPE; })))).subscribe((/**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- if (!_this.disableClose &&
- (event.type !== 'keydown' || !keycodes.hasModifierKey((/** @type {?} */ (event))))) {
- event.preventDefault();
- _this.dismiss();
- }
- }));
- }
- /**
- * Dismisses the bottom sheet.
- * @param result Data to be passed back to the bottom sheet opener.
- */
- /**
- * Dismisses the bottom sheet.
- * @param {?=} result Data to be passed back to the bottom sheet opener.
- * @return {?}
- */
- MatBottomSheetRef.prototype.dismiss = /**
- * Dismisses the bottom sheet.
- * @param {?=} result Data to be passed back to the bottom sheet opener.
- * @return {?}
- */
- function (result) {
- var _this = this;
- if (!this._afterDismissed.closed) {
- // Transition the backdrop in parallel to the bottom sheet.
- this.containerInstance._animationStateChanged.pipe(operators.filter((/**
- * @param {?} event
- * @return {?}
- */
- function (event) { return event.phaseName === 'start'; })), operators.take(1)).subscribe((/**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- // The logic that disposes of the overlay depends on the exit animation completing, however
- // it isn't guaranteed if the parent view is destroyed while it's running. Add a fallback
- // timeout which will clean everything up if the animation hasn't fired within the specified
- // amount of time plus 100ms. We don't need to run this outside the NgZone, because for the
- // vast majority of cases the timeout will have been cleared before it has fired.
- _this._closeFallbackTimeout = setTimeout((/**
- * @return {?}
- */
- function () {
- _this._overlayRef.dispose();
- }), event.totalTime + 100);
- _this._overlayRef.detachBackdrop();
- }));
- this._result = result;
- this.containerInstance.exit();
- }
- };
- /** Gets an observable that is notified when the bottom sheet is finished closing. */
- /**
- * Gets an observable that is notified when the bottom sheet is finished closing.
- * @return {?}
- */
- MatBottomSheetRef.prototype.afterDismissed = /**
- * Gets an observable that is notified when the bottom sheet is finished closing.
- * @return {?}
- */
- function () {
- return this._afterDismissed.asObservable();
- };
- /** Gets an observable that is notified when the bottom sheet has opened and appeared. */
- /**
- * Gets an observable that is notified when the bottom sheet has opened and appeared.
- * @return {?}
- */
- MatBottomSheetRef.prototype.afterOpened = /**
- * Gets an observable that is notified when the bottom sheet has opened and appeared.
- * @return {?}
- */
- function () {
- return this._afterOpened.asObservable();
- };
- /**
- * Gets an observable that emits when the overlay's backdrop has been clicked.
- */
- /**
- * Gets an observable that emits when the overlay's backdrop has been clicked.
- * @return {?}
- */
- MatBottomSheetRef.prototype.backdropClick = /**
- * Gets an observable that emits when the overlay's backdrop has been clicked.
- * @return {?}
- */
- function () {
- return this._overlayRef.backdropClick();
- };
- /**
- * Gets an observable that emits when keydown events are targeted on the overlay.
- */
- /**
- * Gets an observable that emits when keydown events are targeted on the overlay.
- * @return {?}
- */
- MatBottomSheetRef.prototype.keydownEvents = /**
- * Gets an observable that emits when keydown events are targeted on the overlay.
- * @return {?}
- */
- function () {
- return this._overlayRef.keydownEvents();
- };
- return MatBottomSheetRef;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Injection token that can be used to specify default bottom sheet options.
- * @type {?}
- */
- var MAT_BOTTOM_SHEET_DEFAULT_OPTIONS = new core.InjectionToken('mat-bottom-sheet-default-options');
- /**
- * Service to trigger Material Design bottom sheets.
- */
- var MatBottomSheet = /** @class */ (function () {
- function MatBottomSheet(_overlay, _injector, _parentBottomSheet, _location, _defaultOptions) {
- this._overlay = _overlay;
- this._injector = _injector;
- this._parentBottomSheet = _parentBottomSheet;
- this._location = _location;
- this._defaultOptions = _defaultOptions;
- this._bottomSheetRefAtThisLevel = null;
- }
- Object.defineProperty(MatBottomSheet.prototype, "_openedBottomSheetRef", {
- /** Reference to the currently opened bottom sheet. */
- get: /**
- * Reference to the currently opened bottom sheet.
- * @return {?}
- */
- function () {
- /** @type {?} */
- var parent = this._parentBottomSheet;
- return parent ? parent._openedBottomSheetRef : this._bottomSheetRefAtThisLevel;
- },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- if (this._parentBottomSheet) {
- this._parentBottomSheet._openedBottomSheetRef = value;
- }
- else {
- this._bottomSheetRefAtThisLevel = value;
- }
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @template T, D, R
- * @param {?} componentOrTemplateRef
- * @param {?=} config
- * @return {?}
- */
- MatBottomSheet.prototype.open = /**
- * @template T, D, R
- * @param {?} componentOrTemplateRef
- * @param {?=} config
- * @return {?}
- */
- function (componentOrTemplateRef, config) {
- var _this = this;
- /** @type {?} */
- var _config = _applyConfigDefaults(this._defaultOptions || new MatBottomSheetConfig(), config);
- /** @type {?} */
- var overlayRef = this._createOverlay(_config);
- /** @type {?} */
- var container = this._attachContainer(overlayRef, _config);
- /** @type {?} */
- var ref = new MatBottomSheetRef(container, overlayRef, this._location);
- if (componentOrTemplateRef instanceof core.TemplateRef) {
- container.attachTemplatePortal(new portal.TemplatePortal(componentOrTemplateRef, (/** @type {?} */ (null)), (/** @type {?} */ ({
- $implicit: _config.data,
- bottomSheetRef: ref
- }))));
- }
- else {
- /** @type {?} */
- var portal$$1 = new portal.ComponentPortal(componentOrTemplateRef, undefined, this._createInjector(_config, ref));
- /** @type {?} */
- var contentRef = container.attachComponentPortal(portal$$1);
- ref.instance = contentRef.instance;
- }
- // When the bottom sheet is dismissed, clear the reference to it.
- ref.afterDismissed().subscribe((/**
- * @return {?}
- */
- function () {
- // Clear the bottom sheet ref if it hasn't already been replaced by a newer one.
- if (_this._openedBottomSheetRef == ref) {
- _this._openedBottomSheetRef = null;
- }
- }));
- if (this._openedBottomSheetRef) {
- // If a bottom sheet is already in view, dismiss it and enter the
- // new bottom sheet after exit animation is complete.
- this._openedBottomSheetRef.afterDismissed().subscribe((/**
- * @return {?}
- */
- function () { return ref.containerInstance.enter(); }));
- this._openedBottomSheetRef.dismiss();
- }
- else {
- // If no bottom sheet is in view, enter the new bottom sheet.
- ref.containerInstance.enter();
- }
- this._openedBottomSheetRef = ref;
- return ref;
- };
- /**
- * Dismisses the currently-visible bottom sheet.
- */
- /**
- * Dismisses the currently-visible bottom sheet.
- * @return {?}
- */
- MatBottomSheet.prototype.dismiss = /**
- * Dismisses the currently-visible bottom sheet.
- * @return {?}
- */
- function () {
- if (this._openedBottomSheetRef) {
- this._openedBottomSheetRef.dismiss();
- }
- };
- /**
- * @return {?}
- */
- MatBottomSheet.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- if (this._bottomSheetRefAtThisLevel) {
- this._bottomSheetRefAtThisLevel.dismiss();
- }
- };
- /**
- * Attaches the bottom sheet container component to the overlay.
- */
- /**
- * Attaches the bottom sheet container component to the overlay.
- * @private
- * @param {?} overlayRef
- * @param {?} config
- * @return {?}
- */
- MatBottomSheet.prototype._attachContainer = /**
- * Attaches the bottom sheet container component to the overlay.
- * @private
- * @param {?} overlayRef
- * @param {?} config
- * @return {?}
- */
- function (overlayRef, config) {
- /** @type {?} */
- var userInjector = config && config.viewContainerRef && config.viewContainerRef.injector;
- /** @type {?} */
- var injector = new portal.PortalInjector(userInjector || this._injector, new WeakMap([
- [MatBottomSheetConfig, config]
- ]));
- /** @type {?} */
- var containerPortal = new portal.ComponentPortal(MatBottomSheetContainer, config.viewContainerRef, injector);
- /** @type {?} */
- var containerRef = overlayRef.attach(containerPortal);
- return containerRef.instance;
- };
- /**
- * Creates a new overlay and places it in the correct location.
- * @param config The user-specified bottom sheet config.
- */
- /**
- * Creates a new overlay and places it in the correct location.
- * @private
- * @param {?} config The user-specified bottom sheet config.
- * @return {?}
- */
- MatBottomSheet.prototype._createOverlay = /**
- * Creates a new overlay and places it in the correct location.
- * @private
- * @param {?} config The user-specified bottom sheet config.
- * @return {?}
- */
- function (config) {
- /** @type {?} */
- var overlayConfig = new overlay.OverlayConfig({
- direction: config.direction,
- hasBackdrop: config.hasBackdrop,
- disposeOnNavigation: config.closeOnNavigation,
- maxWidth: '100%',
- scrollStrategy: config.scrollStrategy || this._overlay.scrollStrategies.block(),
- positionStrategy: this._overlay.position().global().centerHorizontally().bottom('0')
- });
- if (config.backdropClass) {
- overlayConfig.backdropClass = config.backdropClass;
- }
- return this._overlay.create(overlayConfig);
- };
- /**
- * Creates an injector to be used inside of a bottom sheet component.
- * @param config Config that was used to create the bottom sheet.
- * @param bottomSheetRef Reference to the bottom sheet.
- */
- /**
- * Creates an injector to be used inside of a bottom sheet component.
- * @private
- * @template T
- * @param {?} config Config that was used to create the bottom sheet.
- * @param {?} bottomSheetRef Reference to the bottom sheet.
- * @return {?}
- */
- MatBottomSheet.prototype._createInjector = /**
- * Creates an injector to be used inside of a bottom sheet component.
- * @private
- * @template T
- * @param {?} config Config that was used to create the bottom sheet.
- * @param {?} bottomSheetRef Reference to the bottom sheet.
- * @return {?}
- */
- function (config, bottomSheetRef) {
- /** @type {?} */
- var userInjector = config && config.viewContainerRef && config.viewContainerRef.injector;
- /** @type {?} */
- var injectionTokens = new WeakMap([
- [MatBottomSheetRef, bottomSheetRef],
- [MAT_BOTTOM_SHEET_DATA, config.data]
- ]);
- if (config.direction &&
- (!userInjector || !userInjector.get(bidi.Directionality, null))) {
- injectionTokens.set(bidi.Directionality, {
- value: config.direction,
- change: rxjs.of()
- });
- }
- return new portal.PortalInjector(userInjector || this._injector, injectionTokens);
- };
- MatBottomSheet.decorators = [
- { type: core.Injectable, args: [{ providedIn: MatBottomSheetModule },] },
- ];
- /** @nocollapse */
- MatBottomSheet.ctorParameters = function () { return [
- { type: overlay.Overlay },
- { type: core.Injector },
- { type: MatBottomSheet, decorators: [{ type: core.Optional }, { type: core.SkipSelf }] },
- { type: common.Location, decorators: [{ type: core.Optional }] },
- { type: MatBottomSheetConfig, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_BOTTOM_SHEET_DEFAULT_OPTIONS,] }] }
- ]; };
- /** @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 });
- return MatBottomSheet;
- }());
- /**
- * Applies default options to the bottom sheet config.
- * @param {?} defaults Object containing the default values to which to fall back.
- * @param {?=} config The configuration to which the defaults will be applied.
- * @return {?} The new configuration object with defaults applied.
- */
- function _applyConfigDefaults(defaults, config) {
- return __assign({}, defaults, config);
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Default color palette for round buttons (mat-fab and mat-mini-fab)
- * @type {?}
- */
- var DEFAULT_ROUND_BUTTON_COLOR = 'accent';
- /**
- * List of classes to add to MatButton instances based on host attributes to
- * style as different variants.
- * @type {?}
- */
- var BUTTON_HOST_ATTRIBUTES = [
- 'mat-button',
- 'mat-flat-button',
- 'mat-icon-button',
- 'mat-raised-button',
- 'mat-stroked-button',
- 'mat-mini-fab',
- 'mat-fab',
- ];
- // Boilerplate for applying mixins to MatButton.
- /**
- * \@docs-private
- */
- var
- // Boilerplate for applying mixins to MatButton.
- /**
- * \@docs-private
- */
- MatButtonBase = /** @class */ (function () {
- function MatButtonBase(_elementRef) {
- this._elementRef = _elementRef;
- }
- return MatButtonBase;
- }());
- /** @type {?} */
- var _MatButtonMixinBase = mixinColor(mixinDisabled(mixinDisableRipple(MatButtonBase)));
- /**
- * Material design button.
- */
- var MatButton = /** @class */ (function (_super) {
- __extends(MatButton, _super);
- function MatButton(elementRef, _focusMonitor, _animationMode) {
- var _this = _super.call(this, elementRef) || this;
- _this._focusMonitor = _focusMonitor;
- _this._animationMode = _animationMode;
- /**
- * Whether the button is round.
- */
- _this.isRoundButton = _this._hasHostAttributes('mat-fab', 'mat-mini-fab');
- /**
- * Whether the button is icon button.
- */
- _this.isIconButton = _this._hasHostAttributes('mat-icon-button');
- // For each of the variant selectors that is present in the button's host
- // attributes, add the correct corresponding class.
- for (var _i = 0, BUTTON_HOST_ATTRIBUTES_1 = BUTTON_HOST_ATTRIBUTES; _i < BUTTON_HOST_ATTRIBUTES_1.length; _i++) {
- var attr = BUTTON_HOST_ATTRIBUTES_1[_i];
- if (_this._hasHostAttributes(attr)) {
- ((/** @type {?} */ (_this._getHostElement()))).classList.add(attr);
- }
- }
- // Add a class that applies to all buttons. This makes it easier to target if somebody
- // wants to target all Material buttons. We do it here rather than `host` to ensure that
- // the class is applied to derived classes.
- elementRef.nativeElement.classList.add('mat-button-base');
- _this._focusMonitor.monitor(_this._elementRef, true);
- if (_this.isRoundButton) {
- _this.color = DEFAULT_ROUND_BUTTON_COLOR;
- }
- return _this;
- }
- /**
- * @return {?}
- */
- MatButton.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- this._focusMonitor.stopMonitoring(this._elementRef);
- };
- /** Focuses the button. */
- /**
- * Focuses the button.
- * @param {?=} _origin
- * @param {?=} options
- * @return {?}
- */
- MatButton.prototype.focus = /**
- * Focuses the button.
- * @param {?=} _origin
- * @param {?=} options
- * @return {?}
- */
- function (_origin, options) {
- // Note that we aren't using `_origin`, but we need to keep it because some internal consumers
- // use `MatButton` in a `FocusKeyManager` and we need it to match `FocusableOption`.
- this._getHostElement().focus(options);
- };
- /**
- * @return {?}
- */
- MatButton.prototype._getHostElement = /**
- * @return {?}
- */
- function () {
- return this._elementRef.nativeElement;
- };
- /**
- * @return {?}
- */
- MatButton.prototype._isRippleDisabled = /**
- * @return {?}
- */
- function () {
- return this.disableRipple || this.disabled;
- };
- /** Gets whether the button has one of the given attributes. */
- /**
- * Gets whether the button has one of the given attributes.
- * @param {...?} attributes
- * @return {?}
- */
- MatButton.prototype._hasHostAttributes = /**
- * Gets whether the button has one of the given attributes.
- * @param {...?} attributes
- * @return {?}
- */
- function () {
- var _this = this;
- var attributes = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- attributes[_i] = arguments[_i];
- }
- return attributes.some((/**
- * @param {?} attribute
- * @return {?}
- */
- function (attribute) { return _this._getHostElement().hasAttribute(attribute); }));
- };
- MatButton.decorators = [
- { 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]",
- exportAs: 'matButton',
- host: {
- '[attr.disabled]': 'disabled || null',
- '[class._mat-animation-noopable]': '_animationMode === "NoopAnimations"',
- },
- 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>",
- 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}}"],
- inputs: ['disabled', 'disableRipple', 'color'],
- encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- },] },
- ];
- /** @nocollapse */
- MatButton.ctorParameters = function () { return [
- { type: core.ElementRef },
- { type: a11y.FocusMonitor },
- { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
- ]; };
- MatButton.propDecorators = {
- ripple: [{ type: core.ViewChild, args: [MatRipple, { static: false },] }]
- };
- return MatButton;
- }(_MatButtonMixinBase));
- /**
- * Material design anchor button.
- */
- var MatAnchor = /** @class */ (function (_super) {
- __extends(MatAnchor, _super);
- function MatAnchor(focusMonitor, elementRef, animationMode) {
- return _super.call(this, elementRef, focusMonitor, animationMode) || this;
- }
- /**
- * @param {?} event
- * @return {?}
- */
- MatAnchor.prototype._haltDisabledEvents = /**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- // A disabled button shouldn't apply any actions
- if (this.disabled) {
- event.preventDefault();
- event.stopImmediatePropagation();
- }
- };
- MatAnchor.decorators = [
- { 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]",
- exportAs: 'matButton, matAnchor',
- host: {
- // Note that we ignore the user-specified tabindex when it's disabled for
- // consistency with the `mat-button` applied on native buttons where even
- // though they have an index, they're not tabbable.
- '[attr.tabindex]': 'disabled ? -1 : (tabIndex || 0)',
- '[attr.disabled]': 'disabled || null',
- '[attr.aria-disabled]': 'disabled.toString()',
- '(click)': '_haltDisabledEvents($event)',
- '[class._mat-animation-noopable]': '_animationMode === "NoopAnimations"',
- },
- inputs: ['disabled', 'disableRipple', 'color'],
- 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>",
- 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}}"],
- encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- },] },
- ];
- /** @nocollapse */
- MatAnchor.ctorParameters = function () { return [
- { type: a11y.FocusMonitor },
- { type: core.ElementRef },
- { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
- ]; };
- MatAnchor.propDecorators = {
- tabIndex: [{ type: core.Input }]
- };
- return MatAnchor;
- }(MatButton));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var MatButtonModule = /** @class */ (function () {
- function MatButtonModule() {
- }
- MatButtonModule.decorators = [
- { type: core.NgModule, args: [{
- imports: [
- common.CommonModule,
- MatRippleModule,
- MatCommonModule,
- ],
- exports: [
- MatButton,
- MatAnchor,
- MatCommonModule,
- ],
- declarations: [
- MatButton,
- MatAnchor,
- ],
- },] },
- ];
- return MatButtonModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Injection token that can be used to configure the
- * default options for all button toggles within an app.
- * @type {?}
- */
- var MAT_BUTTON_TOGGLE_DEFAULT_OPTIONS = new core.InjectionToken('MAT_BUTTON_TOGGLE_DEFAULT_OPTIONS');
- /**
- * Provider Expression that allows mat-button-toggle-group to register as a ControlValueAccessor.
- * This allows it to support [(ngModel)].
- * \@docs-private
- * @type {?}
- */
- var MAT_BUTTON_TOGGLE_GROUP_VALUE_ACCESSOR = {
- provide: forms.NG_VALUE_ACCESSOR,
- useExisting: core.forwardRef((/**
- * @return {?}
- */
- function () { return MatButtonToggleGroup; })),
- multi: true
- };
- /**
- * @deprecated Use `MatButtonToggleGroup` instead.
- * \@breaking-change 8.0.0
- */
- var /**
- * @deprecated Use `MatButtonToggleGroup` instead.
- * \@breaking-change 8.0.0
- */
- MatButtonToggleGroupMultiple = /** @class */ (function () {
- function MatButtonToggleGroupMultiple() {
- }
- return MatButtonToggleGroupMultiple;
- }());
- /** @type {?} */
- var _uniqueIdCounter$1 = 0;
- /**
- * Change event object emitted by MatButtonToggle.
- */
- var /**
- * Change event object emitted by MatButtonToggle.
- */
- MatButtonToggleChange = /** @class */ (function () {
- function MatButtonToggleChange(source, value) {
- this.source = source;
- this.value = value;
- }
- return MatButtonToggleChange;
- }());
- /**
- * Exclusive selection button toggle group that behaves like a radio-button group.
- */
- var MatButtonToggleGroup = /** @class */ (function () {
- function MatButtonToggleGroup(_changeDetector, defaultOptions) {
- this._changeDetector = _changeDetector;
- this._vertical = false;
- this._multiple = false;
- this._disabled = false;
- /**
- * The method to be called in order to update ngModel.
- * Now `ngModel` binding is not supported in multiple selection mode.
- */
- this._controlValueAccessorChangeFn = (/**
- * @return {?}
- */
- function () { });
- /**
- * onTouch function registered via registerOnTouch (ControlValueAccessor).
- */
- this._onTouched = (/**
- * @return {?}
- */
- function () { });
- this._name = "mat-button-toggle-group-" + _uniqueIdCounter$1++;
- /**
- * Event that emits whenever the value of the group changes.
- * Used to facilitate two-way data binding.
- * \@docs-private
- */
- this.valueChange = new core.EventEmitter();
- /**
- * Event emitted when the group's value changes.
- */
- this.change = new core.EventEmitter();
- this.appearance =
- defaultOptions && defaultOptions.appearance ? defaultOptions.appearance : 'standard';
- }
- Object.defineProperty(MatButtonToggleGroup.prototype, "name", {
- /** `name` attribute for the underlying `input` element. */
- get: /**
- * `name` attribute for the underlying `input` element.
- * @return {?}
- */
- function () { return this._name; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- var _this = this;
- this._name = value;
- if (this._buttonToggles) {
- this._buttonToggles.forEach((/**
- * @param {?} toggle
- * @return {?}
- */
- function (toggle) {
- toggle.name = _this._name;
- toggle._markForCheck();
- }));
- }
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatButtonToggleGroup.prototype, "vertical", {
- /** Whether the toggle group is vertical. */
- get: /**
- * Whether the toggle group is vertical.
- * @return {?}
- */
- function () { return this._vertical; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._vertical = coercion.coerceBooleanProperty(value);
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatButtonToggleGroup.prototype, "value", {
- /** Value of the toggle group. */
- get: /**
- * Value of the toggle group.
- * @return {?}
- */
- function () {
- /** @type {?} */
- var selected = this._selectionModel ? this._selectionModel.selected : [];
- if (this.multiple) {
- return selected.map((/**
- * @param {?} toggle
- * @return {?}
- */
- function (toggle) { return toggle.value; }));
- }
- return selected[0] ? selected[0].value : undefined;
- },
- set: /**
- * @param {?} newValue
- * @return {?}
- */
- function (newValue) {
- this._setSelectionByValue(newValue);
- this.valueChange.emit(this.value);
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatButtonToggleGroup.prototype, "selected", {
- /** Selected button toggles in the group. */
- get: /**
- * Selected button toggles in the group.
- * @return {?}
- */
- function () {
- /** @type {?} */
- var selected = this._selectionModel ? this._selectionModel.selected : [];
- return this.multiple ? selected : (selected[0] || null);
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatButtonToggleGroup.prototype, "multiple", {
- /** Whether multiple button toggles can be selected. */
- get: /**
- * Whether multiple button toggles can be selected.
- * @return {?}
- */
- function () { return this._multiple; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._multiple = coercion.coerceBooleanProperty(value);
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatButtonToggleGroup.prototype, "disabled", {
- /** Whether multiple button toggle group is disabled. */
- get: /**
- * Whether multiple button toggle group is disabled.
- * @return {?}
- */
- function () { return this._disabled; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._disabled = coercion.coerceBooleanProperty(value);
- if (this._buttonToggles) {
- this._buttonToggles.forEach((/**
- * @param {?} toggle
- * @return {?}
- */
- function (toggle) { return toggle._markForCheck(); }));
- }
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- MatButtonToggleGroup.prototype.ngOnInit = /**
- * @return {?}
- */
- function () {
- this._selectionModel = new collections.SelectionModel(this.multiple, undefined, false);
- };
- /**
- * @return {?}
- */
- MatButtonToggleGroup.prototype.ngAfterContentInit = /**
- * @return {?}
- */
- function () {
- var _a;
- (_a = this._selectionModel).select.apply(_a, this._buttonToggles.filter((/**
- * @param {?} toggle
- * @return {?}
- */
- function (toggle) { return toggle.checked; })));
- };
- /**
- * Sets the model value. Implemented as part of ControlValueAccessor.
- * @param value Value to be set to the model.
- */
- /**
- * Sets the model value. Implemented as part of ControlValueAccessor.
- * @param {?} value Value to be set to the model.
- * @return {?}
- */
- MatButtonToggleGroup.prototype.writeValue = /**
- * Sets the model value. Implemented as part of ControlValueAccessor.
- * @param {?} value Value to be set to the model.
- * @return {?}
- */
- function (value) {
- this.value = value;
- this._changeDetector.markForCheck();
- };
- // Implemented as part of ControlValueAccessor.
- // Implemented as part of ControlValueAccessor.
- /**
- * @param {?} fn
- * @return {?}
- */
- MatButtonToggleGroup.prototype.registerOnChange =
- // Implemented as part of ControlValueAccessor.
- /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- this._controlValueAccessorChangeFn = fn;
- };
- // Implemented as part of ControlValueAccessor.
- // Implemented as part of ControlValueAccessor.
- /**
- * @param {?} fn
- * @return {?}
- */
- MatButtonToggleGroup.prototype.registerOnTouched =
- // Implemented as part of ControlValueAccessor.
- /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- this._onTouched = fn;
- };
- // Implemented as part of ControlValueAccessor.
- // Implemented as part of ControlValueAccessor.
- /**
- * @param {?} isDisabled
- * @return {?}
- */
- MatButtonToggleGroup.prototype.setDisabledState =
- // Implemented as part of ControlValueAccessor.
- /**
- * @param {?} isDisabled
- * @return {?}
- */
- function (isDisabled) {
- this.disabled = isDisabled;
- };
- /** Dispatch change event with current selection and group value. */
- /**
- * Dispatch change event with current selection and group value.
- * @return {?}
- */
- MatButtonToggleGroup.prototype._emitChangeEvent = /**
- * Dispatch change event with current selection and group value.
- * @return {?}
- */
- function () {
- /** @type {?} */
- var selected = this.selected;
- /** @type {?} */
- var source = Array.isArray(selected) ? selected[selected.length - 1] : selected;
- /** @type {?} */
- var event = new MatButtonToggleChange((/** @type {?} */ (source)), this.value);
- this._controlValueAccessorChangeFn(event.value);
- this.change.emit(event);
- };
- /**
- * Syncs a button toggle's selected state with the model value.
- * @param toggle Toggle to be synced.
- * @param select Whether the toggle should be selected.
- * @param isUserInput Whether the change was a result of a user interaction.
- * @param deferEvents Whether to defer emitting the change events.
- */
- /**
- * Syncs a button toggle's selected state with the model value.
- * @param {?} toggle Toggle to be synced.
- * @param {?} select Whether the toggle should be selected.
- * @param {?=} isUserInput Whether the change was a result of a user interaction.
- * @param {?=} deferEvents Whether to defer emitting the change events.
- * @return {?}
- */
- MatButtonToggleGroup.prototype._syncButtonToggle = /**
- * Syncs a button toggle's selected state with the model value.
- * @param {?} toggle Toggle to be synced.
- * @param {?} select Whether the toggle should be selected.
- * @param {?=} isUserInput Whether the change was a result of a user interaction.
- * @param {?=} deferEvents Whether to defer emitting the change events.
- * @return {?}
- */
- function (toggle, select, isUserInput, deferEvents) {
- if (isUserInput === void 0) { isUserInput = false; }
- if (deferEvents === void 0) { deferEvents = false; }
- // Deselect the currently-selected toggle, if we're in single-selection
- // mode and the button being toggled isn't selected at the moment.
- if (!this.multiple && this.selected && !toggle.checked) {
- ((/** @type {?} */ (this.selected))).checked = false;
- }
- if (this._selectionModel) {
- if (select) {
- this._selectionModel.select(toggle);
- }
- else {
- this._selectionModel.deselect(toggle);
- }
- }
- else {
- deferEvents = true;
- }
- // We need to defer in some cases in order to avoid "changed after checked errors", however
- // the side-effect is that we may end up updating the model value out of sequence in others
- // The `deferEvents` flag allows us to decide whether to do it on a case-by-case basis.
- if (deferEvents) {
- }
- else {
- this._updateModelValue(isUserInput);
- }
- };
- /** Checks whether a button toggle is selected. */
- /**
- * Checks whether a button toggle is selected.
- * @param {?} toggle
- * @return {?}
- */
- MatButtonToggleGroup.prototype._isSelected = /**
- * Checks whether a button toggle is selected.
- * @param {?} toggle
- * @return {?}
- */
- function (toggle) {
- return this._selectionModel && this._selectionModel.isSelected(toggle);
- };
- /** Determines whether a button toggle should be checked on init. */
- /**
- * Determines whether a button toggle should be checked on init.
- * @param {?} toggle
- * @return {?}
- */
- MatButtonToggleGroup.prototype._isPrechecked = /**
- * Determines whether a button toggle should be checked on init.
- * @param {?} toggle
- * @return {?}
- */
- function (toggle) {
- if (typeof this._rawValue === 'undefined') {
- return false;
- }
- if (this.multiple && Array.isArray(this._rawValue)) {
- return this._rawValue.some((/**
- * @param {?} value
- * @return {?}
- */
- function (value) { return toggle.value != null && value === toggle.value; }));
- }
- return toggle.value === this._rawValue;
- };
- /** Updates the selection state of the toggles in the group based on a value. */
- /**
- * Updates the selection state of the toggles in the group based on a value.
- * @private
- * @param {?} value
- * @return {?}
- */
- MatButtonToggleGroup.prototype._setSelectionByValue = /**
- * Updates the selection state of the toggles in the group based on a value.
- * @private
- * @param {?} value
- * @return {?}
- */
- function (value) {
- var _this = this;
- this._rawValue = value;
- if (!this._buttonToggles) {
- return;
- }
- if (this.multiple && value) {
- if (!Array.isArray(value)) {
- throw Error('Value must be an array in multiple-selection mode.');
- }
- this._clearSelection();
- value.forEach((/**
- * @param {?} currentValue
- * @return {?}
- */
- function (currentValue) { return _this._selectValue(currentValue); }));
- }
- else {
- this._clearSelection();
- this._selectValue(value);
- }
- };
- /** Clears the selected toggles. */
- /**
- * Clears the selected toggles.
- * @private
- * @return {?}
- */
- MatButtonToggleGroup.prototype._clearSelection = /**
- * Clears the selected toggles.
- * @private
- * @return {?}
- */
- function () {
- this._selectionModel.clear();
- this._buttonToggles.forEach((/**
- * @param {?} toggle
- * @return {?}
- */
- function (toggle) { return toggle.checked = false; }));
- };
- /** Selects a value if there's a toggle that corresponds to it. */
- /**
- * Selects a value if there's a toggle that corresponds to it.
- * @private
- * @param {?} value
- * @return {?}
- */
- MatButtonToggleGroup.prototype._selectValue = /**
- * Selects a value if there's a toggle that corresponds to it.
- * @private
- * @param {?} value
- * @return {?}
- */
- function (value) {
- /** @type {?} */
- var correspondingOption = this._buttonToggles.find((/**
- * @param {?} toggle
- * @return {?}
- */
- function (toggle) {
- return toggle.value != null && toggle.value === value;
- }));
- if (correspondingOption) {
- correspondingOption.checked = true;
- this._selectionModel.select(correspondingOption);
- }
- };
- /** Syncs up the group's value with the model and emits the change event. */
- /**
- * Syncs up the group's value with the model and emits the change event.
- * @private
- * @param {?} isUserInput
- * @return {?}
- */
- MatButtonToggleGroup.prototype._updateModelValue = /**
- * Syncs up the group's value with the model and emits the change event.
- * @private
- * @param {?} isUserInput
- * @return {?}
- */
- function (isUserInput) {
- // Only emit the change event for user input.
- if (isUserInput) {
- this._emitChangeEvent();
- }
- // Note: we emit this one no matter whether it was a user interaction, because
- // it is used by Angular to sync up the two-way data binding.
- this.valueChange.emit(this.value);
- };
- MatButtonToggleGroup.decorators = [
- { type: core.Directive, args: [{
- selector: 'mat-button-toggle-group',
- providers: [
- MAT_BUTTON_TOGGLE_GROUP_VALUE_ACCESSOR,
- { provide: MatButtonToggleGroupMultiple, useExisting: MatButtonToggleGroup },
- ],
- host: {
- 'role': 'group',
- 'class': 'mat-button-toggle-group',
- '[attr.aria-disabled]': 'disabled',
- '[class.mat-button-toggle-vertical]': 'vertical',
- '[class.mat-button-toggle-group-appearance-standard]': 'appearance === "standard"',
- },
- exportAs: 'matButtonToggleGroup',
- },] },
- ];
- /** @nocollapse */
- MatButtonToggleGroup.ctorParameters = function () { return [
- { type: core.ChangeDetectorRef },
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_BUTTON_TOGGLE_DEFAULT_OPTIONS,] }] }
- ]; };
- MatButtonToggleGroup.propDecorators = {
- _buttonToggles: [{ type: core.ContentChildren, args: [core.forwardRef((/**
- * @return {?}
- */
- function () { return MatButtonToggle; })),] }],
- appearance: [{ type: core.Input }],
- name: [{ type: core.Input }],
- vertical: [{ type: core.Input }],
- value: [{ type: core.Input }],
- valueChange: [{ type: core.Output }],
- multiple: [{ type: core.Input }],
- disabled: [{ type: core.Input }],
- change: [{ type: core.Output }]
- };
- return MatButtonToggleGroup;
- }());
- // Boilerplate for applying mixins to the MatButtonToggle class.
- /**
- * \@docs-private
- */
- var
- // Boilerplate for applying mixins to the MatButtonToggle class.
- /**
- * \@docs-private
- */
- MatButtonToggleBase = /** @class */ (function () {
- function MatButtonToggleBase() {
- }
- return MatButtonToggleBase;
- }());
- /** @type {?} */
- var _MatButtonToggleMixinBase = mixinDisableRipple(MatButtonToggleBase);
- /**
- * Single button inside of a toggle group.
- */
- var MatButtonToggle = /** @class */ (function (_super) {
- __extends(MatButtonToggle, _super);
- function MatButtonToggle(toggleGroup, _changeDetectorRef, _elementRef, _focusMonitor,
- // @breaking-change 8.0.0 `defaultTabIndex` to be made a required parameter.
- defaultTabIndex, defaultOptions) {
- var _this = _super.call(this) || this;
- _this._changeDetectorRef = _changeDetectorRef;
- _this._elementRef = _elementRef;
- _this._focusMonitor = _focusMonitor;
- _this._isSingleSelector = false;
- _this._checked = false;
- /**
- * Users can specify the `aria-labelledby` attribute which will be forwarded to the input element
- */
- _this.ariaLabelledby = null;
- _this._disabled = false;
- /**
- * Event emitted when the group value changes.
- */
- _this.change = new core.EventEmitter();
- /** @type {?} */
- var parsedTabIndex = Number(defaultTabIndex);
- _this.tabIndex = (parsedTabIndex || parsedTabIndex === 0) ? parsedTabIndex : null;
- _this.buttonToggleGroup = toggleGroup;
- _this.appearance =
- defaultOptions && defaultOptions.appearance ? defaultOptions.appearance : 'standard';
- return _this;
- }
- Object.defineProperty(MatButtonToggle.prototype, "buttonId", {
- /** Unique ID for the underlying `button` element. */
- get: /**
- * Unique ID for the underlying `button` element.
- * @return {?}
- */
- function () { return this.id + "-button"; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatButtonToggle.prototype, "appearance", {
- /** The appearance style of the button. */
- get: /**
- * The appearance style of the button.
- * @return {?}
- */
- function () {
- return this.buttonToggleGroup ? this.buttonToggleGroup.appearance : this._appearance;
- },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._appearance = value;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatButtonToggle.prototype, "checked", {
- /** Whether the button is checked. */
- get: /**
- * Whether the button is checked.
- * @return {?}
- */
- function () {
- return this.buttonToggleGroup ? this.buttonToggleGroup._isSelected(this) : this._checked;
- },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- /** @type {?} */
- var newValue = coercion.coerceBooleanProperty(value);
- if (newValue !== this._checked) {
- this._checked = newValue;
- if (this.buttonToggleGroup) {
- this.buttonToggleGroup._syncButtonToggle(this, this._checked);
- }
- this._changeDetectorRef.markForCheck();
- }
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatButtonToggle.prototype, "disabled", {
- /** Whether the button is disabled. */
- get: /**
- * Whether the button is disabled.
- * @return {?}
- */
- function () {
- return this._disabled || (this.buttonToggleGroup && this.buttonToggleGroup.disabled);
- },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) { this._disabled = coercion.coerceBooleanProperty(value); },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- MatButtonToggle.prototype.ngOnInit = /**
- * @return {?}
- */
- function () {
- this._isSingleSelector = this.buttonToggleGroup && !this.buttonToggleGroup.multiple;
- this._type = this._isSingleSelector ? 'radio' : 'checkbox';
- this.id = this.id || "mat-button-toggle-" + _uniqueIdCounter$1++;
- if (this._isSingleSelector) {
- this.name = this.buttonToggleGroup.name;
- }
- if (this.buttonToggleGroup && this.buttonToggleGroup._isPrechecked(this)) {
- this.checked = true;
- }
- this._focusMonitor.monitor(this._elementRef, true);
- };
- /**
- * @return {?}
- */
- MatButtonToggle.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- /** @type {?} */
- var group = this.buttonToggleGroup;
- this._focusMonitor.stopMonitoring(this._elementRef);
- // Remove the toggle from the selection once it's destroyed. Needs to happen
- // on the next tick in order to avoid "changed after checked" errors.
- if (group && group._isSelected(this)) {
- group._syncButtonToggle(this, false, false, true);
- }
- };
- /** Focuses the button. */
- /**
- * Focuses the button.
- * @param {?=} options
- * @return {?}
- */
- MatButtonToggle.prototype.focus = /**
- * Focuses the button.
- * @param {?=} options
- * @return {?}
- */
- function (options) {
- this._buttonElement.nativeElement.focus(options);
- };
- /** Checks the button toggle due to an interaction with the underlying native button. */
- /**
- * Checks the button toggle due to an interaction with the underlying native button.
- * @return {?}
- */
- MatButtonToggle.prototype._onButtonClick = /**
- * Checks the button toggle due to an interaction with the underlying native button.
- * @return {?}
- */
- function () {
- /** @type {?} */
- var newChecked = this._isSingleSelector ? true : !this._checked;
- if (newChecked !== this._checked) {
- this._checked = newChecked;
- if (this.buttonToggleGroup) {
- this.buttonToggleGroup._syncButtonToggle(this, this._checked, true);
- this.buttonToggleGroup._onTouched();
- }
- }
- // Emit a change event when it's the single selector
- this.change.emit(new MatButtonToggleChange(this, this.value));
- };
- /**
- * Marks the button toggle as needing checking for change detection.
- * This method is exposed because the parent button toggle group will directly
- * update bound properties of the radio button.
- */
- /**
- * Marks the button toggle as needing checking for change detection.
- * This method is exposed because the parent button toggle group will directly
- * update bound properties of the radio button.
- * @return {?}
- */
- MatButtonToggle.prototype._markForCheck = /**
- * Marks the button toggle as needing checking for change detection.
- * This method is exposed because the parent button toggle group will directly
- * update bound properties of the radio button.
- * @return {?}
- */
- function () {
- // When the group value changes, the button will not be notified.
- // Use `markForCheck` to explicit update button toggle's status.
- this._changeDetectorRef.markForCheck();
- };
- MatButtonToggle.decorators = [
- { type: core.Component, args: [{selector: 'mat-button-toggle',
- 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>",
- 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}"],
- encapsulation: core.ViewEncapsulation.None,
- exportAs: 'matButtonToggle',
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- inputs: ['disableRipple'],
- host: {
- '[class.mat-button-toggle-standalone]': '!buttonToggleGroup',
- '[class.mat-button-toggle-checked]': 'checked',
- '[class.mat-button-toggle-disabled]': 'disabled',
- '[class.mat-button-toggle-appearance-standard]': 'appearance === "standard"',
- 'class': 'mat-button-toggle',
- // Always reset the tabindex to -1 so it doesn't conflict with the one on the `button`,
- // but can still receive focus from things like cdkFocusInitial.
- '[attr.tabindex]': '-1',
- '[attr.id]': 'id',
- '[attr.name]': 'null',
- '(focus)': 'focus()',
- }
- },] },
- ];
- /** @nocollapse */
- MatButtonToggle.ctorParameters = function () { return [
- { type: MatButtonToggleGroup, decorators: [{ type: core.Optional }] },
- { type: core.ChangeDetectorRef },
- { type: core.ElementRef },
- { type: a11y.FocusMonitor },
- { type: String, decorators: [{ type: core.Attribute, args: ['tabindex',] }] },
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_BUTTON_TOGGLE_DEFAULT_OPTIONS,] }] }
- ]; };
- MatButtonToggle.propDecorators = {
- ariaLabel: [{ type: core.Input, args: ['aria-label',] }],
- ariaLabelledby: [{ type: core.Input, args: ['aria-labelledby',] }],
- _buttonElement: [{ type: core.ViewChild, args: ['button', { static: false },] }],
- id: [{ type: core.Input }],
- name: [{ type: core.Input }],
- value: [{ type: core.Input }],
- tabIndex: [{ type: core.Input }],
- appearance: [{ type: core.Input }],
- checked: [{ type: core.Input }],
- disabled: [{ type: core.Input }],
- change: [{ type: core.Output }]
- };
- return MatButtonToggle;
- }(_MatButtonToggleMixinBase));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var MatButtonToggleModule = /** @class */ (function () {
- function MatButtonToggleModule() {
- }
- MatButtonToggleModule.decorators = [
- { type: core.NgModule, args: [{
- imports: [MatCommonModule, MatRippleModule],
- exports: [MatCommonModule, MatButtonToggleGroup, MatButtonToggle],
- declarations: [MatButtonToggleGroup, MatButtonToggle],
- },] },
- ];
- return MatButtonToggleModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Content of a card, needed as it's used as a selector in the API.
- * \@docs-private
- */
- var MatCardContent = /** @class */ (function () {
- function MatCardContent() {
- }
- MatCardContent.decorators = [
- { type: core.Directive, args: [{
- selector: 'mat-card-content',
- host: { 'class': 'mat-card-content' }
- },] },
- ];
- return MatCardContent;
- }());
- /**
- * Title of a card, needed as it's used as a selector in the API.
- * \@docs-private
- */
- var MatCardTitle = /** @class */ (function () {
- function MatCardTitle() {
- }
- MatCardTitle.decorators = [
- { type: core.Directive, args: [{
- selector: "mat-card-title, [mat-card-title], [matCardTitle]",
- host: {
- 'class': 'mat-card-title'
- }
- },] },
- ];
- return MatCardTitle;
- }());
- /**
- * Sub-title of a card, needed as it's used as a selector in the API.
- * \@docs-private
- */
- var MatCardSubtitle = /** @class */ (function () {
- function MatCardSubtitle() {
- }
- MatCardSubtitle.decorators = [
- { type: core.Directive, args: [{
- selector: "mat-card-subtitle, [mat-card-subtitle], [matCardSubtitle]",
- host: {
- 'class': 'mat-card-subtitle'
- }
- },] },
- ];
- return MatCardSubtitle;
- }());
- /**
- * Action section of a card, needed as it's used as a selector in the API.
- * \@docs-private
- */
- var MatCardActions = /** @class */ (function () {
- function MatCardActions() {
- /**
- * Position of the actions inside the card.
- */
- this.align = 'start';
- }
- MatCardActions.decorators = [
- { type: core.Directive, args: [{
- selector: 'mat-card-actions',
- exportAs: 'matCardActions',
- host: {
- 'class': 'mat-card-actions',
- '[class.mat-card-actions-align-end]': 'align === "end"',
- }
- },] },
- ];
- MatCardActions.propDecorators = {
- align: [{ type: core.Input }]
- };
- return MatCardActions;
- }());
- /**
- * Footer of a card, needed as it's used as a selector in the API.
- * \@docs-private
- */
- var MatCardFooter = /** @class */ (function () {
- function MatCardFooter() {
- }
- MatCardFooter.decorators = [
- { type: core.Directive, args: [{
- selector: 'mat-card-footer',
- host: { 'class': 'mat-card-footer' }
- },] },
- ];
- return MatCardFooter;
- }());
- /**
- * Image used in a card, needed to add the mat- CSS styling.
- * \@docs-private
- */
- var MatCardImage = /** @class */ (function () {
- function MatCardImage() {
- }
- MatCardImage.decorators = [
- { type: core.Directive, args: [{
- selector: '[mat-card-image], [matCardImage]',
- host: { 'class': 'mat-card-image' }
- },] },
- ];
- return MatCardImage;
- }());
- /**
- * Image used in a card, needed to add the mat- CSS styling.
- * \@docs-private
- */
- var MatCardSmImage = /** @class */ (function () {
- function MatCardSmImage() {
- }
- MatCardSmImage.decorators = [
- { type: core.Directive, args: [{
- selector: '[mat-card-sm-image], [matCardImageSmall]',
- host: { 'class': 'mat-card-sm-image' }
- },] },
- ];
- return MatCardSmImage;
- }());
- /**
- * Image used in a card, needed to add the mat- CSS styling.
- * \@docs-private
- */
- var MatCardMdImage = /** @class */ (function () {
- function MatCardMdImage() {
- }
- MatCardMdImage.decorators = [
- { type: core.Directive, args: [{
- selector: '[mat-card-md-image], [matCardImageMedium]',
- host: { 'class': 'mat-card-md-image' }
- },] },
- ];
- return MatCardMdImage;
- }());
- /**
- * Image used in a card, needed to add the mat- CSS styling.
- * \@docs-private
- */
- var MatCardLgImage = /** @class */ (function () {
- function MatCardLgImage() {
- }
- MatCardLgImage.decorators = [
- { type: core.Directive, args: [{
- selector: '[mat-card-lg-image], [matCardImageLarge]',
- host: { 'class': 'mat-card-lg-image' }
- },] },
- ];
- return MatCardLgImage;
- }());
- /**
- * Large image used in a card, needed to add the mat- CSS styling.
- * \@docs-private
- */
- var MatCardXlImage = /** @class */ (function () {
- function MatCardXlImage() {
- }
- MatCardXlImage.decorators = [
- { type: core.Directive, args: [{
- selector: '[mat-card-xl-image], [matCardImageXLarge]',
- host: { 'class': 'mat-card-xl-image' }
- },] },
- ];
- return MatCardXlImage;
- }());
- /**
- * Avatar image used in a card, needed to add the mat- CSS styling.
- * \@docs-private
- */
- var MatCardAvatar = /** @class */ (function () {
- function MatCardAvatar() {
- }
- MatCardAvatar.decorators = [
- { type: core.Directive, args: [{
- selector: '[mat-card-avatar], [matCardAvatar]',
- host: { 'class': 'mat-card-avatar' }
- },] },
- ];
- return MatCardAvatar;
- }());
- /**
- * A basic content container component that adds the styles of a Material design card.
- *
- * While this component can be used alone, it also provides a number
- * of preset styles for common card sections, including:
- * - mat-card-title
- * - mat-card-subtitle
- * - mat-card-content
- * - mat-card-actions
- * - mat-card-footer
- */
- var MatCard = /** @class */ (function () {
- // @breaking-change 9.0.0 `_animationMode` parameter to be made required.
- function MatCard(_animationMode) {
- this._animationMode = _animationMode;
- }
- MatCard.decorators = [
- { type: core.Component, args: [{selector: 'mat-card',
- exportAs: 'matCard',
- template: "<ng-content></ng-content><ng-content select=\"mat-card-footer\"></ng-content>",
- 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}"],
- encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- host: {
- 'class': 'mat-card',
- '[class._mat-animation-noopable]': '_animationMode === "NoopAnimations"',
- }
- },] },
- ];
- /** @nocollapse */
- MatCard.ctorParameters = function () { return [
- { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
- ]; };
- return MatCard;
- }());
- /**
- * Component intended to be used within the `<mat-card>` component. It adds styles for a
- * preset header section (i.e. a title, subtitle, and avatar layout).
- * \@docs-private
- */
- var MatCardHeader = /** @class */ (function () {
- function MatCardHeader() {
- }
- MatCardHeader.decorators = [
- { type: core.Component, args: [{selector: 'mat-card-header',
- 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>",
- encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- host: { 'class': 'mat-card-header' }
- },] },
- ];
- return MatCardHeader;
- }());
- /**
- * Component intended to be used within the `<mat-card>` component. It adds styles for a preset
- * layout that groups an image with a title section.
- * \@docs-private
- */
- var MatCardTitleGroup = /** @class */ (function () {
- function MatCardTitleGroup() {
- }
- MatCardTitleGroup.decorators = [
- { type: core.Component, args: [{selector: 'mat-card-title-group',
- 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>",
- encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- host: { 'class': 'mat-card-title-group' }
- },] },
- ];
- return MatCardTitleGroup;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var MatCardModule = /** @class */ (function () {
- function MatCardModule() {
- }
- MatCardModule.decorators = [
- { type: core.NgModule, args: [{
- imports: [MatCommonModule],
- exports: [
- MatCard,
- MatCardHeader,
- MatCardTitleGroup,
- MatCardContent,
- MatCardTitle,
- MatCardSubtitle,
- MatCardActions,
- MatCardFooter,
- MatCardSmImage,
- MatCardMdImage,
- MatCardLgImage,
- MatCardImage,
- MatCardXlImage,
- MatCardAvatar,
- MatCommonModule,
- ],
- declarations: [
- MatCard, MatCardHeader, MatCardTitleGroup, MatCardContent, MatCardTitle, MatCardSubtitle,
- MatCardActions, MatCardFooter, MatCardSmImage, MatCardMdImage, MatCardLgImage, MatCardImage,
- MatCardXlImage, MatCardAvatar,
- ],
- },] },
- ];
- return MatCardModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Injection token that can be used to specify the checkbox click behavior.
- * @type {?}
- */
- var MAT_CHECKBOX_CLICK_ACTION = new core.InjectionToken('mat-checkbox-click-action');
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- // Increasing integer for generating unique ids for checkbox components.
- /** @type {?} */
- var nextUniqueId$3 = 0;
- /**
- * Provider Expression that allows mat-checkbox to register as a ControlValueAccessor.
- * This allows it to support [(ngModel)].
- * \@docs-private
- * @type {?}
- */
- var MAT_CHECKBOX_CONTROL_VALUE_ACCESSOR = {
- provide: forms.NG_VALUE_ACCESSOR,
- useExisting: core.forwardRef((/**
- * @return {?}
- */
- function () { return MatCheckbox; })),
- multi: true
- };
- /** @enum {number} */
- var TransitionCheckState = {
- /** The initial state of the component before any user interaction. */
- Init: 0,
- /** The state representing the component when it's becoming checked. */
- Checked: 1,
- /** The state representing the component when it's becoming unchecked. */
- Unchecked: 2,
- /** The state representing the component when it's becoming indeterminate. */
- Indeterminate: 3,
- };
- TransitionCheckState[TransitionCheckState.Init] = 'Init';
- TransitionCheckState[TransitionCheckState.Checked] = 'Checked';
- TransitionCheckState[TransitionCheckState.Unchecked] = 'Unchecked';
- TransitionCheckState[TransitionCheckState.Indeterminate] = 'Indeterminate';
- /**
- * Change event object emitted by MatCheckbox.
- */
- var /**
- * Change event object emitted by MatCheckbox.
- */
- MatCheckboxChange = /** @class */ (function () {
- function MatCheckboxChange() {
- }
- return MatCheckboxChange;
- }());
- // Boilerplate for applying mixins to MatCheckbox.
- /**
- * \@docs-private
- */
- var
- // Boilerplate for applying mixins to MatCheckbox.
- /**
- * \@docs-private
- */
- MatCheckboxBase = /** @class */ (function () {
- function MatCheckboxBase(_elementRef) {
- this._elementRef = _elementRef;
- }
- return MatCheckboxBase;
- }());
- /** @type {?} */
- var _MatCheckboxMixinBase = mixinTabIndex(mixinColor(mixinDisableRipple(mixinDisabled(MatCheckboxBase)), 'accent'));
- /**
- * A material design checkbox component. Supports all of the functionality of an HTML5 checkbox,
- * and exposes a similar API. A MatCheckbox can be either checked, unchecked, indeterminate, or
- * disabled. Note that all additional accessibility attributes are taken care of by the component,
- * so there is no need to provide them yourself. However, if you want to omit a label and still
- * have the checkbox be accessible, you may supply an [aria-label] input.
- * See: https://material.io/design/components/selection-controls.html
- */
- var MatCheckbox = /** @class */ (function (_super) {
- __extends(MatCheckbox, _super);
- function MatCheckbox(elementRef, _changeDetectorRef, _focusMonitor, _ngZone, tabIndex, _clickAction, _animationMode) {
- var _this = _super.call(this, elementRef) || this;
- _this._changeDetectorRef = _changeDetectorRef;
- _this._focusMonitor = _focusMonitor;
- _this._ngZone = _ngZone;
- _this._clickAction = _clickAction;
- _this._animationMode = _animationMode;
- /**
- * Attached to the aria-label attribute of the host element. In most cases, aria-labelledby will
- * take precedence so this may be omitted.
- */
- _this.ariaLabel = '';
- /**
- * Users can specify the `aria-labelledby` attribute which will be forwarded to the input element
- */
- _this.ariaLabelledby = null;
- _this._uniqueId = "mat-checkbox-" + ++nextUniqueId$3;
- /**
- * A unique id for the checkbox input. If none is supplied, it will be auto-generated.
- */
- _this.id = _this._uniqueId;
- /**
- * Whether the label should appear after or before the checkbox. Defaults to 'after'
- */
- _this.labelPosition = 'after';
- /**
- * Name value will be applied to the input element if present
- */
- _this.name = null;
- /**
- * Event emitted when the checkbox's `checked` value changes.
- */
- _this.change = new core.EventEmitter();
- /**
- * Event emitted when the checkbox's `indeterminate` value changes.
- */
- _this.indeterminateChange = new core.EventEmitter();
- /**
- * Called when the checkbox is blurred. Needed to properly implement ControlValueAccessor.
- * \@docs-private
- */
- _this._onTouched = (/**
- * @return {?}
- */
- function () { });
- _this._currentAnimationClass = '';
- _this._currentCheckState = TransitionCheckState.Init;
- _this._controlValueAccessorChangeFn = (/**
- * @return {?}
- */
- function () { });
- _this._checked = false;
- _this._disabled = false;
- _this._indeterminate = false;
- _this.tabIndex = parseInt(tabIndex) || 0;
- _this._focusMonitor.monitor(elementRef, true).subscribe((/**
- * @param {?} focusOrigin
- * @return {?}
- */
- function (focusOrigin) {
- if (!focusOrigin) {
- // When a focused element becomes disabled, the browser *immediately* fires a blur event.
- // Angular does not expect events to be raised during change detection, so any state change
- // (such as a form control's 'ng-touched') will cause a changed-after-checked error.
- // See https://github.com/angular/angular/issues/17793. To work around this, we defer
- // telling the form control it has been touched until the next tick.
- Promise.resolve().then((/**
- * @return {?}
- */
- function () {
- _this._onTouched();
- _changeDetectorRef.markForCheck();
- }));
- }
- }));
- return _this;
- }
- Object.defineProperty(MatCheckbox.prototype, "inputId", {
- /** Returns the unique id for the visual hidden input. */
- get: /**
- * Returns the unique id for the visual hidden input.
- * @return {?}
- */
- function () { return (this.id || this._uniqueId) + "-input"; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatCheckbox.prototype, "required", {
- /** Whether the checkbox is required. */
- get: /**
- * Whether the checkbox is required.
- * @return {?}
- */
- function () { return this._required; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) { this._required = coercion.coerceBooleanProperty(value); },
- enumerable: true,
- configurable: true
- });
- // TODO: Delete next major revision.
- // TODO: Delete next major revision.
- /**
- * @return {?}
- */
- MatCheckbox.prototype.ngAfterViewChecked =
- // TODO: Delete next major revision.
- /**
- * @return {?}
- */
- function () { };
- /**
- * @return {?}
- */
- MatCheckbox.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- this._focusMonitor.stopMonitoring(this._elementRef);
- };
- Object.defineProperty(MatCheckbox.prototype, "checked", {
- /**
- * Whether the checkbox is checked.
- */
- get: /**
- * Whether the checkbox is checked.
- * @return {?}
- */
- function () { return this._checked; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- if (value != this.checked) {
- this._checked = value;
- this._changeDetectorRef.markForCheck();
- }
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatCheckbox.prototype, "disabled", {
- /**
- * Whether the checkbox is disabled. This fully overrides the implementation provided by
- * mixinDisabled, but the mixin is still required because mixinTabIndex requires it.
- */
- get: /**
- * Whether the checkbox is disabled. This fully overrides the implementation provided by
- * mixinDisabled, but the mixin is still required because mixinTabIndex requires it.
- * @return {?}
- */
- function () { return this._disabled; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- /** @type {?} */
- var newValue = coercion.coerceBooleanProperty(value);
- if (newValue !== this.disabled) {
- this._disabled = newValue;
- this._changeDetectorRef.markForCheck();
- }
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatCheckbox.prototype, "indeterminate", {
- /**
- * Whether the checkbox is indeterminate. This is also known as "mixed" mode and can be used to
- * represent a checkbox with three states, e.g. a checkbox that represents a nested list of
- * checkable items. Note that whenever checkbox is manually clicked, indeterminate is immediately
- * set to false.
- */
- get: /**
- * Whether the checkbox is indeterminate. This is also known as "mixed" mode and can be used to
- * represent a checkbox with three states, e.g. a checkbox that represents a nested list of
- * checkable items. Note that whenever checkbox is manually clicked, indeterminate is immediately
- * set to false.
- * @return {?}
- */
- function () { return this._indeterminate; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- /** @type {?} */
- var changed = value != this._indeterminate;
- this._indeterminate = value;
- if (changed) {
- if (this._indeterminate) {
- this._transitionCheckState(TransitionCheckState.Indeterminate);
- }
- else {
- this._transitionCheckState(this.checked ? TransitionCheckState.Checked : TransitionCheckState.Unchecked);
- }
- this.indeterminateChange.emit(this._indeterminate);
- }
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- MatCheckbox.prototype._isRippleDisabled = /**
- * @return {?}
- */
- function () {
- return this.disableRipple || this.disabled;
- };
- /** Method being called whenever the label text changes. */
- /**
- * Method being called whenever the label text changes.
- * @return {?}
- */
- MatCheckbox.prototype._onLabelTextChange = /**
- * Method being called whenever the label text changes.
- * @return {?}
- */
- function () {
- // Since the event of the `cdkObserveContent` directive runs outside of the zone, the checkbox
- // component will be only marked for check, but no actual change detection runs automatically.
- // Instead of going back into the zone in order to trigger a change detection which causes
- // *all* components to be checked (if explicitly marked or not using OnPush), we only trigger
- // an explicit change detection for the checkbox view and it's children.
- this._changeDetectorRef.detectChanges();
- };
- // Implemented as part of ControlValueAccessor.
- // Implemented as part of ControlValueAccessor.
- /**
- * @param {?} value
- * @return {?}
- */
- MatCheckbox.prototype.writeValue =
- // Implemented as part of ControlValueAccessor.
- /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this.checked = !!value;
- };
- // Implemented as part of ControlValueAccessor.
- // Implemented as part of ControlValueAccessor.
- /**
- * @param {?} fn
- * @return {?}
- */
- MatCheckbox.prototype.registerOnChange =
- // Implemented as part of ControlValueAccessor.
- /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- this._controlValueAccessorChangeFn = fn;
- };
- // Implemented as part of ControlValueAccessor.
- // Implemented as part of ControlValueAccessor.
- /**
- * @param {?} fn
- * @return {?}
- */
- MatCheckbox.prototype.registerOnTouched =
- // Implemented as part of ControlValueAccessor.
- /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- this._onTouched = fn;
- };
- // Implemented as part of ControlValueAccessor.
- // Implemented as part of ControlValueAccessor.
- /**
- * @param {?} isDisabled
- * @return {?}
- */
- MatCheckbox.prototype.setDisabledState =
- // Implemented as part of ControlValueAccessor.
- /**
- * @param {?} isDisabled
- * @return {?}
- */
- function (isDisabled) {
- this.disabled = isDisabled;
- };
- /**
- * @return {?}
- */
- MatCheckbox.prototype._getAriaChecked = /**
- * @return {?}
- */
- function () {
- return this.checked ? 'true' : (this.indeterminate ? 'mixed' : 'false');
- };
- /**
- * @private
- * @param {?} newState
- * @return {?}
- */
- MatCheckbox.prototype._transitionCheckState = /**
- * @private
- * @param {?} newState
- * @return {?}
- */
- function (newState) {
- /** @type {?} */
- var oldState = this._currentCheckState;
- /** @type {?} */
- var element = this._elementRef.nativeElement;
- if (oldState === newState) {
- return;
- }
- if (this._currentAnimationClass.length > 0) {
- element.classList.remove(this._currentAnimationClass);
- }
- this._currentAnimationClass = this._getAnimationClassForCheckStateTransition(oldState, newState);
- this._currentCheckState = newState;
- if (this._currentAnimationClass.length > 0) {
- element.classList.add(this._currentAnimationClass);
- // Remove the animation class to avoid animation when the checkbox is moved between containers
- /** @type {?} */
- var animationClass_1 = this._currentAnimationClass;
- this._ngZone.runOutsideAngular((/**
- * @return {?}
- */
- function () {
- setTimeout((/**
- * @return {?}
- */
- function () {
- element.classList.remove(animationClass_1);
- }), 1000);
- }));
- }
- };
- /**
- * @private
- * @return {?}
- */
- MatCheckbox.prototype._emitChangeEvent = /**
- * @private
- * @return {?}
- */
- function () {
- /** @type {?} */
- var event = new MatCheckboxChange();
- event.source = this;
- event.checked = this.checked;
- this._controlValueAccessorChangeFn(this.checked);
- this.change.emit(event);
- };
- /** Toggles the `checked` state of the checkbox. */
- /**
- * Toggles the `checked` state of the checkbox.
- * @return {?}
- */
- MatCheckbox.prototype.toggle = /**
- * Toggles the `checked` state of the checkbox.
- * @return {?}
- */
- function () {
- this.checked = !this.checked;
- };
- /**
- * Event handler for checkbox input element.
- * Toggles checked state if element is not disabled.
- * Do not toggle on (change) event since IE doesn't fire change event when
- * indeterminate checkbox is clicked.
- * @param event
- */
- /**
- * Event handler for checkbox input element.
- * Toggles checked state if element is not disabled.
- * Do not toggle on (change) event since IE doesn't fire change event when
- * indeterminate checkbox is clicked.
- * @param {?} event
- * @return {?}
- */
- MatCheckbox.prototype._onInputClick = /**
- * Event handler for checkbox input element.
- * Toggles checked state if element is not disabled.
- * Do not toggle on (change) event since IE doesn't fire change event when
- * indeterminate checkbox is clicked.
- * @param {?} event
- * @return {?}
- */
- function (event) {
- var _this = this;
- // We have to stop propagation for click events on the visual hidden input element.
- // By default, when a user clicks on a label element, a generated click event will be
- // dispatched on the associated input element. Since we are using a label element as our
- // root container, the click event on the `checkbox` will be executed twice.
- // The real click event will bubble up, and the generated click event also tries to bubble up.
- // This will lead to multiple click events.
- // Preventing bubbling for the second event will solve that issue.
- event.stopPropagation();
- // If resetIndeterminate is false, and the current state is indeterminate, do nothing on click
- if (!this.disabled && this._clickAction !== 'noop') {
- // When user manually click on the checkbox, `indeterminate` is set to false.
- if (this.indeterminate && this._clickAction !== 'check') {
- Promise.resolve().then((/**
- * @return {?}
- */
- function () {
- _this._indeterminate = false;
- _this.indeterminateChange.emit(_this._indeterminate);
- }));
- }
- this.toggle();
- this._transitionCheckState(this._checked ? TransitionCheckState.Checked : TransitionCheckState.Unchecked);
- // Emit our custom change event if the native input emitted one.
- // It is important to only emit it, if the native input triggered one, because
- // we don't want to trigger a change event, when the `checked` variable changes for example.
- this._emitChangeEvent();
- }
- else if (!this.disabled && this._clickAction === 'noop') {
- // Reset native input when clicked with noop. The native checkbox becomes checked after
- // click, reset it to be align with `checked` value of `mat-checkbox`.
- this._inputElement.nativeElement.checked = this.checked;
- this._inputElement.nativeElement.indeterminate = this.indeterminate;
- }
- };
- /** Focuses the checkbox. */
- /**
- * Focuses the checkbox.
- * @param {?=} origin
- * @param {?=} options
- * @return {?}
- */
- MatCheckbox.prototype.focus = /**
- * Focuses the checkbox.
- * @param {?=} origin
- * @param {?=} options
- * @return {?}
- */
- function (origin, options) {
- if (origin === void 0) { origin = 'keyboard'; }
- this._focusMonitor.focusVia(this._inputElement, origin, options);
- };
- /**
- * @param {?} event
- * @return {?}
- */
- MatCheckbox.prototype._onInteractionEvent = /**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- // We always have to stop propagation on the change event.
- // Otherwise the change event, from the input element, will bubble up and
- // emit its event object to the `change` output.
- event.stopPropagation();
- };
- /**
- * @private
- * @param {?} oldState
- * @param {?} newState
- * @return {?}
- */
- MatCheckbox.prototype._getAnimationClassForCheckStateTransition = /**
- * @private
- * @param {?} oldState
- * @param {?} newState
- * @return {?}
- */
- function (oldState, newState) {
- // Don't transition if animations are disabled.
- if (this._animationMode === 'NoopAnimations') {
- return '';
- }
- /** @type {?} */
- var animSuffix = '';
- switch (oldState) {
- case TransitionCheckState.Init:
- // Handle edge case where user interacts with checkbox that does not have [(ngModel)] or
- // [checked] bound to it.
- if (newState === TransitionCheckState.Checked) {
- animSuffix = 'unchecked-checked';
- }
- else if (newState == TransitionCheckState.Indeterminate) {
- animSuffix = 'unchecked-indeterminate';
- }
- else {
- return '';
- }
- break;
- case TransitionCheckState.Unchecked:
- animSuffix = newState === TransitionCheckState.Checked ?
- 'unchecked-checked' : 'unchecked-indeterminate';
- break;
- case TransitionCheckState.Checked:
- animSuffix = newState === TransitionCheckState.Unchecked ?
- 'checked-unchecked' : 'checked-indeterminate';
- break;
- case TransitionCheckState.Indeterminate:
- animSuffix = newState === TransitionCheckState.Checked ?
- 'indeterminate-checked' : 'indeterminate-unchecked';
- break;
- }
- return "mat-checkbox-anim-" + animSuffix;
- };
- MatCheckbox.decorators = [
- { type: core.Component, args: [{selector: 'mat-checkbox',
- 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\"> </span><ng-content></ng-content></span></label>",
- 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}"],
- exportAs: 'matCheckbox',
- host: {
- 'class': 'mat-checkbox',
- '[id]': 'id',
- '[attr.tabindex]': 'null',
- '[class.mat-checkbox-indeterminate]': 'indeterminate',
- '[class.mat-checkbox-checked]': 'checked',
- '[class.mat-checkbox-disabled]': 'disabled',
- '[class.mat-checkbox-label-before]': 'labelPosition == "before"',
- '[class._mat-animation-noopable]': "_animationMode === 'NoopAnimations'",
- },
- providers: [MAT_CHECKBOX_CONTROL_VALUE_ACCESSOR],
- inputs: ['disableRipple', 'color', 'tabIndex'],
- encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush
- },] },
- ];
- /** @nocollapse */
- MatCheckbox.ctorParameters = function () { return [
- { type: core.ElementRef },
- { type: core.ChangeDetectorRef },
- { type: a11y.FocusMonitor },
- { type: core.NgZone },
- { type: String, decorators: [{ type: core.Attribute, args: ['tabindex',] }] },
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_CHECKBOX_CLICK_ACTION,] }] },
- { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
- ]; };
- MatCheckbox.propDecorators = {
- ariaLabel: [{ type: core.Input, args: ['aria-label',] }],
- ariaLabelledby: [{ type: core.Input, args: ['aria-labelledby',] }],
- id: [{ type: core.Input }],
- required: [{ type: core.Input }],
- labelPosition: [{ type: core.Input }],
- name: [{ type: core.Input }],
- change: [{ type: core.Output }],
- indeterminateChange: [{ type: core.Output }],
- value: [{ type: core.Input }],
- _inputElement: [{ type: core.ViewChild, args: ['input', { static: false },] }],
- ripple: [{ type: core.ViewChild, args: [MatRipple, { static: false },] }],
- checked: [{ type: core.Input }],
- disabled: [{ type: core.Input }],
- indeterminate: [{ type: core.Input }]
- };
- return MatCheckbox;
- }(_MatCheckboxMixinBase));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /** @type {?} */
- var MAT_CHECKBOX_REQUIRED_VALIDATOR = {
- provide: forms.NG_VALIDATORS,
- useExisting: core.forwardRef((/**
- * @return {?}
- */
- function () { return MatCheckboxRequiredValidator; })),
- multi: true
- };
- /**
- * Validator for Material checkbox's required attribute in template-driven checkbox.
- * Current CheckboxRequiredValidator only work with `input type=checkbox` and does not
- * work with `mat-checkbox`.
- */
- var MatCheckboxRequiredValidator = /** @class */ (function (_super) {
- __extends(MatCheckboxRequiredValidator, _super);
- function MatCheckboxRequiredValidator() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- MatCheckboxRequiredValidator.decorators = [
- { type: core.Directive, args: [{
- selector: "mat-checkbox[required][formControlName],\n mat-checkbox[required][formControl], mat-checkbox[required][ngModel]",
- providers: [MAT_CHECKBOX_REQUIRED_VALIDATOR],
- },] },
- ];
- return MatCheckboxRequiredValidator;
- }(forms.CheckboxRequiredValidator));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * This module is used by both original and MDC-based checkbox implementations.
- */
- var _MatCheckboxRequiredValidatorModule = /** @class */ (function () {
- function _MatCheckboxRequiredValidatorModule() {
- }
- _MatCheckboxRequiredValidatorModule.decorators = [
- { type: core.NgModule, args: [{
- exports: [MatCheckboxRequiredValidator],
- declarations: [MatCheckboxRequiredValidator],
- },] },
- ];
- return _MatCheckboxRequiredValidatorModule;
- }());
- var MatCheckboxModule = /** @class */ (function () {
- function MatCheckboxModule() {
- }
- MatCheckboxModule.decorators = [
- { type: core.NgModule, args: [{
- imports: [
- common.CommonModule, MatRippleModule, MatCommonModule, observers.ObserversModule,
- _MatCheckboxRequiredValidatorModule
- ],
- exports: [MatCheckbox, MatCommonModule, _MatCheckboxRequiredValidatorModule],
- declarations: [MatCheckbox],
- },] },
- ];
- return MatCheckboxModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Event object emitted by MatChip when selected or deselected.
- */
- var /**
- * Event object emitted by MatChip when selected or deselected.
- */
- MatChipSelectionChange = /** @class */ (function () {
- function MatChipSelectionChange(source, selected, isUserInput) {
- if (isUserInput === void 0) { isUserInput = false; }
- this.source = source;
- this.selected = selected;
- this.isUserInput = isUserInput;
- }
- return MatChipSelectionChange;
- }());
- // Boilerplate for applying mixins to MatChip.
- /**
- * \@docs-private
- */
- var
- // Boilerplate for applying mixins to MatChip.
- /**
- * \@docs-private
- */
- MatChipBase = /** @class */ (function () {
- function MatChipBase(_elementRef) {
- this._elementRef = _elementRef;
- }
- return MatChipBase;
- }());
- /** @type {?} */
- var _MatChipMixinBase = mixinColor(mixinDisableRipple(mixinDisabled(MatChipBase)), 'primary');
- /**
- * Dummy directive to add CSS class to chip avatar.
- * \@docs-private
- */
- var MatChipAvatar = /** @class */ (function () {
- function MatChipAvatar() {
- }
- MatChipAvatar.decorators = [
- { type: core.Directive, args: [{
- selector: 'mat-chip-avatar, [matChipAvatar]',
- host: { 'class': 'mat-chip-avatar' }
- },] },
- ];
- return MatChipAvatar;
- }());
- /**
- * Dummy directive to add CSS class to chip trailing icon.
- * \@docs-private
- */
- var MatChipTrailingIcon = /** @class */ (function () {
- function MatChipTrailingIcon() {
- }
- MatChipTrailingIcon.decorators = [
- { type: core.Directive, args: [{
- selector: 'mat-chip-trailing-icon, [matChipTrailingIcon]',
- host: { 'class': 'mat-chip-trailing-icon' }
- },] },
- ];
- return MatChipTrailingIcon;
- }());
- /**
- * Material design styled Chip component. Used inside the MatChipList component.
- */
- var MatChip = /** @class */ (function (_super) {
- __extends(MatChip, _super);
- function MatChip(_elementRef, _ngZone, platform$$1, globalRippleOptions,
- // @breaking-change 8.0.0 `animationMode` parameter to become required.
- animationMode) {
- var _this = _super.call(this, _elementRef) || this;
- _this._elementRef = _elementRef;
- _this._ngZone = _ngZone;
- /**
- * Whether the chip has focus.
- */
- _this._hasFocus = false;
- /**
- * Whether the chip list is selectable
- */
- _this.chipListSelectable = true;
- /**
- * Whether the chip list is in multi-selection mode.
- */
- _this._chipListMultiple = false;
- _this._selected = false;
- _this._selectable = true;
- _this._removable = true;
- /**
- * Emits when the chip is focused.
- */
- _this._onFocus = new rxjs.Subject();
- /**
- * Emits when the chip is blured.
- */
- _this._onBlur = new rxjs.Subject();
- /**
- * Emitted when the chip is selected or deselected.
- */
- _this.selectionChange = new core.EventEmitter();
- /**
- * Emitted when the chip is destroyed.
- */
- _this.destroyed = new core.EventEmitter();
- /**
- * Emitted when a chip is to be removed.
- */
- _this.removed = new core.EventEmitter();
- _this._addHostClassName();
- _this._chipRipple = new RippleRenderer(_this, _ngZone, _elementRef, platform$$1);
- _this._chipRipple.setupTriggerEvents(_elementRef.nativeElement);
- _this.rippleConfig = globalRippleOptions || {};
- _this._animationsDisabled = animationMode === 'NoopAnimations';
- return _this;
- }
- Object.defineProperty(MatChip.prototype, "rippleDisabled", {
- /**
- * Whether ripples are disabled on interaction
- * @docs-private
- */
- get: /**
- * Whether ripples are disabled on interaction
- * \@docs-private
- * @return {?}
- */
- function () {
- return this.disabled || this.disableRipple || !!this.rippleConfig.disabled;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatChip.prototype, "selected", {
- /** Whether the chip is selected. */
- get: /**
- * Whether the chip is selected.
- * @return {?}
- */
- function () { return this._selected; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- /** @type {?} */
- var coercedValue = coercion.coerceBooleanProperty(value);
- if (coercedValue !== this._selected) {
- this._selected = coercedValue;
- this._dispatchSelectionChange();
- }
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatChip.prototype, "value", {
- /** The value of the chip. Defaults to the content inside `<mat-chip>` tags. */
- get: /**
- * The value of the chip. Defaults to the content inside `<mat-chip>` tags.
- * @return {?}
- */
- function () {
- return this._value != undefined
- ? this._value
- : this._elementRef.nativeElement.textContent;
- },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) { this._value = value; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatChip.prototype, "selectable", {
- /**
- * Whether or not the chip is selectable. When a chip is not selectable,
- * changes to its selected state are always ignored. By default a chip is
- * selectable, and it becomes non-selectable if its parent chip list is
- * not selectable.
- */
- get: /**
- * Whether or not the chip is selectable. When a chip is not selectable,
- * changes to its selected state are always ignored. By default a chip is
- * selectable, and it becomes non-selectable if its parent chip list is
- * not selectable.
- * @return {?}
- */
- function () { return this._selectable && this.chipListSelectable; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._selectable = coercion.coerceBooleanProperty(value);
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatChip.prototype, "removable", {
- /**
- * Determines whether or not the chip displays the remove styling and emits (removed) events.
- */
- get: /**
- * Determines whether or not the chip displays the remove styling and emits (removed) events.
- * @return {?}
- */
- function () { return this._removable; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._removable = coercion.coerceBooleanProperty(value);
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatChip.prototype, "ariaSelected", {
- /** The ARIA selected applied to the chip. */
- get: /**
- * The ARIA selected applied to the chip.
- * @return {?}
- */
- function () {
- // Remove the `aria-selected` when the chip is deselected in single-selection mode, because
- // it adds noise to NVDA users where "not selected" will be read out for each chip.
- return this.selectable && (this._chipListMultiple || this.selected) ?
- this.selected.toString() : null;
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- MatChip.prototype._addHostClassName = /**
- * @return {?}
- */
- function () {
- /** @type {?} */
- var basicChipAttrName = 'mat-basic-chip';
- /** @type {?} */
- var element = (/** @type {?} */ (this._elementRef.nativeElement));
- if (element.hasAttribute(basicChipAttrName) ||
- element.tagName.toLowerCase() === basicChipAttrName) {
- element.classList.add(basicChipAttrName);
- return;
- }
- else {
- element.classList.add('mat-standard-chip');
- }
- };
- /**
- * @return {?}
- */
- MatChip.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- this.destroyed.emit({ chip: this });
- this._chipRipple._removeTriggerEvents();
- };
- /** Selects the chip. */
- /**
- * Selects the chip.
- * @return {?}
- */
- MatChip.prototype.select = /**
- * Selects the chip.
- * @return {?}
- */
- function () {
- if (!this._selected) {
- this._selected = true;
- this._dispatchSelectionChange();
- }
- };
- /** Deselects the chip. */
- /**
- * Deselects the chip.
- * @return {?}
- */
- MatChip.prototype.deselect = /**
- * Deselects the chip.
- * @return {?}
- */
- function () {
- if (this._selected) {
- this._selected = false;
- this._dispatchSelectionChange();
- }
- };
- /** Select this chip and emit selected event */
- /**
- * Select this chip and emit selected event
- * @return {?}
- */
- MatChip.prototype.selectViaInteraction = /**
- * Select this chip and emit selected event
- * @return {?}
- */
- function () {
- if (!this._selected) {
- this._selected = true;
- this._dispatchSelectionChange(true);
- }
- };
- /** Toggles the current selected state of this chip. */
- /**
- * Toggles the current selected state of this chip.
- * @param {?=} isUserInput
- * @return {?}
- */
- MatChip.prototype.toggleSelected = /**
- * Toggles the current selected state of this chip.
- * @param {?=} isUserInput
- * @return {?}
- */
- function (isUserInput) {
- if (isUserInput === void 0) { isUserInput = false; }
- this._selected = !this.selected;
- this._dispatchSelectionChange(isUserInput);
- return this.selected;
- };
- /** Allows for programmatic focusing of the chip. */
- /**
- * Allows for programmatic focusing of the chip.
- * @return {?}
- */
- MatChip.prototype.focus = /**
- * Allows for programmatic focusing of the chip.
- * @return {?}
- */
- function () {
- if (!this._hasFocus) {
- this._elementRef.nativeElement.focus();
- this._onFocus.next({ chip: this });
- }
- this._hasFocus = true;
- };
- /**
- * Allows for programmatic removal of the chip. Called by the MatChipList when the DELETE or
- * BACKSPACE keys are pressed.
- *
- * Informs any listeners of the removal request. Does not remove the chip from the DOM.
- */
- /**
- * Allows for programmatic removal of the chip. Called by the MatChipList when the DELETE or
- * BACKSPACE keys are pressed.
- *
- * Informs any listeners of the removal request. Does not remove the chip from the DOM.
- * @return {?}
- */
- MatChip.prototype.remove = /**
- * Allows for programmatic removal of the chip. Called by the MatChipList when the DELETE or
- * BACKSPACE keys are pressed.
- *
- * Informs any listeners of the removal request. Does not remove the chip from the DOM.
- * @return {?}
- */
- function () {
- if (this.removable) {
- this.removed.emit({ chip: this });
- }
- };
- /** Handles click events on the chip. */
- /**
- * Handles click events on the chip.
- * @param {?} event
- * @return {?}
- */
- MatChip.prototype._handleClick = /**
- * Handles click events on the chip.
- * @param {?} event
- * @return {?}
- */
- function (event) {
- if (this.disabled) {
- event.preventDefault();
- }
- else {
- event.stopPropagation();
- }
- };
- /** Handle custom key presses. */
- /**
- * Handle custom key presses.
- * @param {?} event
- * @return {?}
- */
- MatChip.prototype._handleKeydown = /**
- * Handle custom key presses.
- * @param {?} event
- * @return {?}
- */
- function (event) {
- if (this.disabled) {
- return;
- }
- switch (event.keyCode) {
- case keycodes.DELETE:
- case keycodes.BACKSPACE:
- // If we are removable, remove the focused chip
- this.remove();
- // Always prevent so page navigation does not occur
- event.preventDefault();
- break;
- case keycodes.SPACE:
- // If we are selectable, toggle the focused chip
- if (this.selectable) {
- this.toggleSelected(true);
- }
- // Always prevent space from scrolling the page since the list has focus
- event.preventDefault();
- break;
- }
- };
- /**
- * @return {?}
- */
- MatChip.prototype._blur = /**
- * @return {?}
- */
- function () {
- var _this = this;
- // When animations are enabled, Angular may end up removing the chip from the DOM a little
- // earlier than usual, causing it to be blurred and throwing off the logic in the chip list
- // that moves focus not the next item. To work around the issue, we defer marking the chip
- // as not focused until the next time the zone stabilizes.
- this._ngZone.onStable
- .asObservable()
- .pipe(operators.take(1))
- .subscribe((/**
- * @return {?}
- */
- function () {
- _this._ngZone.run((/**
- * @return {?}
- */
- function () {
- _this._hasFocus = false;
- _this._onBlur.next({ chip: _this });
- }));
- }));
- };
- /**
- * @private
- * @param {?=} isUserInput
- * @return {?}
- */
- MatChip.prototype._dispatchSelectionChange = /**
- * @private
- * @param {?=} isUserInput
- * @return {?}
- */
- function (isUserInput) {
- if (isUserInput === void 0) { isUserInput = false; }
- this.selectionChange.emit({
- source: this,
- isUserInput: isUserInput,
- selected: this._selected
- });
- };
- MatChip.decorators = [
- { type: core.Directive, args: [{
- selector: "mat-basic-chip, [mat-basic-chip], mat-chip, [mat-chip]",
- inputs: ['color', 'disabled', 'disableRipple'],
- exportAs: 'matChip',
- host: {
- 'class': 'mat-chip',
- '[attr.tabindex]': 'disabled ? null : -1',
- 'role': 'option',
- '[class.mat-chip-selected]': 'selected',
- '[class.mat-chip-with-avatar]': 'avatar',
- '[class.mat-chip-with-trailing-icon]': 'trailingIcon || removeIcon',
- '[class.mat-chip-disabled]': 'disabled',
- '[class._mat-animation-noopable]': '_animationsDisabled',
- '[attr.disabled]': 'disabled || null',
- '[attr.aria-disabled]': 'disabled.toString()',
- '[attr.aria-selected]': 'ariaSelected',
- '(click)': '_handleClick($event)',
- '(keydown)': '_handleKeydown($event)',
- '(focus)': 'focus()',
- '(blur)': '_blur()',
- },
- },] },
- ];
- /** @nocollapse */
- MatChip.ctorParameters = function () { return [
- { type: core.ElementRef },
- { type: core.NgZone },
- { type: platform.Platform },
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_RIPPLE_GLOBAL_OPTIONS,] }] },
- { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
- ]; };
- MatChip.propDecorators = {
- avatar: [{ type: core.ContentChild, args: [MatChipAvatar, { static: false },] }],
- trailingIcon: [{ type: core.ContentChild, args: [MatChipTrailingIcon, { static: false },] }],
- removeIcon: [{ type: core.ContentChild, args: [core.forwardRef((/**
- * @return {?}
- */
- function () { return MatChipRemove; })), { static: false },] }],
- selected: [{ type: core.Input }],
- value: [{ type: core.Input }],
- selectable: [{ type: core.Input }],
- removable: [{ type: core.Input }],
- selectionChange: [{ type: core.Output }],
- destroyed: [{ type: core.Output }],
- removed: [{ type: core.Output }]
- };
- return MatChip;
- }(_MatChipMixinBase));
- /**
- * Applies proper (click) support and adds styling for use with the Material Design "cancel" icon
- * available at https://material.io/icons/#ic_cancel.
- *
- * Example:
- *
- * `<mat-chip>
- * <mat-icon matChipRemove>cancel</mat-icon>
- * </mat-chip>`
- *
- * You *may* use a custom icon, but you may need to override the `mat-chip-remove` positioning
- * styles to properly center the icon within the chip.
- */
- var MatChipRemove = /** @class */ (function () {
- function MatChipRemove(_parentChip) {
- this._parentChip = _parentChip;
- }
- /** Calls the parent chip's public `remove()` method if applicable. */
- /**
- * Calls the parent chip's public `remove()` method if applicable.
- * @param {?} event
- * @return {?}
- */
- MatChipRemove.prototype._handleClick = /**
- * Calls the parent chip's public `remove()` method if applicable.
- * @param {?} event
- * @return {?}
- */
- function (event) {
- /** @type {?} */
- var parentChip = this._parentChip;
- if (parentChip.removable && !parentChip.disabled) {
- parentChip.remove();
- }
- // We need to stop event propagation because otherwise the event will bubble up to the
- // form field and cause the `onContainerClick` method to be invoked. This method would then
- // reset the focused chip that has been focused after chip removal. Usually the parent
- // the parent click listener of the `MatChip` would prevent propagation, but it can happen
- // that the chip is being removed before the event bubbles up.
- event.stopPropagation();
- };
- MatChipRemove.decorators = [
- { type: core.Directive, args: [{
- selector: '[matChipRemove]',
- host: {
- 'class': 'mat-chip-remove mat-chip-trailing-icon',
- '(click)': '_handleClick($event)',
- }
- },] },
- ];
- /** @nocollapse */
- MatChipRemove.ctorParameters = function () { return [
- { type: MatChip }
- ]; };
- return MatChipRemove;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Injection token to be used to override the default options for the chips module.
- * @type {?}
- */
- var MAT_CHIPS_DEFAULT_OPTIONS = new core.InjectionToken('mat-chips-default-options');
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- // Boilerplate for applying mixins to MatChipList.
- /**
- * \@docs-private
- */
- var
- // Boilerplate for applying mixins to MatChipList.
- /**
- * \@docs-private
- */
- MatChipListBase = /** @class */ (function () {
- function MatChipListBase(_defaultErrorStateMatcher, _parentForm, _parentFormGroup, ngControl) {
- this._defaultErrorStateMatcher = _defaultErrorStateMatcher;
- this._parentForm = _parentForm;
- this._parentFormGroup = _parentFormGroup;
- this.ngControl = ngControl;
- }
- return MatChipListBase;
- }());
- /** @type {?} */
- var _MatChipListMixinBase = mixinErrorState(MatChipListBase);
- // Increasing integer for generating unique ids for chip-list components.
- /** @type {?} */
- var nextUniqueId$4 = 0;
- /**
- * Change event object that is emitted when the chip list value has changed.
- */
- var /**
- * Change event object that is emitted when the chip list value has changed.
- */
- MatChipListChange = /** @class */ (function () {
- function MatChipListChange(source, value) {
- this.source = source;
- this.value = value;
- }
- return MatChipListChange;
- }());
- /**
- * A material design chips component (named ChipList for its similarity to the List component).
- */
- var MatChipList = /** @class */ (function (_super) {
- __extends(MatChipList, _super);
- function MatChipList(_elementRef, _changeDetectorRef, _dir, _parentForm, _parentFormGroup, _defaultErrorStateMatcher, ngControl) {
- var _this = _super.call(this, _defaultErrorStateMatcher, _parentForm, _parentFormGroup, ngControl) || this;
- _this._elementRef = _elementRef;
- _this._changeDetectorRef = _changeDetectorRef;
- _this._dir = _dir;
- _this.ngControl = ngControl;
- /**
- * Implemented as part of MatFormFieldControl.
- * \@docs-private
- */
- _this.controlType = 'mat-chip-list';
- /**
- * When a chip is destroyed, we store the index of the destroyed chip until the chips
- * query list notifies about the update. This is necessary because we cannot determine an
- * appropriate chip that should receive focus until the array of chips updated completely.
- */
- _this._lastDestroyedChipIndex = null;
- /**
- * Subject that emits when the component has been destroyed.
- */
- _this._destroyed = new rxjs.Subject();
- /**
- * Uid of the chip list
- */
- _this._uid = "mat-chip-list-" + nextUniqueId$4++;
- /**
- * Tab index for the chip list.
- */
- _this._tabIndex = 0;
- /**
- * User defined tab index.
- * When it is not null, use user defined tab index. Otherwise use _tabIndex
- */
- _this._userTabIndex = null;
- /**
- * Function when touched
- */
- _this._onTouched = (/**
- * @return {?}
- */
- function () { });
- /**
- * Function when changed
- */
- _this._onChange = (/**
- * @return {?}
- */
- function () { });
- _this._multiple = false;
- _this._compareWith = (/**
- * @param {?} o1
- * @param {?} o2
- * @return {?}
- */
- function (o1, o2) { return o1 === o2; });
- _this._required = false;
- _this._disabled = false;
- /**
- * Orientation of the chip list.
- */
- _this.ariaOrientation = 'horizontal';
- _this._selectable = true;
- /**
- * Event emitted when the selected chip list value has been changed by the user.
- */
- _this.change = new core.EventEmitter();
- /**
- * Event that emits whenever the raw value of the chip-list changes. This is here primarily
- * to facilitate the two-way binding for the `value` input.
- * \@docs-private
- */
- _this.valueChange = new core.EventEmitter();
- if (_this.ngControl) {
- _this.ngControl.valueAccessor = _this;
- }
- return _this;
- }
- Object.defineProperty(MatChipList.prototype, "selected", {
- /** The array of selected chips inside chip list. */
- get: /**
- * The array of selected chips inside chip list.
- * @return {?}
- */
- function () {
- return this.multiple ? this._selectionModel.selected : this._selectionModel.selected[0];
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatChipList.prototype, "role", {
- /** The ARIA role applied to the chip list. */
- get: /**
- * The ARIA role applied to the chip list.
- * @return {?}
- */
- function () { return this.empty ? null : 'listbox'; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatChipList.prototype, "multiple", {
- /** Whether the user should be allowed to select multiple chips. */
- get: /**
- * Whether the user should be allowed to select multiple chips.
- * @return {?}
- */
- function () { return this._multiple; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._multiple = coercion.coerceBooleanProperty(value);
- this._syncChipsState();
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatChipList.prototype, "compareWith", {
- /**
- * A function to compare the option values with the selected values. The first argument
- * is a value from an option. The second is a value from the selection. A boolean
- * should be returned.
- */
- get: /**
- * A function to compare the option values with the selected values. The first argument
- * is a value from an option. The second is a value from the selection. A boolean
- * should be returned.
- * @return {?}
- */
- function () { return this._compareWith; },
- set: /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- this._compareWith = fn;
- if (this._selectionModel) {
- // A different comparator means the selection could change.
- this._initializeSelection();
- }
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatChipList.prototype, "value", {
- /**
- * Implemented as part of MatFormFieldControl.
- * @docs-private
- */
- get: /**
- * Implemented as part of MatFormFieldControl.
- * \@docs-private
- * @return {?}
- */
- function () { return this._value; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this.writeValue(value);
- this._value = value;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatChipList.prototype, "id", {
- /**
- * Implemented as part of MatFormFieldControl.
- * @docs-private
- */
- get: /**
- * Implemented as part of MatFormFieldControl.
- * \@docs-private
- * @return {?}
- */
- function () {
- return this._chipInput ? this._chipInput.id : this._uid;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatChipList.prototype, "required", {
- /**
- * Implemented as part of MatFormFieldControl.
- * @docs-private
- */
- get: /**
- * Implemented as part of MatFormFieldControl.
- * \@docs-private
- * @return {?}
- */
- function () { return this._required; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._required = coercion.coerceBooleanProperty(value);
- this.stateChanges.next();
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatChipList.prototype, "placeholder", {
- /**
- * Implemented as part of MatFormFieldControl.
- * @docs-private
- */
- get: /**
- * Implemented as part of MatFormFieldControl.
- * \@docs-private
- * @return {?}
- */
- function () {
- return this._chipInput ? this._chipInput.placeholder : this._placeholder;
- },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._placeholder = value;
- this.stateChanges.next();
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatChipList.prototype, "focused", {
- /** Whether any chips or the matChipInput inside of this chip-list has focus. */
- get: /**
- * Whether any chips or the matChipInput inside of this chip-list has focus.
- * @return {?}
- */
- function () {
- return (this._chipInput && this._chipInput.focused) || this._hasFocusedChip();
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatChipList.prototype, "empty", {
- /**
- * Implemented as part of MatFormFieldControl.
- * @docs-private
- */
- get: /**
- * Implemented as part of MatFormFieldControl.
- * \@docs-private
- * @return {?}
- */
- function () {
- return (!this._chipInput || this._chipInput.empty) && this.chips.length === 0;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatChipList.prototype, "shouldLabelFloat", {
- /**
- * Implemented as part of MatFormFieldControl.
- * @docs-private
- */
- get: /**
- * Implemented as part of MatFormFieldControl.
- * \@docs-private
- * @return {?}
- */
- function () { return !this.empty || this.focused; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatChipList.prototype, "disabled", {
- /**
- * Implemented as part of MatFormFieldControl.
- * @docs-private
- */
- get: /**
- * Implemented as part of MatFormFieldControl.
- * \@docs-private
- * @return {?}
- */
- function () { return this.ngControl ? !!this.ngControl.disabled : this._disabled; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._disabled = coercion.coerceBooleanProperty(value);
- this._syncChipsState();
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatChipList.prototype, "selectable", {
- /**
- * Whether or not this chip list is selectable. When a chip list is not selectable,
- * the selected states for all the chips inside the chip list are always ignored.
- */
- get: /**
- * Whether or not this chip list is selectable. When a chip list is not selectable,
- * the selected states for all the chips inside the chip list are always ignored.
- * @return {?}
- */
- function () { return this._selectable; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- var _this = this;
- this._selectable = coercion.coerceBooleanProperty(value);
- if (this.chips) {
- this.chips.forEach((/**
- * @param {?} chip
- * @return {?}
- */
- function (chip) { return chip.chipListSelectable = _this._selectable; }));
- }
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatChipList.prototype, "tabIndex", {
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._userTabIndex = value;
- this._tabIndex = value;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatChipList.prototype, "chipSelectionChanges", {
- /** Combined stream of all of the child chips' selection change events. */
- get: /**
- * Combined stream of all of the child chips' selection change events.
- * @return {?}
- */
- function () {
- return rxjs.merge.apply(void 0, this.chips.map((/**
- * @param {?} chip
- * @return {?}
- */
- function (chip) { return chip.selectionChange; })));
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatChipList.prototype, "chipFocusChanges", {
- /** Combined stream of all of the child chips' focus change events. */
- get: /**
- * Combined stream of all of the child chips' focus change events.
- * @return {?}
- */
- function () {
- return rxjs.merge.apply(void 0, this.chips.map((/**
- * @param {?} chip
- * @return {?}
- */
- function (chip) { return chip._onFocus; })));
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatChipList.prototype, "chipBlurChanges", {
- /** Combined stream of all of the child chips' blur change events. */
- get: /**
- * Combined stream of all of the child chips' blur change events.
- * @return {?}
- */
- function () {
- return rxjs.merge.apply(void 0, this.chips.map((/**
- * @param {?} chip
- * @return {?}
- */
- function (chip) { return chip._onBlur; })));
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatChipList.prototype, "chipRemoveChanges", {
- /** Combined stream of all of the child chips' remove change events. */
- get: /**
- * Combined stream of all of the child chips' remove change events.
- * @return {?}
- */
- function () {
- return rxjs.merge.apply(void 0, this.chips.map((/**
- * @param {?} chip
- * @return {?}
- */
- function (chip) { return chip.destroyed; })));
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- MatChipList.prototype.ngAfterContentInit = /**
- * @return {?}
- */
- function () {
- var _this = this;
- this._keyManager = new a11y.FocusKeyManager(this.chips)
- .withWrap()
- .withVerticalOrientation()
- .withHorizontalOrientation(this._dir ? this._dir.value : 'ltr');
- if (this._dir) {
- this._dir.change
- .pipe(operators.takeUntil(this._destroyed))
- .subscribe((/**
- * @param {?} dir
- * @return {?}
- */
- function (dir) { return _this._keyManager.withHorizontalOrientation(dir); }));
- }
- this._keyManager.tabOut.pipe(operators.takeUntil(this._destroyed)).subscribe((/**
- * @return {?}
- */
- function () {
- _this._allowFocusEscape();
- }));
- // When the list changes, re-subscribe
- this.chips.changes.pipe(operators.startWith(null), operators.takeUntil(this._destroyed)).subscribe((/**
- * @return {?}
- */
- function () {
- if (_this.disabled) {
- // Since this happens after the content has been
- // checked, we need to defer it to the next tick.
- Promise.resolve().then((/**
- * @return {?}
- */
- function () {
- _this._syncChipsState();
- }));
- }
- _this._resetChips();
- // Reset chips selected/deselected status
- _this._initializeSelection();
- // Check to see if we need to update our tab index
- _this._updateTabIndex();
- // Check to see if we have a destroyed chip and need to refocus
- _this._updateFocusForDestroyedChips();
- _this.stateChanges.next();
- }));
- };
- /**
- * @return {?}
- */
- MatChipList.prototype.ngOnInit = /**
- * @return {?}
- */
- function () {
- this._selectionModel = new collections.SelectionModel(this.multiple, undefined, false);
- this.stateChanges.next();
- };
- /**
- * @return {?}
- */
- MatChipList.prototype.ngDoCheck = /**
- * @return {?}
- */
- function () {
- if (this.ngControl) {
- // We need to re-evaluate this on every change detection cycle, because there are some
- // error triggers that we can't subscribe to (e.g. parent form submissions). This means
- // that whatever logic is in here has to be super lean or we risk destroying the performance.
- this.updateErrorState();
- }
- };
- /**
- * @return {?}
- */
- MatChipList.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- this._destroyed.next();
- this._destroyed.complete();
- this.stateChanges.complete();
- this._dropSubscriptions();
- };
- /** Associates an HTML input element with this chip list. */
- /**
- * Associates an HTML input element with this chip list.
- * @param {?} inputElement
- * @return {?}
- */
- MatChipList.prototype.registerInput = /**
- * Associates an HTML input element with this chip list.
- * @param {?} inputElement
- * @return {?}
- */
- function (inputElement) {
- this._chipInput = inputElement;
- };
- /**
- * Implemented as part of MatFormFieldControl.
- * @docs-private
- */
- /**
- * Implemented as part of MatFormFieldControl.
- * \@docs-private
- * @param {?} ids
- * @return {?}
- */
- MatChipList.prototype.setDescribedByIds = /**
- * Implemented as part of MatFormFieldControl.
- * \@docs-private
- * @param {?} ids
- * @return {?}
- */
- function (ids) { this._ariaDescribedby = ids.join(' '); };
- // Implemented as part of ControlValueAccessor.
- // Implemented as part of ControlValueAccessor.
- /**
- * @param {?} value
- * @return {?}
- */
- MatChipList.prototype.writeValue =
- // Implemented as part of ControlValueAccessor.
- /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- if (this.chips) {
- this._setSelectionByValue(value, false);
- }
- };
- // Implemented as part of ControlValueAccessor.
- // Implemented as part of ControlValueAccessor.
- /**
- * @param {?} fn
- * @return {?}
- */
- MatChipList.prototype.registerOnChange =
- // Implemented as part of ControlValueAccessor.
- /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- this._onChange = fn;
- };
- // Implemented as part of ControlValueAccessor.
- // Implemented as part of ControlValueAccessor.
- /**
- * @param {?} fn
- * @return {?}
- */
- MatChipList.prototype.registerOnTouched =
- // Implemented as part of ControlValueAccessor.
- /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- this._onTouched = fn;
- };
- // Implemented as part of ControlValueAccessor.
- // Implemented as part of ControlValueAccessor.
- /**
- * @param {?} isDisabled
- * @return {?}
- */
- MatChipList.prototype.setDisabledState =
- // Implemented as part of ControlValueAccessor.
- /**
- * @param {?} isDisabled
- * @return {?}
- */
- function (isDisabled) {
- this.disabled = isDisabled;
- this.stateChanges.next();
- };
- /**
- * Implemented as part of MatFormFieldControl.
- * @docs-private
- */
- /**
- * Implemented as part of MatFormFieldControl.
- * \@docs-private
- * @param {?} event
- * @return {?}
- */
- MatChipList.prototype.onContainerClick = /**
- * Implemented as part of MatFormFieldControl.
- * \@docs-private
- * @param {?} event
- * @return {?}
- */
- function (event) {
- if (!this._originatesFromChip(event)) {
- this.focus();
- }
- };
- /**
- * Focuses the first non-disabled chip in this chip list, or the associated input when there
- * are no eligible chips.
- */
- /**
- * Focuses the first non-disabled chip in this chip list, or the associated input when there
- * are no eligible chips.
- * @param {?=} options
- * @return {?}
- */
- MatChipList.prototype.focus = /**
- * Focuses the first non-disabled chip in this chip list, or the associated input when there
- * are no eligible chips.
- * @param {?=} options
- * @return {?}
- */
- function (options) {
- if (this.disabled) {
- return;
- }
- // TODO: ARIA says this should focus the first `selected` chip if any are selected.
- // Focus on first element if there's no chipInput inside chip-list
- if (this._chipInput && this._chipInput.focused) {
- // do nothing
- }
- else if (this.chips.length > 0) {
- this._keyManager.setFirstItemActive();
- this.stateChanges.next();
- }
- else {
- this._focusInput(options);
- this.stateChanges.next();
- }
- };
- /** Attempt to focus an input if we have one. */
- /**
- * Attempt to focus an input if we have one.
- * @param {?=} options
- * @return {?}
- */
- MatChipList.prototype._focusInput = /**
- * Attempt to focus an input if we have one.
- * @param {?=} options
- * @return {?}
- */
- function (options) {
- if (this._chipInput) {
- this._chipInput.focus(options);
- }
- };
- /**
- * Pass events to the keyboard manager. Available here for tests.
- */
- /**
- * Pass events to the keyboard manager. Available here for tests.
- * @param {?} event
- * @return {?}
- */
- MatChipList.prototype._keydown = /**
- * Pass events to the keyboard manager. Available here for tests.
- * @param {?} event
- * @return {?}
- */
- function (event) {
- /** @type {?} */
- var target = (/** @type {?} */ (event.target));
- // If they are on an empty input and hit backspace, focus the last chip
- if (event.keyCode === keycodes.BACKSPACE && this._isInputEmpty(target)) {
- this._keyManager.setLastItemActive();
- event.preventDefault();
- }
- else if (target && target.classList.contains('mat-chip')) {
- if (event.keyCode === keycodes.HOME) {
- this._keyManager.setFirstItemActive();
- event.preventDefault();
- }
- else if (event.keyCode === keycodes.END) {
- this._keyManager.setLastItemActive();
- event.preventDefault();
- }
- else {
- this._keyManager.onKeydown(event);
- }
- this.stateChanges.next();
- }
- };
- /**
- * Check the tab index as you should not be allowed to focus an empty list.
- */
- /**
- * Check the tab index as you should not be allowed to focus an empty list.
- * @protected
- * @return {?}
- */
- MatChipList.prototype._updateTabIndex = /**
- * Check the tab index as you should not be allowed to focus an empty list.
- * @protected
- * @return {?}
- */
- function () {
- // If we have 0 chips, we should not allow keyboard focus
- this._tabIndex = this._userTabIndex || (this.chips.length === 0 ? -1 : 0);
- };
- /**
- * If the amount of chips changed, we need to update the
- * key manager state and focus the next closest chip.
- */
- /**
- * If the amount of chips changed, we need to update the
- * key manager state and focus the next closest chip.
- * @protected
- * @return {?}
- */
- MatChipList.prototype._updateFocusForDestroyedChips = /**
- * If the amount of chips changed, we need to update the
- * key manager state and focus the next closest chip.
- * @protected
- * @return {?}
- */
- function () {
- // Move focus to the closest chip. If no other chips remain, focus the chip-list itself.
- if (this._lastDestroyedChipIndex != null) {
- if (this.chips.length) {
- /** @type {?} */
- var newChipIndex = Math.min(this._lastDestroyedChipIndex, this.chips.length - 1);
- this._keyManager.setActiveItem(newChipIndex);
- }
- else {
- this.focus();
- }
- }
- this._lastDestroyedChipIndex = null;
- };
- /**
- * Utility to ensure all indexes are valid.
- *
- * @param index The index to be checked.
- * @returns True if the index is valid for our list of chips.
- */
- /**
- * Utility to ensure all indexes are valid.
- *
- * @private
- * @param {?} index The index to be checked.
- * @return {?} True if the index is valid for our list of chips.
- */
- MatChipList.prototype._isValidIndex = /**
- * Utility to ensure all indexes are valid.
- *
- * @private
- * @param {?} index The index to be checked.
- * @return {?} True if the index is valid for our list of chips.
- */
- function (index) {
- return index >= 0 && index < this.chips.length;
- };
- /**
- * @private
- * @param {?} element
- * @return {?}
- */
- MatChipList.prototype._isInputEmpty = /**
- * @private
- * @param {?} element
- * @return {?}
- */
- function (element) {
- if (element && element.nodeName.toLowerCase() === 'input') {
- /** @type {?} */
- var input = (/** @type {?} */ (element));
- return !input.value;
- }
- return false;
- };
- /**
- * @param {?} value
- * @param {?=} isUserInput
- * @return {?}
- */
- MatChipList.prototype._setSelectionByValue = /**
- * @param {?} value
- * @param {?=} isUserInput
- * @return {?}
- */
- function (value, isUserInput) {
- var _this = this;
- if (isUserInput === void 0) { isUserInput = true; }
- this._clearSelection();
- this.chips.forEach((/**
- * @param {?} chip
- * @return {?}
- */
- function (chip) { return chip.deselect(); }));
- if (Array.isArray(value)) {
- value.forEach((/**
- * @param {?} currentValue
- * @return {?}
- */
- function (currentValue) { return _this._selectValue(currentValue, isUserInput); }));
- this._sortValues();
- }
- else {
- /** @type {?} */
- var correspondingChip = this._selectValue(value, isUserInput);
- // Shift focus to the active item. Note that we shouldn't do this in multiple
- // mode, because we don't know what chip the user interacted with last.
- if (correspondingChip) {
- if (isUserInput) {
- this._keyManager.setActiveItem(correspondingChip);
- }
- }
- }
- };
- /**
- * Finds and selects the chip based on its value.
- * @returns Chip that has the corresponding value.
- */
- /**
- * Finds and selects the chip based on its value.
- * @private
- * @param {?} value
- * @param {?=} isUserInput
- * @return {?} Chip that has the corresponding value.
- */
- MatChipList.prototype._selectValue = /**
- * Finds and selects the chip based on its value.
- * @private
- * @param {?} value
- * @param {?=} isUserInput
- * @return {?} Chip that has the corresponding value.
- */
- function (value, isUserInput) {
- var _this = this;
- if (isUserInput === void 0) { isUserInput = true; }
- /** @type {?} */
- var correspondingChip = this.chips.find((/**
- * @param {?} chip
- * @return {?}
- */
- function (chip) {
- return chip.value != null && _this._compareWith(chip.value, value);
- }));
- if (correspondingChip) {
- isUserInput ? correspondingChip.selectViaInteraction() : correspondingChip.select();
- this._selectionModel.select(correspondingChip);
- }
- return correspondingChip;
- };
- /**
- * @private
- * @return {?}
- */
- MatChipList.prototype._initializeSelection = /**
- * @private
- * @return {?}
- */
- function () {
- var _this = this;
- // Defer setting the value in order to avoid the "Expression
- // has changed after it was checked" errors from Angular.
- Promise.resolve().then((/**
- * @return {?}
- */
- function () {
- if (_this.ngControl || _this._value) {
- _this._setSelectionByValue(_this.ngControl ? _this.ngControl.value : _this._value, false);
- _this.stateChanges.next();
- }
- }));
- };
- /**
- * Deselects every chip in the list.
- * @param skip Chip that should not be deselected.
- */
- /**
- * Deselects every chip in the list.
- * @private
- * @param {?=} skip Chip that should not be deselected.
- * @return {?}
- */
- MatChipList.prototype._clearSelection = /**
- * Deselects every chip in the list.
- * @private
- * @param {?=} skip Chip that should not be deselected.
- * @return {?}
- */
- function (skip) {
- this._selectionModel.clear();
- this.chips.forEach((/**
- * @param {?} chip
- * @return {?}
- */
- function (chip) {
- if (chip !== skip) {
- chip.deselect();
- }
- }));
- this.stateChanges.next();
- };
- /**
- * Sorts the model values, ensuring that they keep the same
- * order that they have in the panel.
- */
- /**
- * Sorts the model values, ensuring that they keep the same
- * order that they have in the panel.
- * @private
- * @return {?}
- */
- MatChipList.prototype._sortValues = /**
- * Sorts the model values, ensuring that they keep the same
- * order that they have in the panel.
- * @private
- * @return {?}
- */
- function () {
- var _this = this;
- if (this._multiple) {
- this._selectionModel.clear();
- this.chips.forEach((/**
- * @param {?} chip
- * @return {?}
- */
- function (chip) {
- if (chip.selected) {
- _this._selectionModel.select(chip);
- }
- }));
- this.stateChanges.next();
- }
- };
- /** Emits change event to set the model value. */
- /**
- * Emits change event to set the model value.
- * @private
- * @param {?=} fallbackValue
- * @return {?}
- */
- MatChipList.prototype._propagateChanges = /**
- * Emits change event to set the model value.
- * @private
- * @param {?=} fallbackValue
- * @return {?}
- */
- function (fallbackValue) {
- /** @type {?} */
- var valueToEmit = null;
- if (Array.isArray(this.selected)) {
- valueToEmit = this.selected.map((/**
- * @param {?} chip
- * @return {?}
- */
- function (chip) { return chip.value; }));
- }
- else {
- valueToEmit = this.selected ? this.selected.value : fallbackValue;
- }
- this._value = valueToEmit;
- this.change.emit(new MatChipListChange(this, valueToEmit));
- this.valueChange.emit(valueToEmit);
- this._onChange(valueToEmit);
- this._changeDetectorRef.markForCheck();
- };
- /** When blurred, mark the field as touched when focus moved outside the chip list. */
- /**
- * When blurred, mark the field as touched when focus moved outside the chip list.
- * @return {?}
- */
- MatChipList.prototype._blur = /**
- * When blurred, mark the field as touched when focus moved outside the chip list.
- * @return {?}
- */
- function () {
- var _this = this;
- if (!this._hasFocusedChip()) {
- this._keyManager.setActiveItem(-1);
- }
- if (!this.disabled) {
- if (this._chipInput) {
- // If there's a chip input, we should check whether the focus moved to chip input.
- // If the focus is not moved to chip input, mark the field as touched. If the focus moved
- // to chip input, do nothing.
- // Timeout is needed to wait for the focus() event trigger on chip input.
- setTimeout((/**
- * @return {?}
- */
- function () {
- if (!_this.focused) {
- _this._markAsTouched();
- }
- }));
- }
- else {
- // If there's no chip input, then mark the field as touched.
- this._markAsTouched();
- }
- }
- };
- /** Mark the field as touched */
- /**
- * Mark the field as touched
- * @return {?}
- */
- MatChipList.prototype._markAsTouched = /**
- * Mark the field as touched
- * @return {?}
- */
- function () {
- this._onTouched();
- this._changeDetectorRef.markForCheck();
- this.stateChanges.next();
- };
- /**
- * Removes the `tabindex` from the chip list and resets it back afterwards, allowing the
- * user to tab out of it. This prevents the list from capturing focus and redirecting
- * it back to the first chip, creating a focus trap, if it user tries to tab away.
- */
- /**
- * Removes the `tabindex` from the chip list and resets it back afterwards, allowing the
- * user to tab out of it. This prevents the list from capturing focus and redirecting
- * it back to the first chip, creating a focus trap, if it user tries to tab away.
- * @return {?}
- */
- MatChipList.prototype._allowFocusEscape = /**
- * Removes the `tabindex` from the chip list and resets it back afterwards, allowing the
- * user to tab out of it. This prevents the list from capturing focus and redirecting
- * it back to the first chip, creating a focus trap, if it user tries to tab away.
- * @return {?}
- */
- function () {
- var _this = this;
- if (this._tabIndex !== -1) {
- this._tabIndex = -1;
- setTimeout((/**
- * @return {?}
- */
- function () {
- _this._tabIndex = _this._userTabIndex || 0;
- _this._changeDetectorRef.markForCheck();
- }));
- }
- };
- /**
- * @private
- * @return {?}
- */
- MatChipList.prototype._resetChips = /**
- * @private
- * @return {?}
- */
- function () {
- this._dropSubscriptions();
- this._listenToChipsFocus();
- this._listenToChipsSelection();
- this._listenToChipsRemoved();
- };
- /**
- * @private
- * @return {?}
- */
- MatChipList.prototype._dropSubscriptions = /**
- * @private
- * @return {?}
- */
- function () {
- if (this._chipFocusSubscription) {
- this._chipFocusSubscription.unsubscribe();
- this._chipFocusSubscription = null;
- }
- if (this._chipBlurSubscription) {
- this._chipBlurSubscription.unsubscribe();
- this._chipBlurSubscription = null;
- }
- if (this._chipSelectionSubscription) {
- this._chipSelectionSubscription.unsubscribe();
- this._chipSelectionSubscription = null;
- }
- if (this._chipRemoveSubscription) {
- this._chipRemoveSubscription.unsubscribe();
- this._chipRemoveSubscription = null;
- }
- };
- /** Listens to user-generated selection events on each chip. */
- /**
- * Listens to user-generated selection events on each chip.
- * @private
- * @return {?}
- */
- MatChipList.prototype._listenToChipsSelection = /**
- * Listens to user-generated selection events on each chip.
- * @private
- * @return {?}
- */
- function () {
- var _this = this;
- this._chipSelectionSubscription = this.chipSelectionChanges.subscribe((/**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- event.source.selected
- ? _this._selectionModel.select(event.source)
- : _this._selectionModel.deselect(event.source);
- // For single selection chip list, make sure the deselected value is unselected.
- if (!_this.multiple) {
- _this.chips.forEach((/**
- * @param {?} chip
- * @return {?}
- */
- function (chip) {
- if (!_this._selectionModel.isSelected(chip) && chip.selected) {
- chip.deselect();
- }
- }));
- }
- if (event.isUserInput) {
- _this._propagateChanges();
- }
- }));
- };
- /** Listens to user-generated selection events on each chip. */
- /**
- * Listens to user-generated selection events on each chip.
- * @private
- * @return {?}
- */
- MatChipList.prototype._listenToChipsFocus = /**
- * Listens to user-generated selection events on each chip.
- * @private
- * @return {?}
- */
- function () {
- var _this = this;
- this._chipFocusSubscription = this.chipFocusChanges.subscribe((/**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- /** @type {?} */
- var chipIndex = _this.chips.toArray().indexOf(event.chip);
- if (_this._isValidIndex(chipIndex)) {
- _this._keyManager.updateActiveItemIndex(chipIndex);
- }
- _this.stateChanges.next();
- }));
- this._chipBlurSubscription = this.chipBlurChanges.subscribe((/**
- * @return {?}
- */
- function () {
- _this._blur();
- _this.stateChanges.next();
- }));
- };
- /**
- * @private
- * @return {?}
- */
- MatChipList.prototype._listenToChipsRemoved = /**
- * @private
- * @return {?}
- */
- function () {
- var _this = this;
- this._chipRemoveSubscription = this.chipRemoveChanges.subscribe((/**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- /** @type {?} */
- var chip = event.chip;
- /** @type {?} */
- var chipIndex = _this.chips.toArray().indexOf(event.chip);
- // In case the chip that will be removed is currently focused, we temporarily store
- // the index in order to be able to determine an appropriate sibling chip that will
- // receive focus.
- if (_this._isValidIndex(chipIndex) && chip._hasFocus) {
- _this._lastDestroyedChipIndex = chipIndex;
- }
- }));
- };
- /** Checks whether an event comes from inside a chip element. */
- /**
- * Checks whether an event comes from inside a chip element.
- * @private
- * @param {?} event
- * @return {?}
- */
- MatChipList.prototype._originatesFromChip = /**
- * Checks whether an event comes from inside a chip element.
- * @private
- * @param {?} event
- * @return {?}
- */
- function (event) {
- /** @type {?} */
- var currentElement = (/** @type {?} */ (event.target));
- while (currentElement && currentElement !== this._elementRef.nativeElement) {
- if (currentElement.classList.contains('mat-chip')) {
- return true;
- }
- currentElement = currentElement.parentElement;
- }
- return false;
- };
- /** Checks whether any of the chips is focused. */
- /**
- * Checks whether any of the chips is focused.
- * @private
- * @return {?}
- */
- MatChipList.prototype._hasFocusedChip = /**
- * Checks whether any of the chips is focused.
- * @private
- * @return {?}
- */
- function () {
- return this.chips.some((/**
- * @param {?} chip
- * @return {?}
- */
- function (chip) { return chip._hasFocus; }));
- };
- /** Syncs the list's state with the individual chips. */
- /**
- * Syncs the list's state with the individual chips.
- * @private
- * @return {?}
- */
- MatChipList.prototype._syncChipsState = /**
- * Syncs the list's state with the individual chips.
- * @private
- * @return {?}
- */
- function () {
- var _this = this;
- if (this.chips) {
- this.chips.forEach((/**
- * @param {?} chip
- * @return {?}
- */
- function (chip) {
- chip.disabled = _this._disabled;
- chip._chipListMultiple = _this.multiple;
- }));
- }
- };
- MatChipList.decorators = [
- { type: core.Component, args: [{selector: 'mat-chip-list',
- template: "<div class=\"mat-chip-list-wrapper\"><ng-content></ng-content></div>",
- exportAs: 'matChipList',
- host: {
- '[attr.tabindex]': 'disabled ? null : _tabIndex',
- '[attr.aria-describedby]': '_ariaDescribedby || null',
- '[attr.aria-required]': 'required.toString()',
- '[attr.aria-disabled]': 'disabled.toString()',
- '[attr.aria-invalid]': 'errorState',
- '[attr.aria-multiselectable]': 'multiple',
- '[attr.role]': 'role',
- '[class.mat-chip-list-disabled]': 'disabled',
- '[class.mat-chip-list-invalid]': 'errorState',
- '[class.mat-chip-list-required]': 'required',
- '[attr.aria-orientation]': 'ariaOrientation',
- 'class': 'mat-chip-list',
- '(focus)': 'focus()',
- '(blur)': '_blur()',
- '(keydown)': '_keydown($event)',
- '[id]': '_uid',
- },
- providers: [{ provide: MatFormFieldControl, useExisting: MatChipList }],
- 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}"],
- encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush
- },] },
- ];
- /** @nocollapse */
- MatChipList.ctorParameters = function () { return [
- { type: core.ElementRef },
- { type: core.ChangeDetectorRef },
- { type: bidi.Directionality, decorators: [{ type: core.Optional }] },
- { type: forms.NgForm, decorators: [{ type: core.Optional }] },
- { type: forms.FormGroupDirective, decorators: [{ type: core.Optional }] },
- { type: ErrorStateMatcher },
- { type: forms.NgControl, decorators: [{ type: core.Optional }, { type: core.Self }] }
- ]; };
- MatChipList.propDecorators = {
- errorStateMatcher: [{ type: core.Input }],
- multiple: [{ type: core.Input }],
- compareWith: [{ type: core.Input }],
- value: [{ type: core.Input }],
- required: [{ type: core.Input }],
- placeholder: [{ type: core.Input }],
- disabled: [{ type: core.Input }],
- ariaOrientation: [{ type: core.Input, args: ['aria-orientation',] }],
- selectable: [{ type: core.Input }],
- tabIndex: [{ type: core.Input }],
- change: [{ type: core.Output }],
- valueChange: [{ type: core.Output }],
- chips: [{ type: core.ContentChildren, args: [MatChip, {
- // We need to use `descendants: true`, because Ivy will no longer match
- // indirect descendants if it's left as false.
- descendants: true
- },] }]
- };
- return MatChipList;
- }(_MatChipListMixinBase));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- // Increasing integer for generating unique ids.
- /** @type {?} */
- var nextUniqueId$1$1 = 0;
- /**
- * Directive that adds chip-specific behaviors to an input element inside `<mat-form-field>`.
- * May be placed inside or outside of an `<mat-chip-list>`.
- */
- var MatChipInput = /** @class */ (function () {
- function MatChipInput(_elementRef, _defaultOptions) {
- this._elementRef = _elementRef;
- this._defaultOptions = _defaultOptions;
- /**
- * Whether the control is focused.
- */
- this.focused = false;
- this._addOnBlur = false;
- /**
- * The list of key codes that will trigger a chipEnd event.
- *
- * Defaults to `[ENTER]`.
- */
- this.separatorKeyCodes = this._defaultOptions.separatorKeyCodes;
- /**
- * Emitted when a chip is to be added.
- */
- this.chipEnd = new core.EventEmitter();
- /**
- * The input's placeholder text.
- */
- this.placeholder = '';
- /**
- * Unique id for the input.
- */
- this.id = "mat-chip-list-input-" + nextUniqueId$1$1++;
- this._disabled = false;
- this._inputElement = (/** @type {?} */ (this._elementRef.nativeElement));
- }
- Object.defineProperty(MatChipInput.prototype, "chipList", {
- /** Register input for chip list */
- set: /**
- * Register input for chip list
- * @param {?} value
- * @return {?}
- */
- function (value) {
- if (value) {
- this._chipList = value;
- this._chipList.registerInput(this);
- }
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatChipInput.prototype, "addOnBlur", {
- /**
- * Whether or not the chipEnd event will be emitted when the input is blurred.
- */
- get: /**
- * Whether or not the chipEnd event will be emitted when the input is blurred.
- * @return {?}
- */
- function () { return this._addOnBlur; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) { this._addOnBlur = coercion.coerceBooleanProperty(value); },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatChipInput.prototype, "disabled", {
- /** Whether the input is disabled. */
- get: /**
- * Whether the input is disabled.
- * @return {?}
- */
- function () { return this._disabled || (this._chipList && this._chipList.disabled); },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) { this._disabled = coercion.coerceBooleanProperty(value); },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatChipInput.prototype, "empty", {
- /** Whether the input is empty. */
- get: /**
- * Whether the input is empty.
- * @return {?}
- */
- function () { return !this._inputElement.value; },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- MatChipInput.prototype.ngOnChanges = /**
- * @return {?}
- */
- function () {
- this._chipList.stateChanges.next();
- };
- /** Utility method to make host definition/tests more clear. */
- /**
- * Utility method to make host definition/tests more clear.
- * @param {?=} event
- * @return {?}
- */
- MatChipInput.prototype._keydown = /**
- * Utility method to make host definition/tests more clear.
- * @param {?=} event
- * @return {?}
- */
- function (event) {
- // Allow the user's focus to escape when they're tabbing forward. Note that we don't
- // want to do this when going backwards, because focus should go back to the first chip.
- if (event && event.keyCode === keycodes.TAB && !keycodes.hasModifierKey(event, 'shiftKey')) {
- this._chipList._allowFocusEscape();
- }
- this._emitChipEnd(event);
- };
- /** Checks to see if the blur should emit the (chipEnd) event. */
- /**
- * Checks to see if the blur should emit the (chipEnd) event.
- * @return {?}
- */
- MatChipInput.prototype._blur = /**
- * Checks to see if the blur should emit the (chipEnd) event.
- * @return {?}
- */
- function () {
- if (this.addOnBlur) {
- this._emitChipEnd();
- }
- this.focused = false;
- // Blur the chip list if it is not focused
- if (!this._chipList.focused) {
- this._chipList._blur();
- }
- this._chipList.stateChanges.next();
- };
- /**
- * @return {?}
- */
- MatChipInput.prototype._focus = /**
- * @return {?}
- */
- function () {
- this.focused = true;
- this._chipList.stateChanges.next();
- };
- /** Checks to see if the (chipEnd) event needs to be emitted. */
- /**
- * Checks to see if the (chipEnd) event needs to be emitted.
- * @param {?=} event
- * @return {?}
- */
- MatChipInput.prototype._emitChipEnd = /**
- * Checks to see if the (chipEnd) event needs to be emitted.
- * @param {?=} event
- * @return {?}
- */
- function (event) {
- if (!this._inputElement.value && !!event) {
- this._chipList._keydown(event);
- }
- if (!event || this._isSeparatorKey(event)) {
- this.chipEnd.emit({ input: this._inputElement, value: this._inputElement.value });
- if (event) {
- event.preventDefault();
- }
- }
- };
- /**
- * @return {?}
- */
- MatChipInput.prototype._onInput = /**
- * @return {?}
- */
- function () {
- // Let chip list know whenever the value changes.
- this._chipList.stateChanges.next();
- };
- /** Focuses the input. */
- /**
- * Focuses the input.
- * @param {?=} options
- * @return {?}
- */
- MatChipInput.prototype.focus = /**
- * Focuses the input.
- * @param {?=} options
- * @return {?}
- */
- function (options) {
- this._inputElement.focus(options);
- };
- /** Checks whether a keycode is one of the configured separators. */
- /**
- * Checks whether a keycode is one of the configured separators.
- * @private
- * @param {?} event
- * @return {?}
- */
- MatChipInput.prototype._isSeparatorKey = /**
- * Checks whether a keycode is one of the configured separators.
- * @private
- * @param {?} event
- * @return {?}
- */
- function (event) {
- if (keycodes.hasModifierKey(event)) {
- return false;
- }
- /** @type {?} */
- var separators = this.separatorKeyCodes;
- /** @type {?} */
- var keyCode = event.keyCode;
- return Array.isArray(separators) ? separators.indexOf(keyCode) > -1 : separators.has(keyCode);
- };
- MatChipInput.decorators = [
- { type: core.Directive, args: [{
- selector: 'input[matChipInputFor]',
- exportAs: 'matChipInput, matChipInputFor',
- host: {
- 'class': 'mat-chip-input mat-input-element',
- '(keydown)': '_keydown($event)',
- '(blur)': '_blur()',
- '(focus)': '_focus()',
- '(input)': '_onInput()',
- '[id]': 'id',
- '[attr.disabled]': 'disabled || null',
- '[attr.placeholder]': 'placeholder || null',
- '[attr.aria-invalid]': '_chipList && _chipList.ngControl ? _chipList.ngControl.invalid : null',
- }
- },] },
- ];
- /** @nocollapse */
- MatChipInput.ctorParameters = function () { return [
- { type: core.ElementRef },
- { type: undefined, decorators: [{ type: core.Inject, args: [MAT_CHIPS_DEFAULT_OPTIONS,] }] }
- ]; };
- MatChipInput.propDecorators = {
- chipList: [{ type: core.Input, args: ['matChipInputFor',] }],
- addOnBlur: [{ type: core.Input, args: ['matChipInputAddOnBlur',] }],
- separatorKeyCodes: [{ type: core.Input, args: ['matChipInputSeparatorKeyCodes',] }],
- chipEnd: [{ type: core.Output, args: ['matChipInputTokenEnd',] }],
- placeholder: [{ type: core.Input }],
- id: [{ type: core.Input }],
- disabled: [{ type: core.Input }]
- };
- return MatChipInput;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /** @type {?} */
- var CHIP_DECLARATIONS = [
- MatChipList,
- MatChip,
- MatChipInput,
- MatChipRemove,
- MatChipAvatar,
- MatChipTrailingIcon,
- ];
- var ɵ0$3 = ({
- separatorKeyCodes: [keycodes.ENTER]
- });
- var MatChipsModule = /** @class */ (function () {
- function MatChipsModule() {
- }
- MatChipsModule.decorators = [
- { type: core.NgModule, args: [{
- exports: CHIP_DECLARATIONS,
- declarations: CHIP_DECLARATIONS,
- providers: [
- ErrorStateMatcher,
- {
- provide: MAT_CHIPS_DEFAULT_OPTIONS,
- useValue: (/** @type {?} */ (ɵ0$3))
- }
- ]
- },] },
- ];
- return MatChipsModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Configuration for opening a modal dialog with the MatDialog service.
- * @template D
- */
- var /**
- * Configuration for opening a modal dialog with the MatDialog service.
- * @template D
- */
- MatDialogConfig = /** @class */ (function () {
- function MatDialogConfig() {
- /**
- * The ARIA role of the dialog element.
- */
- this.role = 'dialog';
- /**
- * Custom class for the overlay pane.
- */
- this.panelClass = '';
- /**
- * Whether the dialog has a backdrop.
- */
- this.hasBackdrop = true;
- /**
- * Custom class for the backdrop,
- */
- this.backdropClass = '';
- /**
- * Whether the user can use escape or clicking on the backdrop to close the modal.
- */
- this.disableClose = false;
- /**
- * Width of the dialog.
- */
- this.width = '';
- /**
- * Height of the dialog.
- */
- this.height = '';
- /**
- * Max-width of the dialog. If a number is provided, pixel units are assumed. Defaults to 80vw
- */
- this.maxWidth = '80vw';
- /**
- * Data being injected into the child component.
- */
- this.data = null;
- /**
- * ID of the element that describes the dialog.
- */
- this.ariaDescribedBy = null;
- /**
- * ID of the element that labels the dialog.
- */
- this.ariaLabelledBy = null;
- /**
- * Aria label to assign to the dialog element
- */
- this.ariaLabel = null;
- /**
- * Whether the dialog should focus the first focusable element on open.
- */
- this.autoFocus = true;
- /**
- * Whether the dialog should restore focus to the
- * previously-focused element, after it's closed.
- */
- this.restoreFocus = true;
- /**
- * Whether the dialog should close when the user goes backwards/forwards in history.
- * Note that this usually doesn't include clicking on links (unless the user is using
- * the `HashLocationStrategy`).
- */
- this.closeOnNavigation = true;
- // TODO(jelbourn): add configuration for lifecycle hooks, ARIA labelling.
- }
- return MatDialogConfig;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /** @type {?} */
- var animationBody = [
- // Note: The `enter` animation transitions to `transform: none`, because for some reason
- // specifying the transform explicitly, causes IE both to blur the dialog content and
- // decimate the animation performance. Leaving it as `none` solves both issues.
- animations$1.state('void, exit', animations$1.style({ opacity: 0, transform: 'scale(0.7)' })),
- animations$1.state('enter', animations$1.style({ transform: 'none' })),
- animations$1.transition('* => enter', animations$1.animate('150ms cubic-bezier(0, 0, 0.2, 1)', animations$1.style({ transform: 'none', opacity: 1 }))),
- animations$1.transition('* => void, * => exit', animations$1.animate('75ms cubic-bezier(0.4, 0.0, 0.2, 1)', animations$1.style({ opacity: 0 }))),
- ];
- /**
- * Animations used by MatDialog.
- * \@docs-private
- * @type {?}
- */
- var matDialogAnimations = {
- /**
- * Animation that is applied on the dialog container by defalt.
- */
- dialogContainer: animations$1.trigger('dialogContainer', animationBody),
- /**
- * @deprecated \@breaking-change 8.0.0 Use `matDialogAnimations.dialogContainer` instead.
- */
- slideDialog: animations$1.trigger('slideDialog', animationBody)
- };
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Throws an exception for the case when a ComponentPortal is
- * attached to a DomPortalOutlet without an origin.
- * \@docs-private
- * @return {?}
- */
- function throwMatDialogContentAlreadyAttachedError() {
- throw Error('Attempting to attach dialog content after content is already attached');
- }
- /**
- * Internal component that wraps user-provided dialog content.
- * Animation is based on https://material.io/guidelines/motion/choreography.html.
- * \@docs-private
- */
- var MatDialogContainer = /** @class */ (function (_super) {
- __extends(MatDialogContainer, _super);
- function MatDialogContainer(_elementRef, _focusTrapFactory, _changeDetectorRef, _document, _config) {
- var _this = _super.call(this) || this;
- _this._elementRef = _elementRef;
- _this._focusTrapFactory = _focusTrapFactory;
- _this._changeDetectorRef = _changeDetectorRef;
- _this._document = _document;
- _this._config = _config;
- /**
- * Element that was focused before the dialog was opened. Save this to restore upon close.
- */
- _this._elementFocusedBeforeDialogWasOpened = null;
- /**
- * State of the dialog animation.
- */
- _this._state = 'enter';
- /**
- * Emits when an animation state changes.
- */
- _this._animationStateChanged = new core.EventEmitter();
- _this._ariaLabelledBy = _config.ariaLabelledBy || null;
- return _this;
- }
- /**
- * Attach a ComponentPortal as content to this dialog container.
- * @param portal Portal to be attached as the dialog content.
- */
- /**
- * Attach a ComponentPortal as content to this dialog container.
- * @template T
- * @param {?} portal Portal to be attached as the dialog content.
- * @return {?}
- */
- MatDialogContainer.prototype.attachComponentPortal = /**
- * Attach a ComponentPortal as content to this dialog container.
- * @template T
- * @param {?} portal Portal to be attached as the dialog content.
- * @return {?}
- */
- function (portal$$1) {
- if (this._portalOutlet.hasAttached()) {
- throwMatDialogContentAlreadyAttachedError();
- }
- this._savePreviouslyFocusedElement();
- return this._portalOutlet.attachComponentPortal(portal$$1);
- };
- /**
- * Attach a TemplatePortal as content to this dialog container.
- * @param portal Portal to be attached as the dialog content.
- */
- /**
- * Attach a TemplatePortal as content to this dialog container.
- * @template C
- * @param {?} portal Portal to be attached as the dialog content.
- * @return {?}
- */
- MatDialogContainer.prototype.attachTemplatePortal = /**
- * Attach a TemplatePortal as content to this dialog container.
- * @template C
- * @param {?} portal Portal to be attached as the dialog content.
- * @return {?}
- */
- function (portal$$1) {
- if (this._portalOutlet.hasAttached()) {
- throwMatDialogContentAlreadyAttachedError();
- }
- this._savePreviouslyFocusedElement();
- return this._portalOutlet.attachTemplatePortal(portal$$1);
- };
- /** Moves the focus inside the focus trap. */
- /**
- * Moves the focus inside the focus trap.
- * @private
- * @return {?}
- */
- MatDialogContainer.prototype._trapFocus = /**
- * Moves the focus inside the focus trap.
- * @private
- * @return {?}
- */
- function () {
- /** @type {?} */
- var element = this._elementRef.nativeElement;
- if (!this._focusTrap) {
- this._focusTrap = this._focusTrapFactory.create(element);
- }
- // If we were to attempt to focus immediately, then the content of the dialog would not yet be
- // ready in instances where change detection has to run first. To deal with this, we simply
- // wait for the microtask queue to be empty.
- if (this._config.autoFocus) {
- this._focusTrap.focusInitialElementWhenReady();
- }
- else {
- /** @type {?} */
- var activeElement = this._document.activeElement;
- // Otherwise ensure that focus is on the dialog container. It's possible that a different
- // component tried to move focus while the open animation was running. See:
- // https://github.com/angular/components/issues/16215. Note that we only want to do this
- // if the focus isn't inside the dialog already, because it's possible that the consumer
- // turned off `autoFocus` in order to move focus themselves.
- if (activeElement !== element && !element.contains(activeElement)) {
- element.focus();
- }
- }
- };
- /** Restores focus to the element that was focused before the dialog opened. */
- /**
- * Restores focus to the element that was focused before the dialog opened.
- * @private
- * @return {?}
- */
- MatDialogContainer.prototype._restoreFocus = /**
- * Restores focus to the element that was focused before the dialog opened.
- * @private
- * @return {?}
- */
- function () {
- /** @type {?} */
- var toFocus = this._elementFocusedBeforeDialogWasOpened;
- // We need the extra check, because IE can set the `activeElement` to null in some cases.
- if (this._config.restoreFocus && toFocus && typeof toFocus.focus === 'function') {
- toFocus.focus();
- }
- if (this._focusTrap) {
- this._focusTrap.destroy();
- }
- };
- /** Saves a reference to the element that was focused before the dialog was opened. */
- /**
- * Saves a reference to the element that was focused before the dialog was opened.
- * @private
- * @return {?}
- */
- MatDialogContainer.prototype._savePreviouslyFocusedElement = /**
- * Saves a reference to the element that was focused before the dialog was opened.
- * @private
- * @return {?}
- */
- function () {
- var _this = this;
- if (this._document) {
- this._elementFocusedBeforeDialogWasOpened = (/** @type {?} */ (this._document.activeElement));
- // Note that there is no focus method when rendering on the server.
- if (this._elementRef.nativeElement.focus) {
- // Move focus onto the dialog immediately in order to prevent the user from accidentally
- // opening multiple dialogs at the same time. Needs to be async, because the element
- // may not be focusable immediately.
- Promise.resolve().then((/**
- * @return {?}
- */
- function () { return _this._elementRef.nativeElement.focus(); }));
- }
- }
- };
- /** Callback, invoked whenever an animation on the host completes. */
- /**
- * Callback, invoked whenever an animation on the host completes.
- * @param {?} event
- * @return {?}
- */
- MatDialogContainer.prototype._onAnimationDone = /**
- * Callback, invoked whenever an animation on the host completes.
- * @param {?} event
- * @return {?}
- */
- function (event) {
- if (event.toState === 'enter') {
- this._trapFocus();
- }
- else if (event.toState === 'exit') {
- this._restoreFocus();
- }
- this._animationStateChanged.emit(event);
- };
- /** Callback, invoked when an animation on the host starts. */
- /**
- * Callback, invoked when an animation on the host starts.
- * @param {?} event
- * @return {?}
- */
- MatDialogContainer.prototype._onAnimationStart = /**
- * Callback, invoked when an animation on the host starts.
- * @param {?} event
- * @return {?}
- */
- function (event) {
- this._animationStateChanged.emit(event);
- };
- /** Starts the dialog exit animation. */
- /**
- * Starts the dialog exit animation.
- * @return {?}
- */
- MatDialogContainer.prototype._startExitAnimation = /**
- * Starts the dialog exit animation.
- * @return {?}
- */
- function () {
- this._state = 'exit';
- // Mark the container for check so it can react if the
- // view container is using OnPush change detection.
- this._changeDetectorRef.markForCheck();
- };
- MatDialogContainer.decorators = [
- { type: core.Component, args: [{selector: 'mat-dialog-container',
- template: "<ng-template cdkPortalOutlet></ng-template>",
- 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}"],
- encapsulation: core.ViewEncapsulation.None,
- // Using OnPush for dialogs caused some G3 sync issues. Disabled until we can track them down.
- // tslint:disable-next-line:validate-decorators
- changeDetection: core.ChangeDetectionStrategy.Default,
- animations: [matDialogAnimations.dialogContainer],
- host: {
- 'class': 'mat-dialog-container',
- 'tabindex': '-1',
- 'aria-modal': 'true',
- '[attr.id]': '_id',
- '[attr.role]': '_config.role',
- '[attr.aria-labelledby]': '_config.ariaLabel ? null : _ariaLabelledBy',
- '[attr.aria-label]': '_config.ariaLabel',
- '[attr.aria-describedby]': '_config.ariaDescribedBy || null',
- '[@dialogContainer]': '_state',
- '(@dialogContainer.start)': '_onAnimationStart($event)',
- '(@dialogContainer.done)': '_onAnimationDone($event)',
- },
- },] },
- ];
- /** @nocollapse */
- MatDialogContainer.ctorParameters = function () { return [
- { type: core.ElementRef },
- { type: a11y.FocusTrapFactory },
- { type: core.ChangeDetectorRef },
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [common.DOCUMENT,] }] },
- { type: MatDialogConfig }
- ]; };
- MatDialogContainer.propDecorators = {
- _portalOutlet: [{ type: core.ViewChild, args: [portal.CdkPortalOutlet, { static: true },] }]
- };
- return MatDialogContainer;
- }(portal.BasePortalOutlet));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- // TODO(jelbourn): resizing
- // Counter for unique dialog ids.
- /** @type {?} */
- var uniqueId = 0;
- /**
- * Reference to a dialog opened via the MatDialog service.
- * @template T, R
- */
- var /**
- * Reference to a dialog opened via the MatDialog service.
- * @template T, R
- */
- MatDialogRef = /** @class */ (function () {
- function MatDialogRef(_overlayRef, _containerInstance,
- // @breaking-change 8.0.0 `_location` parameter to be removed.
- _location, id) {
- var _this = this;
- if (id === void 0) { id = "mat-dialog-" + uniqueId++; }
- this._overlayRef = _overlayRef;
- this._containerInstance = _containerInstance;
- this.id = id;
- /**
- * Whether the user is allowed to close the dialog.
- */
- this.disableClose = this._containerInstance._config.disableClose;
- /**
- * Subject for notifying the user that the dialog has finished opening.
- */
- this._afterOpened = new rxjs.Subject();
- /**
- * Subject for notifying the user that the dialog has finished closing.
- */
- this._afterClosed = new rxjs.Subject();
- /**
- * Subject for notifying the user that the dialog has started closing.
- */
- this._beforeClosed = new rxjs.Subject();
- // Pass the id along to the container.
- _containerInstance._id = id;
- // Emit when opening animation completes
- _containerInstance._animationStateChanged.pipe(operators.filter((/**
- * @param {?} event
- * @return {?}
- */
- function (event) { return event.phaseName === 'done' && event.toState === 'enter'; })), operators.take(1))
- .subscribe((/**
- * @return {?}
- */
- function () {
- _this._afterOpened.next();
- _this._afterOpened.complete();
- }));
- // Dispose overlay when closing animation is complete
- _containerInstance._animationStateChanged.pipe(operators.filter((/**
- * @param {?} event
- * @return {?}
- */
- function (event) { return event.phaseName === 'done' && event.toState === 'exit'; })), operators.take(1)).subscribe((/**
- * @return {?}
- */
- function () {
- clearTimeout(_this._closeFallbackTimeout);
- _this._overlayRef.dispose();
- }));
- _overlayRef.detachments().subscribe((/**
- * @return {?}
- */
- function () {
- _this._beforeClosed.next(_this._result);
- _this._beforeClosed.complete();
- _this._afterClosed.next(_this._result);
- _this._afterClosed.complete();
- _this.componentInstance = (/** @type {?} */ (null));
- _this._overlayRef.dispose();
- }));
- _overlayRef.keydownEvents()
- .pipe(operators.filter((/**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- return event.keyCode === keycodes.ESCAPE && !_this.disableClose && !keycodes.hasModifierKey(event);
- })))
- .subscribe((/**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- event.preventDefault();
- _this.close();
- }));
- }
- /**
- * Close the dialog.
- * @param dialogResult Optional result to return to the dialog opener.
- */
- /**
- * Close the dialog.
- * @param {?=} dialogResult Optional result to return to the dialog opener.
- * @return {?}
- */
- MatDialogRef.prototype.close = /**
- * Close the dialog.
- * @param {?=} dialogResult Optional result to return to the dialog opener.
- * @return {?}
- */
- function (dialogResult) {
- var _this = this;
- this._result = dialogResult;
- // Transition the backdrop in parallel to the dialog.
- this._containerInstance._animationStateChanged.pipe(operators.filter((/**
- * @param {?} event
- * @return {?}
- */
- function (event) { return event.phaseName === 'start'; })), operators.take(1))
- .subscribe((/**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- _this._beforeClosed.next(dialogResult);
- _this._beforeClosed.complete();
- _this._overlayRef.detachBackdrop();
- // The logic that disposes of the overlay depends on the exit animation completing, however
- // it isn't guaranteed if the parent view is destroyed while it's running. Add a fallback
- // timeout which will clean everything up if the animation hasn't fired within the specified
- // amount of time plus 100ms. We don't need to run this outside the NgZone, because for the
- // vast majority of cases the timeout will have been cleared before it has the chance to fire.
- _this._closeFallbackTimeout = setTimeout((/**
- * @return {?}
- */
- function () {
- _this._overlayRef.dispose();
- }), event.totalTime + 100);
- }));
- this._containerInstance._startExitAnimation();
- };
- /**
- * Gets an observable that is notified when the dialog is finished opening.
- */
- /**
- * Gets an observable that is notified when the dialog is finished opening.
- * @return {?}
- */
- MatDialogRef.prototype.afterOpened = /**
- * Gets an observable that is notified when the dialog is finished opening.
- * @return {?}
- */
- function () {
- return this._afterOpened.asObservable();
- };
- /**
- * Gets an observable that is notified when the dialog is finished closing.
- */
- /**
- * Gets an observable that is notified when the dialog is finished closing.
- * @return {?}
- */
- MatDialogRef.prototype.afterClosed = /**
- * Gets an observable that is notified when the dialog is finished closing.
- * @return {?}
- */
- function () {
- return this._afterClosed.asObservable();
- };
- /**
- * Gets an observable that is notified when the dialog has started closing.
- */
- /**
- * Gets an observable that is notified when the dialog has started closing.
- * @return {?}
- */
- MatDialogRef.prototype.beforeClosed = /**
- * Gets an observable that is notified when the dialog has started closing.
- * @return {?}
- */
- function () {
- return this._beforeClosed.asObservable();
- };
- /**
- * Gets an observable that emits when the overlay's backdrop has been clicked.
- */
- /**
- * Gets an observable that emits when the overlay's backdrop has been clicked.
- * @return {?}
- */
- MatDialogRef.prototype.backdropClick = /**
- * Gets an observable that emits when the overlay's backdrop has been clicked.
- * @return {?}
- */
- function () {
- return this._overlayRef.backdropClick();
- };
- /**
- * Gets an observable that emits when keydown events are targeted on the overlay.
- */
- /**
- * Gets an observable that emits when keydown events are targeted on the overlay.
- * @return {?}
- */
- MatDialogRef.prototype.keydownEvents = /**
- * Gets an observable that emits when keydown events are targeted on the overlay.
- * @return {?}
- */
- function () {
- return this._overlayRef.keydownEvents();
- };
- /**
- * Updates the dialog's position.
- * @param position New dialog position.
- */
- /**
- * Updates the dialog's position.
- * @template THIS
- * @this {THIS}
- * @param {?=} position New dialog position.
- * @return {THIS}
- */
- MatDialogRef.prototype.updatePosition = /**
- * Updates the dialog's position.
- * @template THIS
- * @this {THIS}
- * @param {?=} position New dialog position.
- * @return {THIS}
- */
- function (position) {
- /** @type {?} */
- var strategy = (/** @type {?} */ (this))._getPositionStrategy();
- if (position && (position.left || position.right)) {
- position.left ? strategy.left(position.left) : strategy.right(position.right);
- }
- else {
- strategy.centerHorizontally();
- }
- if (position && (position.top || position.bottom)) {
- position.top ? strategy.top(position.top) : strategy.bottom(position.bottom);
- }
- else {
- strategy.centerVertically();
- }
- (/** @type {?} */ (this))._overlayRef.updatePosition();
- return (/** @type {?} */ (this));
- };
- /**
- * Updates the dialog's width and height.
- * @param width New width of the dialog.
- * @param height New height of the dialog.
- */
- /**
- * Updates the dialog's width and height.
- * @template THIS
- * @this {THIS}
- * @param {?=} width New width of the dialog.
- * @param {?=} height New height of the dialog.
- * @return {THIS}
- */
- MatDialogRef.prototype.updateSize = /**
- * Updates the dialog's width and height.
- * @template THIS
- * @this {THIS}
- * @param {?=} width New width of the dialog.
- * @param {?=} height New height of the dialog.
- * @return {THIS}
- */
- function (width, height) {
- if (width === void 0) { width = ''; }
- if (height === void 0) { height = ''; }
- (/** @type {?} */ (this))._getPositionStrategy().width(width).height(height);
- (/** @type {?} */ (this))._overlayRef.updatePosition();
- return (/** @type {?} */ (this));
- };
- /** Add a CSS class or an array of classes to the overlay pane. */
- /**
- * Add a CSS class or an array of classes to the overlay pane.
- * @template THIS
- * @this {THIS}
- * @param {?} classes
- * @return {THIS}
- */
- MatDialogRef.prototype.addPanelClass = /**
- * Add a CSS class or an array of classes to the overlay pane.
- * @template THIS
- * @this {THIS}
- * @param {?} classes
- * @return {THIS}
- */
- function (classes) {
- (/** @type {?} */ (this))._overlayRef.addPanelClass(classes);
- return (/** @type {?} */ (this));
- };
- /** Remove a CSS class or an array of classes from the overlay pane. */
- /**
- * Remove a CSS class or an array of classes from the overlay pane.
- * @template THIS
- * @this {THIS}
- * @param {?} classes
- * @return {THIS}
- */
- MatDialogRef.prototype.removePanelClass = /**
- * Remove a CSS class or an array of classes from the overlay pane.
- * @template THIS
- * @this {THIS}
- * @param {?} classes
- * @return {THIS}
- */
- function (classes) {
- (/** @type {?} */ (this))._overlayRef.removePanelClass(classes);
- return (/** @type {?} */ (this));
- };
- /**
- * Gets an observable that is notified when the dialog is finished opening.
- * @deprecated Use `afterOpened` instead.
- * @breaking-change 8.0.0
- */
- /**
- * Gets an observable that is notified when the dialog is finished opening.
- * @deprecated Use `afterOpened` instead.
- * \@breaking-change 8.0.0
- * @return {?}
- */
- MatDialogRef.prototype.afterOpen = /**
- * Gets an observable that is notified when the dialog is finished opening.
- * @deprecated Use `afterOpened` instead.
- * \@breaking-change 8.0.0
- * @return {?}
- */
- function () {
- return this.afterOpened();
- };
- /**
- * Gets an observable that is notified when the dialog has started closing.
- * @deprecated Use `beforeClosed` instead.
- * @breaking-change 8.0.0
- */
- /**
- * Gets an observable that is notified when the dialog has started closing.
- * @deprecated Use `beforeClosed` instead.
- * \@breaking-change 8.0.0
- * @return {?}
- */
- MatDialogRef.prototype.beforeClose = /**
- * Gets an observable that is notified when the dialog has started closing.
- * @deprecated Use `beforeClosed` instead.
- * \@breaking-change 8.0.0
- * @return {?}
- */
- function () {
- return this.beforeClosed();
- };
- /** Fetches the position strategy object from the overlay ref. */
- /**
- * Fetches the position strategy object from the overlay ref.
- * @private
- * @return {?}
- */
- MatDialogRef.prototype._getPositionStrategy = /**
- * Fetches the position strategy object from the overlay ref.
- * @private
- * @return {?}
- */
- function () {
- return (/** @type {?} */ (this._overlayRef.getConfig().positionStrategy));
- };
- return MatDialogRef;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Injection token that can be used to access the data that was passed in to a dialog.
- * @type {?}
- */
- var MAT_DIALOG_DATA = new core.InjectionToken('MatDialogData');
- /**
- * Injection token that can be used to specify default dialog options.
- * @type {?}
- */
- var MAT_DIALOG_DEFAULT_OPTIONS = new core.InjectionToken('mat-dialog-default-options');
- /**
- * Injection token that determines the scroll handling while the dialog is open.
- * @type {?}
- */
- var MAT_DIALOG_SCROLL_STRATEGY = new core.InjectionToken('mat-dialog-scroll-strategy');
- /**
- * \@docs-private
- * @param {?} overlay
- * @return {?}
- */
- function MAT_DIALOG_SCROLL_STRATEGY_FACTORY(overlay$$1) {
- return (/**
- * @return {?}
- */
- function () { return overlay$$1.scrollStrategies.block(); });
- }
- /**
- * \@docs-private
- * @param {?} overlay
- * @return {?}
- */
- function MAT_DIALOG_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay$$1) {
- return (/**
- * @return {?}
- */
- function () { return overlay$$1.scrollStrategies.block(); });
- }
- /**
- * \@docs-private
- * @type {?}
- */
- var MAT_DIALOG_SCROLL_STRATEGY_PROVIDER = {
- provide: MAT_DIALOG_SCROLL_STRATEGY,
- deps: [overlay.Overlay],
- useFactory: MAT_DIALOG_SCROLL_STRATEGY_PROVIDER_FACTORY,
- };
- /**
- * Service to open Material Design modal dialogs.
- */
- var MatDialog = /** @class */ (function () {
- function MatDialog(_overlay, _injector, _location, _defaultOptions, scrollStrategy, _parentDialog, _overlayContainer) {
- var _this = this;
- this._overlay = _overlay;
- this._injector = _injector;
- this._location = _location;
- this._defaultOptions = _defaultOptions;
- this._parentDialog = _parentDialog;
- this._overlayContainer = _overlayContainer;
- this._openDialogsAtThisLevel = [];
- this._afterAllClosedAtThisLevel = new rxjs.Subject();
- this._afterOpenedAtThisLevel = new rxjs.Subject();
- this._ariaHiddenElements = new Map();
- // TODO (jelbourn): tighten the typing right-hand side of this expression.
- /**
- * Stream that emits when all open dialog have finished closing.
- * Will emit on subscribe if there are no open dialogs to begin with.
- */
- this.afterAllClosed = (/** @type {?} */ (rxjs.defer((/**
- * @return {?}
- */
- function () { return _this.openDialogs.length ?
- _this._afterAllClosed :
- _this._afterAllClosed.pipe(operators.startWith(undefined)); }))));
- this._scrollStrategy = scrollStrategy;
- }
- Object.defineProperty(MatDialog.prototype, "openDialogs", {
- /** Keeps track of the currently-open dialogs. */
- get: /**
- * Keeps track of the currently-open dialogs.
- * @return {?}
- */
- function () {
- return this._parentDialog ? this._parentDialog.openDialogs : this._openDialogsAtThisLevel;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatDialog.prototype, "afterOpened", {
- /** Stream that emits when a dialog has been opened. */
- get: /**
- * Stream that emits when a dialog has been opened.
- * @return {?}
- */
- function () {
- return this._parentDialog ? this._parentDialog.afterOpened : this._afterOpenedAtThisLevel;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatDialog.prototype, "afterOpen", {
- /**
- * Stream that emits when a dialog has been opened.
- * @deprecated Use `afterOpened` instead.
- * @breaking-change 8.0.0
- */
- get: /**
- * Stream that emits when a dialog has been opened.
- * @deprecated Use `afterOpened` instead.
- * \@breaking-change 8.0.0
- * @return {?}
- */
- function () {
- return this.afterOpened;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatDialog.prototype, "_afterAllClosed", {
- get: /**
- * @return {?}
- */
- function () {
- /** @type {?} */
- var parent = this._parentDialog;
- return parent ? parent._afterAllClosed : this._afterAllClosedAtThisLevel;
- },
- enumerable: true,
- configurable: true
- });
- /**
- * Opens a modal dialog containing the given component.
- * @param componentOrTemplateRef Type of the component to load into the dialog,
- * or a TemplateRef to instantiate as the dialog content.
- * @param config Extra configuration options.
- * @returns Reference to the newly-opened dialog.
- */
- /**
- * Opens a modal dialog containing the given component.
- * @template T, D, R
- * @param {?} componentOrTemplateRef Type of the component to load into the dialog,
- * or a TemplateRef to instantiate as the dialog content.
- * @param {?=} config Extra configuration options.
- * @return {?} Reference to the newly-opened dialog.
- */
- MatDialog.prototype.open = /**
- * Opens a modal dialog containing the given component.
- * @template T, D, R
- * @param {?} componentOrTemplateRef Type of the component to load into the dialog,
- * or a TemplateRef to instantiate as the dialog content.
- * @param {?=} config Extra configuration options.
- * @return {?} Reference to the newly-opened dialog.
- */
- function (componentOrTemplateRef, config) {
- var _this = this;
- config = _applyConfigDefaults$1(config, this._defaultOptions || new MatDialogConfig());
- if (config.id && this.getDialogById(config.id)) {
- throw Error("Dialog with id \"" + config.id + "\" exists already. The dialog id must be unique.");
- }
- /** @type {?} */
- var overlayRef = this._createOverlay(config);
- /** @type {?} */
- var dialogContainer = this._attachDialogContainer(overlayRef, config);
- /** @type {?} */
- var dialogRef = this._attachDialogContent(componentOrTemplateRef, dialogContainer, overlayRef, config);
- // If this is the first dialog that we're opening, hide all the non-overlay content.
- if (!this.openDialogs.length) {
- this._hideNonDialogContentFromAssistiveTechnology();
- }
- this.openDialogs.push(dialogRef);
- dialogRef.afterClosed().subscribe((/**
- * @return {?}
- */
- function () { return _this._removeOpenDialog(dialogRef); }));
- this.afterOpened.next(dialogRef);
- return dialogRef;
- };
- /**
- * Closes all of the currently-open dialogs.
- */
- /**
- * Closes all of the currently-open dialogs.
- * @return {?}
- */
- MatDialog.prototype.closeAll = /**
- * Closes all of the currently-open dialogs.
- * @return {?}
- */
- function () {
- this._closeDialogs(this.openDialogs);
- };
- /**
- * Finds an open dialog by its id.
- * @param id ID to use when looking up the dialog.
- */
- /**
- * Finds an open dialog by its id.
- * @param {?} id ID to use when looking up the dialog.
- * @return {?}
- */
- MatDialog.prototype.getDialogById = /**
- * Finds an open dialog by its id.
- * @param {?} id ID to use when looking up the dialog.
- * @return {?}
- */
- function (id) {
- return this.openDialogs.find((/**
- * @param {?} dialog
- * @return {?}
- */
- function (dialog) { return dialog.id === id; }));
- };
- /**
- * @return {?}
- */
- MatDialog.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- // Only close the dialogs at this level on destroy
- // since the parent service may still be active.
- this._closeDialogs(this._openDialogsAtThisLevel);
- this._afterAllClosedAtThisLevel.complete();
- this._afterOpenedAtThisLevel.complete();
- };
- /**
- * Creates the overlay into which the dialog will be loaded.
- * @param config The dialog configuration.
- * @returns A promise resolving to the OverlayRef for the created overlay.
- */
- /**
- * Creates the overlay into which the dialog will be loaded.
- * @private
- * @param {?} config The dialog configuration.
- * @return {?} A promise resolving to the OverlayRef for the created overlay.
- */
- MatDialog.prototype._createOverlay = /**
- * Creates the overlay into which the dialog will be loaded.
- * @private
- * @param {?} config The dialog configuration.
- * @return {?} A promise resolving to the OverlayRef for the created overlay.
- */
- function (config) {
- /** @type {?} */
- var overlayConfig = this._getOverlayConfig(config);
- return this._overlay.create(overlayConfig);
- };
- /**
- * Creates an overlay config from a dialog config.
- * @param dialogConfig The dialog configuration.
- * @returns The overlay configuration.
- */
- /**
- * Creates an overlay config from a dialog config.
- * @private
- * @param {?} dialogConfig The dialog configuration.
- * @return {?} The overlay configuration.
- */
- MatDialog.prototype._getOverlayConfig = /**
- * Creates an overlay config from a dialog config.
- * @private
- * @param {?} dialogConfig The dialog configuration.
- * @return {?} The overlay configuration.
- */
- function (dialogConfig) {
- /** @type {?} */
- var state$$1 = new overlay.OverlayConfig({
- positionStrategy: this._overlay.position().global(),
- scrollStrategy: dialogConfig.scrollStrategy || this._scrollStrategy(),
- panelClass: dialogConfig.panelClass,
- hasBackdrop: dialogConfig.hasBackdrop,
- direction: dialogConfig.direction,
- minWidth: dialogConfig.minWidth,
- minHeight: dialogConfig.minHeight,
- maxWidth: dialogConfig.maxWidth,
- maxHeight: dialogConfig.maxHeight,
- disposeOnNavigation: dialogConfig.closeOnNavigation
- });
- if (dialogConfig.backdropClass) {
- state$$1.backdropClass = dialogConfig.backdropClass;
- }
- return state$$1;
- };
- /**
- * Attaches an MatDialogContainer to a dialog's already-created overlay.
- * @param overlay Reference to the dialog's underlying overlay.
- * @param config The dialog configuration.
- * @returns A promise resolving to a ComponentRef for the attached container.
- */
- /**
- * Attaches an MatDialogContainer to a dialog's already-created overlay.
- * @private
- * @param {?} overlay Reference to the dialog's underlying overlay.
- * @param {?} config The dialog configuration.
- * @return {?} A promise resolving to a ComponentRef for the attached container.
- */
- MatDialog.prototype._attachDialogContainer = /**
- * Attaches an MatDialogContainer to a dialog's already-created overlay.
- * @private
- * @param {?} overlay Reference to the dialog's underlying overlay.
- * @param {?} config The dialog configuration.
- * @return {?} A promise resolving to a ComponentRef for the attached container.
- */
- function (overlay$$1, config) {
- /** @type {?} */
- var userInjector = config && config.viewContainerRef && config.viewContainerRef.injector;
- /** @type {?} */
- var injector = new portal.PortalInjector(userInjector || this._injector, new WeakMap([
- [MatDialogConfig, config]
- ]));
- /** @type {?} */
- var containerPortal = new portal.ComponentPortal(MatDialogContainer, config.viewContainerRef, injector);
- /** @type {?} */
- var containerRef = overlay$$1.attach(containerPortal);
- return containerRef.instance;
- };
- /**
- * Attaches the user-provided component to the already-created MatDialogContainer.
- * @param componentOrTemplateRef The type of component being loaded into the dialog,
- * or a TemplateRef to instantiate as the content.
- * @param dialogContainer Reference to the wrapping MatDialogContainer.
- * @param overlayRef Reference to the overlay in which the dialog resides.
- * @param config The dialog configuration.
- * @returns A promise resolving to the MatDialogRef that should be returned to the user.
- */
- /**
- * Attaches the user-provided component to the already-created MatDialogContainer.
- * @private
- * @template T, R
- * @param {?} componentOrTemplateRef The type of component being loaded into the dialog,
- * or a TemplateRef to instantiate as the content.
- * @param {?} dialogContainer Reference to the wrapping MatDialogContainer.
- * @param {?} overlayRef Reference to the overlay in which the dialog resides.
- * @param {?} config The dialog configuration.
- * @return {?} A promise resolving to the MatDialogRef that should be returned to the user.
- */
- MatDialog.prototype._attachDialogContent = /**
- * Attaches the user-provided component to the already-created MatDialogContainer.
- * @private
- * @template T, R
- * @param {?} componentOrTemplateRef The type of component being loaded into the dialog,
- * or a TemplateRef to instantiate as the content.
- * @param {?} dialogContainer Reference to the wrapping MatDialogContainer.
- * @param {?} overlayRef Reference to the overlay in which the dialog resides.
- * @param {?} config The dialog configuration.
- * @return {?} A promise resolving to the MatDialogRef that should be returned to the user.
- */
- function (componentOrTemplateRef, dialogContainer, overlayRef, config) {
- // Create a reference to the dialog we're creating in order to give the user a handle
- // to modify and close it.
- /** @type {?} */
- var dialogRef = new MatDialogRef(overlayRef, dialogContainer, this._location, config.id);
- // When the dialog backdrop is clicked, we want to close it.
- if (config.hasBackdrop) {
- overlayRef.backdropClick().subscribe((/**
- * @return {?}
- */
- function () {
- if (!dialogRef.disableClose) {
- dialogRef.close();
- }
- }));
- }
- if (componentOrTemplateRef instanceof core.TemplateRef) {
- dialogContainer.attachTemplatePortal(new portal.TemplatePortal(componentOrTemplateRef, (/** @type {?} */ (null)), (/** @type {?} */ ({ $implicit: config.data, dialogRef: dialogRef }))));
- }
- else {
- /** @type {?} */
- var injector = this._createInjector(config, dialogRef, dialogContainer);
- /** @type {?} */
- var contentRef = dialogContainer.attachComponentPortal(new portal.ComponentPortal(componentOrTemplateRef, undefined, injector));
- dialogRef.componentInstance = contentRef.instance;
- }
- dialogRef
- .updateSize(config.width, config.height)
- .updatePosition(config.position);
- return dialogRef;
- };
- /**
- * Creates a custom injector to be used inside the dialog. This allows a component loaded inside
- * of a dialog to close itself and, optionally, to return a value.
- * @param config Config object that is used to construct the dialog.
- * @param dialogRef Reference to the dialog.
- * @param container Dialog container element that wraps all of the contents.
- * @returns The custom injector that can be used inside the dialog.
- */
- /**
- * Creates a custom injector to be used inside the dialog. This allows a component loaded inside
- * of a dialog to close itself and, optionally, to return a value.
- * @private
- * @template T
- * @param {?} config Config object that is used to construct the dialog.
- * @param {?} dialogRef Reference to the dialog.
- * @param {?} dialogContainer
- * @return {?} The custom injector that can be used inside the dialog.
- */
- MatDialog.prototype._createInjector = /**
- * Creates a custom injector to be used inside the dialog. This allows a component loaded inside
- * of a dialog to close itself and, optionally, to return a value.
- * @private
- * @template T
- * @param {?} config Config object that is used to construct the dialog.
- * @param {?} dialogRef Reference to the dialog.
- * @param {?} dialogContainer
- * @return {?} The custom injector that can be used inside the dialog.
- */
- function (config, dialogRef, dialogContainer) {
- /** @type {?} */
- var userInjector = config && config.viewContainerRef && config.viewContainerRef.injector;
- // The MatDialogContainer is injected in the portal as the MatDialogContainer and the dialog's
- // content are created out of the same ViewContainerRef and as such, are siblings for injector
- // purposes. To allow the hierarchy that is expected, the MatDialogContainer is explicitly
- // added to the injection tokens.
- /** @type {?} */
- var injectionTokens = new WeakMap([
- [MatDialogContainer, dialogContainer],
- [MAT_DIALOG_DATA, config.data],
- [MatDialogRef, dialogRef]
- ]);
- if (config.direction &&
- (!userInjector || !userInjector.get(bidi.Directionality, null))) {
- injectionTokens.set(bidi.Directionality, {
- value: config.direction,
- change: rxjs.of()
- });
- }
- return new portal.PortalInjector(userInjector || this._injector, injectionTokens);
- };
- /**
- * Removes a dialog from the array of open dialogs.
- * @param dialogRef Dialog to be removed.
- */
- /**
- * Removes a dialog from the array of open dialogs.
- * @private
- * @param {?} dialogRef Dialog to be removed.
- * @return {?}
- */
- MatDialog.prototype._removeOpenDialog = /**
- * Removes a dialog from the array of open dialogs.
- * @private
- * @param {?} dialogRef Dialog to be removed.
- * @return {?}
- */
- function (dialogRef) {
- /** @type {?} */
- var index = this.openDialogs.indexOf(dialogRef);
- if (index > -1) {
- this.openDialogs.splice(index, 1);
- // If all the dialogs were closed, remove/restore the `aria-hidden`
- // to a the siblings and emit to the `afterAllClosed` stream.
- if (!this.openDialogs.length) {
- this._ariaHiddenElements.forEach((/**
- * @param {?} previousValue
- * @param {?} element
- * @return {?}
- */
- function (previousValue, element) {
- if (previousValue) {
- element.setAttribute('aria-hidden', previousValue);
- }
- else {
- element.removeAttribute('aria-hidden');
- }
- }));
- this._ariaHiddenElements.clear();
- this._afterAllClosed.next();
- }
- }
- };
- /**
- * Hides all of the content that isn't an overlay from assistive technology.
- */
- /**
- * Hides all of the content that isn't an overlay from assistive technology.
- * @private
- * @return {?}
- */
- MatDialog.prototype._hideNonDialogContentFromAssistiveTechnology = /**
- * Hides all of the content that isn't an overlay from assistive technology.
- * @private
- * @return {?}
- */
- function () {
- /** @type {?} */
- var overlayContainer = this._overlayContainer.getContainerElement();
- // Ensure that the overlay container is attached to the DOM.
- if (overlayContainer.parentElement) {
- /** @type {?} */
- var siblings = overlayContainer.parentElement.children;
- for (var i = siblings.length - 1; i > -1; i--) {
- /** @type {?} */
- var sibling = siblings[i];
- if (sibling !== overlayContainer &&
- sibling.nodeName !== 'SCRIPT' &&
- sibling.nodeName !== 'STYLE' &&
- !sibling.hasAttribute('aria-live')) {
- this._ariaHiddenElements.set(sibling, sibling.getAttribute('aria-hidden'));
- sibling.setAttribute('aria-hidden', 'true');
- }
- }
- }
- };
- /** Closes all of the dialogs in an array. */
- /**
- * Closes all of the dialogs in an array.
- * @private
- * @param {?} dialogs
- * @return {?}
- */
- MatDialog.prototype._closeDialogs = /**
- * Closes all of the dialogs in an array.
- * @private
- * @param {?} dialogs
- * @return {?}
- */
- function (dialogs) {
- /** @type {?} */
- var i = dialogs.length;
- while (i--) {
- // The `_openDialogs` property isn't updated after close until the rxjs subscription
- // runs on the next microtask, in addition to modifying the array as we're going
- // through it. We loop through all of them and call close without assuming that
- // they'll be removed from the list instantaneously.
- dialogs[i].close();
- }
- };
- MatDialog.decorators = [
- { type: core.Injectable },
- ];
- /** @nocollapse */
- MatDialog.ctorParameters = function () { return [
- { type: overlay.Overlay },
- { type: core.Injector },
- { type: common.Location, decorators: [{ type: core.Optional }] },
- { type: MatDialogConfig, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_DIALOG_DEFAULT_OPTIONS,] }] },
- { type: undefined, decorators: [{ type: core.Inject, args: [MAT_DIALOG_SCROLL_STRATEGY,] }] },
- { type: MatDialog, decorators: [{ type: core.Optional }, { type: core.SkipSelf }] },
- { type: overlay.OverlayContainer }
- ]; };
- return MatDialog;
- }());
- /**
- * Applies default options to the dialog config.
- * @param {?=} config Config to be modified.
- * @param {?=} defaultOptions Default options provided.
- * @return {?} The new configuration object.
- */
- function _applyConfigDefaults$1(config, defaultOptions) {
- return __assign({}, defaultOptions, config);
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Counter used to generate unique IDs for dialog elements.
- * @type {?}
- */
- var dialogElementUid = 0;
- /**
- * Button that will close the current dialog.
- */
- var MatDialogClose = /** @class */ (function () {
- function MatDialogClose(dialogRef, _elementRef, _dialog) {
- this.dialogRef = dialogRef;
- this._elementRef = _elementRef;
- this._dialog = _dialog;
- }
- /**
- * @return {?}
- */
- MatDialogClose.prototype.ngOnInit = /**
- * @return {?}
- */
- function () {
- if (!this.dialogRef) {
- // When this directive is included in a dialog via TemplateRef (rather than being
- // in a Component), the DialogRef isn't available via injection because embedded
- // views cannot be given a custom injector. Instead, we look up the DialogRef by
- // ID. This must occur in `onInit`, as the ID binding for the dialog container won't
- // be resolved at constructor time.
- this.dialogRef = (/** @type {?} */ (getClosestDialog(this._elementRef, this._dialog.openDialogs)));
- }
- };
- /**
- * @param {?} changes
- * @return {?}
- */
- MatDialogClose.prototype.ngOnChanges = /**
- * @param {?} changes
- * @return {?}
- */
- function (changes) {
- /** @type {?} */
- var proxiedChange = changes['_matDialogClose'] || changes['_matDialogCloseResult'];
- if (proxiedChange) {
- this.dialogResult = proxiedChange.currentValue;
- }
- };
- MatDialogClose.decorators = [
- { type: core.Directive, args: [{
- selector: '[mat-dialog-close], [matDialogClose]',
- exportAs: 'matDialogClose',
- host: {
- '(click)': 'dialogRef.close(dialogResult)',
- '[attr.aria-label]': 'ariaLabel || null',
- 'type': 'button',
- }
- },] },
- ];
- /** @nocollapse */
- MatDialogClose.ctorParameters = function () { return [
- { type: MatDialogRef, decorators: [{ type: core.Optional }] },
- { type: core.ElementRef },
- { type: MatDialog }
- ]; };
- MatDialogClose.propDecorators = {
- ariaLabel: [{ type: core.Input, args: ['aria-label',] }],
- dialogResult: [{ type: core.Input, args: ['mat-dialog-close',] }],
- _matDialogClose: [{ type: core.Input, args: ['matDialogClose',] }]
- };
- return MatDialogClose;
- }());
- /**
- * Title of a dialog element. Stays fixed to the top of the dialog when scrolling.
- */
- var MatDialogTitle = /** @class */ (function () {
- function MatDialogTitle(_dialogRef, _elementRef, _dialog) {
- this._dialogRef = _dialogRef;
- this._elementRef = _elementRef;
- this._dialog = _dialog;
- this.id = "mat-dialog-title-" + dialogElementUid++;
- }
- /**
- * @return {?}
- */
- MatDialogTitle.prototype.ngOnInit = /**
- * @return {?}
- */
- function () {
- var _this = this;
- if (!this._dialogRef) {
- this._dialogRef = (/** @type {?} */ (getClosestDialog(this._elementRef, this._dialog.openDialogs)));
- }
- if (this._dialogRef) {
- Promise.resolve().then((/**
- * @return {?}
- */
- function () {
- /** @type {?} */
- var container = _this._dialogRef._containerInstance;
- if (container && !container._ariaLabelledBy) {
- container._ariaLabelledBy = _this.id;
- }
- }));
- }
- };
- MatDialogTitle.decorators = [
- { type: core.Directive, args: [{
- selector: '[mat-dialog-title], [matDialogTitle]',
- exportAs: 'matDialogTitle',
- host: {
- 'class': 'mat-dialog-title',
- '[id]': 'id',
- },
- },] },
- ];
- /** @nocollapse */
- MatDialogTitle.ctorParameters = function () { return [
- { type: MatDialogRef, decorators: [{ type: core.Optional }] },
- { type: core.ElementRef },
- { type: MatDialog }
- ]; };
- MatDialogTitle.propDecorators = {
- id: [{ type: core.Input }]
- };
- return MatDialogTitle;
- }());
- /**
- * Scrollable content container of a dialog.
- */
- var MatDialogContent = /** @class */ (function () {
- function MatDialogContent() {
- }
- MatDialogContent.decorators = [
- { type: core.Directive, args: [{
- selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]",
- host: { 'class': 'mat-dialog-content' }
- },] },
- ];
- return MatDialogContent;
- }());
- /**
- * Container for the bottom action buttons in a dialog.
- * Stays fixed to the bottom when scrolling.
- */
- var MatDialogActions = /** @class */ (function () {
- function MatDialogActions() {
- }
- MatDialogActions.decorators = [
- { type: core.Directive, args: [{
- selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]",
- host: { 'class': 'mat-dialog-actions' }
- },] },
- ];
- return MatDialogActions;
- }());
- /**
- * Finds the closest MatDialogRef to an element by looking at the DOM.
- * @param {?} element Element relative to which to look for a dialog.
- * @param {?} openDialogs References to the currently-open dialogs.
- * @return {?}
- */
- function getClosestDialog(element, openDialogs) {
- /** @type {?} */
- var parent = element.nativeElement.parentElement;
- while (parent && !parent.classList.contains('mat-dialog-container')) {
- parent = parent.parentElement;
- }
- return parent ? openDialogs.find((/**
- * @param {?} dialog
- * @return {?}
- */
- function (dialog) { return dialog.id === (/** @type {?} */ (parent)).id; })) : null;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var MatDialogModule = /** @class */ (function () {
- function MatDialogModule() {
- }
- MatDialogModule.decorators = [
- { type: core.NgModule, args: [{
- imports: [
- common.CommonModule,
- overlay.OverlayModule,
- portal.PortalModule,
- MatCommonModule,
- ],
- exports: [
- MatDialogContainer,
- MatDialogClose,
- MatDialogTitle,
- MatDialogContent,
- MatDialogActions,
- MatCommonModule,
- ],
- declarations: [
- MatDialogContainer,
- MatDialogClose,
- MatDialogTitle,
- MatDialogActions,
- MatDialogContent,
- ],
- providers: [
- MatDialog,
- MAT_DIALOG_SCROLL_STRATEGY_PROVIDER,
- ],
- entryComponents: [MatDialogContainer],
- },] },
- ];
- return MatDialogModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Directive to automatically resize a textarea to fit its content.
- * @deprecated Use `cdkTextareaAutosize` from `\@angular/cdk/text-field` instead.
- * \@breaking-change 8.0.0
- */
- var MatTextareaAutosize = /** @class */ (function (_super) {
- __extends(MatTextareaAutosize, _super);
- function MatTextareaAutosize() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- Object.defineProperty(MatTextareaAutosize.prototype, "matAutosizeMinRows", {
- get: /**
- * @return {?}
- */
- function () { return this.minRows; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) { this.minRows = value; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatTextareaAutosize.prototype, "matAutosizeMaxRows", {
- get: /**
- * @return {?}
- */
- function () { return this.maxRows; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) { this.maxRows = value; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatTextareaAutosize.prototype, "matAutosize", {
- get: /**
- * @return {?}
- */
- function () { return this.enabled; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) { this.enabled = value; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatTextareaAutosize.prototype, "matTextareaAutosize", {
- get: /**
- * @return {?}
- */
- function () { return this.enabled; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) { this.enabled = value; },
- enumerable: true,
- configurable: true
- });
- MatTextareaAutosize.decorators = [
- { type: core.Directive, args: [{
- selector: 'textarea[mat-autosize], textarea[matTextareaAutosize]',
- exportAs: 'matTextareaAutosize',
- inputs: ['cdkAutosizeMinRows', 'cdkAutosizeMaxRows'],
- host: {
- 'class': 'cdk-textarea-autosize mat-autosize',
- // Textarea elements that have the directive applied should have a single row by default.
- // Browsers normally show two rows by default and therefore this limits the minRows binding.
- 'rows': '1',
- '(input)': '_noopInputHandler()',
- },
- },] },
- ];
- MatTextareaAutosize.propDecorators = {
- matAutosizeMinRows: [{ type: core.Input }],
- matAutosizeMaxRows: [{ type: core.Input }],
- matAutosize: [{ type: core.Input, args: ['mat-autosize',] }],
- matTextareaAutosize: [{ type: core.Input }]
- };
- return MatTextareaAutosize;
- }(textField.CdkTextareaAutosize));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * \@docs-private
- * @param {?} type
- * @return {?}
- */
- function getMatInputUnsupportedTypeError(type) {
- return Error("Input type \"" + type + "\" isn't supported by matInput.");
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * This token is used to inject the object whose value should be set into `MatInput`. If none is
- * provided, the native `HTMLInputElement` is used. Directives like `MatDatepickerInput` can provide
- * themselves for this token, in order to make `MatInput` delegate the getting and setting of the
- * value to them.
- * @type {?}
- */
- var MAT_INPUT_VALUE_ACCESSOR = new core.InjectionToken('MAT_INPUT_VALUE_ACCESSOR');
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- // Invalid input type. Using one of these will throw an MatInputUnsupportedTypeError.
- /** @type {?} */
- var MAT_INPUT_INVALID_TYPES = [
- 'button',
- 'checkbox',
- 'file',
- 'hidden',
- 'image',
- 'radio',
- 'range',
- 'reset',
- 'submit'
- ];
- /** @type {?} */
- var nextUniqueId$5 = 0;
- // Boilerplate for applying mixins to MatInput.
- /**
- * \@docs-private
- */
- var
- // Boilerplate for applying mixins to MatInput.
- /**
- * \@docs-private
- */
- MatInputBase = /** @class */ (function () {
- function MatInputBase(_defaultErrorStateMatcher, _parentForm, _parentFormGroup, ngControl) {
- this._defaultErrorStateMatcher = _defaultErrorStateMatcher;
- this._parentForm = _parentForm;
- this._parentFormGroup = _parentFormGroup;
- this.ngControl = ngControl;
- }
- return MatInputBase;
- }());
- /** @type {?} */
- var _MatInputMixinBase = mixinErrorState(MatInputBase);
- /**
- * Directive that allows a native input to work inside a `MatFormField`.
- */
- var MatInput = /** @class */ (function (_super) {
- __extends(MatInput, _super);
- function MatInput(_elementRef, _platform, ngControl, _parentForm, _parentFormGroup, _defaultErrorStateMatcher, inputValueAccessor, _autofillMonitor, ngZone) {
- var _this = _super.call(this, _defaultErrorStateMatcher, _parentForm, _parentFormGroup, ngControl) || this;
- _this._elementRef = _elementRef;
- _this._platform = _platform;
- _this.ngControl = ngControl;
- _this._autofillMonitor = _autofillMonitor;
- _this._uid = "mat-input-" + nextUniqueId$5++;
- /**
- * Whether the component is being rendered on the server.
- */
- _this._isServer = false;
- /**
- * Whether the component is a native html select.
- */
- _this._isNativeSelect = false;
- /**
- * Implemented as part of MatFormFieldControl.
- * \@docs-private
- */
- _this.focused = false;
- /**
- * Implemented as part of MatFormFieldControl.
- * \@docs-private
- */
- _this.stateChanges = new rxjs.Subject();
- /**
- * Implemented as part of MatFormFieldControl.
- * \@docs-private
- */
- _this.controlType = 'mat-input';
- /**
- * Implemented as part of MatFormFieldControl.
- * \@docs-private
- */
- _this.autofilled = false;
- _this._disabled = false;
- _this._required = false;
- _this._type = 'text';
- _this._readonly = false;
- _this._neverEmptyInputTypes = [
- 'date',
- 'datetime',
- 'datetime-local',
- 'month',
- 'time',
- 'week'
- ].filter((/**
- * @param {?} t
- * @return {?}
- */
- function (t) { return platform.getSupportedInputTypes().has(t); }));
- /** @type {?} */
- var element = _this._elementRef.nativeElement;
- // If no input value accessor was explicitly specified, use the element as the input value
- // accessor.
- _this._inputValueAccessor = inputValueAccessor || element;
- _this._previousNativeValue = _this.value;
- // Force setter to be called in case id was not specified.
- _this.id = _this.id;
- // On some versions of iOS the caret gets stuck in the wrong place when holding down the delete
- // key. In order to get around this we need to "jiggle" the caret loose. Since this bug only
- // exists on iOS, we only bother to install the listener on iOS.
- if (_platform.IOS) {
- ngZone.runOutsideAngular((/**
- * @return {?}
- */
- function () {
- _elementRef.nativeElement.addEventListener('keyup', (/**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- /** @type {?} */
- var el = (/** @type {?} */ (event.target));
- if (!el.value && !el.selectionStart && !el.selectionEnd) {
- // Note: Just setting `0, 0` doesn't fix the issue. Setting
- // `1, 1` fixes it for the first time that you type text and
- // then hold delete. Toggling to `1, 1` and then back to
- // `0, 0` seems to completely fix it.
- el.setSelectionRange(1, 1);
- el.setSelectionRange(0, 0);
- }
- }));
- }));
- }
- _this._isServer = !_this._platform.isBrowser;
- _this._isNativeSelect = element.nodeName.toLowerCase() === 'select';
- if (_this._isNativeSelect) {
- _this.controlType = ((/** @type {?} */ (element))).multiple ? 'mat-native-select-multiple' :
- 'mat-native-select';
- }
- return _this;
- }
- Object.defineProperty(MatInput.prototype, "disabled", {
- /**
- * Implemented as part of MatFormFieldControl.
- * @docs-private
- */
- get: /**
- * Implemented as part of MatFormFieldControl.
- * \@docs-private
- * @return {?}
- */
- function () {
- if (this.ngControl && this.ngControl.disabled !== null) {
- return this.ngControl.disabled;
- }
- return this._disabled;
- },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._disabled = coercion.coerceBooleanProperty(value);
- // Browsers may not fire the blur event if the input is disabled too quickly.
- // Reset from here to ensure that the element doesn't become stuck.
- if (this.focused) {
- this.focused = false;
- this.stateChanges.next();
- }
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatInput.prototype, "id", {
- /**
- * Implemented as part of MatFormFieldControl.
- * @docs-private
- */
- get: /**
- * Implemented as part of MatFormFieldControl.
- * \@docs-private
- * @return {?}
- */
- function () { return this._id; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) { this._id = value || this._uid; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatInput.prototype, "required", {
- /**
- * Implemented as part of MatFormFieldControl.
- * @docs-private
- */
- get: /**
- * Implemented as part of MatFormFieldControl.
- * \@docs-private
- * @return {?}
- */
- function () { return this._required; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) { this._required = coercion.coerceBooleanProperty(value); },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatInput.prototype, "type", {
- /** Input type of the element. */
- get: /**
- * Input type of the element.
- * @return {?}
- */
- function () { return this._type; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._type = value || 'text';
- this._validateType();
- // When using Angular inputs, developers are no longer able to set the properties on the native
- // input element. To ensure that bindings for `type` work, we need to sync the setter
- // with the native property. Textarea elements don't support the type property or attribute.
- if (!this._isTextarea() && platform.getSupportedInputTypes().has(this._type)) {
- ((/** @type {?} */ (this._elementRef.nativeElement))).type = this._type;
- }
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatInput.prototype, "value", {
- /**
- * Implemented as part of MatFormFieldControl.
- * @docs-private
- */
- get: /**
- * Implemented as part of MatFormFieldControl.
- * \@docs-private
- * @return {?}
- */
- function () { return this._inputValueAccessor.value; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- if (value !== this.value) {
- this._inputValueAccessor.value = value;
- this.stateChanges.next();
- }
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatInput.prototype, "readonly", {
- /** Whether the element is readonly. */
- get: /**
- * Whether the element is readonly.
- * @return {?}
- */
- function () { return this._readonly; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) { this._readonly = coercion.coerceBooleanProperty(value); },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- MatInput.prototype.ngOnInit = /**
- * @return {?}
- */
- function () {
- var _this = this;
- if (this._platform.isBrowser) {
- this._autofillMonitor.monitor(this._elementRef.nativeElement).subscribe((/**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- _this.autofilled = event.isAutofilled;
- _this.stateChanges.next();
- }));
- }
- };
- /**
- * @return {?}
- */
- MatInput.prototype.ngOnChanges = /**
- * @return {?}
- */
- function () {
- this.stateChanges.next();
- };
- /**
- * @return {?}
- */
- MatInput.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- this.stateChanges.complete();
- if (this._platform.isBrowser) {
- this._autofillMonitor.stopMonitoring(this._elementRef.nativeElement);
- }
- };
- /**
- * @return {?}
- */
- MatInput.prototype.ngDoCheck = /**
- * @return {?}
- */
- function () {
- if (this.ngControl) {
- // We need to re-evaluate this on every change detection cycle, because there are some
- // error triggers that we can't subscribe to (e.g. parent form submissions). This means
- // that whatever logic is in here has to be super lean or we risk destroying the performance.
- this.updateErrorState();
- }
- // We need to dirty-check the native element's value, because there are some cases where
- // we won't be notified when it changes (e.g. the consumer isn't using forms or they're
- // updating the value using `emitEvent: false`).
- this._dirtyCheckNativeValue();
- };
- /** Focuses the input. */
- /**
- * Focuses the input.
- * @param {?=} options
- * @return {?}
- */
- MatInput.prototype.focus = /**
- * Focuses the input.
- * @param {?=} options
- * @return {?}
- */
- function (options) {
- this._elementRef.nativeElement.focus(options);
- };
- /** Callback for the cases where the focused state of the input changes. */
- /**
- * Callback for the cases where the focused state of the input changes.
- * @param {?} isFocused
- * @return {?}
- */
- MatInput.prototype._focusChanged = /**
- * Callback for the cases where the focused state of the input changes.
- * @param {?} isFocused
- * @return {?}
- */
- function (isFocused) {
- if (isFocused !== this.focused && (!this.readonly || !isFocused)) {
- this.focused = isFocused;
- this.stateChanges.next();
- }
- };
- /**
- * @return {?}
- */
- MatInput.prototype._onInput = /**
- * @return {?}
- */
- function () {
- // This is a noop function and is used to let Angular know whenever the value changes.
- // Angular will run a new change detection each time the `input` event has been dispatched.
- // It's necessary that Angular recognizes the value change, because when floatingLabel
- // is set to false and Angular forms aren't used, the placeholder won't recognize the
- // value changes and will not disappear.
- // Listening to the input event wouldn't be necessary when the input is using the
- // FormsModule or ReactiveFormsModule, because Angular forms also listens to input events.
- };
- /** Does some manual dirty checking on the native input `value` property. */
- /**
- * Does some manual dirty checking on the native input `value` property.
- * @protected
- * @return {?}
- */
- MatInput.prototype._dirtyCheckNativeValue = /**
- * Does some manual dirty checking on the native input `value` property.
- * @protected
- * @return {?}
- */
- function () {
- /** @type {?} */
- var newValue = this._elementRef.nativeElement.value;
- if (this._previousNativeValue !== newValue) {
- this._previousNativeValue = newValue;
- this.stateChanges.next();
- }
- };
- /** Make sure the input is a supported type. */
- /**
- * Make sure the input is a supported type.
- * @protected
- * @return {?}
- */
- MatInput.prototype._validateType = /**
- * Make sure the input is a supported type.
- * @protected
- * @return {?}
- */
- function () {
- if (MAT_INPUT_INVALID_TYPES.indexOf(this._type) > -1) {
- throw getMatInputUnsupportedTypeError(this._type);
- }
- };
- /** Checks whether the input type is one of the types that are never empty. */
- /**
- * Checks whether the input type is one of the types that are never empty.
- * @protected
- * @return {?}
- */
- MatInput.prototype._isNeverEmpty = /**
- * Checks whether the input type is one of the types that are never empty.
- * @protected
- * @return {?}
- */
- function () {
- return this._neverEmptyInputTypes.indexOf(this._type) > -1;
- };
- /** Checks whether the input is invalid based on the native validation. */
- /**
- * Checks whether the input is invalid based on the native validation.
- * @protected
- * @return {?}
- */
- MatInput.prototype._isBadInput = /**
- * Checks whether the input is invalid based on the native validation.
- * @protected
- * @return {?}
- */
- function () {
- // The `validity` property won't be present on platform-server.
- /** @type {?} */
- var validity = ((/** @type {?} */ (this._elementRef.nativeElement))).validity;
- return validity && validity.badInput;
- };
- /** Determines if the component host is a textarea. */
- /**
- * Determines if the component host is a textarea.
- * @protected
- * @return {?}
- */
- MatInput.prototype._isTextarea = /**
- * Determines if the component host is a textarea.
- * @protected
- * @return {?}
- */
- function () {
- return this._elementRef.nativeElement.nodeName.toLowerCase() === 'textarea';
- };
- Object.defineProperty(MatInput.prototype, "empty", {
- /**
- * Implemented as part of MatFormFieldControl.
- * @docs-private
- */
- get: /**
- * Implemented as part of MatFormFieldControl.
- * \@docs-private
- * @return {?}
- */
- function () {
- return !this._isNeverEmpty() && !this._elementRef.nativeElement.value && !this._isBadInput() &&
- !this.autofilled;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatInput.prototype, "shouldLabelFloat", {
- /**
- * Implemented as part of MatFormFieldControl.
- * @docs-private
- */
- get: /**
- * Implemented as part of MatFormFieldControl.
- * \@docs-private
- * @return {?}
- */
- function () {
- if (this._isNativeSelect) {
- // For a single-selection `<select>`, the label should float when the selected option has
- // a non-empty display value. For a `<select multiple>`, the label *always* floats to avoid
- // overlapping the label with the options.
- /** @type {?} */
- var selectElement = (/** @type {?} */ (this._elementRef.nativeElement));
- /** @type {?} */
- var firstOption = selectElement.options[0];
- // On most browsers the `selectedIndex` will always be 0, however on IE and Edge it'll be
- // -1 if the `value` is set to something, that isn't in the list of options, at a later point.
- return this.focused || selectElement.multiple || !this.empty ||
- !!(selectElement.selectedIndex > -1 && firstOption && firstOption.label);
- }
- else {
- return this.focused || !this.empty;
- }
- },
- enumerable: true,
- configurable: true
- });
- /**
- * Implemented as part of MatFormFieldControl.
- * @docs-private
- */
- /**
- * Implemented as part of MatFormFieldControl.
- * \@docs-private
- * @param {?} ids
- * @return {?}
- */
- MatInput.prototype.setDescribedByIds = /**
- * Implemented as part of MatFormFieldControl.
- * \@docs-private
- * @param {?} ids
- * @return {?}
- */
- function (ids) {
- this._ariaDescribedby = ids.join(' ');
- };
- /**
- * Implemented as part of MatFormFieldControl.
- * @docs-private
- */
- /**
- * Implemented as part of MatFormFieldControl.
- * \@docs-private
- * @return {?}
- */
- MatInput.prototype.onContainerClick = /**
- * Implemented as part of MatFormFieldControl.
- * \@docs-private
- * @return {?}
- */
- function () {
- // Do not re-focus the input element if the element is already focused. Otherwise it can happen
- // that someone clicks on a time input and the cursor resets to the "hours" field while the
- // "minutes" field was actually clicked. See: https://github.com/angular/components/issues/12849
- if (!this.focused) {
- this.focus();
- }
- };
- MatInput.decorators = [
- { type: core.Directive, args: [{
- selector: "input[matInput], textarea[matInput], select[matNativeControl],\n input[matNativeControl], textarea[matNativeControl]",
- exportAs: 'matInput',
- host: {
- /**
- * \@breaking-change 8.0.0 remove .mat-form-field-autofill-control in favor of AutofillMonitor.
- */
- 'class': 'mat-input-element mat-form-field-autofill-control',
- '[class.mat-input-server]': '_isServer',
- // Native input properties that are overwritten by Angular inputs need to be synced with
- // the native input element. Otherwise property bindings for those don't work.
- '[attr.id]': 'id',
- '[attr.placeholder]': 'placeholder',
- '[disabled]': 'disabled',
- '[required]': 'required',
- '[attr.readonly]': 'readonly && !_isNativeSelect || null',
- '[attr.aria-describedby]': '_ariaDescribedby || null',
- '[attr.aria-invalid]': 'errorState',
- '[attr.aria-required]': 'required.toString()',
- '(blur)': '_focusChanged(false)',
- '(focus)': '_focusChanged(true)',
- '(input)': '_onInput()',
- },
- providers: [{ provide: MatFormFieldControl, useExisting: MatInput }],
- },] },
- ];
- /** @nocollapse */
- MatInput.ctorParameters = function () { return [
- { type: core.ElementRef },
- { type: platform.Platform },
- { type: forms.NgControl, decorators: [{ type: core.Optional }, { type: core.Self }] },
- { type: forms.NgForm, decorators: [{ type: core.Optional }] },
- { type: forms.FormGroupDirective, decorators: [{ type: core.Optional }] },
- { type: ErrorStateMatcher },
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Self }, { type: core.Inject, args: [MAT_INPUT_VALUE_ACCESSOR,] }] },
- { type: textField.AutofillMonitor },
- { type: core.NgZone }
- ]; };
- MatInput.propDecorators = {
- disabled: [{ type: core.Input }],
- id: [{ type: core.Input }],
- placeholder: [{ type: core.Input }],
- required: [{ type: core.Input }],
- type: [{ type: core.Input }],
- errorStateMatcher: [{ type: core.Input }],
- value: [{ type: core.Input }],
- readonly: [{ type: core.Input }]
- };
- return MatInput;
- }(_MatInputMixinBase));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var MatInputModule = /** @class */ (function () {
- function MatInputModule() {
- }
- MatInputModule.decorators = [
- { type: core.NgModule, args: [{
- declarations: [MatInput, MatTextareaAutosize],
- imports: [
- common.CommonModule,
- textField.TextFieldModule,
- MatFormFieldModule,
- ],
- exports: [
- textField.TextFieldModule,
- // We re-export the `MatFormFieldModule` since `MatInput` will almost always
- // be used together with `MatFormField`.
- MatFormFieldModule,
- MatInput,
- MatTextareaAutosize,
- ],
- providers: [ErrorStateMatcher],
- },] },
- ];
- return MatInputModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * \@docs-private
- * @param {?} provider
- * @return {?}
- */
- function createMissingDateImplError(provider) {
- return Error("MatDatepicker: No provider found for " + provider + ". You must import one of the following " +
- "modules at your application root: MatNativeDateModule, MatMomentDateModule, or provide a " +
- "custom implementation.");
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Datepicker data that requires internationalization.
- */
- var MatDatepickerIntl = /** @class */ (function () {
- function MatDatepickerIntl() {
- /**
- * Stream that emits whenever the labels here are changed. Use this to notify
- * components if the labels have changed after initialization.
- */
- this.changes = new rxjs.Subject();
- /**
- * A label for the calendar popup (used by screen readers).
- */
- this.calendarLabel = 'Calendar';
- /**
- * A label for the button used to open the calendar popup (used by screen readers).
- */
- this.openCalendarLabel = 'Open calendar';
- /**
- * A label for the previous month button (used by screen readers).
- */
- this.prevMonthLabel = 'Previous month';
- /**
- * A label for the next month button (used by screen readers).
- */
- this.nextMonthLabel = 'Next month';
- /**
- * A label for the previous year button (used by screen readers).
- */
- this.prevYearLabel = 'Previous year';
- /**
- * A label for the next year button (used by screen readers).
- */
- this.nextYearLabel = 'Next year';
- /**
- * A label for the previous multi-year button (used by screen readers).
- */
- this.prevMultiYearLabel = 'Previous 20 years';
- /**
- * A label for the next multi-year button (used by screen readers).
- */
- this.nextMultiYearLabel = 'Next 20 years';
- /**
- * A label for the 'switch to month view' button (used by screen readers).
- */
- this.switchToMonthViewLabel = 'Choose date';
- /**
- * A label for the 'switch to year view' button (used by screen readers).
- */
- this.switchToMultiYearViewLabel = 'Choose month and year';
- }
- MatDatepickerIntl.decorators = [
- { type: core.Injectable, args: [{ providedIn: 'root' },] },
- ];
- /** @nocollapse */ MatDatepickerIntl.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function MatDatepickerIntl_Factory() { return new MatDatepickerIntl(); }, token: MatDatepickerIntl, providedIn: "root" });
- return MatDatepickerIntl;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * An internal class that represents the data corresponding to a single calendar cell.
- * \@docs-private
- */
- var /**
- * An internal class that represents the data corresponding to a single calendar cell.
- * \@docs-private
- */
- MatCalendarCell = /** @class */ (function () {
- function MatCalendarCell(value, displayValue, ariaLabel, enabled, cssClasses) {
- this.value = value;
- this.displayValue = displayValue;
- this.ariaLabel = ariaLabel;
- this.enabled = enabled;
- this.cssClasses = cssClasses;
- }
- return MatCalendarCell;
- }());
- /**
- * An internal component used to display calendar data in a table.
- * \@docs-private
- */
- var MatCalendarBody = /** @class */ (function () {
- function MatCalendarBody(_elementRef, _ngZone) {
- this._elementRef = _elementRef;
- this._ngZone = _ngZone;
- /**
- * The number of columns in the table.
- */
- this.numCols = 7;
- /**
- * The cell number of the active cell in the table.
- */
- this.activeCell = 0;
- /**
- * The aspect ratio (width / height) to use for the cells in the table. This aspect ratio will be
- * maintained even as the table resizes.
- */
- this.cellAspectRatio = 1;
- /**
- * Emits when a new value is selected.
- */
- this.selectedValueChange = new core.EventEmitter();
- }
- /**
- * @param {?} cell
- * @return {?}
- */
- MatCalendarBody.prototype._cellClicked = /**
- * @param {?} cell
- * @return {?}
- */
- function (cell) {
- if (cell.enabled) {
- this.selectedValueChange.emit(cell.value);
- }
- };
- /**
- * @param {?} changes
- * @return {?}
- */
- MatCalendarBody.prototype.ngOnChanges = /**
- * @param {?} changes
- * @return {?}
- */
- function (changes) {
- /** @type {?} */
- var columnChanges = changes['numCols'];
- var _a = this, rows = _a.rows, numCols = _a.numCols;
- if (changes['rows'] || columnChanges) {
- this._firstRowOffset = rows && rows.length && rows[0].length ? numCols - rows[0].length : 0;
- }
- if (changes['cellAspectRatio'] || columnChanges || !this._cellPadding) {
- this._cellPadding = 50 * this.cellAspectRatio / numCols + "%";
- }
- if (columnChanges || !this._cellWidth) {
- this._cellWidth = 100 / numCols + "%";
- }
- };
- /**
- * @param {?} rowIndex
- * @param {?} colIndex
- * @return {?}
- */
- MatCalendarBody.prototype._isActiveCell = /**
- * @param {?} rowIndex
- * @param {?} colIndex
- * @return {?}
- */
- function (rowIndex, colIndex) {
- /** @type {?} */
- var cellNumber = rowIndex * this.numCols + colIndex;
- // Account for the fact that the first row may not have as many cells.
- if (rowIndex) {
- cellNumber -= this._firstRowOffset;
- }
- return cellNumber == this.activeCell;
- };
- /** Focuses the active cell after the microtask queue is empty. */
- /**
- * Focuses the active cell after the microtask queue is empty.
- * @return {?}
- */
- MatCalendarBody.prototype._focusActiveCell = /**
- * Focuses the active cell after the microtask queue is empty.
- * @return {?}
- */
- function () {
- var _this = this;
- this._ngZone.runOutsideAngular((/**
- * @return {?}
- */
- function () {
- _this._ngZone.onStable.asObservable().pipe(operators.take(1)).subscribe((/**
- * @return {?}
- */
- function () {
- /** @type {?} */
- var activeCell = _this._elementRef.nativeElement.querySelector('.mat-calendar-body-active');
- if (activeCell) {
- activeCell.focus();
- }
- }));
- }));
- };
- MatCalendarBody.decorators = [
- { type: core.Component, args: [{selector: '[mat-calendar-body]',
- 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>",
- 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}"],
- host: {
- 'class': 'mat-calendar-body',
- 'role': 'grid',
- 'aria-readonly': 'true'
- },
- exportAs: 'matCalendarBody',
- encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- },] },
- ];
- /** @nocollapse */
- MatCalendarBody.ctorParameters = function () { return [
- { type: core.ElementRef },
- { type: core.NgZone }
- ]; };
- MatCalendarBody.propDecorators = {
- label: [{ type: core.Input }],
- rows: [{ type: core.Input }],
- todayValue: [{ type: core.Input }],
- selectedValue: [{ type: core.Input }],
- labelMinRequiredCells: [{ type: core.Input }],
- numCols: [{ type: core.Input }],
- activeCell: [{ type: core.Input }],
- cellAspectRatio: [{ type: core.Input }],
- selectedValueChange: [{ type: core.Output }]
- };
- return MatCalendarBody;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /** @type {?} */
- var DAYS_PER_WEEK = 7;
- /**
- * An internal component used to display a single month in the datepicker.
- * \@docs-private
- * @template D
- */
- var MatMonthView = /** @class */ (function () {
- function MatMonthView(_changeDetectorRef, _dateFormats, _dateAdapter, _dir) {
- this._changeDetectorRef = _changeDetectorRef;
- this._dateFormats = _dateFormats;
- this._dateAdapter = _dateAdapter;
- this._dir = _dir;
- /**
- * Emits when a new date is selected.
- */
- this.selectedChange = new core.EventEmitter();
- /**
- * Emits when any date is selected.
- */
- this._userSelection = new core.EventEmitter();
- /**
- * Emits when any date is activated.
- */
- this.activeDateChange = new core.EventEmitter();
- if (!this._dateAdapter) {
- throw createMissingDateImplError('DateAdapter');
- }
- if (!this._dateFormats) {
- throw createMissingDateImplError('MAT_DATE_FORMATS');
- }
- this._activeDate = this._dateAdapter.today();
- }
- Object.defineProperty(MatMonthView.prototype, "activeDate", {
- /**
- * The date to display in this month view (everything other than the month and year is ignored).
- */
- get: /**
- * The date to display in this month view (everything other than the month and year is ignored).
- * @return {?}
- */
- function () { return this._activeDate; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- /** @type {?} */
- var oldActiveDate = this._activeDate;
- /** @type {?} */
- var validDate = this._getValidDateOrNull(this._dateAdapter.deserialize(value)) || this._dateAdapter.today();
- this._activeDate = this._dateAdapter.clampDate(validDate, this.minDate, this.maxDate);
- if (!this._hasSameMonthAndYear(oldActiveDate, this._activeDate)) {
- this._init();
- }
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatMonthView.prototype, "selected", {
- /** The currently selected date. */
- get: /**
- * The currently selected date.
- * @return {?}
- */
- function () { return this._selected; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._selected = this._getValidDateOrNull(this._dateAdapter.deserialize(value));
- this._selectedDate = this._getDateInCurrentMonth(this._selected);
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatMonthView.prototype, "minDate", {
- /** The minimum selectable date. */
- get: /**
- * The minimum selectable date.
- * @return {?}
- */
- function () { return this._minDate; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._minDate = this._getValidDateOrNull(this._dateAdapter.deserialize(value));
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatMonthView.prototype, "maxDate", {
- /** The maximum selectable date. */
- get: /**
- * The maximum selectable date.
- * @return {?}
- */
- function () { return this._maxDate; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._maxDate = this._getValidDateOrNull(this._dateAdapter.deserialize(value));
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- MatMonthView.prototype.ngAfterContentInit = /**
- * @return {?}
- */
- function () {
- this._init();
- };
- /** Handles when a new date is selected. */
- /**
- * Handles when a new date is selected.
- * @param {?} date
- * @return {?}
- */
- MatMonthView.prototype._dateSelected = /**
- * Handles when a new date is selected.
- * @param {?} date
- * @return {?}
- */
- function (date) {
- if (this._selectedDate != date) {
- /** @type {?} */
- var selectedYear = this._dateAdapter.getYear(this.activeDate);
- /** @type {?} */
- var selectedMonth = this._dateAdapter.getMonth(this.activeDate);
- /** @type {?} */
- var selectedDate = this._dateAdapter.createDate(selectedYear, selectedMonth, date);
- this.selectedChange.emit(selectedDate);
- }
- this._userSelection.emit();
- };
- /** Handles keydown events on the calendar body when calendar is in month view. */
- /**
- * Handles keydown events on the calendar body when calendar is in month view.
- * @param {?} event
- * @return {?}
- */
- MatMonthView.prototype._handleCalendarBodyKeydown = /**
- * Handles keydown events on the calendar body when calendar is in month view.
- * @param {?} event
- * @return {?}
- */
- function (event) {
- // TODO(mmalerba): We currently allow keyboard navigation to disabled dates, but just prevent
- // disabled ones from being selected. This may not be ideal, we should look into whether
- // navigation should skip over disabled dates, and if so, how to implement that efficiently.
- // TODO(mmalerba): We currently allow keyboard navigation to disabled dates, but just prevent
- // disabled ones from being selected. This may not be ideal, we should look into whether
- // navigation should skip over disabled dates, and if so, how to implement that efficiently.
- /** @type {?} */
- var oldActiveDate = this._activeDate;
- /** @type {?} */
- var isRtl = this._isRtl();
- switch (event.keyCode) {
- case keycodes.LEFT_ARROW:
- this.activeDate = this._dateAdapter.addCalendarDays(this._activeDate, isRtl ? 1 : -1);
- break;
- case keycodes.RIGHT_ARROW:
- this.activeDate = this._dateAdapter.addCalendarDays(this._activeDate, isRtl ? -1 : 1);
- break;
- case keycodes.UP_ARROW:
- this.activeDate = this._dateAdapter.addCalendarDays(this._activeDate, -7);
- break;
- case keycodes.DOWN_ARROW:
- this.activeDate = this._dateAdapter.addCalendarDays(this._activeDate, 7);
- break;
- case keycodes.HOME:
- this.activeDate = this._dateAdapter.addCalendarDays(this._activeDate, 1 - this._dateAdapter.getDate(this._activeDate));
- break;
- case keycodes.END:
- this.activeDate = this._dateAdapter.addCalendarDays(this._activeDate, (this._dateAdapter.getNumDaysInMonth(this._activeDate) -
- this._dateAdapter.getDate(this._activeDate)));
- break;
- case keycodes.PAGE_UP:
- this.activeDate = event.altKey ?
- this._dateAdapter.addCalendarYears(this._activeDate, -1) :
- this._dateAdapter.addCalendarMonths(this._activeDate, -1);
- break;
- case keycodes.PAGE_DOWN:
- this.activeDate = event.altKey ?
- this._dateAdapter.addCalendarYears(this._activeDate, 1) :
- this._dateAdapter.addCalendarMonths(this._activeDate, 1);
- break;
- case keycodes.ENTER:
- case keycodes.SPACE:
- if (!this.dateFilter || this.dateFilter(this._activeDate)) {
- this._dateSelected(this._dateAdapter.getDate(this._activeDate));
- this._userSelection.emit();
- // Prevent unexpected default actions such as form submission.
- event.preventDefault();
- }
- return;
- default:
- // Don't prevent default or focus active cell on keys that we don't explicitly handle.
- return;
- }
- if (this._dateAdapter.compareDate(oldActiveDate, this.activeDate)) {
- this.activeDateChange.emit(this.activeDate);
- }
- this._focusActiveCell();
- // Prevent unexpected default actions such as form submission.
- event.preventDefault();
- };
- /** Initializes this month view. */
- /**
- * Initializes this month view.
- * @return {?}
- */
- MatMonthView.prototype._init = /**
- * Initializes this month view.
- * @return {?}
- */
- function () {
- this._selectedDate = this._getDateInCurrentMonth(this.selected);
- this._todayDate = this._getDateInCurrentMonth(this._dateAdapter.today());
- this._monthLabel =
- this._dateAdapter.getMonthNames('short')[this._dateAdapter.getMonth(this.activeDate)]
- .toLocaleUpperCase();
- /** @type {?} */
- var firstOfMonth = this._dateAdapter.createDate(this._dateAdapter.getYear(this.activeDate), this._dateAdapter.getMonth(this.activeDate), 1);
- this._firstWeekOffset =
- (DAYS_PER_WEEK + this._dateAdapter.getDayOfWeek(firstOfMonth) -
- this._dateAdapter.getFirstDayOfWeek()) % DAYS_PER_WEEK;
- this._initWeekdays();
- this._createWeekCells();
- this._changeDetectorRef.markForCheck();
- };
- /** Focuses the active cell after the microtask queue is empty. */
- /**
- * Focuses the active cell after the microtask queue is empty.
- * @return {?}
- */
- MatMonthView.prototype._focusActiveCell = /**
- * Focuses the active cell after the microtask queue is empty.
- * @return {?}
- */
- function () {
- this._matCalendarBody._focusActiveCell();
- };
- /** Initializes the weekdays. */
- /**
- * Initializes the weekdays.
- * @private
- * @return {?}
- */
- MatMonthView.prototype._initWeekdays = /**
- * Initializes the weekdays.
- * @private
- * @return {?}
- */
- function () {
- /** @type {?} */
- var firstDayOfWeek = this._dateAdapter.getFirstDayOfWeek();
- /** @type {?} */
- var narrowWeekdays = this._dateAdapter.getDayOfWeekNames('narrow');
- /** @type {?} */
- var longWeekdays = this._dateAdapter.getDayOfWeekNames('long');
- // Rotate the labels for days of the week based on the configured first day of the week.
- /** @type {?} */
- var weekdays = longWeekdays.map((/**
- * @param {?} long
- * @param {?} i
- * @return {?}
- */
- function (long, i) {
- return { long: long, narrow: narrowWeekdays[i] };
- }));
- this._weekdays = weekdays.slice(firstDayOfWeek).concat(weekdays.slice(0, firstDayOfWeek));
- };
- /** Creates MatCalendarCells for the dates in this month. */
- /**
- * Creates MatCalendarCells for the dates in this month.
- * @private
- * @return {?}
- */
- MatMonthView.prototype._createWeekCells = /**
- * Creates MatCalendarCells for the dates in this month.
- * @private
- * @return {?}
- */
- function () {
- /** @type {?} */
- var daysInMonth = this._dateAdapter.getNumDaysInMonth(this.activeDate);
- /** @type {?} */
- var dateNames = this._dateAdapter.getDateNames();
- this._weeks = [[]];
- for (var i = 0, cell = this._firstWeekOffset; i < daysInMonth; i++, cell++) {
- if (cell == DAYS_PER_WEEK) {
- this._weeks.push([]);
- cell = 0;
- }
- /** @type {?} */
- var date = this._dateAdapter.createDate(this._dateAdapter.getYear(this.activeDate), this._dateAdapter.getMonth(this.activeDate), i + 1);
- /** @type {?} */
- var enabled = this._shouldEnableDate(date);
- /** @type {?} */
- var ariaLabel = this._dateAdapter.format(date, this._dateFormats.display.dateA11yLabel);
- /** @type {?} */
- var cellClasses = this.dateClass ? this.dateClass(date) : undefined;
- this._weeks[this._weeks.length - 1]
- .push(new MatCalendarCell(i + 1, dateNames[i], ariaLabel, enabled, cellClasses));
- }
- };
- /** Date filter for the month */
- /**
- * Date filter for the month
- * @private
- * @param {?} date
- * @return {?}
- */
- MatMonthView.prototype._shouldEnableDate = /**
- * Date filter for the month
- * @private
- * @param {?} date
- * @return {?}
- */
- function (date) {
- return !!date &&
- (!this.dateFilter || this.dateFilter(date)) &&
- (!this.minDate || this._dateAdapter.compareDate(date, this.minDate) >= 0) &&
- (!this.maxDate || this._dateAdapter.compareDate(date, this.maxDate) <= 0);
- };
- /**
- * Gets the date in this month that the given Date falls on.
- * Returns null if the given Date is in another month.
- */
- /**
- * Gets the date in this month that the given Date falls on.
- * Returns null if the given Date is in another month.
- * @private
- * @param {?} date
- * @return {?}
- */
- MatMonthView.prototype._getDateInCurrentMonth = /**
- * Gets the date in this month that the given Date falls on.
- * Returns null if the given Date is in another month.
- * @private
- * @param {?} date
- * @return {?}
- */
- function (date) {
- return date && this._hasSameMonthAndYear(date, this.activeDate) ?
- this._dateAdapter.getDate(date) : null;
- };
- /** Checks whether the 2 dates are non-null and fall within the same month of the same year. */
- /**
- * Checks whether the 2 dates are non-null and fall within the same month of the same year.
- * @private
- * @param {?} d1
- * @param {?} d2
- * @return {?}
- */
- MatMonthView.prototype._hasSameMonthAndYear = /**
- * Checks whether the 2 dates are non-null and fall within the same month of the same year.
- * @private
- * @param {?} d1
- * @param {?} d2
- * @return {?}
- */
- function (d1, d2) {
- return !!(d1 && d2 && this._dateAdapter.getMonth(d1) == this._dateAdapter.getMonth(d2) &&
- this._dateAdapter.getYear(d1) == this._dateAdapter.getYear(d2));
- };
- /**
- * @param obj The object to check.
- * @returns The given object if it is both a date instance and valid, otherwise null.
- */
- /**
- * @private
- * @param {?} obj The object to check.
- * @return {?} The given object if it is both a date instance and valid, otherwise null.
- */
- MatMonthView.prototype._getValidDateOrNull = /**
- * @private
- * @param {?} obj The object to check.
- * @return {?} The given object if it is both a date instance and valid, otherwise null.
- */
- function (obj) {
- return (this._dateAdapter.isDateInstance(obj) && this._dateAdapter.isValid(obj)) ? obj : null;
- };
- /** Determines whether the user has the RTL layout direction. */
- /**
- * Determines whether the user has the RTL layout direction.
- * @private
- * @return {?}
- */
- MatMonthView.prototype._isRtl = /**
- * Determines whether the user has the RTL layout direction.
- * @private
- * @return {?}
- */
- function () {
- return this._dir && this._dir.value === 'rtl';
- };
- MatMonthView.decorators = [
- { type: core.Component, args: [{selector: 'mat-month-view',
- 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>",
- exportAs: 'matMonthView',
- encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush
- },] },
- ];
- /** @nocollapse */
- MatMonthView.ctorParameters = function () { return [
- { type: core.ChangeDetectorRef },
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_DATE_FORMATS,] }] },
- { type: DateAdapter, decorators: [{ type: core.Optional }] },
- { type: bidi.Directionality, decorators: [{ type: core.Optional }] }
- ]; };
- MatMonthView.propDecorators = {
- activeDate: [{ type: core.Input }],
- selected: [{ type: core.Input }],
- minDate: [{ type: core.Input }],
- maxDate: [{ type: core.Input }],
- dateFilter: [{ type: core.Input }],
- dateClass: [{ type: core.Input }],
- selectedChange: [{ type: core.Output }],
- _userSelection: [{ type: core.Output }],
- activeDateChange: [{ type: core.Output }],
- _matCalendarBody: [{ type: core.ViewChild, args: [MatCalendarBody, { static: false },] }]
- };
- return MatMonthView;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /** @type {?} */
- var yearsPerPage = 24;
- /** @type {?} */
- var yearsPerRow = 4;
- /**
- * An internal component used to display a year selector in the datepicker.
- * \@docs-private
- * @template D
- */
- var MatMultiYearView = /** @class */ (function () {
- function MatMultiYearView(_changeDetectorRef, _dateAdapter, _dir) {
- this._changeDetectorRef = _changeDetectorRef;
- this._dateAdapter = _dateAdapter;
- this._dir = _dir;
- /**
- * Emits when a new year is selected.
- */
- this.selectedChange = new core.EventEmitter();
- /**
- * Emits the selected year. This doesn't imply a change on the selected date
- */
- this.yearSelected = new core.EventEmitter();
- /**
- * Emits when any date is activated.
- */
- this.activeDateChange = new core.EventEmitter();
- if (!this._dateAdapter) {
- throw createMissingDateImplError('DateAdapter');
- }
- this._activeDate = this._dateAdapter.today();
- }
- Object.defineProperty(MatMultiYearView.prototype, "activeDate", {
- /** The date to display in this multi-year view (everything other than the year is ignored). */
- get: /**
- * The date to display in this multi-year view (everything other than the year is ignored).
- * @return {?}
- */
- function () { return this._activeDate; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- /** @type {?} */
- var oldActiveDate = this._activeDate;
- /** @type {?} */
- var validDate = this._getValidDateOrNull(this._dateAdapter.deserialize(value)) || this._dateAdapter.today();
- this._activeDate = this._dateAdapter.clampDate(validDate, this.minDate, this.maxDate);
- if (!isSameMultiYearView(this._dateAdapter, oldActiveDate, this._activeDate, this.minDate, this.maxDate)) {
- this._init();
- }
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatMultiYearView.prototype, "selected", {
- /** The currently selected date. */
- get: /**
- * The currently selected date.
- * @return {?}
- */
- function () { return this._selected; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._selected = this._getValidDateOrNull(this._dateAdapter.deserialize(value));
- this._selectedYear = this._selected && this._dateAdapter.getYear(this._selected);
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatMultiYearView.prototype, "minDate", {
- /** The minimum selectable date. */
- get: /**
- * The minimum selectable date.
- * @return {?}
- */
- function () { return this._minDate; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._minDate = this._getValidDateOrNull(this._dateAdapter.deserialize(value));
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatMultiYearView.prototype, "maxDate", {
- /** The maximum selectable date. */
- get: /**
- * The maximum selectable date.
- * @return {?}
- */
- function () { return this._maxDate; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._maxDate = this._getValidDateOrNull(this._dateAdapter.deserialize(value));
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- MatMultiYearView.prototype.ngAfterContentInit = /**
- * @return {?}
- */
- function () {
- this._init();
- };
- /** Initializes this multi-year view. */
- /**
- * Initializes this multi-year view.
- * @return {?}
- */
- MatMultiYearView.prototype._init = /**
- * Initializes this multi-year view.
- * @return {?}
- */
- function () {
- var _this = this;
- this._todayYear = this._dateAdapter.getYear(this._dateAdapter.today());
- // We want a range years such that we maximize the number of
- // enabled dates visible at once. This prevents issues where the minimum year
- // is the last item of a page OR the maximum year is the first item of a page.
- // The offset from the active year to the "slot" for the starting year is the
- // *actual* first rendered year in the multi-year view.
- /** @type {?} */
- var activeYear = this._dateAdapter.getYear(this._activeDate);
- /** @type {?} */
- var minYearOfPage = activeYear - getActiveOffset(this._dateAdapter, this.activeDate, this.minDate, this.maxDate);
- this._years = [];
- for (var i = 0, row = []; i < yearsPerPage; i++) {
- row.push(minYearOfPage + i);
- if (row.length == yearsPerRow) {
- this._years.push(row.map((/**
- * @param {?} year
- * @return {?}
- */
- function (year) { return _this._createCellForYear(year); })));
- row = [];
- }
- }
- this._changeDetectorRef.markForCheck();
- };
- /** Handles when a new year is selected. */
- /**
- * Handles when a new year is selected.
- * @param {?} year
- * @return {?}
- */
- MatMultiYearView.prototype._yearSelected = /**
- * Handles when a new year is selected.
- * @param {?} year
- * @return {?}
- */
- function (year) {
- this.yearSelected.emit(this._dateAdapter.createDate(year, 0, 1));
- /** @type {?} */
- var month = this._dateAdapter.getMonth(this.activeDate);
- /** @type {?} */
- var daysInMonth = this._dateAdapter.getNumDaysInMonth(this._dateAdapter.createDate(year, month, 1));
- this.selectedChange.emit(this._dateAdapter.createDate(year, month, Math.min(this._dateAdapter.getDate(this.activeDate), daysInMonth)));
- };
- /** Handles keydown events on the calendar body when calendar is in multi-year view. */
- /**
- * Handles keydown events on the calendar body when calendar is in multi-year view.
- * @param {?} event
- * @return {?}
- */
- MatMultiYearView.prototype._handleCalendarBodyKeydown = /**
- * Handles keydown events on the calendar body when calendar is in multi-year view.
- * @param {?} event
- * @return {?}
- */
- function (event) {
- /** @type {?} */
- var oldActiveDate = this._activeDate;
- /** @type {?} */
- var isRtl = this._isRtl();
- switch (event.keyCode) {
- case keycodes.LEFT_ARROW:
- this.activeDate = this._dateAdapter.addCalendarYears(this._activeDate, isRtl ? 1 : -1);
- break;
- case keycodes.RIGHT_ARROW:
- this.activeDate = this._dateAdapter.addCalendarYears(this._activeDate, isRtl ? -1 : 1);
- break;
- case keycodes.UP_ARROW:
- this.activeDate = this._dateAdapter.addCalendarYears(this._activeDate, -yearsPerRow);
- break;
- case keycodes.DOWN_ARROW:
- this.activeDate = this._dateAdapter.addCalendarYears(this._activeDate, yearsPerRow);
- break;
- case keycodes.HOME:
- this.activeDate = this._dateAdapter.addCalendarYears(this._activeDate, -getActiveOffset(this._dateAdapter, this.activeDate, this.minDate, this.maxDate));
- break;
- case keycodes.END:
- this.activeDate = this._dateAdapter.addCalendarYears(this._activeDate, yearsPerPage - getActiveOffset(this._dateAdapter, this.activeDate, this.minDate, this.maxDate) - 1);
- break;
- case keycodes.PAGE_UP:
- this.activeDate =
- this._dateAdapter.addCalendarYears(this._activeDate, event.altKey ? -yearsPerPage * 10 : -yearsPerPage);
- break;
- case keycodes.PAGE_DOWN:
- this.activeDate =
- this._dateAdapter.addCalendarYears(this._activeDate, event.altKey ? yearsPerPage * 10 : yearsPerPage);
- break;
- case keycodes.ENTER:
- case keycodes.SPACE:
- this._yearSelected(this._dateAdapter.getYear(this._activeDate));
- break;
- default:
- // Don't prevent default or focus active cell on keys that we don't explicitly handle.
- return;
- }
- if (this._dateAdapter.compareDate(oldActiveDate, this.activeDate)) {
- this.activeDateChange.emit(this.activeDate);
- }
- this._focusActiveCell();
- // Prevent unexpected default actions such as form submission.
- event.preventDefault();
- };
- /**
- * @return {?}
- */
- MatMultiYearView.prototype._getActiveCell = /**
- * @return {?}
- */
- function () {
- return getActiveOffset(this._dateAdapter, this.activeDate, this.minDate, this.maxDate);
- };
- /** Focuses the active cell after the microtask queue is empty. */
- /**
- * Focuses the active cell after the microtask queue is empty.
- * @return {?}
- */
- MatMultiYearView.prototype._focusActiveCell = /**
- * Focuses the active cell after the microtask queue is empty.
- * @return {?}
- */
- function () {
- this._matCalendarBody._focusActiveCell();
- };
- /** Creates an MatCalendarCell for the given year. */
- /**
- * Creates an MatCalendarCell for the given year.
- * @private
- * @param {?} year
- * @return {?}
- */
- MatMultiYearView.prototype._createCellForYear = /**
- * Creates an MatCalendarCell for the given year.
- * @private
- * @param {?} year
- * @return {?}
- */
- function (year) {
- /** @type {?} */
- var yearName = this._dateAdapter.getYearName(this._dateAdapter.createDate(year, 0, 1));
- return new MatCalendarCell(year, yearName, yearName, this._shouldEnableYear(year));
- };
- /** Whether the given year is enabled. */
- /**
- * Whether the given year is enabled.
- * @private
- * @param {?} year
- * @return {?}
- */
- MatMultiYearView.prototype._shouldEnableYear = /**
- * Whether the given year is enabled.
- * @private
- * @param {?} year
- * @return {?}
- */
- function (year) {
- // disable if the year is greater than maxDate lower than minDate
- if (year === undefined || year === null ||
- (this.maxDate && year > this._dateAdapter.getYear(this.maxDate)) ||
- (this.minDate && year < this._dateAdapter.getYear(this.minDate))) {
- return false;
- }
- // enable if it reaches here and there's no filter defined
- if (!this.dateFilter) {
- return true;
- }
- /** @type {?} */
- var firstOfYear = this._dateAdapter.createDate(year, 0, 1);
- // If any date in the year is enabled count the year as enabled.
- for (var date = firstOfYear; this._dateAdapter.getYear(date) == year; date = this._dateAdapter.addCalendarDays(date, 1)) {
- if (this.dateFilter(date)) {
- return true;
- }
- }
- return false;
- };
- /**
- * @param obj The object to check.
- * @returns The given object if it is both a date instance and valid, otherwise null.
- */
- /**
- * @private
- * @param {?} obj The object to check.
- * @return {?} The given object if it is both a date instance and valid, otherwise null.
- */
- MatMultiYearView.prototype._getValidDateOrNull = /**
- * @private
- * @param {?} obj The object to check.
- * @return {?} The given object if it is both a date instance and valid, otherwise null.
- */
- function (obj) {
- return (this._dateAdapter.isDateInstance(obj) && this._dateAdapter.isValid(obj)) ? obj : null;
- };
- /** Determines whether the user has the RTL layout direction. */
- /**
- * Determines whether the user has the RTL layout direction.
- * @private
- * @return {?}
- */
- MatMultiYearView.prototype._isRtl = /**
- * Determines whether the user has the RTL layout direction.
- * @private
- * @return {?}
- */
- function () {
- return this._dir && this._dir.value === 'rtl';
- };
- MatMultiYearView.decorators = [
- { type: core.Component, args: [{selector: 'mat-multi-year-view',
- 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>",
- exportAs: 'matMultiYearView',
- encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush
- },] },
- ];
- /** @nocollapse */
- MatMultiYearView.ctorParameters = function () { return [
- { type: core.ChangeDetectorRef },
- { type: DateAdapter, decorators: [{ type: core.Optional }] },
- { type: bidi.Directionality, decorators: [{ type: core.Optional }] }
- ]; };
- MatMultiYearView.propDecorators = {
- activeDate: [{ type: core.Input }],
- selected: [{ type: core.Input }],
- minDate: [{ type: core.Input }],
- maxDate: [{ type: core.Input }],
- dateFilter: [{ type: core.Input }],
- selectedChange: [{ type: core.Output }],
- yearSelected: [{ type: core.Output }],
- activeDateChange: [{ type: core.Output }],
- _matCalendarBody: [{ type: core.ViewChild, args: [MatCalendarBody, { static: false },] }]
- };
- return MatMultiYearView;
- }());
- /**
- * @template D
- * @param {?} dateAdapter
- * @param {?} date1
- * @param {?} date2
- * @param {?} minDate
- * @param {?} maxDate
- * @return {?}
- */
- function isSameMultiYearView(dateAdapter, date1, date2, minDate, maxDate) {
- /** @type {?} */
- var year1 = dateAdapter.getYear(date1);
- /** @type {?} */
- var year2 = dateAdapter.getYear(date2);
- /** @type {?} */
- var startingYear = getStartingYear(dateAdapter, minDate, maxDate);
- return Math.floor((year1 - startingYear) / yearsPerPage) ===
- Math.floor((year2 - startingYear) / yearsPerPage);
- }
- /**
- * When the multi-year view is first opened, the active year will be in view.
- * So we compute how many years are between the active year and the *slot* where our
- * "startingYear" will render when paged into view.
- * @template D
- * @param {?} dateAdapter
- * @param {?} activeDate
- * @param {?} minDate
- * @param {?} maxDate
- * @return {?}
- */
- function getActiveOffset(dateAdapter, activeDate, minDate, maxDate) {
- /** @type {?} */
- var activeYear = dateAdapter.getYear(activeDate);
- return euclideanModulo((activeYear - getStartingYear(dateAdapter, minDate, maxDate)), yearsPerPage);
- }
- /**
- * We pick a "starting" year such that either the maximum year would be at the end
- * or the minimum year would be at the beginning of a page.
- * @template D
- * @param {?} dateAdapter
- * @param {?} minDate
- * @param {?} maxDate
- * @return {?}
- */
- function getStartingYear(dateAdapter, minDate, maxDate) {
- /** @type {?} */
- var startingYear = 0;
- if (maxDate) {
- /** @type {?} */
- var maxYear = dateAdapter.getYear(maxDate);
- startingYear = maxYear - yearsPerPage + 1;
- }
- else if (minDate) {
- startingYear = dateAdapter.getYear(minDate);
- }
- return startingYear;
- }
- /**
- * Gets remainder that is non-negative, even if first number is negative
- * @param {?} a
- * @param {?} b
- * @return {?}
- */
- function euclideanModulo(a, b) {
- return (a % b + b) % b;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * An internal component used to display a single year in the datepicker.
- * \@docs-private
- * @template D
- */
- var MatYearView = /** @class */ (function () {
- function MatYearView(_changeDetectorRef, _dateFormats, _dateAdapter, _dir) {
- this._changeDetectorRef = _changeDetectorRef;
- this._dateFormats = _dateFormats;
- this._dateAdapter = _dateAdapter;
- this._dir = _dir;
- /**
- * Emits when a new month is selected.
- */
- this.selectedChange = new core.EventEmitter();
- /**
- * Emits the selected month. This doesn't imply a change on the selected date
- */
- this.monthSelected = new core.EventEmitter();
- /**
- * Emits when any date is activated.
- */
- this.activeDateChange = new core.EventEmitter();
- if (!this._dateAdapter) {
- throw createMissingDateImplError('DateAdapter');
- }
- if (!this._dateFormats) {
- throw createMissingDateImplError('MAT_DATE_FORMATS');
- }
- this._activeDate = this._dateAdapter.today();
- }
- Object.defineProperty(MatYearView.prototype, "activeDate", {
- /** The date to display in this year view (everything other than the year is ignored). */
- get: /**
- * The date to display in this year view (everything other than the year is ignored).
- * @return {?}
- */
- function () { return this._activeDate; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- /** @type {?} */
- var oldActiveDate = this._activeDate;
- /** @type {?} */
- var validDate = this._getValidDateOrNull(this._dateAdapter.deserialize(value)) || this._dateAdapter.today();
- this._activeDate = this._dateAdapter.clampDate(validDate, this.minDate, this.maxDate);
- if (this._dateAdapter.getYear(oldActiveDate) !== this._dateAdapter.getYear(this._activeDate)) {
- this._init();
- }
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatYearView.prototype, "selected", {
- /** The currently selected date. */
- get: /**
- * The currently selected date.
- * @return {?}
- */
- function () { return this._selected; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._selected = this._getValidDateOrNull(this._dateAdapter.deserialize(value));
- this._selectedMonth = this._getMonthInCurrentYear(this._selected);
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatYearView.prototype, "minDate", {
- /** The minimum selectable date. */
- get: /**
- * The minimum selectable date.
- * @return {?}
- */
- function () { return this._minDate; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._minDate = this._getValidDateOrNull(this._dateAdapter.deserialize(value));
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatYearView.prototype, "maxDate", {
- /** The maximum selectable date. */
- get: /**
- * The maximum selectable date.
- * @return {?}
- */
- function () { return this._maxDate; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._maxDate = this._getValidDateOrNull(this._dateAdapter.deserialize(value));
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- MatYearView.prototype.ngAfterContentInit = /**
- * @return {?}
- */
- function () {
- this._init();
- };
- /** Handles when a new month is selected. */
- /**
- * Handles when a new month is selected.
- * @param {?} month
- * @return {?}
- */
- MatYearView.prototype._monthSelected = /**
- * Handles when a new month is selected.
- * @param {?} month
- * @return {?}
- */
- function (month) {
- /** @type {?} */
- var normalizedDate = this._dateAdapter.createDate(this._dateAdapter.getYear(this.activeDate), month, 1);
- this.monthSelected.emit(normalizedDate);
- /** @type {?} */
- var daysInMonth = this._dateAdapter.getNumDaysInMonth(normalizedDate);
- this.selectedChange.emit(this._dateAdapter.createDate(this._dateAdapter.getYear(this.activeDate), month, Math.min(this._dateAdapter.getDate(this.activeDate), daysInMonth)));
- };
- /** Handles keydown events on the calendar body when calendar is in year view. */
- /**
- * Handles keydown events on the calendar body when calendar is in year view.
- * @param {?} event
- * @return {?}
- */
- MatYearView.prototype._handleCalendarBodyKeydown = /**
- * Handles keydown events on the calendar body when calendar is in year view.
- * @param {?} event
- * @return {?}
- */
- function (event) {
- // TODO(mmalerba): We currently allow keyboard navigation to disabled dates, but just prevent
- // disabled ones from being selected. This may not be ideal, we should look into whether
- // navigation should skip over disabled dates, and if so, how to implement that efficiently.
- // TODO(mmalerba): We currently allow keyboard navigation to disabled dates, but just prevent
- // disabled ones from being selected. This may not be ideal, we should look into whether
- // navigation should skip over disabled dates, and if so, how to implement that efficiently.
- /** @type {?} */
- var oldActiveDate = this._activeDate;
- /** @type {?} */
- var isRtl = this._isRtl();
- switch (event.keyCode) {
- case keycodes.LEFT_ARROW:
- this.activeDate = this._dateAdapter.addCalendarMonths(this._activeDate, isRtl ? 1 : -1);
- break;
- case keycodes.RIGHT_ARROW:
- this.activeDate = this._dateAdapter.addCalendarMonths(this._activeDate, isRtl ? -1 : 1);
- break;
- case keycodes.UP_ARROW:
- this.activeDate = this._dateAdapter.addCalendarMonths(this._activeDate, -4);
- break;
- case keycodes.DOWN_ARROW:
- this.activeDate = this._dateAdapter.addCalendarMonths(this._activeDate, 4);
- break;
- case keycodes.HOME:
- this.activeDate = this._dateAdapter.addCalendarMonths(this._activeDate, -this._dateAdapter.getMonth(this._activeDate));
- break;
- case keycodes.END:
- this.activeDate = this._dateAdapter.addCalendarMonths(this._activeDate, 11 - this._dateAdapter.getMonth(this._activeDate));
- break;
- case keycodes.PAGE_UP:
- this.activeDate =
- this._dateAdapter.addCalendarYears(this._activeDate, event.altKey ? -10 : -1);
- break;
- case keycodes.PAGE_DOWN:
- this.activeDate =
- this._dateAdapter.addCalendarYears(this._activeDate, event.altKey ? 10 : 1);
- break;
- case keycodes.ENTER:
- case keycodes.SPACE:
- this._monthSelected(this._dateAdapter.getMonth(this._activeDate));
- break;
- default:
- // Don't prevent default or focus active cell on keys that we don't explicitly handle.
- return;
- }
- if (this._dateAdapter.compareDate(oldActiveDate, this.activeDate)) {
- this.activeDateChange.emit(this.activeDate);
- }
- this._focusActiveCell();
- // Prevent unexpected default actions such as form submission.
- event.preventDefault();
- };
- /** Initializes this year view. */
- /**
- * Initializes this year view.
- * @return {?}
- */
- MatYearView.prototype._init = /**
- * Initializes this year view.
- * @return {?}
- */
- function () {
- var _this = this;
- this._selectedMonth = this._getMonthInCurrentYear(this.selected);
- this._todayMonth = this._getMonthInCurrentYear(this._dateAdapter.today());
- this._yearLabel = this._dateAdapter.getYearName(this.activeDate);
- /** @type {?} */
- var monthNames = this._dateAdapter.getMonthNames('short');
- // First row of months only contains 5 elements so we can fit the year label on the same row.
- this._months = [[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11]].map((/**
- * @param {?} row
- * @return {?}
- */
- function (row) { return row.map((/**
- * @param {?} month
- * @return {?}
- */
- function (month) { return _this._createCellForMonth(month, monthNames[month]); })); }));
- this._changeDetectorRef.markForCheck();
- };
- /** Focuses the active cell after the microtask queue is empty. */
- /**
- * Focuses the active cell after the microtask queue is empty.
- * @return {?}
- */
- MatYearView.prototype._focusActiveCell = /**
- * Focuses the active cell after the microtask queue is empty.
- * @return {?}
- */
- function () {
- this._matCalendarBody._focusActiveCell();
- };
- /**
- * Gets the month in this year that the given Date falls on.
- * Returns null if the given Date is in another year.
- */
- /**
- * Gets the month in this year that the given Date falls on.
- * Returns null if the given Date is in another year.
- * @private
- * @param {?} date
- * @return {?}
- */
- MatYearView.prototype._getMonthInCurrentYear = /**
- * Gets the month in this year that the given Date falls on.
- * Returns null if the given Date is in another year.
- * @private
- * @param {?} date
- * @return {?}
- */
- function (date) {
- return date && this._dateAdapter.getYear(date) == this._dateAdapter.getYear(this.activeDate) ?
- this._dateAdapter.getMonth(date) : null;
- };
- /** Creates an MatCalendarCell for the given month. */
- /**
- * Creates an MatCalendarCell for the given month.
- * @private
- * @param {?} month
- * @param {?} monthName
- * @return {?}
- */
- MatYearView.prototype._createCellForMonth = /**
- * Creates an MatCalendarCell for the given month.
- * @private
- * @param {?} month
- * @param {?} monthName
- * @return {?}
- */
- function (month, monthName) {
- /** @type {?} */
- var ariaLabel = this._dateAdapter.format(this._dateAdapter.createDate(this._dateAdapter.getYear(this.activeDate), month, 1), this._dateFormats.display.monthYearA11yLabel);
- return new MatCalendarCell(month, monthName.toLocaleUpperCase(), ariaLabel, this._shouldEnableMonth(month));
- };
- /** Whether the given month is enabled. */
- /**
- * Whether the given month is enabled.
- * @private
- * @param {?} month
- * @return {?}
- */
- MatYearView.prototype._shouldEnableMonth = /**
- * Whether the given month is enabled.
- * @private
- * @param {?} month
- * @return {?}
- */
- function (month) {
- /** @type {?} */
- var activeYear = this._dateAdapter.getYear(this.activeDate);
- if (month === undefined || month === null ||
- this._isYearAndMonthAfterMaxDate(activeYear, month) ||
- this._isYearAndMonthBeforeMinDate(activeYear, month)) {
- return false;
- }
- if (!this.dateFilter) {
- return true;
- }
- /** @type {?} */
- var firstOfMonth = this._dateAdapter.createDate(activeYear, month, 1);
- // If any date in the month is enabled count the month as enabled.
- for (var date = firstOfMonth; this._dateAdapter.getMonth(date) == month; date = this._dateAdapter.addCalendarDays(date, 1)) {
- if (this.dateFilter(date)) {
- return true;
- }
- }
- return false;
- };
- /**
- * Tests whether the combination month/year is after this.maxDate, considering
- * just the month and year of this.maxDate
- */
- /**
- * Tests whether the combination month/year is after this.maxDate, considering
- * just the month and year of this.maxDate
- * @private
- * @param {?} year
- * @param {?} month
- * @return {?}
- */
- MatYearView.prototype._isYearAndMonthAfterMaxDate = /**
- * Tests whether the combination month/year is after this.maxDate, considering
- * just the month and year of this.maxDate
- * @private
- * @param {?} year
- * @param {?} month
- * @return {?}
- */
- function (year, month) {
- if (this.maxDate) {
- /** @type {?} */
- var maxYear = this._dateAdapter.getYear(this.maxDate);
- /** @type {?} */
- var maxMonth = this._dateAdapter.getMonth(this.maxDate);
- return year > maxYear || (year === maxYear && month > maxMonth);
- }
- return false;
- };
- /**
- * Tests whether the combination month/year is before this.minDate, considering
- * just the month and year of this.minDate
- */
- /**
- * Tests whether the combination month/year is before this.minDate, considering
- * just the month and year of this.minDate
- * @private
- * @param {?} year
- * @param {?} month
- * @return {?}
- */
- MatYearView.prototype._isYearAndMonthBeforeMinDate = /**
- * Tests whether the combination month/year is before this.minDate, considering
- * just the month and year of this.minDate
- * @private
- * @param {?} year
- * @param {?} month
- * @return {?}
- */
- function (year, month) {
- if (this.minDate) {
- /** @type {?} */
- var minYear = this._dateAdapter.getYear(this.minDate);
- /** @type {?} */
- var minMonth = this._dateAdapter.getMonth(this.minDate);
- return year < minYear || (year === minYear && month < minMonth);
- }
- return false;
- };
- /**
- * @param obj The object to check.
- * @returns The given object if it is both a date instance and valid, otherwise null.
- */
- /**
- * @private
- * @param {?} obj The object to check.
- * @return {?} The given object if it is both a date instance and valid, otherwise null.
- */
- MatYearView.prototype._getValidDateOrNull = /**
- * @private
- * @param {?} obj The object to check.
- * @return {?} The given object if it is both a date instance and valid, otherwise null.
- */
- function (obj) {
- return (this._dateAdapter.isDateInstance(obj) && this._dateAdapter.isValid(obj)) ? obj : null;
- };
- /** Determines whether the user has the RTL layout direction. */
- /**
- * Determines whether the user has the RTL layout direction.
- * @private
- * @return {?}
- */
- MatYearView.prototype._isRtl = /**
- * Determines whether the user has the RTL layout direction.
- * @private
- * @return {?}
- */
- function () {
- return this._dir && this._dir.value === 'rtl';
- };
- MatYearView.decorators = [
- { type: core.Component, args: [{selector: 'mat-year-view',
- 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>",
- exportAs: 'matYearView',
- encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush
- },] },
- ];
- /** @nocollapse */
- MatYearView.ctorParameters = function () { return [
- { type: core.ChangeDetectorRef },
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_DATE_FORMATS,] }] },
- { type: DateAdapter, decorators: [{ type: core.Optional }] },
- { type: bidi.Directionality, decorators: [{ type: core.Optional }] }
- ]; };
- MatYearView.propDecorators = {
- activeDate: [{ type: core.Input }],
- selected: [{ type: core.Input }],
- minDate: [{ type: core.Input }],
- maxDate: [{ type: core.Input }],
- dateFilter: [{ type: core.Input }],
- selectedChange: [{ type: core.Output }],
- monthSelected: [{ type: core.Output }],
- activeDateChange: [{ type: core.Output }],
- _matCalendarBody: [{ type: core.ViewChild, args: [MatCalendarBody, { static: false },] }]
- };
- return MatYearView;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Default header for MatCalendar
- * @template D
- */
- var MatCalendarHeader = /** @class */ (function () {
- function MatCalendarHeader(_intl, calendar, _dateAdapter, _dateFormats, changeDetectorRef) {
- this._intl = _intl;
- this.calendar = calendar;
- this._dateAdapter = _dateAdapter;
- this._dateFormats = _dateFormats;
- this.calendar.stateChanges.subscribe((/**
- * @return {?}
- */
- function () { return changeDetectorRef.markForCheck(); }));
- }
- Object.defineProperty(MatCalendarHeader.prototype, "periodButtonText", {
- /** The label for the current calendar view. */
- get: /**
- * The label for the current calendar view.
- * @return {?}
- */
- function () {
- if (this.calendar.currentView == 'month') {
- return this._dateAdapter
- .format(this.calendar.activeDate, this._dateFormats.display.monthYearLabel)
- .toLocaleUpperCase();
- }
- if (this.calendar.currentView == 'year') {
- return this._dateAdapter.getYearName(this.calendar.activeDate);
- }
- // The offset from the active year to the "slot" for the starting year is the
- // *actual* first rendered year in the multi-year view, and the last year is
- // just yearsPerPage - 1 away.
- /** @type {?} */
- var activeYear = this._dateAdapter.getYear(this.calendar.activeDate);
- /** @type {?} */
- var minYearOfPage = activeYear - getActiveOffset(this._dateAdapter, this.calendar.activeDate, this.calendar.minDate, this.calendar.maxDate);
- /** @type {?} */
- var maxYearOfPage = minYearOfPage + yearsPerPage - 1;
- return minYearOfPage + " \u2013 " + maxYearOfPage;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatCalendarHeader.prototype, "periodButtonLabel", {
- get: /**
- * @return {?}
- */
- function () {
- return this.calendar.currentView == 'month' ?
- this._intl.switchToMultiYearViewLabel : this._intl.switchToMonthViewLabel;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatCalendarHeader.prototype, "prevButtonLabel", {
- /** The label for the previous button. */
- get: /**
- * The label for the previous button.
- * @return {?}
- */
- function () {
- return {
- 'month': this._intl.prevMonthLabel,
- 'year': this._intl.prevYearLabel,
- 'multi-year': this._intl.prevMultiYearLabel
- }[this.calendar.currentView];
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatCalendarHeader.prototype, "nextButtonLabel", {
- /** The label for the next button. */
- get: /**
- * The label for the next button.
- * @return {?}
- */
- function () {
- return {
- 'month': this._intl.nextMonthLabel,
- 'year': this._intl.nextYearLabel,
- 'multi-year': this._intl.nextMultiYearLabel
- }[this.calendar.currentView];
- },
- enumerable: true,
- configurable: true
- });
- /** Handles user clicks on the period label. */
- /**
- * Handles user clicks on the period label.
- * @return {?}
- */
- MatCalendarHeader.prototype.currentPeriodClicked = /**
- * Handles user clicks on the period label.
- * @return {?}
- */
- function () {
- this.calendar.currentView = this.calendar.currentView == 'month' ? 'multi-year' : 'month';
- };
- /** Handles user clicks on the previous button. */
- /**
- * Handles user clicks on the previous button.
- * @return {?}
- */
- MatCalendarHeader.prototype.previousClicked = /**
- * Handles user clicks on the previous button.
- * @return {?}
- */
- function () {
- this.calendar.activeDate = this.calendar.currentView == 'month' ?
- this._dateAdapter.addCalendarMonths(this.calendar.activeDate, -1) :
- this._dateAdapter.addCalendarYears(this.calendar.activeDate, this.calendar.currentView == 'year' ? -1 : -yearsPerPage);
- };
- /** Handles user clicks on the next button. */
- /**
- * Handles user clicks on the next button.
- * @return {?}
- */
- MatCalendarHeader.prototype.nextClicked = /**
- * Handles user clicks on the next button.
- * @return {?}
- */
- function () {
- this.calendar.activeDate = this.calendar.currentView == 'month' ?
- this._dateAdapter.addCalendarMonths(this.calendar.activeDate, 1) :
- this._dateAdapter.addCalendarYears(this.calendar.activeDate, this.calendar.currentView == 'year' ? 1 : yearsPerPage);
- };
- /** Whether the previous period button is enabled. */
- /**
- * Whether the previous period button is enabled.
- * @return {?}
- */
- MatCalendarHeader.prototype.previousEnabled = /**
- * Whether the previous period button is enabled.
- * @return {?}
- */
- function () {
- if (!this.calendar.minDate) {
- return true;
- }
- return !this.calendar.minDate ||
- !this._isSameView(this.calendar.activeDate, this.calendar.minDate);
- };
- /** Whether the next period button is enabled. */
- /**
- * Whether the next period button is enabled.
- * @return {?}
- */
- MatCalendarHeader.prototype.nextEnabled = /**
- * Whether the next period button is enabled.
- * @return {?}
- */
- function () {
- return !this.calendar.maxDate ||
- !this._isSameView(this.calendar.activeDate, this.calendar.maxDate);
- };
- /** Whether the two dates represent the same view in the current view mode (month or year). */
- /**
- * Whether the two dates represent the same view in the current view mode (month or year).
- * @private
- * @param {?} date1
- * @param {?} date2
- * @return {?}
- */
- MatCalendarHeader.prototype._isSameView = /**
- * Whether the two dates represent the same view in the current view mode (month or year).
- * @private
- * @param {?} date1
- * @param {?} date2
- * @return {?}
- */
- function (date1, date2) {
- if (this.calendar.currentView == 'month') {
- return this._dateAdapter.getYear(date1) == this._dateAdapter.getYear(date2) &&
- this._dateAdapter.getMonth(date1) == this._dateAdapter.getMonth(date2);
- }
- if (this.calendar.currentView == 'year') {
- return this._dateAdapter.getYear(date1) == this._dateAdapter.getYear(date2);
- }
- // Otherwise we are in 'multi-year' view.
- return isSameMultiYearView(this._dateAdapter, date1, date2, this.calendar.minDate, this.calendar.maxDate);
- };
- MatCalendarHeader.decorators = [
- { type: core.Component, args: [{selector: 'mat-calendar-header',
- 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>",
- exportAs: 'matCalendarHeader',
- encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- },] },
- ];
- /** @nocollapse */
- MatCalendarHeader.ctorParameters = function () { return [
- { type: MatDatepickerIntl },
- { type: MatCalendar, decorators: [{ type: core.Inject, args: [core.forwardRef((/**
- * @return {?}
- */
- function () { return MatCalendar; })),] }] },
- { type: DateAdapter, decorators: [{ type: core.Optional }] },
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_DATE_FORMATS,] }] },
- { type: core.ChangeDetectorRef }
- ]; };
- return MatCalendarHeader;
- }());
- /**
- * A calendar that is used as part of the datepicker.
- * \@docs-private
- * @template D
- */
- var MatCalendar = /** @class */ (function () {
- function MatCalendar(_intl, _dateAdapter, _dateFormats, _changeDetectorRef) {
- var _this = this;
- this._dateAdapter = _dateAdapter;
- this._dateFormats = _dateFormats;
- this._changeDetectorRef = _changeDetectorRef;
- /**
- * Used for scheduling that focus should be moved to the active cell on the next tick.
- * We need to schedule it, rather than do it immediately, because we have to wait
- * for Angular to re-evaluate the view children.
- */
- this._moveFocusOnNextTick = false;
- /**
- * Whether the calendar should be started in month or year view.
- */
- this.startView = 'month';
- /**
- * Emits when the currently selected date changes.
- */
- this.selectedChange = new core.EventEmitter();
- /**
- * Emits the year chosen in multiyear view.
- * This doesn't imply a change on the selected date.
- */
- this.yearSelected = new core.EventEmitter();
- /**
- * Emits the month chosen in year view.
- * This doesn't imply a change on the selected date.
- */
- this.monthSelected = new core.EventEmitter();
- /**
- * Emits when any date is selected.
- */
- this._userSelection = new core.EventEmitter();
- /**
- * Emits whenever there is a state change that the header may need to respond to.
- */
- this.stateChanges = new rxjs.Subject();
- if (!this._dateAdapter) {
- throw createMissingDateImplError('DateAdapter');
- }
- if (!this._dateFormats) {
- throw createMissingDateImplError('MAT_DATE_FORMATS');
- }
- this._intlChanges = _intl.changes.subscribe((/**
- * @return {?}
- */
- function () {
- _changeDetectorRef.markForCheck();
- _this.stateChanges.next();
- }));
- }
- Object.defineProperty(MatCalendar.prototype, "startAt", {
- /** A date representing the period (month or year) to start the calendar in. */
- get: /**
- * A date representing the period (month or year) to start the calendar in.
- * @return {?}
- */
- function () { return this._startAt; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._startAt = this._getValidDateOrNull(this._dateAdapter.deserialize(value));
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatCalendar.prototype, "selected", {
- /** The currently selected date. */
- get: /**
- * The currently selected date.
- * @return {?}
- */
- function () { return this._selected; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._selected = this._getValidDateOrNull(this._dateAdapter.deserialize(value));
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatCalendar.prototype, "minDate", {
- /** The minimum selectable date. */
- get: /**
- * The minimum selectable date.
- * @return {?}
- */
- function () { return this._minDate; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._minDate = this._getValidDateOrNull(this._dateAdapter.deserialize(value));
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatCalendar.prototype, "maxDate", {
- /** The maximum selectable date. */
- get: /**
- * The maximum selectable date.
- * @return {?}
- */
- function () { return this._maxDate; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._maxDate = this._getValidDateOrNull(this._dateAdapter.deserialize(value));
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatCalendar.prototype, "activeDate", {
- /**
- * The current active date. This determines which time period is shown and which date is
- * highlighted when using keyboard navigation.
- */
- get: /**
- * The current active date. This determines which time period is shown and which date is
- * highlighted when using keyboard navigation.
- * @return {?}
- */
- function () { return this._clampedActiveDate; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._clampedActiveDate = this._dateAdapter.clampDate(value, this.minDate, this.maxDate);
- this.stateChanges.next();
- this._changeDetectorRef.markForCheck();
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatCalendar.prototype, "currentView", {
- /** Whether the calendar is in month view. */
- get: /**
- * Whether the calendar is in month view.
- * @return {?}
- */
- function () { return this._currentView; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._currentView = value;
- this._moveFocusOnNextTick = true;
- this._changeDetectorRef.markForCheck();
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- MatCalendar.prototype.ngAfterContentInit = /**
- * @return {?}
- */
- function () {
- this._calendarHeaderPortal = new portal.ComponentPortal(this.headerComponent || MatCalendarHeader);
- this.activeDate = this.startAt || this._dateAdapter.today();
- // Assign to the private property since we don't want to move focus on init.
- this._currentView = this.startView;
- };
- /**
- * @return {?}
- */
- MatCalendar.prototype.ngAfterViewChecked = /**
- * @return {?}
- */
- function () {
- if (this._moveFocusOnNextTick) {
- this._moveFocusOnNextTick = false;
- this.focusActiveCell();
- }
- };
- /**
- * @return {?}
- */
- MatCalendar.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- this._intlChanges.unsubscribe();
- this.stateChanges.complete();
- };
- /**
- * @param {?} changes
- * @return {?}
- */
- MatCalendar.prototype.ngOnChanges = /**
- * @param {?} changes
- * @return {?}
- */
- function (changes) {
- /** @type {?} */
- var change = changes['minDate'] || changes['maxDate'] || changes['dateFilter'];
- if (change && !change.firstChange) {
- /** @type {?} */
- var view = this._getCurrentViewComponent();
- if (view) {
- // We need to `detectChanges` manually here, because the `minDate`, `maxDate` etc. are
- // passed down to the view via data bindings which won't be up-to-date when we call `_init`.
- this._changeDetectorRef.detectChanges();
- view._init();
- }
- }
- this.stateChanges.next();
- };
- /**
- * @return {?}
- */
- MatCalendar.prototype.focusActiveCell = /**
- * @return {?}
- */
- function () {
- this._getCurrentViewComponent()._focusActiveCell();
- };
- /** Updates today's date after an update of the active date */
- /**
- * Updates today's date after an update of the active date
- * @return {?}
- */
- MatCalendar.prototype.updateTodaysDate = /**
- * Updates today's date after an update of the active date
- * @return {?}
- */
- function () {
- /** @type {?} */
- var view = this.currentView == 'month' ? this.monthView :
- (this.currentView == 'year' ? this.yearView : this.multiYearView);
- view.ngAfterContentInit();
- };
- /** Handles date selection in the month view. */
- /**
- * Handles date selection in the month view.
- * @param {?} date
- * @return {?}
- */
- MatCalendar.prototype._dateSelected = /**
- * Handles date selection in the month view.
- * @param {?} date
- * @return {?}
- */
- function (date) {
- if (!this._dateAdapter.sameDate(date, this.selected)) {
- this.selectedChange.emit(date);
- }
- };
- /** Handles year selection in the multiyear view. */
- /**
- * Handles year selection in the multiyear view.
- * @param {?} normalizedYear
- * @return {?}
- */
- MatCalendar.prototype._yearSelectedInMultiYearView = /**
- * Handles year selection in the multiyear view.
- * @param {?} normalizedYear
- * @return {?}
- */
- function (normalizedYear) {
- this.yearSelected.emit(normalizedYear);
- };
- /** Handles month selection in the year view. */
- /**
- * Handles month selection in the year view.
- * @param {?} normalizedMonth
- * @return {?}
- */
- MatCalendar.prototype._monthSelectedInYearView = /**
- * Handles month selection in the year view.
- * @param {?} normalizedMonth
- * @return {?}
- */
- function (normalizedMonth) {
- this.monthSelected.emit(normalizedMonth);
- };
- /**
- * @return {?}
- */
- MatCalendar.prototype._userSelected = /**
- * @return {?}
- */
- function () {
- this._userSelection.emit();
- };
- /** Handles year/month selection in the multi-year/year views. */
- /**
- * Handles year/month selection in the multi-year/year views.
- * @param {?} date
- * @param {?} view
- * @return {?}
- */
- MatCalendar.prototype._goToDateInView = /**
- * Handles year/month selection in the multi-year/year views.
- * @param {?} date
- * @param {?} view
- * @return {?}
- */
- function (date, view) {
- this.activeDate = date;
- this.currentView = view;
- };
- /**
- * @param obj The object to check.
- * @returns The given object if it is both a date instance and valid, otherwise null.
- */
- /**
- * @private
- * @param {?} obj The object to check.
- * @return {?} The given object if it is both a date instance and valid, otherwise null.
- */
- MatCalendar.prototype._getValidDateOrNull = /**
- * @private
- * @param {?} obj The object to check.
- * @return {?} The given object if it is both a date instance and valid, otherwise null.
- */
- function (obj) {
- return (this._dateAdapter.isDateInstance(obj) && this._dateAdapter.isValid(obj)) ? obj : null;
- };
- /** Returns the component instance that corresponds to the current calendar view. */
- /**
- * Returns the component instance that corresponds to the current calendar view.
- * @private
- * @return {?}
- */
- MatCalendar.prototype._getCurrentViewComponent = /**
- * Returns the component instance that corresponds to the current calendar view.
- * @private
- * @return {?}
- */
- function () {
- return this.monthView || this.yearView || this.multiYearView;
- };
- MatCalendar.decorators = [
- { type: core.Component, args: [{selector: 'mat-calendar',
- 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>",
- 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}"],
- host: {
- 'class': 'mat-calendar',
- },
- exportAs: 'matCalendar',
- encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- },] },
- ];
- /** @nocollapse */
- MatCalendar.ctorParameters = function () { return [
- { type: MatDatepickerIntl },
- { type: DateAdapter, decorators: [{ type: core.Optional }] },
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_DATE_FORMATS,] }] },
- { type: core.ChangeDetectorRef }
- ]; };
- MatCalendar.propDecorators = {
- headerComponent: [{ type: core.Input }],
- startAt: [{ type: core.Input }],
- startView: [{ type: core.Input }],
- selected: [{ type: core.Input }],
- minDate: [{ type: core.Input }],
- maxDate: [{ type: core.Input }],
- dateFilter: [{ type: core.Input }],
- dateClass: [{ type: core.Input }],
- selectedChange: [{ type: core.Output }],
- yearSelected: [{ type: core.Output }],
- monthSelected: [{ type: core.Output }],
- _userSelection: [{ type: core.Output }],
- monthView: [{ type: core.ViewChild, args: [MatMonthView, { static: false },] }],
- yearView: [{ type: core.ViewChild, args: [MatYearView, { static: false },] }],
- multiYearView: [{ type: core.ViewChild, args: [MatMultiYearView, { static: false },] }]
- };
- return MatCalendar;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Animations used by the Material datepicker.
- * \@docs-private
- * @type {?}
- */
- var matDatepickerAnimations = {
- /**
- * Transforms the height of the datepicker's calendar.
- */
- transformPanel: animations$1.trigger('transformPanel', [
- animations$1.state('void', animations$1.style({
- opacity: 0,
- transform: 'scale(1, 0.8)'
- })),
- animations$1.transition('void => enter', animations$1.animate('120ms cubic-bezier(0, 0, 0.2, 1)', animations$1.style({
- opacity: 1,
- transform: 'scale(1, 1)'
- }))),
- animations$1.transition('* => void', animations$1.animate('100ms linear', animations$1.style({ opacity: 0 })))
- ]),
- /**
- * Fades in the content of the calendar.
- */
- fadeInCalendar: animations$1.trigger('fadeInCalendar', [
- animations$1.state('void', animations$1.style({ opacity: 0 })),
- animations$1.state('enter', animations$1.style({ opacity: 1 })),
- // TODO(crisbeto): this animation should be removed since it isn't quite on spec, but we
- // need to keep it until #12440 gets in, otherwise the exit animation will look glitchy.
- animations$1.transition('void => *', animations$1.animate('120ms 100ms cubic-bezier(0.55, 0, 0.55, 0.2)'))
- ])
- };
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Used to generate a unique ID for each datepicker instance.
- * @type {?}
- */
- var datepickerUid = 0;
- /**
- * Injection token that determines the scroll handling while the calendar is open.
- * @type {?}
- */
- var MAT_DATEPICKER_SCROLL_STRATEGY = new core.InjectionToken('mat-datepicker-scroll-strategy');
- /**
- * \@docs-private
- * @param {?} overlay
- * @return {?}
- */
- function MAT_DATEPICKER_SCROLL_STRATEGY_FACTORY(overlay$$1) {
- return (/**
- * @return {?}
- */
- function () { return overlay$$1.scrollStrategies.reposition(); });
- }
- /**
- * \@docs-private
- * @type {?}
- */
- var MAT_DATEPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER = {
- provide: MAT_DATEPICKER_SCROLL_STRATEGY,
- deps: [overlay.Overlay],
- useFactory: MAT_DATEPICKER_SCROLL_STRATEGY_FACTORY,
- };
- // Boilerplate for applying mixins to MatDatepickerContent.
- /**
- * \@docs-private
- */
- var
- // Boilerplate for applying mixins to MatDatepickerContent.
- /**
- * \@docs-private
- */
- MatDatepickerContentBase = /** @class */ (function () {
- function MatDatepickerContentBase(_elementRef) {
- this._elementRef = _elementRef;
- }
- return MatDatepickerContentBase;
- }());
- /** @type {?} */
- var _MatDatepickerContentMixinBase = mixinColor(MatDatepickerContentBase);
- /**
- * Component used as the content for the datepicker dialog and popup. We use this instead of using
- * MatCalendar directly as the content so we can control the initial focus. This also gives us a
- * place to put additional features of the popup that are not part of the calendar itself in the
- * future. (e.g. confirmation buttons).
- * \@docs-private
- * @template D
- */
- var MatDatepickerContent = /** @class */ (function (_super) {
- __extends(MatDatepickerContent, _super);
- function MatDatepickerContent(elementRef) {
- return _super.call(this, elementRef) || this;
- }
- /**
- * @return {?}
- */
- MatDatepickerContent.prototype.ngAfterViewInit = /**
- * @return {?}
- */
- function () {
- this._calendar.focusActiveCell();
- };
- MatDatepickerContent.decorators = [
- { type: core.Component, args: [{selector: 'mat-datepicker-content',
- 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>",
- 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}}"],
- host: {
- 'class': 'mat-datepicker-content',
- '[@transformPanel]': '"enter"',
- '[class.mat-datepicker-content-touch]': 'datepicker.touchUi',
- },
- animations: [
- matDatepickerAnimations.transformPanel,
- matDatepickerAnimations.fadeInCalendar,
- ],
- exportAs: 'matDatepickerContent',
- encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- inputs: ['color'],
- },] },
- ];
- /** @nocollapse */
- MatDatepickerContent.ctorParameters = function () { return [
- { type: core.ElementRef }
- ]; };
- MatDatepickerContent.propDecorators = {
- _calendar: [{ type: core.ViewChild, args: [MatCalendar, { static: false },] }]
- };
- return MatDatepickerContent;
- }(_MatDatepickerContentMixinBase));
- // TODO(mmalerba): We use a component instead of a directive here so the user can use implicit
- // template reference variables (e.g. #d vs #d="matDatepicker"). We can change this to a directive
- // if angular adds support for `exportAs: '$implicit'` on directives.
- /**
- * Component responsible for managing the datepicker popup/dialog.
- * @template D
- */
- var MatDatepicker = /** @class */ (function () {
- function MatDatepicker(_dialog, _overlay, _ngZone, _viewContainerRef, scrollStrategy, _dateAdapter, _dir, _document) {
- this._dialog = _dialog;
- this._overlay = _overlay;
- this._ngZone = _ngZone;
- this._viewContainerRef = _viewContainerRef;
- this._dateAdapter = _dateAdapter;
- this._dir = _dir;
- this._document = _document;
- /**
- * The view that the calendar should start in.
- */
- this.startView = 'month';
- this._touchUi = false;
- /**
- * Emits selected year in multiyear view.
- * This doesn't imply a change on the selected date.
- */
- this.yearSelected = new core.EventEmitter();
- /**
- * Emits selected month in year view.
- * This doesn't imply a change on the selected date.
- */
- this.monthSelected = new core.EventEmitter();
- /**
- * Emits when the datepicker has been opened.
- */
- this.openedStream = new core.EventEmitter();
- /**
- * Emits when the datepicker has been closed.
- */
- this.closedStream = new core.EventEmitter();
- this._opened = false;
- /**
- * The id for the datepicker calendar.
- */
- this.id = "mat-datepicker-" + datepickerUid++;
- this._validSelected = null;
- /**
- * The element that was focused before the datepicker was opened.
- */
- this._focusedElementBeforeOpen = null;
- /**
- * Subscription to value changes in the associated input element.
- */
- this._inputSubscription = rxjs.Subscription.EMPTY;
- /**
- * Emits when the datepicker is disabled.
- */
- this._disabledChange = new rxjs.Subject();
- /**
- * Emits new selected date when selected date changes.
- */
- this._selectedChanged = new rxjs.Subject();
- if (!this._dateAdapter) {
- throw createMissingDateImplError('DateAdapter');
- }
- this._scrollStrategy = scrollStrategy;
- }
- Object.defineProperty(MatDatepicker.prototype, "startAt", {
- /** The date to open the calendar to initially. */
- get: /**
- * The date to open the calendar to initially.
- * @return {?}
- */
- function () {
- // If an explicit startAt is set we start there, otherwise we start at whatever the currently
- // selected value is.
- return this._startAt || (this._datepickerInput ? this._datepickerInput.value : null);
- },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._startAt = this._getValidDateOrNull(this._dateAdapter.deserialize(value));
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatDatepicker.prototype, "color", {
- /** Color palette to use on the datepicker's calendar. */
- get: /**
- * Color palette to use on the datepicker's calendar.
- * @return {?}
- */
- function () {
- return this._color ||
- (this._datepickerInput ? this._datepickerInput._getThemePalette() : undefined);
- },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._color = value;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatDatepicker.prototype, "touchUi", {
- /**
- * Whether the calendar UI is in touch mode. In touch mode the calendar opens in a dialog rather
- * than a popup and elements have more padding to allow for bigger touch targets.
- */
- get: /**
- * Whether the calendar UI is in touch mode. In touch mode the calendar opens in a dialog rather
- * than a popup and elements have more padding to allow for bigger touch targets.
- * @return {?}
- */
- function () { return this._touchUi; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._touchUi = coercion.coerceBooleanProperty(value);
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatDatepicker.prototype, "disabled", {
- /** Whether the datepicker pop-up should be disabled. */
- get: /**
- * Whether the datepicker pop-up should be disabled.
- * @return {?}
- */
- function () {
- return this._disabled === undefined && this._datepickerInput ?
- this._datepickerInput.disabled : !!this._disabled;
- },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- /** @type {?} */
- var newValue = coercion.coerceBooleanProperty(value);
- if (newValue !== this._disabled) {
- this._disabled = newValue;
- this._disabledChange.next(newValue);
- }
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatDatepicker.prototype, "opened", {
- /** Whether the calendar is open. */
- get: /**
- * Whether the calendar is open.
- * @return {?}
- */
- function () { return this._opened; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) { value ? this.open() : this.close(); },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatDatepicker.prototype, "_selected", {
- /** The currently selected date. */
- get: /**
- * The currently selected date.
- * @return {?}
- */
- function () { return this._validSelected; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) { this._validSelected = value; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatDatepicker.prototype, "_minDate", {
- /** The minimum selectable date. */
- get: /**
- * The minimum selectable date.
- * @return {?}
- */
- function () {
- return this._datepickerInput && this._datepickerInput.min;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatDatepicker.prototype, "_maxDate", {
- /** The maximum selectable date. */
- get: /**
- * The maximum selectable date.
- * @return {?}
- */
- function () {
- return this._datepickerInput && this._datepickerInput.max;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatDatepicker.prototype, "_dateFilter", {
- get: /**
- * @return {?}
- */
- function () {
- return this._datepickerInput && this._datepickerInput._dateFilter;
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- MatDatepicker.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- this.close();
- this._inputSubscription.unsubscribe();
- this._disabledChange.complete();
- if (this._popupRef) {
- this._popupRef.dispose();
- this._popupComponentRef = null;
- }
- };
- /** Selects the given date */
- /**
- * Selects the given date
- * @param {?} date
- * @return {?}
- */
- MatDatepicker.prototype.select = /**
- * Selects the given date
- * @param {?} date
- * @return {?}
- */
- function (date) {
- /** @type {?} */
- var oldValue = this._selected;
- this._selected = date;
- if (!this._dateAdapter.sameDate(oldValue, this._selected)) {
- this._selectedChanged.next(date);
- }
- };
- /** Emits the selected year in multiyear view */
- /**
- * Emits the selected year in multiyear view
- * @param {?} normalizedYear
- * @return {?}
- */
- MatDatepicker.prototype._selectYear = /**
- * Emits the selected year in multiyear view
- * @param {?} normalizedYear
- * @return {?}
- */
- function (normalizedYear) {
- this.yearSelected.emit(normalizedYear);
- };
- /** Emits selected month in year view */
- /**
- * Emits selected month in year view
- * @param {?} normalizedMonth
- * @return {?}
- */
- MatDatepicker.prototype._selectMonth = /**
- * Emits selected month in year view
- * @param {?} normalizedMonth
- * @return {?}
- */
- function (normalizedMonth) {
- this.monthSelected.emit(normalizedMonth);
- };
- /**
- * Register an input with this datepicker.
- * @param input The datepicker input to register with this datepicker.
- */
- /**
- * Register an input with this datepicker.
- * @param {?} input The datepicker input to register with this datepicker.
- * @return {?}
- */
- MatDatepicker.prototype._registerInput = /**
- * Register an input with this datepicker.
- * @param {?} input The datepicker input to register with this datepicker.
- * @return {?}
- */
- function (input) {
- var _this = this;
- if (this._datepickerInput) {
- throw Error('A MatDatepicker can only be associated with a single input.');
- }
- this._datepickerInput = input;
- this._inputSubscription =
- this._datepickerInput._valueChange.subscribe((/**
- * @param {?} value
- * @return {?}
- */
- function (value) { return _this._selected = value; }));
- };
- /** Open the calendar. */
- /**
- * Open the calendar.
- * @return {?}
- */
- MatDatepicker.prototype.open = /**
- * Open the calendar.
- * @return {?}
- */
- function () {
- if (this._opened || this.disabled) {
- return;
- }
- if (!this._datepickerInput) {
- throw Error('Attempted to open an MatDatepicker with no associated input.');
- }
- if (this._document) {
- this._focusedElementBeforeOpen = this._document.activeElement;
- }
- this.touchUi ? this._openAsDialog() : this._openAsPopup();
- this._opened = true;
- this.openedStream.emit();
- };
- /** Close the calendar. */
- /**
- * Close the calendar.
- * @return {?}
- */
- MatDatepicker.prototype.close = /**
- * Close the calendar.
- * @return {?}
- */
- function () {
- var _this = this;
- if (!this._opened) {
- return;
- }
- if (this._popupRef && this._popupRef.hasAttached()) {
- this._popupRef.detach();
- }
- if (this._dialogRef) {
- this._dialogRef.close();
- this._dialogRef = null;
- }
- if (this._calendarPortal && this._calendarPortal.isAttached) {
- this._calendarPortal.detach();
- }
- /** @type {?} */
- var completeClose = (/**
- * @return {?}
- */
- function () {
- // The `_opened` could've been reset already if
- // we got two events in quick succession.
- if (_this._opened) {
- _this._opened = false;
- _this.closedStream.emit();
- _this._focusedElementBeforeOpen = null;
- }
- });
- if (this._focusedElementBeforeOpen &&
- typeof this._focusedElementBeforeOpen.focus === 'function') {
- // Because IE moves focus asynchronously, we can't count on it being restored before we've
- // marked the datepicker as closed. If the event fires out of sequence and the element that
- // we're refocusing opens the datepicker on focus, the user could be stuck with not being
- // able to close the calendar at all. We work around it by making the logic, that marks
- // the datepicker as closed, async as well.
- this._focusedElementBeforeOpen.focus();
- setTimeout(completeClose);
- }
- else {
- completeClose();
- }
- };
- /** Open the calendar as a dialog. */
- /**
- * Open the calendar as a dialog.
- * @private
- * @return {?}
- */
- MatDatepicker.prototype._openAsDialog = /**
- * Open the calendar as a dialog.
- * @private
- * @return {?}
- */
- function () {
- var _this = this;
- // Usually this would be handled by `open` which ensures that we can only have one overlay
- // open at a time, however since we reset the variables in async handlers some overlays
- // may slip through if the user opens and closes multiple times in quick succession (e.g.
- // by holding down the enter key).
- if (this._dialogRef) {
- this._dialogRef.close();
- }
- this._dialogRef = this._dialog.open(MatDatepickerContent, {
- direction: this._dir ? this._dir.value : 'ltr',
- viewContainerRef: this._viewContainerRef,
- panelClass: 'mat-datepicker-dialog',
- });
- this._dialogRef.afterClosed().subscribe((/**
- * @return {?}
- */
- function () { return _this.close(); }));
- this._dialogRef.componentInstance.datepicker = this;
- this._setColor();
- };
- /** Open the calendar as a popup. */
- /**
- * Open the calendar as a popup.
- * @private
- * @return {?}
- */
- MatDatepicker.prototype._openAsPopup = /**
- * Open the calendar as a popup.
- * @private
- * @return {?}
- */
- function () {
- var _this = this;
- if (!this._calendarPortal) {
- this._calendarPortal = new portal.ComponentPortal(MatDatepickerContent, this._viewContainerRef);
- }
- if (!this._popupRef) {
- this._createPopup();
- }
- if (!this._popupRef.hasAttached()) {
- this._popupComponentRef = this._popupRef.attach(this._calendarPortal);
- this._popupComponentRef.instance.datepicker = this;
- this._setColor();
- // Update the position once the calendar has rendered.
- this._ngZone.onStable.asObservable().pipe(operators.take(1)).subscribe((/**
- * @return {?}
- */
- function () {
- _this._popupRef.updatePosition();
- }));
- }
- };
- /** Create the popup. */
- /**
- * Create the popup.
- * @private
- * @return {?}
- */
- MatDatepicker.prototype._createPopup = /**
- * Create the popup.
- * @private
- * @return {?}
- */
- function () {
- var _this = this;
- /** @type {?} */
- var overlayConfig = new overlay.OverlayConfig({
- positionStrategy: this._createPopupPositionStrategy(),
- hasBackdrop: true,
- backdropClass: 'mat-overlay-transparent-backdrop',
- direction: this._dir,
- scrollStrategy: this._scrollStrategy(),
- panelClass: 'mat-datepicker-popup',
- });
- this._popupRef = this._overlay.create(overlayConfig);
- this._popupRef.overlayElement.setAttribute('role', 'dialog');
- rxjs.merge(this._popupRef.backdropClick(), this._popupRef.detachments(), this._popupRef.keydownEvents().pipe(operators.filter((/**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- // Closing on alt + up is only valid when there's an input associated with the datepicker.
- return event.keyCode === keycodes.ESCAPE ||
- (_this._datepickerInput && event.altKey && event.keyCode === keycodes.UP_ARROW);
- })))).subscribe((/**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- if (event) {
- event.preventDefault();
- }
- _this.close();
- }));
- };
- /** Create the popup PositionStrategy. */
- /**
- * Create the popup PositionStrategy.
- * @private
- * @return {?}
- */
- MatDatepicker.prototype._createPopupPositionStrategy = /**
- * Create the popup PositionStrategy.
- * @private
- * @return {?}
- */
- function () {
- return this._overlay.position()
- .flexibleConnectedTo(this._datepickerInput.getConnectedOverlayOrigin())
- .withTransformOriginOn('.mat-datepicker-content')
- .withFlexibleDimensions(false)
- .withViewportMargin(8)
- .withLockedPosition()
- .withPositions([
- {
- originX: 'start',
- originY: 'bottom',
- overlayX: 'start',
- overlayY: 'top'
- },
- {
- originX: 'start',
- originY: 'top',
- overlayX: 'start',
- overlayY: 'bottom'
- },
- {
- originX: 'end',
- originY: 'bottom',
- overlayX: 'end',
- overlayY: 'top'
- },
- {
- originX: 'end',
- originY: 'top',
- overlayX: 'end',
- overlayY: 'bottom'
- }
- ]);
- };
- /**
- * @param obj The object to check.
- * @returns The given object if it is both a date instance and valid, otherwise null.
- */
- /**
- * @private
- * @param {?} obj The object to check.
- * @return {?} The given object if it is both a date instance and valid, otherwise null.
- */
- MatDatepicker.prototype._getValidDateOrNull = /**
- * @private
- * @param {?} obj The object to check.
- * @return {?} The given object if it is both a date instance and valid, otherwise null.
- */
- function (obj) {
- return (this._dateAdapter.isDateInstance(obj) && this._dateAdapter.isValid(obj)) ? obj : null;
- };
- /** Passes the current theme color along to the calendar overlay. */
- /**
- * Passes the current theme color along to the calendar overlay.
- * @private
- * @return {?}
- */
- MatDatepicker.prototype._setColor = /**
- * Passes the current theme color along to the calendar overlay.
- * @private
- * @return {?}
- */
- function () {
- /** @type {?} */
- var color = this.color;
- if (this._popupComponentRef) {
- this._popupComponentRef.instance.color = color;
- }
- if (this._dialogRef) {
- this._dialogRef.componentInstance.color = color;
- }
- };
- MatDatepicker.decorators = [
- { type: core.Component, args: [{selector: 'mat-datepicker',
- template: '',
- exportAs: 'matDatepicker',
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- encapsulation: core.ViewEncapsulation.None,
- },] },
- ];
- /** @nocollapse */
- MatDatepicker.ctorParameters = function () { return [
- { type: MatDialog },
- { type: overlay.Overlay },
- { type: core.NgZone },
- { type: core.ViewContainerRef },
- { type: undefined, decorators: [{ type: core.Inject, args: [MAT_DATEPICKER_SCROLL_STRATEGY,] }] },
- { type: DateAdapter, decorators: [{ type: core.Optional }] },
- { type: bidi.Directionality, decorators: [{ type: core.Optional }] },
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [common.DOCUMENT,] }] }
- ]; };
- MatDatepicker.propDecorators = {
- calendarHeaderComponent: [{ type: core.Input }],
- startAt: [{ type: core.Input }],
- startView: [{ type: core.Input }],
- color: [{ type: core.Input }],
- touchUi: [{ type: core.Input }],
- disabled: [{ type: core.Input }],
- yearSelected: [{ type: core.Output }],
- monthSelected: [{ type: core.Output }],
- panelClass: [{ type: core.Input }],
- dateClass: [{ type: core.Input }],
- openedStream: [{ type: core.Output, args: ['opened',] }],
- closedStream: [{ type: core.Output, args: ['closed',] }],
- opened: [{ type: core.Input }]
- };
- return MatDatepicker;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * \@docs-private
- * @type {?}
- */
- var MAT_DATEPICKER_VALUE_ACCESSOR = {
- provide: forms.NG_VALUE_ACCESSOR,
- useExisting: core.forwardRef((/**
- * @return {?}
- */
- function () { return MatDatepickerInput; })),
- multi: true
- };
- /**
- * \@docs-private
- * @type {?}
- */
- var MAT_DATEPICKER_VALIDATORS = {
- provide: forms.NG_VALIDATORS,
- useExisting: core.forwardRef((/**
- * @return {?}
- */
- function () { return MatDatepickerInput; })),
- multi: true
- };
- /**
- * An event used for datepicker input and change events. We don't always have access to a native
- * input or change event because the event may have been triggered by the user clicking on the
- * calendar popup. For consistency, we always use MatDatepickerInputEvent instead.
- * @template D
- */
- var /**
- * An event used for datepicker input and change events. We don't always have access to a native
- * input or change event because the event may have been triggered by the user clicking on the
- * calendar popup. For consistency, we always use MatDatepickerInputEvent instead.
- * @template D
- */
- MatDatepickerInputEvent = /** @class */ (function () {
- function MatDatepickerInputEvent(target, targetElement) {
- this.target = target;
- this.targetElement = targetElement;
- this.value = this.target.value;
- }
- return MatDatepickerInputEvent;
- }());
- /**
- * Directive used to connect an input to a MatDatepicker.
- * @template D
- */
- var MatDatepickerInput = /** @class */ (function () {
- function MatDatepickerInput(_elementRef, _dateAdapter, _dateFormats, _formField) {
- var _this = this;
- this._elementRef = _elementRef;
- this._dateAdapter = _dateAdapter;
- this._dateFormats = _dateFormats;
- this._formField = _formField;
- /**
- * Emits when a `change` event is fired on this `<input>`.
- */
- this.dateChange = new core.EventEmitter();
- /**
- * Emits when an `input` event is fired on this `<input>`.
- */
- this.dateInput = new core.EventEmitter();
- /**
- * Emits when the value changes (either due to user input or programmatic change).
- */
- this._valueChange = new core.EventEmitter();
- /**
- * Emits when the disabled state has changed
- */
- this._disabledChange = new core.EventEmitter();
- this._onTouched = (/**
- * @return {?}
- */
- function () { });
- this._cvaOnChange = (/**
- * @return {?}
- */
- function () { });
- this._validatorOnChange = (/**
- * @return {?}
- */
- function () { });
- this._datepickerSubscription = rxjs.Subscription.EMPTY;
- this._localeSubscription = rxjs.Subscription.EMPTY;
- /**
- * The form control validator for whether the input parses.
- */
- this._parseValidator = (/**
- * @return {?}
- */
- function () {
- return _this._lastValueValid ?
- null : { 'matDatepickerParse': { 'text': _this._elementRef.nativeElement.value } };
- });
- /**
- * The form control validator for the min date.
- */
- this._minValidator = (/**
- * @param {?} control
- * @return {?}
- */
- function (control) {
- /** @type {?} */
- var controlValue = _this._getValidDateOrNull(_this._dateAdapter.deserialize(control.value));
- return (!_this.min || !controlValue ||
- _this._dateAdapter.compareDate(_this.min, controlValue) <= 0) ?
- null : { 'matDatepickerMin': { 'min': _this.min, 'actual': controlValue } };
- });
- /**
- * The form control validator for the max date.
- */
- this._maxValidator = (/**
- * @param {?} control
- * @return {?}
- */
- function (control) {
- /** @type {?} */
- var controlValue = _this._getValidDateOrNull(_this._dateAdapter.deserialize(control.value));
- return (!_this.max || !controlValue ||
- _this._dateAdapter.compareDate(_this.max, controlValue) >= 0) ?
- null : { 'matDatepickerMax': { 'max': _this.max, 'actual': controlValue } };
- });
- /**
- * The form control validator for the date filter.
- */
- this._filterValidator = (/**
- * @param {?} control
- * @return {?}
- */
- function (control) {
- /** @type {?} */
- var controlValue = _this._getValidDateOrNull(_this._dateAdapter.deserialize(control.value));
- return !_this._dateFilter || !controlValue || _this._dateFilter(controlValue) ?
- null : { 'matDatepickerFilter': true };
- });
- /**
- * The combined form control validator for this input.
- */
- this._validator = forms.Validators.compose([this._parseValidator, this._minValidator, this._maxValidator, this._filterValidator]);
- /**
- * Whether the last value set on the input was valid.
- */
- this._lastValueValid = false;
- if (!this._dateAdapter) {
- throw createMissingDateImplError('DateAdapter');
- }
- if (!this._dateFormats) {
- throw createMissingDateImplError('MAT_DATE_FORMATS');
- }
- // Update the displayed date when the locale changes.
- this._localeSubscription = _dateAdapter.localeChanges.subscribe((/**
- * @return {?}
- */
- function () {
- _this.value = _this.value;
- }));
- }
- Object.defineProperty(MatDatepickerInput.prototype, "matDatepicker", {
- /** The datepicker that this input is associated with. */
- set: /**
- * The datepicker that this input is associated with.
- * @param {?} value
- * @return {?}
- */
- function (value) {
- var _this = this;
- if (!value) {
- return;
- }
- this._datepicker = value;
- this._datepicker._registerInput(this);
- this._datepickerSubscription.unsubscribe();
- this._datepickerSubscription = this._datepicker._selectedChanged.subscribe((/**
- * @param {?} selected
- * @return {?}
- */
- function (selected) {
- _this.value = selected;
- _this._cvaOnChange(selected);
- _this._onTouched();
- _this.dateInput.emit(new MatDatepickerInputEvent(_this, _this._elementRef.nativeElement));
- _this.dateChange.emit(new MatDatepickerInputEvent(_this, _this._elementRef.nativeElement));
- }));
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatDatepickerInput.prototype, "matDatepickerFilter", {
- /** Function that can be used to filter out dates within the datepicker. */
- set: /**
- * Function that can be used to filter out dates within the datepicker.
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._dateFilter = value;
- this._validatorOnChange();
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatDatepickerInput.prototype, "value", {
- /** The value of the input. */
- get: /**
- * The value of the input.
- * @return {?}
- */
- function () { return this._value; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- value = this._dateAdapter.deserialize(value);
- this._lastValueValid = !value || this._dateAdapter.isValid(value);
- value = this._getValidDateOrNull(value);
- /** @type {?} */
- var oldDate = this.value;
- this._value = value;
- this._formatValue(value);
- if (!this._dateAdapter.sameDate(oldDate, value)) {
- this._valueChange.emit(value);
- }
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatDatepickerInput.prototype, "min", {
- /** The minimum valid date. */
- get: /**
- * The minimum valid date.
- * @return {?}
- */
- function () { return this._min; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._min = this._getValidDateOrNull(this._dateAdapter.deserialize(value));
- this._validatorOnChange();
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatDatepickerInput.prototype, "max", {
- /** The maximum valid date. */
- get: /**
- * The maximum valid date.
- * @return {?}
- */
- function () { return this._max; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._max = this._getValidDateOrNull(this._dateAdapter.deserialize(value));
- this._validatorOnChange();
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatDatepickerInput.prototype, "disabled", {
- /** Whether the datepicker-input is disabled. */
- get: /**
- * Whether the datepicker-input is disabled.
- * @return {?}
- */
- function () { return !!this._disabled; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- /** @type {?} */
- var newValue = coercion.coerceBooleanProperty(value);
- /** @type {?} */
- var element = this._elementRef.nativeElement;
- if (this._disabled !== newValue) {
- this._disabled = newValue;
- this._disabledChange.emit(newValue);
- }
- // We need to null check the `blur` method, because it's undefined during SSR.
- if (newValue && element.blur) {
- // Normally, native input elements automatically blur if they turn disabled. This behavior
- // is problematic, because it would mean that it triggers another change detection cycle,
- // which then causes a changed after checked error if the input element was focused before.
- element.blur();
- }
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- MatDatepickerInput.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- this._datepickerSubscription.unsubscribe();
- this._localeSubscription.unsubscribe();
- this._valueChange.complete();
- this._disabledChange.complete();
- };
- /** @docs-private */
- /**
- * \@docs-private
- * @param {?} fn
- * @return {?}
- */
- MatDatepickerInput.prototype.registerOnValidatorChange = /**
- * \@docs-private
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- this._validatorOnChange = fn;
- };
- /** @docs-private */
- /**
- * \@docs-private
- * @param {?} c
- * @return {?}
- */
- MatDatepickerInput.prototype.validate = /**
- * \@docs-private
- * @param {?} c
- * @return {?}
- */
- function (c) {
- return this._validator ? this._validator(c) : null;
- };
- /**
- * @deprecated
- * @breaking-change 8.0.0 Use `getConnectedOverlayOrigin` instead
- */
- /**
- * @deprecated
- * \@breaking-change 8.0.0 Use `getConnectedOverlayOrigin` instead
- * @return {?}
- */
- MatDatepickerInput.prototype.getPopupConnectionElementRef = /**
- * @deprecated
- * \@breaking-change 8.0.0 Use `getConnectedOverlayOrigin` instead
- * @return {?}
- */
- function () {
- return this.getConnectedOverlayOrigin();
- };
- /**
- * Gets the element that the datepicker popup should be connected to.
- * @return The element to connect the popup to.
- */
- /**
- * Gets the element that the datepicker popup should be connected to.
- * @return {?} The element to connect the popup to.
- */
- MatDatepickerInput.prototype.getConnectedOverlayOrigin = /**
- * Gets the element that the datepicker popup should be connected to.
- * @return {?} The element to connect the popup to.
- */
- function () {
- return this._formField ? this._formField.getConnectedOverlayOrigin() : this._elementRef;
- };
- // Implemented as part of ControlValueAccessor.
- // Implemented as part of ControlValueAccessor.
- /**
- * @param {?} value
- * @return {?}
- */
- MatDatepickerInput.prototype.writeValue =
- // Implemented as part of ControlValueAccessor.
- /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this.value = value;
- };
- // Implemented as part of ControlValueAccessor.
- // Implemented as part of ControlValueAccessor.
- /**
- * @param {?} fn
- * @return {?}
- */
- MatDatepickerInput.prototype.registerOnChange =
- // Implemented as part of ControlValueAccessor.
- /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- this._cvaOnChange = fn;
- };
- // Implemented as part of ControlValueAccessor.
- // Implemented as part of ControlValueAccessor.
- /**
- * @param {?} fn
- * @return {?}
- */
- MatDatepickerInput.prototype.registerOnTouched =
- // Implemented as part of ControlValueAccessor.
- /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- this._onTouched = fn;
- };
- // Implemented as part of ControlValueAccessor.
- // Implemented as part of ControlValueAccessor.
- /**
- * @param {?} isDisabled
- * @return {?}
- */
- MatDatepickerInput.prototype.setDisabledState =
- // Implemented as part of ControlValueAccessor.
- /**
- * @param {?} isDisabled
- * @return {?}
- */
- function (isDisabled) {
- this.disabled = isDisabled;
- };
- /**
- * @param {?} event
- * @return {?}
- */
- MatDatepickerInput.prototype._onKeydown = /**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- /** @type {?} */
- var isAltDownArrow = event.altKey && event.keyCode === keycodes.DOWN_ARROW;
- if (this._datepicker && isAltDownArrow && !this._elementRef.nativeElement.readOnly) {
- this._datepicker.open();
- event.preventDefault();
- }
- };
- /**
- * @param {?} value
- * @return {?}
- */
- MatDatepickerInput.prototype._onInput = /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- /** @type {?} */
- var date = this._dateAdapter.parse(value, this._dateFormats.parse.dateInput);
- this._lastValueValid = !date || this._dateAdapter.isValid(date);
- date = this._getValidDateOrNull(date);
- if (!this._dateAdapter.sameDate(date, this._value)) {
- this._value = date;
- this._cvaOnChange(date);
- this._valueChange.emit(date);
- this.dateInput.emit(new MatDatepickerInputEvent(this, this._elementRef.nativeElement));
- }
- else {
- this._validatorOnChange();
- }
- };
- /**
- * @return {?}
- */
- MatDatepickerInput.prototype._onChange = /**
- * @return {?}
- */
- function () {
- this.dateChange.emit(new MatDatepickerInputEvent(this, this._elementRef.nativeElement));
- };
- /** Returns the palette used by the input's form field, if any. */
- /**
- * Returns the palette used by the input's form field, if any.
- * @return {?}
- */
- MatDatepickerInput.prototype._getThemePalette = /**
- * Returns the palette used by the input's form field, if any.
- * @return {?}
- */
- function () {
- return this._formField ? this._formField.color : undefined;
- };
- /** Handles blur events on the input. */
- /**
- * Handles blur events on the input.
- * @return {?}
- */
- MatDatepickerInput.prototype._onBlur = /**
- * Handles blur events on the input.
- * @return {?}
- */
- function () {
- // Reformat the input only if we have a valid value.
- if (this.value) {
- this._formatValue(this.value);
- }
- this._onTouched();
- };
- /** Formats a value and sets it on the input element. */
- /**
- * Formats a value and sets it on the input element.
- * @private
- * @param {?} value
- * @return {?}
- */
- MatDatepickerInput.prototype._formatValue = /**
- * Formats a value and sets it on the input element.
- * @private
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._elementRef.nativeElement.value =
- value ? this._dateAdapter.format(value, this._dateFormats.display.dateInput) : '';
- };
- /**
- * @param obj The object to check.
- * @returns The given object if it is both a date instance and valid, otherwise null.
- */
- /**
- * @private
- * @param {?} obj The object to check.
- * @return {?} The given object if it is both a date instance and valid, otherwise null.
- */
- MatDatepickerInput.prototype._getValidDateOrNull = /**
- * @private
- * @param {?} obj The object to check.
- * @return {?} The given object if it is both a date instance and valid, otherwise null.
- */
- function (obj) {
- return (this._dateAdapter.isDateInstance(obj) && this._dateAdapter.isValid(obj)) ? obj : null;
- };
- MatDatepickerInput.decorators = [
- { type: core.Directive, args: [{
- selector: 'input[matDatepicker]',
- providers: [
- MAT_DATEPICKER_VALUE_ACCESSOR,
- MAT_DATEPICKER_VALIDATORS,
- { provide: MAT_INPUT_VALUE_ACCESSOR, useExisting: MatDatepickerInput },
- ],
- host: {
- '[attr.aria-haspopup]': '_datepicker ? "dialog" : null',
- '[attr.aria-owns]': '(_datepicker?.opened && _datepicker.id) || null',
- '[attr.min]': 'min ? _dateAdapter.toIso8601(min) : null',
- '[attr.max]': 'max ? _dateAdapter.toIso8601(max) : null',
- '[disabled]': 'disabled',
- '(input)': '_onInput($event.target.value)',
- '(change)': '_onChange()',
- '(blur)': '_onBlur()',
- '(keydown)': '_onKeydown($event)',
- },
- exportAs: 'matDatepickerInput',
- },] },
- ];
- /** @nocollapse */
- MatDatepickerInput.ctorParameters = function () { return [
- { type: core.ElementRef },
- { type: DateAdapter, decorators: [{ type: core.Optional }] },
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_DATE_FORMATS,] }] },
- { type: MatFormField, decorators: [{ type: core.Optional }] }
- ]; };
- MatDatepickerInput.propDecorators = {
- matDatepicker: [{ type: core.Input }],
- matDatepickerFilter: [{ type: core.Input }],
- value: [{ type: core.Input }],
- min: [{ type: core.Input }],
- max: [{ type: core.Input }],
- disabled: [{ type: core.Input }],
- dateChange: [{ type: core.Output }],
- dateInput: [{ type: core.Output }]
- };
- return MatDatepickerInput;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Can be used to override the icon of a `matDatepickerToggle`.
- */
- var MatDatepickerToggleIcon = /** @class */ (function () {
- function MatDatepickerToggleIcon() {
- }
- MatDatepickerToggleIcon.decorators = [
- { type: core.Directive, args: [{
- selector: '[matDatepickerToggleIcon]'
- },] },
- ];
- return MatDatepickerToggleIcon;
- }());
- /**
- * @template D
- */
- var MatDatepickerToggle = /** @class */ (function () {
- function MatDatepickerToggle(_intl, _changeDetectorRef, defaultTabIndex) {
- this._intl = _intl;
- this._changeDetectorRef = _changeDetectorRef;
- this._stateChanges = rxjs.Subscription.EMPTY;
- /** @type {?} */
- var parsedTabIndex = Number(defaultTabIndex);
- this.tabIndex = (parsedTabIndex || parsedTabIndex === 0) ? parsedTabIndex : null;
- }
- Object.defineProperty(MatDatepickerToggle.prototype, "disabled", {
- /** Whether the toggle button is disabled. */
- get: /**
- * Whether the toggle button is disabled.
- * @return {?}
- */
- function () {
- if (this._disabled === undefined && this.datepicker) {
- return this.datepicker.disabled;
- }
- return !!this._disabled;
- },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._disabled = coercion.coerceBooleanProperty(value);
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @param {?} changes
- * @return {?}
- */
- MatDatepickerToggle.prototype.ngOnChanges = /**
- * @param {?} changes
- * @return {?}
- */
- function (changes) {
- if (changes['datepicker']) {
- this._watchStateChanges();
- }
- };
- /**
- * @return {?}
- */
- MatDatepickerToggle.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- this._stateChanges.unsubscribe();
- };
- /**
- * @return {?}
- */
- MatDatepickerToggle.prototype.ngAfterContentInit = /**
- * @return {?}
- */
- function () {
- this._watchStateChanges();
- };
- /**
- * @param {?} event
- * @return {?}
- */
- MatDatepickerToggle.prototype._open = /**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- if (this.datepicker && !this.disabled) {
- this.datepicker.open();
- event.stopPropagation();
- }
- };
- /**
- * @private
- * @return {?}
- */
- MatDatepickerToggle.prototype._watchStateChanges = /**
- * @private
- * @return {?}
- */
- function () {
- var _this = this;
- /** @type {?} */
- var datepickerDisabled = this.datepicker ? this.datepicker._disabledChange : rxjs.of();
- /** @type {?} */
- var inputDisabled = this.datepicker && this.datepicker._datepickerInput ?
- this.datepicker._datepickerInput._disabledChange : rxjs.of();
- /** @type {?} */
- var datepickerToggled = this.datepicker ?
- rxjs.merge(this.datepicker.openedStream, this.datepicker.closedStream) :
- rxjs.of();
- this._stateChanges.unsubscribe();
- this._stateChanges = rxjs.merge(this._intl.changes, datepickerDisabled, inputDisabled, datepickerToggled).subscribe((/**
- * @return {?}
- */
- function () { return _this._changeDetectorRef.markForCheck(); }));
- };
- MatDatepickerToggle.decorators = [
- { type: core.Component, args: [{selector: 'mat-datepicker-toggle',
- 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>",
- 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}"],
- host: {
- 'class': 'mat-datepicker-toggle',
- // Always set the tabindex to -1 so that it doesn't overlap with any custom tabindex the
- // consumer may have provided, while still being able to receive focus.
- '[attr.tabindex]': '-1',
- '[class.mat-datepicker-toggle-active]': 'datepicker && datepicker.opened',
- '[class.mat-accent]': 'datepicker && datepicker.color === "accent"',
- '[class.mat-warn]': 'datepicker && datepicker.color === "warn"',
- '(focus)': '_button.focus()',
- },
- exportAs: 'matDatepickerToggle',
- encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- },] },
- ];
- /** @nocollapse */
- MatDatepickerToggle.ctorParameters = function () { return [
- { type: MatDatepickerIntl },
- { type: core.ChangeDetectorRef },
- { type: String, decorators: [{ type: core.Attribute, args: ['tabindex',] }] }
- ]; };
- MatDatepickerToggle.propDecorators = {
- datepicker: [{ type: core.Input, args: ['for',] }],
- tabIndex: [{ type: core.Input }],
- disabled: [{ type: core.Input }],
- disableRipple: [{ type: core.Input }],
- _customIcon: [{ type: core.ContentChild, args: [MatDatepickerToggleIcon, { static: false },] }],
- _button: [{ type: core.ViewChild, args: ['button', { static: false },] }]
- };
- return MatDatepickerToggle;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var MatDatepickerModule = /** @class */ (function () {
- function MatDatepickerModule() {
- }
- MatDatepickerModule.decorators = [
- { type: core.NgModule, args: [{
- imports: [
- common.CommonModule,
- MatButtonModule,
- MatDialogModule,
- overlay.OverlayModule,
- a11y.A11yModule,
- portal.PortalModule,
- ],
- exports: [
- MatCalendar,
- MatCalendarBody,
- MatDatepicker,
- MatDatepickerContent,
- MatDatepickerInput,
- MatDatepickerToggle,
- MatDatepickerToggleIcon,
- MatMonthView,
- MatYearView,
- MatMultiYearView,
- MatCalendarHeader,
- ],
- declarations: [
- MatCalendar,
- MatCalendarBody,
- MatDatepicker,
- MatDatepickerContent,
- MatDatepickerInput,
- MatDatepickerToggle,
- MatDatepickerToggleIcon,
- MatMonthView,
- MatYearView,
- MatMultiYearView,
- MatCalendarHeader,
- ],
- providers: [
- MatDatepickerIntl,
- MAT_DATEPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER,
- ],
- entryComponents: [
- MatDatepickerContent,
- MatCalendarHeader,
- ]
- },] },
- ];
- return MatDatepickerModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var MatDivider = /** @class */ (function () {
- function MatDivider() {
- this._vertical = false;
- this._inset = false;
- }
- Object.defineProperty(MatDivider.prototype, "vertical", {
- /** Whether the divider is vertically aligned. */
- get: /**
- * Whether the divider is vertically aligned.
- * @return {?}
- */
- function () { return this._vertical; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) { this._vertical = coercion.coerceBooleanProperty(value); },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatDivider.prototype, "inset", {
- /** Whether the divider is an inset divider. */
- get: /**
- * Whether the divider is an inset divider.
- * @return {?}
- */
- function () { return this._inset; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) { this._inset = coercion.coerceBooleanProperty(value); },
- enumerable: true,
- configurable: true
- });
- MatDivider.decorators = [
- { type: core.Component, args: [{selector: 'mat-divider',
- host: {
- 'role': 'separator',
- '[attr.aria-orientation]': 'vertical ? "vertical" : "horizontal"',
- '[class.mat-divider-vertical]': 'vertical',
- '[class.mat-divider-horizontal]': '!vertical',
- '[class.mat-divider-inset]': 'inset',
- 'class': 'mat-divider'
- },
- template: '',
- 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}"],
- encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- },] },
- ];
- MatDivider.propDecorators = {
- vertical: [{ type: core.Input }],
- inset: [{ type: core.Input }]
- };
- return MatDivider;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var MatDividerModule = /** @class */ (function () {
- function MatDividerModule() {
- }
- MatDividerModule.decorators = [
- { type: core.NgModule, args: [{
- imports: [MatCommonModule, common.CommonModule],
- exports: [MatDivider, MatCommonModule],
- declarations: [MatDivider],
- },] },
- ];
- return MatDividerModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Token used to provide a `MatAccordion` to `MatExpansionPanel`.
- * Used primarily to avoid circular imports between `MatAccordion` and `MatExpansionPanel`.
- * @type {?}
- */
- var MAT_ACCORDION = new core.InjectionToken('MAT_ACCORDION');
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Time and timing curve for expansion panel animations.
- * @type {?}
- */
- var EXPANSION_PANEL_ANIMATION_TIMING = '225ms cubic-bezier(0.4,0.0,0.2,1)';
- /**
- * Animations used by the Material expansion panel.
- *
- * A bug in angular animation's `state` when ViewContainers are moved using ViewContainerRef.move()
- * causes the animation state of moved components to become `void` upon exit, and not update again
- * upon reentry into the DOM. This can lead a to situation for the expansion panel where the state
- * of the panel is `expanded` or `collapsed` but the animation state is `void`.
- *
- * To correctly handle animating to the next state, we animate between `void` and `collapsed` which
- * are defined to have the same styles. Since angular animates from the current styles to the
- * destination state's style definition, in situations where we are moving from `void`'s styles to
- * `collapsed` this acts a noop since no style values change.
- *
- * In the case where angular's animation state is out of sync with the expansion panel's state, the
- * expansion panel being `expanded` and angular animations being `void`, the animation from the
- * `expanded`'s effective styles (though in a `void` animation state) to the collapsed state will
- * occur as expected.
- *
- * Angular Bug: https://github.com/angular/angular/issues/18847
- *
- * \@docs-private
- * @type {?}
- */
- var matExpansionAnimations = {
- /**
- * Animation that rotates the indicator arrow.
- */
- indicatorRotate: animations$1.trigger('indicatorRotate', [
- animations$1.state('collapsed, void', animations$1.style({ transform: 'rotate(0deg)' })),
- animations$1.state('expanded', animations$1.style({ transform: 'rotate(180deg)' })),
- animations$1.transition('expanded <=> collapsed, void => collapsed', animations$1.animate(EXPANSION_PANEL_ANIMATION_TIMING)),
- ]),
- /**
- * Animation that expands and collapses the panel header height.
- */
- expansionHeaderHeight: animations$1.trigger('expansionHeight', [
- animations$1.state('collapsed, void', animations$1.style({
- height: '{{collapsedHeight}}',
- }), {
- params: { collapsedHeight: '48px' },
- }),
- animations$1.state('expanded', animations$1.style({
- height: '{{expandedHeight}}'
- }), {
- params: { expandedHeight: '64px' }
- }),
- animations$1.transition('expanded <=> collapsed, void => collapsed', animations$1.group([
- animations$1.query('@indicatorRotate', animations$1.animateChild(), { optional: true }),
- animations$1.animate(EXPANSION_PANEL_ANIMATION_TIMING),
- ])),
- ]),
- /**
- * Animation that expands and collapses the panel content.
- */
- bodyExpansion: animations$1.trigger('bodyExpansion', [
- animations$1.state('collapsed, void', animations$1.style({ height: '0px', visibility: 'hidden' })),
- animations$1.state('expanded', animations$1.style({ height: '*', visibility: 'visible' })),
- animations$1.transition('expanded <=> collapsed, void => collapsed', animations$1.animate(EXPANSION_PANEL_ANIMATION_TIMING)),
- ])
- };
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Expansion panel content that will be rendered lazily
- * after the panel is opened for the first time.
- */
- var MatExpansionPanelContent = /** @class */ (function () {
- function MatExpansionPanelContent(_template) {
- this._template = _template;
- }
- MatExpansionPanelContent.decorators = [
- { type: core.Directive, args: [{
- selector: 'ng-template[matExpansionPanelContent]'
- },] },
- ];
- /** @nocollapse */
- MatExpansionPanelContent.ctorParameters = function () { return [
- { type: core.TemplateRef }
- ]; };
- return MatExpansionPanelContent;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Counter for generating unique element ids.
- * @type {?}
- */
- var uniqueId$1 = 0;
- /**
- * Injection token that can be used to configure the defalt
- * options for the expansion panel component.
- * @type {?}
- */
- var MAT_EXPANSION_PANEL_DEFAULT_OPTIONS = new core.InjectionToken('MAT_EXPANSION_PANEL_DEFAULT_OPTIONS');
- var ɵ0$4 = undefined;
- /**
- * `<mat-expansion-panel>`
- *
- * This component can be used as a single element to show expandable content, or as one of
- * multiple children of an element with the MatAccordion directive attached.
- */
- var MatExpansionPanel = /** @class */ (function (_super) {
- __extends(MatExpansionPanel, _super);
- function MatExpansionPanel(accordion$$1, _changeDetectorRef, _uniqueSelectionDispatcher, _viewContainerRef, _document, _animationMode, defaultOptions) {
- var _this = _super.call(this, accordion$$1, _changeDetectorRef, _uniqueSelectionDispatcher) || this;
- _this._viewContainerRef = _viewContainerRef;
- _this._animationMode = _animationMode;
- _this._hideToggle = false;
- /**
- * An event emitted after the body's expansion animation happens.
- */
- _this.afterExpand = new core.EventEmitter();
- /**
- * An event emitted after the body's collapse animation happens.
- */
- _this.afterCollapse = new core.EventEmitter();
- /**
- * Stream that emits for changes in `\@Input` properties.
- */
- _this._inputChanges = new rxjs.Subject();
- /**
- * ID for the associated header element. Used for a11y labelling.
- */
- _this._headerId = "mat-expansion-panel-header-" + uniqueId$1++;
- /**
- * Stream of body animation done events.
- */
- _this._bodyAnimationDone = new rxjs.Subject();
- _this.accordion = accordion$$1;
- _this._document = _document;
- // We need a Subject with distinctUntilChanged, because the `done` event
- // fires twice on some browsers. See https://github.com/angular/angular/issues/24084
- _this._bodyAnimationDone.pipe(operators.distinctUntilChanged((/**
- * @param {?} x
- * @param {?} y
- * @return {?}
- */
- function (x, y) {
- return x.fromState === y.fromState && x.toState === y.toState;
- }))).subscribe((/**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- if (event.fromState !== 'void') {
- if (event.toState === 'expanded') {
- _this.afterExpand.emit();
- }
- else if (event.toState === 'collapsed') {
- _this.afterCollapse.emit();
- }
- }
- }));
- if (defaultOptions) {
- _this.hideToggle = defaultOptions.hideToggle;
- }
- return _this;
- }
- Object.defineProperty(MatExpansionPanel.prototype, "hideToggle", {
- /** Whether the toggle indicator should be hidden. */
- get: /**
- * Whether the toggle indicator should be hidden.
- * @return {?}
- */
- function () {
- return this._hideToggle || (this.accordion && this.accordion.hideToggle);
- },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._hideToggle = coercion.coerceBooleanProperty(value);
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatExpansionPanel.prototype, "togglePosition", {
- /** The position of the expansion indicator. */
- get: /**
- * The position of the expansion indicator.
- * @return {?}
- */
- function () {
- return this._togglePosition || (this.accordion && this.accordion.togglePosition);
- },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._togglePosition = value;
- },
- enumerable: true,
- configurable: true
- });
- /** Determines whether the expansion panel should have spacing between it and its siblings. */
- /**
- * Determines whether the expansion panel should have spacing between it and its siblings.
- * @return {?}
- */
- MatExpansionPanel.prototype._hasSpacing = /**
- * Determines whether the expansion panel should have spacing between it and its siblings.
- * @return {?}
- */
- function () {
- if (this.accordion) {
- // We don't need to subscribe to the `stateChanges` of the parent accordion because each time
- // the [displayMode] input changes, the change detection will also cover the host bindings
- // of this expansion panel.
- return (this.expanded ? this.accordion.displayMode : this._getExpandedState()) === 'default';
- }
- return false;
- };
- /** Gets the expanded state string. */
- /**
- * Gets the expanded state string.
- * @return {?}
- */
- MatExpansionPanel.prototype._getExpandedState = /**
- * Gets the expanded state string.
- * @return {?}
- */
- function () {
- return this.expanded ? 'expanded' : 'collapsed';
- };
- /**
- * @return {?}
- */
- MatExpansionPanel.prototype.ngAfterContentInit = /**
- * @return {?}
- */
- function () {
- var _this = this;
- if (this._lazyContent) {
- // Render the content as soon as the panel becomes open.
- this.opened.pipe(operators.startWith((/** @type {?} */ (null))), operators.filter((/**
- * @return {?}
- */
- function () { return _this.expanded && !_this._portal; })), operators.take(1)).subscribe((/**
- * @return {?}
- */
- function () {
- _this._portal = new portal.TemplatePortal(_this._lazyContent._template, _this._viewContainerRef);
- }));
- }
- };
- /**
- * @param {?} changes
- * @return {?}
- */
- MatExpansionPanel.prototype.ngOnChanges = /**
- * @param {?} changes
- * @return {?}
- */
- function (changes) {
- this._inputChanges.next(changes);
- };
- /**
- * @return {?}
- */
- MatExpansionPanel.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- _super.prototype.ngOnDestroy.call(this);
- this._bodyAnimationDone.complete();
- this._inputChanges.complete();
- };
- /** Checks whether the expansion panel's content contains the currently-focused element. */
- /**
- * Checks whether the expansion panel's content contains the currently-focused element.
- * @return {?}
- */
- MatExpansionPanel.prototype._containsFocus = /**
- * Checks whether the expansion panel's content contains the currently-focused element.
- * @return {?}
- */
- function () {
- if (this._body) {
- /** @type {?} */
- var focusedElement = this._document.activeElement;
- /** @type {?} */
- var bodyElement = this._body.nativeElement;
- return focusedElement === bodyElement || bodyElement.contains(focusedElement);
- }
- return false;
- };
- MatExpansionPanel.decorators = [
- { 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}"],
- selector: 'mat-expansion-panel',
- exportAs: 'matExpansionPanel',
- 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>",
- encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- inputs: ['disabled', 'expanded'],
- outputs: ['opened', 'closed', 'expandedChange'],
- animations: [matExpansionAnimations.bodyExpansion],
- providers: [
- // Provide MatAccordion as undefined to prevent nested expansion panels from registering
- // to the same accordion.
- { provide: MAT_ACCORDION, useValue: ɵ0$4 },
- ],
- host: {
- 'class': 'mat-expansion-panel',
- '[class.mat-expanded]': 'expanded',
- '[class._mat-animation-noopable]': '_animationMode === "NoopAnimations"',
- '[class.mat-expansion-panel-spacing]': '_hasSpacing()',
- }
- },] },
- ];
- /** @nocollapse */
- MatExpansionPanel.ctorParameters = function () { return [
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.SkipSelf }, { type: core.Inject, args: [MAT_ACCORDION,] }] },
- { type: core.ChangeDetectorRef },
- { type: collections.UniqueSelectionDispatcher },
- { type: core.ViewContainerRef },
- { type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] },
- { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] },
- { type: undefined, decorators: [{ type: core.Inject, args: [MAT_EXPANSION_PANEL_DEFAULT_OPTIONS,] }, { type: core.Optional }] }
- ]; };
- MatExpansionPanel.propDecorators = {
- hideToggle: [{ type: core.Input }],
- togglePosition: [{ type: core.Input }],
- afterExpand: [{ type: core.Output }],
- afterCollapse: [{ type: core.Output }],
- _lazyContent: [{ type: core.ContentChild, args: [MatExpansionPanelContent, { static: false },] }],
- _body: [{ type: core.ViewChild, args: ['body', { static: false },] }]
- };
- return MatExpansionPanel;
- }(accordion.CdkAccordionItem));
- var MatExpansionPanelActionRow = /** @class */ (function () {
- function MatExpansionPanelActionRow() {
- }
- MatExpansionPanelActionRow.decorators = [
- { type: core.Directive, args: [{
- selector: 'mat-action-row',
- host: {
- class: 'mat-action-row'
- }
- },] },
- ];
- return MatExpansionPanelActionRow;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * `<mat-expansion-panel-header>`
- *
- * This component corresponds to the header element of an `<mat-expansion-panel>`.
- */
- var MatExpansionPanelHeader = /** @class */ (function () {
- function MatExpansionPanelHeader(panel, _element, _focusMonitor, _changeDetectorRef, defaultOptions) {
- var _this = this;
- this.panel = panel;
- this._element = _element;
- this._focusMonitor = _focusMonitor;
- this._changeDetectorRef = _changeDetectorRef;
- this._parentChangeSubscription = rxjs.Subscription.EMPTY;
- /**
- * Whether Angular animations in the panel header should be disabled.
- */
- this._animationsDisabled = true;
- /** @type {?} */
- var accordionHideToggleChange = panel.accordion ?
- panel.accordion._stateChanges.pipe(operators.filter((/**
- * @param {?} changes
- * @return {?}
- */
- function (changes) { return !!(changes['hideToggle'] || changes['togglePosition']); }))) :
- rxjs.EMPTY;
- // Since the toggle state depends on an @Input on the panel, we
- // need to subscribe and trigger change detection manually.
- this._parentChangeSubscription =
- rxjs.merge(panel.opened, panel.closed, accordionHideToggleChange, panel._inputChanges.pipe(operators.filter((/**
- * @param {?} changes
- * @return {?}
- */
- function (changes) {
- return !!(changes['hideToggle'] ||
- changes['disabled'] ||
- changes['togglePosition']);
- }))))
- .subscribe((/**
- * @return {?}
- */
- function () { return _this._changeDetectorRef.markForCheck(); }));
- // Avoids focus being lost if the panel contained the focused element and was closed.
- panel.closed
- .pipe(operators.filter((/**
- * @return {?}
- */
- function () { return panel._containsFocus(); })))
- .subscribe((/**
- * @return {?}
- */
- function () { return _focusMonitor.focusVia(_element, 'program'); }));
- _focusMonitor.monitor(_element).subscribe((/**
- * @param {?} origin
- * @return {?}
- */
- function (origin) {
- if (origin && panel.accordion) {
- panel.accordion._handleHeaderFocus(_this);
- }
- }));
- if (defaultOptions) {
- this.expandedHeight = defaultOptions.expandedHeight;
- this.collapsedHeight = defaultOptions.collapsedHeight;
- }
- }
- /**
- * @return {?}
- */
- MatExpansionPanelHeader.prototype._animationStarted = /**
- * @return {?}
- */
- function () {
- // Currently the `expansionHeight` animation has a `void => collapsed` transition which is
- // there to work around a bug in Angular (see #13088), however this introduces a different
- // issue. The new transition will cause the header to animate in on init (see #16067), if the
- // consumer has set a header height that is different from the default one. We work around it
- // by disabling animations on the header and re-enabling them after the first animation has run.
- // Note that Angular dispatches animation events even if animations are disabled. Ideally this
- // wouldn't be necessary if we remove the `void => collapsed` transition, but we have to wait
- // for https://github.com/angular/angular/issues/18847 to be resolved.
- this._animationsDisabled = false;
- };
- Object.defineProperty(MatExpansionPanelHeader.prototype, "disabled", {
- /**
- * Whether the associated panel is disabled. Implemented as a part of `FocusableOption`.
- * @docs-private
- */
- get: /**
- * Whether the associated panel is disabled. Implemented as a part of `FocusableOption`.
- * \@docs-private
- * @return {?}
- */
- function () {
- return this.panel.disabled;
- },
- enumerable: true,
- configurable: true
- });
- /** Toggles the expanded state of the panel. */
- /**
- * Toggles the expanded state of the panel.
- * @return {?}
- */
- MatExpansionPanelHeader.prototype._toggle = /**
- * Toggles the expanded state of the panel.
- * @return {?}
- */
- function () {
- this.panel.toggle();
- };
- /** Gets whether the panel is expanded. */
- /**
- * Gets whether the panel is expanded.
- * @return {?}
- */
- MatExpansionPanelHeader.prototype._isExpanded = /**
- * Gets whether the panel is expanded.
- * @return {?}
- */
- function () {
- return this.panel.expanded;
- };
- /** Gets the expanded state string of the panel. */
- /**
- * Gets the expanded state string of the panel.
- * @return {?}
- */
- MatExpansionPanelHeader.prototype._getExpandedState = /**
- * Gets the expanded state string of the panel.
- * @return {?}
- */
- function () {
- return this.panel._getExpandedState();
- };
- /** Gets the panel id. */
- /**
- * Gets the panel id.
- * @return {?}
- */
- MatExpansionPanelHeader.prototype._getPanelId = /**
- * Gets the panel id.
- * @return {?}
- */
- function () {
- return this.panel.id;
- };
- /** Gets the toggle position for the header. */
- /**
- * Gets the toggle position for the header.
- * @return {?}
- */
- MatExpansionPanelHeader.prototype._getTogglePosition = /**
- * Gets the toggle position for the header.
- * @return {?}
- */
- function () {
- return this.panel.togglePosition;
- };
- /** Gets whether the expand indicator should be shown. */
- /**
- * Gets whether the expand indicator should be shown.
- * @return {?}
- */
- MatExpansionPanelHeader.prototype._showToggle = /**
- * Gets whether the expand indicator should be shown.
- * @return {?}
- */
- function () {
- return !this.panel.hideToggle && !this.panel.disabled;
- };
- /** Handle keydown event calling to toggle() if appropriate. */
- /**
- * Handle keydown event calling to toggle() if appropriate.
- * @param {?} event
- * @return {?}
- */
- MatExpansionPanelHeader.prototype._keydown = /**
- * Handle keydown event calling to toggle() if appropriate.
- * @param {?} event
- * @return {?}
- */
- function (event) {
- switch (event.keyCode) {
- // Toggle for space and enter keys.
- case keycodes.SPACE:
- case keycodes.ENTER:
- if (!keycodes.hasModifierKey(event)) {
- event.preventDefault();
- this._toggle();
- }
- break;
- default:
- if (this.panel.accordion) {
- this.panel.accordion._handleHeaderKeydown(event);
- }
- return;
- }
- };
- /**
- * Focuses the panel header. Implemented as a part of `FocusableOption`.
- * @param origin Origin of the action that triggered the focus.
- * @docs-private
- */
- /**
- * Focuses the panel header. Implemented as a part of `FocusableOption`.
- * \@docs-private
- * @param {?=} origin Origin of the action that triggered the focus.
- * @param {?=} options
- * @return {?}
- */
- MatExpansionPanelHeader.prototype.focus = /**
- * Focuses the panel header. Implemented as a part of `FocusableOption`.
- * \@docs-private
- * @param {?=} origin Origin of the action that triggered the focus.
- * @param {?=} options
- * @return {?}
- */
- function (origin, options) {
- if (origin === void 0) { origin = 'program'; }
- this._focusMonitor.focusVia(this._element, origin, options);
- };
- /**
- * @return {?}
- */
- MatExpansionPanelHeader.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- this._parentChangeSubscription.unsubscribe();
- this._focusMonitor.stopMonitoring(this._element);
- };
- MatExpansionPanelHeader.decorators = [
- { type: core.Component, args: [{selector: 'mat-expansion-panel-header',
- 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}"],
- 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>",
- encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- animations: [
- matExpansionAnimations.indicatorRotate,
- matExpansionAnimations.expansionHeaderHeight
- ],
- host: {
- 'class': 'mat-expansion-panel-header',
- 'role': 'button',
- '[attr.id]': 'panel._headerId',
- '[attr.tabindex]': 'disabled ? -1 : 0',
- '[attr.aria-controls]': '_getPanelId()',
- '[attr.aria-expanded]': '_isExpanded()',
- '[attr.aria-disabled]': 'panel.disabled',
- '[class.mat-expanded]': '_isExpanded()',
- '[class.mat-expansion-toggle-indicator-after]': "_getTogglePosition() === 'after'",
- '[class.mat-expansion-toggle-indicator-before]': "_getTogglePosition() === 'before'",
- '(click)': '_toggle()',
- '(keydown)': '_keydown($event)',
- '[@.disabled]': '_animationsDisabled',
- '(@expansionHeight.start)': '_animationStarted()',
- '[@expansionHeight]': "{\n value: _getExpandedState(),\n params: {\n collapsedHeight: collapsedHeight,\n expandedHeight: expandedHeight\n }\n }",
- },
- },] },
- ];
- /** @nocollapse */
- MatExpansionPanelHeader.ctorParameters = function () { return [
- { type: MatExpansionPanel, decorators: [{ type: core.Host }] },
- { type: core.ElementRef },
- { type: a11y.FocusMonitor },
- { type: core.ChangeDetectorRef },
- { type: undefined, decorators: [{ type: core.Inject, args: [MAT_EXPANSION_PANEL_DEFAULT_OPTIONS,] }, { type: core.Optional }] }
- ]; };
- MatExpansionPanelHeader.propDecorators = {
- expandedHeight: [{ type: core.Input }],
- collapsedHeight: [{ type: core.Input }]
- };
- return MatExpansionPanelHeader;
- }());
- /**
- * `<mat-panel-description>`
- *
- * This directive is to be used inside of the MatExpansionPanelHeader component.
- */
- var MatExpansionPanelDescription = /** @class */ (function () {
- function MatExpansionPanelDescription() {
- }
- MatExpansionPanelDescription.decorators = [
- { type: core.Directive, args: [{
- selector: 'mat-panel-description',
- host: {
- class: 'mat-expansion-panel-header-description'
- }
- },] },
- ];
- return MatExpansionPanelDescription;
- }());
- /**
- * `<mat-panel-title>`
- *
- * This directive is to be used inside of the MatExpansionPanelHeader component.
- */
- var MatExpansionPanelTitle = /** @class */ (function () {
- function MatExpansionPanelTitle() {
- }
- MatExpansionPanelTitle.decorators = [
- { type: core.Directive, args: [{
- selector: 'mat-panel-title',
- host: {
- class: 'mat-expansion-panel-header-title'
- }
- },] },
- ];
- return MatExpansionPanelTitle;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Directive for a Material Design Accordion.
- */
- var MatAccordion = /** @class */ (function (_super) {
- __extends(MatAccordion, _super);
- function MatAccordion() {
- var _this = _super !== null && _super.apply(this, arguments) || this;
- _this._hideToggle = false;
- /**
- * Display mode used for all expansion panels in the accordion. Currently two display
- * modes exist:
- * default - a gutter-like spacing is placed around any expanded panel, placing the expanded
- * panel at a different elevation from the rest of the accordion.
- * flat - no spacing is placed around expanded panels, showing all panels at the same
- * elevation.
- */
- _this.displayMode = 'default';
- /**
- * The position of the expansion indicator.
- */
- _this.togglePosition = 'after';
- return _this;
- }
- Object.defineProperty(MatAccordion.prototype, "hideToggle", {
- /** Whether the expansion indicator should be hidden. */
- get: /**
- * Whether the expansion indicator should be hidden.
- * @return {?}
- */
- function () { return this._hideToggle; },
- set: /**
- * @param {?} show
- * @return {?}
- */
- function (show) { this._hideToggle = coercion.coerceBooleanProperty(show); },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- MatAccordion.prototype.ngAfterContentInit = /**
- * @return {?}
- */
- function () {
- this._keyManager = new a11y.FocusKeyManager(this._headers).withWrap();
- };
- /** Handles keyboard events coming in from the panel headers. */
- /**
- * Handles keyboard events coming in from the panel headers.
- * @param {?} event
- * @return {?}
- */
- MatAccordion.prototype._handleHeaderKeydown = /**
- * Handles keyboard events coming in from the panel headers.
- * @param {?} event
- * @return {?}
- */
- function (event) {
- var keyCode = event.keyCode;
- /** @type {?} */
- var manager = this._keyManager;
- if (keyCode === keycodes.HOME) {
- if (!keycodes.hasModifierKey(event)) {
- manager.setFirstItemActive();
- event.preventDefault();
- }
- }
- else if (keyCode === keycodes.END) {
- if (!keycodes.hasModifierKey(event)) {
- manager.setLastItemActive();
- event.preventDefault();
- }
- }
- else {
- this._keyManager.onKeydown(event);
- }
- };
- /**
- * @param {?} header
- * @return {?}
- */
- MatAccordion.prototype._handleHeaderFocus = /**
- * @param {?} header
- * @return {?}
- */
- function (header) {
- this._keyManager.updateActiveItem(header);
- };
- MatAccordion.decorators = [
- { type: core.Directive, args: [{
- selector: 'mat-accordion',
- exportAs: 'matAccordion',
- inputs: ['multi'],
- providers: [{
- provide: MAT_ACCORDION,
- useExisting: MatAccordion
- }],
- host: {
- class: 'mat-accordion'
- }
- },] },
- ];
- MatAccordion.propDecorators = {
- _headers: [{ type: core.ContentChildren, args: [MatExpansionPanelHeader, { descendants: true },] }],
- hideToggle: [{ type: core.Input }],
- displayMode: [{ type: core.Input }],
- togglePosition: [{ type: core.Input }]
- };
- return MatAccordion;
- }(accordion.CdkAccordion));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var MatExpansionModule = /** @class */ (function () {
- function MatExpansionModule() {
- }
- MatExpansionModule.decorators = [
- { type: core.NgModule, args: [{
- imports: [common.CommonModule, accordion.CdkAccordionModule, portal.PortalModule],
- exports: [
- MatAccordion,
- MatExpansionPanel,
- MatExpansionPanelActionRow,
- MatExpansionPanelHeader,
- MatExpansionPanelTitle,
- MatExpansionPanelDescription,
- MatExpansionPanelContent,
- ],
- declarations: [
- MatAccordion,
- MatExpansionPanel,
- MatExpansionPanelActionRow,
- MatExpansionPanelHeader,
- MatExpansionPanelTitle,
- MatExpansionPanelDescription,
- MatExpansionPanelContent,
- ],
- },] },
- ];
- return MatExpansionModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Injection token used to provide a grid list to a tile and to avoid circular imports.
- * \@docs-private
- * @type {?}
- */
- var MAT_GRID_LIST = new core.InjectionToken('MAT_GRID_LIST');
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var MatGridTile = /** @class */ (function () {
- function MatGridTile(_element, _gridList) {
- this._element = _element;
- this._gridList = _gridList;
- this._rowspan = 1;
- this._colspan = 1;
- }
- Object.defineProperty(MatGridTile.prototype, "rowspan", {
- /** Amount of rows that the grid tile takes up. */
- get: /**
- * Amount of rows that the grid tile takes up.
- * @return {?}
- */
- function () { return this._rowspan; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) { this._rowspan = Math.round(coercion.coerceNumberProperty(value)); },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatGridTile.prototype, "colspan", {
- /** Amount of columns that the grid tile takes up. */
- get: /**
- * Amount of columns that the grid tile takes up.
- * @return {?}
- */
- function () { return this._colspan; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) { this._colspan = Math.round(coercion.coerceNumberProperty(value)); },
- enumerable: true,
- configurable: true
- });
- /**
- * Sets the style of the grid-tile element. Needs to be set manually to avoid
- * "Changed after checked" errors that would occur with HostBinding.
- */
- /**
- * Sets the style of the grid-tile element. Needs to be set manually to avoid
- * "Changed after checked" errors that would occur with HostBinding.
- * @param {?} property
- * @param {?} value
- * @return {?}
- */
- MatGridTile.prototype._setStyle = /**
- * Sets the style of the grid-tile element. Needs to be set manually to avoid
- * "Changed after checked" errors that would occur with HostBinding.
- * @param {?} property
- * @param {?} value
- * @return {?}
- */
- function (property, value) {
- ((/** @type {?} */ (this._element.nativeElement.style)))[property] = value;
- };
- MatGridTile.decorators = [
- { type: core.Component, args: [{selector: 'mat-grid-tile',
- exportAs: 'matGridTile',
- host: {
- 'class': 'mat-grid-tile',
- },
- template: "<figure class=\"mat-figure\"><ng-content></ng-content></figure>",
- 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}"],
- encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- },] },
- ];
- /** @nocollapse */
- MatGridTile.ctorParameters = function () { return [
- { type: core.ElementRef },
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_GRID_LIST,] }] }
- ]; };
- MatGridTile.propDecorators = {
- rowspan: [{ type: core.Input }],
- colspan: [{ type: core.Input }]
- };
- return MatGridTile;
- }());
- var MatGridTileText = /** @class */ (function () {
- function MatGridTileText(_element) {
- this._element = _element;
- }
- /**
- * @return {?}
- */
- MatGridTileText.prototype.ngAfterContentInit = /**
- * @return {?}
- */
- function () {
- setLines(this._lines, this._element);
- };
- MatGridTileText.decorators = [
- { type: core.Component, args: [{selector: 'mat-grid-tile-header, mat-grid-tile-footer',
- 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>",
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- encapsulation: core.ViewEncapsulation.None,
- },] },
- ];
- /** @nocollapse */
- MatGridTileText.ctorParameters = function () { return [
- { type: core.ElementRef }
- ]; };
- MatGridTileText.propDecorators = {
- _lines: [{ type: core.ContentChildren, args: [MatLine,] }]
- };
- return MatGridTileText;
- }());
- /**
- * Directive whose purpose is to add the mat- CSS styling to this selector.
- * \@docs-private
- */
- var MatGridAvatarCssMatStyler = /** @class */ (function () {
- function MatGridAvatarCssMatStyler() {
- }
- MatGridAvatarCssMatStyler.decorators = [
- { type: core.Directive, args: [{
- selector: '[mat-grid-avatar], [matGridAvatar]',
- host: { 'class': 'mat-grid-avatar' }
- },] },
- ];
- return MatGridAvatarCssMatStyler;
- }());
- /**
- * Directive whose purpose is to add the mat- CSS styling to this selector.
- * \@docs-private
- */
- var MatGridTileHeaderCssMatStyler = /** @class */ (function () {
- function MatGridTileHeaderCssMatStyler() {
- }
- MatGridTileHeaderCssMatStyler.decorators = [
- { type: core.Directive, args: [{
- selector: 'mat-grid-tile-header',
- host: { 'class': 'mat-grid-tile-header' }
- },] },
- ];
- return MatGridTileHeaderCssMatStyler;
- }());
- /**
- * Directive whose purpose is to add the mat- CSS styling to this selector.
- * \@docs-private
- */
- var MatGridTileFooterCssMatStyler = /** @class */ (function () {
- function MatGridTileFooterCssMatStyler() {
- }
- MatGridTileFooterCssMatStyler.decorators = [
- { type: core.Directive, args: [{
- selector: 'mat-grid-tile-footer',
- host: { 'class': 'mat-grid-tile-footer' }
- },] },
- ];
- return MatGridTileFooterCssMatStyler;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Class for determining, from a list of tiles, the (row, col) position of each of those tiles
- * in the grid. This is necessary (rather than just rendering the tiles in normal document flow)
- * because the tiles can have a rowspan.
- *
- * The positioning algorithm greedily places each tile as soon as it encounters a gap in the grid
- * large enough to accommodate it so that the tiles still render in the same order in which they
- * are given.
- *
- * The basis of the algorithm is the use of an array to track the already placed tiles. Each
- * element of the array corresponds to a column, and the value indicates how many cells in that
- * column are already occupied; zero indicates an empty cell. Moving "down" to the next row
- * decrements each value in the tracking array (indicating that the column is one cell closer to
- * being free).
- *
- * \@docs-private
- */
- var /**
- * Class for determining, from a list of tiles, the (row, col) position of each of those tiles
- * in the grid. This is necessary (rather than just rendering the tiles in normal document flow)
- * because the tiles can have a rowspan.
- *
- * The positioning algorithm greedily places each tile as soon as it encounters a gap in the grid
- * large enough to accommodate it so that the tiles still render in the same order in which they
- * are given.
- *
- * The basis of the algorithm is the use of an array to track the already placed tiles. Each
- * element of the array corresponds to a column, and the value indicates how many cells in that
- * column are already occupied; zero indicates an empty cell. Moving "down" to the next row
- * decrements each value in the tracking array (indicating that the column is one cell closer to
- * being free).
- *
- * \@docs-private
- */
- TileCoordinator = /** @class */ (function () {
- function TileCoordinator() {
- /**
- * Index at which the search for the next gap will start.
- */
- this.columnIndex = 0;
- /**
- * The current row index.
- */
- this.rowIndex = 0;
- }
- Object.defineProperty(TileCoordinator.prototype, "rowCount", {
- /** Gets the total number of rows occupied by tiles */
- get: /**
- * Gets the total number of rows occupied by tiles
- * @return {?}
- */
- function () { return this.rowIndex + 1; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(TileCoordinator.prototype, "rowspan", {
- /**
- * Gets the total span of rows occupied by tiles.
- * Ex: A list with 1 row that contains a tile with rowspan 2 will have a total rowspan of 2.
- */
- get: /**
- * Gets the total span of rows occupied by tiles.
- * Ex: A list with 1 row that contains a tile with rowspan 2 will have a total rowspan of 2.
- * @return {?}
- */
- function () {
- /** @type {?} */
- var lastRowMax = Math.max.apply(Math, this.tracker);
- // if any of the tiles has a rowspan that pushes it beyond the total row count,
- // add the difference to the rowcount
- return lastRowMax > 1 ? this.rowCount + lastRowMax - 1 : this.rowCount;
- },
- enumerable: true,
- configurable: true
- });
- /**
- * Updates the tile positions.
- * @param numColumns Amount of columns in the grid.
- */
- /**
- * Updates the tile positions.
- * @param {?} numColumns Amount of columns in the grid.
- * @param {?} tiles
- * @return {?}
- */
- TileCoordinator.prototype.update = /**
- * Updates the tile positions.
- * @param {?} numColumns Amount of columns in the grid.
- * @param {?} tiles
- * @return {?}
- */
- function (numColumns, tiles) {
- var _this = this;
- this.columnIndex = 0;
- this.rowIndex = 0;
- this.tracker = new Array(numColumns);
- this.tracker.fill(0, 0, this.tracker.length);
- this.positions = tiles.map((/**
- * @param {?} tile
- * @return {?}
- */
- function (tile) { return _this._trackTile(tile); }));
- };
- /** Calculates the row and col position of a tile. */
- /**
- * Calculates the row and col position of a tile.
- * @private
- * @param {?} tile
- * @return {?}
- */
- TileCoordinator.prototype._trackTile = /**
- * Calculates the row and col position of a tile.
- * @private
- * @param {?} tile
- * @return {?}
- */
- function (tile) {
- // Find a gap large enough for this tile.
- /** @type {?} */
- var gapStartIndex = this._findMatchingGap(tile.colspan);
- // Place tile in the resulting gap.
- this._markTilePosition(gapStartIndex, tile);
- // The next time we look for a gap, the search will start at columnIndex, which should be
- // immediately after the tile that has just been placed.
- this.columnIndex = gapStartIndex + tile.colspan;
- return new TilePosition(this.rowIndex, gapStartIndex);
- };
- /** Finds the next available space large enough to fit the tile. */
- /**
- * Finds the next available space large enough to fit the tile.
- * @private
- * @param {?} tileCols
- * @return {?}
- */
- TileCoordinator.prototype._findMatchingGap = /**
- * Finds the next available space large enough to fit the tile.
- * @private
- * @param {?} tileCols
- * @return {?}
- */
- function (tileCols) {
- if (tileCols > this.tracker.length) {
- throw Error("mat-grid-list: tile with colspan " + tileCols + " is wider than " +
- ("grid with cols=\"" + this.tracker.length + "\"."));
- }
- // Start index is inclusive, end index is exclusive.
- /** @type {?} */
- var gapStartIndex = -1;
- /** @type {?} */
- var gapEndIndex = -1;
- // Look for a gap large enough to fit the given tile. Empty spaces are marked with a zero.
- do {
- // If we've reached the end of the row, go to the next row.
- if (this.columnIndex + tileCols > this.tracker.length) {
- this._nextRow();
- gapStartIndex = this.tracker.indexOf(0, this.columnIndex);
- gapEndIndex = this._findGapEndIndex(gapStartIndex);
- continue;
- }
- gapStartIndex = this.tracker.indexOf(0, this.columnIndex);
- // If there are no more empty spaces in this row at all, move on to the next row.
- if (gapStartIndex == -1) {
- this._nextRow();
- gapStartIndex = this.tracker.indexOf(0, this.columnIndex);
- gapEndIndex = this._findGapEndIndex(gapStartIndex);
- continue;
- }
- gapEndIndex = this._findGapEndIndex(gapStartIndex);
- // If a gap large enough isn't found, we want to start looking immediately after the current
- // gap on the next iteration.
- this.columnIndex = gapStartIndex + 1;
- // Continue iterating until we find a gap wide enough for this tile. Since gapEndIndex is
- // exclusive, gapEndIndex is 0 means we didn't find a gap and should continue.
- } while ((gapEndIndex - gapStartIndex < tileCols) || (gapEndIndex == 0));
- // If we still didn't manage to find a gap, ensure that the index is
- // at least zero so the tile doesn't get pulled out of the grid.
- return Math.max(gapStartIndex, 0);
- };
- /** Move "down" to the next row. */
- /**
- * Move "down" to the next row.
- * @private
- * @return {?}
- */
- TileCoordinator.prototype._nextRow = /**
- * Move "down" to the next row.
- * @private
- * @return {?}
- */
- function () {
- this.columnIndex = 0;
- this.rowIndex++;
- // Decrement all spaces by one to reflect moving down one row.
- for (var i = 0; i < this.tracker.length; i++) {
- this.tracker[i] = Math.max(0, this.tracker[i] - 1);
- }
- };
- /**
- * Finds the end index (exclusive) of a gap given the index from which to start looking.
- * The gap ends when a non-zero value is found.
- */
- /**
- * Finds the end index (exclusive) of a gap given the index from which to start looking.
- * The gap ends when a non-zero value is found.
- * @private
- * @param {?} gapStartIndex
- * @return {?}
- */
- TileCoordinator.prototype._findGapEndIndex = /**
- * Finds the end index (exclusive) of a gap given the index from which to start looking.
- * The gap ends when a non-zero value is found.
- * @private
- * @param {?} gapStartIndex
- * @return {?}
- */
- function (gapStartIndex) {
- for (var i = gapStartIndex + 1; i < this.tracker.length; i++) {
- if (this.tracker[i] != 0) {
- return i;
- }
- }
- // The gap ends with the end of the row.
- return this.tracker.length;
- };
- /** Update the tile tracker to account for the given tile in the given space. */
- /**
- * Update the tile tracker to account for the given tile in the given space.
- * @private
- * @param {?} start
- * @param {?} tile
- * @return {?}
- */
- TileCoordinator.prototype._markTilePosition = /**
- * Update the tile tracker to account for the given tile in the given space.
- * @private
- * @param {?} start
- * @param {?} tile
- * @return {?}
- */
- function (start, tile) {
- for (var i = 0; i < tile.colspan; i++) {
- this.tracker[start + i] = tile.rowspan;
- }
- };
- return TileCoordinator;
- }());
- /**
- * Simple data structure for tile position (row, col).
- * \@docs-private
- */
- var /**
- * Simple data structure for tile position (row, col).
- * \@docs-private
- */
- TilePosition = /** @class */ (function () {
- function TilePosition(row, col) {
- this.row = row;
- this.col = col;
- }
- return TilePosition;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * RegExp that can be used to check whether a value will
- * be allowed inside a CSS `calc()` expression.
- * @type {?}
- */
- var cssCalcAllowedValue = /^-?\d+((\.\d+)?[A-Za-z%$]?)+$/;
- /**
- * Sets the style properties for an individual tile, given the position calculated by the
- * Tile Coordinator.
- * \@docs-private
- * @abstract
- */
- var /**
- * Sets the style properties for an individual tile, given the position calculated by the
- * Tile Coordinator.
- * \@docs-private
- * @abstract
- */
- TileStyler = /** @class */ (function () {
- function TileStyler() {
- this._rows = 0;
- this._rowspan = 0;
- }
- /**
- * Adds grid-list layout info once it is available. Cannot be processed in the constructor
- * because these properties haven't been calculated by that point.
- *
- * @param gutterSize Size of the grid's gutter.
- * @param tracker Instance of the TileCoordinator.
- * @param cols Amount of columns in the grid.
- * @param direction Layout direction of the grid.
- */
- /**
- * Adds grid-list layout info once it is available. Cannot be processed in the constructor
- * because these properties haven't been calculated by that point.
- *
- * @param {?} gutterSize Size of the grid's gutter.
- * @param {?} tracker Instance of the TileCoordinator.
- * @param {?} cols Amount of columns in the grid.
- * @param {?} direction Layout direction of the grid.
- * @return {?}
- */
- TileStyler.prototype.init = /**
- * Adds grid-list layout info once it is available. Cannot be processed in the constructor
- * because these properties haven't been calculated by that point.
- *
- * @param {?} gutterSize Size of the grid's gutter.
- * @param {?} tracker Instance of the TileCoordinator.
- * @param {?} cols Amount of columns in the grid.
- * @param {?} direction Layout direction of the grid.
- * @return {?}
- */
- function (gutterSize, tracker, cols, direction) {
- this._gutterSize = normalizeUnits(gutterSize);
- this._rows = tracker.rowCount;
- this._rowspan = tracker.rowspan;
- this._cols = cols;
- this._direction = direction;
- };
- /**
- * Computes the amount of space a single 1x1 tile would take up (width or height).
- * Used as a basis for other calculations.
- * @param sizePercent Percent of the total grid-list space that one 1x1 tile would take up.
- * @param gutterFraction Fraction of the gutter size taken up by one 1x1 tile.
- * @return The size of a 1x1 tile as an expression that can be evaluated via CSS calc().
- */
- /**
- * Computes the amount of space a single 1x1 tile would take up (width or height).
- * Used as a basis for other calculations.
- * @param {?} sizePercent Percent of the total grid-list space that one 1x1 tile would take up.
- * @param {?} gutterFraction Fraction of the gutter size taken up by one 1x1 tile.
- * @return {?} The size of a 1x1 tile as an expression that can be evaluated via CSS calc().
- */
- TileStyler.prototype.getBaseTileSize = /**
- * Computes the amount of space a single 1x1 tile would take up (width or height).
- * Used as a basis for other calculations.
- * @param {?} sizePercent Percent of the total grid-list space that one 1x1 tile would take up.
- * @param {?} gutterFraction Fraction of the gutter size taken up by one 1x1 tile.
- * @return {?} The size of a 1x1 tile as an expression that can be evaluated via CSS calc().
- */
- function (sizePercent, gutterFraction) {
- // Take the base size percent (as would be if evenly dividing the size between cells),
- // and then subtracting the size of one gutter. However, since there are no gutters on the
- // edges, each tile only uses a fraction (gutterShare = numGutters / numCells) of the gutter
- // size. (Imagine having one gutter per tile, and then breaking up the extra gutter on the
- // edge evenly among the cells).
- return "(" + sizePercent + "% - (" + this._gutterSize + " * " + gutterFraction + "))";
- };
- /**
- * Gets The horizontal or vertical position of a tile, e.g., the 'top' or 'left' property value.
- * @param offset Number of tiles that have already been rendered in the row/column.
- * @param baseSize Base size of a 1x1 tile (as computed in getBaseTileSize).
- * @return Position of the tile as a CSS calc() expression.
- */
- /**
- * Gets The horizontal or vertical position of a tile, e.g., the 'top' or 'left' property value.
- * @param {?} baseSize Base size of a 1x1 tile (as computed in getBaseTileSize).
- * @param {?} offset Number of tiles that have already been rendered in the row/column.
- * @return {?} Position of the tile as a CSS calc() expression.
- */
- TileStyler.prototype.getTilePosition = /**
- * Gets The horizontal or vertical position of a tile, e.g., the 'top' or 'left' property value.
- * @param {?} baseSize Base size of a 1x1 tile (as computed in getBaseTileSize).
- * @param {?} offset Number of tiles that have already been rendered in the row/column.
- * @return {?} Position of the tile as a CSS calc() expression.
- */
- function (baseSize, offset) {
- // The position comes the size of a 1x1 tile plus gutter for each previous tile in the
- // row/column (offset).
- return offset === 0 ? '0' : calc("(" + baseSize + " + " + this._gutterSize + ") * " + offset);
- };
- /**
- * Gets the actual size of a tile, e.g., width or height, taking rowspan or colspan into account.
- * @param baseSize Base size of a 1x1 tile (as computed in getBaseTileSize).
- * @param span The tile's rowspan or colspan.
- * @return Size of the tile as a CSS calc() expression.
- */
- /**
- * Gets the actual size of a tile, e.g., width or height, taking rowspan or colspan into account.
- * @param {?} baseSize Base size of a 1x1 tile (as computed in getBaseTileSize).
- * @param {?} span The tile's rowspan or colspan.
- * @return {?} Size of the tile as a CSS calc() expression.
- */
- TileStyler.prototype.getTileSize = /**
- * Gets the actual size of a tile, e.g., width or height, taking rowspan or colspan into account.
- * @param {?} baseSize Base size of a 1x1 tile (as computed in getBaseTileSize).
- * @param {?} span The tile's rowspan or colspan.
- * @return {?} Size of the tile as a CSS calc() expression.
- */
- function (baseSize, span) {
- return "(" + baseSize + " * " + span + ") + (" + (span - 1) + " * " + this._gutterSize + ")";
- };
- /**
- * Sets the style properties to be applied to a tile for the given row and column index.
- * @param tile Tile to which to apply the styling.
- * @param rowIndex Index of the tile's row.
- * @param colIndex Index of the tile's column.
- */
- /**
- * Sets the style properties to be applied to a tile for the given row and column index.
- * @param {?} tile Tile to which to apply the styling.
- * @param {?} rowIndex Index of the tile's row.
- * @param {?} colIndex Index of the tile's column.
- * @return {?}
- */
- TileStyler.prototype.setStyle = /**
- * Sets the style properties to be applied to a tile for the given row and column index.
- * @param {?} tile Tile to which to apply the styling.
- * @param {?} rowIndex Index of the tile's row.
- * @param {?} colIndex Index of the tile's column.
- * @return {?}
- */
- function (tile, rowIndex, colIndex) {
- // Percent of the available horizontal space that one column takes up.
- /** @type {?} */
- var percentWidthPerTile = 100 / this._cols;
- // Fraction of the vertical gutter size that each column takes up.
- // For example, if there are 5 columns, each column uses 4/5 = 0.8 times the gutter width.
- /** @type {?} */
- var gutterWidthFractionPerTile = (this._cols - 1) / this._cols;
- this.setColStyles(tile, colIndex, percentWidthPerTile, gutterWidthFractionPerTile);
- this.setRowStyles(tile, rowIndex, percentWidthPerTile, gutterWidthFractionPerTile);
- };
- /** Sets the horizontal placement of the tile in the list. */
- /**
- * Sets the horizontal placement of the tile in the list.
- * @param {?} tile
- * @param {?} colIndex
- * @param {?} percentWidth
- * @param {?} gutterWidth
- * @return {?}
- */
- TileStyler.prototype.setColStyles = /**
- * Sets the horizontal placement of the tile in the list.
- * @param {?} tile
- * @param {?} colIndex
- * @param {?} percentWidth
- * @param {?} gutterWidth
- * @return {?}
- */
- function (tile, colIndex, percentWidth, gutterWidth) {
- // Base horizontal size of a column.
- /** @type {?} */
- var baseTileWidth = this.getBaseTileSize(percentWidth, gutterWidth);
- // The width and horizontal position of each tile is always calculated the same way, but the
- // height and vertical position depends on the rowMode.
- /** @type {?} */
- var side = this._direction === 'rtl' ? 'right' : 'left';
- tile._setStyle(side, this.getTilePosition(baseTileWidth, colIndex));
- tile._setStyle('width', calc(this.getTileSize(baseTileWidth, tile.colspan)));
- };
- /**
- * Calculates the total size taken up by gutters across one axis of a list.
- */
- /**
- * Calculates the total size taken up by gutters across one axis of a list.
- * @return {?}
- */
- TileStyler.prototype.getGutterSpan = /**
- * Calculates the total size taken up by gutters across one axis of a list.
- * @return {?}
- */
- function () {
- return this._gutterSize + " * (" + this._rowspan + " - 1)";
- };
- /**
- * Calculates the total size taken up by tiles across one axis of a list.
- * @param tileHeight Height of the tile.
- */
- /**
- * Calculates the total size taken up by tiles across one axis of a list.
- * @param {?} tileHeight Height of the tile.
- * @return {?}
- */
- TileStyler.prototype.getTileSpan = /**
- * Calculates the total size taken up by tiles across one axis of a list.
- * @param {?} tileHeight Height of the tile.
- * @return {?}
- */
- function (tileHeight) {
- return this._rowspan + " * " + this.getTileSize(tileHeight, 1);
- };
- /**
- * Calculates the computed height and returns the correct style property to set.
- * This method can be implemented by each type of TileStyler.
- * @docs-private
- */
- /**
- * Calculates the computed height and returns the correct style property to set.
- * This method can be implemented by each type of TileStyler.
- * \@docs-private
- * @return {?}
- */
- TileStyler.prototype.getComputedHeight = /**
- * Calculates the computed height and returns the correct style property to set.
- * This method can be implemented by each type of TileStyler.
- * \@docs-private
- * @return {?}
- */
- function () { return null; };
- return TileStyler;
- }());
- /**
- * This type of styler is instantiated when the user passes in a fixed row height.
- * Example `<mat-grid-list cols="3" rowHeight="100px">`
- * \@docs-private
- */
- var /**
- * This type of styler is instantiated when the user passes in a fixed row height.
- * Example `<mat-grid-list cols="3" rowHeight="100px">`
- * \@docs-private
- */
- FixedTileStyler = /** @class */ (function (_super) {
- __extends(FixedTileStyler, _super);
- function FixedTileStyler(fixedRowHeight) {
- var _this = _super.call(this) || this;
- _this.fixedRowHeight = fixedRowHeight;
- return _this;
- }
- /**
- * @param {?} gutterSize
- * @param {?} tracker
- * @param {?} cols
- * @param {?} direction
- * @return {?}
- */
- FixedTileStyler.prototype.init = /**
- * @param {?} gutterSize
- * @param {?} tracker
- * @param {?} cols
- * @param {?} direction
- * @return {?}
- */
- function (gutterSize, tracker, cols, direction) {
- _super.prototype.init.call(this, gutterSize, tracker, cols, direction);
- this.fixedRowHeight = normalizeUnits(this.fixedRowHeight);
- if (!cssCalcAllowedValue.test(this.fixedRowHeight)) {
- throw Error("Invalid value \"" + this.fixedRowHeight + "\" set as rowHeight.");
- }
- };
- /**
- * @param {?} tile
- * @param {?} rowIndex
- * @return {?}
- */
- FixedTileStyler.prototype.setRowStyles = /**
- * @param {?} tile
- * @param {?} rowIndex
- * @return {?}
- */
- function (tile, rowIndex) {
- tile._setStyle('top', this.getTilePosition(this.fixedRowHeight, rowIndex));
- tile._setStyle('height', calc(this.getTileSize(this.fixedRowHeight, tile.rowspan)));
- };
- /**
- * @return {?}
- */
- FixedTileStyler.prototype.getComputedHeight = /**
- * @return {?}
- */
- function () {
- return [
- 'height', calc(this.getTileSpan(this.fixedRowHeight) + " + " + this.getGutterSpan())
- ];
- };
- /**
- * @param {?} list
- * @return {?}
- */
- FixedTileStyler.prototype.reset = /**
- * @param {?} list
- * @return {?}
- */
- function (list) {
- list._setListStyle(['height', null]);
- if (list._tiles) {
- list._tiles.forEach((/**
- * @param {?} tile
- * @return {?}
- */
- function (tile) {
- tile._setStyle('top', null);
- tile._setStyle('height', null);
- }));
- }
- };
- return FixedTileStyler;
- }(TileStyler));
- /**
- * This type of styler is instantiated when the user passes in a width:height ratio
- * for the row height. Example `<mat-grid-list cols="3" rowHeight="3:1">`
- * \@docs-private
- */
- var /**
- * This type of styler is instantiated when the user passes in a width:height ratio
- * for the row height. Example `<mat-grid-list cols="3" rowHeight="3:1">`
- * \@docs-private
- */
- RatioTileStyler = /** @class */ (function (_super) {
- __extends(RatioTileStyler, _super);
- function RatioTileStyler(value) {
- var _this = _super.call(this) || this;
- _this._parseRatio(value);
- return _this;
- }
- /**
- * @param {?} tile
- * @param {?} rowIndex
- * @param {?} percentWidth
- * @param {?} gutterWidth
- * @return {?}
- */
- RatioTileStyler.prototype.setRowStyles = /**
- * @param {?} tile
- * @param {?} rowIndex
- * @param {?} percentWidth
- * @param {?} gutterWidth
- * @return {?}
- */
- function (tile, rowIndex, percentWidth, gutterWidth) {
- /** @type {?} */
- var percentHeightPerTile = percentWidth / this.rowHeightRatio;
- this.baseTileHeight = this.getBaseTileSize(percentHeightPerTile, gutterWidth);
- // Use padding-top and margin-top to maintain the given aspect ratio, as
- // a percentage-based value for these properties is applied versus the *width* of the
- // containing block. See http://www.w3.org/TR/CSS2/box.html#margin-properties
- tile._setStyle('marginTop', this.getTilePosition(this.baseTileHeight, rowIndex));
- tile._setStyle('paddingTop', calc(this.getTileSize(this.baseTileHeight, tile.rowspan)));
- };
- /**
- * @return {?}
- */
- RatioTileStyler.prototype.getComputedHeight = /**
- * @return {?}
- */
- function () {
- return [
- 'paddingBottom', calc(this.getTileSpan(this.baseTileHeight) + " + " + this.getGutterSpan())
- ];
- };
- /**
- * @param {?} list
- * @return {?}
- */
- RatioTileStyler.prototype.reset = /**
- * @param {?} list
- * @return {?}
- */
- function (list) {
- list._setListStyle(['paddingBottom', null]);
- list._tiles.forEach((/**
- * @param {?} tile
- * @return {?}
- */
- function (tile) {
- tile._setStyle('marginTop', null);
- tile._setStyle('paddingTop', null);
- }));
- };
- /**
- * @private
- * @param {?} value
- * @return {?}
- */
- RatioTileStyler.prototype._parseRatio = /**
- * @private
- * @param {?} value
- * @return {?}
- */
- function (value) {
- /** @type {?} */
- var ratioParts = value.split(':');
- if (ratioParts.length !== 2) {
- throw Error("mat-grid-list: invalid ratio given for row-height: \"" + value + "\"");
- }
- this.rowHeightRatio = parseFloat(ratioParts[0]) / parseFloat(ratioParts[1]);
- };
- return RatioTileStyler;
- }(TileStyler));
- /**
- * This type of styler is instantiated when the user selects a "fit" row height mode.
- * In other words, the row height will reflect the total height of the container divided
- * by the number of rows. Example `<mat-grid-list cols="3" rowHeight="fit">`
- *
- * \@docs-private
- */
- var /**
- * This type of styler is instantiated when the user selects a "fit" row height mode.
- * In other words, the row height will reflect the total height of the container divided
- * by the number of rows. Example `<mat-grid-list cols="3" rowHeight="fit">`
- *
- * \@docs-private
- */
- FitTileStyler = /** @class */ (function (_super) {
- __extends(FitTileStyler, _super);
- function FitTileStyler() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- /**
- * @param {?} tile
- * @param {?} rowIndex
- * @return {?}
- */
- FitTileStyler.prototype.setRowStyles = /**
- * @param {?} tile
- * @param {?} rowIndex
- * @return {?}
- */
- function (tile, rowIndex) {
- // Percent of the available vertical space that one row takes up.
- /** @type {?} */
- var percentHeightPerTile = 100 / this._rowspan;
- // Fraction of the horizontal gutter size that each column takes up.
- /** @type {?} */
- var gutterHeightPerTile = (this._rows - 1) / this._rows;
- // Base vertical size of a column.
- /** @type {?} */
- var baseTileHeight = this.getBaseTileSize(percentHeightPerTile, gutterHeightPerTile);
- tile._setStyle('top', this.getTilePosition(baseTileHeight, rowIndex));
- tile._setStyle('height', calc(this.getTileSize(baseTileHeight, tile.rowspan)));
- };
- /**
- * @param {?} list
- * @return {?}
- */
- FitTileStyler.prototype.reset = /**
- * @param {?} list
- * @return {?}
- */
- function (list) {
- if (list._tiles) {
- list._tiles.forEach((/**
- * @param {?} tile
- * @return {?}
- */
- function (tile) {
- tile._setStyle('top', null);
- tile._setStyle('height', null);
- }));
- }
- };
- return FitTileStyler;
- }(TileStyler));
- /**
- * Wraps a CSS string in a calc function
- * @param {?} exp
- * @return {?}
- */
- function calc(exp) {
- return "calc(" + exp + ")";
- }
- /**
- * Appends pixels to a CSS string if no units are given.
- * @param {?} value
- * @return {?}
- */
- function normalizeUnits(value) {
- return value.match(/([A-Za-z%]+)$/) ? value : value + "px";
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- // TODO(kara): Conditional (responsive) column count / row size.
- // TODO(kara): Re-layout on window resize / media change (debounced).
- // TODO(kara): gridTileHeader and gridTileFooter.
- /** @type {?} */
- var MAT_FIT_MODE = 'fit';
- var MatGridList = /** @class */ (function () {
- function MatGridList(_element, _dir) {
- this._element = _element;
- this._dir = _dir;
- /**
- * The amount of space between tiles. This will be something like '5px' or '2em'.
- */
- this._gutter = '1px';
- }
- Object.defineProperty(MatGridList.prototype, "cols", {
- /** Amount of columns in the grid list. */
- get: /**
- * Amount of columns in the grid list.
- * @return {?}
- */
- function () { return this._cols; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._cols = Math.max(1, Math.round(coercion.coerceNumberProperty(value)));
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatGridList.prototype, "gutterSize", {
- /** Size of the grid list's gutter in pixels. */
- get: /**
- * Size of the grid list's gutter in pixels.
- * @return {?}
- */
- function () { return this._gutter; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) { this._gutter = "" + (value == null ? '' : value); },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatGridList.prototype, "rowHeight", {
- /** Set internal representation of row height from the user-provided value. */
- get: /**
- * Set internal representation of row height from the user-provided value.
- * @return {?}
- */
- function () { return this._rowHeight; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- /** @type {?} */
- var newValue = "" + (value == null ? '' : value);
- if (newValue !== this._rowHeight) {
- this._rowHeight = newValue;
- this._setTileStyler(this._rowHeight);
- }
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- MatGridList.prototype.ngOnInit = /**
- * @return {?}
- */
- function () {
- this._checkCols();
- this._checkRowHeight();
- };
- /**
- * The layout calculation is fairly cheap if nothing changes, so there's little cost
- * to run it frequently.
- */
- /**
- * The layout calculation is fairly cheap if nothing changes, so there's little cost
- * to run it frequently.
- * @return {?}
- */
- MatGridList.prototype.ngAfterContentChecked = /**
- * The layout calculation is fairly cheap if nothing changes, so there's little cost
- * to run it frequently.
- * @return {?}
- */
- function () {
- this._layoutTiles();
- };
- /** Throw a friendly error if cols property is missing */
- /**
- * Throw a friendly error if cols property is missing
- * @private
- * @return {?}
- */
- MatGridList.prototype._checkCols = /**
- * Throw a friendly error if cols property is missing
- * @private
- * @return {?}
- */
- function () {
- if (!this.cols) {
- throw Error("mat-grid-list: must pass in number of columns. " +
- "Example: <mat-grid-list cols=\"3\">");
- }
- };
- /** Default to equal width:height if rowHeight property is missing */
- /**
- * Default to equal width:height if rowHeight property is missing
- * @private
- * @return {?}
- */
- MatGridList.prototype._checkRowHeight = /**
- * Default to equal width:height if rowHeight property is missing
- * @private
- * @return {?}
- */
- function () {
- if (!this._rowHeight) {
- this._setTileStyler('1:1');
- }
- };
- /** Creates correct Tile Styler subtype based on rowHeight passed in by user */
- /**
- * Creates correct Tile Styler subtype based on rowHeight passed in by user
- * @private
- * @param {?} rowHeight
- * @return {?}
- */
- MatGridList.prototype._setTileStyler = /**
- * Creates correct Tile Styler subtype based on rowHeight passed in by user
- * @private
- * @param {?} rowHeight
- * @return {?}
- */
- function (rowHeight) {
- if (this._tileStyler) {
- this._tileStyler.reset(this);
- }
- if (rowHeight === MAT_FIT_MODE) {
- this._tileStyler = new FitTileStyler();
- }
- else if (rowHeight && rowHeight.indexOf(':') > -1) {
- this._tileStyler = new RatioTileStyler(rowHeight);
- }
- else {
- this._tileStyler = new FixedTileStyler(rowHeight);
- }
- };
- /** Computes and applies the size and position for all children grid tiles. */
- /**
- * Computes and applies the size and position for all children grid tiles.
- * @private
- * @return {?}
- */
- MatGridList.prototype._layoutTiles = /**
- * Computes and applies the size and position for all children grid tiles.
- * @private
- * @return {?}
- */
- function () {
- var _this = this;
- if (!this._tileCoordinator) {
- this._tileCoordinator = new TileCoordinator();
- }
- /** @type {?} */
- var tracker = this._tileCoordinator;
- /** @type {?} */
- var tiles = this._tiles.filter((/**
- * @param {?} tile
- * @return {?}
- */
- function (tile) { return !tile._gridList || tile._gridList === _this; }));
- /** @type {?} */
- var direction = this._dir ? this._dir.value : 'ltr';
- this._tileCoordinator.update(this.cols, tiles);
- this._tileStyler.init(this.gutterSize, tracker, this.cols, direction);
- tiles.forEach((/**
- * @param {?} tile
- * @param {?} index
- * @return {?}
- */
- function (tile, index) {
- /** @type {?} */
- var pos = tracker.positions[index];
- _this._tileStyler.setStyle(tile, pos.row, pos.col);
- }));
- this._setListStyle(this._tileStyler.getComputedHeight());
- };
- /** Sets style on the main grid-list element, given the style name and value. */
- /**
- * Sets style on the main grid-list element, given the style name and value.
- * @param {?} style
- * @return {?}
- */
- MatGridList.prototype._setListStyle = /**
- * Sets style on the main grid-list element, given the style name and value.
- * @param {?} style
- * @return {?}
- */
- function (style) {
- if (style) {
- ((/** @type {?} */ (this._element.nativeElement.style)))[style[0]] = style[1];
- }
- };
- MatGridList.decorators = [
- { type: core.Component, args: [{selector: 'mat-grid-list',
- exportAs: 'matGridList',
- template: "<div><ng-content></ng-content></div>",
- 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}"],
- host: {
- 'class': 'mat-grid-list',
- },
- providers: [{
- provide: MAT_GRID_LIST,
- useExisting: MatGridList
- }],
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- encapsulation: core.ViewEncapsulation.None,
- },] },
- ];
- /** @nocollapse */
- MatGridList.ctorParameters = function () { return [
- { type: core.ElementRef },
- { type: bidi.Directionality, decorators: [{ type: core.Optional }] }
- ]; };
- MatGridList.propDecorators = {
- _tiles: [{ type: core.ContentChildren, args: [MatGridTile, { descendants: true },] }],
- cols: [{ type: core.Input }],
- gutterSize: [{ type: core.Input }],
- rowHeight: [{ type: core.Input }]
- };
- return MatGridList;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var MatGridListModule = /** @class */ (function () {
- function MatGridListModule() {
- }
- MatGridListModule.decorators = [
- { type: core.NgModule, args: [{
- imports: [MatLineModule, MatCommonModule],
- exports: [
- MatGridList,
- MatGridTile,
- MatGridTileText,
- MatLineModule,
- MatCommonModule,
- MatGridTileHeaderCssMatStyler,
- MatGridTileFooterCssMatStyler,
- MatGridAvatarCssMatStyler
- ],
- declarations: [
- MatGridList,
- MatGridTile,
- MatGridTileText,
- MatGridTileHeaderCssMatStyler,
- MatGridTileFooterCssMatStyler,
- MatGridAvatarCssMatStyler
- ],
- },] },
- ];
- return MatGridListModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Returns an exception to be thrown in the case when attempting to
- * load an icon with a name that cannot be found.
- * \@docs-private
- * @param {?} iconName
- * @return {?}
- */
- function getMatIconNameNotFoundError(iconName) {
- return Error("Unable to find icon with the name \"" + iconName + "\"");
- }
- /**
- * Returns an exception to be thrown when the consumer attempts to use
- * `<mat-icon>` without including \@angular/common/http.
- * \@docs-private
- * @return {?}
- */
- function getMatIconNoHttpProviderError() {
- return Error('Could not find HttpClient provider for use with Angular Material icons. ' +
- 'Please include the HttpClientModule from @angular/common/http in your ' +
- 'app imports.');
- }
- /**
- * Returns an exception to be thrown when a URL couldn't be sanitized.
- * \@docs-private
- * @param {?} url URL that was attempted to be sanitized.
- * @return {?}
- */
- function getMatIconFailedToSanitizeUrlError(url) {
- return Error("The URL provided to MatIconRegistry was not trusted as a resource URL " +
- ("via Angular's DomSanitizer. Attempted URL was \"" + url + "\"."));
- }
- /**
- * Returns an exception to be thrown when a HTML string couldn't be sanitized.
- * \@docs-private
- * @param {?} literal HTML that was attempted to be sanitized.
- * @return {?}
- */
- function getMatIconFailedToSanitizeLiteralError(literal) {
- return Error("The literal provided to MatIconRegistry was not trusted as safe HTML by " +
- ("Angular's DomSanitizer. Attempted literal was \"" + literal + "\"."));
- }
- /**
- * Configuration for an icon, including the URL and possibly the cached SVG element.
- * \@docs-private
- */
- var /**
- * Configuration for an icon, including the URL and possibly the cached SVG element.
- * \@docs-private
- */
- SvgIconConfig = /** @class */ (function () {
- function SvgIconConfig(data) {
- // Note that we can't use `instanceof SVGElement` here,
- // because it'll break during server-side rendering.
- if (!!((/** @type {?} */ (data))).nodeName) {
- this.svgElement = (/** @type {?} */ (data));
- }
- else {
- this.url = (/** @type {?} */ (data));
- }
- }
- return SvgIconConfig;
- }());
- /**
- * Service to register and display icons used by the `<mat-icon>` component.
- * - Registers icon URLs by namespace and name.
- * - Registers icon set URLs by namespace.
- * - Registers aliases for CSS classes, for use with icon fonts.
- * - Loads icons from URLs and extracts individual icons from icon sets.
- */
- var MatIconRegistry = /** @class */ (function () {
- function MatIconRegistry(_httpClient, _sanitizer, document) {
- this._httpClient = _httpClient;
- this._sanitizer = _sanitizer;
- /**
- * URLs and cached SVG elements for individual icons. Keys are of the format "[namespace]:[icon]".
- */
- this._svgIconConfigs = new Map();
- /**
- * SvgIconConfig objects and cached SVG elements for icon sets, keyed by namespace.
- * Multiple icon sets can be registered under the same namespace.
- */
- this._iconSetConfigs = new Map();
- /**
- * Cache for icons loaded by direct URLs.
- */
- this._cachedIconsByUrl = new Map();
- /**
- * In-progress icon fetches. Used to coalesce multiple requests to the same URL.
- */
- this._inProgressUrlFetches = new Map();
- /**
- * Map from font identifiers to their CSS class names. Used for icon fonts.
- */
- this._fontCssClassesByAlias = new Map();
- /**
- * The CSS class to apply when an `<mat-icon>` component has no icon name, url, or font specified.
- * The default 'material-icons' value assumes that the material icon font has been loaded as
- * described at http://google.github.io/material-design-icons/#icon-font-for-the-web
- */
- this._defaultFontSetClass = 'material-icons';
- this._document = document;
- }
- /**
- * Registers an icon by URL in the default namespace.
- * @param iconName Name under which the icon should be registered.
- * @param url
- */
- /**
- * Registers an icon by URL in the default namespace.
- * @template THIS
- * @this {THIS}
- * @param {?} iconName Name under which the icon should be registered.
- * @param {?} url
- * @return {THIS}
- */
- MatIconRegistry.prototype.addSvgIcon = /**
- * Registers an icon by URL in the default namespace.
- * @template THIS
- * @this {THIS}
- * @param {?} iconName Name under which the icon should be registered.
- * @param {?} url
- * @return {THIS}
- */
- function (iconName, url) {
- return (/** @type {?} */ (this)).addSvgIconInNamespace('', iconName, url);
- };
- /**
- * Registers an icon using an HTML string in the default namespace.
- * @param iconName Name under which the icon should be registered.
- * @param literal SVG source of the icon.
- */
- /**
- * Registers an icon using an HTML string in the default namespace.
- * @template THIS
- * @this {THIS}
- * @param {?} iconName Name under which the icon should be registered.
- * @param {?} literal SVG source of the icon.
- * @return {THIS}
- */
- MatIconRegistry.prototype.addSvgIconLiteral = /**
- * Registers an icon using an HTML string in the default namespace.
- * @template THIS
- * @this {THIS}
- * @param {?} iconName Name under which the icon should be registered.
- * @param {?} literal SVG source of the icon.
- * @return {THIS}
- */
- function (iconName, literal) {
- return (/** @type {?} */ (this)).addSvgIconLiteralInNamespace('', iconName, literal);
- };
- /**
- * Registers an icon by URL in the specified namespace.
- * @param namespace Namespace in which the icon should be registered.
- * @param iconName Name under which the icon should be registered.
- * @param url
- */
- /**
- * Registers an icon by URL in the specified namespace.
- * @template THIS
- * @this {THIS}
- * @param {?} namespace Namespace in which the icon should be registered.
- * @param {?} iconName Name under which the icon should be registered.
- * @param {?} url
- * @return {THIS}
- */
- MatIconRegistry.prototype.addSvgIconInNamespace = /**
- * Registers an icon by URL in the specified namespace.
- * @template THIS
- * @this {THIS}
- * @param {?} namespace Namespace in which the icon should be registered.
- * @param {?} iconName Name under which the icon should be registered.
- * @param {?} url
- * @return {THIS}
- */
- function (namespace, iconName, url) {
- return (/** @type {?} */ (this))._addSvgIconConfig(namespace, iconName, new SvgIconConfig(url));
- };
- /**
- * Registers an icon using an HTML string in the specified namespace.
- * @param namespace Namespace in which the icon should be registered.
- * @param iconName Name under which the icon should be registered.
- * @param literal SVG source of the icon.
- */
- /**
- * Registers an icon using an HTML string in the specified namespace.
- * @template THIS
- * @this {THIS}
- * @param {?} namespace Namespace in which the icon should be registered.
- * @param {?} iconName Name under which the icon should be registered.
- * @param {?} literal SVG source of the icon.
- * @return {THIS}
- */
- MatIconRegistry.prototype.addSvgIconLiteralInNamespace = /**
- * Registers an icon using an HTML string in the specified namespace.
- * @template THIS
- * @this {THIS}
- * @param {?} namespace Namespace in which the icon should be registered.
- * @param {?} iconName Name under which the icon should be registered.
- * @param {?} literal SVG source of the icon.
- * @return {THIS}
- */
- function (namespace, iconName, literal) {
- /** @type {?} */
- var sanitizedLiteral = (/** @type {?} */ (this))._sanitizer.sanitize(core.SecurityContext.HTML, literal);
- if (!sanitizedLiteral) {
- throw getMatIconFailedToSanitizeLiteralError(literal);
- }
- /** @type {?} */
- var svgElement = (/** @type {?} */ (this))._createSvgElementForSingleIcon(sanitizedLiteral);
- return (/** @type {?} */ (this))._addSvgIconConfig(namespace, iconName, new SvgIconConfig(svgElement));
- };
- /**
- * Registers an icon set by URL in the default namespace.
- * @param url
- */
- /**
- * Registers an icon set by URL in the default namespace.
- * @template THIS
- * @this {THIS}
- * @param {?} url
- * @return {THIS}
- */
- MatIconRegistry.prototype.addSvgIconSet = /**
- * Registers an icon set by URL in the default namespace.
- * @template THIS
- * @this {THIS}
- * @param {?} url
- * @return {THIS}
- */
- function (url) {
- return (/** @type {?} */ (this)).addSvgIconSetInNamespace('', url);
- };
- /**
- * Registers an icon set using an HTML string in the default namespace.
- * @param literal SVG source of the icon set.
- */
- /**
- * Registers an icon set using an HTML string in the default namespace.
- * @template THIS
- * @this {THIS}
- * @param {?} literal SVG source of the icon set.
- * @return {THIS}
- */
- MatIconRegistry.prototype.addSvgIconSetLiteral = /**
- * Registers an icon set using an HTML string in the default namespace.
- * @template THIS
- * @this {THIS}
- * @param {?} literal SVG source of the icon set.
- * @return {THIS}
- */
- function (literal) {
- return (/** @type {?} */ (this)).addSvgIconSetLiteralInNamespace('', literal);
- };
- /**
- * Registers an icon set by URL in the specified namespace.
- * @param namespace Namespace in which to register the icon set.
- * @param url
- */
- /**
- * Registers an icon set by URL in the specified namespace.
- * @template THIS
- * @this {THIS}
- * @param {?} namespace Namespace in which to register the icon set.
- * @param {?} url
- * @return {THIS}
- */
- MatIconRegistry.prototype.addSvgIconSetInNamespace = /**
- * Registers an icon set by URL in the specified namespace.
- * @template THIS
- * @this {THIS}
- * @param {?} namespace Namespace in which to register the icon set.
- * @param {?} url
- * @return {THIS}
- */
- function (namespace, url) {
- return (/** @type {?} */ (this))._addSvgIconSetConfig(namespace, new SvgIconConfig(url));
- };
- /**
- * Registers an icon set using an HTML string in the specified namespace.
- * @param namespace Namespace in which to register the icon set.
- * @param literal SVG source of the icon set.
- */
- /**
- * Registers an icon set using an HTML string in the specified namespace.
- * @template THIS
- * @this {THIS}
- * @param {?} namespace Namespace in which to register the icon set.
- * @param {?} literal SVG source of the icon set.
- * @return {THIS}
- */
- MatIconRegistry.prototype.addSvgIconSetLiteralInNamespace = /**
- * Registers an icon set using an HTML string in the specified namespace.
- * @template THIS
- * @this {THIS}
- * @param {?} namespace Namespace in which to register the icon set.
- * @param {?} literal SVG source of the icon set.
- * @return {THIS}
- */
- function (namespace, literal) {
- /** @type {?} */
- var sanitizedLiteral = (/** @type {?} */ (this))._sanitizer.sanitize(core.SecurityContext.HTML, literal);
- if (!sanitizedLiteral) {
- throw getMatIconFailedToSanitizeLiteralError(literal);
- }
- /** @type {?} */
- var svgElement = (/** @type {?} */ (this))._svgElementFromString(sanitizedLiteral);
- return (/** @type {?} */ (this))._addSvgIconSetConfig(namespace, new SvgIconConfig(svgElement));
- };
- /**
- * Defines an alias for a CSS class name to be used for icon fonts. Creating an matIcon
- * component with the alias as the fontSet input will cause the class name to be applied
- * to the `<mat-icon>` element.
- *
- * @param alias Alias for the font.
- * @param className Class name override to be used instead of the alias.
- */
- /**
- * Defines an alias for a CSS class name to be used for icon fonts. Creating an matIcon
- * component with the alias as the fontSet input will cause the class name to be applied
- * to the `<mat-icon>` element.
- *
- * @template THIS
- * @this {THIS}
- * @param {?} alias Alias for the font.
- * @param {?=} className Class name override to be used instead of the alias.
- * @return {THIS}
- */
- MatIconRegistry.prototype.registerFontClassAlias = /**
- * Defines an alias for a CSS class name to be used for icon fonts. Creating an matIcon
- * component with the alias as the fontSet input will cause the class name to be applied
- * to the `<mat-icon>` element.
- *
- * @template THIS
- * @this {THIS}
- * @param {?} alias Alias for the font.
- * @param {?=} className Class name override to be used instead of the alias.
- * @return {THIS}
- */
- function (alias, className) {
- if (className === void 0) { className = alias; }
- (/** @type {?} */ (this))._fontCssClassesByAlias.set(alias, className);
- return (/** @type {?} */ (this));
- };
- /**
- * Returns the CSS class name associated with the alias by a previous call to
- * registerFontClassAlias. If no CSS class has been associated, returns the alias unmodified.
- */
- /**
- * Returns the CSS class name associated with the alias by a previous call to
- * registerFontClassAlias. If no CSS class has been associated, returns the alias unmodified.
- * @param {?} alias
- * @return {?}
- */
- MatIconRegistry.prototype.classNameForFontAlias = /**
- * Returns the CSS class name associated with the alias by a previous call to
- * registerFontClassAlias. If no CSS class has been associated, returns the alias unmodified.
- * @param {?} alias
- * @return {?}
- */
- function (alias) {
- return this._fontCssClassesByAlias.get(alias) || alias;
- };
- /**
- * Sets the CSS class name to be used for icon fonts when an `<mat-icon>` component does not
- * have a fontSet input value, and is not loading an icon by name or URL.
- *
- * @param className
- */
- /**
- * Sets the CSS class name to be used for icon fonts when an `<mat-icon>` component does not
- * have a fontSet input value, and is not loading an icon by name or URL.
- *
- * @template THIS
- * @this {THIS}
- * @param {?} className
- * @return {THIS}
- */
- MatIconRegistry.prototype.setDefaultFontSetClass = /**
- * Sets the CSS class name to be used for icon fonts when an `<mat-icon>` component does not
- * have a fontSet input value, and is not loading an icon by name or URL.
- *
- * @template THIS
- * @this {THIS}
- * @param {?} className
- * @return {THIS}
- */
- function (className) {
- (/** @type {?} */ (this))._defaultFontSetClass = className;
- return (/** @type {?} */ (this));
- };
- /**
- * Returns the CSS class name to be used for icon fonts when an `<mat-icon>` component does not
- * have a fontSet input value, and is not loading an icon by name or URL.
- */
- /**
- * Returns the CSS class name to be used for icon fonts when an `<mat-icon>` component does not
- * have a fontSet input value, and is not loading an icon by name or URL.
- * @return {?}
- */
- MatIconRegistry.prototype.getDefaultFontSetClass = /**
- * Returns the CSS class name to be used for icon fonts when an `<mat-icon>` component does not
- * have a fontSet input value, and is not loading an icon by name or URL.
- * @return {?}
- */
- function () {
- return this._defaultFontSetClass;
- };
- /**
- * Returns an Observable that produces the icon (as an `<svg>` DOM element) from the given URL.
- * The response from the URL may be cached so this will not always cause an HTTP request, but
- * the produced element will always be a new copy of the originally fetched icon. (That is,
- * it will not contain any modifications made to elements previously returned).
- *
- * @param safeUrl URL from which to fetch the SVG icon.
- */
- /**
- * Returns an Observable that produces the icon (as an `<svg>` DOM element) from the given URL.
- * The response from the URL may be cached so this will not always cause an HTTP request, but
- * the produced element will always be a new copy of the originally fetched icon. (That is,
- * it will not contain any modifications made to elements previously returned).
- *
- * @param {?} safeUrl URL from which to fetch the SVG icon.
- * @return {?}
- */
- MatIconRegistry.prototype.getSvgIconFromUrl = /**
- * Returns an Observable that produces the icon (as an `<svg>` DOM element) from the given URL.
- * The response from the URL may be cached so this will not always cause an HTTP request, but
- * the produced element will always be a new copy of the originally fetched icon. (That is,
- * it will not contain any modifications made to elements previously returned).
- *
- * @param {?} safeUrl URL from which to fetch the SVG icon.
- * @return {?}
- */
- function (safeUrl) {
- var _this = this;
- /** @type {?} */
- var url = this._sanitizer.sanitize(core.SecurityContext.RESOURCE_URL, safeUrl);
- if (!url) {
- throw getMatIconFailedToSanitizeUrlError(safeUrl);
- }
- /** @type {?} */
- var cachedIcon = this._cachedIconsByUrl.get(url);
- if (cachedIcon) {
- return rxjs.of(cloneSvg(cachedIcon));
- }
- return this._loadSvgIconFromConfig(new SvgIconConfig(safeUrl)).pipe(operators.tap((/**
- * @param {?} svg
- * @return {?}
- */
- function (svg) { return _this._cachedIconsByUrl.set((/** @type {?} */ (url)), svg); })), operators.map((/**
- * @param {?} svg
- * @return {?}
- */
- function (svg) { return cloneSvg(svg); })));
- };
- /**
- * Returns an Observable that produces the icon (as an `<svg>` DOM element) with the given name
- * and namespace. The icon must have been previously registered with addIcon or addIconSet;
- * if not, the Observable will throw an error.
- *
- * @param name Name of the icon to be retrieved.
- * @param namespace Namespace in which to look for the icon.
- */
- /**
- * Returns an Observable that produces the icon (as an `<svg>` DOM element) with the given name
- * and namespace. The icon must have been previously registered with addIcon or addIconSet;
- * if not, the Observable will throw an error.
- *
- * @param {?} name Name of the icon to be retrieved.
- * @param {?=} namespace Namespace in which to look for the icon.
- * @return {?}
- */
- MatIconRegistry.prototype.getNamedSvgIcon = /**
- * Returns an Observable that produces the icon (as an `<svg>` DOM element) with the given name
- * and namespace. The icon must have been previously registered with addIcon or addIconSet;
- * if not, the Observable will throw an error.
- *
- * @param {?} name Name of the icon to be retrieved.
- * @param {?=} namespace Namespace in which to look for the icon.
- * @return {?}
- */
- function (name, namespace) {
- if (namespace === void 0) { namespace = ''; }
- // Return (copy of) cached icon if possible.
- /** @type {?} */
- var key = iconKey(namespace, name);
- /** @type {?} */
- var config = this._svgIconConfigs.get(key);
- if (config) {
- return this._getSvgFromConfig(config);
- }
- // See if we have any icon sets registered for the namespace.
- /** @type {?} */
- var iconSetConfigs = this._iconSetConfigs.get(namespace);
- if (iconSetConfigs) {
- return this._getSvgFromIconSetConfigs(name, iconSetConfigs);
- }
- return rxjs.throwError(getMatIconNameNotFoundError(key));
- };
- /**
- * @return {?}
- */
- MatIconRegistry.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- this._svgIconConfigs.clear();
- this._iconSetConfigs.clear();
- this._cachedIconsByUrl.clear();
- };
- /**
- * Returns the cached icon for a SvgIconConfig if available, or fetches it from its URL if not.
- */
- /**
- * Returns the cached icon for a SvgIconConfig if available, or fetches it from its URL if not.
- * @private
- * @param {?} config
- * @return {?}
- */
- MatIconRegistry.prototype._getSvgFromConfig = /**
- * Returns the cached icon for a SvgIconConfig if available, or fetches it from its URL if not.
- * @private
- * @param {?} config
- * @return {?}
- */
- function (config) {
- if (config.svgElement) {
- // We already have the SVG element for this icon, return a copy.
- return rxjs.of(cloneSvg(config.svgElement));
- }
- else {
- // Fetch the icon from the config's URL, cache it, and return a copy.
- return this._loadSvgIconFromConfig(config).pipe(operators.tap((/**
- * @param {?} svg
- * @return {?}
- */
- function (svg) { return config.svgElement = svg; })), operators.map((/**
- * @param {?} svg
- * @return {?}
- */
- function (svg) { return cloneSvg(svg); })));
- }
- };
- /**
- * Attempts to find an icon with the specified name in any of the SVG icon sets.
- * First searches the available cached icons for a nested element with a matching name, and
- * if found copies the element to a new `<svg>` element. If not found, fetches all icon sets
- * that have not been cached, and searches again after all fetches are completed.
- * The returned Observable produces the SVG element if possible, and throws
- * an error if no icon with the specified name can be found.
- */
- /**
- * Attempts to find an icon with the specified name in any of the SVG icon sets.
- * First searches the available cached icons for a nested element with a matching name, and
- * if found copies the element to a new `<svg>` element. If not found, fetches all icon sets
- * that have not been cached, and searches again after all fetches are completed.
- * The returned Observable produces the SVG element if possible, and throws
- * an error if no icon with the specified name can be found.
- * @private
- * @param {?} name
- * @param {?} iconSetConfigs
- * @return {?}
- */
- MatIconRegistry.prototype._getSvgFromIconSetConfigs = /**
- * Attempts to find an icon with the specified name in any of the SVG icon sets.
- * First searches the available cached icons for a nested element with a matching name, and
- * if found copies the element to a new `<svg>` element. If not found, fetches all icon sets
- * that have not been cached, and searches again after all fetches are completed.
- * The returned Observable produces the SVG element if possible, and throws
- * an error if no icon with the specified name can be found.
- * @private
- * @param {?} name
- * @param {?} iconSetConfigs
- * @return {?}
- */
- function (name, iconSetConfigs) {
- var _this = this;
- // For all the icon set SVG elements we've fetched, see if any contain an icon with the
- // requested name.
- /** @type {?} */
- var namedIcon = this._extractIconWithNameFromAnySet(name, iconSetConfigs);
- if (namedIcon) {
- // We could cache namedIcon in _svgIconConfigs, but since we have to make a copy every
- // time anyway, there's probably not much advantage compared to just always extracting
- // it from the icon set.
- return rxjs.of(namedIcon);
- }
- // Not found in any cached icon sets. If there are icon sets with URLs that we haven't
- // fetched, fetch them now and look for iconName in the results.
- /** @type {?} */
- var iconSetFetchRequests = iconSetConfigs
- .filter((/**
- * @param {?} iconSetConfig
- * @return {?}
- */
- function (iconSetConfig) { return !iconSetConfig.svgElement; }))
- .map((/**
- * @param {?} iconSetConfig
- * @return {?}
- */
- function (iconSetConfig) {
- return _this._loadSvgIconSetFromConfig(iconSetConfig).pipe(operators.catchError((/**
- * @param {?} err
- * @return {?}
- */
- function (err) {
- /** @type {?} */
- var url = _this._sanitizer.sanitize(core.SecurityContext.RESOURCE_URL, iconSetConfig.url);
- // Swallow errors fetching individual URLs so the
- // combined Observable won't necessarily fail.
- console.error("Loading icon set URL: " + url + " failed: " + err.message);
- return rxjs.of(null);
- })));
- }));
- // Fetch all the icon set URLs. When the requests complete, every IconSet should have a
- // cached SVG element (unless the request failed), and we can check again for the icon.
- return rxjs.forkJoin(iconSetFetchRequests).pipe(operators.map((/**
- * @return {?}
- */
- function () {
- /** @type {?} */
- var foundIcon = _this._extractIconWithNameFromAnySet(name, iconSetConfigs);
- if (!foundIcon) {
- throw getMatIconNameNotFoundError(name);
- }
- return foundIcon;
- })));
- };
- /**
- * Searches the cached SVG elements for the given icon sets for a nested icon element whose "id"
- * tag matches the specified name. If found, copies the nested element to a new SVG element and
- * returns it. Returns null if no matching element is found.
- */
- /**
- * Searches the cached SVG elements for the given icon sets for a nested icon element whose "id"
- * tag matches the specified name. If found, copies the nested element to a new SVG element and
- * returns it. Returns null if no matching element is found.
- * @private
- * @param {?} iconName
- * @param {?} iconSetConfigs
- * @return {?}
- */
- MatIconRegistry.prototype._extractIconWithNameFromAnySet = /**
- * Searches the cached SVG elements for the given icon sets for a nested icon element whose "id"
- * tag matches the specified name. If found, copies the nested element to a new SVG element and
- * returns it. Returns null if no matching element is found.
- * @private
- * @param {?} iconName
- * @param {?} iconSetConfigs
- * @return {?}
- */
- function (iconName, iconSetConfigs) {
- // Iterate backwards, so icon sets added later have precedence.
- for (var i = iconSetConfigs.length - 1; i >= 0; i--) {
- /** @type {?} */
- var config = iconSetConfigs[i];
- if (config.svgElement) {
- /** @type {?} */
- var foundIcon = this._extractSvgIconFromSet(config.svgElement, iconName);
- if (foundIcon) {
- return foundIcon;
- }
- }
- }
- return null;
- };
- /**
- * Loads the content of the icon URL specified in the SvgIconConfig and creates an SVG element
- * from it.
- */
- /**
- * Loads the content of the icon URL specified in the SvgIconConfig and creates an SVG element
- * from it.
- * @private
- * @param {?} config
- * @return {?}
- */
- MatIconRegistry.prototype._loadSvgIconFromConfig = /**
- * Loads the content of the icon URL specified in the SvgIconConfig and creates an SVG element
- * from it.
- * @private
- * @param {?} config
- * @return {?}
- */
- function (config) {
- var _this = this;
- return this._fetchUrl(config.url)
- .pipe(operators.map((/**
- * @param {?} svgText
- * @return {?}
- */
- function (svgText) { return _this._createSvgElementForSingleIcon(svgText); })));
- };
- /**
- * Loads the content of the icon set URL specified in the SvgIconConfig and creates an SVG element
- * from it.
- */
- /**
- * Loads the content of the icon set URL specified in the SvgIconConfig and creates an SVG element
- * from it.
- * @private
- * @param {?} config
- * @return {?}
- */
- MatIconRegistry.prototype._loadSvgIconSetFromConfig = /**
- * Loads the content of the icon set URL specified in the SvgIconConfig and creates an SVG element
- * from it.
- * @private
- * @param {?} config
- * @return {?}
- */
- function (config) {
- var _this = this;
- // If the SVG for this icon set has already been parsed, do nothing.
- if (config.svgElement) {
- return rxjs.of(config.svgElement);
- }
- return this._fetchUrl(config.url).pipe(operators.map((/**
- * @param {?} svgText
- * @return {?}
- */
- function (svgText) {
- // It is possible that the icon set was parsed and cached by an earlier request, so parsing
- // only needs to occur if the cache is yet unset.
- if (!config.svgElement) {
- config.svgElement = _this._svgElementFromString(svgText);
- }
- return config.svgElement;
- })));
- };
- /**
- * Creates a DOM element from the given SVG string, and adds default attributes.
- */
- /**
- * Creates a DOM element from the given SVG string, and adds default attributes.
- * @private
- * @param {?} responseText
- * @return {?}
- */
- MatIconRegistry.prototype._createSvgElementForSingleIcon = /**
- * Creates a DOM element from the given SVG string, and adds default attributes.
- * @private
- * @param {?} responseText
- * @return {?}
- */
- function (responseText) {
- /** @type {?} */
- var svg = this._svgElementFromString(responseText);
- this._setSvgAttributes(svg);
- return svg;
- };
- /**
- * Searches the cached element of the given SvgIconConfig for a nested icon element whose "id"
- * tag matches the specified name. If found, copies the nested element to a new SVG element and
- * returns it. Returns null if no matching element is found.
- */
- /**
- * Searches the cached element of the given SvgIconConfig for a nested icon element whose "id"
- * tag matches the specified name. If found, copies the nested element to a new SVG element and
- * returns it. Returns null if no matching element is found.
- * @private
- * @param {?} iconSet
- * @param {?} iconName
- * @return {?}
- */
- MatIconRegistry.prototype._extractSvgIconFromSet = /**
- * Searches the cached element of the given SvgIconConfig for a nested icon element whose "id"
- * tag matches the specified name. If found, copies the nested element to a new SVG element and
- * returns it. Returns null if no matching element is found.
- * @private
- * @param {?} iconSet
- * @param {?} iconName
- * @return {?}
- */
- function (iconSet, iconName) {
- // Use the `id="iconName"` syntax in order to escape special
- // characters in the ID (versus using the #iconName syntax).
- /** @type {?} */
- var iconSource = iconSet.querySelector("[id=\"" + iconName + "\"]");
- if (!iconSource) {
- return null;
- }
- // Clone the element and remove the ID to prevent multiple elements from being added
- // to the page with the same ID.
- /** @type {?} */
- var iconElement = (/** @type {?} */ (iconSource.cloneNode(true)));
- iconElement.removeAttribute('id');
- // If the icon node is itself an <svg> node, clone and return it directly. If not, set it as
- // the content of a new <svg> node.
- if (iconElement.nodeName.toLowerCase() === 'svg') {
- return this._setSvgAttributes((/** @type {?} */ (iconElement)));
- }
- // If the node is a <symbol>, it won't be rendered so we have to convert it into <svg>. Note
- // that the same could be achieved by referring to it via <use href="#id">, however the <use>
- // tag is problematic on Firefox, because it needs to include the current page path.
- if (iconElement.nodeName.toLowerCase() === 'symbol') {
- return this._setSvgAttributes(this._toSvgElement(iconElement));
- }
- // createElement('SVG') doesn't work as expected; the DOM ends up with
- // the correct nodes, but the SVG content doesn't render. Instead we
- // have to create an empty SVG node using innerHTML and append its content.
- // Elements created using DOMParser.parseFromString have the same problem.
- // http://stackoverflow.com/questions/23003278/svg-innerhtml-in-firefox-can-not-display
- /** @type {?} */
- var svg = this._svgElementFromString('<svg></svg>');
- // Clone the node so we don't remove it from the parent icon set element.
- svg.appendChild(iconElement);
- return this._setSvgAttributes(svg);
- };
- /**
- * Creates a DOM element from the given SVG string.
- */
- /**
- * Creates a DOM element from the given SVG string.
- * @private
- * @param {?} str
- * @return {?}
- */
- MatIconRegistry.prototype._svgElementFromString = /**
- * Creates a DOM element from the given SVG string.
- * @private
- * @param {?} str
- * @return {?}
- */
- function (str) {
- /** @type {?} */
- var div = this._document.createElement('DIV');
- div.innerHTML = str;
- /** @type {?} */
- var svg = (/** @type {?} */ (div.querySelector('svg')));
- if (!svg) {
- throw Error('<svg> tag not found');
- }
- return svg;
- };
- /**
- * Converts an element into an SVG node by cloning all of its children.
- */
- /**
- * Converts an element into an SVG node by cloning all of its children.
- * @private
- * @param {?} element
- * @return {?}
- */
- MatIconRegistry.prototype._toSvgElement = /**
- * Converts an element into an SVG node by cloning all of its children.
- * @private
- * @param {?} element
- * @return {?}
- */
- function (element) {
- /** @type {?} */
- var svg = this._svgElementFromString('<svg></svg>');
- for (var i = 0; i < element.childNodes.length; i++) {
- if (element.childNodes[i].nodeType === this._document.ELEMENT_NODE) {
- svg.appendChild(element.childNodes[i].cloneNode(true));
- }
- }
- return svg;
- };
- /**
- * Sets the default attributes for an SVG element to be used as an icon.
- */
- /**
- * Sets the default attributes for an SVG element to be used as an icon.
- * @private
- * @param {?} svg
- * @return {?}
- */
- MatIconRegistry.prototype._setSvgAttributes = /**
- * Sets the default attributes for an SVG element to be used as an icon.
- * @private
- * @param {?} svg
- * @return {?}
- */
- function (svg) {
- svg.setAttribute('fit', '');
- svg.setAttribute('height', '100%');
- svg.setAttribute('width', '100%');
- svg.setAttribute('preserveAspectRatio', 'xMidYMid meet');
- svg.setAttribute('focusable', 'false'); // Disable IE11 default behavior to make SVGs focusable.
- return svg;
- };
- /**
- * Returns an Observable which produces the string contents of the given URL. Results may be
- * cached, so future calls with the same URL may not cause another HTTP request.
- */
- /**
- * Returns an Observable which produces the string contents of the given URL. Results may be
- * cached, so future calls with the same URL may not cause another HTTP request.
- * @private
- * @param {?} safeUrl
- * @return {?}
- */
- MatIconRegistry.prototype._fetchUrl = /**
- * Returns an Observable which produces the string contents of the given URL. Results may be
- * cached, so future calls with the same URL may not cause another HTTP request.
- * @private
- * @param {?} safeUrl
- * @return {?}
- */
- function (safeUrl) {
- var _this = this;
- if (!this._httpClient) {
- throw getMatIconNoHttpProviderError();
- }
- if (safeUrl == null) {
- throw Error("Cannot fetch icon from URL \"" + safeUrl + "\".");
- }
- /** @type {?} */
- var url = this._sanitizer.sanitize(core.SecurityContext.RESOURCE_URL, safeUrl);
- if (!url) {
- throw getMatIconFailedToSanitizeUrlError(safeUrl);
- }
- // Store in-progress fetches to avoid sending a duplicate request for a URL when there is
- // already a request in progress for that URL. It's necessary to call share() on the
- // Observable returned by http.get() so that multiple subscribers don't cause multiple XHRs.
- /** @type {?} */
- var inProgressFetch = this._inProgressUrlFetches.get(url);
- if (inProgressFetch) {
- return inProgressFetch;
- }
- // TODO(jelbourn): for some reason, the `finalize` operator "loses" the generic type on the
- // Observable. Figure out why and fix it.
- /** @type {?} */
- var req = this._httpClient.get(url, { responseType: 'text' }).pipe(operators.finalize((/**
- * @return {?}
- */
- function () { return _this._inProgressUrlFetches.delete(url); })), operators.share());
- this._inProgressUrlFetches.set(url, req);
- return req;
- };
- /**
- * Registers an icon config by name in the specified namespace.
- * @param namespace Namespace in which to register the icon config.
- * @param iconName Name under which to register the config.
- * @param config Config to be registered.
- */
- /**
- * Registers an icon config by name in the specified namespace.
- * @private
- * @template THIS
- * @this {THIS}
- * @param {?} namespace Namespace in which to register the icon config.
- * @param {?} iconName Name under which to register the config.
- * @param {?} config Config to be registered.
- * @return {THIS}
- */
- MatIconRegistry.prototype._addSvgIconConfig = /**
- * Registers an icon config by name in the specified namespace.
- * @private
- * @template THIS
- * @this {THIS}
- * @param {?} namespace Namespace in which to register the icon config.
- * @param {?} iconName Name under which to register the config.
- * @param {?} config Config to be registered.
- * @return {THIS}
- */
- function (namespace, iconName, config) {
- (/** @type {?} */ (this))._svgIconConfigs.set(iconKey(namespace, iconName), config);
- return (/** @type {?} */ (this));
- };
- /**
- * Registers an icon set config in the specified namespace.
- * @param namespace Namespace in which to register the icon config.
- * @param config Config to be registered.
- */
- /**
- * Registers an icon set config in the specified namespace.
- * @private
- * @template THIS
- * @this {THIS}
- * @param {?} namespace Namespace in which to register the icon config.
- * @param {?} config Config to be registered.
- * @return {THIS}
- */
- MatIconRegistry.prototype._addSvgIconSetConfig = /**
- * Registers an icon set config in the specified namespace.
- * @private
- * @template THIS
- * @this {THIS}
- * @param {?} namespace Namespace in which to register the icon config.
- * @param {?} config Config to be registered.
- * @return {THIS}
- */
- function (namespace, config) {
- /** @type {?} */
- var configNamespace = (/** @type {?} */ (this))._iconSetConfigs.get(namespace);
- if (configNamespace) {
- configNamespace.push(config);
- }
- else {
- (/** @type {?} */ (this))._iconSetConfigs.set(namespace, [config]);
- }
- return (/** @type {?} */ (this));
- };
- MatIconRegistry.decorators = [
- { type: core.Injectable, args: [{ providedIn: 'root' },] },
- ];
- /** @nocollapse */
- MatIconRegistry.ctorParameters = function () { return [
- { type: http.HttpClient, decorators: [{ type: core.Optional }] },
- { type: platformBrowser.DomSanitizer },
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [common.DOCUMENT,] }] }
- ]; };
- /** @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" });
- return MatIconRegistry;
- }());
- /**
- * \@docs-private
- * @param {?} parentRegistry
- * @param {?} httpClient
- * @param {?} sanitizer
- * @param {?=} document
- * @return {?}
- */
- function ICON_REGISTRY_PROVIDER_FACTORY(parentRegistry, httpClient, sanitizer, document) {
- return parentRegistry || new MatIconRegistry(httpClient, sanitizer, document);
- }
- /**
- * \@docs-private
- * @type {?}
- */
- var ICON_REGISTRY_PROVIDER = {
- // If there is already an MatIconRegistry available, use that. Otherwise, provide a new one.
- provide: MatIconRegistry,
- deps: [
- [new core.Optional(), new core.SkipSelf(), MatIconRegistry],
- [new core.Optional(), http.HttpClient],
- platformBrowser.DomSanitizer,
- [new core.Optional(), (/** @type {?} */ (common.DOCUMENT))],
- ],
- useFactory: ICON_REGISTRY_PROVIDER_FACTORY,
- };
- /**
- * Clones an SVGElement while preserving type information.
- * @param {?} svg
- * @return {?}
- */
- function cloneSvg(svg) {
- return (/** @type {?} */ (svg.cloneNode(true)));
- }
- /**
- * Returns the cache key to use for an icon namespace and name.
- * @param {?} namespace
- * @param {?} name
- * @return {?}
- */
- function iconKey(namespace, name) {
- return namespace + ':' + name;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- // Boilerplate for applying mixins to MatIcon.
- /**
- * \@docs-private
- */
- var
- // Boilerplate for applying mixins to MatIcon.
- /**
- * \@docs-private
- */
- MatIconBase = /** @class */ (function () {
- function MatIconBase(_elementRef) {
- this._elementRef = _elementRef;
- }
- return MatIconBase;
- }());
- /** @type {?} */
- var _MatIconMixinBase = mixinColor(MatIconBase);
- /**
- * Injection token used to provide the current location to `MatIcon`.
- * Used to handle server-side rendering and to stub out during unit tests.
- * \@docs-private
- * @type {?}
- */
- var MAT_ICON_LOCATION = new core.InjectionToken('mat-icon-location', {
- providedIn: 'root',
- factory: MAT_ICON_LOCATION_FACTORY
- });
- /**
- * \@docs-private
- * @return {?}
- */
- function MAT_ICON_LOCATION_FACTORY() {
- /** @type {?} */
- var _document = core.inject(common.DOCUMENT);
- /** @type {?} */
- var _location = _document ? _document.location : null;
- return {
- // Note that this needs to be a function, rather than a property, because Angular
- // will only resolve it once, but we want the current path on each call.
- getPathname: (/**
- * @return {?}
- */
- function () { return _location ? (_location.pathname + _location.search) : ''; })
- };
- }
- /**
- * SVG attributes that accept a FuncIRI (e.g. `url(<something>)`).
- * @type {?}
- */
- var funcIriAttributes = [
- 'clip-path',
- 'color-profile',
- 'src',
- 'cursor',
- 'fill',
- 'filter',
- 'marker',
- 'marker-start',
- 'marker-mid',
- 'marker-end',
- 'mask',
- 'stroke'
- ];
- var ɵ0$5 = /**
- * @param {?} attr
- * @return {?}
- */
- function (attr) { return "[" + attr + "]"; };
- /**
- * Selector that can be used to find all elements that are using a `FuncIRI`.
- * @type {?}
- */
- var funcIriAttributeSelector = funcIriAttributes.map((ɵ0$5)).join(', ');
- /**
- * Regex that can be used to extract the id out of a FuncIRI.
- * @type {?}
- */
- var funcIriPattern = /^url\(['"]?#(.*?)['"]?\)$/;
- /**
- * Component to display an icon. It can be used in the following ways:
- *
- * - Specify the svgIcon input to load an SVG icon from a URL previously registered with the
- * addSvgIcon, addSvgIconInNamespace, addSvgIconSet, or addSvgIconSetInNamespace methods of
- * MatIconRegistry. If the svgIcon value contains a colon it is assumed to be in the format
- * "[namespace]:[name]", if not the value will be the name of an icon in the default namespace.
- * Examples:
- * `<mat-icon svgIcon="left-arrow"></mat-icon>
- * <mat-icon svgIcon="animals:cat"></mat-icon>`
- *
- * - Use a font ligature as an icon by putting the ligature text in the content of the `<mat-icon>`
- * component. By default the Material icons font is used as described at
- * http://google.github.io/material-design-icons/#icon-font-for-the-web. You can specify an
- * alternate font by setting the fontSet input to either the CSS class to apply to use the
- * desired font, or to an alias previously registered with MatIconRegistry.registerFontClassAlias.
- * Examples:
- * `<mat-icon>home</mat-icon>
- * <mat-icon fontSet="myfont">sun</mat-icon>`
- *
- * - Specify a font glyph to be included via CSS rules by setting the fontSet input to specify the
- * font, and the fontIcon input to specify the icon. Typically the fontIcon will specify a
- * CSS class which causes the glyph to be displayed via a :before selector, as in
- * https://fortawesome.github.io/Font-Awesome/examples/
- * Example:
- * `<mat-icon fontSet="fa" fontIcon="alarm"></mat-icon>`
- */
- var MatIcon = /** @class */ (function (_super) {
- __extends(MatIcon, _super);
- function MatIcon(elementRef, _iconRegistry, ariaHidden, _location) {
- var _this = _super.call(this, elementRef) || this;
- _this._iconRegistry = _iconRegistry;
- _this._location = _location;
- _this._inline = false;
- // If the user has not explicitly set aria-hidden, mark the icon as hidden, as this is
- // the right thing to do for the majority of icon use-cases.
- if (!ariaHidden) {
- elementRef.nativeElement.setAttribute('aria-hidden', 'true');
- }
- return _this;
- }
- Object.defineProperty(MatIcon.prototype, "inline", {
- /**
- * Whether the icon should be inlined, automatically sizing the icon to match the font size of
- * the element the icon is contained in.
- */
- get: /**
- * Whether the icon should be inlined, automatically sizing the icon to match the font size of
- * the element the icon is contained in.
- * @return {?}
- */
- function () {
- return this._inline;
- },
- set: /**
- * @param {?} inline
- * @return {?}
- */
- function (inline) {
- this._inline = coercion.coerceBooleanProperty(inline);
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatIcon.prototype, "fontSet", {
- /** Font set that the icon is a part of. */
- get: /**
- * Font set that the icon is a part of.
- * @return {?}
- */
- function () { return this._fontSet; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._fontSet = this._cleanupFontValue(value);
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatIcon.prototype, "fontIcon", {
- /** Name of an icon within a font set. */
- get: /**
- * Name of an icon within a font set.
- * @return {?}
- */
- function () { return this._fontIcon; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._fontIcon = this._cleanupFontValue(value);
- },
- enumerable: true,
- configurable: true
- });
- /**
- * Splits an svgIcon binding value into its icon set and icon name components.
- * Returns a 2-element array of [(icon set), (icon name)].
- * The separator for the two fields is ':'. If there is no separator, an empty
- * string is returned for the icon set and the entire value is returned for
- * the icon name. If the argument is falsy, returns an array of two empty strings.
- * Throws an error if the name contains two or more ':' separators.
- * Examples:
- * `'social:cake' -> ['social', 'cake']
- * 'penguin' -> ['', 'penguin']
- * null -> ['', '']
- * 'a:b:c' -> (throws Error)`
- */
- /**
- * Splits an svgIcon binding value into its icon set and icon name components.
- * Returns a 2-element array of [(icon set), (icon name)].
- * The separator for the two fields is ':'. If there is no separator, an empty
- * string is returned for the icon set and the entire value is returned for
- * the icon name. If the argument is falsy, returns an array of two empty strings.
- * Throws an error if the name contains two or more ':' separators.
- * Examples:
- * `'social:cake' -> ['social', 'cake']
- * 'penguin' -> ['', 'penguin']
- * null -> ['', '']
- * 'a:b:c' -> (throws Error)`
- * @private
- * @param {?} iconName
- * @return {?}
- */
- MatIcon.prototype._splitIconName = /**
- * Splits an svgIcon binding value into its icon set and icon name components.
- * Returns a 2-element array of [(icon set), (icon name)].
- * The separator for the two fields is ':'. If there is no separator, an empty
- * string is returned for the icon set and the entire value is returned for
- * the icon name. If the argument is falsy, returns an array of two empty strings.
- * Throws an error if the name contains two or more ':' separators.
- * Examples:
- * `'social:cake' -> ['social', 'cake']
- * 'penguin' -> ['', 'penguin']
- * null -> ['', '']
- * 'a:b:c' -> (throws Error)`
- * @private
- * @param {?} iconName
- * @return {?}
- */
- function (iconName) {
- if (!iconName) {
- return ['', ''];
- }
- /** @type {?} */
- var parts = iconName.split(':');
- switch (parts.length) {
- case 1: return ['', parts[0]]; // Use default namespace.
- case 2: return (/** @type {?} */ (parts));
- default: throw Error("Invalid icon name: \"" + iconName + "\"");
- }
- };
- /**
- * @param {?} changes
- * @return {?}
- */
- MatIcon.prototype.ngOnChanges = /**
- * @param {?} changes
- * @return {?}
- */
- function (changes) {
- var _this = this;
- // Only update the inline SVG icon if the inputs changed, to avoid unnecessary DOM operations.
- /** @type {?} */
- var svgIconChanges = changes['svgIcon'];
- if (svgIconChanges) {
- if (this.svgIcon) {
- var _a = this._splitIconName(this.svgIcon), namespace = _a[0], iconName = _a[1];
- this._iconRegistry.getNamedSvgIcon(iconName, namespace).pipe(operators.take(1)).subscribe((/**
- * @param {?} svg
- * @return {?}
- */
- function (svg) { return _this._setSvgElement(svg); }), (/**
- * @param {?} err
- * @return {?}
- */
- function (err) { return console.log("Error retrieving icon: " + err.message); }));
- }
- else if (svgIconChanges.previousValue) {
- this._clearSvgElement();
- }
- }
- if (this._usingFontIcon()) {
- this._updateFontIconClasses();
- }
- };
- /**
- * @return {?}
- */
- MatIcon.prototype.ngOnInit = /**
- * @return {?}
- */
- function () {
- // Update font classes because ngOnChanges won't be called if none of the inputs are present,
- // e.g. <mat-icon>arrow</mat-icon> In this case we need to add a CSS class for the default font.
- if (this._usingFontIcon()) {
- this._updateFontIconClasses();
- }
- };
- /**
- * @return {?}
- */
- MatIcon.prototype.ngAfterViewChecked = /**
- * @return {?}
- */
- function () {
- /** @type {?} */
- var cachedElements = this._elementsWithExternalReferences;
- if (cachedElements && this._location && cachedElements.size) {
- /** @type {?} */
- var newPath = this._location.getPathname();
- // We need to check whether the URL has changed on each change detection since
- // the browser doesn't have an API that will let us react on link clicks and
- // we can't depend on the Angular router. The references need to be updated,
- // because while most browsers don't care whether the URL is correct after
- // the first render, Safari will break if the user navigates to a different
- // page and the SVG isn't re-rendered.
- if (newPath !== this._previousPath) {
- this._previousPath = newPath;
- this._prependPathToReferences(newPath);
- }
- }
- };
- /**
- * @return {?}
- */
- MatIcon.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- if (this._elementsWithExternalReferences) {
- this._elementsWithExternalReferences.clear();
- }
- };
- /**
- * @private
- * @return {?}
- */
- MatIcon.prototype._usingFontIcon = /**
- * @private
- * @return {?}
- */
- function () {
- return !this.svgIcon;
- };
- /**
- * @private
- * @param {?} svg
- * @return {?}
- */
- MatIcon.prototype._setSvgElement = /**
- * @private
- * @param {?} svg
- * @return {?}
- */
- function (svg) {
- this._clearSvgElement();
- // Workaround for IE11 and Edge ignoring `style` tags inside dynamically-created SVGs.
- // See: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/10898469/
- // Do this before inserting the element into the DOM, in order to avoid a style recalculation.
- /** @type {?} */
- var styleTags = (/** @type {?} */ (svg.querySelectorAll('style')));
- for (var i = 0; i < styleTags.length; i++) {
- styleTags[i].textContent += ' ';
- }
- // Note: we do this fix here, rather than the icon registry, because the
- // references have to point to the URL at the time that the icon was created.
- if (this._location) {
- /** @type {?} */
- var path = this._location.getPathname();
- this._previousPath = path;
- this._cacheChildrenWithExternalReferences(svg);
- this._prependPathToReferences(path);
- }
- this._elementRef.nativeElement.appendChild(svg);
- };
- /**
- * @private
- * @return {?}
- */
- MatIcon.prototype._clearSvgElement = /**
- * @private
- * @return {?}
- */
- function () {
- /** @type {?} */
- var layoutElement = this._elementRef.nativeElement;
- /** @type {?} */
- var childCount = layoutElement.childNodes.length;
- if (this._elementsWithExternalReferences) {
- this._elementsWithExternalReferences.clear();
- }
- // Remove existing non-element child nodes and SVGs, and add the new SVG element. Note that
- // we can't use innerHTML, because IE will throw if the element has a data binding.
- while (childCount--) {
- /** @type {?} */
- var child = layoutElement.childNodes[childCount];
- // 1 corresponds to Node.ELEMENT_NODE. We remove all non-element nodes in order to get rid
- // of any loose text nodes, as well as any SVG elements in order to remove any old icons.
- if (child.nodeType !== 1 || child.nodeName.toLowerCase() === 'svg') {
- layoutElement.removeChild(child);
- }
- }
- };
- /**
- * @private
- * @return {?}
- */
- MatIcon.prototype._updateFontIconClasses = /**
- * @private
- * @return {?}
- */
- function () {
- if (!this._usingFontIcon()) {
- return;
- }
- /** @type {?} */
- var elem = this._elementRef.nativeElement;
- /** @type {?} */
- var fontSetClass = this.fontSet ?
- this._iconRegistry.classNameForFontAlias(this.fontSet) :
- this._iconRegistry.getDefaultFontSetClass();
- if (fontSetClass != this._previousFontSetClass) {
- if (this._previousFontSetClass) {
- elem.classList.remove(this._previousFontSetClass);
- }
- if (fontSetClass) {
- elem.classList.add(fontSetClass);
- }
- this._previousFontSetClass = fontSetClass;
- }
- if (this.fontIcon != this._previousFontIconClass) {
- if (this._previousFontIconClass) {
- elem.classList.remove(this._previousFontIconClass);
- }
- if (this.fontIcon) {
- elem.classList.add(this.fontIcon);
- }
- this._previousFontIconClass = this.fontIcon;
- }
- };
- /**
- * Cleans up a value to be used as a fontIcon or fontSet.
- * Since the value ends up being assigned as a CSS class, we
- * have to trim the value and omit space-separated values.
- */
- /**
- * Cleans up a value to be used as a fontIcon or fontSet.
- * Since the value ends up being assigned as a CSS class, we
- * have to trim the value and omit space-separated values.
- * @private
- * @param {?} value
- * @return {?}
- */
- MatIcon.prototype._cleanupFontValue = /**
- * Cleans up a value to be used as a fontIcon or fontSet.
- * Since the value ends up being assigned as a CSS class, we
- * have to trim the value and omit space-separated values.
- * @private
- * @param {?} value
- * @return {?}
- */
- function (value) {
- return typeof value === 'string' ? value.trim().split(' ')[0] : value;
- };
- /**
- * Prepends the current path to all elements that have an attribute pointing to a `FuncIRI`
- * reference. This is required because WebKit browsers require references to be prefixed with
- * the current path, if the page has a `base` tag.
- */
- /**
- * Prepends the current path to all elements that have an attribute pointing to a `FuncIRI`
- * reference. This is required because WebKit browsers require references to be prefixed with
- * the current path, if the page has a `base` tag.
- * @private
- * @param {?} path
- * @return {?}
- */
- MatIcon.prototype._prependPathToReferences = /**
- * Prepends the current path to all elements that have an attribute pointing to a `FuncIRI`
- * reference. This is required because WebKit browsers require references to be prefixed with
- * the current path, if the page has a `base` tag.
- * @private
- * @param {?} path
- * @return {?}
- */
- function (path) {
- /** @type {?} */
- var elements = this._elementsWithExternalReferences;
- if (elements) {
- elements.forEach((/**
- * @param {?} attrs
- * @param {?} element
- * @return {?}
- */
- function (attrs, element) {
- attrs.forEach((/**
- * @param {?} attr
- * @return {?}
- */
- function (attr) {
- element.setAttribute(attr.name, "url('" + path + "#" + attr.value + "')");
- }));
- }));
- }
- };
- /**
- * Caches the children of an SVG element that have `url()`
- * references that we need to prefix with the current path.
- */
- /**
- * Caches the children of an SVG element that have `url()`
- * references that we need to prefix with the current path.
- * @private
- * @param {?} element
- * @return {?}
- */
- MatIcon.prototype._cacheChildrenWithExternalReferences = /**
- * Caches the children of an SVG element that have `url()`
- * references that we need to prefix with the current path.
- * @private
- * @param {?} element
- * @return {?}
- */
- function (element) {
- /** @type {?} */
- var elementsWithFuncIri = element.querySelectorAll(funcIriAttributeSelector);
- /** @type {?} */
- var elements = this._elementsWithExternalReferences =
- this._elementsWithExternalReferences || new Map();
- var _loop_1 = function (i) {
- funcIriAttributes.forEach((/**
- * @param {?} attr
- * @return {?}
- */
- function (attr) {
- /** @type {?} */
- var elementWithReference = elementsWithFuncIri[i];
- /** @type {?} */
- var value = elementWithReference.getAttribute(attr);
- /** @type {?} */
- var match = value ? value.match(funcIriPattern) : null;
- if (match) {
- /** @type {?} */
- var attributes = elements.get(elementWithReference);
- if (!attributes) {
- attributes = [];
- elements.set(elementWithReference, attributes);
- }
- (/** @type {?} */ (attributes)).push({ name: attr, value: match[1] });
- }
- }));
- };
- for (var i = 0; i < elementsWithFuncIri.length; i++) {
- _loop_1(i);
- }
- };
- MatIcon.decorators = [
- { type: core.Component, args: [{template: '<ng-content></ng-content>',
- selector: 'mat-icon',
- exportAs: 'matIcon',
- 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}"],
- inputs: ['color'],
- host: {
- 'role': 'img',
- 'class': 'mat-icon notranslate',
- '[class.mat-icon-inline]': 'inline',
- '[class.mat-icon-no-color]': 'color !== "primary" && color !== "accent" && color !== "warn"',
- },
- encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- },] },
- ];
- /** @nocollapse */
- MatIcon.ctorParameters = function () { return [
- { type: core.ElementRef },
- { type: MatIconRegistry },
- { type: String, decorators: [{ type: core.Attribute, args: ['aria-hidden',] }] },
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_ICON_LOCATION,] }] }
- ]; };
- MatIcon.propDecorators = {
- inline: [{ type: core.Input }],
- svgIcon: [{ type: core.Input }],
- fontSet: [{ type: core.Input }],
- fontIcon: [{ type: core.Input }]
- };
- return MatIcon;
- }(_MatIconMixinBase));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var MatIconModule = /** @class */ (function () {
- function MatIconModule() {
- }
- MatIconModule.decorators = [
- { type: core.NgModule, args: [{
- imports: [MatCommonModule],
- exports: [MatIcon, MatCommonModule],
- declarations: [MatIcon],
- },] },
- ];
- return MatIconModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- // Boilerplate for applying mixins to MatList.
- /**
- * \@docs-private
- */
- var
- // Boilerplate for applying mixins to MatList.
- /**
- * \@docs-private
- */
- MatListBase = /** @class */ (function () {
- function MatListBase() {
- }
- return MatListBase;
- }());
- /** @type {?} */
- var _MatListMixinBase = mixinDisableRipple(MatListBase);
- // Boilerplate for applying mixins to MatListItem.
- /**
- * \@docs-private
- */
- var
- // Boilerplate for applying mixins to MatListItem.
- /**
- * \@docs-private
- */
- MatListItemBase = /** @class */ (function () {
- function MatListItemBase() {
- }
- return MatListItemBase;
- }());
- /** @type {?} */
- var _MatListItemMixinBase = mixinDisableRipple(MatListItemBase);
- var MatNavList = /** @class */ (function (_super) {
- __extends(MatNavList, _super);
- function MatNavList() {
- var _this = _super !== null && _super.apply(this, arguments) || this;
- /**
- * Emits when the state of the list changes.
- */
- _this._stateChanges = new rxjs.Subject();
- return _this;
- }
- /**
- * @return {?}
- */
- MatNavList.prototype.ngOnChanges = /**
- * @return {?}
- */
- function () {
- this._stateChanges.next();
- };
- /**
- * @return {?}
- */
- MatNavList.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- this._stateChanges.complete();
- };
- MatNavList.decorators = [
- { type: core.Component, args: [{selector: 'mat-nav-list',
- exportAs: 'matNavList',
- host: {
- 'role': 'navigation',
- 'class': 'mat-nav-list mat-list-base'
- },
- template: "<ng-content></ng-content>",
- 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}}"],
- inputs: ['disableRipple'],
- encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- },] },
- ];
- return MatNavList;
- }(_MatListMixinBase));
- var MatList = /** @class */ (function (_super) {
- __extends(MatList, _super);
- function MatList(_elementRef) {
- var _this = _super.call(this) || this;
- _this._elementRef = _elementRef;
- /**
- * Emits when the state of the list changes.
- */
- _this._stateChanges = new rxjs.Subject();
- if (_this._getListType() === 'action-list') {
- _elementRef.nativeElement.classList.add('mat-action-list');
- }
- return _this;
- }
- /**
- * @return {?}
- */
- MatList.prototype._getListType = /**
- * @return {?}
- */
- function () {
- /** @type {?} */
- var nodeName = this._elementRef.nativeElement.nodeName.toLowerCase();
- if (nodeName === 'mat-list') {
- return 'list';
- }
- if (nodeName === 'mat-action-list') {
- return 'action-list';
- }
- return null;
- };
- /**
- * @return {?}
- */
- MatList.prototype.ngOnChanges = /**
- * @return {?}
- */
- function () {
- this._stateChanges.next();
- };
- /**
- * @return {?}
- */
- MatList.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- this._stateChanges.complete();
- };
- MatList.decorators = [
- { type: core.Component, args: [{selector: 'mat-list, mat-action-list',
- exportAs: 'matList',
- template: "<ng-content></ng-content>",
- host: {
- 'class': 'mat-list mat-list-base'
- },
- 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}}"],
- inputs: ['disableRipple'],
- encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- },] },
- ];
- /** @nocollapse */
- MatList.ctorParameters = function () { return [
- { type: core.ElementRef }
- ]; };
- return MatList;
- }(_MatListMixinBase));
- /**
- * Directive whose purpose is to add the mat- CSS styling to this selector.
- * \@docs-private
- */
- var MatListAvatarCssMatStyler = /** @class */ (function () {
- function MatListAvatarCssMatStyler() {
- }
- MatListAvatarCssMatStyler.decorators = [
- { type: core.Directive, args: [{
- selector: '[mat-list-avatar], [matListAvatar]',
- host: { 'class': 'mat-list-avatar' }
- },] },
- ];
- return MatListAvatarCssMatStyler;
- }());
- /**
- * Directive whose purpose is to add the mat- CSS styling to this selector.
- * \@docs-private
- */
- var MatListIconCssMatStyler = /** @class */ (function () {
- function MatListIconCssMatStyler() {
- }
- MatListIconCssMatStyler.decorators = [
- { type: core.Directive, args: [{
- selector: '[mat-list-icon], [matListIcon]',
- host: { 'class': 'mat-list-icon' }
- },] },
- ];
- return MatListIconCssMatStyler;
- }());
- /**
- * Directive whose purpose is to add the mat- CSS styling to this selector.
- * \@docs-private
- */
- var MatListSubheaderCssMatStyler = /** @class */ (function () {
- function MatListSubheaderCssMatStyler() {
- }
- MatListSubheaderCssMatStyler.decorators = [
- { type: core.Directive, args: [{
- selector: '[mat-subheader], [matSubheader]',
- host: { 'class': 'mat-subheader' }
- },] },
- ];
- return MatListSubheaderCssMatStyler;
- }());
- /**
- * An item within a Material Design list.
- */
- var MatListItem = /** @class */ (function (_super) {
- __extends(MatListItem, _super);
- function MatListItem(_element, _changeDetectorRef, navList, list) {
- var _this = _super.call(this) || this;
- _this._element = _element;
- _this._isInteractiveList = false;
- _this._destroyed = new rxjs.Subject();
- _this._isInteractiveList = !!(navList || (list && list._getListType() === 'action-list'));
- _this._list = navList || list;
- // If no type attributed is specified for <button>, set it to "button".
- // If a type attribute is already specified, do nothing.
- /** @type {?} */
- var element = _this._getHostElement();
- if (element.nodeName.toLowerCase() === 'button' && !element.hasAttribute('type')) {
- element.setAttribute('type', 'button');
- }
- if (_this._list) {
- // React to changes in the state of the parent list since
- // some of the item's properties depend on it (e.g. `disableRipple`).
- _this._list._stateChanges.pipe(operators.takeUntil(_this._destroyed)).subscribe((/**
- * @return {?}
- */
- function () {
- _changeDetectorRef.markForCheck();
- }));
- }
- return _this;
- }
- /**
- * @return {?}
- */
- MatListItem.prototype.ngAfterContentInit = /**
- * @return {?}
- */
- function () {
- setLines(this._lines, this._element);
- };
- /**
- * @return {?}
- */
- MatListItem.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- this._destroyed.next();
- this._destroyed.complete();
- };
- /** Whether this list item should show a ripple effect when clicked. */
- /**
- * Whether this list item should show a ripple effect when clicked.
- * @return {?}
- */
- MatListItem.prototype._isRippleDisabled = /**
- * Whether this list item should show a ripple effect when clicked.
- * @return {?}
- */
- function () {
- return !this._isInteractiveList || this.disableRipple ||
- !!(this._list && this._list.disableRipple);
- };
- /** Retrieves the DOM element of the component host. */
- /**
- * Retrieves the DOM element of the component host.
- * @return {?}
- */
- MatListItem.prototype._getHostElement = /**
- * Retrieves the DOM element of the component host.
- * @return {?}
- */
- function () {
- return this._element.nativeElement;
- };
- MatListItem.decorators = [
- { type: core.Component, args: [{selector: 'mat-list-item, a[mat-list-item], button[mat-list-item]',
- exportAs: 'matListItem',
- host: {
- 'class': 'mat-list-item',
- // @breaking-change 8.0.0 Remove `mat-list-item-avatar` in favor of `mat-list-item-with-avatar`.
- '[class.mat-list-item-avatar]': '_avatar || _icon',
- '[class.mat-list-item-with-avatar]': '_avatar || _icon',
- },
- inputs: ['disableRipple'],
- 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>",
- encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- },] },
- ];
- /** @nocollapse */
- MatListItem.ctorParameters = function () { return [
- { type: core.ElementRef },
- { type: core.ChangeDetectorRef },
- { type: MatNavList, decorators: [{ type: core.Optional }] },
- { type: MatList, decorators: [{ type: core.Optional }] }
- ]; };
- MatListItem.propDecorators = {
- _lines: [{ type: core.ContentChildren, args: [MatLine, { descendants: true },] }],
- _avatar: [{ type: core.ContentChild, args: [MatListAvatarCssMatStyler, { static: false },] }],
- _icon: [{ type: core.ContentChild, args: [MatListIconCssMatStyler, { static: false },] }]
- };
- return MatListItem;
- }(_MatListItemMixinBase));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * \@docs-private
- */
- var /**
- * \@docs-private
- */
- MatSelectionListBase = /** @class */ (function () {
- function MatSelectionListBase() {
- }
- return MatSelectionListBase;
- }());
- /** @type {?} */
- var _MatSelectionListMixinBase = mixinDisableRipple(MatSelectionListBase);
- /**
- * \@docs-private
- */
- var /**
- * \@docs-private
- */
- MatListOptionBase = /** @class */ (function () {
- function MatListOptionBase() {
- }
- return MatListOptionBase;
- }());
- /** @type {?} */
- var _MatListOptionMixinBase = mixinDisableRipple(MatListOptionBase);
- /**
- * \@docs-private
- * @type {?}
- */
- var MAT_SELECTION_LIST_VALUE_ACCESSOR = {
- provide: forms.NG_VALUE_ACCESSOR,
- useExisting: core.forwardRef((/**
- * @return {?}
- */
- function () { return MatSelectionList; })),
- multi: true
- };
- /**
- * Change event that is being fired whenever the selected state of an option changes.
- */
- var /**
- * Change event that is being fired whenever the selected state of an option changes.
- */
- MatSelectionListChange = /** @class */ (function () {
- function MatSelectionListChange(source, option) {
- this.source = source;
- this.option = option;
- }
- return MatSelectionListChange;
- }());
- /**
- * Component for list-options of selection-list. Each list-option can automatically
- * generate a checkbox and can put current item into the selectionModel of selection-list
- * if the current item is selected.
- */
- var MatListOption = /** @class */ (function (_super) {
- __extends(MatListOption, _super);
- function MatListOption(_element, _changeDetector, selectionList) {
- var _this = _super.call(this) || this;
- _this._element = _element;
- _this._changeDetector = _changeDetector;
- _this.selectionList = selectionList;
- _this._selected = false;
- _this._disabled = false;
- _this._hasFocus = false;
- /**
- * Whether the label should appear before or after the checkbox. Defaults to 'after'
- */
- _this.checkboxPosition = 'after';
- return _this;
- }
- Object.defineProperty(MatListOption.prototype, "color", {
- /** Theme color of the list option. This sets the color of the checkbox. */
- get: /**
- * Theme color of the list option. This sets the color of the checkbox.
- * @return {?}
- */
- function () { return this._color || this.selectionList.color; },
- set: /**
- * @param {?} newValue
- * @return {?}
- */
- function (newValue) { this._color = newValue; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatListOption.prototype, "value", {
- /** Value of the option */
- get: /**
- * Value of the option
- * @return {?}
- */
- function () { return this._value; },
- set: /**
- * @param {?} newValue
- * @return {?}
- */
- function (newValue) {
- if (this.selected && newValue !== this.value) {
- this.selected = false;
- }
- this._value = newValue;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatListOption.prototype, "disabled", {
- /** Whether the option is disabled. */
- get: /**
- * Whether the option is disabled.
- * @return {?}
- */
- function () { return this._disabled || (this.selectionList && this.selectionList.disabled); },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- /** @type {?} */
- var newValue = coercion.coerceBooleanProperty(value);
- if (newValue !== this._disabled) {
- this._disabled = newValue;
- this._changeDetector.markForCheck();
- }
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatListOption.prototype, "selected", {
- /** Whether the option is selected. */
- get: /**
- * Whether the option is selected.
- * @return {?}
- */
- function () { return this.selectionList.selectedOptions.isSelected(this); },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- /** @type {?} */
- var isSelected = coercion.coerceBooleanProperty(value);
- if (isSelected !== this._selected) {
- this._setSelected(isSelected);
- this.selectionList._reportValueChange();
- }
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- MatListOption.prototype.ngOnInit = /**
- * @return {?}
- */
- function () {
- var _this = this;
- /** @type {?} */
- var list = this.selectionList;
- if (list._value && list._value.some((/**
- * @param {?} value
- * @return {?}
- */
- function (value) { return list.compareWith(value, _this._value); }))) {
- this._setSelected(true);
- }
- /** @type {?} */
- var wasSelected = this._selected;
- // List options that are selected at initialization can't be reported properly to the form
- // control. This is because it takes some time until the selection-list knows about all
- // available options. Also it can happen that the ControlValueAccessor has an initial value
- // that should be used instead. Deferring the value change report to the next tick ensures
- // that the form control value is not being overwritten.
- Promise.resolve().then((/**
- * @return {?}
- */
- function () {
- if (_this._selected || wasSelected) {
- _this.selected = true;
- _this._changeDetector.markForCheck();
- }
- }));
- };
- /**
- * @return {?}
- */
- MatListOption.prototype.ngAfterContentInit = /**
- * @return {?}
- */
- function () {
- setLines(this._lines, this._element);
- };
- /**
- * @return {?}
- */
- MatListOption.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- var _this = this;
- if (this.selected) {
- // We have to delay this until the next tick in order
- // to avoid changed after checked errors.
- Promise.resolve().then((/**
- * @return {?}
- */
- function () {
- _this.selected = false;
- }));
- }
- /** @type {?} */
- var hadFocus = this._hasFocus;
- /** @type {?} */
- var newActiveItem = this.selectionList._removeOptionFromList(this);
- // Only move focus if this option was focused at the time it was destroyed.
- if (hadFocus && newActiveItem) {
- newActiveItem.focus();
- }
- };
- /** Toggles the selection state of the option. */
- /**
- * Toggles the selection state of the option.
- * @return {?}
- */
- MatListOption.prototype.toggle = /**
- * Toggles the selection state of the option.
- * @return {?}
- */
- function () {
- this.selected = !this.selected;
- };
- /** Allows for programmatic focusing of the option. */
- /**
- * Allows for programmatic focusing of the option.
- * @return {?}
- */
- MatListOption.prototype.focus = /**
- * Allows for programmatic focusing of the option.
- * @return {?}
- */
- function () {
- this._element.nativeElement.focus();
- };
- /**
- * Returns the list item's text label. Implemented as a part of the FocusKeyManager.
- * @docs-private
- */
- /**
- * Returns the list item's text label. Implemented as a part of the FocusKeyManager.
- * \@docs-private
- * @return {?}
- */
- MatListOption.prototype.getLabel = /**
- * Returns the list item's text label. Implemented as a part of the FocusKeyManager.
- * \@docs-private
- * @return {?}
- */
- function () {
- return this._text ? (this._text.nativeElement.textContent || '') : '';
- };
- /** Whether this list item should show a ripple effect when clicked. */
- /**
- * Whether this list item should show a ripple effect when clicked.
- * @return {?}
- */
- MatListOption.prototype._isRippleDisabled = /**
- * Whether this list item should show a ripple effect when clicked.
- * @return {?}
- */
- function () {
- return this.disabled || this.disableRipple || this.selectionList.disableRipple;
- };
- /**
- * @return {?}
- */
- MatListOption.prototype._handleClick = /**
- * @return {?}
- */
- function () {
- if (!this.disabled) {
- this.toggle();
- // Emit a change event if the selected state of the option changed through user interaction.
- this.selectionList._emitChangeEvent(this);
- }
- };
- /**
- * @return {?}
- */
- MatListOption.prototype._handleFocus = /**
- * @return {?}
- */
- function () {
- this.selectionList._setFocusedOption(this);
- this._hasFocus = true;
- };
- /**
- * @return {?}
- */
- MatListOption.prototype._handleBlur = /**
- * @return {?}
- */
- function () {
- this.selectionList._onTouched();
- this._hasFocus = false;
- };
- /** Retrieves the DOM element of the component host. */
- /**
- * Retrieves the DOM element of the component host.
- * @return {?}
- */
- MatListOption.prototype._getHostElement = /**
- * Retrieves the DOM element of the component host.
- * @return {?}
- */
- function () {
- return this._element.nativeElement;
- };
- /** Sets the selected state of the option. Returns whether the value has changed. */
- /**
- * Sets the selected state of the option. Returns whether the value has changed.
- * @param {?} selected
- * @return {?}
- */
- MatListOption.prototype._setSelected = /**
- * Sets the selected state of the option. Returns whether the value has changed.
- * @param {?} selected
- * @return {?}
- */
- function (selected) {
- if (selected === this._selected) {
- return false;
- }
- this._selected = selected;
- if (selected) {
- this.selectionList.selectedOptions.select(this);
- }
- else {
- this.selectionList.selectedOptions.deselect(this);
- }
- this._changeDetector.markForCheck();
- return true;
- };
- /**
- * Notifies Angular that the option needs to be checked in the next change detection run. Mainly
- * used to trigger an update of the list option if the disabled state of the selection list
- * changed.
- */
- /**
- * Notifies Angular that the option needs to be checked in the next change detection run. Mainly
- * used to trigger an update of the list option if the disabled state of the selection list
- * changed.
- * @return {?}
- */
- MatListOption.prototype._markForCheck = /**
- * Notifies Angular that the option needs to be checked in the next change detection run. Mainly
- * used to trigger an update of the list option if the disabled state of the selection list
- * changed.
- * @return {?}
- */
- function () {
- this._changeDetector.markForCheck();
- };
- MatListOption.decorators = [
- { type: core.Component, args: [{selector: 'mat-list-option',
- exportAs: 'matListOption',
- inputs: ['disableRipple'],
- host: {
- 'role': 'option',
- 'class': 'mat-list-item mat-list-option',
- '(focus)': '_handleFocus()',
- '(blur)': '_handleBlur()',
- '(click)': '_handleClick()',
- 'tabindex': '-1',
- '[class.mat-list-item-disabled]': 'disabled',
- '[class.mat-list-item-with-avatar]': '_avatar || _icon',
- // Manually set the "primary" or "warn" class if the color has been explicitly
- // set to "primary" or "warn". The pseudo checkbox picks up these classes for
- // its theme. The accent theme palette is the default and doesn't need to be set.
- '[class.mat-primary]': 'color === "primary"',
- '[class.mat-warn]': 'color === "warn"',
- '[attr.aria-selected]': 'selected',
- '[attr.aria-disabled]': 'disabled',
- },
- 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>",
- encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- },] },
- ];
- /** @nocollapse */
- MatListOption.ctorParameters = function () { return [
- { type: core.ElementRef },
- { type: core.ChangeDetectorRef },
- { type: MatSelectionList, decorators: [{ type: core.Inject, args: [core.forwardRef((/**
- * @return {?}
- */
- function () { return MatSelectionList; })),] }] }
- ]; };
- MatListOption.propDecorators = {
- _avatar: [{ type: core.ContentChild, args: [MatListAvatarCssMatStyler, { static: false },] }],
- _icon: [{ type: core.ContentChild, args: [MatListIconCssMatStyler, { static: false },] }],
- _lines: [{ type: core.ContentChildren, args: [MatLine,] }],
- _text: [{ type: core.ViewChild, args: ['text', { static: false },] }],
- checkboxPosition: [{ type: core.Input }],
- color: [{ type: core.Input }],
- value: [{ type: core.Input }],
- disabled: [{ type: core.Input }],
- selected: [{ type: core.Input }]
- };
- return MatListOption;
- }(_MatListOptionMixinBase));
- /**
- * Material Design list component where each item is a selectable option. Behaves as a listbox.
- */
- var MatSelectionList = /** @class */ (function (_super) {
- __extends(MatSelectionList, _super);
- function MatSelectionList(_element, tabIndex) {
- var _this = _super.call(this) || this;
- _this._element = _element;
- /**
- * Emits a change event whenever the selected state of an option changes.
- */
- _this.selectionChange = new core.EventEmitter();
- /**
- * Tabindex of the selection list.
- */
- _this.tabIndex = 0;
- /**
- * Theme color of the selection list. This sets the checkbox color for all list options.
- */
- _this.color = 'accent';
- /**
- * Function used for comparing an option against the selected value when determining which
- * options should appear as selected. The first argument is the value of an options. The second
- * one is a value from the selected value. A boolean must be returned.
- */
- _this.compareWith = (/**
- * @param {?} a1
- * @param {?} a2
- * @return {?}
- */
- function (a1, a2) { return a1 === a2; });
- _this._disabled = false;
- /**
- * The currently selected options.
- */
- _this.selectedOptions = new collections.SelectionModel(true);
- /**
- * View to model callback that should be called whenever the selected options change.
- */
- _this._onChange = (/**
- * @param {?} _
- * @return {?}
- */
- function (_) { });
- /**
- * Emits when the list has been destroyed.
- */
- _this._destroyed = new rxjs.Subject();
- /**
- * View to model callback that should be called if the list or its options lost focus.
- */
- _this._onTouched = (/**
- * @return {?}
- */
- function () { });
- _this.tabIndex = parseInt(tabIndex) || 0;
- return _this;
- }
- Object.defineProperty(MatSelectionList.prototype, "disabled", {
- /** Whether the selection list is disabled. */
- get: /**
- * Whether the selection list is disabled.
- * @return {?}
- */
- function () { return this._disabled; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._disabled = coercion.coerceBooleanProperty(value);
- // The `MatSelectionList` and `MatListOption` are using the `OnPush` change detection
- // strategy. Therefore the options will not check for any changes if the `MatSelectionList`
- // changed its state. Since we know that a change to `disabled` property of the list affects
- // the state of the options, we manually mark each option for check.
- this._markOptionsForCheck();
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- MatSelectionList.prototype.ngAfterContentInit = /**
- * @return {?}
- */
- function () {
- this._keyManager = new a11y.FocusKeyManager(this.options)
- .withWrap()
- .withTypeAhead()
- // Allow disabled items to be focusable. For accessibility reasons, there must be a way for
- // screenreader users, that allows reading the different options of the list.
- .skipPredicate((/**
- * @return {?}
- */
- function () { return false; }))
- .withAllowedModifierKeys(['shiftKey']);
- if (this._value) {
- this._setOptionsFromValues(this._value);
- }
- // Sync external changes to the model back to the options.
- this.selectedOptions.onChange.pipe(operators.takeUntil(this._destroyed)).subscribe((/**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- if (event.added) {
- for (var _i = 0, _a = event.added; _i < _a.length; _i++) {
- var item = _a[_i];
- item.selected = true;
- }
- }
- if (event.removed) {
- for (var _b = 0, _c = event.removed; _b < _c.length; _b++) {
- var item = _c[_b];
- item.selected = false;
- }
- }
- }));
- };
- /**
- * @param {?} changes
- * @return {?}
- */
- MatSelectionList.prototype.ngOnChanges = /**
- * @param {?} changes
- * @return {?}
- */
- function (changes) {
- /** @type {?} */
- var disableRippleChanges = changes['disableRipple'];
- /** @type {?} */
- var colorChanges = changes['color'];
- if ((disableRippleChanges && !disableRippleChanges.firstChange) ||
- (colorChanges && !colorChanges.firstChange)) {
- this._markOptionsForCheck();
- }
- };
- /**
- * @return {?}
- */
- MatSelectionList.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- this._destroyed.next();
- this._destroyed.complete();
- this._isDestroyed = true;
- };
- /** Focuses the selection list. */
- /**
- * Focuses the selection list.
- * @param {?=} options
- * @return {?}
- */
- MatSelectionList.prototype.focus = /**
- * Focuses the selection list.
- * @param {?=} options
- * @return {?}
- */
- function (options) {
- this._element.nativeElement.focus(options);
- };
- /** Selects all of the options. */
- /**
- * Selects all of the options.
- * @return {?}
- */
- MatSelectionList.prototype.selectAll = /**
- * Selects all of the options.
- * @return {?}
- */
- function () {
- this._setAllOptionsSelected(true);
- };
- /** Deselects all of the options. */
- /**
- * Deselects all of the options.
- * @return {?}
- */
- MatSelectionList.prototype.deselectAll = /**
- * Deselects all of the options.
- * @return {?}
- */
- function () {
- this._setAllOptionsSelected(false);
- };
- /** Sets the focused option of the selection-list. */
- /**
- * Sets the focused option of the selection-list.
- * @param {?} option
- * @return {?}
- */
- MatSelectionList.prototype._setFocusedOption = /**
- * Sets the focused option of the selection-list.
- * @param {?} option
- * @return {?}
- */
- function (option) {
- this._keyManager.updateActiveItem(option);
- };
- /**
- * Removes an option from the selection list and updates the active item.
- * @returns Currently-active item.
- */
- /**
- * Removes an option from the selection list and updates the active item.
- * @param {?} option
- * @return {?} Currently-active item.
- */
- MatSelectionList.prototype._removeOptionFromList = /**
- * Removes an option from the selection list and updates the active item.
- * @param {?} option
- * @return {?} Currently-active item.
- */
- function (option) {
- /** @type {?} */
- var optionIndex = this._getOptionIndex(option);
- if (optionIndex > -1 && this._keyManager.activeItemIndex === optionIndex) {
- // Check whether the option is the last item
- if (optionIndex > 0) {
- this._keyManager.updateActiveItem(optionIndex - 1);
- }
- else if (optionIndex === 0 && this.options.length > 1) {
- this._keyManager.updateActiveItem(Math.min(optionIndex + 1, this.options.length - 1));
- }
- }
- return this._keyManager.activeItem;
- };
- /** Passes relevant key presses to our key manager. */
- /**
- * Passes relevant key presses to our key manager.
- * @param {?} event
- * @return {?}
- */
- MatSelectionList.prototype._keydown = /**
- * Passes relevant key presses to our key manager.
- * @param {?} event
- * @return {?}
- */
- function (event) {
- /** @type {?} */
- var keyCode = event.keyCode;
- /** @type {?} */
- var manager = this._keyManager;
- /** @type {?} */
- var previousFocusIndex = manager.activeItemIndex;
- /** @type {?} */
- var hasModifier = keycodes.hasModifierKey(event);
- switch (keyCode) {
- case keycodes.SPACE:
- case keycodes.ENTER:
- if (!hasModifier) {
- this._toggleFocusedOption();
- // Always prevent space from scrolling the page since the list has focus
- event.preventDefault();
- }
- break;
- case keycodes.HOME:
- case keycodes.END:
- if (!hasModifier) {
- keyCode === keycodes.HOME ? manager.setFirstItemActive() : manager.setLastItemActive();
- event.preventDefault();
- }
- break;
- case keycodes.A:
- if (keycodes.hasModifierKey(event, 'ctrlKey')) {
- this.options.find((/**
- * @param {?} option
- * @return {?}
- */
- function (option) { return !option.selected; })) ? this.selectAll() : this.deselectAll();
- event.preventDefault();
- }
- break;
- default:
- manager.onKeydown(event);
- }
- if ((keyCode === keycodes.UP_ARROW || keyCode === keycodes.DOWN_ARROW) && event.shiftKey &&
- manager.activeItemIndex !== previousFocusIndex) {
- this._toggleFocusedOption();
- }
- };
- /** Reports a value change to the ControlValueAccessor */
- /**
- * Reports a value change to the ControlValueAccessor
- * @return {?}
- */
- MatSelectionList.prototype._reportValueChange = /**
- * Reports a value change to the ControlValueAccessor
- * @return {?}
- */
- function () {
- // Stop reporting value changes after the list has been destroyed. This avoids
- // cases where the list might wrongly reset its value once it is removed, but
- // the form control is still live.
- if (this.options && !this._isDestroyed) {
- /** @type {?} */
- var value = this._getSelectedOptionValues();
- this._onChange(value);
- this._value = value;
- }
- };
- /** Emits a change event if the selected state of an option changed. */
- /**
- * Emits a change event if the selected state of an option changed.
- * @param {?} option
- * @return {?}
- */
- MatSelectionList.prototype._emitChangeEvent = /**
- * Emits a change event if the selected state of an option changed.
- * @param {?} option
- * @return {?}
- */
- function (option) {
- this.selectionChange.emit(new MatSelectionListChange(this, option));
- };
- /** Implemented as part of ControlValueAccessor. */
- /**
- * Implemented as part of ControlValueAccessor.
- * @param {?} values
- * @return {?}
- */
- MatSelectionList.prototype.writeValue = /**
- * Implemented as part of ControlValueAccessor.
- * @param {?} values
- * @return {?}
- */
- function (values) {
- this._value = values;
- if (this.options) {
- this._setOptionsFromValues(values || []);
- }
- };
- /** Implemented as a part of ControlValueAccessor. */
- /**
- * Implemented as a part of ControlValueAccessor.
- * @param {?} isDisabled
- * @return {?}
- */
- MatSelectionList.prototype.setDisabledState = /**
- * Implemented as a part of ControlValueAccessor.
- * @param {?} isDisabled
- * @return {?}
- */
- function (isDisabled) {
- this.disabled = isDisabled;
- };
- /** Implemented as part of ControlValueAccessor. */
- /**
- * Implemented as part of ControlValueAccessor.
- * @param {?} fn
- * @return {?}
- */
- MatSelectionList.prototype.registerOnChange = /**
- * Implemented as part of ControlValueAccessor.
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- this._onChange = fn;
- };
- /** Implemented as part of ControlValueAccessor. */
- /**
- * Implemented as part of ControlValueAccessor.
- * @param {?} fn
- * @return {?}
- */
- MatSelectionList.prototype.registerOnTouched = /**
- * Implemented as part of ControlValueAccessor.
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- this._onTouched = fn;
- };
- /** Sets the selected options based on the specified values. */
- /**
- * Sets the selected options based on the specified values.
- * @private
- * @param {?} values
- * @return {?}
- */
- MatSelectionList.prototype._setOptionsFromValues = /**
- * Sets the selected options based on the specified values.
- * @private
- * @param {?} values
- * @return {?}
- */
- function (values) {
- var _this = this;
- this.options.forEach((/**
- * @param {?} option
- * @return {?}
- */
- function (option) { return option._setSelected(false); }));
- values.forEach((/**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- /** @type {?} */
- var correspondingOption = _this.options.find((/**
- * @param {?} option
- * @return {?}
- */
- function (option) {
- // Skip options that are already in the model. This allows us to handle cases
- // where the same primitive value is selected multiple times.
- return option.selected ? false : _this.compareWith(option.value, value);
- }));
- if (correspondingOption) {
- correspondingOption._setSelected(true);
- }
- }));
- };
- /** Returns the values of the selected options. */
- /**
- * Returns the values of the selected options.
- * @private
- * @return {?}
- */
- MatSelectionList.prototype._getSelectedOptionValues = /**
- * Returns the values of the selected options.
- * @private
- * @return {?}
- */
- function () {
- return this.options.filter((/**
- * @param {?} option
- * @return {?}
- */
- function (option) { return option.selected; })).map((/**
- * @param {?} option
- * @return {?}
- */
- function (option) { return option.value; }));
- };
- /** Toggles the state of the currently focused option if enabled. */
- /**
- * Toggles the state of the currently focused option if enabled.
- * @private
- * @return {?}
- */
- MatSelectionList.prototype._toggleFocusedOption = /**
- * Toggles the state of the currently focused option if enabled.
- * @private
- * @return {?}
- */
- function () {
- /** @type {?} */
- var focusedIndex = this._keyManager.activeItemIndex;
- if (focusedIndex != null && this._isValidIndex(focusedIndex)) {
- /** @type {?} */
- var focusedOption = this.options.toArray()[focusedIndex];
- if (focusedOption && !focusedOption.disabled) {
- focusedOption.toggle();
- // Emit a change event because the focused option changed its state through user
- // interaction.
- this._emitChangeEvent(focusedOption);
- }
- }
- };
- /**
- * Sets the selected state on all of the options
- * and emits an event if anything changed.
- */
- /**
- * Sets the selected state on all of the options
- * and emits an event if anything changed.
- * @private
- * @param {?} isSelected
- * @return {?}
- */
- MatSelectionList.prototype._setAllOptionsSelected = /**
- * Sets the selected state on all of the options
- * and emits an event if anything changed.
- * @private
- * @param {?} isSelected
- * @return {?}
- */
- function (isSelected) {
- // Keep track of whether anything changed, because we only want to
- // emit the changed event when something actually changed.
- /** @type {?} */
- var hasChanged = false;
- this.options.forEach((/**
- * @param {?} option
- * @return {?}
- */
- function (option) {
- if (option._setSelected(isSelected)) {
- hasChanged = true;
- }
- }));
- if (hasChanged) {
- this._reportValueChange();
- }
- };
- /**
- * Utility to ensure all indexes are valid.
- * @param index The index to be checked.
- * @returns True if the index is valid for our list of options.
- */
- /**
- * Utility to ensure all indexes are valid.
- * @private
- * @param {?} index The index to be checked.
- * @return {?} True if the index is valid for our list of options.
- */
- MatSelectionList.prototype._isValidIndex = /**
- * Utility to ensure all indexes are valid.
- * @private
- * @param {?} index The index to be checked.
- * @return {?} True if the index is valid for our list of options.
- */
- function (index) {
- return index >= 0 && index < this.options.length;
- };
- /** Returns the index of the specified list option. */
- /**
- * Returns the index of the specified list option.
- * @private
- * @param {?} option
- * @return {?}
- */
- MatSelectionList.prototype._getOptionIndex = /**
- * Returns the index of the specified list option.
- * @private
- * @param {?} option
- * @return {?}
- */
- function (option) {
- return this.options.toArray().indexOf(option);
- };
- /** Marks all the options to be checked in the next change detection run. */
- /**
- * Marks all the options to be checked in the next change detection run.
- * @private
- * @return {?}
- */
- MatSelectionList.prototype._markOptionsForCheck = /**
- * Marks all the options to be checked in the next change detection run.
- * @private
- * @return {?}
- */
- function () {
- if (this.options) {
- this.options.forEach((/**
- * @param {?} option
- * @return {?}
- */
- function (option) { return option._markForCheck(); }));
- }
- };
- MatSelectionList.decorators = [
- { type: core.Component, args: [{selector: 'mat-selection-list',
- exportAs: 'matSelectionList',
- inputs: ['disableRipple'],
- host: {
- 'role': 'listbox',
- '[tabIndex]': 'tabIndex',
- 'class': 'mat-selection-list mat-list-base',
- '(blur)': '_onTouched()',
- '(keydown)': '_keydown($event)',
- 'aria-multiselectable': 'true',
- '[attr.aria-disabled]': 'disabled.toString()',
- },
- template: '<ng-content></ng-content>',
- 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}}"],
- encapsulation: core.ViewEncapsulation.None,
- providers: [MAT_SELECTION_LIST_VALUE_ACCESSOR],
- changeDetection: core.ChangeDetectionStrategy.OnPush
- },] },
- ];
- /** @nocollapse */
- MatSelectionList.ctorParameters = function () { return [
- { type: core.ElementRef },
- { type: String, decorators: [{ type: core.Attribute, args: ['tabindex',] }] }
- ]; };
- MatSelectionList.propDecorators = {
- options: [{ type: core.ContentChildren, args: [MatListOption, { descendants: true },] }],
- selectionChange: [{ type: core.Output }],
- tabIndex: [{ type: core.Input }],
- color: [{ type: core.Input }],
- compareWith: [{ type: core.Input }],
- disabled: [{ type: core.Input }]
- };
- return MatSelectionList;
- }(_MatSelectionListMixinBase));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var MatListModule = /** @class */ (function () {
- function MatListModule() {
- }
- MatListModule.decorators = [
- { type: core.NgModule, args: [{
- imports: [MatLineModule, MatRippleModule, MatCommonModule, MatPseudoCheckboxModule, common.CommonModule],
- exports: [
- MatList,
- MatNavList,
- MatListItem,
- MatListAvatarCssMatStyler,
- MatLineModule,
- MatCommonModule,
- MatListIconCssMatStyler,
- MatListSubheaderCssMatStyler,
- MatPseudoCheckboxModule,
- MatSelectionList,
- MatListOption,
- MatDividerModule
- ],
- declarations: [
- MatList,
- MatNavList,
- MatListItem,
- MatListAvatarCssMatStyler,
- MatListIconCssMatStyler,
- MatListSubheaderCssMatStyler,
- MatSelectionList,
- MatListOption
- ],
- },] },
- ];
- return MatListModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Animations used by the mat-menu component.
- * Animation duration and timing values are based on:
- * https://material.io/guidelines/components/menus.html#menus-usage
- * \@docs-private
- * @type {?}
- */
- var matMenuAnimations = {
- /**
- * This animation controls the menu panel's entry and exit from the page.
- *
- * When the menu panel is added to the DOM, it scales in and fades in its border.
- *
- * When the menu panel is removed from the DOM, it simply fades out after a brief
- * delay to display the ripple.
- */
- transformMenu: animations$1.trigger('transformMenu', [
- animations$1.state('void', animations$1.style({
- opacity: 0,
- transform: 'scale(0.8)'
- })),
- animations$1.transition('void => enter', animations$1.group([
- animations$1.query('.mat-menu-content, .mat-mdc-menu-content', animations$1.animate('100ms linear', animations$1.style({
- opacity: 1
- }))),
- animations$1.animate('120ms cubic-bezier(0, 0, 0.2, 1)', animations$1.style({ transform: 'scale(1)' })),
- ])),
- animations$1.transition('* => void', animations$1.animate('100ms 25ms linear', animations$1.style({ opacity: 0 })))
- ]),
- /**
- * This animation fades in the background color and content of the menu panel
- * after its containing element is scaled in.
- */
- fadeInItems: animations$1.trigger('fadeInItems', [
- // TODO(crisbeto): this is inside the `transformMenu`
- // now. Remove next time we do breaking changes.
- animations$1.state('showing', animations$1.style({ opacity: 1 })),
- animations$1.transition('void => *', [
- animations$1.style({ opacity: 0 }),
- animations$1.animate('400ms 100ms cubic-bezier(0.55, 0, 0.55, 0.2)')
- ])
- ])
- };
- /**
- * @deprecated
- * \@breaking-change 8.0.0
- * \@docs-private
- * @type {?}
- */
- var fadeInItems = matMenuAnimations.fadeInItems;
- /**
- * @deprecated
- * \@breaking-change 8.0.0
- * \@docs-private
- * @type {?}
- */
- var transformMenu = matMenuAnimations.transformMenu;
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Menu content that will be rendered lazily once the menu is opened.
- */
- var MatMenuContent = /** @class */ (function () {
- function MatMenuContent(_template, _componentFactoryResolver, _appRef, _injector, _viewContainerRef, _document, _changeDetectorRef) {
- this._template = _template;
- this._componentFactoryResolver = _componentFactoryResolver;
- this._appRef = _appRef;
- this._injector = _injector;
- this._viewContainerRef = _viewContainerRef;
- this._document = _document;
- this._changeDetectorRef = _changeDetectorRef;
- /**
- * Emits when the menu content has been attached.
- */
- this._attached = new rxjs.Subject();
- }
- /**
- * Attaches the content with a particular context.
- * @docs-private
- */
- /**
- * Attaches the content with a particular context.
- * \@docs-private
- * @param {?=} context
- * @return {?}
- */
- MatMenuContent.prototype.attach = /**
- * Attaches the content with a particular context.
- * \@docs-private
- * @param {?=} context
- * @return {?}
- */
- function (context) {
- if (context === void 0) { context = {}; }
- if (!this._portal) {
- this._portal = new portal.TemplatePortal(this._template, this._viewContainerRef);
- }
- this.detach();
- if (!this._outlet) {
- this._outlet = new portal.DomPortalOutlet(this._document.createElement('div'), this._componentFactoryResolver, this._appRef, this._injector);
- }
- /** @type {?} */
- var element = this._template.elementRef.nativeElement;
- // Because we support opening the same menu from different triggers (which in turn have their
- // own `OverlayRef` panel), we have to re-insert the host element every time, otherwise we
- // risk it staying attached to a pane that's no longer in the DOM.
- (/** @type {?} */ (element.parentNode)).insertBefore(this._outlet.outletElement, element);
- // When `MatMenuContent` is used in an `OnPush` component, the insertion of the menu
- // content via `createEmbeddedView` does not cause the content to be seen as "dirty"
- // by Angular. This causes the `@ContentChildren` for menu items within the menu to
- // not be updated by Angular. By explicitly marking for check here, we tell Angular that
- // it needs to check for new menu items and update the `@ContentChild` in `MatMenu`.
- // @breaking-change 9.0.0 Make change detector ref required
- if (this._changeDetectorRef) {
- this._changeDetectorRef.markForCheck();
- }
- this._portal.attach(this._outlet, context);
- this._attached.next();
- };
- /**
- * Detaches the content.
- * @docs-private
- */
- /**
- * Detaches the content.
- * \@docs-private
- * @return {?}
- */
- MatMenuContent.prototype.detach = /**
- * Detaches the content.
- * \@docs-private
- * @return {?}
- */
- function () {
- if (this._portal.isAttached) {
- this._portal.detach();
- }
- };
- /**
- * @return {?}
- */
- MatMenuContent.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- if (this._outlet) {
- this._outlet.dispose();
- }
- };
- MatMenuContent.decorators = [
- { type: core.Directive, args: [{
- selector: 'ng-template[matMenuContent]'
- },] },
- ];
- /** @nocollapse */
- MatMenuContent.ctorParameters = function () { return [
- { type: core.TemplateRef },
- { type: core.ComponentFactoryResolver },
- { type: core.ApplicationRef },
- { type: core.Injector },
- { type: core.ViewContainerRef },
- { type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] },
- { type: core.ChangeDetectorRef }
- ]; };
- return MatMenuContent;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Throws an exception for the case when menu trigger doesn't have a valid mat-menu instance
- * \@docs-private
- * @return {?}
- */
- function throwMatMenuMissingError() {
- 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>");
- }
- /**
- * Throws an exception for the case when menu's x-position value isn't valid.
- * In other words, it doesn't match 'before' or 'after'.
- * \@docs-private
- * @return {?}
- */
- function throwMatMenuInvalidPositionX() {
- throw Error("xPosition value must be either 'before' or after'.\n Example: <mat-menu xPosition=\"before\" #menu=\"matMenu\"></mat-menu>");
- }
- /**
- * Throws an exception for the case when menu's y-position value isn't valid.
- * In other words, it doesn't match 'above' or 'below'.
- * \@docs-private
- * @return {?}
- */
- function throwMatMenuInvalidPositionY() {
- throw Error("yPosition value must be either 'above' or below'.\n Example: <mat-menu yPosition=\"above\" #menu=\"matMenu\"></mat-menu>");
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Injection token used to provide the parent menu to menu-specific components.
- * \@docs-private
- * @type {?}
- */
- var MAT_MENU_PANEL = new core.InjectionToken('MAT_MENU_PANEL');
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- // Boilerplate for applying mixins to MatMenuItem.
- /**
- * \@docs-private
- */
- var
- // Boilerplate for applying mixins to MatMenuItem.
- /**
- * \@docs-private
- */
- MatMenuItemBase = /** @class */ (function () {
- function MatMenuItemBase() {
- }
- return MatMenuItemBase;
- }());
- /** @type {?} */
- var _MatMenuItemMixinBase = mixinDisableRipple(mixinDisabled(MatMenuItemBase));
- /**
- * This directive is intended to be used inside an mat-menu tag.
- * It exists mostly to set the role attribute.
- */
- var MatMenuItem = /** @class */ (function (_super) {
- __extends(MatMenuItem, _super);
- function MatMenuItem(_elementRef, document, _focusMonitor, _parentMenu) {
- var _this =
- // @breaking-change 8.0.0 make `_focusMonitor` and `document` required params.
- _super.call(this) || this;
- _this._elementRef = _elementRef;
- _this._focusMonitor = _focusMonitor;
- _this._parentMenu = _parentMenu;
- /**
- * ARIA role for the menu item.
- */
- _this.role = 'menuitem';
- /**
- * Stream that emits when the menu item is hovered.
- */
- _this._hovered = new rxjs.Subject();
- /**
- * Whether the menu item is highlighted.
- */
- _this._highlighted = false;
- /**
- * Whether the menu item acts as a trigger for a sub-menu.
- */
- _this._triggersSubmenu = false;
- if (_focusMonitor) {
- // Start monitoring the element so it gets the appropriate focused classes. We want
- // to show the focus style for menu items only when the focus was not caused by a
- // mouse or touch interaction.
- _focusMonitor.monitor(_this._elementRef, false);
- }
- if (_parentMenu && _parentMenu.addItem) {
- _parentMenu.addItem(_this);
- }
- _this._document = document;
- return _this;
- }
- /** Focuses the menu item. */
- /**
- * Focuses the menu item.
- * @param {?=} origin
- * @param {?=} options
- * @return {?}
- */
- MatMenuItem.prototype.focus = /**
- * Focuses the menu item.
- * @param {?=} origin
- * @param {?=} options
- * @return {?}
- */
- function (origin, options) {
- if (origin === void 0) { origin = 'program'; }
- if (this._focusMonitor) {
- this._focusMonitor.focusVia(this._getHostElement(), origin, options);
- }
- else {
- this._getHostElement().focus(options);
- }
- };
- /**
- * @return {?}
- */
- MatMenuItem.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- if (this._focusMonitor) {
- this._focusMonitor.stopMonitoring(this._elementRef);
- }
- if (this._parentMenu && this._parentMenu.removeItem) {
- this._parentMenu.removeItem(this);
- }
- this._hovered.complete();
- };
- /** Used to set the `tabindex`. */
- /**
- * Used to set the `tabindex`.
- * @return {?}
- */
- MatMenuItem.prototype._getTabIndex = /**
- * Used to set the `tabindex`.
- * @return {?}
- */
- function () {
- return this.disabled ? '-1' : '0';
- };
- /** Returns the host DOM element. */
- /**
- * Returns the host DOM element.
- * @return {?}
- */
- MatMenuItem.prototype._getHostElement = /**
- * Returns the host DOM element.
- * @return {?}
- */
- function () {
- return this._elementRef.nativeElement;
- };
- /** Prevents the default element actions if it is disabled. */
- // We have to use a `HostListener` here in order to support both Ivy and ViewEngine.
- // In Ivy the `host` bindings will be merged when this class is extended, whereas in
- // ViewEngine they're overwritten.
- // TODO(crisbeto): we move this back into `host` once Ivy is turned on by default.
- // tslint:disable-next-line:no-host-decorator-in-concrete
- /**
- * Prevents the default element actions if it is disabled.
- * @param {?} event
- * @return {?}
- */
- // We have to use a `HostListener` here in order to support both Ivy and ViewEngine.
- // In Ivy the `host` bindings will be merged when this class is extended, whereas in
- // ViewEngine they're overwritten.
- // TODO(crisbeto): we move this back into `host` once Ivy is turned on by default.
- // tslint:disable-next-line:no-host-decorator-in-concrete
- MatMenuItem.prototype._checkDisabled = /**
- * Prevents the default element actions if it is disabled.
- * @param {?} event
- * @return {?}
- */
- // We have to use a `HostListener` here in order to support both Ivy and ViewEngine.
- // In Ivy the `host` bindings will be merged when this class is extended, whereas in
- // ViewEngine they're overwritten.
- // TODO(crisbeto): we move this back into `host` once Ivy is turned on by default.
- // tslint:disable-next-line:no-host-decorator-in-concrete
- function (event) {
- if (this.disabled) {
- event.preventDefault();
- event.stopPropagation();
- }
- };
- /** Emits to the hover stream. */
- // We have to use a `HostListener` here in order to support both Ivy and ViewEngine.
- // In Ivy the `host` bindings will be merged when this class is extended, whereas in
- // ViewEngine they're overwritten.
- // TODO(crisbeto): we move this back into `host` once Ivy is turned on by default.
- // tslint:disable-next-line:no-host-decorator-in-concrete
- /**
- * Emits to the hover stream.
- * @return {?}
- */
- // We have to use a `HostListener` here in order to support both Ivy and ViewEngine.
- // In Ivy the `host` bindings will be merged when this class is extended, whereas in
- // ViewEngine they're overwritten.
- // TODO(crisbeto): we move this back into `host` once Ivy is turned on by default.
- // tslint:disable-next-line:no-host-decorator-in-concrete
- MatMenuItem.prototype._handleMouseEnter = /**
- * Emits to the hover stream.
- * @return {?}
- */
- // We have to use a `HostListener` here in order to support both Ivy and ViewEngine.
- // In Ivy the `host` bindings will be merged when this class is extended, whereas in
- // ViewEngine they're overwritten.
- // TODO(crisbeto): we move this back into `host` once Ivy is turned on by default.
- // tslint:disable-next-line:no-host-decorator-in-concrete
- function () {
- this._hovered.next(this);
- };
- /** Gets the label to be used when determining whether the option should be focused. */
- /**
- * Gets the label to be used when determining whether the option should be focused.
- * @return {?}
- */
- MatMenuItem.prototype.getLabel = /**
- * Gets the label to be used when determining whether the option should be focused.
- * @return {?}
- */
- function () {
- /** @type {?} */
- var element = this._elementRef.nativeElement;
- /** @type {?} */
- var textNodeType = this._document ? this._document.TEXT_NODE : 3;
- /** @type {?} */
- var output = '';
- if (element.childNodes) {
- /** @type {?} */
- var length_1 = element.childNodes.length;
- // Go through all the top-level text nodes and extract their text.
- // We skip anything that's not a text node to prevent the text from
- // being thrown off by something like an icon.
- for (var i = 0; i < length_1; i++) {
- if (element.childNodes[i].nodeType === textNodeType) {
- output += element.childNodes[i].textContent;
- }
- }
- }
- return output.trim();
- };
- MatMenuItem.decorators = [
- { type: core.Component, args: [{selector: '[mat-menu-item]',
- exportAs: 'matMenuItem',
- inputs: ['disabled', 'disableRipple'],
- host: {
- '[attr.role]': 'role',
- 'class': 'mat-menu-item',
- '[class.mat-menu-item-highlighted]': '_highlighted',
- '[class.mat-menu-item-submenu-trigger]': '_triggersSubmenu',
- '[attr.tabindex]': '_getTabIndex()',
- '[attr.aria-disabled]': 'disabled.toString()',
- '[attr.disabled]': 'disabled || null',
- },
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- encapsulation: core.ViewEncapsulation.None,
- template: "<ng-content></ng-content><div class=\"mat-menu-ripple\" matRipple [matRippleDisabled]=\"disableRipple || disabled\" [matRippleTrigger]=\"_getHostElement()\"></div>",
- },] },
- ];
- /** @nocollapse */
- MatMenuItem.ctorParameters = function () { return [
- { type: core.ElementRef },
- { type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] },
- { type: a11y.FocusMonitor },
- { type: undefined, decorators: [{ type: core.Inject, args: [MAT_MENU_PANEL,] }, { type: core.Optional }] }
- ]; };
- MatMenuItem.propDecorators = {
- role: [{ type: core.Input }],
- _checkDisabled: [{ type: core.HostListener, args: ['click', ['$event'],] }],
- _handleMouseEnter: [{ type: core.HostListener, args: ['mouseenter',] }]
- };
- return MatMenuItem;
- }(_MatMenuItemMixinBase));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Injection token to be used to override the default options for `mat-menu`.
- * @type {?}
- */
- var MAT_MENU_DEFAULT_OPTIONS = new core.InjectionToken('mat-menu-default-options', {
- providedIn: 'root',
- factory: MAT_MENU_DEFAULT_OPTIONS_FACTORY
- });
- /**
- * \@docs-private
- * @return {?}
- */
- function MAT_MENU_DEFAULT_OPTIONS_FACTORY() {
- return {
- overlapTrigger: false,
- xPosition: 'after',
- yPosition: 'below',
- backdropClass: 'cdk-overlay-transparent-backdrop',
- };
- }
- /**
- * Start elevation for the menu panel.
- * \@docs-private
- * @type {?}
- */
- var MAT_MENU_BASE_ELEVATION = 4;
- /**
- * Base class with all of the `MatMenu` functionality.
- */
- // tslint:disable-next-line:class-name
- var _MatMenuBase = /** @class */ (function () {
- function _MatMenuBase(_elementRef, _ngZone, _defaultOptions) {
- this._elementRef = _elementRef;
- this._ngZone = _ngZone;
- this._defaultOptions = _defaultOptions;
- this._xPosition = this._defaultOptions.xPosition;
- this._yPosition = this._defaultOptions.yPosition;
- /**
- * Only the direct descendant menu items.
- */
- this._directDescendantItems = new core.QueryList();
- /**
- * Subscription to tab events on the menu panel
- */
- this._tabSubscription = rxjs.Subscription.EMPTY;
- /**
- * Config object to be passed into the menu's ngClass
- */
- this._classList = {};
- /**
- * Current state of the panel animation.
- */
- this._panelAnimationState = 'void';
- /**
- * Emits whenever an animation on the menu completes.
- */
- this._animationDone = new rxjs.Subject();
- /**
- * Class to be added to the backdrop element.
- */
- this.backdropClass = this._defaultOptions.backdropClass;
- this._overlapTrigger = this._defaultOptions.overlapTrigger;
- this._hasBackdrop = this._defaultOptions.hasBackdrop;
- /**
- * Event emitted when the menu is closed.
- */
- this.closed = new core.EventEmitter();
- /**
- * Event emitted when the menu is closed.
- * @deprecated Switch to `closed` instead
- * \@breaking-change 8.0.0
- */
- this.close = this.closed;
- }
- Object.defineProperty(_MatMenuBase.prototype, "xPosition", {
- /** Position of the menu in the X axis. */
- get: /**
- * Position of the menu in the X axis.
- * @return {?}
- */
- function () { return this._xPosition; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- if (value !== 'before' && value !== 'after') {
- throwMatMenuInvalidPositionX();
- }
- this._xPosition = value;
- this.setPositionClasses();
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(_MatMenuBase.prototype, "yPosition", {
- /** Position of the menu in the Y axis. */
- get: /**
- * Position of the menu in the Y axis.
- * @return {?}
- */
- function () { return this._yPosition; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- if (value !== 'above' && value !== 'below') {
- throwMatMenuInvalidPositionY();
- }
- this._yPosition = value;
- this.setPositionClasses();
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(_MatMenuBase.prototype, "overlapTrigger", {
- /** Whether the menu should overlap its trigger. */
- get: /**
- * Whether the menu should overlap its trigger.
- * @return {?}
- */
- function () { return this._overlapTrigger; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._overlapTrigger = coercion.coerceBooleanProperty(value);
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(_MatMenuBase.prototype, "hasBackdrop", {
- /** Whether the menu has a backdrop. */
- get: /**
- * Whether the menu has a backdrop.
- * @return {?}
- */
- function () { return this._hasBackdrop; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._hasBackdrop = coercion.coerceBooleanProperty(value);
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(_MatMenuBase.prototype, "panelClass", {
- /**
- * This method takes classes set on the host mat-menu element and applies them on the
- * menu template that displays in the overlay container. Otherwise, it's difficult
- * to style the containing menu from outside the component.
- * @param classes list of class names
- */
- set: /**
- * This method takes classes set on the host mat-menu element and applies them on the
- * menu template that displays in the overlay container. Otherwise, it's difficult
- * to style the containing menu from outside the component.
- * @param {?} classes list of class names
- * @return {?}
- */
- function (classes) {
- var _this = this;
- /** @type {?} */
- var previousPanelClass = this._previousPanelClass;
- if (previousPanelClass && previousPanelClass.length) {
- previousPanelClass.split(' ').forEach((/**
- * @param {?} className
- * @return {?}
- */
- function (className) {
- _this._classList[className] = false;
- }));
- }
- this._previousPanelClass = classes;
- if (classes && classes.length) {
- classes.split(' ').forEach((/**
- * @param {?} className
- * @return {?}
- */
- function (className) {
- _this._classList[className] = true;
- }));
- this._elementRef.nativeElement.className = '';
- }
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(_MatMenuBase.prototype, "classList", {
- /**
- * This method takes classes set on the host mat-menu element and applies them on the
- * menu template that displays in the overlay container. Otherwise, it's difficult
- * to style the containing menu from outside the component.
- * @deprecated Use `panelClass` instead.
- * @breaking-change 8.0.0
- */
- get: /**
- * This method takes classes set on the host mat-menu element and applies them on the
- * menu template that displays in the overlay container. Otherwise, it's difficult
- * to style the containing menu from outside the component.
- * @deprecated Use `panelClass` instead.
- * \@breaking-change 8.0.0
- * @return {?}
- */
- function () { return this.panelClass; },
- set: /**
- * @param {?} classes
- * @return {?}
- */
- function (classes) { this.panelClass = classes; },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- _MatMenuBase.prototype.ngOnInit = /**
- * @return {?}
- */
- function () {
- this.setPositionClasses();
- };
- /**
- * @return {?}
- */
- _MatMenuBase.prototype.ngAfterContentInit = /**
- * @return {?}
- */
- function () {
- var _this = this;
- this._updateDirectDescendants();
- this._keyManager = new a11y.FocusKeyManager(this._directDescendantItems).withWrap().withTypeAhead();
- this._tabSubscription = this._keyManager.tabOut.subscribe((/**
- * @return {?}
- */
- function () { return _this.closed.emit('tab'); }));
- };
- /**
- * @return {?}
- */
- _MatMenuBase.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- this._directDescendantItems.destroy();
- this._tabSubscription.unsubscribe();
- this.closed.complete();
- };
- /** Stream that emits whenever the hovered menu item changes. */
- /**
- * Stream that emits whenever the hovered menu item changes.
- * @return {?}
- */
- _MatMenuBase.prototype._hovered = /**
- * Stream that emits whenever the hovered menu item changes.
- * @return {?}
- */
- function () {
- // Coerce the `changes` property because Angular types it as `Observable<any>`
- /** @type {?} */
- var itemChanges = (/** @type {?} */ (this._directDescendantItems.changes));
- return itemChanges.pipe(operators.startWith(this._directDescendantItems), operators.switchMap((/**
- * @param {?} items
- * @return {?}
- */
- function (items) { return rxjs.merge.apply(void 0, items.map((/**
- * @param {?} item
- * @return {?}
- */
- function (item) { return item._hovered; }))); })));
- };
- /*
- * Registers a menu item with the menu.
- * @docs-private
- * @deprecated No longer being used. To be removed.
- * @breaking-change 9.0.0
- */
- /*
- * Registers a menu item with the menu.
- * @docs-private
- * @deprecated No longer being used. To be removed.
- * @breaking-change 9.0.0
- */
- /**
- * @param {?} _item
- * @return {?}
- */
- _MatMenuBase.prototype.addItem = /*
- * Registers a menu item with the menu.
- * @docs-private
- * @deprecated No longer being used. To be removed.
- * @breaking-change 9.0.0
- */
- /**
- * @param {?} _item
- * @return {?}
- */
- function (_item) { };
- /**
- * Removes an item from the menu.
- * @docs-private
- * @deprecated No longer being used. To be removed.
- * @breaking-change 9.0.0
- */
- /**
- * Removes an item from the menu.
- * \@docs-private
- * @deprecated No longer being used. To be removed.
- * \@breaking-change 9.0.0
- * @param {?} _item
- * @return {?}
- */
- _MatMenuBase.prototype.removeItem = /**
- * Removes an item from the menu.
- * \@docs-private
- * @deprecated No longer being used. To be removed.
- * \@breaking-change 9.0.0
- * @param {?} _item
- * @return {?}
- */
- function (_item) { };
- /** Handle a keyboard event from the menu, delegating to the appropriate action. */
- /**
- * Handle a keyboard event from the menu, delegating to the appropriate action.
- * @param {?} event
- * @return {?}
- */
- _MatMenuBase.prototype._handleKeydown = /**
- * Handle a keyboard event from the menu, delegating to the appropriate action.
- * @param {?} event
- * @return {?}
- */
- function (event) {
- /** @type {?} */
- var keyCode = event.keyCode;
- /** @type {?} */
- var manager = this._keyManager;
- switch (keyCode) {
- case keycodes.ESCAPE:
- if (!keycodes.hasModifierKey(event)) {
- event.preventDefault();
- this.closed.emit('keydown');
- }
- break;
- case keycodes.LEFT_ARROW:
- if (this.parentMenu && this.direction === 'ltr') {
- this.closed.emit('keydown');
- }
- break;
- case keycodes.RIGHT_ARROW:
- if (this.parentMenu && this.direction === 'rtl') {
- this.closed.emit('keydown');
- }
- break;
- case keycodes.HOME:
- case keycodes.END:
- if (!keycodes.hasModifierKey(event)) {
- keyCode === keycodes.HOME ? manager.setFirstItemActive() : manager.setLastItemActive();
- event.preventDefault();
- }
- break;
- default:
- if (keyCode === keycodes.UP_ARROW || keyCode === keycodes.DOWN_ARROW) {
- manager.setFocusOrigin('keyboard');
- }
- manager.onKeydown(event);
- }
- };
- /**
- * Focus the first item in the menu.
- * @param origin Action from which the focus originated. Used to set the correct styling.
- */
- /**
- * Focus the first item in the menu.
- * @param {?=} origin Action from which the focus originated. Used to set the correct styling.
- * @return {?}
- */
- _MatMenuBase.prototype.focusFirstItem = /**
- * Focus the first item in the menu.
- * @param {?=} origin Action from which the focus originated. Used to set the correct styling.
- * @return {?}
- */
- function (origin) {
- var _this = this;
- if (origin === void 0) { origin = 'program'; }
- // When the content is rendered lazily, it takes a bit before the items are inside the DOM.
- if (this.lazyContent) {
- this._ngZone.onStable.asObservable()
- .pipe(operators.take(1))
- .subscribe((/**
- * @return {?}
- */
- function () { return _this._keyManager.setFocusOrigin(origin).setFirstItemActive(); }));
- }
- else {
- this._keyManager.setFocusOrigin(origin).setFirstItemActive();
- }
- };
- /**
- * Resets the active item in the menu. This is used when the menu is opened, allowing
- * the user to start from the first option when pressing the down arrow.
- */
- /**
- * Resets the active item in the menu. This is used when the menu is opened, allowing
- * the user to start from the first option when pressing the down arrow.
- * @return {?}
- */
- _MatMenuBase.prototype.resetActiveItem = /**
- * Resets the active item in the menu. This is used when the menu is opened, allowing
- * the user to start from the first option when pressing the down arrow.
- * @return {?}
- */
- function () {
- this._keyManager.setActiveItem(-1);
- };
- /**
- * Sets the menu panel elevation.
- * @param depth Number of parent menus that come before the menu.
- */
- /**
- * Sets the menu panel elevation.
- * @param {?} depth Number of parent menus that come before the menu.
- * @return {?}
- */
- _MatMenuBase.prototype.setElevation = /**
- * Sets the menu panel elevation.
- * @param {?} depth Number of parent menus that come before the menu.
- * @return {?}
- */
- function (depth) {
- // The elevation starts at the base and increases by one for each level.
- /** @type {?} */
- var newElevation = "mat-elevation-z" + (MAT_MENU_BASE_ELEVATION + depth);
- /** @type {?} */
- var customElevation = Object.keys(this._classList).find((/**
- * @param {?} c
- * @return {?}
- */
- function (c) { return c.startsWith('mat-elevation-z'); }));
- if (!customElevation || customElevation === this._previousElevation) {
- if (this._previousElevation) {
- this._classList[this._previousElevation] = false;
- }
- this._classList[newElevation] = true;
- this._previousElevation = newElevation;
- }
- };
- /**
- * Adds classes to the menu panel based on its position. Can be used by
- * consumers to add specific styling based on the position.
- * @param posX Position of the menu along the x axis.
- * @param posY Position of the menu along the y axis.
- * @docs-private
- */
- /**
- * Adds classes to the menu panel based on its position. Can be used by
- * consumers to add specific styling based on the position.
- * \@docs-private
- * @param {?=} posX Position of the menu along the x axis.
- * @param {?=} posY Position of the menu along the y axis.
- * @return {?}
- */
- _MatMenuBase.prototype.setPositionClasses = /**
- * Adds classes to the menu panel based on its position. Can be used by
- * consumers to add specific styling based on the position.
- * \@docs-private
- * @param {?=} posX Position of the menu along the x axis.
- * @param {?=} posY Position of the menu along the y axis.
- * @return {?}
- */
- function (posX, posY) {
- if (posX === void 0) { posX = this.xPosition; }
- if (posY === void 0) { posY = this.yPosition; }
- /** @type {?} */
- var classes = this._classList;
- classes['mat-menu-before'] = posX === 'before';
- classes['mat-menu-after'] = posX === 'after';
- classes['mat-menu-above'] = posY === 'above';
- classes['mat-menu-below'] = posY === 'below';
- };
- /** Starts the enter animation. */
- /**
- * Starts the enter animation.
- * @return {?}
- */
- _MatMenuBase.prototype._startAnimation = /**
- * Starts the enter animation.
- * @return {?}
- */
- function () {
- // @breaking-change 8.0.0 Combine with _resetAnimation.
- this._panelAnimationState = 'enter';
- };
- /** Resets the panel animation to its initial state. */
- /**
- * Resets the panel animation to its initial state.
- * @return {?}
- */
- _MatMenuBase.prototype._resetAnimation = /**
- * Resets the panel animation to its initial state.
- * @return {?}
- */
- function () {
- // @breaking-change 8.0.0 Combine with _startAnimation.
- this._panelAnimationState = 'void';
- };
- /** Callback that is invoked when the panel animation completes. */
- /**
- * Callback that is invoked when the panel animation completes.
- * @param {?} event
- * @return {?}
- */
- _MatMenuBase.prototype._onAnimationDone = /**
- * Callback that is invoked when the panel animation completes.
- * @param {?} event
- * @return {?}
- */
- function (event) {
- this._animationDone.next(event);
- this._isAnimating = false;
- };
- /**
- * @param {?} event
- * @return {?}
- */
- _MatMenuBase.prototype._onAnimationStart = /**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- this._isAnimating = true;
- // Scroll the content element to the top as soon as the animation starts. This is necessary,
- // because we move focus to the first item while it's still being animated, which can throw
- // the browser off when it determines the scroll position. Alternatively we can move focus
- // when the animation is done, however moving focus asynchronously will interrupt screen
- // readers which are in the process of reading out the menu already. We take the `element`
- // from the `event` since we can't use a `ViewChild` to access the pane.
- if (event.toState === 'enter' && this._keyManager.activeItemIndex === 0) {
- event.element.scrollTop = 0;
- }
- };
- /**
- * Sets up a stream that will keep track of any newly-added menu items and will update the list
- * of direct descendants. We collect the descendants this way, because `_allItems` can include
- * items that are part of child menus, and using a custom way of registering items is unreliable
- * when it comes to maintaining the item order.
- */
- /**
- * Sets up a stream that will keep track of any newly-added menu items and will update the list
- * of direct descendants. We collect the descendants this way, because `_allItems` can include
- * items that are part of child menus, and using a custom way of registering items is unreliable
- * when it comes to maintaining the item order.
- * @private
- * @return {?}
- */
- _MatMenuBase.prototype._updateDirectDescendants = /**
- * Sets up a stream that will keep track of any newly-added menu items and will update the list
- * of direct descendants. We collect the descendants this way, because `_allItems` can include
- * items that are part of child menus, and using a custom way of registering items is unreliable
- * when it comes to maintaining the item order.
- * @private
- * @return {?}
- */
- function () {
- var _this = this;
- this._allItems.changes
- .pipe(operators.startWith(this._allItems))
- .subscribe((/**
- * @param {?} items
- * @return {?}
- */
- function (items) {
- _this._directDescendantItems.reset(items.filter((/**
- * @param {?} item
- * @return {?}
- */
- function (item) { return item._parentMenu === _this; })));
- _this._directDescendantItems.notifyOnChanges();
- }));
- };
- /** @nocollapse */
- _MatMenuBase.ctorParameters = function () { return [
- { type: core.ElementRef },
- { type: core.NgZone },
- { type: undefined, decorators: [{ type: core.Inject, args: [MAT_MENU_DEFAULT_OPTIONS,] }] }
- ]; };
- _MatMenuBase.propDecorators = {
- _allItems: [{ type: core.ContentChildren, args: [MatMenuItem, { descendants: true },] }],
- backdropClass: [{ type: core.Input }],
- xPosition: [{ type: core.Input }],
- yPosition: [{ type: core.Input }],
- templateRef: [{ type: core.ViewChild, args: [core.TemplateRef, { static: false },] }],
- items: [{ type: core.ContentChildren, args: [MatMenuItem,] }],
- lazyContent: [{ type: core.ContentChild, args: [MatMenuContent, { static: false },] }],
- overlapTrigger: [{ type: core.Input }],
- hasBackdrop: [{ type: core.Input }],
- panelClass: [{ type: core.Input, args: ['class',] }],
- classList: [{ type: core.Input }],
- closed: [{ type: core.Output }],
- close: [{ type: core.Output }]
- };
- return _MatMenuBase;
- }());
- /**
- * \@docs-private We show the "_MatMenu" class as "MatMenu" in the docs.
- */
- var /**
- * \@docs-private We show the "_MatMenu" class as "MatMenu" in the docs.
- */
- MatMenu = /** @class */ (function (_super) {
- __extends(MatMenu, _super);
- function MatMenu() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- return MatMenu;
- }(_MatMenuBase));
- // Note on the weird inheritance setup: we need three classes, because the MDC-based menu has to
- // extend `MatMenu`, however keeping a reference to it will cause the inlined template and styles
- // to be retained as well. The MDC menu also has to provide itself as a `MatMenu` in order for
- // queries and DI to work correctly, while still not referencing the actual menu class.
- // Class responsibility is split up as follows:
- // * _MatMenuBase - provides all the functionality without any of the Angular metadata.
- // * MatMenu - keeps the same name symbol name as the current menu and
- // is used as a provider for DI and query purposes.
- // * _MatMenu - the actual menu component implementation with the Angular metadata that should
- // be tree shaken away for MDC.
- /**
- * \@docs-public MatMenu
- */
- var _MatMenu = /** @class */ (function (_super) {
- __extends(_MatMenu, _super);
- function _MatMenu(elementRef, ngZone, defaultOptions) {
- return _super.call(this, elementRef, ngZone, defaultOptions) || this;
- }
- _MatMenu.decorators = [
- { type: core.Component, args: [{selector: 'mat-menu',
- 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>",
- 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}"],
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- encapsulation: core.ViewEncapsulation.None,
- exportAs: 'matMenu',
- animations: [
- matMenuAnimations.transformMenu,
- matMenuAnimations.fadeInItems
- ],
- providers: [
- { provide: MAT_MENU_PANEL, useExisting: MatMenu },
- { provide: MatMenu, useExisting: _MatMenu }
- ]
- },] },
- ];
- /** @nocollapse */
- _MatMenu.ctorParameters = function () { return [
- { type: core.ElementRef },
- { type: core.NgZone },
- { type: undefined, decorators: [{ type: core.Inject, args: [MAT_MENU_DEFAULT_OPTIONS,] }] }
- ]; };
- return _MatMenu;
- }(MatMenu));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Injection token that determines the scroll handling while the menu is open.
- * @type {?}
- */
- var MAT_MENU_SCROLL_STRATEGY = new core.InjectionToken('mat-menu-scroll-strategy');
- /**
- * \@docs-private
- * @param {?} overlay
- * @return {?}
- */
- function MAT_MENU_SCROLL_STRATEGY_FACTORY(overlay$$1) {
- return (/**
- * @return {?}
- */
- function () { return overlay$$1.scrollStrategies.reposition(); });
- }
- /**
- * \@docs-private
- * @type {?}
- */
- var MAT_MENU_SCROLL_STRATEGY_FACTORY_PROVIDER = {
- provide: MAT_MENU_SCROLL_STRATEGY,
- deps: [overlay.Overlay],
- useFactory: MAT_MENU_SCROLL_STRATEGY_FACTORY,
- };
- /**
- * Default top padding of the menu panel.
- * @type {?}
- */
- var MENU_PANEL_TOP_PADDING = 8;
- /**
- * Options for binding a passive event listener.
- * @type {?}
- */
- var passiveEventListenerOptions = platform.normalizePassiveListenerOptions({ passive: true });
- // TODO(andrewseguin): Remove the kebab versions in favor of camelCased attribute selectors
- /**
- * This directive is intended to be used in conjunction with an mat-menu tag. It is
- * responsible for toggling the display of the provided menu instance.
- */
- var MatMenuTrigger = /** @class */ (function () {
- function MatMenuTrigger(_overlay, _element, _viewContainerRef, scrollStrategy, _parentMenu, _menuItemInstance, _dir, _focusMonitor) {
- var _this = this;
- this._overlay = _overlay;
- this._element = _element;
- this._viewContainerRef = _viewContainerRef;
- this._parentMenu = _parentMenu;
- this._menuItemInstance = _menuItemInstance;
- this._dir = _dir;
- this._focusMonitor = _focusMonitor;
- this._overlayRef = null;
- this._menuOpen = false;
- this._closingActionsSubscription = rxjs.Subscription.EMPTY;
- this._hoverSubscription = rxjs.Subscription.EMPTY;
- this._menuCloseSubscription = rxjs.Subscription.EMPTY;
- /**
- * Handles touch start events on the trigger.
- * Needs to be an arrow function so we can easily use addEventListener and removeEventListener.
- */
- this._handleTouchStart = (/**
- * @return {?}
- */
- function () { return _this._openedBy = 'touch'; });
- // Tracking input type is necessary so it's possible to only auto-focus
- // the first item of the list when the menu is opened via the keyboard
- this._openedBy = null;
- /**
- * Whether focus should be restored when the menu is closed.
- * Note that disabling this option can have accessibility implications
- * and it's up to you to manage focus, if you decide to turn it off.
- */
- this.restoreFocus = true;
- /**
- * Event emitted when the associated menu is opened.
- */
- this.menuOpened = new core.EventEmitter();
- /**
- * Event emitted when the associated menu is opened.
- * @deprecated Switch to `menuOpened` instead
- * \@breaking-change 8.0.0
- */
- // tslint:disable-next-line:no-output-on-prefix
- this.onMenuOpen = this.menuOpened;
- /**
- * Event emitted when the associated menu is closed.
- */
- this.menuClosed = new core.EventEmitter();
- /**
- * Event emitted when the associated menu is closed.
- * @deprecated Switch to `menuClosed` instead
- * \@breaking-change 8.0.0
- */
- // tslint:disable-next-line:no-output-on-prefix
- this.onMenuClose = this.menuClosed;
- _element.nativeElement.addEventListener('touchstart', this._handleTouchStart, passiveEventListenerOptions);
- if (_menuItemInstance) {
- _menuItemInstance._triggersSubmenu = this.triggersSubmenu();
- }
- this._scrollStrategy = scrollStrategy;
- }
- Object.defineProperty(MatMenuTrigger.prototype, "_deprecatedMatMenuTriggerFor", {
- /**
- * @deprecated
- * @breaking-change 8.0.0
- */
- get: /**
- * @deprecated
- * \@breaking-change 8.0.0
- * @return {?}
- */
- function () { return this.menu; },
- set: /**
- * @param {?} v
- * @return {?}
- */
- function (v) {
- this.menu = v;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatMenuTrigger.prototype, "menu", {
- /** References the menu instance that the trigger is associated with. */
- get: /**
- * References the menu instance that the trigger is associated with.
- * @return {?}
- */
- function () { return this._menu; },
- set: /**
- * @param {?} menu
- * @return {?}
- */
- function (menu) {
- var _this = this;
- if (menu === this._menu) {
- return;
- }
- this._menu = menu;
- this._menuCloseSubscription.unsubscribe();
- if (menu) {
- this._menuCloseSubscription = menu.close.asObservable().subscribe((/**
- * @param {?} reason
- * @return {?}
- */
- function (reason) {
- _this._destroyMenu();
- // If a click closed the menu, we should close the entire chain of nested menus.
- if ((reason === 'click' || reason === 'tab') && _this._parentMenu) {
- _this._parentMenu.closed.emit(reason);
- }
- }));
- }
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- MatMenuTrigger.prototype.ngAfterContentInit = /**
- * @return {?}
- */
- function () {
- this._checkMenu();
- this._handleHover();
- };
- /**
- * @return {?}
- */
- MatMenuTrigger.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- if (this._overlayRef) {
- this._overlayRef.dispose();
- this._overlayRef = null;
- }
- this._element.nativeElement.removeEventListener('touchstart', this._handleTouchStart, passiveEventListenerOptions);
- this._menuCloseSubscription.unsubscribe();
- this._closingActionsSubscription.unsubscribe();
- this._hoverSubscription.unsubscribe();
- };
- Object.defineProperty(MatMenuTrigger.prototype, "menuOpen", {
- /** Whether the menu is open. */
- get: /**
- * Whether the menu is open.
- * @return {?}
- */
- function () {
- return this._menuOpen;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatMenuTrigger.prototype, "dir", {
- /** The text direction of the containing app. */
- get: /**
- * The text direction of the containing app.
- * @return {?}
- */
- function () {
- return this._dir && this._dir.value === 'rtl' ? 'rtl' : 'ltr';
- },
- enumerable: true,
- configurable: true
- });
- /** Whether the menu triggers a sub-menu or a top-level one. */
- /**
- * Whether the menu triggers a sub-menu or a top-level one.
- * @return {?}
- */
- MatMenuTrigger.prototype.triggersSubmenu = /**
- * Whether the menu triggers a sub-menu or a top-level one.
- * @return {?}
- */
- function () {
- return !!(this._menuItemInstance && this._parentMenu);
- };
- /** Toggles the menu between the open and closed states. */
- /**
- * Toggles the menu between the open and closed states.
- * @return {?}
- */
- MatMenuTrigger.prototype.toggleMenu = /**
- * Toggles the menu between the open and closed states.
- * @return {?}
- */
- function () {
- return this._menuOpen ? this.closeMenu() : this.openMenu();
- };
- /** Opens the menu. */
- /**
- * Opens the menu.
- * @return {?}
- */
- MatMenuTrigger.prototype.openMenu = /**
- * Opens the menu.
- * @return {?}
- */
- function () {
- var _this = this;
- if (this._menuOpen) {
- return;
- }
- this._checkMenu();
- /** @type {?} */
- var overlayRef = this._createOverlay();
- /** @type {?} */
- var overlayConfig = overlayRef.getConfig();
- this._setPosition((/** @type {?} */ (overlayConfig.positionStrategy)));
- overlayConfig.hasBackdrop = this.menu.hasBackdrop == null ? !this.triggersSubmenu() :
- this.menu.hasBackdrop;
- overlayRef.attach(this._getPortal());
- if (this.menu.lazyContent) {
- this.menu.lazyContent.attach(this.menuData);
- }
- this._closingActionsSubscription = this._menuClosingActions().subscribe((/**
- * @return {?}
- */
- function () { return _this.closeMenu(); }));
- this._initMenu();
- if (this.menu instanceof MatMenu) {
- this.menu._startAnimation();
- }
- };
- /** Closes the menu. */
- /**
- * Closes the menu.
- * @return {?}
- */
- MatMenuTrigger.prototype.closeMenu = /**
- * Closes the menu.
- * @return {?}
- */
- function () {
- this.menu.close.emit();
- };
- /**
- * Focuses the menu trigger.
- * @param origin Source of the menu trigger's focus.
- */
- /**
- * Focuses the menu trigger.
- * @param {?=} origin Source of the menu trigger's focus.
- * @param {?=} options
- * @return {?}
- */
- MatMenuTrigger.prototype.focus = /**
- * Focuses the menu trigger.
- * @param {?=} origin Source of the menu trigger's focus.
- * @param {?=} options
- * @return {?}
- */
- function (origin, options) {
- if (origin === void 0) { origin = 'program'; }
- if (this._focusMonitor) {
- this._focusMonitor.focusVia(this._element, origin, options);
- }
- else {
- this._element.nativeElement.focus(options);
- }
- };
- /** Closes the menu and does the necessary cleanup. */
- /**
- * Closes the menu and does the necessary cleanup.
- * @private
- * @return {?}
- */
- MatMenuTrigger.prototype._destroyMenu = /**
- * Closes the menu and does the necessary cleanup.
- * @private
- * @return {?}
- */
- function () {
- var _this = this;
- if (!this._overlayRef || !this.menuOpen) {
- return;
- }
- /** @type {?} */
- var menu = this.menu;
- this._closingActionsSubscription.unsubscribe();
- this._overlayRef.detach();
- if (menu instanceof MatMenu) {
- menu._resetAnimation();
- if (menu.lazyContent) {
- // Wait for the exit animation to finish before detaching the content.
- menu._animationDone
- .pipe(operators.filter((/**
- * @param {?} event
- * @return {?}
- */
- function (event) { return event.toState === 'void'; })), operators.take(1),
- // Interrupt if the content got re-attached.
- operators.takeUntil(menu.lazyContent._attached))
- .subscribe({
- next: (/**
- * @return {?}
- */
- function () { return (/** @type {?} */ (menu.lazyContent)).detach(); }),
- // No matter whether the content got re-attached, reset the menu.
- complete: (/**
- * @return {?}
- */
- function () { return _this._resetMenu(); })
- });
- }
- else {
- this._resetMenu();
- }
- }
- else {
- this._resetMenu();
- if (menu.lazyContent) {
- menu.lazyContent.detach();
- }
- }
- };
- /**
- * This method sets the menu state to open and focuses the first item if
- * the menu was opened via the keyboard.
- */
- /**
- * This method sets the menu state to open and focuses the first item if
- * the menu was opened via the keyboard.
- * @private
- * @return {?}
- */
- MatMenuTrigger.prototype._initMenu = /**
- * This method sets the menu state to open and focuses the first item if
- * the menu was opened via the keyboard.
- * @private
- * @return {?}
- */
- function () {
- this.menu.parentMenu = this.triggersSubmenu() ? this._parentMenu : undefined;
- this.menu.direction = this.dir;
- this._setMenuElevation();
- this._setIsMenuOpen(true);
- this.menu.focusFirstItem(this._openedBy || 'program');
- };
- /** Updates the menu elevation based on the amount of parent menus that it has. */
- /**
- * Updates the menu elevation based on the amount of parent menus that it has.
- * @private
- * @return {?}
- */
- MatMenuTrigger.prototype._setMenuElevation = /**
- * Updates the menu elevation based on the amount of parent menus that it has.
- * @private
- * @return {?}
- */
- function () {
- if (this.menu.setElevation) {
- /** @type {?} */
- var depth = 0;
- /** @type {?} */
- var parentMenu = this.menu.parentMenu;
- while (parentMenu) {
- depth++;
- parentMenu = parentMenu.parentMenu;
- }
- this.menu.setElevation(depth);
- }
- };
- /**
- * This method resets the menu when it's closed, most importantly restoring
- * focus to the menu trigger if the menu was opened via the keyboard.
- */
- /**
- * This method resets the menu when it's closed, most importantly restoring
- * focus to the menu trigger if the menu was opened via the keyboard.
- * @private
- * @return {?}
- */
- MatMenuTrigger.prototype._resetMenu = /**
- * This method resets the menu when it's closed, most importantly restoring
- * focus to the menu trigger if the menu was opened via the keyboard.
- * @private
- * @return {?}
- */
- function () {
- this._setIsMenuOpen(false);
- // We should reset focus if the user is navigating using a keyboard or
- // if we have a top-level trigger which might cause focus to be lost
- // when clicking on the backdrop.
- if (this.restoreFocus) {
- if (!this._openedBy) {
- // Note that the focus style will show up both for `program` and
- // `keyboard` so we don't have to specify which one it is.
- this.focus();
- }
- else if (!this.triggersSubmenu()) {
- this.focus(this._openedBy);
- }
- }
- this._openedBy = null;
- };
- // set state rather than toggle to support triggers sharing a menu
- // set state rather than toggle to support triggers sharing a menu
- /**
- * @private
- * @param {?} isOpen
- * @return {?}
- */
- MatMenuTrigger.prototype._setIsMenuOpen =
- // set state rather than toggle to support triggers sharing a menu
- /**
- * @private
- * @param {?} isOpen
- * @return {?}
- */
- function (isOpen) {
- this._menuOpen = isOpen;
- this._menuOpen ? this.menuOpened.emit() : this.menuClosed.emit();
- if (this.triggersSubmenu()) {
- this._menuItemInstance._highlighted = isOpen;
- }
- };
- /**
- * This method checks that a valid instance of MatMenu has been passed into
- * matMenuTriggerFor. If not, an exception is thrown.
- */
- /**
- * This method checks that a valid instance of MatMenu has been passed into
- * matMenuTriggerFor. If not, an exception is thrown.
- * @private
- * @return {?}
- */
- MatMenuTrigger.prototype._checkMenu = /**
- * This method checks that a valid instance of MatMenu has been passed into
- * matMenuTriggerFor. If not, an exception is thrown.
- * @private
- * @return {?}
- */
- function () {
- if (!this.menu) {
- throwMatMenuMissingError();
- }
- };
- /**
- * This method creates the overlay from the provided menu's template and saves its
- * OverlayRef so that it can be attached to the DOM when openMenu is called.
- */
- /**
- * This method creates the overlay from the provided menu's template and saves its
- * OverlayRef so that it can be attached to the DOM when openMenu is called.
- * @private
- * @return {?}
- */
- MatMenuTrigger.prototype._createOverlay = /**
- * This method creates the overlay from the provided menu's template and saves its
- * OverlayRef so that it can be attached to the DOM when openMenu is called.
- * @private
- * @return {?}
- */
- function () {
- if (!this._overlayRef) {
- /** @type {?} */
- var config = this._getOverlayConfig();
- this._subscribeToPositions((/** @type {?} */ (config.positionStrategy)));
- this._overlayRef = this._overlay.create(config);
- // Consume the `keydownEvents` in order to prevent them from going to another overlay.
- // Ideally we'd also have our keyboard event logic in here, however doing so will
- // break anybody that may have implemented the `MatMenuPanel` themselves.
- this._overlayRef.keydownEvents().subscribe();
- }
- return this._overlayRef;
- };
- /**
- * This method builds the configuration object needed to create the overlay, the OverlayState.
- * @returns OverlayConfig
- */
- /**
- * This method builds the configuration object needed to create the overlay, the OverlayState.
- * @private
- * @return {?} OverlayConfig
- */
- MatMenuTrigger.prototype._getOverlayConfig = /**
- * This method builds the configuration object needed to create the overlay, the OverlayState.
- * @private
- * @return {?} OverlayConfig
- */
- function () {
- return new overlay.OverlayConfig({
- positionStrategy: this._overlay.position()
- .flexibleConnectedTo(this._element)
- .withLockedPosition()
- .withTransformOriginOn('.mat-menu-panel, .mat-mdc-menu-panel'),
- backdropClass: this.menu.backdropClass || 'cdk-overlay-transparent-backdrop',
- scrollStrategy: this._scrollStrategy(),
- direction: this._dir
- });
- };
- /**
- * Listens to changes in the position of the overlay and sets the correct classes
- * on the menu based on the new position. This ensures the animation origin is always
- * correct, even if a fallback position is used for the overlay.
- */
- /**
- * Listens to changes in the position of the overlay and sets the correct classes
- * on the menu based on the new position. This ensures the animation origin is always
- * correct, even if a fallback position is used for the overlay.
- * @private
- * @param {?} position
- * @return {?}
- */
- MatMenuTrigger.prototype._subscribeToPositions = /**
- * Listens to changes in the position of the overlay and sets the correct classes
- * on the menu based on the new position. This ensures the animation origin is always
- * correct, even if a fallback position is used for the overlay.
- * @private
- * @param {?} position
- * @return {?}
- */
- function (position) {
- var _this = this;
- if (this.menu.setPositionClasses) {
- position.positionChanges.subscribe((/**
- * @param {?} change
- * @return {?}
- */
- function (change) {
- /** @type {?} */
- var posX = change.connectionPair.overlayX === 'start' ? 'after' : 'before';
- /** @type {?} */
- var posY = change.connectionPair.overlayY === 'top' ? 'below' : 'above';
- (/** @type {?} */ (_this.menu.setPositionClasses))(posX, posY);
- }));
- }
- };
- /**
- * Sets the appropriate positions on a position strategy
- * so the overlay connects with the trigger correctly.
- * @param positionStrategy Strategy whose position to update.
- */
- /**
- * Sets the appropriate positions on a position strategy
- * so the overlay connects with the trigger correctly.
- * @private
- * @param {?} positionStrategy Strategy whose position to update.
- * @return {?}
- */
- MatMenuTrigger.prototype._setPosition = /**
- * Sets the appropriate positions on a position strategy
- * so the overlay connects with the trigger correctly.
- * @private
- * @param {?} positionStrategy Strategy whose position to update.
- * @return {?}
- */
- function (positionStrategy) {
- var _a = this.menu.xPosition === 'before' ? ['end', 'start'] : ['start', 'end'], originX = _a[0], originFallbackX = _a[1];
- var _b = this.menu.yPosition === 'above' ? ['bottom', 'top'] : ['top', 'bottom'], overlayY = _b[0], overlayFallbackY = _b[1];
- var _c = [overlayY, overlayFallbackY], originY = _c[0], originFallbackY = _c[1];
- var _d = [originX, originFallbackX], overlayX = _d[0], overlayFallbackX = _d[1];
- /** @type {?} */
- var offsetY = 0;
- if (this.triggersSubmenu()) {
- // When the menu is a sub-menu, it should always align itself
- // to the edges of the trigger, instead of overlapping it.
- overlayFallbackX = originX = this.menu.xPosition === 'before' ? 'start' : 'end';
- originFallbackX = overlayX = originX === 'end' ? 'start' : 'end';
- offsetY = overlayY === 'bottom' ? MENU_PANEL_TOP_PADDING : -MENU_PANEL_TOP_PADDING;
- }
- else if (!this.menu.overlapTrigger) {
- originY = overlayY === 'top' ? 'bottom' : 'top';
- originFallbackY = overlayFallbackY === 'top' ? 'bottom' : 'top';
- }
- positionStrategy.withPositions([
- { originX: originX, originY: originY, overlayX: overlayX, overlayY: overlayY, offsetY: offsetY },
- { originX: originFallbackX, originY: originY, overlayX: overlayFallbackX, overlayY: overlayY, offsetY: offsetY },
- {
- originX: originX,
- originY: originFallbackY,
- overlayX: overlayX,
- overlayY: overlayFallbackY,
- offsetY: -offsetY
- },
- {
- originX: originFallbackX,
- originY: originFallbackY,
- overlayX: overlayFallbackX,
- overlayY: overlayFallbackY,
- offsetY: -offsetY
- }
- ]);
- };
- /** Returns a stream that emits whenever an action that should close the menu occurs. */
- /**
- * Returns a stream that emits whenever an action that should close the menu occurs.
- * @private
- * @return {?}
- */
- MatMenuTrigger.prototype._menuClosingActions = /**
- * Returns a stream that emits whenever an action that should close the menu occurs.
- * @private
- * @return {?}
- */
- function () {
- var _this = this;
- /** @type {?} */
- var backdrop = (/** @type {?} */ (this._overlayRef)).backdropClick();
- /** @type {?} */
- var detachments = (/** @type {?} */ (this._overlayRef)).detachments();
- /** @type {?} */
- var parentClose = this._parentMenu ? this._parentMenu.closed : rxjs.of();
- /** @type {?} */
- var hover = this._parentMenu ? this._parentMenu._hovered().pipe(operators.filter((/**
- * @param {?} active
- * @return {?}
- */
- function (active) { return active !== _this._menuItemInstance; })), operators.filter((/**
- * @return {?}
- */
- function () { return _this._menuOpen; }))) : rxjs.of();
- return rxjs.merge(backdrop, parentClose, hover, detachments);
- };
- /** Handles mouse presses on the trigger. */
- /**
- * Handles mouse presses on the trigger.
- * @param {?} event
- * @return {?}
- */
- MatMenuTrigger.prototype._handleMousedown = /**
- * Handles mouse presses on the trigger.
- * @param {?} event
- * @return {?}
- */
- function (event) {
- if (!a11y.isFakeMousedownFromScreenReader(event)) {
- // Since right or middle button clicks won't trigger the `click` event,
- // we shouldn't consider the menu as opened by mouse in those cases.
- this._openedBy = event.button === 0 ? 'mouse' : null;
- // Since clicking on the trigger won't close the menu if it opens a sub-menu,
- // we should prevent focus from moving onto it via click to avoid the
- // highlight from lingering on the menu item.
- if (this.triggersSubmenu()) {
- event.preventDefault();
- }
- }
- };
- /** Handles key presses on the trigger. */
- /**
- * Handles key presses on the trigger.
- * @param {?} event
- * @return {?}
- */
- MatMenuTrigger.prototype._handleKeydown = /**
- * Handles key presses on the trigger.
- * @param {?} event
- * @return {?}
- */
- function (event) {
- /** @type {?} */
- var keyCode = event.keyCode;
- if (this.triggersSubmenu() && ((keyCode === keycodes.RIGHT_ARROW && this.dir === 'ltr') ||
- (keyCode === keycodes.LEFT_ARROW && this.dir === 'rtl'))) {
- this.openMenu();
- }
- };
- /** Handles click events on the trigger. */
- /**
- * Handles click events on the trigger.
- * @param {?} event
- * @return {?}
- */
- MatMenuTrigger.prototype._handleClick = /**
- * Handles click events on the trigger.
- * @param {?} event
- * @return {?}
- */
- function (event) {
- if (this.triggersSubmenu()) {
- // Stop event propagation to avoid closing the parent menu.
- event.stopPropagation();
- this.openMenu();
- }
- else {
- this.toggleMenu();
- }
- };
- /** Handles the cases where the user hovers over the trigger. */
- /**
- * Handles the cases where the user hovers over the trigger.
- * @private
- * @return {?}
- */
- MatMenuTrigger.prototype._handleHover = /**
- * Handles the cases where the user hovers over the trigger.
- * @private
- * @return {?}
- */
- function () {
- var _this = this;
- // Subscribe to changes in the hovered item in order to toggle the panel.
- if (!this.triggersSubmenu()) {
- return;
- }
- this._hoverSubscription = this._parentMenu._hovered()
- // Since we might have multiple competing triggers for the same menu (e.g. a sub-menu
- // with different data and triggers), we have to delay it by a tick to ensure that
- // it won't be closed immediately after it is opened.
- .pipe(operators.filter((/**
- * @param {?} active
- * @return {?}
- */
- function (active) { return active === _this._menuItemInstance && !active.disabled; })), operators.delay(0, rxjs.asapScheduler))
- .subscribe((/**
- * @return {?}
- */
- function () {
- _this._openedBy = 'mouse';
- // If the same menu is used between multiple triggers, it might still be animating
- // while the new trigger tries to re-open it. Wait for the animation to finish
- // before doing so. Also interrupt if the user moves to another item.
- if (_this.menu instanceof MatMenu && _this.menu._isAnimating) {
- // We need the `delay(0)` here in order to avoid
- // 'changed after checked' errors in some cases. See #12194.
- _this.menu._animationDone
- .pipe(operators.take(1), operators.delay(0, rxjs.asapScheduler), operators.takeUntil(_this._parentMenu._hovered()))
- .subscribe((/**
- * @return {?}
- */
- function () { return _this.openMenu(); }));
- }
- else {
- _this.openMenu();
- }
- }));
- };
- /** Gets the portal that should be attached to the overlay. */
- /**
- * Gets the portal that should be attached to the overlay.
- * @private
- * @return {?}
- */
- MatMenuTrigger.prototype._getPortal = /**
- * Gets the portal that should be attached to the overlay.
- * @private
- * @return {?}
- */
- function () {
- // Note that we can avoid this check by keeping the portal on the menu panel.
- // While it would be cleaner, we'd have to introduce another required method on
- // `MatMenuPanel`, making it harder to consume.
- if (!this._portal || this._portal.templateRef !== this.menu.templateRef) {
- this._portal = new portal.TemplatePortal(this.menu.templateRef, this._viewContainerRef);
- }
- return this._portal;
- };
- MatMenuTrigger.decorators = [
- { type: core.Directive, args: [{
- selector: "[mat-menu-trigger-for], [matMenuTriggerFor]",
- host: {
- 'class': 'mat-menu-trigger',
- 'aria-haspopup': 'true',
- '[attr.aria-expanded]': 'menuOpen || null',
- '(mousedown)': '_handleMousedown($event)',
- '(keydown)': '_handleKeydown($event)',
- '(click)': '_handleClick($event)',
- },
- exportAs: 'matMenuTrigger'
- },] },
- ];
- /** @nocollapse */
- MatMenuTrigger.ctorParameters = function () { return [
- { type: overlay.Overlay },
- { type: core.ElementRef },
- { type: core.ViewContainerRef },
- { type: undefined, decorators: [{ type: core.Inject, args: [MAT_MENU_SCROLL_STRATEGY,] }] },
- { type: MatMenu, decorators: [{ type: core.Optional }] },
- { type: MatMenuItem, decorators: [{ type: core.Optional }, { type: core.Self }] },
- { type: bidi.Directionality, decorators: [{ type: core.Optional }] },
- { type: a11y.FocusMonitor }
- ]; };
- MatMenuTrigger.propDecorators = {
- _deprecatedMatMenuTriggerFor: [{ type: core.Input, args: ['mat-menu-trigger-for',] }],
- menu: [{ type: core.Input, args: ['matMenuTriggerFor',] }],
- menuData: [{ type: core.Input, args: ['matMenuTriggerData',] }],
- restoreFocus: [{ type: core.Input, args: ['matMenuTriggerRestoreFocus',] }],
- menuOpened: [{ type: core.Output }],
- onMenuOpen: [{ type: core.Output }],
- menuClosed: [{ type: core.Output }],
- onMenuClose: [{ type: core.Output }]
- };
- return MatMenuTrigger;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Used by both the current `MatMenuModule` and the MDC `MatMenuModule`
- * to declare the menu-related directives.
- */
- var _MatMenuDirectivesModule = /** @class */ (function () {
- function _MatMenuDirectivesModule() {
- }
- _MatMenuDirectivesModule.decorators = [
- { type: core.NgModule, args: [{
- exports: [MatMenuTrigger, MatMenuContent, MatCommonModule],
- declarations: [MatMenuTrigger, MatMenuContent],
- providers: [MAT_MENU_SCROLL_STRATEGY_FACTORY_PROVIDER]
- },] },
- ];
- return _MatMenuDirectivesModule;
- }());
- var MatMenuModule = /** @class */ (function () {
- function MatMenuModule() {
- }
- MatMenuModule.decorators = [
- { type: core.NgModule, args: [{
- imports: [
- common.CommonModule,
- MatCommonModule,
- MatRippleModule,
- overlay.OverlayModule,
- _MatMenuDirectivesModule,
- ],
- exports: [_MatMenu, MatMenuItem, _MatMenuDirectivesModule],
- declarations: [_MatMenu, MatMenuItem],
- providers: [MAT_MENU_SCROLL_STRATEGY_FACTORY_PROVIDER]
- },] },
- ];
- return MatMenuModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * The following are all the animations for the mat-select component, with each
- * const containing the metadata for one animation.
- *
- * The values below match the implementation of the AngularJS Material mat-select animation.
- * \@docs-private
- * @type {?}
- */
- var matSelectAnimations = {
- /**
- * This animation ensures the select's overlay panel animation (transformPanel) is called when
- * closing the select.
- * This is needed due to https://github.com/angular/angular/issues/23302
- */
- transformPanelWrap: animations$1.trigger('transformPanelWrap', [
- animations$1.transition('* => void', animations$1.query('@transformPanel', [animations$1.animateChild()], { optional: true }))
- ]),
- /**
- * This animation transforms the select's overlay panel on and off the page.
- *
- * When the panel is attached to the DOM, it expands its width by the amount of padding, scales it
- * up to 100% on the Y axis, fades in its border, and translates slightly up and to the
- * side to ensure the option text correctly overlaps the trigger text.
- *
- * When the panel is removed from the DOM, it simply fades out linearly.
- */
- transformPanel: animations$1.trigger('transformPanel', [
- animations$1.state('void', animations$1.style({
- transform: 'scaleY(0.8)',
- minWidth: '100%',
- opacity: 0
- })),
- animations$1.state('showing', animations$1.style({
- opacity: 1,
- minWidth: 'calc(100% + 32px)',
- // 32px = 2 * 16px padding
- transform: 'scaleY(1)'
- })),
- animations$1.state('showing-multiple', animations$1.style({
- opacity: 1,
- minWidth: 'calc(100% + 64px)',
- // 64px = 48px padding on the left + 16px padding on the right
- transform: 'scaleY(1)'
- })),
- animations$1.transition('void => *', animations$1.animate('120ms cubic-bezier(0, 0, 0.2, 1)')),
- animations$1.transition('* => void', animations$1.animate('100ms 25ms linear', animations$1.style({ opacity: 0 })))
- ]),
- /**
- * This animation fades in the background color and text content of the
- * select's options. It is time delayed to occur 100ms after the overlay
- * panel has transformed in.
- * @deprecated Not used anymore. To be removed.
- * \@breaking-change 8.0.0
- */
- fadeInContent: animations$1.trigger('fadeInContent', [
- animations$1.state('showing', animations$1.style({ opacity: 1 })),
- animations$1.transition('void => showing', [
- animations$1.style({ opacity: 0 }),
- animations$1.animate('150ms 100ms cubic-bezier(0.55, 0, 0.55, 0.2)')
- ])
- ])
- };
- /**
- * @deprecated
- * \@breaking-change 8.0.0
- * \@docs-private
- * @type {?}
- */
- var transformPanel = matSelectAnimations.transformPanel;
- /**
- * @deprecated
- * \@breaking-change 8.0.0
- * \@docs-private
- * @type {?}
- */
- var fadeInContent = matSelectAnimations.fadeInContent;
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Returns an exception to be thrown when attempting to change a select's `multiple` option
- * after initialization.
- * \@docs-private
- * @return {?}
- */
- function getMatSelectDynamicMultipleError() {
- return Error('Cannot change `multiple` mode of select after initialization.');
- }
- /**
- * Returns an exception to be thrown when attempting to assign a non-array value to a select
- * in `multiple` mode. Note that `undefined` and `null` are still valid values to allow for
- * resetting the value.
- * \@docs-private
- * @return {?}
- */
- function getMatSelectNonArrayValueError() {
- return Error('Value must be an array in multiple-selection mode.');
- }
- /**
- * Returns an exception to be thrown when assigning a non-function value to the comparator
- * used to determine if a value corresponds to an option. Note that whether the function
- * actually takes two values and returns a boolean is not checked.
- * @return {?}
- */
- function getMatSelectNonFunctionValueError() {
- return Error('`compareWith` must be a function.');
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /** @type {?} */
- var nextUniqueId$6 = 0;
- /**
- * The max height of the select's overlay panel
- * @type {?}
- */
- var SELECT_PANEL_MAX_HEIGHT = 256;
- /**
- * The panel's padding on the x-axis
- * @type {?}
- */
- var SELECT_PANEL_PADDING_X = 16;
- /**
- * The panel's x axis padding if it is indented (e.g. there is an option group).
- * @type {?}
- */
- var SELECT_PANEL_INDENT_PADDING_X = SELECT_PANEL_PADDING_X * 2;
- /**
- * The height of the select items in `em` units.
- * @type {?}
- */
- var SELECT_ITEM_HEIGHT_EM = 3;
- // TODO(josephperrott): Revert to a constant after 2018 spec updates are fully merged.
- /**
- * Distance between the panel edge and the option text in
- * multi-selection mode.
- *
- * Calculated as:
- * (SELECT_PANEL_PADDING_X * 1.5) + 16 = 40
- * The padding is multiplied by 1.5 because the checkbox's margin is half the padding.
- * The checkbox width is 16px.
- * @type {?}
- */
- var SELECT_MULTIPLE_PANEL_PADDING_X = SELECT_PANEL_PADDING_X * 1.5 + 16;
- /**
- * The select panel will only "fit" inside the viewport if it is positioned at
- * this value or more away from the viewport boundary.
- * @type {?}
- */
- var SELECT_PANEL_VIEWPORT_PADDING = 8;
- /**
- * Injection token that determines the scroll handling while a select is open.
- * @type {?}
- */
- var MAT_SELECT_SCROLL_STRATEGY = new core.InjectionToken('mat-select-scroll-strategy');
- /**
- * \@docs-private
- * @param {?} overlay
- * @return {?}
- */
- function MAT_SELECT_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay$$1) {
- return (/**
- * @return {?}
- */
- function () { return overlay$$1.scrollStrategies.reposition(); });
- }
- /**
- * \@docs-private
- * @type {?}
- */
- var MAT_SELECT_SCROLL_STRATEGY_PROVIDER = {
- provide: MAT_SELECT_SCROLL_STRATEGY,
- deps: [overlay.Overlay],
- useFactory: MAT_SELECT_SCROLL_STRATEGY_PROVIDER_FACTORY,
- };
- /**
- * Change event object that is emitted when the select value has changed.
- */
- var /**
- * Change event object that is emitted when the select value has changed.
- */
- MatSelectChange = /** @class */ (function () {
- function MatSelectChange(source, value) {
- this.source = source;
- this.value = value;
- }
- return MatSelectChange;
- }());
- // Boilerplate for applying mixins to MatSelect.
- /**
- * \@docs-private
- */
- var
- // Boilerplate for applying mixins to MatSelect.
- /**
- * \@docs-private
- */
- MatSelectBase = /** @class */ (function () {
- function MatSelectBase(_elementRef, _defaultErrorStateMatcher, _parentForm, _parentFormGroup, ngControl) {
- this._elementRef = _elementRef;
- this._defaultErrorStateMatcher = _defaultErrorStateMatcher;
- this._parentForm = _parentForm;
- this._parentFormGroup = _parentFormGroup;
- this.ngControl = ngControl;
- }
- return MatSelectBase;
- }());
- /** @type {?} */
- var _MatSelectMixinBase = mixinDisableRipple(mixinTabIndex(mixinDisabled(mixinErrorState(MatSelectBase))));
- /**
- * Allows the user to customize the trigger that is displayed when the select has a value.
- */
- var MatSelectTrigger = /** @class */ (function () {
- function MatSelectTrigger() {
- }
- MatSelectTrigger.decorators = [
- { type: core.Directive, args: [{
- selector: 'mat-select-trigger'
- },] },
- ];
- return MatSelectTrigger;
- }());
- var MatSelect = /** @class */ (function (_super) {
- __extends(MatSelect, _super);
- function MatSelect(_viewportRuler, _changeDetectorRef, _ngZone, _defaultErrorStateMatcher, elementRef, _dir, _parentForm, _parentFormGroup, _parentFormField, ngControl, tabIndex, scrollStrategyFactory, _liveAnnouncer) {
- var _this = _super.call(this, elementRef, _defaultErrorStateMatcher, _parentForm, _parentFormGroup, ngControl) || this;
- _this._viewportRuler = _viewportRuler;
- _this._changeDetectorRef = _changeDetectorRef;
- _this._ngZone = _ngZone;
- _this._dir = _dir;
- _this._parentFormField = _parentFormField;
- _this.ngControl = ngControl;
- _this._liveAnnouncer = _liveAnnouncer;
- /**
- * Whether or not the overlay panel is open.
- */
- _this._panelOpen = false;
- /**
- * Whether filling out the select is required in the form.
- */
- _this._required = false;
- /**
- * The scroll position of the overlay panel, calculated to center the selected option.
- */
- _this._scrollTop = 0;
- /**
- * Whether the component is in multiple selection mode.
- */
- _this._multiple = false;
- /**
- * Comparison function to specify which option is displayed. Defaults to object equality.
- */
- _this._compareWith = (/**
- * @param {?} o1
- * @param {?} o2
- * @return {?}
- */
- function (o1, o2) { return o1 === o2; });
- /**
- * Unique id for this input.
- */
- _this._uid = "mat-select-" + nextUniqueId$6++;
- /**
- * Emits whenever the component is destroyed.
- */
- _this._destroy = new rxjs.Subject();
- /**
- * The cached font-size of the trigger element.
- */
- _this._triggerFontSize = 0;
- /**
- * `View -> model callback called when value changes`
- */
- _this._onChange = (/**
- * @return {?}
- */
- function () { });
- /**
- * `View -> model callback called when select has been touched`
- */
- _this._onTouched = (/**
- * @return {?}
- */
- function () { });
- /**
- * The IDs of child options to be passed to the aria-owns attribute.
- */
- _this._optionIds = '';
- /**
- * The value of the select panel's transform-origin property.
- */
- _this._transformOrigin = 'top';
- /**
- * Emits when the panel element is finished transforming in.
- */
- _this._panelDoneAnimatingStream = new rxjs.Subject();
- /**
- * The y-offset of the overlay panel in relation to the trigger's top start corner.
- * This must be adjusted to align the selected option text over the trigger text.
- * when the panel opens. Will change based on the y-position of the selected option.
- */
- _this._offsetY = 0;
- /**
- * This position config ensures that the top "start" corner of the overlay
- * is aligned with with the top "start" of the origin by default (overlapping
- * the trigger completely). If the panel cannot fit below the trigger, it
- * will fall back to a position above the trigger.
- */
- _this._positions = [
- {
- originX: 'start',
- originY: 'top',
- overlayX: 'start',
- overlayY: 'top',
- },
- {
- originX: 'start',
- originY: 'bottom',
- overlayX: 'start',
- overlayY: 'bottom',
- },
- ];
- /**
- * Whether the component is disabling centering of the active option over the trigger.
- */
- _this._disableOptionCentering = false;
- _this._focused = false;
- /**
- * A name for this control that can be used by `mat-form-field`.
- */
- _this.controlType = 'mat-select';
- /**
- * Aria label of the select. If not specified, the placeholder will be used as label.
- */
- _this.ariaLabel = '';
- /**
- * Combined stream of all of the child options' change events.
- */
- _this.optionSelectionChanges = (/** @type {?} */ (rxjs.defer((/**
- * @return {?}
- */
- function () {
- /** @type {?} */
- var options = _this.options;
- if (options) {
- return options.changes.pipe(operators.startWith(options), operators.switchMap((/**
- * @return {?}
- */
- function () { return rxjs.merge.apply(void 0, options.map((/**
- * @param {?} option
- * @return {?}
- */
- function (option) { return option.onSelectionChange; }))); })));
- }
- return _this._ngZone.onStable
- .asObservable()
- .pipe(operators.take(1), operators.switchMap((/**
- * @return {?}
- */
- function () { return _this.optionSelectionChanges; })));
- }))));
- /**
- * Event emitted when the select panel has been toggled.
- */
- _this.openedChange = new core.EventEmitter();
- /**
- * Event emitted when the select has been opened.
- */
- _this._openedStream = _this.openedChange.pipe(operators.filter((/**
- * @param {?} o
- * @return {?}
- */
- function (o) { return o; })), operators.map((/**
- * @return {?}
- */
- function () { })));
- /**
- * Event emitted when the select has been closed.
- */
- _this._closedStream = _this.openedChange.pipe(operators.filter((/**
- * @param {?} o
- * @return {?}
- */
- function (o) { return !o; })), operators.map((/**
- * @return {?}
- */
- function () { })));
- /**
- * Event emitted when the selected value has been changed by the user.
- */
- _this.selectionChange = new core.EventEmitter();
- /**
- * Event that emits whenever the raw value of the select changes. This is here primarily
- * to facilitate the two-way binding for the `value` input.
- * \@docs-private
- */
- _this.valueChange = new core.EventEmitter();
- if (_this.ngControl) {
- // Note: we provide the value accessor through here, instead of
- // the `providers` to avoid running into a circular import.
- _this.ngControl.valueAccessor = _this;
- }
- _this._scrollStrategyFactory = scrollStrategyFactory;
- _this._scrollStrategy = _this._scrollStrategyFactory();
- _this.tabIndex = parseInt(tabIndex) || 0;
- // Force setter to be called in case id was not specified.
- _this.id = _this.id;
- return _this;
- }
- Object.defineProperty(MatSelect.prototype, "focused", {
- /** Whether the select is focused. */
- get: /**
- * Whether the select is focused.
- * @return {?}
- */
- function () {
- return this._focused || this._panelOpen;
- },
- /**
- * @deprecated Setter to be removed as this property is intended to be readonly.
- * @breaking-change 8.0.0
- */
- set: /**
- * @deprecated Setter to be removed as this property is intended to be readonly.
- * \@breaking-change 8.0.0
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._focused = value;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatSelect.prototype, "placeholder", {
- /** Placeholder to be shown if no value has been selected. */
- get: /**
- * Placeholder to be shown if no value has been selected.
- * @return {?}
- */
- function () { return this._placeholder; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._placeholder = value;
- this.stateChanges.next();
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatSelect.prototype, "required", {
- /** Whether the component is required. */
- get: /**
- * Whether the component is required.
- * @return {?}
- */
- function () { return this._required; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._required = coercion.coerceBooleanProperty(value);
- this.stateChanges.next();
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatSelect.prototype, "multiple", {
- /** Whether the user should be allowed to select multiple options. */
- get: /**
- * Whether the user should be allowed to select multiple options.
- * @return {?}
- */
- function () { return this._multiple; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- if (this._selectionModel) {
- throw getMatSelectDynamicMultipleError();
- }
- this._multiple = coercion.coerceBooleanProperty(value);
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatSelect.prototype, "disableOptionCentering", {
- /** Whether to center the active option over the trigger. */
- get: /**
- * Whether to center the active option over the trigger.
- * @return {?}
- */
- function () { return this._disableOptionCentering; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._disableOptionCentering = coercion.coerceBooleanProperty(value);
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatSelect.prototype, "compareWith", {
- /**
- * Function to compare the option values with the selected values. The first argument
- * is a value from an option. The second is a value from the selection. A boolean
- * should be returned.
- */
- get: /**
- * Function to compare the option values with the selected values. The first argument
- * is a value from an option. The second is a value from the selection. A boolean
- * should be returned.
- * @return {?}
- */
- function () { return this._compareWith; },
- set: /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- if (typeof fn !== 'function') {
- throw getMatSelectNonFunctionValueError();
- }
- this._compareWith = fn;
- if (this._selectionModel) {
- // A different comparator means the selection could change.
- this._initializeSelection();
- }
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatSelect.prototype, "value", {
- /** Value of the select control. */
- get: /**
- * Value of the select control.
- * @return {?}
- */
- function () { return this._value; },
- set: /**
- * @param {?} newValue
- * @return {?}
- */
- function (newValue) {
- if (newValue !== this._value) {
- this.writeValue(newValue);
- this._value = newValue;
- }
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatSelect.prototype, "id", {
- /** Unique id of the element. */
- get: /**
- * Unique id of the element.
- * @return {?}
- */
- function () { return this._id; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._id = value || this._uid;
- this.stateChanges.next();
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- MatSelect.prototype.ngOnInit = /**
- * @return {?}
- */
- function () {
- var _this = this;
- this._selectionModel = new collections.SelectionModel(this.multiple);
- this.stateChanges.next();
- // We need `distinctUntilChanged` here, because some browsers will
- // fire the animation end event twice for the same animation. See:
- // https://github.com/angular/angular/issues/24084
- this._panelDoneAnimatingStream
- .pipe(operators.distinctUntilChanged(), operators.takeUntil(this._destroy))
- .subscribe((/**
- * @return {?}
- */
- function () {
- if (_this.panelOpen) {
- _this._scrollTop = 0;
- _this.openedChange.emit(true);
- }
- else {
- _this.openedChange.emit(false);
- _this.overlayDir.offsetX = 0;
- _this._changeDetectorRef.markForCheck();
- }
- }));
- this._viewportRuler.change()
- .pipe(operators.takeUntil(this._destroy))
- .subscribe((/**
- * @return {?}
- */
- function () {
- if (_this._panelOpen) {
- _this._triggerRect = _this.trigger.nativeElement.getBoundingClientRect();
- _this._changeDetectorRef.markForCheck();
- }
- }));
- };
- /**
- * @return {?}
- */
- MatSelect.prototype.ngAfterContentInit = /**
- * @return {?}
- */
- function () {
- var _this = this;
- this._initKeyManager();
- this._selectionModel.onChange.pipe(operators.takeUntil(this._destroy)).subscribe((/**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- event.added.forEach((/**
- * @param {?} option
- * @return {?}
- */
- function (option) { return option.select(); }));
- event.removed.forEach((/**
- * @param {?} option
- * @return {?}
- */
- function (option) { return option.deselect(); }));
- }));
- this.options.changes.pipe(operators.startWith(null), operators.takeUntil(this._destroy)).subscribe((/**
- * @return {?}
- */
- function () {
- _this._resetOptions();
- _this._initializeSelection();
- }));
- };
- /**
- * @return {?}
- */
- MatSelect.prototype.ngDoCheck = /**
- * @return {?}
- */
- function () {
- if (this.ngControl) {
- this.updateErrorState();
- }
- };
- /**
- * @param {?} changes
- * @return {?}
- */
- MatSelect.prototype.ngOnChanges = /**
- * @param {?} changes
- * @return {?}
- */
- function (changes) {
- // Updating the disabled state is handled by `mixinDisabled`, but we need to additionally let
- // the parent form field know to run change detection when the disabled state changes.
- if (changes['disabled']) {
- this.stateChanges.next();
- }
- };
- /**
- * @return {?}
- */
- MatSelect.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- this._destroy.next();
- this._destroy.complete();
- this.stateChanges.complete();
- };
- /** Toggles the overlay panel open or closed. */
- /**
- * Toggles the overlay panel open or closed.
- * @return {?}
- */
- MatSelect.prototype.toggle = /**
- * Toggles the overlay panel open or closed.
- * @return {?}
- */
- function () {
- this.panelOpen ? this.close() : this.open();
- };
- /** Opens the overlay panel. */
- /**
- * Opens the overlay panel.
- * @return {?}
- */
- MatSelect.prototype.open = /**
- * Opens the overlay panel.
- * @return {?}
- */
- function () {
- var _this = this;
- if (this.disabled || !this.options || !this.options.length || this._panelOpen) {
- return;
- }
- this._triggerRect = this.trigger.nativeElement.getBoundingClientRect();
- // Note: The computed font-size will be a string pixel value (e.g. "16px").
- // `parseInt` ignores the trailing 'px' and converts this to a number.
- this._triggerFontSize = parseInt(getComputedStyle(this.trigger.nativeElement).fontSize || '0');
- this._panelOpen = true;
- this._keyManager.withHorizontalOrientation(null);
- this._calculateOverlayPosition();
- this._highlightCorrectOption();
- this._changeDetectorRef.markForCheck();
- // Set the font size on the panel element once it exists.
- this._ngZone.onStable.asObservable().pipe(operators.take(1)).subscribe((/**
- * @return {?}
- */
- function () {
- if (_this._triggerFontSize && _this.overlayDir.overlayRef &&
- _this.overlayDir.overlayRef.overlayElement) {
- _this.overlayDir.overlayRef.overlayElement.style.fontSize = _this._triggerFontSize + "px";
- }
- }));
- };
- /** Closes the overlay panel and focuses the host element. */
- /**
- * Closes the overlay panel and focuses the host element.
- * @return {?}
- */
- MatSelect.prototype.close = /**
- * Closes the overlay panel and focuses the host element.
- * @return {?}
- */
- function () {
- if (this._panelOpen) {
- this._panelOpen = false;
- this._keyManager.withHorizontalOrientation(this._isRtl() ? 'rtl' : 'ltr');
- this._changeDetectorRef.markForCheck();
- this._onTouched();
- }
- };
- /**
- * Sets the select's value. Part of the ControlValueAccessor interface
- * required to integrate with Angular's core forms API.
- *
- * @param value New value to be written to the model.
- */
- /**
- * Sets the select's value. Part of the ControlValueAccessor interface
- * required to integrate with Angular's core forms API.
- *
- * @param {?} value New value to be written to the model.
- * @return {?}
- */
- MatSelect.prototype.writeValue = /**
- * Sets the select's value. Part of the ControlValueAccessor interface
- * required to integrate with Angular's core forms API.
- *
- * @param {?} value New value to be written to the model.
- * @return {?}
- */
- function (value) {
- if (this.options) {
- this._setSelectionByValue(value);
- }
- };
- /**
- * Saves a callback function to be invoked when the select's value
- * changes from user input. Part of the ControlValueAccessor interface
- * required to integrate with Angular's core forms API.
- *
- * @param fn Callback to be triggered when the value changes.
- */
- /**
- * Saves a callback function to be invoked when the select's value
- * changes from user input. Part of the ControlValueAccessor interface
- * required to integrate with Angular's core forms API.
- *
- * @param {?} fn Callback to be triggered when the value changes.
- * @return {?}
- */
- MatSelect.prototype.registerOnChange = /**
- * Saves a callback function to be invoked when the select's value
- * changes from user input. Part of the ControlValueAccessor interface
- * required to integrate with Angular's core forms API.
- *
- * @param {?} fn Callback to be triggered when the value changes.
- * @return {?}
- */
- function (fn) {
- this._onChange = fn;
- };
- /**
- * Saves a callback function to be invoked when the select is blurred
- * by the user. Part of the ControlValueAccessor interface required
- * to integrate with Angular's core forms API.
- *
- * @param fn Callback to be triggered when the component has been touched.
- */
- /**
- * Saves a callback function to be invoked when the select is blurred
- * by the user. Part of the ControlValueAccessor interface required
- * to integrate with Angular's core forms API.
- *
- * @param {?} fn Callback to be triggered when the component has been touched.
- * @return {?}
- */
- MatSelect.prototype.registerOnTouched = /**
- * Saves a callback function to be invoked when the select is blurred
- * by the user. Part of the ControlValueAccessor interface required
- * to integrate with Angular's core forms API.
- *
- * @param {?} fn Callback to be triggered when the component has been touched.
- * @return {?}
- */
- function (fn) {
- this._onTouched = fn;
- };
- /**
- * Disables the select. Part of the ControlValueAccessor interface required
- * to integrate with Angular's core forms API.
- *
- * @param isDisabled Sets whether the component is disabled.
- */
- /**
- * Disables the select. Part of the ControlValueAccessor interface required
- * to integrate with Angular's core forms API.
- *
- * @param {?} isDisabled Sets whether the component is disabled.
- * @return {?}
- */
- MatSelect.prototype.setDisabledState = /**
- * Disables the select. Part of the ControlValueAccessor interface required
- * to integrate with Angular's core forms API.
- *
- * @param {?} isDisabled Sets whether the component is disabled.
- * @return {?}
- */
- function (isDisabled) {
- this.disabled = isDisabled;
- this._changeDetectorRef.markForCheck();
- this.stateChanges.next();
- };
- Object.defineProperty(MatSelect.prototype, "panelOpen", {
- /** Whether or not the overlay panel is open. */
- get: /**
- * Whether or not the overlay panel is open.
- * @return {?}
- */
- function () {
- return this._panelOpen;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatSelect.prototype, "selected", {
- /** The currently selected option. */
- get: /**
- * The currently selected option.
- * @return {?}
- */
- function () {
- return this.multiple ? this._selectionModel.selected : this._selectionModel.selected[0];
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatSelect.prototype, "triggerValue", {
- /** The value displayed in the trigger. */
- get: /**
- * The value displayed in the trigger.
- * @return {?}
- */
- function () {
- if (this.empty) {
- return '';
- }
- if (this._multiple) {
- /** @type {?} */
- var selectedOptions = this._selectionModel.selected.map((/**
- * @param {?} option
- * @return {?}
- */
- function (option) { return option.viewValue; }));
- if (this._isRtl()) {
- selectedOptions.reverse();
- }
- // TODO(crisbeto): delimiter should be configurable for proper localization.
- return selectedOptions.join(', ');
- }
- return this._selectionModel.selected[0].viewValue;
- },
- enumerable: true,
- configurable: true
- });
- /** Whether the element is in RTL mode. */
- /**
- * Whether the element is in RTL mode.
- * @return {?}
- */
- MatSelect.prototype._isRtl = /**
- * Whether the element is in RTL mode.
- * @return {?}
- */
- function () {
- return this._dir ? this._dir.value === 'rtl' : false;
- };
- /** Handles all keydown events on the select. */
- /**
- * Handles all keydown events on the select.
- * @param {?} event
- * @return {?}
- */
- MatSelect.prototype._handleKeydown = /**
- * Handles all keydown events on the select.
- * @param {?} event
- * @return {?}
- */
- function (event) {
- if (!this.disabled) {
- this.panelOpen ? this._handleOpenKeydown(event) : this._handleClosedKeydown(event);
- }
- };
- /** Handles keyboard events while the select is closed. */
- /**
- * Handles keyboard events while the select is closed.
- * @private
- * @param {?} event
- * @return {?}
- */
- MatSelect.prototype._handleClosedKeydown = /**
- * Handles keyboard events while the select is closed.
- * @private
- * @param {?} event
- * @return {?}
- */
- function (event) {
- /** @type {?} */
- var keyCode = event.keyCode;
- /** @type {?} */
- var isArrowKey = keyCode === keycodes.DOWN_ARROW || keyCode === keycodes.UP_ARROW ||
- keyCode === keycodes.LEFT_ARROW || keyCode === keycodes.RIGHT_ARROW;
- /** @type {?} */
- var isOpenKey = keyCode === keycodes.ENTER || keyCode === keycodes.SPACE;
- /** @type {?} */
- var manager = this._keyManager;
- // Open the select on ALT + arrow key to match the native <select>
- if ((isOpenKey && !keycodes.hasModifierKey(event)) || ((this.multiple || event.altKey) && isArrowKey)) {
- event.preventDefault(); // prevents the page from scrolling down when pressing space
- this.open();
- }
- else if (!this.multiple) {
- /** @type {?} */
- var previouslySelectedOption = this.selected;
- if (keyCode === keycodes.HOME || keyCode === keycodes.END) {
- keyCode === keycodes.HOME ? manager.setFirstItemActive() : manager.setLastItemActive();
- event.preventDefault();
- }
- else {
- manager.onKeydown(event);
- }
- /** @type {?} */
- var selectedOption = this.selected;
- // Since the value has changed, we need to announce it ourselves.
- // @breaking-change 8.0.0 remove null check for _liveAnnouncer.
- if (this._liveAnnouncer && selectedOption && previouslySelectedOption !== selectedOption) {
- // We set a duration on the live announcement, because we want the live element to be
- // cleared after a while so that users can't navigate to it using the arrow keys.
- this._liveAnnouncer.announce(((/** @type {?} */ (selectedOption))).viewValue, 10000);
- }
- }
- };
- /** Handles keyboard events when the selected is open. */
- /**
- * Handles keyboard events when the selected is open.
- * @private
- * @param {?} event
- * @return {?}
- */
- MatSelect.prototype._handleOpenKeydown = /**
- * Handles keyboard events when the selected is open.
- * @private
- * @param {?} event
- * @return {?}
- */
- function (event) {
- /** @type {?} */
- var keyCode = event.keyCode;
- /** @type {?} */
- var isArrowKey = keyCode === keycodes.DOWN_ARROW || keyCode === keycodes.UP_ARROW;
- /** @type {?} */
- var manager = this._keyManager;
- if (keyCode === keycodes.HOME || keyCode === keycodes.END) {
- event.preventDefault();
- keyCode === keycodes.HOME ? manager.setFirstItemActive() : manager.setLastItemActive();
- }
- else if (isArrowKey && event.altKey) {
- // Close the select on ALT + arrow key to match the native <select>
- event.preventDefault();
- this.close();
- }
- else if ((keyCode === keycodes.ENTER || keyCode === keycodes.SPACE) && manager.activeItem &&
- !keycodes.hasModifierKey(event)) {
- event.preventDefault();
- manager.activeItem._selectViaInteraction();
- }
- else if (this._multiple && keyCode === keycodes.A && event.ctrlKey) {
- event.preventDefault();
- /** @type {?} */
- var hasDeselectedOptions_1 = this.options.some((/**
- * @param {?} opt
- * @return {?}
- */
- function (opt) { return !opt.disabled && !opt.selected; }));
- this.options.forEach((/**
- * @param {?} option
- * @return {?}
- */
- function (option) {
- if (!option.disabled) {
- hasDeselectedOptions_1 ? option.select() : option.deselect();
- }
- }));
- }
- else {
- /** @type {?} */
- var previouslyFocusedIndex = manager.activeItemIndex;
- manager.onKeydown(event);
- if (this._multiple && isArrowKey && event.shiftKey && manager.activeItem &&
- manager.activeItemIndex !== previouslyFocusedIndex) {
- manager.activeItem._selectViaInteraction();
- }
- }
- };
- /**
- * @return {?}
- */
- MatSelect.prototype._onFocus = /**
- * @return {?}
- */
- function () {
- if (!this.disabled) {
- this._focused = true;
- this.stateChanges.next();
- }
- };
- /**
- * Calls the touched callback only if the panel is closed. Otherwise, the trigger will
- * "blur" to the panel when it opens, causing a false positive.
- */
- /**
- * Calls the touched callback only if the panel is closed. Otherwise, the trigger will
- * "blur" to the panel when it opens, causing a false positive.
- * @return {?}
- */
- MatSelect.prototype._onBlur = /**
- * Calls the touched callback only if the panel is closed. Otherwise, the trigger will
- * "blur" to the panel when it opens, causing a false positive.
- * @return {?}
- */
- function () {
- this._focused = false;
- if (!this.disabled && !this.panelOpen) {
- this._onTouched();
- this._changeDetectorRef.markForCheck();
- this.stateChanges.next();
- }
- };
- /**
- * Callback that is invoked when the overlay panel has been attached.
- */
- /**
- * Callback that is invoked when the overlay panel has been attached.
- * @return {?}
- */
- MatSelect.prototype._onAttached = /**
- * Callback that is invoked when the overlay panel has been attached.
- * @return {?}
- */
- function () {
- var _this = this;
- this.overlayDir.positionChange.pipe(operators.take(1)).subscribe((/**
- * @return {?}
- */
- function () {
- _this._changeDetectorRef.detectChanges();
- _this._calculateOverlayOffsetX();
- _this.panel.nativeElement.scrollTop = _this._scrollTop;
- }));
- };
- /** Returns the theme to be used on the panel. */
- /**
- * Returns the theme to be used on the panel.
- * @return {?}
- */
- MatSelect.prototype._getPanelTheme = /**
- * Returns the theme to be used on the panel.
- * @return {?}
- */
- function () {
- return this._parentFormField ? "mat-" + this._parentFormField.color : '';
- };
- Object.defineProperty(MatSelect.prototype, "empty", {
- /** Whether the select has a value. */
- get: /**
- * Whether the select has a value.
- * @return {?}
- */
- function () {
- return !this._selectionModel || this._selectionModel.isEmpty();
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @private
- * @return {?}
- */
- MatSelect.prototype._initializeSelection = /**
- * @private
- * @return {?}
- */
- function () {
- var _this = this;
- // Defer setting the value in order to avoid the "Expression
- // has changed after it was checked" errors from Angular.
- Promise.resolve().then((/**
- * @return {?}
- */
- function () {
- _this._setSelectionByValue(_this.ngControl ? _this.ngControl.value : _this._value);
- _this.stateChanges.next();
- }));
- };
- /**
- * Sets the selected option based on a value. If no option can be
- * found with the designated value, the select trigger is cleared.
- */
- /**
- * Sets the selected option based on a value. If no option can be
- * found with the designated value, the select trigger is cleared.
- * @private
- * @param {?} value
- * @return {?}
- */
- MatSelect.prototype._setSelectionByValue = /**
- * Sets the selected option based on a value. If no option can be
- * found with the designated value, the select trigger is cleared.
- * @private
- * @param {?} value
- * @return {?}
- */
- function (value) {
- var _this = this;
- if (this.multiple && value) {
- if (!Array.isArray(value)) {
- throw getMatSelectNonArrayValueError();
- }
- this._selectionModel.clear();
- value.forEach((/**
- * @param {?} currentValue
- * @return {?}
- */
- function (currentValue) { return _this._selectValue(currentValue); }));
- this._sortValues();
- }
- else {
- this._selectionModel.clear();
- /** @type {?} */
- var correspondingOption = this._selectValue(value);
- // Shift focus to the active item. Note that we shouldn't do this in multiple
- // mode, because we don't know what option the user interacted with last.
- if (correspondingOption) {
- this._keyManager.setActiveItem(correspondingOption);
- }
- }
- this._changeDetectorRef.markForCheck();
- };
- /**
- * Finds and selects and option based on its value.
- * @returns Option that has the corresponding value.
- */
- /**
- * Finds and selects and option based on its value.
- * @private
- * @param {?} value
- * @return {?} Option that has the corresponding value.
- */
- MatSelect.prototype._selectValue = /**
- * Finds and selects and option based on its value.
- * @private
- * @param {?} value
- * @return {?} Option that has the corresponding value.
- */
- function (value) {
- var _this = this;
- /** @type {?} */
- var correspondingOption = this.options.find((/**
- * @param {?} option
- * @return {?}
- */
- function (option) {
- try {
- // Treat null as a special reset value.
- return option.value != null && _this._compareWith(option.value, value);
- }
- catch (error) {
- if (core.isDevMode()) {
- // Notify developers of errors in their comparator.
- console.warn(error);
- }
- return false;
- }
- }));
- if (correspondingOption) {
- this._selectionModel.select(correspondingOption);
- }
- return correspondingOption;
- };
- /** Sets up a key manager to listen to keyboard events on the overlay panel. */
- /**
- * Sets up a key manager to listen to keyboard events on the overlay panel.
- * @private
- * @return {?}
- */
- MatSelect.prototype._initKeyManager = /**
- * Sets up a key manager to listen to keyboard events on the overlay panel.
- * @private
- * @return {?}
- */
- function () {
- var _this = this;
- this._keyManager = new a11y.ActiveDescendantKeyManager(this.options)
- .withTypeAhead()
- .withVerticalOrientation()
- .withHorizontalOrientation(this._isRtl() ? 'rtl' : 'ltr')
- .withAllowedModifierKeys(['shiftKey']);
- this._keyManager.tabOut.pipe(operators.takeUntil(this._destroy)).subscribe((/**
- * @return {?}
- */
- function () {
- // Restore focus to the trigger before closing. Ensures that the focus
- // position won't be lost if the user got focus into the overlay.
- _this.focus();
- _this.close();
- }));
- this._keyManager.change.pipe(operators.takeUntil(this._destroy)).subscribe((/**
- * @return {?}
- */
- function () {
- if (_this._panelOpen && _this.panel) {
- _this._scrollActiveOptionIntoView();
- }
- else if (!_this._panelOpen && !_this.multiple && _this._keyManager.activeItem) {
- _this._keyManager.activeItem._selectViaInteraction();
- }
- }));
- };
- /** Drops current option subscriptions and IDs and resets from scratch. */
- /**
- * Drops current option subscriptions and IDs and resets from scratch.
- * @private
- * @return {?}
- */
- MatSelect.prototype._resetOptions = /**
- * Drops current option subscriptions and IDs and resets from scratch.
- * @private
- * @return {?}
- */
- function () {
- var _this = this;
- /** @type {?} */
- var changedOrDestroyed = rxjs.merge(this.options.changes, this._destroy);
- this.optionSelectionChanges.pipe(operators.takeUntil(changedOrDestroyed)).subscribe((/**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- _this._onSelect(event.source, event.isUserInput);
- if (event.isUserInput && !_this.multiple && _this._panelOpen) {
- _this.close();
- _this.focus();
- }
- }));
- // Listen to changes in the internal state of the options and react accordingly.
- // Handles cases like the labels of the selected options changing.
- rxjs.merge.apply(void 0, this.options.map((/**
- * @param {?} option
- * @return {?}
- */
- function (option) { return option._stateChanges; }))).pipe(operators.takeUntil(changedOrDestroyed))
- .subscribe((/**
- * @return {?}
- */
- function () {
- _this._changeDetectorRef.markForCheck();
- _this.stateChanges.next();
- }));
- this._setOptionIds();
- };
- /** Invoked when an option is clicked. */
- /**
- * Invoked when an option is clicked.
- * @private
- * @param {?} option
- * @param {?} isUserInput
- * @return {?}
- */
- MatSelect.prototype._onSelect = /**
- * Invoked when an option is clicked.
- * @private
- * @param {?} option
- * @param {?} isUserInput
- * @return {?}
- */
- function (option, isUserInput) {
- /** @type {?} */
- var wasSelected = this._selectionModel.isSelected(option);
- if (option.value == null && !this._multiple) {
- option.deselect();
- this._selectionModel.clear();
- this._propagateChanges(option.value);
- }
- else {
- option.selected ? this._selectionModel.select(option) : this._selectionModel.deselect(option);
- if (isUserInput) {
- this._keyManager.setActiveItem(option);
- }
- if (this.multiple) {
- this._sortValues();
- if (isUserInput) {
- // In case the user selected the option with their mouse, we
- // want to restore focus back to the trigger, in order to
- // prevent the select keyboard controls from clashing with
- // the ones from `mat-option`.
- this.focus();
- }
- }
- }
- if (wasSelected !== this._selectionModel.isSelected(option)) {
- this._propagateChanges();
- }
- this.stateChanges.next();
- };
- /** Sorts the selected values in the selected based on their order in the panel. */
- /**
- * Sorts the selected values in the selected based on their order in the panel.
- * @private
- * @return {?}
- */
- MatSelect.prototype._sortValues = /**
- * Sorts the selected values in the selected based on their order in the panel.
- * @private
- * @return {?}
- */
- function () {
- var _this = this;
- if (this.multiple) {
- /** @type {?} */
- var options_1 = this.options.toArray();
- this._selectionModel.sort((/**
- * @param {?} a
- * @param {?} b
- * @return {?}
- */
- function (a, b) {
- return _this.sortComparator ? _this.sortComparator(a, b, options_1) :
- options_1.indexOf(a) - options_1.indexOf(b);
- }));
- this.stateChanges.next();
- }
- };
- /** Emits change event to set the model value. */
- /**
- * Emits change event to set the model value.
- * @private
- * @param {?=} fallbackValue
- * @return {?}
- */
- MatSelect.prototype._propagateChanges = /**
- * Emits change event to set the model value.
- * @private
- * @param {?=} fallbackValue
- * @return {?}
- */
- function (fallbackValue) {
- /** @type {?} */
- var valueToEmit = null;
- if (this.multiple) {
- valueToEmit = ((/** @type {?} */ (this.selected))).map((/**
- * @param {?} option
- * @return {?}
- */
- function (option) { return option.value; }));
- }
- else {
- valueToEmit = this.selected ? ((/** @type {?} */ (this.selected))).value : fallbackValue;
- }
- this._value = valueToEmit;
- this.valueChange.emit(valueToEmit);
- this._onChange(valueToEmit);
- this.selectionChange.emit(new MatSelectChange(this, valueToEmit));
- this._changeDetectorRef.markForCheck();
- };
- /** Records option IDs to pass to the aria-owns property. */
- /**
- * Records option IDs to pass to the aria-owns property.
- * @private
- * @return {?}
- */
- MatSelect.prototype._setOptionIds = /**
- * Records option IDs to pass to the aria-owns property.
- * @private
- * @return {?}
- */
- function () {
- this._optionIds = this.options.map((/**
- * @param {?} option
- * @return {?}
- */
- function (option) { return option.id; })).join(' ');
- };
- /**
- * Highlights the selected item. If no option is selected, it will highlight
- * the first item instead.
- */
- /**
- * Highlights the selected item. If no option is selected, it will highlight
- * the first item instead.
- * @private
- * @return {?}
- */
- MatSelect.prototype._highlightCorrectOption = /**
- * Highlights the selected item. If no option is selected, it will highlight
- * the first item instead.
- * @private
- * @return {?}
- */
- function () {
- if (this._keyManager) {
- if (this.empty) {
- this._keyManager.setFirstItemActive();
- }
- else {
- this._keyManager.setActiveItem(this._selectionModel.selected[0]);
- }
- }
- };
- /** Scrolls the active option into view. */
- /**
- * Scrolls the active option into view.
- * @private
- * @return {?}
- */
- MatSelect.prototype._scrollActiveOptionIntoView = /**
- * Scrolls the active option into view.
- * @private
- * @return {?}
- */
- function () {
- /** @type {?} */
- var activeOptionIndex = this._keyManager.activeItemIndex || 0;
- /** @type {?} */
- var labelCount = _countGroupLabelsBeforeOption(activeOptionIndex, this.options, this.optionGroups);
- this.panel.nativeElement.scrollTop = _getOptionScrollPosition(activeOptionIndex + labelCount, this._getItemHeight(), this.panel.nativeElement.scrollTop, SELECT_PANEL_MAX_HEIGHT);
- };
- /** Focuses the select element. */
- /**
- * Focuses the select element.
- * @param {?=} options
- * @return {?}
- */
- MatSelect.prototype.focus = /**
- * Focuses the select element.
- * @param {?=} options
- * @return {?}
- */
- function (options) {
- this._elementRef.nativeElement.focus(options);
- };
- /** Gets the index of the provided option in the option list. */
- /**
- * Gets the index of the provided option in the option list.
- * @private
- * @param {?} option
- * @return {?}
- */
- MatSelect.prototype._getOptionIndex = /**
- * Gets the index of the provided option in the option list.
- * @private
- * @param {?} option
- * @return {?}
- */
- function (option) {
- return this.options.reduce((/**
- * @param {?} result
- * @param {?} current
- * @param {?} index
- * @return {?}
- */
- function (result, current, index) {
- return result === undefined ? (option === current ? index : undefined) : result;
- }), undefined);
- };
- /** Calculates the scroll position and x- and y-offsets of the overlay panel. */
- /**
- * Calculates the scroll position and x- and y-offsets of the overlay panel.
- * @private
- * @return {?}
- */
- MatSelect.prototype._calculateOverlayPosition = /**
- * Calculates the scroll position and x- and y-offsets of the overlay panel.
- * @private
- * @return {?}
- */
- function () {
- /** @type {?} */
- var itemHeight = this._getItemHeight();
- /** @type {?} */
- var items = this._getItemCount();
- /** @type {?} */
- var panelHeight = Math.min(items * itemHeight, SELECT_PANEL_MAX_HEIGHT);
- /** @type {?} */
- var scrollContainerHeight = items * itemHeight;
- // The farthest the panel can be scrolled before it hits the bottom
- /** @type {?} */
- var maxScroll = scrollContainerHeight - panelHeight;
- // If no value is selected we open the popup to the first item.
- /** @type {?} */
- var selectedOptionOffset = this.empty ? 0 : (/** @type {?} */ (this._getOptionIndex(this._selectionModel.selected[0])));
- selectedOptionOffset += _countGroupLabelsBeforeOption(selectedOptionOffset, this.options, this.optionGroups);
- // We must maintain a scroll buffer so the selected option will be scrolled to the
- // center of the overlay panel rather than the top.
- /** @type {?} */
- var scrollBuffer = panelHeight / 2;
- this._scrollTop = this._calculateOverlayScroll(selectedOptionOffset, scrollBuffer, maxScroll);
- this._offsetY = this._calculateOverlayOffsetY(selectedOptionOffset, scrollBuffer, maxScroll);
- this._checkOverlayWithinViewport(maxScroll);
- };
- /**
- * Calculates the scroll position of the select's overlay panel.
- *
- * Attempts to center the selected option in the panel. If the option is
- * too high or too low in the panel to be scrolled to the center, it clamps the
- * scroll position to the min or max scroll positions respectively.
- */
- /**
- * Calculates the scroll position of the select's overlay panel.
- *
- * Attempts to center the selected option in the panel. If the option is
- * too high or too low in the panel to be scrolled to the center, it clamps the
- * scroll position to the min or max scroll positions respectively.
- * @param {?} selectedIndex
- * @param {?} scrollBuffer
- * @param {?} maxScroll
- * @return {?}
- */
- MatSelect.prototype._calculateOverlayScroll = /**
- * Calculates the scroll position of the select's overlay panel.
- *
- * Attempts to center the selected option in the panel. If the option is
- * too high or too low in the panel to be scrolled to the center, it clamps the
- * scroll position to the min or max scroll positions respectively.
- * @param {?} selectedIndex
- * @param {?} scrollBuffer
- * @param {?} maxScroll
- * @return {?}
- */
- function (selectedIndex, scrollBuffer, maxScroll) {
- /** @type {?} */
- var itemHeight = this._getItemHeight();
- /** @type {?} */
- var optionOffsetFromScrollTop = itemHeight * selectedIndex;
- /** @type {?} */
- var halfOptionHeight = itemHeight / 2;
- // Starts at the optionOffsetFromScrollTop, which scrolls the option to the top of the
- // scroll container, then subtracts the scroll buffer to scroll the option down to
- // the center of the overlay panel. Half the option height must be re-added to the
- // scrollTop so the option is centered based on its middle, not its top edge.
- /** @type {?} */
- var optimalScrollPosition = optionOffsetFromScrollTop - scrollBuffer + halfOptionHeight;
- return Math.min(Math.max(0, optimalScrollPosition), maxScroll);
- };
- /** Returns the aria-label of the select component. */
- /**
- * Returns the aria-label of the select component.
- * @return {?}
- */
- MatSelect.prototype._getAriaLabel = /**
- * Returns the aria-label of the select component.
- * @return {?}
- */
- function () {
- // If an ariaLabelledby value has been set by the consumer, the select should not overwrite the
- // `aria-labelledby` value by setting the ariaLabel to the placeholder.
- return this.ariaLabelledby ? null : this.ariaLabel || this.placeholder;
- };
- /** Returns the aria-labelledby of the select component. */
- /**
- * Returns the aria-labelledby of the select component.
- * @return {?}
- */
- MatSelect.prototype._getAriaLabelledby = /**
- * Returns the aria-labelledby of the select component.
- * @return {?}
- */
- function () {
- if (this.ariaLabelledby) {
- return this.ariaLabelledby;
- }
- // Note: we use `_getAriaLabel` here, because we want to check whether there's a
- // computed label. `this.ariaLabel` is only the user-specified label.
- if (!this._parentFormField || !this._parentFormField._hasFloatingLabel() ||
- this._getAriaLabel()) {
- return null;
- }
- return this._parentFormField._labelId || null;
- };
- /** Determines the `aria-activedescendant` to be set on the host. */
- /**
- * Determines the `aria-activedescendant` to be set on the host.
- * @return {?}
- */
- MatSelect.prototype._getAriaActiveDescendant = /**
- * Determines the `aria-activedescendant` to be set on the host.
- * @return {?}
- */
- function () {
- if (this.panelOpen && this._keyManager && this._keyManager.activeItem) {
- return this._keyManager.activeItem.id;
- }
- return null;
- };
- /**
- * Sets the x-offset of the overlay panel in relation to the trigger's top start corner.
- * This must be adjusted to align the selected option text over the trigger text when
- * the panel opens. Will change based on LTR or RTL text direction. Note that the offset
- * can't be calculated until the panel has been attached, because we need to know the
- * content width in order to constrain the panel within the viewport.
- */
- /**
- * Sets the x-offset of the overlay panel in relation to the trigger's top start corner.
- * This must be adjusted to align the selected option text over the trigger text when
- * the panel opens. Will change based on LTR or RTL text direction. Note that the offset
- * can't be calculated until the panel has been attached, because we need to know the
- * content width in order to constrain the panel within the viewport.
- * @private
- * @return {?}
- */
- MatSelect.prototype._calculateOverlayOffsetX = /**
- * Sets the x-offset of the overlay panel in relation to the trigger's top start corner.
- * This must be adjusted to align the selected option text over the trigger text when
- * the panel opens. Will change based on LTR or RTL text direction. Note that the offset
- * can't be calculated until the panel has been attached, because we need to know the
- * content width in order to constrain the panel within the viewport.
- * @private
- * @return {?}
- */
- function () {
- /** @type {?} */
- var overlayRect = this.overlayDir.overlayRef.overlayElement.getBoundingClientRect();
- /** @type {?} */
- var viewportSize = this._viewportRuler.getViewportSize();
- /** @type {?} */
- var isRtl = this._isRtl();
- /** @type {?} */
- var paddingWidth = this.multiple ? SELECT_MULTIPLE_PANEL_PADDING_X + SELECT_PANEL_PADDING_X :
- SELECT_PANEL_PADDING_X * 2;
- /** @type {?} */
- var offsetX;
- // Adjust the offset, depending on the option padding.
- if (this.multiple) {
- offsetX = SELECT_MULTIPLE_PANEL_PADDING_X;
- }
- else {
- /** @type {?} */
- var selected = this._selectionModel.selected[0] || this.options.first;
- offsetX = selected && selected.group ? SELECT_PANEL_INDENT_PADDING_X : SELECT_PANEL_PADDING_X;
- }
- // Invert the offset in LTR.
- if (!isRtl) {
- offsetX *= -1;
- }
- // Determine how much the select overflows on each side.
- /** @type {?} */
- var leftOverflow = 0 - (overlayRect.left + offsetX - (isRtl ? paddingWidth : 0));
- /** @type {?} */
- var rightOverflow = overlayRect.right + offsetX - viewportSize.width
- + (isRtl ? 0 : paddingWidth);
- // If the element overflows on either side, reduce the offset to allow it to fit.
- if (leftOverflow > 0) {
- offsetX += leftOverflow + SELECT_PANEL_VIEWPORT_PADDING;
- }
- else if (rightOverflow > 0) {
- offsetX -= rightOverflow + SELECT_PANEL_VIEWPORT_PADDING;
- }
- // Set the offset directly in order to avoid having to go through change detection and
- // potentially triggering "changed after it was checked" errors. Round the value to avoid
- // blurry content in some browsers.
- this.overlayDir.offsetX = Math.round(offsetX);
- this.overlayDir.overlayRef.updatePosition();
- };
- /**
- * Calculates the y-offset of the select's overlay panel in relation to the
- * top start corner of the trigger. It has to be adjusted in order for the
- * selected option to be aligned over the trigger when the panel opens.
- */
- /**
- * Calculates the y-offset of the select's overlay panel in relation to the
- * top start corner of the trigger. It has to be adjusted in order for the
- * selected option to be aligned over the trigger when the panel opens.
- * @private
- * @param {?} selectedIndex
- * @param {?} scrollBuffer
- * @param {?} maxScroll
- * @return {?}
- */
- MatSelect.prototype._calculateOverlayOffsetY = /**
- * Calculates the y-offset of the select's overlay panel in relation to the
- * top start corner of the trigger. It has to be adjusted in order for the
- * selected option to be aligned over the trigger when the panel opens.
- * @private
- * @param {?} selectedIndex
- * @param {?} scrollBuffer
- * @param {?} maxScroll
- * @return {?}
- */
- function (selectedIndex, scrollBuffer, maxScroll) {
- /** @type {?} */
- var itemHeight = this._getItemHeight();
- /** @type {?} */
- var optionHeightAdjustment = (itemHeight - this._triggerRect.height) / 2;
- /** @type {?} */
- var maxOptionsDisplayed = Math.floor(SELECT_PANEL_MAX_HEIGHT / itemHeight);
- /** @type {?} */
- var optionOffsetFromPanelTop;
- // Disable offset if requested by user by returning 0 as value to offset
- if (this._disableOptionCentering) {
- return 0;
- }
- if (this._scrollTop === 0) {
- optionOffsetFromPanelTop = selectedIndex * itemHeight;
- }
- else if (this._scrollTop === maxScroll) {
- /** @type {?} */
- var firstDisplayedIndex = this._getItemCount() - maxOptionsDisplayed;
- /** @type {?} */
- var selectedDisplayIndex = selectedIndex - firstDisplayedIndex;
- // The first item is partially out of the viewport. Therefore we need to calculate what
- // portion of it is shown in the viewport and account for it in our offset.
- /** @type {?} */
- var partialItemHeight = itemHeight - (this._getItemCount() * itemHeight - SELECT_PANEL_MAX_HEIGHT) % itemHeight;
- // Because the panel height is longer than the height of the options alone,
- // there is always extra padding at the top or bottom of the panel. When
- // scrolled to the very bottom, this padding is at the top of the panel and
- // must be added to the offset.
- optionOffsetFromPanelTop = selectedDisplayIndex * itemHeight + partialItemHeight;
- }
- else {
- // If the option was scrolled to the middle of the panel using a scroll buffer,
- // its offset will be the scroll buffer minus the half height that was added to
- // center it.
- optionOffsetFromPanelTop = scrollBuffer - itemHeight / 2;
- }
- // The final offset is the option's offset from the top, adjusted for the height difference,
- // multiplied by -1 to ensure that the overlay moves in the correct direction up the page.
- // The value is rounded to prevent some browsers from blurring the content.
- return Math.round(optionOffsetFromPanelTop * -1 - optionHeightAdjustment);
- };
- /**
- * Checks that the attempted overlay position will fit within the viewport.
- * If it will not fit, tries to adjust the scroll position and the associated
- * y-offset so the panel can open fully on-screen. If it still won't fit,
- * sets the offset back to 0 to allow the fallback position to take over.
- */
- /**
- * Checks that the attempted overlay position will fit within the viewport.
- * If it will not fit, tries to adjust the scroll position and the associated
- * y-offset so the panel can open fully on-screen. If it still won't fit,
- * sets the offset back to 0 to allow the fallback position to take over.
- * @private
- * @param {?} maxScroll
- * @return {?}
- */
- MatSelect.prototype._checkOverlayWithinViewport = /**
- * Checks that the attempted overlay position will fit within the viewport.
- * If it will not fit, tries to adjust the scroll position and the associated
- * y-offset so the panel can open fully on-screen. If it still won't fit,
- * sets the offset back to 0 to allow the fallback position to take over.
- * @private
- * @param {?} maxScroll
- * @return {?}
- */
- function (maxScroll) {
- /** @type {?} */
- var itemHeight = this._getItemHeight();
- /** @type {?} */
- var viewportSize = this._viewportRuler.getViewportSize();
- /** @type {?} */
- var topSpaceAvailable = this._triggerRect.top - SELECT_PANEL_VIEWPORT_PADDING;
- /** @type {?} */
- var bottomSpaceAvailable = viewportSize.height - this._triggerRect.bottom - SELECT_PANEL_VIEWPORT_PADDING;
- /** @type {?} */
- var panelHeightTop = Math.abs(this._offsetY);
- /** @type {?} */
- var totalPanelHeight = Math.min(this._getItemCount() * itemHeight, SELECT_PANEL_MAX_HEIGHT);
- /** @type {?} */
- var panelHeightBottom = totalPanelHeight - panelHeightTop - this._triggerRect.height;
- if (panelHeightBottom > bottomSpaceAvailable) {
- this._adjustPanelUp(panelHeightBottom, bottomSpaceAvailable);
- }
- else if (panelHeightTop > topSpaceAvailable) {
- this._adjustPanelDown(panelHeightTop, topSpaceAvailable, maxScroll);
- }
- else {
- this._transformOrigin = this._getOriginBasedOnOption();
- }
- };
- /** Adjusts the overlay panel up to fit in the viewport. */
- /**
- * Adjusts the overlay panel up to fit in the viewport.
- * @private
- * @param {?} panelHeightBottom
- * @param {?} bottomSpaceAvailable
- * @return {?}
- */
- MatSelect.prototype._adjustPanelUp = /**
- * Adjusts the overlay panel up to fit in the viewport.
- * @private
- * @param {?} panelHeightBottom
- * @param {?} bottomSpaceAvailable
- * @return {?}
- */
- function (panelHeightBottom, bottomSpaceAvailable) {
- // Browsers ignore fractional scroll offsets, so we need to round.
- /** @type {?} */
- var distanceBelowViewport = Math.round(panelHeightBottom - bottomSpaceAvailable);
- // Scrolls the panel up by the distance it was extending past the boundary, then
- // adjusts the offset by that amount to move the panel up into the viewport.
- this._scrollTop -= distanceBelowViewport;
- this._offsetY -= distanceBelowViewport;
- this._transformOrigin = this._getOriginBasedOnOption();
- // If the panel is scrolled to the very top, it won't be able to fit the panel
- // by scrolling, so set the offset to 0 to allow the fallback position to take
- // effect.
- if (this._scrollTop <= 0) {
- this._scrollTop = 0;
- this._offsetY = 0;
- this._transformOrigin = "50% bottom 0px";
- }
- };
- /** Adjusts the overlay panel down to fit in the viewport. */
- /**
- * Adjusts the overlay panel down to fit in the viewport.
- * @private
- * @param {?} panelHeightTop
- * @param {?} topSpaceAvailable
- * @param {?} maxScroll
- * @return {?}
- */
- MatSelect.prototype._adjustPanelDown = /**
- * Adjusts the overlay panel down to fit in the viewport.
- * @private
- * @param {?} panelHeightTop
- * @param {?} topSpaceAvailable
- * @param {?} maxScroll
- * @return {?}
- */
- function (panelHeightTop, topSpaceAvailable, maxScroll) {
- // Browsers ignore fractional scroll offsets, so we need to round.
- /** @type {?} */
- var distanceAboveViewport = Math.round(panelHeightTop - topSpaceAvailable);
- // Scrolls the panel down by the distance it was extending past the boundary, then
- // adjusts the offset by that amount to move the panel down into the viewport.
- this._scrollTop += distanceAboveViewport;
- this._offsetY += distanceAboveViewport;
- this._transformOrigin = this._getOriginBasedOnOption();
- // If the panel is scrolled to the very bottom, it won't be able to fit the
- // panel by scrolling, so set the offset to 0 to allow the fallback position
- // to take effect.
- if (this._scrollTop >= maxScroll) {
- this._scrollTop = maxScroll;
- this._offsetY = 0;
- this._transformOrigin = "50% top 0px";
- return;
- }
- };
- /** Sets the transform origin point based on the selected option. */
- /**
- * Sets the transform origin point based on the selected option.
- * @private
- * @return {?}
- */
- MatSelect.prototype._getOriginBasedOnOption = /**
- * Sets the transform origin point based on the selected option.
- * @private
- * @return {?}
- */
- function () {
- /** @type {?} */
- var itemHeight = this._getItemHeight();
- /** @type {?} */
- var optionHeightAdjustment = (itemHeight - this._triggerRect.height) / 2;
- /** @type {?} */
- var originY = Math.abs(this._offsetY) - optionHeightAdjustment + itemHeight / 2;
- return "50% " + originY + "px 0px";
- };
- /** Calculates the amount of items in the select. This includes options and group labels. */
- /**
- * Calculates the amount of items in the select. This includes options and group labels.
- * @private
- * @return {?}
- */
- MatSelect.prototype._getItemCount = /**
- * Calculates the amount of items in the select. This includes options and group labels.
- * @private
- * @return {?}
- */
- function () {
- return this.options.length + this.optionGroups.length;
- };
- /** Calculates the height of the select's options. */
- /**
- * Calculates the height of the select's options.
- * @private
- * @return {?}
- */
- MatSelect.prototype._getItemHeight = /**
- * Calculates the height of the select's options.
- * @private
- * @return {?}
- */
- function () {
- return this._triggerFontSize * SELECT_ITEM_HEIGHT_EM;
- };
- /**
- * Implemented as part of MatFormFieldControl.
- * @docs-private
- */
- /**
- * Implemented as part of MatFormFieldControl.
- * \@docs-private
- * @param {?} ids
- * @return {?}
- */
- MatSelect.prototype.setDescribedByIds = /**
- * Implemented as part of MatFormFieldControl.
- * \@docs-private
- * @param {?} ids
- * @return {?}
- */
- function (ids) {
- this._ariaDescribedby = ids.join(' ');
- };
- /**
- * Implemented as part of MatFormFieldControl.
- * @docs-private
- */
- /**
- * Implemented as part of MatFormFieldControl.
- * \@docs-private
- * @return {?}
- */
- MatSelect.prototype.onContainerClick = /**
- * Implemented as part of MatFormFieldControl.
- * \@docs-private
- * @return {?}
- */
- function () {
- this.focus();
- this.open();
- };
- Object.defineProperty(MatSelect.prototype, "shouldLabelFloat", {
- /**
- * Implemented as part of MatFormFieldControl.
- * @docs-private
- */
- get: /**
- * Implemented as part of MatFormFieldControl.
- * \@docs-private
- * @return {?}
- */
- function () {
- return this._panelOpen || !this.empty;
- },
- enumerable: true,
- configurable: true
- });
- MatSelect.decorators = [
- { type: core.Component, args: [{selector: 'mat-select',
- exportAs: 'matSelect',
- 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>",
- 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}"],
- inputs: ['disabled', 'disableRipple', 'tabIndex'],
- encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- host: {
- 'role': 'listbox',
- '[attr.id]': 'id',
- '[attr.tabindex]': 'tabIndex',
- '[attr.aria-label]': '_getAriaLabel()',
- '[attr.aria-labelledby]': '_getAriaLabelledby()',
- '[attr.aria-required]': 'required.toString()',
- '[attr.aria-disabled]': 'disabled.toString()',
- '[attr.aria-invalid]': 'errorState',
- '[attr.aria-owns]': 'panelOpen ? _optionIds : null',
- '[attr.aria-multiselectable]': 'multiple',
- '[attr.aria-describedby]': '_ariaDescribedby || null',
- '[attr.aria-activedescendant]': '_getAriaActiveDescendant()',
- '[class.mat-select-disabled]': 'disabled',
- '[class.mat-select-invalid]': 'errorState',
- '[class.mat-select-required]': 'required',
- '[class.mat-select-empty]': 'empty',
- 'class': 'mat-select',
- '(keydown)': '_handleKeydown($event)',
- '(focus)': '_onFocus()',
- '(blur)': '_onBlur()',
- },
- animations: [
- matSelectAnimations.transformPanelWrap,
- matSelectAnimations.transformPanel
- ],
- providers: [
- { provide: MatFormFieldControl, useExisting: MatSelect },
- { provide: MAT_OPTION_PARENT_COMPONENT, useExisting: MatSelect }
- ],
- },] },
- ];
- /** @nocollapse */
- MatSelect.ctorParameters = function () { return [
- { type: scrolling.ViewportRuler },
- { type: core.ChangeDetectorRef },
- { type: core.NgZone },
- { type: ErrorStateMatcher },
- { type: core.ElementRef },
- { type: bidi.Directionality, decorators: [{ type: core.Optional }] },
- { type: forms.NgForm, decorators: [{ type: core.Optional }] },
- { type: forms.FormGroupDirective, decorators: [{ type: core.Optional }] },
- { type: MatFormField, decorators: [{ type: core.Optional }] },
- { type: forms.NgControl, decorators: [{ type: core.Self }, { type: core.Optional }] },
- { type: String, decorators: [{ type: core.Attribute, args: ['tabindex',] }] },
- { type: undefined, decorators: [{ type: core.Inject, args: [MAT_SELECT_SCROLL_STRATEGY,] }] },
- { type: a11y.LiveAnnouncer }
- ]; };
- MatSelect.propDecorators = {
- trigger: [{ type: core.ViewChild, args: ['trigger', { static: false },] }],
- panel: [{ type: core.ViewChild, args: ['panel', { static: false },] }],
- overlayDir: [{ type: core.ViewChild, args: [overlay.CdkConnectedOverlay, { static: false },] }],
- options: [{ type: core.ContentChildren, args: [MatOption, { descendants: true },] }],
- optionGroups: [{ type: core.ContentChildren, args: [MatOptgroup,] }],
- panelClass: [{ type: core.Input }],
- customTrigger: [{ type: core.ContentChild, args: [MatSelectTrigger, { static: false },] }],
- placeholder: [{ type: core.Input }],
- required: [{ type: core.Input }],
- multiple: [{ type: core.Input }],
- disableOptionCentering: [{ type: core.Input }],
- compareWith: [{ type: core.Input }],
- value: [{ type: core.Input }],
- ariaLabel: [{ type: core.Input, args: ['aria-label',] }],
- ariaLabelledby: [{ type: core.Input, args: ['aria-labelledby',] }],
- errorStateMatcher: [{ type: core.Input }],
- sortComparator: [{ type: core.Input }],
- id: [{ type: core.Input }],
- openedChange: [{ type: core.Output }],
- _openedStream: [{ type: core.Output, args: ['opened',] }],
- _closedStream: [{ type: core.Output, args: ['closed',] }],
- selectionChange: [{ type: core.Output }],
- valueChange: [{ type: core.Output }]
- };
- return MatSelect;
- }(_MatSelectMixinBase));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var MatSelectModule = /** @class */ (function () {
- function MatSelectModule() {
- }
- MatSelectModule.decorators = [
- { type: core.NgModule, args: [{
- imports: [
- common.CommonModule,
- overlay.OverlayModule,
- MatOptionModule,
- MatCommonModule,
- ],
- exports: [MatFormFieldModule, MatSelect, MatSelectTrigger, MatOptionModule, MatCommonModule],
- declarations: [MatSelect, MatSelectTrigger],
- providers: [MAT_SELECT_SCROLL_STRATEGY_PROVIDER]
- },] },
- ];
- return MatSelectModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Animations used by MatTooltip.
- * \@docs-private
- * @type {?}
- */
- var matTooltipAnimations = {
- /**
- * Animation that transitions a tooltip in and out.
- */
- tooltipState: animations$1.trigger('state', [
- animations$1.state('initial, void, hidden', animations$1.style({ opacity: 0, transform: 'scale(0)' })),
- animations$1.state('visible', animations$1.style({ transform: 'scale(1)' })),
- animations$1.transition('* => visible', animations$1.animate('200ms cubic-bezier(0, 0, 0.2, 1)', animations$1.keyframes([
- animations$1.style({ opacity: 0, transform: 'scale(0)', offset: 0 }),
- animations$1.style({ opacity: 0.5, transform: 'scale(0.99)', offset: 0.5 }),
- animations$1.style({ opacity: 1, transform: 'scale(1)', offset: 1 })
- ]))),
- animations$1.transition('* => hidden', animations$1.animate('100ms cubic-bezier(0, 0, 0.2, 1)', animations$1.style({ opacity: 0 }))),
- ])
- };
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Time in ms to throttle repositioning after scroll events.
- * @type {?}
- */
- var SCROLL_THROTTLE_MS = 20;
- /**
- * CSS class that will be attached to the overlay panel.
- * @type {?}
- */
- var TOOLTIP_PANEL_CLASS = 'mat-tooltip-panel';
- /**
- * Creates an error to be thrown if the user supplied an invalid tooltip position.
- * \@docs-private
- * @param {?} position
- * @return {?}
- */
- function getMatTooltipInvalidPositionError(position) {
- return Error("Tooltip position \"" + position + "\" is invalid.");
- }
- /**
- * Injection token that determines the scroll handling while a tooltip is visible.
- * @type {?}
- */
- var MAT_TOOLTIP_SCROLL_STRATEGY = new core.InjectionToken('mat-tooltip-scroll-strategy');
- /**
- * \@docs-private
- * @param {?} overlay
- * @return {?}
- */
- function MAT_TOOLTIP_SCROLL_STRATEGY_FACTORY(overlay$$1) {
- return (/**
- * @return {?}
- */
- function () { return overlay$$1.scrollStrategies.reposition({ scrollThrottle: SCROLL_THROTTLE_MS }); });
- }
- /**
- * \@docs-private
- * @type {?}
- */
- var MAT_TOOLTIP_SCROLL_STRATEGY_FACTORY_PROVIDER = {
- provide: MAT_TOOLTIP_SCROLL_STRATEGY,
- deps: [overlay.Overlay],
- useFactory: MAT_TOOLTIP_SCROLL_STRATEGY_FACTORY,
- };
- /**
- * Injection token to be used to override the default options for `matTooltip`.
- * @type {?}
- */
- var MAT_TOOLTIP_DEFAULT_OPTIONS = new core.InjectionToken('mat-tooltip-default-options', {
- providedIn: 'root',
- factory: MAT_TOOLTIP_DEFAULT_OPTIONS_FACTORY
- });
- /**
- * \@docs-private
- * @return {?}
- */
- function MAT_TOOLTIP_DEFAULT_OPTIONS_FACTORY() {
- return {
- showDelay: 0,
- hideDelay: 0,
- touchendHideDelay: 1500,
- };
- }
- /**
- * Directive that attaches a material design tooltip to the host element. Animates the showing and
- * hiding of a tooltip provided position (defaults to below the element).
- *
- * https://material.io/design/components/tooltips.html
- */
- var MatTooltip = /** @class */ (function () {
- function MatTooltip(_overlay, _elementRef, _scrollDispatcher, _viewContainerRef, _ngZone, platform$$1, _ariaDescriber, _focusMonitor, scrollStrategy, _dir, _defaultOptions, hammerLoader) {
- var _this = this;
- this._overlay = _overlay;
- this._elementRef = _elementRef;
- this._scrollDispatcher = _scrollDispatcher;
- this._viewContainerRef = _viewContainerRef;
- this._ngZone = _ngZone;
- this._ariaDescriber = _ariaDescriber;
- this._focusMonitor = _focusMonitor;
- this._dir = _dir;
- this._defaultOptions = _defaultOptions;
- this._position = 'below';
- this._disabled = false;
- /**
- * The default delay in ms before showing the tooltip after show is called
- */
- this.showDelay = this._defaultOptions.showDelay;
- /**
- * The default delay in ms before hiding the tooltip after hide is called
- */
- this.hideDelay = this._defaultOptions.hideDelay;
- this._message = '';
- this._manualListeners = new Map();
- /**
- * Emits when the component is destroyed.
- */
- this._destroyed = new rxjs.Subject();
- this._scrollStrategy = scrollStrategy;
- /** @type {?} */
- var element = _elementRef.nativeElement;
- /** @type {?} */
- var hasGestures = typeof window === 'undefined' || ((/** @type {?} */ (window))).Hammer || hammerLoader;
- // The mouse events shouldn't be bound on mobile devices, because they can prevent the
- // first tap from firing its click event or can cause the tooltip to open for clicks.
- if (!platform$$1.IOS && !platform$$1.ANDROID) {
- this._manualListeners
- .set('mouseenter', (/**
- * @return {?}
- */
- function () { return _this.show(); }))
- .set('mouseleave', (/**
- * @return {?}
- */
- function () { return _this.hide(); }));
- }
- else if (!hasGestures) {
- // If Hammerjs isn't loaded, fall back to showing on `touchstart`, otherwise
- // there's no way for the user to trigger the tooltip on a touch device.
- this._manualListeners.set('touchstart', (/**
- * @return {?}
- */
- function () { return _this.show(); }));
- }
- this._manualListeners.forEach((/**
- * @param {?} listener
- * @param {?} event
- * @return {?}
- */
- function (listener, event) { return element.addEventListener(event, listener); }));
- _focusMonitor.monitor(_elementRef).pipe(operators.takeUntil(this._destroyed)).subscribe((/**
- * @param {?} origin
- * @return {?}
- */
- function (origin) {
- // Note that the focus monitor runs outside the Angular zone.
- if (!origin) {
- _ngZone.run((/**
- * @return {?}
- */
- function () { return _this.hide(0); }));
- }
- else if (origin === 'keyboard') {
- _ngZone.run((/**
- * @return {?}
- */
- function () { return _this.show(); }));
- }
- }));
- if (_defaultOptions && _defaultOptions.position) {
- this.position = _defaultOptions.position;
- }
- }
- Object.defineProperty(MatTooltip.prototype, "position", {
- /** Allows the user to define the position of the tooltip relative to the parent element */
- get: /**
- * Allows the user to define the position of the tooltip relative to the parent element
- * @return {?}
- */
- function () { return this._position; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- if (value !== this._position) {
- this._position = value;
- if (this._overlayRef) {
- this._updatePosition();
- if (this._tooltipInstance) {
- (/** @type {?} */ (this._tooltipInstance)).show(0);
- }
- this._overlayRef.updatePosition();
- }
- }
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatTooltip.prototype, "disabled", {
- /** Disables the display of the tooltip. */
- get: /**
- * Disables the display of the tooltip.
- * @return {?}
- */
- function () { return this._disabled; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._disabled = coercion.coerceBooleanProperty(value);
- // If tooltip is disabled, hide immediately.
- if (this._disabled) {
- this.hide(0);
- }
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatTooltip.prototype, "message", {
- /** The message to be displayed in the tooltip */
- get: /**
- * The message to be displayed in the tooltip
- * @return {?}
- */
- function () { return this._message; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._ariaDescriber.removeDescription(this._elementRef.nativeElement, this._message);
- // If the message is not a string (e.g. number), convert it to a string and trim it.
- this._message = value != null ? ("" + value).trim() : '';
- if (!this._message && this._isTooltipVisible()) {
- this.hide(0);
- }
- else {
- this._updateTooltipMessage();
- this._ariaDescriber.describe(this._elementRef.nativeElement, this.message);
- }
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatTooltip.prototype, "tooltipClass", {
- /** Classes to be passed to the tooltip. Supports the same syntax as `ngClass`. */
- get: /**
- * Classes to be passed to the tooltip. Supports the same syntax as `ngClass`.
- * @return {?}
- */
- function () { return this._tooltipClass; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._tooltipClass = value;
- if (this._tooltipInstance) {
- this._setTooltipClass(this._tooltipClass);
- }
- },
- enumerable: true,
- configurable: true
- });
- /**
- * Setup styling-specific things
- */
- /**
- * Setup styling-specific things
- * @return {?}
- */
- MatTooltip.prototype.ngOnInit = /**
- * Setup styling-specific things
- * @return {?}
- */
- function () {
- /** @type {?} */
- var element = this._elementRef.nativeElement;
- /** @type {?} */
- var elementStyle = (/** @type {?} */ (element.style));
- if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
- // When we bind a gesture event on an element (in this case `longpress`), HammerJS
- // will add some inline styles by default, including `user-select: none`. This is
- // problematic on iOS and in Safari, because it will prevent users from typing in inputs.
- // Since `user-select: none` is not needed for the `longpress` event and can cause unexpected
- // behavior for text fields, we always clear the `user-select` to avoid such issues.
- elementStyle.webkitUserSelect = elementStyle.userSelect = elementStyle.msUserSelect = '';
- }
- // Hammer applies `-webkit-user-drag: none` on all elements by default,
- // which breaks the native drag&drop. If the consumer explicitly made
- // the element draggable, clear the `-webkit-user-drag`.
- if (element.draggable && elementStyle.webkitUserDrag === 'none') {
- elementStyle.webkitUserDrag = '';
- }
- };
- /**
- * Dispose the tooltip when destroyed.
- */
- /**
- * Dispose the tooltip when destroyed.
- * @return {?}
- */
- MatTooltip.prototype.ngOnDestroy = /**
- * Dispose the tooltip when destroyed.
- * @return {?}
- */
- function () {
- var _this = this;
- if (this._overlayRef) {
- this._overlayRef.dispose();
- this._tooltipInstance = null;
- }
- // Clean up the event listeners set in the constructor
- this._manualListeners.forEach((/**
- * @param {?} listener
- * @param {?} event
- * @return {?}
- */
- function (listener, event) {
- _this._elementRef.nativeElement.removeEventListener(event, listener);
- }));
- this._manualListeners.clear();
- this._destroyed.next();
- this._destroyed.complete();
- this._ariaDescriber.removeDescription(this._elementRef.nativeElement, this.message);
- this._focusMonitor.stopMonitoring(this._elementRef);
- };
- /** Shows the tooltip after the delay in ms, defaults to tooltip-delay-show or 0ms if no input */
- /**
- * Shows the tooltip after the delay in ms, defaults to tooltip-delay-show or 0ms if no input
- * @param {?=} delay
- * @return {?}
- */
- MatTooltip.prototype.show = /**
- * Shows the tooltip after the delay in ms, defaults to tooltip-delay-show or 0ms if no input
- * @param {?=} delay
- * @return {?}
- */
- function (delay) {
- var _this = this;
- if (delay === void 0) { delay = this.showDelay; }
- if (this.disabled || !this.message || (this._isTooltipVisible() &&
- !(/** @type {?} */ (this._tooltipInstance))._showTimeoutId && !(/** @type {?} */ (this._tooltipInstance))._hideTimeoutId)) {
- return;
- }
- /** @type {?} */
- var overlayRef = this._createOverlay();
- this._detach();
- this._portal = this._portal || new portal.ComponentPortal(TooltipComponent, this._viewContainerRef);
- this._tooltipInstance = overlayRef.attach(this._portal).instance;
- this._tooltipInstance.afterHidden()
- .pipe(operators.takeUntil(this._destroyed))
- .subscribe((/**
- * @return {?}
- */
- function () { return _this._detach(); }));
- this._setTooltipClass(this._tooltipClass);
- this._updateTooltipMessage();
- (/** @type {?} */ (this._tooltipInstance)).show(delay);
- };
- /** Hides the tooltip after the delay in ms, defaults to tooltip-delay-hide or 0ms if no input */
- /**
- * Hides the tooltip after the delay in ms, defaults to tooltip-delay-hide or 0ms if no input
- * @param {?=} delay
- * @return {?}
- */
- MatTooltip.prototype.hide = /**
- * Hides the tooltip after the delay in ms, defaults to tooltip-delay-hide or 0ms if no input
- * @param {?=} delay
- * @return {?}
- */
- function (delay) {
- if (delay === void 0) { delay = this.hideDelay; }
- if (this._tooltipInstance) {
- this._tooltipInstance.hide(delay);
- }
- };
- /** Shows/hides the tooltip */
- /**
- * Shows/hides the tooltip
- * @return {?}
- */
- MatTooltip.prototype.toggle = /**
- * Shows/hides the tooltip
- * @return {?}
- */
- function () {
- this._isTooltipVisible() ? this.hide() : this.show();
- };
- /** Returns true if the tooltip is currently visible to the user */
- /**
- * Returns true if the tooltip is currently visible to the user
- * @return {?}
- */
- MatTooltip.prototype._isTooltipVisible = /**
- * Returns true if the tooltip is currently visible to the user
- * @return {?}
- */
- function () {
- return !!this._tooltipInstance && this._tooltipInstance.isVisible();
- };
- /** Handles the keydown events on the host element. */
- /**
- * Handles the keydown events on the host element.
- * @param {?} e
- * @return {?}
- */
- MatTooltip.prototype._handleKeydown = /**
- * Handles the keydown events on the host element.
- * @param {?} e
- * @return {?}
- */
- function (e) {
- if (this._isTooltipVisible() && e.keyCode === keycodes.ESCAPE && !keycodes.hasModifierKey(e)) {
- e.preventDefault();
- e.stopPropagation();
- this.hide(0);
- }
- };
- /** Handles the touchend events on the host element. */
- /**
- * Handles the touchend events on the host element.
- * @return {?}
- */
- MatTooltip.prototype._handleTouchend = /**
- * Handles the touchend events on the host element.
- * @return {?}
- */
- function () {
- this.hide(this._defaultOptions.touchendHideDelay);
- };
- /** Create the overlay config and position strategy */
- /**
- * Create the overlay config and position strategy
- * @private
- * @return {?}
- */
- MatTooltip.prototype._createOverlay = /**
- * Create the overlay config and position strategy
- * @private
- * @return {?}
- */
- function () {
- var _this = this;
- if (this._overlayRef) {
- return this._overlayRef;
- }
- /** @type {?} */
- var scrollableAncestors = this._scrollDispatcher.getAncestorScrollContainers(this._elementRef);
- // Create connected position strategy that listens for scroll events to reposition.
- /** @type {?} */
- var strategy = this._overlay.position()
- .flexibleConnectedTo(this._elementRef)
- .withTransformOriginOn('.mat-tooltip')
- .withFlexibleDimensions(false)
- .withViewportMargin(8)
- .withScrollableContainers(scrollableAncestors);
- strategy.positionChanges.pipe(operators.takeUntil(this._destroyed)).subscribe((/**
- * @param {?} change
- * @return {?}
- */
- function (change) {
- if (_this._tooltipInstance) {
- if (change.scrollableViewProperties.isOverlayClipped && _this._tooltipInstance.isVisible()) {
- // After position changes occur and the overlay is clipped by
- // a parent scrollable then close the tooltip.
- _this._ngZone.run((/**
- * @return {?}
- */
- function () { return _this.hide(0); }));
- }
- }
- }));
- this._overlayRef = this._overlay.create({
- direction: this._dir,
- positionStrategy: strategy,
- panelClass: TOOLTIP_PANEL_CLASS,
- scrollStrategy: this._scrollStrategy()
- });
- this._updatePosition();
- this._overlayRef.detachments()
- .pipe(operators.takeUntil(this._destroyed))
- .subscribe((/**
- * @return {?}
- */
- function () { return _this._detach(); }));
- return this._overlayRef;
- };
- /** Detaches the currently-attached tooltip. */
- /**
- * Detaches the currently-attached tooltip.
- * @private
- * @return {?}
- */
- MatTooltip.prototype._detach = /**
- * Detaches the currently-attached tooltip.
- * @private
- * @return {?}
- */
- function () {
- if (this._overlayRef && this._overlayRef.hasAttached()) {
- this._overlayRef.detach();
- }
- this._tooltipInstance = null;
- };
- /** Updates the position of the current tooltip. */
- /**
- * Updates the position of the current tooltip.
- * @private
- * @return {?}
- */
- MatTooltip.prototype._updatePosition = /**
- * Updates the position of the current tooltip.
- * @private
- * @return {?}
- */
- function () {
- /** @type {?} */
- var position = (/** @type {?} */ ((/** @type {?} */ (this._overlayRef)).getConfig().positionStrategy));
- /** @type {?} */
- var origin = this._getOrigin();
- /** @type {?} */
- var overlay$$1 = this._getOverlayPosition();
- position.withPositions([
- __assign({}, origin.main, overlay$$1.main),
- __assign({}, origin.fallback, overlay$$1.fallback)
- ]);
- };
- /**
- * Returns the origin position and a fallback position based on the user's position preference.
- * The fallback position is the inverse of the origin (e.g. `'below' -> 'above'`).
- */
- /**
- * Returns the origin position and a fallback position based on the user's position preference.
- * The fallback position is the inverse of the origin (e.g. `'below' -> 'above'`).
- * @return {?}
- */
- MatTooltip.prototype._getOrigin = /**
- * Returns the origin position and a fallback position based on the user's position preference.
- * The fallback position is the inverse of the origin (e.g. `'below' -> 'above'`).
- * @return {?}
- */
- function () {
- /** @type {?} */
- var isLtr = !this._dir || this._dir.value == 'ltr';
- /** @type {?} */
- var position = this.position;
- /** @type {?} */
- var originPosition;
- if (position == 'above' || position == 'below') {
- originPosition = { originX: 'center', originY: position == 'above' ? 'top' : 'bottom' };
- }
- else if (position == 'before' ||
- (position == 'left' && isLtr) ||
- (position == 'right' && !isLtr)) {
- originPosition = { originX: 'start', originY: 'center' };
- }
- else if (position == 'after' ||
- (position == 'right' && isLtr) ||
- (position == 'left' && !isLtr)) {
- originPosition = { originX: 'end', originY: 'center' };
- }
- else {
- throw getMatTooltipInvalidPositionError(position);
- }
- var _a = this._invertPosition(originPosition.originX, originPosition.originY), x = _a.x, y = _a.y;
- return {
- main: originPosition,
- fallback: { originX: x, originY: y }
- };
- };
- /** Returns the overlay position and a fallback position based on the user's preference */
- /**
- * Returns the overlay position and a fallback position based on the user's preference
- * @return {?}
- */
- MatTooltip.prototype._getOverlayPosition = /**
- * Returns the overlay position and a fallback position based on the user's preference
- * @return {?}
- */
- function () {
- /** @type {?} */
- var isLtr = !this._dir || this._dir.value == 'ltr';
- /** @type {?} */
- var position = this.position;
- /** @type {?} */
- var overlayPosition;
- if (position == 'above') {
- overlayPosition = { overlayX: 'center', overlayY: 'bottom' };
- }
- else if (position == 'below') {
- overlayPosition = { overlayX: 'center', overlayY: 'top' };
- }
- else if (position == 'before' ||
- (position == 'left' && isLtr) ||
- (position == 'right' && !isLtr)) {
- overlayPosition = { overlayX: 'end', overlayY: 'center' };
- }
- else if (position == 'after' ||
- (position == 'right' && isLtr) ||
- (position == 'left' && !isLtr)) {
- overlayPosition = { overlayX: 'start', overlayY: 'center' };
- }
- else {
- throw getMatTooltipInvalidPositionError(position);
- }
- var _a = this._invertPosition(overlayPosition.overlayX, overlayPosition.overlayY), x = _a.x, y = _a.y;
- return {
- main: overlayPosition,
- fallback: { overlayX: x, overlayY: y }
- };
- };
- /** Updates the tooltip message and repositions the overlay according to the new message length */
- /**
- * Updates the tooltip message and repositions the overlay according to the new message length
- * @private
- * @return {?}
- */
- MatTooltip.prototype._updateTooltipMessage = /**
- * Updates the tooltip message and repositions the overlay according to the new message length
- * @private
- * @return {?}
- */
- function () {
- var _this = this;
- // Must wait for the message to be painted to the tooltip so that the overlay can properly
- // calculate the correct positioning based on the size of the text.
- if (this._tooltipInstance) {
- this._tooltipInstance.message = this.message;
- this._tooltipInstance._markForCheck();
- this._ngZone.onMicrotaskEmpty.asObservable().pipe(operators.take(1), operators.takeUntil(this._destroyed)).subscribe((/**
- * @return {?}
- */
- function () {
- if (_this._tooltipInstance) {
- (/** @type {?} */ (_this._overlayRef)).updatePosition();
- }
- }));
- }
- };
- /** Updates the tooltip class */
- /**
- * Updates the tooltip class
- * @private
- * @param {?} tooltipClass
- * @return {?}
- */
- MatTooltip.prototype._setTooltipClass = /**
- * Updates the tooltip class
- * @private
- * @param {?} tooltipClass
- * @return {?}
- */
- function (tooltipClass) {
- if (this._tooltipInstance) {
- this._tooltipInstance.tooltipClass = tooltipClass;
- this._tooltipInstance._markForCheck();
- }
- };
- /** Inverts an overlay position. */
- /**
- * Inverts an overlay position.
- * @private
- * @param {?} x
- * @param {?} y
- * @return {?}
- */
- MatTooltip.prototype._invertPosition = /**
- * Inverts an overlay position.
- * @private
- * @param {?} x
- * @param {?} y
- * @return {?}
- */
- function (x, y) {
- if (this.position === 'above' || this.position === 'below') {
- if (y === 'top') {
- y = 'bottom';
- }
- else if (y === 'bottom') {
- y = 'top';
- }
- }
- else {
- if (x === 'end') {
- x = 'start';
- }
- else if (x === 'start') {
- x = 'end';
- }
- }
- return { x: x, y: y };
- };
- MatTooltip.decorators = [
- { type: core.Directive, args: [{
- selector: '[matTooltip]',
- exportAs: 'matTooltip',
- host: {
- '(longpress)': 'show()',
- '(keydown)': '_handleKeydown($event)',
- '(touchend)': '_handleTouchend()',
- },
- },] },
- ];
- /** @nocollapse */
- MatTooltip.ctorParameters = function () { return [
- { type: overlay.Overlay },
- { type: core.ElementRef },
- { type: scrolling.ScrollDispatcher },
- { type: core.ViewContainerRef },
- { type: core.NgZone },
- { type: platform.Platform },
- { type: a11y.AriaDescriber },
- { type: a11y.FocusMonitor },
- { type: undefined, decorators: [{ type: core.Inject, args: [MAT_TOOLTIP_SCROLL_STRATEGY,] }] },
- { type: bidi.Directionality, decorators: [{ type: core.Optional }] },
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_TOOLTIP_DEFAULT_OPTIONS,] }] },
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [platformBrowser.HAMMER_LOADER,] }] }
- ]; };
- MatTooltip.propDecorators = {
- position: [{ type: core.Input, args: ['matTooltipPosition',] }],
- disabled: [{ type: core.Input, args: ['matTooltipDisabled',] }],
- showDelay: [{ type: core.Input, args: ['matTooltipShowDelay',] }],
- hideDelay: [{ type: core.Input, args: ['matTooltipHideDelay',] }],
- message: [{ type: core.Input, args: ['matTooltip',] }],
- tooltipClass: [{ type: core.Input, args: ['matTooltipClass',] }]
- };
- return MatTooltip;
- }());
- /**
- * Internal component that wraps the tooltip's content.
- * \@docs-private
- */
- var TooltipComponent = /** @class */ (function () {
- function TooltipComponent(_changeDetectorRef, _breakpointObserver) {
- this._changeDetectorRef = _changeDetectorRef;
- this._breakpointObserver = _breakpointObserver;
- /**
- * Property watched by the animation framework to show or hide the tooltip
- */
- this._visibility = 'initial';
- /**
- * Whether interactions on the page should close the tooltip
- */
- this._closeOnInteraction = false;
- /**
- * Subject for notifying that the tooltip has been hidden from the view
- */
- this._onHide = new rxjs.Subject();
- /**
- * Stream that emits whether the user has a handset-sized display.
- */
- this._isHandset = this._breakpointObserver.observe(layout.Breakpoints.Handset);
- }
- /**
- * Shows the tooltip with an animation originating from the provided origin
- * @param delay Amount of milliseconds to the delay showing the tooltip.
- */
- /**
- * Shows the tooltip with an animation originating from the provided origin
- * @param {?} delay Amount of milliseconds to the delay showing the tooltip.
- * @return {?}
- */
- TooltipComponent.prototype.show = /**
- * Shows the tooltip with an animation originating from the provided origin
- * @param {?} delay Amount of milliseconds to the delay showing the tooltip.
- * @return {?}
- */
- function (delay) {
- var _this = this;
- // Cancel the delayed hide if it is scheduled
- if (this._hideTimeoutId) {
- clearTimeout(this._hideTimeoutId);
- this._hideTimeoutId = null;
- }
- // Body interactions should cancel the tooltip if there is a delay in showing.
- this._closeOnInteraction = true;
- this._showTimeoutId = setTimeout((/**
- * @return {?}
- */
- function () {
- _this._visibility = 'visible';
- _this._showTimeoutId = null;
- // Mark for check so if any parent component has set the
- // ChangeDetectionStrategy to OnPush it will be checked anyways
- _this._markForCheck();
- }), delay);
- };
- /**
- * Begins the animation to hide the tooltip after the provided delay in ms.
- * @param delay Amount of milliseconds to delay showing the tooltip.
- */
- /**
- * Begins the animation to hide the tooltip after the provided delay in ms.
- * @param {?} delay Amount of milliseconds to delay showing the tooltip.
- * @return {?}
- */
- TooltipComponent.prototype.hide = /**
- * Begins the animation to hide the tooltip after the provided delay in ms.
- * @param {?} delay Amount of milliseconds to delay showing the tooltip.
- * @return {?}
- */
- function (delay) {
- var _this = this;
- // Cancel the delayed show if it is scheduled
- if (this._showTimeoutId) {
- clearTimeout(this._showTimeoutId);
- this._showTimeoutId = null;
- }
- this._hideTimeoutId = setTimeout((/**
- * @return {?}
- */
- function () {
- _this._visibility = 'hidden';
- _this._hideTimeoutId = null;
- // Mark for check so if any parent component has set the
- // ChangeDetectionStrategy to OnPush it will be checked anyways
- _this._markForCheck();
- }), delay);
- };
- /** Returns an observable that notifies when the tooltip has been hidden from view. */
- /**
- * Returns an observable that notifies when the tooltip has been hidden from view.
- * @return {?}
- */
- TooltipComponent.prototype.afterHidden = /**
- * Returns an observable that notifies when the tooltip has been hidden from view.
- * @return {?}
- */
- function () {
- return this._onHide.asObservable();
- };
- /** Whether the tooltip is being displayed. */
- /**
- * Whether the tooltip is being displayed.
- * @return {?}
- */
- TooltipComponent.prototype.isVisible = /**
- * Whether the tooltip is being displayed.
- * @return {?}
- */
- function () {
- return this._visibility === 'visible';
- };
- /**
- * @return {?}
- */
- TooltipComponent.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- this._onHide.complete();
- };
- /**
- * @return {?}
- */
- TooltipComponent.prototype._animationStart = /**
- * @return {?}
- */
- function () {
- this._closeOnInteraction = false;
- };
- /**
- * @param {?} event
- * @return {?}
- */
- TooltipComponent.prototype._animationDone = /**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- /** @type {?} */
- var toState = (/** @type {?} */ (event.toState));
- if (toState === 'hidden' && !this.isVisible()) {
- this._onHide.next();
- }
- if (toState === 'visible' || toState === 'hidden') {
- this._closeOnInteraction = true;
- }
- };
- /**
- * Interactions on the HTML body should close the tooltip immediately as defined in the
- * material design spec.
- * https://material.io/design/components/tooltips.html#behavior
- */
- /**
- * Interactions on the HTML body should close the tooltip immediately as defined in the
- * material design spec.
- * https://material.io/design/components/tooltips.html#behavior
- * @return {?}
- */
- TooltipComponent.prototype._handleBodyInteraction = /**
- * Interactions on the HTML body should close the tooltip immediately as defined in the
- * material design spec.
- * https://material.io/design/components/tooltips.html#behavior
- * @return {?}
- */
- function () {
- if (this._closeOnInteraction) {
- this.hide(0);
- }
- };
- /**
- * Marks that the tooltip needs to be checked in the next change detection run.
- * Mainly used for rendering the initial text before positioning a tooltip, which
- * can be problematic in components with OnPush change detection.
- */
- /**
- * Marks that the tooltip needs to be checked in the next change detection run.
- * Mainly used for rendering the initial text before positioning a tooltip, which
- * can be problematic in components with OnPush change detection.
- * @return {?}
- */
- TooltipComponent.prototype._markForCheck = /**
- * Marks that the tooltip needs to be checked in the next change detection run.
- * Mainly used for rendering the initial text before positioning a tooltip, which
- * can be problematic in components with OnPush change detection.
- * @return {?}
- */
- function () {
- this._changeDetectorRef.markForCheck();
- };
- TooltipComponent.decorators = [
- { type: core.Component, args: [{selector: 'mat-tooltip-component',
- 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>",
- 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}"],
- encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- animations: [matTooltipAnimations.tooltipState],
- host: {
- // Forces the element to have a layout in IE and Edge. This fixes issues where the element
- // won't be rendered if the animations are disabled or there is no web animations polyfill.
- '[style.zoom]': '_visibility === "visible" ? 1 : null',
- '(body:click)': 'this._handleBodyInteraction()',
- 'aria-hidden': 'true',
- }
- },] },
- ];
- /** @nocollapse */
- TooltipComponent.ctorParameters = function () { return [
- { type: core.ChangeDetectorRef },
- { type: layout.BreakpointObserver }
- ]; };
- return TooltipComponent;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var MatTooltipModule = /** @class */ (function () {
- function MatTooltipModule() {
- }
- MatTooltipModule.decorators = [
- { type: core.NgModule, args: [{
- imports: [
- a11y.A11yModule,
- common.CommonModule,
- overlay.OverlayModule,
- MatCommonModule,
- ],
- exports: [MatTooltip, TooltipComponent, MatCommonModule],
- declarations: [MatTooltip, TooltipComponent],
- entryComponents: [TooltipComponent],
- providers: [
- MAT_TOOLTIP_SCROLL_STRATEGY_FACTORY_PROVIDER,
- { provide: platformBrowser.HAMMER_GESTURE_CONFIG, useClass: GestureConfig },
- ]
- },] },
- ];
- return MatTooltipModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * To modify the labels and text displayed, create a new instance of MatPaginatorIntl and
- * include it in a custom provider
- */
- var MatPaginatorIntl = /** @class */ (function () {
- function MatPaginatorIntl() {
- /**
- * Stream to emit from when labels are changed. Use this to notify components when the labels have
- * changed after initialization.
- */
- this.changes = new rxjs.Subject();
- /**
- * A label for the page size selector.
- */
- this.itemsPerPageLabel = 'Items per page:';
- /**
- * A label for the button that increments the current page.
- */
- this.nextPageLabel = 'Next page';
- /**
- * A label for the button that decrements the current page.
- */
- this.previousPageLabel = 'Previous page';
- /**
- * A label for the button that moves to the first page.
- */
- this.firstPageLabel = 'First page';
- /**
- * A label for the button that moves to the last page.
- */
- this.lastPageLabel = 'Last page';
- /**
- * A label for the range of items within the current page and the length of the whole list.
- */
- this.getRangeLabel = (/**
- * @param {?} page
- * @param {?} pageSize
- * @param {?} length
- * @return {?}
- */
- function (page, pageSize, length) {
- if (length == 0 || pageSize == 0) {
- return "0 of " + length;
- }
- length = Math.max(length, 0);
- /** @type {?} */
- var startIndex = page * pageSize;
- // If the start index exceeds the list length, do not try and fix the end index to the end.
- /** @type {?} */
- var endIndex = startIndex < length ?
- Math.min(startIndex + pageSize, length) :
- startIndex + pageSize;
- return startIndex + 1 + " - " + endIndex + " of " + length;
- });
- }
- MatPaginatorIntl.decorators = [
- { type: core.Injectable, args: [{ providedIn: 'root' },] },
- ];
- /** @nocollapse */ MatPaginatorIntl.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function MatPaginatorIntl_Factory() { return new MatPaginatorIntl(); }, token: MatPaginatorIntl, providedIn: "root" });
- return MatPaginatorIntl;
- }());
- /**
- * \@docs-private
- * @param {?} parentIntl
- * @return {?}
- */
- function MAT_PAGINATOR_INTL_PROVIDER_FACTORY(parentIntl) {
- return parentIntl || new MatPaginatorIntl();
- }
- /**
- * \@docs-private
- * @type {?}
- */
- var MAT_PAGINATOR_INTL_PROVIDER = {
- // If there is already an MatPaginatorIntl available, use that. Otherwise, provide a new one.
- provide: MatPaginatorIntl,
- deps: [[new core.Optional(), new core.SkipSelf(), MatPaginatorIntl]],
- useFactory: MAT_PAGINATOR_INTL_PROVIDER_FACTORY
- };
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * The default page size if there is no page size and there are no provided page size options.
- * @type {?}
- */
- var DEFAULT_PAGE_SIZE = 50;
- /**
- * Change event object that is emitted when the user selects a
- * different page size or navigates to another page.
- */
- var /**
- * Change event object that is emitted when the user selects a
- * different page size or navigates to another page.
- */
- PageEvent = /** @class */ (function () {
- function PageEvent() {
- }
- return PageEvent;
- }());
- // Boilerplate for applying mixins to MatPaginator.
- /**
- * \@docs-private
- */
- var
- // Boilerplate for applying mixins to MatPaginator.
- /**
- * \@docs-private
- */
- MatPaginatorBase = /** @class */ (function () {
- function MatPaginatorBase() {
- }
- return MatPaginatorBase;
- }());
- /** @type {?} */
- var _MatPaginatorBase = mixinDisabled(mixinInitialized(MatPaginatorBase));
- /**
- * Component to provide navigation between paged information. Displays the size of the current
- * page, user-selectable options to change that size, what items are being shown, and
- * navigational button to go to the previous or next page.
- */
- var MatPaginator = /** @class */ (function (_super) {
- __extends(MatPaginator, _super);
- function MatPaginator(_intl, _changeDetectorRef) {
- var _this = _super.call(this) || this;
- _this._intl = _intl;
- _this._changeDetectorRef = _changeDetectorRef;
- _this._pageIndex = 0;
- _this._length = 0;
- _this._pageSizeOptions = [];
- _this._hidePageSize = false;
- _this._showFirstLastButtons = false;
- /**
- * Event emitted when the paginator changes the page size or page index.
- */
- _this.page = new core.EventEmitter();
- _this._intlChanges = _intl.changes.subscribe((/**
- * @return {?}
- */
- function () { return _this._changeDetectorRef.markForCheck(); }));
- return _this;
- }
- Object.defineProperty(MatPaginator.prototype, "pageIndex", {
- /** The zero-based page index of the displayed list of items. Defaulted to 0. */
- get: /**
- * The zero-based page index of the displayed list of items. Defaulted to 0.
- * @return {?}
- */
- function () { return this._pageIndex; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._pageIndex = Math.max(coercion.coerceNumberProperty(value), 0);
- this._changeDetectorRef.markForCheck();
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatPaginator.prototype, "length", {
- /** The length of the total number of items that are being paginated. Defaulted to 0. */
- get: /**
- * The length of the total number of items that are being paginated. Defaulted to 0.
- * @return {?}
- */
- function () { return this._length; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._length = coercion.coerceNumberProperty(value);
- this._changeDetectorRef.markForCheck();
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatPaginator.prototype, "pageSize", {
- /** Number of items to display on a page. By default set to 50. */
- get: /**
- * Number of items to display on a page. By default set to 50.
- * @return {?}
- */
- function () { return this._pageSize; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._pageSize = Math.max(coercion.coerceNumberProperty(value), 0);
- this._updateDisplayedPageSizeOptions();
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatPaginator.prototype, "pageSizeOptions", {
- /** The set of provided page size options to display to the user. */
- get: /**
- * The set of provided page size options to display to the user.
- * @return {?}
- */
- function () { return this._pageSizeOptions; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._pageSizeOptions = (value || []).map((/**
- * @param {?} p
- * @return {?}
- */
- function (p) { return coercion.coerceNumberProperty(p); }));
- this._updateDisplayedPageSizeOptions();
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatPaginator.prototype, "hidePageSize", {
- /** Whether to hide the page size selection UI from the user. */
- get: /**
- * Whether to hide the page size selection UI from the user.
- * @return {?}
- */
- function () { return this._hidePageSize; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._hidePageSize = coercion.coerceBooleanProperty(value);
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatPaginator.prototype, "showFirstLastButtons", {
- /** Whether to show the first/last buttons UI to the user. */
- get: /**
- * Whether to show the first/last buttons UI to the user.
- * @return {?}
- */
- function () { return this._showFirstLastButtons; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._showFirstLastButtons = coercion.coerceBooleanProperty(value);
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- MatPaginator.prototype.ngOnInit = /**
- * @return {?}
- */
- function () {
- this._initialized = true;
- this._updateDisplayedPageSizeOptions();
- this._markInitialized();
- };
- /**
- * @return {?}
- */
- MatPaginator.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- this._intlChanges.unsubscribe();
- };
- /** Advances to the next page if it exists. */
- /**
- * Advances to the next page if it exists.
- * @return {?}
- */
- MatPaginator.prototype.nextPage = /**
- * Advances to the next page if it exists.
- * @return {?}
- */
- function () {
- if (!this.hasNextPage()) {
- return;
- }
- /** @type {?} */
- var previousPageIndex = this.pageIndex;
- this.pageIndex++;
- this._emitPageEvent(previousPageIndex);
- };
- /** Move back to the previous page if it exists. */
- /**
- * Move back to the previous page if it exists.
- * @return {?}
- */
- MatPaginator.prototype.previousPage = /**
- * Move back to the previous page if it exists.
- * @return {?}
- */
- function () {
- if (!this.hasPreviousPage()) {
- return;
- }
- /** @type {?} */
- var previousPageIndex = this.pageIndex;
- this.pageIndex--;
- this._emitPageEvent(previousPageIndex);
- };
- /** Move to the first page if not already there. */
- /**
- * Move to the first page if not already there.
- * @return {?}
- */
- MatPaginator.prototype.firstPage = /**
- * Move to the first page if not already there.
- * @return {?}
- */
- function () {
- // hasPreviousPage being false implies at the start
- if (!this.hasPreviousPage()) {
- return;
- }
- /** @type {?} */
- var previousPageIndex = this.pageIndex;
- this.pageIndex = 0;
- this._emitPageEvent(previousPageIndex);
- };
- /** Move to the last page if not already there. */
- /**
- * Move to the last page if not already there.
- * @return {?}
- */
- MatPaginator.prototype.lastPage = /**
- * Move to the last page if not already there.
- * @return {?}
- */
- function () {
- // hasNextPage being false implies at the end
- if (!this.hasNextPage()) {
- return;
- }
- /** @type {?} */
- var previousPageIndex = this.pageIndex;
- this.pageIndex = this.getNumberOfPages() - 1;
- this._emitPageEvent(previousPageIndex);
- };
- /** Whether there is a previous page. */
- /**
- * Whether there is a previous page.
- * @return {?}
- */
- MatPaginator.prototype.hasPreviousPage = /**
- * Whether there is a previous page.
- * @return {?}
- */
- function () {
- return this.pageIndex >= 1 && this.pageSize != 0;
- };
- /** Whether there is a next page. */
- /**
- * Whether there is a next page.
- * @return {?}
- */
- MatPaginator.prototype.hasNextPage = /**
- * Whether there is a next page.
- * @return {?}
- */
- function () {
- /** @type {?} */
- var maxPageIndex = this.getNumberOfPages() - 1;
- return this.pageIndex < maxPageIndex && this.pageSize != 0;
- };
- /** Calculate the number of pages */
- /**
- * Calculate the number of pages
- * @return {?}
- */
- MatPaginator.prototype.getNumberOfPages = /**
- * Calculate the number of pages
- * @return {?}
- */
- function () {
- if (!this.pageSize) {
- return 0;
- }
- return Math.ceil(this.length / this.pageSize);
- };
- /**
- * Changes the page size so that the first item displayed on the page will still be
- * displayed using the new page size.
- *
- * For example, if the page size is 10 and on the second page (items indexed 10-19) then
- * switching so that the page size is 5 will set the third page as the current page so
- * that the 10th item will still be displayed.
- */
- /**
- * Changes the page size so that the first item displayed on the page will still be
- * displayed using the new page size.
- *
- * For example, if the page size is 10 and on the second page (items indexed 10-19) then
- * switching so that the page size is 5 will set the third page as the current page so
- * that the 10th item will still be displayed.
- * @param {?} pageSize
- * @return {?}
- */
- MatPaginator.prototype._changePageSize = /**
- * Changes the page size so that the first item displayed on the page will still be
- * displayed using the new page size.
- *
- * For example, if the page size is 10 and on the second page (items indexed 10-19) then
- * switching so that the page size is 5 will set the third page as the current page so
- * that the 10th item will still be displayed.
- * @param {?} pageSize
- * @return {?}
- */
- function (pageSize) {
- // Current page needs to be updated to reflect the new page size. Navigate to the page
- // containing the previous page's first item.
- /** @type {?} */
- var startIndex = this.pageIndex * this.pageSize;
- /** @type {?} */
- var previousPageIndex = this.pageIndex;
- this.pageIndex = Math.floor(startIndex / pageSize) || 0;
- this.pageSize = pageSize;
- this._emitPageEvent(previousPageIndex);
- };
- /** Checks whether the buttons for going forwards should be disabled. */
- /**
- * Checks whether the buttons for going forwards should be disabled.
- * @return {?}
- */
- MatPaginator.prototype._nextButtonsDisabled = /**
- * Checks whether the buttons for going forwards should be disabled.
- * @return {?}
- */
- function () {
- return this.disabled || !this.hasNextPage();
- };
- /** Checks whether the buttons for going backwards should be disabled. */
- /**
- * Checks whether the buttons for going backwards should be disabled.
- * @return {?}
- */
- MatPaginator.prototype._previousButtonsDisabled = /**
- * Checks whether the buttons for going backwards should be disabled.
- * @return {?}
- */
- function () {
- return this.disabled || !this.hasPreviousPage();
- };
- /**
- * Updates the list of page size options to display to the user. Includes making sure that
- * the page size is an option and that the list is sorted.
- */
- /**
- * Updates the list of page size options to display to the user. Includes making sure that
- * the page size is an option and that the list is sorted.
- * @private
- * @return {?}
- */
- MatPaginator.prototype._updateDisplayedPageSizeOptions = /**
- * Updates the list of page size options to display to the user. Includes making sure that
- * the page size is an option and that the list is sorted.
- * @private
- * @return {?}
- */
- function () {
- if (!this._initialized) {
- return;
- }
- // If no page size is provided, use the first page size option or the default page size.
- if (!this.pageSize) {
- this._pageSize = this.pageSizeOptions.length != 0 ?
- this.pageSizeOptions[0] :
- DEFAULT_PAGE_SIZE;
- }
- this._displayedPageSizeOptions = this.pageSizeOptions.slice();
- if (this._displayedPageSizeOptions.indexOf(this.pageSize) === -1) {
- this._displayedPageSizeOptions.push(this.pageSize);
- }
- // Sort the numbers using a number-specific sort function.
- this._displayedPageSizeOptions.sort((/**
- * @param {?} a
- * @param {?} b
- * @return {?}
- */
- function (a, b) { return a - b; }));
- this._changeDetectorRef.markForCheck();
- };
- /** Emits an event notifying that a change of the paginator's properties has been triggered. */
- /**
- * Emits an event notifying that a change of the paginator's properties has been triggered.
- * @private
- * @param {?} previousPageIndex
- * @return {?}
- */
- MatPaginator.prototype._emitPageEvent = /**
- * Emits an event notifying that a change of the paginator's properties has been triggered.
- * @private
- * @param {?} previousPageIndex
- * @return {?}
- */
- function (previousPageIndex) {
- this.page.emit({
- previousPageIndex: previousPageIndex,
- pageIndex: this.pageIndex,
- pageSize: this.pageSize,
- length: this.length
- });
- };
- MatPaginator.decorators = [
- { type: core.Component, args: [{selector: 'mat-paginator',
- exportAs: 'matPaginator',
- 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>",
- 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)}"],
- inputs: ['disabled'],
- host: {
- 'class': 'mat-paginator',
- },
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- encapsulation: core.ViewEncapsulation.None,
- },] },
- ];
- /** @nocollapse */
- MatPaginator.ctorParameters = function () { return [
- { type: MatPaginatorIntl },
- { type: core.ChangeDetectorRef }
- ]; };
- MatPaginator.propDecorators = {
- color: [{ type: core.Input }],
- pageIndex: [{ type: core.Input }],
- length: [{ type: core.Input }],
- pageSize: [{ type: core.Input }],
- pageSizeOptions: [{ type: core.Input }],
- hidePageSize: [{ type: core.Input }],
- showFirstLastButtons: [{ type: core.Input }],
- page: [{ type: core.Output }]
- };
- return MatPaginator;
- }(_MatPaginatorBase));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var MatPaginatorModule = /** @class */ (function () {
- function MatPaginatorModule() {
- }
- MatPaginatorModule.decorators = [
- { type: core.NgModule, args: [{
- imports: [
- common.CommonModule,
- MatButtonModule,
- MatSelectModule,
- MatTooltipModule,
- ],
- exports: [MatPaginator],
- declarations: [MatPaginator],
- providers: [MAT_PAGINATOR_INTL_PROVIDER],
- },] },
- ];
- return MatPaginatorModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- // Boilerplate for applying mixins to MatProgressBar.
- /**
- * \@docs-private
- */
- var
- // Boilerplate for applying mixins to MatProgressBar.
- /**
- * \@docs-private
- */
- MatProgressBarBase = /** @class */ (function () {
- function MatProgressBarBase(_elementRef) {
- this._elementRef = _elementRef;
- }
- return MatProgressBarBase;
- }());
- /** @type {?} */
- var _MatProgressBarMixinBase = mixinColor(MatProgressBarBase, 'primary');
- /**
- * Injection token used to provide the current location to `MatProgressBar`.
- * Used to handle server-side rendering and to stub out during unit tests.
- * \@docs-private
- * @type {?}
- */
- var MAT_PROGRESS_BAR_LOCATION = new core.InjectionToken('mat-progress-bar-location', { providedIn: 'root', factory: MAT_PROGRESS_BAR_LOCATION_FACTORY });
- /**
- * \@docs-private
- * @return {?}
- */
- function MAT_PROGRESS_BAR_LOCATION_FACTORY() {
- /** @type {?} */
- var _document = core.inject(common.DOCUMENT);
- /** @type {?} */
- var _location = _document ? _document.location : null;
- return {
- // Note that this needs to be a function, rather than a property, because Angular
- // will only resolve it once, but we want the current path on each call.
- getPathname: (/**
- * @return {?}
- */
- function () { return _location ? (_location.pathname + _location.search) : ''; })
- };
- }
- /**
- * Counter used to generate unique IDs for progress bars.
- * @type {?}
- */
- var progressbarId = 0;
- /**
- * `<mat-progress-bar>` component.
- */
- var MatProgressBar = /** @class */ (function (_super) {
- __extends(MatProgressBar, _super);
- function MatProgressBar(_elementRef, _ngZone, _animationMode,
- /**
- * @deprecated `location` parameter to be made required.
- * @breaking-change 8.0.0
- */
- location) {
- var _this = _super.call(this, _elementRef) || this;
- _this._elementRef = _elementRef;
- _this._ngZone = _ngZone;
- _this._animationMode = _animationMode;
- /**
- * Flag that indicates whether NoopAnimations mode is set to true.
- */
- _this._isNoopAnimation = false;
- _this._value = 0;
- _this._bufferValue = 0;
- /**
- * Event emitted when animation of the primary progress bar completes. This event will not
- * be emitted when animations are disabled, nor will it be emitted for modes with continuous
- * animations (indeterminate and query).
- */
- _this.animationEnd = new core.EventEmitter();
- /**
- * Reference to animation end subscription to be unsubscribed on destroy.
- */
- _this._animationEndSubscription = rxjs.Subscription.EMPTY;
- /**
- * Mode of the progress bar.
- *
- * Input must be one of these values: determinate, indeterminate, buffer, query, defaults to
- * 'determinate'.
- * Mirrored to mode attribute.
- */
- _this.mode = 'determinate';
- /**
- * ID of the progress bar.
- */
- _this.progressbarId = "mat-progress-bar-" + progressbarId++;
- // We need to prefix the SVG reference with the current path, otherwise they won't work
- // in Safari if the page has a `<base>` tag. Note that we need quotes inside the `url()`,
- // because named route URLs can contain parentheses (see #12338). Also we don't use since
- // we can't tell the difference between whether
- // the consumer is using the hash location strategy or not, because `Location` normalizes
- // both `/#/foo/bar` and `/foo/bar` to the same thing.
- /** @type {?} */
- var path = location ? location.getPathname().split('#')[0] : '';
- _this._rectangleFillValue = "url('" + path + "#" + _this.progressbarId + "')";
- _this._isNoopAnimation = _animationMode === 'NoopAnimations';
- return _this;
- }
- Object.defineProperty(MatProgressBar.prototype, "value", {
- /** Value of the progress bar. Defaults to zero. Mirrored to aria-valuenow. */
- get: /**
- * Value of the progress bar. Defaults to zero. Mirrored to aria-valuenow.
- * @return {?}
- */
- function () { return this._value; },
- set: /**
- * @param {?} v
- * @return {?}
- */
- function (v) {
- this._value = clamp(v || 0);
- // When noop animation is set to true, trigger animationEnd directly.
- if (this._isNoopAnimation) {
- this._emitAnimationEnd();
- }
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatProgressBar.prototype, "bufferValue", {
- /** Buffer value of the progress bar. Defaults to zero. */
- get: /**
- * Buffer value of the progress bar. Defaults to zero.
- * @return {?}
- */
- function () { return this._bufferValue; },
- set: /**
- * @param {?} v
- * @return {?}
- */
- function (v) { this._bufferValue = clamp(v || 0); },
- enumerable: true,
- configurable: true
- });
- /** Gets the current transform value for the progress bar's primary indicator. */
- /**
- * Gets the current transform value for the progress bar's primary indicator.
- * @return {?}
- */
- MatProgressBar.prototype._primaryTransform = /**
- * Gets the current transform value for the progress bar's primary indicator.
- * @return {?}
- */
- function () {
- /** @type {?} */
- var scale = this.value / 100;
- return { transform: "scaleX(" + scale + ")" };
- };
- /**
- * Gets the current transform value for the progress bar's buffer indicator. Only used if the
- * progress mode is set to buffer, otherwise returns an undefined, causing no transformation.
- */
- /**
- * Gets the current transform value for the progress bar's buffer indicator. Only used if the
- * progress mode is set to buffer, otherwise returns an undefined, causing no transformation.
- * @return {?}
- */
- MatProgressBar.prototype._bufferTransform = /**
- * Gets the current transform value for the progress bar's buffer indicator. Only used if the
- * progress mode is set to buffer, otherwise returns an undefined, causing no transformation.
- * @return {?}
- */
- function () {
- if (this.mode === 'buffer') {
- /** @type {?} */
- var scale = this.bufferValue / 100;
- return { transform: "scaleX(" + scale + ")" };
- }
- return undefined;
- };
- /**
- * @return {?}
- */
- MatProgressBar.prototype.ngAfterViewInit = /**
- * @return {?}
- */
- function () {
- var _this = this;
- if (!this._isNoopAnimation) {
- // Run outside angular so change detection didn't get triggered on every transition end
- // instead only on the animation that we care about (primary value bar's transitionend)
- this._ngZone.runOutsideAngular(((/**
- * @return {?}
- */
- function () {
- /** @type {?} */
- var element = _this._primaryValueBar.nativeElement;
- _this._animationEndSubscription =
- ((/** @type {?} */ (rxjs.fromEvent(element, 'transitionend'))))
- .pipe(operators.filter(((/**
- * @param {?} e
- * @return {?}
- */
- function (e) { return e.target === element; }))))
- .subscribe((/**
- * @return {?}
- */
- function () { return _this._ngZone.run((/**
- * @return {?}
- */
- function () { return _this._emitAnimationEnd(); })); }));
- })));
- }
- };
- /**
- * @return {?}
- */
- MatProgressBar.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- this._animationEndSubscription.unsubscribe();
- };
- /** Emit an animationEnd event if in determinate or buffer mode. */
- /**
- * Emit an animationEnd event if in determinate or buffer mode.
- * @private
- * @return {?}
- */
- MatProgressBar.prototype._emitAnimationEnd = /**
- * Emit an animationEnd event if in determinate or buffer mode.
- * @private
- * @return {?}
- */
- function () {
- if (this.mode === 'determinate' || this.mode === 'buffer') {
- this.animationEnd.next({ value: this.value });
- }
- };
- MatProgressBar.decorators = [
- { type: core.Component, args: [{selector: 'mat-progress-bar',
- exportAs: 'matProgressBar',
- host: {
- 'role': 'progressbar',
- 'aria-valuemin': '0',
- 'aria-valuemax': '100',
- '[attr.aria-valuenow]': '(mode === "indeterminate" || mode === "query") ? null : value',
- '[attr.mode]': 'mode',
- 'class': 'mat-progress-bar',
- '[class._mat-animation-noopable]': '_isNoopAnimation',
- },
- inputs: ['color'],
- 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>",
- 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)}}"],
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- encapsulation: core.ViewEncapsulation.None,
- },] },
- ];
- /** @nocollapse */
- MatProgressBar.ctorParameters = function () { return [
- { type: core.ElementRef },
- { type: core.NgZone },
- { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] },
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_PROGRESS_BAR_LOCATION,] }] }
- ]; };
- MatProgressBar.propDecorators = {
- value: [{ type: core.Input }],
- bufferValue: [{ type: core.Input }],
- _primaryValueBar: [{ type: core.ViewChild, args: ['primaryValueBar', { static: false },] }],
- animationEnd: [{ type: core.Output }],
- mode: [{ type: core.Input }]
- };
- return MatProgressBar;
- }(_MatProgressBarMixinBase));
- /**
- * Clamps a value to be between two numbers, by default 0 and 100.
- * @param {?} v
- * @param {?=} min
- * @param {?=} max
- * @return {?}
- */
- function clamp(v, min, max) {
- if (min === void 0) { min = 0; }
- if (max === void 0) { max = 100; }
- return Math.max(min, Math.min(max, v));
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var MatProgressBarModule = /** @class */ (function () {
- function MatProgressBarModule() {
- }
- MatProgressBarModule.decorators = [
- { type: core.NgModule, args: [{
- imports: [common.CommonModule, MatCommonModule],
- exports: [MatProgressBar, MatCommonModule],
- declarations: [MatProgressBar],
- },] },
- ];
- return MatProgressBarModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Base reference size of the spinner.
- * \@docs-private
- * @type {?}
- */
- var BASE_SIZE = 100;
- /**
- * Base reference stroke width of the spinner.
- * \@docs-private
- * @type {?}
- */
- var BASE_STROKE_WIDTH = 10;
- // Boilerplate for applying mixins to MatProgressSpinner.
- /**
- * \@docs-private
- */
- var
- // Boilerplate for applying mixins to MatProgressSpinner.
- /**
- * \@docs-private
- */
- MatProgressSpinnerBase = /** @class */ (function () {
- function MatProgressSpinnerBase(_elementRef) {
- this._elementRef = _elementRef;
- }
- return MatProgressSpinnerBase;
- }());
- /** @type {?} */
- var _MatProgressSpinnerMixinBase = mixinColor(MatProgressSpinnerBase, 'primary');
- /**
- * Injection token to be used to override the default options for `mat-progress-spinner`.
- * @type {?}
- */
- var MAT_PROGRESS_SPINNER_DEFAULT_OPTIONS = new core.InjectionToken('mat-progress-spinner-default-options', {
- providedIn: 'root',
- factory: MAT_PROGRESS_SPINNER_DEFAULT_OPTIONS_FACTORY,
- });
- /**
- * \@docs-private
- * @return {?}
- */
- function MAT_PROGRESS_SPINNER_DEFAULT_OPTIONS_FACTORY() {
- return { diameter: BASE_SIZE };
- }
- // .0001 percentage difference is necessary in order to avoid unwanted animation frames
- // for example because the animation duration is 4 seconds, .1% accounts to 4ms
- // which are enough to see the flicker described in
- // https://github.com/angular/components/issues/8984
- /** @type {?} */
- 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";
- /**
- * `<mat-progress-spinner>` component.
- */
- var MatProgressSpinner = /** @class */ (function (_super) {
- __extends(MatProgressSpinner, _super);
- function MatProgressSpinner(_elementRef, platform$$1, _document, animationMode, defaults) {
- var _this = _super.call(this, _elementRef) || this;
- _this._elementRef = _elementRef;
- _this._document = _document;
- _this._diameter = BASE_SIZE;
- _this._value = 0;
- _this._fallbackAnimation = false;
- /**
- * Mode of the progress circle
- */
- _this.mode = 'determinate';
- /** @type {?} */
- var trackedDiameters = MatProgressSpinner._diameters;
- // The base size is already inserted via the component's structural styles. We still
- // need to track it so we don't end up adding the same styles again.
- if (!trackedDiameters.has(_document.head)) {
- trackedDiameters.set(_document.head, new Set([BASE_SIZE]));
- }
- _this._styleRoot = _getShadowRoot(_elementRef.nativeElement, _document) || _document.head;
- _this._fallbackAnimation = platform$$1.EDGE || platform$$1.TRIDENT;
- _this._noopAnimations = animationMode === 'NoopAnimations' &&
- (!!defaults && !defaults._forceAnimations);
- if (defaults) {
- if (defaults.diameter) {
- _this.diameter = defaults.diameter;
- }
- if (defaults.strokeWidth) {
- _this.strokeWidth = defaults.strokeWidth;
- }
- }
- // On IE and Edge, we can't animate the `stroke-dashoffset`
- // reliably so we fall back to a non-spec animation.
- /** @type {?} */
- var animationClass = "mat-progress-spinner-indeterminate" + (_this._fallbackAnimation ? '-fallback' : '') + "-animation";
- _elementRef.nativeElement.classList.add(animationClass);
- return _this;
- }
- Object.defineProperty(MatProgressSpinner.prototype, "diameter", {
- /** The diameter of the progress spinner (will set width and height of svg). */
- get: /**
- * The diameter of the progress spinner (will set width and height of svg).
- * @return {?}
- */
- function () { return this._diameter; },
- set: /**
- * @param {?} size
- * @return {?}
- */
- function (size) {
- this._diameter = coercion.coerceNumberProperty(size);
- if (!this._fallbackAnimation) {
- /** @type {?} */
- var trackedDiameters = MatProgressSpinner._diameters;
- /** @type {?} */
- var diametersForElement = trackedDiameters.get(this._styleRoot);
- if (!diametersForElement || !diametersForElement.has(this._diameter)) {
- this._attachStyleNode();
- }
- }
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatProgressSpinner.prototype, "strokeWidth", {
- /** Stroke width of the progress spinner. */
- get: /**
- * Stroke width of the progress spinner.
- * @return {?}
- */
- function () {
- return this._strokeWidth || this.diameter / 10;
- },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._strokeWidth = coercion.coerceNumberProperty(value);
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatProgressSpinner.prototype, "value", {
- /** Value of the progress circle. */
- get: /**
- * Value of the progress circle.
- * @return {?}
- */
- function () {
- return this.mode === 'determinate' ? this._value : 0;
- },
- set: /**
- * @param {?} newValue
- * @return {?}
- */
- function (newValue) {
- this._value = Math.max(0, Math.min(100, coercion.coerceNumberProperty(newValue)));
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatProgressSpinner.prototype, "_circleRadius", {
- /** The radius of the spinner, adjusted for stroke width. */
- get: /**
- * The radius of the spinner, adjusted for stroke width.
- * @return {?}
- */
- function () {
- return (this.diameter - BASE_STROKE_WIDTH) / 2;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatProgressSpinner.prototype, "_viewBox", {
- /** The view box of the spinner's svg element. */
- get: /**
- * The view box of the spinner's svg element.
- * @return {?}
- */
- function () {
- /** @type {?} */
- var viewBox = this._circleRadius * 2 + this.strokeWidth;
- return "0 0 " + viewBox + " " + viewBox;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatProgressSpinner.prototype, "_strokeCircumference", {
- /** The stroke circumference of the svg circle. */
- get: /**
- * The stroke circumference of the svg circle.
- * @return {?}
- */
- function () {
- return 2 * Math.PI * this._circleRadius;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatProgressSpinner.prototype, "_strokeDashOffset", {
- /** The dash offset of the svg circle. */
- get: /**
- * The dash offset of the svg circle.
- * @return {?}
- */
- function () {
- if (this.mode === 'determinate') {
- return this._strokeCircumference * (100 - this._value) / 100;
- }
- // In fallback mode set the circle to 80% and rotate it with CSS.
- if (this._fallbackAnimation && this.mode === 'indeterminate') {
- return this._strokeCircumference * 0.2;
- }
- return null;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatProgressSpinner.prototype, "_circleStrokeWidth", {
- /** Stroke width of the circle in percent. */
- get: /**
- * Stroke width of the circle in percent.
- * @return {?}
- */
- function () {
- return this.strokeWidth / this.diameter * 100;
- },
- enumerable: true,
- configurable: true
- });
- /** Dynamically generates a style tag containing the correct animation for this diameter. */
- /**
- * Dynamically generates a style tag containing the correct animation for this diameter.
- * @private
- * @return {?}
- */
- MatProgressSpinner.prototype._attachStyleNode = /**
- * Dynamically generates a style tag containing the correct animation for this diameter.
- * @private
- * @return {?}
- */
- function () {
- /** @type {?} */
- var styleTag = this._document.createElement('style');
- /** @type {?} */
- var styleRoot = this._styleRoot;
- /** @type {?} */
- var currentDiameter = this._diameter;
- /** @type {?} */
- var diameters = MatProgressSpinner._diameters;
- /** @type {?} */
- var diametersForElement = diameters.get(styleRoot);
- styleTag.setAttribute('mat-spinner-animation', currentDiameter + '');
- styleTag.textContent = this._getAnimationText();
- styleRoot.appendChild(styleTag);
- if (!diametersForElement) {
- diametersForElement = new Set();
- diameters.set(styleRoot, diametersForElement);
- }
- diametersForElement.add(currentDiameter);
- };
- /** Generates animation styles adjusted for the spinner's diameter. */
- /**
- * Generates animation styles adjusted for the spinner's diameter.
- * @private
- * @return {?}
- */
- MatProgressSpinner.prototype._getAnimationText = /**
- * Generates animation styles adjusted for the spinner's diameter.
- * @private
- * @return {?}
- */
- function () {
- return INDETERMINATE_ANIMATION_TEMPLATE
- // Animation should begin at 5% and end at 80%
- .replace(/START_VALUE/g, "" + 0.95 * this._strokeCircumference)
- .replace(/END_VALUE/g, "" + 0.2 * this._strokeCircumference)
- .replace(/DIAMETER/g, "" + this.diameter);
- };
- /**
- * Tracks diameters of existing instances to de-dupe generated styles (default d = 100).
- * We need to keep track of which elements the diameters were attached to, because for
- * elements in the Shadow DOM the style tags are attached to the shadow root, rather
- * than the document head.
- */
- MatProgressSpinner._diameters = new WeakMap();
- MatProgressSpinner.decorators = [
- { type: core.Component, args: [{selector: 'mat-progress-spinner',
- exportAs: 'matProgressSpinner',
- host: {
- 'role': 'progressbar',
- 'class': 'mat-progress-spinner',
- '[class._mat-animation-noopable]': "_noopAnimations",
- '[style.width.px]': 'diameter',
- '[style.height.px]': 'diameter',
- '[attr.aria-valuemin]': 'mode === "determinate" ? 0 : null',
- '[attr.aria-valuemax]': 'mode === "determinate" ? 100 : null',
- '[attr.aria-valuenow]': 'mode === "determinate" ? value : null',
- '[attr.mode]': 'mode',
- },
- inputs: ['color'],
- 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>",
- 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)}}"],
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- encapsulation: core.ViewEncapsulation.None,
- },] },
- ];
- /** @nocollapse */
- MatProgressSpinner.ctorParameters = function () { return [
- { type: core.ElementRef },
- { type: platform.Platform },
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [common.DOCUMENT,] }] },
- { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] },
- { type: undefined, decorators: [{ type: core.Inject, args: [MAT_PROGRESS_SPINNER_DEFAULT_OPTIONS,] }] }
- ]; };
- MatProgressSpinner.propDecorators = {
- diameter: [{ type: core.Input }],
- strokeWidth: [{ type: core.Input }],
- mode: [{ type: core.Input }],
- value: [{ type: core.Input }]
- };
- return MatProgressSpinner;
- }(_MatProgressSpinnerMixinBase));
- /**
- * `<mat-spinner>` component.
- *
- * This is a component definition to be used as a convenience reference to create an
- * indeterminate `<mat-progress-spinner>` instance.
- */
- var MatSpinner = /** @class */ (function (_super) {
- __extends(MatSpinner, _super);
- function MatSpinner(elementRef, platform$$1, document, animationMode, defaults) {
- var _this = _super.call(this, elementRef, platform$$1, document, animationMode, defaults) || this;
- _this.mode = 'indeterminate';
- return _this;
- }
- MatSpinner.decorators = [
- { type: core.Component, args: [{selector: 'mat-spinner',
- host: {
- 'role': 'progressbar',
- 'mode': 'indeterminate',
- 'class': 'mat-spinner mat-progress-spinner',
- '[class._mat-animation-noopable]': "_noopAnimations",
- '[style.width.px]': 'diameter',
- '[style.height.px]': 'diameter',
- },
- inputs: ['color'],
- 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>",
- 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)}}"],
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- encapsulation: core.ViewEncapsulation.None,
- },] },
- ];
- /** @nocollapse */
- MatSpinner.ctorParameters = function () { return [
- { type: core.ElementRef },
- { type: platform.Platform },
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [common.DOCUMENT,] }] },
- { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] },
- { type: undefined, decorators: [{ type: core.Inject, args: [MAT_PROGRESS_SPINNER_DEFAULT_OPTIONS,] }] }
- ]; };
- return MatSpinner;
- }(MatProgressSpinner));
- /**
- * Gets the shadow root of an element, if supported and the element is inside the Shadow DOM.
- * @param {?} element
- * @param {?} _document
- * @return {?}
- */
- function _getShadowRoot(element, _document) {
- // TODO(crisbeto): see whether we should move this into the CDK
- // feature detection utilities once #15616 gets merged in.
- if (typeof window !== 'undefined') {
- /** @type {?} */
- var head = _document.head;
- // Check whether the browser supports Shadow DOM.
- if (head && (((/** @type {?} */ (head))).createShadowRoot || head.attachShadow)) {
- /** @type {?} */
- var rootNode = element.getRootNode ? element.getRootNode() : null;
- // We need to take the `ShadowRoot` off of `window`, because the built-in types are
- // incorrect. See https://github.com/Microsoft/TypeScript/issues/27929.
- if (rootNode instanceof ((/** @type {?} */ (window))).ShadowRoot) {
- return rootNode;
- }
- }
- }
- return null;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var MatProgressSpinnerModule = /** @class */ (function () {
- function MatProgressSpinnerModule() {
- }
- MatProgressSpinnerModule.decorators = [
- { type: core.NgModule, args: [{
- imports: [MatCommonModule, common.CommonModule],
- exports: [
- MatProgressSpinner,
- MatSpinner,
- MatCommonModule
- ],
- declarations: [
- MatProgressSpinner,
- MatSpinner
- ],
- },] },
- ];
- return MatProgressSpinnerModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /** @type {?} */
- var MAT_RADIO_DEFAULT_OPTIONS = new core.InjectionToken('mat-radio-default-options', {
- providedIn: 'root',
- factory: MAT_RADIO_DEFAULT_OPTIONS_FACTORY
- });
- /**
- * @return {?}
- */
- function MAT_RADIO_DEFAULT_OPTIONS_FACTORY() {
- return {
- color: 'accent'
- };
- }
- // Increasing integer for generating unique ids for radio components.
- /** @type {?} */
- var nextUniqueId$7 = 0;
- /**
- * Provider Expression that allows mat-radio-group to register as a ControlValueAccessor. This
- * allows it to support [(ngModel)] and ngControl.
- * \@docs-private
- * @type {?}
- */
- var MAT_RADIO_GROUP_CONTROL_VALUE_ACCESSOR = {
- provide: forms.NG_VALUE_ACCESSOR,
- useExisting: core.forwardRef((/**
- * @return {?}
- */
- function () { return MatRadioGroup; })),
- multi: true
- };
- /**
- * Change event object emitted by MatRadio and MatRadioGroup.
- */
- var /**
- * Change event object emitted by MatRadio and MatRadioGroup.
- */
- MatRadioChange = /** @class */ (function () {
- function MatRadioChange(source, value) {
- this.source = source;
- this.value = value;
- }
- return MatRadioChange;
- }());
- /**
- * A group of radio buttons. May contain one or more `<mat-radio-button>` elements.
- */
- var MatRadioGroup = /** @class */ (function () {
- function MatRadioGroup(_changeDetector) {
- this._changeDetector = _changeDetector;
- /**
- * Selected value for the radio group.
- */
- this._value = null;
- /**
- * The HTML name attribute applied to radio buttons in this group.
- */
- this._name = "mat-radio-group-" + nextUniqueId$7++;
- /**
- * The currently selected radio button. Should match value.
- */
- this._selected = null;
- /**
- * Whether the `value` has been set to its initial value.
- */
- this._isInitialized = false;
- /**
- * Whether the labels should appear after or before the radio-buttons. Defaults to 'after'
- */
- this._labelPosition = 'after';
- /**
- * Whether the radio group is disabled.
- */
- this._disabled = false;
- /**
- * Whether the radio group is required.
- */
- this._required = false;
- /**
- * The method to be called in order to update ngModel
- */
- this._controlValueAccessorChangeFn = (/**
- * @return {?}
- */
- function () { });
- /**
- * onTouch function registered via registerOnTouch (ControlValueAccessor).
- * \@docs-private
- */
- this.onTouched = (/**
- * @return {?}
- */
- function () { });
- /**
- * Event emitted when the group value changes.
- * Change events are only emitted when the value changes due to user interaction with
- * a radio button (the same behavior as `<input type-"radio">`).
- */
- this.change = new core.EventEmitter();
- }
- Object.defineProperty(MatRadioGroup.prototype, "name", {
- /** Name of the radio button group. All radio buttons inside this group will use this name. */
- get: /**
- * Name of the radio button group. All radio buttons inside this group will use this name.
- * @return {?}
- */
- function () { return this._name; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._name = value;
- this._updateRadioButtonNames();
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatRadioGroup.prototype, "labelPosition", {
- /** Whether the labels should appear after or before the radio-buttons. Defaults to 'after' */
- get: /**
- * Whether the labels should appear after or before the radio-buttons. Defaults to 'after'
- * @return {?}
- */
- function () {
- return this._labelPosition;
- },
- set: /**
- * @param {?} v
- * @return {?}
- */
- function (v) {
- this._labelPosition = v === 'before' ? 'before' : 'after';
- this._markRadiosForCheck();
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatRadioGroup.prototype, "value", {
- /**
- * Value for the radio-group. Should equal the value of the selected radio button if there is
- * a corresponding radio button with a matching value. If there is not such a corresponding
- * radio button, this value persists to be applied in case a new radio button is added with a
- * matching value.
- */
- get: /**
- * Value for the radio-group. Should equal the value of the selected radio button if there is
- * a corresponding radio button with a matching value. If there is not such a corresponding
- * radio button, this value persists to be applied in case a new radio button is added with a
- * matching value.
- * @return {?}
- */
- function () { return this._value; },
- set: /**
- * @param {?} newValue
- * @return {?}
- */
- function (newValue) {
- if (this._value !== newValue) {
- // Set this before proceeding to ensure no circular loop occurs with selection.
- this._value = newValue;
- this._updateSelectedRadioFromValue();
- this._checkSelectedRadioButton();
- }
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- MatRadioGroup.prototype._checkSelectedRadioButton = /**
- * @return {?}
- */
- function () {
- if (this._selected && !this._selected.checked) {
- this._selected.checked = true;
- }
- };
- Object.defineProperty(MatRadioGroup.prototype, "selected", {
- /**
- * The currently selected radio button. If set to a new radio button, the radio group value
- * will be updated to match the new selected button.
- */
- get: /**
- * The currently selected radio button. If set to a new radio button, the radio group value
- * will be updated to match the new selected button.
- * @return {?}
- */
- function () { return this._selected; },
- set: /**
- * @param {?} selected
- * @return {?}
- */
- function (selected) {
- this._selected = selected;
- this.value = selected ? selected.value : null;
- this._checkSelectedRadioButton();
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatRadioGroup.prototype, "disabled", {
- /** Whether the radio group is disabled */
- get: /**
- * Whether the radio group is disabled
- * @return {?}
- */
- function () { return this._disabled; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._disabled = coercion.coerceBooleanProperty(value);
- this._markRadiosForCheck();
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatRadioGroup.prototype, "required", {
- /** Whether the radio group is required */
- get: /**
- * Whether the radio group is required
- * @return {?}
- */
- function () { return this._required; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._required = coercion.coerceBooleanProperty(value);
- this._markRadiosForCheck();
- },
- enumerable: true,
- configurable: true
- });
- /**
- * Initialize properties once content children are available.
- * This allows us to propagate relevant attributes to associated buttons.
- */
- /**
- * Initialize properties once content children are available.
- * This allows us to propagate relevant attributes to associated buttons.
- * @return {?}
- */
- MatRadioGroup.prototype.ngAfterContentInit = /**
- * Initialize properties once content children are available.
- * This allows us to propagate relevant attributes to associated buttons.
- * @return {?}
- */
- function () {
- // Mark this component as initialized in AfterContentInit because the initial value can
- // possibly be set by NgModel on MatRadioGroup, and it is possible that the OnInit of the
- // NgModel occurs *after* the OnInit of the MatRadioGroup.
- this._isInitialized = true;
- };
- /**
- * Mark this group as being "touched" (for ngModel). Meant to be called by the contained
- * radio buttons upon their blur.
- */
- /**
- * Mark this group as being "touched" (for ngModel). Meant to be called by the contained
- * radio buttons upon their blur.
- * @return {?}
- */
- MatRadioGroup.prototype._touch = /**
- * Mark this group as being "touched" (for ngModel). Meant to be called by the contained
- * radio buttons upon their blur.
- * @return {?}
- */
- function () {
- if (this.onTouched) {
- this.onTouched();
- }
- };
- /**
- * @private
- * @return {?}
- */
- MatRadioGroup.prototype._updateRadioButtonNames = /**
- * @private
- * @return {?}
- */
- function () {
- var _this = this;
- if (this._radios) {
- this._radios.forEach((/**
- * @param {?} radio
- * @return {?}
- */
- function (radio) {
- radio.name = _this.name;
- radio._markForCheck();
- }));
- }
- };
- /** Updates the `selected` radio button from the internal _value state. */
- /**
- * Updates the `selected` radio button from the internal _value state.
- * @private
- * @return {?}
- */
- MatRadioGroup.prototype._updateSelectedRadioFromValue = /**
- * Updates the `selected` radio button from the internal _value state.
- * @private
- * @return {?}
- */
- function () {
- var _this = this;
- // If the value already matches the selected radio, do nothing.
- /** @type {?} */
- var isAlreadySelected = this._selected !== null && this._selected.value === this._value;
- if (this._radios && !isAlreadySelected) {
- this._selected = null;
- this._radios.forEach((/**
- * @param {?} radio
- * @return {?}
- */
- function (radio) {
- radio.checked = _this.value === radio.value;
- if (radio.checked) {
- _this._selected = radio;
- }
- }));
- }
- };
- /** Dispatch change event with current selection and group value. */
- /**
- * Dispatch change event with current selection and group value.
- * @return {?}
- */
- MatRadioGroup.prototype._emitChangeEvent = /**
- * Dispatch change event with current selection and group value.
- * @return {?}
- */
- function () {
- if (this._isInitialized) {
- this.change.emit(new MatRadioChange((/** @type {?} */ (this._selected)), this._value));
- }
- };
- /**
- * @return {?}
- */
- MatRadioGroup.prototype._markRadiosForCheck = /**
- * @return {?}
- */
- function () {
- if (this._radios) {
- this._radios.forEach((/**
- * @param {?} radio
- * @return {?}
- */
- function (radio) { return radio._markForCheck(); }));
- }
- };
- /**
- * Sets the model value. Implemented as part of ControlValueAccessor.
- * @param value
- */
- /**
- * Sets the model value. Implemented as part of ControlValueAccessor.
- * @param {?} value
- * @return {?}
- */
- MatRadioGroup.prototype.writeValue = /**
- * Sets the model value. Implemented as part of ControlValueAccessor.
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this.value = value;
- this._changeDetector.markForCheck();
- };
- /**
- * Registers a callback to be triggered when the model value changes.
- * Implemented as part of ControlValueAccessor.
- * @param fn Callback to be registered.
- */
- /**
- * Registers a callback to be triggered when the model value changes.
- * Implemented as part of ControlValueAccessor.
- * @param {?} fn Callback to be registered.
- * @return {?}
- */
- MatRadioGroup.prototype.registerOnChange = /**
- * Registers a callback to be triggered when the model value changes.
- * Implemented as part of ControlValueAccessor.
- * @param {?} fn Callback to be registered.
- * @return {?}
- */
- function (fn) {
- this._controlValueAccessorChangeFn = fn;
- };
- /**
- * Registers a callback to be triggered when the control is touched.
- * Implemented as part of ControlValueAccessor.
- * @param fn Callback to be registered.
- */
- /**
- * Registers a callback to be triggered when the control is touched.
- * Implemented as part of ControlValueAccessor.
- * @param {?} fn Callback to be registered.
- * @return {?}
- */
- MatRadioGroup.prototype.registerOnTouched = /**
- * Registers a callback to be triggered when the control is touched.
- * Implemented as part of ControlValueAccessor.
- * @param {?} fn Callback to be registered.
- * @return {?}
- */
- function (fn) {
- this.onTouched = fn;
- };
- /**
- * Sets the disabled state of the control. Implemented as a part of ControlValueAccessor.
- * @param isDisabled Whether the control should be disabled.
- */
- /**
- * Sets the disabled state of the control. Implemented as a part of ControlValueAccessor.
- * @param {?} isDisabled Whether the control should be disabled.
- * @return {?}
- */
- MatRadioGroup.prototype.setDisabledState = /**
- * Sets the disabled state of the control. Implemented as a part of ControlValueAccessor.
- * @param {?} isDisabled Whether the control should be disabled.
- * @return {?}
- */
- function (isDisabled) {
- this.disabled = isDisabled;
- this._changeDetector.markForCheck();
- };
- MatRadioGroup.decorators = [
- { type: core.Directive, args: [{
- selector: 'mat-radio-group',
- exportAs: 'matRadioGroup',
- providers: [MAT_RADIO_GROUP_CONTROL_VALUE_ACCESSOR],
- host: {
- 'role': 'radiogroup',
- 'class': 'mat-radio-group',
- },
- },] },
- ];
- /** @nocollapse */
- MatRadioGroup.ctorParameters = function () { return [
- { type: core.ChangeDetectorRef }
- ]; };
- MatRadioGroup.propDecorators = {
- change: [{ type: core.Output }],
- _radios: [{ type: core.ContentChildren, args: [core.forwardRef((/**
- * @return {?}
- */
- function () { return MatRadioButton; })), { descendants: true },] }],
- color: [{ type: core.Input }],
- name: [{ type: core.Input }],
- labelPosition: [{ type: core.Input }],
- value: [{ type: core.Input }],
- selected: [{ type: core.Input }],
- disabled: [{ type: core.Input }],
- required: [{ type: core.Input }]
- };
- return MatRadioGroup;
- }());
- // Boilerplate for applying mixins to MatRadioButton.
- /**
- * \@docs-private
- */
- var
- // Boilerplate for applying mixins to MatRadioButton.
- /**
- * \@docs-private
- */
- MatRadioButtonBase = /** @class */ (function () {
- function MatRadioButtonBase(_elementRef) {
- this._elementRef = _elementRef;
- }
- return MatRadioButtonBase;
- }());
- // As per Material design specifications the selection control radio should use the accent color
- // palette by default. https://material.io/guidelines/components/selection-controls.html
- /** @type {?} */
- var _MatRadioButtonMixinBase = mixinDisableRipple(mixinTabIndex(MatRadioButtonBase));
- /**
- * A Material design radio-button. Typically placed inside of `<mat-radio-group>` elements.
- */
- var MatRadioButton = /** @class */ (function (_super) {
- __extends(MatRadioButton, _super);
- function MatRadioButton(radioGroup, elementRef, _changeDetector, _focusMonitor, _radioDispatcher, _animationMode, _providerOverride) {
- var _this = _super.call(this, elementRef) || this;
- _this._changeDetector = _changeDetector;
- _this._focusMonitor = _focusMonitor;
- _this._radioDispatcher = _radioDispatcher;
- _this._animationMode = _animationMode;
- _this._providerOverride = _providerOverride;
- _this._uniqueId = "mat-radio-" + ++nextUniqueId$7;
- /**
- * The unique ID for the radio button.
- */
- _this.id = _this._uniqueId;
- /**
- * Event emitted when the checked state of this radio button changes.
- * Change events are only emitted when the value changes due to user interaction with
- * the radio button (the same behavior as `<input type-"radio">`).
- */
- _this.change = new core.EventEmitter();
- /**
- * Whether this radio is checked.
- */
- _this._checked = false;
- /**
- * Value assigned to this radio.
- */
- _this._value = null;
- /**
- * Unregister function for _radioDispatcher
- */
- _this._removeUniqueSelectionListener = (/**
- * @return {?}
- */
- function () { });
- // Assertions. Ideally these should be stripped out by the compiler.
- // TODO(jelbourn): Assert that there's no name binding AND a parent radio group.
- _this.radioGroup = radioGroup;
- _this._removeUniqueSelectionListener =
- _radioDispatcher.listen((/**
- * @param {?} id
- * @param {?} name
- * @return {?}
- */
- function (id, name) {
- if (id !== _this.id && name === _this.name) {
- _this.checked = false;
- }
- }));
- return _this;
- }
- Object.defineProperty(MatRadioButton.prototype, "checked", {
- /** Whether this radio button is checked. */
- get: /**
- * Whether this radio button is checked.
- * @return {?}
- */
- function () { return this._checked; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- /** @type {?} */
- var newCheckedState = coercion.coerceBooleanProperty(value);
- if (this._checked !== newCheckedState) {
- this._checked = newCheckedState;
- if (newCheckedState && this.radioGroup && this.radioGroup.value !== this.value) {
- this.radioGroup.selected = this;
- }
- else if (!newCheckedState && this.radioGroup && this.radioGroup.value === this.value) {
- // When unchecking the selected radio button, update the selected radio
- // property on the group.
- this.radioGroup.selected = null;
- }
- if (newCheckedState) {
- // Notify all radio buttons with the same name to un-check.
- this._radioDispatcher.notify(this.id, this.name);
- }
- this._changeDetector.markForCheck();
- }
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatRadioButton.prototype, "value", {
- /** The value of this radio button. */
- get: /**
- * The value of this radio button.
- * @return {?}
- */
- function () { return this._value; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- if (this._value !== value) {
- this._value = value;
- if (this.radioGroup !== null) {
- if (!this.checked) {
- // Update checked when the value changed to match the radio group's value
- this.checked = this.radioGroup.value === value;
- }
- if (this.checked) {
- this.radioGroup.selected = this;
- }
- }
- }
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatRadioButton.prototype, "labelPosition", {
- /** Whether the label should appear after or before the radio button. Defaults to 'after' */
- get: /**
- * Whether the label should appear after or before the radio button. Defaults to 'after'
- * @return {?}
- */
- function () {
- return this._labelPosition || (this.radioGroup && this.radioGroup.labelPosition) || 'after';
- },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._labelPosition = value;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatRadioButton.prototype, "disabled", {
- /** Whether the radio button is disabled. */
- get: /**
- * Whether the radio button is disabled.
- * @return {?}
- */
- function () {
- return this._disabled || (this.radioGroup !== null && this.radioGroup.disabled);
- },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- /** @type {?} */
- var newDisabledState = coercion.coerceBooleanProperty(value);
- if (this._disabled !== newDisabledState) {
- this._disabled = newDisabledState;
- this._changeDetector.markForCheck();
- }
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatRadioButton.prototype, "required", {
- /** Whether the radio button is required. */
- get: /**
- * Whether the radio button is required.
- * @return {?}
- */
- function () {
- return this._required || (this.radioGroup && this.radioGroup.required);
- },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._required = coercion.coerceBooleanProperty(value);
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatRadioButton.prototype, "color", {
- /** Theme color of the radio button. */
- get: /**
- * Theme color of the radio button.
- * @return {?}
- */
- function () {
- return this._color ||
- (this.radioGroup && this.radioGroup.color) ||
- this._providerOverride && this._providerOverride.color || 'accent';
- },
- set: /**
- * @param {?} newValue
- * @return {?}
- */
- function (newValue) { this._color = newValue; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatRadioButton.prototype, "inputId", {
- /** ID of the native input element inside `<mat-radio-button>` */
- get: /**
- * ID of the native input element inside `<mat-radio-button>`
- * @return {?}
- */
- function () { return (this.id || this._uniqueId) + "-input"; },
- enumerable: true,
- configurable: true
- });
- /** Focuses the radio button. */
- /**
- * Focuses the radio button.
- * @param {?=} options
- * @return {?}
- */
- MatRadioButton.prototype.focus = /**
- * Focuses the radio button.
- * @param {?=} options
- * @return {?}
- */
- function (options) {
- this._focusMonitor.focusVia(this._inputElement, 'keyboard', options);
- };
- /**
- * Marks the radio button as needing checking for change detection.
- * This method is exposed because the parent radio group will directly
- * update bound properties of the radio button.
- */
- /**
- * Marks the radio button as needing checking for change detection.
- * This method is exposed because the parent radio group will directly
- * update bound properties of the radio button.
- * @return {?}
- */
- MatRadioButton.prototype._markForCheck = /**
- * Marks the radio button as needing checking for change detection.
- * This method is exposed because the parent radio group will directly
- * update bound properties of the radio button.
- * @return {?}
- */
- function () {
- // When group value changes, the button will not be notified. Use `markForCheck` to explicit
- // update radio button's status
- this._changeDetector.markForCheck();
- };
- /**
- * @return {?}
- */
- MatRadioButton.prototype.ngOnInit = /**
- * @return {?}
- */
- function () {
- if (this.radioGroup) {
- // If the radio is inside a radio group, determine if it should be checked
- this.checked = this.radioGroup.value === this._value;
- // Copy name from parent radio group
- this.name = this.radioGroup.name;
- }
- };
- /**
- * @return {?}
- */
- MatRadioButton.prototype.ngAfterViewInit = /**
- * @return {?}
- */
- function () {
- var _this = this;
- this._focusMonitor
- .monitor(this._elementRef, true)
- .subscribe((/**
- * @param {?} focusOrigin
- * @return {?}
- */
- function (focusOrigin) {
- if (!focusOrigin && _this.radioGroup) {
- _this.radioGroup._touch();
- }
- }));
- };
- /**
- * @return {?}
- */
- MatRadioButton.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- this._focusMonitor.stopMonitoring(this._elementRef);
- this._removeUniqueSelectionListener();
- };
- /** Dispatch change event with current value. */
- /**
- * Dispatch change event with current value.
- * @private
- * @return {?}
- */
- MatRadioButton.prototype._emitChangeEvent = /**
- * Dispatch change event with current value.
- * @private
- * @return {?}
- */
- function () {
- this.change.emit(new MatRadioChange(this, this._value));
- };
- /**
- * @return {?}
- */
- MatRadioButton.prototype._isRippleDisabled = /**
- * @return {?}
- */
- function () {
- return this.disableRipple || this.disabled;
- };
- /**
- * @param {?} event
- * @return {?}
- */
- MatRadioButton.prototype._onInputClick = /**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- // We have to stop propagation for click events on the visual hidden input element.
- // By default, when a user clicks on a label element, a generated click event will be
- // dispatched on the associated input element. Since we are using a label element as our
- // root container, the click event on the `radio-button` will be executed twice.
- // The real click event will bubble up, and the generated click event also tries to bubble up.
- // This will lead to multiple click events.
- // Preventing bubbling for the second event will solve that issue.
- event.stopPropagation();
- };
- /**
- * Triggered when the radio button received a click or the input recognized any change.
- * Clicking on a label element, will trigger a change event on the associated input.
- */
- /**
- * Triggered when the radio button received a click or the input recognized any change.
- * Clicking on a label element, will trigger a change event on the associated input.
- * @param {?} event
- * @return {?}
- */
- MatRadioButton.prototype._onInputChange = /**
- * Triggered when the radio button received a click or the input recognized any change.
- * Clicking on a label element, will trigger a change event on the associated input.
- * @param {?} event
- * @return {?}
- */
- function (event) {
- // We always have to stop propagation on the change event.
- // Otherwise the change event, from the input element, will bubble up and
- // emit its event object to the `change` output.
- event.stopPropagation();
- /** @type {?} */
- var groupValueChanged = this.radioGroup && this.value !== this.radioGroup.value;
- this.checked = true;
- this._emitChangeEvent();
- if (this.radioGroup) {
- this.radioGroup._controlValueAccessorChangeFn(this.value);
- if (groupValueChanged) {
- this.radioGroup._emitChangeEvent();
- }
- }
- };
- MatRadioButton.decorators = [
- { type: core.Component, args: [{selector: 'mat-radio-button',
- 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\"> </span><ng-content></ng-content></div></label>",
- 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}}"],
- inputs: ['disableRipple', 'tabIndex'],
- encapsulation: core.ViewEncapsulation.None,
- exportAs: 'matRadioButton',
- host: {
- 'class': 'mat-radio-button',
- '[class.mat-radio-checked]': 'checked',
- '[class.mat-radio-disabled]': 'disabled',
- '[class._mat-animation-noopable]': '_animationMode === "NoopAnimations"',
- '[class.mat-primary]': 'color === "primary"',
- '[class.mat-accent]': 'color === "accent"',
- '[class.mat-warn]': 'color === "warn"',
- // Needs to be -1 so the `focus` event still fires.
- '[attr.tabindex]': '-1',
- '[attr.id]': 'id',
- // Note: under normal conditions focus shouldn't land on this element, however it may be
- // programmatically set, for example inside of a focus trap, in this case we want to forward
- // the focus to the native element.
- '(focus)': '_inputElement.nativeElement.focus()',
- },
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- },] },
- ];
- /** @nocollapse */
- MatRadioButton.ctorParameters = function () { return [
- { type: MatRadioGroup, decorators: [{ type: core.Optional }] },
- { type: core.ElementRef },
- { type: core.ChangeDetectorRef },
- { type: a11y.FocusMonitor },
- { type: collections.UniqueSelectionDispatcher },
- { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] },
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_RADIO_DEFAULT_OPTIONS,] }] }
- ]; };
- MatRadioButton.propDecorators = {
- id: [{ type: core.Input }],
- name: [{ type: core.Input }],
- ariaLabel: [{ type: core.Input, args: ['aria-label',] }],
- ariaLabelledby: [{ type: core.Input, args: ['aria-labelledby',] }],
- ariaDescribedby: [{ type: core.Input, args: ['aria-describedby',] }],
- checked: [{ type: core.Input }],
- value: [{ type: core.Input }],
- labelPosition: [{ type: core.Input }],
- disabled: [{ type: core.Input }],
- required: [{ type: core.Input }],
- color: [{ type: core.Input }],
- change: [{ type: core.Output }],
- _inputElement: [{ type: core.ViewChild, args: ['input', { static: false },] }]
- };
- return MatRadioButton;
- }(_MatRadioButtonMixinBase));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var MatRadioModule = /** @class */ (function () {
- function MatRadioModule() {
- }
- MatRadioModule.decorators = [
- { type: core.NgModule, args: [{
- imports: [common.CommonModule, MatRippleModule, MatCommonModule],
- exports: [MatRadioGroup, MatRadioButton, MatCommonModule],
- declarations: [MatRadioGroup, MatRadioButton],
- },] },
- ];
- return MatRadioModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Animations used by the Material drawers.
- * \@docs-private
- * @type {?}
- */
- var matDrawerAnimations = {
- /**
- * Animation that slides a drawer in and out.
- */
- transformDrawer: animations$1.trigger('transform', [
- // We remove the `transform` here completely, rather than setting it to zero, because:
- // 1. Having a transform can cause elements with ripples or an animated
- // transform to shift around in Chrome with an RTL layout (see #10023).
- // 2. 3d transforms causes text to appear blurry on IE and Edge.
- animations$1.state('open, open-instant', animations$1.style({
- 'transform': 'none',
- 'visibility': 'visible',
- })),
- animations$1.state('void', animations$1.style({
- // Avoids the shadow showing up when closed in SSR.
- 'box-shadow': 'none',
- 'visibility': 'hidden',
- })),
- animations$1.transition('void => open-instant', animations$1.animate('0ms')),
- animations$1.transition('void <=> open, open-instant => void', animations$1.animate('400ms cubic-bezier(0.25, 0.8, 0.25, 1)'))
- ])
- };
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Throws an exception when two MatDrawer are matching the same position.
- * \@docs-private
- * @param {?} position
- * @return {?}
- */
- function throwMatDuplicatedDrawerError(position) {
- throw Error("A drawer was already declared for 'position=\"" + position + "\"'");
- }
- /**
- * Configures whether drawers should use auto sizing by default.
- * @type {?}
- */
- var MAT_DRAWER_DEFAULT_AUTOSIZE = new core.InjectionToken('MAT_DRAWER_DEFAULT_AUTOSIZE', {
- providedIn: 'root',
- factory: MAT_DRAWER_DEFAULT_AUTOSIZE_FACTORY,
- });
- /**
- * \@docs-private
- * @return {?}
- */
- function MAT_DRAWER_DEFAULT_AUTOSIZE_FACTORY() {
- return false;
- }
- var MatDrawerContent = /** @class */ (function (_super) {
- __extends(MatDrawerContent, _super);
- function MatDrawerContent(_changeDetectorRef, _container, elementRef, scrollDispatcher, ngZone) {
- var _this = _super.call(this, elementRef, scrollDispatcher, ngZone) || this;
- _this._changeDetectorRef = _changeDetectorRef;
- _this._container = _container;
- return _this;
- }
- /**
- * @return {?}
- */
- MatDrawerContent.prototype.ngAfterContentInit = /**
- * @return {?}
- */
- function () {
- var _this = this;
- this._container._contentMarginChanges.subscribe((/**
- * @return {?}
- */
- function () {
- _this._changeDetectorRef.markForCheck();
- }));
- };
- MatDrawerContent.decorators = [
- { type: core.Component, args: [{selector: 'mat-drawer-content',
- template: '<ng-content></ng-content>',
- host: {
- 'class': 'mat-drawer-content',
- '[style.margin-left.px]': '_container._contentMargins.left',
- '[style.margin-right.px]': '_container._contentMargins.right',
- },
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- encapsulation: core.ViewEncapsulation.None,
- },] },
- ];
- /** @nocollapse */
- MatDrawerContent.ctorParameters = function () { return [
- { type: core.ChangeDetectorRef },
- { type: MatDrawerContainer, decorators: [{ type: core.Inject, args: [core.forwardRef((/**
- * @return {?}
- */
- function () { return MatDrawerContainer; })),] }] },
- { type: core.ElementRef },
- { type: scrolling.ScrollDispatcher },
- { type: core.NgZone }
- ]; };
- return MatDrawerContent;
- }(scrolling.CdkScrollable));
- /**
- * This component corresponds to a drawer that can be opened on the drawer container.
- */
- var MatDrawer = /** @class */ (function () {
- function MatDrawer(_elementRef, _focusTrapFactory, _focusMonitor, _platform, _ngZone, _doc) {
- var _this = this;
- this._elementRef = _elementRef;
- this._focusTrapFactory = _focusTrapFactory;
- this._focusMonitor = _focusMonitor;
- this._platform = _platform;
- this._ngZone = _ngZone;
- this._doc = _doc;
- this._elementFocusedBeforeDrawerWasOpened = null;
- /**
- * Whether the drawer is initialized. Used for disabling the initial animation.
- */
- this._enableAnimations = false;
- this._position = 'start';
- this._mode = 'over';
- this._disableClose = false;
- this._autoFocus = true;
- /**
- * Emits whenever the drawer has started animating.
- */
- this._animationStarted = new rxjs.Subject();
- /**
- * Emits whenever the drawer is done animating.
- */
- this._animationEnd = new rxjs.Subject();
- /**
- * Current state of the sidenav animation.
- */
- // @HostBinding is used in the class as it is expected to be extended. Since @Component decorator
- // metadata is not inherited by child classes, instead the host binding data is defined in a way
- // that can be inherited.
- // tslint:disable:no-host-decorator-in-concrete
- this._animationState = 'void';
- /**
- * Event emitted when the drawer open state is changed.
- */
- this.openedChange =
- // Note this has to be async in order to avoid some issues with two-bindings (see #8872).
- new core.EventEmitter(/* isAsync */ true);
- /**
- * Emits when the component is destroyed.
- */
- this._destroyed = new rxjs.Subject();
- /**
- * Event emitted when the drawer's position changes.
- */
- // tslint:disable-next-line:no-output-on-prefix
- this.onPositionChanged = new core.EventEmitter();
- /**
- * An observable that emits when the drawer mode changes. This is used by the drawer container to
- * to know when to when the mode changes so it can adapt the margins on the content.
- */
- this._modeChanged = new rxjs.Subject();
- this._opened = false;
- this.openedChange.subscribe((/**
- * @param {?} opened
- * @return {?}
- */
- function (opened) {
- if (opened) {
- if (_this._doc) {
- _this._elementFocusedBeforeDrawerWasOpened = (/** @type {?} */ (_this._doc.activeElement));
- }
- if (_this._isFocusTrapEnabled && _this._focusTrap) {
- _this._trapFocus();
- }
- }
- else {
- _this._restoreFocus();
- }
- }));
- /**
- * Listen to `keydown` events outside the zone so that change detection is not run every
- * time a key is pressed. Instead we re-enter the zone only if the `ESC` key is pressed
- * and we don't have close disabled.
- */
- this._ngZone.runOutsideAngular((/**
- * @return {?}
- */
- function () {
- ((/** @type {?} */ (rxjs.fromEvent(_this._elementRef.nativeElement, 'keydown')))).pipe(operators.filter((/**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- return event.keyCode === keycodes.ESCAPE && !_this.disableClose && !keycodes.hasModifierKey(event);
- })), operators.takeUntil(_this._destroyed)).subscribe((/**
- * @param {?} event
- * @return {?}
- */
- function (event) { return _this._ngZone.run((/**
- * @return {?}
- */
- function () {
- _this.close();
- event.stopPropagation();
- event.preventDefault();
- })); }));
- }));
- // We need a Subject with distinctUntilChanged, because the `done` event
- // fires twice on some browsers. See https://github.com/angular/angular/issues/24084
- this._animationEnd.pipe(operators.distinctUntilChanged((/**
- * @param {?} x
- * @param {?} y
- * @return {?}
- */
- function (x, y) {
- return x.fromState === y.fromState && x.toState === y.toState;
- }))).subscribe((/**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- var fromState = event.fromState, toState = event.toState;
- if ((toState.indexOf('open') === 0 && fromState === 'void') ||
- (toState === 'void' && fromState.indexOf('open') === 0)) {
- _this.openedChange.emit(_this._opened);
- }
- }));
- }
- Object.defineProperty(MatDrawer.prototype, "position", {
- /** The side that the drawer is attached to. */
- get: /**
- * The side that the drawer is attached to.
- * @return {?}
- */
- function () { return this._position; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- // Make sure we have a valid value.
- value = value === 'end' ? 'end' : 'start';
- if (value != this._position) {
- this._position = value;
- this.onPositionChanged.emit();
- }
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatDrawer.prototype, "mode", {
- /** Mode of the drawer; one of 'over', 'push' or 'side'. */
- get: /**
- * Mode of the drawer; one of 'over', 'push' or 'side'.
- * @return {?}
- */
- function () { return this._mode; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._mode = value;
- this._updateFocusTrapState();
- this._modeChanged.next();
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatDrawer.prototype, "disableClose", {
- /** Whether the drawer can be closed with the escape key or by clicking on the backdrop. */
- get: /**
- * Whether the drawer can be closed with the escape key or by clicking on the backdrop.
- * @return {?}
- */
- function () { return this._disableClose; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) { this._disableClose = coercion.coerceBooleanProperty(value); },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatDrawer.prototype, "autoFocus", {
- /** Whether the drawer should focus the first focusable element automatically when opened. */
- get: /**
- * Whether the drawer should focus the first focusable element automatically when opened.
- * @return {?}
- */
- function () { return this._autoFocus; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) { this._autoFocus = coercion.coerceBooleanProperty(value); },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatDrawer.prototype, "_openedStream", {
- /** Event emitted when the drawer has been opened. */
- get: /**
- * Event emitted when the drawer has been opened.
- * @return {?}
- */
- function () {
- return this.openedChange.pipe(operators.filter((/**
- * @param {?} o
- * @return {?}
- */
- function (o) { return o; })), operators.map((/**
- * @return {?}
- */
- function () { })));
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatDrawer.prototype, "openedStart", {
- /** Event emitted when the drawer has started opening. */
- get: /**
- * Event emitted when the drawer has started opening.
- * @return {?}
- */
- function () {
- return this._animationStarted.pipe(operators.filter((/**
- * @param {?} e
- * @return {?}
- */
- function (e) { return e.fromState !== e.toState && e.toState.indexOf('open') === 0; })), operators.map((/**
- * @return {?}
- */
- function () { })));
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatDrawer.prototype, "_closedStream", {
- /** Event emitted when the drawer has been closed. */
- get: /**
- * Event emitted when the drawer has been closed.
- * @return {?}
- */
- function () {
- return this.openedChange.pipe(operators.filter((/**
- * @param {?} o
- * @return {?}
- */
- function (o) { return !o; })), operators.map((/**
- * @return {?}
- */
- function () { })));
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatDrawer.prototype, "closedStart", {
- /** Event emitted when the drawer has started closing. */
- get: /**
- * Event emitted when the drawer has started closing.
- * @return {?}
- */
- function () {
- return this._animationStarted.pipe(operators.filter((/**
- * @param {?} e
- * @return {?}
- */
- function (e) { return e.fromState !== e.toState && e.toState === 'void'; })), operators.map((/**
- * @return {?}
- */
- function () { })));
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatDrawer.prototype, "_isFocusTrapEnabled", {
- get: /**
- * @return {?}
- */
- function () {
- // The focus trap is only enabled when the drawer is open in any mode other than side.
- return this.opened && this.mode !== 'side';
- },
- enumerable: true,
- configurable: true
- });
- /** Traps focus inside the drawer. */
- /**
- * Traps focus inside the drawer.
- * @private
- * @return {?}
- */
- MatDrawer.prototype._trapFocus = /**
- * Traps focus inside the drawer.
- * @private
- * @return {?}
- */
- function () {
- var _this = this;
- if (!this.autoFocus) {
- return;
- }
- this._focusTrap.focusInitialElementWhenReady().then((/**
- * @param {?} hasMovedFocus
- * @return {?}
- */
- function (hasMovedFocus) {
- // If there were no focusable elements, focus the sidenav itself so the keyboard navigation
- // still works. We need to check that `focus` is a function due to Universal.
- if (!hasMovedFocus && typeof _this._elementRef.nativeElement.focus === 'function') {
- _this._elementRef.nativeElement.focus();
- }
- }));
- };
- /**
- * If focus is currently inside the drawer, restores it to where it was before the drawer
- * opened.
- */
- /**
- * If focus is currently inside the drawer, restores it to where it was before the drawer
- * opened.
- * @private
- * @return {?}
- */
- MatDrawer.prototype._restoreFocus = /**
- * If focus is currently inside the drawer, restores it to where it was before the drawer
- * opened.
- * @private
- * @return {?}
- */
- function () {
- if (!this.autoFocus) {
- return;
- }
- /** @type {?} */
- var activeEl = this._doc && this._doc.activeElement;
- if (activeEl && this._elementRef.nativeElement.contains(activeEl)) {
- if (this._elementFocusedBeforeDrawerWasOpened instanceof HTMLElement) {
- this._focusMonitor.focusVia(this._elementFocusedBeforeDrawerWasOpened, this._openedVia);
- }
- else {
- this._elementRef.nativeElement.blur();
- }
- }
- this._elementFocusedBeforeDrawerWasOpened = null;
- this._openedVia = null;
- };
- /**
- * @return {?}
- */
- MatDrawer.prototype.ngAfterContentInit = /**
- * @return {?}
- */
- function () {
- this._focusTrap = this._focusTrapFactory.create(this._elementRef.nativeElement);
- this._updateFocusTrapState();
- };
- /**
- * @return {?}
- */
- MatDrawer.prototype.ngAfterContentChecked = /**
- * @return {?}
- */
- function () {
- // Enable the animations after the lifecycle hooks have run, in order to avoid animating
- // drawers that are open by default. When we're on the server, we shouldn't enable the
- // animations, because we don't want the drawer to animate the first time the user sees
- // the page.
- if (this._platform.isBrowser) {
- this._enableAnimations = true;
- }
- };
- /**
- * @return {?}
- */
- MatDrawer.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- if (this._focusTrap) {
- this._focusTrap.destroy();
- }
- this._animationStarted.complete();
- this._animationEnd.complete();
- this._modeChanged.complete();
- this._destroyed.next();
- this._destroyed.complete();
- };
- Object.defineProperty(MatDrawer.prototype, "opened", {
- /**
- * Whether the drawer is opened. We overload this because we trigger an event when it
- * starts or end.
- */
- get: /**
- * Whether the drawer is opened. We overload this because we trigger an event when it
- * starts or end.
- * @return {?}
- */
- function () { return this._opened; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) { this.toggle(coercion.coerceBooleanProperty(value)); },
- enumerable: true,
- configurable: true
- });
- /**
- * Open the drawer.
- * @param openedVia Whether the drawer was opened by a key press, mouse click or programmatically.
- * Used for focus management after the sidenav is closed.
- */
- /**
- * Open the drawer.
- * @param {?=} openedVia Whether the drawer was opened by a key press, mouse click or programmatically.
- * Used for focus management after the sidenav is closed.
- * @return {?}
- */
- MatDrawer.prototype.open = /**
- * Open the drawer.
- * @param {?=} openedVia Whether the drawer was opened by a key press, mouse click or programmatically.
- * Used for focus management after the sidenav is closed.
- * @return {?}
- */
- function (openedVia) {
- return this.toggle(true, openedVia);
- };
- /** Close the drawer. */
- /**
- * Close the drawer.
- * @return {?}
- */
- MatDrawer.prototype.close = /**
- * Close the drawer.
- * @return {?}
- */
- function () {
- return this.toggle(false);
- };
- /**
- * Toggle this drawer.
- * @param isOpen Whether the drawer should be open.
- * @param openedVia Whether the drawer was opened by a key press, mouse click or programmatically.
- * Used for focus management after the sidenav is closed.
- */
- /**
- * Toggle this drawer.
- * @param {?=} isOpen Whether the drawer should be open.
- * @param {?=} openedVia Whether the drawer was opened by a key press, mouse click or programmatically.
- * Used for focus management after the sidenav is closed.
- * @return {?}
- */
- MatDrawer.prototype.toggle = /**
- * Toggle this drawer.
- * @param {?=} isOpen Whether the drawer should be open.
- * @param {?=} openedVia Whether the drawer was opened by a key press, mouse click or programmatically.
- * Used for focus management after the sidenav is closed.
- * @return {?}
- */
- function (isOpen, openedVia) {
- var _this = this;
- if (isOpen === void 0) { isOpen = !this.opened; }
- if (openedVia === void 0) { openedVia = 'program'; }
- this._opened = isOpen;
- if (isOpen) {
- this._animationState = this._enableAnimations ? 'open' : 'open-instant';
- this._openedVia = openedVia;
- }
- else {
- this._animationState = 'void';
- this._restoreFocus();
- }
- this._updateFocusTrapState();
- return new Promise((/**
- * @param {?} resolve
- * @return {?}
- */
- function (resolve) {
- _this.openedChange.pipe(operators.take(1)).subscribe((/**
- * @param {?} open
- * @return {?}
- */
- function (open) { return resolve(open ? 'open' : 'close'); }));
- }));
- };
- Object.defineProperty(MatDrawer.prototype, "_width", {
- get: /**
- * @return {?}
- */
- function () {
- return this._elementRef.nativeElement ? (this._elementRef.nativeElement.offsetWidth || 0) : 0;
- },
- enumerable: true,
- configurable: true
- });
- /** Updates the enabled state of the focus trap. */
- /**
- * Updates the enabled state of the focus trap.
- * @private
- * @return {?}
- */
- MatDrawer.prototype._updateFocusTrapState = /**
- * Updates the enabled state of the focus trap.
- * @private
- * @return {?}
- */
- function () {
- if (this._focusTrap) {
- this._focusTrap.enabled = this._isFocusTrapEnabled;
- }
- };
- // We have to use a `HostListener` here in order to support both Ivy and ViewEngine.
- // In Ivy the `host` bindings will be merged when this class is extended, whereas in
- // ViewEngine they're overwritten.
- // TODO(crisbeto): we move this back into `host` once Ivy is turned on by default.
- // tslint:disable-next-line:no-host-decorator-in-concrete
- // We have to use a `HostListener` here in order to support both Ivy and ViewEngine.
- // In Ivy the `host` bindings will be merged when this class is extended, whereas in
- // ViewEngine they're overwritten.
- // TODO(crisbeto): we move this back into `host` once Ivy is turned on by default.
- // tslint:disable-next-line:no-host-decorator-in-concrete
- /**
- * @param {?} event
- * @return {?}
- */
- MatDrawer.prototype._animationStartListener =
- // We have to use a `HostListener` here in order to support both Ivy and ViewEngine.
- // In Ivy the `host` bindings will be merged when this class is extended, whereas in
- // ViewEngine they're overwritten.
- // TODO(crisbeto): we move this back into `host` once Ivy is turned on by default.
- // tslint:disable-next-line:no-host-decorator-in-concrete
- /**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- this._animationStarted.next(event);
- };
- // We have to use a `HostListener` here in order to support both Ivy and ViewEngine.
- // In Ivy the `host` bindings will be merged when this class is extended, whereas in
- // ViewEngine they're overwritten.
- // TODO(crisbeto): we move this back into `host` once Ivy is turned on by default.
- // tslint:disable-next-line:no-host-decorator-in-concrete
- // We have to use a `HostListener` here in order to support both Ivy and ViewEngine.
- // In Ivy the `host` bindings will be merged when this class is extended, whereas in
- // ViewEngine they're overwritten.
- // TODO(crisbeto): we move this back into `host` once Ivy is turned on by default.
- // tslint:disable-next-line:no-host-decorator-in-concrete
- /**
- * @param {?} event
- * @return {?}
- */
- MatDrawer.prototype._animationDoneListener =
- // We have to use a `HostListener` here in order to support both Ivy and ViewEngine.
- // In Ivy the `host` bindings will be merged when this class is extended, whereas in
- // ViewEngine they're overwritten.
- // TODO(crisbeto): we move this back into `host` once Ivy is turned on by default.
- // tslint:disable-next-line:no-host-decorator-in-concrete
- /**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- this._animationEnd.next(event);
- };
- MatDrawer.decorators = [
- { type: core.Component, args: [{selector: 'mat-drawer',
- exportAs: 'matDrawer',
- template: "<div class=\"mat-drawer-inner-container\"><ng-content></ng-content></div>",
- animations: [matDrawerAnimations.transformDrawer],
- host: {
- 'class': 'mat-drawer',
- // must prevent the browser from aligning text based on value
- '[attr.align]': 'null',
- '[class.mat-drawer-end]': 'position === "end"',
- '[class.mat-drawer-over]': 'mode === "over"',
- '[class.mat-drawer-push]': 'mode === "push"',
- '[class.mat-drawer-side]': 'mode === "side"',
- '[class.mat-drawer-opened]': 'opened',
- 'tabIndex': '-1',
- },
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- encapsulation: core.ViewEncapsulation.None,
- },] },
- ];
- /** @nocollapse */
- MatDrawer.ctorParameters = function () { return [
- { type: core.ElementRef },
- { type: a11y.FocusTrapFactory },
- { type: a11y.FocusMonitor },
- { type: platform.Platform },
- { type: core.NgZone },
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [common.DOCUMENT,] }] }
- ]; };
- MatDrawer.propDecorators = {
- position: [{ type: core.Input }],
- mode: [{ type: core.Input }],
- disableClose: [{ type: core.Input }],
- autoFocus: [{ type: core.Input }],
- _animationState: [{ type: core.HostBinding, args: ['@transform',] }],
- openedChange: [{ type: core.Output }],
- _openedStream: [{ type: core.Output, args: ['opened',] }],
- openedStart: [{ type: core.Output }],
- _closedStream: [{ type: core.Output, args: ['closed',] }],
- closedStart: [{ type: core.Output }],
- onPositionChanged: [{ type: core.Output, args: ['positionChanged',] }],
- opened: [{ type: core.Input }],
- _animationStartListener: [{ type: core.HostListener, args: ['@transform.start', ['$event'],] }],
- _animationDoneListener: [{ type: core.HostListener, args: ['@transform.done', ['$event'],] }]
- };
- return MatDrawer;
- }());
- /**
- * `<mat-drawer-container>` component.
- *
- * This is the parent component to one or two `<mat-drawer>`s that validates the state internally
- * and coordinates the backdrop and content styling.
- */
- var MatDrawerContainer = /** @class */ (function () {
- function MatDrawerContainer(_dir, _element, _ngZone, _changeDetectorRef, viewportRuler, defaultAutosize, _animationMode) {
- var _this = this;
- if (defaultAutosize === void 0) { defaultAutosize = false; }
- this._dir = _dir;
- this._element = _element;
- this._ngZone = _ngZone;
- this._changeDetectorRef = _changeDetectorRef;
- this._animationMode = _animationMode;
- /**
- * Event emitted when the drawer backdrop is clicked.
- */
- this.backdropClick = new core.EventEmitter();
- /**
- * Emits when the component is destroyed.
- */
- this._destroyed = new rxjs.Subject();
- /**
- * Emits on every ngDoCheck. Used for debouncing reflows.
- */
- this._doCheckSubject = new rxjs.Subject();
- /**
- * Margins to be applied to the content. These are used to push / shrink the drawer content when a
- * drawer is open. We use margin rather than transform even for push mode because transform breaks
- * fixed position elements inside of the transformed element.
- */
- this._contentMargins = { left: null, right: null };
- this._contentMarginChanges = new rxjs.Subject();
- // If a `Dir` directive exists up the tree, listen direction changes
- // and update the left/right properties to point to the proper start/end.
- if (_dir) {
- _dir.change.pipe(operators.takeUntil(this._destroyed)).subscribe((/**
- * @return {?}
- */
- function () {
- _this._validateDrawers();
- _this.updateContentMargins();
- }));
- }
- // Since the minimum width of the sidenav depends on the viewport width,
- // we need to recompute the margins if the viewport changes.
- viewportRuler.change()
- .pipe(operators.takeUntil(this._destroyed))
- .subscribe((/**
- * @return {?}
- */
- function () { return _this.updateContentMargins(); }));
- this._autosize = defaultAutosize;
- }
- Object.defineProperty(MatDrawerContainer.prototype, "start", {
- /** The drawer child with the `start` position. */
- get: /**
- * The drawer child with the `start` position.
- * @return {?}
- */
- function () { return this._start; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatDrawerContainer.prototype, "end", {
- /** The drawer child with the `end` position. */
- get: /**
- * The drawer child with the `end` position.
- * @return {?}
- */
- function () { return this._end; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatDrawerContainer.prototype, "autosize", {
- /**
- * Whether to automatically resize the container whenever
- * the size of any of its drawers changes.
- *
- * **Use at your own risk!** Enabling this option can cause layout thrashing by measuring
- * the drawers on every change detection cycle. Can be configured globally via the
- * `MAT_DRAWER_DEFAULT_AUTOSIZE` token.
- */
- get: /**
- * Whether to automatically resize the container whenever
- * the size of any of its drawers changes.
- *
- * **Use at your own risk!** Enabling this option can cause layout thrashing by measuring
- * the drawers on every change detection cycle. Can be configured globally via the
- * `MAT_DRAWER_DEFAULT_AUTOSIZE` token.
- * @return {?}
- */
- function () { return this._autosize; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) { this._autosize = coercion.coerceBooleanProperty(value); },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatDrawerContainer.prototype, "hasBackdrop", {
- /**
- * Whether the drawer container should have a backdrop while one of the sidenavs is open.
- * If explicitly set to `true`, the backdrop will be enabled for drawers in the `side`
- * mode as well.
- */
- get: /**
- * Whether the drawer container should have a backdrop while one of the sidenavs is open.
- * If explicitly set to `true`, the backdrop will be enabled for drawers in the `side`
- * mode as well.
- * @return {?}
- */
- function () {
- if (this._backdropOverride == null) {
- return !this._start || this._start.mode !== 'side' || !this._end || this._end.mode !== 'side';
- }
- return this._backdropOverride;
- },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._backdropOverride = value == null ? null : coercion.coerceBooleanProperty(value);
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatDrawerContainer.prototype, "scrollable", {
- /** Reference to the CdkScrollable instance that wraps the scrollable content. */
- get: /**
- * Reference to the CdkScrollable instance that wraps the scrollable content.
- * @return {?}
- */
- function () {
- return this._userContent || this._content;
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- MatDrawerContainer.prototype.ngAfterContentInit = /**
- * @return {?}
- */
- function () {
- var _this = this;
- this._drawers.changes.pipe(operators.startWith(null)).subscribe((/**
- * @return {?}
- */
- function () {
- _this._validateDrawers();
- _this._drawers.forEach((/**
- * @param {?} drawer
- * @return {?}
- */
- function (drawer) {
- _this._watchDrawerToggle(drawer);
- _this._watchDrawerPosition(drawer);
- _this._watchDrawerMode(drawer);
- }));
- if (!_this._drawers.length ||
- _this._isDrawerOpen(_this._start) ||
- _this._isDrawerOpen(_this._end)) {
- _this.updateContentMargins();
- }
- _this._changeDetectorRef.markForCheck();
- }));
- this._doCheckSubject.pipe(operators.debounceTime(10), // Arbitrary debounce time, less than a frame at 60fps
- operators.takeUntil(this._destroyed)).subscribe((/**
- * @return {?}
- */
- function () { return _this.updateContentMargins(); }));
- };
- /**
- * @return {?}
- */
- MatDrawerContainer.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- this._contentMarginChanges.complete();
- this._doCheckSubject.complete();
- this._destroyed.next();
- this._destroyed.complete();
- };
- /** Calls `open` of both start and end drawers */
- /**
- * Calls `open` of both start and end drawers
- * @return {?}
- */
- MatDrawerContainer.prototype.open = /**
- * Calls `open` of both start and end drawers
- * @return {?}
- */
- function () {
- this._drawers.forEach((/**
- * @param {?} drawer
- * @return {?}
- */
- function (drawer) { return drawer.open(); }));
- };
- /** Calls `close` of both start and end drawers */
- /**
- * Calls `close` of both start and end drawers
- * @return {?}
- */
- MatDrawerContainer.prototype.close = /**
- * Calls `close` of both start and end drawers
- * @return {?}
- */
- function () {
- this._drawers.forEach((/**
- * @param {?} drawer
- * @return {?}
- */
- function (drawer) { return drawer.close(); }));
- };
- /**
- * Recalculates and updates the inline styles for the content. Note that this should be used
- * sparingly, because it causes a reflow.
- */
- /**
- * Recalculates and updates the inline styles for the content. Note that this should be used
- * sparingly, because it causes a reflow.
- * @return {?}
- */
- MatDrawerContainer.prototype.updateContentMargins = /**
- * Recalculates and updates the inline styles for the content. Note that this should be used
- * sparingly, because it causes a reflow.
- * @return {?}
- */
- function () {
- var _this = this;
- // 1. For drawers in `over` mode, they don't affect the content.
- // 2. For drawers in `side` mode they should shrink the content. We do this by adding to the
- // left margin (for left drawer) or right margin (for right the drawer).
- // 3. For drawers in `push` mode the should shift the content without resizing it. We do this by
- // adding to the left or right margin and simultaneously subtracting the same amount of
- // margin from the other side.
- /** @type {?} */
- var left = 0;
- /** @type {?} */
- var right = 0;
- if (this._left && this._left.opened) {
- if (this._left.mode == 'side') {
- left += this._left._width;
- }
- else if (this._left.mode == 'push') {
- /** @type {?} */
- var width = this._left._width;
- left += width;
- right -= width;
- }
- }
- if (this._right && this._right.opened) {
- if (this._right.mode == 'side') {
- right += this._right._width;
- }
- else if (this._right.mode == 'push') {
- /** @type {?} */
- var width = this._right._width;
- right += width;
- left -= width;
- }
- }
- // If either `right` or `left` is zero, don't set a style to the element. This
- // allows users to specify a custom size via CSS class in SSR scenarios where the
- // measured widths will always be zero. Note that we reset to `null` here, rather
- // than below, in order to ensure that the types in the `if` below are consistent.
- left = left || (/** @type {?} */ (null));
- right = right || (/** @type {?} */ (null));
- if (left !== this._contentMargins.left || right !== this._contentMargins.right) {
- this._contentMargins = { left: left, right: right };
- // Pull back into the NgZone since in some cases we could be outside. We need to be careful
- // to do it only when something changed, otherwise we can end up hitting the zone too often.
- this._ngZone.run((/**
- * @return {?}
- */
- function () { return _this._contentMarginChanges.next(_this._contentMargins); }));
- }
- };
- /**
- * @return {?}
- */
- MatDrawerContainer.prototype.ngDoCheck = /**
- * @return {?}
- */
- function () {
- var _this = this;
- // If users opted into autosizing, do a check every change detection cycle.
- if (this._autosize && this._isPushed()) {
- // Run outside the NgZone, otherwise the debouncer will throw us into an infinite loop.
- this._ngZone.runOutsideAngular((/**
- * @return {?}
- */
- function () { return _this._doCheckSubject.next(); }));
- }
- };
- /**
- * Subscribes to drawer events in order to set a class on the main container element when the
- * drawer is open and the backdrop is visible. This ensures any overflow on the container element
- * is properly hidden.
- */
- /**
- * Subscribes to drawer events in order to set a class on the main container element when the
- * drawer is open and the backdrop is visible. This ensures any overflow on the container element
- * is properly hidden.
- * @private
- * @param {?} drawer
- * @return {?}
- */
- MatDrawerContainer.prototype._watchDrawerToggle = /**
- * Subscribes to drawer events in order to set a class on the main container element when the
- * drawer is open and the backdrop is visible. This ensures any overflow on the container element
- * is properly hidden.
- * @private
- * @param {?} drawer
- * @return {?}
- */
- function (drawer) {
- var _this = this;
- drawer._animationStarted.pipe(operators.filter((/**
- * @param {?} event
- * @return {?}
- */
- function (event) { return event.fromState !== event.toState; })), operators.takeUntil(this._drawers.changes))
- .subscribe((/**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- // Set the transition class on the container so that the animations occur. This should not
- // be set initially because animations should only be triggered via a change in state.
- if (event.toState !== 'open-instant' && _this._animationMode !== 'NoopAnimations') {
- _this._element.nativeElement.classList.add('mat-drawer-transition');
- }
- _this.updateContentMargins();
- _this._changeDetectorRef.markForCheck();
- }));
- if (drawer.mode !== 'side') {
- drawer.openedChange.pipe(operators.takeUntil(this._drawers.changes)).subscribe((/**
- * @return {?}
- */
- function () {
- return _this._setContainerClass(drawer.opened);
- }));
- }
- };
- /**
- * Subscribes to drawer onPositionChanged event in order to
- * re-validate drawers when the position changes.
- */
- /**
- * Subscribes to drawer onPositionChanged event in order to
- * re-validate drawers when the position changes.
- * @private
- * @param {?} drawer
- * @return {?}
- */
- MatDrawerContainer.prototype._watchDrawerPosition = /**
- * Subscribes to drawer onPositionChanged event in order to
- * re-validate drawers when the position changes.
- * @private
- * @param {?} drawer
- * @return {?}
- */
- function (drawer) {
- var _this = this;
- if (!drawer) {
- return;
- }
- // NOTE: We need to wait for the microtask queue to be empty before validating,
- // since both drawers may be swapping positions at the same time.
- drawer.onPositionChanged.pipe(operators.takeUntil(this._drawers.changes)).subscribe((/**
- * @return {?}
- */
- function () {
- _this._ngZone.onMicrotaskEmpty.asObservable().pipe(operators.take(1)).subscribe((/**
- * @return {?}
- */
- function () {
- _this._validateDrawers();
- }));
- }));
- };
- /** Subscribes to changes in drawer mode so we can run change detection. */
- /**
- * Subscribes to changes in drawer mode so we can run change detection.
- * @private
- * @param {?} drawer
- * @return {?}
- */
- MatDrawerContainer.prototype._watchDrawerMode = /**
- * Subscribes to changes in drawer mode so we can run change detection.
- * @private
- * @param {?} drawer
- * @return {?}
- */
- function (drawer) {
- var _this = this;
- if (drawer) {
- drawer._modeChanged.pipe(operators.takeUntil(rxjs.merge(this._drawers.changes, this._destroyed)))
- .subscribe((/**
- * @return {?}
- */
- function () {
- _this.updateContentMargins();
- _this._changeDetectorRef.markForCheck();
- }));
- }
- };
- /** Toggles the 'mat-drawer-opened' class on the main 'mat-drawer-container' element. */
- /**
- * Toggles the 'mat-drawer-opened' class on the main 'mat-drawer-container' element.
- * @private
- * @param {?} isAdd
- * @return {?}
- */
- MatDrawerContainer.prototype._setContainerClass = /**
- * Toggles the 'mat-drawer-opened' class on the main 'mat-drawer-container' element.
- * @private
- * @param {?} isAdd
- * @return {?}
- */
- function (isAdd) {
- /** @type {?} */
- var classList = this._element.nativeElement.classList;
- /** @type {?} */
- var className = 'mat-drawer-container-has-open';
- if (isAdd) {
- classList.add(className);
- }
- else {
- classList.remove(className);
- }
- };
- /** Validate the state of the drawer children components. */
- /**
- * Validate the state of the drawer children components.
- * @private
- * @return {?}
- */
- MatDrawerContainer.prototype._validateDrawers = /**
- * Validate the state of the drawer children components.
- * @private
- * @return {?}
- */
- function () {
- var _this = this;
- this._start = this._end = null;
- // Ensure that we have at most one start and one end drawer.
- this._drawers.forEach((/**
- * @param {?} drawer
- * @return {?}
- */
- function (drawer) {
- if (drawer.position == 'end') {
- if (_this._end != null) {
- throwMatDuplicatedDrawerError('end');
- }
- _this._end = drawer;
- }
- else {
- if (_this._start != null) {
- throwMatDuplicatedDrawerError('start');
- }
- _this._start = drawer;
- }
- }));
- this._right = this._left = null;
- // Detect if we're LTR or RTL.
- if (this._dir && this._dir.value === 'rtl') {
- this._left = this._end;
- this._right = this._start;
- }
- else {
- this._left = this._start;
- this._right = this._end;
- }
- };
- /** Whether the container is being pushed to the side by one of the drawers. */
- /**
- * Whether the container is being pushed to the side by one of the drawers.
- * @private
- * @return {?}
- */
- MatDrawerContainer.prototype._isPushed = /**
- * Whether the container is being pushed to the side by one of the drawers.
- * @private
- * @return {?}
- */
- function () {
- return (this._isDrawerOpen(this._start) && this._start.mode != 'over') ||
- (this._isDrawerOpen(this._end) && this._end.mode != 'over');
- };
- /**
- * @return {?}
- */
- MatDrawerContainer.prototype._onBackdropClicked = /**
- * @return {?}
- */
- function () {
- this.backdropClick.emit();
- this._closeModalDrawer();
- };
- /**
- * @return {?}
- */
- MatDrawerContainer.prototype._closeModalDrawer = /**
- * @return {?}
- */
- function () {
- var _this = this;
- // Close all open drawers where closing is not disabled and the mode is not `side`.
- [this._start, this._end]
- .filter((/**
- * @param {?} drawer
- * @return {?}
- */
- function (drawer) { return drawer && !drawer.disableClose && _this._canHaveBackdrop(drawer); }))
- .forEach((/**
- * @param {?} drawer
- * @return {?}
- */
- function (drawer) { return (/** @type {?} */ (drawer)).close(); }));
- };
- /**
- * @return {?}
- */
- MatDrawerContainer.prototype._isShowingBackdrop = /**
- * @return {?}
- */
- function () {
- return (this._isDrawerOpen(this._start) && this._canHaveBackdrop(this._start)) ||
- (this._isDrawerOpen(this._end) && this._canHaveBackdrop(this._end));
- };
- /**
- * @private
- * @param {?} drawer
- * @return {?}
- */
- MatDrawerContainer.prototype._canHaveBackdrop = /**
- * @private
- * @param {?} drawer
- * @return {?}
- */
- function (drawer) {
- return drawer.mode !== 'side' || !!this._backdropOverride;
- };
- /**
- * @private
- * @param {?} drawer
- * @return {?}
- */
- MatDrawerContainer.prototype._isDrawerOpen = /**
- * @private
- * @param {?} drawer
- * @return {?}
- */
- function (drawer) {
- return drawer != null && drawer.opened;
- };
- MatDrawerContainer.decorators = [
- { type: core.Component, args: [{selector: 'mat-drawer-container',
- exportAs: 'matDrawerContainer',
- 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>",
- 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}"],
- host: {
- 'class': 'mat-drawer-container',
- '[class.mat-drawer-container-explicit-backdrop]': '_backdropOverride',
- },
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- encapsulation: core.ViewEncapsulation.None,
- },] },
- ];
- /** @nocollapse */
- MatDrawerContainer.ctorParameters = function () { return [
- { type: bidi.Directionality, decorators: [{ type: core.Optional }] },
- { type: core.ElementRef },
- { type: core.NgZone },
- { type: core.ChangeDetectorRef },
- { type: scrolling.ViewportRuler },
- { type: undefined, decorators: [{ type: core.Inject, args: [MAT_DRAWER_DEFAULT_AUTOSIZE,] }] },
- { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
- ]; };
- MatDrawerContainer.propDecorators = {
- _drawers: [{ type: core.ContentChildren, args: [MatDrawer,] }],
- _content: [{ type: core.ContentChild, args: [MatDrawerContent, { static: false },] }],
- _userContent: [{ type: core.ViewChild, args: [MatDrawerContent, { static: false },] }],
- autosize: [{ type: core.Input }],
- hasBackdrop: [{ type: core.Input }],
- backdropClick: [{ type: core.Output }]
- };
- return MatDrawerContainer;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var MatSidenavContent = /** @class */ (function (_super) {
- __extends(MatSidenavContent, _super);
- function MatSidenavContent(changeDetectorRef, container, elementRef, scrollDispatcher, ngZone) {
- return _super.call(this, changeDetectorRef, container, elementRef, scrollDispatcher, ngZone) || this;
- }
- MatSidenavContent.decorators = [
- { type: core.Component, args: [{selector: 'mat-sidenav-content',
- template: '<ng-content></ng-content>',
- host: {
- 'class': 'mat-drawer-content mat-sidenav-content',
- '[style.margin-left.px]': '_container._contentMargins.left',
- '[style.margin-right.px]': '_container._contentMargins.right',
- },
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- encapsulation: core.ViewEncapsulation.None,
- },] },
- ];
- /** @nocollapse */
- MatSidenavContent.ctorParameters = function () { return [
- { type: core.ChangeDetectorRef },
- { type: MatSidenavContainer, decorators: [{ type: core.Inject, args: [core.forwardRef((/**
- * @return {?}
- */
- function () { return MatSidenavContainer; })),] }] },
- { type: core.ElementRef },
- { type: scrolling.ScrollDispatcher },
- { type: core.NgZone }
- ]; };
- return MatSidenavContent;
- }(MatDrawerContent));
- var MatSidenav = /** @class */ (function (_super) {
- __extends(MatSidenav, _super);
- function MatSidenav() {
- var _this = _super !== null && _super.apply(this, arguments) || this;
- _this._fixedInViewport = false;
- _this._fixedTopGap = 0;
- _this._fixedBottomGap = 0;
- return _this;
- }
- Object.defineProperty(MatSidenav.prototype, "fixedInViewport", {
- /** Whether the sidenav is fixed in the viewport. */
- get: /**
- * Whether the sidenav is fixed in the viewport.
- * @return {?}
- */
- function () { return this._fixedInViewport; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) { this._fixedInViewport = coercion.coerceBooleanProperty(value); },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatSidenav.prototype, "fixedTopGap", {
- /**
- * The gap between the top of the sidenav and the top of the viewport when the sidenav is in fixed
- * mode.
- */
- get: /**
- * The gap between the top of the sidenav and the top of the viewport when the sidenav is in fixed
- * mode.
- * @return {?}
- */
- function () { return this._fixedTopGap; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) { this._fixedTopGap = coercion.coerceNumberProperty(value); },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatSidenav.prototype, "fixedBottomGap", {
- /**
- * The gap between the bottom of the sidenav and the bottom of the viewport when the sidenav is in
- * fixed mode.
- */
- get: /**
- * The gap between the bottom of the sidenav and the bottom of the viewport when the sidenav is in
- * fixed mode.
- * @return {?}
- */
- function () { return this._fixedBottomGap; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) { this._fixedBottomGap = coercion.coerceNumberProperty(value); },
- enumerable: true,
- configurable: true
- });
- MatSidenav.decorators = [
- { type: core.Component, args: [{selector: 'mat-sidenav',
- exportAs: 'matSidenav',
- template: "<div class=\"mat-drawer-inner-container\"><ng-content></ng-content></div>",
- animations: [matDrawerAnimations.transformDrawer],
- host: {
- 'class': 'mat-drawer mat-sidenav',
- 'tabIndex': '-1',
- // must prevent the browser from aligning text based on value
- '[attr.align]': 'null',
- '[class.mat-drawer-end]': 'position === "end"',
- '[class.mat-drawer-over]': 'mode === "over"',
- '[class.mat-drawer-push]': 'mode === "push"',
- '[class.mat-drawer-side]': 'mode === "side"',
- '[class.mat-drawer-opened]': 'opened',
- '[class.mat-sidenav-fixed]': 'fixedInViewport',
- '[style.top.px]': 'fixedInViewport ? fixedTopGap : null',
- '[style.bottom.px]': 'fixedInViewport ? fixedBottomGap : null',
- },
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- encapsulation: core.ViewEncapsulation.None,
- },] },
- ];
- MatSidenav.propDecorators = {
- fixedInViewport: [{ type: core.Input }],
- fixedTopGap: [{ type: core.Input }],
- fixedBottomGap: [{ type: core.Input }]
- };
- return MatSidenav;
- }(MatDrawer));
- var MatSidenavContainer = /** @class */ (function (_super) {
- __extends(MatSidenavContainer, _super);
- function MatSidenavContainer() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- MatSidenavContainer.decorators = [
- { type: core.Component, args: [{selector: 'mat-sidenav-container',
- exportAs: 'matSidenavContainer',
- 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>",
- 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}"],
- host: {
- 'class': 'mat-drawer-container mat-sidenav-container',
- '[class.mat-drawer-container-explicit-backdrop]': '_backdropOverride',
- },
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- encapsulation: core.ViewEncapsulation.None,
- },] },
- ];
- MatSidenavContainer.propDecorators = {
- _drawers: [{ type: core.ContentChildren, args: [MatSidenav,] }],
- _content: [{ type: core.ContentChild, args: [MatSidenavContent, { static: false },] }]
- };
- return MatSidenavContainer;
- }(MatDrawerContainer));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var MatSidenavModule = /** @class */ (function () {
- function MatSidenavModule() {
- }
- MatSidenavModule.decorators = [
- { type: core.NgModule, args: [{
- imports: [
- common.CommonModule,
- MatCommonModule,
- scrolling.ScrollingModule,
- platform.PlatformModule,
- ],
- exports: [
- MatCommonModule,
- MatDrawer,
- MatDrawerContainer,
- MatDrawerContent,
- MatSidenav,
- MatSidenavContainer,
- MatSidenavContent,
- ],
- declarations: [
- MatDrawer,
- MatDrawerContainer,
- MatDrawerContent,
- MatSidenav,
- MatSidenavContainer,
- MatSidenavContent,
- ],
- },] },
- ];
- return MatSidenavModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Injection token to be used to override the default options for `mat-slide-toggle`.
- * @type {?}
- */
- var MAT_SLIDE_TOGGLE_DEFAULT_OPTIONS = new core.InjectionToken('mat-slide-toggle-default-options', {
- providedIn: 'root',
- factory: (/**
- * @return {?}
- */
- function () { return ({ disableToggleValue: false, disableDragValue: false }); })
- });
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- // Increasing integer for generating unique ids for slide-toggle components.
- /** @type {?} */
- var nextUniqueId$8 = 0;
- /**
- * \@docs-private
- * @type {?}
- */
- var MAT_SLIDE_TOGGLE_VALUE_ACCESSOR = {
- provide: forms.NG_VALUE_ACCESSOR,
- useExisting: core.forwardRef((/**
- * @return {?}
- */
- function () { return MatSlideToggle; })),
- multi: true
- };
- /**
- * Change event object emitted by a MatSlideToggle.
- */
- var /**
- * Change event object emitted by a MatSlideToggle.
- */
- MatSlideToggleChange = /** @class */ (function () {
- function MatSlideToggleChange(source, checked) {
- this.source = source;
- this.checked = checked;
- }
- return MatSlideToggleChange;
- }());
- // Boilerplate for applying mixins to MatSlideToggle.
- /**
- * \@docs-private
- */
- var
- // Boilerplate for applying mixins to MatSlideToggle.
- /**
- * \@docs-private
- */
- MatSlideToggleBase = /** @class */ (function () {
- function MatSlideToggleBase(_elementRef) {
- this._elementRef = _elementRef;
- }
- return MatSlideToggleBase;
- }());
- /** @type {?} */
- var _MatSlideToggleMixinBase = mixinTabIndex(mixinColor(mixinDisableRipple(mixinDisabled(MatSlideToggleBase)), 'accent'));
- /**
- * Represents a slidable "switch" toggle that can be moved between on and off.
- */
- var MatSlideToggle = /** @class */ (function (_super) {
- __extends(MatSlideToggle, _super);
- function MatSlideToggle(elementRef, _focusMonitor, _changeDetectorRef, tabIndex, _ngZone, defaults, _animationMode, _dir) {
- var _this = _super.call(this, elementRef) || this;
- _this._focusMonitor = _focusMonitor;
- _this._changeDetectorRef = _changeDetectorRef;
- _this._ngZone = _ngZone;
- _this.defaults = defaults;
- _this._animationMode = _animationMode;
- _this._dir = _dir;
- _this._onChange = (/**
- * @param {?} _
- * @return {?}
- */
- function (_) { });
- _this._onTouched = (/**
- * @return {?}
- */
- function () { });
- _this._uniqueId = "mat-slide-toggle-" + ++nextUniqueId$8;
- _this._required = false;
- _this._checked = false;
- /**
- * Whether the thumb is currently being dragged.
- */
- _this._dragging = false;
- /**
- * Name value will be applied to the input element if present.
- */
- _this.name = null;
- /**
- * A unique id for the slide-toggle input. If none is supplied, it will be auto-generated.
- */
- _this.id = _this._uniqueId;
- /**
- * Whether the label should appear after or before the slide-toggle. Defaults to 'after'.
- */
- _this.labelPosition = 'after';
- /**
- * Used to set the aria-label attribute on the underlying input element.
- */
- _this.ariaLabel = null;
- /**
- * Used to set the aria-labelledby attribute on the underlying input element.
- */
- _this.ariaLabelledby = null;
- /**
- * An event will be dispatched each time the slide-toggle changes its value.
- */
- _this.change = new core.EventEmitter();
- /**
- * An event will be dispatched each time the slide-toggle input is toggled.
- * This event is always emitted when the user toggles the slide toggle, but this does not mean
- * the slide toggle's value has changed. The event does not fire when the user drags to change
- * the slide toggle value.
- */
- _this.toggleChange = new core.EventEmitter();
- /**
- * An event will be dispatched each time the slide-toggle is dragged.
- * This event is always emitted when the user drags the slide toggle to make a change greater
- * than 50%. It does not mean the slide toggle's value is changed. The event is not emitted when
- * the user toggles the slide toggle to change its value.
- */
- _this.dragChange = new core.EventEmitter();
- _this.tabIndex = parseInt(tabIndex) || 0;
- return _this;
- }
- Object.defineProperty(MatSlideToggle.prototype, "required", {
- /** Whether the slide-toggle is required. */
- get: /**
- * Whether the slide-toggle is required.
- * @return {?}
- */
- function () { return this._required; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) { this._required = coercion.coerceBooleanProperty(value); },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatSlideToggle.prototype, "checked", {
- /** Whether the slide-toggle element is checked or not. */
- get: /**
- * Whether the slide-toggle element is checked or not.
- * @return {?}
- */
- function () { return this._checked; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._checked = coercion.coerceBooleanProperty(value);
- this._changeDetectorRef.markForCheck();
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatSlideToggle.prototype, "inputId", {
- /** Returns the unique id for the visual hidden input. */
- get: /**
- * Returns the unique id for the visual hidden input.
- * @return {?}
- */
- function () { return (this.id || this._uniqueId) + "-input"; },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- MatSlideToggle.prototype.ngAfterContentInit = /**
- * @return {?}
- */
- function () {
- var _this = this;
- this._focusMonitor
- .monitor(this._elementRef, true)
- .subscribe((/**
- * @param {?} focusOrigin
- * @return {?}
- */
- function (focusOrigin) {
- if (!focusOrigin) {
- // When a focused element becomes disabled, the browser *immediately* fires a blur event.
- // Angular does not expect events to be raised during change detection, so any state
- // change (such as a form control's 'ng-touched') will cause a changed-after-checked
- // error. See https://github.com/angular/angular/issues/17793. To work around this,
- // we defer telling the form control it has been touched until the next tick.
- Promise.resolve().then((/**
- * @return {?}
- */
- function () { return _this._onTouched(); }));
- }
- }));
- };
- /**
- * @return {?}
- */
- MatSlideToggle.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- this._focusMonitor.stopMonitoring(this._elementRef);
- };
- /** Method being called whenever the underlying input emits a change event. */
- /**
- * Method being called whenever the underlying input emits a change event.
- * @param {?} event
- * @return {?}
- */
- MatSlideToggle.prototype._onChangeEvent = /**
- * Method being called whenever the underlying input emits a change event.
- * @param {?} event
- * @return {?}
- */
- function (event) {
- // We always have to stop propagation on the change event.
- // Otherwise the change event, from the input element, will bubble up and
- // emit its event object to the component's `change` output.
- event.stopPropagation();
- if (!this._dragging) {
- this.toggleChange.emit();
- }
- // Releasing the pointer over the `<label>` element while dragging triggers another
- // click event on the `<label>` element. This means that the checked state of the underlying
- // input changed unintentionally and needs to be changed back. Or when the slide toggle's config
- // disabled toggle change event by setting `disableToggleValue: true`, the slide toggle's value
- // does not change, and the checked state of the underlying input needs to be changed back.
- if (this._dragging || this.defaults.disableToggleValue) {
- this._inputElement.nativeElement.checked = this.checked;
- return;
- }
- // Sync the value from the underlying input element with the component instance.
- this.checked = this._inputElement.nativeElement.checked;
- // Emit our custom change event only if the underlying input emitted one. This ensures that
- // there is no change event, when the checked state changes programmatically.
- this._emitChangeEvent();
- };
- /** Method being called whenever the slide-toggle has been clicked. */
- /**
- * Method being called whenever the slide-toggle has been clicked.
- * @param {?} event
- * @return {?}
- */
- MatSlideToggle.prototype._onInputClick = /**
- * Method being called whenever the slide-toggle has been clicked.
- * @param {?} event
- * @return {?}
- */
- function (event) {
- // We have to stop propagation for click events on the visual hidden input element.
- // By default, when a user clicks on a label element, a generated click event will be
- // dispatched on the associated input element. Since we are using a label element as our
- // root container, the click event on the `slide-toggle` will be executed twice.
- // The real click event will bubble up, and the generated click event also tries to bubble up.
- // This will lead to multiple click events.
- // Preventing bubbling for the second event will solve that issue.
- event.stopPropagation();
- };
- /** Implemented as part of ControlValueAccessor. */
- /**
- * Implemented as part of ControlValueAccessor.
- * @param {?} value
- * @return {?}
- */
- MatSlideToggle.prototype.writeValue = /**
- * Implemented as part of ControlValueAccessor.
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this.checked = !!value;
- };
- /** Implemented as part of ControlValueAccessor. */
- /**
- * Implemented as part of ControlValueAccessor.
- * @param {?} fn
- * @return {?}
- */
- MatSlideToggle.prototype.registerOnChange = /**
- * Implemented as part of ControlValueAccessor.
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- this._onChange = fn;
- };
- /** Implemented as part of ControlValueAccessor. */
- /**
- * Implemented as part of ControlValueAccessor.
- * @param {?} fn
- * @return {?}
- */
- MatSlideToggle.prototype.registerOnTouched = /**
- * Implemented as part of ControlValueAccessor.
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- this._onTouched = fn;
- };
- /** Implemented as a part of ControlValueAccessor. */
- /**
- * Implemented as a part of ControlValueAccessor.
- * @param {?} isDisabled
- * @return {?}
- */
- MatSlideToggle.prototype.setDisabledState = /**
- * Implemented as a part of ControlValueAccessor.
- * @param {?} isDisabled
- * @return {?}
- */
- function (isDisabled) {
- this.disabled = isDisabled;
- this._changeDetectorRef.markForCheck();
- };
- /** Focuses the slide-toggle. */
- /**
- * Focuses the slide-toggle.
- * @param {?=} options
- * @return {?}
- */
- MatSlideToggle.prototype.focus = /**
- * Focuses the slide-toggle.
- * @param {?=} options
- * @return {?}
- */
- function (options) {
- this._focusMonitor.focusVia(this._inputElement, 'keyboard', options);
- };
- /** Toggles the checked state of the slide-toggle. */
- /**
- * Toggles the checked state of the slide-toggle.
- * @return {?}
- */
- MatSlideToggle.prototype.toggle = /**
- * Toggles the checked state of the slide-toggle.
- * @return {?}
- */
- function () {
- this.checked = !this.checked;
- this._onChange(this.checked);
- };
- /**
- * Emits a change event on the `change` output. Also notifies the FormControl about the change.
- */
- /**
- * Emits a change event on the `change` output. Also notifies the FormControl about the change.
- * @private
- * @return {?}
- */
- MatSlideToggle.prototype._emitChangeEvent = /**
- * Emits a change event on the `change` output. Also notifies the FormControl about the change.
- * @private
- * @return {?}
- */
- function () {
- this._onChange(this.checked);
- this.change.emit(new MatSlideToggleChange(this, this.checked));
- };
- /** Retrieves the percentage of thumb from the moved distance. Percentage as fraction of 100. */
- /**
- * Retrieves the percentage of thumb from the moved distance. Percentage as fraction of 100.
- * @private
- * @param {?} distance
- * @return {?}
- */
- MatSlideToggle.prototype._getDragPercentage = /**
- * Retrieves the percentage of thumb from the moved distance. Percentage as fraction of 100.
- * @private
- * @param {?} distance
- * @return {?}
- */
- function (distance) {
- /** @type {?} */
- var percentage = (distance / this._thumbBarWidth) * 100;
- // When the toggle was initially checked, then we have to start the drag at the end.
- if (this._previousChecked) {
- percentage += 100;
- }
- return Math.max(0, Math.min(percentage, 100));
- };
- /**
- * @return {?}
- */
- MatSlideToggle.prototype._onDragStart = /**
- * @return {?}
- */
- function () {
- if (!this.disabled && !this._dragging) {
- /** @type {?} */
- var thumbEl = this._thumbEl.nativeElement;
- this._thumbBarWidth = this._thumbBarEl.nativeElement.clientWidth - thumbEl.clientWidth;
- thumbEl.classList.add('mat-dragging');
- this._previousChecked = this.checked;
- this._dragging = true;
- }
- };
- /**
- * @param {?} event
- * @return {?}
- */
- MatSlideToggle.prototype._onDrag = /**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- if (this._dragging) {
- /** @type {?} */
- var direction = this._dir && this._dir.value === 'rtl' ? -1 : 1;
- this._dragPercentage = this._getDragPercentage(event.deltaX * direction);
- // Calculate the moved distance based on the thumb bar width.
- /** @type {?} */
- var dragX = (this._dragPercentage / 100) * this._thumbBarWidth * direction;
- this._thumbEl.nativeElement.style.transform = "translate3d(" + dragX + "px, 0, 0)";
- }
- };
- /**
- * @return {?}
- */
- MatSlideToggle.prototype._onDragEnd = /**
- * @return {?}
- */
- function () {
- var _this = this;
- if (this._dragging) {
- /** @type {?} */
- var newCheckedValue = this._dragPercentage > 50;
- if (newCheckedValue !== this.checked) {
- this.dragChange.emit();
- if (!this.defaults.disableDragValue) {
- this.checked = newCheckedValue;
- this._emitChangeEvent();
- }
- }
- // The drag should be stopped outside of the current event handler, otherwise the
- // click event will be fired before it and will revert the drag change.
- this._ngZone.runOutsideAngular((/**
- * @return {?}
- */
- function () { return setTimeout((/**
- * @return {?}
- */
- function () {
- if (_this._dragging) {
- _this._dragging = false;
- _this._thumbEl.nativeElement.classList.remove('mat-dragging');
- // Reset the transform because the component will take care
- // of the thumb position after drag.
- _this._thumbEl.nativeElement.style.transform = '';
- }
- })); }));
- }
- };
- /** Method being called whenever the label text changes. */
- /**
- * Method being called whenever the label text changes.
- * @return {?}
- */
- MatSlideToggle.prototype._onLabelTextChange = /**
- * Method being called whenever the label text changes.
- * @return {?}
- */
- function () {
- // Since the event of the `cdkObserveContent` directive runs outside of the zone, the
- // slide-toggle component will be only marked for check, but no actual change detection runs
- // automatically. Instead of going back into the zone in order to trigger a change detection
- // which causes *all* components to be checked (if explicitly marked or not using OnPush),
- // we only trigger an explicit change detection for the slide-toggle view and it's children.
- this._changeDetectorRef.detectChanges();
- };
- MatSlideToggle.decorators = [
- { type: core.Component, args: [{selector: 'mat-slide-toggle',
- exportAs: 'matSlideToggle',
- host: {
- 'class': 'mat-slide-toggle',
- '[id]': 'id',
- // Needs to be `-1` so it can still receive programmatic focus.
- '[attr.tabindex]': 'disabled ? null : -1',
- '[class.mat-checked]': 'checked',
- '[class.mat-disabled]': 'disabled',
- '[class.mat-slide-toggle-label-before]': 'labelPosition == "before"',
- '[class._mat-animation-noopable]': '_animationMode === "NoopAnimations"',
- '(focus)': '_inputElement.nativeElement.focus()',
- },
- 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\"> </span><ng-content></ng-content></span></label>",
- 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}}"],
- providers: [MAT_SLIDE_TOGGLE_VALUE_ACCESSOR],
- inputs: ['disabled', 'disableRipple', 'color', 'tabIndex'],
- encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- },] },
- ];
- /** @nocollapse */
- MatSlideToggle.ctorParameters = function () { return [
- { type: core.ElementRef },
- { type: a11y.FocusMonitor },
- { type: core.ChangeDetectorRef },
- { type: String, decorators: [{ type: core.Attribute, args: ['tabindex',] }] },
- { type: core.NgZone },
- { type: undefined, decorators: [{ type: core.Inject, args: [MAT_SLIDE_TOGGLE_DEFAULT_OPTIONS,] }] },
- { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] },
- { type: bidi.Directionality, decorators: [{ type: core.Optional }] }
- ]; };
- MatSlideToggle.propDecorators = {
- _thumbEl: [{ type: core.ViewChild, args: ['thumbContainer', { static: false },] }],
- _thumbBarEl: [{ type: core.ViewChild, args: ['toggleBar', { static: false },] }],
- name: [{ type: core.Input }],
- id: [{ type: core.Input }],
- labelPosition: [{ type: core.Input }],
- ariaLabel: [{ type: core.Input, args: ['aria-label',] }],
- ariaLabelledby: [{ type: core.Input, args: ['aria-labelledby',] }],
- required: [{ type: core.Input }],
- checked: [{ type: core.Input }],
- change: [{ type: core.Output }],
- toggleChange: [{ type: core.Output }],
- dragChange: [{ type: core.Output }],
- _inputElement: [{ type: core.ViewChild, args: ['input', { static: false },] }]
- };
- return MatSlideToggle;
- }(_MatSlideToggleMixinBase));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /** @type {?} */
- var MAT_SLIDE_TOGGLE_REQUIRED_VALIDATOR = {
- provide: forms.NG_VALIDATORS,
- useExisting: core.forwardRef((/**
- * @return {?}
- */
- function () { return MatSlideToggleRequiredValidator; })),
- multi: true
- };
- /**
- * Validator for Material slide-toggle components with the required attribute in a
- * template-driven form. The default validator for required form controls asserts
- * that the control value is not undefined but that is not appropriate for a slide-toggle
- * where the value is always defined.
- *
- * Required slide-toggle form controls are valid when checked.
- */
- var MatSlideToggleRequiredValidator = /** @class */ (function (_super) {
- __extends(MatSlideToggleRequiredValidator, _super);
- function MatSlideToggleRequiredValidator() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- MatSlideToggleRequiredValidator.decorators = [
- { type: core.Directive, args: [{
- selector: "mat-slide-toggle[required][formControlName],\n mat-slide-toggle[required][formControl], mat-slide-toggle[required][ngModel]",
- providers: [MAT_SLIDE_TOGGLE_REQUIRED_VALIDATOR],
- },] },
- ];
- return MatSlideToggleRequiredValidator;
- }(forms.CheckboxRequiredValidator));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * This module is used by both original and MDC-based slide-toggle implementations.
- */
- var _MatSlideToggleRequiredValidatorModule = /** @class */ (function () {
- function _MatSlideToggleRequiredValidatorModule() {
- }
- _MatSlideToggleRequiredValidatorModule.decorators = [
- { type: core.NgModule, args: [{
- exports: [MatSlideToggleRequiredValidator],
- declarations: [MatSlideToggleRequiredValidator],
- },] },
- ];
- return _MatSlideToggleRequiredValidatorModule;
- }());
- var MatSlideToggleModule = /** @class */ (function () {
- function MatSlideToggleModule() {
- }
- MatSlideToggleModule.decorators = [
- { type: core.NgModule, args: [{
- imports: [
- _MatSlideToggleRequiredValidatorModule,
- MatRippleModule,
- MatCommonModule,
- observers.ObserversModule,
- ],
- exports: [
- _MatSlideToggleRequiredValidatorModule,
- MatSlideToggle,
- MatCommonModule
- ],
- declarations: [MatSlideToggle],
- providers: [
- { provide: platformBrowser.HAMMER_GESTURE_CONFIG, useClass: GestureConfig }
- ],
- },] },
- ];
- return MatSlideToggleModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Visually, a 30px separation between tick marks looks best. This is very subjective but it is
- * the default separation we chose.
- * @type {?}
- */
- var MIN_AUTO_TICK_SEPARATION = 30;
- /**
- * The thumb gap size for a disabled slider.
- * @type {?}
- */
- var DISABLED_THUMB_GAP = 7;
- /**
- * The thumb gap size for a non-active slider at its minimum value.
- * @type {?}
- */
- var MIN_VALUE_NONACTIVE_THUMB_GAP = 7;
- /**
- * The thumb gap size for an active slider at its minimum value.
- * @type {?}
- */
- var MIN_VALUE_ACTIVE_THUMB_GAP = 10;
- /**
- * Provider Expression that allows mat-slider to register as a ControlValueAccessor.
- * This allows it to support [(ngModel)] and [formControl].
- * \@docs-private
- * @type {?}
- */
- var MAT_SLIDER_VALUE_ACCESSOR = {
- provide: forms.NG_VALUE_ACCESSOR,
- useExisting: core.forwardRef((/**
- * @return {?}
- */
- function () { return MatSlider; })),
- multi: true
- };
- /**
- * A simple change event emitted by the MatSlider component.
- */
- var /**
- * A simple change event emitted by the MatSlider component.
- */
- MatSliderChange = /** @class */ (function () {
- function MatSliderChange() {
- }
- return MatSliderChange;
- }());
- // Boilerplate for applying mixins to MatSlider.
- /**
- * \@docs-private
- */
- var
- // Boilerplate for applying mixins to MatSlider.
- /**
- * \@docs-private
- */
- MatSliderBase = /** @class */ (function () {
- function MatSliderBase(_elementRef) {
- this._elementRef = _elementRef;
- }
- return MatSliderBase;
- }());
- /** @type {?} */
- var _MatSliderMixinBase = mixinTabIndex(mixinColor(mixinDisabled(MatSliderBase), 'accent'));
- /**
- * Allows users to select from a range of values by moving the slider thumb. It is similar in
- * behavior to the native `<input type="range">` element.
- */
- var MatSlider = /** @class */ (function (_super) {
- __extends(MatSlider, _super);
- function MatSlider(elementRef, _focusMonitor, _changeDetectorRef, _dir, tabIndex, _animationMode) {
- var _this = _super.call(this, elementRef) || this;
- _this._focusMonitor = _focusMonitor;
- _this._changeDetectorRef = _changeDetectorRef;
- _this._dir = _dir;
- _this._animationMode = _animationMode;
- _this._invert = false;
- _this._max = 100;
- _this._min = 0;
- _this._step = 1;
- _this._thumbLabel = false;
- _this._tickInterval = 0;
- _this._value = null;
- _this._vertical = false;
- /**
- * Event emitted when the slider value has changed.
- */
- _this.change = new core.EventEmitter();
- /**
- * Event emitted when the slider thumb moves.
- */
- _this.input = new core.EventEmitter();
- /**
- * Emits when the raw value of the slider changes. This is here primarily
- * to facilitate the two-way binding for the `value` input.
- * \@docs-private
- */
- _this.valueChange = new core.EventEmitter();
- /**
- * onTouch function registered via registerOnTouch (ControlValueAccessor).
- */
- _this.onTouched = (/**
- * @return {?}
- */
- function () { });
- _this._percent = 0;
- /**
- * Whether or not the thumb is sliding.
- * Used to determine if there should be a transition for the thumb and fill track.
- */
- _this._isSliding = false;
- /**
- * Whether or not the slider is active (clicked or sliding).
- * Used to shrink and grow the thumb as according to the Material Design spec.
- */
- _this._isActive = false;
- /**
- * The size of a tick interval as a percentage of the size of the track.
- */
- _this._tickIntervalPercent = 0;
- /**
- * The dimensions of the slider.
- */
- _this._sliderDimensions = null;
- _this._controlValueAccessorChangeFn = (/**
- * @return {?}
- */
- function () { });
- /**
- * Subscription to the Directionality change EventEmitter.
- */
- _this._dirChangeSubscription = rxjs.Subscription.EMPTY;
- _this.tabIndex = parseInt(tabIndex) || 0;
- return _this;
- }
- Object.defineProperty(MatSlider.prototype, "invert", {
- /** Whether the slider is inverted. */
- get: /**
- * Whether the slider is inverted.
- * @return {?}
- */
- function () { return this._invert; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._invert = coercion.coerceBooleanProperty(value);
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatSlider.prototype, "max", {
- /** The maximum value that the slider can have. */
- get: /**
- * The maximum value that the slider can have.
- * @return {?}
- */
- function () { return this._max; },
- set: /**
- * @param {?} v
- * @return {?}
- */
- function (v) {
- this._max = coercion.coerceNumberProperty(v, this._max);
- this._percent = this._calculatePercentage(this._value);
- // Since this also modifies the percentage, we need to let the change detection know.
- this._changeDetectorRef.markForCheck();
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatSlider.prototype, "min", {
- /** The minimum value that the slider can have. */
- get: /**
- * The minimum value that the slider can have.
- * @return {?}
- */
- function () { return this._min; },
- set: /**
- * @param {?} v
- * @return {?}
- */
- function (v) {
- this._min = coercion.coerceNumberProperty(v, this._min);
- // If the value wasn't explicitly set by the user, set it to the min.
- if (this._value === null) {
- this.value = this._min;
- }
- this._percent = this._calculatePercentage(this._value);
- // Since this also modifies the percentage, we need to let the change detection know.
- this._changeDetectorRef.markForCheck();
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatSlider.prototype, "step", {
- /** The values at which the thumb will snap. */
- get: /**
- * The values at which the thumb will snap.
- * @return {?}
- */
- function () { return this._step; },
- set: /**
- * @param {?} v
- * @return {?}
- */
- function (v) {
- this._step = coercion.coerceNumberProperty(v, this._step);
- if (this._step % 1 !== 0) {
- this._roundToDecimal = (/** @type {?} */ (this._step.toString().split('.').pop())).length;
- }
- // Since this could modify the label, we need to notify the change detection.
- this._changeDetectorRef.markForCheck();
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatSlider.prototype, "thumbLabel", {
- /** Whether or not to show the thumb label. */
- get: /**
- * Whether or not to show the thumb label.
- * @return {?}
- */
- function () { return this._thumbLabel; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) { this._thumbLabel = coercion.coerceBooleanProperty(value); },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatSlider.prototype, "tickInterval", {
- /**
- * How often to show ticks. Relative to the step so that a tick always appears on a step.
- * Ex: Tick interval of 4 with a step of 3 will draw a tick every 4 steps (every 12 values).
- */
- get: /**
- * How often to show ticks. Relative to the step so that a tick always appears on a step.
- * Ex: Tick interval of 4 with a step of 3 will draw a tick every 4 steps (every 12 values).
- * @return {?}
- */
- function () { return this._tickInterval; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- if (value === 'auto') {
- this._tickInterval = 'auto';
- }
- else if (typeof value === 'number' || typeof value === 'string') {
- this._tickInterval = coercion.coerceNumberProperty(value, (/** @type {?} */ (this._tickInterval)));
- }
- else {
- this._tickInterval = 0;
- }
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatSlider.prototype, "value", {
- /** Value of the slider. */
- get: /**
- * Value of the slider.
- * @return {?}
- */
- function () {
- // If the value needs to be read and it is still uninitialized, initialize it to the min.
- if (this._value === null) {
- this.value = this._min;
- }
- return this._value;
- },
- set: /**
- * @param {?} v
- * @return {?}
- */
- function (v) {
- if (v !== this._value) {
- /** @type {?} */
- var value = coercion.coerceNumberProperty(v);
- // While incrementing by a decimal we can end up with values like 33.300000000000004.
- // Truncate it to ensure that it matches the label and to make it easier to work with.
- if (this._roundToDecimal) {
- value = parseFloat(value.toFixed(this._roundToDecimal));
- }
- this._value = value;
- this._percent = this._calculatePercentage(this._value);
- // Since this also modifies the percentage, we need to let the change detection know.
- this._changeDetectorRef.markForCheck();
- }
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatSlider.prototype, "vertical", {
- /** Whether the slider is vertical. */
- get: /**
- * Whether the slider is vertical.
- * @return {?}
- */
- function () { return this._vertical; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._vertical = coercion.coerceBooleanProperty(value);
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatSlider.prototype, "displayValue", {
- /** The value to be used for display purposes. */
- get: /**
- * The value to be used for display purposes.
- * @return {?}
- */
- function () {
- if (this.displayWith) {
- return this.displayWith(this.value);
- }
- // Note that this could be improved further by rounding something like 0.999 to 1 or
- // 0.899 to 0.9, however it is very performance sensitive, because it gets called on
- // every change detection cycle.
- if (this._roundToDecimal && this.value && this.value % 1 !== 0) {
- return this.value.toFixed(this._roundToDecimal);
- }
- return this.value || 0;
- },
- enumerable: true,
- configurable: true
- });
- /** set focus to the host element */
- /**
- * set focus to the host element
- * @param {?=} options
- * @return {?}
- */
- MatSlider.prototype.focus = /**
- * set focus to the host element
- * @param {?=} options
- * @return {?}
- */
- function (options) {
- this._focusHostElement(options);
- };
- /** blur the host element */
- /**
- * blur the host element
- * @return {?}
- */
- MatSlider.prototype.blur = /**
- * blur the host element
- * @return {?}
- */
- function () {
- this._blurHostElement();
- };
- Object.defineProperty(MatSlider.prototype, "percent", {
- /** The percentage of the slider that coincides with the value. */
- get: /**
- * The percentage of the slider that coincides with the value.
- * @return {?}
- */
- function () { return this._clamp(this._percent); },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatSlider.prototype, "_invertAxis", {
- /**
- * Whether the axis of the slider is inverted.
- * (i.e. whether moving the thumb in the positive x or y direction decreases the slider's value).
- */
- get: /**
- * Whether the axis of the slider is inverted.
- * (i.e. whether moving the thumb in the positive x or y direction decreases the slider's value).
- * @return {?}
- */
- function () {
- // Standard non-inverted mode for a vertical slider should be dragging the thumb from bottom to
- // top. However from a y-axis standpoint this is inverted.
- return this.vertical ? !this.invert : this.invert;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatSlider.prototype, "_isMinValue", {
- /** Whether the slider is at its minimum value. */
- get: /**
- * Whether the slider is at its minimum value.
- * @return {?}
- */
- function () {
- return this.percent === 0;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatSlider.prototype, "_thumbGap", {
- /**
- * The amount of space to leave between the slider thumb and the track fill & track background
- * elements.
- */
- get: /**
- * The amount of space to leave between the slider thumb and the track fill & track background
- * elements.
- * @return {?}
- */
- function () {
- if (this.disabled) {
- return DISABLED_THUMB_GAP;
- }
- if (this._isMinValue && !this.thumbLabel) {
- return this._isActive ? MIN_VALUE_ACTIVE_THUMB_GAP : MIN_VALUE_NONACTIVE_THUMB_GAP;
- }
- return 0;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatSlider.prototype, "_trackBackgroundStyles", {
- /** CSS styles for the track background element. */
- get: /**
- * CSS styles for the track background element.
- * @return {?}
- */
- function () {
- /** @type {?} */
- var axis = this.vertical ? 'Y' : 'X';
- /** @type {?} */
- var scale = this.vertical ? "1, " + (1 - this.percent) + ", 1" : 1 - this.percent + ", 1, 1";
- /** @type {?} */
- var sign = this._shouldInvertMouseCoords() ? '-' : '';
- return {
- // scale3d avoids some rendering issues in Chrome. See #12071.
- transform: "translate" + axis + "(" + sign + this._thumbGap + "px) scale3d(" + scale + ")"
- };
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatSlider.prototype, "_trackFillStyles", {
- /** CSS styles for the track fill element. */
- get: /**
- * CSS styles for the track fill element.
- * @return {?}
- */
- function () {
- /** @type {?} */
- var axis = this.vertical ? 'Y' : 'X';
- /** @type {?} */
- var scale = this.vertical ? "1, " + this.percent + ", 1" : this.percent + ", 1, 1";
- /** @type {?} */
- var sign = this._shouldInvertMouseCoords() ? '' : '-';
- return {
- // scale3d avoids some rendering issues in Chrome. See #12071.
- transform: "translate" + axis + "(" + sign + this._thumbGap + "px) scale3d(" + scale + ")"
- };
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatSlider.prototype, "_ticksContainerStyles", {
- /** CSS styles for the ticks container element. */
- get: /**
- * CSS styles for the ticks container element.
- * @return {?}
- */
- function () {
- /** @type {?} */
- var axis = this.vertical ? 'Y' : 'X';
- // For a horizontal slider in RTL languages we push the ticks container off the left edge
- // instead of the right edge to avoid causing a horizontal scrollbar to appear.
- /** @type {?} */
- var sign = !this.vertical && this._getDirection() == 'rtl' ? '' : '-';
- /** @type {?} */
- var offset = this._tickIntervalPercent / 2 * 100;
- return {
- 'transform': "translate" + axis + "(" + sign + offset + "%)"
- };
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatSlider.prototype, "_ticksStyles", {
- /** CSS styles for the ticks element. */
- get: /**
- * CSS styles for the ticks element.
- * @return {?}
- */
- function () {
- /** @type {?} */
- var tickSize = this._tickIntervalPercent * 100;
- /** @type {?} */
- var backgroundSize = this.vertical ? "2px " + tickSize + "%" : tickSize + "% 2px";
- /** @type {?} */
- var axis = this.vertical ? 'Y' : 'X';
- // Depending on the direction we pushed the ticks container, push the ticks the opposite
- // direction to re-center them but clip off the end edge. In RTL languages we need to flip the
- // ticks 180 degrees so we're really cutting off the end edge abd not the start.
- /** @type {?} */
- var sign = !this.vertical && this._getDirection() == 'rtl' ? '-' : '';
- /** @type {?} */
- var rotate = !this.vertical && this._getDirection() == 'rtl' ? ' rotate(180deg)' : '';
- /** @type {?} */
- var styles = {
- 'backgroundSize': backgroundSize,
- // Without translateZ ticks sometimes jitter as the slider moves on Chrome & Firefox.
- 'transform': "translateZ(0) translate" + axis + "(" + sign + tickSize / 2 + "%)" + rotate
- };
- if (this._isMinValue && this._thumbGap) {
- /** @type {?} */
- var side = this.vertical ?
- (this._invertAxis ? 'Bottom' : 'Top') :
- (this._invertAxis ? 'Right' : 'Left');
- styles["padding" + side] = this._thumbGap + "px";
- }
- return styles;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatSlider.prototype, "_thumbContainerStyles", {
- get: /**
- * @return {?}
- */
- function () {
- /** @type {?} */
- var axis = this.vertical ? 'Y' : 'X';
- // For a horizontal slider in RTL languages we push the thumb container off the left edge
- // instead of the right edge to avoid causing a horizontal scrollbar to appear.
- /** @type {?} */
- var invertOffset = (this._getDirection() == 'rtl' && !this.vertical) ? !this._invertAxis : this._invertAxis;
- /** @type {?} */
- var offset = (invertOffset ? this.percent : 1 - this.percent) * 100;
- return {
- 'transform': "translate" + axis + "(-" + offset + "%)"
- };
- },
- enumerable: true,
- configurable: true
- });
- /**
- * Whether mouse events should be converted to a slider position by calculating their distance
- * from the right or bottom edge of the slider as opposed to the top or left.
- */
- /**
- * Whether mouse events should be converted to a slider position by calculating their distance
- * from the right or bottom edge of the slider as opposed to the top or left.
- * @private
- * @return {?}
- */
- MatSlider.prototype._shouldInvertMouseCoords = /**
- * Whether mouse events should be converted to a slider position by calculating their distance
- * from the right or bottom edge of the slider as opposed to the top or left.
- * @private
- * @return {?}
- */
- function () {
- return (this._getDirection() == 'rtl' && !this.vertical) ? !this._invertAxis : this._invertAxis;
- };
- /** The language direction for this slider element. */
- /**
- * The language direction for this slider element.
- * @private
- * @return {?}
- */
- MatSlider.prototype._getDirection = /**
- * The language direction for this slider element.
- * @private
- * @return {?}
- */
- function () {
- return (this._dir && this._dir.value == 'rtl') ? 'rtl' : 'ltr';
- };
- /**
- * @return {?}
- */
- MatSlider.prototype.ngOnInit = /**
- * @return {?}
- */
- function () {
- var _this = this;
- this._focusMonitor
- .monitor(this._elementRef, true)
- .subscribe((/**
- * @param {?} origin
- * @return {?}
- */
- function (origin) {
- _this._isActive = !!origin && origin !== 'keyboard';
- _this._changeDetectorRef.detectChanges();
- }));
- if (this._dir) {
- this._dirChangeSubscription = this._dir.change.subscribe((/**
- * @return {?}
- */
- function () {
- _this._changeDetectorRef.markForCheck();
- }));
- }
- };
- /**
- * @return {?}
- */
- MatSlider.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- this._focusMonitor.stopMonitoring(this._elementRef);
- this._dirChangeSubscription.unsubscribe();
- };
- /**
- * @return {?}
- */
- MatSlider.prototype._onMouseenter = /**
- * @return {?}
- */
- function () {
- if (this.disabled) {
- return;
- }
- // We save the dimensions of the slider here so we can use them to update the spacing of the
- // ticks and determine where on the slider click and slide events happen.
- this._sliderDimensions = this._getSliderDimensions();
- this._updateTickIntervalPercent();
- };
- /**
- * @param {?} event
- * @return {?}
- */
- MatSlider.prototype._onMousedown = /**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- // Don't do anything if the slider is disabled or the
- // user is using anything other than the main mouse button.
- if (this.disabled || event.button !== 0) {
- return;
- }
- /** @type {?} */
- var oldValue = this.value;
- this._isSliding = false;
- this._focusHostElement();
- this._updateValueFromPosition({ x: event.clientX, y: event.clientY });
- // Emit a change and input event if the value changed.
- if (oldValue != this.value) {
- this._emitInputEvent();
- this._emitChangeEvent();
- }
- };
- /**
- * @param {?} event
- * @return {?}
- */
- MatSlider.prototype._onSlide = /**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- if (this.disabled) {
- return;
- }
- // The slide start event sometimes fails to fire on iOS, so if we're not already in the sliding
- // state, call the slide start handler manually.
- if (!this._isSliding) {
- this._onSlideStart(null);
- }
- // Prevent the slide from selecting anything else.
- event.preventDefault();
- /** @type {?} */
- var oldValue = this.value;
- this._updateValueFromPosition({ x: event.center.x, y: event.center.y });
- // Native range elements always emit `input` events when the value changed while sliding.
- if (oldValue != this.value) {
- this._emitInputEvent();
- }
- };
- /**
- * @param {?} event
- * @return {?}
- */
- MatSlider.prototype._onSlideStart = /**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- if (this.disabled || this._isSliding) {
- return;
- }
- // Simulate mouseenter in case this is a mobile device.
- this._onMouseenter();
- this._isSliding = true;
- this._focusHostElement();
- this._valueOnSlideStart = this.value;
- if (event) {
- this._updateValueFromPosition({ x: event.center.x, y: event.center.y });
- event.preventDefault();
- }
- };
- /**
- * @return {?}
- */
- MatSlider.prototype._onSlideEnd = /**
- * @return {?}
- */
- function () {
- this._isSliding = false;
- if (this._valueOnSlideStart != this.value && !this.disabled) {
- this._emitChangeEvent();
- }
- this._valueOnSlideStart = null;
- };
- /**
- * @return {?}
- */
- MatSlider.prototype._onFocus = /**
- * @return {?}
- */
- function () {
- // We save the dimensions of the slider here so we can use them to update the spacing of the
- // ticks and determine where on the slider click and slide events happen.
- this._sliderDimensions = this._getSliderDimensions();
- this._updateTickIntervalPercent();
- };
- /**
- * @return {?}
- */
- MatSlider.prototype._onBlur = /**
- * @return {?}
- */
- function () {
- this.onTouched();
- };
- /**
- * @param {?} event
- * @return {?}
- */
- MatSlider.prototype._onKeydown = /**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- if (this.disabled || keycodes.hasModifierKey(event)) {
- return;
- }
- /** @type {?} */
- var oldValue = this.value;
- switch (event.keyCode) {
- case keycodes.PAGE_UP:
- this._increment(10);
- break;
- case keycodes.PAGE_DOWN:
- this._increment(-10);
- break;
- case keycodes.END:
- this.value = this.max;
- break;
- case keycodes.HOME:
- this.value = this.min;
- break;
- case keycodes.LEFT_ARROW:
- // NOTE: For a sighted user it would make more sense that when they press an arrow key on an
- // inverted slider the thumb moves in that direction. However for a blind user, nothing
- // about the slider indicates that it is inverted. They will expect left to be decrement,
- // regardless of how it appears on the screen. For speakers ofRTL languages, they probably
- // expect left to mean increment. Therefore we flip the meaning of the side arrow keys for
- // RTL. For inverted sliders we prefer a good a11y experience to having it "look right" for
- // sighted users, therefore we do not swap the meaning.
- this._increment(this._getDirection() == 'rtl' ? 1 : -1);
- break;
- case keycodes.UP_ARROW:
- this._increment(1);
- break;
- case keycodes.RIGHT_ARROW:
- // See comment on LEFT_ARROW about the conditions under which we flip the meaning.
- this._increment(this._getDirection() == 'rtl' ? -1 : 1);
- break;
- case keycodes.DOWN_ARROW:
- this._increment(-1);
- break;
- default:
- // Return if the key is not one that we explicitly handle to avoid calling preventDefault on
- // it.
- return;
- }
- if (oldValue != this.value) {
- this._emitInputEvent();
- this._emitChangeEvent();
- }
- this._isSliding = true;
- event.preventDefault();
- };
- /**
- * @return {?}
- */
- MatSlider.prototype._onKeyup = /**
- * @return {?}
- */
- function () {
- this._isSliding = false;
- };
- /** Increments the slider by the given number of steps (negative number decrements). */
- /**
- * Increments the slider by the given number of steps (negative number decrements).
- * @private
- * @param {?} numSteps
- * @return {?}
- */
- MatSlider.prototype._increment = /**
- * Increments the slider by the given number of steps (negative number decrements).
- * @private
- * @param {?} numSteps
- * @return {?}
- */
- function (numSteps) {
- this.value = this._clamp((this.value || 0) + this.step * numSteps, this.min, this.max);
- };
- /** Calculate the new value from the new physical location. The value will always be snapped. */
- /**
- * Calculate the new value from the new physical location. The value will always be snapped.
- * @private
- * @param {?} pos
- * @return {?}
- */
- MatSlider.prototype._updateValueFromPosition = /**
- * Calculate the new value from the new physical location. The value will always be snapped.
- * @private
- * @param {?} pos
- * @return {?}
- */
- function (pos) {
- if (!this._sliderDimensions) {
- return;
- }
- /** @type {?} */
- var offset = this.vertical ? this._sliderDimensions.top : this._sliderDimensions.left;
- /** @type {?} */
- var size = this.vertical ? this._sliderDimensions.height : this._sliderDimensions.width;
- /** @type {?} */
- var posComponent = this.vertical ? pos.y : pos.x;
- // The exact value is calculated from the event and used to find the closest snap value.
- /** @type {?} */
- var percent = this._clamp((posComponent - offset) / size);
- if (this._shouldInvertMouseCoords()) {
- percent = 1 - percent;
- }
- // Since the steps may not divide cleanly into the max value, if the user
- // slid to 0 or 100 percent, we jump to the min/max value. This approach
- // is slightly more intuitive than using `Math.ceil` below, because it
- // follows the user's pointer closer.
- if (percent === 0) {
- this.value = this.min;
- }
- else if (percent === 1) {
- this.value = this.max;
- }
- else {
- /** @type {?} */
- var exactValue = this._calculateValue(percent);
- // This calculation finds the closest step by finding the closest
- // whole number divisible by the step relative to the min.
- /** @type {?} */
- var closestValue = Math.round((exactValue - this.min) / this.step) * this.step + this.min;
- // The value needs to snap to the min and max.
- this.value = this._clamp(closestValue, this.min, this.max);
- }
- };
- /** Emits a change event if the current value is different from the last emitted value. */
- /**
- * Emits a change event if the current value is different from the last emitted value.
- * @private
- * @return {?}
- */
- MatSlider.prototype._emitChangeEvent = /**
- * Emits a change event if the current value is different from the last emitted value.
- * @private
- * @return {?}
- */
- function () {
- this._controlValueAccessorChangeFn(this.value);
- this.valueChange.emit(this.value);
- this.change.emit(this._createChangeEvent());
- };
- /** Emits an input event when the current value is different from the last emitted value. */
- /**
- * Emits an input event when the current value is different from the last emitted value.
- * @private
- * @return {?}
- */
- MatSlider.prototype._emitInputEvent = /**
- * Emits an input event when the current value is different from the last emitted value.
- * @private
- * @return {?}
- */
- function () {
- this.input.emit(this._createChangeEvent());
- };
- /** Updates the amount of space between ticks as a percentage of the width of the slider. */
- /**
- * Updates the amount of space between ticks as a percentage of the width of the slider.
- * @private
- * @return {?}
- */
- MatSlider.prototype._updateTickIntervalPercent = /**
- * Updates the amount of space between ticks as a percentage of the width of the slider.
- * @private
- * @return {?}
- */
- function () {
- if (!this.tickInterval || !this._sliderDimensions) {
- return;
- }
- if (this.tickInterval == 'auto') {
- /** @type {?} */
- var trackSize = this.vertical ? this._sliderDimensions.height : this._sliderDimensions.width;
- /** @type {?} */
- var pixelsPerStep = trackSize * this.step / (this.max - this.min);
- /** @type {?} */
- var stepsPerTick = Math.ceil(MIN_AUTO_TICK_SEPARATION / pixelsPerStep);
- /** @type {?} */
- var pixelsPerTick = stepsPerTick * this.step;
- this._tickIntervalPercent = pixelsPerTick / trackSize;
- }
- else {
- this._tickIntervalPercent = this.tickInterval * this.step / (this.max - this.min);
- }
- };
- /** Creates a slider change object from the specified value. */
- /**
- * Creates a slider change object from the specified value.
- * @private
- * @param {?=} value
- * @return {?}
- */
- MatSlider.prototype._createChangeEvent = /**
- * Creates a slider change object from the specified value.
- * @private
- * @param {?=} value
- * @return {?}
- */
- function (value) {
- if (value === void 0) { value = this.value; }
- /** @type {?} */
- var event = new MatSliderChange();
- event.source = this;
- event.value = value;
- return event;
- };
- /** Calculates the percentage of the slider that a value is. */
- /**
- * Calculates the percentage of the slider that a value is.
- * @private
- * @param {?} value
- * @return {?}
- */
- MatSlider.prototype._calculatePercentage = /**
- * Calculates the percentage of the slider that a value is.
- * @private
- * @param {?} value
- * @return {?}
- */
- function (value) {
- return ((value || 0) - this.min) / (this.max - this.min);
- };
- /** Calculates the value a percentage of the slider corresponds to. */
- /**
- * Calculates the value a percentage of the slider corresponds to.
- * @private
- * @param {?} percentage
- * @return {?}
- */
- MatSlider.prototype._calculateValue = /**
- * Calculates the value a percentage of the slider corresponds to.
- * @private
- * @param {?} percentage
- * @return {?}
- */
- function (percentage) {
- return this.min + percentage * (this.max - this.min);
- };
- /** Return a number between two numbers. */
- /**
- * Return a number between two numbers.
- * @private
- * @param {?} value
- * @param {?=} min
- * @param {?=} max
- * @return {?}
- */
- MatSlider.prototype._clamp = /**
- * Return a number between two numbers.
- * @private
- * @param {?} value
- * @param {?=} min
- * @param {?=} max
- * @return {?}
- */
- function (value, min, max) {
- if (min === void 0) { min = 0; }
- if (max === void 0) { max = 1; }
- return Math.max(min, Math.min(value, max));
- };
- /**
- * Get the bounding client rect of the slider track element.
- * The track is used rather than the native element to ignore the extra space that the thumb can
- * take up.
- */
- /**
- * Get the bounding client rect of the slider track element.
- * The track is used rather than the native element to ignore the extra space that the thumb can
- * take up.
- * @private
- * @return {?}
- */
- MatSlider.prototype._getSliderDimensions = /**
- * Get the bounding client rect of the slider track element.
- * The track is used rather than the native element to ignore the extra space that the thumb can
- * take up.
- * @private
- * @return {?}
- */
- function () {
- return this._sliderWrapper ? this._sliderWrapper.nativeElement.getBoundingClientRect() : null;
- };
- /**
- * Focuses the native element.
- * Currently only used to allow a blur event to fire but will be used with keyboard input later.
- */
- /**
- * Focuses the native element.
- * Currently only used to allow a blur event to fire but will be used with keyboard input later.
- * @private
- * @param {?=} options
- * @return {?}
- */
- MatSlider.prototype._focusHostElement = /**
- * Focuses the native element.
- * Currently only used to allow a blur event to fire but will be used with keyboard input later.
- * @private
- * @param {?=} options
- * @return {?}
- */
- function (options) {
- this._elementRef.nativeElement.focus(options);
- };
- /** Blurs the native element. */
- /**
- * Blurs the native element.
- * @private
- * @return {?}
- */
- MatSlider.prototype._blurHostElement = /**
- * Blurs the native element.
- * @private
- * @return {?}
- */
- function () {
- this._elementRef.nativeElement.blur();
- };
- /**
- * Sets the model value. Implemented as part of ControlValueAccessor.
- * @param value
- */
- /**
- * Sets the model value. Implemented as part of ControlValueAccessor.
- * @param {?} value
- * @return {?}
- */
- MatSlider.prototype.writeValue = /**
- * Sets the model value. Implemented as part of ControlValueAccessor.
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this.value = value;
- };
- /**
- * Registers a callback to be triggered when the value has changed.
- * Implemented as part of ControlValueAccessor.
- * @param fn Callback to be registered.
- */
- /**
- * Registers a callback to be triggered when the value has changed.
- * Implemented as part of ControlValueAccessor.
- * @param {?} fn Callback to be registered.
- * @return {?}
- */
- MatSlider.prototype.registerOnChange = /**
- * Registers a callback to be triggered when the value has changed.
- * Implemented as part of ControlValueAccessor.
- * @param {?} fn Callback to be registered.
- * @return {?}
- */
- function (fn) {
- this._controlValueAccessorChangeFn = fn;
- };
- /**
- * Registers a callback to be triggered when the component is touched.
- * Implemented as part of ControlValueAccessor.
- * @param fn Callback to be registered.
- */
- /**
- * Registers a callback to be triggered when the component is touched.
- * Implemented as part of ControlValueAccessor.
- * @param {?} fn Callback to be registered.
- * @return {?}
- */
- MatSlider.prototype.registerOnTouched = /**
- * Registers a callback to be triggered when the component is touched.
- * Implemented as part of ControlValueAccessor.
- * @param {?} fn Callback to be registered.
- * @return {?}
- */
- function (fn) {
- this.onTouched = fn;
- };
- /**
- * Sets whether the component should be disabled.
- * Implemented as part of ControlValueAccessor.
- * @param isDisabled
- */
- /**
- * Sets whether the component should be disabled.
- * Implemented as part of ControlValueAccessor.
- * @param {?} isDisabled
- * @return {?}
- */
- MatSlider.prototype.setDisabledState = /**
- * Sets whether the component should be disabled.
- * Implemented as part of ControlValueAccessor.
- * @param {?} isDisabled
- * @return {?}
- */
- function (isDisabled) {
- this.disabled = isDisabled;
- };
- MatSlider.decorators = [
- { type: core.Component, args: [{selector: 'mat-slider',
- exportAs: 'matSlider',
- providers: [MAT_SLIDER_VALUE_ACCESSOR],
- host: {
- '(focus)': '_onFocus()',
- '(blur)': '_onBlur()',
- '(mousedown)': '_onMousedown($event)',
- '(keydown)': '_onKeydown($event)',
- '(keyup)': '_onKeyup()',
- '(mouseenter)': '_onMouseenter()',
- '(slide)': '_onSlide($event)',
- '(slideend)': '_onSlideEnd()',
- '(slidestart)': '_onSlideStart($event)',
- // On Safari starting to slide temporarily triggers text selection mode which
- // show the wrong cursor. We prevent it by stopping the `selectstart` event.
- '(selectstart)': '$event.preventDefault()',
- 'class': 'mat-slider',
- 'role': 'slider',
- '[tabIndex]': 'tabIndex',
- '[attr.aria-disabled]': 'disabled',
- '[attr.aria-valuemax]': 'max',
- '[attr.aria-valuemin]': 'min',
- '[attr.aria-valuenow]': 'value',
- '[attr.aria-orientation]': 'vertical ? "vertical" : "horizontal"',
- '[class.mat-slider-disabled]': 'disabled',
- '[class.mat-slider-has-ticks]': 'tickInterval',
- '[class.mat-slider-horizontal]': '!vertical',
- '[class.mat-slider-axis-inverted]': '_invertAxis',
- '[class.mat-slider-sliding]': '_isSliding',
- '[class.mat-slider-thumb-label-showing]': 'thumbLabel',
- '[class.mat-slider-vertical]': 'vertical',
- '[class.mat-slider-min-value]': '_isMinValue',
- '[class.mat-slider-hide-last-tick]': 'disabled || _isMinValue && _thumbGap && _invertAxis',
- '[class._mat-animation-noopable]': '_animationMode === "NoopAnimations"',
- },
- 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>",
- 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}"],
- inputs: ['disabled', 'color', 'tabIndex'],
- encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- },] },
- ];
- /** @nocollapse */
- MatSlider.ctorParameters = function () { return [
- { type: core.ElementRef },
- { type: a11y.FocusMonitor },
- { type: core.ChangeDetectorRef },
- { type: bidi.Directionality, decorators: [{ type: core.Optional }] },
- { type: String, decorators: [{ type: core.Attribute, args: ['tabindex',] }] },
- { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
- ]; };
- MatSlider.propDecorators = {
- invert: [{ type: core.Input }],
- max: [{ type: core.Input }],
- min: [{ type: core.Input }],
- step: [{ type: core.Input }],
- thumbLabel: [{ type: core.Input }],
- tickInterval: [{ type: core.Input }],
- value: [{ type: core.Input }],
- displayWith: [{ type: core.Input }],
- vertical: [{ type: core.Input }],
- change: [{ type: core.Output }],
- input: [{ type: core.Output }],
- valueChange: [{ type: core.Output }],
- _sliderWrapper: [{ type: core.ViewChild, args: ['sliderWrapper', { static: false },] }]
- };
- return MatSlider;
- }(_MatSliderMixinBase));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var MatSliderModule = /** @class */ (function () {
- function MatSliderModule() {
- }
- MatSliderModule.decorators = [
- { type: core.NgModule, args: [{
- imports: [common.CommonModule, MatCommonModule],
- exports: [MatSlider, MatCommonModule],
- declarations: [MatSlider],
- providers: [{ provide: platformBrowser.HAMMER_GESTURE_CONFIG, useClass: GestureConfig }]
- },] },
- ];
- return MatSliderModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Reference to a snack bar dispatched from the snack bar service.
- * @template T
- */
- var /**
- * Reference to a snack bar dispatched from the snack bar service.
- * @template T
- */
- MatSnackBarRef = /** @class */ (function () {
- function MatSnackBarRef(containerInstance, _overlayRef) {
- var _this = this;
- this._overlayRef = _overlayRef;
- /**
- * Subject for notifying the user that the snack bar has been dismissed.
- */
- this._afterDismissed = new rxjs.Subject();
- /**
- * Subject for notifying the user that the snack bar has opened and appeared.
- */
- this._afterOpened = new rxjs.Subject();
- /**
- * Subject for notifying the user that the snack bar action was called.
- */
- this._onAction = new rxjs.Subject();
- /**
- * Whether the snack bar was dismissed using the action button.
- */
- this._dismissedByAction = false;
- this.containerInstance = containerInstance;
- // Dismiss snackbar on action.
- this.onAction().subscribe((/**
- * @return {?}
- */
- function () { return _this.dismiss(); }));
- containerInstance._onExit.subscribe((/**
- * @return {?}
- */
- function () { return _this._finishDismiss(); }));
- }
- /** Dismisses the snack bar. */
- /**
- * Dismisses the snack bar.
- * @return {?}
- */
- MatSnackBarRef.prototype.dismiss = /**
- * Dismisses the snack bar.
- * @return {?}
- */
- function () {
- if (!this._afterDismissed.closed) {
- this.containerInstance.exit();
- }
- clearTimeout(this._durationTimeoutId);
- };
- /** Marks the snackbar action clicked. */
- /**
- * Marks the snackbar action clicked.
- * @return {?}
- */
- MatSnackBarRef.prototype.dismissWithAction = /**
- * Marks the snackbar action clicked.
- * @return {?}
- */
- function () {
- if (!this._onAction.closed) {
- this._dismissedByAction = true;
- this._onAction.next();
- this._onAction.complete();
- }
- };
- /**
- * Marks the snackbar action clicked.
- * @deprecated Use `dismissWithAction` instead.
- * @breaking-change 8.0.0
- */
- /**
- * Marks the snackbar action clicked.
- * @deprecated Use `dismissWithAction` instead.
- * \@breaking-change 8.0.0
- * @return {?}
- */
- MatSnackBarRef.prototype.closeWithAction = /**
- * Marks the snackbar action clicked.
- * @deprecated Use `dismissWithAction` instead.
- * \@breaking-change 8.0.0
- * @return {?}
- */
- function () {
- this.dismissWithAction();
- };
- /** Dismisses the snack bar after some duration */
- /**
- * Dismisses the snack bar after some duration
- * @param {?} duration
- * @return {?}
- */
- MatSnackBarRef.prototype._dismissAfter = /**
- * Dismisses the snack bar after some duration
- * @param {?} duration
- * @return {?}
- */
- function (duration) {
- var _this = this;
- this._durationTimeoutId = setTimeout((/**
- * @return {?}
- */
- function () { return _this.dismiss(); }), duration);
- };
- /** Marks the snackbar as opened */
- /**
- * Marks the snackbar as opened
- * @return {?}
- */
- MatSnackBarRef.prototype._open = /**
- * Marks the snackbar as opened
- * @return {?}
- */
- function () {
- if (!this._afterOpened.closed) {
- this._afterOpened.next();
- this._afterOpened.complete();
- }
- };
- /** Cleans up the DOM after closing. */
- /**
- * Cleans up the DOM after closing.
- * @private
- * @return {?}
- */
- MatSnackBarRef.prototype._finishDismiss = /**
- * Cleans up the DOM after closing.
- * @private
- * @return {?}
- */
- function () {
- this._overlayRef.dispose();
- if (!this._onAction.closed) {
- this._onAction.complete();
- }
- this._afterDismissed.next({ dismissedByAction: this._dismissedByAction });
- this._afterDismissed.complete();
- this._dismissedByAction = false;
- };
- /** Gets an observable that is notified when the snack bar is finished closing. */
- /**
- * Gets an observable that is notified when the snack bar is finished closing.
- * @return {?}
- */
- MatSnackBarRef.prototype.afterDismissed = /**
- * Gets an observable that is notified when the snack bar is finished closing.
- * @return {?}
- */
- function () {
- return this._afterDismissed.asObservable();
- };
- /** Gets an observable that is notified when the snack bar has opened and appeared. */
- /**
- * Gets an observable that is notified when the snack bar has opened and appeared.
- * @return {?}
- */
- MatSnackBarRef.prototype.afterOpened = /**
- * Gets an observable that is notified when the snack bar has opened and appeared.
- * @return {?}
- */
- function () {
- return this.containerInstance._onEnter;
- };
- /** Gets an observable that is notified when the snack bar action is called. */
- /**
- * Gets an observable that is notified when the snack bar action is called.
- * @return {?}
- */
- MatSnackBarRef.prototype.onAction = /**
- * Gets an observable that is notified when the snack bar action is called.
- * @return {?}
- */
- function () {
- return this._onAction.asObservable();
- };
- return MatSnackBarRef;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Injection token that can be used to access the data that was passed in to a snack bar.
- * @type {?}
- */
- var MAT_SNACK_BAR_DATA = new core.InjectionToken('MatSnackBarData');
- /**
- * Configuration used when opening a snack-bar.
- * @template D
- */
- var /**
- * Configuration used when opening a snack-bar.
- * @template D
- */
- MatSnackBarConfig = /** @class */ (function () {
- function MatSnackBarConfig() {
- /**
- * The politeness level for the MatAriaLiveAnnouncer announcement.
- */
- this.politeness = 'assertive';
- /**
- * Message to be announced by the LiveAnnouncer. When opening a snackbar without a custom
- * component or template, the announcement message will default to the specified message.
- */
- this.announcementMessage = '';
- /**
- * The length of time in milliseconds to wait before automatically dismissing the snack bar.
- */
- this.duration = 0;
- /**
- * Data being injected into the child component.
- */
- this.data = null;
- /**
- * The horizontal position to place the snack bar.
- */
- this.horizontalPosition = 'center';
- /**
- * The vertical position to place the snack bar.
- */
- this.verticalPosition = 'bottom';
- }
- return MatSnackBarConfig;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * A component used to open as the default snack bar, matching material spec.
- * This should only be used internally by the snack bar service.
- */
- var SimpleSnackBar = /** @class */ (function () {
- function SimpleSnackBar(snackBarRef, data) {
- this.snackBarRef = snackBarRef;
- this.data = data;
- }
- /** Performs the action on the snack bar. */
- /**
- * Performs the action on the snack bar.
- * @return {?}
- */
- SimpleSnackBar.prototype.action = /**
- * Performs the action on the snack bar.
- * @return {?}
- */
- function () {
- this.snackBarRef.dismissWithAction();
- };
- Object.defineProperty(SimpleSnackBar.prototype, "hasAction", {
- /** If the action button should be shown. */
- get: /**
- * If the action button should be shown.
- * @return {?}
- */
- function () {
- return !!this.data.action;
- },
- enumerable: true,
- configurable: true
- });
- SimpleSnackBar.decorators = [
- { type: core.Component, args: [{selector: 'simple-snack-bar',
- template: "<span>{{data.message}}</span><div class=\"mat-simple-snackbar-action\" *ngIf=\"hasAction\"><button mat-button (click)=\"action()\">{{data.action}}</button></div>",
- 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}"],
- encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- host: {
- 'class': 'mat-simple-snackbar',
- }
- },] },
- ];
- /** @nocollapse */
- SimpleSnackBar.ctorParameters = function () { return [
- { type: MatSnackBarRef },
- { type: undefined, decorators: [{ type: core.Inject, args: [MAT_SNACK_BAR_DATA,] }] }
- ]; };
- return SimpleSnackBar;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Animations used by the Material snack bar.
- * \@docs-private
- * @type {?}
- */
- var matSnackBarAnimations = {
- /**
- * Animation that shows and hides a snack bar.
- */
- snackBarState: animations$1.trigger('state', [
- animations$1.state('void, hidden', animations$1.style({
- transform: 'scale(0.8)',
- opacity: 0,
- })),
- animations$1.state('visible', animations$1.style({
- transform: 'scale(1)',
- opacity: 1,
- })),
- animations$1.transition('* => visible', animations$1.animate('150ms cubic-bezier(0, 0, 0.2, 1)')),
- animations$1.transition('* => void, * => hidden', animations$1.animate('75ms cubic-bezier(0.4, 0.0, 1, 1)', animations$1.style({
- opacity: 0
- }))),
- ])
- };
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Internal component that wraps user-provided snack bar content.
- * \@docs-private
- */
- var MatSnackBarContainer = /** @class */ (function (_super) {
- __extends(MatSnackBarContainer, _super);
- function MatSnackBarContainer(_ngZone, _elementRef, _changeDetectorRef, snackBarConfig) {
- var _this = _super.call(this) || this;
- _this._ngZone = _ngZone;
- _this._elementRef = _elementRef;
- _this._changeDetectorRef = _changeDetectorRef;
- _this.snackBarConfig = snackBarConfig;
- /**
- * Whether the component has been destroyed.
- */
- _this._destroyed = false;
- /**
- * Subject for notifying that the snack bar has exited from view.
- */
- _this._onExit = new rxjs.Subject();
- /**
- * Subject for notifying that the snack bar has finished entering the view.
- */
- _this._onEnter = new rxjs.Subject();
- /**
- * The state of the snack bar animations.
- */
- _this._animationState = 'void';
- // Based on the ARIA spec, `alert` and `status` roles have an
- // implicit `assertive` and `polite` politeness respectively.
- if (snackBarConfig.politeness === 'assertive' && !snackBarConfig.announcementMessage) {
- _this._role = 'alert';
- }
- else if (snackBarConfig.politeness === 'off') {
- _this._role = null;
- }
- else {
- _this._role = 'status';
- }
- return _this;
- }
- /** Attach a component portal as content to this snack bar container. */
- /**
- * Attach a component portal as content to this snack bar container.
- * @template T
- * @param {?} portal
- * @return {?}
- */
- MatSnackBarContainer.prototype.attachComponentPortal = /**
- * Attach a component portal as content to this snack bar container.
- * @template T
- * @param {?} portal
- * @return {?}
- */
- function (portal$$1) {
- this._assertNotAttached();
- this._applySnackBarClasses();
- return this._portalOutlet.attachComponentPortal(portal$$1);
- };
- /** Attach a template portal as content to this snack bar container. */
- /**
- * Attach a template portal as content to this snack bar container.
- * @template C
- * @param {?} portal
- * @return {?}
- */
- MatSnackBarContainer.prototype.attachTemplatePortal = /**
- * Attach a template portal as content to this snack bar container.
- * @template C
- * @param {?} portal
- * @return {?}
- */
- function (portal$$1) {
- this._assertNotAttached();
- this._applySnackBarClasses();
- return this._portalOutlet.attachTemplatePortal(portal$$1);
- };
- /** Handle end of animations, updating the state of the snackbar. */
- /**
- * Handle end of animations, updating the state of the snackbar.
- * @param {?} event
- * @return {?}
- */
- MatSnackBarContainer.prototype.onAnimationEnd = /**
- * Handle end of animations, updating the state of the snackbar.
- * @param {?} event
- * @return {?}
- */
- function (event) {
- var fromState = event.fromState, toState = event.toState;
- if ((toState === 'void' && fromState !== 'void') || toState === 'hidden') {
- this._completeExit();
- }
- if (toState === 'visible') {
- // Note: we shouldn't use `this` inside the zone callback,
- // because it can cause a memory leak.
- /** @type {?} */
- var onEnter_1 = this._onEnter;
- this._ngZone.run((/**
- * @return {?}
- */
- function () {
- onEnter_1.next();
- onEnter_1.complete();
- }));
- }
- };
- /** Begin animation of snack bar entrance into view. */
- /**
- * Begin animation of snack bar entrance into view.
- * @return {?}
- */
- MatSnackBarContainer.prototype.enter = /**
- * Begin animation of snack bar entrance into view.
- * @return {?}
- */
- function () {
- if (!this._destroyed) {
- this._animationState = 'visible';
- this._changeDetectorRef.detectChanges();
- }
- };
- /** Begin animation of the snack bar exiting from view. */
- /**
- * Begin animation of the snack bar exiting from view.
- * @return {?}
- */
- MatSnackBarContainer.prototype.exit = /**
- * Begin animation of the snack bar exiting from view.
- * @return {?}
- */
- function () {
- // Note: this one transitions to `hidden`, rather than `void`, in order to handle the case
- // where multiple snack bars are opened in quick succession (e.g. two consecutive calls to
- // `MatSnackBar.open`).
- this._animationState = 'hidden';
- return this._onExit;
- };
- /** Makes sure the exit callbacks have been invoked when the element is destroyed. */
- /**
- * Makes sure the exit callbacks have been invoked when the element is destroyed.
- * @return {?}
- */
- MatSnackBarContainer.prototype.ngOnDestroy = /**
- * Makes sure the exit callbacks have been invoked when the element is destroyed.
- * @return {?}
- */
- function () {
- this._destroyed = true;
- this._completeExit();
- };
- /**
- * Waits for the zone to settle before removing the element. Helps prevent
- * errors where we end up removing an element which is in the middle of an animation.
- */
- /**
- * Waits for the zone to settle before removing the element. Helps prevent
- * errors where we end up removing an element which is in the middle of an animation.
- * @private
- * @return {?}
- */
- MatSnackBarContainer.prototype._completeExit = /**
- * Waits for the zone to settle before removing the element. Helps prevent
- * errors where we end up removing an element which is in the middle of an animation.
- * @private
- * @return {?}
- */
- function () {
- var _this = this;
- this._ngZone.onMicrotaskEmpty.asObservable().pipe(operators.take(1)).subscribe((/**
- * @return {?}
- */
- function () {
- _this._onExit.next();
- _this._onExit.complete();
- }));
- };
- /** Applies the various positioning and user-configured CSS classes to the snack bar. */
- /**
- * Applies the various positioning and user-configured CSS classes to the snack bar.
- * @private
- * @return {?}
- */
- MatSnackBarContainer.prototype._applySnackBarClasses = /**
- * Applies the various positioning and user-configured CSS classes to the snack bar.
- * @private
- * @return {?}
- */
- function () {
- /** @type {?} */
- var element = this._elementRef.nativeElement;
- /** @type {?} */
- var panelClasses = this.snackBarConfig.panelClass;
- if (panelClasses) {
- if (Array.isArray(panelClasses)) {
- // Note that we can't use a spread here, because IE doesn't support multiple arguments.
- panelClasses.forEach((/**
- * @param {?} cssClass
- * @return {?}
- */
- function (cssClass) { return element.classList.add(cssClass); }));
- }
- else {
- element.classList.add(panelClasses);
- }
- }
- if (this.snackBarConfig.horizontalPosition === 'center') {
- element.classList.add('mat-snack-bar-center');
- }
- if (this.snackBarConfig.verticalPosition === 'top') {
- element.classList.add('mat-snack-bar-top');
- }
- };
- /** Asserts that no content is already attached to the container. */
- /**
- * Asserts that no content is already attached to the container.
- * @private
- * @return {?}
- */
- MatSnackBarContainer.prototype._assertNotAttached = /**
- * Asserts that no content is already attached to the container.
- * @private
- * @return {?}
- */
- function () {
- if (this._portalOutlet.hasAttached()) {
- throw Error('Attempting to attach snack bar content after content is already attached');
- }
- };
- MatSnackBarContainer.decorators = [
- { type: core.Component, args: [{selector: 'snack-bar-container',
- template: "<ng-template cdkPortalOutlet></ng-template>",
- 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%}"],
- // In Ivy embedded views will be change detected from their declaration place, rather than
- // where they were stamped out. This means that we can't have the snack bar container be OnPush,
- // because it might cause snack bars that were opened from a template not to be out of date.
- // tslint:disable-next-line:validate-decorators
- changeDetection: core.ChangeDetectionStrategy.Default,
- encapsulation: core.ViewEncapsulation.None,
- animations: [matSnackBarAnimations.snackBarState],
- host: {
- '[attr.role]': '_role',
- 'class': 'mat-snack-bar-container',
- '[@state]': '_animationState',
- '(@state.done)': 'onAnimationEnd($event)'
- },
- },] },
- ];
- /** @nocollapse */
- MatSnackBarContainer.ctorParameters = function () { return [
- { type: core.NgZone },
- { type: core.ElementRef },
- { type: core.ChangeDetectorRef },
- { type: MatSnackBarConfig }
- ]; };
- MatSnackBarContainer.propDecorators = {
- _portalOutlet: [{ type: core.ViewChild, args: [portal.CdkPortalOutlet, { static: true },] }]
- };
- return MatSnackBarContainer;
- }(portal.BasePortalOutlet));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var MatSnackBarModule = /** @class */ (function () {
- function MatSnackBarModule() {
- }
- MatSnackBarModule.decorators = [
- { type: core.NgModule, args: [{
- imports: [
- overlay.OverlayModule,
- portal.PortalModule,
- common.CommonModule,
- MatButtonModule,
- MatCommonModule,
- ],
- exports: [MatSnackBarContainer, MatCommonModule],
- declarations: [MatSnackBarContainer, SimpleSnackBar],
- entryComponents: [MatSnackBarContainer, SimpleSnackBar],
- },] },
- ];
- return MatSnackBarModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Injection token that can be used to specify default snack bar.
- * @type {?}
- */
- var MAT_SNACK_BAR_DEFAULT_OPTIONS = new core.InjectionToken('mat-snack-bar-default-options', {
- providedIn: 'root',
- factory: MAT_SNACK_BAR_DEFAULT_OPTIONS_FACTORY,
- });
- /**
- * \@docs-private
- * @return {?}
- */
- function MAT_SNACK_BAR_DEFAULT_OPTIONS_FACTORY() {
- return new MatSnackBarConfig();
- }
- /**
- * Service to dispatch Material Design snack bar messages.
- */
- var MatSnackBar = /** @class */ (function () {
- function MatSnackBar(_overlay, _live, _injector, _breakpointObserver, _parentSnackBar, _defaultConfig) {
- this._overlay = _overlay;
- this._live = _live;
- this._injector = _injector;
- this._breakpointObserver = _breakpointObserver;
- this._parentSnackBar = _parentSnackBar;
- this._defaultConfig = _defaultConfig;
- /**
- * Reference to the current snack bar in the view *at this level* (in the Angular injector tree).
- * If there is a parent snack-bar service, all operations should delegate to that parent
- * via `_openedSnackBarRef`.
- */
- this._snackBarRefAtThisLevel = null;
- }
- Object.defineProperty(MatSnackBar.prototype, "_openedSnackBarRef", {
- /** Reference to the currently opened snackbar at *any* level. */
- get: /**
- * Reference to the currently opened snackbar at *any* level.
- * @return {?}
- */
- function () {
- /** @type {?} */
- var parent = this._parentSnackBar;
- return parent ? parent._openedSnackBarRef : this._snackBarRefAtThisLevel;
- },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- if (this._parentSnackBar) {
- this._parentSnackBar._openedSnackBarRef = value;
- }
- else {
- this._snackBarRefAtThisLevel = value;
- }
- },
- enumerable: true,
- configurable: true
- });
- /**
- * Creates and dispatches a snack bar with a custom component for the content, removing any
- * currently opened snack bars.
- *
- * @param component Component to be instantiated.
- * @param config Extra configuration for the snack bar.
- */
- /**
- * Creates and dispatches a snack bar with a custom component for the content, removing any
- * currently opened snack bars.
- *
- * @template T
- * @param {?} component Component to be instantiated.
- * @param {?=} config Extra configuration for the snack bar.
- * @return {?}
- */
- MatSnackBar.prototype.openFromComponent = /**
- * Creates and dispatches a snack bar with a custom component for the content, removing any
- * currently opened snack bars.
- *
- * @template T
- * @param {?} component Component to be instantiated.
- * @param {?=} config Extra configuration for the snack bar.
- * @return {?}
- */
- function (component, config) {
- return (/** @type {?} */ (this._attach(component, config)));
- };
- /**
- * Creates and dispatches a snack bar with a custom template for the content, removing any
- * currently opened snack bars.
- *
- * @param template Template to be instantiated.
- * @param config Extra configuration for the snack bar.
- */
- /**
- * Creates and dispatches a snack bar with a custom template for the content, removing any
- * currently opened snack bars.
- *
- * @param {?} template Template to be instantiated.
- * @param {?=} config Extra configuration for the snack bar.
- * @return {?}
- */
- MatSnackBar.prototype.openFromTemplate = /**
- * Creates and dispatches a snack bar with a custom template for the content, removing any
- * currently opened snack bars.
- *
- * @param {?} template Template to be instantiated.
- * @param {?=} config Extra configuration for the snack bar.
- * @return {?}
- */
- function (template, config) {
- return this._attach(template, config);
- };
- /**
- * Opens a snackbar with a message and an optional action.
- * @param message The message to show in the snackbar.
- * @param action The label for the snackbar action.
- * @param config Additional configuration options for the snackbar.
- */
- /**
- * Opens a snackbar with a message and an optional action.
- * @param {?} message The message to show in the snackbar.
- * @param {?=} action The label for the snackbar action.
- * @param {?=} config Additional configuration options for the snackbar.
- * @return {?}
- */
- MatSnackBar.prototype.open = /**
- * Opens a snackbar with a message and an optional action.
- * @param {?} message The message to show in the snackbar.
- * @param {?=} action The label for the snackbar action.
- * @param {?=} config Additional configuration options for the snackbar.
- * @return {?}
- */
- function (message, action, config) {
- if (action === void 0) { action = ''; }
- /** @type {?} */
- var _config = __assign({}, this._defaultConfig, config);
- // Since the user doesn't have access to the component, we can
- // override the data to pass in our own message and action.
- _config.data = { message: message, action: action };
- if (!_config.announcementMessage) {
- _config.announcementMessage = message;
- }
- return this.openFromComponent(SimpleSnackBar, _config);
- };
- /**
- * Dismisses the currently-visible snack bar.
- */
- /**
- * Dismisses the currently-visible snack bar.
- * @return {?}
- */
- MatSnackBar.prototype.dismiss = /**
- * Dismisses the currently-visible snack bar.
- * @return {?}
- */
- function () {
- if (this._openedSnackBarRef) {
- this._openedSnackBarRef.dismiss();
- }
- };
- /**
- * @return {?}
- */
- MatSnackBar.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- // Only dismiss the snack bar at the current level on destroy.
- if (this._snackBarRefAtThisLevel) {
- this._snackBarRefAtThisLevel.dismiss();
- }
- };
- /**
- * Attaches the snack bar container component to the overlay.
- */
- /**
- * Attaches the snack bar container component to the overlay.
- * @private
- * @param {?} overlayRef
- * @param {?} config
- * @return {?}
- */
- MatSnackBar.prototype._attachSnackBarContainer = /**
- * Attaches the snack bar container component to the overlay.
- * @private
- * @param {?} overlayRef
- * @param {?} config
- * @return {?}
- */
- function (overlayRef, config) {
- /** @type {?} */
- var userInjector = config && config.viewContainerRef && config.viewContainerRef.injector;
- /** @type {?} */
- var injector = new portal.PortalInjector(userInjector || this._injector, new WeakMap([
- [MatSnackBarConfig, config]
- ]));
- /** @type {?} */
- var containerPortal = new portal.ComponentPortal(MatSnackBarContainer, config.viewContainerRef, injector);
- /** @type {?} */
- var containerRef = overlayRef.attach(containerPortal);
- containerRef.instance.snackBarConfig = config;
- return containerRef.instance;
- };
- /**
- * Places a new component or a template as the content of the snack bar container.
- */
- /**
- * Places a new component or a template as the content of the snack bar container.
- * @private
- * @template T
- * @param {?} content
- * @param {?=} userConfig
- * @return {?}
- */
- MatSnackBar.prototype._attach = /**
- * Places a new component or a template as the content of the snack bar container.
- * @private
- * @template T
- * @param {?} content
- * @param {?=} userConfig
- * @return {?}
- */
- function (content, userConfig) {
- /** @type {?} */
- var config = __assign({}, new MatSnackBarConfig(), this._defaultConfig, userConfig);
- /** @type {?} */
- var overlayRef = this._createOverlay(config);
- /** @type {?} */
- var container = this._attachSnackBarContainer(overlayRef, config);
- /** @type {?} */
- var snackBarRef = new MatSnackBarRef(container, overlayRef);
- if (content instanceof core.TemplateRef) {
- /** @type {?} */
- var portal$$1 = new portal.TemplatePortal(content, (/** @type {?} */ (null)), (/** @type {?} */ ({
- $implicit: config.data,
- snackBarRef: snackBarRef
- })));
- snackBarRef.instance = container.attachTemplatePortal(portal$$1);
- }
- else {
- /** @type {?} */
- var injector = this._createInjector(config, snackBarRef);
- /** @type {?} */
- var portal$$1 = new portal.ComponentPortal(content, undefined, injector);
- /** @type {?} */
- var contentRef = container.attachComponentPortal(portal$$1);
- // We can't pass this via the injector, because the injector is created earlier.
- snackBarRef.instance = contentRef.instance;
- }
- // Subscribe to the breakpoint observer and attach the mat-snack-bar-handset class as
- // appropriate. This class is applied to the overlay element because the overlay must expand to
- // fill the width of the screen for full width snackbars.
- this._breakpointObserver.observe(layout.Breakpoints.Handset).pipe(operators.takeUntil(overlayRef.detachments().pipe(operators.take(1)))).subscribe((/**
- * @param {?} state
- * @return {?}
- */
- function (state$$1) {
- if (state$$1.matches) {
- overlayRef.overlayElement.classList.add('mat-snack-bar-handset');
- }
- else {
- overlayRef.overlayElement.classList.remove('mat-snack-bar-handset');
- }
- }));
- this._animateSnackBar(snackBarRef, config);
- this._openedSnackBarRef = snackBarRef;
- return this._openedSnackBarRef;
- };
- /** Animates the old snack bar out and the new one in. */
- /**
- * Animates the old snack bar out and the new one in.
- * @private
- * @param {?} snackBarRef
- * @param {?} config
- * @return {?}
- */
- MatSnackBar.prototype._animateSnackBar = /**
- * Animates the old snack bar out and the new one in.
- * @private
- * @param {?} snackBarRef
- * @param {?} config
- * @return {?}
- */
- function (snackBarRef, config) {
- var _this = this;
- // When the snackbar is dismissed, clear the reference to it.
- snackBarRef.afterDismissed().subscribe((/**
- * @return {?}
- */
- function () {
- // Clear the snackbar ref if it hasn't already been replaced by a newer snackbar.
- if (_this._openedSnackBarRef == snackBarRef) {
- _this._openedSnackBarRef = null;
- }
- if (config.announcementMessage) {
- _this._live.clear();
- }
- }));
- if (this._openedSnackBarRef) {
- // If a snack bar is already in view, dismiss it and enter the
- // new snack bar after exit animation is complete.
- this._openedSnackBarRef.afterDismissed().subscribe((/**
- * @return {?}
- */
- function () {
- snackBarRef.containerInstance.enter();
- }));
- this._openedSnackBarRef.dismiss();
- }
- else {
- // If no snack bar is in view, enter the new snack bar.
- snackBarRef.containerInstance.enter();
- }
- // If a dismiss timeout is provided, set up dismiss based on after the snackbar is opened.
- if (config.duration && config.duration > 0) {
- snackBarRef.afterOpened().subscribe((/**
- * @return {?}
- */
- function () { return snackBarRef._dismissAfter((/** @type {?} */ (config.duration))); }));
- }
- if (config.announcementMessage) {
- this._live.announce(config.announcementMessage, config.politeness);
- }
- };
- /**
- * Creates a new overlay and places it in the correct location.
- * @param config The user-specified snack bar config.
- */
- /**
- * Creates a new overlay and places it in the correct location.
- * @private
- * @param {?} config The user-specified snack bar config.
- * @return {?}
- */
- MatSnackBar.prototype._createOverlay = /**
- * Creates a new overlay and places it in the correct location.
- * @private
- * @param {?} config The user-specified snack bar config.
- * @return {?}
- */
- function (config) {
- /** @type {?} */
- var overlayConfig = new overlay.OverlayConfig();
- overlayConfig.direction = config.direction;
- /** @type {?} */
- var positionStrategy = this._overlay.position().global();
- // Set horizontal position.
- /** @type {?} */
- var isRtl = config.direction === 'rtl';
- /** @type {?} */
- var isLeft = (config.horizontalPosition === 'left' ||
- (config.horizontalPosition === 'start' && !isRtl) ||
- (config.horizontalPosition === 'end' && isRtl));
- /** @type {?} */
- var isRight = !isLeft && config.horizontalPosition !== 'center';
- if (isLeft) {
- positionStrategy.left('0');
- }
- else if (isRight) {
- positionStrategy.right('0');
- }
- else {
- positionStrategy.centerHorizontally();
- }
- // Set horizontal position.
- if (config.verticalPosition === 'top') {
- positionStrategy.top('0');
- }
- else {
- positionStrategy.bottom('0');
- }
- overlayConfig.positionStrategy = positionStrategy;
- return this._overlay.create(overlayConfig);
- };
- /**
- * Creates an injector to be used inside of a snack bar component.
- * @param config Config that was used to create the snack bar.
- * @param snackBarRef Reference to the snack bar.
- */
- /**
- * Creates an injector to be used inside of a snack bar component.
- * @private
- * @template T
- * @param {?} config Config that was used to create the snack bar.
- * @param {?} snackBarRef Reference to the snack bar.
- * @return {?}
- */
- MatSnackBar.prototype._createInjector = /**
- * Creates an injector to be used inside of a snack bar component.
- * @private
- * @template T
- * @param {?} config Config that was used to create the snack bar.
- * @param {?} snackBarRef Reference to the snack bar.
- * @return {?}
- */
- function (config, snackBarRef) {
- /** @type {?} */
- var userInjector = config && config.viewContainerRef && config.viewContainerRef.injector;
- return new portal.PortalInjector(userInjector || this._injector, new WeakMap([
- [MatSnackBarRef, snackBarRef],
- [MAT_SNACK_BAR_DATA, config.data]
- ]));
- };
- MatSnackBar.decorators = [
- { type: core.Injectable, args: [{ providedIn: MatSnackBarModule },] },
- ];
- /** @nocollapse */
- MatSnackBar.ctorParameters = function () { return [
- { type: overlay.Overlay },
- { type: a11y.LiveAnnouncer },
- { type: core.Injector },
- { type: layout.BreakpointObserver },
- { type: MatSnackBar, decorators: [{ type: core.Optional }, { type: core.SkipSelf }] },
- { type: MatSnackBarConfig, decorators: [{ type: core.Inject, args: [MAT_SNACK_BAR_DEFAULT_OPTIONS,] }] }
- ]; };
- /** @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 });
- return MatSnackBar;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * \@docs-private
- * @param {?} id
- * @return {?}
- */
- function getSortDuplicateSortableIdError(id) {
- return Error("Cannot have two MatSortables with the same id (" + id + ").");
- }
- /**
- * \@docs-private
- * @return {?}
- */
- function getSortHeaderNotContainedWithinSortError() {
- return Error("MatSortHeader must be placed within a parent element with the MatSort directive.");
- }
- /**
- * \@docs-private
- * @return {?}
- */
- function getSortHeaderMissingIdError() {
- return Error("MatSortHeader must be provided with a unique id.");
- }
- /**
- * \@docs-private
- * @param {?} direction
- * @return {?}
- */
- function getSortInvalidDirectionError(direction) {
- return Error(direction + " is not a valid sort direction ('asc' or 'desc').");
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- // Boilerplate for applying mixins to MatSort.
- /**
- * \@docs-private
- */
- var
- // Boilerplate for applying mixins to MatSort.
- /**
- * \@docs-private
- */
- MatSortBase = /** @class */ (function () {
- function MatSortBase() {
- }
- return MatSortBase;
- }());
- /** @type {?} */
- var _MatSortMixinBase = mixinInitialized(mixinDisabled(MatSortBase));
- /**
- * Container for MatSortables to manage the sort state and provide default sort parameters.
- */
- var MatSort = /** @class */ (function (_super) {
- __extends(MatSort, _super);
- function MatSort() {
- var _this = _super !== null && _super.apply(this, arguments) || this;
- /**
- * Collection of all registered sortables that this directive manages.
- */
- _this.sortables = new Map();
- /**
- * Used to notify any child components listening to state changes.
- */
- _this._stateChanges = new rxjs.Subject();
- /**
- * The direction to set when an MatSortable is initially sorted.
- * May be overriden by the MatSortable's sort start.
- */
- _this.start = 'asc';
- _this._direction = '';
- /**
- * Event emitted when the user changes either the active sort or sort direction.
- */
- _this.sortChange = new core.EventEmitter();
- return _this;
- }
- Object.defineProperty(MatSort.prototype, "direction", {
- /** The sort direction of the currently active MatSortable. */
- get: /**
- * The sort direction of the currently active MatSortable.
- * @return {?}
- */
- function () { return this._direction; },
- set: /**
- * @param {?} direction
- * @return {?}
- */
- function (direction) {
- if (core.isDevMode() && direction && direction !== 'asc' && direction !== 'desc') {
- throw getSortInvalidDirectionError(direction);
- }
- this._direction = direction;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatSort.prototype, "disableClear", {
- /**
- * Whether to disable the user from clearing the sort by finishing the sort direction cycle.
- * May be overriden by the MatSortable's disable clear input.
- */
- get: /**
- * Whether to disable the user from clearing the sort by finishing the sort direction cycle.
- * May be overriden by the MatSortable's disable clear input.
- * @return {?}
- */
- function () { return this._disableClear; },
- set: /**
- * @param {?} v
- * @return {?}
- */
- function (v) { this._disableClear = coercion.coerceBooleanProperty(v); },
- enumerable: true,
- configurable: true
- });
- /**
- * Register function to be used by the contained MatSortables. Adds the MatSortable to the
- * collection of MatSortables.
- */
- /**
- * Register function to be used by the contained MatSortables. Adds the MatSortable to the
- * collection of MatSortables.
- * @param {?} sortable
- * @return {?}
- */
- MatSort.prototype.register = /**
- * Register function to be used by the contained MatSortables. Adds the MatSortable to the
- * collection of MatSortables.
- * @param {?} sortable
- * @return {?}
- */
- function (sortable) {
- if (!sortable.id) {
- throw getSortHeaderMissingIdError();
- }
- if (this.sortables.has(sortable.id)) {
- throw getSortDuplicateSortableIdError(sortable.id);
- }
- this.sortables.set(sortable.id, sortable);
- };
- /**
- * Unregister function to be used by the contained MatSortables. Removes the MatSortable from the
- * collection of contained MatSortables.
- */
- /**
- * Unregister function to be used by the contained MatSortables. Removes the MatSortable from the
- * collection of contained MatSortables.
- * @param {?} sortable
- * @return {?}
- */
- MatSort.prototype.deregister = /**
- * Unregister function to be used by the contained MatSortables. Removes the MatSortable from the
- * collection of contained MatSortables.
- * @param {?} sortable
- * @return {?}
- */
- function (sortable) {
- this.sortables.delete(sortable.id);
- };
- /** Sets the active sort id and determines the new sort direction. */
- /**
- * Sets the active sort id and determines the new sort direction.
- * @param {?} sortable
- * @return {?}
- */
- MatSort.prototype.sort = /**
- * Sets the active sort id and determines the new sort direction.
- * @param {?} sortable
- * @return {?}
- */
- function (sortable) {
- if (this.active != sortable.id) {
- this.active = sortable.id;
- this.direction = sortable.start ? sortable.start : this.start;
- }
- else {
- this.direction = this.getNextSortDirection(sortable);
- }
- this.sortChange.emit({ active: this.active, direction: this.direction });
- };
- /** Returns the next sort direction of the active sortable, checking for potential overrides. */
- /**
- * Returns the next sort direction of the active sortable, checking for potential overrides.
- * @param {?} sortable
- * @return {?}
- */
- MatSort.prototype.getNextSortDirection = /**
- * Returns the next sort direction of the active sortable, checking for potential overrides.
- * @param {?} sortable
- * @return {?}
- */
- function (sortable) {
- if (!sortable) {
- return '';
- }
- // Get the sort direction cycle with the potential sortable overrides.
- /** @type {?} */
- var disableClear = sortable.disableClear != null ? sortable.disableClear : this.disableClear;
- /** @type {?} */
- var sortDirectionCycle = getSortDirectionCycle(sortable.start || this.start, disableClear);
- // Get and return the next direction in the cycle
- /** @type {?} */
- var nextDirectionIndex = sortDirectionCycle.indexOf(this.direction) + 1;
- if (nextDirectionIndex >= sortDirectionCycle.length) {
- nextDirectionIndex = 0;
- }
- return sortDirectionCycle[nextDirectionIndex];
- };
- /**
- * @return {?}
- */
- MatSort.prototype.ngOnInit = /**
- * @return {?}
- */
- function () {
- this._markInitialized();
- };
- /**
- * @return {?}
- */
- MatSort.prototype.ngOnChanges = /**
- * @return {?}
- */
- function () {
- this._stateChanges.next();
- };
- /**
- * @return {?}
- */
- MatSort.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- this._stateChanges.complete();
- };
- MatSort.decorators = [
- { type: core.Directive, args: [{
- selector: '[matSort]',
- exportAs: 'matSort',
- inputs: ['disabled: matSortDisabled']
- },] },
- ];
- MatSort.propDecorators = {
- active: [{ type: core.Input, args: ['matSortActive',] }],
- start: [{ type: core.Input, args: ['matSortStart',] }],
- direction: [{ type: core.Input, args: ['matSortDirection',] }],
- disableClear: [{ type: core.Input, args: ['matSortDisableClear',] }],
- sortChange: [{ type: core.Output, args: ['matSortChange',] }]
- };
- return MatSort;
- }(_MatSortMixinBase));
- /**
- * Returns the sort direction cycle to use given the provided parameters of order and clear.
- * @param {?} start
- * @param {?} disableClear
- * @return {?}
- */
- function getSortDirectionCycle(start, disableClear) {
- /** @type {?} */
- var sortOrder = ['asc', 'desc'];
- if (start == 'desc') {
- sortOrder.reverse();
- }
- if (!disableClear) {
- sortOrder.push('');
- }
- return sortOrder;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /** @type {?} */
- var SORT_ANIMATION_TRANSITION = AnimationDurations.ENTERING + ' ' +
- AnimationCurves.STANDARD_CURVE;
- /**
- * Animations used by MatSort.
- * \@docs-private
- * @type {?}
- */
- var matSortAnimations = {
- /**
- * Animation that moves the sort indicator.
- */
- indicator: animations$1.trigger('indicator', [
- animations$1.state('active-asc, asc', animations$1.style({ transform: 'translateY(0px)' })),
- // 10px is the height of the sort indicator, minus the width of the pointers
- animations$1.state('active-desc, desc', animations$1.style({ transform: 'translateY(10px)' })),
- animations$1.transition('active-asc <=> active-desc', animations$1.animate(SORT_ANIMATION_TRANSITION))
- ]),
- /**
- * Animation that rotates the left pointer of the indicator based on the sorting direction.
- */
- leftPointer: animations$1.trigger('leftPointer', [
- animations$1.state('active-asc, asc', animations$1.style({ transform: 'rotate(-45deg)' })),
- animations$1.state('active-desc, desc', animations$1.style({ transform: 'rotate(45deg)' })),
- animations$1.transition('active-asc <=> active-desc', animations$1.animate(SORT_ANIMATION_TRANSITION))
- ]),
- /**
- * Animation that rotates the right pointer of the indicator based on the sorting direction.
- */
- rightPointer: animations$1.trigger('rightPointer', [
- animations$1.state('active-asc, asc', animations$1.style({ transform: 'rotate(45deg)' })),
- animations$1.state('active-desc, desc', animations$1.style({ transform: 'rotate(-45deg)' })),
- animations$1.transition('active-asc <=> active-desc', animations$1.animate(SORT_ANIMATION_TRANSITION))
- ]),
- /**
- * Animation that controls the arrow opacity.
- */
- arrowOpacity: animations$1.trigger('arrowOpacity', [
- animations$1.state('desc-to-active, asc-to-active, active', animations$1.style({ opacity: 1 })),
- animations$1.state('desc-to-hint, asc-to-hint, hint', animations$1.style({ opacity: .54 })),
- animations$1.state('hint-to-desc, active-to-desc, desc, hint-to-asc, active-to-asc, asc, void', animations$1.style({ opacity: 0 })),
- // Transition between all states except for immediate transitions
- animations$1.transition('* => asc, * => desc, * => active, * => hint, * => void', animations$1.animate('0ms')),
- animations$1.transition('* <=> *', animations$1.animate(SORT_ANIMATION_TRANSITION)),
- ]),
- /**
- * Animation for the translation of the arrow as a whole. States are separated into two
- * groups: ones with animations and others that are immediate. Immediate states are asc, desc,
- * peek, and active. The other states define a specific animation (source-to-destination)
- * and are determined as a function of their prev user-perceived state and what the next state
- * should be.
- */
- arrowPosition: animations$1.trigger('arrowPosition', [
- // Hidden Above => Hint Center
- animations$1.transition('* => desc-to-hint, * => desc-to-active', animations$1.animate(SORT_ANIMATION_TRANSITION, animations$1.keyframes([
- animations$1.style({ transform: 'translateY(-25%)' }),
- animations$1.style({ transform: 'translateY(0)' })
- ]))),
- // Hint Center => Hidden Below
- animations$1.transition('* => hint-to-desc, * => active-to-desc', animations$1.animate(SORT_ANIMATION_TRANSITION, animations$1.keyframes([
- animations$1.style({ transform: 'translateY(0)' }),
- animations$1.style({ transform: 'translateY(25%)' })
- ]))),
- // Hidden Below => Hint Center
- animations$1.transition('* => asc-to-hint, * => asc-to-active', animations$1.animate(SORT_ANIMATION_TRANSITION, animations$1.keyframes([
- animations$1.style({ transform: 'translateY(25%)' }),
- animations$1.style({ transform: 'translateY(0)' })
- ]))),
- // Hint Center => Hidden Above
- animations$1.transition('* => hint-to-asc, * => active-to-asc', animations$1.animate(SORT_ANIMATION_TRANSITION, animations$1.keyframes([
- animations$1.style({ transform: 'translateY(0)' }),
- animations$1.style({ transform: 'translateY(-25%)' })
- ]))),
- animations$1.state('desc-to-hint, asc-to-hint, hint, desc-to-active, asc-to-active, active', animations$1.style({ transform: 'translateY(0)' })),
- animations$1.state('hint-to-desc, active-to-desc, desc', animations$1.style({ transform: 'translateY(-25%)' })),
- animations$1.state('hint-to-asc, active-to-asc, asc', animations$1.style({ transform: 'translateY(25%)' })),
- ]),
- /**
- * Necessary trigger that calls animate on children animations.
- */
- allowChildren: animations$1.trigger('allowChildren', [
- animations$1.transition('* <=> *', [
- animations$1.query('@*', animations$1.animateChild(), { optional: true })
- ])
- ]),
- };
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * To modify the labels and text displayed, create a new instance of MatSortHeaderIntl and
- * include it in a custom provider.
- */
- var MatSortHeaderIntl = /** @class */ (function () {
- function MatSortHeaderIntl() {
- /**
- * Stream that emits whenever the labels here are changed. Use this to notify
- * components if the labels have changed after initialization.
- */
- this.changes = new rxjs.Subject();
- /**
- * ARIA label for the sorting button.
- */
- this.sortButtonLabel = (/**
- * @param {?} id
- * @return {?}
- */
- function (id) {
- return "Change sorting for " + id;
- });
- }
- MatSortHeaderIntl.decorators = [
- { type: core.Injectable, args: [{ providedIn: 'root' },] },
- ];
- /** @nocollapse */ MatSortHeaderIntl.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function MatSortHeaderIntl_Factory() { return new MatSortHeaderIntl(); }, token: MatSortHeaderIntl, providedIn: "root" });
- return MatSortHeaderIntl;
- }());
- /**
- * \@docs-private
- * @param {?} parentIntl
- * @return {?}
- */
- function MAT_SORT_HEADER_INTL_PROVIDER_FACTORY(parentIntl) {
- return parentIntl || new MatSortHeaderIntl();
- }
- /**
- * \@docs-private
- * @type {?}
- */
- var MAT_SORT_HEADER_INTL_PROVIDER = {
- // If there is already an MatSortHeaderIntl available, use that. Otherwise, provide a new one.
- provide: MatSortHeaderIntl,
- deps: [[new core.Optional(), new core.SkipSelf(), MatSortHeaderIntl]],
- useFactory: MAT_SORT_HEADER_INTL_PROVIDER_FACTORY
- };
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- // Boilerplate for applying mixins to the sort header.
- /**
- * \@docs-private
- */
- var
- // Boilerplate for applying mixins to the sort header.
- /**
- * \@docs-private
- */
- MatSortHeaderBase = /** @class */ (function () {
- function MatSortHeaderBase() {
- }
- return MatSortHeaderBase;
- }());
- /** @type {?} */
- var _MatSortHeaderMixinBase = mixinDisabled(MatSortHeaderBase);
- /**
- * Applies sorting behavior (click to change sort) and styles to an element, including an
- * arrow to display the current sort direction.
- *
- * Must be provided with an id and contained within a parent MatSort directive.
- *
- * If used on header cells in a CdkTable, it will automatically default its id from its containing
- * column definition.
- */
- var MatSortHeader = /** @class */ (function (_super) {
- __extends(MatSortHeader, _super);
- function MatSortHeader(_intl, changeDetectorRef, _sort, _columnDef) {
- var _this =
- // Note that we use a string token for the `_columnDef`, because the value is provided both by
- // `material/table` and `cdk/table` and we can't have the CDK depending on Material,
- // and we want to avoid having the sort header depending on the CDK table because
- // of this single reference.
- _super.call(this) || this;
- _this._intl = _intl;
- _this._sort = _sort;
- _this._columnDef = _columnDef;
- /**
- * Flag set to true when the indicator should be displayed while the sort is not active. Used to
- * provide an affordance that the header is sortable by showing on focus and hover.
- */
- _this._showIndicatorHint = false;
- /**
- * The direction the arrow should be facing according to the current state.
- */
- _this._arrowDirection = '';
- /**
- * Whether the view state animation should show the transition between the `from` and `to` states.
- */
- _this._disableViewStateAnimation = false;
- /**
- * Sets the position of the arrow that displays when sorted.
- */
- _this.arrowPosition = 'after';
- if (!_sort) {
- throw getSortHeaderNotContainedWithinSortError();
- }
- _this._rerenderSubscription = rxjs.merge(_sort.sortChange, _sort._stateChanges, _intl.changes)
- .subscribe((/**
- * @return {?}
- */
- function () {
- if (_this._isSorted()) {
- _this._updateArrowDirection();
- }
- // If this header was recently active and now no longer sorted, animate away the arrow.
- if (!_this._isSorted() && _this._viewState && _this._viewState.toState === 'active') {
- _this._disableViewStateAnimation = false;
- _this._setAnimationTransitionState({ fromState: 'active', toState: _this._arrowDirection });
- }
- changeDetectorRef.markForCheck();
- }));
- return _this;
- }
- Object.defineProperty(MatSortHeader.prototype, "disableClear", {
- /** Overrides the disable clear value of the containing MatSort for this MatSortable. */
- get: /**
- * Overrides the disable clear value of the containing MatSort for this MatSortable.
- * @return {?}
- */
- function () { return this._disableClear; },
- set: /**
- * @param {?} v
- * @return {?}
- */
- function (v) { this._disableClear = coercion.coerceBooleanProperty(v); },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- MatSortHeader.prototype.ngOnInit = /**
- * @return {?}
- */
- function () {
- if (!this.id && this._columnDef) {
- this.id = this._columnDef.name;
- }
- // Initialize the direction of the arrow and set the view state to be immediately that state.
- this._updateArrowDirection();
- this._setAnimationTransitionState({ toState: this._isSorted() ? 'active' : this._arrowDirection });
- this._sort.register(this);
- };
- /**
- * @return {?}
- */
- MatSortHeader.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- this._sort.deregister(this);
- this._rerenderSubscription.unsubscribe();
- };
- /**
- * Sets the "hint" state such that the arrow will be semi-transparently displayed as a hint to the
- * user showing what the active sort will become. If set to false, the arrow will fade away.
- */
- /**
- * Sets the "hint" state such that the arrow will be semi-transparently displayed as a hint to the
- * user showing what the active sort will become. If set to false, the arrow will fade away.
- * @param {?} visible
- * @return {?}
- */
- MatSortHeader.prototype._setIndicatorHintVisible = /**
- * Sets the "hint" state such that the arrow will be semi-transparently displayed as a hint to the
- * user showing what the active sort will become. If set to false, the arrow will fade away.
- * @param {?} visible
- * @return {?}
- */
- function (visible) {
- // No-op if the sort header is disabled - should not make the hint visible.
- if (this._isDisabled() && visible) {
- return;
- }
- this._showIndicatorHint = visible;
- if (!this._isSorted()) {
- this._updateArrowDirection();
- if (this._showIndicatorHint) {
- this._setAnimationTransitionState({ fromState: this._arrowDirection, toState: 'hint' });
- }
- else {
- this._setAnimationTransitionState({ fromState: 'hint', toState: this._arrowDirection });
- }
- }
- };
- /**
- * Sets the animation transition view state for the arrow's position and opacity. If the
- * `disableViewStateAnimation` flag is set to true, the `fromState` will be ignored so that
- * no animation appears.
- */
- /**
- * Sets the animation transition view state for the arrow's position and opacity. If the
- * `disableViewStateAnimation` flag is set to true, the `fromState` will be ignored so that
- * no animation appears.
- * @param {?} viewState
- * @return {?}
- */
- MatSortHeader.prototype._setAnimationTransitionState = /**
- * Sets the animation transition view state for the arrow's position and opacity. If the
- * `disableViewStateAnimation` flag is set to true, the `fromState` will be ignored so that
- * no animation appears.
- * @param {?} viewState
- * @return {?}
- */
- function (viewState) {
- this._viewState = viewState;
- // If the animation for arrow position state (opacity/translation) should be disabled,
- // remove the fromState so that it jumps right to the toState.
- if (this._disableViewStateAnimation) {
- this._viewState = { toState: viewState.toState };
- }
- };
- /** Triggers the sort on this sort header and removes the indicator hint. */
- /**
- * Triggers the sort on this sort header and removes the indicator hint.
- * @return {?}
- */
- MatSortHeader.prototype._handleClick = /**
- * Triggers the sort on this sort header and removes the indicator hint.
- * @return {?}
- */
- function () {
- if (this._isDisabled()) {
- return;
- }
- this._sort.sort(this);
- // Do not show the animation if the header was already shown in the right position.
- if (this._viewState.toState === 'hint' || this._viewState.toState === 'active') {
- this._disableViewStateAnimation = true;
- }
- // If the arrow is now sorted, animate the arrow into place. Otherwise, animate it away into
- // the direction it is facing.
- /** @type {?} */
- var viewState = this._isSorted() ?
- { fromState: this._arrowDirection, toState: 'active' } :
- { fromState: 'active', toState: this._arrowDirection };
- this._setAnimationTransitionState(viewState);
- this._showIndicatorHint = false;
- };
- /** Whether this MatSortHeader is currently sorted in either ascending or descending order. */
- /**
- * Whether this MatSortHeader is currently sorted in either ascending or descending order.
- * @return {?}
- */
- MatSortHeader.prototype._isSorted = /**
- * Whether this MatSortHeader is currently sorted in either ascending or descending order.
- * @return {?}
- */
- function () {
- return this._sort.active == this.id &&
- (this._sort.direction === 'asc' || this._sort.direction === 'desc');
- };
- /** Returns the animation state for the arrow direction (indicator and pointers). */
- /**
- * Returns the animation state for the arrow direction (indicator and pointers).
- * @return {?}
- */
- MatSortHeader.prototype._getArrowDirectionState = /**
- * Returns the animation state for the arrow direction (indicator and pointers).
- * @return {?}
- */
- function () {
- return "" + (this._isSorted() ? 'active-' : '') + this._arrowDirection;
- };
- /** Returns the arrow position state (opacity, translation). */
- /**
- * Returns the arrow position state (opacity, translation).
- * @return {?}
- */
- MatSortHeader.prototype._getArrowViewState = /**
- * Returns the arrow position state (opacity, translation).
- * @return {?}
- */
- function () {
- /** @type {?} */
- var fromState = this._viewState.fromState;
- return (fromState ? fromState + "-to-" : '') + this._viewState.toState;
- };
- /**
- * Updates the direction the arrow should be pointing. If it is not sorted, the arrow should be
- * facing the start direction. Otherwise if it is sorted, the arrow should point in the currently
- * active sorted direction. The reason this is updated through a function is because the direction
- * should only be changed at specific times - when deactivated but the hint is displayed and when
- * the sort is active and the direction changes. Otherwise the arrow's direction should linger
- * in cases such as the sort becoming deactivated but we want to animate the arrow away while
- * preserving its direction, even though the next sort direction is actually different and should
- * only be changed once the arrow displays again (hint or activation).
- */
- /**
- * Updates the direction the arrow should be pointing. If it is not sorted, the arrow should be
- * facing the start direction. Otherwise if it is sorted, the arrow should point in the currently
- * active sorted direction. The reason this is updated through a function is because the direction
- * should only be changed at specific times - when deactivated but the hint is displayed and when
- * the sort is active and the direction changes. Otherwise the arrow's direction should linger
- * in cases such as the sort becoming deactivated but we want to animate the arrow away while
- * preserving its direction, even though the next sort direction is actually different and should
- * only be changed once the arrow displays again (hint or activation).
- * @return {?}
- */
- MatSortHeader.prototype._updateArrowDirection = /**
- * Updates the direction the arrow should be pointing. If it is not sorted, the arrow should be
- * facing the start direction. Otherwise if it is sorted, the arrow should point in the currently
- * active sorted direction. The reason this is updated through a function is because the direction
- * should only be changed at specific times - when deactivated but the hint is displayed and when
- * the sort is active and the direction changes. Otherwise the arrow's direction should linger
- * in cases such as the sort becoming deactivated but we want to animate the arrow away while
- * preserving its direction, even though the next sort direction is actually different and should
- * only be changed once the arrow displays again (hint or activation).
- * @return {?}
- */
- function () {
- this._arrowDirection = this._isSorted() ?
- this._sort.direction :
- (this.start || this._sort.start);
- };
- /**
- * @return {?}
- */
- MatSortHeader.prototype._isDisabled = /**
- * @return {?}
- */
- function () {
- return this._sort.disabled || this.disabled;
- };
- /**
- * Gets the aria-sort attribute that should be applied to this sort header. If this header
- * is not sorted, returns null so that the attribute is removed from the host element. Aria spec
- * says that the aria-sort property should only be present on one header at a time, so removing
- * ensures this is true.
- */
- /**
- * Gets the aria-sort attribute that should be applied to this sort header. If this header
- * is not sorted, returns null so that the attribute is removed from the host element. Aria spec
- * says that the aria-sort property should only be present on one header at a time, so removing
- * ensures this is true.
- * @return {?}
- */
- MatSortHeader.prototype._getAriaSortAttribute = /**
- * Gets the aria-sort attribute that should be applied to this sort header. If this header
- * is not sorted, returns null so that the attribute is removed from the host element. Aria spec
- * says that the aria-sort property should only be present on one header at a time, so removing
- * ensures this is true.
- * @return {?}
- */
- function () {
- if (!this._isSorted()) {
- return null;
- }
- return this._sort.direction == 'asc' ? 'ascending' : 'descending';
- };
- /** Whether the arrow inside the sort header should be rendered. */
- /**
- * Whether the arrow inside the sort header should be rendered.
- * @return {?}
- */
- MatSortHeader.prototype._renderArrow = /**
- * Whether the arrow inside the sort header should be rendered.
- * @return {?}
- */
- function () {
- return !this._isDisabled() || this._isSorted();
- };
- MatSortHeader.decorators = [
- { type: core.Component, args: [{selector: '[mat-sort-header]',
- exportAs: 'matSortHeader',
- 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>",
- 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}"],
- host: {
- '(click)': '_handleClick()',
- '(mouseenter)': '_setIndicatorHintVisible(true)',
- '(longpress)': '_setIndicatorHintVisible(true)',
- '(mouseleave)': '_setIndicatorHintVisible(false)',
- '[attr.aria-sort]': '_getAriaSortAttribute()',
- '[class.mat-sort-header-disabled]': '_isDisabled()',
- },
- encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- inputs: ['disabled'],
- animations: [
- matSortAnimations.indicator,
- matSortAnimations.leftPointer,
- matSortAnimations.rightPointer,
- matSortAnimations.arrowOpacity,
- matSortAnimations.arrowPosition,
- matSortAnimations.allowChildren,
- ]
- },] },
- ];
- /** @nocollapse */
- MatSortHeader.ctorParameters = function () { return [
- { type: MatSortHeaderIntl },
- { type: core.ChangeDetectorRef },
- { type: MatSort, decorators: [{ type: core.Optional }] },
- { type: undefined, decorators: [{ type: core.Inject, args: ['MAT_SORT_HEADER_COLUMN_DEF',] }, { type: core.Optional }] }
- ]; };
- MatSortHeader.propDecorators = {
- id: [{ type: core.Input, args: ['mat-sort-header',] }],
- arrowPosition: [{ type: core.Input }],
- start: [{ type: core.Input }],
- disableClear: [{ type: core.Input }]
- };
- return MatSortHeader;
- }(_MatSortHeaderMixinBase));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var MatSortModule = /** @class */ (function () {
- function MatSortModule() {
- }
- MatSortModule.decorators = [
- { type: core.NgModule, args: [{
- imports: [common.CommonModule],
- exports: [MatSort, MatSortHeader],
- declarations: [MatSort, MatSortHeader],
- providers: [MAT_SORT_HEADER_INTL_PROVIDER]
- },] },
- ];
- return MatSortModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var MatStepLabel = /** @class */ (function (_super) {
- __extends(MatStepLabel, _super);
- function MatStepLabel() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- MatStepLabel.decorators = [
- { type: core.Directive, args: [{
- selector: '[matStepLabel]',
- },] },
- ];
- return MatStepLabel;
- }(stepper.CdkStepLabel));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Stepper data that is required for internationalization.
- */
- var MatStepperIntl = /** @class */ (function () {
- function MatStepperIntl() {
- /**
- * Stream that emits whenever the labels here are changed. Use this to notify
- * components if the labels have changed after initialization.
- */
- this.changes = new rxjs.Subject();
- /**
- * Label that is rendered below optional steps.
- */
- this.optionalLabel = 'Optional';
- }
- MatStepperIntl.decorators = [
- { type: core.Injectable, args: [{ providedIn: 'root' },] },
- ];
- /** @nocollapse */ MatStepperIntl.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function MatStepperIntl_Factory() { return new MatStepperIntl(); }, token: MatStepperIntl, providedIn: "root" });
- return MatStepperIntl;
- }());
- /**
- * \@docs-private
- * @param {?} parentIntl
- * @return {?}
- */
- function MAT_STEPPER_INTL_PROVIDER_FACTORY(parentIntl) {
- return parentIntl || new MatStepperIntl();
- }
- /**
- * \@docs-private
- * @type {?}
- */
- var MAT_STEPPER_INTL_PROVIDER = {
- provide: MatStepperIntl,
- deps: [[new core.Optional(), new core.SkipSelf(), MatStepperIntl]],
- useFactory: MAT_STEPPER_INTL_PROVIDER_FACTORY
- };
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var MatStepHeader = /** @class */ (function (_super) {
- __extends(MatStepHeader, _super);
- function MatStepHeader(_intl, _focusMonitor, _elementRef, changeDetectorRef) {
- var _this = _super.call(this, _elementRef) || this;
- _this._intl = _intl;
- _this._focusMonitor = _focusMonitor;
- _focusMonitor.monitor(_elementRef, true);
- _this._intlSubscription = _intl.changes.subscribe((/**
- * @return {?}
- */
- function () { return changeDetectorRef.markForCheck(); }));
- return _this;
- }
- /**
- * @return {?}
- */
- MatStepHeader.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- this._intlSubscription.unsubscribe();
- this._focusMonitor.stopMonitoring(this._elementRef);
- };
- /** Focuses the step header. */
- /**
- * Focuses the step header.
- * @return {?}
- */
- MatStepHeader.prototype.focus = /**
- * Focuses the step header.
- * @return {?}
- */
- function () {
- this._focusMonitor.focusVia(this._elementRef, 'program');
- };
- /** Returns string label of given step if it is a text label. */
- /**
- * Returns string label of given step if it is a text label.
- * @return {?}
- */
- MatStepHeader.prototype._stringLabel = /**
- * Returns string label of given step if it is a text label.
- * @return {?}
- */
- function () {
- return this.label instanceof MatStepLabel ? null : this.label;
- };
- /** Returns MatStepLabel if the label of given step is a template label. */
- /**
- * Returns MatStepLabel if the label of given step is a template label.
- * @return {?}
- */
- MatStepHeader.prototype._templateLabel = /**
- * Returns MatStepLabel if the label of given step is a template label.
- * @return {?}
- */
- function () {
- return this.label instanceof MatStepLabel ? this.label : null;
- };
- /** Returns the host HTML element. */
- /**
- * Returns the host HTML element.
- * @return {?}
- */
- MatStepHeader.prototype._getHostElement = /**
- * Returns the host HTML element.
- * @return {?}
- */
- function () {
- return this._elementRef.nativeElement;
- };
- /** Template context variables that are exposed to the `matStepperIcon` instances. */
- /**
- * Template context variables that are exposed to the `matStepperIcon` instances.
- * @return {?}
- */
- MatStepHeader.prototype._getIconContext = /**
- * Template context variables that are exposed to the `matStepperIcon` instances.
- * @return {?}
- */
- function () {
- return {
- index: this.index,
- active: this.active,
- optional: this.optional
- };
- };
- /**
- * @param {?} state
- * @return {?}
- */
- MatStepHeader.prototype._getDefaultTextForState = /**
- * @param {?} state
- * @return {?}
- */
- function (state$$1) {
- if (state$$1 == 'number') {
- return "" + (this.index + 1);
- }
- if (state$$1 == 'edit') {
- return 'create';
- }
- if (state$$1 == 'error') {
- return 'warning';
- }
- return state$$1;
- };
- MatStepHeader.decorators = [
- { type: core.Component, args: [{selector: 'mat-step-header',
- 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>",
- 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}"],
- host: {
- 'class': 'mat-step-header',
- 'role': 'tab',
- },
- encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- },] },
- ];
- /** @nocollapse */
- MatStepHeader.ctorParameters = function () { return [
- { type: MatStepperIntl },
- { type: a11y.FocusMonitor },
- { type: core.ElementRef },
- { type: core.ChangeDetectorRef }
- ]; };
- MatStepHeader.propDecorators = {
- state: [{ type: core.Input }],
- label: [{ type: core.Input }],
- errorMessage: [{ type: core.Input }],
- iconOverrides: [{ type: core.Input }],
- index: [{ type: core.Input }],
- selected: [{ type: core.Input }],
- active: [{ type: core.Input }],
- optional: [{ type: core.Input }],
- disableRipple: [{ type: core.Input }]
- };
- return MatStepHeader;
- }(stepper.CdkStepHeader));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Animations used by the Material steppers.
- * \@docs-private
- * @type {?}
- */
- var matStepperAnimations = {
- /**
- * Animation that transitions the step along the X axis in a horizontal stepper.
- */
- horizontalStepTransition: animations$1.trigger('stepTransition', [
- animations$1.state('previous', animations$1.style({ transform: 'translate3d(-100%, 0, 0)', visibility: 'hidden' })),
- animations$1.state('current', animations$1.style({ transform: 'none', visibility: 'visible' })),
- animations$1.state('next', animations$1.style({ transform: 'translate3d(100%, 0, 0)', visibility: 'hidden' })),
- animations$1.transition('* => *', animations$1.animate('500ms cubic-bezier(0.35, 0, 0.25, 1)'))
- ]),
- /**
- * Animation that transitions the step along the Y axis in a vertical stepper.
- */
- verticalStepTransition: animations$1.trigger('stepTransition', [
- animations$1.state('previous', animations$1.style({ height: '0px', visibility: 'hidden' })),
- animations$1.state('next', animations$1.style({ height: '0px', visibility: 'hidden' })),
- animations$1.state('current', animations$1.style({ height: '*', visibility: 'visible' })),
- animations$1.transition('* <=> current', animations$1.animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)'))
- ])
- };
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Template to be used to override the icons inside the step header.
- */
- var MatStepperIcon = /** @class */ (function () {
- function MatStepperIcon(templateRef) {
- this.templateRef = templateRef;
- }
- MatStepperIcon.decorators = [
- { type: core.Directive, args: [{
- selector: 'ng-template[matStepperIcon]',
- },] },
- ];
- /** @nocollapse */
- MatStepperIcon.ctorParameters = function () { return [
- { type: core.TemplateRef }
- ]; };
- MatStepperIcon.propDecorators = {
- name: [{ type: core.Input, args: ['matStepperIcon',] }]
- };
- return MatStepperIcon;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var MatStep = /** @class */ (function (_super) {
- __extends(MatStep, _super);
- /** @breaking-change 8.0.0 remove the `?` after `stepperOptions` */
- function MatStep(stepper$$1, _errorStateMatcher, stepperOptions) {
- var _this = _super.call(this, stepper$$1, stepperOptions) || this;
- _this._errorStateMatcher = _errorStateMatcher;
- return _this;
- }
- /** Custom error state matcher that additionally checks for validity of interacted form. */
- /**
- * Custom error state matcher that additionally checks for validity of interacted form.
- * @param {?} control
- * @param {?} form
- * @return {?}
- */
- MatStep.prototype.isErrorState = /**
- * Custom error state matcher that additionally checks for validity of interacted form.
- * @param {?} control
- * @param {?} form
- * @return {?}
- */
- function (control, form) {
- /** @type {?} */
- var originalErrorState = this._errorStateMatcher.isErrorState(control, form);
- // Custom error state checks for the validity of form that is not submitted or touched
- // since user can trigger a form change by calling for another step without directly
- // interacting with the current form.
- /** @type {?} */
- var customErrorState = !!(control && control.invalid && this.interacted);
- return originalErrorState || customErrorState;
- };
- MatStep.decorators = [
- { type: core.Component, args: [{selector: 'mat-step',
- template: "<ng-template><ng-content></ng-content></ng-template>",
- providers: [{ provide: ErrorStateMatcher, useExisting: MatStep }],
- encapsulation: core.ViewEncapsulation.None,
- exportAs: 'matStep',
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- },] },
- ];
- /** @nocollapse */
- MatStep.ctorParameters = function () { return [
- { type: MatStepper, decorators: [{ type: core.Inject, args: [core.forwardRef((/**
- * @return {?}
- */
- function () { return MatStepper; })),] }] },
- { type: ErrorStateMatcher, decorators: [{ type: core.SkipSelf }] },
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [stepper.STEPPER_GLOBAL_OPTIONS,] }] }
- ]; };
- MatStep.propDecorators = {
- stepLabel: [{ type: core.ContentChild, args: [MatStepLabel, { static: false },] }]
- };
- return MatStep;
- }(stepper.CdkStep));
- var MatStepper = /** @class */ (function (_super) {
- __extends(MatStepper, _super);
- function MatStepper() {
- var _this = _super !== null && _super.apply(this, arguments) || this;
- /**
- * Event emitted when the current step is done transitioning in.
- */
- _this.animationDone = new core.EventEmitter();
- /**
- * Consumer-specified template-refs to be used to override the header icons.
- */
- _this._iconOverrides = {};
- /**
- * Stream of animation `done` events when the body expands/collapses.
- */
- _this._animationDone = new rxjs.Subject();
- return _this;
- }
- /**
- * @return {?}
- */
- MatStepper.prototype.ngAfterContentInit = /**
- * @return {?}
- */
- function () {
- var _this = this;
- this._icons.forEach((/**
- * @param {?} __0
- * @return {?}
- */
- function (_a) {
- var name = _a.name, templateRef = _a.templateRef;
- return _this._iconOverrides[name] = templateRef;
- }));
- // Mark the component for change detection whenever the content children query changes
- this._steps.changes.pipe(operators.takeUntil(this._destroyed)).subscribe((/**
- * @return {?}
- */
- function () { return _this._stateChanged(); }));
- this._animationDone.pipe(
- // This needs a `distinctUntilChanged` in order to avoid emitting the same event twice due
- // to a bug in animations where the `.done` callback gets invoked twice on some browsers.
- // See https://github.com/angular/angular/issues/24084
- operators.distinctUntilChanged((/**
- * @param {?} x
- * @param {?} y
- * @return {?}
- */
- function (x, y) { return x.fromState === y.fromState && x.toState === y.toState; })), operators.takeUntil(this._destroyed)).subscribe((/**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- if (((/** @type {?} */ (event.toState))) === 'current') {
- _this.animationDone.emit();
- }
- }));
- };
- MatStepper.decorators = [
- { type: core.Directive, args: [{ selector: '[matStepper]', providers: [{ provide: stepper.CdkStepper, useExisting: MatStepper }] },] },
- ];
- MatStepper.propDecorators = {
- _stepHeader: [{ type: core.ViewChildren, args: [MatStepHeader,] }],
- _steps: [{ type: core.ContentChildren, args: [MatStep,] }],
- _icons: [{ type: core.ContentChildren, args: [MatStepperIcon,] }],
- animationDone: [{ type: core.Output }],
- disableRipple: [{ type: core.Input }]
- };
- return MatStepper;
- }(stepper.CdkStepper));
- var MatHorizontalStepper = /** @class */ (function (_super) {
- __extends(MatHorizontalStepper, _super);
- function MatHorizontalStepper() {
- var _this = _super !== null && _super.apply(this, arguments) || this;
- /**
- * Whether the label should display in bottom or end position.
- */
- _this.labelPosition = 'end';
- return _this;
- }
- MatHorizontalStepper.decorators = [
- { type: core.Component, args: [{selector: 'mat-horizontal-stepper',
- exportAs: 'matHorizontalStepper',
- 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>",
- 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}"],
- inputs: ['selectedIndex'],
- host: {
- 'class': 'mat-stepper-horizontal',
- '[class.mat-stepper-label-position-end]': 'labelPosition == "end"',
- '[class.mat-stepper-label-position-bottom]': 'labelPosition == "bottom"',
- 'aria-orientation': 'horizontal',
- 'role': 'tablist',
- },
- animations: [matStepperAnimations.horizontalStepTransition],
- providers: [
- { provide: MatStepper, useExisting: MatHorizontalStepper },
- { provide: stepper.CdkStepper, useExisting: MatHorizontalStepper }
- ],
- encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- },] },
- ];
- MatHorizontalStepper.propDecorators = {
- labelPosition: [{ type: core.Input }]
- };
- return MatHorizontalStepper;
- }(MatStepper));
- var MatVerticalStepper = /** @class */ (function (_super) {
- __extends(MatVerticalStepper, _super);
- function MatVerticalStepper(dir, changeDetectorRef,
- // @breaking-change 8.0.0 `elementRef` and `_document` parameters to become required.
- elementRef, _document) {
- var _this = _super.call(this, dir, changeDetectorRef, elementRef, _document) || this;
- _this._orientation = 'vertical';
- return _this;
- }
- MatVerticalStepper.decorators = [
- { type: core.Component, args: [{selector: 'mat-vertical-stepper',
- exportAs: 'matVerticalStepper',
- 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>",
- 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}"],
- inputs: ['selectedIndex'],
- host: {
- 'class': 'mat-stepper-vertical',
- 'aria-orientation': 'vertical',
- 'role': 'tablist',
- },
- animations: [matStepperAnimations.verticalStepTransition],
- providers: [
- { provide: MatStepper, useExisting: MatVerticalStepper },
- { provide: stepper.CdkStepper, useExisting: MatVerticalStepper }
- ],
- encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- },] },
- ];
- /** @nocollapse */
- MatVerticalStepper.ctorParameters = function () { return [
- { type: bidi.Directionality, decorators: [{ type: core.Optional }] },
- { type: core.ChangeDetectorRef },
- { type: core.ElementRef },
- { type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] }
- ]; };
- return MatVerticalStepper;
- }(MatStepper));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Button that moves to the next step in a stepper workflow.
- */
- var MatStepperNext = /** @class */ (function (_super) {
- __extends(MatStepperNext, _super);
- function MatStepperNext() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- MatStepperNext.decorators = [
- { type: core.Directive, args: [{
- selector: 'button[matStepperNext]',
- host: {
- '[type]': 'type',
- },
- inputs: ['type']
- },] },
- ];
- return MatStepperNext;
- }(stepper.CdkStepperNext));
- /**
- * Button that moves to the previous step in a stepper workflow.
- */
- var MatStepperPrevious = /** @class */ (function (_super) {
- __extends(MatStepperPrevious, _super);
- function MatStepperPrevious() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- MatStepperPrevious.decorators = [
- { type: core.Directive, args: [{
- selector: 'button[matStepperPrevious]',
- host: {
- '[type]': 'type',
- },
- inputs: ['type']
- },] },
- ];
- return MatStepperPrevious;
- }(stepper.CdkStepperPrevious));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var MatStepperModule = /** @class */ (function () {
- function MatStepperModule() {
- }
- MatStepperModule.decorators = [
- { type: core.NgModule, args: [{
- imports: [
- MatCommonModule,
- common.CommonModule,
- portal.PortalModule,
- MatButtonModule,
- stepper.CdkStepperModule,
- MatIconModule,
- MatRippleModule,
- ],
- exports: [
- MatCommonModule,
- MatHorizontalStepper,
- MatVerticalStepper,
- MatStep,
- MatStepLabel,
- MatStepper,
- MatStepperNext,
- MatStepperPrevious,
- MatStepHeader,
- MatStepperIcon,
- ],
- declarations: [
- MatHorizontalStepper,
- MatVerticalStepper,
- MatStep,
- MatStepLabel,
- MatStepper,
- MatStepperNext,
- MatStepperPrevious,
- MatStepHeader,
- MatStepperIcon,
- ],
- providers: [MAT_STEPPER_INTL_PROVIDER, ErrorStateMatcher],
- },] },
- ];
- return MatStepperModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Wrapper for the CdkTable with Material design styles.
- * @template T
- */
- var MatTable = /** @class */ (function (_super) {
- __extends(MatTable, _super);
- function MatTable() {
- var _this = _super !== null && _super.apply(this, arguments) || this;
- /**
- * Overrides the sticky CSS class set by the `CdkTable`.
- */
- _this.stickyCssClass = 'mat-table-sticky';
- return _this;
- }
- MatTable.decorators = [
- { type: core.Component, args: [{selector: 'mat-table, table[mat-table]',
- exportAs: 'matTable',
- template: table.CDK_TABLE_TEMPLATE,
- 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}"],
- host: {
- 'class': 'mat-table',
- },
- providers: [{ provide: table.CdkTable, useExisting: MatTable }],
- encapsulation: core.ViewEncapsulation.None,
- // See note on CdkTable for explanation on why this uses the default change detection strategy.
- // tslint:disable-next-line:validate-decorators
- changeDetection: core.ChangeDetectionStrategy.Default,
- },] },
- ];
- return MatTable;
- }(table.CdkTable));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Cell definition for the mat-table.
- * Captures the template of a column's data row cell as well as cell-specific properties.
- */
- var MatCellDef = /** @class */ (function (_super) {
- __extends(MatCellDef, _super);
- function MatCellDef() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- MatCellDef.decorators = [
- { type: core.Directive, args: [{
- selector: '[matCellDef]',
- providers: [{ provide: table.CdkCellDef, useExisting: MatCellDef }]
- },] },
- ];
- return MatCellDef;
- }(table.CdkCellDef));
- /**
- * Header cell definition for the mat-table.
- * Captures the template of a column's header cell and as well as cell-specific properties.
- */
- var MatHeaderCellDef = /** @class */ (function (_super) {
- __extends(MatHeaderCellDef, _super);
- function MatHeaderCellDef() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- MatHeaderCellDef.decorators = [
- { type: core.Directive, args: [{
- selector: '[matHeaderCellDef]',
- providers: [{ provide: table.CdkHeaderCellDef, useExisting: MatHeaderCellDef }]
- },] },
- ];
- return MatHeaderCellDef;
- }(table.CdkHeaderCellDef));
- /**
- * Footer cell definition for the mat-table.
- * Captures the template of a column's footer cell and as well as cell-specific properties.
- */
- var MatFooterCellDef = /** @class */ (function (_super) {
- __extends(MatFooterCellDef, _super);
- function MatFooterCellDef() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- MatFooterCellDef.decorators = [
- { type: core.Directive, args: [{
- selector: '[matFooterCellDef]',
- providers: [{ provide: table.CdkFooterCellDef, useExisting: MatFooterCellDef }]
- },] },
- ];
- return MatFooterCellDef;
- }(table.CdkFooterCellDef));
- /**
- * Column definition for the mat-table.
- * Defines a set of cells available for a table column.
- */
- var MatColumnDef = /** @class */ (function (_super) {
- __extends(MatColumnDef, _super);
- function MatColumnDef() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- MatColumnDef.decorators = [
- { type: core.Directive, args: [{
- selector: '[matColumnDef]',
- providers: [
- { provide: table.CdkColumnDef, useExisting: MatColumnDef },
- { provide: 'MAT_SORT_HEADER_COLUMN_DEF', useExisting: MatColumnDef }
- ],
- },] },
- ];
- MatColumnDef.propDecorators = {
- name: [{ type: core.Input, args: ['matColumnDef',] }],
- sticky: [{ type: core.Input }],
- stickyEnd: [{ type: core.Input }]
- };
- return MatColumnDef;
- }(table.CdkColumnDef));
- /**
- * Header cell template container that adds the right classes and role.
- */
- var MatHeaderCell = /** @class */ (function (_super) {
- __extends(MatHeaderCell, _super);
- function MatHeaderCell(columnDef, elementRef) {
- var _this = _super.call(this, columnDef, elementRef) || this;
- elementRef.nativeElement.classList.add("mat-column-" + columnDef.cssClassFriendlyName);
- return _this;
- }
- MatHeaderCell.decorators = [
- { type: core.Directive, args: [{
- selector: 'mat-header-cell, th[mat-header-cell]',
- host: {
- 'class': 'mat-header-cell',
- 'role': 'columnheader',
- },
- },] },
- ];
- /** @nocollapse */
- MatHeaderCell.ctorParameters = function () { return [
- { type: table.CdkColumnDef },
- { type: core.ElementRef }
- ]; };
- return MatHeaderCell;
- }(table.CdkHeaderCell));
- /**
- * Footer cell template container that adds the right classes and role.
- */
- var MatFooterCell = /** @class */ (function (_super) {
- __extends(MatFooterCell, _super);
- function MatFooterCell(columnDef, elementRef) {
- var _this = _super.call(this, columnDef, elementRef) || this;
- elementRef.nativeElement.classList.add("mat-column-" + columnDef.cssClassFriendlyName);
- return _this;
- }
- MatFooterCell.decorators = [
- { type: core.Directive, args: [{
- selector: 'mat-footer-cell, td[mat-footer-cell]',
- host: {
- 'class': 'mat-footer-cell',
- 'role': 'gridcell',
- },
- },] },
- ];
- /** @nocollapse */
- MatFooterCell.ctorParameters = function () { return [
- { type: table.CdkColumnDef },
- { type: core.ElementRef }
- ]; };
- return MatFooterCell;
- }(table.CdkFooterCell));
- /**
- * Cell template container that adds the right classes and role.
- */
- var MatCell = /** @class */ (function (_super) {
- __extends(MatCell, _super);
- function MatCell(columnDef, elementRef) {
- var _this = _super.call(this, columnDef, elementRef) || this;
- elementRef.nativeElement.classList.add("mat-column-" + columnDef.cssClassFriendlyName);
- return _this;
- }
- MatCell.decorators = [
- { type: core.Directive, args: [{
- selector: 'mat-cell, td[mat-cell]',
- host: {
- 'class': 'mat-cell',
- 'role': 'gridcell',
- },
- },] },
- ];
- /** @nocollapse */
- MatCell.ctorParameters = function () { return [
- { type: table.CdkColumnDef },
- { type: core.ElementRef }
- ]; };
- return MatCell;
- }(table.CdkCell));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Header row definition for the mat-table.
- * Captures the header row's template and other header properties such as the columns to display.
- */
- var MatHeaderRowDef = /** @class */ (function (_super) {
- __extends(MatHeaderRowDef, _super);
- function MatHeaderRowDef() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- MatHeaderRowDef.decorators = [
- { type: core.Directive, args: [{
- selector: '[matHeaderRowDef]',
- providers: [{ provide: table.CdkHeaderRowDef, useExisting: MatHeaderRowDef }],
- inputs: ['columns: matHeaderRowDef', 'sticky: matHeaderRowDefSticky'],
- },] },
- ];
- return MatHeaderRowDef;
- }(table.CdkHeaderRowDef));
- /**
- * Footer row definition for the mat-table.
- * Captures the footer row's template and other footer properties such as the columns to display.
- */
- var MatFooterRowDef = /** @class */ (function (_super) {
- __extends(MatFooterRowDef, _super);
- function MatFooterRowDef() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- MatFooterRowDef.decorators = [
- { type: core.Directive, args: [{
- selector: '[matFooterRowDef]',
- providers: [{ provide: table.CdkFooterRowDef, useExisting: MatFooterRowDef }],
- inputs: ['columns: matFooterRowDef', 'sticky: matFooterRowDefSticky'],
- },] },
- ];
- return MatFooterRowDef;
- }(table.CdkFooterRowDef));
- /**
- * Data row definition for the mat-table.
- * Captures the data row's template and other properties such as the columns to display and
- * a when predicate that describes when this row should be used.
- * @template T
- */
- var MatRowDef = /** @class */ (function (_super) {
- __extends(MatRowDef, _super);
- function MatRowDef() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- MatRowDef.decorators = [
- { type: core.Directive, args: [{
- selector: '[matRowDef]',
- providers: [{ provide: table.CdkRowDef, useExisting: MatRowDef }],
- inputs: ['columns: matRowDefColumns', 'when: matRowDefWhen'],
- },] },
- ];
- return MatRowDef;
- }(table.CdkRowDef));
- /**
- * Footer template container that contains the cell outlet. Adds the right class and role.
- */
- var MatHeaderRow = /** @class */ (function (_super) {
- __extends(MatHeaderRow, _super);
- function MatHeaderRow() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- MatHeaderRow.decorators = [
- { type: core.Component, args: [{selector: 'mat-header-row, tr[mat-header-row]',
- template: table.CDK_ROW_TEMPLATE,
- host: {
- 'class': 'mat-header-row',
- 'role': 'row',
- },
- // See note on CdkTable for explanation on why this uses the default change detection strategy.
- // tslint:disable-next-line:validate-decorators
- changeDetection: core.ChangeDetectionStrategy.Default,
- encapsulation: core.ViewEncapsulation.None,
- exportAs: 'matHeaderRow',
- providers: [{ provide: table.CdkHeaderRow, useExisting: MatHeaderRow }],
- },] },
- ];
- return MatHeaderRow;
- }(table.CdkHeaderRow));
- /**
- * Footer template container that contains the cell outlet. Adds the right class and role.
- */
- var MatFooterRow = /** @class */ (function (_super) {
- __extends(MatFooterRow, _super);
- function MatFooterRow() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- MatFooterRow.decorators = [
- { type: core.Component, args: [{selector: 'mat-footer-row, tr[mat-footer-row]',
- template: table.CDK_ROW_TEMPLATE,
- host: {
- 'class': 'mat-footer-row',
- 'role': 'row',
- },
- // See note on CdkTable for explanation on why this uses the default change detection strategy.
- // tslint:disable-next-line:validate-decorators
- changeDetection: core.ChangeDetectionStrategy.Default,
- encapsulation: core.ViewEncapsulation.None,
- exportAs: 'matFooterRow',
- providers: [{ provide: table.CdkFooterRow, useExisting: MatFooterRow }],
- },] },
- ];
- return MatFooterRow;
- }(table.CdkFooterRow));
- /**
- * Data row template container that contains the cell outlet. Adds the right class and role.
- */
- var MatRow = /** @class */ (function (_super) {
- __extends(MatRow, _super);
- function MatRow() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- MatRow.decorators = [
- { type: core.Component, args: [{selector: 'mat-row, tr[mat-row]',
- template: table.CDK_ROW_TEMPLATE,
- host: {
- 'class': 'mat-row',
- 'role': 'row',
- },
- // See note on CdkTable for explanation on why this uses the default change detection strategy.
- // tslint:disable-next-line:validate-decorators
- changeDetection: core.ChangeDetectionStrategy.Default,
- encapsulation: core.ViewEncapsulation.None,
- exportAs: 'matRow',
- providers: [{ provide: table.CdkRow, useExisting: MatRow }],
- },] },
- ];
- return MatRow;
- }(table.CdkRow));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Column that simply shows text content for the header and row cells. Assumes that the table
- * is using the native table implementation (`<table>`).
- *
- * By default, the name of this column will be the header text and data property accessor.
- * The header text can be overridden with the `headerText` input. Cell values can be overridden with
- * the `dataAccessor` input. Change the text justification to the start or end using the `justify`
- * input.
- * @template T
- */
- var MatTextColumn = /** @class */ (function (_super) {
- __extends(MatTextColumn, _super);
- function MatTextColumn() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- MatTextColumn.decorators = [
- { type: core.Component, args: [{selector: 'mat-text-column',
- 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 ",
- encapsulation: core.ViewEncapsulation.None,
- // Change detection is intentionally not set to OnPush. This component's template will be provided
- // to the table to be inserted into its view. This is problematic when change detection runs since
- // the bindings in this template will be evaluated _after_ the table's view is evaluated, which
- // mean's the template in the table's view will not have the updated value (and in fact will cause
- // an ExpressionChangedAfterItHasBeenCheckedError).
- // tslint:disable-next-line:validate-decorators
- changeDetection: core.ChangeDetectionStrategy.Default,
- },] },
- ];
- return MatTextColumn;
- }(table.CdkTextColumn));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /** @type {?} */
- var EXPORTED_DECLARATIONS = [
- // Table
- MatTable,
- // Template defs
- MatHeaderCellDef,
- MatHeaderRowDef,
- MatColumnDef,
- MatCellDef,
- MatRowDef,
- MatFooterCellDef,
- MatFooterRowDef,
- // Cell directives
- MatHeaderCell,
- MatCell,
- MatFooterCell,
- // Row directives
- MatHeaderRow,
- MatRow,
- MatFooterRow,
- MatTextColumn,
- ];
- var MatTableModule = /** @class */ (function () {
- function MatTableModule() {
- }
- MatTableModule.decorators = [
- { type: core.NgModule, args: [{
- imports: [
- table.CdkTableModule,
- common.CommonModule,
- MatCommonModule,
- ],
- exports: EXPORTED_DECLARATIONS,
- declarations: EXPORTED_DECLARATIONS,
- },] },
- ];
- return MatTableModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Corresponds to `Number.MAX_SAFE_INTEGER`. Moved out into a variable here due to
- * flaky browser support and the value not being defined in Closure's typings.
- * @type {?}
- */
- var MAX_SAFE_INTEGER = 9007199254740991;
- /**
- * Data source that accepts a client-side data array and includes native support of filtering,
- * sorting (using MatSort), and pagination (using MatPaginator).
- *
- * Allows for sort customization by overriding sortingDataAccessor, which defines how data
- * properties are accessed. Also allows for filter customization by overriding filterTermAccessor,
- * which defines how row data is converted to a string for filter matching.
- * @template T
- */
- var /**
- * Data source that accepts a client-side data array and includes native support of filtering,
- * sorting (using MatSort), and pagination (using MatPaginator).
- *
- * Allows for sort customization by overriding sortingDataAccessor, which defines how data
- * properties are accessed. Also allows for filter customization by overriding filterTermAccessor,
- * which defines how row data is converted to a string for filter matching.
- * @template T
- */
- MatTableDataSource = /** @class */ (function (_super) {
- __extends(MatTableDataSource, _super);
- function MatTableDataSource(initialData) {
- if (initialData === void 0) { initialData = []; }
- var _this = _super.call(this) || this;
- /**
- * Stream emitting render data to the table (depends on ordered data changes).
- */
- _this._renderData = new rxjs.BehaviorSubject([]);
- /**
- * Stream that emits when a new filter string is set on the data source.
- */
- _this._filter = new rxjs.BehaviorSubject('');
- /**
- * Used to react to internal changes of the paginator that are made by the data source itself.
- */
- _this._internalPageChanges = new rxjs.Subject();
- /**
- * Subscription to the changes that should trigger an update to the table's rendered rows, such
- * as filtering, sorting, pagination, or base data changes.
- */
- _this._renderChangesSubscription = rxjs.Subscription.EMPTY;
- /**
- * Data accessor function that is used for accessing data properties for sorting through
- * the default sortData function.
- * This default function assumes that the sort header IDs (which defaults to the column name)
- * matches the data's properties (e.g. column Xyz represents data['Xyz']).
- * May be set to a custom function for different behavior.
- * @param data Data object that is being accessed.
- * @param sortHeaderId The name of the column that represents the data.
- */
- _this.sortingDataAccessor = (/**
- * @param {?} data
- * @param {?} sortHeaderId
- * @return {?}
- */
- function (data, sortHeaderId) {
- /** @type {?} */
- var value = ((/** @type {?} */ (data)))[sortHeaderId];
- if (coercion._isNumberValue(value)) {
- /** @type {?} */
- var numberValue = Number(value);
- // Numbers beyond `MAX_SAFE_INTEGER` can't be compared reliably so we
- // leave them as strings. For more info: https://goo.gl/y5vbSg
- return numberValue < MAX_SAFE_INTEGER ? numberValue : value;
- }
- return value;
- });
- /**
- * Gets a sorted copy of the data array based on the state of the MatSort. Called
- * after changes are made to the filtered data or when sort changes are emitted from MatSort.
- * By default, the function retrieves the active sort and its direction and compares data
- * by retrieving data using the sortingDataAccessor. May be overridden for a custom implementation
- * of data ordering.
- * @param data The array of data that should be sorted.
- * @param sort The connected MatSort that holds the current sort state.
- */
- _this.sortData = (/**
- * @param {?} data
- * @param {?} sort
- * @return {?}
- */
- function (data, sort) {
- /** @type {?} */
- var active = sort.active;
- /** @type {?} */
- var direction = sort.direction;
- if (!active || direction == '') {
- return data;
- }
- return data.sort((/**
- * @param {?} a
- * @param {?} b
- * @return {?}
- */
- function (a, b) {
- /** @type {?} */
- var valueA = _this.sortingDataAccessor(a, active);
- /** @type {?} */
- var valueB = _this.sortingDataAccessor(b, active);
- // If both valueA and valueB exist (truthy), then compare the two. Otherwise, check if
- // one value exists while the other doesn't. In this case, existing value should come first.
- // This avoids inconsistent results when comparing values to undefined/null.
- // If neither value exists, return 0 (equal).
- /** @type {?} */
- var comparatorResult = 0;
- if (valueA != null && valueB != null) {
- // Check if one value is greater than the other; if equal, comparatorResult should remain 0.
- if (valueA > valueB) {
- comparatorResult = 1;
- }
- else if (valueA < valueB) {
- comparatorResult = -1;
- }
- }
- else if (valueA != null) {
- comparatorResult = 1;
- }
- else if (valueB != null) {
- comparatorResult = -1;
- }
- return comparatorResult * (direction == 'asc' ? 1 : -1);
- }));
- });
- /**
- * Checks if a data object matches the data source's filter string. By default, each data object
- * is converted to a string of its properties and returns true if the filter has
- * at least one occurrence in that string. By default, the filter string has its whitespace
- * trimmed and the match is case-insensitive. May be overridden for a custom implementation of
- * filter matching.
- * @param data Data object used to check against the filter.
- * @param filter Filter string that has been set on the data source.
- * @return Whether the filter matches against the data
- */
- _this.filterPredicate = (/**
- * @param {?} data
- * @param {?} filter
- * @return {?}
- */
- function (data, filter) {
- // Transform the data into a lowercase string of all property values.
- /** @type {?} */
- var dataStr = Object.keys(data).reduce((/**
- * @param {?} currentTerm
- * @param {?} key
- * @return {?}
- */
- function (currentTerm, key) {
- // Use an obscure Unicode character to delimit the words in the concatenated string.
- // This avoids matches where the values of two columns combined will match the user's query
- // (e.g. `Flute` and `Stop` will match `Test`). The character is intended to be something
- // that has a very low chance of being typed in by somebody in a text field. This one in
- // particular is "White up-pointing triangle with dot" from
- // https://en.wikipedia.org/wiki/List_of_Unicode_characters
- return currentTerm + ((/** @type {?} */ (data)))[key] + '◬';
- }), '').toLowerCase();
- // Transform the filter by converting it to lowercase and removing whitespace.
- /** @type {?} */
- var transformedFilter = filter.trim().toLowerCase();
- return dataStr.indexOf(transformedFilter) != -1;
- });
- _this._data = new rxjs.BehaviorSubject(initialData);
- _this._updateChangeSubscription();
- return _this;
- }
- Object.defineProperty(MatTableDataSource.prototype, "data", {
- /** Array of data that should be rendered by the table, where each object represents one row. */
- get: /**
- * Array of data that should be rendered by the table, where each object represents one row.
- * @return {?}
- */
- function () { return this._data.value; },
- set: /**
- * @param {?} data
- * @return {?}
- */
- function (data) { this._data.next(data); },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatTableDataSource.prototype, "filter", {
- /**
- * Filter term that should be used to filter out objects from the data array. To override how
- * data objects match to this filter string, provide a custom function for filterPredicate.
- */
- get: /**
- * Filter term that should be used to filter out objects from the data array. To override how
- * data objects match to this filter string, provide a custom function for filterPredicate.
- * @return {?}
- */
- function () { return this._filter.value; },
- set: /**
- * @param {?} filter
- * @return {?}
- */
- function (filter) { this._filter.next(filter); },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatTableDataSource.prototype, "sort", {
- /**
- * Instance of the MatSort directive used by the table to control its sorting. Sort changes
- * emitted by the MatSort will trigger an update to the table's rendered data.
- */
- get: /**
- * Instance of the MatSort directive used by the table to control its sorting. Sort changes
- * emitted by the MatSort will trigger an update to the table's rendered data.
- * @return {?}
- */
- function () { return this._sort; },
- set: /**
- * @param {?} sort
- * @return {?}
- */
- function (sort) {
- this._sort = sort;
- this._updateChangeSubscription();
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatTableDataSource.prototype, "paginator", {
- /**
- * Instance of the MatPaginator component used by the table to control what page of the data is
- * displayed. Page changes emitted by the MatPaginator will trigger an update to the
- * table's rendered data.
- *
- * Note that the data source uses the paginator's properties to calculate which page of data
- * should be displayed. If the paginator receives its properties as template inputs,
- * e.g. `[pageLength]=100` or `[pageIndex]=1`, then be sure that the paginator's view has been
- * initialized before assigning it to this data source.
- */
- get: /**
- * Instance of the MatPaginator component used by the table to control what page of the data is
- * displayed. Page changes emitted by the MatPaginator will trigger an update to the
- * table's rendered data.
- *
- * Note that the data source uses the paginator's properties to calculate which page of data
- * should be displayed. If the paginator receives its properties as template inputs,
- * e.g. `[pageLength]=100` or `[pageIndex]=1`, then be sure that the paginator's view has been
- * initialized before assigning it to this data source.
- * @return {?}
- */
- function () { return this._paginator; },
- set: /**
- * @param {?} paginator
- * @return {?}
- */
- function (paginator) {
- this._paginator = paginator;
- this._updateChangeSubscription();
- },
- enumerable: true,
- configurable: true
- });
- /**
- * Subscribe to changes that should trigger an update to the table's rendered rows. When the
- * changes occur, process the current state of the filter, sort, and pagination along with
- * the provided base data and send it to the table for rendering.
- */
- /**
- * Subscribe to changes that should trigger an update to the table's rendered rows. When the
- * changes occur, process the current state of the filter, sort, and pagination along with
- * the provided base data and send it to the table for rendering.
- * @return {?}
- */
- MatTableDataSource.prototype._updateChangeSubscription = /**
- * Subscribe to changes that should trigger an update to the table's rendered rows. When the
- * changes occur, process the current state of the filter, sort, and pagination along with
- * the provided base data and send it to the table for rendering.
- * @return {?}
- */
- function () {
- var _this = this;
- // Sorting and/or pagination should be watched if MatSort and/or MatPaginator are provided.
- // The events should emit whenever the component emits a change or initializes, or if no
- // component is provided, a stream with just a null event should be provided.
- // The `sortChange` and `pageChange` acts as a signal to the combineLatests below so that the
- // pipeline can progress to the next step. Note that the value from these streams are not used,
- // they purely act as a signal to progress in the pipeline.
- /** @type {?} */
- var sortChange = this._sort ?
- (/** @type {?} */ (rxjs.merge(this._sort.sortChange, this._sort.initialized))) :
- rxjs.of(null);
- /** @type {?} */
- var pageChange = this._paginator ?
- (/** @type {?} */ (rxjs.merge(this._paginator.page, this._internalPageChanges, this._paginator.initialized))) :
- rxjs.of(null);
- /** @type {?} */
- var dataStream = this._data;
- // Watch for base data or filter changes to provide a filtered set of data.
- /** @type {?} */
- var filteredData = rxjs.combineLatest(dataStream, this._filter)
- .pipe(operators.map((/**
- * @param {?} __0
- * @return {?}
- */
- function (_a) {
- var data = _a[0];
- return _this._filterData(data);
- })));
- // Watch for filtered data or sort changes to provide an ordered set of data.
- /** @type {?} */
- var orderedData = rxjs.combineLatest(filteredData, sortChange)
- .pipe(operators.map((/**
- * @param {?} __0
- * @return {?}
- */
- function (_a) {
- var data = _a[0];
- return _this._orderData(data);
- })));
- // Watch for ordered data or page changes to provide a paged set of data.
- /** @type {?} */
- var paginatedData = rxjs.combineLatest(orderedData, pageChange)
- .pipe(operators.map((/**
- * @param {?} __0
- * @return {?}
- */
- function (_a) {
- var data = _a[0];
- return _this._pageData(data);
- })));
- // Watched for paged data changes and send the result to the table to render.
- this._renderChangesSubscription.unsubscribe();
- this._renderChangesSubscription = paginatedData.subscribe((/**
- * @param {?} data
- * @return {?}
- */
- function (data) { return _this._renderData.next(data); }));
- };
- /**
- * Returns a filtered data array where each filter object contains the filter string within
- * the result of the filterTermAccessor function. If no filter is set, returns the data array
- * as provided.
- */
- /**
- * Returns a filtered data array where each filter object contains the filter string within
- * the result of the filterTermAccessor function. If no filter is set, returns the data array
- * as provided.
- * @param {?} data
- * @return {?}
- */
- MatTableDataSource.prototype._filterData = /**
- * Returns a filtered data array where each filter object contains the filter string within
- * the result of the filterTermAccessor function. If no filter is set, returns the data array
- * as provided.
- * @param {?} data
- * @return {?}
- */
- function (data) {
- var _this = this;
- // If there is a filter string, filter out data that does not contain it.
- // Each data object is converted to a string using the function defined by filterTermAccessor.
- // May be overridden for customization.
- this.filteredData =
- !this.filter ? data : data.filter((/**
- * @param {?} obj
- * @return {?}
- */
- function (obj) { return _this.filterPredicate(obj, _this.filter); }));
- if (this.paginator) {
- this._updatePaginator(this.filteredData.length);
- }
- return this.filteredData;
- };
- /**
- * Returns a sorted copy of the data if MatSort has a sort applied, otherwise just returns the
- * data array as provided. Uses the default data accessor for data lookup, unless a
- * sortDataAccessor function is defined.
- */
- /**
- * Returns a sorted copy of the data if MatSort has a sort applied, otherwise just returns the
- * data array as provided. Uses the default data accessor for data lookup, unless a
- * sortDataAccessor function is defined.
- * @param {?} data
- * @return {?}
- */
- MatTableDataSource.prototype._orderData = /**
- * Returns a sorted copy of the data if MatSort has a sort applied, otherwise just returns the
- * data array as provided. Uses the default data accessor for data lookup, unless a
- * sortDataAccessor function is defined.
- * @param {?} data
- * @return {?}
- */
- function (data) {
- // If there is no active sort or direction, return the data without trying to sort.
- if (!this.sort) {
- return data;
- }
- return this.sortData(data.slice(), this.sort);
- };
- /**
- * Returns a paged slice of the provided data array according to the provided MatPaginator's page
- * index and length. If there is no paginator provided, returns the data array as provided.
- */
- /**
- * Returns a paged slice of the provided data array according to the provided MatPaginator's page
- * index and length. If there is no paginator provided, returns the data array as provided.
- * @param {?} data
- * @return {?}
- */
- MatTableDataSource.prototype._pageData = /**
- * Returns a paged slice of the provided data array according to the provided MatPaginator's page
- * index and length. If there is no paginator provided, returns the data array as provided.
- * @param {?} data
- * @return {?}
- */
- function (data) {
- if (!this.paginator) {
- return data;
- }
- /** @type {?} */
- var startIndex = this.paginator.pageIndex * this.paginator.pageSize;
- return data.slice(startIndex, startIndex + this.paginator.pageSize);
- };
- /**
- * Updates the paginator to reflect the length of the filtered data, and makes sure that the page
- * index does not exceed the paginator's last page. Values are changed in a resolved promise to
- * guard against making property changes within a round of change detection.
- */
- /**
- * Updates the paginator to reflect the length of the filtered data, and makes sure that the page
- * index does not exceed the paginator's last page. Values are changed in a resolved promise to
- * guard against making property changes within a round of change detection.
- * @param {?} filteredDataLength
- * @return {?}
- */
- MatTableDataSource.prototype._updatePaginator = /**
- * Updates the paginator to reflect the length of the filtered data, and makes sure that the page
- * index does not exceed the paginator's last page. Values are changed in a resolved promise to
- * guard against making property changes within a round of change detection.
- * @param {?} filteredDataLength
- * @return {?}
- */
- function (filteredDataLength) {
- var _this = this;
- Promise.resolve().then((/**
- * @return {?}
- */
- function () {
- /** @type {?} */
- var paginator = _this.paginator;
- if (!paginator) {
- return;
- }
- paginator.length = filteredDataLength;
- // If the page index is set beyond the page, reduce it to the last page.
- if (paginator.pageIndex > 0) {
- /** @type {?} */
- var lastPageIndex = Math.ceil(paginator.length / paginator.pageSize) - 1 || 0;
- /** @type {?} */
- var newPageIndex = Math.min(paginator.pageIndex, lastPageIndex);
- if (newPageIndex !== paginator.pageIndex) {
- paginator.pageIndex = newPageIndex;
- // Since the paginator only emits after user-generated changes,
- // we need our own stream so we know to should re-render the data.
- _this._internalPageChanges.next();
- }
- }
- }));
- };
- /**
- * Used by the MatTable. Called when it connects to the data source.
- * @docs-private
- */
- /**
- * Used by the MatTable. Called when it connects to the data source.
- * \@docs-private
- * @return {?}
- */
- MatTableDataSource.prototype.connect = /**
- * Used by the MatTable. Called when it connects to the data source.
- * \@docs-private
- * @return {?}
- */
- function () { return this._renderData; };
- /**
- * Used by the MatTable. Called when it is destroyed. No-op.
- * @docs-private
- */
- /**
- * Used by the MatTable. Called when it is destroyed. No-op.
- * \@docs-private
- * @return {?}
- */
- MatTableDataSource.prototype.disconnect = /**
- * Used by the MatTable. Called when it is destroyed. No-op.
- * \@docs-private
- * @return {?}
- */
- function () { };
- return MatTableDataSource;
- }(table.DataSource));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Injection token for the MatInkBar's Positioner.
- * @type {?}
- */
- var _MAT_INK_BAR_POSITIONER = new core.InjectionToken('MatInkBarPositioner', {
- providedIn: 'root',
- factory: _MAT_INK_BAR_POSITIONER_FACTORY
- });
- /**
- * The default positioner function for the MatInkBar.
- * \@docs-private
- * @return {?}
- */
- function _MAT_INK_BAR_POSITIONER_FACTORY() {
- /** @type {?} */
- var method = (/**
- * @param {?} element
- * @return {?}
- */
- function (element) { return ({
- left: element ? (element.offsetLeft || 0) + 'px' : '0',
- width: element ? (element.offsetWidth || 0) + 'px' : '0',
- }); });
- return method;
- }
- /**
- * The ink-bar is used to display and animate the line underneath the current active tab label.
- * \@docs-private
- */
- var MatInkBar = /** @class */ (function () {
- function MatInkBar(_elementRef, _ngZone, _inkBarPositioner, _animationMode) {
- this._elementRef = _elementRef;
- this._ngZone = _ngZone;
- this._inkBarPositioner = _inkBarPositioner;
- this._animationMode = _animationMode;
- }
- /**
- * Calculates the styles from the provided element in order to align the ink-bar to that element.
- * Shows the ink bar if previously set as hidden.
- * @param element
- */
- /**
- * Calculates the styles from the provided element in order to align the ink-bar to that element.
- * Shows the ink bar if previously set as hidden.
- * @param {?} element
- * @return {?}
- */
- MatInkBar.prototype.alignToElement = /**
- * Calculates the styles from the provided element in order to align the ink-bar to that element.
- * Shows the ink bar if previously set as hidden.
- * @param {?} element
- * @return {?}
- */
- function (element) {
- var _this = this;
- this.show();
- if (typeof requestAnimationFrame !== 'undefined') {
- this._ngZone.runOutsideAngular((/**
- * @return {?}
- */
- function () {
- requestAnimationFrame((/**
- * @return {?}
- */
- function () { return _this._setStyles(element); }));
- }));
- }
- else {
- this._setStyles(element);
- }
- };
- /** Shows the ink bar. */
- /**
- * Shows the ink bar.
- * @return {?}
- */
- MatInkBar.prototype.show = /**
- * Shows the ink bar.
- * @return {?}
- */
- function () {
- this._elementRef.nativeElement.style.visibility = 'visible';
- };
- /** Hides the ink bar. */
- /**
- * Hides the ink bar.
- * @return {?}
- */
- MatInkBar.prototype.hide = /**
- * Hides the ink bar.
- * @return {?}
- */
- function () {
- this._elementRef.nativeElement.style.visibility = 'hidden';
- };
- /**
- * Sets the proper styles to the ink bar element.
- * @param element
- */
- /**
- * Sets the proper styles to the ink bar element.
- * @private
- * @param {?} element
- * @return {?}
- */
- MatInkBar.prototype._setStyles = /**
- * Sets the proper styles to the ink bar element.
- * @private
- * @param {?} element
- * @return {?}
- */
- function (element) {
- /** @type {?} */
- var positions = this._inkBarPositioner(element);
- /** @type {?} */
- var inkBar = this._elementRef.nativeElement;
- inkBar.style.left = positions.left;
- inkBar.style.width = positions.width;
- };
- MatInkBar.decorators = [
- { type: core.Directive, args: [{
- selector: 'mat-ink-bar',
- host: {
- 'class': 'mat-ink-bar',
- '[class._mat-animation-noopable]': "_animationMode === 'NoopAnimations'",
- },
- },] },
- ];
- /** @nocollapse */
- MatInkBar.ctorParameters = function () { return [
- { type: core.ElementRef },
- { type: core.NgZone },
- { type: undefined, decorators: [{ type: core.Inject, args: [_MAT_INK_BAR_POSITIONER,] }] },
- { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
- ]; };
- return MatInkBar;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Decorates the `ng-template` tags and reads out the template from it.
- */
- var MatTabContent = /** @class */ (function () {
- function MatTabContent(template) {
- this.template = template;
- }
- MatTabContent.decorators = [
- { type: core.Directive, args: [{ selector: '[matTabContent]' },] },
- ];
- /** @nocollapse */
- MatTabContent.ctorParameters = function () { return [
- { type: core.TemplateRef }
- ]; };
- return MatTabContent;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Used to flag tab labels for use with the portal directive
- */
- var MatTabLabel = /** @class */ (function (_super) {
- __extends(MatTabLabel, _super);
- function MatTabLabel() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- MatTabLabel.decorators = [
- { type: core.Directive, args: [{
- selector: '[mat-tab-label], [matTabLabel]',
- },] },
- ];
- return MatTabLabel;
- }(portal.CdkPortal));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- // Boilerplate for applying mixins to MatTab.
- /**
- * \@docs-private
- */
- var
- // Boilerplate for applying mixins to MatTab.
- /**
- * \@docs-private
- */
- MatTabBase = /** @class */ (function () {
- function MatTabBase() {
- }
- return MatTabBase;
- }());
- /** @type {?} */
- var _MatTabMixinBase = mixinDisabled(MatTabBase);
- var MatTab = /** @class */ (function (_super) {
- __extends(MatTab, _super);
- function MatTab(_viewContainerRef) {
- var _this = _super.call(this) || this;
- _this._viewContainerRef = _viewContainerRef;
- /**
- * Plain text label for the tab, used when there is no template label.
- */
- _this.textLabel = '';
- /**
- * Portal that will be the hosted content of the tab
- */
- _this._contentPortal = null;
- /**
- * Emits whenever the internal state of the tab changes.
- */
- _this._stateChanges = new rxjs.Subject();
- /**
- * The relatively indexed position where 0 represents the center, negative is left, and positive
- * represents the right.
- */
- _this.position = null;
- /**
- * The initial relatively index origin of the tab if it was created and selected after there
- * was already a selected tab. Provides context of what position the tab should originate from.
- */
- _this.origin = null;
- /**
- * Whether the tab is currently active.
- */
- _this.isActive = false;
- return _this;
- }
- Object.defineProperty(MatTab.prototype, "content", {
- /** @docs-private */
- get: /**
- * \@docs-private
- * @return {?}
- */
- function () {
- return this._contentPortal;
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @param {?} changes
- * @return {?}
- */
- MatTab.prototype.ngOnChanges = /**
- * @param {?} changes
- * @return {?}
- */
- function (changes) {
- if (changes.hasOwnProperty('textLabel') || changes.hasOwnProperty('disabled')) {
- this._stateChanges.next();
- }
- };
- /**
- * @return {?}
- */
- MatTab.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- this._stateChanges.complete();
- };
- /**
- * @return {?}
- */
- MatTab.prototype.ngOnInit = /**
- * @return {?}
- */
- function () {
- this._contentPortal = new portal.TemplatePortal(this._explicitContent || this._implicitContent, this._viewContainerRef);
- };
- MatTab.decorators = [
- { type: core.Component, args: [{selector: 'mat-tab',
- template: "<ng-template><ng-content></ng-content></ng-template>",
- inputs: ['disabled'],
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- encapsulation: core.ViewEncapsulation.None,
- exportAs: 'matTab',
- },] },
- ];
- /** @nocollapse */
- MatTab.ctorParameters = function () { return [
- { type: core.ViewContainerRef }
- ]; };
- MatTab.propDecorators = {
- templateLabel: [{ type: core.ContentChild, args: [MatTabLabel, { static: false },] }],
- _explicitContent: [{ type: core.ContentChild, args: [MatTabContent, { read: core.TemplateRef, static: true },] }],
- _implicitContent: [{ type: core.ViewChild, args: [core.TemplateRef, { static: true },] }],
- textLabel: [{ type: core.Input, args: ['label',] }],
- ariaLabel: [{ type: core.Input, args: ['aria-label',] }],
- ariaLabelledby: [{ type: core.Input, args: ['aria-labelledby',] }]
- };
- return MatTab;
- }(_MatTabMixinBase));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Animations used by the Material tabs.
- * \@docs-private
- * @type {?}
- */
- var matTabsAnimations = {
- /**
- * Animation translates a tab along the X axis.
- */
- translateTab: animations$1.trigger('translateTab', [
- // Note: transitions to `none` instead of 0, because some browsers might blur the content.
- animations$1.state('center, void, left-origin-center, right-origin-center', animations$1.style({ transform: 'none' })),
- // If the tab is either on the left or right, we additionally add a `min-height` of 1px
- // in order to ensure that the element has a height before its state changes. This is
- // necessary because Chrome does seem to skip the transition in RTL mode if the element does
- // not have a static height and is not rendered. See related issue: #9465
- animations$1.state('left', animations$1.style({ transform: 'translate3d(-100%, 0, 0)', minHeight: '1px' })),
- animations$1.state('right', animations$1.style({ transform: 'translate3d(100%, 0, 0)', minHeight: '1px' })),
- animations$1.transition('* => left, * => right, left => center, right => center', animations$1.animate('{{animationDuration}} cubic-bezier(0.35, 0, 0.25, 1)')),
- animations$1.transition('void => left-origin-center', [
- animations$1.style({ transform: 'translate3d(-100%, 0, 0)' }),
- animations$1.animate('{{animationDuration}} cubic-bezier(0.35, 0, 0.25, 1)')
- ]),
- animations$1.transition('void => right-origin-center', [
- animations$1.style({ transform: 'translate3d(100%, 0, 0)' }),
- animations$1.animate('{{animationDuration}} cubic-bezier(0.35, 0, 0.25, 1)')
- ])
- ])
- };
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * The portal host directive for the contents of the tab.
- * \@docs-private
- */
- var MatTabBodyPortal = /** @class */ (function (_super) {
- __extends(MatTabBodyPortal, _super);
- function MatTabBodyPortal(componentFactoryResolver, viewContainerRef, _host) {
- var _this = _super.call(this, componentFactoryResolver, viewContainerRef) || this;
- _this._host = _host;
- /**
- * Subscription to events for when the tab body begins centering.
- */
- _this._centeringSub = rxjs.Subscription.EMPTY;
- /**
- * Subscription to events for when the tab body finishes leaving from center position.
- */
- _this._leavingSub = rxjs.Subscription.EMPTY;
- return _this;
- }
- /** Set initial visibility or set up subscription for changing visibility. */
- /**
- * Set initial visibility or set up subscription for changing visibility.
- * @return {?}
- */
- MatTabBodyPortal.prototype.ngOnInit = /**
- * Set initial visibility or set up subscription for changing visibility.
- * @return {?}
- */
- function () {
- var _this = this;
- _super.prototype.ngOnInit.call(this);
- this._centeringSub = this._host._beforeCentering
- .pipe(operators.startWith(this._host._isCenterPosition(this._host._position)))
- .subscribe((/**
- * @param {?} isCentering
- * @return {?}
- */
- function (isCentering) {
- if (isCentering && !_this.hasAttached()) {
- _this.attach(_this._host._content);
- }
- }));
- this._leavingSub = this._host._afterLeavingCenter.subscribe((/**
- * @return {?}
- */
- function () {
- _this.detach();
- }));
- };
- /** Clean up centering subscription. */
- /**
- * Clean up centering subscription.
- * @return {?}
- */
- MatTabBodyPortal.prototype.ngOnDestroy = /**
- * Clean up centering subscription.
- * @return {?}
- */
- function () {
- _super.prototype.ngOnDestroy.call(this);
- this._centeringSub.unsubscribe();
- this._leavingSub.unsubscribe();
- };
- MatTabBodyPortal.decorators = [
- { type: core.Directive, args: [{
- selector: '[matTabBodyHost]'
- },] },
- ];
- /** @nocollapse */
- MatTabBodyPortal.ctorParameters = function () { return [
- { type: core.ComponentFactoryResolver },
- { type: core.ViewContainerRef },
- { type: MatTabBody, decorators: [{ type: core.Inject, args: [core.forwardRef((/**
- * @return {?}
- */
- function () { return MatTabBody; })),] }] }
- ]; };
- return MatTabBodyPortal;
- }(portal.CdkPortalOutlet));
- /**
- * Wrapper for the contents of a tab.
- * \@docs-private
- */
- var MatTabBody = /** @class */ (function () {
- function MatTabBody(_elementRef, _dir, changeDetectorRef) {
- var _this = this;
- this._elementRef = _elementRef;
- this._dir = _dir;
- /**
- * Subscription to the directionality change observable.
- */
- this._dirChangeSubscription = rxjs.Subscription.EMPTY;
- /**
- * Emits when an animation on the tab is complete.
- */
- this._translateTabComplete = new rxjs.Subject();
- /**
- * Event emitted when the tab begins to animate towards the center as the active tab.
- */
- this._onCentering = new core.EventEmitter();
- /**
- * Event emitted before the centering of the tab begins.
- */
- this._beforeCentering = new core.EventEmitter();
- /**
- * Event emitted before the centering of the tab begins.
- */
- this._afterLeavingCenter = new core.EventEmitter();
- /**
- * Event emitted when the tab completes its animation towards the center.
- */
- this._onCentered = new core.EventEmitter(true);
- // Note that the default value will always be overwritten by `MatTabBody`, but we need one
- // anyway to prevent the animations module from throwing an error if the body is used on its own.
- /**
- * Duration for the tab's animation.
- */
- this.animationDuration = '500ms';
- if (_dir) {
- this._dirChangeSubscription = _dir.change.subscribe((/**
- * @param {?} dir
- * @return {?}
- */
- function (dir) {
- _this._computePositionAnimationState(dir);
- changeDetectorRef.markForCheck();
- }));
- }
- // Ensure that we get unique animation events, because the `.done` callback can get
- // invoked twice in some browsers. See https://github.com/angular/angular/issues/24084.
- this._translateTabComplete.pipe(operators.distinctUntilChanged((/**
- * @param {?} x
- * @param {?} y
- * @return {?}
- */
- function (x, y) {
- return x.fromState === y.fromState && x.toState === y.toState;
- }))).subscribe((/**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- // If the transition to the center is complete, emit an event.
- if (_this._isCenterPosition(event.toState) && _this._isCenterPosition(_this._position)) {
- _this._onCentered.emit();
- }
- if (_this._isCenterPosition(event.fromState) && !_this._isCenterPosition(_this._position)) {
- _this._afterLeavingCenter.emit();
- }
- }));
- }
- Object.defineProperty(MatTabBody.prototype, "position", {
- /** The shifted index position of the tab body, where zero represents the active center tab. */
- set: /**
- * The shifted index position of the tab body, where zero represents the active center tab.
- * @param {?} position
- * @return {?}
- */
- function (position) {
- this._positionIndex = position;
- this._computePositionAnimationState();
- },
- enumerable: true,
- configurable: true
- });
- /**
- * After initialized, check if the content is centered and has an origin. If so, set the
- * special position states that transition the tab from the left or right before centering.
- */
- /**
- * After initialized, check if the content is centered and has an origin. If so, set the
- * special position states that transition the tab from the left or right before centering.
- * @return {?}
- */
- MatTabBody.prototype.ngOnInit = /**
- * After initialized, check if the content is centered and has an origin. If so, set the
- * special position states that transition the tab from the left or right before centering.
- * @return {?}
- */
- function () {
- if (this._position == 'center' && this.origin != null) {
- this._position = this._computePositionFromOrigin();
- }
- };
- /**
- * @return {?}
- */
- MatTabBody.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- this._dirChangeSubscription.unsubscribe();
- this._translateTabComplete.complete();
- };
- /**
- * @param {?} event
- * @return {?}
- */
- MatTabBody.prototype._onTranslateTabStarted = /**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- /** @type {?} */
- var isCentering = this._isCenterPosition(event.toState);
- this._beforeCentering.emit(isCentering);
- if (isCentering) {
- this._onCentering.emit(this._elementRef.nativeElement.clientHeight);
- }
- };
- /** The text direction of the containing app. */
- /**
- * The text direction of the containing app.
- * @return {?}
- */
- MatTabBody.prototype._getLayoutDirection = /**
- * The text direction of the containing app.
- * @return {?}
- */
- function () {
- return this._dir && this._dir.value === 'rtl' ? 'rtl' : 'ltr';
- };
- /** Whether the provided position state is considered center, regardless of origin. */
- /**
- * Whether the provided position state is considered center, regardless of origin.
- * @param {?} position
- * @return {?}
- */
- MatTabBody.prototype._isCenterPosition = /**
- * Whether the provided position state is considered center, regardless of origin.
- * @param {?} position
- * @return {?}
- */
- function (position) {
- return position == 'center' ||
- position == 'left-origin-center' ||
- position == 'right-origin-center';
- };
- /** Computes the position state that will be used for the tab-body animation trigger. */
- /**
- * Computes the position state that will be used for the tab-body animation trigger.
- * @private
- * @param {?=} dir
- * @return {?}
- */
- MatTabBody.prototype._computePositionAnimationState = /**
- * Computes the position state that will be used for the tab-body animation trigger.
- * @private
- * @param {?=} dir
- * @return {?}
- */
- function (dir) {
- if (dir === void 0) { dir = this._getLayoutDirection(); }
- if (this._positionIndex < 0) {
- this._position = dir == 'ltr' ? 'left' : 'right';
- }
- else if (this._positionIndex > 0) {
- this._position = dir == 'ltr' ? 'right' : 'left';
- }
- else {
- this._position = 'center';
- }
- };
- /**
- * Computes the position state based on the specified origin position. This is used if the
- * tab is becoming visible immediately after creation.
- */
- /**
- * Computes the position state based on the specified origin position. This is used if the
- * tab is becoming visible immediately after creation.
- * @private
- * @return {?}
- */
- MatTabBody.prototype._computePositionFromOrigin = /**
- * Computes the position state based on the specified origin position. This is used if the
- * tab is becoming visible immediately after creation.
- * @private
- * @return {?}
- */
- function () {
- /** @type {?} */
- var dir = this._getLayoutDirection();
- if ((dir == 'ltr' && this.origin <= 0) || (dir == 'rtl' && this.origin > 0)) {
- return 'left-origin-center';
- }
- return 'right-origin-center';
- };
- MatTabBody.decorators = [
- { type: core.Component, args: [{selector: 'mat-tab-body',
- 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>",
- styles: [".mat-tab-body-content{height:100%;overflow:auto}.mat-tab-group-dynamic-height .mat-tab-body-content{overflow:hidden}"],
- encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- animations: [matTabsAnimations.translateTab],
- host: {
- 'class': 'mat-tab-body',
- },
- },] },
- ];
- /** @nocollapse */
- MatTabBody.ctorParameters = function () { return [
- { type: core.ElementRef },
- { type: bidi.Directionality, decorators: [{ type: core.Optional }] },
- { type: core.ChangeDetectorRef }
- ]; };
- MatTabBody.propDecorators = {
- _onCentering: [{ type: core.Output }],
- _beforeCentering: [{ type: core.Output }],
- _afterLeavingCenter: [{ type: core.Output }],
- _onCentered: [{ type: core.Output }],
- _portalHost: [{ type: core.ViewChild, args: [portal.PortalHostDirective, { static: false },] }],
- _content: [{ type: core.Input, args: ['content',] }],
- origin: [{ type: core.Input }],
- animationDuration: [{ type: core.Input }],
- position: [{ type: core.Input }]
- };
- return MatTabBody;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- // Boilerplate for applying mixins to MatTabLabelWrapper.
- /**
- * \@docs-private
- */
- var
- // Boilerplate for applying mixins to MatTabLabelWrapper.
- /**
- * \@docs-private
- */
- MatTabLabelWrapperBase = /** @class */ (function () {
- function MatTabLabelWrapperBase() {
- }
- return MatTabLabelWrapperBase;
- }());
- /** @type {?} */
- var _MatTabLabelWrapperMixinBase = mixinDisabled(MatTabLabelWrapperBase);
- /**
- * Used in the `mat-tab-group` view to display tab labels.
- * \@docs-private
- */
- var MatTabLabelWrapper = /** @class */ (function (_super) {
- __extends(MatTabLabelWrapper, _super);
- function MatTabLabelWrapper(elementRef) {
- var _this = _super.call(this) || this;
- _this.elementRef = elementRef;
- return _this;
- }
- /** Sets focus on the wrapper element */
- /**
- * Sets focus on the wrapper element
- * @return {?}
- */
- MatTabLabelWrapper.prototype.focus = /**
- * Sets focus on the wrapper element
- * @return {?}
- */
- function () {
- this.elementRef.nativeElement.focus();
- };
- /**
- * @return {?}
- */
- MatTabLabelWrapper.prototype.getOffsetLeft = /**
- * @return {?}
- */
- function () {
- return this.elementRef.nativeElement.offsetLeft;
- };
- /**
- * @return {?}
- */
- MatTabLabelWrapper.prototype.getOffsetWidth = /**
- * @return {?}
- */
- function () {
- return this.elementRef.nativeElement.offsetWidth;
- };
- MatTabLabelWrapper.decorators = [
- { type: core.Directive, args: [{
- selector: '[matTabLabelWrapper]',
- inputs: ['disabled'],
- host: {
- '[class.mat-tab-disabled]': 'disabled',
- '[attr.aria-disabled]': '!!disabled',
- }
- },] },
- ];
- /** @nocollapse */
- MatTabLabelWrapper.ctorParameters = function () { return [
- { type: core.ElementRef }
- ]; };
- return MatTabLabelWrapper;
- }(_MatTabLabelWrapperMixinBase));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Config used to bind passive event listeners
- * @type {?}
- */
- var passiveEventListenerOptions$1 = (/** @type {?} */ (platform.normalizePassiveListenerOptions({ passive: true })));
- /**
- * The distance in pixels that will be overshot when scrolling a tab label into view. This helps
- * provide a small affordance to the label next to it.
- * @type {?}
- */
- var EXAGGERATED_OVERSCROLL = 60;
- /**
- * Amount of milliseconds to wait before starting to scroll the header automatically.
- * Set a little conservatively in order to handle fake events dispatched on touch devices.
- * @type {?}
- */
- var HEADER_SCROLL_DELAY = 650;
- /**
- * Interval in milliseconds at which to scroll the header
- * while the user is holding their pointer.
- * @type {?}
- */
- var HEADER_SCROLL_INTERVAL = 100;
- /**
- * Base class for a tab header that supported pagination.
- * @abstract
- */
- var MatPaginatedTabHeader = /** @class */ (function () {
- function MatPaginatedTabHeader(_elementRef, _changeDetectorRef, _viewportRuler, _dir, _ngZone, _platform, _animationMode) {
- var _this = this;
- this._elementRef = _elementRef;
- this._changeDetectorRef = _changeDetectorRef;
- this._viewportRuler = _viewportRuler;
- this._dir = _dir;
- this._ngZone = _ngZone;
- this._platform = _platform;
- this._animationMode = _animationMode;
- /**
- * The distance in pixels that the tab labels should be translated to the left.
- */
- this._scrollDistance = 0;
- /**
- * Whether the header should scroll to the selected index after the view has been checked.
- */
- this._selectedIndexChanged = false;
- /**
- * Emits when the component is destroyed.
- */
- this._destroyed = new rxjs.Subject();
- /**
- * Whether the controls for pagination should be displayed
- */
- this._showPaginationControls = false;
- /**
- * Whether the tab list can be scrolled more towards the end of the tab label list.
- */
- this._disableScrollAfter = true;
- /**
- * Whether the tab list can be scrolled more towards the beginning of the tab label list.
- */
- this._disableScrollBefore = true;
- /**
- * Stream that will stop the automated scrolling.
- */
- this._stopScrolling = new rxjs.Subject();
- this._selectedIndex = 0;
- /**
- * Event emitted when the option is selected.
- */
- this.selectFocusedIndex = new core.EventEmitter();
- /**
- * Event emitted when a label is focused.
- */
- this.indexFocused = new core.EventEmitter();
- // Bind the `mouseleave` event on the outside since it doesn't change anything in the view.
- _ngZone.runOutsideAngular((/**
- * @return {?}
- */
- function () {
- rxjs.fromEvent(_elementRef.nativeElement, 'mouseleave')
- .pipe(operators.takeUntil(_this._destroyed))
- .subscribe((/**
- * @return {?}
- */
- function () {
- _this._stopInterval();
- }));
- }));
- }
- Object.defineProperty(MatPaginatedTabHeader.prototype, "selectedIndex", {
- /** The index of the active tab. */
- get: /**
- * The index of the active tab.
- * @return {?}
- */
- function () { return this._selectedIndex; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- value = coercion.coerceNumberProperty(value);
- if (this._selectedIndex != value) {
- this._selectedIndexChanged = true;
- this._selectedIndex = value;
- if (this._keyManager) {
- this._keyManager.updateActiveItemIndex(value);
- }
- }
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- MatPaginatedTabHeader.prototype.ngAfterViewInit = /**
- * @return {?}
- */
- function () {
- var _this = this;
- // We need to handle these events manually, because we want to bind passive event listeners.
- rxjs.fromEvent(this._previousPaginator.nativeElement, 'touchstart', passiveEventListenerOptions$1)
- .pipe(operators.takeUntil(this._destroyed))
- .subscribe((/**
- * @return {?}
- */
- function () {
- _this._handlePaginatorPress('before');
- }));
- rxjs.fromEvent(this._nextPaginator.nativeElement, 'touchstart', passiveEventListenerOptions$1)
- .pipe(operators.takeUntil(this._destroyed))
- .subscribe((/**
- * @return {?}
- */
- function () {
- _this._handlePaginatorPress('after');
- }));
- };
- /**
- * @return {?}
- */
- MatPaginatedTabHeader.prototype.ngAfterContentInit = /**
- * @return {?}
- */
- function () {
- var _this = this;
- /** @type {?} */
- var dirChange = this._dir ? this._dir.change : rxjs.of(null);
- /** @type {?} */
- var resize = this._viewportRuler.change(150);
- /** @type {?} */
- var realign = (/**
- * @return {?}
- */
- function () {
- _this.updatePagination();
- _this._alignInkBarToSelectedTab();
- });
- this._keyManager = new a11y.FocusKeyManager(this._items)
- .withHorizontalOrientation(this._getLayoutDirection())
- .withWrap();
- this._keyManager.updateActiveItem(0);
- // Defer the first call in order to allow for slower browsers to lay out the elements.
- // This helps in cases where the user lands directly on a page with paginated tabs.
- typeof requestAnimationFrame !== 'undefined' ? requestAnimationFrame(realign) : realign();
- // On dir change or window resize, realign the ink bar and update the orientation of
- // the key manager if the direction has changed.
- rxjs.merge(dirChange, resize, this._items.changes).pipe(operators.takeUntil(this._destroyed)).subscribe((/**
- * @return {?}
- */
- function () {
- realign();
- _this._keyManager.withHorizontalOrientation(_this._getLayoutDirection());
- }));
- // If there is a change in the focus key manager we need to emit the `indexFocused`
- // event in order to provide a public event that notifies about focus changes. Also we realign
- // the tabs container by scrolling the new focused tab into the visible section.
- this._keyManager.change.pipe(operators.takeUntil(this._destroyed)).subscribe((/**
- * @param {?} newFocusIndex
- * @return {?}
- */
- function (newFocusIndex) {
- _this.indexFocused.emit(newFocusIndex);
- _this._setTabFocus(newFocusIndex);
- }));
- };
- /**
- * @return {?}
- */
- MatPaginatedTabHeader.prototype.ngAfterContentChecked = /**
- * @return {?}
- */
- function () {
- // If the number of tab labels have changed, check if scrolling should be enabled
- if (this._tabLabelCount != this._items.length) {
- this.updatePagination();
- this._tabLabelCount = this._items.length;
- this._changeDetectorRef.markForCheck();
- }
- // If the selected index has changed, scroll to the label and check if the scrolling controls
- // should be disabled.
- if (this._selectedIndexChanged) {
- this._scrollToLabel(this._selectedIndex);
- this._checkScrollingControls();
- this._alignInkBarToSelectedTab();
- this._selectedIndexChanged = false;
- this._changeDetectorRef.markForCheck();
- }
- // If the scroll distance has been changed (tab selected, focused, scroll controls activated),
- // then translate the header to reflect this.
- if (this._scrollDistanceChanged) {
- this._updateTabScrollPosition();
- this._scrollDistanceChanged = false;
- this._changeDetectorRef.markForCheck();
- }
- };
- /**
- * @return {?}
- */
- MatPaginatedTabHeader.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- this._destroyed.next();
- this._destroyed.complete();
- this._stopScrolling.complete();
- };
- /** Handles keyboard events on the header. */
- /**
- * Handles keyboard events on the header.
- * @param {?} event
- * @return {?}
- */
- MatPaginatedTabHeader.prototype._handleKeydown = /**
- * Handles keyboard events on the header.
- * @param {?} event
- * @return {?}
- */
- function (event) {
- // We don't handle any key bindings with a modifier key.
- if (keycodes.hasModifierKey(event)) {
- return;
- }
- switch (event.keyCode) {
- case keycodes.HOME:
- this._keyManager.setFirstItemActive();
- event.preventDefault();
- break;
- case keycodes.END:
- this._keyManager.setLastItemActive();
- event.preventDefault();
- break;
- case keycodes.ENTER:
- case keycodes.SPACE:
- this.selectFocusedIndex.emit(this.focusIndex);
- this._itemSelected(event);
- break;
- default:
- this._keyManager.onKeydown(event);
- }
- };
- /**
- * Callback for when the MutationObserver detects that the content has changed.
- */
- /**
- * Callback for when the MutationObserver detects that the content has changed.
- * @return {?}
- */
- MatPaginatedTabHeader.prototype._onContentChanges = /**
- * Callback for when the MutationObserver detects that the content has changed.
- * @return {?}
- */
- function () {
- var _this = this;
- /** @type {?} */
- var textContent = this._elementRef.nativeElement.textContent;
- // We need to diff the text content of the header, because the MutationObserver callback
- // will fire even if the text content didn't change which is inefficient and is prone
- // to infinite loops if a poorly constructed expression is passed in (see #14249).
- if (textContent !== this._currentTextContent) {
- this._currentTextContent = textContent || '';
- // The content observer runs outside the `NgZone` by default, which
- // means that we need to bring the callback back in ourselves.
- this._ngZone.run((/**
- * @return {?}
- */
- function () {
- _this.updatePagination();
- _this._alignInkBarToSelectedTab();
- _this._changeDetectorRef.markForCheck();
- }));
- }
- };
- /**
- * Updates the view whether pagination should be enabled or not.
- *
- * WARNING: Calling this method can be very costly in terms of performance. It should be called
- * as infrequently as possible from outside of the Tabs component as it causes a reflow of the
- * page.
- */
- /**
- * Updates the view whether pagination should be enabled or not.
- *
- * WARNING: Calling this method can be very costly in terms of performance. It should be called
- * as infrequently as possible from outside of the Tabs component as it causes a reflow of the
- * page.
- * @return {?}
- */
- MatPaginatedTabHeader.prototype.updatePagination = /**
- * Updates the view whether pagination should be enabled or not.
- *
- * WARNING: Calling this method can be very costly in terms of performance. It should be called
- * as infrequently as possible from outside of the Tabs component as it causes a reflow of the
- * page.
- * @return {?}
- */
- function () {
- this._checkPaginationEnabled();
- this._checkScrollingControls();
- this._updateTabScrollPosition();
- };
- Object.defineProperty(MatPaginatedTabHeader.prototype, "focusIndex", {
- /** Tracks which element has focus; used for keyboard navigation */
- get: /**
- * Tracks which element has focus; used for keyboard navigation
- * @return {?}
- */
- function () {
- return this._keyManager ? (/** @type {?} */ (this._keyManager.activeItemIndex)) : 0;
- },
- /** When the focus index is set, we must manually send focus to the correct label */
- set: /**
- * When the focus index is set, we must manually send focus to the correct label
- * @param {?} value
- * @return {?}
- */
- function (value) {
- if (!this._isValidIndex(value) || this.focusIndex === value || !this._keyManager) {
- return;
- }
- this._keyManager.setActiveItem(value);
- },
- enumerable: true,
- configurable: true
- });
- /**
- * Determines if an index is valid. If the tabs are not ready yet, we assume that the user is
- * providing a valid index and return true.
- */
- /**
- * Determines if an index is valid. If the tabs are not ready yet, we assume that the user is
- * providing a valid index and return true.
- * @param {?} index
- * @return {?}
- */
- MatPaginatedTabHeader.prototype._isValidIndex = /**
- * Determines if an index is valid. If the tabs are not ready yet, we assume that the user is
- * providing a valid index and return true.
- * @param {?} index
- * @return {?}
- */
- function (index) {
- if (!this._items) {
- return true;
- }
- /** @type {?} */
- var tab = this._items ? this._items.toArray()[index] : null;
- return !!tab && !tab.disabled;
- };
- /**
- * Sets focus on the HTML element for the label wrapper and scrolls it into the view if
- * scrolling is enabled.
- */
- /**
- * Sets focus on the HTML element for the label wrapper and scrolls it into the view if
- * scrolling is enabled.
- * @param {?} tabIndex
- * @return {?}
- */
- MatPaginatedTabHeader.prototype._setTabFocus = /**
- * Sets focus on the HTML element for the label wrapper and scrolls it into the view if
- * scrolling is enabled.
- * @param {?} tabIndex
- * @return {?}
- */
- function (tabIndex) {
- if (this._showPaginationControls) {
- this._scrollToLabel(tabIndex);
- }
- if (this._items && this._items.length) {
- this._items.toArray()[tabIndex].focus();
- // Do not let the browser manage scrolling to focus the element, this will be handled
- // by using translation. In LTR, the scroll left should be 0. In RTL, the scroll width
- // should be the full width minus the offset width.
- /** @type {?} */
- var containerEl = this._tabListContainer.nativeElement;
- /** @type {?} */
- var dir = this._getLayoutDirection();
- if (dir == 'ltr') {
- containerEl.scrollLeft = 0;
- }
- else {
- containerEl.scrollLeft = containerEl.scrollWidth - containerEl.offsetWidth;
- }
- }
- };
- /** The layout direction of the containing app. */
- /**
- * The layout direction of the containing app.
- * @return {?}
- */
- MatPaginatedTabHeader.prototype._getLayoutDirection = /**
- * The layout direction of the containing app.
- * @return {?}
- */
- function () {
- return this._dir && this._dir.value === 'rtl' ? 'rtl' : 'ltr';
- };
- /** Performs the CSS transformation on the tab list that will cause the list to scroll. */
- /**
- * Performs the CSS transformation on the tab list that will cause the list to scroll.
- * @return {?}
- */
- MatPaginatedTabHeader.prototype._updateTabScrollPosition = /**
- * Performs the CSS transformation on the tab list that will cause the list to scroll.
- * @return {?}
- */
- function () {
- /** @type {?} */
- var scrollDistance = this.scrollDistance;
- /** @type {?} */
- var platform$$1 = this._platform;
- /** @type {?} */
- var translateX = this._getLayoutDirection() === 'ltr' ? -scrollDistance : scrollDistance;
- // Don't use `translate3d` here because we don't want to create a new layer. A new layer
- // seems to cause flickering and overflow in Internet Explorer. For example, the ink bar
- // and ripples will exceed the boundaries of the visible tab bar.
- // See: https://github.com/angular/components/issues/10276
- // We round the `transform` here, because transforms with sub-pixel precision cause some
- // browsers to blur the content of the element.
- this._tabList.nativeElement.style.transform = "translateX(" + Math.round(translateX) + "px)";
- // Setting the `transform` on IE will change the scroll offset of the parent, causing the
- // position to be thrown off in some cases. We have to reset it ourselves to ensure that
- // it doesn't get thrown off. Note that we scope it only to IE and Edge, because messing
- // with the scroll position throws off Chrome 71+ in RTL mode (see #14689).
- // @breaking-change 9.0.0 Remove null check for `platform` after it can no longer be undefined.
- if (platform$$1 && (platform$$1.TRIDENT || platform$$1.EDGE)) {
- this._tabListContainer.nativeElement.scrollLeft = 0;
- }
- };
- Object.defineProperty(MatPaginatedTabHeader.prototype, "scrollDistance", {
- /** Sets the distance in pixels that the tab header should be transformed in the X-axis. */
- get: /**
- * Sets the distance in pixels that the tab header should be transformed in the X-axis.
- * @return {?}
- */
- function () { return this._scrollDistance; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._scrollTo(value);
- },
- enumerable: true,
- configurable: true
- });
- /**
- * Moves the tab list in the 'before' or 'after' direction (towards the beginning of the list or
- * the end of the list, respectively). The distance to scroll is computed to be a third of the
- * length of the tab list view window.
- *
- * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
- * should be called sparingly.
- */
- /**
- * Moves the tab list in the 'before' or 'after' direction (towards the beginning of the list or
- * the end of the list, respectively). The distance to scroll is computed to be a third of the
- * length of the tab list view window.
- *
- * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
- * should be called sparingly.
- * @param {?} direction
- * @return {?}
- */
- MatPaginatedTabHeader.prototype._scrollHeader = /**
- * Moves the tab list in the 'before' or 'after' direction (towards the beginning of the list or
- * the end of the list, respectively). The distance to scroll is computed to be a third of the
- * length of the tab list view window.
- *
- * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
- * should be called sparingly.
- * @param {?} direction
- * @return {?}
- */
- function (direction) {
- /** @type {?} */
- var viewLength = this._tabListContainer.nativeElement.offsetWidth;
- // Move the scroll distance one-third the length of the tab list's viewport.
- /** @type {?} */
- var scrollAmount = (direction == 'before' ? -1 : 1) * viewLength / 3;
- return this._scrollTo(this._scrollDistance + scrollAmount);
- };
- /** Handles click events on the pagination arrows. */
- /**
- * Handles click events on the pagination arrows.
- * @param {?} direction
- * @return {?}
- */
- MatPaginatedTabHeader.prototype._handlePaginatorClick = /**
- * Handles click events on the pagination arrows.
- * @param {?} direction
- * @return {?}
- */
- function (direction) {
- this._stopInterval();
- this._scrollHeader(direction);
- };
- /**
- * Moves the tab list such that the desired tab label (marked by index) is moved into view.
- *
- * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
- * should be called sparingly.
- */
- /**
- * Moves the tab list such that the desired tab label (marked by index) is moved into view.
- *
- * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
- * should be called sparingly.
- * @param {?} labelIndex
- * @return {?}
- */
- MatPaginatedTabHeader.prototype._scrollToLabel = /**
- * Moves the tab list such that the desired tab label (marked by index) is moved into view.
- *
- * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
- * should be called sparingly.
- * @param {?} labelIndex
- * @return {?}
- */
- function (labelIndex) {
- /** @type {?} */
- var selectedLabel = this._items ? this._items.toArray()[labelIndex] : null;
- if (!selectedLabel) {
- return;
- }
- // The view length is the visible width of the tab labels.
- /** @type {?} */
- var viewLength = this._tabListContainer.nativeElement.offsetWidth;
- var _a = selectedLabel.elementRef.nativeElement, offsetLeft = _a.offsetLeft, offsetWidth = _a.offsetWidth;
- /** @type {?} */
- var labelBeforePos;
- /** @type {?} */
- var labelAfterPos;
- if (this._getLayoutDirection() == 'ltr') {
- labelBeforePos = offsetLeft;
- labelAfterPos = labelBeforePos + offsetWidth;
- }
- else {
- labelAfterPos = this._tabList.nativeElement.offsetWidth - offsetLeft;
- labelBeforePos = labelAfterPos - offsetWidth;
- }
- /** @type {?} */
- var beforeVisiblePos = this.scrollDistance;
- /** @type {?} */
- var afterVisiblePos = this.scrollDistance + viewLength;
- if (labelBeforePos < beforeVisiblePos) {
- // Scroll header to move label to the before direction
- this.scrollDistance -= beforeVisiblePos - labelBeforePos + EXAGGERATED_OVERSCROLL;
- }
- else if (labelAfterPos > afterVisiblePos) {
- // Scroll header to move label to the after direction
- this.scrollDistance += labelAfterPos - afterVisiblePos + EXAGGERATED_OVERSCROLL;
- }
- };
- /**
- * Evaluate whether the pagination controls should be displayed. If the scroll width of the
- * tab list is wider than the size of the header container, then the pagination controls should
- * be shown.
- *
- * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
- * should be called sparingly.
- */
- /**
- * Evaluate whether the pagination controls should be displayed. If the scroll width of the
- * tab list is wider than the size of the header container, then the pagination controls should
- * be shown.
- *
- * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
- * should be called sparingly.
- * @return {?}
- */
- MatPaginatedTabHeader.prototype._checkPaginationEnabled = /**
- * Evaluate whether the pagination controls should be displayed. If the scroll width of the
- * tab list is wider than the size of the header container, then the pagination controls should
- * be shown.
- *
- * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
- * should be called sparingly.
- * @return {?}
- */
- function () {
- /** @type {?} */
- var isEnabled = this._tabList.nativeElement.scrollWidth > this._elementRef.nativeElement.offsetWidth;
- if (!isEnabled) {
- this.scrollDistance = 0;
- }
- if (isEnabled !== this._showPaginationControls) {
- this._changeDetectorRef.markForCheck();
- }
- this._showPaginationControls = isEnabled;
- };
- /**
- * Evaluate whether the before and after controls should be enabled or disabled.
- * If the header is at the beginning of the list (scroll distance is equal to 0) then disable the
- * before button. If the header is at the end of the list (scroll distance is equal to the
- * maximum distance we can scroll), then disable the after button.
- *
- * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
- * should be called sparingly.
- */
- /**
- * Evaluate whether the before and after controls should be enabled or disabled.
- * If the header is at the beginning of the list (scroll distance is equal to 0) then disable the
- * before button. If the header is at the end of the list (scroll distance is equal to the
- * maximum distance we can scroll), then disable the after button.
- *
- * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
- * should be called sparingly.
- * @return {?}
- */
- MatPaginatedTabHeader.prototype._checkScrollingControls = /**
- * Evaluate whether the before and after controls should be enabled or disabled.
- * If the header is at the beginning of the list (scroll distance is equal to 0) then disable the
- * before button. If the header is at the end of the list (scroll distance is equal to the
- * maximum distance we can scroll), then disable the after button.
- *
- * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
- * should be called sparingly.
- * @return {?}
- */
- function () {
- // Check if the pagination arrows should be activated.
- this._disableScrollBefore = this.scrollDistance == 0;
- this._disableScrollAfter = this.scrollDistance == this._getMaxScrollDistance();
- this._changeDetectorRef.markForCheck();
- };
- /**
- * Determines what is the maximum length in pixels that can be set for the scroll distance. This
- * is equal to the difference in width between the tab list container and tab header container.
- *
- * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
- * should be called sparingly.
- */
- /**
- * Determines what is the maximum length in pixels that can be set for the scroll distance. This
- * is equal to the difference in width between the tab list container and tab header container.
- *
- * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
- * should be called sparingly.
- * @return {?}
- */
- MatPaginatedTabHeader.prototype._getMaxScrollDistance = /**
- * Determines what is the maximum length in pixels that can be set for the scroll distance. This
- * is equal to the difference in width between the tab list container and tab header container.
- *
- * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
- * should be called sparingly.
- * @return {?}
- */
- function () {
- /** @type {?} */
- var lengthOfTabList = this._tabList.nativeElement.scrollWidth;
- /** @type {?} */
- var viewLength = this._tabListContainer.nativeElement.offsetWidth;
- return (lengthOfTabList - viewLength) || 0;
- };
- /** Tells the ink-bar to align itself to the current label wrapper */
- /**
- * Tells the ink-bar to align itself to the current label wrapper
- * @return {?}
- */
- MatPaginatedTabHeader.prototype._alignInkBarToSelectedTab = /**
- * Tells the ink-bar to align itself to the current label wrapper
- * @return {?}
- */
- function () {
- /** @type {?} */
- var selectedItem = this._items && this._items.length ?
- this._items.toArray()[this.selectedIndex] : null;
- /** @type {?} */
- var selectedLabelWrapper = selectedItem ? selectedItem.elementRef.nativeElement : null;
- if (selectedLabelWrapper) {
- this._inkBar.alignToElement(selectedLabelWrapper);
- }
- else {
- this._inkBar.hide();
- }
- };
- /** Stops the currently-running paginator interval. */
- /**
- * Stops the currently-running paginator interval.
- * @return {?}
- */
- MatPaginatedTabHeader.prototype._stopInterval = /**
- * Stops the currently-running paginator interval.
- * @return {?}
- */
- function () {
- this._stopScrolling.next();
- };
- /**
- * Handles the user pressing down on one of the paginators.
- * Starts scrolling the header after a certain amount of time.
- * @param direction In which direction the paginator should be scrolled.
- */
- /**
- * Handles the user pressing down on one of the paginators.
- * Starts scrolling the header after a certain amount of time.
- * @param {?} direction In which direction the paginator should be scrolled.
- * @return {?}
- */
- MatPaginatedTabHeader.prototype._handlePaginatorPress = /**
- * Handles the user pressing down on one of the paginators.
- * Starts scrolling the header after a certain amount of time.
- * @param {?} direction In which direction the paginator should be scrolled.
- * @return {?}
- */
- function (direction) {
- var _this = this;
- // Avoid overlapping timers.
- this._stopInterval();
- // Start a timer after the delay and keep firing based on the interval.
- rxjs.timer(HEADER_SCROLL_DELAY, HEADER_SCROLL_INTERVAL)
- // Keep the timer going until something tells it to stop or the component is destroyed.
- .pipe(operators.takeUntil(rxjs.merge(this._stopScrolling, this._destroyed)))
- .subscribe((/**
- * @return {?}
- */
- function () {
- var _a = _this._scrollHeader(direction), maxScrollDistance = _a.maxScrollDistance, distance = _a.distance;
- // Stop the timer if we've reached the start or the end.
- if (distance === 0 || distance >= maxScrollDistance) {
- _this._stopInterval();
- }
- }));
- };
- /**
- * Scrolls the header to a given position.
- * @param position Position to which to scroll.
- * @returns Information on the current scroll distance and the maximum.
- */
- /**
- * Scrolls the header to a given position.
- * @private
- * @param {?} position Position to which to scroll.
- * @return {?} Information on the current scroll distance and the maximum.
- */
- MatPaginatedTabHeader.prototype._scrollTo = /**
- * Scrolls the header to a given position.
- * @private
- * @param {?} position Position to which to scroll.
- * @return {?} Information on the current scroll distance and the maximum.
- */
- function (position) {
- /** @type {?} */
- var maxScrollDistance = this._getMaxScrollDistance();
- this._scrollDistance = Math.max(0, Math.min(maxScrollDistance, position));
- // Mark that the scroll distance has changed so that after the view is checked, the CSS
- // transformation can move the header.
- this._scrollDistanceChanged = true;
- this._checkScrollingControls();
- return { maxScrollDistance: maxScrollDistance, distance: this._scrollDistance };
- };
- /** @nocollapse */
- MatPaginatedTabHeader.ctorParameters = function () { return [
- { type: core.ElementRef },
- { type: core.ChangeDetectorRef },
- { type: scrolling.ViewportRuler },
- { type: bidi.Directionality, decorators: [{ type: core.Optional }] },
- { type: core.NgZone },
- { type: platform.Platform },
- { type: String }
- ]; };
- return MatPaginatedTabHeader;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * The header of the tab group which displays a list of all the tabs in the tab group. Includes
- * an ink bar that follows the currently selected tab. When the tabs list's width exceeds the
- * width of the header container, then arrows will be displayed to allow the user to scroll
- * left and right across the header.
- * \@docs-private
- */
- var MatTabHeader = /** @class */ (function (_super) {
- __extends(MatTabHeader, _super);
- function MatTabHeader(elementRef, changeDetectorRef, viewportRuler, dir, ngZone, platform$$1,
- // @breaking-change 9.0.0 `_animationMode` parameter to be made required.
- animationMode) {
- var _this = _super.call(this, elementRef, changeDetectorRef, viewportRuler, dir, ngZone, platform$$1, animationMode) || this;
- _this._disableRipple = false;
- return _this;
- }
- Object.defineProperty(MatTabHeader.prototype, "disableRipple", {
- /** Whether the ripple effect is disabled or not. */
- get: /**
- * Whether the ripple effect is disabled or not.
- * @return {?}
- */
- function () { return this._disableRipple; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) { this._disableRipple = coercion.coerceBooleanProperty(value); },
- enumerable: true,
- configurable: true
- });
- /**
- * @protected
- * @param {?} event
- * @return {?}
- */
- MatTabHeader.prototype._itemSelected = /**
- * @protected
- * @param {?} event
- * @return {?}
- */
- function (event) {
- event.preventDefault();
- };
- MatTabHeader.decorators = [
- { type: core.Component, args: [{selector: 'mat-tab-header',
- 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>",
- 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}}"],
- inputs: ['selectedIndex'],
- outputs: ['selectFocusedIndex', 'indexFocused'],
- encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- host: {
- 'class': 'mat-tab-header',
- '[class.mat-tab-header-pagination-controls-enabled]': '_showPaginationControls',
- '[class.mat-tab-header-rtl]': "_getLayoutDirection() == 'rtl'",
- },
- },] },
- ];
- /** @nocollapse */
- MatTabHeader.ctorParameters = function () { return [
- { type: core.ElementRef },
- { type: core.ChangeDetectorRef },
- { type: scrolling.ViewportRuler },
- { type: bidi.Directionality, decorators: [{ type: core.Optional }] },
- { type: core.NgZone },
- { type: platform.Platform },
- { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
- ]; };
- MatTabHeader.propDecorators = {
- _items: [{ type: core.ContentChildren, args: [MatTabLabelWrapper,] }],
- _inkBar: [{ type: core.ViewChild, args: [MatInkBar, { static: true },] }],
- _tabListContainer: [{ type: core.ViewChild, args: ['tabListContainer', { static: true },] }],
- _tabList: [{ type: core.ViewChild, args: ['tabList', { static: true },] }],
- _nextPaginator: [{ type: core.ViewChild, args: ['nextPaginator', { static: false },] }],
- _previousPaginator: [{ type: core.ViewChild, args: ['previousPaginator', { static: false },] }],
- disableRipple: [{ type: core.Input }]
- };
- return MatTabHeader;
- }(MatPaginatedTabHeader));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Used to generate unique ID's for each tab component
- * @type {?}
- */
- var nextId$1 = 0;
- /**
- * A simple change event emitted on focus or selection changes.
- */
- var /**
- * A simple change event emitted on focus or selection changes.
- */
- MatTabChangeEvent = /** @class */ (function () {
- function MatTabChangeEvent() {
- }
- return MatTabChangeEvent;
- }());
- /**
- * Injection token that can be used to provide the default options the tabs module.
- * @type {?}
- */
- var MAT_TABS_CONFIG = new core.InjectionToken('MAT_TABS_CONFIG');
- // Boilerplate for applying mixins to MatTabGroup.
- /**
- * \@docs-private
- */
- var
- // Boilerplate for applying mixins to MatTabGroup.
- /**
- * \@docs-private
- */
- MatTabGroupBase = /** @class */ (function () {
- function MatTabGroupBase(_elementRef) {
- this._elementRef = _elementRef;
- }
- return MatTabGroupBase;
- }());
- /** @type {?} */
- var _MatTabGroupMixinBase = mixinColor(mixinDisableRipple(MatTabGroupBase), 'primary');
- /**
- * Material design tab-group component. Supports basic tab pairs (label + content) and includes
- * animated ink-bar, keyboard navigation, and screen reader.
- * See: https://material.io/design/components/tabs.html
- */
- var MatTabGroup = /** @class */ (function (_super) {
- __extends(MatTabGroup, _super);
- function MatTabGroup(elementRef, _changeDetectorRef, defaultConfig, _animationMode) {
- var _this = _super.call(this, elementRef) || this;
- _this._changeDetectorRef = _changeDetectorRef;
- _this._animationMode = _animationMode;
- /**
- * The tab index that should be selected after the content has been checked.
- */
- _this._indexToSelect = 0;
- /**
- * Snapshot of the height of the tab body wrapper before another tab is activated.
- */
- _this._tabBodyWrapperHeight = 0;
- /**
- * Subscription to tabs being added/removed.
- */
- _this._tabsSubscription = rxjs.Subscription.EMPTY;
- /**
- * Subscription to changes in the tab labels.
- */
- _this._tabLabelSubscription = rxjs.Subscription.EMPTY;
- _this._dynamicHeight = false;
- _this._selectedIndex = null;
- /**
- * Position of the tab header.
- */
- _this.headerPosition = 'above';
- /**
- * Output to enable support for two-way binding on `[(selectedIndex)]`
- */
- _this.selectedIndexChange = new core.EventEmitter();
- /**
- * Event emitted when focus has changed within a tab group.
- */
- _this.focusChange = new core.EventEmitter();
- /**
- * Event emitted when the body animation has completed
- */
- _this.animationDone = new core.EventEmitter();
- /**
- * Event emitted when the tab selection has changed.
- */
- _this.selectedTabChange = new core.EventEmitter(true);
- _this._groupId = nextId$1++;
- _this.animationDuration = defaultConfig && defaultConfig.animationDuration ?
- defaultConfig.animationDuration : '500ms';
- return _this;
- }
- Object.defineProperty(MatTabGroup.prototype, "dynamicHeight", {
- /** Whether the tab group should grow to the size of the active tab. */
- get: /**
- * Whether the tab group should grow to the size of the active tab.
- * @return {?}
- */
- function () { return this._dynamicHeight; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) { this._dynamicHeight = coercion.coerceBooleanProperty(value); },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatTabGroup.prototype, "selectedIndex", {
- /** The index of the active tab. */
- get: /**
- * The index of the active tab.
- * @return {?}
- */
- function () { return this._selectedIndex; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._indexToSelect = coercion.coerceNumberProperty(value, null);
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatTabGroup.prototype, "animationDuration", {
- /** Duration for the tab animation. Will be normalized to milliseconds if no units are set. */
- get: /**
- * Duration for the tab animation. Will be normalized to milliseconds if no units are set.
- * @return {?}
- */
- function () { return this._animationDuration; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._animationDuration = /^\d+$/.test(value) ? value + 'ms' : value;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatTabGroup.prototype, "backgroundColor", {
- /** Background color of the tab group. */
- get: /**
- * Background color of the tab group.
- * @return {?}
- */
- function () { return this._backgroundColor; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- /** @type {?} */
- var nativeElement = this._elementRef.nativeElement;
- nativeElement.classList.remove("mat-background-" + this.backgroundColor);
- if (value) {
- nativeElement.classList.add("mat-background-" + value);
- }
- this._backgroundColor = value;
- },
- enumerable: true,
- configurable: true
- });
- /**
- * After the content is checked, this component knows what tabs have been defined
- * and what the selected index should be. This is where we can know exactly what position
- * each tab should be in according to the new selected index, and additionally we know how
- * a new selected tab should transition in (from the left or right).
- */
- /**
- * After the content is checked, this component knows what tabs have been defined
- * and what the selected index should be. This is where we can know exactly what position
- * each tab should be in according to the new selected index, and additionally we know how
- * a new selected tab should transition in (from the left or right).
- * @return {?}
- */
- MatTabGroup.prototype.ngAfterContentChecked = /**
- * After the content is checked, this component knows what tabs have been defined
- * and what the selected index should be. This is where we can know exactly what position
- * each tab should be in according to the new selected index, and additionally we know how
- * a new selected tab should transition in (from the left or right).
- * @return {?}
- */
- function () {
- var _this = this;
- // Don't clamp the `indexToSelect` immediately in the setter because it can happen that
- // the amount of tabs changes before the actual change detection runs.
- /** @type {?} */
- var indexToSelect = this._indexToSelect = this._clampTabIndex(this._indexToSelect);
- // If there is a change in selected index, emit a change event. Should not trigger if
- // the selected index has not yet been initialized.
- if (this._selectedIndex != indexToSelect) {
- /** @type {?} */
- var isFirstRun_1 = this._selectedIndex == null;
- if (!isFirstRun_1) {
- this.selectedTabChange.emit(this._createChangeEvent(indexToSelect));
- }
- // Changing these values after change detection has run
- // since the checked content may contain references to them.
- Promise.resolve().then((/**
- * @return {?}
- */
- function () {
- _this._tabs.forEach((/**
- * @param {?} tab
- * @param {?} index
- * @return {?}
- */
- function (tab, index) { return tab.isActive = index === indexToSelect; }));
- if (!isFirstRun_1) {
- _this.selectedIndexChange.emit(indexToSelect);
- }
- }));
- }
- // Setup the position for each tab and optionally setup an origin on the next selected tab.
- this._tabs.forEach((/**
- * @param {?} tab
- * @param {?} index
- * @return {?}
- */
- function (tab, index) {
- tab.position = index - indexToSelect;
- // If there is already a selected tab, then set up an origin for the next selected tab
- // if it doesn't have one already.
- if (_this._selectedIndex != null && tab.position == 0 && !tab.origin) {
- tab.origin = indexToSelect - _this._selectedIndex;
- }
- }));
- if (this._selectedIndex !== indexToSelect) {
- this._selectedIndex = indexToSelect;
- this._changeDetectorRef.markForCheck();
- }
- };
- /**
- * @return {?}
- */
- MatTabGroup.prototype.ngAfterContentInit = /**
- * @return {?}
- */
- function () {
- var _this = this;
- this._subscribeToTabLabels();
- // Subscribe to changes in the amount of tabs, in order to be
- // able to re-render the content as new tabs are added or removed.
- this._tabsSubscription = this._tabs.changes.subscribe((/**
- * @return {?}
- */
- function () {
- /** @type {?} */
- var indexToSelect = _this._clampTabIndex(_this._indexToSelect);
- // Maintain the previously-selected tab if a new tab is added or removed and there is no
- // explicit change that selects a different tab.
- if (indexToSelect === _this._selectedIndex) {
- /** @type {?} */
- var tabs = _this._tabs.toArray();
- for (var i = 0; i < tabs.length; i++) {
- if (tabs[i].isActive) {
- // Assign both to the `_indexToSelect` and `_selectedIndex` so we don't fire a changed
- // event, otherwise the consumer may end up in an infinite loop in some edge cases like
- // adding a tab within the `selectedIndexChange` event.
- _this._indexToSelect = _this._selectedIndex = i;
- break;
- }
- }
- }
- _this._subscribeToTabLabels();
- _this._changeDetectorRef.markForCheck();
- }));
- };
- /**
- * @return {?}
- */
- MatTabGroup.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- this._tabsSubscription.unsubscribe();
- this._tabLabelSubscription.unsubscribe();
- };
- /** Re-aligns the ink bar to the selected tab element. */
- /**
- * Re-aligns the ink bar to the selected tab element.
- * @return {?}
- */
- MatTabGroup.prototype.realignInkBar = /**
- * Re-aligns the ink bar to the selected tab element.
- * @return {?}
- */
- function () {
- if (this._tabHeader) {
- this._tabHeader._alignInkBarToSelectedTab();
- }
- };
- /**
- * @param {?} index
- * @return {?}
- */
- MatTabGroup.prototype._focusChanged = /**
- * @param {?} index
- * @return {?}
- */
- function (index) {
- this.focusChange.emit(this._createChangeEvent(index));
- };
- /**
- * @private
- * @param {?} index
- * @return {?}
- */
- MatTabGroup.prototype._createChangeEvent = /**
- * @private
- * @param {?} index
- * @return {?}
- */
- function (index) {
- /** @type {?} */
- var event = new MatTabChangeEvent;
- event.index = index;
- if (this._tabs && this._tabs.length) {
- event.tab = this._tabs.toArray()[index];
- }
- return event;
- };
- /**
- * Subscribes to changes in the tab labels. This is needed, because the @Input for the label is
- * on the MatTab component, whereas the data binding is inside the MatTabGroup. In order for the
- * binding to be updated, we need to subscribe to changes in it and trigger change detection
- * manually.
- */
- /**
- * Subscribes to changes in the tab labels. This is needed, because the \@Input for the label is
- * on the MatTab component, whereas the data binding is inside the MatTabGroup. In order for the
- * binding to be updated, we need to subscribe to changes in it and trigger change detection
- * manually.
- * @private
- * @return {?}
- */
- MatTabGroup.prototype._subscribeToTabLabels = /**
- * Subscribes to changes in the tab labels. This is needed, because the \@Input for the label is
- * on the MatTab component, whereas the data binding is inside the MatTabGroup. In order for the
- * binding to be updated, we need to subscribe to changes in it and trigger change detection
- * manually.
- * @private
- * @return {?}
- */
- function () {
- var _this = this;
- if (this._tabLabelSubscription) {
- this._tabLabelSubscription.unsubscribe();
- }
- this._tabLabelSubscription = rxjs.merge.apply(void 0, this._tabs.map((/**
- * @param {?} tab
- * @return {?}
- */
- function (tab) { return tab._stateChanges; }))).subscribe((/**
- * @return {?}
- */
- function () { return _this._changeDetectorRef.markForCheck(); }));
- };
- /** Clamps the given index to the bounds of 0 and the tabs length. */
- /**
- * Clamps the given index to the bounds of 0 and the tabs length.
- * @private
- * @param {?} index
- * @return {?}
- */
- MatTabGroup.prototype._clampTabIndex = /**
- * Clamps the given index to the bounds of 0 and the tabs length.
- * @private
- * @param {?} index
- * @return {?}
- */
- function (index) {
- // Note the `|| 0`, which ensures that values like NaN can't get through
- // and which would otherwise throw the component into an infinite loop
- // (since Math.max(NaN, 0) === NaN).
- return Math.min(this._tabs.length - 1, Math.max(index || 0, 0));
- };
- /** Returns a unique id for each tab label element */
- /**
- * Returns a unique id for each tab label element
- * @param {?} i
- * @return {?}
- */
- MatTabGroup.prototype._getTabLabelId = /**
- * Returns a unique id for each tab label element
- * @param {?} i
- * @return {?}
- */
- function (i) {
- return "mat-tab-label-" + this._groupId + "-" + i;
- };
- /** Returns a unique id for each tab content element */
- /**
- * Returns a unique id for each tab content element
- * @param {?} i
- * @return {?}
- */
- MatTabGroup.prototype._getTabContentId = /**
- * Returns a unique id for each tab content element
- * @param {?} i
- * @return {?}
- */
- function (i) {
- return "mat-tab-content-" + this._groupId + "-" + i;
- };
- /**
- * Sets the height of the body wrapper to the height of the activating tab if dynamic
- * height property is true.
- */
- /**
- * Sets the height of the body wrapper to the height of the activating tab if dynamic
- * height property is true.
- * @param {?} tabHeight
- * @return {?}
- */
- MatTabGroup.prototype._setTabBodyWrapperHeight = /**
- * Sets the height of the body wrapper to the height of the activating tab if dynamic
- * height property is true.
- * @param {?} tabHeight
- * @return {?}
- */
- function (tabHeight) {
- if (!this._dynamicHeight || !this._tabBodyWrapperHeight) {
- return;
- }
- /** @type {?} */
- var wrapper = this._tabBodyWrapper.nativeElement;
- wrapper.style.height = this._tabBodyWrapperHeight + 'px';
- // This conditional forces the browser to paint the height so that
- // the animation to the new height can have an origin.
- if (this._tabBodyWrapper.nativeElement.offsetHeight) {
- wrapper.style.height = tabHeight + 'px';
- }
- };
- /** Removes the height of the tab body wrapper. */
- /**
- * Removes the height of the tab body wrapper.
- * @return {?}
- */
- MatTabGroup.prototype._removeTabBodyWrapperHeight = /**
- * Removes the height of the tab body wrapper.
- * @return {?}
- */
- function () {
- /** @type {?} */
- var wrapper = this._tabBodyWrapper.nativeElement;
- this._tabBodyWrapperHeight = wrapper.clientHeight;
- wrapper.style.height = '';
- this.animationDone.emit();
- };
- /** Handle click events, setting new selected index if appropriate. */
- /**
- * Handle click events, setting new selected index if appropriate.
- * @param {?} tab
- * @param {?} tabHeader
- * @param {?} index
- * @return {?}
- */
- MatTabGroup.prototype._handleClick = /**
- * Handle click events, setting new selected index if appropriate.
- * @param {?} tab
- * @param {?} tabHeader
- * @param {?} index
- * @return {?}
- */
- function (tab, tabHeader, index) {
- if (!tab.disabled) {
- this.selectedIndex = tabHeader.focusIndex = index;
- }
- };
- /** Retrieves the tabindex for the tab. */
- /**
- * Retrieves the tabindex for the tab.
- * @param {?} tab
- * @param {?} idx
- * @return {?}
- */
- MatTabGroup.prototype._getTabIndex = /**
- * Retrieves the tabindex for the tab.
- * @param {?} tab
- * @param {?} idx
- * @return {?}
- */
- function (tab, idx) {
- if (tab.disabled) {
- return null;
- }
- return this.selectedIndex === idx ? 0 : -1;
- };
- MatTabGroup.decorators = [
- { type: core.Component, args: [{selector: 'mat-tab-group',
- exportAs: 'matTabGroup',
- 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>",
- 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}"],
- encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- inputs: ['color', 'disableRipple'],
- host: {
- 'class': 'mat-tab-group',
- '[class.mat-tab-group-dynamic-height]': 'dynamicHeight',
- '[class.mat-tab-group-inverted-header]': 'headerPosition === "below"',
- },
- },] },
- ];
- /** @nocollapse */
- MatTabGroup.ctorParameters = function () { return [
- { type: core.ElementRef },
- { type: core.ChangeDetectorRef },
- { type: undefined, decorators: [{ type: core.Inject, args: [MAT_TABS_CONFIG,] }, { type: core.Optional }] },
- { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
- ]; };
- MatTabGroup.propDecorators = {
- _tabs: [{ type: core.ContentChildren, args: [MatTab,] }],
- _tabBodyWrapper: [{ type: core.ViewChild, args: ['tabBodyWrapper', { static: false },] }],
- _tabHeader: [{ type: core.ViewChild, args: ['tabHeader', { static: false },] }],
- dynamicHeight: [{ type: core.Input }],
- selectedIndex: [{ type: core.Input }],
- headerPosition: [{ type: core.Input }],
- animationDuration: [{ type: core.Input }],
- backgroundColor: [{ type: core.Input }],
- selectedIndexChange: [{ type: core.Output }],
- focusChange: [{ type: core.Output }],
- animationDone: [{ type: core.Output }],
- selectedTabChange: [{ type: core.Output }]
- };
- return MatTabGroup;
- }(_MatTabGroupMixinBase));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Navigation component matching the styles of the tab group header.
- * Provides anchored navigation with animated ink bar.
- */
- var MatTabNav = /** @class */ (function (_super) {
- __extends(MatTabNav, _super);
- function MatTabNav(elementRef, dir, ngZone, changeDetectorRef, viewportRuler,
- /**
- * @deprecated @breaking-change 9.0.0 `platform` parameter to become required.
- */
- platform$$1, animationMode) {
- var _this = _super.call(this, elementRef, changeDetectorRef, viewportRuler, dir, ngZone, platform$$1, animationMode) || this;
- _this._disableRipple = false;
- /**
- * Theme color of the nav bar.
- */
- _this.color = 'primary';
- return _this;
- }
- Object.defineProperty(MatTabNav.prototype, "backgroundColor", {
- /** Background color of the tab nav. */
- get: /**
- * Background color of the tab nav.
- * @return {?}
- */
- function () { return this._backgroundColor; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- /** @type {?} */
- var classList = this._elementRef.nativeElement.classList;
- classList.remove("mat-background-" + this.backgroundColor);
- if (value) {
- classList.add("mat-background-" + value);
- }
- this._backgroundColor = value;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatTabNav.prototype, "disableRipple", {
- /** Whether the ripple effect is disabled or not. */
- get: /**
- * Whether the ripple effect is disabled or not.
- * @return {?}
- */
- function () { return this._disableRipple; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) { this._disableRipple = coercion.coerceBooleanProperty(value); },
- enumerable: true,
- configurable: true
- });
- /**
- * @protected
- * @return {?}
- */
- MatTabNav.prototype._itemSelected = /**
- * @protected
- * @return {?}
- */
- function () {
- // noop
- };
- /**
- * @return {?}
- */
- MatTabNav.prototype.ngAfterContentInit = /**
- * @return {?}
- */
- function () {
- this.updateActiveLink();
- _super.prototype.ngAfterContentInit.call(this);
- };
- /**
- * Notifies the component that the active link has been changed.
- * @breaking-change 8.0.0 `element` parameter to be removed.
- */
- /**
- * Notifies the component that the active link has been changed.
- * \@breaking-change 8.0.0 `element` parameter to be removed.
- * @param {?=} _element
- * @return {?}
- */
- MatTabNav.prototype.updateActiveLink = /**
- * Notifies the component that the active link has been changed.
- * \@breaking-change 8.0.0 `element` parameter to be removed.
- * @param {?=} _element
- * @return {?}
- */
- function (_element) {
- if (!this._items) {
- return;
- }
- /** @type {?} */
- var items = this._items.toArray();
- for (var i = 0; i < items.length; i++) {
- if (items[i].active) {
- this.selectedIndex = i;
- this._changeDetectorRef.markForCheck();
- return;
- }
- }
- // The ink bar should hide itself if no items are active.
- this.selectedIndex = -1;
- this._inkBar.hide();
- };
- MatTabNav.decorators = [
- { type: core.Component, args: [{selector: '[mat-tab-nav-bar]',
- exportAs: 'matTabNavBar, matTabNav',
- inputs: ['color'],
- 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>",
- 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}}"],
- host: {
- 'class': 'mat-tab-nav-bar mat-tab-header',
- '[class.mat-tab-header-pagination-controls-enabled]': '_showPaginationControls',
- '[class.mat-tab-header-rtl]': "_getLayoutDirection() == 'rtl'",
- '[class.mat-primary]': 'color !== "warn" && color !== "accent"',
- '[class.mat-accent]': 'color === "accent"',
- '[class.mat-warn]': 'color === "warn"',
- },
- encapsulation: core.ViewEncapsulation.None,
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- },] },
- ];
- /** @nocollapse */
- MatTabNav.ctorParameters = function () { return [
- { type: core.ElementRef },
- { type: bidi.Directionality, decorators: [{ type: core.Optional }] },
- { type: core.NgZone },
- { type: core.ChangeDetectorRef },
- { type: scrolling.ViewportRuler },
- { type: platform.Platform, decorators: [{ type: core.Optional }] },
- { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
- ]; };
- MatTabNav.propDecorators = {
- _items: [{ type: core.ContentChildren, args: [core.forwardRef((/**
- * @return {?}
- */
- function () { return MatTabLink; })), { descendants: true },] }],
- _inkBar: [{ type: core.ViewChild, args: [MatInkBar, { static: true },] }],
- _tabListContainer: [{ type: core.ViewChild, args: ['tabListContainer', { static: true },] }],
- _tabList: [{ type: core.ViewChild, args: ['tabList', { static: true },] }],
- _nextPaginator: [{ type: core.ViewChild, args: ['nextPaginator', { static: false },] }],
- _previousPaginator: [{ type: core.ViewChild, args: ['previousPaginator', { static: false },] }],
- backgroundColor: [{ type: core.Input }],
- disableRipple: [{ type: core.Input }],
- color: [{ type: core.Input }]
- };
- return MatTabNav;
- }(MatPaginatedTabHeader));
- // Boilerplate for applying mixins to MatTabLink.
- var
- // Boilerplate for applying mixins to MatTabLink.
- MatTabLinkBase = /** @class */ (function () {
- function MatTabLinkBase() {
- }
- return MatTabLinkBase;
- }());
- /** @type {?} */
- var _MatTabLinkMixinBase = mixinTabIndex(mixinDisableRipple(mixinDisabled(MatTabLinkBase)));
- /**
- * Link inside of a `mat-tab-nav-bar`.
- */
- var MatTabLink = /** @class */ (function (_super) {
- __extends(MatTabLink, _super);
- function MatTabLink(_tabNavBar, elementRef, ngZone, platform$$1, globalRippleOptions, tabIndex, _focusMonitor, animationMode) {
- var _this = _super.call(this) || this;
- _this._tabNavBar = _tabNavBar;
- _this.elementRef = elementRef;
- _this._focusMonitor = _focusMonitor;
- /**
- * Whether the tab link is active or not.
- */
- _this._isActive = false;
- _this._tabLinkRipple = new RippleRenderer(_this, ngZone, elementRef, platform$$1);
- _this._tabLinkRipple.setupTriggerEvents(elementRef.nativeElement);
- _this.rippleConfig = globalRippleOptions || {};
- _this.tabIndex = parseInt(tabIndex) || 0;
- if (animationMode === 'NoopAnimations') {
- _this.rippleConfig.animation = { enterDuration: 0, exitDuration: 0 };
- }
- _focusMonitor.monitor(elementRef);
- return _this;
- }
- Object.defineProperty(MatTabLink.prototype, "active", {
- /** Whether the link is active. */
- get: /**
- * Whether the link is active.
- * @return {?}
- */
- function () { return this._isActive; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- if (value !== this._isActive) {
- this._isActive = value;
- this._tabNavBar.updateActiveLink(this.elementRef);
- }
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatTabLink.prototype, "rippleDisabled", {
- /**
- * Whether ripples are disabled on interaction.
- * @docs-private
- */
- get: /**
- * Whether ripples are disabled on interaction.
- * \@docs-private
- * @return {?}
- */
- function () {
- return this.disabled || this.disableRipple || this._tabNavBar.disableRipple ||
- !!this.rippleConfig.disabled;
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- MatTabLink.prototype.focus = /**
- * @return {?}
- */
- function () {
- this.elementRef.nativeElement.focus();
- };
- /**
- * @return {?}
- */
- MatTabLink.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- this._tabLinkRipple._removeTriggerEvents();
- this._focusMonitor.stopMonitoring(this.elementRef);
- };
- MatTabLink.decorators = [
- { type: core.Directive, args: [{
- selector: '[mat-tab-link], [matTabLink]',
- exportAs: 'matTabLink',
- inputs: ['disabled', 'disableRipple', 'tabIndex'],
- host: {
- 'class': 'mat-tab-link',
- '[attr.aria-current]': 'active ? "page" : null',
- '[attr.aria-disabled]': 'disabled',
- '[attr.tabIndex]': 'tabIndex',
- '[class.mat-tab-disabled]': 'disabled',
- '[class.mat-tab-label-active]': 'active',
- }
- },] },
- ];
- /** @nocollapse */
- MatTabLink.ctorParameters = function () { return [
- { type: MatTabNav },
- { type: core.ElementRef },
- { type: core.NgZone },
- { type: platform.Platform },
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_RIPPLE_GLOBAL_OPTIONS,] }] },
- { type: String, decorators: [{ type: core.Attribute, args: ['tabindex',] }] },
- { type: a11y.FocusMonitor },
- { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations.ANIMATION_MODULE_TYPE,] }] }
- ]; };
- MatTabLink.propDecorators = {
- active: [{ type: core.Input }]
- };
- return MatTabLink;
- }(_MatTabLinkMixinBase));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var MatTabsModule = /** @class */ (function () {
- function MatTabsModule() {
- }
- MatTabsModule.decorators = [
- { type: core.NgModule, args: [{
- imports: [
- common.CommonModule,
- MatCommonModule,
- portal.PortalModule,
- MatRippleModule,
- observers.ObserversModule,
- a11y.A11yModule,
- ],
- // Don't export all components because some are only to be used internally.
- exports: [
- MatCommonModule,
- MatTabGroup,
- MatTabLabel,
- MatTab,
- MatTabNav,
- MatTabLink,
- MatTabContent,
- ],
- declarations: [
- MatTabGroup,
- MatTabLabel,
- MatTab,
- MatInkBar,
- MatTabLabelWrapper,
- MatTabNav,
- MatTabLink,
- MatTabBody,
- MatTabBodyPortal,
- MatTabHeader,
- MatTabContent,
- ],
- },] },
- ];
- return MatTabsModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- // Boilerplate for applying mixins to MatToolbar.
- /**
- * \@docs-private
- */
- var
- // Boilerplate for applying mixins to MatToolbar.
- /**
- * \@docs-private
- */
- MatToolbarBase = /** @class */ (function () {
- function MatToolbarBase(_elementRef) {
- this._elementRef = _elementRef;
- }
- return MatToolbarBase;
- }());
- /** @type {?} */
- var _MatToolbarMixinBase = mixinColor(MatToolbarBase);
- var MatToolbarRow = /** @class */ (function () {
- function MatToolbarRow() {
- }
- MatToolbarRow.decorators = [
- { type: core.Directive, args: [{
- selector: 'mat-toolbar-row',
- exportAs: 'matToolbarRow',
- host: { 'class': 'mat-toolbar-row' },
- },] },
- ];
- return MatToolbarRow;
- }());
- var MatToolbar = /** @class */ (function (_super) {
- __extends(MatToolbar, _super);
- function MatToolbar(elementRef, _platform, document) {
- var _this = _super.call(this, elementRef) || this;
- _this._platform = _platform;
- // TODO: make the document a required param when doing breaking changes.
- _this._document = document;
- return _this;
- }
- /**
- * @return {?}
- */
- MatToolbar.prototype.ngAfterViewInit = /**
- * @return {?}
- */
- function () {
- var _this = this;
- if (!core.isDevMode() || !this._platform.isBrowser) {
- return;
- }
- this._checkToolbarMixedModes();
- this._toolbarRows.changes.subscribe((/**
- * @return {?}
- */
- function () { return _this._checkToolbarMixedModes(); }));
- };
- /**
- * Throws an exception when developers are attempting to combine the different toolbar row modes.
- */
- /**
- * Throws an exception when developers are attempting to combine the different toolbar row modes.
- * @private
- * @return {?}
- */
- MatToolbar.prototype._checkToolbarMixedModes = /**
- * Throws an exception when developers are attempting to combine the different toolbar row modes.
- * @private
- * @return {?}
- */
- function () {
- var _this = this;
- if (!this._toolbarRows.length) {
- return;
- }
- // Check if there are any other DOM nodes that can display content but aren't inside of
- // a <mat-toolbar-row> element.
- /** @type {?} */
- var isCombinedUsage = Array.from(this._elementRef.nativeElement.childNodes)
- .filter((/**
- * @param {?} node
- * @return {?}
- */
- function (node) { return !(node.classList && node.classList.contains('mat-toolbar-row')); }))
- .filter((/**
- * @param {?} node
- * @return {?}
- */
- function (node) { return node.nodeType !== (_this._document ? _this._document.COMMENT_NODE : 8); }))
- .some((/**
- * @param {?} node
- * @return {?}
- */
- function (node) { return !!(node.textContent && node.textContent.trim()); }));
- if (isCombinedUsage) {
- throwToolbarMixedModesError();
- }
- };
- MatToolbar.decorators = [
- { type: core.Component, args: [{selector: 'mat-toolbar',
- exportAs: 'matToolbar',
- template: "<ng-content></ng-content><ng-content select=\"mat-toolbar-row\"></ng-content>",
- 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}}"],
- inputs: ['color'],
- host: {
- 'class': 'mat-toolbar',
- '[class.mat-toolbar-multiple-rows]': '_toolbarRows.length > 0',
- '[class.mat-toolbar-single-row]': '_toolbarRows.length === 0',
- },
- changeDetection: core.ChangeDetectionStrategy.OnPush,
- encapsulation: core.ViewEncapsulation.None,
- },] },
- ];
- /** @nocollapse */
- MatToolbar.ctorParameters = function () { return [
- { type: core.ElementRef },
- { type: platform.Platform },
- { type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] }
- ]; };
- MatToolbar.propDecorators = {
- _toolbarRows: [{ type: core.ContentChildren, args: [MatToolbarRow,] }]
- };
- return MatToolbar;
- }(_MatToolbarMixinBase));
- /**
- * Throws an exception when attempting to combine the different toolbar row modes.
- * \@docs-private
- * @return {?}
- */
- function throwToolbarMixedModesError() {
- throw Error('MatToolbar: Attempting to combine different toolbar modes. ' +
- 'Either specify multiple `<mat-toolbar-row>` elements explicitly or just place content ' +
- 'inside of a `<mat-toolbar>` for a single row.');
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var MatToolbarModule = /** @class */ (function () {
- function MatToolbarModule() {
- }
- MatToolbarModule.decorators = [
- { type: core.NgModule, args: [{
- imports: [MatCommonModule],
- exports: [MatToolbar, MatToolbarRow, MatCommonModule],
- declarations: [MatToolbar, MatToolbarRow],
- },] },
- ];
- return MatToolbarModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /** @type {?} */
- var _MatTreeNodeMixinBase = mixinTabIndex(mixinDisabled(tree.CdkTreeNode));
- /**
- * Wrapper for the CdkTree node with Material design styles.
- * @template T
- */
- var MatTreeNode = /** @class */ (function (_super) {
- __extends(MatTreeNode, _super);
- function MatTreeNode(_elementRef, _tree, tabIndex) {
- var _this = _super.call(this, _elementRef, _tree) || this;
- _this._elementRef = _elementRef;
- _this._tree = _tree;
- _this.role = 'treeitem';
- _this.tabIndex = Number(tabIndex) || 0;
- return _this;
- }
- MatTreeNode.decorators = [
- { type: core.Directive, args: [{
- selector: 'mat-tree-node',
- exportAs: 'matTreeNode',
- inputs: ['disabled', 'tabIndex'],
- host: {
- '[attr.aria-expanded]': 'isExpanded',
- '[attr.aria-level]': 'role === "treeitem" ? level : null',
- '[attr.role]': 'role',
- 'class': 'mat-tree-node'
- },
- providers: [{ provide: tree.CdkTreeNode, useExisting: MatTreeNode }]
- },] },
- ];
- /** @nocollapse */
- MatTreeNode.ctorParameters = function () { return [
- { type: core.ElementRef },
- { type: tree.CdkTree },
- { type: String, decorators: [{ type: core.Attribute, args: ['tabindex',] }] }
- ]; };
- MatTreeNode.propDecorators = {
- role: [{ type: core.Input }]
- };
- return MatTreeNode;
- }(_MatTreeNodeMixinBase));
- /**
- * Wrapper for the CdkTree node definition with Material design styles.
- * @template T
- */
- var MatTreeNodeDef = /** @class */ (function (_super) {
- __extends(MatTreeNodeDef, _super);
- function MatTreeNodeDef() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- MatTreeNodeDef.decorators = [
- { type: core.Directive, args: [{
- selector: '[matTreeNodeDef]',
- inputs: [
- 'when: matTreeNodeDefWhen'
- ],
- providers: [{ provide: tree.CdkTreeNodeDef, useExisting: MatTreeNodeDef }]
- },] },
- ];
- MatTreeNodeDef.propDecorators = {
- data: [{ type: core.Input, args: ['matTreeNode',] }]
- };
- return MatTreeNodeDef;
- }(tree.CdkTreeNodeDef));
- /**
- * Wrapper for the CdkTree nested node with Material design styles.
- * @template T
- */
- var MatNestedTreeNode = /** @class */ (function (_super) {
- __extends(MatNestedTreeNode, _super);
- function MatNestedTreeNode(_elementRef, _tree, _differs, tabIndex) {
- var _this = _super.call(this, _elementRef, _tree, _differs) || this;
- _this._elementRef = _elementRef;
- _this._tree = _tree;
- _this._differs = _differs;
- _this._disabled = false;
- _this.tabIndex = Number(tabIndex) || 0;
- return _this;
- }
- Object.defineProperty(MatNestedTreeNode.prototype, "disabled", {
- /** Whether the node is disabled. */
- get: /**
- * Whether the node is disabled.
- * @return {?}
- */
- function () { return this._disabled; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) { this._disabled = coercion.coerceBooleanProperty(value); },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MatNestedTreeNode.prototype, "tabIndex", {
- /** Tabindex for the node. */
- get: /**
- * Tabindex for the node.
- * @return {?}
- */
- function () { return this.disabled ? -1 : this._tabIndex; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- // If the specified tabIndex value is null or undefined, fall back to the default value.
- this._tabIndex = value != null ? value : 0;
- },
- enumerable: true,
- configurable: true
- });
- // This is a workaround for https://github.com/angular/angular/issues/23091
- // In aot mode, the lifecycle hooks from parent class are not called.
- // TODO(tinayuangao): Remove when the angular issue #23091 is fixed
- // This is a workaround for https://github.com/angular/angular/issues/23091
- // In aot mode, the lifecycle hooks from parent class are not called.
- // TODO(tinayuangao): Remove when the angular issue #23091 is fixed
- /**
- * @return {?}
- */
- MatNestedTreeNode.prototype.ngAfterContentInit =
- // This is a workaround for https://github.com/angular/angular/issues/23091
- // In aot mode, the lifecycle hooks from parent class are not called.
- // TODO(tinayuangao): Remove when the angular issue #23091 is fixed
- /**
- * @return {?}
- */
- function () {
- _super.prototype.ngAfterContentInit.call(this);
- };
- /**
- * @return {?}
- */
- MatNestedTreeNode.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- _super.prototype.ngOnDestroy.call(this);
- };
- MatNestedTreeNode.decorators = [
- { type: core.Directive, args: [{
- selector: 'mat-nested-tree-node',
- exportAs: 'matNestedTreeNode',
- host: {
- '[attr.aria-expanded]': 'isExpanded',
- '[attr.role]': 'role',
- 'class': 'mat-nested-tree-node',
- },
- providers: [
- { provide: tree.CdkNestedTreeNode, useExisting: MatNestedTreeNode },
- { provide: tree.CdkTreeNode, useExisting: MatNestedTreeNode },
- { provide: tree.CDK_TREE_NODE_OUTLET_NODE, useExisting: MatNestedTreeNode }
- ]
- },] },
- ];
- /** @nocollapse */
- MatNestedTreeNode.ctorParameters = function () { return [
- { type: core.ElementRef },
- { type: tree.CdkTree },
- { type: core.IterableDiffers },
- { type: String, decorators: [{ type: core.Attribute, args: ['tabindex',] }] }
- ]; };
- MatNestedTreeNode.propDecorators = {
- node: [{ type: core.Input, args: ['matNestedTreeNode',] }],
- disabled: [{ type: core.Input }],
- tabIndex: [{ type: core.Input }]
- };
- return MatNestedTreeNode;
- }(tree.CdkNestedTreeNode));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Wrapper for the CdkTree padding with Material design styles.
- * @template T
- */
- var MatTreeNodePadding = /** @class */ (function (_super) {
- __extends(MatTreeNodePadding, _super);
- function MatTreeNodePadding() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- MatTreeNodePadding.decorators = [
- { type: core.Directive, args: [{
- selector: '[matTreeNodePadding]',
- providers: [{ provide: tree.CdkTreeNodePadding, useExisting: MatTreeNodePadding }]
- },] },
- ];
- MatTreeNodePadding.propDecorators = {
- level: [{ type: core.Input, args: ['matTreeNodePadding',] }],
- indent: [{ type: core.Input, args: ['matTreeNodePaddingIndent',] }]
- };
- return MatTreeNodePadding;
- }(tree.CdkTreeNodePadding));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Outlet for nested CdkNode. Put `[matTreeNodeOutlet]` on a tag to place children dataNodes
- * inside the outlet.
- */
- var MatTreeNodeOutlet = /** @class */ (function () {
- function MatTreeNodeOutlet(viewContainer, _node) {
- this.viewContainer = viewContainer;
- this._node = _node;
- }
- MatTreeNodeOutlet.decorators = [
- { type: core.Directive, args: [{
- selector: '[matTreeNodeOutlet]',
- providers: [{
- provide: tree.CdkTreeNodeOutlet,
- useExisting: MatTreeNodeOutlet
- }]
- },] },
- ];
- /** @nocollapse */
- MatTreeNodeOutlet.ctorParameters = function () { return [
- { type: core.ViewContainerRef },
- { type: undefined, decorators: [{ type: core.Inject, args: [tree.CDK_TREE_NODE_OUTLET_NODE,] }, { type: core.Optional }] }
- ]; };
- return MatTreeNodeOutlet;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Wrapper for the CdkTable with Material design styles.
- * @template T
- */
- var MatTree = /** @class */ (function (_super) {
- __extends(MatTree, _super);
- function MatTree() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- MatTree.decorators = [
- { type: core.Component, args: [{selector: 'mat-tree',
- exportAs: 'matTree',
- template: "<ng-container matTreeNodeOutlet></ng-container>",
- host: {
- 'class': 'mat-tree',
- 'role': 'tree',
- },
- 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}"],
- encapsulation: core.ViewEncapsulation.None,
- // See note on CdkTree for explanation on why this uses the default change detection strategy.
- // tslint:disable-next-line:validate-decorators
- changeDetection: core.ChangeDetectionStrategy.Default,
- providers: [{ provide: tree.CdkTree, useExisting: MatTree }]
- },] },
- ];
- MatTree.propDecorators = {
- _nodeOutlet: [{ type: core.ViewChild, args: [MatTreeNodeOutlet, { static: true },] }]
- };
- return MatTree;
- }(tree.CdkTree));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Wrapper for the CdkTree's toggle with Material design styles.
- * @template T
- */
- var MatTreeNodeToggle = /** @class */ (function (_super) {
- __extends(MatTreeNodeToggle, _super);
- function MatTreeNodeToggle() {
- var _this = _super !== null && _super.apply(this, arguments) || this;
- _this.recursive = false;
- return _this;
- }
- MatTreeNodeToggle.decorators = [
- { type: core.Directive, args: [{
- selector: '[matTreeNodeToggle]',
- providers: [{ provide: tree.CdkTreeNodeToggle, useExisting: MatTreeNodeToggle }]
- },] },
- ];
- MatTreeNodeToggle.propDecorators = {
- recursive: [{ type: core.Input, args: ['matTreeNodeToggleRecursive',] }]
- };
- return MatTreeNodeToggle;
- }(tree.CdkTreeNodeToggle));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /** @type {?} */
- var MAT_TREE_DIRECTIVES = [
- MatNestedTreeNode,
- MatTreeNodeDef,
- MatTreeNodePadding,
- MatTreeNodeToggle,
- MatTree,
- MatTreeNode,
- MatTreeNodeOutlet
- ];
- var MatTreeModule = /** @class */ (function () {
- function MatTreeModule() {
- }
- MatTreeModule.decorators = [
- { type: core.NgModule, args: [{
- imports: [tree.CdkTreeModule, common.CommonModule, MatCommonModule],
- exports: MAT_TREE_DIRECTIVES,
- declarations: MAT_TREE_DIRECTIVES,
- },] },
- ];
- return MatTreeModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Tree flattener to convert a normal type of node to node with children & level information.
- * Transform nested nodes of type `T` to flattened nodes of type `F`.
- *
- * For example, the input data of type `T` is nested, and contains its children data:
- * SomeNode: {
- * key: 'Fruits',
- * children: [
- * NodeOne: {
- * key: 'Apple',
- * },
- * NodeTwo: {
- * key: 'Pear',
- * }
- * ]
- * }
- * After flattener flatten the tree, the structure will become
- * SomeNode: {
- * key: 'Fruits',
- * expandable: true,
- * level: 1
- * },
- * NodeOne: {
- * key: 'Apple',
- * expandable: false,
- * level: 2
- * },
- * NodeTwo: {
- * key: 'Pear',
- * expandable: false,
- * level: 2
- * }
- * and the output flattened type is `F` with additional information.
- * @template T, F
- */
- var /**
- * Tree flattener to convert a normal type of node to node with children & level information.
- * Transform nested nodes of type `T` to flattened nodes of type `F`.
- *
- * For example, the input data of type `T` is nested, and contains its children data:
- * SomeNode: {
- * key: 'Fruits',
- * children: [
- * NodeOne: {
- * key: 'Apple',
- * },
- * NodeTwo: {
- * key: 'Pear',
- * }
- * ]
- * }
- * After flattener flatten the tree, the structure will become
- * SomeNode: {
- * key: 'Fruits',
- * expandable: true,
- * level: 1
- * },
- * NodeOne: {
- * key: 'Apple',
- * expandable: false,
- * level: 2
- * },
- * NodeTwo: {
- * key: 'Pear',
- * expandable: false,
- * level: 2
- * }
- * and the output flattened type is `F` with additional information.
- * @template T, F
- */
- MatTreeFlattener = /** @class */ (function () {
- function MatTreeFlattener(transformFunction, getLevel, isExpandable, getChildren) {
- this.transformFunction = transformFunction;
- this.getLevel = getLevel;
- this.isExpandable = isExpandable;
- this.getChildren = getChildren;
- }
- /**
- * @param {?} node
- * @param {?} level
- * @param {?} resultNodes
- * @param {?} parentMap
- * @return {?}
- */
- MatTreeFlattener.prototype._flattenNode = /**
- * @param {?} node
- * @param {?} level
- * @param {?} resultNodes
- * @param {?} parentMap
- * @return {?}
- */
- function (node, level, resultNodes, parentMap) {
- var _this = this;
- /** @type {?} */
- var flatNode = this.transformFunction(node, level);
- resultNodes.push(flatNode);
- if (this.isExpandable(flatNode)) {
- /** @type {?} */
- var childrenNodes = this.getChildren(node);
- if (childrenNodes) {
- if (Array.isArray(childrenNodes)) {
- this._flattenChildren(childrenNodes, level, resultNodes, parentMap);
- }
- else {
- childrenNodes.pipe(operators.take(1)).subscribe((/**
- * @param {?} children
- * @return {?}
- */
- function (children) {
- _this._flattenChildren(children, level, resultNodes, parentMap);
- }));
- }
- }
- }
- return resultNodes;
- };
- /**
- * @param {?} children
- * @param {?} level
- * @param {?} resultNodes
- * @param {?} parentMap
- * @return {?}
- */
- MatTreeFlattener.prototype._flattenChildren = /**
- * @param {?} children
- * @param {?} level
- * @param {?} resultNodes
- * @param {?} parentMap
- * @return {?}
- */
- function (children, level, resultNodes, parentMap) {
- var _this = this;
- children.forEach((/**
- * @param {?} child
- * @param {?} index
- * @return {?}
- */
- function (child, index) {
- /** @type {?} */
- var childParentMap = parentMap.slice();
- childParentMap.push(index != children.length - 1);
- _this._flattenNode(child, level + 1, resultNodes, childParentMap);
- }));
- };
- /**
- * Flatten a list of node type T to flattened version of node F.
- * Please note that type T may be nested, and the length of `structuredData` may be different
- * from that of returned list `F[]`.
- */
- /**
- * Flatten a list of node type T to flattened version of node F.
- * Please note that type T may be nested, and the length of `structuredData` may be different
- * from that of returned list `F[]`.
- * @param {?} structuredData
- * @return {?}
- */
- MatTreeFlattener.prototype.flattenNodes = /**
- * Flatten a list of node type T to flattened version of node F.
- * Please note that type T may be nested, and the length of `structuredData` may be different
- * from that of returned list `F[]`.
- * @param {?} structuredData
- * @return {?}
- */
- function (structuredData) {
- var _this = this;
- /** @type {?} */
- var resultNodes = [];
- structuredData.forEach((/**
- * @param {?} node
- * @return {?}
- */
- function (node) { return _this._flattenNode(node, 0, resultNodes, []); }));
- return resultNodes;
- };
- /**
- * Expand flattened node with current expansion status.
- * The returned list may have different length.
- */
- /**
- * Expand flattened node with current expansion status.
- * The returned list may have different length.
- * @param {?} nodes
- * @param {?} treeControl
- * @return {?}
- */
- MatTreeFlattener.prototype.expandFlattenedNodes = /**
- * Expand flattened node with current expansion status.
- * The returned list may have different length.
- * @param {?} nodes
- * @param {?} treeControl
- * @return {?}
- */
- function (nodes, treeControl) {
- var _this = this;
- /** @type {?} */
- var results = [];
- /** @type {?} */
- var currentExpand = [];
- currentExpand[0] = true;
- nodes.forEach((/**
- * @param {?} node
- * @return {?}
- */
- function (node) {
- /** @type {?} */
- var expand = true;
- for (var i = 0; i <= _this.getLevel(node); i++) {
- expand = expand && currentExpand[i];
- }
- if (expand) {
- results.push(node);
- }
- if (_this.isExpandable(node)) {
- currentExpand[_this.getLevel(node) + 1] = treeControl.isExpanded(node);
- }
- }));
- return results;
- };
- return MatTreeFlattener;
- }());
- /**
- * Data source for flat tree.
- * The data source need to handle expansion/collapsion of the tree node and change the data feed
- * to `MatTree`.
- * The nested tree nodes of type `T` are flattened through `MatTreeFlattener`, and converted
- * to type `F` for `MatTree` to consume.
- * @template T, F
- */
- var /**
- * Data source for flat tree.
- * The data source need to handle expansion/collapsion of the tree node and change the data feed
- * to `MatTree`.
- * The nested tree nodes of type `T` are flattened through `MatTreeFlattener`, and converted
- * to type `F` for `MatTree` to consume.
- * @template T, F
- */
- MatTreeFlatDataSource = /** @class */ (function (_super) {
- __extends(MatTreeFlatDataSource, _super);
- function MatTreeFlatDataSource(_treeControl, _treeFlattener, initialData) {
- if (initialData === void 0) { initialData = []; }
- var _this = _super.call(this) || this;
- _this._treeControl = _treeControl;
- _this._treeFlattener = _treeFlattener;
- _this._flattenedData = new rxjs.BehaviorSubject([]);
- _this._expandedData = new rxjs.BehaviorSubject([]);
- _this._data = new rxjs.BehaviorSubject(initialData);
- return _this;
- }
- Object.defineProperty(MatTreeFlatDataSource.prototype, "data", {
- get: /**
- * @return {?}
- */
- function () { return this._data.value; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._data.next(value);
- this._flattenedData.next(this._treeFlattener.flattenNodes(this.data));
- this._treeControl.dataNodes = this._flattenedData.value;
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @param {?} collectionViewer
- * @return {?}
- */
- MatTreeFlatDataSource.prototype.connect = /**
- * @param {?} collectionViewer
- * @return {?}
- */
- function (collectionViewer) {
- var _this = this;
- /** @type {?} */
- var changes = [
- collectionViewer.viewChange,
- this._treeControl.expansionModel.onChange,
- this._flattenedData
- ];
- return rxjs.merge.apply(void 0, changes).pipe(operators.map((/**
- * @return {?}
- */
- function () {
- _this._expandedData.next(_this._treeFlattener.expandFlattenedNodes(_this._flattenedData.value, _this._treeControl));
- return _this._expandedData.value;
- })));
- };
- /**
- * @return {?}
- */
- MatTreeFlatDataSource.prototype.disconnect = /**
- * @return {?}
- */
- function () {
- // no op
- };
- return MatTreeFlatDataSource;
- }(collections.DataSource));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Data source for nested tree.
- *
- * The data source for nested tree doesn't have to consider node flattener, or the way to expand
- * or collapse. The expansion/collapsion will be handled by TreeControl and each non-leaf node.
- * @template T
- */
- var /**
- * Data source for nested tree.
- *
- * The data source for nested tree doesn't have to consider node flattener, or the way to expand
- * or collapse. The expansion/collapsion will be handled by TreeControl and each non-leaf node.
- * @template T
- */
- MatTreeNestedDataSource = /** @class */ (function (_super) {
- __extends(MatTreeNestedDataSource, _super);
- function MatTreeNestedDataSource() {
- var _this = _super !== null && _super.apply(this, arguments) || this;
- _this._data = new rxjs.BehaviorSubject([]);
- return _this;
- }
- Object.defineProperty(MatTreeNestedDataSource.prototype, "data", {
- /**
- * Data for the nested tree
- */
- get: /**
- * Data for the nested tree
- * @return {?}
- */
- function () { return this._data.value; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) { this._data.next(value); },
- enumerable: true,
- configurable: true
- });
- /**
- * @param {?} collectionViewer
- * @return {?}
- */
- MatTreeNestedDataSource.prototype.connect = /**
- * @param {?} collectionViewer
- * @return {?}
- */
- function (collectionViewer) {
- var _this = this;
- return rxjs.merge.apply(void 0, [collectionViewer.viewChange, this._data]).pipe(operators.map((/**
- * @return {?}
- */
- function () {
- return _this.data;
- })));
- };
- /**
- * @return {?}
- */
- MatTreeNestedDataSource.prototype.disconnect = /**
- * @return {?}
- */
- function () {
- // no op
- };
- return MatTreeNestedDataSource;
- }(collections.DataSource));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- exports.MAT_AUTOCOMPLETE_DEFAULT_OPTIONS_FACTORY = MAT_AUTOCOMPLETE_DEFAULT_OPTIONS_FACTORY;
- exports.MatAutocompleteSelectedEvent = MatAutocompleteSelectedEvent;
- exports.MAT_AUTOCOMPLETE_DEFAULT_OPTIONS = MAT_AUTOCOMPLETE_DEFAULT_OPTIONS;
- exports.MatAutocomplete = MatAutocomplete;
- exports.MatAutocompleteModule = MatAutocompleteModule;
- exports.MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY = MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY;
- exports.getMatAutocompleteMissingPanelError = getMatAutocompleteMissingPanelError;
- exports.AUTOCOMPLETE_OPTION_HEIGHT = AUTOCOMPLETE_OPTION_HEIGHT;
- exports.AUTOCOMPLETE_PANEL_HEIGHT = AUTOCOMPLETE_PANEL_HEIGHT;
- exports.MAT_AUTOCOMPLETE_SCROLL_STRATEGY = MAT_AUTOCOMPLETE_SCROLL_STRATEGY;
- exports.MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY_PROVIDER = MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY_PROVIDER;
- exports.MAT_AUTOCOMPLETE_VALUE_ACCESSOR = MAT_AUTOCOMPLETE_VALUE_ACCESSOR;
- exports.MatAutocompleteTrigger = MatAutocompleteTrigger;
- exports.MatAutocompleteOrigin = MatAutocompleteOrigin;
- exports.MatBadgeModule = MatBadgeModule;
- exports.MatBadge = MatBadge;
- exports.MatBottomSheetModule = MatBottomSheetModule;
- exports.MAT_BOTTOM_SHEET_DEFAULT_OPTIONS = MAT_BOTTOM_SHEET_DEFAULT_OPTIONS;
- exports.MatBottomSheet = MatBottomSheet;
- exports.MAT_BOTTOM_SHEET_DATA = MAT_BOTTOM_SHEET_DATA;
- exports.MatBottomSheetConfig = MatBottomSheetConfig;
- exports.MatBottomSheetContainer = MatBottomSheetContainer;
- exports.matBottomSheetAnimations = matBottomSheetAnimations;
- exports.MatBottomSheetRef = MatBottomSheetRef;
- exports.MatButtonModule = MatButtonModule;
- exports.MatButton = MatButton;
- exports.MatAnchor = MatAnchor;
- exports.MAT_BUTTON_TOGGLE_DEFAULT_OPTIONS = MAT_BUTTON_TOGGLE_DEFAULT_OPTIONS;
- exports.MAT_BUTTON_TOGGLE_GROUP_VALUE_ACCESSOR = MAT_BUTTON_TOGGLE_GROUP_VALUE_ACCESSOR;
- exports.MatButtonToggleGroupMultiple = MatButtonToggleGroupMultiple;
- exports.MatButtonToggleChange = MatButtonToggleChange;
- exports.MatButtonToggleGroup = MatButtonToggleGroup;
- exports.MatButtonToggle = MatButtonToggle;
- exports.MatButtonToggleModule = MatButtonToggleModule;
- exports.MatCardContent = MatCardContent;
- exports.MatCardTitle = MatCardTitle;
- exports.MatCardSubtitle = MatCardSubtitle;
- exports.MatCardActions = MatCardActions;
- exports.MatCardFooter = MatCardFooter;
- exports.MatCardImage = MatCardImage;
- exports.MatCardSmImage = MatCardSmImage;
- exports.MatCardMdImage = MatCardMdImage;
- exports.MatCardLgImage = MatCardLgImage;
- exports.MatCardXlImage = MatCardXlImage;
- exports.MatCardAvatar = MatCardAvatar;
- exports.MatCard = MatCard;
- exports.MatCardHeader = MatCardHeader;
- exports.MatCardTitleGroup = MatCardTitleGroup;
- exports.MatCardModule = MatCardModule;
- exports.MAT_CHECKBOX_CONTROL_VALUE_ACCESSOR = MAT_CHECKBOX_CONTROL_VALUE_ACCESSOR;
- exports.TransitionCheckState = TransitionCheckState;
- exports.MatCheckboxChange = MatCheckboxChange;
- exports.MatCheckbox = MatCheckbox;
- exports.MAT_CHECKBOX_CLICK_ACTION = MAT_CHECKBOX_CLICK_ACTION;
- exports._MatCheckboxRequiredValidatorModule = _MatCheckboxRequiredValidatorModule;
- exports.MatCheckboxModule = MatCheckboxModule;
- exports.MAT_CHECKBOX_REQUIRED_VALIDATOR = MAT_CHECKBOX_REQUIRED_VALIDATOR;
- exports.MatCheckboxRequiredValidator = MatCheckboxRequiredValidator;
- exports.MatChipsModule = MatChipsModule;
- exports.MatChipListChange = MatChipListChange;
- exports.MatChipList = MatChipList;
- exports.MatChipSelectionChange = MatChipSelectionChange;
- exports.MatChipAvatar = MatChipAvatar;
- exports.MatChipTrailingIcon = MatChipTrailingIcon;
- exports.MatChip = MatChip;
- exports.MatChipRemove = MatChipRemove;
- exports.MatChipInput = MatChipInput;
- exports.MAT_CHIPS_DEFAULT_OPTIONS = MAT_CHIPS_DEFAULT_OPTIONS;
- exports.ɵa1 = MATERIAL_SANITY_CHECKS_FACTORY;
- exports.VERSION = VERSION$1;
- exports.AnimationCurves = AnimationCurves;
- exports.AnimationDurations = AnimationDurations;
- exports.MatCommonModule = MatCommonModule;
- exports.MATERIAL_SANITY_CHECKS = MATERIAL_SANITY_CHECKS;
- exports.mixinDisabled = mixinDisabled;
- exports.mixinColor = mixinColor;
- exports.mixinDisableRipple = mixinDisableRipple;
- exports.mixinTabIndex = mixinTabIndex;
- exports.mixinErrorState = mixinErrorState;
- exports.mixinInitialized = mixinInitialized;
- exports.NativeDateModule = NativeDateModule;
- exports.MatNativeDateModule = MatNativeDateModule;
- exports.MAT_DATE_LOCALE_FACTORY = MAT_DATE_LOCALE_FACTORY;
- exports.MAT_DATE_LOCALE = MAT_DATE_LOCALE;
- exports.MAT_DATE_LOCALE_PROVIDER = MAT_DATE_LOCALE_PROVIDER;
- exports.DateAdapter = DateAdapter;
- exports.MAT_DATE_FORMATS = MAT_DATE_FORMATS;
- exports.NativeDateAdapter = NativeDateAdapter;
- exports.MAT_NATIVE_DATE_FORMATS = MAT_NATIVE_DATE_FORMATS;
- exports.ShowOnDirtyErrorStateMatcher = ShowOnDirtyErrorStateMatcher;
- exports.ErrorStateMatcher = ErrorStateMatcher;
- exports.MAT_HAMMER_OPTIONS = MAT_HAMMER_OPTIONS;
- exports.GestureConfig = GestureConfig;
- exports.setLines = setLines;
- exports.MatLine = MatLine;
- exports.MatLineSetter = MatLineSetter;
- exports.MatLineModule = MatLineModule;
- exports.MatOptionModule = MatOptionModule;
- exports._countGroupLabelsBeforeOption = _countGroupLabelsBeforeOption;
- exports._getOptionScrollPosition = _getOptionScrollPosition;
- exports.MatOptionSelectionChange = MatOptionSelectionChange;
- exports.MAT_OPTION_PARENT_COMPONENT = MAT_OPTION_PARENT_COMPONENT;
- exports.MatOption = MatOption;
- exports.MatOptgroup = MatOptgroup;
- exports.MAT_LABEL_GLOBAL_OPTIONS = MAT_LABEL_GLOBAL_OPTIONS;
- exports.MatRippleModule = MatRippleModule;
- exports.MAT_RIPPLE_GLOBAL_OPTIONS = MAT_RIPPLE_GLOBAL_OPTIONS;
- exports.MatRipple = MatRipple;
- exports.RippleState = RippleState;
- exports.RippleRef = RippleRef;
- exports.defaultRippleAnimationConfig = defaultRippleAnimationConfig;
- exports.RippleRenderer = RippleRenderer;
- exports.MatPseudoCheckboxModule = MatPseudoCheckboxModule;
- exports.MatPseudoCheckbox = MatPseudoCheckbox;
- exports.JAN = JAN;
- exports.FEB = FEB;
- exports.MAR = MAR;
- exports.APR = APR;
- exports.MAY = MAY;
- exports.JUN = JUN;
- exports.JUL = JUL;
- exports.AUG = AUG;
- exports.SEP = SEP;
- exports.OCT = OCT;
- exports.NOV = NOV;
- exports.DEC = DEC;
- exports.MatMultiYearView = MatMultiYearView;
- exports.yearsPerPage = yearsPerPage;
- exports.yearsPerRow = yearsPerRow;
- exports.MatDatepickerModule = MatDatepickerModule;
- exports.MatCalendarHeader = MatCalendarHeader;
- exports.MatCalendar = MatCalendar;
- exports.MatCalendarCell = MatCalendarCell;
- exports.MatCalendarBody = MatCalendarBody;
- exports.MAT_DATEPICKER_SCROLL_STRATEGY_FACTORY = MAT_DATEPICKER_SCROLL_STRATEGY_FACTORY;
- exports.MAT_DATEPICKER_SCROLL_STRATEGY = MAT_DATEPICKER_SCROLL_STRATEGY;
- exports.MAT_DATEPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER = MAT_DATEPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER;
- exports.MatDatepickerContent = MatDatepickerContent;
- exports.MatDatepicker = MatDatepicker;
- exports.matDatepickerAnimations = matDatepickerAnimations;
- exports.MAT_DATEPICKER_VALUE_ACCESSOR = MAT_DATEPICKER_VALUE_ACCESSOR;
- exports.MAT_DATEPICKER_VALIDATORS = MAT_DATEPICKER_VALIDATORS;
- exports.MatDatepickerInputEvent = MatDatepickerInputEvent;
- exports.MatDatepickerInput = MatDatepickerInput;
- exports.MatDatepickerIntl = MatDatepickerIntl;
- exports.MatDatepickerToggleIcon = MatDatepickerToggleIcon;
- exports.MatDatepickerToggle = MatDatepickerToggle;
- exports.MatMonthView = MatMonthView;
- exports.MatYearView = MatYearView;
- exports.MatDialogModule = MatDialogModule;
- exports.MAT_DIALOG_SCROLL_STRATEGY_FACTORY = MAT_DIALOG_SCROLL_STRATEGY_FACTORY;
- exports.MAT_DIALOG_SCROLL_STRATEGY_PROVIDER_FACTORY = MAT_DIALOG_SCROLL_STRATEGY_PROVIDER_FACTORY;
- exports.MAT_DIALOG_DATA = MAT_DIALOG_DATA;
- exports.MAT_DIALOG_DEFAULT_OPTIONS = MAT_DIALOG_DEFAULT_OPTIONS;
- exports.MAT_DIALOG_SCROLL_STRATEGY = MAT_DIALOG_SCROLL_STRATEGY;
- exports.MAT_DIALOG_SCROLL_STRATEGY_PROVIDER = MAT_DIALOG_SCROLL_STRATEGY_PROVIDER;
- exports.MatDialog = MatDialog;
- exports.throwMatDialogContentAlreadyAttachedError = throwMatDialogContentAlreadyAttachedError;
- exports.MatDialogContainer = MatDialogContainer;
- exports.MatDialogClose = MatDialogClose;
- exports.MatDialogTitle = MatDialogTitle;
- exports.MatDialogContent = MatDialogContent;
- exports.MatDialogActions = MatDialogActions;
- exports.MatDialogConfig = MatDialogConfig;
- exports.MatDialogRef = MatDialogRef;
- exports.matDialogAnimations = matDialogAnimations;
- exports.MatDivider = MatDivider;
- exports.MatDividerModule = MatDividerModule;
- exports.MatExpansionModule = MatExpansionModule;
- exports.MatAccordion = MatAccordion;
- exports.MAT_ACCORDION = MAT_ACCORDION;
- exports.MAT_EXPANSION_PANEL_DEFAULT_OPTIONS = MAT_EXPANSION_PANEL_DEFAULT_OPTIONS;
- exports.MatExpansionPanel = MatExpansionPanel;
- exports.MatExpansionPanelActionRow = MatExpansionPanelActionRow;
- exports.MatExpansionPanelHeader = MatExpansionPanelHeader;
- exports.MatExpansionPanelDescription = MatExpansionPanelDescription;
- exports.MatExpansionPanelTitle = MatExpansionPanelTitle;
- exports.MatExpansionPanelContent = MatExpansionPanelContent;
- exports.EXPANSION_PANEL_ANIMATION_TIMING = EXPANSION_PANEL_ANIMATION_TIMING;
- exports.matExpansionAnimations = matExpansionAnimations;
- exports.MatFormFieldModule = MatFormFieldModule;
- exports.MatError = MatError;
- exports.MAT_FORM_FIELD_DEFAULT_OPTIONS = MAT_FORM_FIELD_DEFAULT_OPTIONS;
- exports.MatFormField = MatFormField;
- exports.MatFormFieldControl = MatFormFieldControl;
- exports.getMatFormFieldPlaceholderConflictError = getMatFormFieldPlaceholderConflictError;
- exports.getMatFormFieldDuplicatedHintError = getMatFormFieldDuplicatedHintError;
- exports.getMatFormFieldMissingControlError = getMatFormFieldMissingControlError;
- exports.MatHint = MatHint;
- exports.MatPlaceholder = MatPlaceholder;
- exports.MatPrefix = MatPrefix;
- exports.MatSuffix = MatSuffix;
- exports.MatLabel = MatLabel;
- exports.matFormFieldAnimations = matFormFieldAnimations;
- exports.ɵa6 = MAT_GRID_LIST;
- exports.MatGridListModule = MatGridListModule;
- exports.MatGridList = MatGridList;
- exports.MatGridTile = MatGridTile;
- exports.MatGridTileText = MatGridTileText;
- exports.MatGridAvatarCssMatStyler = MatGridAvatarCssMatStyler;
- exports.MatGridTileHeaderCssMatStyler = MatGridTileHeaderCssMatStyler;
- exports.MatGridTileFooterCssMatStyler = MatGridTileFooterCssMatStyler;
- exports.MatIconModule = MatIconModule;
- exports.MAT_ICON_LOCATION_FACTORY = MAT_ICON_LOCATION_FACTORY;
- exports.MAT_ICON_LOCATION = MAT_ICON_LOCATION;
- exports.MatIcon = MatIcon;
- exports.getMatIconNameNotFoundError = getMatIconNameNotFoundError;
- exports.getMatIconNoHttpProviderError = getMatIconNoHttpProviderError;
- exports.getMatIconFailedToSanitizeUrlError = getMatIconFailedToSanitizeUrlError;
- exports.getMatIconFailedToSanitizeLiteralError = getMatIconFailedToSanitizeLiteralError;
- exports.ICON_REGISTRY_PROVIDER_FACTORY = ICON_REGISTRY_PROVIDER_FACTORY;
- exports.MatIconRegistry = MatIconRegistry;
- exports.ICON_REGISTRY_PROVIDER = ICON_REGISTRY_PROVIDER;
- exports.MatTextareaAutosize = MatTextareaAutosize;
- exports.MatInput = MatInput;
- exports.getMatInputUnsupportedTypeError = getMatInputUnsupportedTypeError;
- exports.MatInputModule = MatInputModule;
- exports.MAT_INPUT_VALUE_ACCESSOR = MAT_INPUT_VALUE_ACCESSOR;
- exports.MatListModule = MatListModule;
- exports.MatNavList = MatNavList;
- exports.MatList = MatList;
- exports.MatListAvatarCssMatStyler = MatListAvatarCssMatStyler;
- exports.MatListIconCssMatStyler = MatListIconCssMatStyler;
- exports.MatListSubheaderCssMatStyler = MatListSubheaderCssMatStyler;
- exports.MatListItem = MatListItem;
- exports.MAT_SELECTION_LIST_VALUE_ACCESSOR = MAT_SELECTION_LIST_VALUE_ACCESSOR;
- exports.MatSelectionListChange = MatSelectionListChange;
- exports.MatListOption = MatListOption;
- exports.MatSelectionList = MatSelectionList;
- exports.ɵa24 = MAT_MENU_DEFAULT_OPTIONS_FACTORY;
- exports.ɵb24 = MAT_MENU_SCROLL_STRATEGY_FACTORY;
- exports.ɵc24 = MAT_MENU_SCROLL_STRATEGY_FACTORY_PROVIDER;
- exports.MatMenu = MatMenu;
- exports.MAT_MENU_DEFAULT_OPTIONS = MAT_MENU_DEFAULT_OPTIONS;
- exports._MatMenu = _MatMenu;
- exports._MatMenuBase = _MatMenuBase;
- exports.MatMenuItem = MatMenuItem;
- exports.MatMenuTrigger = MatMenuTrigger;
- exports.MAT_MENU_SCROLL_STRATEGY = MAT_MENU_SCROLL_STRATEGY;
- exports.MAT_MENU_PANEL = MAT_MENU_PANEL;
- exports._MatMenuDirectivesModule = _MatMenuDirectivesModule;
- exports.MatMenuModule = MatMenuModule;
- exports.matMenuAnimations = matMenuAnimations;
- exports.fadeInItems = fadeInItems;
- exports.transformMenu = transformMenu;
- exports.MatMenuContent = MatMenuContent;
- exports.MatPaginatorModule = MatPaginatorModule;
- exports.PageEvent = PageEvent;
- exports.MatPaginator = MatPaginator;
- exports.MAT_PAGINATOR_INTL_PROVIDER_FACTORY = MAT_PAGINATOR_INTL_PROVIDER_FACTORY;
- exports.MatPaginatorIntl = MatPaginatorIntl;
- exports.MAT_PAGINATOR_INTL_PROVIDER = MAT_PAGINATOR_INTL_PROVIDER;
- exports.MatProgressBarModule = MatProgressBarModule;
- exports.MAT_PROGRESS_BAR_LOCATION_FACTORY = MAT_PROGRESS_BAR_LOCATION_FACTORY;
- exports.MAT_PROGRESS_BAR_LOCATION = MAT_PROGRESS_BAR_LOCATION;
- exports.MatProgressBar = MatProgressBar;
- exports.MatProgressSpinner = MatProgressSpinner;
- exports.MatSpinner = MatSpinner;
- exports.MAT_PROGRESS_SPINNER_DEFAULT_OPTIONS = MAT_PROGRESS_SPINNER_DEFAULT_OPTIONS;
- exports.MAT_PROGRESS_SPINNER_DEFAULT_OPTIONS_FACTORY = MAT_PROGRESS_SPINNER_DEFAULT_OPTIONS_FACTORY;
- exports.MatProgressSpinnerModule = MatProgressSpinnerModule;
- exports.MatRadioModule = MatRadioModule;
- exports.MAT_RADIO_DEFAULT_OPTIONS_FACTORY = MAT_RADIO_DEFAULT_OPTIONS_FACTORY;
- exports.MAT_RADIO_DEFAULT_OPTIONS = MAT_RADIO_DEFAULT_OPTIONS;
- exports.MAT_RADIO_GROUP_CONTROL_VALUE_ACCESSOR = MAT_RADIO_GROUP_CONTROL_VALUE_ACCESSOR;
- exports.MatRadioChange = MatRadioChange;
- exports.MatRadioGroup = MatRadioGroup;
- exports.MatRadioButton = MatRadioButton;
- exports.MatSelectModule = MatSelectModule;
- exports.MAT_SELECT_SCROLL_STRATEGY_PROVIDER_FACTORY = MAT_SELECT_SCROLL_STRATEGY_PROVIDER_FACTORY;
- exports.SELECT_PANEL_MAX_HEIGHT = SELECT_PANEL_MAX_HEIGHT;
- exports.SELECT_PANEL_PADDING_X = SELECT_PANEL_PADDING_X;
- exports.SELECT_PANEL_INDENT_PADDING_X = SELECT_PANEL_INDENT_PADDING_X;
- exports.SELECT_ITEM_HEIGHT_EM = SELECT_ITEM_HEIGHT_EM;
- exports.SELECT_MULTIPLE_PANEL_PADDING_X = SELECT_MULTIPLE_PANEL_PADDING_X;
- exports.SELECT_PANEL_VIEWPORT_PADDING = SELECT_PANEL_VIEWPORT_PADDING;
- exports.MAT_SELECT_SCROLL_STRATEGY = MAT_SELECT_SCROLL_STRATEGY;
- exports.MAT_SELECT_SCROLL_STRATEGY_PROVIDER = MAT_SELECT_SCROLL_STRATEGY_PROVIDER;
- exports.MatSelectChange = MatSelectChange;
- exports.MatSelectTrigger = MatSelectTrigger;
- exports.MatSelect = MatSelect;
- exports.matSelectAnimations = matSelectAnimations;
- exports.transformPanel = transformPanel;
- exports.fadeInContent = fadeInContent;
- exports.MatSidenavModule = MatSidenavModule;
- exports.throwMatDuplicatedDrawerError = throwMatDuplicatedDrawerError;
- exports.MAT_DRAWER_DEFAULT_AUTOSIZE_FACTORY = MAT_DRAWER_DEFAULT_AUTOSIZE_FACTORY;
- exports.MAT_DRAWER_DEFAULT_AUTOSIZE = MAT_DRAWER_DEFAULT_AUTOSIZE;
- exports.MatDrawerContent = MatDrawerContent;
- exports.MatDrawer = MatDrawer;
- exports.MatDrawerContainer = MatDrawerContainer;
- exports.MatSidenavContent = MatSidenavContent;
- exports.MatSidenav = MatSidenav;
- exports.MatSidenavContainer = MatSidenavContainer;
- exports.matDrawerAnimations = matDrawerAnimations;
- exports._MatSlideToggleRequiredValidatorModule = _MatSlideToggleRequiredValidatorModule;
- exports.MatSlideToggleModule = MatSlideToggleModule;
- exports.MAT_SLIDE_TOGGLE_VALUE_ACCESSOR = MAT_SLIDE_TOGGLE_VALUE_ACCESSOR;
- exports.MatSlideToggleChange = MatSlideToggleChange;
- exports.MatSlideToggle = MatSlideToggle;
- exports.MAT_SLIDE_TOGGLE_DEFAULT_OPTIONS = MAT_SLIDE_TOGGLE_DEFAULT_OPTIONS;
- exports.MAT_SLIDE_TOGGLE_REQUIRED_VALIDATOR = MAT_SLIDE_TOGGLE_REQUIRED_VALIDATOR;
- exports.MatSlideToggleRequiredValidator = MatSlideToggleRequiredValidator;
- exports.MatSliderModule = MatSliderModule;
- exports.MAT_SLIDER_VALUE_ACCESSOR = MAT_SLIDER_VALUE_ACCESSOR;
- exports.MatSliderChange = MatSliderChange;
- exports.MatSlider = MatSlider;
- exports.MatSnackBarModule = MatSnackBarModule;
- exports.MAT_SNACK_BAR_DEFAULT_OPTIONS_FACTORY = MAT_SNACK_BAR_DEFAULT_OPTIONS_FACTORY;
- exports.MAT_SNACK_BAR_DEFAULT_OPTIONS = MAT_SNACK_BAR_DEFAULT_OPTIONS;
- exports.MatSnackBar = MatSnackBar;
- exports.MatSnackBarContainer = MatSnackBarContainer;
- exports.MAT_SNACK_BAR_DATA = MAT_SNACK_BAR_DATA;
- exports.MatSnackBarConfig = MatSnackBarConfig;
- exports.MatSnackBarRef = MatSnackBarRef;
- exports.SimpleSnackBar = SimpleSnackBar;
- exports.matSnackBarAnimations = matSnackBarAnimations;
- exports.MatSortModule = MatSortModule;
- exports.MatSortHeader = MatSortHeader;
- exports.MAT_SORT_HEADER_INTL_PROVIDER_FACTORY = MAT_SORT_HEADER_INTL_PROVIDER_FACTORY;
- exports.MatSortHeaderIntl = MatSortHeaderIntl;
- exports.MAT_SORT_HEADER_INTL_PROVIDER = MAT_SORT_HEADER_INTL_PROVIDER;
- exports.MatSort = MatSort;
- exports.matSortAnimations = matSortAnimations;
- exports.MatStepperModule = MatStepperModule;
- exports.MatStepLabel = MatStepLabel;
- exports.MatStep = MatStep;
- exports.MatStepper = MatStepper;
- exports.MatHorizontalStepper = MatHorizontalStepper;
- exports.MatVerticalStepper = MatVerticalStepper;
- exports.MatStepperNext = MatStepperNext;
- exports.MatStepperPrevious = MatStepperPrevious;
- exports.MatStepHeader = MatStepHeader;
- exports.MAT_STEPPER_INTL_PROVIDER_FACTORY = MAT_STEPPER_INTL_PROVIDER_FACTORY;
- exports.MatStepperIntl = MatStepperIntl;
- exports.MAT_STEPPER_INTL_PROVIDER = MAT_STEPPER_INTL_PROVIDER;
- exports.matStepperAnimations = matStepperAnimations;
- exports.MatStepperIcon = MatStepperIcon;
- exports.MatTableModule = MatTableModule;
- exports.MatCellDef = MatCellDef;
- exports.MatHeaderCellDef = MatHeaderCellDef;
- exports.MatFooterCellDef = MatFooterCellDef;
- exports.MatColumnDef = MatColumnDef;
- exports.MatHeaderCell = MatHeaderCell;
- exports.MatFooterCell = MatFooterCell;
- exports.MatCell = MatCell;
- exports.MatTable = MatTable;
- exports.MatHeaderRowDef = MatHeaderRowDef;
- exports.MatFooterRowDef = MatFooterRowDef;
- exports.MatRowDef = MatRowDef;
- exports.MatHeaderRow = MatHeaderRow;
- exports.MatFooterRow = MatFooterRow;
- exports.MatRow = MatRow;
- exports.MatTableDataSource = MatTableDataSource;
- exports.MatTextColumn = MatTextColumn;
- exports.ɵa23 = _MAT_INK_BAR_POSITIONER_FACTORY;
- exports.ɵb23 = MatPaginatedTabHeader;
- exports.MatInkBar = MatInkBar;
- exports._MAT_INK_BAR_POSITIONER = _MAT_INK_BAR_POSITIONER;
- exports.MatTabBody = MatTabBody;
- exports.MatTabBodyPortal = MatTabBodyPortal;
- exports.MatTabHeader = MatTabHeader;
- exports.MatTabLabelWrapper = MatTabLabelWrapper;
- exports.MatTab = MatTab;
- exports.MatTabLabel = MatTabLabel;
- exports.MatTabNav = MatTabNav;
- exports.MatTabLink = MatTabLink;
- exports.MatTabContent = MatTabContent;
- exports.MatTabsModule = MatTabsModule;
- exports.MatTabChangeEvent = MatTabChangeEvent;
- exports.MAT_TABS_CONFIG = MAT_TABS_CONFIG;
- exports.MatTabGroup = MatTabGroup;
- exports.matTabsAnimations = matTabsAnimations;
- exports.MatToolbarModule = MatToolbarModule;
- exports.throwToolbarMixedModesError = throwToolbarMixedModesError;
- exports.MatToolbarRow = MatToolbarRow;
- exports.MatToolbar = MatToolbar;
- exports.MatTooltipModule = MatTooltipModule;
- exports.getMatTooltipInvalidPositionError = getMatTooltipInvalidPositionError;
- exports.MAT_TOOLTIP_SCROLL_STRATEGY_FACTORY = MAT_TOOLTIP_SCROLL_STRATEGY_FACTORY;
- exports.MAT_TOOLTIP_DEFAULT_OPTIONS_FACTORY = MAT_TOOLTIP_DEFAULT_OPTIONS_FACTORY;
- exports.SCROLL_THROTTLE_MS = SCROLL_THROTTLE_MS;
- exports.TOOLTIP_PANEL_CLASS = TOOLTIP_PANEL_CLASS;
- exports.MAT_TOOLTIP_SCROLL_STRATEGY = MAT_TOOLTIP_SCROLL_STRATEGY;
- exports.MAT_TOOLTIP_SCROLL_STRATEGY_FACTORY_PROVIDER = MAT_TOOLTIP_SCROLL_STRATEGY_FACTORY_PROVIDER;
- exports.MAT_TOOLTIP_DEFAULT_OPTIONS = MAT_TOOLTIP_DEFAULT_OPTIONS;
- exports.MatTooltip = MatTooltip;
- exports.TooltipComponent = TooltipComponent;
- exports.matTooltipAnimations = matTooltipAnimations;
- exports.MatTreeNode = MatTreeNode;
- exports.MatTreeNodeDef = MatTreeNodeDef;
- exports.MatNestedTreeNode = MatNestedTreeNode;
- exports.MatTreeNodePadding = MatTreeNodePadding;
- exports.MatTree = MatTree;
- exports.MatTreeModule = MatTreeModule;
- exports.MatTreeNodeToggle = MatTreeNodeToggle;
- exports.MatTreeNodeOutlet = MatTreeNodeOutlet;
- exports.MatTreeFlattener = MatTreeFlattener;
- exports.MatTreeFlatDataSource = MatTreeFlatDataSource;
- exports.MatTreeNestedDataSource = MatTreeNestedDataSource;
- Object.defineProperty(exports, '__esModule', { value: true });
- })));
- //# sourceMappingURL=material.umd.js.map
|