12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996 |
- /**
- * @license Angular v5.2.11
- * (c) 2010-2018 Google, Inc. https://angular.io/
- * License: MIT
- */
- import { Directive, ElementRef, EventEmitter, Host, Inject, Injectable, InjectionToken, Injector, Input, NgModule, Optional, Output, Renderer2, Self, SkipSelf, Version, forwardRef, ɵisObservable, ɵisPromise, ɵlooseIdentical } from '@angular/core';
- import { forkJoin } from 'rxjs/observable/forkJoin';
- import { fromPromise } from 'rxjs/observable/fromPromise';
- import { map } from 'rxjs/operator/map';
- import { ɵgetDOM } from '@angular/platform-browser';
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. 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
- */
- /**
- * Base class for control directives.
- *
- * Only used internally in the forms module.
- *
- * \@stable
- * @abstract
- */
- class AbstractControlDirective {
- /**
- * The value of the control.
- * @return {?}
- */
- get value() { return this.control ? this.control.value : null; }
- /**
- * A control is `valid` when its `status === VALID`.
- *
- * In order to have this status, the control must have passed all its
- * validation checks.
- * @return {?}
- */
- get valid() { return this.control ? this.control.valid : null; }
- /**
- * A control is `invalid` when its `status === INVALID`.
- *
- * In order to have this status, the control must have failed
- * at least one of its validation checks.
- * @return {?}
- */
- get invalid() { return this.control ? this.control.invalid : null; }
- /**
- * A control is `pending` when its `status === PENDING`.
- *
- * In order to have this status, the control must be in the
- * middle of conducting a validation check.
- * @return {?}
- */
- get pending() { return this.control ? this.control.pending : null; }
- /**
- * A control is `disabled` when its `status === DISABLED`.
- *
- * Disabled controls are exempt from validation checks and
- * are not included in the aggregate value of their ancestor
- * controls.
- * @return {?}
- */
- get disabled() { return this.control ? this.control.disabled : null; }
- /**
- * A control is `enabled` as long as its `status !== DISABLED`.
- *
- * In other words, it has a status of `VALID`, `INVALID`, or
- * `PENDING`.
- * @return {?}
- */
- get enabled() { return this.control ? this.control.enabled : null; }
- /**
- * Returns any errors generated by failing validation. If there
- * are no errors, it will return null.
- * @return {?}
- */
- get errors() { return this.control ? this.control.errors : null; }
- /**
- * A control is `pristine` if the user has not yet changed
- * the value in the UI.
- *
- * Note that programmatic changes to a control's value will
- * *not* mark it dirty.
- * @return {?}
- */
- get pristine() { return this.control ? this.control.pristine : null; }
- /**
- * A control is `dirty` if the user has changed the value
- * in the UI.
- *
- * Note that programmatic changes to a control's value will
- * *not* mark it dirty.
- * @return {?}
- */
- get dirty() { return this.control ? this.control.dirty : null; }
- /**
- * A control is marked `touched` once the user has triggered
- * a `blur` event on it.
- * @return {?}
- */
- get touched() { return this.control ? this.control.touched : null; }
- /**
- * @return {?}
- */
- get status() { return this.control ? this.control.status : null; }
- /**
- * A control is `untouched` if the user has not yet triggered
- * a `blur` event on it.
- * @return {?}
- */
- get untouched() { return this.control ? this.control.untouched : null; }
- /**
- * Emits an event every time the validation status of the control
- * is re-calculated.
- * @return {?}
- */
- get statusChanges() {
- return this.control ? this.control.statusChanges : null;
- }
- /**
- * Emits an event every time the value of the control changes, in
- * the UI or programmatically.
- * @return {?}
- */
- get valueChanges() {
- return this.control ? this.control.valueChanges : null;
- }
- /**
- * Returns an array that represents the path from the top-level form
- * to this control. Each index is the string name of the control on
- * that level.
- * @return {?}
- */
- get path() { return null; }
- /**
- * Resets the form control. This means by default:
- *
- * * it is marked as `pristine`
- * * it is marked as `untouched`
- * * value is set to null
- *
- * For more information, see {\@link AbstractControl}.
- * @param {?=} value
- * @return {?}
- */
- reset(value = undefined) {
- if (this.control)
- this.control.reset(value);
- }
- /**
- * Returns true if the control with the given path has the error specified. Otherwise
- * returns false.
- *
- * If no path is given, it checks for the error on the present control.
- * @param {?} errorCode
- * @param {?=} path
- * @return {?}
- */
- hasError(errorCode, path) {
- return this.control ? this.control.hasError(errorCode, path) : false;
- }
- /**
- * Returns error data if the control with the given path has the error specified. Otherwise
- * returns null or undefined.
- *
- * If no path is given, it checks for the error on the present control.
- * @param {?} errorCode
- * @param {?=} path
- * @return {?}
- */
- getError(errorCode, path) {
- return this.control ? this.control.getError(errorCode, path) : null;
- }
- }
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. 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
- */
- /**
- * A directive that contains multiple {\@link NgControl}s.
- *
- * Only used by the forms module.
- *
- * \@stable
- * @abstract
- */
- class ControlContainer extends AbstractControlDirective {
- /**
- * Get the form to which this container belongs.
- * @return {?}
- */
- get formDirective() { return null; }
- /**
- * Get the path to this container.
- * @return {?}
- */
- get path() { return null; }
- }
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. 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
- */
- /**
- * @param {?} value
- * @return {?}
- */
- function isEmptyInputValue(value) {
- // we don't check for string here so it also works with arrays
- return value == null || value.length === 0;
- }
- /**
- * Providers for validators to be used for {\@link FormControl}s in a form.
- *
- * Provide this using `multi: true` to add validators.
- *
- * ### Example
- *
- * ```typescript
- * \@Directive({
- * selector: '[custom-validator]',
- * providers: [{provide: NG_VALIDATORS, useExisting: CustomValidatorDirective, multi: true}]
- * })
- * class CustomValidatorDirective implements Validator {
- * validate(control: AbstractControl): ValidationErrors | null {
- * return {"custom": true};
- * }
- * }
- * ```
- *
- * \@stable
- */
- const NG_VALIDATORS = new InjectionToken('NgValidators');
- /**
- * Providers for asynchronous validators to be used for {\@link FormControl}s
- * in a form.
- *
- * Provide this using `multi: true` to add validators.
- *
- * See {\@link NG_VALIDATORS} for more details.
- *
- * \@stable
- */
- const NG_ASYNC_VALIDATORS = new InjectionToken('NgAsyncValidators');
- const EMAIL_REGEXP = /^(?=.{1,254}$)(?=.{1,64}@)[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+(\.[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+)*@[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?(\.[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/;
- /**
- * Provides a set of validators used by form controls.
- *
- * A validator is a function that processes a {\@link FormControl} or collection of
- * controls and returns a map of errors. A null map means that validation has passed.
- *
- * ### Example
- *
- * ```typescript
- * var loginControl = new FormControl("", Validators.required)
- * ```
- *
- * \@stable
- */
- class Validators {
- /**
- * Validator that requires controls to have a value greater than a number.
- * `min()` exists only as a function, not as a directive. For example,
- * `control = new FormControl('', Validators.min(3));`.
- * @param {?} min
- * @return {?}
- */
- static min(min) {
- return (control) => {
- if (isEmptyInputValue(control.value) || isEmptyInputValue(min)) {
- return null; // don't validate empty values to allow optional controls
- }
- const /** @type {?} */ value = parseFloat(control.value);
- // Controls with NaN values after parsing should be treated as not having a
- // minimum, per the HTML forms spec: https://www.w3.org/TR/html5/forms.html#attr-input-min
- return !isNaN(value) && value < min ? { 'min': { 'min': min, 'actual': control.value } } : null;
- };
- }
- /**
- * Validator that requires controls to have a value less than a number.
- * `max()` exists only as a function, not as a directive. For example,
- * `control = new FormControl('', Validators.max(15));`.
- * @param {?} max
- * @return {?}
- */
- static max(max) {
- return (control) => {
- if (isEmptyInputValue(control.value) || isEmptyInputValue(max)) {
- return null; // don't validate empty values to allow optional controls
- }
- const /** @type {?} */ value = parseFloat(control.value);
- // Controls with NaN values after parsing should be treated as not having a
- // maximum, per the HTML forms spec: https://www.w3.org/TR/html5/forms.html#attr-input-max
- return !isNaN(value) && value > max ? { 'max': { 'max': max, 'actual': control.value } } : null;
- };
- }
- /**
- * Validator that requires controls to have a non-empty value.
- * @param {?} control
- * @return {?}
- */
- static required(control) {
- return isEmptyInputValue(control.value) ? { 'required': true } : null;
- }
- /**
- * Validator that requires control value to be true.
- * @param {?} control
- * @return {?}
- */
- static requiredTrue(control) {
- return control.value === true ? null : { 'required': true };
- }
- /**
- * Validator that performs email validation.
- * @param {?} control
- * @return {?}
- */
- static email(control) {
- return EMAIL_REGEXP.test(control.value) ? null : { 'email': true };
- }
- /**
- * Validator that requires controls to have a value of a minimum length.
- * @param {?} minLength
- * @return {?}
- */
- static minLength(minLength) {
- return (control) => {
- if (isEmptyInputValue(control.value)) {
- return null; // don't validate empty values to allow optional controls
- }
- const /** @type {?} */ length = control.value ? control.value.length : 0;
- return length < minLength ?
- { 'minlength': { 'requiredLength': minLength, 'actualLength': length } } :
- null;
- };
- }
- /**
- * Validator that requires controls to have a value of a maximum length.
- * @param {?} maxLength
- * @return {?}
- */
- static maxLength(maxLength) {
- return (control) => {
- const /** @type {?} */ length = control.value ? control.value.length : 0;
- return length > maxLength ?
- { 'maxlength': { 'requiredLength': maxLength, 'actualLength': length } } :
- null;
- };
- }
- /**
- * Validator that requires a control to match a regex to its value.
- * @param {?} pattern
- * @return {?}
- */
- static pattern(pattern) {
- if (!pattern)
- return Validators.nullValidator;
- let /** @type {?} */ regex;
- let /** @type {?} */ regexStr;
- if (typeof pattern === 'string') {
- regexStr = '';
- if (pattern.charAt(0) !== '^')
- regexStr += '^';
- regexStr += pattern;
- if (pattern.charAt(pattern.length - 1) !== '$')
- regexStr += '$';
- regex = new RegExp(regexStr);
- }
- else {
- regexStr = pattern.toString();
- regex = pattern;
- }
- return (control) => {
- if (isEmptyInputValue(control.value)) {
- return null; // don't validate empty values to allow optional controls
- }
- const /** @type {?} */ value = control.value;
- return regex.test(value) ? null :
- { 'pattern': { 'requiredPattern': regexStr, 'actualValue': value } };
- };
- }
- /**
- * No-op validator.
- * @param {?} c
- * @return {?}
- */
- static nullValidator(c) { return null; }
- /**
- * @param {?} validators
- * @return {?}
- */
- static compose(validators) {
- if (!validators)
- return null;
- const /** @type {?} */ presentValidators = /** @type {?} */ (validators.filter(isPresent));
- if (presentValidators.length == 0)
- return null;
- return function (control) {
- return _mergeErrors(_executeValidators(control, presentValidators));
- };
- }
- /**
- * @param {?} validators
- * @return {?}
- */
- static composeAsync(validators) {
- if (!validators)
- return null;
- const /** @type {?} */ presentValidators = /** @type {?} */ (validators.filter(isPresent));
- if (presentValidators.length == 0)
- return null;
- return function (control) {
- const /** @type {?} */ observables = _executeAsyncValidators(control, presentValidators).map(toObservable);
- return map.call(forkJoin(observables), _mergeErrors);
- };
- }
- }
- /**
- * @param {?} o
- * @return {?}
- */
- function isPresent(o) {
- return o != null;
- }
- /**
- * @param {?} r
- * @return {?}
- */
- function toObservable(r) {
- const /** @type {?} */ obs = ɵisPromise(r) ? fromPromise(r) : r;
- if (!(ɵisObservable(obs))) {
- throw new Error(`Expected validator to return Promise or Observable.`);
- }
- return obs;
- }
- /**
- * @param {?} control
- * @param {?} validators
- * @return {?}
- */
- function _executeValidators(control, validators) {
- return validators.map(v => v(control));
- }
- /**
- * @param {?} control
- * @param {?} validators
- * @return {?}
- */
- function _executeAsyncValidators(control, validators) {
- return validators.map(v => v(control));
- }
- /**
- * @param {?} arrayOfErrors
- * @return {?}
- */
- function _mergeErrors(arrayOfErrors) {
- const /** @type {?} */ res = arrayOfErrors.reduce((res, errors) => {
- return errors != null ? Object.assign({}, /** @type {?} */ ((res)), errors) : /** @type {?} */ ((res));
- }, {});
- return Object.keys(res).length === 0 ? null : res;
- }
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. 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
- */
- /**
- * A `ControlValueAccessor` acts as a bridge between the Angular forms API and a
- * native element in the DOM.
- *
- * Implement this interface if you want to create a custom form control directive
- * that integrates with Angular forms.
- *
- * \@stable
- * @record
- */
-
- /**
- * Used to provide a {\@link ControlValueAccessor} for form controls.
- *
- * See {\@link DefaultValueAccessor} for how to implement one.
- * \@stable
- */
- const NG_VALUE_ACCESSOR = new InjectionToken('NgValueAccessor');
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. 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
- */
- const CHECKBOX_VALUE_ACCESSOR = {
- provide: NG_VALUE_ACCESSOR,
- useExisting: forwardRef(() => CheckboxControlValueAccessor),
- multi: true,
- };
- /**
- * The accessor for writing a value and listening to changes on a checkbox input element.
- *
- * ### Example
- * ```
- * <input type="checkbox" name="rememberLogin" ngModel>
- * ```
- *
- * \@stable
- */
- class CheckboxControlValueAccessor {
- /**
- * @param {?} _renderer
- * @param {?} _elementRef
- */
- constructor(_renderer, _elementRef) {
- this._renderer = _renderer;
- this._elementRef = _elementRef;
- this.onChange = (_) => { };
- this.onTouched = () => { };
- }
- /**
- * @param {?} value
- * @return {?}
- */
- writeValue(value) {
- this._renderer.setProperty(this._elementRef.nativeElement, 'checked', value);
- }
- /**
- * @param {?} fn
- * @return {?}
- */
- registerOnChange(fn) { this.onChange = fn; }
- /**
- * @param {?} fn
- * @return {?}
- */
- registerOnTouched(fn) { this.onTouched = fn; }
- /**
- * @param {?} isDisabled
- * @return {?}
- */
- setDisabledState(isDisabled) {
- this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled);
- }
- }
- CheckboxControlValueAccessor.decorators = [
- { type: Directive, args: [{
- selector: 'input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]',
- host: { '(change)': 'onChange($event.target.checked)', '(blur)': 'onTouched()' },
- providers: [CHECKBOX_VALUE_ACCESSOR]
- },] },
- ];
- /** @nocollapse */
- CheckboxControlValueAccessor.ctorParameters = () => [
- { type: Renderer2, },
- { type: ElementRef, },
- ];
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. 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
- */
- const DEFAULT_VALUE_ACCESSOR = {
- provide: NG_VALUE_ACCESSOR,
- useExisting: forwardRef(() => DefaultValueAccessor),
- multi: true
- };
- /**
- * We must check whether the agent is Android because composition events
- * behave differently between iOS and Android.
- * @return {?}
- */
- function _isAndroid() {
- const /** @type {?} */ userAgent = ɵgetDOM() ? ɵgetDOM().getUserAgent() : '';
- return /android (\d+)/.test(userAgent.toLowerCase());
- }
- /**
- * Turn this mode on if you want form directives to buffer IME input until compositionend
- * \@experimental
- */
- const COMPOSITION_BUFFER_MODE = new InjectionToken('CompositionEventMode');
- /**
- * The default accessor for writing a value and listening to changes that is used by the
- * {\@link NgModel}, {\@link FormControlDirective}, and {\@link FormControlName} directives.
- *
- * ### Example
- * ```
- * <input type="text" name="searchQuery" ngModel>
- * ```
- *
- * \@stable
- */
- class DefaultValueAccessor {
- /**
- * @param {?} _renderer
- * @param {?} _elementRef
- * @param {?} _compositionMode
- */
- constructor(_renderer, _elementRef, _compositionMode) {
- this._renderer = _renderer;
- this._elementRef = _elementRef;
- this._compositionMode = _compositionMode;
- this.onChange = (_) => { };
- this.onTouched = () => { };
- /**
- * Whether the user is creating a composition string (IME events).
- */
- this._composing = false;
- if (this._compositionMode == null) {
- this._compositionMode = !_isAndroid();
- }
- }
- /**
- * @param {?} value
- * @return {?}
- */
- writeValue(value) {
- const /** @type {?} */ normalizedValue = value == null ? '' : value;
- this._renderer.setProperty(this._elementRef.nativeElement, 'value', normalizedValue);
- }
- /**
- * @param {?} fn
- * @return {?}
- */
- registerOnChange(fn) { this.onChange = fn; }
- /**
- * @param {?} fn
- * @return {?}
- */
- registerOnTouched(fn) { this.onTouched = fn; }
- /**
- * @param {?} isDisabled
- * @return {?}
- */
- setDisabledState(isDisabled) {
- this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled);
- }
- /**
- * \@internal
- * @param {?} value
- * @return {?}
- */
- _handleInput(value) {
- if (!this._compositionMode || (this._compositionMode && !this._composing)) {
- this.onChange(value);
- }
- }
- /**
- * \@internal
- * @return {?}
- */
- _compositionStart() { this._composing = true; }
- /**
- * \@internal
- * @param {?} value
- * @return {?}
- */
- _compositionEnd(value) {
- this._composing = false;
- this._compositionMode && this.onChange(value);
- }
- }
- DefaultValueAccessor.decorators = [
- { type: Directive, args: [{
- selector: 'input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]',
- // TODO: vsavkin replace the above selector with the one below it once
- // https://github.com/angular/angular/issues/3011 is implemented
- // selector: '[ngModel],[formControl],[formControlName]',
- host: {
- '(input)': '$any(this)._handleInput($event.target.value)',
- '(blur)': 'onTouched()',
- '(compositionstart)': '$any(this)._compositionStart()',
- '(compositionend)': '$any(this)._compositionEnd($event.target.value)'
- },
- providers: [DEFAULT_VALUE_ACCESSOR]
- },] },
- ];
- /** @nocollapse */
- DefaultValueAccessor.ctorParameters = () => [
- { type: Renderer2, },
- { type: ElementRef, },
- { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [COMPOSITION_BUFFER_MODE,] },] },
- ];
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. 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
- */
- /**
- * @param {?} validator
- * @return {?}
- */
- function normalizeValidator(validator) {
- if ((/** @type {?} */ (validator)).validate) {
- return (c) => (/** @type {?} */ (validator)).validate(c);
- }
- else {
- return /** @type {?} */ (validator);
- }
- }
- /**
- * @param {?} validator
- * @return {?}
- */
- function normalizeAsyncValidator(validator) {
- if ((/** @type {?} */ (validator)).validate) {
- return (c) => (/** @type {?} */ (validator)).validate(c);
- }
- else {
- return /** @type {?} */ (validator);
- }
- }
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. 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
- */
- const NUMBER_VALUE_ACCESSOR = {
- provide: NG_VALUE_ACCESSOR,
- useExisting: forwardRef(() => NumberValueAccessor),
- multi: true
- };
- /**
- * The accessor for writing a number value and listening to changes that is used by the
- * {\@link NgModel}, {\@link FormControlDirective}, and {\@link FormControlName} directives.
- *
- * ### Example
- * ```
- * <input type="number" [(ngModel)]="age">
- * ```
- */
- class NumberValueAccessor {
- /**
- * @param {?} _renderer
- * @param {?} _elementRef
- */
- constructor(_renderer, _elementRef) {
- this._renderer = _renderer;
- this._elementRef = _elementRef;
- this.onChange = (_) => { };
- this.onTouched = () => { };
- }
- /**
- * @param {?} value
- * @return {?}
- */
- writeValue(value) {
- // The value needs to be normalized for IE9, otherwise it is set to 'null' when null
- const /** @type {?} */ normalizedValue = value == null ? '' : value;
- this._renderer.setProperty(this._elementRef.nativeElement, 'value', normalizedValue);
- }
- /**
- * @param {?} fn
- * @return {?}
- */
- registerOnChange(fn) {
- this.onChange = (value) => { fn(value == '' ? null : parseFloat(value)); };
- }
- /**
- * @param {?} fn
- * @return {?}
- */
- registerOnTouched(fn) { this.onTouched = fn; }
- /**
- * @param {?} isDisabled
- * @return {?}
- */
- setDisabledState(isDisabled) {
- this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled);
- }
- }
- NumberValueAccessor.decorators = [
- { type: Directive, args: [{
- selector: 'input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]',
- host: {
- '(change)': 'onChange($event.target.value)',
- '(input)': 'onChange($event.target.value)',
- '(blur)': 'onTouched()'
- },
- providers: [NUMBER_VALUE_ACCESSOR]
- },] },
- ];
- /** @nocollapse */
- NumberValueAccessor.ctorParameters = () => [
- { type: Renderer2, },
- { type: ElementRef, },
- ];
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. 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
- */
- /**
- * @return {?}
- */
- function unimplemented() {
- throw new Error('unimplemented');
- }
- /**
- * A base class that all control directive extend.
- * It binds a {\@link FormControl} object to a DOM element.
- *
- * Used internally by Angular forms.
- *
- * \@stable
- * @abstract
- */
- class NgControl extends AbstractControlDirective {
- constructor() {
- super(...arguments);
- /**
- * \@internal
- */
- this._parent = null;
- this.name = null;
- this.valueAccessor = null;
- /**
- * \@internal
- */
- this._rawValidators = [];
- /**
- * \@internal
- */
- this._rawAsyncValidators = [];
- }
- /**
- * @return {?}
- */
- get validator() { return /** @type {?} */ (unimplemented()); }
- /**
- * @return {?}
- */
- get asyncValidator() { return /** @type {?} */ (unimplemented()); }
- }
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. 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
- */
- const RADIO_VALUE_ACCESSOR = {
- provide: NG_VALUE_ACCESSOR,
- useExisting: forwardRef(() => RadioControlValueAccessor),
- multi: true
- };
- /**
- * Internal class used by Angular to uncheck radio buttons with the matching name.
- */
- class RadioControlRegistry {
- constructor() {
- this._accessors = [];
- }
- /**
- * @param {?} control
- * @param {?} accessor
- * @return {?}
- */
- add(control, accessor) {
- this._accessors.push([control, accessor]);
- }
- /**
- * @param {?} accessor
- * @return {?}
- */
- remove(accessor) {
- for (let /** @type {?} */ i = this._accessors.length - 1; i >= 0; --i) {
- if (this._accessors[i][1] === accessor) {
- this._accessors.splice(i, 1);
- return;
- }
- }
- }
- /**
- * @param {?} accessor
- * @return {?}
- */
- select(accessor) {
- this._accessors.forEach((c) => {
- if (this._isSameGroup(c, accessor) && c[1] !== accessor) {
- c[1].fireUncheck(accessor.value);
- }
- });
- }
- /**
- * @param {?} controlPair
- * @param {?} accessor
- * @return {?}
- */
- _isSameGroup(controlPair, accessor) {
- if (!controlPair[0].control)
- return false;
- return controlPair[0]._parent === accessor._control._parent &&
- controlPair[1].name === accessor.name;
- }
- }
- RadioControlRegistry.decorators = [
- { type: Injectable },
- ];
- /** @nocollapse */
- RadioControlRegistry.ctorParameters = () => [];
- /**
- * \@whatItDoes Writes radio control values and listens to radio control changes.
- *
- * Used by {\@link NgModel}, {\@link FormControlDirective}, and {\@link FormControlName}
- * to keep the view synced with the {\@link FormControl} model.
- *
- * \@howToUse
- *
- * If you have imported the {\@link FormsModule} or the {\@link ReactiveFormsModule}, this
- * value accessor will be active on any radio control that has a form directive. You do
- * **not** need to add a special selector to activate it.
- *
- * ### How to use radio buttons with form directives
- *
- * To use radio buttons in a template-driven form, you'll want to ensure that radio buttons
- * in the same group have the same `name` attribute. Radio buttons with different `name`
- * attributes do not affect each other.
- *
- * {\@example forms/ts/radioButtons/radio_button_example.ts region='TemplateDriven'}
- *
- * When using radio buttons in a reactive form, radio buttons in the same group should have the
- * same `formControlName`. You can also add a `name` attribute, but it's optional.
- *
- * {\@example forms/ts/reactiveRadioButtons/reactive_radio_button_example.ts region='Reactive'}
- *
- * * **npm package**: `\@angular/forms`
- *
- * \@stable
- */
- class RadioControlValueAccessor {
- /**
- * @param {?} _renderer
- * @param {?} _elementRef
- * @param {?} _registry
- * @param {?} _injector
- */
- constructor(_renderer, _elementRef, _registry, _injector) {
- this._renderer = _renderer;
- this._elementRef = _elementRef;
- this._registry = _registry;
- this._injector = _injector;
- this.onChange = () => { };
- this.onTouched = () => { };
- }
- /**
- * @return {?}
- */
- ngOnInit() {
- this._control = this._injector.get(NgControl);
- this._checkName();
- this._registry.add(this._control, this);
- }
- /**
- * @return {?}
- */
- ngOnDestroy() { this._registry.remove(this); }
- /**
- * @param {?} value
- * @return {?}
- */
- writeValue(value) {
- this._state = value === this.value;
- this._renderer.setProperty(this._elementRef.nativeElement, 'checked', this._state);
- }
- /**
- * @param {?} fn
- * @return {?}
- */
- registerOnChange(fn) {
- this._fn = fn;
- this.onChange = () => {
- fn(this.value);
- this._registry.select(this);
- };
- }
- /**
- * @param {?} value
- * @return {?}
- */
- fireUncheck(value) { this.writeValue(value); }
- /**
- * @param {?} fn
- * @return {?}
- */
- registerOnTouched(fn) { this.onTouched = fn; }
- /**
- * @param {?} isDisabled
- * @return {?}
- */
- setDisabledState(isDisabled) {
- this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled);
- }
- /**
- * @return {?}
- */
- _checkName() {
- if (this.name && this.formControlName && this.name !== this.formControlName) {
- this._throwNameError();
- }
- if (!this.name && this.formControlName)
- this.name = this.formControlName;
- }
- /**
- * @return {?}
- */
- _throwNameError() {
- throw new Error(`
- If you define both a name and a formControlName attribute on your radio button, their values
- must match. Ex: <input type="radio" formControlName="food" name="food">
- `);
- }
- }
- RadioControlValueAccessor.decorators = [
- { type: Directive, args: [{
- selector: 'input[type=radio][formControlName],input[type=radio][formControl],input[type=radio][ngModel]',
- host: { '(change)': 'onChange()', '(blur)': 'onTouched()' },
- providers: [RADIO_VALUE_ACCESSOR]
- },] },
- ];
- /** @nocollapse */
- RadioControlValueAccessor.ctorParameters = () => [
- { type: Renderer2, },
- { type: ElementRef, },
- { type: RadioControlRegistry, },
- { type: Injector, },
- ];
- RadioControlValueAccessor.propDecorators = {
- "name": [{ type: Input },],
- "formControlName": [{ type: Input },],
- "value": [{ type: Input },],
- };
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. 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
- */
- const RANGE_VALUE_ACCESSOR = {
- provide: NG_VALUE_ACCESSOR,
- useExisting: forwardRef(() => RangeValueAccessor),
- multi: true
- };
- /**
- * The accessor for writing a range value and listening to changes that is used by the
- * {\@link NgModel}, {\@link FormControlDirective}, and {\@link FormControlName} directives.
- *
- * ### Example
- * ```
- * <input type="range" [(ngModel)]="age" >
- * ```
- */
- class RangeValueAccessor {
- /**
- * @param {?} _renderer
- * @param {?} _elementRef
- */
- constructor(_renderer, _elementRef) {
- this._renderer = _renderer;
- this._elementRef = _elementRef;
- this.onChange = (_) => { };
- this.onTouched = () => { };
- }
- /**
- * @param {?} value
- * @return {?}
- */
- writeValue(value) {
- this._renderer.setProperty(this._elementRef.nativeElement, 'value', parseFloat(value));
- }
- /**
- * @param {?} fn
- * @return {?}
- */
- registerOnChange(fn) {
- this.onChange = (value) => { fn(value == '' ? null : parseFloat(value)); };
- }
- /**
- * @param {?} fn
- * @return {?}
- */
- registerOnTouched(fn) { this.onTouched = fn; }
- /**
- * @param {?} isDisabled
- * @return {?}
- */
- setDisabledState(isDisabled) {
- this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled);
- }
- }
- RangeValueAccessor.decorators = [
- { type: Directive, args: [{
- selector: 'input[type=range][formControlName],input[type=range][formControl],input[type=range][ngModel]',
- host: {
- '(change)': 'onChange($event.target.value)',
- '(input)': 'onChange($event.target.value)',
- '(blur)': 'onTouched()'
- },
- providers: [RANGE_VALUE_ACCESSOR]
- },] },
- ];
- /** @nocollapse */
- RangeValueAccessor.ctorParameters = () => [
- { type: Renderer2, },
- { type: ElementRef, },
- ];
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. 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
- */
- const SELECT_VALUE_ACCESSOR = {
- provide: NG_VALUE_ACCESSOR,
- useExisting: forwardRef(() => SelectControlValueAccessor),
- multi: true
- };
- /**
- * @param {?} id
- * @param {?} value
- * @return {?}
- */
- function _buildValueString(id, value) {
- if (id == null)
- return `${value}`;
- if (value && typeof value === 'object')
- value = 'Object';
- return `${id}: ${value}`.slice(0, 50);
- }
- /**
- * @param {?} valueString
- * @return {?}
- */
- function _extractId(valueString) {
- return valueString.split(':')[0];
- }
- /**
- * \@whatItDoes Writes values and listens to changes on a select element.
- *
- * Used by {\@link NgModel}, {\@link FormControlDirective}, and {\@link FormControlName}
- * to keep the view synced with the {\@link FormControl} model.
- *
- * \@howToUse
- *
- * If you have imported the {\@link FormsModule} or the {\@link ReactiveFormsModule}, this
- * value accessor will be active on any select control that has a form directive. You do
- * **not** need to add a special selector to activate it.
- *
- * ### How to use select controls with form directives
- *
- * To use a select in a template-driven form, simply add an `ngModel` and a `name`
- * attribute to the main `<select>` tag.
- *
- * If your option values are simple strings, you can bind to the normal `value` property
- * on the option. If your option values happen to be objects (and you'd like to save the
- * selection in your form as an object), use `ngValue` instead:
- *
- * {\@example forms/ts/selectControl/select_control_example.ts region='Component'}
- *
- * In reactive forms, you'll also want to add your form directive (`formControlName` or
- * `formControl`) on the main `<select>` tag. Like in the former example, you have the
- * choice of binding to the `value` or `ngValue` property on the select's options.
- *
- * {\@example forms/ts/reactiveSelectControl/reactive_select_control_example.ts region='Component'}
- *
- * ### Caveat: Option selection
- *
- * Angular uses object identity to select option. It's possible for the identities of items
- * to change while the data does not. This can happen, for example, if the items are produced
- * from an RPC to the server, and that RPC is re-run. Even if the data hasn't changed, the
- * second response will produce objects with different identities.
- *
- * To customize the default option comparison algorithm, `<select>` supports `compareWith` input.
- * `compareWith` takes a **function** which has two arguments: `option1` and `option2`.
- * If `compareWith` is given, Angular selects option by the return value of the function.
- *
- * #### Syntax
- *
- * ```
- * <select [compareWith]="compareFn" [(ngModel)]="selectedCountries">
- * <option *ngFor="let country of countries" [ngValue]="country">
- * {{country.name}}
- * </option>
- * </select>
- *
- * compareFn(c1: Country, c2: Country): boolean {
- * return c1 && c2 ? c1.id === c2.id : c1 === c2;
- * }
- * ```
- *
- * Note: We listen to the 'change' event because 'input' events aren't fired
- * for selects in Firefox and IE:
- * https://bugzilla.mozilla.org/show_bug.cgi?id=1024350
- * https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/4660045/
- *
- * * **npm package**: `\@angular/forms`
- *
- * \@stable
- */
- class SelectControlValueAccessor {
- /**
- * @param {?} _renderer
- * @param {?} _elementRef
- */
- constructor(_renderer, _elementRef) {
- this._renderer = _renderer;
- this._elementRef = _elementRef;
- /**
- * \@internal
- */
- this._optionMap = new Map();
- /**
- * \@internal
- */
- this._idCounter = 0;
- this.onChange = (_) => { };
- this.onTouched = () => { };
- this._compareWith = ɵlooseIdentical;
- }
- /**
- * @param {?} fn
- * @return {?}
- */
- set compareWith(fn) {
- if (typeof fn !== 'function') {
- throw new Error(`compareWith must be a function, but received ${JSON.stringify(fn)}`);
- }
- this._compareWith = fn;
- }
- /**
- * @param {?} value
- * @return {?}
- */
- writeValue(value) {
- this.value = value;
- const /** @type {?} */ id = this._getOptionId(value);
- if (id == null) {
- this._renderer.setProperty(this._elementRef.nativeElement, 'selectedIndex', -1);
- }
- const /** @type {?} */ valueString = _buildValueString(id, value);
- this._renderer.setProperty(this._elementRef.nativeElement, 'value', valueString);
- }
- /**
- * @param {?} fn
- * @return {?}
- */
- registerOnChange(fn) {
- this.onChange = (valueString) => {
- this.value = this._getOptionValue(valueString);
- fn(this.value);
- };
- }
- /**
- * @param {?} fn
- * @return {?}
- */
- registerOnTouched(fn) { this.onTouched = fn; }
- /**
- * @param {?} isDisabled
- * @return {?}
- */
- setDisabledState(isDisabled) {
- this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled);
- }
- /**
- * \@internal
- * @return {?}
- */
- _registerOption() { return (this._idCounter++).toString(); }
- /**
- * \@internal
- * @param {?} value
- * @return {?}
- */
- _getOptionId(value) {
- for (const /** @type {?} */ id of Array.from(this._optionMap.keys())) {
- if (this._compareWith(this._optionMap.get(id), value))
- return id;
- }
- return null;
- }
- /**
- * \@internal
- * @param {?} valueString
- * @return {?}
- */
- _getOptionValue(valueString) {
- const /** @type {?} */ id = _extractId(valueString);
- return this._optionMap.has(id) ? this._optionMap.get(id) : valueString;
- }
- }
- SelectControlValueAccessor.decorators = [
- { type: Directive, args: [{
- selector: 'select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]',
- host: { '(change)': 'onChange($event.target.value)', '(blur)': 'onTouched()' },
- providers: [SELECT_VALUE_ACCESSOR]
- },] },
- ];
- /** @nocollapse */
- SelectControlValueAccessor.ctorParameters = () => [
- { type: Renderer2, },
- { type: ElementRef, },
- ];
- SelectControlValueAccessor.propDecorators = {
- "compareWith": [{ type: Input },],
- };
- /**
- * \@whatItDoes Marks `<option>` as dynamic, so Angular can be notified when options change.
- *
- * \@howToUse
- *
- * See docs for {\@link SelectControlValueAccessor} for usage examples.
- *
- * \@stable
- */
- class NgSelectOption {
- /**
- * @param {?} _element
- * @param {?} _renderer
- * @param {?} _select
- */
- constructor(_element, _renderer, _select) {
- this._element = _element;
- this._renderer = _renderer;
- this._select = _select;
- if (this._select)
- this.id = this._select._registerOption();
- }
- /**
- * @param {?} value
- * @return {?}
- */
- set ngValue(value) {
- if (this._select == null)
- return;
- this._select._optionMap.set(this.id, value);
- this._setElementValue(_buildValueString(this.id, value));
- this._select.writeValue(this._select.value);
- }
- /**
- * @param {?} value
- * @return {?}
- */
- set value(value) {
- this._setElementValue(value);
- if (this._select)
- this._select.writeValue(this._select.value);
- }
- /**
- * \@internal
- * @param {?} value
- * @return {?}
- */
- _setElementValue(value) {
- this._renderer.setProperty(this._element.nativeElement, 'value', value);
- }
- /**
- * @return {?}
- */
- ngOnDestroy() {
- if (this._select) {
- this._select._optionMap.delete(this.id);
- this._select.writeValue(this._select.value);
- }
- }
- }
- NgSelectOption.decorators = [
- { type: Directive, args: [{ selector: 'option' },] },
- ];
- /** @nocollapse */
- NgSelectOption.ctorParameters = () => [
- { type: ElementRef, },
- { type: Renderer2, },
- { type: SelectControlValueAccessor, decorators: [{ type: Optional }, { type: Host },] },
- ];
- NgSelectOption.propDecorators = {
- "ngValue": [{ type: Input, args: ['ngValue',] },],
- "value": [{ type: Input, args: ['value',] },],
- };
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. 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
- */
- const SELECT_MULTIPLE_VALUE_ACCESSOR = {
- provide: NG_VALUE_ACCESSOR,
- useExisting: forwardRef(() => SelectMultipleControlValueAccessor),
- multi: true
- };
- /**
- * @param {?} id
- * @param {?} value
- * @return {?}
- */
- function _buildValueString$1(id, value) {
- if (id == null)
- return `${value}`;
- if (typeof value === 'string')
- value = `'${value}'`;
- if (value && typeof value === 'object')
- value = 'Object';
- return `${id}: ${value}`.slice(0, 50);
- }
- /**
- * @param {?} valueString
- * @return {?}
- */
- function _extractId$1(valueString) {
- return valueString.split(':')[0];
- }
- /**
- * The accessor for writing a value and listening to changes on a select element.
- *
- * ### Caveat: Options selection
- *
- * Angular uses object identity to select options. It's possible for the identities of items
- * to change while the data does not. This can happen, for example, if the items are produced
- * from an RPC to the server, and that RPC is re-run. Even if the data hasn't changed, the
- * second response will produce objects with different identities.
- *
- * To customize the default option comparison algorithm, `<select multiple>` supports `compareWith`
- * input. `compareWith` takes a **function** which has two arguments: `option1` and `option2`.
- * If `compareWith` is given, Angular selects options by the return value of the function.
- *
- * #### Syntax
- *
- * ```
- * <select multiple [compareWith]="compareFn" [(ngModel)]="selectedCountries">
- * <option *ngFor="let country of countries" [ngValue]="country">
- * {{country.name}}
- * </option>
- * </select>
- *
- * compareFn(c1: Country, c2: Country): boolean {
- * return c1 && c2 ? c1.id === c2.id : c1 === c2;
- * }
- * ```
- *
- * \@stable
- */
- class SelectMultipleControlValueAccessor {
- /**
- * @param {?} _renderer
- * @param {?} _elementRef
- */
- constructor(_renderer, _elementRef) {
- this._renderer = _renderer;
- this._elementRef = _elementRef;
- /**
- * \@internal
- */
- this._optionMap = new Map();
- /**
- * \@internal
- */
- this._idCounter = 0;
- this.onChange = (_) => { };
- this.onTouched = () => { };
- this._compareWith = ɵlooseIdentical;
- }
- /**
- * @param {?} fn
- * @return {?}
- */
- set compareWith(fn) {
- if (typeof fn !== 'function') {
- throw new Error(`compareWith must be a function, but received ${JSON.stringify(fn)}`);
- }
- this._compareWith = fn;
- }
- /**
- * @param {?} value
- * @return {?}
- */
- writeValue(value) {
- this.value = value;
- let /** @type {?} */ optionSelectedStateSetter;
- if (Array.isArray(value)) {
- // convert values to ids
- const /** @type {?} */ ids = value.map((v) => this._getOptionId(v));
- optionSelectedStateSetter = (opt, o) => { opt._setSelected(ids.indexOf(o.toString()) > -1); };
- }
- else {
- optionSelectedStateSetter = (opt, o) => { opt._setSelected(false); };
- }
- this._optionMap.forEach(optionSelectedStateSetter);
- }
- /**
- * @param {?} fn
- * @return {?}
- */
- registerOnChange(fn) {
- this.onChange = (_) => {
- const /** @type {?} */ selected = [];
- if (_.hasOwnProperty('selectedOptions')) {
- const /** @type {?} */ options = _.selectedOptions;
- for (let /** @type {?} */ i = 0; i < options.length; i++) {
- const /** @type {?} */ opt = options.item(i);
- const /** @type {?} */ val = this._getOptionValue(opt.value);
- selected.push(val);
- }
- }
- else {
- const /** @type {?} */ options = /** @type {?} */ (_.options);
- for (let /** @type {?} */ i = 0; i < options.length; i++) {
- const /** @type {?} */ opt = options.item(i);
- if (opt.selected) {
- const /** @type {?} */ val = this._getOptionValue(opt.value);
- selected.push(val);
- }
- }
- }
- this.value = selected;
- fn(selected);
- };
- }
- /**
- * @param {?} fn
- * @return {?}
- */
- registerOnTouched(fn) { this.onTouched = fn; }
- /**
- * @param {?} isDisabled
- * @return {?}
- */
- setDisabledState(isDisabled) {
- this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled);
- }
- /**
- * \@internal
- * @param {?} value
- * @return {?}
- */
- _registerOption(value) {
- const /** @type {?} */ id = (this._idCounter++).toString();
- this._optionMap.set(id, value);
- return id;
- }
- /**
- * \@internal
- * @param {?} value
- * @return {?}
- */
- _getOptionId(value) {
- for (const /** @type {?} */ id of Array.from(this._optionMap.keys())) {
- if (this._compareWith(/** @type {?} */ ((this._optionMap.get(id)))._value, value))
- return id;
- }
- return null;
- }
- /**
- * \@internal
- * @param {?} valueString
- * @return {?}
- */
- _getOptionValue(valueString) {
- const /** @type {?} */ id = _extractId$1(valueString);
- return this._optionMap.has(id) ? /** @type {?} */ ((this._optionMap.get(id)))._value : valueString;
- }
- }
- SelectMultipleControlValueAccessor.decorators = [
- { type: Directive, args: [{
- selector: 'select[multiple][formControlName],select[multiple][formControl],select[multiple][ngModel]',
- host: { '(change)': 'onChange($event.target)', '(blur)': 'onTouched()' },
- providers: [SELECT_MULTIPLE_VALUE_ACCESSOR]
- },] },
- ];
- /** @nocollapse */
- SelectMultipleControlValueAccessor.ctorParameters = () => [
- { type: Renderer2, },
- { type: ElementRef, },
- ];
- SelectMultipleControlValueAccessor.propDecorators = {
- "compareWith": [{ type: Input },],
- };
- /**
- * Marks `<option>` as dynamic, so Angular can be notified when options change.
- *
- * ### Example
- *
- * ```
- * <select multiple name="city" ngModel>
- * <option *ngFor="let c of cities" [value]="c"></option>
- * </select>
- * ```
- */
- class NgSelectMultipleOption {
- /**
- * @param {?} _element
- * @param {?} _renderer
- * @param {?} _select
- */
- constructor(_element, _renderer, _select) {
- this._element = _element;
- this._renderer = _renderer;
- this._select = _select;
- if (this._select) {
- this.id = this._select._registerOption(this);
- }
- }
- /**
- * @param {?} value
- * @return {?}
- */
- set ngValue(value) {
- if (this._select == null)
- return;
- this._value = value;
- this._setElementValue(_buildValueString$1(this.id, value));
- this._select.writeValue(this._select.value);
- }
- /**
- * @param {?} value
- * @return {?}
- */
- set value(value) {
- if (this._select) {
- this._value = value;
- this._setElementValue(_buildValueString$1(this.id, value));
- this._select.writeValue(this._select.value);
- }
- else {
- this._setElementValue(value);
- }
- }
- /**
- * \@internal
- * @param {?} value
- * @return {?}
- */
- _setElementValue(value) {
- this._renderer.setProperty(this._element.nativeElement, 'value', value);
- }
- /**
- * \@internal
- * @param {?} selected
- * @return {?}
- */
- _setSelected(selected) {
- this._renderer.setProperty(this._element.nativeElement, 'selected', selected);
- }
- /**
- * @return {?}
- */
- ngOnDestroy() {
- if (this._select) {
- this._select._optionMap.delete(this.id);
- this._select.writeValue(this._select.value);
- }
- }
- }
- NgSelectMultipleOption.decorators = [
- { type: Directive, args: [{ selector: 'option' },] },
- ];
- /** @nocollapse */
- NgSelectMultipleOption.ctorParameters = () => [
- { type: ElementRef, },
- { type: Renderer2, },
- { type: SelectMultipleControlValueAccessor, decorators: [{ type: Optional }, { type: Host },] },
- ];
- NgSelectMultipleOption.propDecorators = {
- "ngValue": [{ type: Input, args: ['ngValue',] },],
- "value": [{ type: Input, args: ['value',] },],
- };
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. 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
- */
- /**
- * @param {?} name
- * @param {?} parent
- * @return {?}
- */
- function controlPath(name, parent) {
- return [.../** @type {?} */ ((parent.path)), name];
- }
- /**
- * @param {?} control
- * @param {?} dir
- * @return {?}
- */
- function setUpControl(control, dir) {
- if (!control)
- _throwError(dir, 'Cannot find control with');
- if (!dir.valueAccessor)
- _throwError(dir, 'No value accessor for form control with');
- control.validator = Validators.compose([/** @type {?} */ ((control.validator)), dir.validator]);
- control.asyncValidator = Validators.composeAsync([/** @type {?} */ ((control.asyncValidator)), dir.asyncValidator]); /** @type {?} */
- ((dir.valueAccessor)).writeValue(control.value);
- setUpViewChangePipeline(control, dir);
- setUpModelChangePipeline(control, dir);
- setUpBlurPipeline(control, dir);
- if (/** @type {?} */ ((dir.valueAccessor)).setDisabledState) {
- control.registerOnDisabledChange((isDisabled) => { /** @type {?} */ ((/** @type {?} */ ((dir.valueAccessor)).setDisabledState))(isDisabled); });
- }
- // re-run validation when validator binding changes, e.g. minlength=3 -> minlength=4
- dir._rawValidators.forEach((validator) => {
- if ((/** @type {?} */ (validator)).registerOnValidatorChange)
- /** @type {?} */ (((/** @type {?} */ (validator)).registerOnValidatorChange))(() => control.updateValueAndValidity());
- });
- dir._rawAsyncValidators.forEach((validator) => {
- if ((/** @type {?} */ (validator)).registerOnValidatorChange)
- /** @type {?} */ (((/** @type {?} */ (validator)).registerOnValidatorChange))(() => control.updateValueAndValidity());
- });
- }
- /**
- * @param {?} control
- * @param {?} dir
- * @return {?}
- */
- function cleanUpControl(control, dir) {
- /** @type {?} */ ((dir.valueAccessor)).registerOnChange(() => _noControlError(dir)); /** @type {?} */
- ((dir.valueAccessor)).registerOnTouched(() => _noControlError(dir));
- dir._rawValidators.forEach((validator) => {
- if (validator.registerOnValidatorChange) {
- validator.registerOnValidatorChange(null);
- }
- });
- dir._rawAsyncValidators.forEach((validator) => {
- if (validator.registerOnValidatorChange) {
- validator.registerOnValidatorChange(null);
- }
- });
- if (control)
- control._clearChangeFns();
- }
- /**
- * @param {?} control
- * @param {?} dir
- * @return {?}
- */
- function setUpViewChangePipeline(control, dir) {
- /** @type {?} */ ((dir.valueAccessor)).registerOnChange((newValue) => {
- control._pendingValue = newValue;
- control._pendingChange = true;
- control._pendingDirty = true;
- if (control.updateOn === 'change')
- updateControl(control, dir);
- });
- }
- /**
- * @param {?} control
- * @param {?} dir
- * @return {?}
- */
- function setUpBlurPipeline(control, dir) {
- /** @type {?} */ ((dir.valueAccessor)).registerOnTouched(() => {
- control._pendingTouched = true;
- if (control.updateOn === 'blur' && control._pendingChange)
- updateControl(control, dir);
- if (control.updateOn !== 'submit')
- control.markAsTouched();
- });
- }
- /**
- * @param {?} control
- * @param {?} dir
- * @return {?}
- */
- function updateControl(control, dir) {
- dir.viewToModelUpdate(control._pendingValue);
- if (control._pendingDirty)
- control.markAsDirty();
- control.setValue(control._pendingValue, { emitModelToViewChange: false });
- control._pendingChange = false;
- }
- /**
- * @param {?} control
- * @param {?} dir
- * @return {?}
- */
- function setUpModelChangePipeline(control, dir) {
- control.registerOnChange((newValue, emitModelEvent) => {
- /** @type {?} */ ((
- // control -> view
- dir.valueAccessor)).writeValue(newValue);
- // control -> ngModel
- if (emitModelEvent)
- dir.viewToModelUpdate(newValue);
- });
- }
- /**
- * @param {?} control
- * @param {?} dir
- * @return {?}
- */
- function setUpFormContainer(control, dir) {
- if (control == null)
- _throwError(dir, 'Cannot find control with');
- control.validator = Validators.compose([control.validator, dir.validator]);
- control.asyncValidator = Validators.composeAsync([control.asyncValidator, dir.asyncValidator]);
- }
- /**
- * @param {?} dir
- * @return {?}
- */
- function _noControlError(dir) {
- return _throwError(dir, 'There is no FormControl instance attached to form control element with');
- }
- /**
- * @param {?} dir
- * @param {?} message
- * @return {?}
- */
- function _throwError(dir, message) {
- let /** @type {?} */ messageEnd;
- if (/** @type {?} */ ((dir.path)).length > 1) {
- messageEnd = `path: '${(/** @type {?} */ ((dir.path))).join(' -> ')}'`;
- }
- else if (/** @type {?} */ ((dir.path))[0]) {
- messageEnd = `name: '${dir.path}'`;
- }
- else {
- messageEnd = 'unspecified name attribute';
- }
- throw new Error(`${message} ${messageEnd}`);
- }
- /**
- * @param {?} validators
- * @return {?}
- */
- function composeValidators(validators) {
- return validators != null ? Validators.compose(validators.map(normalizeValidator)) : null;
- }
- /**
- * @param {?} validators
- * @return {?}
- */
- function composeAsyncValidators(validators) {
- return validators != null ? Validators.composeAsync(validators.map(normalizeAsyncValidator)) :
- null;
- }
- /**
- * @param {?} changes
- * @param {?} viewModel
- * @return {?}
- */
- function isPropertyUpdated(changes, viewModel) {
- if (!changes.hasOwnProperty('model'))
- return false;
- const /** @type {?} */ change = changes['model'];
- if (change.isFirstChange())
- return true;
- return !ɵlooseIdentical(viewModel, change.currentValue);
- }
- const BUILTIN_ACCESSORS = [
- CheckboxControlValueAccessor,
- RangeValueAccessor,
- NumberValueAccessor,
- SelectControlValueAccessor,
- SelectMultipleControlValueAccessor,
- RadioControlValueAccessor,
- ];
- /**
- * @param {?} valueAccessor
- * @return {?}
- */
- function isBuiltInAccessor(valueAccessor) {
- return BUILTIN_ACCESSORS.some(a => valueAccessor.constructor === a);
- }
- /**
- * @param {?} form
- * @param {?} directives
- * @return {?}
- */
- function syncPendingControls(form, directives) {
- form._syncPendingControls();
- directives.forEach(dir => {
- const /** @type {?} */ control = /** @type {?} */ (dir.control);
- if (control.updateOn === 'submit' && control._pendingChange) {
- dir.viewToModelUpdate(control._pendingValue);
- control._pendingChange = false;
- }
- });
- }
- /**
- * @param {?} dir
- * @param {?} valueAccessors
- * @return {?}
- */
- function selectValueAccessor(dir, valueAccessors) {
- if (!valueAccessors)
- return null;
- if (!Array.isArray(valueAccessors))
- _throwError(dir, 'Value accessor was not provided as an array for form control with');
- let /** @type {?} */ defaultAccessor = undefined;
- let /** @type {?} */ builtinAccessor = undefined;
- let /** @type {?} */ customAccessor = undefined;
- valueAccessors.forEach((v) => {
- if (v.constructor === DefaultValueAccessor) {
- defaultAccessor = v;
- }
- else if (isBuiltInAccessor(v)) {
- if (builtinAccessor)
- _throwError(dir, 'More than one built-in value accessor matches form control with');
- builtinAccessor = v;
- }
- else {
- if (customAccessor)
- _throwError(dir, 'More than one custom value accessor matches form control with');
- customAccessor = v;
- }
- });
- if (customAccessor)
- return customAccessor;
- if (builtinAccessor)
- return builtinAccessor;
- if (defaultAccessor)
- return defaultAccessor;
- _throwError(dir, 'No valid value accessor for form control with');
- return null;
- }
- /**
- * @template T
- * @param {?} list
- * @param {?} el
- * @return {?}
- */
- function removeDir(list, el) {
- const /** @type {?} */ index = list.indexOf(el);
- if (index > -1)
- list.splice(index, 1);
- }
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. 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
- */
- /**
- * This is a base class for code shared between {\@link NgModelGroup} and {\@link FormGroupName}.
- *
- * \@stable
- */
- class AbstractFormGroupDirective extends ControlContainer {
- /**
- * @return {?}
- */
- ngOnInit() {
- this._checkParentType(); /** @type {?} */
- ((this.formDirective)).addFormGroup(this);
- }
- /**
- * @return {?}
- */
- ngOnDestroy() {
- if (this.formDirective) {
- this.formDirective.removeFormGroup(this);
- }
- }
- /**
- * Get the {\@link FormGroup} backing this binding.
- * @return {?}
- */
- get control() { return /** @type {?} */ ((this.formDirective)).getFormGroup(this); }
- /**
- * Get the path to this control group.
- * @return {?}
- */
- get path() { return controlPath(this.name, this._parent); }
- /**
- * Get the {\@link Form} to which this group belongs.
- * @return {?}
- */
- get formDirective() { return this._parent ? this._parent.formDirective : null; }
- /**
- * @return {?}
- */
- get validator() { return composeValidators(this._validators); }
- /**
- * @return {?}
- */
- get asyncValidator() {
- return composeAsyncValidators(this._asyncValidators);
- }
- /**
- * \@internal
- * @return {?}
- */
- _checkParentType() { }
- }
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. 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
- */
- class AbstractControlStatus {
- /**
- * @param {?} cd
- */
- constructor(cd) { this._cd = cd; }
- /**
- * @return {?}
- */
- get ngClassUntouched() { return this._cd.control ? this._cd.control.untouched : false; }
- /**
- * @return {?}
- */
- get ngClassTouched() { return this._cd.control ? this._cd.control.touched : false; }
- /**
- * @return {?}
- */
- get ngClassPristine() { return this._cd.control ? this._cd.control.pristine : false; }
- /**
- * @return {?}
- */
- get ngClassDirty() { return this._cd.control ? this._cd.control.dirty : false; }
- /**
- * @return {?}
- */
- get ngClassValid() { return this._cd.control ? this._cd.control.valid : false; }
- /**
- * @return {?}
- */
- get ngClassInvalid() { return this._cd.control ? this._cd.control.invalid : false; }
- /**
- * @return {?}
- */
- get ngClassPending() { return this._cd.control ? this._cd.control.pending : false; }
- }
- const ngControlStatusHost = {
- '[class.ng-untouched]': 'ngClassUntouched',
- '[class.ng-touched]': 'ngClassTouched',
- '[class.ng-pristine]': 'ngClassPristine',
- '[class.ng-dirty]': 'ngClassDirty',
- '[class.ng-valid]': 'ngClassValid',
- '[class.ng-invalid]': 'ngClassInvalid',
- '[class.ng-pending]': 'ngClassPending',
- };
- /**
- * Directive automatically applied to Angular form controls that sets CSS classes
- * based on control status. The following classes are applied as the properties
- * become true:
- *
- * * ng-valid
- * * ng-invalid
- * * ng-pending
- * * ng-pristine
- * * ng-dirty
- * * ng-untouched
- * * ng-touched
- *
- * \@stable
- */
- class NgControlStatus extends AbstractControlStatus {
- /**
- * @param {?} cd
- */
- constructor(cd) { super(cd); }
- }
- NgControlStatus.decorators = [
- { type: Directive, args: [{ selector: '[formControlName],[ngModel],[formControl]', host: ngControlStatusHost },] },
- ];
- /** @nocollapse */
- NgControlStatus.ctorParameters = () => [
- { type: NgControl, decorators: [{ type: Self },] },
- ];
- /**
- * Directive automatically applied to Angular form groups that sets CSS classes
- * based on control status (valid/invalid/dirty/etc).
- *
- * \@stable
- */
- class NgControlStatusGroup extends AbstractControlStatus {
- /**
- * @param {?} cd
- */
- constructor(cd) { super(cd); }
- }
- NgControlStatusGroup.decorators = [
- { type: Directive, args: [{
- selector: '[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]',
- host: ngControlStatusHost
- },] },
- ];
- /** @nocollapse */
- NgControlStatusGroup.ctorParameters = () => [
- { type: ControlContainer, decorators: [{ type: Self },] },
- ];
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. 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
- */
- /**
- * Indicates that a FormControl is valid, i.e. that no errors exist in the input value.
- */
- const VALID = 'VALID';
- /**
- * Indicates that a FormControl is invalid, i.e. that an error exists in the input value.
- */
- const INVALID = 'INVALID';
- /**
- * Indicates that a FormControl is pending, i.e. that async validation is occurring and
- * errors are not yet available for the input value.
- */
- const PENDING = 'PENDING';
- /**
- * Indicates that a FormControl is disabled, i.e. that the control is exempt from ancestor
- * calculations of validity or value.
- */
- const DISABLED = 'DISABLED';
- /**
- * @param {?} control
- * @param {?} path
- * @param {?} delimiter
- * @return {?}
- */
- function _find(control, path, delimiter) {
- if (path == null)
- return null;
- if (!(path instanceof Array)) {
- path = (/** @type {?} */ (path)).split(delimiter);
- }
- if (path instanceof Array && (path.length === 0))
- return null;
- return (/** @type {?} */ (path)).reduce((v, name) => {
- if (v instanceof FormGroup) {
- return v.controls[name] || null;
- }
- if (v instanceof FormArray) {
- return v.at(/** @type {?} */ (name)) || null;
- }
- return null;
- }, control);
- }
- /**
- * @param {?=} validatorOrOpts
- * @return {?}
- */
- function coerceToValidator(validatorOrOpts) {
- const /** @type {?} */ validator = /** @type {?} */ ((isOptionsObj(validatorOrOpts) ? (/** @type {?} */ (validatorOrOpts)).validators :
- validatorOrOpts));
- return Array.isArray(validator) ? composeValidators(validator) : validator || null;
- }
- /**
- * @param {?=} asyncValidator
- * @param {?=} validatorOrOpts
- * @return {?}
- */
- function coerceToAsyncValidator(asyncValidator, validatorOrOpts) {
- const /** @type {?} */ origAsyncValidator = /** @type {?} */ ((isOptionsObj(validatorOrOpts) ? (/** @type {?} */ (validatorOrOpts)).asyncValidators :
- asyncValidator));
- return Array.isArray(origAsyncValidator) ? composeAsyncValidators(origAsyncValidator) :
- origAsyncValidator || null;
- }
- /**
- * @record
- */
-
- /**
- * @param {?=} validatorOrOpts
- * @return {?}
- */
- function isOptionsObj(validatorOrOpts) {
- return validatorOrOpts != null && !Array.isArray(validatorOrOpts) &&
- typeof validatorOrOpts === 'object';
- }
- /**
- * \@whatItDoes This is the base class for {\@link FormControl}, {\@link FormGroup}, and
- * {\@link FormArray}.
- *
- * It provides some of the shared behavior that all controls and groups of controls have, like
- * running validators, calculating status, and resetting state. It also defines the properties
- * that are shared between all sub-classes, like `value`, `valid`, and `dirty`. It shouldn't be
- * instantiated directly.
- *
- * \@stable
- * @abstract
- */
- class AbstractControl {
- /**
- * @param {?} validator
- * @param {?} asyncValidator
- */
- constructor(validator, asyncValidator) {
- this.validator = validator;
- this.asyncValidator = asyncValidator;
- /**
- * \@internal
- */
- this._onCollectionChange = () => { };
- /**
- * A control is `pristine` if the user has not yet changed
- * the value in the UI.
- *
- * Note that programmatic changes to a control's value will
- * *not* mark it dirty.
- */
- this.pristine = true;
- /**
- * A control is marked `touched` once the user has triggered
- * a `blur` event on it.
- */
- this.touched = false;
- /**
- * \@internal
- */
- this._onDisabledChange = [];
- }
- /**
- * The parent control.
- * @return {?}
- */
- get parent() { return this._parent; }
- /**
- * A control is `valid` when its `status === VALID`.
- *
- * In order to have this status, the control must have passed all its
- * validation checks.
- * @return {?}
- */
- get valid() { return this.status === VALID; }
- /**
- * A control is `invalid` when its `status === INVALID`.
- *
- * In order to have this status, the control must have failed
- * at least one of its validation checks.
- * @return {?}
- */
- get invalid() { return this.status === INVALID; }
- /**
- * A control is `pending` when its `status === PENDING`.
- *
- * In order to have this status, the control must be in the
- * middle of conducting a validation check.
- * @return {?}
- */
- get pending() { return this.status == PENDING; }
- /**
- * A control is `disabled` when its `status === DISABLED`.
- *
- * Disabled controls are exempt from validation checks and
- * are not included in the aggregate value of their ancestor
- * controls.
- * @return {?}
- */
- get disabled() { return this.status === DISABLED; }
- /**
- * A control is `enabled` as long as its `status !== DISABLED`.
- *
- * In other words, it has a status of `VALID`, `INVALID`, or
- * `PENDING`.
- * @return {?}
- */
- get enabled() { return this.status !== DISABLED; }
- /**
- * A control is `dirty` if the user has changed the value
- * in the UI.
- *
- * Note that programmatic changes to a control's value will
- * *not* mark it dirty.
- * @return {?}
- */
- get dirty() { return !this.pristine; }
- /**
- * A control is `untouched` if the user has not yet triggered
- * a `blur` event on it.
- * @return {?}
- */
- get untouched() { return !this.touched; }
- /**
- * Returns the update strategy of the `AbstractControl` (i.e.
- * the event on which the control will update itself).
- * Possible values: `'change'` (default) | `'blur'` | `'submit'`
- * @return {?}
- */
- get updateOn() {
- return this._updateOn ? this._updateOn : (this.parent ? this.parent.updateOn : 'change');
- }
- /**
- * Sets the synchronous validators that are active on this control. Calling
- * this will overwrite any existing sync validators.
- * @param {?} newValidator
- * @return {?}
- */
- setValidators(newValidator) {
- this.validator = coerceToValidator(newValidator);
- }
- /**
- * Sets the async validators that are active on this control. Calling this
- * will overwrite any existing async validators.
- * @param {?} newValidator
- * @return {?}
- */
- setAsyncValidators(newValidator) {
- this.asyncValidator = coerceToAsyncValidator(newValidator);
- }
- /**
- * Empties out the sync validator list.
- * @return {?}
- */
- clearValidators() { this.validator = null; }
- /**
- * Empties out the async validator list.
- * @return {?}
- */
- clearAsyncValidators() { this.asyncValidator = null; }
- /**
- * Marks the control as `touched`.
- *
- * This will also mark all direct ancestors as `touched` to maintain
- * the model.
- * @param {?=} opts
- * @return {?}
- */
- markAsTouched(opts = {}) {
- (/** @type {?} */ (this)).touched = true;
- if (this._parent && !opts.onlySelf) {
- this._parent.markAsTouched(opts);
- }
- }
- /**
- * Marks the control as `untouched`.
- *
- * If the control has any children, it will also mark all children as `untouched`
- * to maintain the model, and re-calculate the `touched` status of all parent
- * controls.
- * @param {?=} opts
- * @return {?}
- */
- markAsUntouched(opts = {}) {
- (/** @type {?} */ (this)).touched = false;
- this._pendingTouched = false;
- this._forEachChild((control) => { control.markAsUntouched({ onlySelf: true }); });
- if (this._parent && !opts.onlySelf) {
- this._parent._updateTouched(opts);
- }
- }
- /**
- * Marks the control as `dirty`.
- *
- * This will also mark all direct ancestors as `dirty` to maintain
- * the model.
- * @param {?=} opts
- * @return {?}
- */
- markAsDirty(opts = {}) {
- (/** @type {?} */ (this)).pristine = false;
- if (this._parent && !opts.onlySelf) {
- this._parent.markAsDirty(opts);
- }
- }
- /**
- * Marks the control as `pristine`.
- *
- * If the control has any children, it will also mark all children as `pristine`
- * to maintain the model, and re-calculate the `pristine` status of all parent
- * controls.
- * @param {?=} opts
- * @return {?}
- */
- markAsPristine(opts = {}) {
- (/** @type {?} */ (this)).pristine = true;
- this._pendingDirty = false;
- this._forEachChild((control) => { control.markAsPristine({ onlySelf: true }); });
- if (this._parent && !opts.onlySelf) {
- this._parent._updatePristine(opts);
- }
- }
- /**
- * Marks the control as `pending`.
- * @param {?=} opts
- * @return {?}
- */
- markAsPending(opts = {}) {
- (/** @type {?} */ (this)).status = PENDING;
- if (this._parent && !opts.onlySelf) {
- this._parent.markAsPending(opts);
- }
- }
- /**
- * Disables the control. This means the control will be exempt from validation checks and
- * excluded from the aggregate value of any parent. Its status is `DISABLED`.
- *
- * If the control has children, all children will be disabled to maintain the model.
- * @param {?=} opts
- * @return {?}
- */
- disable(opts = {}) {
- (/** @type {?} */ (this)).status = DISABLED;
- (/** @type {?} */ (this)).errors = null;
- this._forEachChild((control) => { control.disable(Object.assign({}, opts, { onlySelf: true })); });
- this._updateValue();
- if (opts.emitEvent !== false) {
- (/** @type {?} */ (this.valueChanges)).emit(this.value);
- (/** @type {?} */ (this.statusChanges)).emit(this.status);
- }
- this._updateAncestors(opts);
- this._onDisabledChange.forEach((changeFn) => changeFn(true));
- }
- /**
- * Enables the control. This means the control will be included in validation checks and
- * the aggregate value of its parent. Its status is re-calculated based on its value and
- * its validators.
- *
- * If the control has children, all children will be enabled.
- * @param {?=} opts
- * @return {?}
- */
- enable(opts = {}) {
- (/** @type {?} */ (this)).status = VALID;
- this._forEachChild((control) => { control.enable(Object.assign({}, opts, { onlySelf: true })); });
- this.updateValueAndValidity({ onlySelf: true, emitEvent: opts.emitEvent });
- this._updateAncestors(opts);
- this._onDisabledChange.forEach((changeFn) => changeFn(false));
- }
- /**
- * @param {?} opts
- * @return {?}
- */
- _updateAncestors(opts) {
- if (this._parent && !opts.onlySelf) {
- this._parent.updateValueAndValidity(opts);
- this._parent._updatePristine();
- this._parent._updateTouched();
- }
- }
- /**
- * @param {?} parent
- * @return {?}
- */
- setParent(parent) { this._parent = parent; }
- /**
- * Re-calculates the value and validation status of the control.
- *
- * By default, it will also update the value and validity of its ancestors.
- * @param {?=} opts
- * @return {?}
- */
- updateValueAndValidity(opts = {}) {
- this._setInitialStatus();
- this._updateValue();
- if (this.enabled) {
- this._cancelExistingSubscription();
- (/** @type {?} */ (this)).errors = this._runValidator();
- (/** @type {?} */ (this)).status = this._calculateStatus();
- if (this.status === VALID || this.status === PENDING) {
- this._runAsyncValidator(opts.emitEvent);
- }
- }
- if (opts.emitEvent !== false) {
- (/** @type {?} */ (this.valueChanges)).emit(this.value);
- (/** @type {?} */ (this.statusChanges)).emit(this.status);
- }
- if (this._parent && !opts.onlySelf) {
- this._parent.updateValueAndValidity(opts);
- }
- }
- /**
- * \@internal
- * @param {?=} opts
- * @return {?}
- */
- _updateTreeValidity(opts = { emitEvent: true }) {
- this._forEachChild((ctrl) => ctrl._updateTreeValidity(opts));
- this.updateValueAndValidity({ onlySelf: true, emitEvent: opts.emitEvent });
- }
- /**
- * @return {?}
- */
- _setInitialStatus() {
- (/** @type {?} */ (this)).status = this._allControlsDisabled() ? DISABLED : VALID;
- }
- /**
- * @return {?}
- */
- _runValidator() {
- return this.validator ? this.validator(this) : null;
- }
- /**
- * @param {?=} emitEvent
- * @return {?}
- */
- _runAsyncValidator(emitEvent) {
- if (this.asyncValidator) {
- (/** @type {?} */ (this)).status = PENDING;
- const /** @type {?} */ obs = toObservable(this.asyncValidator(this));
- this._asyncValidationSubscription =
- obs.subscribe((errors) => this.setErrors(errors, { emitEvent }));
- }
- }
- /**
- * @return {?}
- */
- _cancelExistingSubscription() {
- if (this._asyncValidationSubscription) {
- this._asyncValidationSubscription.unsubscribe();
- }
- }
- /**
- * Sets errors on a form control.
- *
- * This is used when validations are run manually by the user, rather than automatically.
- *
- * Calling `setErrors` will also update the validity of the parent control.
- *
- * ### Example
- *
- * ```
- * const login = new FormControl("someLogin");
- * login.setErrors({
- * "notUnique": true
- * });
- *
- * expect(login.valid).toEqual(false);
- * expect(login.errors).toEqual({"notUnique": true});
- *
- * login.setValue("someOtherLogin");
- *
- * expect(login.valid).toEqual(true);
- * ```
- * @param {?} errors
- * @param {?=} opts
- * @return {?}
- */
- setErrors(errors, opts = {}) {
- (/** @type {?} */ (this)).errors = errors;
- this._updateControlsErrors(opts.emitEvent !== false);
- }
- /**
- * Retrieves a child control given the control's name or path.
- *
- * Paths can be passed in as an array or a string delimited by a dot.
- *
- * To get a control nested within a `person` sub-group:
- *
- * * `this.form.get('person.name');`
- *
- * -OR-
- *
- * * `this.form.get(['person', 'name']);`
- * @param {?} path
- * @return {?}
- */
- get(path) { return _find(this, path, '.'); }
- /**
- * Returns error data if the control with the given path has the error specified. Otherwise
- * returns null or undefined.
- *
- * If no path is given, it checks for the error on the present control.
- * @param {?} errorCode
- * @param {?=} path
- * @return {?}
- */
- getError(errorCode, path) {
- const /** @type {?} */ control = path ? this.get(path) : this;
- return control && control.errors ? control.errors[errorCode] : null;
- }
- /**
- * Returns true if the control with the given path has the error specified. Otherwise
- * returns false.
- *
- * If no path is given, it checks for the error on the present control.
- * @param {?} errorCode
- * @param {?=} path
- * @return {?}
- */
- hasError(errorCode, path) { return !!this.getError(errorCode, path); }
- /**
- * Retrieves the top-level ancestor of this control.
- * @return {?}
- */
- get root() {
- let /** @type {?} */ x = this;
- while (x._parent) {
- x = x._parent;
- }
- return x;
- }
- /**
- * \@internal
- * @param {?} emitEvent
- * @return {?}
- */
- _updateControlsErrors(emitEvent) {
- (/** @type {?} */ (this)).status = this._calculateStatus();
- if (emitEvent) {
- (/** @type {?} */ (this.statusChanges)).emit(this.status);
- }
- if (this._parent) {
- this._parent._updateControlsErrors(emitEvent);
- }
- }
- /**
- * \@internal
- * @return {?}
- */
- _initObservables() {
- (/** @type {?} */ (this)).valueChanges = new EventEmitter();
- (/** @type {?} */ (this)).statusChanges = new EventEmitter();
- }
- /**
- * @return {?}
- */
- _calculateStatus() {
- if (this._allControlsDisabled())
- return DISABLED;
- if (this.errors)
- return INVALID;
- if (this._anyControlsHaveStatus(PENDING))
- return PENDING;
- if (this._anyControlsHaveStatus(INVALID))
- return INVALID;
- return VALID;
- }
- /**
- * \@internal
- * @param {?} status
- * @return {?}
- */
- _anyControlsHaveStatus(status) {
- return this._anyControls((control) => control.status === status);
- }
- /**
- * \@internal
- * @return {?}
- */
- _anyControlsDirty() {
- return this._anyControls((control) => control.dirty);
- }
- /**
- * \@internal
- * @return {?}
- */
- _anyControlsTouched() {
- return this._anyControls((control) => control.touched);
- }
- /**
- * \@internal
- * @param {?=} opts
- * @return {?}
- */
- _updatePristine(opts = {}) {
- (/** @type {?} */ (this)).pristine = !this._anyControlsDirty();
- if (this._parent && !opts.onlySelf) {
- this._parent._updatePristine(opts);
- }
- }
- /**
- * \@internal
- * @param {?=} opts
- * @return {?}
- */
- _updateTouched(opts = {}) {
- (/** @type {?} */ (this)).touched = this._anyControlsTouched();
- if (this._parent && !opts.onlySelf) {
- this._parent._updateTouched(opts);
- }
- }
- /**
- * \@internal
- * @param {?} formState
- * @return {?}
- */
- _isBoxedValue(formState) {
- return typeof formState === 'object' && formState !== null &&
- Object.keys(formState).length === 2 && 'value' in formState && 'disabled' in formState;
- }
- /**
- * \@internal
- * @param {?} fn
- * @return {?}
- */
- _registerOnCollectionChange(fn) { this._onCollectionChange = fn; }
- /**
- * \@internal
- * @param {?=} opts
- * @return {?}
- */
- _setUpdateStrategy(opts) {
- if (isOptionsObj(opts) && (/** @type {?} */ (opts)).updateOn != null) {
- this._updateOn = /** @type {?} */ (((/** @type {?} */ (opts)).updateOn));
- }
- }
- }
- /**
- * \@whatItDoes Tracks the value and validation status of an individual form control.
- *
- * It is one of the three fundamental building blocks of Angular forms, along with
- * {\@link FormGroup} and {\@link FormArray}.
- *
- * \@howToUse
- *
- * When instantiating a {\@link FormControl}, you can pass in an initial value as the
- * first argument. Example:
- *
- * ```ts
- * const ctrl = new FormControl('some value');
- * console.log(ctrl.value); // 'some value'
- * ```
- *
- * You can also initialize the control with a form state object on instantiation,
- * which includes both the value and whether or not the control is disabled.
- * You can't use the value key without the disabled key; both are required
- * to use this way of initialization.
- *
- * ```ts
- * const ctrl = new FormControl({value: 'n/a', disabled: true});
- * console.log(ctrl.value); // 'n/a'
- * console.log(ctrl.status); // 'DISABLED'
- * ```
- *
- * The second {\@link FormControl} argument can accept one of three things:
- * * a sync validator function
- * * an array of sync validator functions
- * * an options object containing validator and/or async validator functions
- *
- * Example of a single sync validator function:
- *
- * ```ts
- * const ctrl = new FormControl('', Validators.required);
- * console.log(ctrl.value); // ''
- * console.log(ctrl.status); // 'INVALID'
- * ```
- *
- * Example using options object:
- *
- * ```ts
- * const ctrl = new FormControl('', {
- * validators: Validators.required,
- * asyncValidators: myAsyncValidator
- * });
- * ```
- *
- * The options object can also be used to define when the control should update.
- * By default, the value and validity of a control updates whenever the value
- * changes. You can configure it to update on the blur event instead by setting
- * the `updateOn` option to `'blur'`.
- *
- * ```ts
- * const c = new FormControl('', { updateOn: 'blur' });
- * ```
- *
- * You can also set `updateOn` to `'submit'`, which will delay value and validity
- * updates until the parent form of the control fires a submit event.
- *
- * See its superclass, {\@link AbstractControl}, for more properties and methods.
- *
- * * **npm package**: `\@angular/forms`
- *
- * \@stable
- */
- class FormControl extends AbstractControl {
- /**
- * @param {?=} formState
- * @param {?=} validatorOrOpts
- * @param {?=} asyncValidator
- */
- constructor(formState = null, validatorOrOpts, asyncValidator) {
- super(coerceToValidator(validatorOrOpts), coerceToAsyncValidator(asyncValidator, validatorOrOpts));
- /**
- * \@internal
- */
- this._onChange = [];
- this._applyFormState(formState);
- this._setUpdateStrategy(validatorOrOpts);
- this.updateValueAndValidity({ onlySelf: true, emitEvent: false });
- this._initObservables();
- }
- /**
- * Set the value of the form control to `value`.
- *
- * If `onlySelf` is `true`, this change will only affect the validation of this `FormControl`
- * and not its parent component. This defaults to false.
- *
- * If `emitEvent` is `true`, this
- * change will cause a `valueChanges` event on the `FormControl` to be emitted. This defaults
- * to true (as it falls through to `updateValueAndValidity`).
- *
- * If `emitModelToViewChange` is `true`, the view will be notified about the new value
- * via an `onChange` event. This is the default behavior if `emitModelToViewChange` is not
- * specified.
- *
- * If `emitViewToModelChange` is `true`, an ngModelChange event will be fired to update the
- * model. This is the default behavior if `emitViewToModelChange` is not specified.
- * @param {?} value
- * @param {?=} options
- * @return {?}
- */
- setValue(value, options = {}) {
- (/** @type {?} */ (this)).value = this._pendingValue = value;
- if (this._onChange.length && options.emitModelToViewChange !== false) {
- this._onChange.forEach((changeFn) => changeFn(this.value, options.emitViewToModelChange !== false));
- }
- this.updateValueAndValidity(options);
- }
- /**
- * Patches the value of a control.
- *
- * This function is functionally the same as {\@link FormControl#setValue setValue} at this level.
- * It exists for symmetry with {\@link FormGroup#patchValue patchValue} on `FormGroups` and
- * `FormArrays`, where it does behave differently.
- * @param {?} value
- * @param {?=} options
- * @return {?}
- */
- patchValue(value, options = {}) {
- this.setValue(value, options);
- }
- /**
- * Resets the form control. This means by default:
- *
- * * it is marked as `pristine`
- * * it is marked as `untouched`
- * * value is set to null
- *
- * You can also reset to a specific form state by passing through a standalone
- * value or a form state object that contains both a value and a disabled state
- * (these are the only two properties that cannot be calculated).
- *
- * Ex:
- *
- * ```ts
- * this.control.reset('Nancy');
- *
- * console.log(this.control.value); // 'Nancy'
- * ```
- *
- * OR
- *
- * ```
- * this.control.reset({value: 'Nancy', disabled: true});
- *
- * console.log(this.control.value); // 'Nancy'
- * console.log(this.control.status); // 'DISABLED'
- * ```
- * @param {?=} formState
- * @param {?=} options
- * @return {?}
- */
- reset(formState = null, options = {}) {
- this._applyFormState(formState);
- this.markAsPristine(options);
- this.markAsUntouched(options);
- this.setValue(this.value, options);
- this._pendingChange = false;
- }
- /**
- * \@internal
- * @return {?}
- */
- _updateValue() { }
- /**
- * \@internal
- * @param {?} condition
- * @return {?}
- */
- _anyControls(condition) { return false; }
- /**
- * \@internal
- * @return {?}
- */
- _allControlsDisabled() { return this.disabled; }
- /**
- * Register a listener for change events.
- * @param {?} fn
- * @return {?}
- */
- registerOnChange(fn) { this._onChange.push(fn); }
- /**
- * \@internal
- * @return {?}
- */
- _clearChangeFns() {
- this._onChange = [];
- this._onDisabledChange = [];
- this._onCollectionChange = () => { };
- }
- /**
- * Register a listener for disabled events.
- * @param {?} fn
- * @return {?}
- */
- registerOnDisabledChange(fn) {
- this._onDisabledChange.push(fn);
- }
- /**
- * \@internal
- * @param {?} cb
- * @return {?}
- */
- _forEachChild(cb) { }
- /**
- * \@internal
- * @return {?}
- */
- _syncPendingControls() {
- if (this.updateOn === 'submit') {
- if (this._pendingDirty)
- this.markAsDirty();
- if (this._pendingTouched)
- this.markAsTouched();
- if (this._pendingChange) {
- this.setValue(this._pendingValue, { onlySelf: true, emitModelToViewChange: false });
- return true;
- }
- }
- return false;
- }
- /**
- * @param {?} formState
- * @return {?}
- */
- _applyFormState(formState) {
- if (this._isBoxedValue(formState)) {
- (/** @type {?} */ (this)).value = this._pendingValue = formState.value;
- formState.disabled ? this.disable({ onlySelf: true, emitEvent: false }) :
- this.enable({ onlySelf: true, emitEvent: false });
- }
- else {
- (/** @type {?} */ (this)).value = this._pendingValue = formState;
- }
- }
- }
- /**
- * \@whatItDoes Tracks the value and validity state of a group of {\@link FormControl}
- * instances.
- *
- * A `FormGroup` aggregates the values of each child {\@link FormControl} into one object,
- * with each control name as the key. It calculates its status by reducing the statuses
- * of its children. For example, if one of the controls in a group is invalid, the entire
- * group becomes invalid.
- *
- * `FormGroup` is one of the three fundamental building blocks used to define forms in Angular,
- * along with {\@link FormControl} and {\@link FormArray}.
- *
- * \@howToUse
- *
- * When instantiating a {\@link FormGroup}, pass in a collection of child controls as the first
- * argument. The key for each child will be the name under which it is registered.
- *
- * ### Example
- *
- * ```
- * const form = new FormGroup({
- * first: new FormControl('Nancy', Validators.minLength(2)),
- * last: new FormControl('Drew'),
- * });
- *
- * console.log(form.value); // {first: 'Nancy', last; 'Drew'}
- * console.log(form.status); // 'VALID'
- * ```
- *
- * You can also include group-level validators as the second arg, or group-level async
- * validators as the third arg. These come in handy when you want to perform validation
- * that considers the value of more than one child control.
- *
- * ### Example
- *
- * ```
- * const form = new FormGroup({
- * password: new FormControl('', Validators.minLength(2)),
- * passwordConfirm: new FormControl('', Validators.minLength(2)),
- * }, passwordMatchValidator);
- *
- *
- * function passwordMatchValidator(g: FormGroup) {
- * return g.get('password').value === g.get('passwordConfirm').value
- * ? null : {'mismatch': true};
- * }
- * ```
- *
- * Like {\@link FormControl} instances, you can alternatively choose to pass in
- * validators and async validators as part of an options object.
- *
- * ```
- * const form = new FormGroup({
- * password: new FormControl('')
- * passwordConfirm: new FormControl('')
- * }, {validators: passwordMatchValidator, asyncValidators: otherValidator});
- * ```
- *
- * The options object can also be used to set a default value for each child
- * control's `updateOn` property. If you set `updateOn` to `'blur'` at the
- * group level, all child controls will default to 'blur', unless the child
- * has explicitly specified a different `updateOn` value.
- *
- * ```ts
- * const c = new FormGroup({
- * one: new FormControl()
- * }, {updateOn: 'blur'});
- * ```
- *
- * * **npm package**: `\@angular/forms`
- *
- * \@stable
- */
- class FormGroup extends AbstractControl {
- /**
- * @param {?} controls
- * @param {?=} validatorOrOpts
- * @param {?=} asyncValidator
- */
- constructor(controls, validatorOrOpts, asyncValidator) {
- super(coerceToValidator(validatorOrOpts), coerceToAsyncValidator(asyncValidator, validatorOrOpts));
- this.controls = controls;
- this._initObservables();
- this._setUpdateStrategy(validatorOrOpts);
- this._setUpControls();
- this.updateValueAndValidity({ onlySelf: true, emitEvent: false });
- }
- /**
- * Registers a control with the group's list of controls.
- *
- * This method does not update the value or validity of the control, so for most cases you'll want
- * to use {\@link FormGroup#addControl addControl} instead.
- * @param {?} name
- * @param {?} control
- * @return {?}
- */
- registerControl(name, control) {
- if (this.controls[name])
- return this.controls[name];
- this.controls[name] = control;
- control.setParent(this);
- control._registerOnCollectionChange(this._onCollectionChange);
- return control;
- }
- /**
- * Add a control to this group.
- * @param {?} name
- * @param {?} control
- * @return {?}
- */
- addControl(name, control) {
- this.registerControl(name, control);
- this.updateValueAndValidity();
- this._onCollectionChange();
- }
- /**
- * Remove a control from this group.
- * @param {?} name
- * @return {?}
- */
- removeControl(name) {
- if (this.controls[name])
- this.controls[name]._registerOnCollectionChange(() => { });
- delete (this.controls[name]);
- this.updateValueAndValidity();
- this._onCollectionChange();
- }
- /**
- * Replace an existing control.
- * @param {?} name
- * @param {?} control
- * @return {?}
- */
- setControl(name, control) {
- if (this.controls[name])
- this.controls[name]._registerOnCollectionChange(() => { });
- delete (this.controls[name]);
- if (control)
- this.registerControl(name, control);
- this.updateValueAndValidity();
- this._onCollectionChange();
- }
- /**
- * Check whether there is an enabled control with the given name in the group.
- *
- * It will return false for disabled controls. If you'd like to check for existence in the group
- * only, use {\@link AbstractControl#get get} instead.
- * @param {?} controlName
- * @return {?}
- */
- contains(controlName) {
- return this.controls.hasOwnProperty(controlName) && this.controls[controlName].enabled;
- }
- /**
- * Sets the value of the {\@link FormGroup}. It accepts an object that matches
- * the structure of the group, with control names as keys.
- *
- * This method performs strict checks, so it will throw an error if you try
- * to set the value of a control that doesn't exist or if you exclude the
- * value of a control.
- *
- * ### Example
- *
- * ```
- * const form = new FormGroup({
- * first: new FormControl(),
- * last: new FormControl()
- * });
- * console.log(form.value); // {first: null, last: null}
- *
- * form.setValue({first: 'Nancy', last: 'Drew'});
- * console.log(form.value); // {first: 'Nancy', last: 'Drew'}
- *
- * ```
- * @param {?} value
- * @param {?=} options
- * @return {?}
- */
- setValue(value, options = {}) {
- this._checkAllValuesPresent(value);
- Object.keys(value).forEach(name => {
- this._throwIfControlMissing(name);
- this.controls[name].setValue(value[name], { onlySelf: true, emitEvent: options.emitEvent });
- });
- this.updateValueAndValidity(options);
- }
- /**
- * Patches the value of the {\@link FormGroup}. It accepts an object with control
- * names as keys, and will do its best to match the values to the correct controls
- * in the group.
- *
- * It accepts both super-sets and sub-sets of the group without throwing an error.
- *
- * ### Example
- *
- * ```
- * const form = new FormGroup({
- * first: new FormControl(),
- * last: new FormControl()
- * });
- * console.log(form.value); // {first: null, last: null}
- *
- * form.patchValue({first: 'Nancy'});
- * console.log(form.value); // {first: 'Nancy', last: null}
- *
- * ```
- * @param {?} value
- * @param {?=} options
- * @return {?}
- */
- patchValue(value, options = {}) {
- Object.keys(value).forEach(name => {
- if (this.controls[name]) {
- this.controls[name].patchValue(value[name], { onlySelf: true, emitEvent: options.emitEvent });
- }
- });
- this.updateValueAndValidity(options);
- }
- /**
- * Resets the {\@link FormGroup}. This means by default:
- *
- * * The group and all descendants are marked `pristine`
- * * The group and all descendants are marked `untouched`
- * * The value of all descendants will be null or null maps
- *
- * You can also reset to a specific form state by passing in a map of states
- * that matches the structure of your form, with control names as keys. The state
- * can be a standalone value or a form state object with both a value and a disabled
- * status.
- *
- * ### Example
- *
- * ```ts
- * this.form.reset({first: 'name', last: 'last name'});
- *
- * console.log(this.form.value); // {first: 'name', last: 'last name'}
- * ```
- *
- * - OR -
- *
- * ```
- * this.form.reset({
- * first: {value: 'name', disabled: true},
- * last: 'last'
- * });
- *
- * console.log(this.form.value); // {first: 'name', last: 'last name'}
- * console.log(this.form.get('first').status); // 'DISABLED'
- * ```
- * @param {?=} value
- * @param {?=} options
- * @return {?}
- */
- reset(value = {}, options = {}) {
- this._forEachChild((control, name) => {
- control.reset(value[name], { onlySelf: true, emitEvent: options.emitEvent });
- });
- this.updateValueAndValidity(options);
- this._updatePristine(options);
- this._updateTouched(options);
- }
- /**
- * The aggregate value of the {\@link FormGroup}, including any disabled controls.
- *
- * If you'd like to include all values regardless of disabled status, use this method.
- * Otherwise, the `value` property is the best way to get the value of the group.
- * @return {?}
- */
- getRawValue() {
- return this._reduceChildren({}, (acc, control, name) => {
- acc[name] = control instanceof FormControl ? control.value : (/** @type {?} */ (control)).getRawValue();
- return acc;
- });
- }
- /**
- * \@internal
- * @return {?}
- */
- _syncPendingControls() {
- let /** @type {?} */ subtreeUpdated = this._reduceChildren(false, (updated, child) => {
- return child._syncPendingControls() ? true : updated;
- });
- if (subtreeUpdated)
- this.updateValueAndValidity({ onlySelf: true });
- return subtreeUpdated;
- }
- /**
- * \@internal
- * @param {?} name
- * @return {?}
- */
- _throwIfControlMissing(name) {
- if (!Object.keys(this.controls).length) {
- throw new Error(`
- There are no form controls registered with this group yet. If you're using ngModel,
- you may want to check next tick (e.g. use setTimeout).
- `);
- }
- if (!this.controls[name]) {
- throw new Error(`Cannot find form control with name: ${name}.`);
- }
- }
- /**
- * \@internal
- * @param {?} cb
- * @return {?}
- */
- _forEachChild(cb) {
- Object.keys(this.controls).forEach(k => cb(this.controls[k], k));
- }
- /**
- * \@internal
- * @return {?}
- */
- _setUpControls() {
- this._forEachChild((control) => {
- control.setParent(this);
- control._registerOnCollectionChange(this._onCollectionChange);
- });
- }
- /**
- * \@internal
- * @return {?}
- */
- _updateValue() { (/** @type {?} */ (this)).value = this._reduceValue(); }
- /**
- * \@internal
- * @param {?} condition
- * @return {?}
- */
- _anyControls(condition) {
- let /** @type {?} */ res = false;
- this._forEachChild((control, name) => {
- res = res || (this.contains(name) && condition(control));
- });
- return res;
- }
- /**
- * \@internal
- * @return {?}
- */
- _reduceValue() {
- return this._reduceChildren({}, (acc, control, name) => {
- if (control.enabled || this.disabled) {
- acc[name] = control.value;
- }
- return acc;
- });
- }
- /**
- * \@internal
- * @param {?} initValue
- * @param {?} fn
- * @return {?}
- */
- _reduceChildren(initValue, fn) {
- let /** @type {?} */ res = initValue;
- this._forEachChild((control, name) => { res = fn(res, control, name); });
- return res;
- }
- /**
- * \@internal
- * @return {?}
- */
- _allControlsDisabled() {
- for (const /** @type {?} */ controlName of Object.keys(this.controls)) {
- if (this.controls[controlName].enabled) {
- return false;
- }
- }
- return Object.keys(this.controls).length > 0 || this.disabled;
- }
- /**
- * \@internal
- * @param {?} value
- * @return {?}
- */
- _checkAllValuesPresent(value) {
- this._forEachChild((control, name) => {
- if (value[name] === undefined) {
- throw new Error(`Must supply a value for form control with name: '${name}'.`);
- }
- });
- }
- }
- /**
- * \@whatItDoes Tracks the value and validity state of an array of {\@link FormControl},
- * {\@link FormGroup} or {\@link FormArray} instances.
- *
- * A `FormArray` aggregates the values of each child {\@link FormControl} into an array.
- * It calculates its status by reducing the statuses of its children. For example, if one of
- * the controls in a `FormArray` is invalid, the entire array becomes invalid.
- *
- * `FormArray` is one of the three fundamental building blocks used to define forms in Angular,
- * along with {\@link FormControl} and {\@link FormGroup}.
- *
- * \@howToUse
- *
- * When instantiating a {\@link FormArray}, pass in an array of child controls as the first
- * argument.
- *
- * ### Example
- *
- * ```
- * const arr = new FormArray([
- * new FormControl('Nancy', Validators.minLength(2)),
- * new FormControl('Drew'),
- * ]);
- *
- * console.log(arr.value); // ['Nancy', 'Drew']
- * console.log(arr.status); // 'VALID'
- * ```
- *
- * You can also include array-level validators and async validators. These come in handy
- * when you want to perform validation that considers the value of more than one child
- * control.
- *
- * The two types of validators can be passed in separately as the second and third arg
- * respectively, or together as part of an options object.
- *
- * ```
- * const arr = new FormArray([
- * new FormControl('Nancy'),
- * new FormControl('Drew')
- * ], {validators: myValidator, asyncValidators: myAsyncValidator});
- * ```
- *
- * The options object can also be used to set a default value for each child
- * control's `updateOn` property. If you set `updateOn` to `'blur'` at the
- * array level, all child controls will default to 'blur', unless the child
- * has explicitly specified a different `updateOn` value.
- *
- * ```ts
- * const c = new FormArray([
- * new FormControl()
- * ], {updateOn: 'blur'});
- * ```
- *
- * ### Adding or removing controls
- *
- * To change the controls in the array, use the `push`, `insert`, or `removeAt` methods
- * in `FormArray` itself. These methods ensure the controls are properly tracked in the
- * form's hierarchy. Do not modify the array of `AbstractControl`s used to instantiate
- * the `FormArray` directly, as that will result in strange and unexpected behavior such
- * as broken change detection.
- *
- * * **npm package**: `\@angular/forms`
- *
- * \@stable
- */
- class FormArray extends AbstractControl {
- /**
- * @param {?} controls
- * @param {?=} validatorOrOpts
- * @param {?=} asyncValidator
- */
- constructor(controls, validatorOrOpts, asyncValidator) {
- super(coerceToValidator(validatorOrOpts), coerceToAsyncValidator(asyncValidator, validatorOrOpts));
- this.controls = controls;
- this._initObservables();
- this._setUpdateStrategy(validatorOrOpts);
- this._setUpControls();
- this.updateValueAndValidity({ onlySelf: true, emitEvent: false });
- }
- /**
- * Get the {\@link AbstractControl} at the given `index` in the array.
- * @param {?} index
- * @return {?}
- */
- at(index) { return this.controls[index]; }
- /**
- * Insert a new {\@link AbstractControl} at the end of the array.
- * @param {?} control
- * @return {?}
- */
- push(control) {
- this.controls.push(control);
- this._registerControl(control);
- this.updateValueAndValidity();
- this._onCollectionChange();
- }
- /**
- * Insert a new {\@link AbstractControl} at the given `index` in the array.
- * @param {?} index
- * @param {?} control
- * @return {?}
- */
- insert(index, control) {
- this.controls.splice(index, 0, control);
- this._registerControl(control);
- this.updateValueAndValidity();
- }
- /**
- * Remove the control at the given `index` in the array.
- * @param {?} index
- * @return {?}
- */
- removeAt(index) {
- if (this.controls[index])
- this.controls[index]._registerOnCollectionChange(() => { });
- this.controls.splice(index, 1);
- this.updateValueAndValidity();
- }
- /**
- * Replace an existing control.
- * @param {?} index
- * @param {?} control
- * @return {?}
- */
- setControl(index, control) {
- if (this.controls[index])
- this.controls[index]._registerOnCollectionChange(() => { });
- this.controls.splice(index, 1);
- if (control) {
- this.controls.splice(index, 0, control);
- this._registerControl(control);
- }
- this.updateValueAndValidity();
- this._onCollectionChange();
- }
- /**
- * Length of the control array.
- * @return {?}
- */
- get length() { return this.controls.length; }
- /**
- * Sets the value of the {\@link FormArray}. It accepts an array that matches
- * the structure of the control.
- *
- * This method performs strict checks, so it will throw an error if you try
- * to set the value of a control that doesn't exist or if you exclude the
- * value of a control.
- *
- * ### Example
- *
- * ```
- * const arr = new FormArray([
- * new FormControl(),
- * new FormControl()
- * ]);
- * console.log(arr.value); // [null, null]
- *
- * arr.setValue(['Nancy', 'Drew']);
- * console.log(arr.value); // ['Nancy', 'Drew']
- * ```
- * @param {?} value
- * @param {?=} options
- * @return {?}
- */
- setValue(value, options = {}) {
- this._checkAllValuesPresent(value);
- value.forEach((newValue, index) => {
- this._throwIfControlMissing(index);
- this.at(index).setValue(newValue, { onlySelf: true, emitEvent: options.emitEvent });
- });
- this.updateValueAndValidity(options);
- }
- /**
- * Patches the value of the {\@link FormArray}. It accepts an array that matches the
- * structure of the control, and will do its best to match the values to the correct
- * controls in the group.
- *
- * It accepts both super-sets and sub-sets of the array without throwing an error.
- *
- * ### Example
- *
- * ```
- * const arr = new FormArray([
- * new FormControl(),
- * new FormControl()
- * ]);
- * console.log(arr.value); // [null, null]
- *
- * arr.patchValue(['Nancy']);
- * console.log(arr.value); // ['Nancy', null]
- * ```
- * @param {?} value
- * @param {?=} options
- * @return {?}
- */
- patchValue(value, options = {}) {
- value.forEach((newValue, index) => {
- if (this.at(index)) {
- this.at(index).patchValue(newValue, { onlySelf: true, emitEvent: options.emitEvent });
- }
- });
- this.updateValueAndValidity(options);
- }
- /**
- * Resets the {\@link FormArray}. This means by default:
- *
- * * The array and all descendants are marked `pristine`
- * * The array and all descendants are marked `untouched`
- * * The value of all descendants will be null or null maps
- *
- * You can also reset to a specific form state by passing in an array of states
- * that matches the structure of the control. The state can be a standalone value
- * or a form state object with both a value and a disabled status.
- *
- * ### Example
- *
- * ```ts
- * this.arr.reset(['name', 'last name']);
- *
- * console.log(this.arr.value); // ['name', 'last name']
- * ```
- *
- * - OR -
- *
- * ```
- * this.arr.reset([
- * {value: 'name', disabled: true},
- * 'last'
- * ]);
- *
- * console.log(this.arr.value); // ['name', 'last name']
- * console.log(this.arr.get(0).status); // 'DISABLED'
- * ```
- * @param {?=} value
- * @param {?=} options
- * @return {?}
- */
- reset(value = [], options = {}) {
- this._forEachChild((control, index) => {
- control.reset(value[index], { onlySelf: true, emitEvent: options.emitEvent });
- });
- this.updateValueAndValidity(options);
- this._updatePristine(options);
- this._updateTouched(options);
- }
- /**
- * The aggregate value of the array, including any disabled controls.
- *
- * If you'd like to include all values regardless of disabled status, use this method.
- * Otherwise, the `value` property is the best way to get the value of the array.
- * @return {?}
- */
- getRawValue() {
- return this.controls.map((control) => {
- return control instanceof FormControl ? control.value : (/** @type {?} */ (control)).getRawValue();
- });
- }
- /**
- * \@internal
- * @return {?}
- */
- _syncPendingControls() {
- let /** @type {?} */ subtreeUpdated = this.controls.reduce((updated, child) => {
- return child._syncPendingControls() ? true : updated;
- }, false);
- if (subtreeUpdated)
- this.updateValueAndValidity({ onlySelf: true });
- return subtreeUpdated;
- }
- /**
- * \@internal
- * @param {?} index
- * @return {?}
- */
- _throwIfControlMissing(index) {
- if (!this.controls.length) {
- throw new Error(`
- There are no form controls registered with this array yet. If you're using ngModel,
- you may want to check next tick (e.g. use setTimeout).
- `);
- }
- if (!this.at(index)) {
- throw new Error(`Cannot find form control at index ${index}`);
- }
- }
- /**
- * \@internal
- * @param {?} cb
- * @return {?}
- */
- _forEachChild(cb) {
- this.controls.forEach((control, index) => { cb(control, index); });
- }
- /**
- * \@internal
- * @return {?}
- */
- _updateValue() {
- (/** @type {?} */ (this)).value =
- this.controls.filter((control) => control.enabled || this.disabled)
- .map((control) => control.value);
- }
- /**
- * \@internal
- * @param {?} condition
- * @return {?}
- */
- _anyControls(condition) {
- return this.controls.some((control) => control.enabled && condition(control));
- }
- /**
- * \@internal
- * @return {?}
- */
- _setUpControls() {
- this._forEachChild((control) => this._registerControl(control));
- }
- /**
- * \@internal
- * @param {?} value
- * @return {?}
- */
- _checkAllValuesPresent(value) {
- this._forEachChild((control, i) => {
- if (value[i] === undefined) {
- throw new Error(`Must supply a value for form control at index: ${i}.`);
- }
- });
- }
- /**
- * \@internal
- * @return {?}
- */
- _allControlsDisabled() {
- for (const /** @type {?} */ control of this.controls) {
- if (control.enabled)
- return false;
- }
- return this.controls.length > 0 || this.disabled;
- }
- /**
- * @param {?} control
- * @return {?}
- */
- _registerControl(control) {
- control.setParent(this);
- control._registerOnCollectionChange(this._onCollectionChange);
- }
- }
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. 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
- */
- const formDirectiveProvider = {
- provide: ControlContainer,
- useExisting: forwardRef(() => NgForm)
- };
- const resolvedPromise = Promise.resolve(null);
- /**
- * \@whatItDoes Creates a top-level {\@link FormGroup} instance and binds it to a form
- * to track aggregate form value and validation status.
- *
- * \@howToUse
- *
- * As soon as you import the `FormsModule`, this directive becomes active by default on
- * all `<form>` tags. You don't need to add a special selector.
- *
- * You can export the directive into a local template variable using `ngForm` as the key
- * (ex: `#myForm="ngForm"`). This is optional, but useful. Many properties from the underlying
- * {\@link FormGroup} instance are duplicated on the directive itself, so a reference to it
- * will give you access to the aggregate value and validity status of the form, as well as
- * user interaction properties like `dirty` and `touched`.
- *
- * To register child controls with the form, you'll want to use {\@link NgModel} with a
- * `name` attribute. You can also use {\@link NgModelGroup} if you'd like to create
- * sub-groups within the form.
- *
- * You can listen to the directive's `ngSubmit` event to be notified when the user has
- * triggered a form submission. The `ngSubmit` event will be emitted with the original form
- * submission event.
- *
- * In template driven forms, all `<form>` tags are automatically tagged as `NgForm`.
- * If you want to import the `FormsModule` but skip its usage in some forms,
- * for example, to use native HTML5 validation, you can add `ngNoForm` and the `<form>`
- * tags won't create an `NgForm` directive. In reactive forms, using `ngNoForm` is
- * unnecessary because the `<form>` tags are inert. In that case, you would
- * refrain from using the `formGroup` directive.
- *
- * {\@example forms/ts/simpleForm/simple_form_example.ts region='Component'}
- *
- * * **npm package**: `\@angular/forms`
- *
- * * **NgModule**: `FormsModule`
- *
- * \@stable
- */
- class NgForm extends ControlContainer {
- /**
- * @param {?} validators
- * @param {?} asyncValidators
- */
- constructor(validators, asyncValidators) {
- super();
- this.submitted = false;
- this._directives = [];
- this.ngSubmit = new EventEmitter();
- this.form =
- new FormGroup({}, composeValidators(validators), composeAsyncValidators(asyncValidators));
- }
- /**
- * @return {?}
- */
- ngAfterViewInit() { this._setUpdateStrategy(); }
- /**
- * @return {?}
- */
- get formDirective() { return this; }
- /**
- * @return {?}
- */
- get control() { return this.form; }
- /**
- * @return {?}
- */
- get path() { return []; }
- /**
- * @return {?}
- */
- get controls() { return this.form.controls; }
- /**
- * @param {?} dir
- * @return {?}
- */
- addControl(dir) {
- resolvedPromise.then(() => {
- const /** @type {?} */ container = this._findContainer(dir.path);
- (/** @type {?} */ (dir)).control = /** @type {?} */ (container.registerControl(dir.name, dir.control));
- setUpControl(dir.control, dir);
- dir.control.updateValueAndValidity({ emitEvent: false });
- this._directives.push(dir);
- });
- }
- /**
- * @param {?} dir
- * @return {?}
- */
- getControl(dir) { return /** @type {?} */ (this.form.get(dir.path)); }
- /**
- * @param {?} dir
- * @return {?}
- */
- removeControl(dir) {
- resolvedPromise.then(() => {
- const /** @type {?} */ container = this._findContainer(dir.path);
- if (container) {
- container.removeControl(dir.name);
- }
- removeDir(this._directives, dir);
- });
- }
- /**
- * @param {?} dir
- * @return {?}
- */
- addFormGroup(dir) {
- resolvedPromise.then(() => {
- const /** @type {?} */ container = this._findContainer(dir.path);
- const /** @type {?} */ group = new FormGroup({});
- setUpFormContainer(group, dir);
- container.registerControl(dir.name, group);
- group.updateValueAndValidity({ emitEvent: false });
- });
- }
- /**
- * @param {?} dir
- * @return {?}
- */
- removeFormGroup(dir) {
- resolvedPromise.then(() => {
- const /** @type {?} */ container = this._findContainer(dir.path);
- if (container) {
- container.removeControl(dir.name);
- }
- });
- }
- /**
- * @param {?} dir
- * @return {?}
- */
- getFormGroup(dir) { return /** @type {?} */ (this.form.get(dir.path)); }
- /**
- * @param {?} dir
- * @param {?} value
- * @return {?}
- */
- updateModel(dir, value) {
- resolvedPromise.then(() => {
- const /** @type {?} */ ctrl = /** @type {?} */ (this.form.get(/** @type {?} */ ((dir.path))));
- ctrl.setValue(value);
- });
- }
- /**
- * @param {?} value
- * @return {?}
- */
- setValue(value) { this.control.setValue(value); }
- /**
- * @param {?} $event
- * @return {?}
- */
- onSubmit($event) {
- (/** @type {?} */ (this)).submitted = true;
- syncPendingControls(this.form, this._directives);
- this.ngSubmit.emit($event);
- return false;
- }
- /**
- * @return {?}
- */
- onReset() { this.resetForm(); }
- /**
- * @param {?=} value
- * @return {?}
- */
- resetForm(value = undefined) {
- this.form.reset(value);
- (/** @type {?} */ (this)).submitted = false;
- }
- /**
- * @return {?}
- */
- _setUpdateStrategy() {
- if (this.options && this.options.updateOn != null) {
- this.form._updateOn = this.options.updateOn;
- }
- }
- /**
- * \@internal
- * @param {?} path
- * @return {?}
- */
- _findContainer(path) {
- path.pop();
- return path.length ? /** @type {?} */ (this.form.get(path)) : this.form;
- }
- }
- NgForm.decorators = [
- { type: Directive, args: [{
- selector: 'form:not([ngNoForm]):not([formGroup]),ngForm,[ngForm]',
- providers: [formDirectiveProvider],
- host: { '(submit)': 'onSubmit($event)', '(reset)': 'onReset()' },
- outputs: ['ngSubmit'],
- exportAs: 'ngForm'
- },] },
- ];
- /** @nocollapse */
- NgForm.ctorParameters = () => [
- { type: Array, decorators: [{ type: Optional }, { type: Self }, { type: Inject, args: [NG_VALIDATORS,] },] },
- { type: Array, decorators: [{ type: Optional }, { type: Self }, { type: Inject, args: [NG_ASYNC_VALIDATORS,] },] },
- ];
- NgForm.propDecorators = {
- "options": [{ type: Input, args: ['ngFormOptions',] },],
- };
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. 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
- */
- const FormErrorExamples = {
- formControlName: `
- <div [formGroup]="myGroup">
- <input formControlName="firstName">
- </div>
-
- In your class:
-
- this.myGroup = new FormGroup({
- firstName: new FormControl()
- });`,
- formGroupName: `
- <div [formGroup]="myGroup">
- <div formGroupName="person">
- <input formControlName="firstName">
- </div>
- </div>
-
- In your class:
-
- this.myGroup = new FormGroup({
- person: new FormGroup({ firstName: new FormControl() })
- });`,
- formArrayName: `
- <div [formGroup]="myGroup">
- <div formArrayName="cities">
- <div *ngFor="let city of cityArray.controls; index as i">
- <input [formControlName]="i">
- </div>
- </div>
- </div>
-
- In your class:
-
- this.cityArray = new FormArray([new FormControl('SF')]);
- this.myGroup = new FormGroup({
- cities: this.cityArray
- });`,
- ngModelGroup: `
- <form>
- <div ngModelGroup="person">
- <input [(ngModel)]="person.name" name="firstName">
- </div>
- </form>`,
- ngModelWithFormGroup: `
- <div [formGroup]="myGroup">
- <input formControlName="firstName">
- <input [(ngModel)]="showMoreControls" [ngModelOptions]="{standalone: true}">
- </div>
- `
- };
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. 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
- */
- class TemplateDrivenErrors {
- /**
- * @return {?}
- */
- static modelParentException() {
- throw new Error(`
- ngModel cannot be used to register form controls with a parent formGroup directive. Try using
- formGroup's partner directive "formControlName" instead. Example:
-
- ${FormErrorExamples.formControlName}
-
- Or, if you'd like to avoid registering this form control, indicate that it's standalone in ngModelOptions:
-
- Example:
-
- ${FormErrorExamples.ngModelWithFormGroup}`);
- }
- /**
- * @return {?}
- */
- static formGroupNameException() {
- throw new Error(`
- ngModel cannot be used to register form controls with a parent formGroupName or formArrayName directive.
-
- Option 1: Use formControlName instead of ngModel (reactive strategy):
-
- ${FormErrorExamples.formGroupName}
-
- Option 2: Update ngModel's parent be ngModelGroup (template-driven strategy):
-
- ${FormErrorExamples.ngModelGroup}`);
- }
- /**
- * @return {?}
- */
- static missingNameException() {
- throw new Error(`If ngModel is used within a form tag, either the name attribute must be set or the form
- control must be defined as 'standalone' in ngModelOptions.
-
- Example 1: <input [(ngModel)]="person.firstName" name="first">
- Example 2: <input [(ngModel)]="person.firstName" [ngModelOptions]="{standalone: true}">`);
- }
- /**
- * @return {?}
- */
- static modelGroupParentException() {
- throw new Error(`
- ngModelGroup cannot be used with a parent formGroup directive.
-
- Option 1: Use formGroupName instead of ngModelGroup (reactive strategy):
-
- ${FormErrorExamples.formGroupName}
-
- Option 2: Use a regular form tag instead of the formGroup directive (template-driven strategy):
-
- ${FormErrorExamples.ngModelGroup}`);
- }
- }
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. 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
- */
- const modelGroupProvider = {
- provide: ControlContainer,
- useExisting: forwardRef(() => NgModelGroup)
- };
- /**
- * \@whatItDoes Creates and binds a {\@link FormGroup} instance to a DOM element.
- *
- * \@howToUse
- *
- * This directive can only be used as a child of {\@link NgForm} (or in other words,
- * within `<form>` tags).
- *
- * Use this directive if you'd like to create a sub-group within a form. This can
- * come in handy if you want to validate a sub-group of your form separately from
- * the rest of your form, or if some values in your domain model make more sense to
- * consume together in a nested object.
- *
- * Pass in the name you'd like this sub-group to have and it will become the key
- * for the sub-group in the form's full value. You can also export the directive into
- * a local template variable using `ngModelGroup` (ex: `#myGroup="ngModelGroup"`).
- *
- * {\@example forms/ts/ngModelGroup/ng_model_group_example.ts region='Component'}
- *
- * * **npm package**: `\@angular/forms`
- *
- * * **NgModule**: `FormsModule`
- *
- * \@stable
- */
- class NgModelGroup extends AbstractFormGroupDirective {
- /**
- * @param {?} parent
- * @param {?} validators
- * @param {?} asyncValidators
- */
- constructor(parent, validators, asyncValidators) {
- super();
- this._parent = parent;
- this._validators = validators;
- this._asyncValidators = asyncValidators;
- }
- /**
- * \@internal
- * @return {?}
- */
- _checkParentType() {
- if (!(this._parent instanceof NgModelGroup) && !(this._parent instanceof NgForm)) {
- TemplateDrivenErrors.modelGroupParentException();
- }
- }
- }
- NgModelGroup.decorators = [
- { type: Directive, args: [{ selector: '[ngModelGroup]', providers: [modelGroupProvider], exportAs: 'ngModelGroup' },] },
- ];
- /** @nocollapse */
- NgModelGroup.ctorParameters = () => [
- { type: ControlContainer, decorators: [{ type: Host }, { type: SkipSelf },] },
- { type: Array, decorators: [{ type: Optional }, { type: Self }, { type: Inject, args: [NG_VALIDATORS,] },] },
- { type: Array, decorators: [{ type: Optional }, { type: Self }, { type: Inject, args: [NG_ASYNC_VALIDATORS,] },] },
- ];
- NgModelGroup.propDecorators = {
- "name": [{ type: Input, args: ['ngModelGroup',] },],
- };
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. 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
- */
- const formControlBinding = {
- provide: NgControl,
- useExisting: forwardRef(() => NgModel)
- };
- /**
- * `ngModel` forces an additional change detection run when its inputs change:
- * E.g.:
- * ```
- * <div>{{myModel.valid}}</div>
- * <input [(ngModel)]="myValue" #myModel="ngModel">
- * ```
- * I.e. `ngModel` can export itself on the element and then be used in the template.
- * Normally, this would result in expressions before the `input` that use the exported directive
- * to have and old value as they have been
- * dirty checked before. As this is a very common case for `ngModel`, we added this second change
- * detection run.
- *
- * Notes:
- * - this is just one extra run no matter how many `ngModel` have been changed.
- * - this is a general problem when using `exportAs` for directives!
- */
- const resolvedPromise$1 = Promise.resolve(null);
- /**
- * \@whatItDoes Creates a {\@link FormControl} instance from a domain model and binds it
- * to a form control element.
- *
- * The {\@link FormControl} instance will track the value, user interaction, and
- * validation status of the control and keep the view synced with the model. If used
- * within a parent form, the directive will also register itself with the form as a child
- * control.
- *
- * \@howToUse
- *
- * This directive can be used by itself or as part of a larger form. All you need is the
- * `ngModel` selector to activate it.
- *
- * It accepts a domain model as an optional {\@link Input}. If you have a one-way binding
- * to `ngModel` with `[]` syntax, changing the value of the domain model in the component
- * class will set the value in the view. If you have a two-way binding with `[()]` syntax
- * (also known as 'banana-box syntax'), the value in the UI will always be synced back to
- * the domain model in your class as well.
- *
- * If you wish to inspect the properties of the associated {\@link FormControl} (like
- * validity state), you can also export the directive into a local template variable using
- * `ngModel` as the key (ex: `#myVar="ngModel"`). You can then access the control using the
- * directive's `control` property, but most properties you'll need (like `valid` and `dirty`)
- * will fall through to the control anyway, so you can access them directly. You can see a
- * full list of properties directly available in {\@link AbstractControlDirective}.
- *
- * The following is an example of a simple standalone control using `ngModel`:
- *
- * {\@example forms/ts/simpleNgModel/simple_ng_model_example.ts region='Component'}
- *
- * When using the `ngModel` within `<form>` tags, you'll also need to supply a `name` attribute
- * so that the control can be registered with the parent form under that name.
- *
- * It's worth noting that in the context of a parent form, you often can skip one-way or
- * two-way binding because the parent form will sync the value for you. You can access
- * its properties by exporting it into a local template variable using `ngForm` (ex:
- * `#f="ngForm"`). Then you can pass it where it needs to go on submit.
- *
- * If you do need to populate initial values into your form, using a one-way binding for
- * `ngModel` tends to be sufficient as long as you use the exported form's value rather
- * than the domain model's value on submit.
- *
- * Take a look at an example of using `ngModel` within a form:
- *
- * {\@example forms/ts/simpleForm/simple_form_example.ts region='Component'}
- *
- * To see `ngModel` examples with different form control types, see:
- *
- * * Radio buttons: {\@link RadioControlValueAccessor}
- * * Selects: {\@link SelectControlValueAccessor}
- *
- * **npm package**: `\@angular/forms`
- *
- * **NgModule**: `FormsModule`
- *
- * \@stable
- */
- class NgModel extends NgControl {
- /**
- * @param {?} parent
- * @param {?} validators
- * @param {?} asyncValidators
- * @param {?} valueAccessors
- */
- constructor(parent, validators, asyncValidators, valueAccessors) {
- super();
- this.control = new FormControl();
- /**
- * \@internal
- */
- this._registered = false;
- this.update = new EventEmitter();
- this._parent = parent;
- this._rawValidators = validators || [];
- this._rawAsyncValidators = asyncValidators || [];
- this.valueAccessor = selectValueAccessor(this, valueAccessors);
- }
- /**
- * @param {?} changes
- * @return {?}
- */
- ngOnChanges(changes) {
- this._checkForErrors();
- if (!this._registered)
- this._setUpControl();
- if ('isDisabled' in changes) {
- this._updateDisabled(changes);
- }
- if (isPropertyUpdated(changes, this.viewModel)) {
- this._updateValue(this.model);
- this.viewModel = this.model;
- }
- }
- /**
- * @return {?}
- */
- ngOnDestroy() { this.formDirective && this.formDirective.removeControl(this); }
- /**
- * @return {?}
- */
- get path() {
- return this._parent ? controlPath(this.name, this._parent) : [this.name];
- }
- /**
- * @return {?}
- */
- get formDirective() { return this._parent ? this._parent.formDirective : null; }
- /**
- * @return {?}
- */
- get validator() { return composeValidators(this._rawValidators); }
- /**
- * @return {?}
- */
- get asyncValidator() {
- return composeAsyncValidators(this._rawAsyncValidators);
- }
- /**
- * @param {?} newValue
- * @return {?}
- */
- viewToModelUpdate(newValue) {
- this.viewModel = newValue;
- this.update.emit(newValue);
- }
- /**
- * @return {?}
- */
- _setUpControl() {
- this._setUpdateStrategy();
- this._isStandalone() ? this._setUpStandalone() :
- this.formDirective.addControl(this);
- this._registered = true;
- }
- /**
- * @return {?}
- */
- _setUpdateStrategy() {
- if (this.options && this.options.updateOn != null) {
- this.control._updateOn = this.options.updateOn;
- }
- }
- /**
- * @return {?}
- */
- _isStandalone() {
- return !this._parent || !!(this.options && this.options.standalone);
- }
- /**
- * @return {?}
- */
- _setUpStandalone() {
- setUpControl(this.control, this);
- this.control.updateValueAndValidity({ emitEvent: false });
- }
- /**
- * @return {?}
- */
- _checkForErrors() {
- if (!this._isStandalone()) {
- this._checkParentType();
- }
- this._checkName();
- }
- /**
- * @return {?}
- */
- _checkParentType() {
- if (!(this._parent instanceof NgModelGroup) &&
- this._parent instanceof AbstractFormGroupDirective) {
- TemplateDrivenErrors.formGroupNameException();
- }
- else if (!(this._parent instanceof NgModelGroup) && !(this._parent instanceof NgForm)) {
- TemplateDrivenErrors.modelParentException();
- }
- }
- /**
- * @return {?}
- */
- _checkName() {
- if (this.options && this.options.name)
- this.name = this.options.name;
- if (!this._isStandalone() && !this.name) {
- TemplateDrivenErrors.missingNameException();
- }
- }
- /**
- * @param {?} value
- * @return {?}
- */
- _updateValue(value) {
- resolvedPromise$1.then(() => { this.control.setValue(value, { emitViewToModelChange: false }); });
- }
- /**
- * @param {?} changes
- * @return {?}
- */
- _updateDisabled(changes) {
- const /** @type {?} */ disabledValue = changes['isDisabled'].currentValue;
- const /** @type {?} */ isDisabled = disabledValue === '' || (disabledValue && disabledValue !== 'false');
- resolvedPromise$1.then(() => {
- if (isDisabled && !this.control.disabled) {
- this.control.disable();
- }
- else if (!isDisabled && this.control.disabled) {
- this.control.enable();
- }
- });
- }
- }
- NgModel.decorators = [
- { type: Directive, args: [{
- selector: '[ngModel]:not([formControlName]):not([formControl])',
- providers: [formControlBinding],
- exportAs: 'ngModel'
- },] },
- ];
- /** @nocollapse */
- NgModel.ctorParameters = () => [
- { type: ControlContainer, decorators: [{ type: Optional }, { type: Host },] },
- { type: Array, decorators: [{ type: Optional }, { type: Self }, { type: Inject, args: [NG_VALIDATORS,] },] },
- { type: Array, decorators: [{ type: Optional }, { type: Self }, { type: Inject, args: [NG_ASYNC_VALIDATORS,] },] },
- { type: Array, decorators: [{ type: Optional }, { type: Self }, { type: Inject, args: [NG_VALUE_ACCESSOR,] },] },
- ];
- NgModel.propDecorators = {
- "name": [{ type: Input },],
- "isDisabled": [{ type: Input, args: ['disabled',] },],
- "model": [{ type: Input, args: ['ngModel',] },],
- "options": [{ type: Input, args: ['ngModelOptions',] },],
- "update": [{ type: Output, args: ['ngModelChange',] },],
- };
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. 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
- */
- class ReactiveErrors {
- /**
- * @return {?}
- */
- static controlParentException() {
- throw new Error(`formControlName must be used with a parent formGroup directive. You'll want to add a formGroup
- directive and pass it an existing FormGroup instance (you can create one in your class).
-
- Example:
-
- ${FormErrorExamples.formControlName}`);
- }
- /**
- * @return {?}
- */
- static ngModelGroupException() {
- throw new Error(`formControlName cannot be used with an ngModelGroup parent. It is only compatible with parents
- that also have a "form" prefix: formGroupName, formArrayName, or formGroup.
-
- Option 1: Update the parent to be formGroupName (reactive form strategy)
-
- ${FormErrorExamples.formGroupName}
-
- Option 2: Use ngModel instead of formControlName (template-driven strategy)
-
- ${FormErrorExamples.ngModelGroup}`);
- }
- /**
- * @return {?}
- */
- static missingFormException() {
- throw new Error(`formGroup expects a FormGroup instance. Please pass one in.
-
- Example:
-
- ${FormErrorExamples.formControlName}`);
- }
- /**
- * @return {?}
- */
- static groupParentException() {
- throw new Error(`formGroupName must be used with a parent formGroup directive. You'll want to add a formGroup
- directive and pass it an existing FormGroup instance (you can create one in your class).
-
- Example:
-
- ${FormErrorExamples.formGroupName}`);
- }
- /**
- * @return {?}
- */
- static arrayParentException() {
- throw new Error(`formArrayName must be used with a parent formGroup directive. You'll want to add a formGroup
- directive and pass it an existing FormGroup instance (you can create one in your class).
-
- Example:
-
- ${FormErrorExamples.formArrayName}`);
- }
- /**
- * @return {?}
- */
- static disabledAttrWarning() {
- console.warn(`
- It looks like you're using the disabled attribute with a reactive form directive. If you set disabled to true
- when you set up this control in your component class, the disabled attribute will actually be set in the DOM for
- you. We recommend using this approach to avoid 'changed after checked' errors.
-
- Example:
- form = new FormGroup({
- first: new FormControl({value: 'Nancy', disabled: true}, Validators.required),
- last: new FormControl('Drew', Validators.required)
- });
- `);
- }
- }
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. 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
- */
- const formControlBinding$1 = {
- provide: NgControl,
- useExisting: forwardRef(() => FormControlDirective)
- };
- /**
- * \@whatItDoes Syncs a standalone {\@link FormControl} instance to a form control element.
- *
- * In other words, this directive ensures that any values written to the {\@link FormControl}
- * instance programmatically will be written to the DOM element (model -> view). Conversely,
- * any values written to the DOM element through user input will be reflected in the
- * {\@link FormControl} instance (view -> model).
- *
- * \@howToUse
- *
- * Use this directive if you'd like to create and manage a {\@link FormControl} instance directly.
- * Simply create a {\@link FormControl}, save it to your component class, and pass it into the
- * {\@link FormControlDirective}.
- *
- * This directive is designed to be used as a standalone control. Unlike {\@link FormControlName},
- * it does not require that your {\@link FormControl} instance be part of any parent
- * {\@link FormGroup}, and it won't be registered to any {\@link FormGroupDirective} that
- * exists above it.
- *
- * **Get the value**: the `value` property is always synced and available on the
- * {\@link FormControl} instance. See a full list of available properties in
- * {\@link AbstractControl}.
- *
- * **Set the value**: You can pass in an initial value when instantiating the {\@link FormControl},
- * or you can set it programmatically later using {\@link AbstractControl#setValue setValue} or
- * {\@link AbstractControl#patchValue patchValue}.
- *
- * **Listen to value**: If you want to listen to changes in the value of the control, you can
- * subscribe to the {\@link AbstractControl#valueChanges valueChanges} event. You can also listen to
- * {\@link AbstractControl#statusChanges statusChanges} to be notified when the validation status is
- * re-calculated.
- *
- * ### Example
- *
- * {\@example forms/ts/simpleFormControl/simple_form_control_example.ts region='Component'}
- *
- * * **npm package**: `\@angular/forms`
- *
- * * **NgModule**: `ReactiveFormsModule`
- *
- * \@stable
- */
- class FormControlDirective extends NgControl {
- /**
- * @param {?} validators
- * @param {?} asyncValidators
- * @param {?} valueAccessors
- */
- constructor(validators, asyncValidators, valueAccessors) {
- super();
- this.update = new EventEmitter();
- this._rawValidators = validators || [];
- this._rawAsyncValidators = asyncValidators || [];
- this.valueAccessor = selectValueAccessor(this, valueAccessors);
- }
- /**
- * @param {?} isDisabled
- * @return {?}
- */
- set isDisabled(isDisabled) { ReactiveErrors.disabledAttrWarning(); }
- /**
- * @param {?} changes
- * @return {?}
- */
- ngOnChanges(changes) {
- if (this._isControlChanged(changes)) {
- setUpControl(this.form, this);
- if (this.control.disabled && /** @type {?} */ ((this.valueAccessor)).setDisabledState) {
- /** @type {?} */ ((/** @type {?} */ ((this.valueAccessor)).setDisabledState))(true);
- }
- this.form.updateValueAndValidity({ emitEvent: false });
- }
- if (isPropertyUpdated(changes, this.viewModel)) {
- this.form.setValue(this.model);
- this.viewModel = this.model;
- }
- }
- /**
- * @return {?}
- */
- get path() { return []; }
- /**
- * @return {?}
- */
- get validator() { return composeValidators(this._rawValidators); }
- /**
- * @return {?}
- */
- get asyncValidator() {
- return composeAsyncValidators(this._rawAsyncValidators);
- }
- /**
- * @return {?}
- */
- get control() { return this.form; }
- /**
- * @param {?} newValue
- * @return {?}
- */
- viewToModelUpdate(newValue) {
- this.viewModel = newValue;
- this.update.emit(newValue);
- }
- /**
- * @param {?} changes
- * @return {?}
- */
- _isControlChanged(changes) {
- return changes.hasOwnProperty('form');
- }
- }
- FormControlDirective.decorators = [
- { type: Directive, args: [{ selector: '[formControl]', providers: [formControlBinding$1], exportAs: 'ngForm' },] },
- ];
- /** @nocollapse */
- FormControlDirective.ctorParameters = () => [
- { type: Array, decorators: [{ type: Optional }, { type: Self }, { type: Inject, args: [NG_VALIDATORS,] },] },
- { type: Array, decorators: [{ type: Optional }, { type: Self }, { type: Inject, args: [NG_ASYNC_VALIDATORS,] },] },
- { type: Array, decorators: [{ type: Optional }, { type: Self }, { type: Inject, args: [NG_VALUE_ACCESSOR,] },] },
- ];
- FormControlDirective.propDecorators = {
- "form": [{ type: Input, args: ['formControl',] },],
- "model": [{ type: Input, args: ['ngModel',] },],
- "update": [{ type: Output, args: ['ngModelChange',] },],
- "isDisabled": [{ type: Input, args: ['disabled',] },],
- };
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. 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
- */
- const formDirectiveProvider$1 = {
- provide: ControlContainer,
- useExisting: forwardRef(() => FormGroupDirective)
- };
- /**
- * \@whatItDoes Binds an existing {\@link FormGroup} to a DOM element.
- *
- * \@howToUse
- *
- * This directive accepts an existing {\@link FormGroup} instance. It will then use this
- * {\@link FormGroup} instance to match any child {\@link FormControl}, {\@link FormGroup},
- * and {\@link FormArray} instances to child {\@link FormControlName}, {\@link FormGroupName},
- * and {\@link FormArrayName} directives.
- *
- * **Set value**: You can set the form's initial value when instantiating the
- * {\@link FormGroup}, or you can set it programmatically later using the {\@link FormGroup}'s
- * {\@link AbstractControl#setValue setValue} or {\@link AbstractControl#patchValue patchValue}
- * methods.
- *
- * **Listen to value**: If you want to listen to changes in the value of the form, you can subscribe
- * to the {\@link FormGroup}'s {\@link AbstractControl#valueChanges valueChanges} event. You can also
- * listen to its {\@link AbstractControl#statusChanges statusChanges} event to be notified when the
- * validation status is re-calculated.
- *
- * Furthermore, you can listen to the directive's `ngSubmit` event to be notified when the user has
- * triggered a form submission. The `ngSubmit` event will be emitted with the original form
- * submission event.
- *
- * ### Example
- *
- * In this example, we create form controls for first name and last name.
- *
- * {\@example forms/ts/simpleFormGroup/simple_form_group_example.ts region='Component'}
- *
- * **npm package**: `\@angular/forms`
- *
- * **NgModule**: {\@link ReactiveFormsModule}
- *
- * \@stable
- */
- class FormGroupDirective extends ControlContainer {
- /**
- * @param {?} _validators
- * @param {?} _asyncValidators
- */
- constructor(_validators, _asyncValidators) {
- super();
- this._validators = _validators;
- this._asyncValidators = _asyncValidators;
- this.submitted = false;
- this.directives = [];
- this.form = /** @type {?} */ ((null));
- this.ngSubmit = new EventEmitter();
- }
- /**
- * @param {?} changes
- * @return {?}
- */
- ngOnChanges(changes) {
- this._checkFormPresent();
- if (changes.hasOwnProperty('form')) {
- this._updateValidators();
- this._updateDomValue();
- this._updateRegistrations();
- }
- }
- /**
- * @return {?}
- */
- get formDirective() { return this; }
- /**
- * @return {?}
- */
- get control() { return this.form; }
- /**
- * @return {?}
- */
- get path() { return []; }
- /**
- * @param {?} dir
- * @return {?}
- */
- addControl(dir) {
- const /** @type {?} */ ctrl = this.form.get(dir.path);
- setUpControl(ctrl, dir);
- ctrl.updateValueAndValidity({ emitEvent: false });
- this.directives.push(dir);
- return ctrl;
- }
- /**
- * @param {?} dir
- * @return {?}
- */
- getControl(dir) { return /** @type {?} */ (this.form.get(dir.path)); }
- /**
- * @param {?} dir
- * @return {?}
- */
- removeControl(dir) { removeDir(this.directives, dir); }
- /**
- * @param {?} dir
- * @return {?}
- */
- addFormGroup(dir) {
- const /** @type {?} */ ctrl = this.form.get(dir.path);
- setUpFormContainer(ctrl, dir);
- ctrl.updateValueAndValidity({ emitEvent: false });
- }
- /**
- * @param {?} dir
- * @return {?}
- */
- removeFormGroup(dir) { }
- /**
- * @param {?} dir
- * @return {?}
- */
- getFormGroup(dir) { return /** @type {?} */ (this.form.get(dir.path)); }
- /**
- * @param {?} dir
- * @return {?}
- */
- addFormArray(dir) {
- const /** @type {?} */ ctrl = this.form.get(dir.path);
- setUpFormContainer(ctrl, dir);
- ctrl.updateValueAndValidity({ emitEvent: false });
- }
- /**
- * @param {?} dir
- * @return {?}
- */
- removeFormArray(dir) { }
- /**
- * @param {?} dir
- * @return {?}
- */
- getFormArray(dir) { return /** @type {?} */ (this.form.get(dir.path)); }
- /**
- * @param {?} dir
- * @param {?} value
- * @return {?}
- */
- updateModel(dir, value) {
- const /** @type {?} */ ctrl = /** @type {?} */ (this.form.get(dir.path));
- ctrl.setValue(value);
- }
- /**
- * @param {?} $event
- * @return {?}
- */
- onSubmit($event) {
- (/** @type {?} */ (this)).submitted = true;
- syncPendingControls(this.form, this.directives);
- this.ngSubmit.emit($event);
- return false;
- }
- /**
- * @return {?}
- */
- onReset() { this.resetForm(); }
- /**
- * @param {?=} value
- * @return {?}
- */
- resetForm(value = undefined) {
- this.form.reset(value);
- (/** @type {?} */ (this)).submitted = false;
- }
- /**
- * \@internal
- * @return {?}
- */
- _updateDomValue() {
- this.directives.forEach(dir => {
- const /** @type {?} */ newCtrl = this.form.get(dir.path);
- if (dir.control !== newCtrl) {
- cleanUpControl(dir.control, dir);
- if (newCtrl)
- setUpControl(newCtrl, dir);
- (/** @type {?} */ (dir)).control = newCtrl;
- }
- });
- this.form._updateTreeValidity({ emitEvent: false });
- }
- /**
- * @return {?}
- */
- _updateRegistrations() {
- this.form._registerOnCollectionChange(() => this._updateDomValue());
- if (this._oldForm)
- this._oldForm._registerOnCollectionChange(() => { });
- this._oldForm = this.form;
- }
- /**
- * @return {?}
- */
- _updateValidators() {
- const /** @type {?} */ sync = composeValidators(this._validators);
- this.form.validator = Validators.compose([/** @type {?} */ ((this.form.validator)), /** @type {?} */ ((sync))]);
- const /** @type {?} */ async = composeAsyncValidators(this._asyncValidators);
- this.form.asyncValidator = Validators.composeAsync([/** @type {?} */ ((this.form.asyncValidator)), /** @type {?} */ ((async))]);
- }
- /**
- * @return {?}
- */
- _checkFormPresent() {
- if (!this.form) {
- ReactiveErrors.missingFormException();
- }
- }
- }
- FormGroupDirective.decorators = [
- { type: Directive, args: [{
- selector: '[formGroup]',
- providers: [formDirectiveProvider$1],
- host: { '(submit)': 'onSubmit($event)', '(reset)': 'onReset()' },
- exportAs: 'ngForm'
- },] },
- ];
- /** @nocollapse */
- FormGroupDirective.ctorParameters = () => [
- { type: Array, decorators: [{ type: Optional }, { type: Self }, { type: Inject, args: [NG_VALIDATORS,] },] },
- { type: Array, decorators: [{ type: Optional }, { type: Self }, { type: Inject, args: [NG_ASYNC_VALIDATORS,] },] },
- ];
- FormGroupDirective.propDecorators = {
- "form": [{ type: Input, args: ['formGroup',] },],
- "ngSubmit": [{ type: Output },],
- };
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. 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
- */
- const formGroupNameProvider = {
- provide: ControlContainer,
- useExisting: forwardRef(() => FormGroupName)
- };
- /**
- * \@whatItDoes Syncs a nested {\@link FormGroup} to a DOM element.
- *
- * \@howToUse
- *
- * This directive can only be used with a parent {\@link FormGroupDirective} (selector:
- * `[formGroup]`).
- *
- * It accepts the string name of the nested {\@link FormGroup} you want to link, and
- * will look for a {\@link FormGroup} registered with that name in the parent
- * {\@link FormGroup} instance you passed into {\@link FormGroupDirective}.
- *
- * Nested form groups can come in handy when you want to validate a sub-group of a
- * form separately from the rest or when you'd like to group the values of certain
- * controls into their own nested object.
- *
- * **Access the group**: You can access the associated {\@link FormGroup} using the
- * {\@link AbstractControl#get get} method. Ex: `this.form.get('name')`.
- *
- * You can also access individual controls within the group using dot syntax.
- * Ex: `this.form.get('name.first')`
- *
- * **Get the value**: the `value` property is always synced and available on the
- * {\@link FormGroup}. See a full list of available properties in {\@link AbstractControl}.
- *
- * **Set the value**: You can set an initial value for each child control when instantiating
- * the {\@link FormGroup}, or you can set it programmatically later using
- * {\@link AbstractControl#setValue setValue} or {\@link AbstractControl#patchValue patchValue}.
- *
- * **Listen to value**: If you want to listen to changes in the value of the group, you can
- * subscribe to the {\@link AbstractControl#valueChanges valueChanges} event. You can also listen to
- * {\@link AbstractControl#statusChanges statusChanges} to be notified when the validation status is
- * re-calculated.
- *
- * ### Example
- *
- * {\@example forms/ts/nestedFormGroup/nested_form_group_example.ts region='Component'}
- *
- * * **npm package**: `\@angular/forms`
- *
- * * **NgModule**: `ReactiveFormsModule`
- *
- * \@stable
- */
- class FormGroupName extends AbstractFormGroupDirective {
- /**
- * @param {?} parent
- * @param {?} validators
- * @param {?} asyncValidators
- */
- constructor(parent, validators, asyncValidators) {
- super();
- this._parent = parent;
- this._validators = validators;
- this._asyncValidators = asyncValidators;
- }
- /**
- * \@internal
- * @return {?}
- */
- _checkParentType() {
- if (_hasInvalidParent(this._parent)) {
- ReactiveErrors.groupParentException();
- }
- }
- }
- FormGroupName.decorators = [
- { type: Directive, args: [{ selector: '[formGroupName]', providers: [formGroupNameProvider] },] },
- ];
- /** @nocollapse */
- FormGroupName.ctorParameters = () => [
- { type: ControlContainer, decorators: [{ type: Optional }, { type: Host }, { type: SkipSelf },] },
- { type: Array, decorators: [{ type: Optional }, { type: Self }, { type: Inject, args: [NG_VALIDATORS,] },] },
- { type: Array, decorators: [{ type: Optional }, { type: Self }, { type: Inject, args: [NG_ASYNC_VALIDATORS,] },] },
- ];
- FormGroupName.propDecorators = {
- "name": [{ type: Input, args: ['formGroupName',] },],
- };
- const formArrayNameProvider = {
- provide: ControlContainer,
- useExisting: forwardRef(() => FormArrayName)
- };
- /**
- * \@whatItDoes Syncs a nested {\@link FormArray} to a DOM element.
- *
- * \@howToUse
- *
- * This directive is designed to be used with a parent {\@link FormGroupDirective} (selector:
- * `[formGroup]`).
- *
- * It accepts the string name of the nested {\@link FormArray} you want to link, and
- * will look for a {\@link FormArray} registered with that name in the parent
- * {\@link FormGroup} instance you passed into {\@link FormGroupDirective}.
- *
- * Nested form arrays can come in handy when you have a group of form controls but
- * you're not sure how many there will be. Form arrays allow you to create new
- * form controls dynamically.
- *
- * **Access the array**: You can access the associated {\@link FormArray} using the
- * {\@link AbstractControl#get get} method on the parent {\@link FormGroup}.
- * Ex: `this.form.get('cities')`.
- *
- * **Get the value**: the `value` property is always synced and available on the
- * {\@link FormArray}. See a full list of available properties in {\@link AbstractControl}.
- *
- * **Set the value**: You can set an initial value for each child control when instantiating
- * the {\@link FormArray}, or you can set the value programmatically later using the
- * {\@link FormArray}'s {\@link AbstractControl#setValue setValue} or
- * {\@link AbstractControl#patchValue patchValue} methods.
- *
- * **Listen to value**: If you want to listen to changes in the value of the array, you can
- * subscribe to the {\@link FormArray}'s {\@link AbstractControl#valueChanges valueChanges} event.
- * You can also listen to its {\@link AbstractControl#statusChanges statusChanges} event to be
- * notified when the validation status is re-calculated.
- *
- * **Add new controls**: You can add new controls to the {\@link FormArray} dynamically by calling
- * its {\@link FormArray#push push} method.
- * Ex: `this.form.get('cities').push(new FormControl());`
- *
- * ### Example
- *
- * {\@example forms/ts/nestedFormArray/nested_form_array_example.ts region='Component'}
- *
- * * **npm package**: `\@angular/forms`
- *
- * * **NgModule**: `ReactiveFormsModule`
- *
- * \@stable
- */
- class FormArrayName extends ControlContainer {
- /**
- * @param {?} parent
- * @param {?} validators
- * @param {?} asyncValidators
- */
- constructor(parent, validators, asyncValidators) {
- super();
- this._parent = parent;
- this._validators = validators;
- this._asyncValidators = asyncValidators;
- }
- /**
- * @return {?}
- */
- ngOnInit() {
- this._checkParentType(); /** @type {?} */
- ((this.formDirective)).addFormArray(this);
- }
- /**
- * @return {?}
- */
- ngOnDestroy() {
- if (this.formDirective) {
- this.formDirective.removeFormArray(this);
- }
- }
- /**
- * @return {?}
- */
- get control() { return /** @type {?} */ ((this.formDirective)).getFormArray(this); }
- /**
- * @return {?}
- */
- get formDirective() {
- return this._parent ? /** @type {?} */ (this._parent.formDirective) : null;
- }
- /**
- * @return {?}
- */
- get path() { return controlPath(this.name, this._parent); }
- /**
- * @return {?}
- */
- get validator() { return composeValidators(this._validators); }
- /**
- * @return {?}
- */
- get asyncValidator() {
- return composeAsyncValidators(this._asyncValidators);
- }
- /**
- * @return {?}
- */
- _checkParentType() {
- if (_hasInvalidParent(this._parent)) {
- ReactiveErrors.arrayParentException();
- }
- }
- }
- FormArrayName.decorators = [
- { type: Directive, args: [{ selector: '[formArrayName]', providers: [formArrayNameProvider] },] },
- ];
- /** @nocollapse */
- FormArrayName.ctorParameters = () => [
- { type: ControlContainer, decorators: [{ type: Optional }, { type: Host }, { type: SkipSelf },] },
- { type: Array, decorators: [{ type: Optional }, { type: Self }, { type: Inject, args: [NG_VALIDATORS,] },] },
- { type: Array, decorators: [{ type: Optional }, { type: Self }, { type: Inject, args: [NG_ASYNC_VALIDATORS,] },] },
- ];
- FormArrayName.propDecorators = {
- "name": [{ type: Input, args: ['formArrayName',] },],
- };
- /**
- * @param {?} parent
- * @return {?}
- */
- function _hasInvalidParent(parent) {
- return !(parent instanceof FormGroupName) && !(parent instanceof FormGroupDirective) &&
- !(parent instanceof FormArrayName);
- }
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. 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
- */
- const controlNameBinding = {
- provide: NgControl,
- useExisting: forwardRef(() => FormControlName)
- };
- /**
- * \@whatItDoes Syncs a {\@link FormControl} in an existing {\@link FormGroup} to a form control
- * element by name.
- *
- * In other words, this directive ensures that any values written to the {\@link FormControl}
- * instance programmatically will be written to the DOM element (model -> view). Conversely,
- * any values written to the DOM element through user input will be reflected in the
- * {\@link FormControl} instance (view -> model).
- *
- * \@howToUse
- *
- * This directive is designed to be used with a parent {\@link FormGroupDirective} (selector:
- * `[formGroup]`).
- *
- * It accepts the string name of the {\@link FormControl} instance you want to
- * link, and will look for a {\@link FormControl} registered with that name in the
- * closest {\@link FormGroup} or {\@link FormArray} above it.
- *
- * **Access the control**: You can access the {\@link FormControl} associated with
- * this directive by using the {\@link AbstractControl#get get} method.
- * Ex: `this.form.get('first');`
- *
- * **Get value**: the `value` property is always synced and available on the {\@link FormControl}.
- * See a full list of available properties in {\@link AbstractControl}.
- *
- * **Set value**: You can set an initial value for the control when instantiating the
- * {\@link FormControl}, or you can set it programmatically later using
- * {\@link AbstractControl#setValue setValue} or {\@link AbstractControl#patchValue patchValue}.
- *
- * **Listen to value**: If you want to listen to changes in the value of the control, you can
- * subscribe to the {\@link AbstractControl#valueChanges valueChanges} event. You can also listen to
- * {\@link AbstractControl#statusChanges statusChanges} to be notified when the validation status is
- * re-calculated.
- *
- * ### Example
- *
- * In this example, we create form controls for first name and last name.
- *
- * {\@example forms/ts/simpleFormGroup/simple_form_group_example.ts region='Component'}
- *
- * To see `formControlName` examples with different form control types, see:
- *
- * * Radio buttons: {\@link RadioControlValueAccessor}
- * * Selects: {\@link SelectControlValueAccessor}
- *
- * **npm package**: `\@angular/forms`
- *
- * **NgModule**: {\@link ReactiveFormsModule}
- *
- * \@stable
- */
- class FormControlName extends NgControl {
- /**
- * @param {?} parent
- * @param {?} validators
- * @param {?} asyncValidators
- * @param {?} valueAccessors
- */
- constructor(parent, validators, asyncValidators, valueAccessors) {
- super();
- this._added = false;
- this.update = new EventEmitter();
- this._parent = parent;
- this._rawValidators = validators || [];
- this._rawAsyncValidators = asyncValidators || [];
- this.valueAccessor = selectValueAccessor(this, valueAccessors);
- }
- /**
- * @param {?} isDisabled
- * @return {?}
- */
- set isDisabled(isDisabled) { ReactiveErrors.disabledAttrWarning(); }
- /**
- * @param {?} changes
- * @return {?}
- */
- ngOnChanges(changes) {
- if (!this._added)
- this._setUpControl();
- if (isPropertyUpdated(changes, this.viewModel)) {
- this.viewModel = this.model;
- this.formDirective.updateModel(this, this.model);
- }
- }
- /**
- * @return {?}
- */
- ngOnDestroy() {
- if (this.formDirective) {
- this.formDirective.removeControl(this);
- }
- }
- /**
- * @param {?} newValue
- * @return {?}
- */
- viewToModelUpdate(newValue) {
- this.viewModel = newValue;
- this.update.emit(newValue);
- }
- /**
- * @return {?}
- */
- get path() { return controlPath(this.name, /** @type {?} */ ((this._parent))); }
- /**
- * @return {?}
- */
- get formDirective() { return this._parent ? this._parent.formDirective : null; }
- /**
- * @return {?}
- */
- get validator() { return composeValidators(this._rawValidators); }
- /**
- * @return {?}
- */
- get asyncValidator() {
- return /** @type {?} */ ((composeAsyncValidators(this._rawAsyncValidators)));
- }
- /**
- * @return {?}
- */
- _checkParentType() {
- if (!(this._parent instanceof FormGroupName) &&
- this._parent instanceof AbstractFormGroupDirective) {
- ReactiveErrors.ngModelGroupException();
- }
- else if (!(this._parent instanceof FormGroupName) && !(this._parent instanceof FormGroupDirective) &&
- !(this._parent instanceof FormArrayName)) {
- ReactiveErrors.controlParentException();
- }
- }
- /**
- * @return {?}
- */
- _setUpControl() {
- this._checkParentType();
- (/** @type {?} */ (this)).control = this.formDirective.addControl(this);
- if (this.control.disabled && /** @type {?} */ ((this.valueAccessor)).setDisabledState) {
- /** @type {?} */ ((/** @type {?} */ ((this.valueAccessor)).setDisabledState))(true);
- }
- this._added = true;
- }
- }
- FormControlName.decorators = [
- { type: Directive, args: [{ selector: '[formControlName]', providers: [controlNameBinding] },] },
- ];
- /** @nocollapse */
- FormControlName.ctorParameters = () => [
- { type: ControlContainer, decorators: [{ type: Optional }, { type: Host }, { type: SkipSelf },] },
- { type: Array, decorators: [{ type: Optional }, { type: Self }, { type: Inject, args: [NG_VALIDATORS,] },] },
- { type: Array, decorators: [{ type: Optional }, { type: Self }, { type: Inject, args: [NG_ASYNC_VALIDATORS,] },] },
- { type: Array, decorators: [{ type: Optional }, { type: Self }, { type: Inject, args: [NG_VALUE_ACCESSOR,] },] },
- ];
- FormControlName.propDecorators = {
- "name": [{ type: Input, args: ['formControlName',] },],
- "model": [{ type: Input, args: ['ngModel',] },],
- "update": [{ type: Output, args: ['ngModelChange',] },],
- "isDisabled": [{ type: Input, args: ['disabled',] },],
- };
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. 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
- */
- /**
- * An interface that can be implemented by classes that can act as validators.
- *
- * ## Usage
- *
- * ```typescript
- * \@Directive({
- * selector: '[custom-validator]',
- * providers: [{provide: NG_VALIDATORS, useExisting: CustomValidatorDirective, multi: true}]
- * })
- * class CustomValidatorDirective implements Validator {
- * validate(c: Control): {[key: string]: any} {
- * return {"custom": true};
- * }
- * }
- * ```
- *
- * \@stable
- * @record
- */
-
- /**
- * \@experimental
- * @record
- */
-
- const REQUIRED_VALIDATOR = {
- provide: NG_VALIDATORS,
- useExisting: forwardRef(() => RequiredValidator),
- multi: true
- };
- const CHECKBOX_REQUIRED_VALIDATOR = {
- provide: NG_VALIDATORS,
- useExisting: forwardRef(() => CheckboxRequiredValidator),
- multi: true
- };
- /**
- * A Directive that adds the `required` validator to any controls marked with the
- * `required` attribute, via the {\@link NG_VALIDATORS} binding.
- *
- * ### Example
- *
- * ```
- * <input name="fullName" ngModel required>
- * ```
- *
- * \@stable
- */
- class RequiredValidator {
- /**
- * @return {?}
- */
- get required() { return this._required; }
- /**
- * @param {?} value
- * @return {?}
- */
- set required(value) {
- this._required = value != null && value !== false && `${value}` !== 'false';
- if (this._onChange)
- this._onChange();
- }
- /**
- * @param {?} c
- * @return {?}
- */
- validate(c) {
- return this.required ? Validators.required(c) : null;
- }
- /**
- * @param {?} fn
- * @return {?}
- */
- registerOnValidatorChange(fn) { this._onChange = fn; }
- }
- RequiredValidator.decorators = [
- { type: Directive, args: [{
- selector: ':not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]',
- providers: [REQUIRED_VALIDATOR],
- host: { '[attr.required]': 'required ? "" : null' }
- },] },
- ];
- /** @nocollapse */
- RequiredValidator.ctorParameters = () => [];
- RequiredValidator.propDecorators = {
- "required": [{ type: Input },],
- };
- /**
- * A Directive that adds the `required` validator to checkbox controls marked with the
- * `required` attribute, via the {\@link NG_VALIDATORS} binding.
- *
- * ### Example
- *
- * ```
- * <input type="checkbox" name="active" ngModel required>
- * ```
- *
- * \@experimental
- */
- class CheckboxRequiredValidator extends RequiredValidator {
- /**
- * @param {?} c
- * @return {?}
- */
- validate(c) {
- return this.required ? Validators.requiredTrue(c) : null;
- }
- }
- CheckboxRequiredValidator.decorators = [
- { type: Directive, args: [{
- selector: 'input[type=checkbox][required][formControlName],input[type=checkbox][required][formControl],input[type=checkbox][required][ngModel]',
- providers: [CHECKBOX_REQUIRED_VALIDATOR],
- host: { '[attr.required]': 'required ? "" : null' }
- },] },
- ];
- /** @nocollapse */
- CheckboxRequiredValidator.ctorParameters = () => [];
- /**
- * Provider which adds {\@link EmailValidator} to {\@link NG_VALIDATORS}.
- */
- const EMAIL_VALIDATOR = {
- provide: NG_VALIDATORS,
- useExisting: forwardRef(() => EmailValidator),
- multi: true
- };
- /**
- * A Directive that adds the `email` validator to controls marked with the
- * `email` attribute, via the {\@link NG_VALIDATORS} binding.
- *
- * ### Example
- *
- * ```
- * <input type="email" name="email" ngModel email>
- * <input type="email" name="email" ngModel email="true">
- * <input type="email" name="email" ngModel [email]="true">
- * ```
- *
- * \@experimental
- */
- class EmailValidator {
- /**
- * @param {?} value
- * @return {?}
- */
- set email(value) {
- this._enabled = value === '' || value === true || value === 'true';
- if (this._onChange)
- this._onChange();
- }
- /**
- * @param {?} c
- * @return {?}
- */
- validate(c) {
- return this._enabled ? Validators.email(c) : null;
- }
- /**
- * @param {?} fn
- * @return {?}
- */
- registerOnValidatorChange(fn) { this._onChange = fn; }
- }
- EmailValidator.decorators = [
- { type: Directive, args: [{
- selector: '[email][formControlName],[email][formControl],[email][ngModel]',
- providers: [EMAIL_VALIDATOR]
- },] },
- ];
- /** @nocollapse */
- EmailValidator.ctorParameters = () => [];
- EmailValidator.propDecorators = {
- "email": [{ type: Input },],
- };
- /**
- * \@stable
- * @record
- */
-
- /**
- * \@stable
- * @record
- */
-
- /**
- * Provider which adds {\@link MinLengthValidator} to {\@link NG_VALIDATORS}.
- *
- * ## Example:
- *
- * {\@example common/forms/ts/validators/validators.ts region='min'}
- */
- const MIN_LENGTH_VALIDATOR = {
- provide: NG_VALIDATORS,
- useExisting: forwardRef(() => MinLengthValidator),
- multi: true
- };
- /**
- * A directive which installs the {\@link MinLengthValidator} for any `formControlName`,
- * `formControl`, or control with `ngModel` that also has a `minlength` attribute.
- *
- * \@stable
- */
- class MinLengthValidator {
- /**
- * @param {?} changes
- * @return {?}
- */
- ngOnChanges(changes) {
- if ('minlength' in changes) {
- this._createValidator();
- if (this._onChange)
- this._onChange();
- }
- }
- /**
- * @param {?} c
- * @return {?}
- */
- validate(c) {
- return this.minlength == null ? null : this._validator(c);
- }
- /**
- * @param {?} fn
- * @return {?}
- */
- registerOnValidatorChange(fn) { this._onChange = fn; }
- /**
- * @return {?}
- */
- _createValidator() {
- this._validator = Validators.minLength(parseInt(this.minlength, 10));
- }
- }
- MinLengthValidator.decorators = [
- { type: Directive, args: [{
- selector: '[minlength][formControlName],[minlength][formControl],[minlength][ngModel]',
- providers: [MIN_LENGTH_VALIDATOR],
- host: { '[attr.minlength]': 'minlength ? minlength : null' }
- },] },
- ];
- /** @nocollapse */
- MinLengthValidator.ctorParameters = () => [];
- MinLengthValidator.propDecorators = {
- "minlength": [{ type: Input },],
- };
- /**
- * Provider which adds {\@link MaxLengthValidator} to {\@link NG_VALIDATORS}.
- *
- * ## Example:
- *
- * {\@example common/forms/ts/validators/validators.ts region='max'}
- */
- const MAX_LENGTH_VALIDATOR = {
- provide: NG_VALIDATORS,
- useExisting: forwardRef(() => MaxLengthValidator),
- multi: true
- };
- /**
- * A directive which installs the {\@link MaxLengthValidator} for any `formControlName,
- * `formControl`,
- * or control with `ngModel` that also has a `maxlength` attribute.
- *
- * \@stable
- */
- class MaxLengthValidator {
- /**
- * @param {?} changes
- * @return {?}
- */
- ngOnChanges(changes) {
- if ('maxlength' in changes) {
- this._createValidator();
- if (this._onChange)
- this._onChange();
- }
- }
- /**
- * @param {?} c
- * @return {?}
- */
- validate(c) {
- return this.maxlength != null ? this._validator(c) : null;
- }
- /**
- * @param {?} fn
- * @return {?}
- */
- registerOnValidatorChange(fn) { this._onChange = fn; }
- /**
- * @return {?}
- */
- _createValidator() {
- this._validator = Validators.maxLength(parseInt(this.maxlength, 10));
- }
- }
- MaxLengthValidator.decorators = [
- { type: Directive, args: [{
- selector: '[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]',
- providers: [MAX_LENGTH_VALIDATOR],
- host: { '[attr.maxlength]': 'maxlength ? maxlength : null' }
- },] },
- ];
- /** @nocollapse */
- MaxLengthValidator.ctorParameters = () => [];
- MaxLengthValidator.propDecorators = {
- "maxlength": [{ type: Input },],
- };
- const PATTERN_VALIDATOR = {
- provide: NG_VALIDATORS,
- useExisting: forwardRef(() => PatternValidator),
- multi: true
- };
- /**
- * A Directive that adds the `pattern` validator to any controls marked with the
- * `pattern` attribute, via the {\@link NG_VALIDATORS} binding. Uses attribute value
- * as the regex to validate Control value against. Follows pattern attribute
- * semantics; i.e. regex must match entire Control value.
- *
- * ### Example
- *
- * ```
- * <input [name]="fullName" pattern="[a-zA-Z ]*" ngModel>
- * ```
- * \@stable
- */
- class PatternValidator {
- /**
- * @param {?} changes
- * @return {?}
- */
- ngOnChanges(changes) {
- if ('pattern' in changes) {
- this._createValidator();
- if (this._onChange)
- this._onChange();
- }
- }
- /**
- * @param {?} c
- * @return {?}
- */
- validate(c) { return this._validator(c); }
- /**
- * @param {?} fn
- * @return {?}
- */
- registerOnValidatorChange(fn) { this._onChange = fn; }
- /**
- * @return {?}
- */
- _createValidator() { this._validator = Validators.pattern(this.pattern); }
- }
- PatternValidator.decorators = [
- { type: Directive, args: [{
- selector: '[pattern][formControlName],[pattern][formControl],[pattern][ngModel]',
- providers: [PATTERN_VALIDATOR],
- host: { '[attr.pattern]': 'pattern ? pattern : null' }
- },] },
- ];
- /** @nocollapse */
- PatternValidator.ctorParameters = () => [];
- PatternValidator.propDecorators = {
- "pattern": [{ type: Input },],
- };
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. 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
- */
- /**
- * \@whatItDoes Creates an {\@link AbstractControl} from a user-specified configuration.
- *
- * It is essentially syntactic sugar that shortens the `new FormGroup()`,
- * `new FormControl()`, and `new FormArray()` boilerplate that can build up in larger
- * forms.
- *
- * \@howToUse
- *
- * To use, inject `FormBuilder` into your component class. You can then call its methods
- * directly.
- *
- * {\@example forms/ts/formBuilder/form_builder_example.ts region='Component'}
- *
- * * **npm package**: `\@angular/forms`
- *
- * * **NgModule**: {\@link ReactiveFormsModule}
- *
- * \@stable
- */
- class FormBuilder {
- /**
- * Construct a new {\@link FormGroup} with the given map of configuration.
- * Valid keys for the `extra` parameter map are `validator` and `asyncValidator`.
- *
- * See the {\@link FormGroup} constructor for more details.
- * @param {?} controlsConfig
- * @param {?=} extra
- * @return {?}
- */
- group(controlsConfig, extra = null) {
- const /** @type {?} */ controls = this._reduceControls(controlsConfig);
- const /** @type {?} */ validator = extra != null ? extra['validator'] : null;
- const /** @type {?} */ asyncValidator = extra != null ? extra['asyncValidator'] : null;
- return new FormGroup(controls, validator, asyncValidator);
- }
- /**
- * Construct a new {\@link FormControl} with the given `formState`,`validator`, and
- * `asyncValidator`.
- *
- * `formState` can either be a standalone value for the form control or an object
- * that contains both a value and a disabled status.
- *
- * @param {?} formState
- * @param {?=} validator
- * @param {?=} asyncValidator
- * @return {?}
- */
- control(formState, validator, asyncValidator) {
- return new FormControl(formState, validator, asyncValidator);
- }
- /**
- * Construct a {\@link FormArray} from the given `controlsConfig` array of
- * configuration, with the given optional `validator` and `asyncValidator`.
- * @param {?} controlsConfig
- * @param {?=} validator
- * @param {?=} asyncValidator
- * @return {?}
- */
- array(controlsConfig, validator, asyncValidator) {
- const /** @type {?} */ controls = controlsConfig.map(c => this._createControl(c));
- return new FormArray(controls, validator, asyncValidator);
- }
- /**
- * \@internal
- * @param {?} controlsConfig
- * @return {?}
- */
- _reduceControls(controlsConfig) {
- const /** @type {?} */ controls = {};
- Object.keys(controlsConfig).forEach(controlName => {
- controls[controlName] = this._createControl(controlsConfig[controlName]);
- });
- return controls;
- }
- /**
- * \@internal
- * @param {?} controlConfig
- * @return {?}
- */
- _createControl(controlConfig) {
- if (controlConfig instanceof FormControl || controlConfig instanceof FormGroup ||
- controlConfig instanceof FormArray) {
- return controlConfig;
- }
- else if (Array.isArray(controlConfig)) {
- const /** @type {?} */ value = controlConfig[0];
- const /** @type {?} */ validator = controlConfig.length > 1 ? controlConfig[1] : null;
- const /** @type {?} */ asyncValidator = controlConfig.length > 2 ? controlConfig[2] : null;
- return this.control(value, validator, asyncValidator);
- }
- else {
- return this.control(controlConfig);
- }
- }
- }
- FormBuilder.decorators = [
- { type: Injectable },
- ];
- /** @nocollapse */
- FormBuilder.ctorParameters = () => [];
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. 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
- */
- /**
- * \@stable
- */
- const VERSION = new Version('5.2.11');
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. 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
- */
- /**
- * \@whatItDoes Adds `novalidate` attribute to all forms by default.
- *
- * `novalidate` is used to disable browser's native form validation.
- *
- * If you want to use native validation with Angular forms, just add `ngNativeValidate` attribute:
- *
- * ```
- * <form ngNativeValidate></form>
- * ```
- *
- * \@experimental
- */
- class NgNoValidate {
- }
- NgNoValidate.decorators = [
- { type: Directive, args: [{
- selector: 'form:not([ngNoForm]):not([ngNativeValidate])',
- host: { 'novalidate': '' },
- },] },
- ];
- /** @nocollapse */
- NgNoValidate.ctorParameters = () => [];
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. 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
- */
- const SHARED_FORM_DIRECTIVES = [
- NgNoValidate,
- NgSelectOption,
- NgSelectMultipleOption,
- DefaultValueAccessor,
- NumberValueAccessor,
- RangeValueAccessor,
- CheckboxControlValueAccessor,
- SelectControlValueAccessor,
- SelectMultipleControlValueAccessor,
- RadioControlValueAccessor,
- NgControlStatus,
- NgControlStatusGroup,
- RequiredValidator,
- MinLengthValidator,
- MaxLengthValidator,
- PatternValidator,
- CheckboxRequiredValidator,
- EmailValidator,
- ];
- const TEMPLATE_DRIVEN_DIRECTIVES = [NgModel, NgModelGroup, NgForm];
- const REACTIVE_DRIVEN_DIRECTIVES = [FormControlDirective, FormGroupDirective, FormControlName, FormGroupName, FormArrayName];
- /**
- * Internal module used for sharing directives between FormsModule and ReactiveFormsModule
- */
- class InternalFormsSharedModule {
- }
- InternalFormsSharedModule.decorators = [
- { type: NgModule, args: [{
- declarations: SHARED_FORM_DIRECTIVES,
- exports: SHARED_FORM_DIRECTIVES,
- },] },
- ];
- /** @nocollapse */
- InternalFormsSharedModule.ctorParameters = () => [];
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. 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
- */
- /**
- * The ng module for forms.
- * \@stable
- */
- class FormsModule {
- }
- FormsModule.decorators = [
- { type: NgModule, args: [{
- declarations: TEMPLATE_DRIVEN_DIRECTIVES,
- providers: [RadioControlRegistry],
- exports: [InternalFormsSharedModule, TEMPLATE_DRIVEN_DIRECTIVES]
- },] },
- ];
- /** @nocollapse */
- FormsModule.ctorParameters = () => [];
- /**
- * The ng module for reactive forms.
- * \@stable
- */
- class ReactiveFormsModule {
- }
- ReactiveFormsModule.decorators = [
- { type: NgModule, args: [{
- declarations: [REACTIVE_DRIVEN_DIRECTIVES],
- providers: [FormBuilder, RadioControlRegistry],
- exports: [InternalFormsSharedModule, REACTIVE_DRIVEN_DIRECTIVES]
- },] },
- ];
- /** @nocollapse */
- ReactiveFormsModule.ctorParameters = () => [];
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. 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
- */
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. 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
- */
- /**
- * @module
- * @description
- * Entry point for all public APIs of this package.
- */
-
- // This file only reexports content of the `src` folder. Keep it that way.
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * Generated bundle index. Do not edit.
- */
-
- export { AbstractControlDirective, AbstractFormGroupDirective, CheckboxControlValueAccessor, ControlContainer, NG_VALUE_ACCESSOR, COMPOSITION_BUFFER_MODE, DefaultValueAccessor, NgControl, NgControlStatus, NgControlStatusGroup, NgForm, NgModel, NgModelGroup, RadioControlValueAccessor, FormControlDirective, FormControlName, FormGroupDirective, FormArrayName, FormGroupName, NgSelectOption, SelectControlValueAccessor, SelectMultipleControlValueAccessor, CheckboxRequiredValidator, EmailValidator, MaxLengthValidator, MinLengthValidator, PatternValidator, RequiredValidator, FormBuilder, AbstractControl, FormArray, FormControl, FormGroup, NG_ASYNC_VALIDATORS, NG_VALIDATORS, Validators, VERSION, FormsModule, ReactiveFormsModule, InternalFormsSharedModule as ɵba, REACTIVE_DRIVEN_DIRECTIVES as ɵz, SHARED_FORM_DIRECTIVES as ɵx, TEMPLATE_DRIVEN_DIRECTIVES as ɵy, CHECKBOX_VALUE_ACCESSOR as ɵa, DEFAULT_VALUE_ACCESSOR as ɵb, AbstractControlStatus as ɵc, ngControlStatusHost as ɵd, formDirectiveProvider as ɵe, formControlBinding as ɵf, modelGroupProvider as ɵg, NgNoValidate as ɵbf, NUMBER_VALUE_ACCESSOR as ɵbb, NumberValueAccessor as ɵbc, RADIO_VALUE_ACCESSOR as ɵh, RadioControlRegistry as ɵi, RANGE_VALUE_ACCESSOR as ɵbd, RangeValueAccessor as ɵbe, formControlBinding$1 as ɵj, controlNameBinding as ɵk, formDirectiveProvider$1 as ɵl, formArrayNameProvider as ɵn, formGroupNameProvider as ɵm, SELECT_VALUE_ACCESSOR as ɵo, NgSelectMultipleOption as ɵq, SELECT_MULTIPLE_VALUE_ACCESSOR as ɵp, CHECKBOX_REQUIRED_VALIDATOR as ɵs, EMAIL_VALIDATOR as ɵt, MAX_LENGTH_VALIDATOR as ɵv, MIN_LENGTH_VALIDATOR as ɵu, PATTERN_VALIDATOR as ɵw, REQUIRED_VALIDATOR as ɵr };
- //# sourceMappingURL=forms.js.map
|