vant.js 584 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076
  1. (function webpackUniversalModuleDefinition(root, factory) {
  2. if(typeof exports === 'object' && typeof module === 'object')
  3. module.exports = factory(require("vue"));
  4. else if(typeof define === 'function' && define.amd)
  5. define("vant", ["vue"], factory);
  6. else if(typeof exports === 'object')
  7. exports["vant"] = factory(require("vue"));
  8. else
  9. root["vant"] = factory(root["Vue"]);
  10. })(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE__3__) {
  11. return /******/ (function(modules) { // webpackBootstrap
  12. /******/ // The module cache
  13. /******/ var installedModules = {};
  14. /******/
  15. /******/ // The require function
  16. /******/ function __webpack_require__(moduleId) {
  17. /******/
  18. /******/ // Check if module is in cache
  19. /******/ if(installedModules[moduleId]) {
  20. /******/ return installedModules[moduleId].exports;
  21. /******/ }
  22. /******/ // Create a new module (and put it into the cache)
  23. /******/ var module = installedModules[moduleId] = {
  24. /******/ i: moduleId,
  25. /******/ l: false,
  26. /******/ exports: {}
  27. /******/ };
  28. /******/
  29. /******/ // Execute the module function
  30. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  31. /******/
  32. /******/ // Flag the module as loaded
  33. /******/ module.l = true;
  34. /******/
  35. /******/ // Return the exports of the module
  36. /******/ return module.exports;
  37. /******/ }
  38. /******/
  39. /******/
  40. /******/ // expose the modules object (__webpack_modules__)
  41. /******/ __webpack_require__.m = modules;
  42. /******/
  43. /******/ // expose the module cache
  44. /******/ __webpack_require__.c = installedModules;
  45. /******/
  46. /******/ // define getter function for harmony exports
  47. /******/ __webpack_require__.d = function(exports, name, getter) {
  48. /******/ if(!__webpack_require__.o(exports, name)) {
  49. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  50. /******/ }
  51. /******/ };
  52. /******/
  53. /******/ // define __esModule on exports
  54. /******/ __webpack_require__.r = function(exports) {
  55. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  56. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  57. /******/ }
  58. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  59. /******/ };
  60. /******/
  61. /******/ // create a fake namespace object
  62. /******/ // mode & 1: value is a module id, require it
  63. /******/ // mode & 2: merge all properties of value into the ns
  64. /******/ // mode & 4: return value when already ns object
  65. /******/ // mode & 8|1: behave like require
  66. /******/ __webpack_require__.t = function(value, mode) {
  67. /******/ if(mode & 1) value = __webpack_require__(value);
  68. /******/ if(mode & 8) return value;
  69. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  70. /******/ var ns = Object.create(null);
  71. /******/ __webpack_require__.r(ns);
  72. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  73. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  74. /******/ return ns;
  75. /******/ };
  76. /******/
  77. /******/ // getDefaultExport function for compatibility with non-harmony modules
  78. /******/ __webpack_require__.n = function(module) {
  79. /******/ var getter = module && module.__esModule ?
  80. /******/ function getDefault() { return module['default']; } :
  81. /******/ function getModuleExports() { return module; };
  82. /******/ __webpack_require__.d(getter, 'a', getter);
  83. /******/ return getter;
  84. /******/ };
  85. /******/
  86. /******/ // Object.prototype.hasOwnProperty.call
  87. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  88. /******/
  89. /******/ // __webpack_public_path__
  90. /******/ __webpack_require__.p = "";
  91. /******/
  92. /******/
  93. /******/ // Load entry module and return exports
  94. /******/ return __webpack_require__(__webpack_require__.s = 11);
  95. /******/ })
  96. /************************************************************************/
  97. /******/ ([
  98. /* 0 */
  99. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  100. "use strict";
  101. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return inBrowser; });
  102. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return isServer; });
  103. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return noop; });
  104. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return isDef; });
  105. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return isFunction; });
  106. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return isObject; });
  107. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return isPromise; });
  108. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return get; });
  109. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return isEmpty; });
  110. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3);
  111. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
  112. var inBrowser = typeof window !== 'undefined';
  113. var isServer = vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer; // eslint-disable-next-line @typescript-eslint/no-empty-function
  114. function noop() {}
  115. function isDef(val) {
  116. return val !== undefined && val !== null;
  117. }
  118. function isFunction(val) {
  119. return typeof val === 'function';
  120. }
  121. function isObject(val) {
  122. return val !== null && typeof val === 'object';
  123. }
  124. function isPromise(val) {
  125. return isObject(val) && isFunction(val.then) && isFunction(val.catch);
  126. }
  127. function get(object, path) {
  128. var keys = path.split('.');
  129. var result = object;
  130. keys.forEach(function (key) {
  131. var _result$key;
  132. result = (_result$key = result[key]) != null ? _result$key : '';
  133. });
  134. return result;
  135. }
  136. /**
  137. * Checks if `value` is an empty object, collection, map, or set.
  138. *
  139. * Objects are considered empty if they have no own enumerable string keyed
  140. * properties.
  141. *
  142. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  143. * jQuery-like collections are considered empty if they have a `length` of `0`.
  144. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  145. *
  146. * @function isEmpty
  147. * @param {*} value The value to check.
  148. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  149. * @example
  150. *
  151. * _.isEmpty(null);
  152. * // => true
  153. *
  154. * _.isEmpty(true);
  155. * // => true
  156. *
  157. * _.isEmpty(1);
  158. * // => true
  159. *
  160. * _.isEmpty([1, 2, 3]);
  161. * // => false
  162. *
  163. * _.isEmpty({ 'a': 1 });
  164. * // => false
  165. */
  166. function isEmpty(value) {
  167. if (value == null) {
  168. return true;
  169. }
  170. if (typeof value !== 'object') {
  171. return true;
  172. }
  173. return Object.keys(value).length === 0;
  174. }
  175. /***/ }),
  176. /* 1 */
  177. /***/ (function(module, exports, __webpack_require__) {
  178. "use strict";
  179. function _extends(){return _extends=Object.assign||function(a){for(var b,c=1;c<arguments.length;c++)for(var d in b=arguments[c],b)Object.prototype.hasOwnProperty.call(b,d)&&(a[d]=b[d]);return a},_extends.apply(this,arguments)}var normalMerge=["attrs","props","domProps"],toArrayMerge=["class","style","directives"],functionalMerge=["on","nativeOn"],mergeJsxProps=function(a){return a.reduce(function(c,a){for(var b in a)if(!c[b])c[b]=a[b];else if(-1!==normalMerge.indexOf(b))c[b]=_extends({},c[b],a[b]);else if(-1!==toArrayMerge.indexOf(b)){var d=c[b]instanceof Array?c[b]:[c[b]],e=a[b]instanceof Array?a[b]:[a[b]];c[b]=d.concat(e)}else if(-1!==functionalMerge.indexOf(b)){for(var f in a[b])if(c[b][f]){var g=c[b][f]instanceof Array?c[b][f]:[c[b][f]],h=a[b][f]instanceof Array?a[b][f]:[a[b][f]];c[b][f]=g.concat(h)}else c[b][f]=a[b][f];}else if("hook"==b)for(var i in a[b])c[b][i]=c[b][i]?mergeFn(c[b][i],a[b][i]):a[b][i];else c[b]=a[b];return c},{})},mergeFn=function(a,b){return function(){a&&a.apply(this,arguments),b&&b.apply(this,arguments)}};module.exports=mergeJsxProps;
  180. /***/ }),
  181. /* 2 */
  182. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  183. "use strict";
  184. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return camelize; });
  185. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return padZero; });
  186. var camelizeRE = /-(\w)/g;
  187. function camelize(str) {
  188. return str.replace(camelizeRE, function (_, c) {
  189. return c.toUpperCase();
  190. });
  191. }
  192. function padZero(num, targetLength) {
  193. if (targetLength === void 0) {
  194. targetLength = 2;
  195. }
  196. var str = num + '';
  197. while (str.length < targetLength) {
  198. str = '0' + str;
  199. }
  200. return str;
  201. }
  202. /***/ }),
  203. /* 3 */
  204. /***/ (function(module, exports) {
  205. module.exports = __WEBPACK_EXTERNAL_MODULE__3__;
  206. /***/ }),
  207. /* 4 */
  208. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  209. "use strict";
  210. /* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return raf; });
  211. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return doubleRaf; });
  212. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return cancelRaf; });
  213. /* harmony import */ var ___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
  214. /**
  215. * requestAnimationFrame polyfill
  216. */
  217. var prev = Date.now();
  218. /* istanbul ignore next */
  219. function fallback(fn) {
  220. var curr = Date.now();
  221. var ms = Math.max(0, 16 - (curr - prev));
  222. var id = setTimeout(fn, ms);
  223. prev = curr + ms;
  224. return id;
  225. }
  226. /* istanbul ignore next */
  227. var root = ___WEBPACK_IMPORTED_MODULE_0__[/* isServer */ "h"] ? global : window;
  228. /* istanbul ignore next */
  229. var iRaf = root.requestAnimationFrame || fallback;
  230. /* istanbul ignore next */
  231. var iCancel = root.cancelAnimationFrame || root.clearTimeout;
  232. function raf(fn) {
  233. return iRaf.call(root, fn);
  234. } // double raf for animation
  235. function doubleRaf(fn) {
  236. raf(function () {
  237. raf(fn);
  238. });
  239. }
  240. function cancelRaf(id) {
  241. iCancel.call(root, id);
  242. }
  243. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(10)))
  244. /***/ }),
  245. /* 5 */
  246. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  247. "use strict";
  248. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return isNumeric; });
  249. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return isNaN; });
  250. function isNumeric(val) {
  251. return /^\d+(\.\d+)?$/.test(val);
  252. }
  253. function isNaN(val) {
  254. if (Number.isNaN) {
  255. return Number.isNaN(val);
  256. } // eslint-disable-next-line no-self-compare
  257. return val !== val;
  258. }
  259. /***/ }),
  260. /* 6 */
  261. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  262. "use strict";
  263. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return addUnit; });
  264. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return unitToPx; });
  265. /* harmony import */ var ___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
  266. /* harmony import */ var _validate_number__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5);
  267. function addUnit(value) {
  268. if (!Object(___WEBPACK_IMPORTED_MODULE_0__[/* isDef */ "c"])(value)) {
  269. return undefined;
  270. }
  271. value = String(value);
  272. return Object(_validate_number__WEBPACK_IMPORTED_MODULE_1__[/* isNumeric */ "b"])(value) ? value + "px" : value;
  273. } // cache
  274. var rootFontSize;
  275. function getRootFontSize() {
  276. if (!rootFontSize) {
  277. var doc = document.documentElement;
  278. var fontSize = doc.style.fontSize || window.getComputedStyle(doc).fontSize;
  279. rootFontSize = parseFloat(fontSize);
  280. }
  281. return rootFontSize;
  282. }
  283. function convertRem(value) {
  284. value = value.replace(/rem/g, '');
  285. return +value * getRootFontSize();
  286. }
  287. function convertVw(value) {
  288. value = value.replace(/vw/g, '');
  289. return +value * window.innerWidth / 100;
  290. }
  291. function convertVh(value) {
  292. value = value.replace(/vh/g, '');
  293. return +value * window.innerHeight / 100;
  294. }
  295. function unitToPx(value) {
  296. if (typeof value === 'number') {
  297. return value;
  298. }
  299. if (___WEBPACK_IMPORTED_MODULE_0__[/* inBrowser */ "b"]) {
  300. if (value.indexOf('rem') !== -1) {
  301. return convertRem(value);
  302. }
  303. if (value.indexOf('vw') !== -1) {
  304. return convertVw(value);
  305. }
  306. if (value.indexOf('vh') !== -1) {
  307. return convertVh(value);
  308. }
  309. }
  310. return parseFloat(value);
  311. }
  312. /***/ }),
  313. /* 7 */
  314. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  315. "use strict";
  316. // EXTERNAL MODULE: external {"root":"Vue","commonjs":"vue","commonjs2":"vue","amd":"vue"}
  317. var external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_ = __webpack_require__(3);
  318. var external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default = /*#__PURE__*/__webpack_require__.n(external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_);
  319. // EXTERNAL MODULE: ./es/utils/index.js
  320. var utils = __webpack_require__(0);
  321. // CONCATENATED MODULE: ./es/utils/deep-assign.js
  322. var deep_assign_hasOwnProperty = Object.prototype.hasOwnProperty;
  323. function assignKey(to, from, key) {
  324. var val = from[key];
  325. if (!Object(utils["c" /* isDef */])(val)) {
  326. return;
  327. }
  328. if (!deep_assign_hasOwnProperty.call(to, key) || !Object(utils["f" /* isObject */])(val)) {
  329. to[key] = val;
  330. } else {
  331. // eslint-disable-next-line @typescript-eslint/no-use-before-define
  332. to[key] = deepAssign(Object(to[key]), from[key]);
  333. }
  334. }
  335. function deepAssign(to, from) {
  336. Object.keys(from).forEach(function (key) {
  337. assignKey(to, from, key);
  338. });
  339. return to;
  340. }
  341. // CONCATENATED MODULE: ./es/locale/lang/zh-CN.js
  342. /* harmony default export */ var zh_CN = ({
  343. name: '姓名',
  344. tel: '电话',
  345. save: '保存',
  346. confirm: '确认',
  347. cancel: '取消',
  348. delete: '删除',
  349. complete: '完成',
  350. loading: '加载中...',
  351. telEmpty: '请填写电话',
  352. nameEmpty: '请填写姓名',
  353. nameInvalid: '请输入正确的姓名',
  354. confirmDelete: '确定要删除吗',
  355. telInvalid: '请输入正确的手机号',
  356. vanCalendar: {
  357. end: '结束',
  358. start: '开始',
  359. title: '日期选择',
  360. confirm: '确定',
  361. startEnd: '开始/结束',
  362. weekdays: ['日', '一', '二', '三', '四', '五', '六'],
  363. monthTitle: function monthTitle(year, month) {
  364. return year + "\u5E74" + month + "\u6708";
  365. },
  366. rangePrompt: function rangePrompt(maxRange) {
  367. return "\u9009\u62E9\u5929\u6570\u4E0D\u80FD\u8D85\u8FC7 " + maxRange + " \u5929";
  368. }
  369. },
  370. vanCascader: {
  371. select: '请选择'
  372. },
  373. vanContactCard: {
  374. addText: '添加联系人'
  375. },
  376. vanContactList: {
  377. addText: '新建联系人'
  378. },
  379. vanPagination: {
  380. prev: '上一页',
  381. next: '下一页'
  382. },
  383. vanPullRefresh: {
  384. pulling: '下拉即可刷新...',
  385. loosing: '释放即可刷新...'
  386. },
  387. vanSubmitBar: {
  388. label: '合计:'
  389. },
  390. vanCoupon: {
  391. unlimited: '无使用门槛',
  392. discount: function discount(_discount) {
  393. return _discount + "\u6298";
  394. },
  395. condition: function condition(_condition) {
  396. return "\u6EE1" + _condition + "\u5143\u53EF\u7528";
  397. }
  398. },
  399. vanCouponCell: {
  400. title: '优惠券',
  401. tips: '暂无可用',
  402. count: function count(_count) {
  403. return _count + "\u5F20\u53EF\u7528";
  404. }
  405. },
  406. vanCouponList: {
  407. empty: '暂无优惠券',
  408. exchange: '兑换',
  409. close: '不使用优惠券',
  410. enable: '可用',
  411. disabled: '不可用',
  412. placeholder: '请输入优惠码'
  413. },
  414. vanAddressEdit: {
  415. area: '地区',
  416. postal: '邮政编码',
  417. areaEmpty: '请选择地区',
  418. addressEmpty: '请填写详细地址',
  419. postalEmpty: '邮政编码格式不正确',
  420. defaultAddress: '设为默认收货地址',
  421. telPlaceholder: '收货人手机号',
  422. namePlaceholder: '收货人姓名',
  423. areaPlaceholder: '选择省 / 市 / 区'
  424. },
  425. vanAddressEditDetail: {
  426. label: '详细地址',
  427. placeholder: '街道门牌、楼层房间号等信息'
  428. },
  429. vanAddressList: {
  430. add: '新增地址'
  431. }
  432. });
  433. // CONCATENATED MODULE: ./es/locale/index.js
  434. var proto = external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a.prototype;
  435. var defineReactive = external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a.util.defineReactive;
  436. defineReactive(proto, '$vantLang', 'zh-CN');
  437. defineReactive(proto, '$vantMessages', {
  438. 'zh-CN': zh_CN
  439. });
  440. /* harmony default export */ var locale = __webpack_exports__["a"] = ({
  441. messages: function messages() {
  442. return proto.$vantMessages[proto.$vantLang];
  443. },
  444. use: function use(lang, messages) {
  445. var _this$add;
  446. proto.$vantLang = lang;
  447. this.add((_this$add = {}, _this$add[lang] = messages, _this$add));
  448. },
  449. add: function add(messages) {
  450. if (messages === void 0) {
  451. messages = {};
  452. }
  453. deepAssign(proto.$vantMessages, messages);
  454. }
  455. });
  456. /***/ }),
  457. /* 8 */
  458. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  459. "use strict";
  460. // EXPORTS
  461. __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ createNamespace; });
  462. // CONCATENATED MODULE: ./es/utils/create/bem.js
  463. /**
  464. * bem helper
  465. * b() // 'button'
  466. * b('text') // 'button__text'
  467. * b({ disabled }) // 'button button--disabled'
  468. * b('text', { disabled }) // 'button__text button__text--disabled'
  469. * b(['disabled', 'primary']) // 'button button--disabled button--primary'
  470. */
  471. function gen(name, mods) {
  472. if (!mods) {
  473. return '';
  474. }
  475. if (typeof mods === 'string') {
  476. return " " + name + "--" + mods;
  477. }
  478. if (Array.isArray(mods)) {
  479. return mods.reduce(function (ret, item) {
  480. return ret + gen(name, item);
  481. }, '');
  482. }
  483. return Object.keys(mods).reduce(function (ret, key) {
  484. return ret + (mods[key] ? gen(name, key) : '');
  485. }, '');
  486. }
  487. function createBEM(name) {
  488. return function (el, mods) {
  489. if (el && typeof el !== 'string') {
  490. mods = el;
  491. el = '';
  492. }
  493. el = el ? name + "__" + el : name;
  494. return "" + el + gen(el, mods);
  495. };
  496. }
  497. // EXTERNAL MODULE: ./es/utils/index.js
  498. var utils = __webpack_require__(0);
  499. // EXTERNAL MODULE: ./es/utils/format/string.js
  500. var string = __webpack_require__(2);
  501. // CONCATENATED MODULE: ./es/mixins/slots.js
  502. /**
  503. * Use scopedSlots in Vue 2.6+
  504. * downgrade to slots in lower version
  505. */
  506. var SlotsMixin = {
  507. methods: {
  508. slots: function slots(name, props) {
  509. if (name === void 0) {
  510. name = 'default';
  511. }
  512. var $slots = this.$slots,
  513. $scopedSlots = this.$scopedSlots;
  514. var scopedSlot = $scopedSlots[name];
  515. if (scopedSlot) {
  516. return scopedSlot(props);
  517. }
  518. return $slots[name];
  519. }
  520. }
  521. };
  522. // EXTERNAL MODULE: external {"root":"Vue","commonjs":"vue","commonjs2":"vue","amd":"vue"}
  523. var external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_ = __webpack_require__(3);
  524. // CONCATENATED MODULE: ./es/utils/create/component.js
  525. /**
  526. * Create a basic component with common options
  527. */
  528. function install(Vue) {
  529. var name = this.name;
  530. Vue.component(name, this);
  531. Vue.component(Object(string["a" /* camelize */])("-" + name), this);
  532. } // unify slots & scopedSlots
  533. function unifySlots(context) {
  534. // use data.scopedSlots in lower Vue version
  535. var scopedSlots = context.scopedSlots || context.data.scopedSlots || {};
  536. var slots = context.slots();
  537. Object.keys(slots).forEach(function (key) {
  538. if (!scopedSlots[key]) {
  539. scopedSlots[key] = function () {
  540. return slots[key];
  541. };
  542. }
  543. });
  544. return scopedSlots;
  545. } // should be removed after Vue 3
  546. function transformFunctionComponent(pure) {
  547. return {
  548. functional: true,
  549. props: pure.props,
  550. model: pure.model,
  551. render: function render(h, context) {
  552. return pure(h, context.props, unifySlots(context), context);
  553. }
  554. };
  555. }
  556. function createComponent(name) {
  557. return function (sfc) {
  558. if (Object(utils["e" /* isFunction */])(sfc)) {
  559. sfc = transformFunctionComponent(sfc);
  560. }
  561. if (!sfc.functional) {
  562. sfc.mixins = sfc.mixins || [];
  563. sfc.mixins.push(SlotsMixin);
  564. }
  565. sfc.name = name;
  566. sfc.install = install;
  567. return sfc;
  568. };
  569. }
  570. // EXTERNAL MODULE: ./es/locale/index.js + 2 modules
  571. var locale = __webpack_require__(7);
  572. // CONCATENATED MODULE: ./es/utils/create/i18n.js
  573. function createI18N(name) {
  574. var prefix = Object(string["a" /* camelize */])(name) + '.';
  575. return function (path) {
  576. var messages = locale["a" /* default */].messages();
  577. var message = Object(utils["a" /* get */])(messages, prefix + path) || Object(utils["a" /* get */])(messages, path);
  578. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  579. args[_key - 1] = arguments[_key];
  580. }
  581. return Object(utils["e" /* isFunction */])(message) ? message.apply(void 0, args) : message;
  582. };
  583. }
  584. // CONCATENATED MODULE: ./es/utils/create/index.js
  585. function createNamespace(name) {
  586. name = 'van-' + name;
  587. return [createComponent(name), createBEM(name), createI18N(name)];
  588. }
  589. /***/ }),
  590. /* 9 */
  591. /***/ (function(module, exports, __webpack_require__) {
  592. /*!
  593. * Vue-Lazyload.js v1.2.3
  594. * (c) 2018 Awe <hilongjw@gmail.com>
  595. * Released under the MIT License.
  596. */
  597. !function(e,t){ true?module.exports=t():undefined}(this,function(){"use strict";function e(e){return e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function t(e){e=e||{};var t=arguments.length,i=0;if(1===t)return e;for(;++i<t;){var o=arguments[i];g(e)&&(e=o),r(o)&&n(e,o)}return e}function n(e,n){m(e,n);for(var o in n)if("__proto__"!==o&&i(n,o)){var a=n[o];r(a)?("undefined"===L(e[o])&&"function"===L(a)&&(e[o]=a),e[o]=t(e[o]||{},a)):e[o]=a}return e}function r(e){return"object"===L(e)||"function"===L(e)}function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function o(e,t){if(e.length){var n=e.indexOf(t);return n>-1?e.splice(n,1):void 0}}function a(e,t){for(var n=!1,r=0,i=e.length;r<i;r++)if(t(e[r])){n=!0;break}return n}function s(e,t){if("IMG"===e.tagName&&e.getAttribute("data-srcset")){var n=e.getAttribute("data-srcset"),r=[],i=e.parentNode,o=i.offsetWidth*t,a=void 0,s=void 0,u=void 0;n=n.trim().split(","),n.map(function(e){e=e.trim(),a=e.lastIndexOf(" "),-1===a?(s=e,u=999998):(s=e.substr(0,a),u=parseInt(e.substr(a+1,e.length-a-2),10)),r.push([u,s])}),r.sort(function(e,t){if(e[0]<t[0])return-1;if(e[0]>t[0])return 1;if(e[0]===t[0]){if(-1!==t[1].indexOf(".webp",t[1].length-5))return 1;if(-1!==e[1].indexOf(".webp",e[1].length-5))return-1}return 0});for(var l="",d=void 0,c=r.length,h=0;h<c;h++)if(d=r[h],d[0]>=o){l=d[1];break}return l}}function u(e,t){for(var n=void 0,r=0,i=e.length;r<i;r++)if(t(e[r])){n=e[r];break}return n}function l(){if(!k)return!1;var e=!0,t=document;try{var n=t.createElement("object");n.type="image/webp",n.style.visibility="hidden",n.innerHTML="!",t.body.appendChild(n),e=!n.offsetWidth,t.body.removeChild(n)}catch(t){e=!1}return e}function d(e,t){var n=null,r=0;return function(){if(!n){var i=Date.now()-r,o=this,a=arguments,s=function(){r=Date.now(),n=!1,e.apply(o,a)};i>=t?s():n=setTimeout(s,t)}}}function c(e){return null!==e&&"object"===(void 0===e?"undefined":p(e))}function h(e){if(!(e instanceof Object))return[];if(Object.keys)return Object.keys(e);var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n);return t}function f(e){for(var t=e.length,n=[],r=0;r<t;r++)n.push(e[r]);return n}function v(){}var p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},b=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},y=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),g=function(e){return null==e||"function"!=typeof e&&"object"!==(void 0===e?"undefined":p(e))},m=function(e,t){if(null===e||void 0===e)throw new TypeError("expected first argument to be an object.");if(void 0===t||"undefined"==typeof Symbol)return e;if("function"!=typeof Object.getOwnPropertySymbols)return e;for(var n=Object.prototype.propertyIsEnumerable,r=Object(e),i=arguments.length,o=0;++o<i;)for(var a=Object(arguments[o]),s=Object.getOwnPropertySymbols(a),u=0;u<s.length;u++){var l=s[u];n.call(a,l)&&(r[l]=a[l])}return r},w=Object.prototype.toString,L=function(t){var n=void 0===t?"undefined":p(t);return"undefined"===n?"undefined":null===t?"null":!0===t||!1===t||t instanceof Boolean?"boolean":"string"===n||t instanceof String?"string":"number"===n||t instanceof Number?"number":"function"===n||t instanceof Function?void 0!==t.constructor.name&&"Generator"===t.constructor.name.slice(0,9)?"generatorfunction":"function":void 0!==Array.isArray&&Array.isArray(t)?"array":t instanceof RegExp?"regexp":t instanceof Date?"date":(n=w.call(t),"[object RegExp]"===n?"regexp":"[object Date]"===n?"date":"[object Arguments]"===n?"arguments":"[object Error]"===n?"error":"[object Promise]"===n?"promise":e(t)?"buffer":"[object Set]"===n?"set":"[object WeakSet]"===n?"weakset":"[object Map]"===n?"map":"[object WeakMap]"===n?"weakmap":"[object Symbol]"===n?"symbol":"[object Map Iterator]"===n?"mapiterator":"[object Set Iterator]"===n?"setiterator":"[object String Iterator]"===n?"stringiterator":"[object Array Iterator]"===n?"arrayiterator":"[object Int8Array]"===n?"int8array":"[object Uint8Array]"===n?"uint8array":"[object Uint8ClampedArray]"===n?"uint8clampedarray":"[object Int16Array]"===n?"int16array":"[object Uint16Array]"===n?"uint16array":"[object Int32Array]"===n?"int32array":"[object Uint32Array]"===n?"uint32array":"[object Float32Array]"===n?"float32array":"[object Float64Array]"===n?"float64array":"object")},_=t,k="undefined"!=typeof window,E=k&&"IntersectionObserver"in window,A={event:"event",observer:"observer"},j=function(){function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n}if(k)return"function"==typeof window.CustomEvent?window.CustomEvent:(e.prototype=window.Event.prototype,e)}(),z=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return k?window.devicePixelRatio||e:e},T=function(){if(k){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("test",null,t)}catch(e){}return e}}(),O={on:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];T?e.addEventListener(t,n,{capture:r,passive:!0}):e.addEventListener(t,n,r)},off:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];e.removeEventListener(t,n,r)}},I=function(e,t,n){var r=new Image;r.src=e.src,r.onload=function(){t({naturalHeight:r.naturalHeight,naturalWidth:r.naturalWidth,src:r.src})},r.onerror=function(e){n(e)}},x=function(e,t){return"undefined"!=typeof getComputedStyle?getComputedStyle(e,null).getPropertyValue(t):e.style[t]},S=function(e){return x(e,"overflow")+x(e,"overflow-y")+x(e,"overflow-x")},$=function(e){if(k){if(!(e instanceof HTMLElement))return window;for(var t=e;t&&t!==document.body&&t!==document.documentElement&&t.parentNode;){if(/(scroll|auto)/.test(S(t)))return t;t=t.parentNode}return window}},H={},Q=function(){function e(t){var n=t.el,r=t.src,i=t.error,o=t.loading,a=t.bindType,s=t.$parent,u=t.options,l=t.elRenderer;b(this,e),this.el=n,this.src=r,this.error=i,this.loading=o,this.bindType=a,this.attempt=0,this.naturalHeight=0,this.naturalWidth=0,this.options=u,this.rect=null,this.$parent=s,this.elRenderer=l,this.performanceData={init:Date.now(),loadStart:0,loadEnd:0},this.filter(),this.initState(),this.render("loading",!1)}return y(e,[{key:"initState",value:function(){this.el.dataset.src=this.src,this.state={error:!1,loaded:!1,rendered:!1}}},{key:"record",value:function(e){this.performanceData[e]=Date.now()}},{key:"update",value:function(e){var t=e.src,n=e.loading,r=e.error,i=this.src;this.src=t,this.loading=n,this.error=r,this.filter(),i!==this.src&&(this.attempt=0,this.initState())}},{key:"getRect",value:function(){this.rect=this.el.getBoundingClientRect()}},{key:"checkInView",value:function(){return this.getRect(),this.rect.top<window.innerHeight*this.options.preLoad&&this.rect.bottom>this.options.preLoadTop&&this.rect.left<window.innerWidth*this.options.preLoad&&this.rect.right>0}},{key:"filter",value:function(){var e=this;h(this.options.filter).map(function(t){e.options.filter[t](e,e.options)})}},{key:"renderLoading",value:function(e){var t=this;I({src:this.loading},function(n){t.render("loading",!1),e()},function(){e(),t.options.silent||console.warn("VueLazyload log: load failed with loading image("+t.loading+")")})}},{key:"load",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:v;return this.attempt>this.options.attempt-1&&this.state.error?(this.options.silent||console.log("VueLazyload log: "+this.src+" tried too more than "+this.options.attempt+" times"),void t()):this.state.loaded||H[this.src]?(this.state.loaded=!0,t(),this.render("loaded",!0)):void this.renderLoading(function(){e.attempt++,e.record("loadStart"),I({src:e.src},function(n){e.naturalHeight=n.naturalHeight,e.naturalWidth=n.naturalWidth,e.state.loaded=!0,e.state.error=!1,e.record("loadEnd"),e.render("loaded",!1),H[e.src]=1,t()},function(t){!e.options.silent&&console.error(t),e.state.error=!0,e.state.loaded=!1,e.render("error",!1)})})}},{key:"render",value:function(e,t){this.elRenderer(this,e,t)}},{key:"performance",value:function(){var e="loading",t=0;return this.state.loaded&&(e="loaded",t=(this.performanceData.loadEnd-this.performanceData.loadStart)/1e3),this.state.error&&(e="error"),{src:this.src,state:e,time:t}}},{key:"destroy",value:function(){this.el=null,this.src=null,this.error=null,this.loading=null,this.bindType=null,this.attempt=0}}]),e}(),C="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",R=["scroll","wheel","mousewheel","resize","animationend","transitionend","touchmove"],W={rootMargin:"0px",threshold:0},D=function(e){return function(){function t(e){var n=e.preLoad,r=e.error,i=e.throttleWait,o=e.preLoadTop,a=e.dispatchEvent,s=e.loading,u=e.attempt,c=e.silent,h=void 0===c||c,f=e.scale,v=e.listenEvents,p=(e.hasbind,e.filter),y=e.adapter,g=e.observer,m=e.observerOptions;b(this,t),this.version="1.2.3",this.mode=A.event,this.ListenerQueue=[],this.TargetIndex=0,this.TargetQueue=[],this.options={silent:h,dispatchEvent:!!a,throttleWait:i||200,preLoad:n||1.3,preLoadTop:o||0,error:r||C,loading:s||C,attempt:u||3,scale:f||z(f),ListenEvents:v||R,hasbind:!1,supportWebp:l(),filter:p||{},adapter:y||{},observer:!!g,observerOptions:m||W},this._initEvent(),this.lazyLoadHandler=d(this._lazyLoadHandler.bind(this),this.options.throttleWait),this.setMode(this.options.observer?A.observer:A.event)}return y(t,[{key:"config",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};_(this.options,e)}},{key:"performance",value:function(){var e=[];return this.ListenerQueue.map(function(t){e.push(t.performance())}),e}},{key:"addLazyBox",value:function(e){this.ListenerQueue.push(e),k&&(this._addListenerTarget(window),this._observer&&this._observer.observe(e.el),e.$el&&e.$el.parentNode&&this._addListenerTarget(e.$el.parentNode))}},{key:"add",value:function(t,n,r){var i=this;if(a(this.ListenerQueue,function(e){return e.el===t}))return this.update(t,n),e.nextTick(this.lazyLoadHandler);var o=this._valueFormatter(n.value),u=o.src,l=o.loading,d=o.error;e.nextTick(function(){u=s(t,i.options.scale)||u,i._observer&&i._observer.observe(t);var o=Object.keys(n.modifiers)[0],a=void 0;o&&(a=r.context.$refs[o],a=a?a.$el||a:document.getElementById(o)),a||(a=$(t));var c=new Q({bindType:n.arg,$parent:a,el:t,loading:l,error:d,src:u,elRenderer:i._elRenderer.bind(i),options:i.options});i.ListenerQueue.push(c),k&&(i._addListenerTarget(window),i._addListenerTarget(a)),i.lazyLoadHandler(),e.nextTick(function(){return i.lazyLoadHandler()})})}},{key:"update",value:function(t,n){var r=this,i=this._valueFormatter(n.value),o=i.src,a=i.loading,l=i.error;o=s(t,this.options.scale)||o;var d=u(this.ListenerQueue,function(e){return e.el===t});d&&d.update({src:o,loading:a,error:l}),this._observer&&(this._observer.unobserve(t),this._observer.observe(t)),this.lazyLoadHandler(),e.nextTick(function(){return r.lazyLoadHandler()})}},{key:"remove",value:function(e){if(e){this._observer&&this._observer.unobserve(e);var t=u(this.ListenerQueue,function(t){return t.el===e});t&&(this._removeListenerTarget(t.$parent),this._removeListenerTarget(window),o(this.ListenerQueue,t)&&t.destroy())}}},{key:"removeComponent",value:function(e){e&&(o(this.ListenerQueue,e),this._observer&&this._observer.unobserve(e.el),e.$parent&&e.$el.parentNode&&this._removeListenerTarget(e.$el.parentNode),this._removeListenerTarget(window))}},{key:"setMode",value:function(e){var t=this;E||e!==A.observer||(e=A.event),this.mode=e,e===A.event?(this._observer&&(this.ListenerQueue.forEach(function(e){t._observer.unobserve(e.el)}),this._observer=null),this.TargetQueue.forEach(function(e){t._initListen(e.el,!0)})):(this.TargetQueue.forEach(function(e){t._initListen(e.el,!1)}),this._initIntersectionObserver())}},{key:"_addListenerTarget",value:function(e){if(e){var t=u(this.TargetQueue,function(t){return t.el===e});return t?t.childrenCount++:(t={el:e,id:++this.TargetIndex,childrenCount:1,listened:!0},this.mode===A.event&&this._initListen(t.el,!0),this.TargetQueue.push(t)),this.TargetIndex}}},{key:"_removeListenerTarget",value:function(e){var t=this;this.TargetQueue.forEach(function(n,r){n.el===e&&(--n.childrenCount||(t._initListen(n.el,!1),t.TargetQueue.splice(r,1),n=null))})}},{key:"_initListen",value:function(e,t){var n=this;this.options.ListenEvents.forEach(function(r){return O[t?"on":"off"](e,r,n.lazyLoadHandler)})}},{key:"_initEvent",value:function(){var e=this;this.Event={listeners:{loading:[],loaded:[],error:[]}},this.$on=function(t,n){e.Event.listeners[t].push(n)},this.$once=function(t,n){function r(){i.$off(t,r),n.apply(i,arguments)}var i=e;e.$on(t,r)},this.$off=function(t,n){if(!n)return void(e.Event.listeners[t]=[]);o(e.Event.listeners[t],n)},this.$emit=function(t,n,r){e.Event.listeners[t].forEach(function(e){return e(n,r)})}}},{key:"_lazyLoadHandler",value:function(){var e=this,t=!1;this.ListenerQueue.forEach(function(n,r){n.state.loaded||(t=n.checkInView())&&n.load(function(){!n.error&&n.loaded&&e.ListenerQueue.splice(r,1)})})}},{key:"_initIntersectionObserver",value:function(){var e=this;E&&(this._observer=new IntersectionObserver(this._observerHandler.bind(this),this.options.observerOptions),this.ListenerQueue.length&&this.ListenerQueue.forEach(function(t){e._observer.observe(t.el)}))}},{key:"_observerHandler",value:function(e,t){var n=this;e.forEach(function(e){e.isIntersecting&&n.ListenerQueue.forEach(function(t){if(t.el===e.target){if(t.state.loaded)return n._observer.unobserve(t.el);t.load()}})})}},{key:"_elRenderer",value:function(e,t,n){if(e.el){var r=e.el,i=e.bindType,o=void 0;switch(t){case"loading":o=e.loading;break;case"error":o=e.error;break;default:o=e.src}if(i?r.style[i]='url("'+o+'")':r.getAttribute("src")!==o&&r.setAttribute("src",o),r.setAttribute("lazy",t),this.$emit(t,e,n),this.options.adapter[t]&&this.options.adapter[t](e,this.options),this.options.dispatchEvent){var a=new j(t,{detail:e});r.dispatchEvent(a)}}}},{key:"_valueFormatter",value:function(e){var t=e,n=this.options.loading,r=this.options.error;return c(e)&&(e.src||this.options.silent||console.error("Vue Lazyload warning: miss src with "+e),t=e.src,n=e.loading||this.options.loading,r=e.error||this.options.error),{src:t,loading:n,error:r}}}]),t}()},B=function(e){return{props:{tag:{type:String,default:"div"}},render:function(e){return!1===this.show?e(this.tag):e(this.tag,null,this.$slots.default)},data:function(){return{el:null,state:{loaded:!1},rect:{},show:!1}},mounted:function(){this.el=this.$el,e.addLazyBox(this),e.lazyLoadHandler()},beforeDestroy:function(){e.removeComponent(this)},methods:{getRect:function(){this.rect=this.$el.getBoundingClientRect()},checkInView:function(){return this.getRect(),k&&this.rect.top<window.innerHeight*e.options.preLoad&&this.rect.bottom>0&&this.rect.left<window.innerWidth*e.options.preLoad&&this.rect.right>0},load:function(){this.show=!0,this.state.loaded=!0,this.$emit("show",this)}}}},V=function(){function e(t){var n=t.lazy;b(this,e),this.lazy=n,n.lazyContainerMananger=this,this._queue=[]}return y(e,[{key:"bind",value:function(e,t,n){var r=new N({el:e,binding:t,vnode:n,lazy:this.lazy});this._queue.push(r)}},{key:"update",value:function(e,t,n){var r=u(this._queue,function(t){return t.el===e});r&&r.update({el:e,binding:t,vnode:n})}},{key:"unbind",value:function(e,t,n){var r=u(this._queue,function(t){return t.el===e});r&&(r.clear(),o(this._queue,r))}}]),e}(),M={selector:"img"},N=function(){function e(t){var n=t.el,r=t.binding,i=t.vnode,o=t.lazy;b(this,e),this.el=null,this.vnode=i,this.binding=r,this.options={},this.lazy=o,this._queue=[],this.update({el:n,binding:r})}return y(e,[{key:"update",value:function(e){var t=this,n=e.el,r=e.binding;this.el=n,this.options=_({},M,r.value),this.getImgs().forEach(function(e){t.lazy.add(e,_({},t.binding,{value:{src:e.dataset.src,error:e.dataset.error,loading:e.dataset.loading}}),t.vnode)})}},{key:"getImgs",value:function(){return f(this.el.querySelectorAll(this.options.selector))}},{key:"clear",value:function(){var e=this;this.getImgs().forEach(function(t){return e.lazy.remove(t)}),this.vnode=null,this.binding=null,this.lazy=null}}]),e}();return{install:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=D(e),r=new n(t),i=new V({lazy:r}),o="2"===e.version.split(".")[0];e.prototype.$Lazyload=r,t.lazyComponent&&e.component("lazy-component",B(r)),o?(e.directive("lazy",{bind:r.add.bind(r),update:r.update.bind(r),componentUpdated:r.lazyLoadHandler.bind(r),unbind:r.remove.bind(r)}),e.directive("lazy-container",{bind:i.bind.bind(i),update:i.update.bind(i),unbind:i.unbind.bind(i)})):(e.directive("lazy",{bind:r.lazyLoadHandler.bind(r),update:function(e,t){_(this.vm.$refs,this.vm.$els),r.add(this.el,{modifiers:this.modifiers||{},arg:this.arg,value:e,oldValue:t},{context:this.vm})},unbind:function(){r.remove(this.el)}}),e.directive("lazy-container",{update:function(e,t){i.update(this.el,{modifiers:this.modifiers||{},arg:this.arg,value:e,oldValue:t},{context:this.vm})},unbind:function(){i.unbind(this.el)}}))}}});
  598. /***/ }),
  599. /* 10 */
  600. /***/ (function(module, exports) {
  601. var g;
  602. // This works in non-strict mode
  603. g = (function() {
  604. return this;
  605. })();
  606. try {
  607. // This works if eval is allowed (see CSP)
  608. g = g || new Function("return this")();
  609. } catch (e) {
  610. // This works if the window reference is available
  611. if (typeof window === "object") g = window;
  612. }
  613. // g can still be undefined, but nothing to do about it...
  614. // We return undefined, instead of nothing here, so it's
  615. // easier to handle this case. if(!global) { ...}
  616. module.exports = g;
  617. /***/ }),
  618. /* 11 */
  619. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  620. "use strict";
  621. // ESM COMPAT FLAG
  622. __webpack_require__.r(__webpack_exports__);
  623. // EXPORTS
  624. __webpack_require__.d(__webpack_exports__, "install", function() { return /* binding */ install; });
  625. __webpack_require__.d(__webpack_exports__, "version", function() { return /* binding */ version; });
  626. __webpack_require__.d(__webpack_exports__, "ActionSheet", function() { return /* reexport */ action_sheet; });
  627. __webpack_require__.d(__webpack_exports__, "AddressEdit", function() { return /* reexport */ address_edit; });
  628. __webpack_require__.d(__webpack_exports__, "AddressList", function() { return /* reexport */ address_list; });
  629. __webpack_require__.d(__webpack_exports__, "Area", function() { return /* reexport */ es_area; });
  630. __webpack_require__.d(__webpack_exports__, "Badge", function() { return /* reexport */ badge; });
  631. __webpack_require__.d(__webpack_exports__, "Button", function() { return /* reexport */ es_button; });
  632. __webpack_require__.d(__webpack_exports__, "Calendar", function() { return /* reexport */ calendar; });
  633. __webpack_require__.d(__webpack_exports__, "Card", function() { return /* reexport */ card; });
  634. __webpack_require__.d(__webpack_exports__, "Cascader", function() { return /* reexport */ cascader; });
  635. __webpack_require__.d(__webpack_exports__, "Cell", function() { return /* reexport */ cell; });
  636. __webpack_require__.d(__webpack_exports__, "CellGroup", function() { return /* reexport */ cell_group; });
  637. __webpack_require__.d(__webpack_exports__, "Checkbox", function() { return /* reexport */ es_checkbox; });
  638. __webpack_require__.d(__webpack_exports__, "CheckboxGroup", function() { return /* reexport */ checkbox_group; });
  639. __webpack_require__.d(__webpack_exports__, "Circle", function() { return /* reexport */ circle; });
  640. __webpack_require__.d(__webpack_exports__, "Col", function() { return /* reexport */ col; });
  641. __webpack_require__.d(__webpack_exports__, "Collapse", function() { return /* reexport */ collapse; });
  642. __webpack_require__.d(__webpack_exports__, "CollapseItem", function() { return /* reexport */ collapse_item; });
  643. __webpack_require__.d(__webpack_exports__, "ContactCard", function() { return /* reexport */ contact_card; });
  644. __webpack_require__.d(__webpack_exports__, "ContactEdit", function() { return /* reexport */ contact_edit; });
  645. __webpack_require__.d(__webpack_exports__, "ContactList", function() { return /* reexport */ contact_list; });
  646. __webpack_require__.d(__webpack_exports__, "CountDown", function() { return /* reexport */ count_down; });
  647. __webpack_require__.d(__webpack_exports__, "Coupon", function() { return /* reexport */ es_coupon; });
  648. __webpack_require__.d(__webpack_exports__, "CouponCell", function() { return /* reexport */ coupon_cell; });
  649. __webpack_require__.d(__webpack_exports__, "CouponList", function() { return /* reexport */ coupon_list; });
  650. __webpack_require__.d(__webpack_exports__, "DatetimePicker", function() { return /* reexport */ datetime_picker; });
  651. __webpack_require__.d(__webpack_exports__, "Dialog", function() { return /* reexport */ dialog; });
  652. __webpack_require__.d(__webpack_exports__, "Divider", function() { return /* reexport */ divider; });
  653. __webpack_require__.d(__webpack_exports__, "DropdownItem", function() { return /* reexport */ dropdown_item; });
  654. __webpack_require__.d(__webpack_exports__, "DropdownMenu", function() { return /* reexport */ dropdown_menu; });
  655. __webpack_require__.d(__webpack_exports__, "Empty", function() { return /* reexport */ empty; });
  656. __webpack_require__.d(__webpack_exports__, "Field", function() { return /* reexport */ es_field; });
  657. __webpack_require__.d(__webpack_exports__, "Form", function() { return /* reexport */ es_form; });
  658. __webpack_require__.d(__webpack_exports__, "GoodsAction", function() { return /* reexport */ goods_action; });
  659. __webpack_require__.d(__webpack_exports__, "GoodsActionButton", function() { return /* reexport */ goods_action_button; });
  660. __webpack_require__.d(__webpack_exports__, "GoodsActionIcon", function() { return /* reexport */ goods_action_icon; });
  661. __webpack_require__.d(__webpack_exports__, "Grid", function() { return /* reexport */ grid; });
  662. __webpack_require__.d(__webpack_exports__, "GridItem", function() { return /* reexport */ grid_item; });
  663. __webpack_require__.d(__webpack_exports__, "Icon", function() { return /* reexport */ es_icon; });
  664. __webpack_require__.d(__webpack_exports__, "Image", function() { return /* reexport */ es_image; });
  665. __webpack_require__.d(__webpack_exports__, "ImagePreview", function() { return /* reexport */ image_preview; });
  666. __webpack_require__.d(__webpack_exports__, "IndexAnchor", function() { return /* reexport */ index_anchor; });
  667. __webpack_require__.d(__webpack_exports__, "IndexBar", function() { return /* reexport */ index_bar; });
  668. __webpack_require__.d(__webpack_exports__, "Info", function() { return /* reexport */ es_info; });
  669. __webpack_require__.d(__webpack_exports__, "Lazyload", function() { return /* reexport */ lazyload; });
  670. __webpack_require__.d(__webpack_exports__, "List", function() { return /* reexport */ es_list; });
  671. __webpack_require__.d(__webpack_exports__, "Loading", function() { return /* reexport */ es_loading; });
  672. __webpack_require__.d(__webpack_exports__, "Locale", function() { return /* reexport */ locale["a" /* default */]; });
  673. __webpack_require__.d(__webpack_exports__, "NavBar", function() { return /* reexport */ nav_bar; });
  674. __webpack_require__.d(__webpack_exports__, "NoticeBar", function() { return /* reexport */ notice_bar; });
  675. __webpack_require__.d(__webpack_exports__, "Notify", function() { return /* reexport */ notify; });
  676. __webpack_require__.d(__webpack_exports__, "NumberKeyboard", function() { return /* reexport */ number_keyboard; });
  677. __webpack_require__.d(__webpack_exports__, "Overlay", function() { return /* reexport */ es_overlay; });
  678. __webpack_require__.d(__webpack_exports__, "Pagination", function() { return /* reexport */ pagination; });
  679. __webpack_require__.d(__webpack_exports__, "Panel", function() { return /* reexport */ panel; });
  680. __webpack_require__.d(__webpack_exports__, "PasswordInput", function() { return /* reexport */ password_input; });
  681. __webpack_require__.d(__webpack_exports__, "Picker", function() { return /* reexport */ picker; });
  682. __webpack_require__.d(__webpack_exports__, "Popover", function() { return /* reexport */ popover; });
  683. __webpack_require__.d(__webpack_exports__, "Popup", function() { return /* reexport */ popup; });
  684. __webpack_require__.d(__webpack_exports__, "Progress", function() { return /* reexport */ es_progress; });
  685. __webpack_require__.d(__webpack_exports__, "PullRefresh", function() { return /* reexport */ pull_refresh; });
  686. __webpack_require__.d(__webpack_exports__, "Radio", function() { return /* reexport */ es_radio; });
  687. __webpack_require__.d(__webpack_exports__, "RadioGroup", function() { return /* reexport */ radio_group; });
  688. __webpack_require__.d(__webpack_exports__, "Rate", function() { return /* reexport */ es_rate; });
  689. __webpack_require__.d(__webpack_exports__, "Row", function() { return /* reexport */ row; });
  690. __webpack_require__.d(__webpack_exports__, "Search", function() { return /* reexport */ search; });
  691. __webpack_require__.d(__webpack_exports__, "ShareSheet", function() { return /* reexport */ share_sheet; });
  692. __webpack_require__.d(__webpack_exports__, "Sidebar", function() { return /* reexport */ sidebar; });
  693. __webpack_require__.d(__webpack_exports__, "SidebarItem", function() { return /* reexport */ sidebar_item; });
  694. __webpack_require__.d(__webpack_exports__, "Skeleton", function() { return /* reexport */ skeleton; });
  695. __webpack_require__.d(__webpack_exports__, "Sku", function() { return /* reexport */ es_sku; });
  696. __webpack_require__.d(__webpack_exports__, "Slider", function() { return /* reexport */ slider; });
  697. __webpack_require__.d(__webpack_exports__, "Step", function() { return /* reexport */ es_step; });
  698. __webpack_require__.d(__webpack_exports__, "Stepper", function() { return /* reexport */ stepper; });
  699. __webpack_require__.d(__webpack_exports__, "Steps", function() { return /* reexport */ steps; });
  700. __webpack_require__.d(__webpack_exports__, "Sticky", function() { return /* reexport */ es_sticky; });
  701. __webpack_require__.d(__webpack_exports__, "SubmitBar", function() { return /* reexport */ submit_bar; });
  702. __webpack_require__.d(__webpack_exports__, "Swipe", function() { return /* reexport */ swipe; });
  703. __webpack_require__.d(__webpack_exports__, "SwipeCell", function() { return /* reexport */ swipe_cell; });
  704. __webpack_require__.d(__webpack_exports__, "SwipeItem", function() { return /* reexport */ swipe_item; });
  705. __webpack_require__.d(__webpack_exports__, "Switch", function() { return /* reexport */ es_switch; });
  706. __webpack_require__.d(__webpack_exports__, "SwitchCell", function() { return /* reexport */ switch_cell; });
  707. __webpack_require__.d(__webpack_exports__, "Tab", function() { return /* reexport */ tab; });
  708. __webpack_require__.d(__webpack_exports__, "Tabbar", function() { return /* reexport */ tabbar; });
  709. __webpack_require__.d(__webpack_exports__, "TabbarItem", function() { return /* reexport */ tabbar_item; });
  710. __webpack_require__.d(__webpack_exports__, "Tabs", function() { return /* reexport */ tabs; });
  711. __webpack_require__.d(__webpack_exports__, "Tag", function() { return /* reexport */ es_tag; });
  712. __webpack_require__.d(__webpack_exports__, "Toast", function() { return /* reexport */ es_toast; });
  713. __webpack_require__.d(__webpack_exports__, "TreeSelect", function() { return /* reexport */ tree_select; });
  714. __webpack_require__.d(__webpack_exports__, "Uploader", function() { return /* reexport */ uploader; });
  715. // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
  716. function _extends() {
  717. _extends = Object.assign || function (target) {
  718. for (var i = 1; i < arguments.length; i++) {
  719. var source = arguments[i];
  720. for (var key in source) {
  721. if (Object.prototype.hasOwnProperty.call(source, key)) {
  722. target[key] = source[key];
  723. }
  724. }
  725. }
  726. return target;
  727. };
  728. return _extends.apply(this, arguments);
  729. }
  730. // EXTERNAL MODULE: ./node_modules/@vue/babel-helper-vue-jsx-merge-props/dist/helper.js
  731. var helper = __webpack_require__(1);
  732. var helper_default = /*#__PURE__*/__webpack_require__.n(helper);
  733. // EXTERNAL MODULE: external {"root":"Vue","commonjs":"vue","commonjs2":"vue","amd":"vue"}
  734. var external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_ = __webpack_require__(3);
  735. var external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default = /*#__PURE__*/__webpack_require__.n(external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_);
  736. // EXTERNAL MODULE: ./es/utils/create/index.js + 4 modules
  737. var create = __webpack_require__(8);
  738. // CONCATENATED MODULE: ./es/utils/functional.js
  739. var inheritKey = ['ref', 'key', 'style', 'class', 'attrs', 'refInFor', 'nativeOn', 'directives', 'staticClass', 'staticStyle'];
  740. var mapInheritKey = {
  741. nativeOn: 'on'
  742. }; // inherit partial context, map nativeOn to on
  743. function inherit(context, inheritListeners) {
  744. var result = inheritKey.reduce(function (obj, key) {
  745. if (context.data[key]) {
  746. obj[mapInheritKey[key] || key] = context.data[key];
  747. }
  748. return obj;
  749. }, {});
  750. if (inheritListeners) {
  751. result.on = result.on || {};
  752. _extends(result.on, context.data.on);
  753. }
  754. return result;
  755. } // emit event
  756. function functional_emit(context, eventName) {
  757. for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
  758. args[_key - 2] = arguments[_key];
  759. }
  760. var listeners = context.listeners[eventName];
  761. if (listeners) {
  762. if (Array.isArray(listeners)) {
  763. listeners.forEach(function (listener) {
  764. listener.apply(void 0, args);
  765. });
  766. } else {
  767. listeners.apply(void 0, args);
  768. }
  769. }
  770. } // mount functional component
  771. function mount(Component, data) {
  772. var instance = new external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a({
  773. el: document.createElement('div'),
  774. props: Component.props,
  775. render: function render(h) {
  776. return h(Component, _extends({
  777. props: this.$props
  778. }, data));
  779. }
  780. });
  781. document.body.appendChild(instance.$el);
  782. return instance;
  783. }
  784. // CONCATENATED MODULE: ./es/mixins/popup/context.js
  785. var context_context = {
  786. zIndex: 2000,
  787. lockCount: 0,
  788. stack: [],
  789. find: function find(vm) {
  790. return this.stack.filter(function (item) {
  791. return item.vm === vm;
  792. })[0];
  793. },
  794. remove: function remove(vm) {
  795. var item = this.find(vm);
  796. if (!item) return;
  797. item.vm = null;
  798. item.overlay = null;
  799. var index = this.stack.indexOf(item);
  800. this.stack.splice(index, 1);
  801. }
  802. };
  803. // EXTERNAL MODULE: ./es/utils/index.js
  804. var utils = __webpack_require__(0);
  805. // CONCATENATED MODULE: ./es/utils/dom/event.js
  806. // eslint-disable-next-line import/no-mutable-exports
  807. var supportsPassive = false;
  808. if (!utils["h" /* isServer */]) {
  809. try {
  810. var opts = {};
  811. Object.defineProperty(opts, 'passive', {
  812. // eslint-disable-next-line getter-return
  813. get: function get() {
  814. /* istanbul ignore next */
  815. supportsPassive = true;
  816. }
  817. });
  818. window.addEventListener('test-passive', null, opts); // eslint-disable-next-line no-empty
  819. } catch (e) {}
  820. }
  821. function event_on(target, event, handler, passive) {
  822. if (passive === void 0) {
  823. passive = false;
  824. }
  825. if (!utils["h" /* isServer */]) {
  826. target.addEventListener(event, handler, supportsPassive ? {
  827. capture: false,
  828. passive: passive
  829. } : false);
  830. }
  831. }
  832. function off(target, event, handler) {
  833. if (!utils["h" /* isServer */]) {
  834. target.removeEventListener(event, handler);
  835. }
  836. }
  837. function event_stopPropagation(event) {
  838. event.stopPropagation();
  839. }
  840. function preventDefault(event, isStopPropagation) {
  841. /* istanbul ignore else */
  842. if (typeof event.cancelable !== 'boolean' || event.cancelable) {
  843. event.preventDefault();
  844. }
  845. if (isStopPropagation) {
  846. event_stopPropagation(event);
  847. }
  848. }
  849. // CONCATENATED MODULE: ./es/overlay/index.js
  850. // Utils
  851. // Types
  852. var _createNamespace = Object(create["a" /* createNamespace */])('overlay'),
  853. createComponent = _createNamespace[0],
  854. overlay_bem = _createNamespace[1];
  855. function preventTouchMove(event) {
  856. preventDefault(event, true);
  857. }
  858. function Overlay(h, props, slots, ctx) {
  859. var style = _extends({
  860. zIndex: props.zIndex
  861. }, props.customStyle);
  862. if (Object(utils["c" /* isDef */])(props.duration)) {
  863. style.animationDuration = props.duration + "s";
  864. }
  865. return h("transition", {
  866. "attrs": {
  867. "name": "van-fade"
  868. }
  869. }, [h("div", helper_default()([{
  870. "directives": [{
  871. name: "show",
  872. value: props.show
  873. }],
  874. "style": style,
  875. "class": [overlay_bem(), props.className],
  876. "on": {
  877. "touchmove": props.lockScroll ? preventTouchMove : utils["i" /* noop */]
  878. }
  879. }, inherit(ctx, true)]), [slots.default == null ? void 0 : slots.default()])]);
  880. }
  881. Overlay.props = {
  882. show: Boolean,
  883. zIndex: [Number, String],
  884. duration: [Number, String],
  885. className: null,
  886. customStyle: Object,
  887. lockScroll: {
  888. type: Boolean,
  889. default: true
  890. }
  891. };
  892. /* harmony default export */ var es_overlay = (createComponent(Overlay));
  893. // CONCATENATED MODULE: ./es/utils/dom/node.js
  894. function removeNode(el) {
  895. var parent = el.parentNode;
  896. if (parent) {
  897. parent.removeChild(el);
  898. }
  899. }
  900. // CONCATENATED MODULE: ./es/mixins/popup/overlay.js
  901. var defaultConfig = {
  902. className: '',
  903. customStyle: {}
  904. };
  905. function mountOverlay(vm) {
  906. return mount(es_overlay, {
  907. on: {
  908. // close popup when overlay clicked & closeOnClickOverlay is true
  909. click: function click() {
  910. vm.$emit('click-overlay');
  911. if (vm.closeOnClickOverlay) {
  912. if (vm.onClickOverlay) {
  913. vm.onClickOverlay();
  914. } else {
  915. vm.close();
  916. }
  917. }
  918. }
  919. }
  920. });
  921. }
  922. function updateOverlay(vm) {
  923. var item = context_context.find(vm);
  924. if (item) {
  925. var el = vm.$el;
  926. var config = item.config,
  927. overlay = item.overlay;
  928. if (el && el.parentNode) {
  929. el.parentNode.insertBefore(overlay.$el, el);
  930. }
  931. _extends(overlay, defaultConfig, config, {
  932. show: true
  933. });
  934. }
  935. }
  936. function openOverlay(vm, config) {
  937. var item = context_context.find(vm);
  938. if (item) {
  939. item.config = config;
  940. } else {
  941. var overlay = mountOverlay(vm);
  942. context_context.stack.push({
  943. vm: vm,
  944. config: config,
  945. overlay: overlay
  946. });
  947. }
  948. updateOverlay(vm);
  949. }
  950. function closeOverlay(vm) {
  951. var item = context_context.find(vm);
  952. if (item) {
  953. item.overlay.show = false;
  954. }
  955. }
  956. function removeOverlay(vm) {
  957. var item = context_context.find(vm);
  958. if (item) {
  959. removeNode(item.overlay.$el);
  960. context_context.remove(vm);
  961. }
  962. }
  963. // CONCATENATED MODULE: ./es/utils/dom/scroll.js
  964. function isWindow(val) {
  965. return val === window;
  966. } // get nearest scroll element
  967. // https://github.com/youzan/vant/issues/3823
  968. var overflowScrollReg = /scroll|auto/i;
  969. function getScroller(el, root) {
  970. if (root === void 0) {
  971. root = window;
  972. }
  973. var node = el;
  974. while (node && node.tagName !== 'HTML' && node.tagName !== 'BODY' && node.nodeType === 1 && node !== root) {
  975. var _window$getComputedSt = window.getComputedStyle(node),
  976. overflowY = _window$getComputedSt.overflowY;
  977. if (overflowScrollReg.test(overflowY)) {
  978. return node;
  979. }
  980. node = node.parentNode;
  981. }
  982. return root;
  983. }
  984. function getScrollTop(el) {
  985. var top = 'scrollTop' in el ? el.scrollTop : el.pageYOffset; // iOS scroll bounce cause minus scrollTop
  986. return Math.max(top, 0);
  987. }
  988. function setScrollTop(el, value) {
  989. if ('scrollTop' in el) {
  990. el.scrollTop = value;
  991. } else {
  992. el.scrollTo(el.scrollX, value);
  993. }
  994. }
  995. function getRootScrollTop() {
  996. return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
  997. }
  998. function setRootScrollTop(value) {
  999. setScrollTop(window, value);
  1000. setScrollTop(document.body, value);
  1001. } // get distance from element top to page top or scroller top
  1002. function getElementTop(el, scroller) {
  1003. if (isWindow(el)) {
  1004. return 0;
  1005. }
  1006. var scrollTop = scroller ? getScrollTop(scroller) : getRootScrollTop();
  1007. return el.getBoundingClientRect().top + scrollTop;
  1008. }
  1009. function getVisibleHeight(el) {
  1010. if (isWindow(el)) {
  1011. return el.innerHeight;
  1012. }
  1013. return el.getBoundingClientRect().height;
  1014. }
  1015. function getVisibleTop(el) {
  1016. if (isWindow(el)) {
  1017. return 0;
  1018. }
  1019. return el.getBoundingClientRect().top;
  1020. }
  1021. // CONCATENATED MODULE: ./es/mixins/touch.js
  1022. var MIN_DISTANCE = 10;
  1023. function getDirection(x, y) {
  1024. if (x > y && x > MIN_DISTANCE) {
  1025. return 'horizontal';
  1026. }
  1027. if (y > x && y > MIN_DISTANCE) {
  1028. return 'vertical';
  1029. }
  1030. return '';
  1031. }
  1032. var TouchMixin = {
  1033. data: function data() {
  1034. return {
  1035. direction: ''
  1036. };
  1037. },
  1038. methods: {
  1039. touchStart: function touchStart(event) {
  1040. this.resetTouchStatus();
  1041. this.startX = event.touches[0].clientX;
  1042. this.startY = event.touches[0].clientY;
  1043. },
  1044. touchMove: function touchMove(event) {
  1045. var touch = event.touches[0]; // Fix: Safari back will set clientX to negative number
  1046. this.deltaX = touch.clientX < 0 ? 0 : touch.clientX - this.startX;
  1047. this.deltaY = touch.clientY - this.startY;
  1048. this.offsetX = Math.abs(this.deltaX);
  1049. this.offsetY = Math.abs(this.deltaY);
  1050. this.direction = this.direction || getDirection(this.offsetX, this.offsetY);
  1051. },
  1052. resetTouchStatus: function resetTouchStatus() {
  1053. this.direction = '';
  1054. this.deltaX = 0;
  1055. this.deltaY = 0;
  1056. this.offsetX = 0;
  1057. this.offsetY = 0;
  1058. },
  1059. // avoid Vue 2.6 event bubble issues by manually binding events
  1060. // https://github.com/youzan/vant/issues/3015
  1061. bindTouchEvent: function bindTouchEvent(el) {
  1062. var onTouchStart = this.onTouchStart,
  1063. onTouchMove = this.onTouchMove,
  1064. onTouchEnd = this.onTouchEnd;
  1065. event_on(el, 'touchstart', onTouchStart);
  1066. event_on(el, 'touchmove', onTouchMove);
  1067. if (onTouchEnd) {
  1068. event_on(el, 'touchend', onTouchEnd);
  1069. event_on(el, 'touchcancel', onTouchEnd);
  1070. }
  1071. }
  1072. }
  1073. };
  1074. // CONCATENATED MODULE: ./es/mixins/portal.js
  1075. function getElement(selector) {
  1076. if (typeof selector === 'string') {
  1077. return document.querySelector(selector);
  1078. }
  1079. return selector();
  1080. }
  1081. function PortalMixin(_temp) {
  1082. var _ref = _temp === void 0 ? {} : _temp,
  1083. ref = _ref.ref,
  1084. afterPortal = _ref.afterPortal;
  1085. return {
  1086. props: {
  1087. getContainer: [String, Function]
  1088. },
  1089. watch: {
  1090. getContainer: 'portal'
  1091. },
  1092. mounted: function mounted() {
  1093. if (this.getContainer) {
  1094. this.portal();
  1095. }
  1096. },
  1097. methods: {
  1098. portal: function portal() {
  1099. var getContainer = this.getContainer;
  1100. var el = ref ? this.$refs[ref] : this.$el;
  1101. var container;
  1102. if (getContainer) {
  1103. container = getElement(getContainer);
  1104. } else if (this.$parent) {
  1105. container = this.$parent.$el;
  1106. }
  1107. if (container && container !== el.parentNode) {
  1108. container.appendChild(el);
  1109. }
  1110. if (afterPortal) {
  1111. afterPortal.call(this);
  1112. }
  1113. }
  1114. }
  1115. };
  1116. }
  1117. // CONCATENATED MODULE: ./es/mixins/bind-event.js
  1118. /**
  1119. * Bind event when mounted or activated
  1120. */
  1121. var uid = 0;
  1122. function BindEventMixin(handler) {
  1123. var key = "binded_" + uid++;
  1124. function bind() {
  1125. if (!this[key]) {
  1126. handler.call(this, event_on, true);
  1127. this[key] = true;
  1128. }
  1129. }
  1130. function unbind() {
  1131. if (this[key]) {
  1132. handler.call(this, off, false);
  1133. this[key] = false;
  1134. }
  1135. }
  1136. return {
  1137. mounted: bind,
  1138. activated: bind,
  1139. deactivated: unbind,
  1140. beforeDestroy: unbind
  1141. };
  1142. }
  1143. // CONCATENATED MODULE: ./es/mixins/close-on-popstate.js
  1144. var CloseOnPopstateMixin = {
  1145. mixins: [BindEventMixin(function (bind, isBind) {
  1146. this.handlePopstate(isBind && this.closeOnPopstate);
  1147. })],
  1148. props: {
  1149. closeOnPopstate: Boolean
  1150. },
  1151. data: function data() {
  1152. return {
  1153. bindStatus: false
  1154. };
  1155. },
  1156. watch: {
  1157. closeOnPopstate: function closeOnPopstate(val) {
  1158. this.handlePopstate(val);
  1159. }
  1160. },
  1161. methods: {
  1162. onPopstate: function onPopstate() {
  1163. this.close();
  1164. this.shouldReopen = false;
  1165. },
  1166. handlePopstate: function handlePopstate(bind) {
  1167. /* istanbul ignore if */
  1168. if (this.$isServer) {
  1169. return;
  1170. }
  1171. if (this.bindStatus !== bind) {
  1172. this.bindStatus = bind;
  1173. var action = bind ? event_on : off;
  1174. action(window, 'popstate', this.onPopstate);
  1175. }
  1176. }
  1177. }
  1178. };
  1179. // CONCATENATED MODULE: ./es/mixins/popup/index.js
  1180. // Context
  1181. // Utils
  1182. // Mixins
  1183. var popupMixinProps = {
  1184. // Initial rendering animation
  1185. transitionAppear: Boolean,
  1186. // whether to show popup
  1187. value: Boolean,
  1188. // whether to show overlay
  1189. overlay: Boolean,
  1190. // overlay custom style
  1191. overlayStyle: Object,
  1192. // overlay custom class name
  1193. overlayClass: String,
  1194. // whether to close popup when overlay is clicked
  1195. closeOnClickOverlay: Boolean,
  1196. // z-index
  1197. zIndex: [Number, String],
  1198. // prevent body scroll
  1199. lockScroll: {
  1200. type: Boolean,
  1201. default: true
  1202. },
  1203. // whether to lazy render
  1204. lazyRender: {
  1205. type: Boolean,
  1206. default: true
  1207. }
  1208. };
  1209. function PopupMixin(options) {
  1210. if (options === void 0) {
  1211. options = {};
  1212. }
  1213. return {
  1214. mixins: [TouchMixin, CloseOnPopstateMixin, PortalMixin({
  1215. afterPortal: function afterPortal() {
  1216. if (this.overlay) {
  1217. updateOverlay();
  1218. }
  1219. }
  1220. })],
  1221. provide: function provide() {
  1222. return {
  1223. vanPopup: this
  1224. };
  1225. },
  1226. props: popupMixinProps,
  1227. data: function data() {
  1228. this.onReopenCallback = [];
  1229. return {
  1230. inited: this.value
  1231. };
  1232. },
  1233. computed: {
  1234. shouldRender: function shouldRender() {
  1235. return this.inited || !this.lazyRender;
  1236. }
  1237. },
  1238. watch: {
  1239. value: function value(val) {
  1240. var type = val ? 'open' : 'close';
  1241. this.inited = this.inited || this.value;
  1242. this[type]();
  1243. if (!options.skipToggleEvent) {
  1244. this.$emit(type);
  1245. }
  1246. },
  1247. overlay: 'renderOverlay'
  1248. },
  1249. mounted: function mounted() {
  1250. if (this.value) {
  1251. this.open();
  1252. }
  1253. },
  1254. /* istanbul ignore next */
  1255. activated: function activated() {
  1256. if (this.shouldReopen) {
  1257. this.$emit('input', true);
  1258. this.shouldReopen = false;
  1259. }
  1260. },
  1261. beforeDestroy: function beforeDestroy() {
  1262. removeOverlay(this);
  1263. if (this.opened) {
  1264. this.removeLock();
  1265. }
  1266. if (this.getContainer) {
  1267. removeNode(this.$el);
  1268. }
  1269. },
  1270. /* istanbul ignore next */
  1271. deactivated: function deactivated() {
  1272. if (this.value) {
  1273. this.close();
  1274. this.shouldReopen = true;
  1275. }
  1276. },
  1277. methods: {
  1278. open: function open() {
  1279. /* istanbul ignore next */
  1280. if (this.$isServer || this.opened) {
  1281. return;
  1282. } // cover default zIndex
  1283. if (this.zIndex !== undefined) {
  1284. context_context.zIndex = this.zIndex;
  1285. }
  1286. this.opened = true;
  1287. this.renderOverlay();
  1288. this.addLock();
  1289. this.onReopenCallback.forEach(function (callback) {
  1290. callback();
  1291. });
  1292. },
  1293. addLock: function addLock() {
  1294. if (this.lockScroll) {
  1295. event_on(document, 'touchstart', this.touchStart);
  1296. event_on(document, 'touchmove', this.onTouchMove);
  1297. if (!context_context.lockCount) {
  1298. document.body.classList.add('van-overflow-hidden');
  1299. }
  1300. context_context.lockCount++;
  1301. }
  1302. },
  1303. removeLock: function removeLock() {
  1304. if (this.lockScroll && context_context.lockCount) {
  1305. context_context.lockCount--;
  1306. off(document, 'touchstart', this.touchStart);
  1307. off(document, 'touchmove', this.onTouchMove);
  1308. if (!context_context.lockCount) {
  1309. document.body.classList.remove('van-overflow-hidden');
  1310. }
  1311. }
  1312. },
  1313. close: function close() {
  1314. if (!this.opened) {
  1315. return;
  1316. }
  1317. closeOverlay(this);
  1318. this.opened = false;
  1319. this.removeLock();
  1320. this.$emit('input', false);
  1321. },
  1322. onTouchMove: function onTouchMove(event) {
  1323. this.touchMove(event);
  1324. var direction = this.deltaY > 0 ? '10' : '01';
  1325. var el = getScroller(event.target, this.$el);
  1326. var scrollHeight = el.scrollHeight,
  1327. offsetHeight = el.offsetHeight,
  1328. scrollTop = el.scrollTop;
  1329. var status = '11';
  1330. /* istanbul ignore next */
  1331. if (scrollTop === 0) {
  1332. status = offsetHeight >= scrollHeight ? '00' : '01';
  1333. } else if (scrollTop + offsetHeight >= scrollHeight) {
  1334. status = '10';
  1335. }
  1336. /* istanbul ignore next */
  1337. if (status !== '11' && this.direction === 'vertical' && !(parseInt(status, 2) & parseInt(direction, 2))) {
  1338. preventDefault(event, true);
  1339. }
  1340. },
  1341. renderOverlay: function renderOverlay() {
  1342. var _this = this;
  1343. if (this.$isServer || !this.value) {
  1344. return;
  1345. }
  1346. this.$nextTick(function () {
  1347. _this.updateZIndex(_this.overlay ? 1 : 0);
  1348. if (_this.overlay) {
  1349. openOverlay(_this, {
  1350. zIndex: context_context.zIndex++,
  1351. duration: _this.duration,
  1352. className: _this.overlayClass,
  1353. customStyle: _this.overlayStyle
  1354. });
  1355. } else {
  1356. closeOverlay(_this);
  1357. }
  1358. });
  1359. },
  1360. updateZIndex: function updateZIndex(value) {
  1361. if (value === void 0) {
  1362. value = 0;
  1363. }
  1364. this.$el.style.zIndex = ++context_context.zIndex + value;
  1365. },
  1366. onReopen: function onReopen(callback) {
  1367. this.onReopenCallback.push(callback);
  1368. }
  1369. }
  1370. };
  1371. }
  1372. // EXTERNAL MODULE: ./es/utils/format/unit.js
  1373. var unit = __webpack_require__(6);
  1374. // CONCATENATED MODULE: ./es/info/index.js
  1375. // Utils
  1376. // Types
  1377. var info_createNamespace = Object(create["a" /* createNamespace */])('info'),
  1378. info_createComponent = info_createNamespace[0],
  1379. info_bem = info_createNamespace[1];
  1380. function info_Info(h, props, slots, ctx) {
  1381. var dot = props.dot,
  1382. info = props.info;
  1383. var showInfo = Object(utils["c" /* isDef */])(info) && info !== '';
  1384. if (!dot && !showInfo) {
  1385. return;
  1386. }
  1387. return h("div", helper_default()([{
  1388. "class": info_bem({
  1389. dot: dot
  1390. })
  1391. }, inherit(ctx, true)]), [dot ? '' : props.info]);
  1392. }
  1393. info_Info.props = {
  1394. dot: Boolean,
  1395. info: [Number, String]
  1396. };
  1397. /* harmony default export */ var es_info = (info_createComponent(info_Info));
  1398. // CONCATENATED MODULE: ./es/icon/index.js
  1399. // Utils
  1400. // Components
  1401. // Types
  1402. var icon_createNamespace = Object(create["a" /* createNamespace */])('icon'),
  1403. icon_createComponent = icon_createNamespace[0],
  1404. icon_bem = icon_createNamespace[1];
  1405. function isImage(name) {
  1406. return name ? name.indexOf('/') !== -1 : false;
  1407. } // compatible with legacy usage, should be removed in next major version
  1408. var LEGACY_MAP = {
  1409. medel: 'medal',
  1410. 'medel-o': 'medal-o',
  1411. 'calender-o': 'calendar-o'
  1412. };
  1413. function correctName(name) {
  1414. return name && LEGACY_MAP[name] || name;
  1415. }
  1416. function Icon(h, props, slots, ctx) {
  1417. var _props$badge;
  1418. var name = correctName(props.name);
  1419. var imageIcon = isImage(name);
  1420. if (false) {}
  1421. return h(props.tag, helper_default()([{
  1422. "class": [props.classPrefix, imageIcon ? '' : props.classPrefix + "-" + name],
  1423. "style": {
  1424. color: props.color,
  1425. fontSize: Object(unit["a" /* addUnit */])(props.size)
  1426. }
  1427. }, inherit(ctx, true)]), [slots.default && slots.default(), imageIcon && h("img", {
  1428. "class": icon_bem('image'),
  1429. "attrs": {
  1430. "src": name
  1431. }
  1432. }), h(es_info, {
  1433. "attrs": {
  1434. "dot": props.dot,
  1435. "info": (_props$badge = props.badge) != null ? _props$badge : props.info
  1436. }
  1437. })]);
  1438. }
  1439. Icon.props = {
  1440. dot: Boolean,
  1441. name: String,
  1442. size: [Number, String],
  1443. // @deprecated
  1444. // should be removed in next major version
  1445. info: [Number, String],
  1446. badge: [Number, String],
  1447. color: String,
  1448. tag: {
  1449. type: String,
  1450. default: 'i'
  1451. },
  1452. classPrefix: {
  1453. type: String,
  1454. default: icon_bem()
  1455. }
  1456. };
  1457. /* harmony default export */ var es_icon = (icon_createComponent(Icon));
  1458. // CONCATENATED MODULE: ./es/popup/index.js
  1459. var popup_createNamespace = Object(create["a" /* createNamespace */])('popup'),
  1460. popup_createComponent = popup_createNamespace[0],
  1461. popup_bem = popup_createNamespace[1];
  1462. /* harmony default export */ var popup = (popup_createComponent({
  1463. mixins: [PopupMixin()],
  1464. props: {
  1465. round: Boolean,
  1466. duration: [Number, String],
  1467. closeable: Boolean,
  1468. transition: String,
  1469. safeAreaInsetBottom: Boolean,
  1470. closeIcon: {
  1471. type: String,
  1472. default: 'cross'
  1473. },
  1474. closeIconPosition: {
  1475. type: String,
  1476. default: 'top-right'
  1477. },
  1478. position: {
  1479. type: String,
  1480. default: 'center'
  1481. },
  1482. overlay: {
  1483. type: Boolean,
  1484. default: true
  1485. },
  1486. closeOnClickOverlay: {
  1487. type: Boolean,
  1488. default: true
  1489. }
  1490. },
  1491. beforeCreate: function beforeCreate() {
  1492. var _this = this;
  1493. var createEmitter = function createEmitter(eventName) {
  1494. return function (event) {
  1495. return _this.$emit(eventName, event);
  1496. };
  1497. };
  1498. this.onClick = createEmitter('click');
  1499. this.onOpened = createEmitter('opened');
  1500. this.onClosed = createEmitter('closed');
  1501. },
  1502. methods: {
  1503. onClickCloseIcon: function onClickCloseIcon(event) {
  1504. this.$emit('click-close-icon', event);
  1505. this.close();
  1506. }
  1507. },
  1508. render: function render() {
  1509. var _bem;
  1510. var h = arguments[0];
  1511. if (!this.shouldRender) {
  1512. return;
  1513. }
  1514. var round = this.round,
  1515. position = this.position,
  1516. duration = this.duration;
  1517. var isCenter = position === 'center';
  1518. var transitionName = this.transition || (isCenter ? 'van-fade' : "van-popup-slide-" + position);
  1519. var style = {};
  1520. if (Object(utils["c" /* isDef */])(duration)) {
  1521. var key = isCenter ? 'animationDuration' : 'transitionDuration';
  1522. style[key] = duration + "s";
  1523. }
  1524. return h("transition", {
  1525. "attrs": {
  1526. "appear": this.transitionAppear,
  1527. "name": transitionName
  1528. },
  1529. "on": {
  1530. "afterEnter": this.onOpened,
  1531. "afterLeave": this.onClosed
  1532. }
  1533. }, [h("div", {
  1534. "directives": [{
  1535. name: "show",
  1536. value: this.value
  1537. }],
  1538. "style": style,
  1539. "class": popup_bem((_bem = {
  1540. round: round
  1541. }, _bem[position] = position, _bem['safe-area-inset-bottom'] = this.safeAreaInsetBottom, _bem)),
  1542. "on": {
  1543. "click": this.onClick
  1544. }
  1545. }, [this.slots(), this.closeable && h(es_icon, {
  1546. "attrs": {
  1547. "role": "button",
  1548. "tabindex": "0",
  1549. "name": this.closeIcon
  1550. },
  1551. "class": popup_bem('close-icon', this.closeIconPosition),
  1552. "on": {
  1553. "click": this.onClickCloseIcon
  1554. }
  1555. })])]);
  1556. }
  1557. }));
  1558. // CONCATENATED MODULE: ./es/loading/index.js
  1559. // Utils
  1560. // Types
  1561. var loading_createNamespace = Object(create["a" /* createNamespace */])('loading'),
  1562. loading_createComponent = loading_createNamespace[0],
  1563. loading_bem = loading_createNamespace[1];
  1564. function LoadingIcon(h, props) {
  1565. if (props.type === 'spinner') {
  1566. var Spin = [];
  1567. for (var i = 0; i < 12; i++) {
  1568. Spin.push(h("i"));
  1569. }
  1570. return Spin;
  1571. }
  1572. return h("svg", {
  1573. "class": loading_bem('circular'),
  1574. "attrs": {
  1575. "viewBox": "25 25 50 50"
  1576. }
  1577. }, [h("circle", {
  1578. "attrs": {
  1579. "cx": "50",
  1580. "cy": "50",
  1581. "r": "20",
  1582. "fill": "none"
  1583. }
  1584. })]);
  1585. }
  1586. function LoadingText(h, props, slots) {
  1587. if (slots.default) {
  1588. var _props$textColor;
  1589. var style = {
  1590. fontSize: Object(unit["a" /* addUnit */])(props.textSize),
  1591. color: (_props$textColor = props.textColor) != null ? _props$textColor : props.color
  1592. };
  1593. return h("span", {
  1594. "class": loading_bem('text'),
  1595. "style": style
  1596. }, [slots.default()]);
  1597. }
  1598. }
  1599. function Loading(h, props, slots, ctx) {
  1600. var color = props.color,
  1601. size = props.size,
  1602. type = props.type;
  1603. var style = {
  1604. color: color
  1605. };
  1606. if (size) {
  1607. var iconSize = Object(unit["a" /* addUnit */])(size);
  1608. style.width = iconSize;
  1609. style.height = iconSize;
  1610. }
  1611. return h("div", helper_default()([{
  1612. "class": loading_bem([type, {
  1613. vertical: props.vertical
  1614. }])
  1615. }, inherit(ctx, true)]), [h("span", {
  1616. "class": loading_bem('spinner', type),
  1617. "style": style
  1618. }, [LoadingIcon(h, props)]), LoadingText(h, props, slots)]);
  1619. }
  1620. Loading.props = {
  1621. color: String,
  1622. size: [Number, String],
  1623. vertical: Boolean,
  1624. textSize: [Number, String],
  1625. textColor: String,
  1626. type: {
  1627. type: String,
  1628. default: 'circular'
  1629. }
  1630. };
  1631. /* harmony default export */ var es_loading = (loading_createComponent(Loading));
  1632. // CONCATENATED MODULE: ./es/action-sheet/index.js
  1633. // Utils
  1634. // Mixins
  1635. // Components
  1636. // Types
  1637. var action_sheet_createNamespace = Object(create["a" /* createNamespace */])('action-sheet'),
  1638. action_sheet_createComponent = action_sheet_createNamespace[0],
  1639. action_sheet_bem = action_sheet_createNamespace[1];
  1640. function ActionSheet(h, props, slots, ctx) {
  1641. var title = props.title,
  1642. cancelText = props.cancelText,
  1643. closeable = props.closeable;
  1644. function onCancel() {
  1645. functional_emit(ctx, 'input', false);
  1646. functional_emit(ctx, 'cancel');
  1647. }
  1648. function Header() {
  1649. if (title) {
  1650. return h("div", {
  1651. "class": action_sheet_bem('header')
  1652. }, [title, closeable && h(es_icon, {
  1653. "attrs": {
  1654. "name": props.closeIcon
  1655. },
  1656. "class": action_sheet_bem('close'),
  1657. "on": {
  1658. "click": onCancel
  1659. }
  1660. })]);
  1661. }
  1662. }
  1663. function Option(item, index) {
  1664. var disabled = item.disabled,
  1665. loading = item.loading,
  1666. callback = item.callback;
  1667. function onClickOption(event) {
  1668. event.stopPropagation();
  1669. if (disabled || loading) {
  1670. return;
  1671. }
  1672. if (callback) {
  1673. callback(item);
  1674. }
  1675. if (props.closeOnClickAction) {
  1676. functional_emit(ctx, 'input', false);
  1677. }
  1678. external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a.nextTick(function () {
  1679. functional_emit(ctx, 'select', item, index);
  1680. });
  1681. }
  1682. function OptionContent() {
  1683. if (loading) {
  1684. return h(es_loading, {
  1685. "class": action_sheet_bem('loading-icon')
  1686. });
  1687. }
  1688. return [h("span", {
  1689. "class": action_sheet_bem('name')
  1690. }, [item.name]), item.subname && h("div", {
  1691. "class": action_sheet_bem('subname')
  1692. }, [item.subname])];
  1693. }
  1694. return h("button", {
  1695. "attrs": {
  1696. "type": "button"
  1697. },
  1698. "class": [action_sheet_bem('item', {
  1699. disabled: disabled,
  1700. loading: loading
  1701. }), item.className],
  1702. "style": {
  1703. color: item.color
  1704. },
  1705. "on": {
  1706. "click": onClickOption
  1707. }
  1708. }, [OptionContent()]);
  1709. }
  1710. function CancelText() {
  1711. if (cancelText) {
  1712. return [h("div", {
  1713. "class": action_sheet_bem('gap')
  1714. }), h("button", {
  1715. "attrs": {
  1716. "type": "button"
  1717. },
  1718. "class": action_sheet_bem('cancel'),
  1719. "on": {
  1720. "click": onCancel
  1721. }
  1722. }, [cancelText])];
  1723. }
  1724. }
  1725. function Description() {
  1726. var description = (slots.description == null ? void 0 : slots.description()) || props.description;
  1727. if (description) {
  1728. return h("div", {
  1729. "class": action_sheet_bem('description')
  1730. }, [description]);
  1731. }
  1732. }
  1733. return h(popup, helper_default()([{
  1734. "class": action_sheet_bem(),
  1735. "attrs": {
  1736. "position": "bottom",
  1737. "round": props.round,
  1738. "value": props.value,
  1739. "overlay": props.overlay,
  1740. "duration": props.duration,
  1741. "lazyRender": props.lazyRender,
  1742. "lockScroll": props.lockScroll,
  1743. "getContainer": props.getContainer,
  1744. "closeOnPopstate": props.closeOnPopstate,
  1745. "closeOnClickOverlay": props.closeOnClickOverlay,
  1746. "safeAreaInsetBottom": props.safeAreaInsetBottom
  1747. }
  1748. }, inherit(ctx, true)]), [Header(), Description(), h("div", {
  1749. "class": action_sheet_bem('content')
  1750. }, [props.actions && props.actions.map(Option), slots.default == null ? void 0 : slots.default()]), CancelText()]);
  1751. }
  1752. ActionSheet.props = _extends({}, popupMixinProps, {
  1753. title: String,
  1754. actions: Array,
  1755. duration: [Number, String],
  1756. cancelText: String,
  1757. description: String,
  1758. getContainer: [String, Function],
  1759. closeOnPopstate: Boolean,
  1760. closeOnClickAction: Boolean,
  1761. round: {
  1762. type: Boolean,
  1763. default: true
  1764. },
  1765. closeable: {
  1766. type: Boolean,
  1767. default: true
  1768. },
  1769. closeIcon: {
  1770. type: String,
  1771. default: 'cross'
  1772. },
  1773. safeAreaInsetBottom: {
  1774. type: Boolean,
  1775. default: true
  1776. },
  1777. overlay: {
  1778. type: Boolean,
  1779. default: true
  1780. },
  1781. closeOnClickOverlay: {
  1782. type: Boolean,
  1783. default: true
  1784. }
  1785. });
  1786. /* harmony default export */ var action_sheet = (action_sheet_createComponent(ActionSheet));
  1787. // CONCATENATED MODULE: ./es/utils/validate/mobile.js
  1788. function isMobile(value) {
  1789. value = value.replace(/[^-|\d]/g, '');
  1790. return /^((\+86)|(86))?(1)\d{10}$/.test(value) || /^0[0-9-]{10,13}$/.test(value);
  1791. }
  1792. // CONCATENATED MODULE: ./es/picker/shared.js
  1793. var DEFAULT_ITEM_HEIGHT = 44;
  1794. var pickerProps = {
  1795. title: String,
  1796. loading: Boolean,
  1797. readonly: Boolean,
  1798. itemHeight: [Number, String],
  1799. showToolbar: Boolean,
  1800. cancelButtonText: String,
  1801. confirmButtonText: String,
  1802. allowHtml: {
  1803. type: Boolean,
  1804. default: true
  1805. },
  1806. visibleItemCount: {
  1807. type: [Number, String],
  1808. default: 6
  1809. },
  1810. swipeDuration: {
  1811. type: [Number, String],
  1812. default: 1000
  1813. }
  1814. };
  1815. // CONCATENATED MODULE: ./es/utils/constant.js
  1816. // color
  1817. var RED = '#ee0a24'; // border
  1818. var BORDER = 'van-hairline';
  1819. var BORDER_TOP = BORDER + "--top";
  1820. var BORDER_LEFT = BORDER + "--left";
  1821. var BORDER_BOTTOM = BORDER + "--bottom";
  1822. var BORDER_SURROUND = BORDER + "--surround";
  1823. var BORDER_TOP_BOTTOM = BORDER + "--top-bottom";
  1824. var BORDER_UNSET_TOP_BOTTOM = BORDER + "-unset--top-bottom";
  1825. // CONCATENATED MODULE: ./es/utils/deep-clone.js
  1826. function deepClone(obj) {
  1827. if (!Object(utils["c" /* isDef */])(obj)) {
  1828. return obj;
  1829. }
  1830. if (Array.isArray(obj)) {
  1831. return obj.map(function (item) {
  1832. return deepClone(item);
  1833. });
  1834. }
  1835. if (typeof obj === 'object') {
  1836. var to = {};
  1837. Object.keys(obj).forEach(function (key) {
  1838. to[key] = deepClone(obj[key]);
  1839. });
  1840. return to;
  1841. }
  1842. return obj;
  1843. }
  1844. // CONCATENATED MODULE: ./es/utils/format/number.js
  1845. function range(num, min, max) {
  1846. return Math.min(Math.max(num, min), max);
  1847. }
  1848. function trimExtraChar(value, _char, regExp) {
  1849. var index = value.indexOf(_char);
  1850. var prefix = '';
  1851. if (index === -1) {
  1852. return value;
  1853. }
  1854. if (_char === '-' && index !== 0) {
  1855. return value.slice(0, index);
  1856. }
  1857. if (_char === '.' && value.match(/^(\.|-\.)/)) {
  1858. prefix = index ? '-0' : '0';
  1859. }
  1860. return prefix + value.slice(0, index + 1) + value.slice(index).replace(regExp, '');
  1861. }
  1862. function number_formatNumber(value, allowDot, allowMinus) {
  1863. if (allowDot === void 0) {
  1864. allowDot = true;
  1865. }
  1866. if (allowMinus === void 0) {
  1867. allowMinus = true;
  1868. }
  1869. if (allowDot) {
  1870. value = trimExtraChar(value, '.', /\./g);
  1871. } else {
  1872. value = value.split('.')[0];
  1873. }
  1874. if (allowMinus) {
  1875. value = trimExtraChar(value, '-', /-/g);
  1876. } else {
  1877. value = value.replace(/-/, '');
  1878. }
  1879. var regExp = allowDot ? /[^-0-9.]/g : /[^-0-9]/g;
  1880. return value.replace(regExp, '');
  1881. } // add num and avoid float number
  1882. function addNumber(num1, num2) {
  1883. var cardinal = Math.pow(10, 10);
  1884. return Math.round((num1 + num2) * cardinal) / cardinal;
  1885. }
  1886. // CONCATENATED MODULE: ./es/picker/PickerColumn.js
  1887. var DEFAULT_DURATION = 200; // 惯性滑动思路:
  1888. // 在手指离开屏幕时,如果和上一次 move 时的间隔小于 `MOMENTUM_LIMIT_TIME` 且 move
  1889. // 距离大于 `MOMENTUM_LIMIT_DISTANCE` 时,执行惯性滑动
  1890. var MOMENTUM_LIMIT_TIME = 300;
  1891. var MOMENTUM_LIMIT_DISTANCE = 15;
  1892. var PickerColumn_createNamespace = Object(create["a" /* createNamespace */])('picker-column'),
  1893. PickerColumn_createComponent = PickerColumn_createNamespace[0],
  1894. PickerColumn_bem = PickerColumn_createNamespace[1];
  1895. function getElementTranslateY(element) {
  1896. var style = window.getComputedStyle(element);
  1897. var transform = style.transform || style.webkitTransform;
  1898. var translateY = transform.slice(7, transform.length - 1).split(', ')[5];
  1899. return Number(translateY);
  1900. }
  1901. function isOptionDisabled(option) {
  1902. return Object(utils["f" /* isObject */])(option) && option.disabled;
  1903. }
  1904. /* harmony default export */ var PickerColumn = (PickerColumn_createComponent({
  1905. mixins: [TouchMixin],
  1906. props: {
  1907. valueKey: String,
  1908. readonly: Boolean,
  1909. allowHtml: Boolean,
  1910. className: String,
  1911. itemHeight: Number,
  1912. defaultIndex: Number,
  1913. swipeDuration: [Number, String],
  1914. visibleItemCount: [Number, String],
  1915. initialOptions: {
  1916. type: Array,
  1917. default: function _default() {
  1918. return [];
  1919. }
  1920. }
  1921. },
  1922. data: function data() {
  1923. return {
  1924. offset: 0,
  1925. duration: 0,
  1926. options: deepClone(this.initialOptions),
  1927. currentIndex: this.defaultIndex
  1928. };
  1929. },
  1930. created: function created() {
  1931. if (this.$parent.children) {
  1932. this.$parent.children.push(this);
  1933. }
  1934. this.setIndex(this.currentIndex);
  1935. },
  1936. mounted: function mounted() {
  1937. this.bindTouchEvent(this.$el);
  1938. },
  1939. destroyed: function destroyed() {
  1940. var children = this.$parent.children;
  1941. if (children) {
  1942. children.splice(children.indexOf(this), 1);
  1943. }
  1944. },
  1945. watch: {
  1946. initialOptions: 'setOptions',
  1947. defaultIndex: function defaultIndex(val) {
  1948. this.setIndex(val);
  1949. }
  1950. },
  1951. computed: {
  1952. count: function count() {
  1953. return this.options.length;
  1954. },
  1955. baseOffset: function baseOffset() {
  1956. return this.itemHeight * (this.visibleItemCount - 1) / 2;
  1957. }
  1958. },
  1959. methods: {
  1960. setOptions: function setOptions(options) {
  1961. if (JSON.stringify(options) !== JSON.stringify(this.options)) {
  1962. this.options = deepClone(options);
  1963. this.setIndex(this.defaultIndex);
  1964. }
  1965. },
  1966. onTouchStart: function onTouchStart(event) {
  1967. if (this.readonly) {
  1968. return;
  1969. }
  1970. this.touchStart(event);
  1971. if (this.moving) {
  1972. var translateY = getElementTranslateY(this.$refs.wrapper);
  1973. this.offset = Math.min(0, translateY - this.baseOffset);
  1974. this.startOffset = this.offset;
  1975. } else {
  1976. this.startOffset = this.offset;
  1977. }
  1978. this.duration = 0;
  1979. this.transitionEndTrigger = null;
  1980. this.touchStartTime = Date.now();
  1981. this.momentumOffset = this.startOffset;
  1982. },
  1983. onTouchMove: function onTouchMove(event) {
  1984. if (this.readonly) {
  1985. return;
  1986. }
  1987. this.touchMove(event);
  1988. if (this.direction === 'vertical') {
  1989. this.moving = true;
  1990. preventDefault(event, true);
  1991. }
  1992. this.offset = range(this.startOffset + this.deltaY, -(this.count * this.itemHeight), this.itemHeight);
  1993. var now = Date.now();
  1994. if (now - this.touchStartTime > MOMENTUM_LIMIT_TIME) {
  1995. this.touchStartTime = now;
  1996. this.momentumOffset = this.offset;
  1997. }
  1998. },
  1999. onTouchEnd: function onTouchEnd() {
  2000. var _this = this;
  2001. if (this.readonly) {
  2002. return;
  2003. }
  2004. var distance = this.offset - this.momentumOffset;
  2005. var duration = Date.now() - this.touchStartTime;
  2006. var allowMomentum = duration < MOMENTUM_LIMIT_TIME && Math.abs(distance) > MOMENTUM_LIMIT_DISTANCE;
  2007. if (allowMomentum) {
  2008. this.momentum(distance, duration);
  2009. return;
  2010. }
  2011. var index = this.getIndexByOffset(this.offset);
  2012. this.duration = DEFAULT_DURATION;
  2013. this.setIndex(index, true); // compatible with desktop scenario
  2014. // use setTimeout to skip the click event Emitted after touchstart
  2015. setTimeout(function () {
  2016. _this.moving = false;
  2017. }, 0);
  2018. },
  2019. onTransitionEnd: function onTransitionEnd() {
  2020. this.stopMomentum();
  2021. },
  2022. onClickItem: function onClickItem(index) {
  2023. if (this.moving || this.readonly) {
  2024. return;
  2025. }
  2026. this.transitionEndTrigger = null;
  2027. this.duration = DEFAULT_DURATION;
  2028. this.setIndex(index, true);
  2029. },
  2030. adjustIndex: function adjustIndex(index) {
  2031. index = range(index, 0, this.count);
  2032. for (var i = index; i < this.count; i++) {
  2033. if (!isOptionDisabled(this.options[i])) return i;
  2034. }
  2035. for (var _i = index - 1; _i >= 0; _i--) {
  2036. if (!isOptionDisabled(this.options[_i])) return _i;
  2037. }
  2038. },
  2039. getOptionText: function getOptionText(option) {
  2040. if (Object(utils["f" /* isObject */])(option) && this.valueKey in option) {
  2041. return option[this.valueKey];
  2042. }
  2043. return option;
  2044. },
  2045. setIndex: function setIndex(index, emitChange) {
  2046. var _this2 = this;
  2047. index = this.adjustIndex(index) || 0;
  2048. var offset = -index * this.itemHeight;
  2049. var trigger = function trigger() {
  2050. if (index !== _this2.currentIndex) {
  2051. _this2.currentIndex = index;
  2052. if (emitChange) {
  2053. _this2.$emit('change', index);
  2054. }
  2055. }
  2056. }; // trigger the change event after transitionend when moving
  2057. if (this.moving && offset !== this.offset) {
  2058. this.transitionEndTrigger = trigger;
  2059. } else {
  2060. trigger();
  2061. }
  2062. this.offset = offset;
  2063. },
  2064. setValue: function setValue(value) {
  2065. var options = this.options;
  2066. for (var i = 0; i < options.length; i++) {
  2067. if (this.getOptionText(options[i]) === value) {
  2068. return this.setIndex(i);
  2069. }
  2070. }
  2071. },
  2072. getValue: function getValue() {
  2073. return this.options[this.currentIndex];
  2074. },
  2075. getIndexByOffset: function getIndexByOffset(offset) {
  2076. return range(Math.round(-offset / this.itemHeight), 0, this.count - 1);
  2077. },
  2078. momentum: function momentum(distance, duration) {
  2079. var speed = Math.abs(distance / duration);
  2080. distance = this.offset + speed / 0.003 * (distance < 0 ? -1 : 1);
  2081. var index = this.getIndexByOffset(distance);
  2082. this.duration = +this.swipeDuration;
  2083. this.setIndex(index, true);
  2084. },
  2085. stopMomentum: function stopMomentum() {
  2086. this.moving = false;
  2087. this.duration = 0;
  2088. if (this.transitionEndTrigger) {
  2089. this.transitionEndTrigger();
  2090. this.transitionEndTrigger = null;
  2091. }
  2092. },
  2093. genOptions: function genOptions() {
  2094. var _this3 = this;
  2095. var h = this.$createElement;
  2096. var optionStyle = {
  2097. height: this.itemHeight + "px"
  2098. };
  2099. return this.options.map(function (option, index) {
  2100. var _domProps;
  2101. var text = _this3.getOptionText(option);
  2102. var disabled = isOptionDisabled(option);
  2103. var data = {
  2104. style: optionStyle,
  2105. attrs: {
  2106. role: 'button',
  2107. tabindex: disabled ? -1 : 0
  2108. },
  2109. class: [PickerColumn_bem('item', {
  2110. disabled: disabled,
  2111. selected: index === _this3.currentIndex
  2112. })],
  2113. on: {
  2114. click: function click() {
  2115. _this3.onClickItem(index);
  2116. }
  2117. }
  2118. };
  2119. var childData = {
  2120. class: 'van-ellipsis',
  2121. domProps: (_domProps = {}, _domProps[_this3.allowHtml ? 'innerHTML' : 'textContent'] = text, _domProps)
  2122. };
  2123. return h("li", helper_default()([{}, data]), [_this3.slots('option', option) || h("div", helper_default()([{}, childData]))]);
  2124. });
  2125. }
  2126. },
  2127. render: function render() {
  2128. var h = arguments[0];
  2129. var wrapperStyle = {
  2130. transform: "translate3d(0, " + (this.offset + this.baseOffset) + "px, 0)",
  2131. transitionDuration: this.duration + "ms",
  2132. transitionProperty: this.duration ? 'all' : 'none'
  2133. };
  2134. return h("div", {
  2135. "class": [PickerColumn_bem(), this.className]
  2136. }, [h("ul", {
  2137. "ref": "wrapper",
  2138. "style": wrapperStyle,
  2139. "class": PickerColumn_bem('wrapper'),
  2140. "on": {
  2141. "transitionend": this.onTransitionEnd
  2142. }
  2143. }, [this.genOptions()])]);
  2144. }
  2145. }));
  2146. // CONCATENATED MODULE: ./es/picker/index.js
  2147. // Utils
  2148. // Components
  2149. var picker_createNamespace = Object(create["a" /* createNamespace */])('picker'),
  2150. picker_createComponent = picker_createNamespace[0],
  2151. picker_bem = picker_createNamespace[1],
  2152. t = picker_createNamespace[2];
  2153. /* harmony default export */ var picker = (picker_createComponent({
  2154. props: _extends({}, pickerProps, {
  2155. defaultIndex: {
  2156. type: [Number, String],
  2157. default: 0
  2158. },
  2159. columns: {
  2160. type: Array,
  2161. default: function _default() {
  2162. return [];
  2163. }
  2164. },
  2165. toolbarPosition: {
  2166. type: String,
  2167. default: 'top'
  2168. },
  2169. valueKey: {
  2170. type: String,
  2171. default: 'text'
  2172. }
  2173. }),
  2174. data: function data() {
  2175. return {
  2176. children: [],
  2177. formattedColumns: []
  2178. };
  2179. },
  2180. computed: {
  2181. itemPxHeight: function itemPxHeight() {
  2182. return this.itemHeight ? Object(unit["b" /* unitToPx */])(this.itemHeight) : DEFAULT_ITEM_HEIGHT;
  2183. },
  2184. dataType: function dataType() {
  2185. var columns = this.columns;
  2186. var firstColumn = columns[0] || {};
  2187. if (firstColumn.children) {
  2188. return 'cascade';
  2189. }
  2190. if (firstColumn.values) {
  2191. return 'object';
  2192. }
  2193. return 'text';
  2194. }
  2195. },
  2196. watch: {
  2197. columns: {
  2198. handler: 'format',
  2199. immediate: true
  2200. }
  2201. },
  2202. methods: {
  2203. format: function format() {
  2204. var columns = this.columns,
  2205. dataType = this.dataType;
  2206. if (dataType === 'text') {
  2207. this.formattedColumns = [{
  2208. values: columns
  2209. }];
  2210. } else if (dataType === 'cascade') {
  2211. this.formatCascade();
  2212. } else {
  2213. this.formattedColumns = columns;
  2214. }
  2215. },
  2216. formatCascade: function formatCascade() {
  2217. var formatted = [];
  2218. var cursor = {
  2219. children: this.columns
  2220. };
  2221. while (cursor && cursor.children) {
  2222. var _cursor$defaultIndex;
  2223. var _cursor = cursor,
  2224. children = _cursor.children;
  2225. var defaultIndex = (_cursor$defaultIndex = cursor.defaultIndex) != null ? _cursor$defaultIndex : +this.defaultIndex;
  2226. while (children[defaultIndex] && children[defaultIndex].disabled) {
  2227. if (defaultIndex < children.length - 1) {
  2228. defaultIndex++;
  2229. } else {
  2230. defaultIndex = 0;
  2231. break;
  2232. }
  2233. }
  2234. formatted.push({
  2235. values: cursor.children,
  2236. className: cursor.className,
  2237. defaultIndex: defaultIndex
  2238. });
  2239. cursor = children[defaultIndex];
  2240. }
  2241. this.formattedColumns = formatted;
  2242. },
  2243. emit: function emit(event) {
  2244. var _this = this;
  2245. if (this.dataType === 'text') {
  2246. this.$emit(event, this.getColumnValue(0), this.getColumnIndex(0));
  2247. } else {
  2248. var values = this.getValues(); // compatible with old version of wrong parameters
  2249. // should be removed in next major version
  2250. // see: https://github.com/youzan/vant/issues/5905
  2251. if (this.dataType === 'cascade') {
  2252. values = values.map(function (item) {
  2253. return item[_this.valueKey];
  2254. });
  2255. }
  2256. this.$emit(event, values, this.getIndexes());
  2257. }
  2258. },
  2259. onCascadeChange: function onCascadeChange(columnIndex) {
  2260. var cursor = {
  2261. children: this.columns
  2262. };
  2263. var indexes = this.getIndexes();
  2264. for (var i = 0; i <= columnIndex; i++) {
  2265. cursor = cursor.children[indexes[i]];
  2266. }
  2267. while (cursor && cursor.children) {
  2268. columnIndex++;
  2269. this.setColumnValues(columnIndex, cursor.children);
  2270. cursor = cursor.children[cursor.defaultIndex || 0];
  2271. }
  2272. },
  2273. onChange: function onChange(columnIndex) {
  2274. var _this2 = this;
  2275. if (this.dataType === 'cascade') {
  2276. this.onCascadeChange(columnIndex);
  2277. }
  2278. if (this.dataType === 'text') {
  2279. this.$emit('change', this, this.getColumnValue(0), this.getColumnIndex(0));
  2280. } else {
  2281. var values = this.getValues(); // compatible with old version of wrong parameters
  2282. // should be removed in next major version
  2283. // see: https://github.com/youzan/vant/issues/5905
  2284. if (this.dataType === 'cascade') {
  2285. values = values.map(function (item) {
  2286. return item[_this2.valueKey];
  2287. });
  2288. }
  2289. this.$emit('change', this, values, columnIndex);
  2290. }
  2291. },
  2292. // get column instance by index
  2293. getColumn: function getColumn(index) {
  2294. return this.children[index];
  2295. },
  2296. // @exposed-api
  2297. // get column value by index
  2298. getColumnValue: function getColumnValue(index) {
  2299. var column = this.getColumn(index);
  2300. return column && column.getValue();
  2301. },
  2302. // @exposed-api
  2303. // set column value by index
  2304. setColumnValue: function setColumnValue(index, value) {
  2305. var column = this.getColumn(index);
  2306. if (column) {
  2307. column.setValue(value);
  2308. if (this.dataType === 'cascade') {
  2309. this.onCascadeChange(index);
  2310. }
  2311. }
  2312. },
  2313. // @exposed-api
  2314. // get column option index by column index
  2315. getColumnIndex: function getColumnIndex(columnIndex) {
  2316. return (this.getColumn(columnIndex) || {}).currentIndex;
  2317. },
  2318. // @exposed-api
  2319. // set column option index by column index
  2320. setColumnIndex: function setColumnIndex(columnIndex, optionIndex) {
  2321. var column = this.getColumn(columnIndex);
  2322. if (column) {
  2323. column.setIndex(optionIndex);
  2324. if (this.dataType === 'cascade') {
  2325. this.onCascadeChange(columnIndex);
  2326. }
  2327. }
  2328. },
  2329. // @exposed-api
  2330. // get options of column by index
  2331. getColumnValues: function getColumnValues(index) {
  2332. return (this.children[index] || {}).options;
  2333. },
  2334. // @exposed-api
  2335. // set options of column by index
  2336. setColumnValues: function setColumnValues(index, options) {
  2337. var column = this.children[index];
  2338. if (column) {
  2339. column.setOptions(options);
  2340. }
  2341. },
  2342. // @exposed-api
  2343. // get values of all columns
  2344. getValues: function getValues() {
  2345. return this.children.map(function (child) {
  2346. return child.getValue();
  2347. });
  2348. },
  2349. // @exposed-api
  2350. // set values of all columns
  2351. setValues: function setValues(values) {
  2352. var _this3 = this;
  2353. values.forEach(function (value, index) {
  2354. _this3.setColumnValue(index, value);
  2355. });
  2356. },
  2357. // @exposed-api
  2358. // get indexes of all columns
  2359. getIndexes: function getIndexes() {
  2360. return this.children.map(function (child) {
  2361. return child.currentIndex;
  2362. });
  2363. },
  2364. // @exposed-api
  2365. // set indexes of all columns
  2366. setIndexes: function setIndexes(indexes) {
  2367. var _this4 = this;
  2368. indexes.forEach(function (optionIndex, columnIndex) {
  2369. _this4.setColumnIndex(columnIndex, optionIndex);
  2370. });
  2371. },
  2372. // @exposed-api
  2373. confirm: function confirm() {
  2374. this.children.forEach(function (child) {
  2375. return child.stopMomentum();
  2376. });
  2377. this.emit('confirm');
  2378. },
  2379. cancel: function cancel() {
  2380. this.emit('cancel');
  2381. },
  2382. genTitle: function genTitle() {
  2383. var h = this.$createElement;
  2384. var titleSlot = this.slots('title');
  2385. if (titleSlot) {
  2386. return titleSlot;
  2387. }
  2388. if (this.title) {
  2389. return h("div", {
  2390. "class": ['van-ellipsis', picker_bem('title')]
  2391. }, [this.title]);
  2392. }
  2393. },
  2394. genCancel: function genCancel() {
  2395. var h = this.$createElement;
  2396. return h("button", {
  2397. "attrs": {
  2398. "type": "button"
  2399. },
  2400. "class": picker_bem('cancel'),
  2401. "on": {
  2402. "click": this.cancel
  2403. }
  2404. }, [this.slots('cancel') || this.cancelButtonText || t('cancel')]);
  2405. },
  2406. genConfirm: function genConfirm() {
  2407. var h = this.$createElement;
  2408. return h("button", {
  2409. "attrs": {
  2410. "type": "button"
  2411. },
  2412. "class": picker_bem('confirm'),
  2413. "on": {
  2414. "click": this.confirm
  2415. }
  2416. }, [this.slots('confirm') || this.confirmButtonText || t('confirm')]);
  2417. },
  2418. genToolbar: function genToolbar() {
  2419. var h = this.$createElement;
  2420. if (this.showToolbar) {
  2421. return h("div", {
  2422. "class": picker_bem('toolbar')
  2423. }, [this.slots() || [this.genCancel(), this.genTitle(), this.genConfirm()]]);
  2424. }
  2425. },
  2426. genColumns: function genColumns() {
  2427. var h = this.$createElement;
  2428. var itemPxHeight = this.itemPxHeight;
  2429. var wrapHeight = itemPxHeight * this.visibleItemCount;
  2430. var frameStyle = {
  2431. height: itemPxHeight + "px"
  2432. };
  2433. var columnsStyle = {
  2434. height: wrapHeight + "px"
  2435. };
  2436. var maskStyle = {
  2437. backgroundSize: "100% " + (wrapHeight - itemPxHeight) / 2 + "px"
  2438. };
  2439. return h("div", {
  2440. "class": picker_bem('columns'),
  2441. "style": columnsStyle,
  2442. "on": {
  2443. "touchmove": preventDefault
  2444. }
  2445. }, [this.genColumnItems(), h("div", {
  2446. "class": picker_bem('mask'),
  2447. "style": maskStyle
  2448. }), h("div", {
  2449. "class": [BORDER_UNSET_TOP_BOTTOM, picker_bem('frame')],
  2450. "style": frameStyle
  2451. })]);
  2452. },
  2453. genColumnItems: function genColumnItems() {
  2454. var _this5 = this;
  2455. var h = this.$createElement;
  2456. return this.formattedColumns.map(function (item, columnIndex) {
  2457. var _item$defaultIndex;
  2458. return h(PickerColumn, {
  2459. "attrs": {
  2460. "readonly": _this5.readonly,
  2461. "valueKey": _this5.valueKey,
  2462. "allowHtml": _this5.allowHtml,
  2463. "className": item.className,
  2464. "itemHeight": _this5.itemPxHeight,
  2465. "defaultIndex": (_item$defaultIndex = item.defaultIndex) != null ? _item$defaultIndex : +_this5.defaultIndex,
  2466. "swipeDuration": _this5.swipeDuration,
  2467. "visibleItemCount": _this5.visibleItemCount,
  2468. "initialOptions": item.values
  2469. },
  2470. "scopedSlots": {
  2471. option: _this5.$scopedSlots.option
  2472. },
  2473. "on": {
  2474. "change": function change() {
  2475. _this5.onChange(columnIndex);
  2476. }
  2477. }
  2478. });
  2479. });
  2480. }
  2481. },
  2482. render: function render(h) {
  2483. return h("div", {
  2484. "class": picker_bem()
  2485. }, [this.toolbarPosition === 'top' ? this.genToolbar() : h(), this.loading ? h(es_loading, {
  2486. "class": picker_bem('loading')
  2487. }) : h(), this.slots('columns-top'), this.genColumns(), this.slots('columns-bottom'), this.toolbarPosition === 'bottom' ? this.genToolbar() : h()]);
  2488. }
  2489. }));
  2490. // CONCATENATED MODULE: ./es/area/index.js
  2491. var area_createNamespace = Object(create["a" /* createNamespace */])('area'),
  2492. area_createComponent = area_createNamespace[0],
  2493. area_bem = area_createNamespace[1];
  2494. var PLACEHOLDER_CODE = '000000';
  2495. function isOverseaCode(code) {
  2496. return code[0] === '9';
  2497. }
  2498. function pickSlots(instance, keys) {
  2499. var $slots = instance.$slots,
  2500. $scopedSlots = instance.$scopedSlots;
  2501. var scopedSlots = {};
  2502. keys.forEach(function (key) {
  2503. if ($scopedSlots[key]) {
  2504. scopedSlots[key] = $scopedSlots[key];
  2505. } else if ($slots[key]) {
  2506. scopedSlots[key] = function () {
  2507. return $slots[key];
  2508. };
  2509. }
  2510. });
  2511. return scopedSlots;
  2512. }
  2513. /* harmony default export */ var es_area = (area_createComponent({
  2514. props: _extends({}, pickerProps, {
  2515. value: String,
  2516. areaList: {
  2517. type: Object,
  2518. default: function _default() {
  2519. return {};
  2520. }
  2521. },
  2522. columnsNum: {
  2523. type: [Number, String],
  2524. default: 3
  2525. },
  2526. isOverseaCode: {
  2527. type: Function,
  2528. default: isOverseaCode
  2529. },
  2530. columnsPlaceholder: {
  2531. type: Array,
  2532. default: function _default() {
  2533. return [];
  2534. }
  2535. }
  2536. }),
  2537. data: function data() {
  2538. return {
  2539. code: this.value,
  2540. columns: [{
  2541. values: []
  2542. }, {
  2543. values: []
  2544. }, {
  2545. values: []
  2546. }]
  2547. };
  2548. },
  2549. computed: {
  2550. province: function province() {
  2551. return this.areaList.province_list || {};
  2552. },
  2553. city: function city() {
  2554. return this.areaList.city_list || {};
  2555. },
  2556. county: function county() {
  2557. return this.areaList.county_list || {};
  2558. },
  2559. displayColumns: function displayColumns() {
  2560. return this.columns.slice(0, +this.columnsNum);
  2561. },
  2562. placeholderMap: function placeholderMap() {
  2563. return {
  2564. province: this.columnsPlaceholder[0] || '',
  2565. city: this.columnsPlaceholder[1] || '',
  2566. county: this.columnsPlaceholder[2] || ''
  2567. };
  2568. }
  2569. },
  2570. watch: {
  2571. value: function value(val) {
  2572. this.code = val;
  2573. this.setValues();
  2574. },
  2575. areaList: {
  2576. deep: true,
  2577. handler: 'setValues'
  2578. },
  2579. columnsNum: function columnsNum() {
  2580. var _this = this;
  2581. this.$nextTick(function () {
  2582. _this.setValues();
  2583. });
  2584. }
  2585. },
  2586. mounted: function mounted() {
  2587. this.setValues();
  2588. },
  2589. methods: {
  2590. // get list by code
  2591. getList: function getList(type, code) {
  2592. var result = [];
  2593. if (type !== 'province' && !code) {
  2594. return result;
  2595. }
  2596. var list = this[type];
  2597. result = Object.keys(list).map(function (listCode) {
  2598. return {
  2599. code: listCode,
  2600. name: list[listCode]
  2601. };
  2602. });
  2603. if (code) {
  2604. // oversea code
  2605. if (this.isOverseaCode(code) && type === 'city') {
  2606. code = '9';
  2607. }
  2608. result = result.filter(function (item) {
  2609. return item.code.indexOf(code) === 0;
  2610. });
  2611. }
  2612. if (this.placeholderMap[type] && result.length) {
  2613. // set columns placeholder
  2614. var codeFill = '';
  2615. if (type === 'city') {
  2616. codeFill = PLACEHOLDER_CODE.slice(2, 4);
  2617. } else if (type === 'county') {
  2618. codeFill = PLACEHOLDER_CODE.slice(4, 6);
  2619. }
  2620. result.unshift({
  2621. code: "" + code + codeFill,
  2622. name: this.placeholderMap[type]
  2623. });
  2624. }
  2625. return result;
  2626. },
  2627. // get index by code
  2628. getIndex: function getIndex(type, code) {
  2629. var compareNum = type === 'province' ? 2 : type === 'city' ? 4 : 6;
  2630. var list = this.getList(type, code.slice(0, compareNum - 2)); // oversea code
  2631. if (this.isOverseaCode(code) && type === 'province') {
  2632. compareNum = 1;
  2633. }
  2634. code = code.slice(0, compareNum);
  2635. for (var i = 0; i < list.length; i++) {
  2636. if (list[i].code.slice(0, compareNum) === code) {
  2637. return i;
  2638. }
  2639. }
  2640. return 0;
  2641. },
  2642. // parse output columns data
  2643. parseOutputValues: function parseOutputValues(values) {
  2644. var _this2 = this;
  2645. return values.map(function (value, index) {
  2646. // save undefined value
  2647. if (!value) return value;
  2648. value = JSON.parse(JSON.stringify(value));
  2649. if (!value.code || value.name === _this2.columnsPlaceholder[index]) {
  2650. value.code = '';
  2651. value.name = '';
  2652. }
  2653. return value;
  2654. });
  2655. },
  2656. onChange: function onChange(picker, values, index) {
  2657. this.code = values[index].code;
  2658. this.setValues();
  2659. var parsedValues = this.parseOutputValues(picker.getValues());
  2660. this.$emit('change', picker, parsedValues, index);
  2661. },
  2662. onConfirm: function onConfirm(values, index) {
  2663. values = this.parseOutputValues(values);
  2664. this.setValues();
  2665. this.$emit('confirm', values, index);
  2666. },
  2667. getDefaultCode: function getDefaultCode() {
  2668. if (this.columnsPlaceholder.length) {
  2669. return PLACEHOLDER_CODE;
  2670. }
  2671. var countyCodes = Object.keys(this.county);
  2672. if (countyCodes[0]) {
  2673. return countyCodes[0];
  2674. }
  2675. var cityCodes = Object.keys(this.city);
  2676. if (cityCodes[0]) {
  2677. return cityCodes[0];
  2678. }
  2679. return '';
  2680. },
  2681. setValues: function setValues() {
  2682. var code = this.code;
  2683. if (!code) {
  2684. code = this.getDefaultCode();
  2685. }
  2686. var picker = this.$refs.picker;
  2687. var province = this.getList('province');
  2688. var city = this.getList('city', code.slice(0, 2));
  2689. if (!picker) {
  2690. return;
  2691. }
  2692. picker.setColumnValues(0, province);
  2693. picker.setColumnValues(1, city);
  2694. if (city.length && code.slice(2, 4) === '00' && !this.isOverseaCode(code)) {
  2695. code = city[0].code;
  2696. }
  2697. picker.setColumnValues(2, this.getList('county', code.slice(0, 4)));
  2698. picker.setIndexes([this.getIndex('province', code), this.getIndex('city', code), this.getIndex('county', code)]);
  2699. },
  2700. getValues: function getValues() {
  2701. var picker = this.$refs.picker;
  2702. var getValues = picker ? picker.getValues().filter(function (value) {
  2703. return !!value;
  2704. }) : [];
  2705. getValues = this.parseOutputValues(getValues);
  2706. return getValues;
  2707. },
  2708. getArea: function getArea() {
  2709. var values = this.getValues();
  2710. var area = {
  2711. code: '',
  2712. country: '',
  2713. province: '',
  2714. city: '',
  2715. county: ''
  2716. };
  2717. if (!values.length) {
  2718. return area;
  2719. }
  2720. var names = values.map(function (item) {
  2721. return item.name;
  2722. });
  2723. var validValues = values.filter(function (value) {
  2724. return !!value.code;
  2725. });
  2726. area.code = validValues.length ? validValues[validValues.length - 1].code : '';
  2727. if (this.isOverseaCode(area.code)) {
  2728. area.country = names[1] || '';
  2729. area.province = names[2] || '';
  2730. } else {
  2731. area.province = names[0] || '';
  2732. area.city = names[1] || '';
  2733. area.county = names[2] || '';
  2734. }
  2735. return area;
  2736. },
  2737. // @exposed-api
  2738. reset: function reset(code) {
  2739. this.code = code || '';
  2740. this.setValues();
  2741. }
  2742. },
  2743. render: function render() {
  2744. var h = arguments[0];
  2745. var on = _extends({}, this.$listeners, {
  2746. change: this.onChange,
  2747. confirm: this.onConfirm
  2748. });
  2749. return h(picker, {
  2750. "ref": "picker",
  2751. "class": area_bem(),
  2752. "attrs": {
  2753. "showToolbar": true,
  2754. "valueKey": "name",
  2755. "title": this.title,
  2756. "columns": this.displayColumns,
  2757. "loading": this.loading,
  2758. "readonly": this.readonly,
  2759. "itemHeight": this.itemHeight,
  2760. "swipeDuration": this.swipeDuration,
  2761. "visibleItemCount": this.visibleItemCount,
  2762. "cancelButtonText": this.cancelButtonText,
  2763. "confirmButtonText": this.confirmButtonText
  2764. },
  2765. "scopedSlots": pickSlots(this, ['title', 'columns-top', 'columns-bottom']),
  2766. "on": _extends({}, on)
  2767. });
  2768. }
  2769. }));
  2770. // CONCATENATED MODULE: ./es/utils/router.js
  2771. /**
  2772. * Vue Router support
  2773. */
  2774. function isRedundantNavigation(err) {
  2775. return err.name === 'NavigationDuplicated' || // compatible with vue-router@3.3
  2776. err.message && err.message.indexOf('redundant navigation') !== -1;
  2777. }
  2778. function route(router, config) {
  2779. var to = config.to,
  2780. url = config.url,
  2781. replace = config.replace;
  2782. if (to && router) {
  2783. var promise = router[replace ? 'replace' : 'push'](to);
  2784. /* istanbul ignore else */
  2785. if (promise && promise.catch) {
  2786. promise.catch(function (err) {
  2787. if (err && !isRedundantNavigation(err)) {
  2788. throw err;
  2789. }
  2790. });
  2791. }
  2792. } else if (url) {
  2793. replace ? location.replace(url) : location.href = url;
  2794. }
  2795. }
  2796. function functionalRoute(context) {
  2797. route(context.parent && context.parent.$router, context.props);
  2798. }
  2799. var routeProps = {
  2800. url: String,
  2801. replace: Boolean,
  2802. to: [String, Object]
  2803. };
  2804. // CONCATENATED MODULE: ./es/cell/shared.js
  2805. var cellProps = {
  2806. icon: String,
  2807. size: String,
  2808. center: Boolean,
  2809. isLink: Boolean,
  2810. required: Boolean,
  2811. iconPrefix: String,
  2812. titleStyle: null,
  2813. titleClass: null,
  2814. valueClass: null,
  2815. labelClass: null,
  2816. title: [Number, String],
  2817. value: [Number, String],
  2818. label: [Number, String],
  2819. arrowDirection: String,
  2820. border: {
  2821. type: Boolean,
  2822. default: true
  2823. },
  2824. clickable: {
  2825. type: Boolean,
  2826. default: null
  2827. }
  2828. };
  2829. // CONCATENATED MODULE: ./es/cell/index.js
  2830. // Utils
  2831. // Components
  2832. // Types
  2833. var cell_createNamespace = Object(create["a" /* createNamespace */])('cell'),
  2834. cell_createComponent = cell_createNamespace[0],
  2835. cell_bem = cell_createNamespace[1];
  2836. function Cell(h, props, slots, ctx) {
  2837. var _props$clickable;
  2838. var icon = props.icon,
  2839. size = props.size,
  2840. title = props.title,
  2841. label = props.label,
  2842. value = props.value,
  2843. isLink = props.isLink;
  2844. var showTitle = slots.title || Object(utils["c" /* isDef */])(title);
  2845. function Label() {
  2846. var showLabel = slots.label || Object(utils["c" /* isDef */])(label);
  2847. if (showLabel) {
  2848. return h("div", {
  2849. "class": [cell_bem('label'), props.labelClass]
  2850. }, [slots.label ? slots.label() : label]);
  2851. }
  2852. }
  2853. function Title() {
  2854. if (showTitle) {
  2855. return h("div", {
  2856. "class": [cell_bem('title'), props.titleClass],
  2857. "style": props.titleStyle
  2858. }, [slots.title ? slots.title() : h("span", [title]), Label()]);
  2859. }
  2860. }
  2861. function Value() {
  2862. var showValue = slots.default || Object(utils["c" /* isDef */])(value);
  2863. if (showValue) {
  2864. return h("div", {
  2865. "class": [cell_bem('value', {
  2866. alone: !showTitle
  2867. }), props.valueClass]
  2868. }, [slots.default ? slots.default() : h("span", [value])]);
  2869. }
  2870. }
  2871. function LeftIcon() {
  2872. if (slots.icon) {
  2873. return slots.icon();
  2874. }
  2875. if (icon) {
  2876. return h(es_icon, {
  2877. "class": cell_bem('left-icon'),
  2878. "attrs": {
  2879. "name": icon,
  2880. "classPrefix": props.iconPrefix
  2881. }
  2882. });
  2883. }
  2884. }
  2885. function RightIcon() {
  2886. var rightIconSlot = slots['right-icon'];
  2887. if (rightIconSlot) {
  2888. return rightIconSlot();
  2889. }
  2890. if (isLink) {
  2891. var arrowDirection = props.arrowDirection;
  2892. return h(es_icon, {
  2893. "class": cell_bem('right-icon'),
  2894. "attrs": {
  2895. "name": arrowDirection ? "arrow-" + arrowDirection : 'arrow'
  2896. }
  2897. });
  2898. }
  2899. }
  2900. function onClick(event) {
  2901. functional_emit(ctx, 'click', event);
  2902. functionalRoute(ctx);
  2903. }
  2904. var clickable = (_props$clickable = props.clickable) != null ? _props$clickable : isLink;
  2905. var classes = {
  2906. clickable: clickable,
  2907. center: props.center,
  2908. required: props.required,
  2909. borderless: !props.border
  2910. };
  2911. if (size) {
  2912. classes[size] = size;
  2913. }
  2914. return h("div", helper_default()([{
  2915. "class": cell_bem(classes),
  2916. "attrs": {
  2917. "role": clickable ? 'button' : null,
  2918. "tabindex": clickable ? 0 : null
  2919. },
  2920. "on": {
  2921. "click": onClick
  2922. }
  2923. }, inherit(ctx)]), [LeftIcon(), Title(), Value(), RightIcon(), slots.extra == null ? void 0 : slots.extra()]);
  2924. }
  2925. Cell.props = _extends({}, cellProps, routeProps);
  2926. /* harmony default export */ var cell = (cell_createComponent(Cell));
  2927. // CONCATENATED MODULE: ./es/utils/validate/system.js
  2928. function isAndroid() {
  2929. /* istanbul ignore next */
  2930. return utils["h" /* isServer */] ? false : /android/.test(navigator.userAgent.toLowerCase());
  2931. }
  2932. function isIOS() {
  2933. /* istanbul ignore next */
  2934. return utils["h" /* isServer */] ? false : /ios|iphone|ipad|ipod/.test(navigator.userAgent.toLowerCase());
  2935. }
  2936. // CONCATENATED MODULE: ./es/utils/dom/reset-scroll.js
  2937. /**
  2938. * Hack for iOS12 page scroll
  2939. * https://developers.weixin.qq.com/community/develop/doc/00044ae90742f8c82fb78fcae56800
  2940. */
  2941. var reset_scroll_isIOS = isIOS();
  2942. /* istanbul ignore next */
  2943. function resetScroll() {
  2944. if (reset_scroll_isIOS) {
  2945. setRootScrollTop(getRootScrollTop());
  2946. }
  2947. }
  2948. // CONCATENATED MODULE: ./es/field/index.js
  2949. // Utils
  2950. // Components
  2951. var field_createNamespace = Object(create["a" /* createNamespace */])('field'),
  2952. field_createComponent = field_createNamespace[0],
  2953. field_bem = field_createNamespace[1];
  2954. /* harmony default export */ var es_field = (field_createComponent({
  2955. inheritAttrs: false,
  2956. provide: function provide() {
  2957. return {
  2958. vanField: this
  2959. };
  2960. },
  2961. inject: {
  2962. vanForm: {
  2963. default: null
  2964. }
  2965. },
  2966. props: _extends({}, cellProps, {
  2967. name: String,
  2968. rules: Array,
  2969. disabled: {
  2970. type: Boolean,
  2971. default: null
  2972. },
  2973. readonly: {
  2974. type: Boolean,
  2975. default: null
  2976. },
  2977. autosize: [Boolean, Object],
  2978. leftIcon: String,
  2979. rightIcon: String,
  2980. clearable: Boolean,
  2981. formatter: Function,
  2982. maxlength: [Number, String],
  2983. labelWidth: [Number, String],
  2984. labelClass: null,
  2985. labelAlign: String,
  2986. inputAlign: String,
  2987. placeholder: String,
  2988. errorMessage: String,
  2989. errorMessageAlign: String,
  2990. showWordLimit: Boolean,
  2991. value: {
  2992. type: [Number, String],
  2993. default: ''
  2994. },
  2995. type: {
  2996. type: String,
  2997. default: 'text'
  2998. },
  2999. error: {
  3000. type: Boolean,
  3001. default: null
  3002. },
  3003. colon: {
  3004. type: Boolean,
  3005. default: null
  3006. },
  3007. clearTrigger: {
  3008. type: String,
  3009. default: 'focus'
  3010. },
  3011. formatTrigger: {
  3012. type: String,
  3013. default: 'onChange'
  3014. }
  3015. }),
  3016. data: function data() {
  3017. return {
  3018. focused: false,
  3019. validateFailed: false,
  3020. validateMessage: ''
  3021. };
  3022. },
  3023. watch: {
  3024. value: function value() {
  3025. this.updateValue(this.value);
  3026. this.resetValidation();
  3027. this.validateWithTrigger('onChange');
  3028. this.$nextTick(this.adjustSize);
  3029. }
  3030. },
  3031. mounted: function mounted() {
  3032. this.updateValue(this.value, this.formatTrigger);
  3033. this.$nextTick(this.adjustSize);
  3034. if (this.vanForm) {
  3035. this.vanForm.addField(this);
  3036. }
  3037. },
  3038. beforeDestroy: function beforeDestroy() {
  3039. if (this.vanForm) {
  3040. this.vanForm.removeField(this);
  3041. }
  3042. },
  3043. computed: {
  3044. showClear: function showClear() {
  3045. var readonly = this.getProp('readonly');
  3046. if (this.clearable && !readonly) {
  3047. var hasValue = Object(utils["c" /* isDef */])(this.value) && this.value !== '';
  3048. var trigger = this.clearTrigger === 'always' || this.clearTrigger === 'focus' && this.focused;
  3049. return hasValue && trigger;
  3050. }
  3051. },
  3052. showError: function showError() {
  3053. if (this.error !== null) {
  3054. return this.error;
  3055. }
  3056. if (this.vanForm && this.vanForm.showError && this.validateFailed) {
  3057. return true;
  3058. }
  3059. },
  3060. listeners: function listeners() {
  3061. return _extends({}, this.$listeners, {
  3062. blur: this.onBlur,
  3063. focus: this.onFocus,
  3064. input: this.onInput,
  3065. click: this.onClickInput,
  3066. keypress: this.onKeypress
  3067. });
  3068. },
  3069. labelStyle: function labelStyle() {
  3070. var labelWidth = this.getProp('labelWidth');
  3071. if (labelWidth) {
  3072. return {
  3073. width: Object(unit["a" /* addUnit */])(labelWidth)
  3074. };
  3075. }
  3076. },
  3077. formValue: function formValue() {
  3078. if (this.children && (this.$scopedSlots.input || this.$slots.input)) {
  3079. return this.children.value;
  3080. }
  3081. return this.value;
  3082. }
  3083. },
  3084. methods: {
  3085. // @exposed-api
  3086. focus: function focus() {
  3087. if (this.$refs.input) {
  3088. this.$refs.input.focus();
  3089. }
  3090. },
  3091. // @exposed-api
  3092. blur: function blur() {
  3093. if (this.$refs.input) {
  3094. this.$refs.input.blur();
  3095. }
  3096. },
  3097. runValidator: function runValidator(value, rule) {
  3098. return new Promise(function (resolve) {
  3099. var returnVal = rule.validator(value, rule);
  3100. if (Object(utils["g" /* isPromise */])(returnVal)) {
  3101. return returnVal.then(resolve);
  3102. }
  3103. resolve(returnVal);
  3104. });
  3105. },
  3106. isEmptyValue: function isEmptyValue(value) {
  3107. if (Array.isArray(value)) {
  3108. return !value.length;
  3109. }
  3110. if (value === 0) {
  3111. return false;
  3112. }
  3113. return !value;
  3114. },
  3115. runSyncRule: function runSyncRule(value, rule) {
  3116. if (rule.required && this.isEmptyValue(value)) {
  3117. return false;
  3118. }
  3119. if (rule.pattern && !rule.pattern.test(value)) {
  3120. return false;
  3121. }
  3122. return true;
  3123. },
  3124. getRuleMessage: function getRuleMessage(value, rule) {
  3125. var message = rule.message;
  3126. if (Object(utils["e" /* isFunction */])(message)) {
  3127. return message(value, rule);
  3128. }
  3129. return message;
  3130. },
  3131. runRules: function runRules(rules) {
  3132. var _this = this;
  3133. return rules.reduce(function (promise, rule) {
  3134. return promise.then(function () {
  3135. if (_this.validateFailed) {
  3136. return;
  3137. }
  3138. var value = _this.formValue;
  3139. if (rule.formatter) {
  3140. value = rule.formatter(value, rule);
  3141. }
  3142. if (!_this.runSyncRule(value, rule)) {
  3143. _this.validateFailed = true;
  3144. _this.validateMessage = _this.getRuleMessage(value, rule);
  3145. return;
  3146. }
  3147. if (rule.validator) {
  3148. return _this.runValidator(value, rule).then(function (result) {
  3149. if (result === false) {
  3150. _this.validateFailed = true;
  3151. _this.validateMessage = _this.getRuleMessage(value, rule);
  3152. }
  3153. });
  3154. }
  3155. });
  3156. }, Promise.resolve());
  3157. },
  3158. validate: function validate(rules) {
  3159. var _this2 = this;
  3160. if (rules === void 0) {
  3161. rules = this.rules;
  3162. }
  3163. return new Promise(function (resolve) {
  3164. if (!rules) {
  3165. resolve();
  3166. }
  3167. _this2.resetValidation();
  3168. _this2.runRules(rules).then(function () {
  3169. if (_this2.validateFailed) {
  3170. resolve({
  3171. name: _this2.name,
  3172. message: _this2.validateMessage
  3173. });
  3174. } else {
  3175. resolve();
  3176. }
  3177. });
  3178. });
  3179. },
  3180. validateWithTrigger: function validateWithTrigger(trigger) {
  3181. if (this.vanForm && this.rules) {
  3182. var defaultTrigger = this.vanForm.validateTrigger === trigger;
  3183. var rules = this.rules.filter(function (rule) {
  3184. if (rule.trigger) {
  3185. return rule.trigger === trigger;
  3186. }
  3187. return defaultTrigger;
  3188. });
  3189. if (rules.length) {
  3190. this.validate(rules);
  3191. }
  3192. }
  3193. },
  3194. resetValidation: function resetValidation() {
  3195. if (this.validateFailed) {
  3196. this.validateFailed = false;
  3197. this.validateMessage = '';
  3198. }
  3199. },
  3200. updateValue: function updateValue(value, trigger) {
  3201. if (trigger === void 0) {
  3202. trigger = 'onChange';
  3203. }
  3204. value = Object(utils["c" /* isDef */])(value) ? String(value) : ''; // native maxlength have incorrect line-break counting
  3205. // see: https://github.com/youzan/vant/issues/5033
  3206. var maxlength = this.maxlength;
  3207. if (Object(utils["c" /* isDef */])(maxlength) && value.length > maxlength) {
  3208. if (this.value && this.value.length === +maxlength) {
  3209. value = this.value;
  3210. } else {
  3211. value = value.slice(0, maxlength);
  3212. }
  3213. }
  3214. if (this.type === 'number' || this.type === 'digit') {
  3215. var isNumber = this.type === 'number';
  3216. value = number_formatNumber(value, isNumber, isNumber);
  3217. }
  3218. if (this.formatter && trigger === this.formatTrigger) {
  3219. value = this.formatter(value);
  3220. }
  3221. var input = this.$refs.input;
  3222. if (input && value !== input.value) {
  3223. input.value = value;
  3224. }
  3225. if (value !== this.value) {
  3226. this.$emit('input', value);
  3227. }
  3228. },
  3229. onInput: function onInput(event) {
  3230. // not update v-model when composing
  3231. if (event.target.composing) {
  3232. return;
  3233. }
  3234. this.updateValue(event.target.value);
  3235. },
  3236. onFocus: function onFocus(event) {
  3237. this.focused = true;
  3238. this.$emit('focus', event); // readonly not work in legacy mobile safari
  3239. /* istanbul ignore if */
  3240. var readonly = this.getProp('readonly');
  3241. if (readonly) {
  3242. this.blur();
  3243. }
  3244. },
  3245. onBlur: function onBlur(event) {
  3246. this.focused = false;
  3247. this.updateValue(this.value, 'onBlur');
  3248. this.$emit('blur', event);
  3249. this.validateWithTrigger('onBlur');
  3250. resetScroll();
  3251. },
  3252. onClick: function onClick(event) {
  3253. this.$emit('click', event);
  3254. },
  3255. onClickInput: function onClickInput(event) {
  3256. this.$emit('click-input', event);
  3257. },
  3258. onClickLeftIcon: function onClickLeftIcon(event) {
  3259. this.$emit('click-left-icon', event);
  3260. },
  3261. onClickRightIcon: function onClickRightIcon(event) {
  3262. this.$emit('click-right-icon', event);
  3263. },
  3264. onClear: function onClear(event) {
  3265. preventDefault(event);
  3266. this.$emit('input', '');
  3267. this.$emit('clear', event);
  3268. },
  3269. onKeypress: function onKeypress(event) {
  3270. var ENTER_CODE = 13;
  3271. if (event.keyCode === ENTER_CODE) {
  3272. var submitOnEnter = this.getProp('submitOnEnter');
  3273. if (!submitOnEnter && this.type !== 'textarea') {
  3274. preventDefault(event);
  3275. } // trigger blur after click keyboard search button
  3276. if (this.type === 'search') {
  3277. this.blur();
  3278. }
  3279. }
  3280. this.$emit('keypress', event);
  3281. },
  3282. adjustSize: function adjustSize() {
  3283. var input = this.$refs.input;
  3284. if (!(this.type === 'textarea' && this.autosize) || !input) {
  3285. return;
  3286. }
  3287. var scrollTop = getRootScrollTop();
  3288. input.style.height = 'auto';
  3289. var height = input.scrollHeight;
  3290. if (Object(utils["f" /* isObject */])(this.autosize)) {
  3291. var _this$autosize = this.autosize,
  3292. maxHeight = _this$autosize.maxHeight,
  3293. minHeight = _this$autosize.minHeight;
  3294. if (maxHeight) {
  3295. height = Math.min(height, maxHeight);
  3296. }
  3297. if (minHeight) {
  3298. height = Math.max(height, minHeight);
  3299. }
  3300. }
  3301. if (height) {
  3302. input.style.height = height + 'px'; // https://github.com/youzan/vant/issues/9178
  3303. setRootScrollTop(scrollTop);
  3304. }
  3305. },
  3306. genInput: function genInput() {
  3307. var h = this.$createElement;
  3308. var type = this.type;
  3309. var disabled = this.getProp('disabled');
  3310. var readonly = this.getProp('readonly');
  3311. var inputSlot = this.slots('input');
  3312. var inputAlign = this.getProp('inputAlign');
  3313. if (inputSlot) {
  3314. return h("div", {
  3315. "class": field_bem('control', [inputAlign, 'custom']),
  3316. "on": {
  3317. "click": this.onClickInput
  3318. }
  3319. }, [inputSlot]);
  3320. }
  3321. var inputProps = {
  3322. ref: 'input',
  3323. class: field_bem('control', inputAlign),
  3324. domProps: {
  3325. value: this.value
  3326. },
  3327. attrs: _extends({}, this.$attrs, {
  3328. name: this.name,
  3329. disabled: disabled,
  3330. readonly: readonly,
  3331. placeholder: this.placeholder
  3332. }),
  3333. on: this.listeners,
  3334. // add model directive to skip IME composition
  3335. directives: [{
  3336. name: 'model',
  3337. value: this.value
  3338. }]
  3339. };
  3340. if (type === 'textarea') {
  3341. return h("textarea", helper_default()([{}, inputProps]));
  3342. }
  3343. var inputType = type;
  3344. var inputMode; // type="number" is weird in iOS, and can't prevent dot in Android
  3345. // so use inputmode to set keyboard in modern browsers
  3346. if (type === 'number') {
  3347. inputType = 'text';
  3348. inputMode = 'decimal';
  3349. }
  3350. if (type === 'digit') {
  3351. inputType = 'tel';
  3352. inputMode = 'numeric';
  3353. }
  3354. return h("input", helper_default()([{
  3355. "attrs": {
  3356. "type": inputType,
  3357. "inputmode": inputMode
  3358. }
  3359. }, inputProps]));
  3360. },
  3361. genLeftIcon: function genLeftIcon() {
  3362. var h = this.$createElement;
  3363. var showLeftIcon = this.slots('left-icon') || this.leftIcon;
  3364. if (showLeftIcon) {
  3365. return h("div", {
  3366. "class": field_bem('left-icon'),
  3367. "on": {
  3368. "click": this.onClickLeftIcon
  3369. }
  3370. }, [this.slots('left-icon') || h(es_icon, {
  3371. "attrs": {
  3372. "name": this.leftIcon,
  3373. "classPrefix": this.iconPrefix
  3374. }
  3375. })]);
  3376. }
  3377. },
  3378. genRightIcon: function genRightIcon() {
  3379. var h = this.$createElement;
  3380. var slots = this.slots;
  3381. var showRightIcon = slots('right-icon') || this.rightIcon;
  3382. if (showRightIcon) {
  3383. return h("div", {
  3384. "class": field_bem('right-icon'),
  3385. "on": {
  3386. "click": this.onClickRightIcon
  3387. }
  3388. }, [slots('right-icon') || h(es_icon, {
  3389. "attrs": {
  3390. "name": this.rightIcon,
  3391. "classPrefix": this.iconPrefix
  3392. }
  3393. })]);
  3394. }
  3395. },
  3396. genWordLimit: function genWordLimit() {
  3397. var h = this.$createElement;
  3398. if (this.showWordLimit && this.maxlength) {
  3399. var count = (this.value || '').length;
  3400. return h("div", {
  3401. "class": field_bem('word-limit')
  3402. }, [h("span", {
  3403. "class": field_bem('word-num')
  3404. }, [count]), "/", this.maxlength]);
  3405. }
  3406. },
  3407. genMessage: function genMessage() {
  3408. var h = this.$createElement;
  3409. if (this.vanForm && this.vanForm.showErrorMessage === false) {
  3410. return;
  3411. }
  3412. var message = this.errorMessage || this.validateMessage;
  3413. if (message) {
  3414. var errorMessageAlign = this.getProp('errorMessageAlign');
  3415. return h("div", {
  3416. "class": field_bem('error-message', errorMessageAlign)
  3417. }, [message]);
  3418. }
  3419. },
  3420. getProp: function getProp(key) {
  3421. if (Object(utils["c" /* isDef */])(this[key])) {
  3422. return this[key];
  3423. }
  3424. if (this.vanForm && Object(utils["c" /* isDef */])(this.vanForm[key])) {
  3425. return this.vanForm[key];
  3426. }
  3427. },
  3428. genLabel: function genLabel() {
  3429. var h = this.$createElement;
  3430. var colon = this.getProp('colon') ? ':' : '';
  3431. if (this.slots('label')) {
  3432. return [this.slots('label'), colon];
  3433. }
  3434. if (this.label) {
  3435. return h("span", [this.label + colon]);
  3436. }
  3437. }
  3438. },
  3439. render: function render() {
  3440. var _bem;
  3441. var h = arguments[0];
  3442. var slots = this.slots;
  3443. var disabled = this.getProp('disabled');
  3444. var labelAlign = this.getProp('labelAlign');
  3445. var scopedSlots = {
  3446. icon: this.genLeftIcon
  3447. };
  3448. var Label = this.genLabel();
  3449. if (Label) {
  3450. scopedSlots.title = function () {
  3451. return Label;
  3452. };
  3453. }
  3454. var extra = this.slots('extra');
  3455. if (extra) {
  3456. scopedSlots.extra = function () {
  3457. return extra;
  3458. };
  3459. }
  3460. return h(cell, {
  3461. "attrs": {
  3462. "icon": this.leftIcon,
  3463. "size": this.size,
  3464. "center": this.center,
  3465. "border": this.border,
  3466. "isLink": this.isLink,
  3467. "required": this.required,
  3468. "clickable": this.clickable,
  3469. "titleStyle": this.labelStyle,
  3470. "valueClass": field_bem('value'),
  3471. "titleClass": [field_bem('label', labelAlign), this.labelClass],
  3472. "arrowDirection": this.arrowDirection
  3473. },
  3474. "scopedSlots": scopedSlots,
  3475. "class": field_bem((_bem = {
  3476. error: this.showError,
  3477. disabled: disabled
  3478. }, _bem["label-" + labelAlign] = labelAlign, _bem['min-height'] = this.type === 'textarea' && !this.autosize, _bem)),
  3479. "on": {
  3480. "click": this.onClick
  3481. }
  3482. }, [h("div", {
  3483. "class": field_bem('body')
  3484. }, [this.genInput(), this.showClear && h(es_icon, {
  3485. "attrs": {
  3486. "name": "clear"
  3487. },
  3488. "class": field_bem('clear'),
  3489. "on": {
  3490. "touchstart": this.onClear
  3491. }
  3492. }), this.genRightIcon(), slots('button') && h("div", {
  3493. "class": field_bem('button')
  3494. }, [slots('button')])]), this.genWordLimit(), this.genMessage()]);
  3495. }
  3496. }));
  3497. // CONCATENATED MODULE: ./es/toast/lock-click.js
  3498. var lockCount = 0;
  3499. function lockClick(lock) {
  3500. if (lock) {
  3501. if (!lockCount) {
  3502. document.body.classList.add('van-toast--unclickable');
  3503. }
  3504. lockCount++;
  3505. } else {
  3506. lockCount--;
  3507. if (!lockCount) {
  3508. document.body.classList.remove('van-toast--unclickable');
  3509. }
  3510. }
  3511. }
  3512. // CONCATENATED MODULE: ./es/toast/Toast.js
  3513. // Utils
  3514. // Mixins
  3515. // Components
  3516. var Toast_createNamespace = Object(create["a" /* createNamespace */])('toast'),
  3517. Toast_createComponent = Toast_createNamespace[0],
  3518. Toast_bem = Toast_createNamespace[1];
  3519. /* harmony default export */ var Toast = (Toast_createComponent({
  3520. mixins: [PopupMixin()],
  3521. props: {
  3522. icon: String,
  3523. className: null,
  3524. iconPrefix: String,
  3525. loadingType: String,
  3526. forbidClick: Boolean,
  3527. closeOnClick: Boolean,
  3528. message: [Number, String],
  3529. type: {
  3530. type: String,
  3531. default: 'text'
  3532. },
  3533. position: {
  3534. type: String,
  3535. default: 'middle'
  3536. },
  3537. transition: {
  3538. type: String,
  3539. default: 'van-fade'
  3540. },
  3541. lockScroll: {
  3542. type: Boolean,
  3543. default: false
  3544. }
  3545. },
  3546. data: function data() {
  3547. return {
  3548. clickable: false
  3549. };
  3550. },
  3551. mounted: function mounted() {
  3552. this.toggleClickable();
  3553. },
  3554. destroyed: function destroyed() {
  3555. this.toggleClickable();
  3556. },
  3557. watch: {
  3558. value: 'toggleClickable',
  3559. forbidClick: 'toggleClickable'
  3560. },
  3561. methods: {
  3562. onClick: function onClick() {
  3563. if (this.closeOnClick) {
  3564. this.close();
  3565. }
  3566. },
  3567. toggleClickable: function toggleClickable() {
  3568. var clickable = this.value && this.forbidClick;
  3569. if (this.clickable !== clickable) {
  3570. this.clickable = clickable;
  3571. lockClick(clickable);
  3572. }
  3573. },
  3574. /* istanbul ignore next */
  3575. onAfterEnter: function onAfterEnter() {
  3576. this.$emit('opened');
  3577. if (this.onOpened) {
  3578. this.onOpened();
  3579. }
  3580. },
  3581. onAfterLeave: function onAfterLeave() {
  3582. this.$emit('closed');
  3583. },
  3584. genIcon: function genIcon() {
  3585. var h = this.$createElement;
  3586. var icon = this.icon,
  3587. type = this.type,
  3588. iconPrefix = this.iconPrefix,
  3589. loadingType = this.loadingType;
  3590. var hasIcon = icon || type === 'success' || type === 'fail';
  3591. if (hasIcon) {
  3592. return h(es_icon, {
  3593. "class": Toast_bem('icon'),
  3594. "attrs": {
  3595. "classPrefix": iconPrefix,
  3596. "name": icon || type
  3597. }
  3598. });
  3599. }
  3600. if (type === 'loading') {
  3601. return h(es_loading, {
  3602. "class": Toast_bem('loading'),
  3603. "attrs": {
  3604. "type": loadingType
  3605. }
  3606. });
  3607. }
  3608. },
  3609. genMessage: function genMessage() {
  3610. var h = this.$createElement;
  3611. var type = this.type,
  3612. message = this.message;
  3613. if (!Object(utils["c" /* isDef */])(message) || message === '') {
  3614. return;
  3615. }
  3616. if (type === 'html') {
  3617. return h("div", {
  3618. "class": Toast_bem('text'),
  3619. "domProps": {
  3620. "innerHTML": message
  3621. }
  3622. });
  3623. }
  3624. return h("div", {
  3625. "class": Toast_bem('text')
  3626. }, [message]);
  3627. }
  3628. },
  3629. render: function render() {
  3630. var _ref;
  3631. var h = arguments[0];
  3632. return h("transition", {
  3633. "attrs": {
  3634. "name": this.transition
  3635. },
  3636. "on": {
  3637. "afterEnter": this.onAfterEnter,
  3638. "afterLeave": this.onAfterLeave
  3639. }
  3640. }, [h("div", {
  3641. "directives": [{
  3642. name: "show",
  3643. value: this.value
  3644. }],
  3645. "class": [Toast_bem([this.position, (_ref = {}, _ref[this.type] = !this.icon, _ref)]), this.className],
  3646. "on": {
  3647. "click": this.onClick
  3648. }
  3649. }, [this.genIcon(), this.genMessage()])]);
  3650. }
  3651. }));
  3652. // CONCATENATED MODULE: ./es/toast/index.js
  3653. var defaultOptions = {
  3654. icon: '',
  3655. type: 'text',
  3656. // @deprecated
  3657. mask: false,
  3658. value: true,
  3659. message: '',
  3660. className: '',
  3661. overlay: false,
  3662. onClose: null,
  3663. onOpened: null,
  3664. duration: 2000,
  3665. iconPrefix: undefined,
  3666. position: 'middle',
  3667. transition: 'van-fade',
  3668. forbidClick: false,
  3669. loadingType: undefined,
  3670. getContainer: 'body',
  3671. overlayStyle: null,
  3672. closeOnClick: false,
  3673. closeOnClickOverlay: false
  3674. }; // default options of specific type
  3675. var defaultOptionsMap = {};
  3676. var queue = [];
  3677. var toast_multiple = false;
  3678. var currentOptions = _extends({}, defaultOptions);
  3679. function parseOptions(message) {
  3680. if (Object(utils["f" /* isObject */])(message)) {
  3681. return message;
  3682. }
  3683. return {
  3684. message: message
  3685. };
  3686. }
  3687. function isInDocument(element) {
  3688. return document.body.contains(element);
  3689. }
  3690. function createInstance() {
  3691. /* istanbul ignore if */
  3692. if (utils["h" /* isServer */]) {
  3693. return {};
  3694. }
  3695. queue = queue.filter(function (item) {
  3696. return !item.$el.parentNode || isInDocument(item.$el);
  3697. });
  3698. if (!queue.length || toast_multiple) {
  3699. var toast = new (external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a.extend(Toast))({
  3700. el: document.createElement('div')
  3701. });
  3702. toast.$on('input', function (value) {
  3703. toast.value = value;
  3704. });
  3705. queue.push(toast);
  3706. }
  3707. return queue[queue.length - 1];
  3708. } // transform toast options to popup props
  3709. function transformOptions(options) {
  3710. return _extends({}, options, {
  3711. overlay: options.mask || options.overlay,
  3712. mask: undefined,
  3713. duration: undefined
  3714. });
  3715. }
  3716. function toast_Toast(options) {
  3717. if (options === void 0) {
  3718. options = {};
  3719. }
  3720. var toast = createInstance(); // should add z-index if previous toast has not disappeared
  3721. if (toast.value) {
  3722. toast.updateZIndex();
  3723. }
  3724. options = parseOptions(options);
  3725. options = _extends({}, currentOptions, defaultOptionsMap[options.type || currentOptions.type], options);
  3726. if (false) {}
  3727. options.clear = function () {
  3728. toast.value = false;
  3729. if (options.onClose) {
  3730. options.onClose();
  3731. options.onClose = null;
  3732. }
  3733. if (toast_multiple && !utils["h" /* isServer */]) {
  3734. toast.$on('closed', function () {
  3735. clearTimeout(toast.timer);
  3736. queue = queue.filter(function (item) {
  3737. return item !== toast;
  3738. });
  3739. removeNode(toast.$el);
  3740. toast.$destroy();
  3741. });
  3742. }
  3743. };
  3744. _extends(toast, transformOptions(options));
  3745. clearTimeout(toast.timer);
  3746. if (options.duration > 0) {
  3747. toast.timer = setTimeout(function () {
  3748. toast.clear();
  3749. }, options.duration);
  3750. }
  3751. return toast;
  3752. }
  3753. var toast_createMethod = function createMethod(type) {
  3754. return function (options) {
  3755. return toast_Toast(_extends({
  3756. type: type
  3757. }, parseOptions(options)));
  3758. };
  3759. };
  3760. ['loading', 'success', 'fail'].forEach(function (method) {
  3761. toast_Toast[method] = toast_createMethod(method);
  3762. });
  3763. toast_Toast.clear = function (all) {
  3764. if (queue.length) {
  3765. if (all) {
  3766. queue.forEach(function (toast) {
  3767. toast.clear();
  3768. });
  3769. queue = [];
  3770. } else if (!toast_multiple) {
  3771. queue[0].clear();
  3772. } else {
  3773. queue.shift().clear();
  3774. }
  3775. }
  3776. };
  3777. toast_Toast.setDefaultOptions = function (type, options) {
  3778. if (typeof type === 'string') {
  3779. defaultOptionsMap[type] = options;
  3780. } else {
  3781. _extends(currentOptions, type);
  3782. }
  3783. };
  3784. toast_Toast.resetDefaultOptions = function (type) {
  3785. if (typeof type === 'string') {
  3786. defaultOptionsMap[type] = null;
  3787. } else {
  3788. currentOptions = _extends({}, defaultOptions);
  3789. defaultOptionsMap = {};
  3790. }
  3791. };
  3792. toast_Toast.allowMultiple = function (value) {
  3793. if (value === void 0) {
  3794. value = true;
  3795. }
  3796. toast_multiple = value;
  3797. };
  3798. toast_Toast.install = function () {
  3799. external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a.use(Toast);
  3800. };
  3801. external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a.prototype.$toast = toast_Toast;
  3802. /* harmony default export */ var es_toast = (toast_Toast);
  3803. // CONCATENATED MODULE: ./es/button/index.js
  3804. // Utils
  3805. // Components
  3806. // Types
  3807. var button_createNamespace = Object(create["a" /* createNamespace */])('button'),
  3808. button_createComponent = button_createNamespace[0],
  3809. button_bem = button_createNamespace[1];
  3810. function Button(h, props, slots, ctx) {
  3811. var _ref;
  3812. var tag = props.tag,
  3813. icon = props.icon,
  3814. type = props.type,
  3815. color = props.color,
  3816. plain = props.plain,
  3817. disabled = props.disabled,
  3818. loading = props.loading,
  3819. hairline = props.hairline,
  3820. loadingText = props.loadingText,
  3821. iconPosition = props.iconPosition;
  3822. var style = {};
  3823. if (color) {
  3824. style.color = plain ? color : 'white';
  3825. if (!plain) {
  3826. // Use background instead of backgroundColor to make linear-gradient work
  3827. style.background = color;
  3828. } // hide border when color is linear-gradient
  3829. if (color.indexOf('gradient') !== -1) {
  3830. style.border = 0;
  3831. } else {
  3832. style.borderColor = color;
  3833. }
  3834. }
  3835. function onClick(event) {
  3836. if (props.loading) {
  3837. event.preventDefault();
  3838. }
  3839. if (!loading && !disabled) {
  3840. functional_emit(ctx, 'click', event);
  3841. functionalRoute(ctx);
  3842. }
  3843. }
  3844. function onTouchstart(event) {
  3845. functional_emit(ctx, 'touchstart', event);
  3846. }
  3847. var classes = [button_bem([type, props.size, {
  3848. plain: plain,
  3849. loading: loading,
  3850. disabled: disabled,
  3851. hairline: hairline,
  3852. block: props.block,
  3853. round: props.round,
  3854. square: props.square
  3855. }]), (_ref = {}, _ref[BORDER_SURROUND] = hairline, _ref)];
  3856. function renderIcon() {
  3857. if (loading) {
  3858. return slots.loading ? slots.loading() : h(es_loading, {
  3859. "class": button_bem('loading'),
  3860. "attrs": {
  3861. "size": props.loadingSize,
  3862. "type": props.loadingType,
  3863. "color": "currentColor"
  3864. }
  3865. });
  3866. }
  3867. if (slots.icon) {
  3868. return h("div", {
  3869. "class": button_bem('icon')
  3870. }, [slots.icon()]);
  3871. }
  3872. if (icon) {
  3873. return h(es_icon, {
  3874. "attrs": {
  3875. "name": icon,
  3876. "classPrefix": props.iconPrefix
  3877. },
  3878. "class": button_bem('icon')
  3879. });
  3880. }
  3881. }
  3882. function renderContent() {
  3883. var content = [];
  3884. if (iconPosition === 'left') {
  3885. content.push(renderIcon());
  3886. }
  3887. var text;
  3888. if (loading) {
  3889. text = loadingText;
  3890. } else {
  3891. text = slots.default ? slots.default() : props.text;
  3892. }
  3893. if (text) {
  3894. content.push(h("span", {
  3895. "class": button_bem('text')
  3896. }, [text]));
  3897. }
  3898. if (iconPosition === 'right') {
  3899. content.push(renderIcon());
  3900. }
  3901. return content;
  3902. }
  3903. return h(tag, helper_default()([{
  3904. "style": style,
  3905. "class": classes,
  3906. "attrs": {
  3907. "type": props.nativeType,
  3908. "disabled": disabled
  3909. },
  3910. "on": {
  3911. "click": onClick,
  3912. "touchstart": onTouchstart
  3913. }
  3914. }, inherit(ctx)]), [h("div", {
  3915. "class": button_bem('content')
  3916. }, [renderContent()])]);
  3917. }
  3918. Button.props = _extends({}, routeProps, {
  3919. text: String,
  3920. icon: String,
  3921. color: String,
  3922. block: Boolean,
  3923. plain: Boolean,
  3924. round: Boolean,
  3925. square: Boolean,
  3926. loading: Boolean,
  3927. hairline: Boolean,
  3928. disabled: Boolean,
  3929. iconPrefix: String,
  3930. nativeType: String,
  3931. loadingText: String,
  3932. loadingType: String,
  3933. tag: {
  3934. type: String,
  3935. default: 'button'
  3936. },
  3937. type: {
  3938. type: String,
  3939. default: 'default'
  3940. },
  3941. size: {
  3942. type: String,
  3943. default: 'normal'
  3944. },
  3945. loadingSize: {
  3946. type: String,
  3947. default: '20px'
  3948. },
  3949. iconPosition: {
  3950. type: String,
  3951. default: 'left'
  3952. }
  3953. });
  3954. /* harmony default export */ var es_button = (button_createComponent(Button));
  3955. // CONCATENATED MODULE: ./es/utils/vnodes.js
  3956. function flattenVNodes(vnodes) {
  3957. var result = [];
  3958. function traverse(vnodes) {
  3959. vnodes.forEach(function (vnode) {
  3960. result.push(vnode);
  3961. if (vnode.componentInstance) {
  3962. traverse(vnode.componentInstance.$children.map(function (item) {
  3963. return item.$vnode;
  3964. }));
  3965. }
  3966. if (vnode.children) {
  3967. traverse(vnode.children);
  3968. }
  3969. });
  3970. }
  3971. traverse(vnodes);
  3972. return result;
  3973. } // sort children instances by vnodes order
  3974. function sortChildren(children, parent) {
  3975. var componentOptions = parent.$vnode.componentOptions;
  3976. if (!componentOptions || !componentOptions.children) {
  3977. return;
  3978. }
  3979. var vnodes = flattenVNodes(componentOptions.children);
  3980. children.sort(function (a, b) {
  3981. return vnodes.indexOf(a.$vnode) - vnodes.indexOf(b.$vnode);
  3982. });
  3983. }
  3984. // CONCATENATED MODULE: ./es/mixins/relation.js
  3985. function ChildrenMixin(_parent, options) {
  3986. var _inject, _computed;
  3987. if (options === void 0) {
  3988. options = {};
  3989. }
  3990. var indexKey = options.indexKey || 'index';
  3991. return {
  3992. inject: (_inject = {}, _inject[_parent] = {
  3993. default: null
  3994. }, _inject),
  3995. computed: (_computed = {
  3996. parent: function parent() {
  3997. if (this.disableBindRelation) {
  3998. return null;
  3999. }
  4000. return this[_parent];
  4001. }
  4002. }, _computed[indexKey] = function () {
  4003. this.bindRelation();
  4004. if (this.parent) {
  4005. return this.parent.children.indexOf(this);
  4006. }
  4007. return null;
  4008. }, _computed),
  4009. watch: {
  4010. disableBindRelation: function disableBindRelation(val) {
  4011. if (!val) {
  4012. this.bindRelation();
  4013. }
  4014. }
  4015. },
  4016. mounted: function mounted() {
  4017. this.bindRelation();
  4018. },
  4019. beforeDestroy: function beforeDestroy() {
  4020. var _this = this;
  4021. if (this.parent) {
  4022. this.parent.children = this.parent.children.filter(function (item) {
  4023. return item !== _this;
  4024. });
  4025. }
  4026. },
  4027. methods: {
  4028. bindRelation: function bindRelation() {
  4029. if (!this.parent || this.parent.children.indexOf(this) !== -1) {
  4030. return;
  4031. }
  4032. var children = [].concat(this.parent.children, [this]);
  4033. sortChildren(children, this.parent);
  4034. this.parent.children = children;
  4035. }
  4036. }
  4037. };
  4038. }
  4039. function ParentMixin(parent) {
  4040. return {
  4041. provide: function provide() {
  4042. var _ref;
  4043. return _ref = {}, _ref[parent] = this, _ref;
  4044. },
  4045. data: function data() {
  4046. return {
  4047. children: []
  4048. };
  4049. }
  4050. };
  4051. }
  4052. // CONCATENATED MODULE: ./es/goods-action/index.js
  4053. var goods_action_createNamespace = Object(create["a" /* createNamespace */])('goods-action'),
  4054. goods_action_createComponent = goods_action_createNamespace[0],
  4055. goods_action_bem = goods_action_createNamespace[1];
  4056. /* harmony default export */ var goods_action = (goods_action_createComponent({
  4057. mixins: [ParentMixin('vanGoodsAction')],
  4058. props: {
  4059. safeAreaInsetBottom: {
  4060. type: Boolean,
  4061. default: true
  4062. }
  4063. },
  4064. render: function render() {
  4065. var h = arguments[0];
  4066. return h("div", {
  4067. "class": goods_action_bem({
  4068. unfit: !this.safeAreaInsetBottom
  4069. })
  4070. }, [this.slots()]);
  4071. }
  4072. }));
  4073. // CONCATENATED MODULE: ./es/goods-action-button/index.js
  4074. var goods_action_button_createNamespace = Object(create["a" /* createNamespace */])('goods-action-button'),
  4075. goods_action_button_createComponent = goods_action_button_createNamespace[0],
  4076. goods_action_button_bem = goods_action_button_createNamespace[1];
  4077. /* harmony default export */ var goods_action_button = (goods_action_button_createComponent({
  4078. mixins: [ChildrenMixin('vanGoodsAction')],
  4079. props: _extends({}, routeProps, {
  4080. type: String,
  4081. text: String,
  4082. icon: String,
  4083. color: String,
  4084. loading: Boolean,
  4085. disabled: Boolean
  4086. }),
  4087. computed: {
  4088. isFirst: function isFirst() {
  4089. var prev = this.parent && this.parent.children[this.index - 1];
  4090. return !prev || prev.$options.name !== this.$options.name;
  4091. },
  4092. isLast: function isLast() {
  4093. var next = this.parent && this.parent.children[this.index + 1];
  4094. return !next || next.$options.name !== this.$options.name;
  4095. }
  4096. },
  4097. methods: {
  4098. onClick: function onClick(event) {
  4099. this.$emit('click', event);
  4100. route(this.$router, this);
  4101. }
  4102. },
  4103. render: function render() {
  4104. var h = arguments[0];
  4105. return h(es_button, {
  4106. "class": goods_action_button_bem([{
  4107. first: this.isFirst,
  4108. last: this.isLast
  4109. }, this.type]),
  4110. "attrs": {
  4111. "size": "large",
  4112. "type": this.type,
  4113. "icon": this.icon,
  4114. "color": this.color,
  4115. "loading": this.loading,
  4116. "disabled": this.disabled
  4117. },
  4118. "on": {
  4119. "click": this.onClick
  4120. }
  4121. }, [this.slots() || this.text]);
  4122. }
  4123. }));
  4124. // CONCATENATED MODULE: ./es/dialog/Dialog.js
  4125. var Dialog_createNamespace = Object(create["a" /* createNamespace */])('dialog'),
  4126. Dialog_createComponent = Dialog_createNamespace[0],
  4127. Dialog_bem = Dialog_createNamespace[1],
  4128. Dialog_t = Dialog_createNamespace[2];
  4129. /* harmony default export */ var Dialog = (Dialog_createComponent({
  4130. mixins: [PopupMixin()],
  4131. props: {
  4132. title: String,
  4133. theme: String,
  4134. width: [Number, String],
  4135. message: String,
  4136. className: null,
  4137. callback: Function,
  4138. beforeClose: Function,
  4139. messageAlign: String,
  4140. cancelButtonText: String,
  4141. cancelButtonColor: String,
  4142. confirmButtonText: String,
  4143. confirmButtonColor: String,
  4144. showCancelButton: Boolean,
  4145. overlay: {
  4146. type: Boolean,
  4147. default: true
  4148. },
  4149. allowHtml: {
  4150. type: Boolean,
  4151. default: true
  4152. },
  4153. transition: {
  4154. type: String,
  4155. default: 'van-dialog-bounce'
  4156. },
  4157. showConfirmButton: {
  4158. type: Boolean,
  4159. default: true
  4160. },
  4161. closeOnPopstate: {
  4162. type: Boolean,
  4163. default: true
  4164. },
  4165. closeOnClickOverlay: {
  4166. type: Boolean,
  4167. default: false
  4168. }
  4169. },
  4170. data: function data() {
  4171. return {
  4172. loading: {
  4173. confirm: false,
  4174. cancel: false
  4175. }
  4176. };
  4177. },
  4178. methods: {
  4179. onClickOverlay: function onClickOverlay() {
  4180. this.handleAction('overlay');
  4181. },
  4182. handleAction: function handleAction(action) {
  4183. var _this = this;
  4184. this.$emit(action); // show not trigger close event when hidden
  4185. if (!this.value) {
  4186. return;
  4187. }
  4188. if (this.beforeClose) {
  4189. this.loading[action] = true;
  4190. this.beforeClose(action, function (state) {
  4191. if (state !== false && _this.loading[action]) {
  4192. _this.onClose(action);
  4193. }
  4194. _this.loading.confirm = false;
  4195. _this.loading.cancel = false;
  4196. });
  4197. } else {
  4198. this.onClose(action);
  4199. }
  4200. },
  4201. onClose: function onClose(action) {
  4202. this.close();
  4203. if (this.callback) {
  4204. this.callback(action);
  4205. }
  4206. },
  4207. onOpened: function onOpened() {
  4208. this.$emit('opened');
  4209. },
  4210. onClosed: function onClosed() {
  4211. this.$emit('closed');
  4212. },
  4213. genRoundButtons: function genRoundButtons() {
  4214. var _this2 = this;
  4215. var h = this.$createElement;
  4216. return h(goods_action, {
  4217. "class": Dialog_bem('footer')
  4218. }, [this.showCancelButton && h(goods_action_button, {
  4219. "attrs": {
  4220. "size": "large",
  4221. "type": "warning",
  4222. "text": this.cancelButtonText || Dialog_t('cancel'),
  4223. "color": this.cancelButtonColor,
  4224. "loading": this.loading.cancel
  4225. },
  4226. "class": Dialog_bem('cancel'),
  4227. "on": {
  4228. "click": function click() {
  4229. _this2.handleAction('cancel');
  4230. }
  4231. }
  4232. }), this.showConfirmButton && h(goods_action_button, {
  4233. "attrs": {
  4234. "size": "large",
  4235. "type": "danger",
  4236. "text": this.confirmButtonText || Dialog_t('confirm'),
  4237. "color": this.confirmButtonColor,
  4238. "loading": this.loading.confirm
  4239. },
  4240. "class": Dialog_bem('confirm'),
  4241. "on": {
  4242. "click": function click() {
  4243. _this2.handleAction('confirm');
  4244. }
  4245. }
  4246. })]);
  4247. },
  4248. genButtons: function genButtons() {
  4249. var _this3 = this,
  4250. _ref;
  4251. var h = this.$createElement;
  4252. var multiple = this.showCancelButton && this.showConfirmButton;
  4253. return h("div", {
  4254. "class": [BORDER_TOP, Dialog_bem('footer')]
  4255. }, [this.showCancelButton && h(es_button, {
  4256. "attrs": {
  4257. "size": "large",
  4258. "loading": this.loading.cancel,
  4259. "text": this.cancelButtonText || Dialog_t('cancel')
  4260. },
  4261. "class": Dialog_bem('cancel'),
  4262. "style": {
  4263. color: this.cancelButtonColor
  4264. },
  4265. "on": {
  4266. "click": function click() {
  4267. _this3.handleAction('cancel');
  4268. }
  4269. }
  4270. }), this.showConfirmButton && h(es_button, {
  4271. "attrs": {
  4272. "size": "large",
  4273. "loading": this.loading.confirm,
  4274. "text": this.confirmButtonText || Dialog_t('confirm')
  4275. },
  4276. "class": [Dialog_bem('confirm'), (_ref = {}, _ref[BORDER_LEFT] = multiple, _ref)],
  4277. "style": {
  4278. color: this.confirmButtonColor
  4279. },
  4280. "on": {
  4281. "click": function click() {
  4282. _this3.handleAction('confirm');
  4283. }
  4284. }
  4285. })]);
  4286. },
  4287. genContent: function genContent(hasTitle, messageSlot) {
  4288. var h = this.$createElement;
  4289. if (messageSlot) {
  4290. return h("div", {
  4291. "class": Dialog_bem('content')
  4292. }, [messageSlot]);
  4293. }
  4294. var message = this.message,
  4295. messageAlign = this.messageAlign;
  4296. if (message) {
  4297. var _bem, _domProps;
  4298. var data = {
  4299. class: Dialog_bem('message', (_bem = {
  4300. 'has-title': hasTitle
  4301. }, _bem[messageAlign] = messageAlign, _bem)),
  4302. domProps: (_domProps = {}, _domProps[this.allowHtml ? 'innerHTML' : 'textContent'] = message, _domProps)
  4303. };
  4304. return h("div", {
  4305. "class": Dialog_bem('content', {
  4306. isolated: !hasTitle
  4307. })
  4308. }, [h("div", helper_default()([{}, data]))]);
  4309. }
  4310. }
  4311. },
  4312. render: function render() {
  4313. var h = arguments[0];
  4314. if (!this.shouldRender) {
  4315. return;
  4316. }
  4317. var message = this.message;
  4318. var messageSlot = this.slots();
  4319. var title = this.slots('title') || this.title;
  4320. var Title = title && h("div", {
  4321. "class": Dialog_bem('header', {
  4322. isolated: !message && !messageSlot
  4323. })
  4324. }, [title]);
  4325. return h("transition", {
  4326. "attrs": {
  4327. "name": this.transition
  4328. },
  4329. "on": {
  4330. "afterEnter": this.onOpened,
  4331. "afterLeave": this.onClosed
  4332. }
  4333. }, [h("div", {
  4334. "directives": [{
  4335. name: "show",
  4336. value: this.value
  4337. }],
  4338. "attrs": {
  4339. "role": "dialog",
  4340. "aria-labelledby": this.title || message
  4341. },
  4342. "class": [Dialog_bem([this.theme]), this.className],
  4343. "style": {
  4344. width: Object(unit["a" /* addUnit */])(this.width)
  4345. }
  4346. }, [Title, this.genContent(title, messageSlot), this.theme === 'round-button' ? this.genRoundButtons() : this.genButtons()])]);
  4347. }
  4348. }));
  4349. // CONCATENATED MODULE: ./es/dialog/index.js
  4350. var dialog_instance;
  4351. function dialog_isInDocument(element) {
  4352. return document.body.contains(element);
  4353. }
  4354. function dialog_initInstance() {
  4355. if (dialog_instance) {
  4356. dialog_instance.$destroy();
  4357. }
  4358. dialog_instance = new (external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a.extend(Dialog))({
  4359. el: document.createElement('div'),
  4360. // avoid missing animation when first rendered
  4361. propsData: {
  4362. lazyRender: false
  4363. }
  4364. });
  4365. dialog_instance.$on('input', function (value) {
  4366. dialog_instance.value = value;
  4367. });
  4368. }
  4369. function dialog_Dialog(options) {
  4370. /* istanbul ignore if */
  4371. if (utils["h" /* isServer */]) {
  4372. return Promise.resolve();
  4373. }
  4374. return new Promise(function (resolve, reject) {
  4375. if (!dialog_instance || !dialog_isInDocument(dialog_instance.$el)) {
  4376. dialog_initInstance();
  4377. }
  4378. _extends(dialog_instance, dialog_Dialog.currentOptions, options, {
  4379. resolve: resolve,
  4380. reject: reject
  4381. });
  4382. });
  4383. }
  4384. dialog_Dialog.defaultOptions = {
  4385. value: true,
  4386. title: '',
  4387. width: '',
  4388. theme: null,
  4389. message: '',
  4390. overlay: true,
  4391. className: '',
  4392. allowHtml: true,
  4393. lockScroll: true,
  4394. transition: 'van-dialog-bounce',
  4395. beforeClose: null,
  4396. overlayClass: '',
  4397. overlayStyle: null,
  4398. messageAlign: '',
  4399. getContainer: 'body',
  4400. cancelButtonText: '',
  4401. cancelButtonColor: null,
  4402. confirmButtonText: '',
  4403. confirmButtonColor: null,
  4404. showConfirmButton: true,
  4405. showCancelButton: false,
  4406. closeOnPopstate: true,
  4407. closeOnClickOverlay: false,
  4408. callback: function callback(action) {
  4409. dialog_instance[action === 'confirm' ? 'resolve' : 'reject'](action);
  4410. }
  4411. };
  4412. dialog_Dialog.alert = dialog_Dialog;
  4413. dialog_Dialog.confirm = function (options) {
  4414. return dialog_Dialog(_extends({
  4415. showCancelButton: true
  4416. }, options));
  4417. };
  4418. dialog_Dialog.close = function () {
  4419. if (dialog_instance) {
  4420. dialog_instance.value = false;
  4421. }
  4422. };
  4423. dialog_Dialog.setDefaultOptions = function (options) {
  4424. _extends(dialog_Dialog.currentOptions, options);
  4425. };
  4426. dialog_Dialog.resetDefaultOptions = function () {
  4427. dialog_Dialog.currentOptions = _extends({}, dialog_Dialog.defaultOptions);
  4428. };
  4429. dialog_Dialog.resetDefaultOptions();
  4430. dialog_Dialog.install = function () {
  4431. external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a.use(Dialog);
  4432. };
  4433. dialog_Dialog.Component = Dialog;
  4434. external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a.prototype.$dialog = dialog_Dialog;
  4435. /* harmony default export */ var dialog = (dialog_Dialog);
  4436. // CONCATENATED MODULE: ./es/address-edit/Detail.js
  4437. // Utils
  4438. // Components
  4439. var Detail_createNamespace = Object(create["a" /* createNamespace */])('address-edit-detail'),
  4440. Detail_createComponent = Detail_createNamespace[0],
  4441. Detail_bem = Detail_createNamespace[1],
  4442. Detail_t = Detail_createNamespace[2];
  4443. var android = isAndroid();
  4444. /* harmony default export */ var Detail = (Detail_createComponent({
  4445. props: {
  4446. value: String,
  4447. errorMessage: String,
  4448. focused: Boolean,
  4449. detailRows: [Number, String],
  4450. searchResult: Array,
  4451. detailMaxlength: [Number, String],
  4452. showSearchResult: Boolean
  4453. },
  4454. computed: {
  4455. shouldShowSearchResult: function shouldShowSearchResult() {
  4456. return this.focused && this.searchResult && this.showSearchResult;
  4457. }
  4458. },
  4459. methods: {
  4460. onSelect: function onSelect(express) {
  4461. this.$emit('select-search', express);
  4462. this.$emit('input', ((express.address || '') + " " + (express.name || '')).trim());
  4463. },
  4464. onFinish: function onFinish() {
  4465. this.$refs.field.blur();
  4466. },
  4467. genFinish: function genFinish() {
  4468. var h = this.$createElement;
  4469. var show = this.value && this.focused && android;
  4470. if (show) {
  4471. return h("div", {
  4472. "class": Detail_bem('finish'),
  4473. "on": {
  4474. "click": this.onFinish
  4475. }
  4476. }, [Detail_t('complete')]);
  4477. }
  4478. },
  4479. genSearchResult: function genSearchResult() {
  4480. var _this = this;
  4481. var h = this.$createElement;
  4482. var value = this.value,
  4483. shouldShowSearchResult = this.shouldShowSearchResult,
  4484. searchResult = this.searchResult;
  4485. if (shouldShowSearchResult) {
  4486. return searchResult.map(function (express) {
  4487. return h(cell, {
  4488. "key": express.name + express.address,
  4489. "attrs": {
  4490. "clickable": true,
  4491. "border": false,
  4492. "icon": "location-o",
  4493. "label": express.address
  4494. },
  4495. "class": Detail_bem('search-item'),
  4496. "on": {
  4497. "click": function click() {
  4498. _this.onSelect(express);
  4499. }
  4500. },
  4501. "scopedSlots": {
  4502. title: function title() {
  4503. if (express.name) {
  4504. var text = express.name.replace(value, "<span class=" + Detail_bem('keyword') + ">" + value + "</span>");
  4505. return h("div", {
  4506. "domProps": {
  4507. "innerHTML": text
  4508. }
  4509. });
  4510. }
  4511. }
  4512. }
  4513. });
  4514. });
  4515. }
  4516. }
  4517. },
  4518. render: function render() {
  4519. var h = arguments[0];
  4520. return h(cell, {
  4521. "class": Detail_bem()
  4522. }, [h(es_field, {
  4523. "attrs": {
  4524. "autosize": true,
  4525. "rows": this.detailRows,
  4526. "clearable": !android,
  4527. "type": "textarea",
  4528. "value": this.value,
  4529. "errorMessage": this.errorMessage,
  4530. "border": !this.shouldShowSearchResult,
  4531. "label": Detail_t('label'),
  4532. "maxlength": this.detailMaxlength,
  4533. "placeholder": Detail_t('placeholder')
  4534. },
  4535. "ref": "field",
  4536. "scopedSlots": {
  4537. icon: this.genFinish
  4538. },
  4539. "on": _extends({}, this.$listeners)
  4540. }), this.genSearchResult()]);
  4541. }
  4542. }));
  4543. // CONCATENATED MODULE: ./es/switch/shared.js
  4544. /**
  4545. * Common Switch Props
  4546. */
  4547. var switchProps = {
  4548. size: [Number, String],
  4549. value: null,
  4550. loading: Boolean,
  4551. disabled: Boolean,
  4552. activeColor: String,
  4553. inactiveColor: String,
  4554. activeValue: {
  4555. type: null,
  4556. default: true
  4557. },
  4558. inactiveValue: {
  4559. type: null,
  4560. default: false
  4561. }
  4562. };
  4563. // CONCATENATED MODULE: ./es/mixins/field.js
  4564. var FieldMixin = {
  4565. inject: {
  4566. vanField: {
  4567. default: null
  4568. }
  4569. },
  4570. watch: {
  4571. value: function value() {
  4572. var field = this.vanField;
  4573. if (field) {
  4574. field.resetValidation();
  4575. field.validateWithTrigger('onChange');
  4576. }
  4577. }
  4578. },
  4579. created: function created() {
  4580. var field = this.vanField;
  4581. if (field && !field.children) {
  4582. field.children = this;
  4583. }
  4584. }
  4585. };
  4586. // CONCATENATED MODULE: ./es/switch/index.js
  4587. // Utils
  4588. // Mixins
  4589. // Components
  4590. var switch_createNamespace = Object(create["a" /* createNamespace */])('switch'),
  4591. switch_createComponent = switch_createNamespace[0],
  4592. switch_bem = switch_createNamespace[1];
  4593. /* harmony default export */ var es_switch = (switch_createComponent({
  4594. mixins: [FieldMixin],
  4595. props: switchProps,
  4596. computed: {
  4597. checked: function checked() {
  4598. return this.value === this.activeValue;
  4599. },
  4600. style: function style() {
  4601. return {
  4602. fontSize: Object(unit["a" /* addUnit */])(this.size),
  4603. backgroundColor: this.checked ? this.activeColor : this.inactiveColor
  4604. };
  4605. }
  4606. },
  4607. methods: {
  4608. onClick: function onClick(event) {
  4609. this.$emit('click', event);
  4610. if (!this.disabled && !this.loading) {
  4611. var newValue = this.checked ? this.inactiveValue : this.activeValue;
  4612. this.$emit('input', newValue);
  4613. this.$emit('change', newValue);
  4614. }
  4615. },
  4616. genLoading: function genLoading() {
  4617. var h = this.$createElement;
  4618. if (this.loading) {
  4619. var color = this.checked ? this.activeColor : this.inactiveColor;
  4620. return h(es_loading, {
  4621. "class": switch_bem('loading'),
  4622. "attrs": {
  4623. "color": color
  4624. }
  4625. });
  4626. }
  4627. }
  4628. },
  4629. render: function render() {
  4630. var h = arguments[0];
  4631. var checked = this.checked,
  4632. loading = this.loading,
  4633. disabled = this.disabled;
  4634. return h("div", {
  4635. "class": switch_bem({
  4636. on: checked,
  4637. loading: loading,
  4638. disabled: disabled
  4639. }),
  4640. "attrs": {
  4641. "role": "switch",
  4642. "aria-checked": String(checked)
  4643. },
  4644. "style": this.style,
  4645. "on": {
  4646. "click": this.onClick
  4647. }
  4648. }, [h("div", {
  4649. "class": switch_bem('node')
  4650. }, [this.genLoading()])]);
  4651. }
  4652. }));
  4653. // CONCATENATED MODULE: ./es/address-edit/index.js
  4654. // Utils
  4655. // Components
  4656. var address_edit_createNamespace = Object(create["a" /* createNamespace */])('address-edit'),
  4657. address_edit_createComponent = address_edit_createNamespace[0],
  4658. address_edit_bem = address_edit_createNamespace[1],
  4659. address_edit_t = address_edit_createNamespace[2];
  4660. var defaultData = {
  4661. name: '',
  4662. tel: '',
  4663. country: '',
  4664. province: '',
  4665. city: '',
  4666. county: '',
  4667. areaCode: '',
  4668. postalCode: '',
  4669. addressDetail: '',
  4670. isDefault: false
  4671. };
  4672. function isPostal(value) {
  4673. return /^\d{6}$/.test(value);
  4674. }
  4675. /* harmony default export */ var address_edit = (address_edit_createComponent({
  4676. props: {
  4677. areaList: Object,
  4678. isSaving: Boolean,
  4679. isDeleting: Boolean,
  4680. validator: Function,
  4681. showDelete: Boolean,
  4682. showPostal: Boolean,
  4683. searchResult: Array,
  4684. telMaxlength: [Number, String],
  4685. showSetDefault: Boolean,
  4686. saveButtonText: String,
  4687. areaPlaceholder: String,
  4688. deleteButtonText: String,
  4689. showSearchResult: Boolean,
  4690. showArea: {
  4691. type: Boolean,
  4692. default: true
  4693. },
  4694. showDetail: {
  4695. type: Boolean,
  4696. default: true
  4697. },
  4698. disableArea: Boolean,
  4699. detailRows: {
  4700. type: [Number, String],
  4701. default: 1
  4702. },
  4703. detailMaxlength: {
  4704. type: [Number, String],
  4705. default: 200
  4706. },
  4707. addressInfo: {
  4708. type: Object,
  4709. default: function _default() {
  4710. return _extends({}, defaultData);
  4711. }
  4712. },
  4713. telValidator: {
  4714. type: Function,
  4715. default: isMobile
  4716. },
  4717. postalValidator: {
  4718. type: Function,
  4719. default: isPostal
  4720. },
  4721. areaColumnsPlaceholder: {
  4722. type: Array,
  4723. default: function _default() {
  4724. return [];
  4725. }
  4726. }
  4727. },
  4728. data: function data() {
  4729. return {
  4730. data: {},
  4731. showAreaPopup: false,
  4732. detailFocused: false,
  4733. errorInfo: {
  4734. tel: '',
  4735. name: '',
  4736. areaCode: '',
  4737. postalCode: '',
  4738. addressDetail: ''
  4739. }
  4740. };
  4741. },
  4742. computed: {
  4743. areaListLoaded: function areaListLoaded() {
  4744. return Object(utils["f" /* isObject */])(this.areaList) && Object.keys(this.areaList).length;
  4745. },
  4746. areaText: function areaText() {
  4747. var _this$data = this.data,
  4748. country = _this$data.country,
  4749. province = _this$data.province,
  4750. city = _this$data.city,
  4751. county = _this$data.county,
  4752. areaCode = _this$data.areaCode;
  4753. if (areaCode) {
  4754. var arr = [country, province, city, county];
  4755. if (province && province === city) {
  4756. arr.splice(1, 1);
  4757. }
  4758. return arr.filter(function (text) {
  4759. return text;
  4760. }).join('/');
  4761. }
  4762. return '';
  4763. },
  4764. // hide bottom field when use search && detail get focused
  4765. hideBottomFields: function hideBottomFields() {
  4766. var searchResult = this.searchResult;
  4767. return searchResult && searchResult.length && this.detailFocused;
  4768. }
  4769. },
  4770. watch: {
  4771. addressInfo: {
  4772. handler: function handler(val) {
  4773. this.data = _extends({}, defaultData, val);
  4774. this.setAreaCode(val.areaCode);
  4775. },
  4776. deep: true,
  4777. immediate: true
  4778. },
  4779. areaList: function areaList() {
  4780. this.setAreaCode(this.data.areaCode);
  4781. }
  4782. },
  4783. methods: {
  4784. onFocus: function onFocus(key) {
  4785. this.errorInfo[key] = '';
  4786. this.detailFocused = key === 'addressDetail';
  4787. this.$emit('focus', key);
  4788. },
  4789. onChangeDetail: function onChangeDetail(val) {
  4790. this.data.addressDetail = val;
  4791. this.$emit('change-detail', val);
  4792. },
  4793. onAreaConfirm: function onAreaConfirm(values) {
  4794. values = values.filter(function (value) {
  4795. return !!value;
  4796. });
  4797. if (values.some(function (value) {
  4798. return !value.code;
  4799. })) {
  4800. es_toast(address_edit_t('areaEmpty'));
  4801. return;
  4802. }
  4803. this.showAreaPopup = false;
  4804. this.assignAreaValues();
  4805. this.$emit('change-area', values);
  4806. },
  4807. assignAreaValues: function assignAreaValues() {
  4808. var area = this.$refs.area;
  4809. if (area) {
  4810. var detail = area.getArea();
  4811. detail.areaCode = detail.code;
  4812. delete detail.code;
  4813. _extends(this.data, detail);
  4814. }
  4815. },
  4816. onSave: function onSave() {
  4817. var _this = this;
  4818. var items = ['name', 'tel'];
  4819. if (this.showArea) {
  4820. items.push('areaCode');
  4821. }
  4822. if (this.showDetail) {
  4823. items.push('addressDetail');
  4824. }
  4825. if (this.showPostal) {
  4826. items.push('postalCode');
  4827. }
  4828. var isValid = items.every(function (item) {
  4829. var msg = _this.getErrorMessage(item);
  4830. if (msg) {
  4831. _this.errorInfo[item] = msg;
  4832. }
  4833. return !msg;
  4834. });
  4835. if (isValid && !this.isSaving) {
  4836. this.$emit('save', this.data);
  4837. }
  4838. },
  4839. getErrorMessage: function getErrorMessage(key) {
  4840. var value = String(this.data[key] || '').trim();
  4841. if (this.validator) {
  4842. var message = this.validator(key, value);
  4843. if (message) {
  4844. return message;
  4845. }
  4846. }
  4847. switch (key) {
  4848. case 'name':
  4849. return value ? '' : address_edit_t('nameEmpty');
  4850. case 'tel':
  4851. return this.telValidator(value) ? '' : address_edit_t('telInvalid');
  4852. case 'areaCode':
  4853. return value ? '' : address_edit_t('areaEmpty');
  4854. case 'addressDetail':
  4855. return value ? '' : address_edit_t('addressEmpty');
  4856. case 'postalCode':
  4857. return value && !this.postalValidator(value) ? address_edit_t('postalEmpty') : '';
  4858. }
  4859. },
  4860. onDelete: function onDelete() {
  4861. var _this2 = this;
  4862. dialog.confirm({
  4863. title: address_edit_t('confirmDelete')
  4864. }).then(function () {
  4865. _this2.$emit('delete', _this2.data);
  4866. }).catch(function () {
  4867. _this2.$emit('cancel-delete', _this2.data);
  4868. });
  4869. },
  4870. // get values of area component
  4871. getArea: function getArea() {
  4872. return this.$refs.area ? this.$refs.area.getValues() : [];
  4873. },
  4874. // set area code to area component
  4875. setAreaCode: function setAreaCode(code) {
  4876. this.data.areaCode = code || '';
  4877. if (code) {
  4878. this.$nextTick(this.assignAreaValues);
  4879. }
  4880. },
  4881. // @exposed-api
  4882. setAddressDetail: function setAddressDetail(value) {
  4883. this.data.addressDetail = value;
  4884. },
  4885. onDetailBlur: function onDetailBlur() {
  4886. var _this3 = this; // await for click search event
  4887. setTimeout(function () {
  4888. _this3.detailFocused = false;
  4889. });
  4890. },
  4891. genSetDefaultCell: function genSetDefaultCell(h) {
  4892. var _this4 = this;
  4893. if (this.showSetDefault) {
  4894. var slots = {
  4895. 'right-icon': function rightIcon() {
  4896. return h(es_switch, {
  4897. "attrs": {
  4898. "size": "24"
  4899. },
  4900. "on": {
  4901. "change": function change(event) {
  4902. _this4.$emit('change-default', event);
  4903. }
  4904. },
  4905. "model": {
  4906. value: _this4.data.isDefault,
  4907. callback: function callback($$v) {
  4908. _this4.$set(_this4.data, "isDefault", $$v);
  4909. }
  4910. }
  4911. });
  4912. }
  4913. };
  4914. return h(cell, {
  4915. "directives": [{
  4916. name: "show",
  4917. value: !this.hideBottomFields
  4918. }],
  4919. "attrs": {
  4920. "center": true,
  4921. "title": address_edit_t('defaultAddress')
  4922. },
  4923. "class": address_edit_bem('default'),
  4924. "scopedSlots": slots
  4925. });
  4926. }
  4927. return h();
  4928. }
  4929. },
  4930. render: function render(h) {
  4931. var _this5 = this;
  4932. var data = this.data,
  4933. errorInfo = this.errorInfo,
  4934. disableArea = this.disableArea,
  4935. hideBottomFields = this.hideBottomFields;
  4936. var onFocus = function onFocus(name) {
  4937. return function () {
  4938. return _this5.onFocus(name);
  4939. };
  4940. };
  4941. return h("div", {
  4942. "class": address_edit_bem()
  4943. }, [h("div", {
  4944. "class": address_edit_bem('fields')
  4945. }, [h(es_field, {
  4946. "attrs": {
  4947. "clearable": true,
  4948. "label": address_edit_t('name'),
  4949. "placeholder": address_edit_t('namePlaceholder'),
  4950. "errorMessage": errorInfo.name
  4951. },
  4952. "on": {
  4953. "focus": onFocus('name')
  4954. },
  4955. "model": {
  4956. value: data.name,
  4957. callback: function callback($$v) {
  4958. _this5.$set(data, "name", $$v);
  4959. }
  4960. }
  4961. }), h(es_field, {
  4962. "attrs": {
  4963. "clearable": true,
  4964. "type": "tel",
  4965. "label": address_edit_t('tel'),
  4966. "maxlength": this.telMaxlength,
  4967. "placeholder": address_edit_t('telPlaceholder'),
  4968. "errorMessage": errorInfo.tel
  4969. },
  4970. "on": {
  4971. "focus": onFocus('tel')
  4972. },
  4973. "model": {
  4974. value: data.tel,
  4975. callback: function callback($$v) {
  4976. _this5.$set(data, "tel", $$v);
  4977. }
  4978. }
  4979. }), h(es_field, {
  4980. "directives": [{
  4981. name: "show",
  4982. value: this.showArea
  4983. }],
  4984. "attrs": {
  4985. "readonly": true,
  4986. "clickable": !disableArea,
  4987. "label": address_edit_t('area'),
  4988. "placeholder": this.areaPlaceholder || address_edit_t('areaPlaceholder'),
  4989. "errorMessage": errorInfo.areaCode,
  4990. "rightIcon": !disableArea ? 'arrow' : null,
  4991. "value": this.areaText
  4992. },
  4993. "on": {
  4994. "focus": onFocus('areaCode'),
  4995. "click": function click() {
  4996. _this5.$emit('click-area');
  4997. _this5.showAreaPopup = !disableArea;
  4998. }
  4999. }
  5000. }), h(Detail, {
  5001. "directives": [{
  5002. name: "show",
  5003. value: this.showDetail
  5004. }],
  5005. "attrs": {
  5006. "focused": this.detailFocused,
  5007. "value": data.addressDetail,
  5008. "errorMessage": errorInfo.addressDetail,
  5009. "detailRows": this.detailRows,
  5010. "detailMaxlength": this.detailMaxlength,
  5011. "searchResult": this.searchResult,
  5012. "showSearchResult": this.showSearchResult
  5013. },
  5014. "on": {
  5015. "focus": onFocus('addressDetail'),
  5016. "blur": this.onDetailBlur,
  5017. "input": this.onChangeDetail,
  5018. "select-search": function selectSearch(event) {
  5019. _this5.$emit('select-search', event);
  5020. }
  5021. }
  5022. }), this.showPostal && h(es_field, {
  5023. "directives": [{
  5024. name: "show",
  5025. value: !hideBottomFields
  5026. }],
  5027. "attrs": {
  5028. "type": "tel",
  5029. "maxlength": "6",
  5030. "label": address_edit_t('postal'),
  5031. "placeholder": address_edit_t('postal'),
  5032. "errorMessage": errorInfo.postalCode
  5033. },
  5034. "on": {
  5035. "focus": onFocus('postalCode')
  5036. },
  5037. "model": {
  5038. value: data.postalCode,
  5039. callback: function callback($$v) {
  5040. _this5.$set(data, "postalCode", $$v);
  5041. }
  5042. }
  5043. }), this.slots()]), this.genSetDefaultCell(h), h("div", {
  5044. "directives": [{
  5045. name: "show",
  5046. value: !hideBottomFields
  5047. }],
  5048. "class": address_edit_bem('buttons')
  5049. }, [h(es_button, {
  5050. "attrs": {
  5051. "block": true,
  5052. "round": true,
  5053. "loading": this.isSaving,
  5054. "type": "danger",
  5055. "text": this.saveButtonText || address_edit_t('save')
  5056. },
  5057. "on": {
  5058. "click": this.onSave
  5059. }
  5060. }), this.showDelete && h(es_button, {
  5061. "attrs": {
  5062. "block": true,
  5063. "round": true,
  5064. "loading": this.isDeleting,
  5065. "text": this.deleteButtonText || address_edit_t('delete')
  5066. },
  5067. "on": {
  5068. "click": this.onDelete
  5069. }
  5070. })]), h(popup, {
  5071. "attrs": {
  5072. "round": true,
  5073. "position": "bottom",
  5074. "lazyRender": false,
  5075. "getContainer": "body"
  5076. },
  5077. "model": {
  5078. value: _this5.showAreaPopup,
  5079. callback: function callback($$v) {
  5080. _this5.showAreaPopup = $$v;
  5081. }
  5082. }
  5083. }, [h(es_area, {
  5084. "ref": "area",
  5085. "attrs": {
  5086. "value": data.areaCode,
  5087. "loading": !this.areaListLoaded,
  5088. "areaList": this.areaList,
  5089. "columnsPlaceholder": this.areaColumnsPlaceholder
  5090. },
  5091. "on": {
  5092. "confirm": this.onAreaConfirm,
  5093. "cancel": function cancel() {
  5094. _this5.showAreaPopup = false;
  5095. }
  5096. }
  5097. })])]);
  5098. }
  5099. }));
  5100. // CONCATENATED MODULE: ./es/radio-group/index.js
  5101. var radio_group_createNamespace = Object(create["a" /* createNamespace */])('radio-group'),
  5102. radio_group_createComponent = radio_group_createNamespace[0],
  5103. radio_group_bem = radio_group_createNamespace[1];
  5104. /* harmony default export */ var radio_group = (radio_group_createComponent({
  5105. mixins: [ParentMixin('vanRadio'), FieldMixin],
  5106. props: {
  5107. value: null,
  5108. disabled: Boolean,
  5109. direction: String,
  5110. checkedColor: String,
  5111. iconSize: [Number, String]
  5112. },
  5113. watch: {
  5114. value: function value(_value) {
  5115. this.$emit('change', _value);
  5116. }
  5117. },
  5118. render: function render() {
  5119. var h = arguments[0];
  5120. return h("div", {
  5121. "class": radio_group_bem([this.direction]),
  5122. "attrs": {
  5123. "role": "radiogroup"
  5124. }
  5125. }, [this.slots()]);
  5126. }
  5127. }));
  5128. // CONCATENATED MODULE: ./es/tag/index.js
  5129. // Utils
  5130. // Components
  5131. // Types
  5132. var tag_createNamespace = Object(create["a" /* createNamespace */])('tag'),
  5133. tag_createComponent = tag_createNamespace[0],
  5134. tag_bem = tag_createNamespace[1];
  5135. function Tag(h, props, slots, ctx) {
  5136. var _style;
  5137. var type = props.type,
  5138. mark = props.mark,
  5139. plain = props.plain,
  5140. color = props.color,
  5141. round = props.round,
  5142. size = props.size,
  5143. textColor = props.textColor;
  5144. var key = plain ? 'color' : 'backgroundColor';
  5145. var style = (_style = {}, _style[key] = color, _style);
  5146. if (plain) {
  5147. style.color = textColor || color;
  5148. style.borderColor = color;
  5149. } else {
  5150. style.color = textColor;
  5151. style.background = color;
  5152. }
  5153. var classes = {
  5154. mark: mark,
  5155. plain: plain,
  5156. round: round
  5157. };
  5158. if (size) {
  5159. classes[size] = size;
  5160. }
  5161. var CloseIcon = props.closeable && h(es_icon, {
  5162. "attrs": {
  5163. "name": "cross"
  5164. },
  5165. "class": tag_bem('close'),
  5166. "on": {
  5167. "click": function click(event) {
  5168. event.stopPropagation();
  5169. functional_emit(ctx, 'close');
  5170. }
  5171. }
  5172. });
  5173. return h("transition", {
  5174. "attrs": {
  5175. "name": props.closeable ? 'van-fade' : null
  5176. }
  5177. }, [h("span", helper_default()([{
  5178. "key": "content",
  5179. "style": style,
  5180. "class": tag_bem([classes, type])
  5181. }, inherit(ctx, true)]), [slots.default == null ? void 0 : slots.default(), CloseIcon])]);
  5182. }
  5183. Tag.props = {
  5184. size: String,
  5185. mark: Boolean,
  5186. color: String,
  5187. plain: Boolean,
  5188. round: Boolean,
  5189. textColor: String,
  5190. closeable: Boolean,
  5191. type: {
  5192. type: String,
  5193. default: 'default'
  5194. }
  5195. };
  5196. /* harmony default export */ var es_tag = (tag_createComponent(Tag));
  5197. // CONCATENATED MODULE: ./es/mixins/checkbox.js
  5198. /**
  5199. * Common part of Checkbox & Radio
  5200. */
  5201. var checkbox_CheckboxMixin = function CheckboxMixin(_ref) {
  5202. var parent = _ref.parent,
  5203. bem = _ref.bem,
  5204. role = _ref.role;
  5205. return {
  5206. mixins: [ChildrenMixin(parent), FieldMixin],
  5207. props: {
  5208. name: null,
  5209. value: null,
  5210. disabled: Boolean,
  5211. iconSize: [Number, String],
  5212. checkedColor: String,
  5213. labelPosition: String,
  5214. labelDisabled: Boolean,
  5215. shape: {
  5216. type: String,
  5217. default: 'round'
  5218. },
  5219. bindGroup: {
  5220. type: Boolean,
  5221. default: true
  5222. }
  5223. },
  5224. computed: {
  5225. disableBindRelation: function disableBindRelation() {
  5226. return !this.bindGroup;
  5227. },
  5228. isDisabled: function isDisabled() {
  5229. return this.parent && this.parent.disabled || this.disabled;
  5230. },
  5231. direction: function direction() {
  5232. return this.parent && this.parent.direction || null;
  5233. },
  5234. iconStyle: function iconStyle() {
  5235. var checkedColor = this.checkedColor || this.parent && this.parent.checkedColor;
  5236. if (checkedColor && this.checked && !this.isDisabled) {
  5237. return {
  5238. borderColor: checkedColor,
  5239. backgroundColor: checkedColor
  5240. };
  5241. }
  5242. },
  5243. tabindex: function tabindex() {
  5244. if (this.isDisabled || role === 'radio' && !this.checked) {
  5245. return -1;
  5246. }
  5247. return 0;
  5248. }
  5249. },
  5250. methods: {
  5251. onClick: function onClick(event) {
  5252. var _this = this;
  5253. var target = event.target;
  5254. var icon = this.$refs.icon;
  5255. var iconClicked = icon === target || (icon == null ? void 0 : icon.contains(target));
  5256. if (!this.isDisabled && (iconClicked || !this.labelDisabled)) {
  5257. this.toggle(); // wait for toggle method to complete
  5258. // so we can get the changed value in the click event listener
  5259. setTimeout(function () {
  5260. _this.$emit('click', event);
  5261. });
  5262. } else {
  5263. this.$emit('click', event);
  5264. }
  5265. },
  5266. genIcon: function genIcon() {
  5267. var h = this.$createElement;
  5268. var checked = this.checked;
  5269. var iconSize = this.iconSize || this.parent && this.parent.iconSize;
  5270. return h("div", {
  5271. "ref": "icon",
  5272. "class": bem('icon', [this.shape, {
  5273. disabled: this.isDisabled,
  5274. checked: checked
  5275. }]),
  5276. "style": {
  5277. fontSize: Object(unit["a" /* addUnit */])(iconSize)
  5278. }
  5279. }, [this.slots('icon', {
  5280. checked: checked
  5281. }) || h(es_icon, {
  5282. "attrs": {
  5283. "name": "success"
  5284. },
  5285. "style": this.iconStyle
  5286. })]);
  5287. },
  5288. genLabel: function genLabel() {
  5289. var h = this.$createElement;
  5290. var slot = this.slots();
  5291. if (slot) {
  5292. return h("span", {
  5293. "class": bem('label', [this.labelPosition, {
  5294. disabled: this.isDisabled
  5295. }])
  5296. }, [slot]);
  5297. }
  5298. }
  5299. },
  5300. render: function render() {
  5301. var h = arguments[0];
  5302. var Children = [this.genIcon()];
  5303. if (this.labelPosition === 'left') {
  5304. Children.unshift(this.genLabel());
  5305. } else {
  5306. Children.push(this.genLabel());
  5307. }
  5308. return h("div", {
  5309. "attrs": {
  5310. "role": role,
  5311. "tabindex": this.tabindex,
  5312. "aria-checked": String(this.checked)
  5313. },
  5314. "class": bem([{
  5315. disabled: this.isDisabled,
  5316. 'label-disabled': this.labelDisabled
  5317. }, this.direction]),
  5318. "on": {
  5319. "click": this.onClick
  5320. }
  5321. }, [Children]);
  5322. }
  5323. };
  5324. };
  5325. // CONCATENATED MODULE: ./es/radio/index.js
  5326. var radio_createNamespace = Object(create["a" /* createNamespace */])('radio'),
  5327. radio_createComponent = radio_createNamespace[0],
  5328. radio_bem = radio_createNamespace[1];
  5329. /* harmony default export */ var es_radio = (radio_createComponent({
  5330. mixins: [checkbox_CheckboxMixin({
  5331. bem: radio_bem,
  5332. role: 'radio',
  5333. parent: 'vanRadio'
  5334. })],
  5335. computed: {
  5336. currentValue: {
  5337. get: function get() {
  5338. return this.parent ? this.parent.value : this.value;
  5339. },
  5340. set: function set(val) {
  5341. (this.parent || this).$emit('input', val);
  5342. }
  5343. },
  5344. checked: function checked() {
  5345. return this.currentValue === this.name;
  5346. }
  5347. },
  5348. methods: {
  5349. toggle: function toggle() {
  5350. this.currentValue = this.name;
  5351. }
  5352. }
  5353. }));
  5354. // CONCATENATED MODULE: ./es/address-list/Item.js
  5355. // Utils
  5356. // Components
  5357. // Types
  5358. var Item_createNamespace = Object(create["a" /* createNamespace */])('address-item'),
  5359. Item_createComponent = Item_createNamespace[0],
  5360. Item_bem = Item_createNamespace[1];
  5361. function AddressItem(h, props, slots, ctx) {
  5362. var disabled = props.disabled,
  5363. switchable = props.switchable;
  5364. function onClick() {
  5365. if (switchable) {
  5366. functional_emit(ctx, 'select');
  5367. }
  5368. functional_emit(ctx, 'click');
  5369. }
  5370. var genRightIcon = function genRightIcon() {
  5371. return h(es_icon, {
  5372. "attrs": {
  5373. "name": "edit"
  5374. },
  5375. "class": Item_bem('edit'),
  5376. "on": {
  5377. "click": function click(event) {
  5378. event.stopPropagation();
  5379. functional_emit(ctx, 'edit');
  5380. functional_emit(ctx, 'click');
  5381. }
  5382. }
  5383. });
  5384. };
  5385. function genTag() {
  5386. if (slots.tag) {
  5387. return slots.tag(_extends({}, props.data));
  5388. }
  5389. if (props.data.isDefault && props.defaultTagText) {
  5390. return h(es_tag, {
  5391. "attrs": {
  5392. "type": "danger",
  5393. "round": true
  5394. },
  5395. "class": Item_bem('tag')
  5396. }, [props.defaultTagText]);
  5397. }
  5398. }
  5399. function genContent() {
  5400. var data = props.data;
  5401. var Info = [h("div", {
  5402. "class": Item_bem('name')
  5403. }, [data.name + " " + data.tel, genTag()]), h("div", {
  5404. "class": Item_bem('address')
  5405. }, [data.address])];
  5406. if (switchable && !disabled) {
  5407. return h(es_radio, {
  5408. "attrs": {
  5409. "name": data.id,
  5410. "iconSize": 18
  5411. }
  5412. }, [Info]);
  5413. }
  5414. return Info;
  5415. }
  5416. return h("div", {
  5417. "class": Item_bem({
  5418. disabled: disabled
  5419. }),
  5420. "on": {
  5421. "click": onClick
  5422. }
  5423. }, [h(cell, helper_default()([{
  5424. "attrs": {
  5425. "border": false,
  5426. "valueClass": Item_bem('value')
  5427. },
  5428. "scopedSlots": {
  5429. default: genContent,
  5430. 'right-icon': genRightIcon
  5431. }
  5432. }, inherit(ctx)])), slots.bottom == null ? void 0 : slots.bottom(_extends({}, props.data, {
  5433. disabled: disabled
  5434. }))]);
  5435. }
  5436. AddressItem.props = {
  5437. data: Object,
  5438. disabled: Boolean,
  5439. switchable: Boolean,
  5440. defaultTagText: String
  5441. };
  5442. /* harmony default export */ var Item = (Item_createComponent(AddressItem));
  5443. // CONCATENATED MODULE: ./es/address-list/index.js
  5444. // Utils
  5445. // Components
  5446. // Types
  5447. var address_list_createNamespace = Object(create["a" /* createNamespace */])('address-list'),
  5448. address_list_createComponent = address_list_createNamespace[0],
  5449. address_list_bem = address_list_createNamespace[1],
  5450. address_list_t = address_list_createNamespace[2];
  5451. function AddressList(h, props, slots, ctx) {
  5452. function genList(list, disabled) {
  5453. if (!list) {
  5454. return;
  5455. }
  5456. return list.map(function (item, index) {
  5457. return h(Item, {
  5458. "attrs": {
  5459. "data": item,
  5460. "disabled": disabled,
  5461. "switchable": props.switchable,
  5462. "defaultTagText": props.defaultTagText
  5463. },
  5464. "key": item.id,
  5465. "scopedSlots": {
  5466. bottom: slots['item-bottom'],
  5467. tag: slots.tag
  5468. },
  5469. "on": {
  5470. "select": function select() {
  5471. functional_emit(ctx, disabled ? 'select-disabled' : 'select', item, index);
  5472. if (!disabled) {
  5473. functional_emit(ctx, 'input', item.id);
  5474. }
  5475. },
  5476. "edit": function edit() {
  5477. functional_emit(ctx, disabled ? 'edit-disabled' : 'edit', item, index);
  5478. },
  5479. "click": function click() {
  5480. functional_emit(ctx, 'click-item', item, index);
  5481. }
  5482. }
  5483. });
  5484. });
  5485. }
  5486. var List = genList(props.list);
  5487. var DisabledList = genList(props.disabledList, true);
  5488. return h("div", helper_default()([{
  5489. "class": address_list_bem()
  5490. }, inherit(ctx)]), [slots.top == null ? void 0 : slots.top(), h(radio_group, {
  5491. "attrs": {
  5492. "value": props.value
  5493. }
  5494. }, [List]), props.disabledText && h("div", {
  5495. "class": address_list_bem('disabled-text')
  5496. }, [props.disabledText]), DisabledList, slots.default == null ? void 0 : slots.default(), h("div", {
  5497. "class": address_list_bem('bottom')
  5498. }, [h(es_button, {
  5499. "attrs": {
  5500. "round": true,
  5501. "block": true,
  5502. "type": "danger",
  5503. "text": props.addButtonText || address_list_t('add')
  5504. },
  5505. "class": address_list_bem('add'),
  5506. "on": {
  5507. "click": function click() {
  5508. functional_emit(ctx, 'add');
  5509. }
  5510. }
  5511. })])]);
  5512. }
  5513. AddressList.props = {
  5514. list: Array,
  5515. value: [Number, String],
  5516. disabledList: Array,
  5517. disabledText: String,
  5518. addButtonText: String,
  5519. defaultTagText: String,
  5520. switchable: {
  5521. type: Boolean,
  5522. default: true
  5523. }
  5524. };
  5525. /* harmony default export */ var address_list = (address_list_createComponent(AddressList));
  5526. // EXTERNAL MODULE: ./es/utils/validate/number.js
  5527. var number = __webpack_require__(5);
  5528. // CONCATENATED MODULE: ./es/badge/index.js
  5529. var badge_createNamespace = Object(create["a" /* createNamespace */])('badge'),
  5530. badge_createComponent = badge_createNamespace[0],
  5531. badge_bem = badge_createNamespace[1];
  5532. /* harmony default export */ var badge = (badge_createComponent({
  5533. props: {
  5534. dot: Boolean,
  5535. max: [Number, String],
  5536. color: String,
  5537. content: [Number, String],
  5538. tag: {
  5539. type: String,
  5540. default: 'div'
  5541. }
  5542. },
  5543. methods: {
  5544. hasContent: function hasContent() {
  5545. return !!(this.$scopedSlots.content || Object(utils["c" /* isDef */])(this.content) && this.content !== '');
  5546. },
  5547. renderContent: function renderContent() {
  5548. var dot = this.dot,
  5549. max = this.max,
  5550. content = this.content;
  5551. if (!dot && this.hasContent()) {
  5552. if (this.$scopedSlots.content) {
  5553. return this.$scopedSlots.content();
  5554. }
  5555. if (Object(utils["c" /* isDef */])(max) && Object(number["b" /* isNumeric */])(content) && +content > max) {
  5556. return max + "+";
  5557. }
  5558. return content;
  5559. }
  5560. },
  5561. renderBadge: function renderBadge() {
  5562. var h = this.$createElement;
  5563. if (this.hasContent() || this.dot) {
  5564. return h("div", {
  5565. "class": badge_bem({
  5566. dot: this.dot,
  5567. fixed: !!this.$scopedSlots.default
  5568. }),
  5569. "style": {
  5570. background: this.color
  5571. }
  5572. }, [this.renderContent()]);
  5573. }
  5574. }
  5575. },
  5576. render: function render() {
  5577. var h = arguments[0];
  5578. if (this.$scopedSlots.default) {
  5579. var tag = this.tag;
  5580. return h(tag, {
  5581. "class": badge_bem('wrapper')
  5582. }, [this.$scopedSlots.default(), this.renderBadge()]);
  5583. }
  5584. return this.renderBadge();
  5585. }
  5586. }));
  5587. // EXTERNAL MODULE: ./es/utils/dom/raf.js
  5588. var raf = __webpack_require__(4);
  5589. // CONCATENATED MODULE: ./es/utils/validate/date.js
  5590. function isDate(val) {
  5591. return Object.prototype.toString.call(val) === '[object Date]' && !Object(number["a" /* isNaN */])(val.getTime());
  5592. }
  5593. // CONCATENATED MODULE: ./es/calendar/utils.js
  5594. var utils_createNamespace = Object(create["a" /* createNamespace */])('calendar'),
  5595. utils_createComponent = utils_createNamespace[0],
  5596. utils_bem = utils_createNamespace[1],
  5597. utils_t = utils_createNamespace[2];
  5598. function formatMonthTitle(date) {
  5599. return utils_t('monthTitle', date.getFullYear(), date.getMonth() + 1);
  5600. }
  5601. function compareMonth(date1, date2) {
  5602. var year1 = date1.getFullYear();
  5603. var year2 = date2.getFullYear();
  5604. var month1 = date1.getMonth();
  5605. var month2 = date2.getMonth();
  5606. if (year1 === year2) {
  5607. return month1 === month2 ? 0 : month1 > month2 ? 1 : -1;
  5608. }
  5609. return year1 > year2 ? 1 : -1;
  5610. }
  5611. function compareDay(day1, day2) {
  5612. var compareMonthResult = compareMonth(day1, day2);
  5613. if (compareMonthResult === 0) {
  5614. var date1 = day1.getDate();
  5615. var date2 = day2.getDate();
  5616. return date1 === date2 ? 0 : date1 > date2 ? 1 : -1;
  5617. }
  5618. return compareMonthResult;
  5619. }
  5620. function getDayByOffset(date, offset) {
  5621. date = new Date(date);
  5622. date.setDate(date.getDate() + offset);
  5623. return date;
  5624. }
  5625. function getPrevDay(date) {
  5626. return getDayByOffset(date, -1);
  5627. }
  5628. function getNextDay(date) {
  5629. return getDayByOffset(date, 1);
  5630. }
  5631. function calcDateNum(date) {
  5632. var day1 = date[0].getTime();
  5633. var day2 = date[1].getTime();
  5634. return (day2 - day1) / (1000 * 60 * 60 * 24) + 1;
  5635. }
  5636. function copyDate(dates) {
  5637. return new Date(dates);
  5638. }
  5639. function copyDates(dates) {
  5640. if (Array.isArray(dates)) {
  5641. return dates.map(function (date) {
  5642. if (date === null) {
  5643. return date;
  5644. }
  5645. return copyDate(date);
  5646. });
  5647. }
  5648. return copyDate(dates);
  5649. }
  5650. // CONCATENATED MODULE: ./es/datetime-picker/utils.js
  5651. function times(n, iteratee) {
  5652. var index = -1;
  5653. var result = Array(n);
  5654. while (++index < n) {
  5655. result[index] = iteratee(index);
  5656. }
  5657. return result;
  5658. }
  5659. function getTrueValue(value) {
  5660. if (!value) {
  5661. return 0;
  5662. }
  5663. while (Object(number["a" /* isNaN */])(parseInt(value, 10))) {
  5664. if (value.length > 1) {
  5665. value = value.slice(1);
  5666. } else {
  5667. return 0;
  5668. }
  5669. }
  5670. return parseInt(value, 10);
  5671. }
  5672. function getMonthEndDay(year, month) {
  5673. return 32 - new Date(year, month - 1, 32).getDate();
  5674. }
  5675. // CONCATENATED MODULE: ./es/calendar/components/Month.js
  5676. var Month_createNamespace = Object(create["a" /* createNamespace */])('calendar-month'),
  5677. Month_createComponent = Month_createNamespace[0];
  5678. /* harmony default export */ var Month = (Month_createComponent({
  5679. props: {
  5680. date: Date,
  5681. type: String,
  5682. color: String,
  5683. minDate: Date,
  5684. maxDate: Date,
  5685. showMark: Boolean,
  5686. rowHeight: [Number, String],
  5687. formatter: Function,
  5688. lazyRender: Boolean,
  5689. currentDate: [Date, Array],
  5690. allowSameDay: Boolean,
  5691. showSubtitle: Boolean,
  5692. showMonthTitle: Boolean,
  5693. firstDayOfWeek: Number
  5694. },
  5695. data: function data() {
  5696. return {
  5697. visible: false
  5698. };
  5699. },
  5700. computed: {
  5701. title: function title() {
  5702. return formatMonthTitle(this.date);
  5703. },
  5704. rowHeightWithUnit: function rowHeightWithUnit() {
  5705. return Object(unit["a" /* addUnit */])(this.rowHeight);
  5706. },
  5707. offset: function offset() {
  5708. var firstDayOfWeek = this.firstDayOfWeek;
  5709. var realDay = this.date.getDay();
  5710. if (!firstDayOfWeek) {
  5711. return realDay;
  5712. }
  5713. return (realDay + 7 - this.firstDayOfWeek) % 7;
  5714. },
  5715. totalDay: function totalDay() {
  5716. return getMonthEndDay(this.date.getFullYear(), this.date.getMonth() + 1);
  5717. },
  5718. shouldRender: function shouldRender() {
  5719. return this.visible || !this.lazyRender;
  5720. },
  5721. placeholders: function placeholders() {
  5722. var rows = [];
  5723. var count = Math.ceil((this.totalDay + this.offset) / 7);
  5724. for (var day = 1; day <= count; day++) {
  5725. rows.push({
  5726. type: 'placeholder'
  5727. });
  5728. }
  5729. return rows;
  5730. },
  5731. days: function days() {
  5732. var days = [];
  5733. var year = this.date.getFullYear();
  5734. var month = this.date.getMonth();
  5735. for (var day = 1; day <= this.totalDay; day++) {
  5736. var date = new Date(year, month, day);
  5737. var type = this.getDayType(date);
  5738. var config = {
  5739. date: date,
  5740. type: type,
  5741. text: day,
  5742. bottomInfo: this.getBottomInfo(type)
  5743. };
  5744. if (this.formatter) {
  5745. config = this.formatter(config);
  5746. }
  5747. days.push(config);
  5748. }
  5749. return days;
  5750. }
  5751. },
  5752. methods: {
  5753. getHeight: function getHeight() {
  5754. if (!this.height) {
  5755. this.height = this.$el.getBoundingClientRect().height;
  5756. }
  5757. return this.height;
  5758. },
  5759. scrollIntoView: function scrollIntoView(body) {
  5760. var _this$$refs = this.$refs,
  5761. days = _this$$refs.days,
  5762. month = _this$$refs.month;
  5763. var el = this.showSubtitle ? days : month;
  5764. var scrollTop = el.getBoundingClientRect().top - body.getBoundingClientRect().top + body.scrollTop;
  5765. setScrollTop(body, scrollTop);
  5766. },
  5767. getMultipleDayType: function getMultipleDayType(day) {
  5768. var _this = this;
  5769. var isSelected = function isSelected(date) {
  5770. return _this.currentDate.some(function (item) {
  5771. return compareDay(item, date) === 0;
  5772. });
  5773. };
  5774. if (isSelected(day)) {
  5775. var prevDay = getPrevDay(day);
  5776. var nextDay = getNextDay(day);
  5777. var prevSelected = isSelected(prevDay);
  5778. var nextSelected = isSelected(nextDay);
  5779. if (prevSelected && nextSelected) {
  5780. return 'multiple-middle';
  5781. }
  5782. if (prevSelected) {
  5783. return 'end';
  5784. }
  5785. return nextSelected ? 'start' : 'multiple-selected';
  5786. }
  5787. return '';
  5788. },
  5789. getRangeDayType: function getRangeDayType(day) {
  5790. var _this$currentDate = this.currentDate,
  5791. startDay = _this$currentDate[0],
  5792. endDay = _this$currentDate[1];
  5793. if (!startDay) {
  5794. return '';
  5795. }
  5796. var compareToStart = compareDay(day, startDay);
  5797. if (!endDay) {
  5798. return compareToStart === 0 ? 'start' : '';
  5799. }
  5800. var compareToEnd = compareDay(day, endDay);
  5801. if (compareToStart === 0 && compareToEnd === 0 && this.allowSameDay) {
  5802. return 'start-end';
  5803. }
  5804. if (compareToStart === 0) {
  5805. return 'start';
  5806. }
  5807. if (compareToEnd === 0) {
  5808. return 'end';
  5809. }
  5810. if (compareToStart > 0 && compareToEnd < 0) {
  5811. return 'middle';
  5812. }
  5813. },
  5814. getDayType: function getDayType(day) {
  5815. var type = this.type,
  5816. minDate = this.minDate,
  5817. maxDate = this.maxDate,
  5818. currentDate = this.currentDate;
  5819. if (compareDay(day, minDate) < 0 || compareDay(day, maxDate) > 0) {
  5820. return 'disabled';
  5821. }
  5822. if (currentDate === null) {
  5823. return;
  5824. }
  5825. if (type === 'single') {
  5826. return compareDay(day, currentDate) === 0 ? 'selected' : '';
  5827. }
  5828. if (type === 'multiple') {
  5829. return this.getMultipleDayType(day);
  5830. }
  5831. /* istanbul ignore else */
  5832. if (type === 'range') {
  5833. return this.getRangeDayType(day);
  5834. }
  5835. },
  5836. getBottomInfo: function getBottomInfo(type) {
  5837. if (this.type === 'range') {
  5838. if (type === 'start' || type === 'end') {
  5839. return utils_t(type);
  5840. }
  5841. if (type === 'start-end') {
  5842. return utils_t('startEnd');
  5843. }
  5844. }
  5845. },
  5846. getDayStyle: function getDayStyle(type, index) {
  5847. var style = {
  5848. height: this.rowHeightWithUnit
  5849. };
  5850. if (type === 'placeholder') {
  5851. style.width = '100%';
  5852. return style;
  5853. }
  5854. if (index === 0) {
  5855. style.marginLeft = 100 * this.offset / 7 + "%";
  5856. }
  5857. if (this.color) {
  5858. if (type === 'start' || type === 'end' || type === 'start-end' || type === 'multiple-selected' || type === 'multiple-middle') {
  5859. style.background = this.color;
  5860. } else if (type === 'middle') {
  5861. style.color = this.color;
  5862. }
  5863. }
  5864. return style;
  5865. },
  5866. genTitle: function genTitle() {
  5867. var h = this.$createElement;
  5868. if (this.showMonthTitle) {
  5869. return h("div", {
  5870. "class": utils_bem('month-title')
  5871. }, [this.title]);
  5872. }
  5873. },
  5874. genMark: function genMark() {
  5875. var h = this.$createElement;
  5876. if (this.showMark && this.shouldRender) {
  5877. return h("div", {
  5878. "class": utils_bem('month-mark')
  5879. }, [this.date.getMonth() + 1]);
  5880. }
  5881. },
  5882. genDays: function genDays() {
  5883. var h = this.$createElement;
  5884. var days = this.shouldRender ? this.days : this.placeholders;
  5885. return h("div", {
  5886. "ref": "days",
  5887. "attrs": {
  5888. "role": "grid"
  5889. },
  5890. "class": utils_bem('days')
  5891. }, [this.genMark(), days.map(this.genDay)]);
  5892. },
  5893. genTopInfo: function genTopInfo(item) {
  5894. var h = this.$createElement;
  5895. var slot = this.$scopedSlots['top-info'];
  5896. if (item.topInfo || slot) {
  5897. return h("div", {
  5898. "class": utils_bem('top-info')
  5899. }, [slot ? slot(item) : item.topInfo]);
  5900. }
  5901. },
  5902. genBottomInfo: function genBottomInfo(item) {
  5903. var h = this.$createElement;
  5904. var slot = this.$scopedSlots['bottom-info'];
  5905. if (item.bottomInfo || slot) {
  5906. return h("div", {
  5907. "class": utils_bem('bottom-info')
  5908. }, [slot ? slot(item) : item.bottomInfo]);
  5909. }
  5910. },
  5911. genDay: function genDay(item, index) {
  5912. var _this2 = this;
  5913. var h = this.$createElement;
  5914. var type = item.type;
  5915. var style = this.getDayStyle(type, index);
  5916. var disabled = type === 'disabled';
  5917. var onClick = function onClick() {
  5918. if (!disabled) {
  5919. _this2.$emit('click', item);
  5920. }
  5921. };
  5922. if (type === 'selected') {
  5923. return h("div", {
  5924. "attrs": {
  5925. "role": "gridcell",
  5926. "tabindex": -1
  5927. },
  5928. "style": style,
  5929. "class": [utils_bem('day'), item.className],
  5930. "on": {
  5931. "click": onClick
  5932. }
  5933. }, [h("div", {
  5934. "class": utils_bem('selected-day'),
  5935. "style": {
  5936. width: this.rowHeightWithUnit,
  5937. height: this.rowHeightWithUnit,
  5938. background: this.color
  5939. }
  5940. }, [this.genTopInfo(item), item.text, this.genBottomInfo(item)])]);
  5941. }
  5942. return h("div", {
  5943. "attrs": {
  5944. "role": "gridcell",
  5945. "tabindex": disabled ? null : -1
  5946. },
  5947. "style": style,
  5948. "class": [utils_bem('day', type), item.className],
  5949. "on": {
  5950. "click": onClick
  5951. }
  5952. }, [this.genTopInfo(item), item.text, this.genBottomInfo(item)]);
  5953. }
  5954. },
  5955. render: function render() {
  5956. var h = arguments[0];
  5957. return h("div", {
  5958. "class": utils_bem('month'),
  5959. "ref": "month"
  5960. }, [this.genTitle(), this.genDays()]);
  5961. }
  5962. }));
  5963. // CONCATENATED MODULE: ./es/calendar/components/Header.js
  5964. var Header_createNamespace = Object(create["a" /* createNamespace */])('calendar-header'),
  5965. Header_createComponent = Header_createNamespace[0];
  5966. /* harmony default export */ var components_Header = (Header_createComponent({
  5967. props: {
  5968. title: String,
  5969. subtitle: String,
  5970. showTitle: Boolean,
  5971. showSubtitle: Boolean,
  5972. firstDayOfWeek: Number
  5973. },
  5974. methods: {
  5975. genTitle: function genTitle() {
  5976. var h = this.$createElement;
  5977. if (this.showTitle) {
  5978. var title = this.slots('title') || this.title || utils_t('title');
  5979. return h("div", {
  5980. "class": utils_bem('header-title')
  5981. }, [title]);
  5982. }
  5983. },
  5984. genSubtitle: function genSubtitle() {
  5985. var h = this.$createElement;
  5986. if (this.showSubtitle) {
  5987. return h("div", {
  5988. "class": utils_bem('header-subtitle')
  5989. }, [this.subtitle]);
  5990. }
  5991. },
  5992. genWeekDays: function genWeekDays() {
  5993. var h = this.$createElement;
  5994. var weekdays = utils_t('weekdays');
  5995. var firstDayOfWeek = this.firstDayOfWeek;
  5996. var renderWeekDays = [].concat(weekdays.slice(firstDayOfWeek, 7), weekdays.slice(0, firstDayOfWeek));
  5997. return h("div", {
  5998. "class": utils_bem('weekdays')
  5999. }, [renderWeekDays.map(function (item) {
  6000. return h("span", {
  6001. "class": utils_bem('weekday')
  6002. }, [item]);
  6003. })]);
  6004. }
  6005. },
  6006. render: function render() {
  6007. var h = arguments[0];
  6008. return h("div", {
  6009. "class": utils_bem('header')
  6010. }, [this.genTitle(), this.genSubtitle(), this.genWeekDays()]);
  6011. }
  6012. }));
  6013. // CONCATENATED MODULE: ./es/calendar/index.js
  6014. // Utils
  6015. // Components
  6016. /* harmony default export */ var calendar = (utils_createComponent({
  6017. props: {
  6018. title: String,
  6019. color: String,
  6020. value: Boolean,
  6021. readonly: Boolean,
  6022. formatter: Function,
  6023. rowHeight: [Number, String],
  6024. confirmText: String,
  6025. rangePrompt: String,
  6026. defaultDate: [Date, Array],
  6027. getContainer: [String, Function],
  6028. allowSameDay: Boolean,
  6029. confirmDisabledText: String,
  6030. type: {
  6031. type: String,
  6032. default: 'single'
  6033. },
  6034. round: {
  6035. type: Boolean,
  6036. default: true
  6037. },
  6038. position: {
  6039. type: String,
  6040. default: 'bottom'
  6041. },
  6042. poppable: {
  6043. type: Boolean,
  6044. default: true
  6045. },
  6046. maxRange: {
  6047. type: [Number, String],
  6048. default: null
  6049. },
  6050. lazyRender: {
  6051. type: Boolean,
  6052. default: true
  6053. },
  6054. showMark: {
  6055. type: Boolean,
  6056. default: true
  6057. },
  6058. showTitle: {
  6059. type: Boolean,
  6060. default: true
  6061. },
  6062. showConfirm: {
  6063. type: Boolean,
  6064. default: true
  6065. },
  6066. showSubtitle: {
  6067. type: Boolean,
  6068. default: true
  6069. },
  6070. closeOnPopstate: {
  6071. type: Boolean,
  6072. default: true
  6073. },
  6074. closeOnClickOverlay: {
  6075. type: Boolean,
  6076. default: true
  6077. },
  6078. safeAreaInsetBottom: {
  6079. type: Boolean,
  6080. default: true
  6081. },
  6082. minDate: {
  6083. type: Date,
  6084. validator: isDate,
  6085. default: function _default() {
  6086. return new Date();
  6087. }
  6088. },
  6089. maxDate: {
  6090. type: Date,
  6091. validator: isDate,
  6092. default: function _default() {
  6093. var now = new Date();
  6094. return new Date(now.getFullYear(), now.getMonth() + 6, now.getDate());
  6095. }
  6096. },
  6097. firstDayOfWeek: {
  6098. type: [Number, String],
  6099. default: 0,
  6100. validator: function validator(val) {
  6101. return val >= 0 && val <= 6;
  6102. }
  6103. }
  6104. },
  6105. data: function data() {
  6106. return {
  6107. subtitle: '',
  6108. currentDate: this.getInitialDate()
  6109. };
  6110. },
  6111. computed: {
  6112. months: function months() {
  6113. var months = [];
  6114. var cursor = new Date(this.minDate);
  6115. cursor.setDate(1);
  6116. do {
  6117. months.push(new Date(cursor));
  6118. cursor.setMonth(cursor.getMonth() + 1);
  6119. } while (compareMonth(cursor, this.maxDate) !== 1);
  6120. return months;
  6121. },
  6122. buttonDisabled: function buttonDisabled() {
  6123. var type = this.type,
  6124. currentDate = this.currentDate;
  6125. if (currentDate) {
  6126. if (type === 'range') {
  6127. return !currentDate[0] || !currentDate[1];
  6128. }
  6129. if (type === 'multiple') {
  6130. return !currentDate.length;
  6131. }
  6132. }
  6133. return !currentDate;
  6134. },
  6135. dayOffset: function dayOffset() {
  6136. return this.firstDayOfWeek ? this.firstDayOfWeek % 7 : 0;
  6137. }
  6138. },
  6139. watch: {
  6140. value: 'init',
  6141. type: function type() {
  6142. this.reset();
  6143. },
  6144. defaultDate: function defaultDate(val) {
  6145. this.currentDate = val;
  6146. this.scrollIntoView();
  6147. }
  6148. },
  6149. mounted: function mounted() {
  6150. this.init();
  6151. },
  6152. /* istanbul ignore next */
  6153. activated: function activated() {
  6154. this.init();
  6155. },
  6156. methods: {
  6157. // @exposed-api
  6158. reset: function reset(date) {
  6159. if (date === void 0) {
  6160. date = this.getInitialDate();
  6161. }
  6162. this.currentDate = date;
  6163. this.scrollIntoView();
  6164. },
  6165. init: function init() {
  6166. var _this = this;
  6167. if (this.poppable && !this.value) {
  6168. return;
  6169. }
  6170. this.$nextTick(function () {
  6171. // add Math.floor to avoid decimal height issues
  6172. // https://github.com/youzan/vant/issues/5640
  6173. _this.bodyHeight = Math.floor(_this.$refs.body.getBoundingClientRect().height);
  6174. _this.onScroll();
  6175. _this.scrollIntoView();
  6176. });
  6177. },
  6178. // @exposed-api
  6179. scrollToDate: function scrollToDate(targetDate) {
  6180. var _this2 = this;
  6181. Object(raf["c" /* raf */])(function () {
  6182. var displayed = _this2.value || !_this2.poppable;
  6183. /* istanbul ignore if */
  6184. if (!targetDate || !displayed) {
  6185. return;
  6186. }
  6187. _this2.months.some(function (month, index) {
  6188. if (compareMonth(month, targetDate) === 0) {
  6189. var _this2$$refs = _this2.$refs,
  6190. body = _this2$$refs.body,
  6191. months = _this2$$refs.months;
  6192. months[index].scrollIntoView(body);
  6193. return true;
  6194. }
  6195. return false;
  6196. });
  6197. _this2.onScroll();
  6198. });
  6199. },
  6200. // scroll to current month
  6201. scrollIntoView: function scrollIntoView() {
  6202. var currentDate = this.currentDate;
  6203. if (currentDate) {
  6204. var targetDate = this.type === 'single' ? currentDate : currentDate[0];
  6205. this.scrollToDate(targetDate);
  6206. }
  6207. },
  6208. getInitialDate: function getInitialDate() {
  6209. var type = this.type,
  6210. minDate = this.minDate,
  6211. maxDate = this.maxDate,
  6212. defaultDate = this.defaultDate;
  6213. if (defaultDate === null) {
  6214. return defaultDate;
  6215. }
  6216. var defaultVal = new Date();
  6217. if (compareDay(defaultVal, minDate) === -1) {
  6218. defaultVal = minDate;
  6219. } else if (compareDay(defaultVal, maxDate) === 1) {
  6220. defaultVal = maxDate;
  6221. }
  6222. if (type === 'range') {
  6223. var _ref = defaultDate || [],
  6224. startDay = _ref[0],
  6225. endDay = _ref[1];
  6226. return [startDay || defaultVal, endDay || getNextDay(defaultVal)];
  6227. }
  6228. if (type === 'multiple') {
  6229. return defaultDate || [defaultVal];
  6230. }
  6231. return defaultDate || defaultVal;
  6232. },
  6233. // calculate the position of the elements
  6234. // and find the elements that needs to be rendered
  6235. onScroll: function onScroll() {
  6236. var _this$$refs = this.$refs,
  6237. body = _this$$refs.body,
  6238. months = _this$$refs.months;
  6239. var top = getScrollTop(body);
  6240. var bottom = top + this.bodyHeight;
  6241. var heights = months.map(function (item) {
  6242. return item.getHeight();
  6243. });
  6244. var heightSum = heights.reduce(function (a, b) {
  6245. return a + b;
  6246. }, 0); // iOS scroll bounce may exceed the range
  6247. if (bottom > heightSum && top > 0) {
  6248. return;
  6249. }
  6250. var height = 0;
  6251. var currentMonth;
  6252. var visibleRange = [-1, -1];
  6253. for (var i = 0; i < months.length; i++) {
  6254. var visible = height <= bottom && height + heights[i] >= top;
  6255. if (visible) {
  6256. visibleRange[1] = i;
  6257. if (!currentMonth) {
  6258. currentMonth = months[i];
  6259. visibleRange[0] = i;
  6260. }
  6261. if (!months[i].showed) {
  6262. months[i].showed = true;
  6263. this.$emit('month-show', {
  6264. date: months[i].date,
  6265. title: months[i].title
  6266. });
  6267. }
  6268. }
  6269. height += heights[i];
  6270. }
  6271. months.forEach(function (month, index) {
  6272. month.visible = index >= visibleRange[0] - 1 && index <= visibleRange[1] + 1;
  6273. });
  6274. /* istanbul ignore else */
  6275. if (currentMonth) {
  6276. this.subtitle = currentMonth.title;
  6277. }
  6278. },
  6279. onClickDay: function onClickDay(item) {
  6280. if (this.readonly) {
  6281. return;
  6282. }
  6283. var date = item.date;
  6284. var type = this.type,
  6285. currentDate = this.currentDate;
  6286. if (type === 'range') {
  6287. if (!currentDate) {
  6288. this.select([date, null]);
  6289. return;
  6290. }
  6291. var startDay = currentDate[0],
  6292. endDay = currentDate[1];
  6293. if (startDay && !endDay) {
  6294. var compareToStart = compareDay(date, startDay);
  6295. if (compareToStart === 1) {
  6296. this.select([startDay, date], true);
  6297. } else if (compareToStart === -1) {
  6298. this.select([date, null]);
  6299. } else if (this.allowSameDay) {
  6300. this.select([date, date], true);
  6301. }
  6302. } else {
  6303. this.select([date, null]);
  6304. }
  6305. } else if (type === 'multiple') {
  6306. if (!currentDate) {
  6307. this.select([date]);
  6308. return;
  6309. }
  6310. var selectedIndex;
  6311. var selected = this.currentDate.some(function (dateItem, index) {
  6312. var equal = compareDay(dateItem, date) === 0;
  6313. if (equal) {
  6314. selectedIndex = index;
  6315. }
  6316. return equal;
  6317. });
  6318. if (selected) {
  6319. var _currentDate$splice = currentDate.splice(selectedIndex, 1),
  6320. unselectedDate = _currentDate$splice[0];
  6321. this.$emit('unselect', copyDate(unselectedDate));
  6322. } else if (this.maxRange && currentDate.length >= this.maxRange) {
  6323. es_toast(this.rangePrompt || utils_t('rangePrompt', this.maxRange));
  6324. } else {
  6325. this.select([].concat(currentDate, [date]));
  6326. }
  6327. } else {
  6328. this.select(date, true);
  6329. }
  6330. },
  6331. togglePopup: function togglePopup(val) {
  6332. this.$emit('input', val);
  6333. },
  6334. select: function select(date, complete) {
  6335. var _this3 = this;
  6336. var emit = function emit(date) {
  6337. _this3.currentDate = date;
  6338. _this3.$emit('select', copyDates(_this3.currentDate));
  6339. };
  6340. if (complete && this.type === 'range') {
  6341. var valid = this.checkRange(date);
  6342. if (!valid) {
  6343. // auto selected to max range if showConfirm
  6344. if (this.showConfirm) {
  6345. emit([date[0], getDayByOffset(date[0], this.maxRange - 1)]);
  6346. } else {
  6347. emit(date);
  6348. }
  6349. return;
  6350. }
  6351. }
  6352. emit(date);
  6353. if (complete && !this.showConfirm) {
  6354. this.onConfirm();
  6355. }
  6356. },
  6357. checkRange: function checkRange(date) {
  6358. var maxRange = this.maxRange,
  6359. rangePrompt = this.rangePrompt;
  6360. if (maxRange && calcDateNum(date) > maxRange) {
  6361. es_toast(rangePrompt || utils_t('rangePrompt', maxRange));
  6362. return false;
  6363. }
  6364. return true;
  6365. },
  6366. onConfirm: function onConfirm() {
  6367. this.$emit('confirm', copyDates(this.currentDate));
  6368. },
  6369. genMonth: function genMonth(date, index) {
  6370. var h = this.$createElement;
  6371. var showMonthTitle = index !== 0 || !this.showSubtitle;
  6372. return h(Month, {
  6373. "ref": "months",
  6374. "refInFor": true,
  6375. "attrs": {
  6376. "date": date,
  6377. "type": this.type,
  6378. "color": this.color,
  6379. "minDate": this.minDate,
  6380. "maxDate": this.maxDate,
  6381. "showMark": this.showMark,
  6382. "formatter": this.formatter,
  6383. "rowHeight": this.rowHeight,
  6384. "lazyRender": this.lazyRender,
  6385. "currentDate": this.currentDate,
  6386. "showSubtitle": this.showSubtitle,
  6387. "allowSameDay": this.allowSameDay,
  6388. "showMonthTitle": showMonthTitle,
  6389. "firstDayOfWeek": this.dayOffset
  6390. },
  6391. "scopedSlots": {
  6392. 'top-info': this.$scopedSlots['top-info'],
  6393. 'bottom-info': this.$scopedSlots['bottom-info']
  6394. },
  6395. "on": {
  6396. "click": this.onClickDay
  6397. }
  6398. });
  6399. },
  6400. genFooterContent: function genFooterContent() {
  6401. var h = this.$createElement;
  6402. var slot = this.slots('footer');
  6403. if (slot) {
  6404. return slot;
  6405. }
  6406. if (this.showConfirm) {
  6407. var text = this.buttonDisabled ? this.confirmDisabledText : this.confirmText;
  6408. return h(es_button, {
  6409. "attrs": {
  6410. "round": true,
  6411. "block": true,
  6412. "type": "danger",
  6413. "color": this.color,
  6414. "disabled": this.buttonDisabled,
  6415. "nativeType": "button"
  6416. },
  6417. "class": utils_bem('confirm'),
  6418. "on": {
  6419. "click": this.onConfirm
  6420. }
  6421. }, [text || utils_t('confirm')]);
  6422. }
  6423. },
  6424. genFooter: function genFooter() {
  6425. var h = this.$createElement;
  6426. return h("div", {
  6427. "class": utils_bem('footer', {
  6428. unfit: !this.safeAreaInsetBottom
  6429. })
  6430. }, [this.genFooterContent()]);
  6431. },
  6432. genCalendar: function genCalendar() {
  6433. var _this4 = this;
  6434. var h = this.$createElement;
  6435. return h("div", {
  6436. "class": utils_bem()
  6437. }, [h(components_Header, {
  6438. "attrs": {
  6439. "title": this.title,
  6440. "showTitle": this.showTitle,
  6441. "subtitle": this.subtitle,
  6442. "showSubtitle": this.showSubtitle,
  6443. "firstDayOfWeek": this.dayOffset
  6444. },
  6445. "scopedSlots": {
  6446. title: function title() {
  6447. return _this4.slots('title');
  6448. }
  6449. }
  6450. }), h("div", {
  6451. "ref": "body",
  6452. "class": utils_bem('body'),
  6453. "on": {
  6454. "scroll": this.onScroll
  6455. }
  6456. }, [this.months.map(this.genMonth)]), this.genFooter()]);
  6457. }
  6458. },
  6459. render: function render() {
  6460. var _this5 = this;
  6461. var h = arguments[0];
  6462. if (this.poppable) {
  6463. var _attrs;
  6464. var createListener = function createListener(name) {
  6465. return function () {
  6466. return _this5.$emit(name);
  6467. };
  6468. };
  6469. return h(popup, {
  6470. "attrs": (_attrs = {
  6471. "round": true,
  6472. "value": this.value
  6473. }, _attrs["round"] = this.round, _attrs["position"] = this.position, _attrs["closeable"] = this.showTitle || this.showSubtitle, _attrs["getContainer"] = this.getContainer, _attrs["closeOnPopstate"] = this.closeOnPopstate, _attrs["closeOnClickOverlay"] = this.closeOnClickOverlay, _attrs),
  6474. "class": utils_bem('popup'),
  6475. "on": {
  6476. "input": this.togglePopup,
  6477. "open": createListener('open'),
  6478. "opened": createListener('opened'),
  6479. "close": createListener('close'),
  6480. "closed": createListener('closed')
  6481. }
  6482. }, [this.genCalendar()]);
  6483. }
  6484. return this.genCalendar();
  6485. }
  6486. }));
  6487. // CONCATENATED MODULE: ./es/image/index.js
  6488. var image_createNamespace = Object(create["a" /* createNamespace */])('image'),
  6489. image_createComponent = image_createNamespace[0],
  6490. image_bem = image_createNamespace[1];
  6491. /* harmony default export */ var es_image = (image_createComponent({
  6492. props: {
  6493. src: String,
  6494. fit: String,
  6495. alt: String,
  6496. round: Boolean,
  6497. width: [Number, String],
  6498. height: [Number, String],
  6499. radius: [Number, String],
  6500. lazyLoad: Boolean,
  6501. iconPrefix: String,
  6502. showError: {
  6503. type: Boolean,
  6504. default: true
  6505. },
  6506. showLoading: {
  6507. type: Boolean,
  6508. default: true
  6509. },
  6510. errorIcon: {
  6511. type: String,
  6512. default: 'photo-fail'
  6513. },
  6514. loadingIcon: {
  6515. type: String,
  6516. default: 'photo'
  6517. }
  6518. },
  6519. data: function data() {
  6520. return {
  6521. loading: true,
  6522. error: false
  6523. };
  6524. },
  6525. watch: {
  6526. src: function src() {
  6527. this.loading = true;
  6528. this.error = false;
  6529. }
  6530. },
  6531. computed: {
  6532. style: function style() {
  6533. var style = {};
  6534. if (Object(utils["c" /* isDef */])(this.width)) {
  6535. style.width = Object(unit["a" /* addUnit */])(this.width);
  6536. }
  6537. if (Object(utils["c" /* isDef */])(this.height)) {
  6538. style.height = Object(unit["a" /* addUnit */])(this.height);
  6539. }
  6540. if (Object(utils["c" /* isDef */])(this.radius)) {
  6541. style.overflow = 'hidden';
  6542. style.borderRadius = Object(unit["a" /* addUnit */])(this.radius);
  6543. }
  6544. return style;
  6545. }
  6546. },
  6547. created: function created() {
  6548. var $Lazyload = this.$Lazyload;
  6549. if ($Lazyload && utils["b" /* inBrowser */]) {
  6550. $Lazyload.$on('loaded', this.onLazyLoaded);
  6551. $Lazyload.$on('error', this.onLazyLoadError);
  6552. }
  6553. },
  6554. beforeDestroy: function beforeDestroy() {
  6555. var $Lazyload = this.$Lazyload;
  6556. if ($Lazyload) {
  6557. $Lazyload.$off('loaded', this.onLazyLoaded);
  6558. $Lazyload.$off('error', this.onLazyLoadError);
  6559. }
  6560. },
  6561. methods: {
  6562. onLoad: function onLoad(event) {
  6563. this.loading = false;
  6564. this.$emit('load', event);
  6565. },
  6566. onLazyLoaded: function onLazyLoaded(_ref) {
  6567. var el = _ref.el;
  6568. if (el === this.$refs.image && this.loading) {
  6569. this.onLoad();
  6570. }
  6571. },
  6572. onLazyLoadError: function onLazyLoadError(_ref2) {
  6573. var el = _ref2.el;
  6574. if (el === this.$refs.image && !this.error) {
  6575. this.onError();
  6576. }
  6577. },
  6578. onError: function onError(event) {
  6579. this.error = true;
  6580. this.loading = false;
  6581. this.$emit('error', event);
  6582. },
  6583. onClick: function onClick(event) {
  6584. this.$emit('click', event);
  6585. },
  6586. genPlaceholder: function genPlaceholder() {
  6587. var h = this.$createElement;
  6588. if (this.loading && this.showLoading) {
  6589. return h("div", {
  6590. "class": image_bem('loading')
  6591. }, [this.slots('loading') || h(es_icon, {
  6592. "attrs": {
  6593. "name": this.loadingIcon,
  6594. "classPrefix": this.iconPrefix
  6595. },
  6596. "class": image_bem('loading-icon')
  6597. })]);
  6598. }
  6599. if (this.error && this.showError) {
  6600. return h("div", {
  6601. "class": image_bem('error')
  6602. }, [this.slots('error') || h(es_icon, {
  6603. "attrs": {
  6604. "name": this.errorIcon,
  6605. "classPrefix": this.iconPrefix
  6606. },
  6607. "class": image_bem('error-icon')
  6608. })]);
  6609. }
  6610. },
  6611. genImage: function genImage() {
  6612. var h = this.$createElement;
  6613. var imgData = {
  6614. class: image_bem('img'),
  6615. attrs: {
  6616. alt: this.alt
  6617. },
  6618. style: {
  6619. objectFit: this.fit
  6620. }
  6621. };
  6622. if (this.error) {
  6623. return;
  6624. }
  6625. if (this.lazyLoad) {
  6626. return h("img", helper_default()([{
  6627. "ref": "image",
  6628. "directives": [{
  6629. name: "lazy",
  6630. value: this.src
  6631. }]
  6632. }, imgData]));
  6633. }
  6634. return h("img", helper_default()([{
  6635. "attrs": {
  6636. "src": this.src
  6637. },
  6638. "on": {
  6639. "load": this.onLoad,
  6640. "error": this.onError
  6641. }
  6642. }, imgData]));
  6643. }
  6644. },
  6645. render: function render() {
  6646. var h = arguments[0];
  6647. return h("div", {
  6648. "class": image_bem({
  6649. round: this.round
  6650. }),
  6651. "style": this.style,
  6652. "on": {
  6653. "click": this.onClick
  6654. }
  6655. }, [this.genImage(), this.genPlaceholder(), this.slots()]);
  6656. }
  6657. }));
  6658. // CONCATENATED MODULE: ./es/card/index.js
  6659. // Utils
  6660. // Components
  6661. // Types
  6662. var card_createNamespace = Object(create["a" /* createNamespace */])('card'),
  6663. card_createComponent = card_createNamespace[0],
  6664. card_bem = card_createNamespace[1];
  6665. function Card(h, props, slots, ctx) {
  6666. var _slots$priceTop;
  6667. var thumb = props.thumb;
  6668. var showNum = slots.num || Object(utils["c" /* isDef */])(props.num);
  6669. var showPrice = slots.price || Object(utils["c" /* isDef */])(props.price);
  6670. var showOriginPrice = slots['origin-price'] || Object(utils["c" /* isDef */])(props.originPrice);
  6671. var showBottom = showNum || showPrice || showOriginPrice || slots.bottom;
  6672. function onThumbClick(event) {
  6673. functional_emit(ctx, 'click-thumb', event);
  6674. }
  6675. function ThumbTag() {
  6676. if (slots.tag || props.tag) {
  6677. return h("div", {
  6678. "class": card_bem('tag')
  6679. }, [slots.tag ? slots.tag() : h(es_tag, {
  6680. "attrs": {
  6681. "mark": true,
  6682. "type": "danger"
  6683. }
  6684. }, [props.tag])]);
  6685. }
  6686. }
  6687. function Thumb() {
  6688. if (slots.thumb || thumb) {
  6689. return h("a", {
  6690. "attrs": {
  6691. "href": props.thumbLink
  6692. },
  6693. "class": card_bem('thumb'),
  6694. "on": {
  6695. "click": onThumbClick
  6696. }
  6697. }, [slots.thumb ? slots.thumb() : h(es_image, {
  6698. "attrs": {
  6699. "src": thumb,
  6700. "width": "100%",
  6701. "height": "100%",
  6702. "fit": "cover",
  6703. "lazy-load": props.lazyLoad
  6704. }
  6705. }), ThumbTag()]);
  6706. }
  6707. }
  6708. function Title() {
  6709. if (slots.title) {
  6710. return slots.title();
  6711. }
  6712. if (props.title) {
  6713. return h("div", {
  6714. "class": [card_bem('title'), 'van-multi-ellipsis--l2']
  6715. }, [props.title]);
  6716. }
  6717. }
  6718. function Desc() {
  6719. if (slots.desc) {
  6720. return slots.desc();
  6721. }
  6722. if (props.desc) {
  6723. return h("div", {
  6724. "class": [card_bem('desc'), 'van-ellipsis']
  6725. }, [props.desc]);
  6726. }
  6727. }
  6728. function PriceContent() {
  6729. var priceArr = props.price.toString().split('.');
  6730. return h("div", [h("span", {
  6731. "class": card_bem('price-currency')
  6732. }, [props.currency]), h("span", {
  6733. "class": card_bem('price-integer')
  6734. }, [priceArr[0]]), ".", h("span", {
  6735. "class": card_bem('price-decimal')
  6736. }, [priceArr[1]])]);
  6737. }
  6738. function Price() {
  6739. if (showPrice) {
  6740. return h("div", {
  6741. "class": card_bem('price')
  6742. }, [slots.price ? slots.price() : PriceContent()]);
  6743. }
  6744. }
  6745. function OriginPrice() {
  6746. if (showOriginPrice) {
  6747. var slot = slots['origin-price'];
  6748. return h("div", {
  6749. "class": card_bem('origin-price')
  6750. }, [slot ? slot() : props.currency + " " + props.originPrice]);
  6751. }
  6752. }
  6753. function Num() {
  6754. if (showNum) {
  6755. return h("div", {
  6756. "class": card_bem('num')
  6757. }, [slots.num ? slots.num() : "x" + props.num]);
  6758. }
  6759. }
  6760. function Footer() {
  6761. if (slots.footer) {
  6762. return h("div", {
  6763. "class": card_bem('footer')
  6764. }, [slots.footer()]);
  6765. }
  6766. }
  6767. return h("div", helper_default()([{
  6768. "class": card_bem()
  6769. }, inherit(ctx, true)]), [h("div", {
  6770. "class": card_bem('header')
  6771. }, [Thumb(), h("div", {
  6772. "class": card_bem('content', {
  6773. centered: props.centered
  6774. })
  6775. }, [h("div", [Title(), Desc(), slots.tags == null ? void 0 : slots.tags()]), showBottom && h("div", {
  6776. "class": "van-card__bottom"
  6777. }, [(_slots$priceTop = slots['price-top']) == null ? void 0 : _slots$priceTop.call(slots), Price(), OriginPrice(), Num(), slots.bottom == null ? void 0 : slots.bottom()])])]), Footer()]);
  6778. }
  6779. Card.props = {
  6780. tag: String,
  6781. desc: String,
  6782. thumb: String,
  6783. title: String,
  6784. centered: Boolean,
  6785. lazyLoad: Boolean,
  6786. thumbLink: String,
  6787. num: [Number, String],
  6788. price: [Number, String],
  6789. originPrice: [Number, String],
  6790. currency: {
  6791. type: String,
  6792. default: '¥'
  6793. }
  6794. };
  6795. /* harmony default export */ var card = (card_createComponent(Card));
  6796. // CONCATENATED MODULE: ./es/tab/index.js
  6797. var tab_createNamespace = Object(create["a" /* createNamespace */])('tab'),
  6798. tab_createComponent = tab_createNamespace[0],
  6799. tab_bem = tab_createNamespace[1];
  6800. /* harmony default export */ var tab = (tab_createComponent({
  6801. mixins: [ChildrenMixin('vanTabs')],
  6802. props: _extends({}, routeProps, {
  6803. dot: Boolean,
  6804. name: [Number, String],
  6805. // @deprecated
  6806. info: [Number, String],
  6807. badge: [Number, String],
  6808. title: String,
  6809. titleStyle: null,
  6810. titleClass: null,
  6811. disabled: Boolean
  6812. }),
  6813. data: function data() {
  6814. return {
  6815. inited: false
  6816. };
  6817. },
  6818. computed: {
  6819. computedName: function computedName() {
  6820. var _this$name;
  6821. return (_this$name = this.name) != null ? _this$name : this.index;
  6822. },
  6823. isActive: function isActive() {
  6824. var active = this.computedName === this.parent.currentName;
  6825. if (active) {
  6826. this.inited = true;
  6827. }
  6828. return active;
  6829. }
  6830. },
  6831. watch: {
  6832. title: function title() {
  6833. this.parent.setLine();
  6834. this.parent.scrollIntoView();
  6835. },
  6836. inited: function inited(val) {
  6837. var _this = this;
  6838. if (this.parent.lazyRender && val) {
  6839. this.$nextTick(function () {
  6840. _this.parent.$emit('rendered', _this.computedName, _this.title);
  6841. });
  6842. }
  6843. }
  6844. },
  6845. render: function render(h) {
  6846. var slots = this.slots,
  6847. parent = this.parent,
  6848. isActive = this.isActive;
  6849. var slotContent = slots();
  6850. if (false) {}
  6851. if (!slotContent && !parent.animated) {
  6852. return;
  6853. }
  6854. var show = parent.scrollspy || isActive;
  6855. var shouldRender = this.inited || parent.scrollspy || !parent.lazyRender;
  6856. var Content = shouldRender ? slotContent : h();
  6857. if (parent.animated) {
  6858. return h("div", {
  6859. "attrs": {
  6860. "role": "tabpanel",
  6861. "aria-hidden": !isActive
  6862. },
  6863. "class": tab_bem('pane-wrapper', {
  6864. inactive: !isActive
  6865. })
  6866. }, [h("div", {
  6867. "class": tab_bem('pane')
  6868. }, [Content])]);
  6869. }
  6870. return h("div", {
  6871. "directives": [{
  6872. name: "show",
  6873. value: show
  6874. }],
  6875. "attrs": {
  6876. "role": "tabpanel"
  6877. },
  6878. "class": tab_bem('pane')
  6879. }, [Content]);
  6880. }
  6881. }));
  6882. // CONCATENATED MODULE: ./es/tabs/utils.js
  6883. function scrollLeftTo(scroller, to, duration) {
  6884. var count = 0;
  6885. var from = scroller.scrollLeft;
  6886. var frames = duration === 0 ? 1 : Math.round(duration * 1000 / 16);
  6887. function animate() {
  6888. scroller.scrollLeft += (to - from) / frames;
  6889. if (++count < frames) {
  6890. Object(raf["c" /* raf */])(animate);
  6891. }
  6892. }
  6893. animate();
  6894. }
  6895. function scrollTopTo(scroller, to, duration, callback) {
  6896. var current = getScrollTop(scroller);
  6897. var isDown = current < to;
  6898. var frames = duration === 0 ? 1 : Math.round(duration * 1000 / 16);
  6899. var step = (to - current) / frames;
  6900. function animate() {
  6901. current += step;
  6902. if (isDown && current > to || !isDown && current < to) {
  6903. current = to;
  6904. }
  6905. setScrollTop(scroller, current);
  6906. if (isDown && current < to || !isDown && current > to) {
  6907. Object(raf["c" /* raf */])(animate);
  6908. } else if (callback) {
  6909. Object(raf["c" /* raf */])(callback);
  6910. }
  6911. }
  6912. animate();
  6913. }
  6914. // CONCATENATED MODULE: ./es/utils/dom/style.js
  6915. function isHidden(el) {
  6916. var style = window.getComputedStyle(el);
  6917. var hidden = style.display === 'none'; // offsetParent returns null in the following situations:
  6918. // 1. The element or its parent element has the display property set to none.
  6919. // 2. The element has the position property set to fixed
  6920. var parentHidden = el.offsetParent === null && style.position !== 'fixed';
  6921. return hidden || parentHidden;
  6922. }
  6923. // CONCATENATED MODULE: ./es/utils/interceptor.js
  6924. function callInterceptor(options) {
  6925. var interceptor = options.interceptor,
  6926. args = options.args,
  6927. done = options.done;
  6928. if (interceptor) {
  6929. var returnVal = interceptor.apply(void 0, args);
  6930. if (Object(utils["g" /* isPromise */])(returnVal)) {
  6931. returnVal.then(function (value) {
  6932. if (value) {
  6933. done();
  6934. }
  6935. }).catch(utils["i" /* noop */]);
  6936. } else if (returnVal) {
  6937. done();
  6938. }
  6939. } else {
  6940. done();
  6941. }
  6942. }
  6943. // CONCATENATED MODULE: ./es/tabs/Title.js
  6944. var Title_createNamespace = Object(create["a" /* createNamespace */])('tab'),
  6945. Title_createComponent = Title_createNamespace[0],
  6946. Title_bem = Title_createNamespace[1];
  6947. /* harmony default export */ var tabs_Title = (Title_createComponent({
  6948. props: {
  6949. dot: Boolean,
  6950. type: String,
  6951. info: [Number, String],
  6952. color: String,
  6953. title: String,
  6954. isActive: Boolean,
  6955. disabled: Boolean,
  6956. scrollable: Boolean,
  6957. activeColor: String,
  6958. inactiveColor: String
  6959. },
  6960. computed: {
  6961. style: function style() {
  6962. var style = {};
  6963. var color = this.color,
  6964. isActive = this.isActive;
  6965. var isCard = this.type === 'card'; // card theme color
  6966. if (color && isCard) {
  6967. style.borderColor = color;
  6968. if (!this.disabled) {
  6969. if (isActive) {
  6970. style.backgroundColor = color;
  6971. } else {
  6972. style.color = color;
  6973. }
  6974. }
  6975. }
  6976. var titleColor = isActive ? this.activeColor : this.inactiveColor;
  6977. if (titleColor) {
  6978. style.color = titleColor;
  6979. }
  6980. return style;
  6981. }
  6982. },
  6983. methods: {
  6984. onClick: function onClick() {
  6985. this.$emit('click');
  6986. },
  6987. genText: function genText() {
  6988. var h = this.$createElement;
  6989. var Text = h("span", {
  6990. "class": Title_bem('text', {
  6991. ellipsis: !this.scrollable
  6992. })
  6993. }, [this.slots() || this.title]);
  6994. if (this.dot || Object(utils["c" /* isDef */])(this.info) && this.info !== '') {
  6995. return h("span", {
  6996. "class": Title_bem('text-wrapper')
  6997. }, [Text, h(es_info, {
  6998. "attrs": {
  6999. "dot": this.dot,
  7000. "info": this.info
  7001. }
  7002. })]);
  7003. }
  7004. return Text;
  7005. }
  7006. },
  7007. render: function render() {
  7008. var h = arguments[0];
  7009. return h("div", {
  7010. "attrs": {
  7011. "role": "tab",
  7012. "aria-selected": this.isActive
  7013. },
  7014. "class": [Title_bem({
  7015. active: this.isActive,
  7016. disabled: this.disabled
  7017. })],
  7018. "style": this.style,
  7019. "on": {
  7020. "click": this.onClick
  7021. }
  7022. }, [this.genText()]);
  7023. }
  7024. }));
  7025. // CONCATENATED MODULE: ./es/sticky/index.js
  7026. var sticky_createNamespace = Object(create["a" /* createNamespace */])('sticky'),
  7027. sticky_createComponent = sticky_createNamespace[0],
  7028. sticky_bem = sticky_createNamespace[1];
  7029. /* harmony default export */ var es_sticky = (sticky_createComponent({
  7030. mixins: [BindEventMixin(function (bind, isBind) {
  7031. if (!this.scroller) {
  7032. this.scroller = getScroller(this.$el);
  7033. }
  7034. if (this.observer) {
  7035. var method = isBind ? 'observe' : 'unobserve';
  7036. this.observer[method](this.$el);
  7037. }
  7038. bind(this.scroller, 'scroll', this.onScroll, true);
  7039. this.onScroll();
  7040. })],
  7041. props: {
  7042. zIndex: [Number, String],
  7043. container: null,
  7044. offsetTop: {
  7045. type: [Number, String],
  7046. default: 0
  7047. }
  7048. },
  7049. data: function data() {
  7050. return {
  7051. fixed: false,
  7052. height: 0,
  7053. transform: 0
  7054. };
  7055. },
  7056. computed: {
  7057. offsetTopPx: function offsetTopPx() {
  7058. return Object(unit["b" /* unitToPx */])(this.offsetTop);
  7059. },
  7060. style: function style() {
  7061. if (!this.fixed) {
  7062. return;
  7063. }
  7064. var style = {};
  7065. if (Object(utils["c" /* isDef */])(this.zIndex)) {
  7066. style.zIndex = this.zIndex;
  7067. }
  7068. if (this.offsetTopPx && this.fixed) {
  7069. style.top = this.offsetTopPx + "px";
  7070. }
  7071. if (this.transform) {
  7072. style.transform = "translate3d(0, " + this.transform + "px, 0)";
  7073. }
  7074. return style;
  7075. }
  7076. },
  7077. watch: {
  7078. fixed: function fixed(isFixed) {
  7079. this.$emit('change', isFixed);
  7080. }
  7081. },
  7082. created: function created() {
  7083. var _this = this; // compatibility: https://caniuse.com/#feat=intersectionobserver
  7084. if (!utils["h" /* isServer */] && window.IntersectionObserver) {
  7085. this.observer = new IntersectionObserver(function (entries) {
  7086. // trigger scroll when visibility changed
  7087. if (entries[0].intersectionRatio > 0) {
  7088. _this.onScroll();
  7089. }
  7090. }, {
  7091. root: document.body
  7092. });
  7093. }
  7094. },
  7095. methods: {
  7096. onScroll: function onScroll() {
  7097. var _this2 = this;
  7098. if (isHidden(this.$el)) {
  7099. return;
  7100. }
  7101. this.height = this.$el.offsetHeight;
  7102. var container = this.container,
  7103. offsetTopPx = this.offsetTopPx;
  7104. var scrollTop = getScrollTop(window);
  7105. var topToPageTop = getElementTop(this.$el);
  7106. var emitScrollEvent = function emitScrollEvent() {
  7107. _this2.$emit('scroll', {
  7108. scrollTop: scrollTop,
  7109. isFixed: _this2.fixed
  7110. });
  7111. }; // The sticky component should be kept inside the container element
  7112. if (container) {
  7113. var bottomToPageTop = topToPageTop + container.offsetHeight;
  7114. if (scrollTop + offsetTopPx + this.height > bottomToPageTop) {
  7115. var distanceToBottom = this.height + scrollTop - bottomToPageTop;
  7116. if (distanceToBottom < this.height) {
  7117. this.fixed = true;
  7118. this.transform = -(distanceToBottom + offsetTopPx);
  7119. } else {
  7120. this.fixed = false;
  7121. }
  7122. emitScrollEvent();
  7123. return;
  7124. }
  7125. }
  7126. if (scrollTop + offsetTopPx > topToPageTop) {
  7127. this.fixed = true;
  7128. this.transform = 0;
  7129. } else {
  7130. this.fixed = false;
  7131. }
  7132. emitScrollEvent();
  7133. }
  7134. },
  7135. render: function render() {
  7136. var h = arguments[0];
  7137. var fixed = this.fixed;
  7138. var style = {
  7139. height: fixed ? this.height + "px" : null
  7140. };
  7141. return h("div", {
  7142. "style": style
  7143. }, [h("div", {
  7144. "class": sticky_bem({
  7145. fixed: fixed
  7146. }),
  7147. "style": this.style
  7148. }, [this.slots()])]);
  7149. }
  7150. }));
  7151. // CONCATENATED MODULE: ./es/tabs/Content.js
  7152. var Content_createNamespace = Object(create["a" /* createNamespace */])('tabs'),
  7153. Content_createComponent = Content_createNamespace[0],
  7154. Content_bem = Content_createNamespace[1];
  7155. var MIN_SWIPE_DISTANCE = 50;
  7156. /* harmony default export */ var tabs_Content = (Content_createComponent({
  7157. mixins: [TouchMixin],
  7158. props: {
  7159. count: Number,
  7160. duration: [Number, String],
  7161. animated: Boolean,
  7162. swipeable: Boolean,
  7163. currentIndex: Number
  7164. },
  7165. computed: {
  7166. style: function style() {
  7167. if (this.animated) {
  7168. return {
  7169. transform: "translate3d(" + -1 * this.currentIndex * 100 + "%, 0, 0)",
  7170. transitionDuration: this.duration + "s"
  7171. };
  7172. }
  7173. },
  7174. listeners: function listeners() {
  7175. if (this.swipeable) {
  7176. return {
  7177. touchstart: this.touchStart,
  7178. touchmove: this.touchMove,
  7179. touchend: this.onTouchEnd,
  7180. touchcancel: this.onTouchEnd
  7181. };
  7182. }
  7183. }
  7184. },
  7185. methods: {
  7186. // watch swipe touch end
  7187. onTouchEnd: function onTouchEnd() {
  7188. var direction = this.direction,
  7189. deltaX = this.deltaX,
  7190. currentIndex = this.currentIndex;
  7191. /* istanbul ignore else */
  7192. if (direction === 'horizontal' && this.offsetX >= MIN_SWIPE_DISTANCE) {
  7193. /* istanbul ignore else */
  7194. if (deltaX > 0 && currentIndex !== 0) {
  7195. this.$emit('change', currentIndex - 1);
  7196. } else if (deltaX < 0 && currentIndex !== this.count - 1) {
  7197. this.$emit('change', currentIndex + 1);
  7198. }
  7199. }
  7200. },
  7201. genChildren: function genChildren() {
  7202. var h = this.$createElement;
  7203. if (this.animated) {
  7204. return h("div", {
  7205. "class": Content_bem('track'),
  7206. "style": this.style
  7207. }, [this.slots()]);
  7208. }
  7209. return this.slots();
  7210. }
  7211. },
  7212. render: function render() {
  7213. var h = arguments[0];
  7214. return h("div", {
  7215. "class": Content_bem('content', {
  7216. animated: this.animated
  7217. }),
  7218. "on": _extends({}, this.listeners)
  7219. }, [this.genChildren()]);
  7220. }
  7221. }));
  7222. // CONCATENATED MODULE: ./es/tabs/index.js
  7223. // Utils
  7224. // Mixins
  7225. // Components
  7226. var tabs_createNamespace = Object(create["a" /* createNamespace */])('tabs'),
  7227. tabs_createComponent = tabs_createNamespace[0],
  7228. tabs_bem = tabs_createNamespace[1];
  7229. /* harmony default export */ var tabs = (tabs_createComponent({
  7230. mixins: [ParentMixin('vanTabs'), BindEventMixin(function (bind) {
  7231. if (!this.scroller) {
  7232. this.scroller = getScroller(this.$el);
  7233. }
  7234. bind(window, 'resize', this.resize, true);
  7235. if (this.scrollspy) {
  7236. bind(this.scroller, 'scroll', this.onScroll, true);
  7237. }
  7238. })],
  7239. inject: {
  7240. vanPopup: {
  7241. default: null
  7242. }
  7243. },
  7244. model: {
  7245. prop: 'active'
  7246. },
  7247. props: {
  7248. color: String,
  7249. border: Boolean,
  7250. sticky: Boolean,
  7251. animated: Boolean,
  7252. swipeable: Boolean,
  7253. scrollspy: Boolean,
  7254. background: String,
  7255. lineWidth: [Number, String],
  7256. lineHeight: [Number, String],
  7257. beforeChange: Function,
  7258. titleActiveColor: String,
  7259. titleInactiveColor: String,
  7260. type: {
  7261. type: String,
  7262. default: 'line'
  7263. },
  7264. active: {
  7265. type: [Number, String],
  7266. default: 0
  7267. },
  7268. ellipsis: {
  7269. type: Boolean,
  7270. default: true
  7271. },
  7272. duration: {
  7273. type: [Number, String],
  7274. default: 0.3
  7275. },
  7276. offsetTop: {
  7277. type: [Number, String],
  7278. default: 0
  7279. },
  7280. lazyRender: {
  7281. type: Boolean,
  7282. default: true
  7283. },
  7284. swipeThreshold: {
  7285. type: [Number, String],
  7286. default: 5
  7287. }
  7288. },
  7289. data: function data() {
  7290. return {
  7291. position: '',
  7292. currentIndex: null,
  7293. lineStyle: {
  7294. backgroundColor: this.color
  7295. }
  7296. };
  7297. },
  7298. computed: {
  7299. // whether the nav is scrollable
  7300. scrollable: function scrollable() {
  7301. return this.children.length > this.swipeThreshold || !this.ellipsis;
  7302. },
  7303. navStyle: function navStyle() {
  7304. return {
  7305. borderColor: this.color,
  7306. background: this.background
  7307. };
  7308. },
  7309. currentName: function currentName() {
  7310. var activeTab = this.children[this.currentIndex];
  7311. if (activeTab) {
  7312. return activeTab.computedName;
  7313. }
  7314. },
  7315. offsetTopPx: function offsetTopPx() {
  7316. return Object(unit["b" /* unitToPx */])(this.offsetTop);
  7317. },
  7318. scrollOffset: function scrollOffset() {
  7319. if (this.sticky) {
  7320. return this.offsetTopPx + this.tabHeight;
  7321. }
  7322. return 0;
  7323. }
  7324. },
  7325. watch: {
  7326. color: 'setLine',
  7327. active: function active(name) {
  7328. if (name !== this.currentName) {
  7329. this.setCurrentIndexByName(name);
  7330. }
  7331. },
  7332. children: function children() {
  7333. var _this = this;
  7334. this.setCurrentIndexByName(this.active);
  7335. this.setLine();
  7336. this.$nextTick(function () {
  7337. _this.scrollIntoView(true);
  7338. });
  7339. },
  7340. currentIndex: function currentIndex() {
  7341. this.scrollIntoView();
  7342. this.setLine(); // scroll to correct position
  7343. if (this.stickyFixed && !this.scrollspy) {
  7344. setRootScrollTop(Math.ceil(getElementTop(this.$el) - this.offsetTopPx));
  7345. }
  7346. },
  7347. scrollspy: function scrollspy(val) {
  7348. if (val) {
  7349. event_on(this.scroller, 'scroll', this.onScroll, true);
  7350. } else {
  7351. off(this.scroller, 'scroll', this.onScroll);
  7352. }
  7353. }
  7354. },
  7355. mounted: function mounted() {
  7356. var _this2 = this;
  7357. this.init(); // https://github.com/youzan/vant/issues/7959
  7358. if (this.vanPopup) {
  7359. this.vanPopup.onReopen(function () {
  7360. _this2.setLine();
  7361. });
  7362. }
  7363. },
  7364. activated: function activated() {
  7365. this.init();
  7366. this.setLine();
  7367. },
  7368. methods: {
  7369. // @exposed-api
  7370. resize: function resize() {
  7371. this.setLine();
  7372. },
  7373. init: function init() {
  7374. var _this3 = this;
  7375. this.$nextTick(function () {
  7376. _this3.inited = true;
  7377. _this3.tabHeight = getVisibleHeight(_this3.$refs.wrap);
  7378. _this3.scrollIntoView(true);
  7379. });
  7380. },
  7381. // update nav bar style
  7382. setLine: function setLine() {
  7383. var _this4 = this;
  7384. var shouldAnimate = this.inited;
  7385. this.$nextTick(function () {
  7386. var titles = _this4.$refs.titles;
  7387. if (!titles || !titles[_this4.currentIndex] || _this4.type !== 'line' || isHidden(_this4.$el)) {
  7388. return;
  7389. }
  7390. var title = titles[_this4.currentIndex].$el;
  7391. var lineWidth = _this4.lineWidth,
  7392. lineHeight = _this4.lineHeight;
  7393. var left = title.offsetLeft + title.offsetWidth / 2;
  7394. var lineStyle = {
  7395. width: Object(unit["a" /* addUnit */])(lineWidth),
  7396. backgroundColor: _this4.color,
  7397. transform: "translateX(" + left + "px) translateX(-50%)"
  7398. };
  7399. if (shouldAnimate) {
  7400. lineStyle.transitionDuration = _this4.duration + "s";
  7401. }
  7402. if (Object(utils["c" /* isDef */])(lineHeight)) {
  7403. var height = Object(unit["a" /* addUnit */])(lineHeight);
  7404. lineStyle.height = height;
  7405. lineStyle.borderRadius = height;
  7406. }
  7407. _this4.lineStyle = lineStyle;
  7408. });
  7409. },
  7410. // correct the index of active tab
  7411. setCurrentIndexByName: function setCurrentIndexByName(name) {
  7412. var matched = this.children.filter(function (tab) {
  7413. return tab.computedName === name;
  7414. });
  7415. var defaultIndex = (this.children[0] || {}).index || 0;
  7416. this.setCurrentIndex(matched.length ? matched[0].index : defaultIndex);
  7417. },
  7418. setCurrentIndex: function setCurrentIndex(currentIndex) {
  7419. var newIndex = this.findAvailableTab(currentIndex);
  7420. if (!Object(utils["c" /* isDef */])(newIndex)) {
  7421. return;
  7422. }
  7423. var newTab = this.children[newIndex];
  7424. var newName = newTab.computedName;
  7425. var shouldEmitChange = this.currentIndex !== null;
  7426. this.currentIndex = newIndex;
  7427. if (newName !== this.active) {
  7428. this.$emit('input', newName);
  7429. if (shouldEmitChange) {
  7430. this.$emit('change', newName, newTab.title);
  7431. }
  7432. }
  7433. },
  7434. findAvailableTab: function findAvailableTab(index) {
  7435. var diff = index < this.currentIndex ? -1 : 1;
  7436. while (index >= 0 && index < this.children.length) {
  7437. if (!this.children[index].disabled) {
  7438. return index;
  7439. }
  7440. index += diff;
  7441. }
  7442. },
  7443. // emit event when clicked
  7444. onClick: function onClick(item, index) {
  7445. var _this5 = this;
  7446. var _this$children$index = this.children[index],
  7447. title = _this$children$index.title,
  7448. disabled = _this$children$index.disabled,
  7449. computedName = _this$children$index.computedName;
  7450. if (disabled) {
  7451. this.$emit('disabled', computedName, title);
  7452. } else {
  7453. callInterceptor({
  7454. interceptor: this.beforeChange,
  7455. args: [computedName],
  7456. done: function done() {
  7457. _this5.setCurrentIndex(index);
  7458. _this5.scrollToCurrentContent();
  7459. }
  7460. });
  7461. this.$emit('click', computedName, title);
  7462. route(item.$router, item);
  7463. }
  7464. },
  7465. // scroll active tab into view
  7466. scrollIntoView: function scrollIntoView(immediate) {
  7467. var titles = this.$refs.titles;
  7468. if (!this.scrollable || !titles || !titles[this.currentIndex]) {
  7469. return;
  7470. }
  7471. var nav = this.$refs.nav;
  7472. var title = titles[this.currentIndex].$el;
  7473. var to = title.offsetLeft - (nav.offsetWidth - title.offsetWidth) / 2;
  7474. scrollLeftTo(nav, to, immediate ? 0 : +this.duration);
  7475. },
  7476. onSticktScroll: function onSticktScroll(params) {
  7477. this.stickyFixed = params.isFixed;
  7478. this.$emit('scroll', params);
  7479. },
  7480. // @exposed-api
  7481. scrollTo: function scrollTo(name) {
  7482. var _this6 = this;
  7483. this.$nextTick(function () {
  7484. _this6.setCurrentIndexByName(name);
  7485. _this6.scrollToCurrentContent(true);
  7486. });
  7487. },
  7488. scrollToCurrentContent: function scrollToCurrentContent(immediate) {
  7489. var _this7 = this;
  7490. if (immediate === void 0) {
  7491. immediate = false;
  7492. }
  7493. if (this.scrollspy) {
  7494. var target = this.children[this.currentIndex];
  7495. var el = target == null ? void 0 : target.$el;
  7496. if (el) {
  7497. var to = getElementTop(el, this.scroller) - this.scrollOffset;
  7498. this.lockScroll = true;
  7499. scrollTopTo(this.scroller, to, immediate ? 0 : +this.duration, function () {
  7500. _this7.lockScroll = false;
  7501. });
  7502. }
  7503. }
  7504. },
  7505. onScroll: function onScroll() {
  7506. if (this.scrollspy && !this.lockScroll) {
  7507. var index = this.getCurrentIndexOnScroll();
  7508. this.setCurrentIndex(index);
  7509. }
  7510. },
  7511. getCurrentIndexOnScroll: function getCurrentIndexOnScroll() {
  7512. var children = this.children;
  7513. for (var index = 0; index < children.length; index++) {
  7514. var top = getVisibleTop(children[index].$el);
  7515. if (top > this.scrollOffset) {
  7516. return index === 0 ? 0 : index - 1;
  7517. }
  7518. }
  7519. return children.length - 1;
  7520. }
  7521. },
  7522. render: function render() {
  7523. var _this8 = this,
  7524. _ref;
  7525. var h = arguments[0];
  7526. var type = this.type,
  7527. animated = this.animated,
  7528. scrollable = this.scrollable;
  7529. var Nav = this.children.map(function (item, index) {
  7530. var _item$badge;
  7531. return h(tabs_Title, {
  7532. "ref": "titles",
  7533. "refInFor": true,
  7534. "attrs": {
  7535. "type": type,
  7536. "dot": item.dot,
  7537. "info": (_item$badge = item.badge) != null ? _item$badge : item.info,
  7538. "title": item.title,
  7539. "color": _this8.color,
  7540. "isActive": index === _this8.currentIndex,
  7541. "disabled": item.disabled,
  7542. "scrollable": scrollable,
  7543. "activeColor": _this8.titleActiveColor,
  7544. "inactiveColor": _this8.titleInactiveColor
  7545. },
  7546. "style": item.titleStyle,
  7547. "class": item.titleClass,
  7548. "scopedSlots": {
  7549. default: function _default() {
  7550. return item.slots('title');
  7551. }
  7552. },
  7553. "on": {
  7554. "click": function click() {
  7555. _this8.onClick(item, index);
  7556. }
  7557. }
  7558. });
  7559. });
  7560. var Wrap = h("div", {
  7561. "ref": "wrap",
  7562. "class": [tabs_bem('wrap', {
  7563. scrollable: scrollable
  7564. }), (_ref = {}, _ref[BORDER_TOP_BOTTOM] = type === 'line' && this.border, _ref)]
  7565. }, [h("div", {
  7566. "ref": "nav",
  7567. "attrs": {
  7568. "role": "tablist"
  7569. },
  7570. "class": tabs_bem('nav', [type, {
  7571. complete: this.scrollable
  7572. }]),
  7573. "style": this.navStyle
  7574. }, [this.slots('nav-left'), Nav, type === 'line' && h("div", {
  7575. "class": tabs_bem('line'),
  7576. "style": this.lineStyle
  7577. }), this.slots('nav-right')])]);
  7578. return h("div", {
  7579. "class": tabs_bem([type])
  7580. }, [this.sticky ? h(es_sticky, {
  7581. "attrs": {
  7582. "container": this.$el,
  7583. "offsetTop": this.offsetTop
  7584. },
  7585. "on": {
  7586. "scroll": this.onSticktScroll
  7587. }
  7588. }, [Wrap]) : Wrap, h(tabs_Content, {
  7589. "attrs": {
  7590. "count": this.children.length,
  7591. "animated": animated,
  7592. "duration": this.duration,
  7593. "swipeable": this.swipeable,
  7594. "currentIndex": this.currentIndex
  7595. },
  7596. "on": {
  7597. "change": this.setCurrentIndex
  7598. }
  7599. }, [this.slots()])]);
  7600. }
  7601. }));
  7602. // CONCATENATED MODULE: ./es/cascader/index.js
  7603. var cascader_createNamespace = Object(create["a" /* createNamespace */])('cascader'),
  7604. cascader_createComponent = cascader_createNamespace[0],
  7605. cascader_bem = cascader_createNamespace[1],
  7606. cascader_t = cascader_createNamespace[2];
  7607. /* harmony default export */ var cascader = (cascader_createComponent({
  7608. props: {
  7609. title: String,
  7610. value: [Number, String],
  7611. fieldNames: Object,
  7612. placeholder: String,
  7613. activeColor: String,
  7614. options: {
  7615. type: Array,
  7616. default: function _default() {
  7617. return [];
  7618. }
  7619. },
  7620. closeable: {
  7621. type: Boolean,
  7622. default: true
  7623. }
  7624. },
  7625. data: function data() {
  7626. return {
  7627. tabs: [],
  7628. activeTab: 0
  7629. };
  7630. },
  7631. computed: {
  7632. textKey: function textKey() {
  7633. var _this$fieldNames;
  7634. return ((_this$fieldNames = this.fieldNames) == null ? void 0 : _this$fieldNames.text) || 'text';
  7635. },
  7636. valueKey: function valueKey() {
  7637. var _this$fieldNames2;
  7638. return ((_this$fieldNames2 = this.fieldNames) == null ? void 0 : _this$fieldNames2.value) || 'value';
  7639. },
  7640. childrenKey: function childrenKey() {
  7641. var _this$fieldNames3;
  7642. return ((_this$fieldNames3 = this.fieldNames) == null ? void 0 : _this$fieldNames3.children) || 'children';
  7643. }
  7644. },
  7645. watch: {
  7646. options: {
  7647. deep: true,
  7648. handler: 'updateTabs'
  7649. },
  7650. value: function value(_value) {
  7651. var _this = this;
  7652. if (_value || _value === 0) {
  7653. var values = this.tabs.map(function (tab) {
  7654. var _tab$selectedOption;
  7655. return (_tab$selectedOption = tab.selectedOption) == null ? void 0 : _tab$selectedOption[_this.valueKey];
  7656. });
  7657. if (values.indexOf(_value) !== -1) {
  7658. return;
  7659. }
  7660. }
  7661. this.updateTabs();
  7662. }
  7663. },
  7664. created: function created() {
  7665. this.updateTabs();
  7666. },
  7667. methods: {
  7668. getSelectedOptionsByValue: function getSelectedOptionsByValue(options, value) {
  7669. for (var i = 0; i < options.length; i++) {
  7670. var option = options[i];
  7671. if (option[this.valueKey] === value) {
  7672. return [option];
  7673. }
  7674. if (option[this.childrenKey]) {
  7675. var selectedOptions = this.getSelectedOptionsByValue(option[this.childrenKey], value);
  7676. if (selectedOptions) {
  7677. return [option].concat(selectedOptions);
  7678. }
  7679. }
  7680. }
  7681. },
  7682. updateTabs: function updateTabs() {
  7683. var _this2 = this;
  7684. if (this.value || this.value === 0) {
  7685. var selectedOptions = this.getSelectedOptionsByValue(this.options, this.value);
  7686. if (selectedOptions) {
  7687. var optionsCursor = this.options;
  7688. this.tabs = selectedOptions.map(function (option) {
  7689. var tab = {
  7690. options: optionsCursor,
  7691. selectedOption: option
  7692. };
  7693. var next = optionsCursor.filter(function (item) {
  7694. return item[_this2.valueKey] === option[_this2.valueKey];
  7695. });
  7696. if (next.length) {
  7697. optionsCursor = next[0][_this2.childrenKey];
  7698. }
  7699. return tab;
  7700. });
  7701. if (optionsCursor) {
  7702. this.tabs.push({
  7703. options: optionsCursor,
  7704. selectedOption: null
  7705. });
  7706. }
  7707. this.$nextTick(function () {
  7708. _this2.activeTab = _this2.tabs.length - 1;
  7709. });
  7710. return;
  7711. }
  7712. }
  7713. this.tabs = [{
  7714. options: this.options,
  7715. selectedOption: null
  7716. }];
  7717. },
  7718. onSelect: function onSelect(option, tabIndex) {
  7719. var _this3 = this;
  7720. this.tabs[tabIndex].selectedOption = option;
  7721. if (this.tabs.length > tabIndex + 1) {
  7722. this.tabs = this.tabs.slice(0, tabIndex + 1);
  7723. }
  7724. if (option[this.childrenKey]) {
  7725. var nextTab = {
  7726. options: option[this.childrenKey],
  7727. selectedOption: null
  7728. };
  7729. if (this.tabs[tabIndex + 1]) {
  7730. this.$set(this.tabs, tabIndex + 1, nextTab);
  7731. } else {
  7732. this.tabs.push(nextTab);
  7733. }
  7734. this.$nextTick(function () {
  7735. _this3.activeTab++;
  7736. });
  7737. }
  7738. var selectedOptions = this.tabs.map(function (tab) {
  7739. return tab.selectedOption;
  7740. }).filter(function (item) {
  7741. return !!item;
  7742. });
  7743. var eventParams = {
  7744. value: option[this.valueKey],
  7745. tabIndex: tabIndex,
  7746. selectedOptions: selectedOptions
  7747. };
  7748. this.$emit('input', option[this.valueKey]);
  7749. this.$emit('change', eventParams);
  7750. if (!option[this.childrenKey]) {
  7751. this.$emit('finish', eventParams);
  7752. }
  7753. },
  7754. onClose: function onClose() {
  7755. this.$emit('close');
  7756. },
  7757. renderHeader: function renderHeader() {
  7758. var h = this.$createElement;
  7759. return h("div", {
  7760. "class": cascader_bem('header')
  7761. }, [h("h2", {
  7762. "class": cascader_bem('title')
  7763. }, [this.slots('title') || this.title]), this.closeable ? h(es_icon, {
  7764. "attrs": {
  7765. "name": "cross"
  7766. },
  7767. "class": cascader_bem('close-icon'),
  7768. "on": {
  7769. "click": this.onClose
  7770. }
  7771. }) : null]);
  7772. },
  7773. renderOptions: function renderOptions(options, selectedOption, tabIndex) {
  7774. var _this4 = this;
  7775. var h = this.$createElement;
  7776. var renderOption = function renderOption(option) {
  7777. var isSelected = selectedOption && option[_this4.valueKey] === selectedOption[_this4.valueKey];
  7778. var Text = _this4.slots('option', {
  7779. option: option,
  7780. selected: isSelected
  7781. }) || h("span", [option[_this4.textKey]]);
  7782. return h("li", {
  7783. "class": cascader_bem('option', {
  7784. selected: isSelected
  7785. }),
  7786. "style": {
  7787. color: isSelected ? _this4.activeColor : null
  7788. },
  7789. "on": {
  7790. "click": function click() {
  7791. _this4.onSelect(option, tabIndex);
  7792. }
  7793. }
  7794. }, [Text, isSelected ? h(es_icon, {
  7795. "attrs": {
  7796. "name": "success"
  7797. },
  7798. "class": cascader_bem('selected-icon')
  7799. }) : null]);
  7800. };
  7801. return h("ul", {
  7802. "class": cascader_bem('options')
  7803. }, [options.map(renderOption)]);
  7804. },
  7805. renderTab: function renderTab(item, tabIndex) {
  7806. var h = this.$createElement;
  7807. var options = item.options,
  7808. selectedOption = item.selectedOption;
  7809. var title = selectedOption ? selectedOption[this.textKey] : this.placeholder || cascader_t('select');
  7810. return h(tab, {
  7811. "attrs": {
  7812. "title": title,
  7813. "titleClass": cascader_bem('tab', {
  7814. unselected: !selectedOption
  7815. })
  7816. }
  7817. }, [this.renderOptions(options, selectedOption, tabIndex)]);
  7818. },
  7819. renderTabs: function renderTabs() {
  7820. var _this5 = this;
  7821. var h = this.$createElement;
  7822. return h(tabs, {
  7823. "attrs": {
  7824. "animated": true,
  7825. "swipeable": true,
  7826. "swipeThreshold": 0,
  7827. "color": this.activeColor
  7828. },
  7829. "class": cascader_bem('tabs'),
  7830. "model": {
  7831. value: _this5.activeTab,
  7832. callback: function callback($$v) {
  7833. _this5.activeTab = $$v;
  7834. }
  7835. }
  7836. }, [this.tabs.map(this.renderTab)]);
  7837. }
  7838. },
  7839. render: function render() {
  7840. var h = arguments[0];
  7841. return h("div", {
  7842. "class": cascader_bem()
  7843. }, [this.renderHeader(), this.renderTabs()]);
  7844. }
  7845. }));
  7846. // CONCATENATED MODULE: ./es/cell-group/index.js
  7847. // Utils
  7848. // Types
  7849. var cell_group_createNamespace = Object(create["a" /* createNamespace */])('cell-group'),
  7850. cell_group_createComponent = cell_group_createNamespace[0],
  7851. cell_group_bem = cell_group_createNamespace[1];
  7852. function CellGroup(h, props, slots, ctx) {
  7853. var _ref;
  7854. var Group = h("div", helper_default()([{
  7855. "class": [cell_group_bem({
  7856. inset: props.inset
  7857. }), (_ref = {}, _ref[BORDER_TOP_BOTTOM] = props.border, _ref)]
  7858. }, inherit(ctx, true)]), [slots.default == null ? void 0 : slots.default()]);
  7859. if (props.title || slots.title) {
  7860. return h("div", {
  7861. "key": ctx.data.key
  7862. }, [h("div", {
  7863. "class": cell_group_bem('title', {
  7864. inset: props.inset
  7865. })
  7866. }, [slots.title ? slots.title() : props.title]), Group]);
  7867. }
  7868. return Group;
  7869. }
  7870. CellGroup.props = {
  7871. title: String,
  7872. inset: Boolean,
  7873. border: {
  7874. type: Boolean,
  7875. default: true
  7876. }
  7877. };
  7878. /* harmony default export */ var cell_group = (cell_group_createComponent(CellGroup));
  7879. // CONCATENATED MODULE: ./es/checkbox/index.js
  7880. var checkbox_createNamespace = Object(create["a" /* createNamespace */])('checkbox'),
  7881. checkbox_createComponent = checkbox_createNamespace[0],
  7882. checkbox_bem = checkbox_createNamespace[1];
  7883. /* harmony default export */ var es_checkbox = (checkbox_createComponent({
  7884. mixins: [checkbox_CheckboxMixin({
  7885. bem: checkbox_bem,
  7886. role: 'checkbox',
  7887. parent: 'vanCheckbox'
  7888. })],
  7889. computed: {
  7890. checked: {
  7891. get: function get() {
  7892. if (this.parent) {
  7893. return this.parent.value.indexOf(this.name) !== -1;
  7894. }
  7895. return this.value;
  7896. },
  7897. set: function set(val) {
  7898. if (this.parent) {
  7899. this.setParentValue(val);
  7900. } else {
  7901. this.$emit('input', val);
  7902. }
  7903. }
  7904. }
  7905. },
  7906. watch: {
  7907. value: function value(val) {
  7908. this.$emit('change', val);
  7909. }
  7910. },
  7911. methods: {
  7912. // @exposed-api
  7913. toggle: function toggle(checked) {
  7914. var _this = this;
  7915. if (checked === void 0) {
  7916. checked = !this.checked;
  7917. } // When toggle method is called multiple times at the same time,
  7918. // only the last call is valid.
  7919. // This is a hack for usage inside Cell.
  7920. clearTimeout(this.toggleTask);
  7921. this.toggleTask = setTimeout(function () {
  7922. _this.checked = checked;
  7923. });
  7924. },
  7925. setParentValue: function setParentValue(val) {
  7926. var parent = this.parent;
  7927. var value = parent.value.slice();
  7928. if (val) {
  7929. if (parent.max && value.length >= parent.max) {
  7930. return;
  7931. }
  7932. /* istanbul ignore else */
  7933. if (value.indexOf(this.name) === -1) {
  7934. value.push(this.name);
  7935. parent.$emit('input', value);
  7936. }
  7937. } else {
  7938. var index = value.indexOf(this.name);
  7939. /* istanbul ignore else */
  7940. if (index !== -1) {
  7941. value.splice(index, 1);
  7942. parent.$emit('input', value);
  7943. }
  7944. }
  7945. }
  7946. }
  7947. }));
  7948. // CONCATENATED MODULE: ./es/checkbox-group/index.js
  7949. var checkbox_group_createNamespace = Object(create["a" /* createNamespace */])('checkbox-group'),
  7950. checkbox_group_createComponent = checkbox_group_createNamespace[0],
  7951. checkbox_group_bem = checkbox_group_createNamespace[1];
  7952. /* harmony default export */ var checkbox_group = (checkbox_group_createComponent({
  7953. mixins: [ParentMixin('vanCheckbox'), FieldMixin],
  7954. props: {
  7955. max: [Number, String],
  7956. disabled: Boolean,
  7957. direction: String,
  7958. iconSize: [Number, String],
  7959. checkedColor: String,
  7960. value: {
  7961. type: Array,
  7962. default: function _default() {
  7963. return [];
  7964. }
  7965. }
  7966. },
  7967. watch: {
  7968. value: function value(val) {
  7969. this.$emit('change', val);
  7970. }
  7971. },
  7972. methods: {
  7973. // @exposed-api
  7974. toggleAll: function toggleAll(options) {
  7975. if (options === void 0) {
  7976. options = {};
  7977. }
  7978. if (typeof options === 'boolean') {
  7979. options = {
  7980. checked: options
  7981. };
  7982. }
  7983. var _options = options,
  7984. checked = _options.checked,
  7985. skipDisabled = _options.skipDisabled;
  7986. var children = this.children.filter(function (item) {
  7987. if (item.disabled && skipDisabled) {
  7988. return item.checked;
  7989. }
  7990. return checked != null ? checked : !item.checked;
  7991. });
  7992. var names = children.map(function (item) {
  7993. return item.name;
  7994. });
  7995. this.$emit('input', names);
  7996. }
  7997. },
  7998. render: function render() {
  7999. var h = arguments[0];
  8000. return h("div", {
  8001. "class": checkbox_group_bem([this.direction])
  8002. }, [this.slots()]);
  8003. }
  8004. }));
  8005. // CONCATENATED MODULE: ./es/circle/index.js
  8006. var circle_createNamespace = Object(create["a" /* createNamespace */])('circle'),
  8007. circle_createComponent = circle_createNamespace[0],
  8008. circle_bem = circle_createNamespace[1];
  8009. var PERIMETER = 3140;
  8010. var circle_uid = 0;
  8011. function circle_format(rate) {
  8012. return Math.min(Math.max(rate, 0), 100);
  8013. }
  8014. function getPath(clockwise, viewBoxSize) {
  8015. var sweepFlag = clockwise ? 1 : 0;
  8016. return "M " + viewBoxSize / 2 + " " + viewBoxSize / 2 + " m 0, -500 a 500, 500 0 1, " + sweepFlag + " 0, 1000 a 500, 500 0 1, " + sweepFlag + " 0, -1000";
  8017. }
  8018. /* harmony default export */ var circle = (circle_createComponent({
  8019. props: {
  8020. text: String,
  8021. size: [Number, String],
  8022. color: [String, Object],
  8023. layerColor: String,
  8024. strokeLinecap: String,
  8025. value: {
  8026. type: Number,
  8027. default: 0
  8028. },
  8029. speed: {
  8030. type: [Number, String],
  8031. default: 0
  8032. },
  8033. fill: {
  8034. type: String,
  8035. default: 'none'
  8036. },
  8037. rate: {
  8038. type: [Number, String],
  8039. default: 100
  8040. },
  8041. strokeWidth: {
  8042. type: [Number, String],
  8043. default: 40
  8044. },
  8045. clockwise: {
  8046. type: Boolean,
  8047. default: true
  8048. }
  8049. },
  8050. beforeCreate: function beforeCreate() {
  8051. this.uid = "van-circle-gradient-" + circle_uid++;
  8052. },
  8053. computed: {
  8054. style: function style() {
  8055. var size = Object(unit["a" /* addUnit */])(this.size);
  8056. return {
  8057. width: size,
  8058. height: size
  8059. };
  8060. },
  8061. path: function path() {
  8062. return getPath(this.clockwise, this.viewBoxSize);
  8063. },
  8064. viewBoxSize: function viewBoxSize() {
  8065. return +this.strokeWidth + 1000;
  8066. },
  8067. layerStyle: function layerStyle() {
  8068. return {
  8069. fill: "" + this.fill,
  8070. stroke: "" + this.layerColor,
  8071. strokeWidth: this.strokeWidth + "px"
  8072. };
  8073. },
  8074. hoverStyle: function hoverStyle() {
  8075. var offset = PERIMETER * this.value / 100;
  8076. return {
  8077. stroke: "" + (this.gradient ? "url(#" + this.uid + ")" : this.color),
  8078. strokeWidth: +this.strokeWidth + 1 + "px",
  8079. strokeLinecap: this.strokeLinecap,
  8080. strokeDasharray: offset + "px " + PERIMETER + "px"
  8081. };
  8082. },
  8083. gradient: function gradient() {
  8084. return Object(utils["f" /* isObject */])(this.color);
  8085. },
  8086. LinearGradient: function LinearGradient() {
  8087. var _this = this;
  8088. var h = this.$createElement;
  8089. if (!this.gradient) {
  8090. return;
  8091. }
  8092. var Stops = Object.keys(this.color).sort(function (a, b) {
  8093. return parseFloat(a) - parseFloat(b);
  8094. }).map(function (key, index) {
  8095. return h("stop", {
  8096. "key": index,
  8097. "attrs": {
  8098. "offset": key,
  8099. "stop-color": _this.color[key]
  8100. }
  8101. });
  8102. });
  8103. return h("defs", [h("linearGradient", {
  8104. "attrs": {
  8105. "id": this.uid,
  8106. "x1": "100%",
  8107. "y1": "0%",
  8108. "x2": "0%",
  8109. "y2": "0%"
  8110. }
  8111. }, [Stops])]);
  8112. }
  8113. },
  8114. watch: {
  8115. rate: {
  8116. handler: function handler(rate) {
  8117. this.startTime = Date.now();
  8118. this.startRate = this.value;
  8119. this.endRate = circle_format(rate);
  8120. this.increase = this.endRate > this.startRate;
  8121. this.duration = Math.abs((this.startRate - this.endRate) * 1000 / this.speed);
  8122. if (this.speed) {
  8123. Object(raf["a" /* cancelRaf */])(this.rafId);
  8124. this.rafId = Object(raf["c" /* raf */])(this.animate);
  8125. } else {
  8126. this.$emit('input', this.endRate);
  8127. }
  8128. },
  8129. immediate: true
  8130. }
  8131. },
  8132. methods: {
  8133. animate: function animate() {
  8134. var now = Date.now();
  8135. var progress = Math.min((now - this.startTime) / this.duration, 1);
  8136. var rate = progress * (this.endRate - this.startRate) + this.startRate;
  8137. this.$emit('input', circle_format(parseFloat(rate.toFixed(1))));
  8138. if (this.increase ? rate < this.endRate : rate > this.endRate) {
  8139. this.rafId = Object(raf["c" /* raf */])(this.animate);
  8140. }
  8141. }
  8142. },
  8143. render: function render() {
  8144. var h = arguments[0];
  8145. return h("div", {
  8146. "class": circle_bem(),
  8147. "style": this.style
  8148. }, [h("svg", {
  8149. "attrs": {
  8150. "viewBox": "0 0 " + this.viewBoxSize + " " + this.viewBoxSize
  8151. }
  8152. }, [this.LinearGradient, h("path", {
  8153. "class": circle_bem('layer'),
  8154. "style": this.layerStyle,
  8155. "attrs": {
  8156. "d": this.path
  8157. }
  8158. }), h("path", {
  8159. "attrs": {
  8160. "d": this.path
  8161. },
  8162. "class": circle_bem('hover'),
  8163. "style": this.hoverStyle
  8164. })]), this.slots() || this.text && h("div", {
  8165. "class": circle_bem('text')
  8166. }, [this.text])]);
  8167. }
  8168. }));
  8169. // CONCATENATED MODULE: ./es/col/index.js
  8170. var col_createNamespace = Object(create["a" /* createNamespace */])('col'),
  8171. col_createComponent = col_createNamespace[0],
  8172. col_bem = col_createNamespace[1];
  8173. /* harmony default export */ var col = (col_createComponent({
  8174. mixins: [ChildrenMixin('vanRow')],
  8175. props: {
  8176. span: [Number, String],
  8177. offset: [Number, String],
  8178. tag: {
  8179. type: String,
  8180. default: 'div'
  8181. }
  8182. },
  8183. computed: {
  8184. style: function style() {
  8185. var index = this.index;
  8186. var _ref = this.parent || {},
  8187. spaces = _ref.spaces;
  8188. if (spaces && spaces[index]) {
  8189. var _spaces$index = spaces[index],
  8190. left = _spaces$index.left,
  8191. right = _spaces$index.right;
  8192. return {
  8193. paddingLeft: left ? left + "px" : null,
  8194. paddingRight: right ? right + "px" : null
  8195. };
  8196. }
  8197. }
  8198. },
  8199. methods: {
  8200. onClick: function onClick(event) {
  8201. this.$emit('click', event);
  8202. }
  8203. },
  8204. render: function render() {
  8205. var _bem;
  8206. var h = arguments[0];
  8207. var span = this.span,
  8208. offset = this.offset;
  8209. return h(this.tag, {
  8210. "style": this.style,
  8211. "class": col_bem((_bem = {}, _bem[span] = span, _bem["offset-" + offset] = offset, _bem)),
  8212. "on": {
  8213. "click": this.onClick
  8214. }
  8215. }, [this.slots()]);
  8216. }
  8217. }));
  8218. // CONCATENATED MODULE: ./es/collapse/index.js
  8219. var collapse_createNamespace = Object(create["a" /* createNamespace */])('collapse'),
  8220. collapse_createComponent = collapse_createNamespace[0],
  8221. collapse_bem = collapse_createNamespace[1];
  8222. /* harmony default export */ var collapse = (collapse_createComponent({
  8223. mixins: [ParentMixin('vanCollapse')],
  8224. props: {
  8225. accordion: Boolean,
  8226. value: [String, Number, Array],
  8227. border: {
  8228. type: Boolean,
  8229. default: true
  8230. }
  8231. },
  8232. methods: {
  8233. switch: function _switch(name, expanded) {
  8234. if (!this.accordion) {
  8235. name = expanded ? this.value.concat(name) : this.value.filter(function (activeName) {
  8236. return activeName !== name;
  8237. });
  8238. }
  8239. this.$emit('change', name);
  8240. this.$emit('input', name);
  8241. }
  8242. },
  8243. render: function render() {
  8244. var _ref;
  8245. var h = arguments[0];
  8246. return h("div", {
  8247. "class": [collapse_bem(), (_ref = {}, _ref[BORDER_TOP_BOTTOM] = this.border, _ref)]
  8248. }, [this.slots()]);
  8249. }
  8250. }));
  8251. // CONCATENATED MODULE: ./es/collapse-item/index.js
  8252. // Utils
  8253. // Mixins
  8254. // Components
  8255. var collapse_item_createNamespace = Object(create["a" /* createNamespace */])('collapse-item'),
  8256. collapse_item_createComponent = collapse_item_createNamespace[0],
  8257. collapse_item_bem = collapse_item_createNamespace[1];
  8258. var CELL_SLOTS = ['title', 'icon', 'right-icon'];
  8259. /* harmony default export */ var collapse_item = (collapse_item_createComponent({
  8260. mixins: [ChildrenMixin('vanCollapse')],
  8261. props: _extends({}, cellProps, {
  8262. name: [Number, String],
  8263. disabled: Boolean,
  8264. isLink: {
  8265. type: Boolean,
  8266. default: true
  8267. }
  8268. }),
  8269. data: function data() {
  8270. return {
  8271. show: null,
  8272. inited: null
  8273. };
  8274. },
  8275. computed: {
  8276. currentName: function currentName() {
  8277. var _this$name;
  8278. return (_this$name = this.name) != null ? _this$name : this.index;
  8279. },
  8280. expanded: function expanded() {
  8281. var _this = this;
  8282. if (!this.parent) {
  8283. return null;
  8284. }
  8285. var _this$parent = this.parent,
  8286. value = _this$parent.value,
  8287. accordion = _this$parent.accordion;
  8288. if (false) {}
  8289. return accordion ? value === this.currentName : value.some(function (name) {
  8290. return name === _this.currentName;
  8291. });
  8292. }
  8293. },
  8294. created: function created() {
  8295. this.show = this.expanded;
  8296. this.inited = this.expanded;
  8297. },
  8298. watch: {
  8299. expanded: function expanded(_expanded, prev) {
  8300. var _this2 = this;
  8301. if (prev === null) {
  8302. return;
  8303. }
  8304. if (_expanded) {
  8305. this.show = true;
  8306. this.inited = true;
  8307. } // Use raf: flick when opened in safari
  8308. // Use nextTick: closing animation failed when set `user-select: none`
  8309. var nextTick = _expanded ? this.$nextTick : raf["c" /* raf */];
  8310. nextTick(function () {
  8311. var _this2$$refs = _this2.$refs,
  8312. content = _this2$$refs.content,
  8313. wrapper = _this2$$refs.wrapper;
  8314. if (!content || !wrapper) {
  8315. return;
  8316. }
  8317. var offsetHeight = content.offsetHeight;
  8318. if (offsetHeight) {
  8319. var contentHeight = offsetHeight + "px";
  8320. wrapper.style.height = _expanded ? 0 : contentHeight; // use double raf to ensure animation can start
  8321. Object(raf["b" /* doubleRaf */])(function () {
  8322. wrapper.style.height = _expanded ? contentHeight : 0;
  8323. });
  8324. } else {
  8325. _this2.onTransitionEnd();
  8326. }
  8327. });
  8328. }
  8329. },
  8330. methods: {
  8331. onClick: function onClick() {
  8332. if (!this.disabled) {
  8333. this.toggle();
  8334. }
  8335. },
  8336. // @exposed-api
  8337. toggle: function toggle(expanded) {
  8338. if (expanded === void 0) {
  8339. expanded = !this.expanded;
  8340. }
  8341. var parent = this.parent,
  8342. currentName = this.currentName;
  8343. var close = parent.accordion && currentName === parent.value;
  8344. var name = close ? '' : currentName;
  8345. this.parent.switch(name, expanded);
  8346. },
  8347. onTransitionEnd: function onTransitionEnd() {
  8348. if (!this.expanded) {
  8349. this.show = false;
  8350. } else {
  8351. this.$refs.wrapper.style.height = '';
  8352. }
  8353. },
  8354. genTitle: function genTitle() {
  8355. var _this3 = this;
  8356. var h = this.$createElement;
  8357. var border = this.border,
  8358. disabled = this.disabled,
  8359. expanded = this.expanded;
  8360. var titleSlots = CELL_SLOTS.reduce(function (slots, name) {
  8361. if (_this3.slots(name)) {
  8362. slots[name] = function () {
  8363. return _this3.slots(name);
  8364. };
  8365. }
  8366. return slots;
  8367. }, {});
  8368. if (this.slots('value')) {
  8369. titleSlots.default = function () {
  8370. return _this3.slots('value');
  8371. };
  8372. }
  8373. return h(cell, {
  8374. "attrs": {
  8375. "role": "button",
  8376. "tabindex": disabled ? -1 : 0,
  8377. "aria-expanded": String(expanded)
  8378. },
  8379. "class": collapse_item_bem('title', {
  8380. disabled: disabled,
  8381. expanded: expanded,
  8382. borderless: !border
  8383. }),
  8384. "on": {
  8385. "click": this.onClick
  8386. },
  8387. "scopedSlots": titleSlots,
  8388. "props": _extends({}, this.$props)
  8389. });
  8390. },
  8391. genContent: function genContent() {
  8392. var h = this.$createElement;
  8393. if (this.inited) {
  8394. return h("div", {
  8395. "directives": [{
  8396. name: "show",
  8397. value: this.show
  8398. }],
  8399. "ref": "wrapper",
  8400. "class": collapse_item_bem('wrapper'),
  8401. "on": {
  8402. "transitionend": this.onTransitionEnd
  8403. }
  8404. }, [h("div", {
  8405. "ref": "content",
  8406. "class": collapse_item_bem('content')
  8407. }, [this.slots()])]);
  8408. }
  8409. }
  8410. },
  8411. render: function render() {
  8412. var h = arguments[0];
  8413. return h("div", {
  8414. "class": [collapse_item_bem({
  8415. border: this.index && this.border
  8416. })]
  8417. }, [this.genTitle(), this.genContent()]);
  8418. }
  8419. }));
  8420. // CONCATENATED MODULE: ./es/contact-card/index.js
  8421. // Utils
  8422. // Components
  8423. // Types
  8424. var contact_card_createNamespace = Object(create["a" /* createNamespace */])('contact-card'),
  8425. contact_card_createComponent = contact_card_createNamespace[0],
  8426. contact_card_bem = contact_card_createNamespace[1],
  8427. contact_card_t = contact_card_createNamespace[2];
  8428. function ContactCard(h, props, slots, ctx) {
  8429. var type = props.type,
  8430. editable = props.editable;
  8431. function onClick(event) {
  8432. if (editable) {
  8433. functional_emit(ctx, 'click', event);
  8434. }
  8435. }
  8436. function Content() {
  8437. if (type === 'add') {
  8438. return props.addText || contact_card_t('addText');
  8439. }
  8440. return [h("div", [contact_card_t('name') + "\uFF1A" + props.name]), h("div", [contact_card_t('tel') + "\uFF1A" + props.tel])];
  8441. }
  8442. return h(cell, helper_default()([{
  8443. "attrs": {
  8444. "center": true,
  8445. "border": false,
  8446. "isLink": editable,
  8447. "valueClass": contact_card_bem('value'),
  8448. "icon": type === 'edit' ? 'contact' : 'add-square'
  8449. },
  8450. "class": contact_card_bem([type]),
  8451. "on": {
  8452. "click": onClick
  8453. }
  8454. }, inherit(ctx)]), [Content()]);
  8455. }
  8456. ContactCard.props = {
  8457. tel: String,
  8458. name: String,
  8459. addText: String,
  8460. editable: {
  8461. type: Boolean,
  8462. default: true
  8463. },
  8464. type: {
  8465. type: String,
  8466. default: 'add'
  8467. }
  8468. };
  8469. /* harmony default export */ var contact_card = (contact_card_createComponent(ContactCard));
  8470. // CONCATENATED MODULE: ./es/contact-edit/index.js
  8471. // Utils
  8472. // Components
  8473. var contact_edit_createNamespace = Object(create["a" /* createNamespace */])('contact-edit'),
  8474. contact_edit_createComponent = contact_edit_createNamespace[0],
  8475. contact_edit_bem = contact_edit_createNamespace[1],
  8476. contact_edit_t = contact_edit_createNamespace[2];
  8477. var defaultContact = {
  8478. tel: '',
  8479. name: ''
  8480. };
  8481. /* harmony default export */ var contact_edit = (contact_edit_createComponent({
  8482. props: {
  8483. isEdit: Boolean,
  8484. isSaving: Boolean,
  8485. isDeleting: Boolean,
  8486. showSetDefault: Boolean,
  8487. setDefaultLabel: String,
  8488. contactInfo: {
  8489. type: Object,
  8490. default: function _default() {
  8491. return _extends({}, defaultContact);
  8492. }
  8493. },
  8494. telValidator: {
  8495. type: Function,
  8496. default: isMobile
  8497. }
  8498. },
  8499. data: function data() {
  8500. return {
  8501. data: _extends({}, defaultContact, this.contactInfo),
  8502. errorInfo: {
  8503. name: '',
  8504. tel: ''
  8505. }
  8506. };
  8507. },
  8508. watch: {
  8509. contactInfo: function contactInfo(val) {
  8510. this.data = _extends({}, defaultContact, val);
  8511. }
  8512. },
  8513. methods: {
  8514. onFocus: function onFocus(key) {
  8515. this.errorInfo[key] = '';
  8516. },
  8517. getErrorMessageByKey: function getErrorMessageByKey(key) {
  8518. var value = this.data[key].trim();
  8519. switch (key) {
  8520. case 'name':
  8521. return value ? '' : contact_edit_t('nameInvalid');
  8522. case 'tel':
  8523. return this.telValidator(value) ? '' : contact_edit_t('telInvalid');
  8524. }
  8525. },
  8526. onSave: function onSave() {
  8527. var _this = this;
  8528. var isValid = ['name', 'tel'].every(function (item) {
  8529. var msg = _this.getErrorMessageByKey(item);
  8530. if (msg) {
  8531. _this.errorInfo[item] = msg;
  8532. }
  8533. return !msg;
  8534. });
  8535. if (isValid && !this.isSaving) {
  8536. this.$emit('save', this.data);
  8537. }
  8538. },
  8539. onDelete: function onDelete() {
  8540. var _this2 = this;
  8541. dialog.confirm({
  8542. title: contact_edit_t('confirmDelete')
  8543. }).then(function () {
  8544. _this2.$emit('delete', _this2.data);
  8545. });
  8546. }
  8547. },
  8548. render: function render() {
  8549. var _this3 = this;
  8550. var h = arguments[0];
  8551. var data = this.data,
  8552. errorInfo = this.errorInfo;
  8553. var onFocus = function onFocus(name) {
  8554. return function () {
  8555. return _this3.onFocus(name);
  8556. };
  8557. };
  8558. return h("div", {
  8559. "class": contact_edit_bem()
  8560. }, [h("div", {
  8561. "class": contact_edit_bem('fields')
  8562. }, [h(es_field, {
  8563. "attrs": {
  8564. "clearable": true,
  8565. "maxlength": "30",
  8566. "label": contact_edit_t('name'),
  8567. "placeholder": contact_edit_t('nameEmpty'),
  8568. "errorMessage": errorInfo.name
  8569. },
  8570. "on": {
  8571. "focus": onFocus('name')
  8572. },
  8573. "model": {
  8574. value: data.name,
  8575. callback: function callback($$v) {
  8576. _this3.$set(data, "name", $$v);
  8577. }
  8578. }
  8579. }), h(es_field, {
  8580. "attrs": {
  8581. "clearable": true,
  8582. "type": "tel",
  8583. "label": contact_edit_t('tel'),
  8584. "placeholder": contact_edit_t('telEmpty'),
  8585. "errorMessage": errorInfo.tel
  8586. },
  8587. "on": {
  8588. "focus": onFocus('tel')
  8589. },
  8590. "model": {
  8591. value: data.tel,
  8592. callback: function callback($$v) {
  8593. _this3.$set(data, "tel", $$v);
  8594. }
  8595. }
  8596. })]), this.showSetDefault && h(cell, {
  8597. "attrs": {
  8598. "title": this.setDefaultLabel,
  8599. "border": false
  8600. },
  8601. "class": contact_edit_bem('switch-cell')
  8602. }, [h(es_switch, {
  8603. "attrs": {
  8604. "size": 24
  8605. },
  8606. "slot": "right-icon",
  8607. "on": {
  8608. "change": function change(event) {
  8609. _this3.$emit('change-default', event);
  8610. }
  8611. },
  8612. "model": {
  8613. value: data.isDefault,
  8614. callback: function callback($$v) {
  8615. _this3.$set(data, "isDefault", $$v);
  8616. }
  8617. }
  8618. })]), h("div", {
  8619. "class": contact_edit_bem('buttons')
  8620. }, [h(es_button, {
  8621. "attrs": {
  8622. "block": true,
  8623. "round": true,
  8624. "type": "danger",
  8625. "text": contact_edit_t('save'),
  8626. "loading": this.isSaving
  8627. },
  8628. "on": {
  8629. "click": this.onSave
  8630. }
  8631. }), this.isEdit && h(es_button, {
  8632. "attrs": {
  8633. "block": true,
  8634. "round": true,
  8635. "text": contact_edit_t('delete'),
  8636. "loading": this.isDeleting
  8637. },
  8638. "on": {
  8639. "click": this.onDelete
  8640. }
  8641. })])]);
  8642. }
  8643. }));
  8644. // CONCATENATED MODULE: ./es/contact-list/index.js
  8645. // Utils
  8646. // Components
  8647. // Types
  8648. var contact_list_createNamespace = Object(create["a" /* createNamespace */])('contact-list'),
  8649. contact_list_createComponent = contact_list_createNamespace[0],
  8650. contact_list_bem = contact_list_createNamespace[1],
  8651. contact_list_t = contact_list_createNamespace[2];
  8652. function ContactList(h, props, slots, ctx) {
  8653. var List = props.list && props.list.map(function (item, index) {
  8654. function onClick() {
  8655. functional_emit(ctx, 'input', item.id);
  8656. functional_emit(ctx, 'select', item, index);
  8657. }
  8658. function RightIcon() {
  8659. return h(es_radio, {
  8660. "attrs": {
  8661. "name": item.id,
  8662. "iconSize": 16,
  8663. "checkedColor": RED
  8664. },
  8665. "on": {
  8666. "click": onClick
  8667. }
  8668. });
  8669. }
  8670. function LeftIcon() {
  8671. return h(es_icon, {
  8672. "attrs": {
  8673. "name": "edit"
  8674. },
  8675. "class": contact_list_bem('edit'),
  8676. "on": {
  8677. "click": function click(event) {
  8678. event.stopPropagation();
  8679. functional_emit(ctx, 'edit', item, index);
  8680. }
  8681. }
  8682. });
  8683. }
  8684. function Content() {
  8685. var nodes = [item.name + "\uFF0C" + item.tel];
  8686. if (item.isDefault && props.defaultTagText) {
  8687. nodes.push(h(es_tag, {
  8688. "attrs": {
  8689. "type": "danger",
  8690. "round": true
  8691. },
  8692. "class": contact_list_bem('item-tag')
  8693. }, [props.defaultTagText]));
  8694. }
  8695. return nodes;
  8696. }
  8697. return h(cell, {
  8698. "key": item.id,
  8699. "attrs": {
  8700. "isLink": true,
  8701. "center": true,
  8702. "valueClass": contact_list_bem('item-value')
  8703. },
  8704. "class": contact_list_bem('item'),
  8705. "scopedSlots": {
  8706. icon: LeftIcon,
  8707. default: Content,
  8708. 'right-icon': RightIcon
  8709. },
  8710. "on": {
  8711. "click": onClick
  8712. }
  8713. });
  8714. });
  8715. return h("div", helper_default()([{
  8716. "class": contact_list_bem()
  8717. }, inherit(ctx)]), [h(radio_group, {
  8718. "attrs": {
  8719. "value": props.value
  8720. },
  8721. "class": contact_list_bem('group')
  8722. }, [List]), h("div", {
  8723. "class": contact_list_bem('bottom')
  8724. }, [h(es_button, {
  8725. "attrs": {
  8726. "round": true,
  8727. "block": true,
  8728. "type": "danger",
  8729. "text": props.addText || contact_list_t('addText')
  8730. },
  8731. "class": contact_list_bem('add'),
  8732. "on": {
  8733. "click": function click() {
  8734. functional_emit(ctx, 'add');
  8735. }
  8736. }
  8737. })])]);
  8738. }
  8739. ContactList.props = {
  8740. value: null,
  8741. list: Array,
  8742. addText: String,
  8743. defaultTagText: String
  8744. };
  8745. /* harmony default export */ var contact_list = (contact_list_createComponent(ContactList));
  8746. // EXTERNAL MODULE: ./es/utils/format/string.js
  8747. var string = __webpack_require__(2);
  8748. // CONCATENATED MODULE: ./es/count-down/utils.js
  8749. var SECOND = 1000;
  8750. var MINUTE = 60 * SECOND;
  8751. var HOUR = 60 * MINUTE;
  8752. var DAY = 24 * HOUR;
  8753. function parseTimeData(time) {
  8754. var days = Math.floor(time / DAY);
  8755. var hours = Math.floor(time % DAY / HOUR);
  8756. var minutes = Math.floor(time % HOUR / MINUTE);
  8757. var seconds = Math.floor(time % MINUTE / SECOND);
  8758. var milliseconds = Math.floor(time % SECOND);
  8759. return {
  8760. days: days,
  8761. hours: hours,
  8762. minutes: minutes,
  8763. seconds: seconds,
  8764. milliseconds: milliseconds
  8765. };
  8766. }
  8767. function parseFormat(format, timeData) {
  8768. var days = timeData.days;
  8769. var hours = timeData.hours,
  8770. minutes = timeData.minutes,
  8771. seconds = timeData.seconds,
  8772. milliseconds = timeData.milliseconds;
  8773. if (format.indexOf('DD') === -1) {
  8774. hours += days * 24;
  8775. } else {
  8776. format = format.replace('DD', Object(string["b" /* padZero */])(days));
  8777. }
  8778. if (format.indexOf('HH') === -1) {
  8779. minutes += hours * 60;
  8780. } else {
  8781. format = format.replace('HH', Object(string["b" /* padZero */])(hours));
  8782. }
  8783. if (format.indexOf('mm') === -1) {
  8784. seconds += minutes * 60;
  8785. } else {
  8786. format = format.replace('mm', Object(string["b" /* padZero */])(minutes));
  8787. }
  8788. if (format.indexOf('ss') === -1) {
  8789. milliseconds += seconds * 1000;
  8790. } else {
  8791. format = format.replace('ss', Object(string["b" /* padZero */])(seconds));
  8792. }
  8793. if (format.indexOf('S') !== -1) {
  8794. var ms = Object(string["b" /* padZero */])(milliseconds, 3);
  8795. if (format.indexOf('SSS') !== -1) {
  8796. format = format.replace('SSS', ms);
  8797. } else if (format.indexOf('SS') !== -1) {
  8798. format = format.replace('SS', ms.slice(0, 2));
  8799. } else {
  8800. format = format.replace('S', ms.charAt(0));
  8801. }
  8802. }
  8803. return format;
  8804. }
  8805. function isSameSecond(time1, time2) {
  8806. return Math.floor(time1 / 1000) === Math.floor(time2 / 1000);
  8807. }
  8808. // CONCATENATED MODULE: ./es/count-down/index.js
  8809. var count_down_createNamespace = Object(create["a" /* createNamespace */])('count-down'),
  8810. count_down_createComponent = count_down_createNamespace[0],
  8811. count_down_bem = count_down_createNamespace[1];
  8812. /* harmony default export */ var count_down = (count_down_createComponent({
  8813. props: {
  8814. millisecond: Boolean,
  8815. time: {
  8816. type: [Number, String],
  8817. default: 0
  8818. },
  8819. format: {
  8820. type: String,
  8821. default: 'HH:mm:ss'
  8822. },
  8823. autoStart: {
  8824. type: Boolean,
  8825. default: true
  8826. }
  8827. },
  8828. data: function data() {
  8829. return {
  8830. remain: 0
  8831. };
  8832. },
  8833. computed: {
  8834. timeData: function timeData() {
  8835. return parseTimeData(this.remain);
  8836. },
  8837. formattedTime: function formattedTime() {
  8838. return parseFormat(this.format, this.timeData);
  8839. }
  8840. },
  8841. watch: {
  8842. time: {
  8843. immediate: true,
  8844. handler: 'reset'
  8845. }
  8846. },
  8847. activated: function activated() {
  8848. if (this.keepAlivePaused) {
  8849. this.counting = true;
  8850. this.keepAlivePaused = false;
  8851. this.tick();
  8852. }
  8853. },
  8854. deactivated: function deactivated() {
  8855. if (this.counting) {
  8856. this.pause();
  8857. this.keepAlivePaused = true;
  8858. }
  8859. },
  8860. beforeDestroy: function beforeDestroy() {
  8861. this.pause();
  8862. },
  8863. methods: {
  8864. // @exposed-api
  8865. start: function start() {
  8866. if (this.counting) {
  8867. return;
  8868. }
  8869. this.counting = true;
  8870. this.endTime = Date.now() + this.remain;
  8871. this.tick();
  8872. },
  8873. // @exposed-api
  8874. pause: function pause() {
  8875. this.counting = false;
  8876. Object(raf["a" /* cancelRaf */])(this.rafId);
  8877. },
  8878. // @exposed-api
  8879. reset: function reset() {
  8880. this.pause();
  8881. this.remain = +this.time;
  8882. if (this.autoStart) {
  8883. this.start();
  8884. }
  8885. },
  8886. tick: function tick() {
  8887. // should not start counting in server
  8888. // see: https://github.com/youzan/vant/issues/7807
  8889. if (!utils["b" /* inBrowser */]) {
  8890. return;
  8891. }
  8892. if (this.millisecond) {
  8893. this.microTick();
  8894. } else {
  8895. this.macroTick();
  8896. }
  8897. },
  8898. microTick: function microTick() {
  8899. var _this = this;
  8900. this.rafId = Object(raf["c" /* raf */])(function () {
  8901. /* istanbul ignore if */
  8902. // in case of call reset immediately after finish
  8903. if (!_this.counting) {
  8904. return;
  8905. }
  8906. _this.setRemain(_this.getRemain());
  8907. if (_this.remain > 0) {
  8908. _this.microTick();
  8909. }
  8910. });
  8911. },
  8912. macroTick: function macroTick() {
  8913. var _this2 = this;
  8914. this.rafId = Object(raf["c" /* raf */])(function () {
  8915. /* istanbul ignore if */
  8916. // in case of call reset immediately after finish
  8917. if (!_this2.counting) {
  8918. return;
  8919. }
  8920. var remain = _this2.getRemain();
  8921. if (!isSameSecond(remain, _this2.remain) || remain === 0) {
  8922. _this2.setRemain(remain);
  8923. }
  8924. if (_this2.remain > 0) {
  8925. _this2.macroTick();
  8926. }
  8927. });
  8928. },
  8929. getRemain: function getRemain() {
  8930. return Math.max(this.endTime - Date.now(), 0);
  8931. },
  8932. setRemain: function setRemain(remain) {
  8933. this.remain = remain;
  8934. this.$emit('change', this.timeData);
  8935. if (remain === 0) {
  8936. this.pause();
  8937. this.$emit('finish');
  8938. }
  8939. }
  8940. },
  8941. render: function render() {
  8942. var h = arguments[0];
  8943. return h("div", {
  8944. "class": count_down_bem()
  8945. }, [this.slots('default', this.timeData) || this.formattedTime]);
  8946. }
  8947. }));
  8948. // CONCATENATED MODULE: ./es/coupon/index.js
  8949. var coupon_createNamespace = Object(create["a" /* createNamespace */])('coupon'),
  8950. coupon_createComponent = coupon_createNamespace[0],
  8951. coupon_bem = coupon_createNamespace[1],
  8952. coupon_t = coupon_createNamespace[2];
  8953. function formatTimeStamp(timeStamp) {
  8954. // compatible when the timestamp is seconds
  8955. if (timeStamp < Math.pow(10, 12)) {
  8956. return timeStamp * 1000;
  8957. }
  8958. return +timeStamp;
  8959. }
  8960. function getDate(timeStamp) {
  8961. var date = new Date(formatTimeStamp(timeStamp));
  8962. return date.getFullYear() + "." + Object(string["b" /* padZero */])(date.getMonth() + 1) + "." + Object(string["b" /* padZero */])(date.getDate());
  8963. }
  8964. function formatDiscount(discount) {
  8965. return (discount / 10).toFixed(discount % 10 === 0 ? 0 : 1);
  8966. }
  8967. function formatAmount(amount) {
  8968. return (amount / 100).toFixed(amount % 100 === 0 ? 0 : amount % 10 === 0 ? 1 : 2);
  8969. }
  8970. /* harmony default export */ var es_coupon = (coupon_createComponent({
  8971. props: {
  8972. coupon: Object,
  8973. chosen: Boolean,
  8974. disabled: Boolean,
  8975. currency: {
  8976. type: String,
  8977. default: '¥'
  8978. }
  8979. },
  8980. computed: {
  8981. validPeriod: function validPeriod() {
  8982. var _this$coupon = this.coupon,
  8983. startAt = _this$coupon.startAt,
  8984. endAt = _this$coupon.endAt,
  8985. customValidPeriod = _this$coupon.customValidPeriod;
  8986. return customValidPeriod || getDate(startAt) + " - " + getDate(endAt);
  8987. },
  8988. faceAmount: function faceAmount() {
  8989. var coupon = this.coupon;
  8990. if (coupon.valueDesc) {
  8991. return coupon.valueDesc + "<span>" + (coupon.unitDesc || '') + "</span>";
  8992. }
  8993. if (coupon.denominations) {
  8994. var denominations = formatAmount(coupon.denominations);
  8995. return "<span>" + this.currency + "</span> " + denominations;
  8996. }
  8997. if (coupon.discount) {
  8998. return coupon_t('discount', formatDiscount(coupon.discount));
  8999. }
  9000. return '';
  9001. },
  9002. conditionMessage: function conditionMessage() {
  9003. var condition = formatAmount(this.coupon.originCondition);
  9004. return condition === '0' ? coupon_t('unlimited') : coupon_t('condition', condition);
  9005. }
  9006. },
  9007. render: function render() {
  9008. var h = arguments[0];
  9009. var coupon = this.coupon,
  9010. disabled = this.disabled;
  9011. var description = disabled && coupon.reason || coupon.description;
  9012. return h("div", {
  9013. "class": coupon_bem({
  9014. disabled: disabled
  9015. })
  9016. }, [h("div", {
  9017. "class": coupon_bem('content')
  9018. }, [h("div", {
  9019. "class": coupon_bem('head')
  9020. }, [h("h2", {
  9021. "class": coupon_bem('amount'),
  9022. "domProps": {
  9023. "innerHTML": this.faceAmount
  9024. }
  9025. }), h("p", {
  9026. "class": coupon_bem('condition')
  9027. }, [this.coupon.condition || this.conditionMessage])]), h("div", {
  9028. "class": coupon_bem('body')
  9029. }, [h("p", {
  9030. "class": coupon_bem('name')
  9031. }, [coupon.name]), h("p", {
  9032. "class": coupon_bem('valid')
  9033. }, [this.validPeriod]), !this.disabled && h(es_checkbox, {
  9034. "attrs": {
  9035. "size": 18,
  9036. "value": this.chosen,
  9037. "checkedColor": RED
  9038. },
  9039. "class": coupon_bem('corner')
  9040. })])]), description && h("p", {
  9041. "class": coupon_bem('description')
  9042. }, [description])]);
  9043. }
  9044. }));
  9045. // CONCATENATED MODULE: ./es/coupon-cell/index.js
  9046. // Utils
  9047. // Components
  9048. // Types
  9049. var coupon_cell_createNamespace = Object(create["a" /* createNamespace */])('coupon-cell'),
  9050. coupon_cell_createComponent = coupon_cell_createNamespace[0],
  9051. coupon_cell_bem = coupon_cell_createNamespace[1],
  9052. coupon_cell_t = coupon_cell_createNamespace[2];
  9053. function coupon_cell_formatValue(props) {
  9054. var coupons = props.coupons,
  9055. chosenCoupon = props.chosenCoupon,
  9056. currency = props.currency;
  9057. var coupon = coupons[+chosenCoupon];
  9058. if (coupon) {
  9059. var value = 0;
  9060. if (Object(utils["c" /* isDef */])(coupon.value)) {
  9061. value = coupon.value;
  9062. } else if (Object(utils["c" /* isDef */])(coupon.denominations)) {
  9063. value = coupon.denominations;
  9064. }
  9065. return "-" + currency + " " + (value / 100).toFixed(2);
  9066. }
  9067. return coupons.length === 0 ? coupon_cell_t('tips') : coupon_cell_t('count', coupons.length);
  9068. }
  9069. function CouponCell(h, props, slots, ctx) {
  9070. var selected = props.coupons[+props.chosenCoupon];
  9071. var value = coupon_cell_formatValue(props);
  9072. return h(cell, helper_default()([{
  9073. "class": coupon_cell_bem(),
  9074. "attrs": {
  9075. "value": value,
  9076. "title": props.title || coupon_cell_t('title'),
  9077. "border": props.border,
  9078. "isLink": props.editable,
  9079. "valueClass": coupon_cell_bem('value', {
  9080. selected: selected
  9081. })
  9082. }
  9083. }, inherit(ctx, true)]));
  9084. }
  9085. CouponCell.model = {
  9086. prop: 'chosenCoupon'
  9087. };
  9088. CouponCell.props = {
  9089. title: String,
  9090. coupons: {
  9091. type: Array,
  9092. default: function _default() {
  9093. return [];
  9094. }
  9095. },
  9096. currency: {
  9097. type: String,
  9098. default: '¥'
  9099. },
  9100. border: {
  9101. type: Boolean,
  9102. default: true
  9103. },
  9104. editable: {
  9105. type: Boolean,
  9106. default: true
  9107. },
  9108. chosenCoupon: {
  9109. type: [Number, String],
  9110. default: -1
  9111. }
  9112. };
  9113. /* harmony default export */ var coupon_cell = (coupon_cell_createComponent(CouponCell));
  9114. // CONCATENATED MODULE: ./es/coupon-list/index.js
  9115. // Utils
  9116. // Components
  9117. var coupon_list_createNamespace = Object(create["a" /* createNamespace */])('coupon-list'),
  9118. coupon_list_createComponent = coupon_list_createNamespace[0],
  9119. coupon_list_bem = coupon_list_createNamespace[1],
  9120. coupon_list_t = coupon_list_createNamespace[2];
  9121. var EMPTY_IMAGE = 'https://img01.yzcdn.cn/vant/coupon-empty.png';
  9122. /* harmony default export */ var coupon_list = (coupon_list_createComponent({
  9123. model: {
  9124. prop: 'code'
  9125. },
  9126. props: {
  9127. code: String,
  9128. closeButtonText: String,
  9129. inputPlaceholder: String,
  9130. enabledTitle: String,
  9131. disabledTitle: String,
  9132. exchangeButtonText: String,
  9133. exchangeButtonLoading: Boolean,
  9134. exchangeButtonDisabled: Boolean,
  9135. exchangeMinLength: {
  9136. type: Number,
  9137. default: 1
  9138. },
  9139. chosenCoupon: {
  9140. type: Number,
  9141. default: -1
  9142. },
  9143. coupons: {
  9144. type: Array,
  9145. default: function _default() {
  9146. return [];
  9147. }
  9148. },
  9149. disabledCoupons: {
  9150. type: Array,
  9151. default: function _default() {
  9152. return [];
  9153. }
  9154. },
  9155. displayedCouponIndex: {
  9156. type: Number,
  9157. default: -1
  9158. },
  9159. showExchangeBar: {
  9160. type: Boolean,
  9161. default: true
  9162. },
  9163. showCloseButton: {
  9164. type: Boolean,
  9165. default: true
  9166. },
  9167. showCount: {
  9168. type: Boolean,
  9169. default: true
  9170. },
  9171. currency: {
  9172. type: String,
  9173. default: '¥'
  9174. },
  9175. emptyImage: {
  9176. type: String,
  9177. default: EMPTY_IMAGE
  9178. }
  9179. },
  9180. data: function data() {
  9181. return {
  9182. tab: 0,
  9183. winHeight: window.innerHeight,
  9184. currentCode: this.code || ''
  9185. };
  9186. },
  9187. computed: {
  9188. buttonDisabled: function buttonDisabled() {
  9189. return !this.exchangeButtonLoading && (this.exchangeButtonDisabled || !this.currentCode || this.currentCode.length < this.exchangeMinLength);
  9190. },
  9191. listStyle: function listStyle() {
  9192. return {
  9193. height: this.winHeight - (this.showExchangeBar ? 140 : 94) + 'px'
  9194. };
  9195. }
  9196. },
  9197. watch: {
  9198. code: function code(_code) {
  9199. this.currentCode = _code;
  9200. },
  9201. currentCode: function currentCode(code) {
  9202. this.$emit('input', code);
  9203. },
  9204. displayedCouponIndex: 'scrollToShowCoupon'
  9205. },
  9206. mounted: function mounted() {
  9207. this.scrollToShowCoupon(this.displayedCouponIndex);
  9208. },
  9209. methods: {
  9210. onClickExchangeButton: function onClickExchangeButton() {
  9211. this.$emit('exchange', this.currentCode); // auto clear currentCode when not use vModel
  9212. if (!this.code) {
  9213. this.currentCode = '';
  9214. }
  9215. },
  9216. // scroll to show specific coupon
  9217. scrollToShowCoupon: function scrollToShowCoupon(index) {
  9218. var _this = this;
  9219. if (index === -1) {
  9220. return;
  9221. }
  9222. this.$nextTick(function () {
  9223. var _this$$refs = _this.$refs,
  9224. card = _this$$refs.card,
  9225. list = _this$$refs.list;
  9226. /* istanbul ignore next */
  9227. if (list && card && card[index]) {
  9228. list.scrollTop = card[index].$el.offsetTop - 100;
  9229. }
  9230. });
  9231. },
  9232. genEmpty: function genEmpty() {
  9233. var h = this.$createElement;
  9234. return h("div", {
  9235. "class": coupon_list_bem('empty')
  9236. }, [h("img", {
  9237. "attrs": {
  9238. "src": this.emptyImage
  9239. }
  9240. }), h("p", [coupon_list_t('empty')])]);
  9241. },
  9242. genExchangeButton: function genExchangeButton() {
  9243. var h = this.$createElement;
  9244. return h(es_button, {
  9245. "attrs": {
  9246. "plain": true,
  9247. "type": "danger",
  9248. "text": this.exchangeButtonText || coupon_list_t('exchange'),
  9249. "loading": this.exchangeButtonLoading,
  9250. "disabled": this.buttonDisabled
  9251. },
  9252. "class": coupon_list_bem('exchange'),
  9253. "on": {
  9254. "click": this.onClickExchangeButton
  9255. }
  9256. });
  9257. }
  9258. },
  9259. render: function render() {
  9260. var _this2 = this;
  9261. var h = arguments[0];
  9262. var coupons = this.coupons,
  9263. disabledCoupons = this.disabledCoupons;
  9264. var count = this.showCount ? " (" + coupons.length + ")" : '';
  9265. var title = (this.enabledTitle || coupon_list_t('enable')) + count;
  9266. var disabledCount = this.showCount ? " (" + disabledCoupons.length + ")" : '';
  9267. var disabledTitle = (this.disabledTitle || coupon_list_t('disabled')) + disabledCount;
  9268. var ExchangeBar = this.showExchangeBar && h("div", {
  9269. "class": coupon_list_bem('exchange-bar')
  9270. }, [h(es_field, {
  9271. "attrs": {
  9272. "clearable": true,
  9273. "border": false,
  9274. "placeholder": this.inputPlaceholder || coupon_list_t('placeholder'),
  9275. "maxlength": "20"
  9276. },
  9277. "class": coupon_list_bem('field'),
  9278. "model": {
  9279. value: _this2.currentCode,
  9280. callback: function callback($$v) {
  9281. _this2.currentCode = $$v;
  9282. }
  9283. }
  9284. }), this.genExchangeButton()]);
  9285. var onChange = function onChange(index) {
  9286. return function () {
  9287. return _this2.$emit('change', index);
  9288. };
  9289. };
  9290. var CouponTab = h(tab, {
  9291. "attrs": {
  9292. "title": title
  9293. }
  9294. }, [h("div", {
  9295. "class": coupon_list_bem('list', {
  9296. 'with-bottom': this.showCloseButton
  9297. }),
  9298. "style": this.listStyle
  9299. }, [coupons.map(function (coupon, index) {
  9300. return h(es_coupon, {
  9301. "ref": "card",
  9302. "key": coupon.id,
  9303. "attrs": {
  9304. "coupon": coupon,
  9305. "currency": _this2.currency,
  9306. "chosen": index === _this2.chosenCoupon
  9307. },
  9308. "nativeOn": {
  9309. "click": onChange(index)
  9310. }
  9311. });
  9312. }), !coupons.length && this.genEmpty(), this.slots('list-footer')])]);
  9313. var DisabledCouponTab = h(tab, {
  9314. "attrs": {
  9315. "title": disabledTitle
  9316. }
  9317. }, [h("div", {
  9318. "class": coupon_list_bem('list', {
  9319. 'with-bottom': this.showCloseButton
  9320. }),
  9321. "style": this.listStyle
  9322. }, [disabledCoupons.map(function (coupon) {
  9323. return h(es_coupon, {
  9324. "attrs": {
  9325. "disabled": true,
  9326. "coupon": coupon,
  9327. "currency": _this2.currency
  9328. },
  9329. "key": coupon.id
  9330. });
  9331. }), !disabledCoupons.length && this.genEmpty(), this.slots('disabled-list-footer')])]);
  9332. return h("div", {
  9333. "class": coupon_list_bem()
  9334. }, [ExchangeBar, h(tabs, {
  9335. "class": coupon_list_bem('tab'),
  9336. "attrs": {
  9337. "border": false
  9338. },
  9339. "model": {
  9340. value: _this2.tab,
  9341. callback: function callback($$v) {
  9342. _this2.tab = $$v;
  9343. }
  9344. }
  9345. }, [CouponTab, DisabledCouponTab]), h("div", {
  9346. "class": coupon_list_bem('bottom')
  9347. }, [h(es_button, {
  9348. "directives": [{
  9349. name: "show",
  9350. value: this.showCloseButton
  9351. }],
  9352. "attrs": {
  9353. "round": true,
  9354. "type": "danger",
  9355. "block": true,
  9356. "text": this.closeButtonText || coupon_list_t('close')
  9357. },
  9358. "class": coupon_list_bem('close'),
  9359. "on": {
  9360. "click": onChange(-1)
  9361. }
  9362. })])]);
  9363. }
  9364. }));
  9365. // CONCATENATED MODULE: ./es/datetime-picker/shared.js
  9366. var sharedProps = _extends({}, pickerProps, {
  9367. value: null,
  9368. filter: Function,
  9369. columnsOrder: Array,
  9370. showToolbar: {
  9371. type: Boolean,
  9372. default: true
  9373. },
  9374. formatter: {
  9375. type: Function,
  9376. default: function _default(type, value) {
  9377. return value;
  9378. }
  9379. }
  9380. });
  9381. var TimePickerMixin = {
  9382. data: function data() {
  9383. return {
  9384. innerValue: this.formatValue(this.value)
  9385. };
  9386. },
  9387. computed: {
  9388. originColumns: function originColumns() {
  9389. var _this = this;
  9390. return this.ranges.map(function (_ref) {
  9391. var type = _ref.type,
  9392. rangeArr = _ref.range;
  9393. var values = times(rangeArr[1] - rangeArr[0] + 1, function (index) {
  9394. var value = Object(string["b" /* padZero */])(rangeArr[0] + index);
  9395. return value;
  9396. });
  9397. if (_this.filter) {
  9398. values = _this.filter(type, values);
  9399. }
  9400. return {
  9401. type: type,
  9402. values: values
  9403. };
  9404. });
  9405. },
  9406. columns: function columns() {
  9407. var _this2 = this;
  9408. return this.originColumns.map(function (column) {
  9409. return {
  9410. values: column.values.map(function (value) {
  9411. return _this2.formatter(column.type, value);
  9412. })
  9413. };
  9414. });
  9415. }
  9416. },
  9417. watch: {
  9418. columns: 'updateColumnValue',
  9419. innerValue: function innerValue(val, oldVal) {
  9420. if (!oldVal) {
  9421. this.$emit('input', null);
  9422. } else {
  9423. this.$emit('input', val);
  9424. }
  9425. }
  9426. },
  9427. mounted: function mounted() {
  9428. var _this3 = this;
  9429. this.updateColumnValue();
  9430. this.$nextTick(function () {
  9431. _this3.updateInnerValue();
  9432. });
  9433. },
  9434. methods: {
  9435. // @exposed-api
  9436. getPicker: function getPicker() {
  9437. return this.$refs.picker;
  9438. },
  9439. onConfirm: function onConfirm() {
  9440. this.$emit('input', this.innerValue);
  9441. this.$emit('confirm', this.innerValue);
  9442. },
  9443. onCancel: function onCancel() {
  9444. this.$emit('cancel');
  9445. }
  9446. },
  9447. render: function render() {
  9448. var _this4 = this;
  9449. var h = arguments[0];
  9450. var props = {};
  9451. Object.keys(pickerProps).forEach(function (key) {
  9452. props[key] = _this4[key];
  9453. });
  9454. return h(picker, {
  9455. "ref": "picker",
  9456. "attrs": {
  9457. "columns": this.columns,
  9458. "readonly": this.readonly
  9459. },
  9460. "scopedSlots": this.$scopedSlots,
  9461. "on": {
  9462. "change": this.onChange,
  9463. "confirm": this.onConfirm,
  9464. "cancel": this.onCancel
  9465. },
  9466. "props": _extends({}, props)
  9467. });
  9468. }
  9469. };
  9470. // CONCATENATED MODULE: ./es/datetime-picker/TimePicker.js
  9471. var TimePicker_createNamespace = Object(create["a" /* createNamespace */])('time-picker'),
  9472. TimePicker_createComponent = TimePicker_createNamespace[0];
  9473. /* harmony default export */ var TimePicker = (TimePicker_createComponent({
  9474. mixins: [TimePickerMixin],
  9475. props: _extends({}, sharedProps, {
  9476. minHour: {
  9477. type: [Number, String],
  9478. default: 0
  9479. },
  9480. maxHour: {
  9481. type: [Number, String],
  9482. default: 23
  9483. },
  9484. minMinute: {
  9485. type: [Number, String],
  9486. default: 0
  9487. },
  9488. maxMinute: {
  9489. type: [Number, String],
  9490. default: 59
  9491. }
  9492. }),
  9493. computed: {
  9494. ranges: function ranges() {
  9495. return [{
  9496. type: 'hour',
  9497. range: [+this.minHour, +this.maxHour]
  9498. }, {
  9499. type: 'minute',
  9500. range: [+this.minMinute, +this.maxMinute]
  9501. }];
  9502. }
  9503. },
  9504. watch: {
  9505. filter: 'updateInnerValue',
  9506. minHour: function minHour() {
  9507. var _this = this;
  9508. this.$nextTick(function () {
  9509. _this.updateInnerValue();
  9510. });
  9511. },
  9512. maxHour: function maxHour(value) {
  9513. var _this$innerValue$spli = this.innerValue.split(':'),
  9514. hour = _this$innerValue$spli[0],
  9515. minute = _this$innerValue$spli[1];
  9516. if (hour >= value) {
  9517. this.innerValue = this.formatValue(value + ":" + minute);
  9518. this.updateColumnValue();
  9519. } else {
  9520. this.updateInnerValue();
  9521. }
  9522. },
  9523. minMinute: 'updateInnerValue',
  9524. maxMinute: function maxMinute(value) {
  9525. var _this$innerValue$spli2 = this.innerValue.split(':'),
  9526. hour = _this$innerValue$spli2[0],
  9527. minute = _this$innerValue$spli2[1];
  9528. if (minute >= value) {
  9529. this.innerValue = this.formatValue(hour + ":" + value);
  9530. this.updateColumnValue();
  9531. } else {
  9532. this.updateInnerValue();
  9533. }
  9534. },
  9535. value: function value(val) {
  9536. val = this.formatValue(val);
  9537. if (val !== this.innerValue) {
  9538. this.innerValue = val;
  9539. this.updateColumnValue();
  9540. }
  9541. }
  9542. },
  9543. methods: {
  9544. formatValue: function formatValue(value) {
  9545. if (!value) {
  9546. value = Object(string["b" /* padZero */])(this.minHour) + ":" + Object(string["b" /* padZero */])(this.minMinute);
  9547. }
  9548. var _value$split = value.split(':'),
  9549. hour = _value$split[0],
  9550. minute = _value$split[1];
  9551. hour = Object(string["b" /* padZero */])(range(hour, this.minHour, this.maxHour));
  9552. minute = Object(string["b" /* padZero */])(range(minute, this.minMinute, this.maxMinute));
  9553. return hour + ":" + minute;
  9554. },
  9555. updateInnerValue: function updateInnerValue() {
  9556. var _this$getPicker$getIn = this.getPicker().getIndexes(),
  9557. hourIndex = _this$getPicker$getIn[0],
  9558. minuteIndex = _this$getPicker$getIn[1];
  9559. var _this$originColumns = this.originColumns,
  9560. hourColumn = _this$originColumns[0],
  9561. minuteColumn = _this$originColumns[1];
  9562. var hour = hourColumn.values[hourIndex] || hourColumn.values[0];
  9563. var minute = minuteColumn.values[minuteIndex] || minuteColumn.values[0];
  9564. this.innerValue = this.formatValue(hour + ":" + minute);
  9565. this.updateColumnValue();
  9566. },
  9567. onChange: function onChange(picker) {
  9568. var _this2 = this;
  9569. this.updateInnerValue();
  9570. this.$nextTick(function () {
  9571. _this2.$nextTick(function () {
  9572. _this2.$emit('change', picker);
  9573. });
  9574. });
  9575. },
  9576. updateColumnValue: function updateColumnValue() {
  9577. var _this3 = this;
  9578. var formatter = this.formatter;
  9579. var pair = this.innerValue.split(':');
  9580. var values = [formatter('hour', pair[0]), formatter('minute', pair[1])];
  9581. this.$nextTick(function () {
  9582. _this3.getPicker().setValues(values);
  9583. });
  9584. }
  9585. }
  9586. }));
  9587. // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
  9588. function _setPrototypeOf(o, p) {
  9589. _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
  9590. o.__proto__ = p;
  9591. return o;
  9592. };
  9593. return _setPrototypeOf(o, p);
  9594. }
  9595. // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js
  9596. function _isNativeReflectConstruct() {
  9597. if (typeof Reflect === "undefined" || !Reflect.construct) return false;
  9598. if (Reflect.construct.sham) return false;
  9599. if (typeof Proxy === "function") return true;
  9600. try {
  9601. Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
  9602. return true;
  9603. } catch (e) {
  9604. return false;
  9605. }
  9606. }
  9607. // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/construct.js
  9608. function construct_construct(Parent, args, Class) {
  9609. if (_isNativeReflectConstruct()) {
  9610. construct_construct = Reflect.construct;
  9611. } else {
  9612. construct_construct = function _construct(Parent, args, Class) {
  9613. var a = [null];
  9614. a.push.apply(a, args);
  9615. var Constructor = Function.bind.apply(Parent, a);
  9616. var instance = new Constructor();
  9617. if (Class) _setPrototypeOf(instance, Class.prototype);
  9618. return instance;
  9619. };
  9620. }
  9621. return construct_construct.apply(null, arguments);
  9622. }
  9623. // CONCATENATED MODULE: ./es/datetime-picker/DatePicker.js
  9624. var currentYear = new Date().getFullYear();
  9625. var DatePicker_createNamespace = Object(create["a" /* createNamespace */])('date-picker'),
  9626. DatePicker_createComponent = DatePicker_createNamespace[0];
  9627. /* harmony default export */ var DatePicker = (DatePicker_createComponent({
  9628. mixins: [TimePickerMixin],
  9629. props: _extends({}, sharedProps, {
  9630. type: {
  9631. type: String,
  9632. default: 'datetime'
  9633. },
  9634. minDate: {
  9635. type: Date,
  9636. default: function _default() {
  9637. return new Date(currentYear - 10, 0, 1);
  9638. },
  9639. validator: isDate
  9640. },
  9641. maxDate: {
  9642. type: Date,
  9643. default: function _default() {
  9644. return new Date(currentYear + 10, 11, 31);
  9645. },
  9646. validator: isDate
  9647. }
  9648. }),
  9649. watch: {
  9650. filter: 'updateInnerValue',
  9651. minDate: function minDate() {
  9652. var _this = this;
  9653. this.$nextTick(function () {
  9654. _this.updateInnerValue();
  9655. });
  9656. },
  9657. maxDate: function maxDate(value) {
  9658. if (this.innerValue.valueOf() >= value.valueOf()) {
  9659. this.innerValue = value;
  9660. } else {
  9661. this.updateInnerValue();
  9662. }
  9663. },
  9664. value: function value(val) {
  9665. val = this.formatValue(val);
  9666. if (val && val.valueOf() !== this.innerValue.valueOf()) {
  9667. this.innerValue = val;
  9668. }
  9669. }
  9670. },
  9671. computed: {
  9672. ranges: function ranges() {
  9673. var _this$getBoundary = this.getBoundary('max', this.innerValue ? this.innerValue : this.minDate),
  9674. maxYear = _this$getBoundary.maxYear,
  9675. maxDate = _this$getBoundary.maxDate,
  9676. maxMonth = _this$getBoundary.maxMonth,
  9677. maxHour = _this$getBoundary.maxHour,
  9678. maxMinute = _this$getBoundary.maxMinute;
  9679. var _this$getBoundary2 = this.getBoundary('min', this.innerValue ? this.innerValue : this.minDate),
  9680. minYear = _this$getBoundary2.minYear,
  9681. minDate = _this$getBoundary2.minDate,
  9682. minMonth = _this$getBoundary2.minMonth,
  9683. minHour = _this$getBoundary2.minHour,
  9684. minMinute = _this$getBoundary2.minMinute;
  9685. var result = [{
  9686. type: 'year',
  9687. range: [minYear, maxYear]
  9688. }, {
  9689. type: 'month',
  9690. range: [minMonth, maxMonth]
  9691. }, {
  9692. type: 'day',
  9693. range: [minDate, maxDate]
  9694. }, {
  9695. type: 'hour',
  9696. range: [minHour, maxHour]
  9697. }, {
  9698. type: 'minute',
  9699. range: [minMinute, maxMinute]
  9700. }];
  9701. switch (this.type) {
  9702. case 'date':
  9703. result = result.slice(0, 3);
  9704. break;
  9705. case 'year-month':
  9706. result = result.slice(0, 2);
  9707. break;
  9708. case 'month-day':
  9709. result = result.slice(1, 3);
  9710. break;
  9711. case 'datehour':
  9712. result = result.slice(0, 4);
  9713. break;
  9714. }
  9715. if (this.columnsOrder) {
  9716. var columnsOrder = this.columnsOrder.concat(result.map(function (column) {
  9717. return column.type;
  9718. }));
  9719. result.sort(function (a, b) {
  9720. return columnsOrder.indexOf(a.type) - columnsOrder.indexOf(b.type);
  9721. });
  9722. }
  9723. return result;
  9724. }
  9725. },
  9726. methods: {
  9727. formatValue: function formatValue(value) {
  9728. var _this2 = this;
  9729. if (!isDate(value)) {
  9730. return null;
  9731. }
  9732. var minDate = new Date(this.minDate);
  9733. var maxDate = new Date(this.maxDate);
  9734. var dateMethods = {
  9735. year: 'getFullYear',
  9736. month: 'getMonth',
  9737. day: 'getDate',
  9738. hour: 'getHours',
  9739. minute: 'getMinutes'
  9740. };
  9741. if (this.originColumns) {
  9742. var dateColumns = this.originColumns.map(function (_ref, index) {
  9743. var type = _ref.type,
  9744. values = _ref.values;
  9745. var range = _this2.ranges[index].range;
  9746. var minDateVal = minDate[dateMethods[type]]();
  9747. var maxDateVal = maxDate[dateMethods[type]]();
  9748. var min = type === 'month' ? +values[0] - 1 : +values[0];
  9749. var max = type === 'month' ? +values[values.length - 1] - 1 : +values[values.length - 1];
  9750. return {
  9751. type: type,
  9752. values: [minDateVal < range[0] ? Math.max(minDateVal, min) : min || minDateVal, maxDateVal > range[1] ? Math.min(maxDateVal, max) : max || maxDateVal]
  9753. };
  9754. });
  9755. if (this.type === 'month-day') {
  9756. var year = (this.innerValue || this.minDate).getFullYear();
  9757. dateColumns.unshift({
  9758. type: 'year',
  9759. values: [year, year]
  9760. });
  9761. }
  9762. var dates = Object.keys(dateMethods).map(function (type) {
  9763. var _dateColumns$filter$;
  9764. return (_dateColumns$filter$ = dateColumns.filter(function (item) {
  9765. return item.type === type;
  9766. })[0]) == null ? void 0 : _dateColumns$filter$.values;
  9767. }).filter(function (item) {
  9768. return item;
  9769. });
  9770. minDate = construct_construct(Date, dates.map(function (val) {
  9771. return getTrueValue(val[0]);
  9772. }));
  9773. maxDate = construct_construct(Date, dates.map(function (val) {
  9774. return getTrueValue(val[1]);
  9775. }));
  9776. }
  9777. value = Math.max(value, minDate.getTime());
  9778. value = Math.min(value, maxDate.getTime());
  9779. return new Date(value);
  9780. },
  9781. getBoundary: function getBoundary(type, value) {
  9782. var _ref2;
  9783. var boundary = this[type + "Date"];
  9784. var year = boundary.getFullYear();
  9785. var month = 1;
  9786. var date = 1;
  9787. var hour = 0;
  9788. var minute = 0;
  9789. if (type === 'max') {
  9790. month = 12;
  9791. date = getMonthEndDay(value.getFullYear(), value.getMonth() + 1);
  9792. hour = 23;
  9793. minute = 59;
  9794. }
  9795. if (value.getFullYear() === year) {
  9796. month = boundary.getMonth() + 1;
  9797. if (value.getMonth() + 1 === month) {
  9798. date = boundary.getDate();
  9799. if (value.getDate() === date) {
  9800. hour = boundary.getHours();
  9801. if (value.getHours() === hour) {
  9802. minute = boundary.getMinutes();
  9803. }
  9804. }
  9805. }
  9806. }
  9807. return _ref2 = {}, _ref2[type + "Year"] = year, _ref2[type + "Month"] = month, _ref2[type + "Date"] = date, _ref2[type + "Hour"] = hour, _ref2[type + "Minute"] = minute, _ref2;
  9808. },
  9809. updateInnerValue: function updateInnerValue() {
  9810. var _this3 = this;
  9811. var type = this.type;
  9812. var indexes = this.getPicker().getIndexes();
  9813. var getValue = function getValue(type) {
  9814. var index = 0;
  9815. _this3.originColumns.forEach(function (column, columnIndex) {
  9816. if (type === column.type) {
  9817. index = columnIndex;
  9818. }
  9819. });
  9820. var values = _this3.originColumns[index].values;
  9821. return getTrueValue(values[indexes[index]]);
  9822. };
  9823. var year;
  9824. var month;
  9825. var day;
  9826. if (type === 'month-day') {
  9827. year = (this.innerValue || this.minDate).getFullYear();
  9828. month = getValue('month');
  9829. day = getValue('day');
  9830. } else {
  9831. year = getValue('year');
  9832. month = getValue('month');
  9833. day = type === 'year-month' ? 1 : getValue('day');
  9834. }
  9835. var maxDay = getMonthEndDay(year, month);
  9836. day = day > maxDay ? maxDay : day;
  9837. var hour = 0;
  9838. var minute = 0;
  9839. if (type === 'datehour') {
  9840. hour = getValue('hour');
  9841. }
  9842. if (type === 'datetime') {
  9843. hour = getValue('hour');
  9844. minute = getValue('minute');
  9845. }
  9846. var value = new Date(year, month - 1, day, hour, minute);
  9847. this.innerValue = this.formatValue(value);
  9848. },
  9849. onChange: function onChange(picker) {
  9850. var _this4 = this;
  9851. this.updateInnerValue();
  9852. this.$nextTick(function () {
  9853. _this4.$nextTick(function () {
  9854. _this4.$emit('change', picker);
  9855. });
  9856. });
  9857. },
  9858. updateColumnValue: function updateColumnValue() {
  9859. var _this5 = this;
  9860. var value = this.innerValue ? this.innerValue : this.minDate;
  9861. var formatter = this.formatter;
  9862. var values = this.originColumns.map(function (column) {
  9863. switch (column.type) {
  9864. case 'year':
  9865. return formatter('year', "" + value.getFullYear());
  9866. case 'month':
  9867. return formatter('month', Object(string["b" /* padZero */])(value.getMonth() + 1));
  9868. case 'day':
  9869. return formatter('day', Object(string["b" /* padZero */])(value.getDate()));
  9870. case 'hour':
  9871. return formatter('hour', Object(string["b" /* padZero */])(value.getHours()));
  9872. case 'minute':
  9873. return formatter('minute', Object(string["b" /* padZero */])(value.getMinutes()));
  9874. default:
  9875. // no default
  9876. return null;
  9877. }
  9878. });
  9879. this.$nextTick(function () {
  9880. _this5.getPicker().setValues(values);
  9881. });
  9882. }
  9883. }
  9884. }));
  9885. // CONCATENATED MODULE: ./es/datetime-picker/index.js
  9886. var datetime_picker_createNamespace = Object(create["a" /* createNamespace */])('datetime-picker'),
  9887. datetime_picker_createComponent = datetime_picker_createNamespace[0],
  9888. datetime_picker_bem = datetime_picker_createNamespace[1];
  9889. /* harmony default export */ var datetime_picker = (datetime_picker_createComponent({
  9890. props: _extends({}, TimePicker.props, DatePicker.props),
  9891. methods: {
  9892. // @exposed-api
  9893. getPicker: function getPicker() {
  9894. return this.$refs.root.getPicker();
  9895. }
  9896. },
  9897. render: function render() {
  9898. var h = arguments[0];
  9899. var Component = this.type === 'time' ? TimePicker : DatePicker;
  9900. return h(Component, {
  9901. "ref": "root",
  9902. "class": datetime_picker_bem(),
  9903. "scopedSlots": this.$scopedSlots,
  9904. "props": _extends({}, this.$props),
  9905. "on": _extends({}, this.$listeners)
  9906. });
  9907. }
  9908. }));
  9909. // CONCATENATED MODULE: ./es/divider/index.js
  9910. // Utils
  9911. // Types
  9912. var divider_createNamespace = Object(create["a" /* createNamespace */])('divider'),
  9913. divider_createComponent = divider_createNamespace[0],
  9914. divider_bem = divider_createNamespace[1];
  9915. function Divider(h, props, slots, ctx) {
  9916. var _bem;
  9917. return h("div", helper_default()([{
  9918. "attrs": {
  9919. "role": "separator"
  9920. },
  9921. "style": {
  9922. borderColor: props.borderColor
  9923. },
  9924. "class": divider_bem((_bem = {
  9925. dashed: props.dashed,
  9926. hairline: props.hairline
  9927. }, _bem["content-" + props.contentPosition] = slots.default, _bem))
  9928. }, inherit(ctx, true)]), [slots.default && slots.default()]);
  9929. }
  9930. Divider.props = {
  9931. dashed: Boolean,
  9932. hairline: {
  9933. type: Boolean,
  9934. default: true
  9935. },
  9936. contentPosition: {
  9937. type: String,
  9938. default: 'center'
  9939. }
  9940. };
  9941. /* harmony default export */ var divider = (divider_createComponent(Divider));
  9942. // CONCATENATED MODULE: ./es/dropdown-item/index.js
  9943. // Utils
  9944. // Mixins
  9945. // Components
  9946. var dropdown_item_createNamespace = Object(create["a" /* createNamespace */])('dropdown-item'),
  9947. dropdown_item_createComponent = dropdown_item_createNamespace[0],
  9948. dropdown_item_bem = dropdown_item_createNamespace[1];
  9949. /* harmony default export */ var dropdown_item = (dropdown_item_createComponent({
  9950. mixins: [PortalMixin({
  9951. ref: 'wrapper'
  9952. }), ChildrenMixin('vanDropdownMenu')],
  9953. props: {
  9954. value: null,
  9955. title: String,
  9956. disabled: Boolean,
  9957. titleClass: String,
  9958. options: {
  9959. type: Array,
  9960. default: function _default() {
  9961. return [];
  9962. }
  9963. },
  9964. lazyRender: {
  9965. type: Boolean,
  9966. default: true
  9967. }
  9968. },
  9969. data: function data() {
  9970. return {
  9971. transition: true,
  9972. showPopup: false,
  9973. showWrapper: false
  9974. };
  9975. },
  9976. computed: {
  9977. displayTitle: function displayTitle() {
  9978. var _this = this;
  9979. if (this.title) {
  9980. return this.title;
  9981. }
  9982. var match = this.options.filter(function (option) {
  9983. return option.value === _this.value;
  9984. });
  9985. return match.length ? match[0].text : '';
  9986. }
  9987. },
  9988. watch: {
  9989. showPopup: function showPopup(val) {
  9990. this.bindScroll(val);
  9991. }
  9992. },
  9993. beforeCreate: function beforeCreate() {
  9994. var _this2 = this;
  9995. var createEmitter = function createEmitter(eventName) {
  9996. return function () {
  9997. return _this2.$emit(eventName);
  9998. };
  9999. };
  10000. this.onOpen = createEmitter('open');
  10001. this.onClose = createEmitter('close');
  10002. this.onOpened = createEmitter('opened');
  10003. },
  10004. methods: {
  10005. // @exposed-api
  10006. toggle: function toggle(show, options) {
  10007. if (show === void 0) {
  10008. show = !this.showPopup;
  10009. }
  10010. if (options === void 0) {
  10011. options = {};
  10012. }
  10013. if (show === this.showPopup) {
  10014. return;
  10015. }
  10016. this.transition = !options.immediate;
  10017. this.showPopup = show;
  10018. if (show) {
  10019. this.parent.updateOffset();
  10020. this.showWrapper = true;
  10021. }
  10022. },
  10023. bindScroll: function bindScroll(bind) {
  10024. var scroller = this.parent.scroller;
  10025. var action = bind ? event_on : off;
  10026. action(scroller, 'scroll', this.onScroll, true);
  10027. },
  10028. onScroll: function onScroll() {
  10029. this.parent.updateOffset();
  10030. },
  10031. onClickWrapper: function onClickWrapper(event) {
  10032. // prevent being identified as clicking outside and closed when use get-contaienr
  10033. if (this.getContainer) {
  10034. event.stopPropagation();
  10035. }
  10036. }
  10037. },
  10038. render: function render() {
  10039. var _this3 = this;
  10040. var h = arguments[0];
  10041. var _this$parent = this.parent,
  10042. zIndex = _this$parent.zIndex,
  10043. offset = _this$parent.offset,
  10044. overlay = _this$parent.overlay,
  10045. duration = _this$parent.duration,
  10046. direction = _this$parent.direction,
  10047. activeColor = _this$parent.activeColor,
  10048. closeOnClickOverlay = _this$parent.closeOnClickOverlay;
  10049. var Options = this.options.map(function (option) {
  10050. var active = option.value === _this3.value;
  10051. return h(cell, {
  10052. "attrs": {
  10053. "clickable": true,
  10054. "icon": option.icon,
  10055. "title": option.text
  10056. },
  10057. "key": option.value,
  10058. "class": dropdown_item_bem('option', {
  10059. active: active
  10060. }),
  10061. "style": {
  10062. color: active ? activeColor : ''
  10063. },
  10064. "on": {
  10065. "click": function click() {
  10066. _this3.showPopup = false;
  10067. if (option.value !== _this3.value) {
  10068. _this3.$emit('input', option.value);
  10069. _this3.$emit('change', option.value);
  10070. }
  10071. }
  10072. }
  10073. }, [active && h(es_icon, {
  10074. "class": dropdown_item_bem('icon'),
  10075. "attrs": {
  10076. "color": activeColor,
  10077. "name": "success"
  10078. }
  10079. })]);
  10080. });
  10081. var style = {
  10082. zIndex: zIndex
  10083. };
  10084. if (direction === 'down') {
  10085. style.top = offset + "px";
  10086. } else {
  10087. style.bottom = offset + "px";
  10088. }
  10089. return h("div", [h("div", {
  10090. "directives": [{
  10091. name: "show",
  10092. value: this.showWrapper
  10093. }],
  10094. "ref": "wrapper",
  10095. "style": style,
  10096. "class": dropdown_item_bem([direction]),
  10097. "on": {
  10098. "click": this.onClickWrapper
  10099. }
  10100. }, [h(popup, {
  10101. "attrs": {
  10102. "overlay": overlay,
  10103. "position": direction === 'down' ? 'top' : 'bottom',
  10104. "duration": this.transition ? duration : 0,
  10105. "lazyRender": this.lazyRender,
  10106. "overlayStyle": {
  10107. position: 'absolute'
  10108. },
  10109. "closeOnClickOverlay": closeOnClickOverlay
  10110. },
  10111. "class": dropdown_item_bem('content'),
  10112. "on": {
  10113. "open": this.onOpen,
  10114. "close": this.onClose,
  10115. "opened": this.onOpened,
  10116. "closed": function closed() {
  10117. _this3.showWrapper = false;
  10118. _this3.$emit('closed');
  10119. }
  10120. },
  10121. "model": {
  10122. value: _this3.showPopup,
  10123. callback: function callback($$v) {
  10124. _this3.showPopup = $$v;
  10125. }
  10126. }
  10127. }, [Options, this.slots('default')])])]);
  10128. }
  10129. }));
  10130. // CONCATENATED MODULE: ./es/mixins/click-outside.js
  10131. /**
  10132. * Listen to click outside event
  10133. */
  10134. var click_outside_ClickOutsideMixin = function ClickOutsideMixin(config) {
  10135. return {
  10136. props: {
  10137. closeOnClickOutside: {
  10138. type: Boolean,
  10139. default: true
  10140. }
  10141. },
  10142. data: function data() {
  10143. var _this = this;
  10144. var clickOutsideHandler = function clickOutsideHandler(event) {
  10145. if (_this.closeOnClickOutside && !_this.$el.contains(event.target)) {
  10146. _this[config.method]();
  10147. }
  10148. };
  10149. return {
  10150. clickOutsideHandler: clickOutsideHandler
  10151. };
  10152. },
  10153. mounted: function mounted() {
  10154. event_on(document, config.event, this.clickOutsideHandler);
  10155. },
  10156. beforeDestroy: function beforeDestroy() {
  10157. off(document, config.event, this.clickOutsideHandler);
  10158. }
  10159. };
  10160. };
  10161. // CONCATENATED MODULE: ./es/dropdown-menu/index.js
  10162. // Utils
  10163. // Mixins
  10164. var dropdown_menu_createNamespace = Object(create["a" /* createNamespace */])('dropdown-menu'),
  10165. dropdown_menu_createComponent = dropdown_menu_createNamespace[0],
  10166. dropdown_menu_bem = dropdown_menu_createNamespace[1];
  10167. /* harmony default export */ var dropdown_menu = (dropdown_menu_createComponent({
  10168. mixins: [ParentMixin('vanDropdownMenu'), click_outside_ClickOutsideMixin({
  10169. event: 'click',
  10170. method: 'onClickOutside'
  10171. })],
  10172. props: {
  10173. zIndex: [Number, String],
  10174. activeColor: String,
  10175. overlay: {
  10176. type: Boolean,
  10177. default: true
  10178. },
  10179. duration: {
  10180. type: [Number, String],
  10181. default: 0.2
  10182. },
  10183. direction: {
  10184. type: String,
  10185. default: 'down'
  10186. },
  10187. closeOnClickOverlay: {
  10188. type: Boolean,
  10189. default: true
  10190. }
  10191. },
  10192. data: function data() {
  10193. return {
  10194. offset: 0
  10195. };
  10196. },
  10197. computed: {
  10198. scroller: function scroller() {
  10199. return getScroller(this.$el);
  10200. },
  10201. opened: function opened() {
  10202. return this.children.some(function (item) {
  10203. return item.showWrapper;
  10204. });
  10205. },
  10206. barStyle: function barStyle() {
  10207. if (this.opened && Object(utils["c" /* isDef */])(this.zIndex)) {
  10208. return {
  10209. zIndex: 1 + this.zIndex
  10210. };
  10211. }
  10212. }
  10213. },
  10214. methods: {
  10215. updateOffset: function updateOffset() {
  10216. if (!this.$refs.bar) {
  10217. return;
  10218. }
  10219. var rect = this.$refs.bar.getBoundingClientRect();
  10220. if (this.direction === 'down') {
  10221. this.offset = rect.bottom;
  10222. } else {
  10223. this.offset = window.innerHeight - rect.top;
  10224. }
  10225. },
  10226. toggleItem: function toggleItem(active) {
  10227. this.children.forEach(function (item, index) {
  10228. if (index === active) {
  10229. item.toggle();
  10230. } else if (item.showPopup) {
  10231. item.toggle(false, {
  10232. immediate: true
  10233. });
  10234. }
  10235. });
  10236. },
  10237. onClickOutside: function onClickOutside() {
  10238. this.children.forEach(function (item) {
  10239. item.toggle(false);
  10240. });
  10241. }
  10242. },
  10243. render: function render() {
  10244. var _this = this;
  10245. var h = arguments[0];
  10246. var Titles = this.children.map(function (item, index) {
  10247. return h("div", {
  10248. "attrs": {
  10249. "role": "button",
  10250. "tabindex": item.disabled ? -1 : 0
  10251. },
  10252. "class": dropdown_menu_bem('item', {
  10253. disabled: item.disabled
  10254. }),
  10255. "on": {
  10256. "click": function click() {
  10257. if (!item.disabled) {
  10258. _this.toggleItem(index);
  10259. }
  10260. }
  10261. }
  10262. }, [h("span", {
  10263. "class": [dropdown_menu_bem('title', {
  10264. active: item.showPopup,
  10265. down: item.showPopup === (_this.direction === 'down')
  10266. }), item.titleClass],
  10267. "style": {
  10268. color: item.showPopup ? _this.activeColor : ''
  10269. }
  10270. }, [h("div", {
  10271. "class": "van-ellipsis"
  10272. }, [item.slots('title') || item.displayTitle])])]);
  10273. });
  10274. return h("div", {
  10275. "class": dropdown_menu_bem()
  10276. }, [h("div", {
  10277. "ref": "bar",
  10278. "style": this.barStyle,
  10279. "class": dropdown_menu_bem('bar', {
  10280. opened: this.opened
  10281. })
  10282. }, [Titles]), this.slots('default')]);
  10283. }
  10284. }));
  10285. // CONCATENATED MODULE: ./es/empty/Network.js
  10286. var prefix = 'van-empty-network-';
  10287. /* harmony default export */ var Network = ({
  10288. render: function render() {
  10289. var h = arguments[0];
  10290. var genStop = function genStop(color, offset, opacity) {
  10291. return h("stop", {
  10292. "attrs": {
  10293. "stop-color": color,
  10294. "offset": offset + "%",
  10295. "stop-opacity": opacity
  10296. }
  10297. });
  10298. };
  10299. return h("svg", {
  10300. "attrs": {
  10301. "viewBox": "0 0 160 160",
  10302. "xmlns": "http://www.w3.org/2000/svg"
  10303. }
  10304. }, [h("defs", [h("linearGradient", {
  10305. "attrs": {
  10306. "id": prefix + "1",
  10307. "x1": "64.022%",
  10308. "y1": "100%",
  10309. "x2": "64.022%",
  10310. "y2": "0%"
  10311. }
  10312. }, [genStop('#FFF', 0, 0.5), genStop('#F2F3F5', 100)]), h("linearGradient", {
  10313. "attrs": {
  10314. "id": prefix + "2",
  10315. "x1": "50%",
  10316. "y1": "0%",
  10317. "x2": "50%",
  10318. "y2": "84.459%"
  10319. }
  10320. }, [genStop('#EBEDF0', 0), genStop('#DCDEE0', 100, 0)]), h("linearGradient", {
  10321. "attrs": {
  10322. "id": prefix + "3",
  10323. "x1": "100%",
  10324. "y1": "0%",
  10325. "x2": "100%",
  10326. "y2": "100%"
  10327. }
  10328. }, [genStop('#EAEDF0', 0), genStop('#DCDEE0', 100)]), h("linearGradient", {
  10329. "attrs": {
  10330. "id": prefix + "4",
  10331. "x1": "100%",
  10332. "y1": "100%",
  10333. "x2": "100%",
  10334. "y2": "0%"
  10335. }
  10336. }, [genStop('#EAEDF0', 0), genStop('#DCDEE0', 100)]), h("linearGradient", {
  10337. "attrs": {
  10338. "id": prefix + "5",
  10339. "x1": "0%",
  10340. "y1": "43.982%",
  10341. "x2": "100%",
  10342. "y2": "54.703%"
  10343. }
  10344. }, [genStop('#EAEDF0', 0), genStop('#DCDEE0', 100)]), h("linearGradient", {
  10345. "attrs": {
  10346. "id": prefix + "6",
  10347. "x1": "94.535%",
  10348. "y1": "43.837%",
  10349. "x2": "5.465%",
  10350. "y2": "54.948%"
  10351. }
  10352. }, [genStop('#EAEDF0', 0), genStop('#DCDEE0', 100)]), h("radialGradient", {
  10353. "attrs": {
  10354. "id": prefix + "7",
  10355. "cx": "50%",
  10356. "cy": "0%",
  10357. "fx": "50%",
  10358. "fy": "0%",
  10359. "r": "100%",
  10360. "gradientTransform": "matrix(0 1 -.54835 0 .5 -.5)"
  10361. }
  10362. }, [genStop('#EBEDF0', 0), genStop('#FFF', 100, 0)])]), h("g", {
  10363. "attrs": {
  10364. "fill": "none",
  10365. "fill-rule": "evenodd"
  10366. }
  10367. }, [h("g", {
  10368. "attrs": {
  10369. "opacity": ".8"
  10370. }
  10371. }, [h("path", {
  10372. "attrs": {
  10373. "d": "M0 124V46h20v20h14v58H0z",
  10374. "fill": "url(#" + prefix + "1)",
  10375. "transform": "matrix(-1 0 0 1 36 7)"
  10376. }
  10377. }), h("path", {
  10378. "attrs": {
  10379. "d": "M121 8h22.231v14H152v77.37h-31V8z",
  10380. "fill": "url(#" + prefix + "1)",
  10381. "transform": "translate(2 7)"
  10382. }
  10383. })]), h("path", {
  10384. "attrs": {
  10385. "fill": "url(#" + prefix + "7)",
  10386. "d": "M0 139h160v21H0z"
  10387. }
  10388. }), h("path", {
  10389. "attrs": {
  10390. "d": "M37 18a7 7 0 013 13.326v26.742c0 1.23-.997 2.227-2.227 2.227h-1.546A2.227 2.227 0 0134 58.068V31.326A7 7 0 0137 18z",
  10391. "fill": "url(#" + prefix + "2)",
  10392. "fill-rule": "nonzero",
  10393. "transform": "translate(43 36)"
  10394. }
  10395. }), h("g", {
  10396. "attrs": {
  10397. "opacity": ".6",
  10398. "stroke-linecap": "round",
  10399. "stroke-width": "7"
  10400. }
  10401. }, [h("path", {
  10402. "attrs": {
  10403. "d": "M20.875 11.136a18.868 18.868 0 00-5.284 13.121c0 5.094 2.012 9.718 5.284 13.12",
  10404. "stroke": "url(#" + prefix + "3)",
  10405. "transform": "translate(43 36)"
  10406. }
  10407. }), h("path", {
  10408. "attrs": {
  10409. "d": "M9.849 0C3.756 6.225 0 14.747 0 24.146c0 9.398 3.756 17.92 9.849 24.145",
  10410. "stroke": "url(#" + prefix + "3)",
  10411. "transform": "translate(43 36)"
  10412. }
  10413. }), h("path", {
  10414. "attrs": {
  10415. "d": "M57.625 11.136a18.868 18.868 0 00-5.284 13.121c0 5.094 2.012 9.718 5.284 13.12",
  10416. "stroke": "url(#" + prefix + "4)",
  10417. "transform": "rotate(-180 76.483 42.257)"
  10418. }
  10419. }), h("path", {
  10420. "attrs": {
  10421. "d": "M73.216 0c-6.093 6.225-9.849 14.747-9.849 24.146 0 9.398 3.756 17.92 9.849 24.145",
  10422. "stroke": "url(#" + prefix + "4)",
  10423. "transform": "rotate(-180 89.791 42.146)"
  10424. }
  10425. })]), h("g", {
  10426. "attrs": {
  10427. "transform": "translate(31 105)",
  10428. "fill-rule": "nonzero"
  10429. }
  10430. }, [h("rect", {
  10431. "attrs": {
  10432. "fill": "url(#" + prefix + "5)",
  10433. "width": "98",
  10434. "height": "34",
  10435. "rx": "2"
  10436. }
  10437. }), h("rect", {
  10438. "attrs": {
  10439. "fill": "#FFF",
  10440. "x": "9",
  10441. "y": "8",
  10442. "width": "80",
  10443. "height": "18",
  10444. "rx": "1.114"
  10445. }
  10446. }), h("rect", {
  10447. "attrs": {
  10448. "fill": "url(#" + prefix + "6)",
  10449. "x": "15",
  10450. "y": "12",
  10451. "width": "18",
  10452. "height": "6",
  10453. "rx": "1.114"
  10454. }
  10455. })])])]);
  10456. }
  10457. });
  10458. // CONCATENATED MODULE: ./es/empty/index.js
  10459. var empty_createNamespace = Object(create["a" /* createNamespace */])('empty'),
  10460. empty_createComponent = empty_createNamespace[0],
  10461. empty_bem = empty_createNamespace[1];
  10462. var PRESETS = ['error', 'search', 'default'];
  10463. /* harmony default export */ var empty = (empty_createComponent({
  10464. props: {
  10465. imageSize: [Number, String],
  10466. description: String,
  10467. image: {
  10468. type: String,
  10469. default: 'default'
  10470. }
  10471. },
  10472. methods: {
  10473. genImageContent: function genImageContent() {
  10474. var h = this.$createElement;
  10475. var slots = this.slots('image');
  10476. if (slots) {
  10477. return slots;
  10478. }
  10479. if (this.image === 'network') {
  10480. return h(Network);
  10481. }
  10482. var image = this.image;
  10483. if (PRESETS.indexOf(image) !== -1) {
  10484. image = "https://img01.yzcdn.cn/vant/empty-image-" + image + ".png";
  10485. }
  10486. return h("img", {
  10487. "attrs": {
  10488. "src": image
  10489. }
  10490. });
  10491. },
  10492. genImage: function genImage() {
  10493. var h = this.$createElement;
  10494. var imageStyle = {
  10495. width: Object(unit["a" /* addUnit */])(this.imageSize),
  10496. height: Object(unit["a" /* addUnit */])(this.imageSize)
  10497. };
  10498. return h("div", {
  10499. "class": empty_bem('image'),
  10500. "style": imageStyle
  10501. }, [this.genImageContent()]);
  10502. },
  10503. genDescription: function genDescription() {
  10504. var h = this.$createElement;
  10505. var description = this.slots('description') || this.description;
  10506. if (description) {
  10507. return h("p", {
  10508. "class": empty_bem('description')
  10509. }, [description]);
  10510. }
  10511. },
  10512. genBottom: function genBottom() {
  10513. var h = this.$createElement;
  10514. var slot = this.slots();
  10515. if (slot) {
  10516. return h("div", {
  10517. "class": empty_bem('bottom')
  10518. }, [slot]);
  10519. }
  10520. }
  10521. },
  10522. render: function render() {
  10523. var h = arguments[0];
  10524. return h("div", {
  10525. "class": empty_bem()
  10526. }, [this.genImage(), this.genDescription(), this.genBottom()]);
  10527. }
  10528. }));
  10529. // CONCATENATED MODULE: ./es/form/index.js
  10530. var form_createNamespace = Object(create["a" /* createNamespace */])('form'),
  10531. form_createComponent = form_createNamespace[0],
  10532. form_bem = form_createNamespace[1];
  10533. /* harmony default export */ var es_form = (form_createComponent({
  10534. props: {
  10535. colon: Boolean,
  10536. disabled: Boolean,
  10537. readonly: Boolean,
  10538. labelWidth: [Number, String],
  10539. labelAlign: String,
  10540. inputAlign: String,
  10541. scrollToError: Boolean,
  10542. validateFirst: Boolean,
  10543. errorMessageAlign: String,
  10544. submitOnEnter: {
  10545. type: Boolean,
  10546. default: true
  10547. },
  10548. validateTrigger: {
  10549. type: String,
  10550. default: 'onBlur'
  10551. },
  10552. showError: {
  10553. type: Boolean,
  10554. default: true
  10555. },
  10556. showErrorMessage: {
  10557. type: Boolean,
  10558. default: true
  10559. }
  10560. },
  10561. provide: function provide() {
  10562. return {
  10563. vanForm: this
  10564. };
  10565. },
  10566. data: function data() {
  10567. return {
  10568. fields: []
  10569. };
  10570. },
  10571. methods: {
  10572. getFieldsByNames: function getFieldsByNames(names) {
  10573. if (names) {
  10574. return this.fields.filter(function (field) {
  10575. return names.indexOf(field.name) !== -1;
  10576. });
  10577. }
  10578. return this.fields;
  10579. },
  10580. validateSeq: function validateSeq(names) {
  10581. var _this = this;
  10582. return new Promise(function (resolve, reject) {
  10583. var errors = [];
  10584. var fields = _this.getFieldsByNames(names);
  10585. fields.reduce(function (promise, field) {
  10586. return promise.then(function () {
  10587. if (!errors.length) {
  10588. return field.validate().then(function (error) {
  10589. if (error) {
  10590. errors.push(error);
  10591. }
  10592. });
  10593. }
  10594. });
  10595. }, Promise.resolve()).then(function () {
  10596. if (errors.length) {
  10597. reject(errors);
  10598. } else {
  10599. resolve();
  10600. }
  10601. });
  10602. });
  10603. },
  10604. validateFields: function validateFields(names) {
  10605. var _this2 = this;
  10606. return new Promise(function (resolve, reject) {
  10607. var fields = _this2.getFieldsByNames(names);
  10608. Promise.all(fields.map(function (item) {
  10609. return item.validate();
  10610. })).then(function (errors) {
  10611. errors = errors.filter(function (item) {
  10612. return item;
  10613. });
  10614. if (errors.length) {
  10615. reject(errors);
  10616. } else {
  10617. resolve();
  10618. }
  10619. });
  10620. });
  10621. },
  10622. // @exposed-api
  10623. validate: function validate(name) {
  10624. if (name && !Array.isArray(name)) {
  10625. return this.validateField(name);
  10626. }
  10627. return this.validateFirst ? this.validateSeq(name) : this.validateFields(name);
  10628. },
  10629. validateField: function validateField(name) {
  10630. var matched = this.fields.filter(function (item) {
  10631. return item.name === name;
  10632. });
  10633. if (matched.length) {
  10634. return new Promise(function (resolve, reject) {
  10635. matched[0].validate().then(function (error) {
  10636. if (error) {
  10637. reject(error);
  10638. } else {
  10639. resolve();
  10640. }
  10641. });
  10642. });
  10643. }
  10644. return Promise.reject();
  10645. },
  10646. // @exposed-api
  10647. resetValidation: function resetValidation(name) {
  10648. if (name && !Array.isArray(name)) {
  10649. name = [name];
  10650. }
  10651. var fields = this.getFieldsByNames(name);
  10652. fields.forEach(function (item) {
  10653. item.resetValidation();
  10654. });
  10655. },
  10656. // @exposed-api
  10657. scrollToField: function scrollToField(name, options) {
  10658. this.fields.some(function (item) {
  10659. if (item.name === name) {
  10660. item.$el.scrollIntoView(options);
  10661. return true;
  10662. }
  10663. return false;
  10664. });
  10665. },
  10666. addField: function addField(field) {
  10667. this.fields.push(field);
  10668. sortChildren(this.fields, this);
  10669. },
  10670. removeField: function removeField(field) {
  10671. this.fields = this.fields.filter(function (item) {
  10672. return item !== field;
  10673. });
  10674. },
  10675. getValues: function getValues() {
  10676. return this.fields.reduce(function (form, field) {
  10677. form[field.name] = field.formValue;
  10678. return form;
  10679. }, {});
  10680. },
  10681. onSubmit: function onSubmit(event) {
  10682. event.preventDefault();
  10683. this.submit();
  10684. },
  10685. // @exposed-api
  10686. submit: function submit() {
  10687. var _this3 = this;
  10688. var values = this.getValues();
  10689. this.validate().then(function () {
  10690. _this3.$emit('submit', values);
  10691. }).catch(function (errors) {
  10692. _this3.$emit('failed', {
  10693. values: values,
  10694. errors: errors
  10695. });
  10696. if (_this3.scrollToError) {
  10697. _this3.scrollToField(errors[0].name);
  10698. }
  10699. });
  10700. }
  10701. },
  10702. render: function render() {
  10703. var h = arguments[0];
  10704. return h("form", {
  10705. "class": form_bem(),
  10706. "on": {
  10707. "submit": this.onSubmit
  10708. }
  10709. }, [this.slots()]);
  10710. }
  10711. }));
  10712. // CONCATENATED MODULE: ./es/goods-action-icon/index.js
  10713. var goods_action_icon_createNamespace = Object(create["a" /* createNamespace */])('goods-action-icon'),
  10714. goods_action_icon_createComponent = goods_action_icon_createNamespace[0],
  10715. goods_action_icon_bem = goods_action_icon_createNamespace[1];
  10716. /* harmony default export */ var goods_action_icon = (goods_action_icon_createComponent({
  10717. mixins: [ChildrenMixin('vanGoodsAction')],
  10718. props: _extends({}, routeProps, {
  10719. dot: Boolean,
  10720. text: String,
  10721. icon: String,
  10722. color: String,
  10723. // @deprecated
  10724. info: [Number, String],
  10725. badge: [Number, String],
  10726. iconClass: null
  10727. }),
  10728. methods: {
  10729. onClick: function onClick(event) {
  10730. this.$emit('click', event);
  10731. route(this.$router, this);
  10732. },
  10733. genIcon: function genIcon() {
  10734. var _this$badge;
  10735. var h = this.$createElement;
  10736. var slot = this.slots('icon');
  10737. var info = (_this$badge = this.badge) != null ? _this$badge : this.info;
  10738. if (false) {}
  10739. if (slot) {
  10740. return h("div", {
  10741. "class": goods_action_icon_bem('icon')
  10742. }, [slot, h(es_info, {
  10743. "attrs": {
  10744. "dot": this.dot,
  10745. "info": info
  10746. }
  10747. })]);
  10748. }
  10749. return h(es_icon, {
  10750. "class": [goods_action_icon_bem('icon'), this.iconClass],
  10751. "attrs": {
  10752. "tag": "div",
  10753. "dot": this.dot,
  10754. "name": this.icon,
  10755. "badge": info,
  10756. "color": this.color
  10757. }
  10758. });
  10759. }
  10760. },
  10761. render: function render() {
  10762. var h = arguments[0];
  10763. return h("div", {
  10764. "attrs": {
  10765. "role": "button",
  10766. "tabindex": "0"
  10767. },
  10768. "class": goods_action_icon_bem(),
  10769. "on": {
  10770. "click": this.onClick
  10771. }
  10772. }, [this.genIcon(), this.slots() || this.text]);
  10773. }
  10774. }));
  10775. // CONCATENATED MODULE: ./es/grid/index.js
  10776. var grid_createNamespace = Object(create["a" /* createNamespace */])('grid'),
  10777. grid_createComponent = grid_createNamespace[0],
  10778. grid_bem = grid_createNamespace[1];
  10779. /* harmony default export */ var grid = (grid_createComponent({
  10780. mixins: [ParentMixin('vanGrid')],
  10781. props: {
  10782. square: Boolean,
  10783. gutter: [Number, String],
  10784. iconSize: [Number, String],
  10785. direction: String,
  10786. clickable: Boolean,
  10787. columnNum: {
  10788. type: [Number, String],
  10789. default: 4
  10790. },
  10791. center: {
  10792. type: Boolean,
  10793. default: true
  10794. },
  10795. border: {
  10796. type: Boolean,
  10797. default: true
  10798. }
  10799. },
  10800. computed: {
  10801. style: function style() {
  10802. var gutter = this.gutter;
  10803. if (gutter) {
  10804. return {
  10805. paddingLeft: Object(unit["a" /* addUnit */])(gutter)
  10806. };
  10807. }
  10808. }
  10809. },
  10810. render: function render() {
  10811. var _ref;
  10812. var h = arguments[0];
  10813. return h("div", {
  10814. "style": this.style,
  10815. "class": [grid_bem(), (_ref = {}, _ref[BORDER_TOP] = this.border && !this.gutter, _ref)]
  10816. }, [this.slots()]);
  10817. }
  10818. }));
  10819. // CONCATENATED MODULE: ./es/grid-item/index.js
  10820. // Utils
  10821. // Mixins
  10822. // Components
  10823. var grid_item_createNamespace = Object(create["a" /* createNamespace */])('grid-item'),
  10824. grid_item_createComponent = grid_item_createNamespace[0],
  10825. grid_item_bem = grid_item_createNamespace[1];
  10826. /* harmony default export */ var grid_item = (grid_item_createComponent({
  10827. mixins: [ChildrenMixin('vanGrid')],
  10828. props: _extends({}, routeProps, {
  10829. dot: Boolean,
  10830. text: String,
  10831. icon: String,
  10832. iconPrefix: String,
  10833. // @deprecated
  10834. info: [Number, String],
  10835. badge: [Number, String]
  10836. }),
  10837. computed: {
  10838. style: function style() {
  10839. var _this$parent = this.parent,
  10840. square = _this$parent.square,
  10841. gutter = _this$parent.gutter,
  10842. columnNum = _this$parent.columnNum;
  10843. var percent = 100 / columnNum + "%";
  10844. var style = {
  10845. flexBasis: percent
  10846. };
  10847. if (square) {
  10848. style.paddingTop = percent;
  10849. } else if (gutter) {
  10850. var gutterValue = Object(unit["a" /* addUnit */])(gutter);
  10851. style.paddingRight = gutterValue;
  10852. if (this.index >= columnNum) {
  10853. style.marginTop = gutterValue;
  10854. }
  10855. }
  10856. return style;
  10857. },
  10858. contentStyle: function contentStyle() {
  10859. var _this$parent2 = this.parent,
  10860. square = _this$parent2.square,
  10861. gutter = _this$parent2.gutter;
  10862. if (square && gutter) {
  10863. var gutterValue = Object(unit["a" /* addUnit */])(gutter);
  10864. return {
  10865. right: gutterValue,
  10866. bottom: gutterValue,
  10867. height: 'auto'
  10868. };
  10869. }
  10870. }
  10871. },
  10872. methods: {
  10873. onClick: function onClick(event) {
  10874. this.$emit('click', event);
  10875. route(this.$router, this);
  10876. },
  10877. genIcon: function genIcon() {
  10878. var _this$badge;
  10879. var h = this.$createElement;
  10880. var iconSlot = this.slots('icon');
  10881. var info = (_this$badge = this.badge) != null ? _this$badge : this.info;
  10882. if (false) {}
  10883. if (iconSlot) {
  10884. return h("div", {
  10885. "class": grid_item_bem('icon-wrapper')
  10886. }, [iconSlot, h(es_info, {
  10887. "attrs": {
  10888. "dot": this.dot,
  10889. "info": info
  10890. }
  10891. })]);
  10892. }
  10893. if (this.icon) {
  10894. return h(es_icon, {
  10895. "attrs": {
  10896. "name": this.icon,
  10897. "dot": this.dot,
  10898. "badge": info,
  10899. "size": this.parent.iconSize,
  10900. "classPrefix": this.iconPrefix
  10901. },
  10902. "class": grid_item_bem('icon')
  10903. });
  10904. }
  10905. },
  10906. getText: function getText() {
  10907. var h = this.$createElement;
  10908. var textSlot = this.slots('text');
  10909. if (textSlot) {
  10910. return textSlot;
  10911. }
  10912. if (this.text) {
  10913. return h("span", {
  10914. "class": grid_item_bem('text')
  10915. }, [this.text]);
  10916. }
  10917. },
  10918. genContent: function genContent() {
  10919. var slot = this.slots();
  10920. if (slot) {
  10921. return slot;
  10922. }
  10923. return [this.genIcon(), this.getText()];
  10924. }
  10925. },
  10926. render: function render() {
  10927. var _ref;
  10928. var h = arguments[0];
  10929. var _this$parent3 = this.parent,
  10930. center = _this$parent3.center,
  10931. border = _this$parent3.border,
  10932. square = _this$parent3.square,
  10933. gutter = _this$parent3.gutter,
  10934. direction = _this$parent3.direction,
  10935. clickable = _this$parent3.clickable;
  10936. return h("div", {
  10937. "class": [grid_item_bem({
  10938. square: square
  10939. })],
  10940. "style": this.style
  10941. }, [h("div", {
  10942. "style": this.contentStyle,
  10943. "attrs": {
  10944. "role": clickable ? 'button' : null,
  10945. "tabindex": clickable ? 0 : null
  10946. },
  10947. "class": [grid_item_bem('content', [direction, {
  10948. center: center,
  10949. square: square,
  10950. clickable: clickable,
  10951. surround: border && gutter
  10952. }]), (_ref = {}, _ref[BORDER] = border, _ref)],
  10953. "on": {
  10954. "click": this.onClick
  10955. }
  10956. }, [this.genContent()])]);
  10957. }
  10958. }));
  10959. // CONCATENATED MODULE: ./es/image-preview/shared.js
  10960. var shared_createNamespace = Object(create["a" /* createNamespace */])('image-preview'),
  10961. shared_createComponent = shared_createNamespace[0],
  10962. shared_bem = shared_createNamespace[1];
  10963. // CONCATENATED MODULE: ./es/swipe/index.js
  10964. // Utils
  10965. // Mixins
  10966. var swipe_createNamespace = Object(create["a" /* createNamespace */])('swipe'),
  10967. swipe_createComponent = swipe_createNamespace[0],
  10968. swipe_bem = swipe_createNamespace[1];
  10969. /* harmony default export */ var swipe = (swipe_createComponent({
  10970. mixins: [TouchMixin, ParentMixin('vanSwipe'), BindEventMixin(function (bind, isBind) {
  10971. bind(window, 'resize', this.resize, true);
  10972. bind(window, 'orientationchange', this.resize, true);
  10973. bind(window, 'visibilitychange', this.onVisibilityChange);
  10974. if (isBind) {
  10975. this.initialize();
  10976. } else {
  10977. this.clear();
  10978. }
  10979. })],
  10980. props: {
  10981. width: [Number, String],
  10982. height: [Number, String],
  10983. autoplay: [Number, String],
  10984. vertical: Boolean,
  10985. lazyRender: Boolean,
  10986. indicatorColor: String,
  10987. loop: {
  10988. type: Boolean,
  10989. default: true
  10990. },
  10991. duration: {
  10992. type: [Number, String],
  10993. default: 500
  10994. },
  10995. touchable: {
  10996. type: Boolean,
  10997. default: true
  10998. },
  10999. initialSwipe: {
  11000. type: [Number, String],
  11001. default: 0
  11002. },
  11003. showIndicators: {
  11004. type: Boolean,
  11005. default: true
  11006. },
  11007. stopPropagation: {
  11008. type: Boolean,
  11009. default: true
  11010. }
  11011. },
  11012. data: function data() {
  11013. return {
  11014. rect: null,
  11015. offset: 0,
  11016. active: 0,
  11017. deltaX: 0,
  11018. deltaY: 0,
  11019. swiping: false,
  11020. computedWidth: 0,
  11021. computedHeight: 0
  11022. };
  11023. },
  11024. watch: {
  11025. children: function children() {
  11026. this.initialize();
  11027. },
  11028. initialSwipe: function initialSwipe() {
  11029. this.initialize();
  11030. },
  11031. autoplay: function autoplay(_autoplay) {
  11032. if (_autoplay > 0) {
  11033. this.autoPlay();
  11034. } else {
  11035. this.clear();
  11036. }
  11037. }
  11038. },
  11039. computed: {
  11040. count: function count() {
  11041. return this.children.length;
  11042. },
  11043. maxCount: function maxCount() {
  11044. return Math.ceil(Math.abs(this.minOffset) / this.size);
  11045. },
  11046. delta: function delta() {
  11047. return this.vertical ? this.deltaY : this.deltaX;
  11048. },
  11049. size: function size() {
  11050. return this[this.vertical ? 'computedHeight' : 'computedWidth'];
  11051. },
  11052. trackSize: function trackSize() {
  11053. return this.count * this.size;
  11054. },
  11055. activeIndicator: function activeIndicator() {
  11056. return (this.active + this.count) % this.count;
  11057. },
  11058. isCorrectDirection: function isCorrectDirection() {
  11059. var expect = this.vertical ? 'vertical' : 'horizontal';
  11060. return this.direction === expect;
  11061. },
  11062. trackStyle: function trackStyle() {
  11063. var style = {
  11064. transitionDuration: (this.swiping ? 0 : this.duration) + "ms",
  11065. transform: "translate" + (this.vertical ? 'Y' : 'X') + "(" + this.offset + "px)"
  11066. };
  11067. if (this.size) {
  11068. var mainAxis = this.vertical ? 'height' : 'width';
  11069. var crossAxis = this.vertical ? 'width' : 'height';
  11070. style[mainAxis] = this.trackSize + "px";
  11071. style[crossAxis] = this[crossAxis] ? this[crossAxis] + "px" : '';
  11072. }
  11073. return style;
  11074. },
  11075. indicatorStyle: function indicatorStyle() {
  11076. return {
  11077. backgroundColor: this.indicatorColor
  11078. };
  11079. },
  11080. minOffset: function minOffset() {
  11081. return (this.vertical ? this.rect.height : this.rect.width) - this.size * this.count;
  11082. }
  11083. },
  11084. mounted: function mounted() {
  11085. this.bindTouchEvent(this.$refs.track);
  11086. },
  11087. methods: {
  11088. // initialize swipe position
  11089. initialize: function initialize(active) {
  11090. if (active === void 0) {
  11091. active = +this.initialSwipe;
  11092. }
  11093. if (!this.$el || isHidden(this.$el)) {
  11094. return;
  11095. }
  11096. clearTimeout(this.timer);
  11097. var rect = {
  11098. width: this.$el.offsetWidth,
  11099. height: this.$el.offsetHeight
  11100. };
  11101. this.rect = rect;
  11102. this.swiping = true;
  11103. this.active = active;
  11104. this.computedWidth = +this.width || rect.width;
  11105. this.computedHeight = +this.height || rect.height;
  11106. this.offset = this.getTargetOffset(active);
  11107. this.children.forEach(function (swipe) {
  11108. swipe.offset = 0;
  11109. });
  11110. this.autoPlay();
  11111. },
  11112. // @exposed-api
  11113. resize: function resize() {
  11114. this.initialize(this.activeIndicator);
  11115. },
  11116. onVisibilityChange: function onVisibilityChange() {
  11117. if (document.hidden) {
  11118. this.clear();
  11119. } else {
  11120. this.autoPlay();
  11121. }
  11122. },
  11123. onTouchStart: function onTouchStart(event) {
  11124. if (!this.touchable) return;
  11125. this.clear();
  11126. this.touchStartTime = Date.now();
  11127. this.touchStart(event);
  11128. this.correctPosition();
  11129. },
  11130. onTouchMove: function onTouchMove(event) {
  11131. if (!this.touchable || !this.swiping) return;
  11132. this.touchMove(event);
  11133. if (this.isCorrectDirection) {
  11134. preventDefault(event, this.stopPropagation);
  11135. this.move({
  11136. offset: this.delta
  11137. });
  11138. }
  11139. },
  11140. onTouchEnd: function onTouchEnd() {
  11141. if (!this.touchable || !this.swiping) return;
  11142. var size = this.size,
  11143. delta = this.delta;
  11144. var duration = Date.now() - this.touchStartTime;
  11145. var speed = delta / duration;
  11146. var shouldSwipe = Math.abs(speed) > 0.25 || Math.abs(delta) > size / 2;
  11147. if (shouldSwipe && this.isCorrectDirection) {
  11148. var offset = this.vertical ? this.offsetY : this.offsetX;
  11149. var pace = 0;
  11150. if (this.loop) {
  11151. pace = offset > 0 ? delta > 0 ? -1 : 1 : 0;
  11152. } else {
  11153. pace = -Math[delta > 0 ? 'ceil' : 'floor'](delta / size);
  11154. }
  11155. this.move({
  11156. pace: pace,
  11157. emitChange: true
  11158. });
  11159. } else if (delta) {
  11160. this.move({
  11161. pace: 0
  11162. });
  11163. }
  11164. this.swiping = false;
  11165. this.autoPlay();
  11166. },
  11167. getTargetActive: function getTargetActive(pace) {
  11168. var active = this.active,
  11169. count = this.count,
  11170. maxCount = this.maxCount;
  11171. if (pace) {
  11172. if (this.loop) {
  11173. return range(active + pace, -1, count);
  11174. }
  11175. return range(active + pace, 0, maxCount);
  11176. }
  11177. return active;
  11178. },
  11179. getTargetOffset: function getTargetOffset(targetActive, offset) {
  11180. if (offset === void 0) {
  11181. offset = 0;
  11182. }
  11183. var currentPosition = targetActive * this.size;
  11184. if (!this.loop) {
  11185. currentPosition = Math.min(currentPosition, -this.minOffset);
  11186. }
  11187. var targetOffset = offset - currentPosition;
  11188. if (!this.loop) {
  11189. targetOffset = range(targetOffset, this.minOffset, 0);
  11190. }
  11191. return targetOffset;
  11192. },
  11193. move: function move(_ref) {
  11194. var _ref$pace = _ref.pace,
  11195. pace = _ref$pace === void 0 ? 0 : _ref$pace,
  11196. _ref$offset = _ref.offset,
  11197. offset = _ref$offset === void 0 ? 0 : _ref$offset,
  11198. emitChange = _ref.emitChange;
  11199. var loop = this.loop,
  11200. count = this.count,
  11201. active = this.active,
  11202. children = this.children,
  11203. trackSize = this.trackSize,
  11204. minOffset = this.minOffset;
  11205. if (count <= 1) {
  11206. return;
  11207. }
  11208. var targetActive = this.getTargetActive(pace);
  11209. var targetOffset = this.getTargetOffset(targetActive, offset); // auto move first and last swipe in loop mode
  11210. if (loop) {
  11211. if (children[0] && targetOffset !== minOffset) {
  11212. var outRightBound = targetOffset < minOffset;
  11213. children[0].offset = outRightBound ? trackSize : 0;
  11214. }
  11215. if (children[count - 1] && targetOffset !== 0) {
  11216. var outLeftBound = targetOffset > 0;
  11217. children[count - 1].offset = outLeftBound ? -trackSize : 0;
  11218. }
  11219. }
  11220. this.active = targetActive;
  11221. this.offset = targetOffset;
  11222. if (emitChange && targetActive !== active) {
  11223. this.$emit('change', this.activeIndicator);
  11224. }
  11225. },
  11226. // @exposed-api
  11227. prev: function prev() {
  11228. var _this = this;
  11229. this.correctPosition();
  11230. this.resetTouchStatus();
  11231. Object(raf["b" /* doubleRaf */])(function () {
  11232. _this.swiping = false;
  11233. _this.move({
  11234. pace: -1,
  11235. emitChange: true
  11236. });
  11237. });
  11238. },
  11239. // @exposed-api
  11240. next: function next() {
  11241. var _this2 = this;
  11242. this.correctPosition();
  11243. this.resetTouchStatus();
  11244. Object(raf["b" /* doubleRaf */])(function () {
  11245. _this2.swiping = false;
  11246. _this2.move({
  11247. pace: 1,
  11248. emitChange: true
  11249. });
  11250. });
  11251. },
  11252. // @exposed-api
  11253. swipeTo: function swipeTo(index, options) {
  11254. var _this3 = this;
  11255. if (options === void 0) {
  11256. options = {};
  11257. }
  11258. this.correctPosition();
  11259. this.resetTouchStatus();
  11260. Object(raf["b" /* doubleRaf */])(function () {
  11261. var targetIndex;
  11262. if (_this3.loop && index === _this3.count) {
  11263. targetIndex = _this3.active === 0 ? 0 : index;
  11264. } else {
  11265. targetIndex = index % _this3.count;
  11266. }
  11267. if (options.immediate) {
  11268. Object(raf["b" /* doubleRaf */])(function () {
  11269. _this3.swiping = false;
  11270. });
  11271. } else {
  11272. _this3.swiping = false;
  11273. }
  11274. _this3.move({
  11275. pace: targetIndex - _this3.active,
  11276. emitChange: true
  11277. });
  11278. });
  11279. },
  11280. correctPosition: function correctPosition() {
  11281. this.swiping = true;
  11282. if (this.active <= -1) {
  11283. this.move({
  11284. pace: this.count
  11285. });
  11286. }
  11287. if (this.active >= this.count) {
  11288. this.move({
  11289. pace: -this.count
  11290. });
  11291. }
  11292. },
  11293. clear: function clear() {
  11294. clearTimeout(this.timer);
  11295. },
  11296. autoPlay: function autoPlay() {
  11297. var _this4 = this;
  11298. var autoplay = this.autoplay;
  11299. if (autoplay > 0 && this.count > 1) {
  11300. this.clear();
  11301. this.timer = setTimeout(function () {
  11302. _this4.next();
  11303. _this4.autoPlay();
  11304. }, autoplay);
  11305. }
  11306. },
  11307. genIndicator: function genIndicator() {
  11308. var _this5 = this;
  11309. var h = this.$createElement;
  11310. var count = this.count,
  11311. activeIndicator = this.activeIndicator;
  11312. var slot = this.slots('indicator');
  11313. if (slot) {
  11314. return slot;
  11315. }
  11316. if (this.showIndicators && count > 1) {
  11317. return h("div", {
  11318. "class": swipe_bem('indicators', {
  11319. vertical: this.vertical
  11320. })
  11321. }, [Array.apply(void 0, Array(count)).map(function (empty, index) {
  11322. return h("i", {
  11323. "class": swipe_bem('indicator', {
  11324. active: index === activeIndicator
  11325. }),
  11326. "style": index === activeIndicator ? _this5.indicatorStyle : null
  11327. });
  11328. })]);
  11329. }
  11330. }
  11331. },
  11332. render: function render() {
  11333. var h = arguments[0];
  11334. return h("div", {
  11335. "class": swipe_bem()
  11336. }, [h("div", {
  11337. "ref": "track",
  11338. "style": this.trackStyle,
  11339. "class": swipe_bem('track', {
  11340. vertical: this.vertical
  11341. })
  11342. }, [this.slots()]), this.genIndicator()]);
  11343. }
  11344. }));
  11345. // CONCATENATED MODULE: ./es/swipe-item/index.js
  11346. var swipe_item_createNamespace = Object(create["a" /* createNamespace */])('swipe-item'),
  11347. swipe_item_createComponent = swipe_item_createNamespace[0],
  11348. swipe_item_bem = swipe_item_createNamespace[1];
  11349. /* harmony default export */ var swipe_item = (swipe_item_createComponent({
  11350. mixins: [ChildrenMixin('vanSwipe')],
  11351. data: function data() {
  11352. return {
  11353. offset: 0,
  11354. inited: false,
  11355. mounted: false
  11356. };
  11357. },
  11358. mounted: function mounted() {
  11359. var _this = this;
  11360. this.$nextTick(function () {
  11361. _this.mounted = true;
  11362. });
  11363. },
  11364. computed: {
  11365. style: function style() {
  11366. var style = {};
  11367. var _this$parent = this.parent,
  11368. size = _this$parent.size,
  11369. vertical = _this$parent.vertical;
  11370. if (size) {
  11371. style[vertical ? 'height' : 'width'] = size + "px";
  11372. }
  11373. if (this.offset) {
  11374. style.transform = "translate" + (vertical ? 'Y' : 'X') + "(" + this.offset + "px)";
  11375. }
  11376. return style;
  11377. },
  11378. shouldRender: function shouldRender() {
  11379. var index = this.index,
  11380. inited = this.inited,
  11381. parent = this.parent,
  11382. mounted = this.mounted;
  11383. if (!parent.lazyRender || inited) {
  11384. return true;
  11385. } // wait for all item to mount, so we can get the exact count
  11386. if (!mounted) {
  11387. return false;
  11388. }
  11389. var active = parent.activeIndicator;
  11390. var maxActive = parent.count - 1;
  11391. var prevActive = active === 0 && parent.loop ? maxActive : active - 1;
  11392. var nextActive = active === maxActive && parent.loop ? 0 : active + 1;
  11393. var shouldRender = index === active || index === prevActive || index === nextActive;
  11394. if (shouldRender) {
  11395. this.inited = true;
  11396. }
  11397. return shouldRender;
  11398. }
  11399. },
  11400. render: function render() {
  11401. var h = arguments[0];
  11402. return h("div", {
  11403. "class": swipe_item_bem(),
  11404. "style": this.style,
  11405. "on": _extends({}, this.$listeners)
  11406. }, [this.shouldRender && this.slots()]);
  11407. }
  11408. }));
  11409. // CONCATENATED MODULE: ./es/image-preview/ImagePreviewItem.js
  11410. // Utils
  11411. // Mixins
  11412. // Component
  11413. function getDistance(touches) {
  11414. return Math.sqrt(Math.pow(touches[0].clientX - touches[1].clientX, 2) + Math.pow(touches[0].clientY - touches[1].clientY, 2));
  11415. }
  11416. /* harmony default export */ var ImagePreviewItem = ({
  11417. mixins: [TouchMixin],
  11418. props: {
  11419. src: String,
  11420. show: Boolean,
  11421. active: Number,
  11422. minZoom: [Number, String],
  11423. maxZoom: [Number, String],
  11424. rootWidth: Number,
  11425. rootHeight: Number
  11426. },
  11427. data: function data() {
  11428. return {
  11429. scale: 1,
  11430. moveX: 0,
  11431. moveY: 0,
  11432. moving: false,
  11433. zooming: false,
  11434. imageRatio: 0,
  11435. displayWidth: 0,
  11436. displayHeight: 0
  11437. };
  11438. },
  11439. computed: {
  11440. vertical: function vertical() {
  11441. var rootWidth = this.rootWidth,
  11442. rootHeight = this.rootHeight;
  11443. var rootRatio = rootHeight / rootWidth;
  11444. return this.imageRatio > rootRatio;
  11445. },
  11446. imageStyle: function imageStyle() {
  11447. var scale = this.scale;
  11448. var style = {
  11449. transitionDuration: this.zooming || this.moving ? '0s' : '.3s'
  11450. };
  11451. if (scale !== 1) {
  11452. var offsetX = this.moveX / scale;
  11453. var offsetY = this.moveY / scale;
  11454. style.transform = "scale(" + scale + ", " + scale + ") translate(" + offsetX + "px, " + offsetY + "px)";
  11455. }
  11456. return style;
  11457. },
  11458. maxMoveX: function maxMoveX() {
  11459. if (this.imageRatio) {
  11460. var displayWidth = this.vertical ? this.rootHeight / this.imageRatio : this.rootWidth;
  11461. return Math.max(0, (this.scale * displayWidth - this.rootWidth) / 2);
  11462. }
  11463. return 0;
  11464. },
  11465. maxMoveY: function maxMoveY() {
  11466. if (this.imageRatio) {
  11467. var displayHeight = this.vertical ? this.rootHeight : this.rootWidth * this.imageRatio;
  11468. return Math.max(0, (this.scale * displayHeight - this.rootHeight) / 2);
  11469. }
  11470. return 0;
  11471. }
  11472. },
  11473. watch: {
  11474. active: 'resetScale',
  11475. show: function show(val) {
  11476. if (!val) {
  11477. this.resetScale();
  11478. }
  11479. }
  11480. },
  11481. mounted: function mounted() {
  11482. this.bindTouchEvent(this.$el);
  11483. },
  11484. methods: {
  11485. resetScale: function resetScale() {
  11486. this.setScale(1);
  11487. this.moveX = 0;
  11488. this.moveY = 0;
  11489. },
  11490. setScale: function setScale(scale) {
  11491. scale = range(scale, +this.minZoom, +this.maxZoom);
  11492. if (scale !== this.scale) {
  11493. this.scale = scale;
  11494. this.$emit('scale', {
  11495. scale: this.scale,
  11496. index: this.active
  11497. });
  11498. }
  11499. },
  11500. toggleScale: function toggleScale() {
  11501. var scale = this.scale > 1 ? 1 : 2;
  11502. this.setScale(scale);
  11503. this.moveX = 0;
  11504. this.moveY = 0;
  11505. },
  11506. onTouchStart: function onTouchStart(event) {
  11507. var touches = event.touches;
  11508. var _this$offsetX = this.offsetX,
  11509. offsetX = _this$offsetX === void 0 ? 0 : _this$offsetX;
  11510. this.touchStart(event);
  11511. this.touchStartTime = new Date();
  11512. this.startMoveX = this.moveX;
  11513. this.startMoveY = this.moveY;
  11514. this.moving = touches.length === 1 && this.scale !== 1;
  11515. this.zooming = touches.length === 2 && !offsetX;
  11516. if (this.zooming) {
  11517. this.startScale = this.scale;
  11518. this.startDistance = getDistance(event.touches);
  11519. }
  11520. },
  11521. onTouchMove: function onTouchMove(event) {
  11522. var touches = event.touches;
  11523. this.touchMove(event);
  11524. if (this.moving || this.zooming) {
  11525. preventDefault(event, true);
  11526. }
  11527. if (this.moving) {
  11528. var moveX = this.deltaX + this.startMoveX;
  11529. var moveY = this.deltaY + this.startMoveY;
  11530. this.moveX = range(moveX, -this.maxMoveX, this.maxMoveX);
  11531. this.moveY = range(moveY, -this.maxMoveY, this.maxMoveY);
  11532. }
  11533. if (this.zooming && touches.length === 2) {
  11534. var distance = getDistance(touches);
  11535. var scale = this.startScale * distance / this.startDistance;
  11536. this.setScale(scale);
  11537. }
  11538. },
  11539. onTouchEnd: function onTouchEnd(event) {
  11540. var stopPropagation = false;
  11541. /* istanbul ignore else */
  11542. if (this.moving || this.zooming) {
  11543. stopPropagation = true;
  11544. if (this.moving && this.startMoveX === this.moveX && this.startMoveY === this.moveY) {
  11545. stopPropagation = false;
  11546. }
  11547. if (!event.touches.length) {
  11548. if (this.zooming) {
  11549. this.moveX = range(this.moveX, -this.maxMoveX, this.maxMoveX);
  11550. this.moveY = range(this.moveY, -this.maxMoveY, this.maxMoveY);
  11551. this.zooming = false;
  11552. }
  11553. this.moving = false;
  11554. this.startMoveX = 0;
  11555. this.startMoveY = 0;
  11556. this.startScale = 1;
  11557. if (this.scale < 1) {
  11558. this.resetScale();
  11559. }
  11560. }
  11561. } // eliminate tap delay on safari
  11562. preventDefault(event, stopPropagation);
  11563. this.checkTap();
  11564. this.resetTouchStatus();
  11565. },
  11566. checkTap: function checkTap() {
  11567. var _this = this;
  11568. var _this$offsetX2 = this.offsetX,
  11569. offsetX = _this$offsetX2 === void 0 ? 0 : _this$offsetX2,
  11570. _this$offsetY = this.offsetY,
  11571. offsetY = _this$offsetY === void 0 ? 0 : _this$offsetY;
  11572. var deltaTime = new Date() - this.touchStartTime;
  11573. var TAP_TIME = 250;
  11574. var TAP_OFFSET = 10;
  11575. if (offsetX < TAP_OFFSET && offsetY < TAP_OFFSET && deltaTime < TAP_TIME) {
  11576. if (this.doubleTapTimer) {
  11577. clearTimeout(this.doubleTapTimer);
  11578. this.doubleTapTimer = null;
  11579. this.toggleScale();
  11580. } else {
  11581. this.doubleTapTimer = setTimeout(function () {
  11582. _this.$emit('close');
  11583. _this.doubleTapTimer = null;
  11584. }, TAP_TIME);
  11585. }
  11586. }
  11587. },
  11588. onLoad: function onLoad(event) {
  11589. var _event$target = event.target,
  11590. naturalWidth = _event$target.naturalWidth,
  11591. naturalHeight = _event$target.naturalHeight;
  11592. this.imageRatio = naturalHeight / naturalWidth;
  11593. }
  11594. },
  11595. render: function render() {
  11596. var h = arguments[0];
  11597. var imageSlots = {
  11598. loading: function loading() {
  11599. return h(es_loading, {
  11600. "attrs": {
  11601. "type": "spinner"
  11602. }
  11603. });
  11604. }
  11605. };
  11606. return h(swipe_item, {
  11607. "class": shared_bem('swipe-item')
  11608. }, [h(es_image, {
  11609. "attrs": {
  11610. "src": this.src,
  11611. "fit": "contain"
  11612. },
  11613. "class": shared_bem('image', {
  11614. vertical: this.vertical
  11615. }),
  11616. "style": this.imageStyle,
  11617. "scopedSlots": imageSlots,
  11618. "on": {
  11619. "load": this.onLoad
  11620. }
  11621. })]);
  11622. }
  11623. });
  11624. // CONCATENATED MODULE: ./es/image-preview/ImagePreview.js
  11625. // Utils
  11626. // Mixins
  11627. // Components
  11628. /* harmony default export */ var image_preview_ImagePreview = (shared_createComponent({
  11629. mixins: [TouchMixin, PopupMixin({
  11630. skipToggleEvent: true
  11631. }), BindEventMixin(function (bind) {
  11632. bind(window, 'resize', this.resize, true);
  11633. bind(window, 'orientationchange', this.resize, true);
  11634. })],
  11635. props: {
  11636. className: null,
  11637. closeable: Boolean,
  11638. asyncClose: Boolean,
  11639. showIndicators: Boolean,
  11640. images: {
  11641. type: Array,
  11642. default: function _default() {
  11643. return [];
  11644. }
  11645. },
  11646. loop: {
  11647. type: Boolean,
  11648. default: true
  11649. },
  11650. overlay: {
  11651. type: Boolean,
  11652. default: true
  11653. },
  11654. minZoom: {
  11655. type: [Number, String],
  11656. default: 1 / 3
  11657. },
  11658. maxZoom: {
  11659. type: [Number, String],
  11660. default: 3
  11661. },
  11662. transition: {
  11663. type: String,
  11664. default: 'van-fade'
  11665. },
  11666. showIndex: {
  11667. type: Boolean,
  11668. default: true
  11669. },
  11670. swipeDuration: {
  11671. type: [Number, String],
  11672. default: 300
  11673. },
  11674. startPosition: {
  11675. type: [Number, String],
  11676. default: 0
  11677. },
  11678. overlayClass: {
  11679. type: String,
  11680. default: shared_bem('overlay')
  11681. },
  11682. closeIcon: {
  11683. type: String,
  11684. default: 'clear'
  11685. },
  11686. closeOnPopstate: {
  11687. type: Boolean,
  11688. default: true
  11689. },
  11690. closeIconPosition: {
  11691. type: String,
  11692. default: 'top-right'
  11693. }
  11694. },
  11695. data: function data() {
  11696. return {
  11697. active: 0,
  11698. rootWidth: 0,
  11699. rootHeight: 0,
  11700. doubleClickTimer: null
  11701. };
  11702. },
  11703. mounted: function mounted() {
  11704. this.resize();
  11705. },
  11706. watch: {
  11707. startPosition: 'setActive',
  11708. value: function value(val) {
  11709. var _this = this;
  11710. if (val) {
  11711. this.setActive(+this.startPosition);
  11712. this.$nextTick(function () {
  11713. _this.resize();
  11714. _this.$refs.swipe.swipeTo(+_this.startPosition, {
  11715. immediate: true
  11716. });
  11717. });
  11718. } else {
  11719. this.$emit('close', {
  11720. index: this.active,
  11721. url: this.images[this.active]
  11722. });
  11723. }
  11724. }
  11725. },
  11726. methods: {
  11727. resize: function resize() {
  11728. if (this.$el && this.$el.getBoundingClientRect) {
  11729. var rect = this.$el.getBoundingClientRect();
  11730. this.rootWidth = rect.width;
  11731. this.rootHeight = rect.height;
  11732. }
  11733. },
  11734. emitClose: function emitClose() {
  11735. if (!this.asyncClose) {
  11736. this.$emit('input', false);
  11737. }
  11738. },
  11739. emitScale: function emitScale(args) {
  11740. this.$emit('scale', args);
  11741. },
  11742. setActive: function setActive(active) {
  11743. if (active !== this.active) {
  11744. this.active = active;
  11745. this.$emit('change', active);
  11746. }
  11747. },
  11748. genIndex: function genIndex() {
  11749. var h = this.$createElement;
  11750. if (this.showIndex) {
  11751. return h("div", {
  11752. "class": shared_bem('index')
  11753. }, [this.slots('index', {
  11754. index: this.active
  11755. }) || this.active + 1 + " / " + this.images.length]);
  11756. }
  11757. },
  11758. genCover: function genCover() {
  11759. var h = this.$createElement;
  11760. var cover = this.slots('cover');
  11761. if (cover) {
  11762. return h("div", {
  11763. "class": shared_bem('cover')
  11764. }, [cover]);
  11765. }
  11766. },
  11767. genImages: function genImages() {
  11768. var _this2 = this;
  11769. var h = this.$createElement;
  11770. return h(swipe, {
  11771. "ref": "swipe",
  11772. "attrs": {
  11773. "lazyRender": true,
  11774. "loop": this.loop,
  11775. "duration": this.swipeDuration,
  11776. "initialSwipe": this.startPosition,
  11777. "showIndicators": this.showIndicators,
  11778. "indicatorColor": "white"
  11779. },
  11780. "class": shared_bem('swipe'),
  11781. "on": {
  11782. "change": this.setActive
  11783. }
  11784. }, [this.images.map(function (image) {
  11785. return h(ImagePreviewItem, {
  11786. "attrs": {
  11787. "src": image,
  11788. "show": _this2.value,
  11789. "active": _this2.active,
  11790. "maxZoom": _this2.maxZoom,
  11791. "minZoom": _this2.minZoom,
  11792. "rootWidth": _this2.rootWidth,
  11793. "rootHeight": _this2.rootHeight
  11794. },
  11795. "on": {
  11796. "scale": _this2.emitScale,
  11797. "close": _this2.emitClose
  11798. }
  11799. });
  11800. })]);
  11801. },
  11802. genClose: function genClose() {
  11803. var h = this.$createElement;
  11804. if (this.closeable) {
  11805. return h(es_icon, {
  11806. "attrs": {
  11807. "role": "button",
  11808. "name": this.closeIcon
  11809. },
  11810. "class": shared_bem('close-icon', this.closeIconPosition),
  11811. "on": {
  11812. "click": this.emitClose
  11813. }
  11814. });
  11815. }
  11816. },
  11817. onClosed: function onClosed() {
  11818. this.$emit('closed');
  11819. },
  11820. // @exposed-api
  11821. swipeTo: function swipeTo(index, options) {
  11822. if (this.$refs.swipe) {
  11823. this.$refs.swipe.swipeTo(index, options);
  11824. }
  11825. }
  11826. },
  11827. render: function render() {
  11828. var h = arguments[0];
  11829. return h("transition", {
  11830. "attrs": {
  11831. "name": this.transition
  11832. },
  11833. "on": {
  11834. "afterLeave": this.onClosed
  11835. }
  11836. }, [this.shouldRender ? h("div", {
  11837. "directives": [{
  11838. name: "show",
  11839. value: this.value
  11840. }],
  11841. "class": [shared_bem(), this.className]
  11842. }, [this.genClose(), this.genImages(), this.genIndex(), this.genCover()]) : null]);
  11843. }
  11844. }));
  11845. // CONCATENATED MODULE: ./es/image-preview/index.js
  11846. var image_preview_instance;
  11847. var image_preview_defaultConfig = {
  11848. loop: true,
  11849. value: true,
  11850. images: [],
  11851. maxZoom: 3,
  11852. minZoom: 1 / 3,
  11853. onClose: null,
  11854. onChange: null,
  11855. className: '',
  11856. showIndex: true,
  11857. closeable: false,
  11858. closeIcon: 'clear',
  11859. asyncClose: false,
  11860. transition: 'van-fade',
  11861. getContainer: 'body',
  11862. startPosition: 0,
  11863. swipeDuration: 300,
  11864. showIndicators: false,
  11865. closeOnPopstate: true,
  11866. closeIconPosition: 'top-right'
  11867. };
  11868. var image_preview_initInstance = function initInstance() {
  11869. image_preview_instance = new (external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a.extend(image_preview_ImagePreview))({
  11870. el: document.createElement('div')
  11871. });
  11872. document.body.appendChild(image_preview_instance.$el);
  11873. image_preview_instance.$on('change', function (index) {
  11874. if (image_preview_instance.onChange) {
  11875. image_preview_instance.onChange(index);
  11876. }
  11877. });
  11878. image_preview_instance.$on('scale', function (data) {
  11879. if (image_preview_instance.onScale) {
  11880. image_preview_instance.onScale(data);
  11881. }
  11882. });
  11883. };
  11884. var es_image_preview_ImagePreview = function ImagePreview(images, startPosition) {
  11885. if (startPosition === void 0) {
  11886. startPosition = 0;
  11887. }
  11888. /* istanbul ignore if */
  11889. if (utils["h" /* isServer */]) {
  11890. return;
  11891. }
  11892. if (!image_preview_instance) {
  11893. image_preview_initInstance();
  11894. }
  11895. var options = Array.isArray(images) ? {
  11896. images: images,
  11897. startPosition: startPosition
  11898. } : images;
  11899. _extends(image_preview_instance, image_preview_defaultConfig, options);
  11900. image_preview_instance.$once('input', function (show) {
  11901. image_preview_instance.value = show;
  11902. });
  11903. image_preview_instance.$once('closed', function () {
  11904. image_preview_instance.images = [];
  11905. });
  11906. if (options.onClose) {
  11907. image_preview_instance.$off('close');
  11908. image_preview_instance.$once('close', options.onClose);
  11909. }
  11910. return image_preview_instance;
  11911. };
  11912. es_image_preview_ImagePreview.Component = image_preview_ImagePreview;
  11913. es_image_preview_ImagePreview.install = function () {
  11914. external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a.use(image_preview_ImagePreview);
  11915. };
  11916. /* harmony default export */ var image_preview = (es_image_preview_ImagePreview);
  11917. // CONCATENATED MODULE: ./es/index-anchor/index.js
  11918. var index_anchor_createNamespace = Object(create["a" /* createNamespace */])('index-anchor'),
  11919. index_anchor_createComponent = index_anchor_createNamespace[0],
  11920. index_anchor_bem = index_anchor_createNamespace[1];
  11921. /* harmony default export */ var index_anchor = (index_anchor_createComponent({
  11922. mixins: [ChildrenMixin('vanIndexBar', {
  11923. indexKey: 'childrenIndex'
  11924. })],
  11925. props: {
  11926. index: [Number, String]
  11927. },
  11928. data: function data() {
  11929. return {
  11930. top: 0,
  11931. left: null,
  11932. rect: {
  11933. top: 0,
  11934. height: 0
  11935. },
  11936. width: null,
  11937. active: false
  11938. };
  11939. },
  11940. computed: {
  11941. sticky: function sticky() {
  11942. return this.active && this.parent.sticky;
  11943. },
  11944. anchorStyle: function anchorStyle() {
  11945. if (this.sticky) {
  11946. return {
  11947. zIndex: "" + this.parent.zIndex,
  11948. left: this.left ? this.left + "px" : null,
  11949. width: this.width ? this.width + "px" : null,
  11950. transform: "translate3d(0, " + this.top + "px, 0)",
  11951. color: this.parent.highlightColor
  11952. };
  11953. }
  11954. }
  11955. },
  11956. mounted: function mounted() {
  11957. var rect = this.$el.getBoundingClientRect();
  11958. this.rect.height = rect.height;
  11959. },
  11960. methods: {
  11961. scrollIntoView: function scrollIntoView() {
  11962. this.$el.scrollIntoView();
  11963. },
  11964. getRect: function getRect(scroller, scrollerRect) {
  11965. var el = this.$el;
  11966. var elRect = el.getBoundingClientRect();
  11967. this.rect.height = elRect.height;
  11968. if (scroller === window || scroller === document.body) {
  11969. this.rect.top = elRect.top + getRootScrollTop();
  11970. } else {
  11971. this.rect.top = elRect.top + getScrollTop(scroller) - scrollerRect.top;
  11972. }
  11973. return this.rect;
  11974. }
  11975. },
  11976. render: function render() {
  11977. var _ref;
  11978. var h = arguments[0];
  11979. var sticky = this.sticky;
  11980. return h("div", {
  11981. "style": {
  11982. height: sticky ? this.rect.height + "px" : null
  11983. }
  11984. }, [h("div", {
  11985. "style": this.anchorStyle,
  11986. "class": [index_anchor_bem({
  11987. sticky: sticky
  11988. }), (_ref = {}, _ref[BORDER_BOTTOM] = sticky, _ref)]
  11989. }, [this.slots('default') || this.index])]);
  11990. }
  11991. }));
  11992. // CONCATENATED MODULE: ./es/index-bar/index.js
  11993. // Utils
  11994. // Mixins
  11995. function genAlphabet() {
  11996. var indexList = [];
  11997. var charCodeOfA = 'A'.charCodeAt(0);
  11998. for (var i = 0; i < 26; i++) {
  11999. indexList.push(String.fromCharCode(charCodeOfA + i));
  12000. }
  12001. return indexList;
  12002. }
  12003. var index_bar_createNamespace = Object(create["a" /* createNamespace */])('index-bar'),
  12004. index_bar_createComponent = index_bar_createNamespace[0],
  12005. index_bar_bem = index_bar_createNamespace[1];
  12006. /* harmony default export */ var index_bar = (index_bar_createComponent({
  12007. mixins: [TouchMixin, ParentMixin('vanIndexBar'), BindEventMixin(function (bind) {
  12008. if (!this.scroller) {
  12009. this.scroller = getScroller(this.$el);
  12010. }
  12011. bind(this.scroller, 'scroll', this.onScroll);
  12012. })],
  12013. props: {
  12014. zIndex: [Number, String],
  12015. highlightColor: String,
  12016. sticky: {
  12017. type: Boolean,
  12018. default: true
  12019. },
  12020. stickyOffsetTop: {
  12021. type: Number,
  12022. default: 0
  12023. },
  12024. indexList: {
  12025. type: Array,
  12026. default: genAlphabet
  12027. }
  12028. },
  12029. data: function data() {
  12030. return {
  12031. activeAnchorIndex: null
  12032. };
  12033. },
  12034. computed: {
  12035. sidebarStyle: function sidebarStyle() {
  12036. if (Object(utils["c" /* isDef */])(this.zIndex)) {
  12037. return {
  12038. zIndex: this.zIndex + 1
  12039. };
  12040. }
  12041. },
  12042. highlightStyle: function highlightStyle() {
  12043. var highlightColor = this.highlightColor;
  12044. if (highlightColor) {
  12045. return {
  12046. color: highlightColor
  12047. };
  12048. }
  12049. }
  12050. },
  12051. watch: {
  12052. indexList: function indexList() {
  12053. this.$nextTick(this.onScroll);
  12054. },
  12055. activeAnchorIndex: function activeAnchorIndex(value) {
  12056. if (value) {
  12057. this.$emit('change', value);
  12058. }
  12059. }
  12060. },
  12061. methods: {
  12062. onScroll: function onScroll() {
  12063. var _this = this;
  12064. if (isHidden(this.$el)) {
  12065. return;
  12066. }
  12067. var scrollTop = getScrollTop(this.scroller);
  12068. var scrollerRect = this.getScrollerRect();
  12069. var rects = this.children.map(function (item) {
  12070. return item.getRect(_this.scroller, scrollerRect);
  12071. });
  12072. var active = this.getActiveAnchorIndex(scrollTop, rects);
  12073. this.activeAnchorIndex = this.indexList[active];
  12074. if (this.sticky) {
  12075. this.children.forEach(function (item, index) {
  12076. if (index === active || index === active - 1) {
  12077. var rect = item.$el.getBoundingClientRect();
  12078. item.left = rect.left;
  12079. item.width = rect.width;
  12080. } else {
  12081. item.left = null;
  12082. item.width = null;
  12083. }
  12084. if (index === active) {
  12085. item.active = true;
  12086. item.top = Math.max(_this.stickyOffsetTop, rects[index].top - scrollTop) + scrollerRect.top;
  12087. } else if (index === active - 1) {
  12088. var activeItemTop = rects[active].top - scrollTop;
  12089. item.active = activeItemTop > 0;
  12090. item.top = activeItemTop + scrollerRect.top - rects[index].height;
  12091. } else {
  12092. item.active = false;
  12093. }
  12094. });
  12095. }
  12096. },
  12097. getScrollerRect: function getScrollerRect() {
  12098. if (this.scroller.getBoundingClientRect) {
  12099. return this.scroller.getBoundingClientRect();
  12100. }
  12101. return {
  12102. top: 0,
  12103. left: 0
  12104. };
  12105. },
  12106. getActiveAnchorIndex: function getActiveAnchorIndex(scrollTop, rects) {
  12107. for (var i = this.children.length - 1; i >= 0; i--) {
  12108. var prevHeight = i > 0 ? rects[i - 1].height : 0;
  12109. var reachTop = this.sticky ? prevHeight + this.stickyOffsetTop : 0;
  12110. if (scrollTop + reachTop >= rects[i].top) {
  12111. return i;
  12112. }
  12113. }
  12114. return -1;
  12115. },
  12116. onClick: function onClick(event) {
  12117. this.scrollToElement(event.target);
  12118. },
  12119. onTouchMove: function onTouchMove(event) {
  12120. this.touchMove(event);
  12121. if (this.direction === 'vertical') {
  12122. preventDefault(event);
  12123. var _event$touches$ = event.touches[0],
  12124. clientX = _event$touches$.clientX,
  12125. clientY = _event$touches$.clientY;
  12126. var target = document.elementFromPoint(clientX, clientY);
  12127. if (target) {
  12128. var index = target.dataset.index;
  12129. /* istanbul ignore else */
  12130. if (this.touchActiveIndex !== index) {
  12131. this.touchActiveIndex = index;
  12132. this.scrollToElement(target);
  12133. }
  12134. }
  12135. }
  12136. },
  12137. scrollTo: function scrollTo(index) {
  12138. var match = this.children.filter(function (item) {
  12139. return String(item.index) === index;
  12140. });
  12141. if (match[0]) {
  12142. match[0].scrollIntoView();
  12143. if (this.sticky && this.stickyOffsetTop) {
  12144. setRootScrollTop(getRootScrollTop() - this.stickyOffsetTop);
  12145. }
  12146. this.$emit('select', match[0].index);
  12147. }
  12148. },
  12149. scrollToElement: function scrollToElement(element) {
  12150. var index = element.dataset.index;
  12151. this.scrollTo(index);
  12152. },
  12153. onTouchEnd: function onTouchEnd() {
  12154. this.active = null;
  12155. }
  12156. },
  12157. render: function render() {
  12158. var _this2 = this;
  12159. var h = arguments[0];
  12160. var Indexes = this.indexList.map(function (index) {
  12161. var active = index === _this2.activeAnchorIndex;
  12162. return h("span", {
  12163. "class": index_bar_bem('index', {
  12164. active: active
  12165. }),
  12166. "style": active ? _this2.highlightStyle : null,
  12167. "attrs": {
  12168. "data-index": index
  12169. }
  12170. }, [index]);
  12171. });
  12172. return h("div", {
  12173. "class": index_bar_bem()
  12174. }, [h("div", {
  12175. "class": index_bar_bem('sidebar'),
  12176. "style": this.sidebarStyle,
  12177. "on": {
  12178. "click": this.onClick,
  12179. "touchstart": this.touchStart,
  12180. "touchmove": this.onTouchMove,
  12181. "touchend": this.onTouchEnd,
  12182. "touchcancel": this.onTouchEnd
  12183. }
  12184. }, [Indexes]), this.slots('default')]);
  12185. }
  12186. }));
  12187. // EXTERNAL MODULE: ./node_modules/vue-lazyload/vue-lazyload.js
  12188. var vue_lazyload = __webpack_require__(9);
  12189. var vue_lazyload_default = /*#__PURE__*/__webpack_require__.n(vue_lazyload);
  12190. // CONCATENATED MODULE: ./es/lazyload/index.js
  12191. /* harmony default export */ var lazyload = (vue_lazyload_default.a);
  12192. // CONCATENATED MODULE: ./es/list/index.js
  12193. // Utils
  12194. // Mixins
  12195. // Components
  12196. var list_createNamespace = Object(create["a" /* createNamespace */])('list'),
  12197. list_createComponent = list_createNamespace[0],
  12198. list_bem = list_createNamespace[1],
  12199. list_t = list_createNamespace[2];
  12200. /* harmony default export */ var es_list = (list_createComponent({
  12201. mixins: [BindEventMixin(function (bind) {
  12202. if (!this.scroller) {
  12203. this.scroller = getScroller(this.$el);
  12204. }
  12205. bind(this.scroller, 'scroll', this.check);
  12206. })],
  12207. model: {
  12208. prop: 'loading'
  12209. },
  12210. props: {
  12211. error: Boolean,
  12212. loading: Boolean,
  12213. finished: Boolean,
  12214. errorText: String,
  12215. loadingText: String,
  12216. finishedText: String,
  12217. immediateCheck: {
  12218. type: Boolean,
  12219. default: true
  12220. },
  12221. offset: {
  12222. type: [Number, String],
  12223. default: 300
  12224. },
  12225. direction: {
  12226. type: String,
  12227. default: 'down'
  12228. }
  12229. },
  12230. data: function data() {
  12231. return {
  12232. // use sync innerLoading state to avoid repeated loading in some edge cases
  12233. innerLoading: this.loading
  12234. };
  12235. },
  12236. updated: function updated() {
  12237. this.innerLoading = this.loading;
  12238. },
  12239. mounted: function mounted() {
  12240. if (this.immediateCheck) {
  12241. this.check();
  12242. }
  12243. },
  12244. watch: {
  12245. loading: 'check',
  12246. finished: 'check'
  12247. },
  12248. methods: {
  12249. // @exposed-api
  12250. check: function check() {
  12251. var _this = this;
  12252. this.$nextTick(function () {
  12253. if (_this.innerLoading || _this.finished || _this.error) {
  12254. return;
  12255. }
  12256. var el = _this.$el,
  12257. scroller = _this.scroller,
  12258. offset = _this.offset,
  12259. direction = _this.direction;
  12260. var scrollerRect;
  12261. if (scroller.getBoundingClientRect) {
  12262. scrollerRect = scroller.getBoundingClientRect();
  12263. } else {
  12264. scrollerRect = {
  12265. top: 0,
  12266. bottom: scroller.innerHeight
  12267. };
  12268. }
  12269. var scrollerHeight = scrollerRect.bottom - scrollerRect.top;
  12270. /* istanbul ignore next */
  12271. if (!scrollerHeight || isHidden(el)) {
  12272. return false;
  12273. }
  12274. var isReachEdge = false;
  12275. var placeholderRect = _this.$refs.placeholder.getBoundingClientRect();
  12276. if (direction === 'up') {
  12277. isReachEdge = scrollerRect.top - placeholderRect.top <= offset;
  12278. } else {
  12279. isReachEdge = placeholderRect.bottom - scrollerRect.bottom <= offset;
  12280. }
  12281. if (isReachEdge) {
  12282. _this.innerLoading = true;
  12283. _this.$emit('input', true);
  12284. _this.$emit('load');
  12285. }
  12286. });
  12287. },
  12288. clickErrorText: function clickErrorText() {
  12289. this.$emit('update:error', false);
  12290. this.check();
  12291. },
  12292. genLoading: function genLoading() {
  12293. var h = this.$createElement;
  12294. if (this.innerLoading && !this.finished) {
  12295. return h("div", {
  12296. "key": "loading",
  12297. "class": list_bem('loading')
  12298. }, [this.slots('loading') || h(es_loading, {
  12299. "attrs": {
  12300. "size": "16"
  12301. }
  12302. }, [this.loadingText || list_t('loading')])]);
  12303. }
  12304. },
  12305. genFinishedText: function genFinishedText() {
  12306. var h = this.$createElement;
  12307. if (this.finished) {
  12308. var text = this.slots('finished') || this.finishedText;
  12309. if (text) {
  12310. return h("div", {
  12311. "class": list_bem('finished-text')
  12312. }, [text]);
  12313. }
  12314. }
  12315. },
  12316. genErrorText: function genErrorText() {
  12317. var h = this.$createElement;
  12318. if (this.error) {
  12319. var text = this.slots('error') || this.errorText;
  12320. if (text) {
  12321. return h("div", {
  12322. "on": {
  12323. "click": this.clickErrorText
  12324. },
  12325. "class": list_bem('error-text')
  12326. }, [text]);
  12327. }
  12328. }
  12329. }
  12330. },
  12331. render: function render() {
  12332. var h = arguments[0];
  12333. var Placeholder = h("div", {
  12334. "ref": "placeholder",
  12335. "key": "placeholder",
  12336. "class": list_bem('placeholder')
  12337. });
  12338. return h("div", {
  12339. "class": list_bem(),
  12340. "attrs": {
  12341. "role": "feed",
  12342. "aria-busy": this.innerLoading
  12343. }
  12344. }, [this.direction === 'down' ? this.slots() : Placeholder, this.genLoading(), this.genFinishedText(), this.genErrorText(), this.direction === 'up' ? this.slots() : Placeholder]);
  12345. }
  12346. }));
  12347. // EXTERNAL MODULE: ./es/locale/index.js + 2 modules
  12348. var locale = __webpack_require__(7);
  12349. // CONCATENATED MODULE: ./es/nav-bar/index.js
  12350. // Utils
  12351. // Components
  12352. var nav_bar_createNamespace = Object(create["a" /* createNamespace */])('nav-bar'),
  12353. nav_bar_createComponent = nav_bar_createNamespace[0],
  12354. nav_bar_bem = nav_bar_createNamespace[1];
  12355. /* harmony default export */ var nav_bar = (nav_bar_createComponent({
  12356. props: {
  12357. title: String,
  12358. fixed: Boolean,
  12359. zIndex: [Number, String],
  12360. leftText: String,
  12361. rightText: String,
  12362. leftArrow: Boolean,
  12363. placeholder: Boolean,
  12364. safeAreaInsetTop: Boolean,
  12365. border: {
  12366. type: Boolean,
  12367. default: true
  12368. }
  12369. },
  12370. data: function data() {
  12371. return {
  12372. height: null
  12373. };
  12374. },
  12375. mounted: function mounted() {
  12376. if (this.placeholder && this.fixed) {
  12377. this.height = this.$refs.navBar.getBoundingClientRect().height;
  12378. }
  12379. },
  12380. methods: {
  12381. genLeft: function genLeft() {
  12382. var h = this.$createElement;
  12383. var leftSlot = this.slots('left');
  12384. if (leftSlot) {
  12385. return leftSlot;
  12386. }
  12387. return [this.leftArrow && h(es_icon, {
  12388. "class": nav_bar_bem('arrow'),
  12389. "attrs": {
  12390. "name": "arrow-left"
  12391. }
  12392. }), this.leftText && h("span", {
  12393. "class": nav_bar_bem('text')
  12394. }, [this.leftText])];
  12395. },
  12396. genRight: function genRight() {
  12397. var h = this.$createElement;
  12398. var rightSlot = this.slots('right');
  12399. if (rightSlot) {
  12400. return rightSlot;
  12401. }
  12402. if (this.rightText) {
  12403. return h("span", {
  12404. "class": nav_bar_bem('text')
  12405. }, [this.rightText]);
  12406. }
  12407. },
  12408. genNavBar: function genNavBar() {
  12409. var _ref;
  12410. var h = this.$createElement;
  12411. return h("div", {
  12412. "ref": "navBar",
  12413. "style": {
  12414. zIndex: this.zIndex
  12415. },
  12416. "class": [nav_bar_bem({
  12417. fixed: this.fixed,
  12418. 'safe-area-inset-top': this.safeAreaInsetTop
  12419. }), (_ref = {}, _ref[BORDER_BOTTOM] = this.border, _ref)]
  12420. }, [h("div", {
  12421. "class": nav_bar_bem('content')
  12422. }, [this.hasLeft() && h("div", {
  12423. "class": nav_bar_bem('left'),
  12424. "on": {
  12425. "click": this.onClickLeft
  12426. }
  12427. }, [this.genLeft()]), h("div", {
  12428. "class": [nav_bar_bem('title'), 'van-ellipsis']
  12429. }, [this.slots('title') || this.title]), this.hasRight() && h("div", {
  12430. "class": nav_bar_bem('right'),
  12431. "on": {
  12432. "click": this.onClickRight
  12433. }
  12434. }, [this.genRight()])])]);
  12435. },
  12436. hasLeft: function hasLeft() {
  12437. return this.leftArrow || this.leftText || this.slots('left');
  12438. },
  12439. hasRight: function hasRight() {
  12440. return this.rightText || this.slots('right');
  12441. },
  12442. onClickLeft: function onClickLeft(event) {
  12443. this.$emit('click-left', event);
  12444. },
  12445. onClickRight: function onClickRight(event) {
  12446. this.$emit('click-right', event);
  12447. }
  12448. },
  12449. render: function render() {
  12450. var h = arguments[0];
  12451. if (this.placeholder && this.fixed) {
  12452. return h("div", {
  12453. "class": nav_bar_bem('placeholder'),
  12454. "style": {
  12455. height: this.height + "px"
  12456. }
  12457. }, [this.genNavBar()]);
  12458. }
  12459. return this.genNavBar();
  12460. }
  12461. }));
  12462. // CONCATENATED MODULE: ./es/notice-bar/index.js
  12463. var notice_bar_createNamespace = Object(create["a" /* createNamespace */])('notice-bar'),
  12464. notice_bar_createComponent = notice_bar_createNamespace[0],
  12465. notice_bar_bem = notice_bar_createNamespace[1];
  12466. /* harmony default export */ var notice_bar = (notice_bar_createComponent({
  12467. mixins: [BindEventMixin(function (bind) {
  12468. // fix cache issues with forwards and back history in safari
  12469. // see: https://guwii.com/cache-issues-with-forwards-and-back-history-in-safari/
  12470. bind(window, 'pageshow', this.start);
  12471. })],
  12472. inject: {
  12473. vanPopup: {
  12474. default: null
  12475. }
  12476. },
  12477. props: {
  12478. text: String,
  12479. mode: String,
  12480. color: String,
  12481. leftIcon: String,
  12482. wrapable: Boolean,
  12483. background: String,
  12484. scrollable: {
  12485. type: Boolean,
  12486. default: null
  12487. },
  12488. delay: {
  12489. type: [Number, String],
  12490. default: 1
  12491. },
  12492. speed: {
  12493. type: [Number, String],
  12494. default: 60
  12495. }
  12496. },
  12497. data: function data() {
  12498. return {
  12499. show: true,
  12500. offset: 0,
  12501. duration: 0,
  12502. wrapWidth: 0,
  12503. contentWidth: 0
  12504. };
  12505. },
  12506. watch: {
  12507. scrollable: 'start',
  12508. text: {
  12509. handler: 'start',
  12510. immediate: true
  12511. }
  12512. },
  12513. created: function created() {
  12514. var _this = this; // https://github.com/youzan/vant/issues/8634
  12515. if (this.vanPopup) {
  12516. this.vanPopup.onReopen(function () {
  12517. _this.start();
  12518. });
  12519. }
  12520. },
  12521. activated: function activated() {
  12522. this.start();
  12523. },
  12524. methods: {
  12525. onClickIcon: function onClickIcon(event) {
  12526. if (this.mode === 'closeable') {
  12527. this.show = false;
  12528. this.$emit('close', event);
  12529. }
  12530. },
  12531. onTransitionEnd: function onTransitionEnd() {
  12532. var _this2 = this;
  12533. this.offset = this.wrapWidth;
  12534. this.duration = 0; // wait for Vue to render offset
  12535. // using nextTick won't work in iOS14
  12536. Object(raf["c" /* raf */])(function () {
  12537. // use double raf to ensure animation can start
  12538. Object(raf["b" /* doubleRaf */])(function () {
  12539. _this2.offset = -_this2.contentWidth;
  12540. _this2.duration = (_this2.contentWidth + _this2.wrapWidth) / _this2.speed;
  12541. _this2.$emit('replay');
  12542. });
  12543. });
  12544. },
  12545. reset: function reset() {
  12546. this.offset = 0;
  12547. this.duration = 0;
  12548. this.wrapWidth = 0;
  12549. this.contentWidth = 0;
  12550. },
  12551. start: function start() {
  12552. var _this3 = this;
  12553. var delay = Object(utils["c" /* isDef */])(this.delay) ? this.delay * 1000 : 0;
  12554. this.reset();
  12555. clearTimeout(this.startTimer);
  12556. this.startTimer = setTimeout(function () {
  12557. var _this3$$refs = _this3.$refs,
  12558. wrap = _this3$$refs.wrap,
  12559. content = _this3$$refs.content;
  12560. if (!wrap || !content || _this3.scrollable === false) {
  12561. return;
  12562. }
  12563. var wrapWidth = wrap.getBoundingClientRect().width;
  12564. var contentWidth = content.getBoundingClientRect().width;
  12565. if (_this3.scrollable || contentWidth > wrapWidth) {
  12566. Object(raf["b" /* doubleRaf */])(function () {
  12567. _this3.offset = -contentWidth;
  12568. _this3.duration = contentWidth / _this3.speed;
  12569. _this3.wrapWidth = wrapWidth;
  12570. _this3.contentWidth = contentWidth;
  12571. });
  12572. }
  12573. }, delay);
  12574. }
  12575. },
  12576. render: function render() {
  12577. var _this4 = this;
  12578. var h = arguments[0];
  12579. var slots = this.slots,
  12580. mode = this.mode,
  12581. leftIcon = this.leftIcon,
  12582. onClickIcon = this.onClickIcon;
  12583. var barStyle = {
  12584. color: this.color,
  12585. background: this.background
  12586. };
  12587. var contentStyle = {
  12588. transform: this.offset ? "translateX(" + this.offset + "px)" : '',
  12589. transitionDuration: this.duration + 's'
  12590. };
  12591. function LeftIcon() {
  12592. var slot = slots('left-icon');
  12593. if (slot) {
  12594. return slot;
  12595. }
  12596. if (leftIcon) {
  12597. return h(es_icon, {
  12598. "class": notice_bar_bem('left-icon'),
  12599. "attrs": {
  12600. "name": leftIcon
  12601. }
  12602. });
  12603. }
  12604. }
  12605. function RightIcon() {
  12606. var slot = slots('right-icon');
  12607. if (slot) {
  12608. return slot;
  12609. }
  12610. var iconName;
  12611. if (mode === 'closeable') {
  12612. iconName = 'cross';
  12613. } else if (mode === 'link') {
  12614. iconName = 'arrow';
  12615. }
  12616. if (iconName) {
  12617. return h(es_icon, {
  12618. "class": notice_bar_bem('right-icon'),
  12619. "attrs": {
  12620. "name": iconName
  12621. },
  12622. "on": {
  12623. "click": onClickIcon
  12624. }
  12625. });
  12626. }
  12627. }
  12628. return h("div", {
  12629. "attrs": {
  12630. "role": "alert"
  12631. },
  12632. "directives": [{
  12633. name: "show",
  12634. value: this.show
  12635. }],
  12636. "class": notice_bar_bem({
  12637. wrapable: this.wrapable
  12638. }),
  12639. "style": barStyle,
  12640. "on": {
  12641. "click": function click(event) {
  12642. _this4.$emit('click', event);
  12643. }
  12644. }
  12645. }, [LeftIcon(), h("div", {
  12646. "ref": "wrap",
  12647. "class": notice_bar_bem('wrap'),
  12648. "attrs": {
  12649. "role": "marquee"
  12650. }
  12651. }, [h("div", {
  12652. "ref": "content",
  12653. "class": [notice_bar_bem('content'), {
  12654. 'van-ellipsis': this.scrollable === false && !this.wrapable
  12655. }],
  12656. "style": contentStyle,
  12657. "on": {
  12658. "transitionend": this.onTransitionEnd
  12659. }
  12660. }, [this.slots() || this.text])]), RightIcon()]);
  12661. }
  12662. }));
  12663. // CONCATENATED MODULE: ./es/notify/Notify.js
  12664. // Utils
  12665. // Mixins
  12666. // Components
  12667. // Types
  12668. var Notify_createNamespace = Object(create["a" /* createNamespace */])('notify'),
  12669. Notify_createComponent = Notify_createNamespace[0],
  12670. Notify_bem = Notify_createNamespace[1];
  12671. function Notify(h, props, slots, ctx) {
  12672. var style = {
  12673. color: props.color,
  12674. background: props.background
  12675. };
  12676. return h(popup, helper_default()([{
  12677. "attrs": {
  12678. "value": props.value,
  12679. "position": "top",
  12680. "overlay": false,
  12681. "duration": 0.2,
  12682. "lockScroll": false
  12683. },
  12684. "style": style,
  12685. "class": [Notify_bem([props.type]), props.className]
  12686. }, inherit(ctx, true)]), [(slots.default == null ? void 0 : slots.default()) || props.message]);
  12687. }
  12688. Notify.props = _extends({}, popupMixinProps, {
  12689. color: String,
  12690. message: [Number, String],
  12691. duration: [Number, String],
  12692. className: null,
  12693. background: String,
  12694. getContainer: [String, Function],
  12695. type: {
  12696. type: String,
  12697. default: 'danger'
  12698. }
  12699. });
  12700. /* harmony default export */ var notify_Notify = (Notify_createComponent(Notify));
  12701. // CONCATENATED MODULE: ./es/notify/index.js
  12702. var timer;
  12703. var notify_instance;
  12704. function notify_parseOptions(message) {
  12705. return Object(utils["f" /* isObject */])(message) ? message : {
  12706. message: message
  12707. };
  12708. }
  12709. function es_notify_Notify(options) {
  12710. /* istanbul ignore if */
  12711. if (utils["h" /* isServer */]) {
  12712. return;
  12713. }
  12714. if (!notify_instance) {
  12715. notify_instance = mount(notify_Notify, {
  12716. on: {
  12717. click: function click(event) {
  12718. if (notify_instance.onClick) {
  12719. notify_instance.onClick(event);
  12720. }
  12721. },
  12722. close: function close() {
  12723. if (notify_instance.onClose) {
  12724. notify_instance.onClose();
  12725. }
  12726. },
  12727. opened: function opened() {
  12728. if (notify_instance.onOpened) {
  12729. notify_instance.onOpened();
  12730. }
  12731. }
  12732. }
  12733. });
  12734. }
  12735. options = _extends({}, es_notify_Notify.currentOptions, notify_parseOptions(options));
  12736. _extends(notify_instance, options);
  12737. clearTimeout(timer);
  12738. if (options.duration && options.duration > 0) {
  12739. timer = setTimeout(es_notify_Notify.clear, options.duration);
  12740. }
  12741. return notify_instance;
  12742. }
  12743. function notify_defaultOptions() {
  12744. return {
  12745. type: 'danger',
  12746. value: true,
  12747. message: '',
  12748. color: undefined,
  12749. background: undefined,
  12750. duration: 3000,
  12751. className: '',
  12752. onClose: null,
  12753. onClick: null,
  12754. onOpened: null
  12755. };
  12756. }
  12757. es_notify_Notify.clear = function () {
  12758. if (notify_instance) {
  12759. notify_instance.value = false;
  12760. }
  12761. };
  12762. es_notify_Notify.currentOptions = notify_defaultOptions();
  12763. es_notify_Notify.setDefaultOptions = function (options) {
  12764. _extends(es_notify_Notify.currentOptions, options);
  12765. };
  12766. es_notify_Notify.resetDefaultOptions = function () {
  12767. es_notify_Notify.currentOptions = notify_defaultOptions();
  12768. };
  12769. es_notify_Notify.install = function () {
  12770. external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a.use(notify_Notify);
  12771. };
  12772. es_notify_Notify.Component = notify_Notify;
  12773. external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a.prototype.$notify = es_notify_Notify;
  12774. /* harmony default export */ var notify = (es_notify_Notify);
  12775. // CONCATENATED MODULE: ./es/number-keyboard/DeleteIcon.js
  12776. /* harmony default export */ var number_keyboard_DeleteIcon = ({
  12777. render: function render() {
  12778. var h = arguments[0];
  12779. return h("svg", {
  12780. "attrs": {
  12781. "viewBox": "0 0 32 22",
  12782. "xmlns": "http://www.w3.org/2000/svg"
  12783. }
  12784. }, [h("path", {
  12785. "attrs": {
  12786. "d": "M28.016 0A3.991 3.991 0 0132 3.987v14.026c0 2.2-1.787 3.987-3.98 3.987H10.382c-.509 0-.996-.206-1.374-.585L.89 13.09C.33 12.62 0 11.84 0 11.006c0-.86.325-1.62.887-2.08L9.01.585A1.936 1.936 0 0110.383 0zm0 1.947H10.368L2.24 10.28c-.224.226-.312.432-.312.73 0 .287.094.51.312.729l8.128 8.333h17.648a2.041 2.041 0 002.037-2.04V3.987c0-1.127-.915-2.04-2.037-2.04zM23.028 6a.96.96 0 01.678.292.95.95 0 01-.003 1.377l-3.342 3.348 3.326 3.333c.189.188.292.43.292.679 0 .248-.103.49-.292.679a.96.96 0 01-.678.292.959.959 0 01-.677-.292L18.99 12.36l-3.343 3.345a.96.96 0 01-.677.292.96.96 0 01-.678-.292.962.962 0 01-.292-.68c0-.248.104-.49.292-.679l3.342-3.348-3.342-3.348A.963.963 0 0114 6.971c0-.248.104-.49.292-.679A.96.96 0 0114.97 6a.96.96 0 01.677.292l3.358 3.348 3.345-3.348A.96.96 0 0123.028 6z",
  12787. "fill": "currentColor"
  12788. }
  12789. })]);
  12790. }
  12791. });
  12792. // CONCATENATED MODULE: ./es/number-keyboard/CollapseIcon.js
  12793. /* harmony default export */ var CollapseIcon = ({
  12794. render: function render() {
  12795. var h = arguments[0];
  12796. return h("svg", {
  12797. "attrs": {
  12798. "viewBox": "0 0 30 24",
  12799. "xmlns": "http://www.w3.org/2000/svg"
  12800. }
  12801. }, [h("path", {
  12802. "attrs": {
  12803. "d": "M25.877 12.843h-1.502c-.188 0-.188 0-.188.19v1.512c0 .188 0 .188.188.188h1.5c.187 0 .187 0 .187-.188v-1.511c0-.19 0-.191-.185-.191zM17.999 10.2c0 .188 0 .188.188.188h1.687c.188 0 .188 0 .188-.188V8.688c0-.187.004-.187-.186-.19h-1.69c-.187 0-.187 0-.187.19V10.2zm2.25-3.967h1.5c.188 0 .188 0 .188-.188v-1.7c0-.19 0-.19-.188-.19h-1.5c-.189 0-.189 0-.189.19v1.7c0 .188 0 .188.19.188zm2.063 4.157h3.563c.187 0 .187 0 .187-.189V4.346c0-.19.004-.19-.185-.19h-1.69c-.187 0-.187 0-.187.188v4.155h-1.688c-.187 0-.187 0-.187.189v1.514c0 .19 0 .19.187.19zM14.812 24l2.812-3.4H12l2.813 3.4zm-9-11.157H4.31c-.188 0-.188 0-.188.19v1.512c0 .188 0 .188.188.188h1.502c.187 0 .187 0 .187-.188v-1.511c0-.19.01-.191-.189-.191zm15.937 0H8.25c-.188 0-.188 0-.188.19v1.512c0 .188 0 .188.188.188h13.5c.188 0 .188 0 .188-.188v-1.511c0-.19 0-.191-.188-.191zm-11.438-2.454h1.5c.188 0 .188 0 .188-.188V8.688c0-.187 0-.187-.188-.189h-1.5c-.187 0-.187 0-.187.189V10.2c0 .188 0 .188.187.188zM27.94 0c.563 0 .917.21 1.313.567.518.466.748.757.748 1.51v14.92c0 .567-.188 1.134-.562 1.512-.376.378-.938.566-1.313.566H2.063c-.563 0-.938-.188-1.313-.566-.562-.378-.75-.945-.75-1.511V2.078C0 1.51.188.944.562.567.938.189 1.5 0 1.875 0zm-.062 2H2v14.92h25.877V2zM5.81 4.157c.19 0 .19 0 .19.189v1.762c-.003.126-.024.126-.188.126H4.249c-.126-.003-.126-.023-.126-.188v-1.7c-.187-.19 0-.19.188-.19zm10.5 2.077h1.503c.187 0 .187 0 .187-.188v-1.7c0-.19 0-.19-.187-.19h-1.502c-.188 0-.188.001-.188.19v1.7c0 .188 0 .188.188.188zM7.875 8.5c.187 0 .187.002.187.189V10.2c0 .188 0 .188-.187.188H4.249c-.126-.002-.126-.023-.126-.188V8.625c.003-.126.024-.126.188-.126zm7.875 0c.19.002.19.002.19.189v1.575c-.003.126-.024.126-.19.126h-1.563c-.126-.002-.126-.023-.126-.188V8.625c.002-.126.023-.126.189-.126zm-6-4.342c.187 0 .187 0 .187.189v1.7c0 .188 0 .188-.187.188H8.187c-.126-.003-.126-.023-.126-.188V4.283c.003-.126.024-.126.188-.126zm3.94 0c.185 0 .372 0 .372.189v1.762c-.002.126-.023.126-.187.126h-1.75C12 6.231 12 6.211 12 6.046v-1.7c0-.19.187-.19.187-.19z",
  12804. "fill": "currentColor"
  12805. }
  12806. })]);
  12807. }
  12808. });
  12809. // CONCATENATED MODULE: ./es/number-keyboard/Key.js
  12810. var Key_createNamespace = Object(create["a" /* createNamespace */])('key'),
  12811. Key_createComponent = Key_createNamespace[0],
  12812. Key_bem = Key_createNamespace[1];
  12813. /* harmony default export */ var Key = (Key_createComponent({
  12814. mixins: [TouchMixin],
  12815. props: {
  12816. type: String,
  12817. text: [Number, String],
  12818. color: String,
  12819. wider: Boolean,
  12820. large: Boolean,
  12821. loading: Boolean
  12822. },
  12823. data: function data() {
  12824. return {
  12825. active: false
  12826. };
  12827. },
  12828. mounted: function mounted() {
  12829. this.bindTouchEvent(this.$el);
  12830. },
  12831. methods: {
  12832. onTouchStart: function onTouchStart(event) {
  12833. // compatible with Vue 2.6 event bubble bug
  12834. event.stopPropagation();
  12835. this.touchStart(event);
  12836. this.active = true;
  12837. },
  12838. onTouchMove: function onTouchMove(event) {
  12839. this.touchMove(event);
  12840. if (this.direction) {
  12841. this.active = false;
  12842. }
  12843. },
  12844. onTouchEnd: function onTouchEnd(event) {
  12845. if (this.active) {
  12846. // eliminate tap delay on safari
  12847. // see: https://github.com/youzan/vant/issues/6836
  12848. if (!this.slots('default')) {
  12849. event.preventDefault();
  12850. }
  12851. this.active = false;
  12852. this.$emit('press', this.text, this.type);
  12853. }
  12854. },
  12855. genContent: function genContent() {
  12856. var h = this.$createElement;
  12857. var isExtra = this.type === 'extra';
  12858. var isDelete = this.type === 'delete';
  12859. var text = this.slots('default') || this.text;
  12860. if (this.loading) {
  12861. return h(es_loading, {
  12862. "class": Key_bem('loading-icon')
  12863. });
  12864. }
  12865. if (isDelete) {
  12866. return text || h(number_keyboard_DeleteIcon, {
  12867. "class": Key_bem('delete-icon')
  12868. });
  12869. }
  12870. if (isExtra) {
  12871. return text || h(CollapseIcon, {
  12872. "class": Key_bem('collapse-icon')
  12873. });
  12874. }
  12875. return text;
  12876. }
  12877. },
  12878. render: function render() {
  12879. var h = arguments[0];
  12880. return h("div", {
  12881. "class": Key_bem('wrapper', {
  12882. wider: this.wider
  12883. })
  12884. }, [h("div", {
  12885. "attrs": {
  12886. "role": "button",
  12887. "tabindex": "0"
  12888. },
  12889. "class": Key_bem([this.color, {
  12890. large: this.large,
  12891. active: this.active,
  12892. delete: this.type === 'delete'
  12893. }])
  12894. }, [this.genContent()])]);
  12895. }
  12896. }));
  12897. // CONCATENATED MODULE: ./es/number-keyboard/index.js
  12898. var number_keyboard_createNamespace = Object(create["a" /* createNamespace */])('number-keyboard'),
  12899. number_keyboard_createComponent = number_keyboard_createNamespace[0],
  12900. number_keyboard_bem = number_keyboard_createNamespace[1];
  12901. /* harmony default export */ var number_keyboard = (number_keyboard_createComponent({
  12902. mixins: [PortalMixin(), BindEventMixin(function (bind) {
  12903. if (this.hideOnClickOutside) {
  12904. bind(document.body, 'touchstart', this.onBlur);
  12905. }
  12906. })],
  12907. model: {
  12908. event: 'update:value'
  12909. },
  12910. props: {
  12911. show: Boolean,
  12912. title: String,
  12913. zIndex: [Number, String],
  12914. randomKeyOrder: Boolean,
  12915. closeButtonText: String,
  12916. deleteButtonText: String,
  12917. closeButtonLoading: Boolean,
  12918. theme: {
  12919. type: String,
  12920. default: 'default'
  12921. },
  12922. value: {
  12923. type: String,
  12924. default: ''
  12925. },
  12926. extraKey: {
  12927. type: [String, Array],
  12928. default: ''
  12929. },
  12930. maxlength: {
  12931. type: [Number, String],
  12932. default: Number.MAX_VALUE
  12933. },
  12934. transition: {
  12935. type: Boolean,
  12936. default: true
  12937. },
  12938. showDeleteKey: {
  12939. type: Boolean,
  12940. default: true
  12941. },
  12942. hideOnClickOutside: {
  12943. type: Boolean,
  12944. default: true
  12945. },
  12946. safeAreaInsetBottom: {
  12947. type: Boolean,
  12948. default: true
  12949. }
  12950. },
  12951. watch: {
  12952. show: function show(val) {
  12953. if (!this.transition) {
  12954. this.$emit(val ? 'show' : 'hide');
  12955. }
  12956. }
  12957. },
  12958. computed: {
  12959. keys: function keys() {
  12960. if (this.theme === 'custom') {
  12961. return this.genCustomKeys();
  12962. }
  12963. return this.genDefaultKeys();
  12964. }
  12965. },
  12966. methods: {
  12967. genBasicKeys: function genBasicKeys() {
  12968. var keys = [];
  12969. for (var i = 1; i <= 9; i++) {
  12970. keys.push({
  12971. text: i
  12972. });
  12973. }
  12974. if (this.randomKeyOrder) {
  12975. keys.sort(function () {
  12976. return Math.random() > 0.5 ? 1 : -1;
  12977. });
  12978. }
  12979. return keys;
  12980. },
  12981. genDefaultKeys: function genDefaultKeys() {
  12982. return [].concat(this.genBasicKeys(), [{
  12983. text: this.extraKey,
  12984. type: 'extra'
  12985. }, {
  12986. text: 0
  12987. }, {
  12988. text: this.showDeleteKey ? this.deleteButtonText : '',
  12989. type: this.showDeleteKey ? 'delete' : ''
  12990. }]);
  12991. },
  12992. genCustomKeys: function genCustomKeys() {
  12993. var keys = this.genBasicKeys();
  12994. var extraKey = this.extraKey;
  12995. var extraKeys = Array.isArray(extraKey) ? extraKey : [extraKey];
  12996. if (extraKeys.length === 1) {
  12997. keys.push({
  12998. text: 0,
  12999. wider: true
  13000. }, {
  13001. text: extraKeys[0],
  13002. type: 'extra'
  13003. });
  13004. } else if (extraKeys.length === 2) {
  13005. keys.push({
  13006. text: extraKeys[0],
  13007. type: 'extra'
  13008. }, {
  13009. text: 0
  13010. }, {
  13011. text: extraKeys[1],
  13012. type: 'extra'
  13013. });
  13014. }
  13015. return keys;
  13016. },
  13017. onBlur: function onBlur() {
  13018. this.show && this.$emit('blur');
  13019. },
  13020. onClose: function onClose() {
  13021. this.$emit('close');
  13022. this.onBlur();
  13023. },
  13024. onAnimationEnd: function onAnimationEnd() {
  13025. this.$emit(this.show ? 'show' : 'hide');
  13026. },
  13027. onPress: function onPress(text, type) {
  13028. if (text === '') {
  13029. if (type === 'extra') {
  13030. this.onBlur();
  13031. }
  13032. return;
  13033. }
  13034. var value = this.value;
  13035. if (type === 'delete') {
  13036. this.$emit('delete');
  13037. this.$emit('update:value', value.slice(0, value.length - 1));
  13038. } else if (type === 'close') {
  13039. this.onClose();
  13040. } else if (value.length < this.maxlength) {
  13041. this.$emit('input', text);
  13042. this.$emit('update:value', value + text);
  13043. }
  13044. },
  13045. genTitle: function genTitle() {
  13046. var h = this.$createElement;
  13047. var title = this.title,
  13048. theme = this.theme,
  13049. closeButtonText = this.closeButtonText;
  13050. var titleLeft = this.slots('title-left');
  13051. var showClose = closeButtonText && theme === 'default';
  13052. var showTitle = title || showClose || titleLeft;
  13053. if (!showTitle) {
  13054. return;
  13055. }
  13056. return h("div", {
  13057. "class": number_keyboard_bem('header')
  13058. }, [titleLeft && h("span", {
  13059. "class": number_keyboard_bem('title-left')
  13060. }, [titleLeft]), title && h("h2", {
  13061. "class": number_keyboard_bem('title')
  13062. }, [title]), showClose && h("button", {
  13063. "attrs": {
  13064. "type": "button"
  13065. },
  13066. "class": number_keyboard_bem('close'),
  13067. "on": {
  13068. "click": this.onClose
  13069. }
  13070. }, [closeButtonText])]);
  13071. },
  13072. genKeys: function genKeys() {
  13073. var _this = this;
  13074. var h = this.$createElement;
  13075. return this.keys.map(function (key) {
  13076. return h(Key, {
  13077. "key": key.text,
  13078. "attrs": {
  13079. "text": key.text,
  13080. "type": key.type,
  13081. "wider": key.wider,
  13082. "color": key.color
  13083. },
  13084. "on": {
  13085. "press": _this.onPress
  13086. }
  13087. }, [key.type === 'delete' && _this.slots('delete'), key.type === 'extra' && _this.slots('extra-key')]);
  13088. });
  13089. },
  13090. genSidebar: function genSidebar() {
  13091. var h = this.$createElement;
  13092. if (this.theme === 'custom') {
  13093. return h("div", {
  13094. "class": number_keyboard_bem('sidebar')
  13095. }, [this.showDeleteKey && h(Key, {
  13096. "attrs": {
  13097. "large": true,
  13098. "text": this.deleteButtonText,
  13099. "type": "delete"
  13100. },
  13101. "on": {
  13102. "press": this.onPress
  13103. }
  13104. }, [this.slots('delete')]), h(Key, {
  13105. "attrs": {
  13106. "large": true,
  13107. "text": this.closeButtonText,
  13108. "type": "close",
  13109. "color": "blue",
  13110. "loading": this.closeButtonLoading
  13111. },
  13112. "on": {
  13113. "press": this.onPress
  13114. }
  13115. })]);
  13116. }
  13117. }
  13118. },
  13119. render: function render() {
  13120. var h = arguments[0];
  13121. var Title = this.genTitle();
  13122. return h("transition", {
  13123. "attrs": {
  13124. "name": this.transition ? 'van-slide-up' : ''
  13125. }
  13126. }, [h("div", {
  13127. "directives": [{
  13128. name: "show",
  13129. value: this.show
  13130. }],
  13131. "style": {
  13132. zIndex: this.zIndex
  13133. },
  13134. "class": number_keyboard_bem({
  13135. unfit: !this.safeAreaInsetBottom,
  13136. 'with-title': Title
  13137. }),
  13138. "on": {
  13139. "touchstart": event_stopPropagation,
  13140. "animationend": this.onAnimationEnd,
  13141. "webkitAnimationEnd": this.onAnimationEnd
  13142. }
  13143. }, [Title, h("div", {
  13144. "class": number_keyboard_bem('body')
  13145. }, [h("div", {
  13146. "class": number_keyboard_bem('keys')
  13147. }, [this.genKeys()]), this.genSidebar()])])]);
  13148. }
  13149. }));
  13150. // CONCATENATED MODULE: ./es/pagination/index.js
  13151. var pagination_createNamespace = Object(create["a" /* createNamespace */])('pagination'),
  13152. pagination_createComponent = pagination_createNamespace[0],
  13153. pagination_bem = pagination_createNamespace[1],
  13154. pagination_t = pagination_createNamespace[2];
  13155. function makePage(number, text, active) {
  13156. return {
  13157. number: number,
  13158. text: text,
  13159. active: active
  13160. };
  13161. }
  13162. /* harmony default export */ var pagination = (pagination_createComponent({
  13163. props: {
  13164. prevText: String,
  13165. nextText: String,
  13166. forceEllipses: Boolean,
  13167. mode: {
  13168. type: String,
  13169. default: 'multi'
  13170. },
  13171. value: {
  13172. type: Number,
  13173. default: 0
  13174. },
  13175. pageCount: {
  13176. type: [Number, String],
  13177. default: 0
  13178. },
  13179. totalItems: {
  13180. type: [Number, String],
  13181. default: 0
  13182. },
  13183. itemsPerPage: {
  13184. type: [Number, String],
  13185. default: 10
  13186. },
  13187. showPageSize: {
  13188. type: [Number, String],
  13189. default: 5
  13190. }
  13191. },
  13192. computed: {
  13193. count: function count() {
  13194. var count = this.pageCount || Math.ceil(this.totalItems / this.itemsPerPage);
  13195. return Math.max(1, count);
  13196. },
  13197. pages: function pages() {
  13198. var pages = [];
  13199. var pageCount = this.count;
  13200. var showPageSize = +this.showPageSize;
  13201. if (this.mode !== 'multi') {
  13202. return pages;
  13203. } // Default page limits
  13204. var startPage = 1;
  13205. var endPage = pageCount;
  13206. var isMaxSized = showPageSize < pageCount; // recompute if showPageSize
  13207. if (isMaxSized) {
  13208. // Current page is displayed in the middle of the visible ones
  13209. startPage = Math.max(this.value - Math.floor(showPageSize / 2), 1);
  13210. endPage = startPage + showPageSize - 1; // Adjust if limit is exceeded
  13211. if (endPage > pageCount) {
  13212. endPage = pageCount;
  13213. startPage = endPage - showPageSize + 1;
  13214. }
  13215. } // Add page number links
  13216. for (var number = startPage; number <= endPage; number++) {
  13217. var page = makePage(number, number, number === this.value);
  13218. pages.push(page);
  13219. } // Add links to move between page sets
  13220. if (isMaxSized && showPageSize > 0 && this.forceEllipses) {
  13221. if (startPage > 1) {
  13222. var previousPageSet = makePage(startPage - 1, '...', false);
  13223. pages.unshift(previousPageSet);
  13224. }
  13225. if (endPage < pageCount) {
  13226. var nextPageSet = makePage(endPage + 1, '...', false);
  13227. pages.push(nextPageSet);
  13228. }
  13229. }
  13230. return pages;
  13231. }
  13232. },
  13233. watch: {
  13234. value: {
  13235. handler: function handler(page) {
  13236. this.select(page || this.value);
  13237. },
  13238. immediate: true
  13239. }
  13240. },
  13241. methods: {
  13242. select: function select(page, emitChange) {
  13243. page = Math.min(this.count, Math.max(1, page));
  13244. if (this.value !== page) {
  13245. this.$emit('input', page);
  13246. if (emitChange) {
  13247. this.$emit('change', page);
  13248. }
  13249. }
  13250. }
  13251. },
  13252. render: function render() {
  13253. var _this = this,
  13254. _this$slots,
  13255. _this$slots3;
  13256. var h = arguments[0];
  13257. var value = this.value;
  13258. var simple = this.mode !== 'multi';
  13259. var onSelect = function onSelect(value) {
  13260. return function () {
  13261. _this.select(value, true);
  13262. };
  13263. };
  13264. return h("ul", {
  13265. "class": pagination_bem({
  13266. simple: simple
  13267. })
  13268. }, [h("li", {
  13269. "class": [pagination_bem('item', {
  13270. disabled: value === 1
  13271. }), pagination_bem('prev'), BORDER],
  13272. "on": {
  13273. "click": onSelect(value - 1)
  13274. }
  13275. }, [((_this$slots = this.slots('prev-text')) != null ? _this$slots : this.prevText) || pagination_t('prev')]), this.pages.map(function (page) {
  13276. var _this$slots2;
  13277. return h("li", {
  13278. "class": [pagination_bem('item', {
  13279. active: page.active
  13280. }), pagination_bem('page'), BORDER],
  13281. "on": {
  13282. "click": onSelect(page.number)
  13283. }
  13284. }, [(_this$slots2 = _this.slots('page', page)) != null ? _this$slots2 : page.text]);
  13285. }), simple && h("li", {
  13286. "class": pagination_bem('page-desc')
  13287. }, [this.slots('pageDesc') || value + "/" + this.count]), h("li", {
  13288. "class": [pagination_bem('item', {
  13289. disabled: value === this.count
  13290. }), pagination_bem('next'), BORDER],
  13291. "on": {
  13292. "click": onSelect(value + 1)
  13293. }
  13294. }, [((_this$slots3 = this.slots('next-text')) != null ? _this$slots3 : this.nextText) || pagination_t('next')])]);
  13295. }
  13296. }));
  13297. // CONCATENATED MODULE: ./es/panel/index.js
  13298. // Utils
  13299. // Components
  13300. // Types
  13301. var panel_createNamespace = Object(create["a" /* createNamespace */])('panel'),
  13302. panel_createComponent = panel_createNamespace[0],
  13303. panel_bem = panel_createNamespace[1];
  13304. function Panel(h, props, slots, ctx) {
  13305. var Content = function Content() {
  13306. return [slots.header ? slots.header() : h(cell, {
  13307. "attrs": {
  13308. "icon": props.icon,
  13309. "label": props.desc,
  13310. "title": props.title,
  13311. "value": props.status,
  13312. "valueClass": panel_bem('header-value')
  13313. },
  13314. "class": panel_bem('header')
  13315. }), h("div", {
  13316. "class": panel_bem('content')
  13317. }, [slots.default && slots.default()]), slots.footer && h("div", {
  13318. "class": [panel_bem('footer'), BORDER_TOP]
  13319. }, [slots.footer()])];
  13320. };
  13321. return h(cell_group, helper_default()([{
  13322. "class": panel_bem(),
  13323. "scopedSlots": {
  13324. default: Content
  13325. }
  13326. }, inherit(ctx, true)]));
  13327. }
  13328. Panel.props = {
  13329. icon: String,
  13330. desc: String,
  13331. title: String,
  13332. status: String
  13333. };
  13334. /* harmony default export */ var panel = (panel_createComponent(Panel));
  13335. // CONCATENATED MODULE: ./es/password-input/index.js
  13336. // Utils
  13337. // Types
  13338. var password_input_createNamespace = Object(create["a" /* createNamespace */])('password-input'),
  13339. password_input_createComponent = password_input_createNamespace[0],
  13340. password_input_bem = password_input_createNamespace[1];
  13341. function PasswordInput(h, props, slots, ctx) {
  13342. var _ref2;
  13343. var mask = props.mask,
  13344. value = props.value,
  13345. length = props.length,
  13346. gutter = props.gutter,
  13347. focused = props.focused,
  13348. errorInfo = props.errorInfo;
  13349. var info = errorInfo || props.info;
  13350. var Points = [];
  13351. for (var i = 0; i < length; i++) {
  13352. var _ref;
  13353. var _char = value[i];
  13354. var showBorder = i !== 0 && !gutter;
  13355. var showCursor = focused && i === value.length;
  13356. var style = void 0;
  13357. if (i !== 0 && gutter) {
  13358. style = {
  13359. marginLeft: Object(unit["a" /* addUnit */])(gutter)
  13360. };
  13361. }
  13362. Points.push(h("li", {
  13363. "class": [(_ref = {}, _ref[BORDER_LEFT] = showBorder, _ref), password_input_bem('item', {
  13364. focus: showCursor
  13365. })],
  13366. "style": style
  13367. }, [mask ? h("i", {
  13368. "style": {
  13369. visibility: _char ? 'visible' : 'hidden'
  13370. }
  13371. }) : _char, showCursor && h("div", {
  13372. "class": password_input_bem('cursor')
  13373. })]));
  13374. }
  13375. return h("div", {
  13376. "class": password_input_bem()
  13377. }, [h("ul", helper_default()([{
  13378. "class": [password_input_bem('security'), (_ref2 = {}, _ref2[BORDER_SURROUND] = !gutter, _ref2)],
  13379. "on": {
  13380. "touchstart": function touchstart(event) {
  13381. event.stopPropagation();
  13382. functional_emit(ctx, 'focus', event);
  13383. }
  13384. }
  13385. }, inherit(ctx, true)]), [Points]), info && h("div", {
  13386. "class": password_input_bem(errorInfo ? 'error-info' : 'info')
  13387. }, [info])]);
  13388. }
  13389. PasswordInput.props = {
  13390. info: String,
  13391. gutter: [Number, String],
  13392. focused: Boolean,
  13393. errorInfo: String,
  13394. mask: {
  13395. type: Boolean,
  13396. default: true
  13397. },
  13398. value: {
  13399. type: String,
  13400. default: ''
  13401. },
  13402. length: {
  13403. type: [Number, String],
  13404. default: 6
  13405. }
  13406. };
  13407. /* harmony default export */ var password_input = (password_input_createComponent(PasswordInput));
  13408. // CONCATENATED MODULE: ./node_modules/@vant/popperjs/dist/esm/index.js
  13409. function getBoundingClientRect(element) {
  13410. var rect = element.getBoundingClientRect();
  13411. return {
  13412. width: rect.width,
  13413. height: rect.height,
  13414. top: rect.top,
  13415. right: rect.right,
  13416. bottom: rect.bottom,
  13417. left: rect.left,
  13418. x: rect.left,
  13419. y: rect.top
  13420. };
  13421. }
  13422. function getWindow(node) {
  13423. if (node == null) {
  13424. return window;
  13425. }
  13426. if (node.toString() !== '[object Window]') {
  13427. var ownerDocument = node.ownerDocument;
  13428. return ownerDocument ? ownerDocument.defaultView || window : window;
  13429. }
  13430. return node;
  13431. }
  13432. function getWindowScroll(node) {
  13433. var win = getWindow(node);
  13434. var scrollLeft = win.pageXOffset;
  13435. var scrollTop = win.pageYOffset;
  13436. return {
  13437. scrollLeft: scrollLeft,
  13438. scrollTop: scrollTop
  13439. };
  13440. }
  13441. function isElement(node) {
  13442. var OwnElement = getWindow(node).Element;
  13443. return node instanceof OwnElement || node instanceof Element;
  13444. }
  13445. function isHTMLElement(node) {
  13446. var OwnElement = getWindow(node).HTMLElement;
  13447. return node instanceof OwnElement || node instanceof HTMLElement;
  13448. }
  13449. function isShadowRoot(node) {
  13450. // IE 11 has no ShadowRoot
  13451. if (typeof ShadowRoot === 'undefined') {
  13452. return false;
  13453. }
  13454. var OwnElement = getWindow(node).ShadowRoot;
  13455. return node instanceof OwnElement || node instanceof ShadowRoot;
  13456. }
  13457. function getHTMLElementScroll(element) {
  13458. return {
  13459. scrollLeft: element.scrollLeft,
  13460. scrollTop: element.scrollTop
  13461. };
  13462. }
  13463. function getNodeScroll(node) {
  13464. if (node === getWindow(node) || !isHTMLElement(node)) {
  13465. return getWindowScroll(node);
  13466. } else {
  13467. return getHTMLElementScroll(node);
  13468. }
  13469. }
  13470. function getNodeName(element) {
  13471. return element ? (element.nodeName || '').toLowerCase() : null;
  13472. }
  13473. function getDocumentElement(element) {
  13474. // $FlowFixMe[incompatible-return]: assume body is always available
  13475. return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]
  13476. element.document) || window.document).documentElement;
  13477. }
  13478. function getWindowScrollBarX(element) {
  13479. // If <html> has a CSS width greater than the viewport, then this will be
  13480. // incorrect for RTL.
  13481. // Popper 1 is broken in this case and never had a bug report so let's assume
  13482. // it's not an issue. I don't think anyone ever specifies width on <html>
  13483. // anyway.
  13484. // Browsers where the left scrollbar doesn't cause an issue report `0` for
  13485. // this (e.g. Edge 2019, IE11, Safari)
  13486. return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
  13487. }
  13488. function getComputedStyle(element) {
  13489. return getWindow(element).getComputedStyle(element);
  13490. }
  13491. function isScrollParent(element) {
  13492. // Firefox wants us to check `-x` and `-y` variations as well
  13493. var _getComputedStyle = getComputedStyle(element),
  13494. overflow = _getComputedStyle.overflow,
  13495. overflowX = _getComputedStyle.overflowX,
  13496. overflowY = _getComputedStyle.overflowY;
  13497. return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
  13498. }
  13499. // Composite means it takes into account transforms as well as layout.
  13500. function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
  13501. if (isFixed === void 0) {
  13502. isFixed = false;
  13503. }
  13504. var documentElement = getDocumentElement(offsetParent);
  13505. var rect = getBoundingClientRect(elementOrVirtualElement);
  13506. var isOffsetParentAnElement = isHTMLElement(offsetParent);
  13507. var scroll = {
  13508. scrollLeft: 0,
  13509. scrollTop: 0
  13510. };
  13511. var offsets = {
  13512. x: 0,
  13513. y: 0
  13514. };
  13515. if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
  13516. if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078
  13517. isScrollParent(documentElement)) {
  13518. scroll = getNodeScroll(offsetParent);
  13519. }
  13520. if (isHTMLElement(offsetParent)) {
  13521. offsets = getBoundingClientRect(offsetParent);
  13522. offsets.x += offsetParent.clientLeft;
  13523. offsets.y += offsetParent.clientTop;
  13524. } else if (documentElement) {
  13525. offsets.x = getWindowScrollBarX(documentElement);
  13526. }
  13527. }
  13528. return {
  13529. x: rect.left + scroll.scrollLeft - offsets.x,
  13530. y: rect.top + scroll.scrollTop - offsets.y,
  13531. width: rect.width,
  13532. height: rect.height
  13533. };
  13534. }
  13535. // means it doesn't take into account transforms.
  13536. function getLayoutRect(element) {
  13537. var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
  13538. // Fixes https://github.com/popperjs/popper-core/issues/1223
  13539. var width = element.offsetWidth;
  13540. var height = element.offsetHeight;
  13541. if (Math.abs(clientRect.width - width) <= 1) {
  13542. width = clientRect.width;
  13543. }
  13544. if (Math.abs(clientRect.height - height) <= 1) {
  13545. height = clientRect.height;
  13546. }
  13547. return {
  13548. x: element.offsetLeft,
  13549. y: element.offsetTop,
  13550. width: width,
  13551. height: height
  13552. };
  13553. }
  13554. function getParentNode(element) {
  13555. if (getNodeName(element) === 'html') {
  13556. return element;
  13557. }
  13558. return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
  13559. // $FlowFixMe[incompatible-return]
  13560. // $FlowFixMe[prop-missing]
  13561. element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
  13562. element.parentNode || ( // DOM Element detected
  13563. isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
  13564. // $FlowFixMe[incompatible-call]: HTMLElement is a Node
  13565. getDocumentElement(element) // fallback
  13566. );
  13567. }
  13568. function getScrollParent(node) {
  13569. if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
  13570. // $FlowFixMe[incompatible-return]: assume body is always available
  13571. return node.ownerDocument.body;
  13572. }
  13573. if (isHTMLElement(node) && isScrollParent(node)) {
  13574. return node;
  13575. }
  13576. return getScrollParent(getParentNode(node));
  13577. }
  13578. /*
  13579. given a DOM element, return the list of all scroll parents, up the list of ancesors
  13580. until we get to the top window object. This list is what we attach scroll listeners
  13581. to, because if any of these parent elements scroll, we'll need to re-calculate the
  13582. reference element's position.
  13583. */
  13584. function listScrollParents(element, list) {
  13585. var _element$ownerDocumen;
  13586. if (list === void 0) {
  13587. list = [];
  13588. }
  13589. var scrollParent = getScrollParent(element);
  13590. var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
  13591. var win = getWindow(scrollParent);
  13592. var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
  13593. var updatedList = list.concat(target);
  13594. return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
  13595. updatedList.concat(listScrollParents(getParentNode(target)));
  13596. }
  13597. function isTableElement(element) {
  13598. return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;
  13599. }
  13600. function getTrueOffsetParent(element) {
  13601. if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
  13602. getComputedStyle(element).position === 'fixed') {
  13603. return null;
  13604. }
  13605. return element.offsetParent;
  13606. } // `.offsetParent` reports `null` for fixed elements, while absolute elements
  13607. // return the containing block
  13608. function getContainingBlock(element) {
  13609. var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') !== -1;
  13610. var isIE = navigator.userAgent.indexOf('Trident') !== -1;
  13611. if (isIE && isHTMLElement(element)) {
  13612. // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
  13613. var elementCss = getComputedStyle(element);
  13614. if (elementCss.position === 'fixed') {
  13615. return null;
  13616. }
  13617. }
  13618. var currentNode = getParentNode(element);
  13619. while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
  13620. var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
  13621. // create a containing block.
  13622. // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
  13623. if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {
  13624. return currentNode;
  13625. } else {
  13626. currentNode = currentNode.parentNode;
  13627. }
  13628. }
  13629. return null;
  13630. } // Gets the closest ancestor positioned element. Handles some edge cases,
  13631. // such as table ancestors and cross browser bugs.
  13632. function getOffsetParent(element) {
  13633. var window = getWindow(element);
  13634. var offsetParent = getTrueOffsetParent(element);
  13635. while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
  13636. offsetParent = getTrueOffsetParent(offsetParent);
  13637. }
  13638. if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {
  13639. return window;
  13640. }
  13641. return offsetParent || getContainingBlock(element) || window;
  13642. }
  13643. var esm_top = 'top';
  13644. var esm_bottom = 'bottom';
  13645. var right = 'right';
  13646. var esm_left = 'left';
  13647. var auto = 'auto';
  13648. var basePlacements = [esm_top, esm_bottom, right, esm_left];
  13649. var esm_start = 'start';
  13650. var end = 'end';
  13651. var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
  13652. return acc.concat([placement, placement + "-" + esm_start, placement + "-" + end]);
  13653. }, []); // modifiers that need to read the DOM
  13654. var beforeRead = 'beforeRead';
  13655. var read = 'read';
  13656. var afterRead = 'afterRead'; // pure-logic modifiers
  13657. var beforeMain = 'beforeMain';
  13658. var main = 'main';
  13659. var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
  13660. var beforeWrite = 'beforeWrite';
  13661. var write = 'write';
  13662. var afterWrite = 'afterWrite';
  13663. var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
  13664. function order(modifiers) {
  13665. var map = new Map();
  13666. var visited = new Set();
  13667. var result = [];
  13668. modifiers.forEach(function (modifier) {
  13669. map.set(modifier.name, modifier);
  13670. }); // On visiting object, check for its dependencies and visit them recursively
  13671. function sort(modifier) {
  13672. visited.add(modifier.name);
  13673. var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
  13674. requires.forEach(function (dep) {
  13675. if (!visited.has(dep)) {
  13676. var depModifier = map.get(dep);
  13677. if (depModifier) {
  13678. sort(depModifier);
  13679. }
  13680. }
  13681. });
  13682. result.push(modifier);
  13683. }
  13684. modifiers.forEach(function (modifier) {
  13685. if (!visited.has(modifier.name)) {
  13686. // check for visited object
  13687. sort(modifier);
  13688. }
  13689. });
  13690. return result;
  13691. }
  13692. function orderModifiers(modifiers) {
  13693. // order based on dependencies
  13694. var orderedModifiers = order(modifiers); // order based on phase
  13695. return modifierPhases.reduce(function (acc, phase) {
  13696. return acc.concat(orderedModifiers.filter(function (modifier) {
  13697. return modifier.phase === phase;
  13698. }));
  13699. }, []);
  13700. }
  13701. function debounce(fn) {
  13702. var pending;
  13703. return function () {
  13704. if (!pending) {
  13705. pending = new Promise(function (resolve) {
  13706. Promise.resolve().then(function () {
  13707. pending = undefined;
  13708. resolve(fn());
  13709. });
  13710. });
  13711. }
  13712. return pending;
  13713. };
  13714. }
  13715. function esm_format(str) {
  13716. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  13717. args[_key - 1] = arguments[_key];
  13718. }
  13719. return [].concat(args).reduce(function (p, c) {
  13720. return p.replace(/%s/, c);
  13721. }, str);
  13722. }
  13723. var INVALID_MODIFIER_ERROR = 'Popper: modifier "%s" provided an invalid %s property, expected %s but got %s';
  13724. var MISSING_DEPENDENCY_ERROR = 'Popper: modifier "%s" requires "%s", but "%s" modifier is not available';
  13725. var VALID_PROPERTIES = ['name', 'enabled', 'phase', 'fn', 'effect', 'requires', 'options'];
  13726. function validateModifiers(modifiers) {
  13727. modifiers.forEach(function (modifier) {
  13728. Object.keys(modifier).forEach(function (key) {
  13729. switch (key) {
  13730. case 'name':
  13731. if (typeof modifier.name !== 'string') {
  13732. console.error(esm_format(INVALID_MODIFIER_ERROR, String(modifier.name), '"name"', '"string"', "\"" + String(modifier.name) + "\""));
  13733. }
  13734. break;
  13735. case 'enabled':
  13736. if (typeof modifier.enabled !== 'boolean') {
  13737. console.error(esm_format(INVALID_MODIFIER_ERROR, modifier.name, '"enabled"', '"boolean"', "\"" + String(modifier.enabled) + "\""));
  13738. }
  13739. case 'phase':
  13740. if (modifierPhases.indexOf(modifier.phase) < 0) {
  13741. console.error(esm_format(INVALID_MODIFIER_ERROR, modifier.name, '"phase"', "either " + modifierPhases.join(', '), "\"" + String(modifier.phase) + "\""));
  13742. }
  13743. break;
  13744. case 'fn':
  13745. if (typeof modifier.fn !== 'function') {
  13746. console.error(esm_format(INVALID_MODIFIER_ERROR, modifier.name, '"fn"', '"function"', "\"" + String(modifier.fn) + "\""));
  13747. }
  13748. break;
  13749. case 'effect':
  13750. if (typeof modifier.effect !== 'function') {
  13751. console.error(esm_format(INVALID_MODIFIER_ERROR, modifier.name, '"effect"', '"function"', "\"" + String(modifier.fn) + "\""));
  13752. }
  13753. break;
  13754. case 'requires':
  13755. if (!Array.isArray(modifier.requires)) {
  13756. console.error(esm_format(INVALID_MODIFIER_ERROR, modifier.name, '"requires"', '"array"', "\"" + String(modifier.requires) + "\""));
  13757. }
  13758. break;
  13759. case 'requiresIfExists':
  13760. if (!Array.isArray(modifier.requiresIfExists)) {
  13761. console.error(esm_format(INVALID_MODIFIER_ERROR, modifier.name, '"requiresIfExists"', '"array"', "\"" + String(modifier.requiresIfExists) + "\""));
  13762. }
  13763. break;
  13764. case 'options':
  13765. case 'data':
  13766. break;
  13767. default:
  13768. console.error("PopperJS: an invalid property has been provided to the \"" + modifier.name + "\" modifier, valid properties are " + VALID_PROPERTIES.map(function (s) {
  13769. return "\"" + s + "\"";
  13770. }).join(', ') + "; but \"" + key + "\" was provided.");
  13771. }
  13772. modifier.requires && modifier.requires.forEach(function (requirement) {
  13773. if (modifiers.find(function (mod) {
  13774. return mod.name === requirement;
  13775. }) == null) {
  13776. console.error(esm_format(MISSING_DEPENDENCY_ERROR, String(modifier.name), requirement, requirement));
  13777. }
  13778. });
  13779. });
  13780. });
  13781. }
  13782. function uniqueBy(arr, fn) {
  13783. var identifiers = new Set();
  13784. return arr.filter(function (item) {
  13785. var identifier = fn(item);
  13786. if (!identifiers.has(identifier)) {
  13787. identifiers.add(identifier);
  13788. return true;
  13789. }
  13790. });
  13791. }
  13792. function getBasePlacement(placement) {
  13793. return placement.split('-')[0];
  13794. }
  13795. function mergeByName(modifiers) {
  13796. var merged = modifiers.reduce(function (merged, current) {
  13797. var existing = merged[current.name];
  13798. merged[current.name] = existing ? Object.assign({}, existing, current, {
  13799. options: Object.assign({}, existing.options, current.options),
  13800. data: Object.assign({}, existing.data, current.data)
  13801. }) : current;
  13802. return merged;
  13803. }, {}); // IE11 does not support Object.values
  13804. return Object.keys(merged).map(function (key) {
  13805. return merged[key];
  13806. });
  13807. }
  13808. var esm_round = Math.round;
  13809. function getVariation(placement) {
  13810. return placement.split('-')[1];
  13811. }
  13812. function getMainAxisFromPlacement(placement) {
  13813. return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
  13814. }
  13815. function computeOffsets(_ref) {
  13816. var reference = _ref.reference,
  13817. element = _ref.element,
  13818. placement = _ref.placement;
  13819. var basePlacement = placement ? getBasePlacement(placement) : null;
  13820. var variation = placement ? getVariation(placement) : null;
  13821. var commonX = reference.x + reference.width / 2 - element.width / 2;
  13822. var commonY = reference.y + reference.height / 2 - element.height / 2;
  13823. var offsets;
  13824. switch (basePlacement) {
  13825. case esm_top:
  13826. offsets = {
  13827. x: commonX,
  13828. y: reference.y - element.height
  13829. };
  13830. break;
  13831. case esm_bottom:
  13832. offsets = {
  13833. x: commonX,
  13834. y: reference.y + reference.height
  13835. };
  13836. break;
  13837. case right:
  13838. offsets = {
  13839. x: reference.x + reference.width,
  13840. y: commonY
  13841. };
  13842. break;
  13843. case esm_left:
  13844. offsets = {
  13845. x: reference.x - element.width,
  13846. y: commonY
  13847. };
  13848. break;
  13849. default:
  13850. offsets = {
  13851. x: reference.x,
  13852. y: reference.y
  13853. };
  13854. }
  13855. var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
  13856. if (mainAxis != null) {
  13857. var len = mainAxis === 'y' ? 'height' : 'width';
  13858. switch (variation) {
  13859. case esm_start:
  13860. offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
  13861. break;
  13862. case end:
  13863. offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
  13864. break;
  13865. }
  13866. }
  13867. return offsets;
  13868. }
  13869. var INVALID_ELEMENT_ERROR = 'Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.';
  13870. var INFINITE_LOOP_ERROR = 'Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.';
  13871. var DEFAULT_OPTIONS = {
  13872. placement: 'bottom',
  13873. modifiers: [],
  13874. strategy: 'absolute'
  13875. };
  13876. function areValidElements() {
  13877. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  13878. args[_key] = arguments[_key];
  13879. }
  13880. return !args.some(function (element) {
  13881. return !(element && typeof element.getBoundingClientRect === 'function');
  13882. });
  13883. }
  13884. function popperGenerator(generatorOptions) {
  13885. if (generatorOptions === void 0) {
  13886. generatorOptions = {};
  13887. }
  13888. var _generatorOptions = generatorOptions,
  13889. _generatorOptions$def = _generatorOptions.defaultModifiers,
  13890. defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,
  13891. _generatorOptions$def2 = _generatorOptions.defaultOptions,
  13892. defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
  13893. return function createPopper(reference, popper, options) {
  13894. if (options === void 0) {
  13895. options = defaultOptions;
  13896. }
  13897. var state = {
  13898. placement: 'bottom',
  13899. orderedModifiers: [],
  13900. options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
  13901. modifiersData: {},
  13902. elements: {
  13903. reference: reference,
  13904. popper: popper
  13905. },
  13906. attributes: {},
  13907. styles: {}
  13908. };
  13909. var effectCleanupFns = [];
  13910. var isDestroyed = false;
  13911. var instance = {
  13912. state: state,
  13913. setOptions: function setOptions(options) {
  13914. cleanupModifierEffects();
  13915. state.options = Object.assign({}, defaultOptions, state.options, options);
  13916. state.scrollParents = {
  13917. reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
  13918. popper: listScrollParents(popper)
  13919. }; // Orders the modifiers based on their dependencies and `phase`
  13920. // properties
  13921. var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers
  13922. state.orderedModifiers = orderedModifiers.filter(function (m) {
  13923. return m.enabled;
  13924. }); // Validate the provided modifiers so that the consumer will get warned
  13925. // if one of the modifiers is invalid for any reason
  13926. if (false) { var _getComputedStyle, marginTop, marginRight, marginBottom, marginLeft, flipModifier, modifiers; }
  13927. runModifierEffects();
  13928. return instance.update();
  13929. },
  13930. // Sync update – it will always be executed, even if not necessary. This
  13931. // is useful for low frequency updates where sync behavior simplifies the
  13932. // logic.
  13933. // For high frequency updates (e.g. `resize` and `scroll` events), always
  13934. // prefer the async Popper#update method
  13935. forceUpdate: function forceUpdate() {
  13936. if (isDestroyed) {
  13937. return;
  13938. }
  13939. var _state$elements = state.elements,
  13940. reference = _state$elements.reference,
  13941. popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements
  13942. // anymore
  13943. if (!areValidElements(reference, popper)) {
  13944. if (false) {}
  13945. return;
  13946. } // Store the reference and popper rects to be read by modifiers
  13947. state.rects = {
  13948. reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),
  13949. popper: getLayoutRect(popper)
  13950. }; // Modifiers have the ability to reset the current update cycle. The
  13951. // most common use case for this is the `flip` modifier changing the
  13952. // placement, which then needs to re-run all the modifiers, because the
  13953. // logic was previously ran for the previous placement and is therefore
  13954. // stale/incorrect
  13955. state.reset = false;
  13956. state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier
  13957. // is filled with the initial data specified by the modifier. This means
  13958. // it doesn't persist and is fresh on each update.
  13959. // To ensure persistent data, use `${name}#persistent`
  13960. state.orderedModifiers.forEach(function (modifier) {
  13961. return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
  13962. });
  13963. var __debug_loops__ = 0;
  13964. for (var index = 0; index < state.orderedModifiers.length; index++) {
  13965. if (false) {}
  13966. if (state.reset === true) {
  13967. state.reset = false;
  13968. index = -1;
  13969. continue;
  13970. }
  13971. var _state$orderedModifie = state.orderedModifiers[index],
  13972. fn = _state$orderedModifie.fn,
  13973. _state$orderedModifie2 = _state$orderedModifie.options,
  13974. _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,
  13975. name = _state$orderedModifie.name;
  13976. if (typeof fn === 'function') {
  13977. state = fn({
  13978. state: state,
  13979. options: _options,
  13980. name: name,
  13981. instance: instance
  13982. }) || state;
  13983. }
  13984. }
  13985. },
  13986. // Async and optimistically optimized update – it will not be executed if
  13987. // not necessary (debounced to run at most once-per-tick)
  13988. update: debounce(function () {
  13989. return new Promise(function (resolve) {
  13990. instance.forceUpdate();
  13991. resolve(state);
  13992. });
  13993. }),
  13994. destroy: function destroy() {
  13995. cleanupModifierEffects();
  13996. isDestroyed = true;
  13997. }
  13998. };
  13999. if (!areValidElements(reference, popper)) {
  14000. if (false) {}
  14001. return instance;
  14002. }
  14003. instance.setOptions(options).then(function (state) {
  14004. if (!isDestroyed && options.onFirstUpdate) {
  14005. options.onFirstUpdate(state);
  14006. }
  14007. }); // Modifiers have the ability to execute arbitrary code before the first
  14008. // update cycle runs. They will be executed in the same order as the update
  14009. // cycle. This is useful when a modifier adds some persistent data that
  14010. // other modifiers need to use, but the modifier is run after the dependent
  14011. // one.
  14012. function runModifierEffects() {
  14013. state.orderedModifiers.forEach(function (_ref3) {
  14014. var name = _ref3.name,
  14015. _ref3$options = _ref3.options,
  14016. options = _ref3$options === void 0 ? {} : _ref3$options,
  14017. effect = _ref3.effect;
  14018. if (typeof effect === 'function') {
  14019. var cleanupFn = effect({
  14020. state: state,
  14021. name: name,
  14022. instance: instance,
  14023. options: options
  14024. });
  14025. var noopFn = function noopFn() {};
  14026. effectCleanupFns.push(cleanupFn || noopFn);
  14027. }
  14028. });
  14029. }
  14030. function cleanupModifierEffects() {
  14031. effectCleanupFns.forEach(function (fn) {
  14032. return fn();
  14033. });
  14034. effectCleanupFns = [];
  14035. }
  14036. return instance;
  14037. };
  14038. }
  14039. var esm_passive = {
  14040. passive: true
  14041. };
  14042. function effect(_ref) {
  14043. var state = _ref.state,
  14044. instance = _ref.instance,
  14045. options = _ref.options;
  14046. var _options$scroll = options.scroll,
  14047. scroll = _options$scroll === void 0 ? true : _options$scroll,
  14048. _options$resize = options.resize,
  14049. resize = _options$resize === void 0 ? true : _options$resize;
  14050. var window = getWindow(state.elements.popper);
  14051. var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
  14052. if (scroll) {
  14053. scrollParents.forEach(function (scrollParent) {
  14054. scrollParent.addEventListener('scroll', instance.update, esm_passive);
  14055. });
  14056. }
  14057. if (resize) {
  14058. window.addEventListener('resize', instance.update, esm_passive);
  14059. }
  14060. return function () {
  14061. if (scroll) {
  14062. scrollParents.forEach(function (scrollParent) {
  14063. scrollParent.removeEventListener('scroll', instance.update, esm_passive);
  14064. });
  14065. }
  14066. if (resize) {
  14067. window.removeEventListener('resize', instance.update, esm_passive);
  14068. }
  14069. };
  14070. } // eslint-disable-next-line import/no-unused-modules
  14071. var eventListeners = {
  14072. name: 'eventListeners',
  14073. enabled: true,
  14074. phase: 'write',
  14075. fn: function fn() {},
  14076. effect: effect,
  14077. data: {}
  14078. };
  14079. function popperOffsets(_ref) {
  14080. var state = _ref.state,
  14081. name = _ref.name; // Offsets are the actual position the popper needs to have to be
  14082. // properly positioned near its reference element
  14083. // This is the most basic placement, and will be adjusted by
  14084. // the modifiers in the next step
  14085. state.modifiersData[name] = computeOffsets({
  14086. reference: state.rects.reference,
  14087. element: state.rects.popper,
  14088. strategy: 'absolute',
  14089. placement: state.placement
  14090. });
  14091. } // eslint-disable-next-line import/no-unused-modules
  14092. var popperOffsets$1 = {
  14093. name: 'popperOffsets',
  14094. enabled: true,
  14095. phase: 'read',
  14096. fn: popperOffsets,
  14097. data: {}
  14098. };
  14099. var unsetSides = {
  14100. top: 'auto',
  14101. right: 'auto',
  14102. bottom: 'auto',
  14103. left: 'auto'
  14104. }; // Round the offsets to the nearest suitable subpixel based on the DPR.
  14105. // Zooming can change the DPR, but it seems to report a value that will
  14106. // cleanly divide the values into the appropriate subpixels.
  14107. function roundOffsetsByDPR(_ref) {
  14108. var x = _ref.x,
  14109. y = _ref.y;
  14110. var win = window;
  14111. var dpr = win.devicePixelRatio || 1;
  14112. return {
  14113. x: esm_round(esm_round(x * dpr) / dpr) || 0,
  14114. y: esm_round(esm_round(y * dpr) / dpr) || 0
  14115. };
  14116. }
  14117. function mapToStyles(_ref2) {
  14118. var _Object$assign2;
  14119. var popper = _ref2.popper,
  14120. popperRect = _ref2.popperRect,
  14121. placement = _ref2.placement,
  14122. offsets = _ref2.offsets,
  14123. position = _ref2.position,
  14124. gpuAcceleration = _ref2.gpuAcceleration,
  14125. adaptive = _ref2.adaptive,
  14126. roundOffsets = _ref2.roundOffsets;
  14127. var _ref3 = roundOffsets === true ? roundOffsetsByDPR(offsets) : typeof roundOffsets === 'function' ? roundOffsets(offsets) : offsets,
  14128. _ref3$x = _ref3.x,
  14129. x = _ref3$x === void 0 ? 0 : _ref3$x,
  14130. _ref3$y = _ref3.y,
  14131. y = _ref3$y === void 0 ? 0 : _ref3$y;
  14132. var hasX = offsets.hasOwnProperty('x');
  14133. var hasY = offsets.hasOwnProperty('y');
  14134. var sideX = esm_left;
  14135. var sideY = esm_top;
  14136. var win = window;
  14137. if (adaptive) {
  14138. var offsetParent = getOffsetParent(popper);
  14139. var heightProp = 'clientHeight';
  14140. var widthProp = 'clientWidth';
  14141. if (offsetParent === getWindow(popper)) {
  14142. offsetParent = getDocumentElement(popper);
  14143. if (getComputedStyle(offsetParent).position !== 'static') {
  14144. heightProp = 'scrollHeight';
  14145. widthProp = 'scrollWidth';
  14146. }
  14147. } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
  14148. offsetParent = offsetParent;
  14149. if (placement === esm_top) {
  14150. sideY = esm_bottom; // $FlowFixMe[prop-missing]
  14151. y -= offsetParent[heightProp] - popperRect.height;
  14152. y *= gpuAcceleration ? 1 : -1;
  14153. }
  14154. if (placement === esm_left) {
  14155. sideX = right; // $FlowFixMe[prop-missing]
  14156. x -= offsetParent[widthProp] - popperRect.width;
  14157. x *= gpuAcceleration ? 1 : -1;
  14158. }
  14159. }
  14160. var commonStyles = Object.assign({
  14161. position: position
  14162. }, adaptive && unsetSides);
  14163. if (gpuAcceleration) {
  14164. var _Object$assign;
  14165. return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) < 2 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
  14166. }
  14167. return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
  14168. }
  14169. function computeStyles(_ref4) {
  14170. var state = _ref4.state,
  14171. options = _ref4.options;
  14172. var _options$gpuAccelerat = options.gpuAcceleration,
  14173. gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
  14174. _options$adaptive = options.adaptive,
  14175. adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
  14176. _options$roundOffsets = options.roundOffsets,
  14177. roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
  14178. if (false) { var transitionProperty; }
  14179. var commonStyles = {
  14180. placement: getBasePlacement(state.placement),
  14181. popper: state.elements.popper,
  14182. popperRect: state.rects.popper,
  14183. gpuAcceleration: gpuAcceleration
  14184. };
  14185. if (state.modifiersData.popperOffsets != null) {
  14186. state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
  14187. offsets: state.modifiersData.popperOffsets,
  14188. position: state.options.strategy,
  14189. adaptive: adaptive,
  14190. roundOffsets: roundOffsets
  14191. })));
  14192. }
  14193. if (state.modifiersData.arrow != null) {
  14194. state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
  14195. offsets: state.modifiersData.arrow,
  14196. position: 'absolute',
  14197. adaptive: false,
  14198. roundOffsets: roundOffsets
  14199. })));
  14200. }
  14201. state.attributes.popper = Object.assign({}, state.attributes.popper, {
  14202. 'data-popper-placement': state.placement
  14203. });
  14204. } // eslint-disable-next-line import/no-unused-modules
  14205. var computeStyles$1 = {
  14206. name: 'computeStyles',
  14207. enabled: true,
  14208. phase: 'beforeWrite',
  14209. fn: computeStyles,
  14210. data: {}
  14211. };
  14212. // and applies them to the HTMLElements such as popper and arrow
  14213. function applyStyles(_ref) {
  14214. var state = _ref.state;
  14215. Object.keys(state.elements).forEach(function (name) {
  14216. var style = state.styles[name] || {};
  14217. var attributes = state.attributes[name] || {};
  14218. var element = state.elements[name]; // arrow is optional + virtual elements
  14219. if (!isHTMLElement(element) || !getNodeName(element)) {
  14220. return;
  14221. } // Flow doesn't support to extend this property, but it's the most
  14222. // effective way to apply styles to an HTMLElement
  14223. // $FlowFixMe[cannot-write]
  14224. Object.assign(element.style, style);
  14225. Object.keys(attributes).forEach(function (name) {
  14226. var value = attributes[name];
  14227. if (value === false) {
  14228. element.removeAttribute(name);
  14229. } else {
  14230. element.setAttribute(name, value === true ? '' : value);
  14231. }
  14232. });
  14233. });
  14234. }
  14235. function effect$1(_ref2) {
  14236. var state = _ref2.state;
  14237. var initialStyles = {
  14238. popper: {
  14239. position: state.options.strategy,
  14240. left: '0',
  14241. top: '0',
  14242. margin: '0'
  14243. },
  14244. arrow: {
  14245. position: 'absolute'
  14246. },
  14247. reference: {}
  14248. };
  14249. Object.assign(state.elements.popper.style, initialStyles.popper);
  14250. state.styles = initialStyles;
  14251. if (state.elements.arrow) {
  14252. Object.assign(state.elements.arrow.style, initialStyles.arrow);
  14253. }
  14254. return function () {
  14255. Object.keys(state.elements).forEach(function (name) {
  14256. var element = state.elements[name];
  14257. var attributes = state.attributes[name] || {};
  14258. var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them
  14259. var style = styleProperties.reduce(function (style, property) {
  14260. style[property] = '';
  14261. return style;
  14262. }, {}); // arrow is optional + virtual elements
  14263. if (!isHTMLElement(element) || !getNodeName(element)) {
  14264. return;
  14265. }
  14266. Object.assign(element.style, style);
  14267. Object.keys(attributes).forEach(function (attribute) {
  14268. element.removeAttribute(attribute);
  14269. });
  14270. });
  14271. };
  14272. } // eslint-disable-next-line import/no-unused-modules
  14273. var applyStyles$1 = {
  14274. name: 'applyStyles',
  14275. enabled: true,
  14276. phase: 'write',
  14277. fn: applyStyles,
  14278. effect: effect$1,
  14279. requires: ['computeStyles']
  14280. };
  14281. var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1];
  14282. var esm_createPopper = /*#__PURE__*/popperGenerator({
  14283. defaultModifiers: defaultModifiers
  14284. }); // eslint-disable-next-line import/no-unused-modules
  14285. function distanceAndSkiddingToXY(placement, rects, offset) {
  14286. var basePlacement = getBasePlacement(placement);
  14287. var invertDistance = [esm_left, esm_top].indexOf(basePlacement) >= 0 ? -1 : 1;
  14288. var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {
  14289. placement: placement
  14290. })) : offset,
  14291. skidding = _ref[0],
  14292. distance = _ref[1];
  14293. skidding = skidding || 0;
  14294. distance = (distance || 0) * invertDistance;
  14295. return [esm_left, right].indexOf(basePlacement) >= 0 ? {
  14296. x: distance,
  14297. y: skidding
  14298. } : {
  14299. x: skidding,
  14300. y: distance
  14301. };
  14302. }
  14303. function esm_offset(_ref2) {
  14304. var state = _ref2.state,
  14305. options = _ref2.options,
  14306. name = _ref2.name;
  14307. var _options$offset = options.offset,
  14308. offset = _options$offset === void 0 ? [0, 0] : _options$offset;
  14309. var data = placements.reduce(function (acc, placement) {
  14310. acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);
  14311. return acc;
  14312. }, {});
  14313. var _data$state$placement = data[state.placement],
  14314. x = _data$state$placement.x,
  14315. y = _data$state$placement.y;
  14316. if (state.modifiersData.popperOffsets != null) {
  14317. state.modifiersData.popperOffsets.x += x;
  14318. state.modifiersData.popperOffsets.y += y;
  14319. }
  14320. state.modifiersData[name] = data;
  14321. } // eslint-disable-next-line import/no-unused-modules
  14322. var offset$1 = {
  14323. name: 'offset',
  14324. enabled: true,
  14325. phase: 'main',
  14326. requires: ['popperOffsets'],
  14327. fn: esm_offset
  14328. };
  14329. // CONCATENATED MODULE: ./es/popover/index.js
  14330. // Mixins
  14331. // Components
  14332. var popover_createNamespace = Object(create["a" /* createNamespace */])('popover'),
  14333. popover_createComponent = popover_createNamespace[0],
  14334. popover_bem = popover_createNamespace[1];
  14335. /* harmony default export */ var popover = (popover_createComponent({
  14336. mixins: [click_outside_ClickOutsideMixin({
  14337. event: 'touchstart',
  14338. method: 'onClickOutside'
  14339. })],
  14340. props: {
  14341. value: Boolean,
  14342. trigger: String,
  14343. overlay: Boolean,
  14344. offset: {
  14345. type: Array,
  14346. default: function _default() {
  14347. return [0, 8];
  14348. }
  14349. },
  14350. theme: {
  14351. type: String,
  14352. default: 'light'
  14353. },
  14354. actions: {
  14355. type: Array,
  14356. default: function _default() {
  14357. return [];
  14358. }
  14359. },
  14360. placement: {
  14361. type: String,
  14362. default: 'bottom'
  14363. },
  14364. getContainer: {
  14365. type: [String, Function],
  14366. default: 'body'
  14367. },
  14368. closeOnClickAction: {
  14369. type: Boolean,
  14370. default: true
  14371. }
  14372. },
  14373. watch: {
  14374. value: 'updateLocation',
  14375. placement: 'updateLocation'
  14376. },
  14377. mounted: function mounted() {
  14378. this.updateLocation();
  14379. },
  14380. beforeDestroy: function beforeDestroy() {
  14381. if (this.popper) {
  14382. this.popper.destroy();
  14383. this.popper = null;
  14384. }
  14385. },
  14386. methods: {
  14387. createPopper: function createPopper() {
  14388. return esm_createPopper(this.$refs.wrapper, this.$refs.popover.$el, {
  14389. placement: this.placement,
  14390. modifiers: [{
  14391. name: 'computeStyles',
  14392. options: {
  14393. adaptive: false,
  14394. gpuAcceleration: false
  14395. }
  14396. }, _extends({}, offset$1, {
  14397. options: {
  14398. offset: this.offset
  14399. }
  14400. })]
  14401. });
  14402. },
  14403. updateLocation: function updateLocation() {
  14404. var _this = this;
  14405. this.$nextTick(function () {
  14406. if (!_this.value) {
  14407. return;
  14408. }
  14409. if (!_this.popper) {
  14410. _this.popper = _this.createPopper();
  14411. } else {
  14412. _this.popper.setOptions({
  14413. placement: _this.placement
  14414. });
  14415. }
  14416. });
  14417. },
  14418. renderAction: function renderAction(action, index) {
  14419. var _this2 = this;
  14420. var h = this.$createElement;
  14421. var icon = action.icon,
  14422. text = action.text,
  14423. disabled = action.disabled,
  14424. className = action.className;
  14425. return h("div", {
  14426. "attrs": {
  14427. "role": "menuitem"
  14428. },
  14429. "class": [popover_bem('action', {
  14430. disabled: disabled,
  14431. 'with-icon': icon
  14432. }), className],
  14433. "on": {
  14434. "click": function click() {
  14435. return _this2.onClickAction(action, index);
  14436. }
  14437. }
  14438. }, [icon && h(es_icon, {
  14439. "attrs": {
  14440. "name": icon
  14441. },
  14442. "class": popover_bem('action-icon')
  14443. }), h("div", {
  14444. "class": [popover_bem('action-text'), BORDER_BOTTOM]
  14445. }, [text])]);
  14446. },
  14447. onToggle: function onToggle(value) {
  14448. this.$emit('input', value);
  14449. },
  14450. onClickWrapper: function onClickWrapper() {
  14451. if (this.trigger === 'click') {
  14452. this.onToggle(!this.value);
  14453. }
  14454. },
  14455. onTouchstart: function onTouchstart(event) {
  14456. event.stopPropagation();
  14457. this.$emit('touchstart', event);
  14458. },
  14459. onClickAction: function onClickAction(action, index) {
  14460. if (action.disabled) {
  14461. return;
  14462. }
  14463. this.$emit('select', action, index);
  14464. if (this.closeOnClickAction) {
  14465. this.$emit('input', false);
  14466. }
  14467. },
  14468. onClickOutside: function onClickOutside() {
  14469. this.$emit('input', false);
  14470. },
  14471. onOpen: function onOpen() {
  14472. this.$emit('open');
  14473. },
  14474. /* istanbul ignore next */
  14475. onOpened: function onOpened() {
  14476. this.$emit('opened');
  14477. },
  14478. onClose: function onClose() {
  14479. this.$emit('close');
  14480. },
  14481. /* istanbul ignore next */
  14482. onClosed: function onClosed() {
  14483. this.$emit('closed');
  14484. }
  14485. },
  14486. render: function render() {
  14487. var h = arguments[0];
  14488. return h("span", {
  14489. "ref": "wrapper",
  14490. "class": popover_bem('wrapper'),
  14491. "on": {
  14492. "click": this.onClickWrapper
  14493. }
  14494. }, [h(popup, {
  14495. "ref": "popover",
  14496. "attrs": {
  14497. "value": this.value,
  14498. "overlay": this.overlay,
  14499. "position": null,
  14500. "transition": "van-popover-zoom",
  14501. "lockScroll": false,
  14502. "getContainer": this.getContainer
  14503. },
  14504. "class": popover_bem([this.theme]),
  14505. "on": {
  14506. "open": this.onOpen,
  14507. "close": this.onClose,
  14508. "input": this.onToggle,
  14509. "opened": this.onOpened,
  14510. "closed": this.onClosed
  14511. },
  14512. "nativeOn": {
  14513. "touchstart": this.onTouchstart
  14514. }
  14515. }, [h("div", {
  14516. "class": popover_bem('arrow')
  14517. }), h("div", {
  14518. "class": popover_bem('content'),
  14519. "attrs": {
  14520. "role": "menu"
  14521. }
  14522. }, [this.slots('default') || this.actions.map(this.renderAction)])]), this.slots('reference')]);
  14523. }
  14524. }));
  14525. // CONCATENATED MODULE: ./es/progress/index.js
  14526. var progress_createNamespace = Object(create["a" /* createNamespace */])('progress'),
  14527. progress_createComponent = progress_createNamespace[0],
  14528. progress_bem = progress_createNamespace[1];
  14529. /* harmony default export */ var es_progress = (progress_createComponent({
  14530. props: {
  14531. color: String,
  14532. inactive: Boolean,
  14533. pivotText: String,
  14534. textColor: String,
  14535. pivotColor: String,
  14536. trackColor: String,
  14537. strokeWidth: [Number, String],
  14538. percentage: {
  14539. type: [Number, String],
  14540. required: true,
  14541. validator: function validator(value) {
  14542. return value >= 0 && value <= 100;
  14543. }
  14544. },
  14545. showPivot: {
  14546. type: Boolean,
  14547. default: true
  14548. }
  14549. },
  14550. data: function data() {
  14551. return {
  14552. pivotWidth: 0,
  14553. progressWidth: 0
  14554. };
  14555. },
  14556. mounted: function mounted() {
  14557. this.resize();
  14558. },
  14559. watch: {
  14560. showPivot: 'resize',
  14561. pivotText: 'resize'
  14562. },
  14563. methods: {
  14564. // @exposed-api
  14565. resize: function resize() {
  14566. var _this = this;
  14567. this.$nextTick(function () {
  14568. _this.progressWidth = _this.$el.offsetWidth;
  14569. _this.pivotWidth = _this.$refs.pivot ? _this.$refs.pivot.offsetWidth : 0;
  14570. });
  14571. }
  14572. },
  14573. render: function render() {
  14574. var h = arguments[0];
  14575. var pivotText = this.pivotText,
  14576. percentage = this.percentage;
  14577. var text = pivotText != null ? pivotText : percentage + '%';
  14578. var showPivot = this.showPivot && text;
  14579. var background = this.inactive ? '#cacaca' : this.color;
  14580. var pivotStyle = {
  14581. color: this.textColor,
  14582. left: (this.progressWidth - this.pivotWidth) * percentage / 100 + "px",
  14583. background: this.pivotColor || background
  14584. };
  14585. var portionStyle = {
  14586. background: background,
  14587. width: this.progressWidth * percentage / 100 + 'px'
  14588. };
  14589. var wrapperStyle = {
  14590. background: this.trackColor,
  14591. height: Object(unit["a" /* addUnit */])(this.strokeWidth)
  14592. };
  14593. return h("div", {
  14594. "class": progress_bem(),
  14595. "style": wrapperStyle
  14596. }, [h("span", {
  14597. "class": progress_bem('portion'),
  14598. "style": portionStyle
  14599. }, [showPivot && h("span", {
  14600. "ref": "pivot",
  14601. "style": pivotStyle,
  14602. "class": progress_bem('pivot')
  14603. }, [text])])]);
  14604. }
  14605. }));
  14606. // CONCATENATED MODULE: ./es/pull-refresh/index.js
  14607. // Utils
  14608. // Mixins
  14609. // Components
  14610. var pull_refresh_createNamespace = Object(create["a" /* createNamespace */])('pull-refresh'),
  14611. pull_refresh_createComponent = pull_refresh_createNamespace[0],
  14612. pull_refresh_bem = pull_refresh_createNamespace[1],
  14613. pull_refresh_t = pull_refresh_createNamespace[2];
  14614. var DEFAULT_HEAD_HEIGHT = 50;
  14615. var TEXT_STATUS = ['pulling', 'loosing', 'success'];
  14616. /* harmony default export */ var pull_refresh = (pull_refresh_createComponent({
  14617. mixins: [TouchMixin],
  14618. props: {
  14619. disabled: Boolean,
  14620. successText: String,
  14621. pullingText: String,
  14622. loosingText: String,
  14623. loadingText: String,
  14624. pullDistance: [Number, String],
  14625. value: {
  14626. type: Boolean,
  14627. required: true
  14628. },
  14629. successDuration: {
  14630. type: [Number, String],
  14631. default: 500
  14632. },
  14633. animationDuration: {
  14634. type: [Number, String],
  14635. default: 300
  14636. },
  14637. headHeight: {
  14638. type: [Number, String],
  14639. default: DEFAULT_HEAD_HEIGHT
  14640. }
  14641. },
  14642. data: function data() {
  14643. return {
  14644. status: 'normal',
  14645. distance: 0,
  14646. duration: 0
  14647. };
  14648. },
  14649. computed: {
  14650. touchable: function touchable() {
  14651. return this.status !== 'loading' && this.status !== 'success' && !this.disabled;
  14652. },
  14653. headStyle: function headStyle() {
  14654. if (this.headHeight !== DEFAULT_HEAD_HEIGHT) {
  14655. return {
  14656. height: this.headHeight + "px"
  14657. };
  14658. }
  14659. }
  14660. },
  14661. watch: {
  14662. value: function value(loading) {
  14663. this.duration = this.animationDuration;
  14664. if (loading) {
  14665. this.setStatus(+this.headHeight, true);
  14666. } else if (this.slots('success') || this.successText) {
  14667. this.showSuccessTip();
  14668. } else {
  14669. this.setStatus(0, false);
  14670. }
  14671. }
  14672. },
  14673. mounted: function mounted() {
  14674. this.bindTouchEvent(this.$refs.track);
  14675. this.scrollEl = getScroller(this.$el);
  14676. },
  14677. methods: {
  14678. checkPullStart: function checkPullStart(event) {
  14679. this.ceiling = getScrollTop(this.scrollEl) === 0;
  14680. if (this.ceiling) {
  14681. this.duration = 0;
  14682. this.touchStart(event);
  14683. }
  14684. },
  14685. onTouchStart: function onTouchStart(event) {
  14686. if (this.touchable) {
  14687. this.checkPullStart(event);
  14688. }
  14689. },
  14690. onTouchMove: function onTouchMove(event) {
  14691. if (!this.touchable) {
  14692. return;
  14693. }
  14694. if (!this.ceiling) {
  14695. this.checkPullStart(event);
  14696. }
  14697. this.touchMove(event);
  14698. if (this.ceiling && this.deltaY >= 0 && this.direction === 'vertical') {
  14699. preventDefault(event);
  14700. this.setStatus(this.ease(this.deltaY));
  14701. }
  14702. },
  14703. onTouchEnd: function onTouchEnd() {
  14704. var _this = this;
  14705. if (this.touchable && this.ceiling && this.deltaY) {
  14706. this.duration = this.animationDuration;
  14707. if (this.status === 'loosing') {
  14708. this.setStatus(+this.headHeight, true);
  14709. this.$emit('input', true); // ensure value change can be watched
  14710. this.$nextTick(function () {
  14711. _this.$emit('refresh');
  14712. });
  14713. } else {
  14714. this.setStatus(0);
  14715. }
  14716. }
  14717. },
  14718. ease: function ease(distance) {
  14719. var pullDistance = +(this.pullDistance || this.headHeight);
  14720. if (distance > pullDistance) {
  14721. if (distance < pullDistance * 2) {
  14722. distance = pullDistance + (distance - pullDistance) / 2;
  14723. } else {
  14724. distance = pullDistance * 1.5 + (distance - pullDistance * 2) / 4;
  14725. }
  14726. }
  14727. return Math.round(distance);
  14728. },
  14729. setStatus: function setStatus(distance, isLoading) {
  14730. var status;
  14731. if (isLoading) {
  14732. status = 'loading';
  14733. } else if (distance === 0) {
  14734. status = 'normal';
  14735. } else {
  14736. status = distance < (this.pullDistance || this.headHeight) ? 'pulling' : 'loosing';
  14737. }
  14738. this.distance = distance;
  14739. if (status !== this.status) {
  14740. this.status = status;
  14741. }
  14742. },
  14743. genStatus: function genStatus() {
  14744. var h = this.$createElement;
  14745. var status = this.status,
  14746. distance = this.distance;
  14747. var slot = this.slots(status, {
  14748. distance: distance
  14749. });
  14750. if (slot) {
  14751. return slot;
  14752. }
  14753. var nodes = [];
  14754. var text = this[status + "Text"] || pull_refresh_t(status);
  14755. if (TEXT_STATUS.indexOf(status) !== -1) {
  14756. nodes.push(h("div", {
  14757. "class": pull_refresh_bem('text')
  14758. }, [text]));
  14759. }
  14760. if (status === 'loading') {
  14761. nodes.push(h(es_loading, {
  14762. "attrs": {
  14763. "size": "16"
  14764. }
  14765. }, [text]));
  14766. }
  14767. return nodes;
  14768. },
  14769. showSuccessTip: function showSuccessTip() {
  14770. var _this2 = this;
  14771. this.status = 'success';
  14772. setTimeout(function () {
  14773. _this2.setStatus(0);
  14774. }, this.successDuration);
  14775. }
  14776. },
  14777. render: function render() {
  14778. var h = arguments[0];
  14779. var trackStyle = {
  14780. transitionDuration: this.duration + "ms",
  14781. transform: this.distance ? "translate3d(0," + this.distance + "px, 0)" : ''
  14782. };
  14783. return h("div", {
  14784. "class": pull_refresh_bem()
  14785. }, [h("div", {
  14786. "ref": "track",
  14787. "class": pull_refresh_bem('track'),
  14788. "style": trackStyle
  14789. }, [h("div", {
  14790. "class": pull_refresh_bem('head'),
  14791. "style": this.headStyle
  14792. }, [this.genStatus()]), this.slots()])]);
  14793. }
  14794. }));
  14795. // CONCATENATED MODULE: ./es/rate/index.js
  14796. // Utils
  14797. // Mixins
  14798. // Components
  14799. var rate_createNamespace = Object(create["a" /* createNamespace */])('rate'),
  14800. rate_createComponent = rate_createNamespace[0],
  14801. rate_bem = rate_createNamespace[1];
  14802. function getRateStatus(value, index, allowHalf) {
  14803. if (value >= index) {
  14804. return 'full';
  14805. }
  14806. if (value + 0.5 >= index && allowHalf) {
  14807. return 'half';
  14808. }
  14809. return 'void';
  14810. }
  14811. /* harmony default export */ var es_rate = (rate_createComponent({
  14812. mixins: [TouchMixin, FieldMixin],
  14813. props: {
  14814. size: [Number, String],
  14815. color: String,
  14816. gutter: [Number, String],
  14817. readonly: Boolean,
  14818. disabled: Boolean,
  14819. allowHalf: Boolean,
  14820. voidColor: String,
  14821. iconPrefix: String,
  14822. disabledColor: String,
  14823. value: {
  14824. type: Number,
  14825. default: 0
  14826. },
  14827. icon: {
  14828. type: String,
  14829. default: 'star'
  14830. },
  14831. voidIcon: {
  14832. type: String,
  14833. default: 'star-o'
  14834. },
  14835. count: {
  14836. type: [Number, String],
  14837. default: 5
  14838. },
  14839. touchable: {
  14840. type: Boolean,
  14841. default: true
  14842. }
  14843. },
  14844. computed: {
  14845. list: function list() {
  14846. var list = [];
  14847. for (var i = 1; i <= this.count; i++) {
  14848. list.push(getRateStatus(this.value, i, this.allowHalf));
  14849. }
  14850. return list;
  14851. },
  14852. sizeWithUnit: function sizeWithUnit() {
  14853. return Object(unit["a" /* addUnit */])(this.size);
  14854. },
  14855. gutterWithUnit: function gutterWithUnit() {
  14856. return Object(unit["a" /* addUnit */])(this.gutter);
  14857. }
  14858. },
  14859. mounted: function mounted() {
  14860. this.bindTouchEvent(this.$el);
  14861. },
  14862. methods: {
  14863. select: function select(index) {
  14864. if (!this.disabled && !this.readonly && index !== this.value) {
  14865. this.$emit('input', index);
  14866. this.$emit('change', index);
  14867. }
  14868. },
  14869. onTouchStart: function onTouchStart(event) {
  14870. var _this = this;
  14871. if (this.readonly || this.disabled || !this.touchable) {
  14872. return;
  14873. }
  14874. this.touchStart(event);
  14875. var rects = this.$refs.items.map(function (item) {
  14876. return item.getBoundingClientRect();
  14877. });
  14878. var ranges = [];
  14879. rects.forEach(function (rect, index) {
  14880. if (_this.allowHalf) {
  14881. ranges.push({
  14882. score: index + 0.5,
  14883. left: rect.left
  14884. }, {
  14885. score: index + 1,
  14886. left: rect.left + rect.width / 2
  14887. });
  14888. } else {
  14889. ranges.push({
  14890. score: index + 1,
  14891. left: rect.left
  14892. });
  14893. }
  14894. });
  14895. this.ranges = ranges;
  14896. },
  14897. onTouchMove: function onTouchMove(event) {
  14898. if (this.readonly || this.disabled || !this.touchable) {
  14899. return;
  14900. }
  14901. this.touchMove(event);
  14902. if (this.direction === 'horizontal') {
  14903. preventDefault(event);
  14904. var clientX = event.touches[0].clientX;
  14905. this.select(this.getScoreByPosition(clientX));
  14906. }
  14907. },
  14908. getScoreByPosition: function getScoreByPosition(x) {
  14909. for (var i = this.ranges.length - 1; i > 0; i--) {
  14910. if (x > this.ranges[i].left) {
  14911. return this.ranges[i].score;
  14912. }
  14913. }
  14914. return this.allowHalf ? 0.5 : 1;
  14915. },
  14916. genStar: function genStar(status, index) {
  14917. var _this2 = this;
  14918. var h = this.$createElement;
  14919. var icon = this.icon,
  14920. color = this.color,
  14921. count = this.count,
  14922. voidIcon = this.voidIcon,
  14923. disabled = this.disabled,
  14924. voidColor = this.voidColor,
  14925. disabledColor = this.disabledColor;
  14926. var score = index + 1;
  14927. var isFull = status === 'full';
  14928. var isVoid = status === 'void';
  14929. var style;
  14930. if (this.gutterWithUnit && score !== +count) {
  14931. style = {
  14932. paddingRight: this.gutterWithUnit
  14933. };
  14934. }
  14935. return h("div", {
  14936. "ref": "items",
  14937. "refInFor": true,
  14938. "key": index,
  14939. "attrs": {
  14940. "role": "radio",
  14941. "tabindex": "0",
  14942. "aria-setsize": count,
  14943. "aria-posinset": score,
  14944. "aria-checked": String(!isVoid)
  14945. },
  14946. "style": style,
  14947. "class": rate_bem('item')
  14948. }, [h(es_icon, {
  14949. "attrs": {
  14950. "size": this.sizeWithUnit,
  14951. "name": isFull ? icon : voidIcon,
  14952. "color": disabled ? disabledColor : isFull ? color : voidColor,
  14953. "classPrefix": this.iconPrefix,
  14954. "data-score": score
  14955. },
  14956. "class": rate_bem('icon', {
  14957. disabled: disabled,
  14958. full: isFull
  14959. }),
  14960. "on": {
  14961. "click": function click() {
  14962. _this2.select(score);
  14963. }
  14964. }
  14965. }), this.allowHalf && h(es_icon, {
  14966. "attrs": {
  14967. "size": this.sizeWithUnit,
  14968. "name": isVoid ? voidIcon : icon,
  14969. "color": disabled ? disabledColor : isVoid ? voidColor : color,
  14970. "classPrefix": this.iconPrefix,
  14971. "data-score": score - 0.5
  14972. },
  14973. "class": rate_bem('icon', ['half', {
  14974. disabled: disabled,
  14975. full: !isVoid
  14976. }]),
  14977. "on": {
  14978. "click": function click() {
  14979. _this2.select(score - 0.5);
  14980. }
  14981. }
  14982. })]);
  14983. }
  14984. },
  14985. render: function render() {
  14986. var _this3 = this;
  14987. var h = arguments[0];
  14988. return h("div", {
  14989. "class": rate_bem({
  14990. readonly: this.readonly,
  14991. disabled: this.disabled
  14992. }),
  14993. "attrs": {
  14994. "tabindex": "0",
  14995. "role": "radiogroup"
  14996. }
  14997. }, [this.list.map(function (status, index) {
  14998. return _this3.genStar(status, index);
  14999. })]);
  15000. }
  15001. }));
  15002. // CONCATENATED MODULE: ./es/row/index.js
  15003. var row_createNamespace = Object(create["a" /* createNamespace */])('row'),
  15004. row_createComponent = row_createNamespace[0],
  15005. row_bem = row_createNamespace[1];
  15006. /* harmony default export */ var row = (row_createComponent({
  15007. mixins: [ParentMixin('vanRow')],
  15008. props: {
  15009. type: String,
  15010. align: String,
  15011. justify: String,
  15012. tag: {
  15013. type: String,
  15014. default: 'div'
  15015. },
  15016. gutter: {
  15017. type: [Number, String],
  15018. default: 0
  15019. }
  15020. },
  15021. computed: {
  15022. spaces: function spaces() {
  15023. var gutter = Number(this.gutter);
  15024. if (!gutter) {
  15025. return;
  15026. }
  15027. var spaces = [];
  15028. var groups = [[]];
  15029. var totalSpan = 0;
  15030. this.children.forEach(function (item, index) {
  15031. totalSpan += Number(item.span);
  15032. if (totalSpan > 24) {
  15033. groups.push([index]);
  15034. totalSpan -= 24;
  15035. } else {
  15036. groups[groups.length - 1].push(index);
  15037. }
  15038. });
  15039. groups.forEach(function (group) {
  15040. var averagePadding = gutter * (group.length - 1) / group.length;
  15041. group.forEach(function (item, index) {
  15042. if (index === 0) {
  15043. spaces.push({
  15044. right: averagePadding
  15045. });
  15046. } else {
  15047. var left = gutter - spaces[item - 1].right;
  15048. var right = averagePadding - left;
  15049. spaces.push({
  15050. left: left,
  15051. right: right
  15052. });
  15053. }
  15054. });
  15055. });
  15056. return spaces;
  15057. }
  15058. },
  15059. methods: {
  15060. onClick: function onClick(event) {
  15061. this.$emit('click', event);
  15062. }
  15063. },
  15064. render: function render() {
  15065. var _bem;
  15066. var h = arguments[0];
  15067. var align = this.align,
  15068. justify = this.justify;
  15069. var flex = this.type === 'flex';
  15070. return h(this.tag, {
  15071. "class": row_bem((_bem = {
  15072. flex: flex
  15073. }, _bem["align-" + align] = flex && align, _bem["justify-" + justify] = flex && justify, _bem)),
  15074. "on": {
  15075. "click": this.onClick
  15076. }
  15077. }, [this.slots()]);
  15078. }
  15079. }));
  15080. // CONCATENATED MODULE: ./es/search/index.js
  15081. // Utils
  15082. // Components
  15083. // Types
  15084. var search_createNamespace = Object(create["a" /* createNamespace */])('search'),
  15085. search_createComponent = search_createNamespace[0],
  15086. search_bem = search_createNamespace[1],
  15087. search_t = search_createNamespace[2];
  15088. function Search(h, props, slots, ctx) {
  15089. function Label() {
  15090. if (slots.label || props.label) {
  15091. return h("div", {
  15092. "class": search_bem('label')
  15093. }, [slots.label ? slots.label() : props.label]);
  15094. }
  15095. }
  15096. function Action() {
  15097. if (!props.showAction) {
  15098. return;
  15099. }
  15100. function onCancel() {
  15101. if (slots.action) {
  15102. return;
  15103. }
  15104. functional_emit(ctx, 'input', '');
  15105. functional_emit(ctx, 'cancel');
  15106. }
  15107. return h("div", {
  15108. "class": search_bem('action'),
  15109. "attrs": {
  15110. "role": "button",
  15111. "tabindex": "0"
  15112. },
  15113. "on": {
  15114. "click": onCancel
  15115. }
  15116. }, [slots.action ? slots.action() : props.actionText || search_t('cancel')]);
  15117. }
  15118. var fieldData = {
  15119. attrs: ctx.data.attrs,
  15120. on: _extends({}, ctx.listeners, {
  15121. keypress: function keypress(event) {
  15122. // press enter
  15123. if (event.keyCode === 13) {
  15124. preventDefault(event);
  15125. functional_emit(ctx, 'search', props.value);
  15126. }
  15127. functional_emit(ctx, 'keypress', event);
  15128. }
  15129. })
  15130. };
  15131. var inheritData = inherit(ctx);
  15132. inheritData.attrs = undefined;
  15133. return h("div", helper_default()([{
  15134. "class": search_bem({
  15135. 'show-action': props.showAction
  15136. }),
  15137. "style": {
  15138. background: props.background
  15139. }
  15140. }, inheritData]), [slots.left == null ? void 0 : slots.left(), h("div", {
  15141. "class": search_bem('content', props.shape)
  15142. }, [Label(), h(es_field, helper_default()([{
  15143. "attrs": {
  15144. "type": "search",
  15145. "border": false,
  15146. "value": props.value,
  15147. "leftIcon": props.leftIcon,
  15148. "rightIcon": props.rightIcon,
  15149. "clearable": props.clearable,
  15150. "clearTrigger": props.clearTrigger
  15151. },
  15152. "scopedSlots": {
  15153. 'left-icon': slots['left-icon'],
  15154. 'right-icon': slots['right-icon']
  15155. }
  15156. }, fieldData]))]), Action()]);
  15157. }
  15158. Search.props = {
  15159. value: String,
  15160. label: String,
  15161. rightIcon: String,
  15162. actionText: String,
  15163. background: String,
  15164. showAction: Boolean,
  15165. clearTrigger: String,
  15166. shape: {
  15167. type: String,
  15168. default: 'square'
  15169. },
  15170. clearable: {
  15171. type: Boolean,
  15172. default: true
  15173. },
  15174. leftIcon: {
  15175. type: String,
  15176. default: 'search'
  15177. }
  15178. };
  15179. /* harmony default export */ var search = (search_createComponent(Search));
  15180. // CONCATENATED MODULE: ./es/share-sheet/index.js
  15181. // Utils
  15182. // Mixins
  15183. // Components
  15184. var PRESET_ICONS = ['qq', 'link', 'weibo', 'wechat', 'poster', 'qrcode', 'weapp-qrcode', 'wechat-moments'];
  15185. var share_sheet_createNamespace = Object(create["a" /* createNamespace */])('share-sheet'),
  15186. share_sheet_createComponent = share_sheet_createNamespace[0],
  15187. share_sheet_bem = share_sheet_createNamespace[1],
  15188. share_sheet_t = share_sheet_createNamespace[2];
  15189. /* harmony default export */ var share_sheet = (share_sheet_createComponent({
  15190. props: _extends({}, popupMixinProps, {
  15191. title: String,
  15192. duration: String,
  15193. cancelText: String,
  15194. description: String,
  15195. getContainer: [String, Function],
  15196. options: {
  15197. type: Array,
  15198. default: function _default() {
  15199. return [];
  15200. }
  15201. },
  15202. overlay: {
  15203. type: Boolean,
  15204. default: true
  15205. },
  15206. closeOnPopstate: {
  15207. type: Boolean,
  15208. default: true
  15209. },
  15210. safeAreaInsetBottom: {
  15211. type: Boolean,
  15212. default: true
  15213. },
  15214. closeOnClickOverlay: {
  15215. type: Boolean,
  15216. default: true
  15217. }
  15218. }),
  15219. methods: {
  15220. onCancel: function onCancel() {
  15221. this.toggle(false);
  15222. this.$emit('cancel');
  15223. },
  15224. onSelect: function onSelect(option, index) {
  15225. this.$emit('select', option, index);
  15226. },
  15227. toggle: function toggle(val) {
  15228. this.$emit('input', val);
  15229. },
  15230. getIconURL: function getIconURL(icon) {
  15231. if (PRESET_ICONS.indexOf(icon) !== -1) {
  15232. return "https://img01.yzcdn.cn/vant/share-sheet-" + icon + ".png";
  15233. }
  15234. return icon;
  15235. },
  15236. genHeader: function genHeader() {
  15237. var h = this.$createElement;
  15238. var title = this.slots('title') || this.title;
  15239. var description = this.slots('description') || this.description;
  15240. if (!title && !description) {
  15241. return;
  15242. }
  15243. return h("div", {
  15244. "class": share_sheet_bem('header')
  15245. }, [title && h("h2", {
  15246. "class": share_sheet_bem('title')
  15247. }, [title]), description && h("span", {
  15248. "class": share_sheet_bem('description')
  15249. }, [description])]);
  15250. },
  15251. genOptions: function genOptions(options, showBorder) {
  15252. var _this = this;
  15253. var h = this.$createElement;
  15254. return h("div", {
  15255. "class": share_sheet_bem('options', {
  15256. border: showBorder
  15257. })
  15258. }, [options.map(function (option, index) {
  15259. return h("div", {
  15260. "attrs": {
  15261. "role": "button",
  15262. "tabindex": "0"
  15263. },
  15264. "class": [share_sheet_bem('option'), option.className],
  15265. "on": {
  15266. "click": function click() {
  15267. _this.onSelect(option, index);
  15268. }
  15269. }
  15270. }, [h("img", {
  15271. "attrs": {
  15272. "src": _this.getIconURL(option.icon)
  15273. },
  15274. "class": share_sheet_bem('icon')
  15275. }), option.name && h("span", {
  15276. "class": share_sheet_bem('name')
  15277. }, [option.name]), option.description && h("span", {
  15278. "class": share_sheet_bem('option-description')
  15279. }, [option.description])]);
  15280. })]);
  15281. },
  15282. genRows: function genRows() {
  15283. var _this2 = this;
  15284. var options = this.options;
  15285. if (Array.isArray(options[0])) {
  15286. return options.map(function (item, index) {
  15287. return _this2.genOptions(item, index !== 0);
  15288. });
  15289. }
  15290. return this.genOptions(options);
  15291. },
  15292. genCancelText: function genCancelText() {
  15293. var _this$cancelText;
  15294. var h = this.$createElement;
  15295. var cancelText = (_this$cancelText = this.cancelText) != null ? _this$cancelText : share_sheet_t('cancel');
  15296. if (cancelText) {
  15297. return h("button", {
  15298. "attrs": {
  15299. "type": "button"
  15300. },
  15301. "class": share_sheet_bem('cancel'),
  15302. "on": {
  15303. "click": this.onCancel
  15304. }
  15305. }, [cancelText]);
  15306. }
  15307. },
  15308. onClickOverlay: function onClickOverlay() {
  15309. this.$emit('click-overlay');
  15310. }
  15311. },
  15312. render: function render() {
  15313. var h = arguments[0];
  15314. return h(popup, {
  15315. "attrs": {
  15316. "round": true,
  15317. "value": this.value,
  15318. "position": "bottom",
  15319. "overlay": this.overlay,
  15320. "duration": this.duration,
  15321. "lazyRender": this.lazyRender,
  15322. "lockScroll": this.lockScroll,
  15323. "getContainer": this.getContainer,
  15324. "closeOnPopstate": this.closeOnPopstate,
  15325. "closeOnClickOverlay": this.closeOnClickOverlay,
  15326. "safeAreaInsetBottom": this.safeAreaInsetBottom
  15327. },
  15328. "class": share_sheet_bem(),
  15329. "on": {
  15330. "input": this.toggle,
  15331. "click-overlay": this.onClickOverlay
  15332. }
  15333. }, [this.genHeader(), this.genRows(), this.genCancelText()]);
  15334. }
  15335. }));
  15336. // CONCATENATED MODULE: ./es/sidebar/index.js
  15337. var sidebar_createNamespace = Object(create["a" /* createNamespace */])('sidebar'),
  15338. sidebar_createComponent = sidebar_createNamespace[0],
  15339. sidebar_bem = sidebar_createNamespace[1];
  15340. /* harmony default export */ var sidebar = (sidebar_createComponent({
  15341. mixins: [ParentMixin('vanSidebar')],
  15342. model: {
  15343. prop: 'activeKey'
  15344. },
  15345. props: {
  15346. activeKey: {
  15347. type: [Number, String],
  15348. default: 0
  15349. }
  15350. },
  15351. data: function data() {
  15352. return {
  15353. index: +this.activeKey
  15354. };
  15355. },
  15356. watch: {
  15357. activeKey: function activeKey() {
  15358. this.setIndex(+this.activeKey);
  15359. }
  15360. },
  15361. methods: {
  15362. setIndex: function setIndex(index) {
  15363. if (index !== this.index) {
  15364. this.index = index;
  15365. this.$emit('change', index);
  15366. }
  15367. }
  15368. },
  15369. render: function render() {
  15370. var h = arguments[0];
  15371. return h("div", {
  15372. "class": sidebar_bem()
  15373. }, [this.slots()]);
  15374. }
  15375. }));
  15376. // CONCATENATED MODULE: ./es/sidebar-item/index.js
  15377. var sidebar_item_createNamespace = Object(create["a" /* createNamespace */])('sidebar-item'),
  15378. sidebar_item_createComponent = sidebar_item_createNamespace[0],
  15379. sidebar_item_bem = sidebar_item_createNamespace[1];
  15380. /* harmony default export */ var sidebar_item = (sidebar_item_createComponent({
  15381. mixins: [ChildrenMixin('vanSidebar')],
  15382. props: _extends({}, routeProps, {
  15383. dot: Boolean,
  15384. // @deprecated
  15385. info: [Number, String],
  15386. badge: [Number, String],
  15387. title: String,
  15388. disabled: Boolean
  15389. }),
  15390. computed: {
  15391. select: function select() {
  15392. return this.index === +this.parent.activeKey;
  15393. }
  15394. },
  15395. methods: {
  15396. onClick: function onClick() {
  15397. if (this.disabled) {
  15398. return;
  15399. }
  15400. this.$emit('click', this.index);
  15401. this.parent.$emit('input', this.index);
  15402. this.parent.setIndex(this.index);
  15403. route(this.$router, this);
  15404. }
  15405. },
  15406. render: function render() {
  15407. var _this$slots, _this$badge;
  15408. var h = arguments[0];
  15409. if (false) {}
  15410. return h("a", {
  15411. "class": sidebar_item_bem({
  15412. select: this.select,
  15413. disabled: this.disabled
  15414. }),
  15415. "on": {
  15416. "click": this.onClick
  15417. }
  15418. }, [h("div", {
  15419. "class": sidebar_item_bem('text')
  15420. }, [(_this$slots = this.slots('title')) != null ? _this$slots : this.title, h(es_info, {
  15421. "attrs": {
  15422. "dot": this.dot,
  15423. "info": (_this$badge = this.badge) != null ? _this$badge : this.info
  15424. },
  15425. "class": sidebar_item_bem('info')
  15426. })])]);
  15427. }
  15428. }));
  15429. // CONCATENATED MODULE: ./es/skeleton/index.js
  15430. // Utils
  15431. // Types
  15432. var skeleton_createNamespace = Object(create["a" /* createNamespace */])('skeleton'),
  15433. skeleton_createComponent = skeleton_createNamespace[0],
  15434. skeleton_bem = skeleton_createNamespace[1];
  15435. var DEFAULT_ROW_WIDTH = '100%';
  15436. var DEFAULT_LAST_ROW_WIDTH = '60%';
  15437. function Skeleton(h, props, slots, ctx) {
  15438. if (!props.loading) {
  15439. return slots.default && slots.default();
  15440. }
  15441. function Title() {
  15442. if (props.title) {
  15443. return h("h3", {
  15444. "class": skeleton_bem('title'),
  15445. "style": {
  15446. width: Object(unit["a" /* addUnit */])(props.titleWidth)
  15447. }
  15448. });
  15449. }
  15450. }
  15451. function Rows() {
  15452. var Rows = [];
  15453. var rowWidth = props.rowWidth;
  15454. function getRowWidth(index) {
  15455. if (rowWidth === DEFAULT_ROW_WIDTH && index === +props.row - 1) {
  15456. return DEFAULT_LAST_ROW_WIDTH;
  15457. }
  15458. if (Array.isArray(rowWidth)) {
  15459. return rowWidth[index];
  15460. }
  15461. return rowWidth;
  15462. }
  15463. for (var i = 0; i < props.row; i++) {
  15464. Rows.push(h("div", {
  15465. "class": skeleton_bem('row'),
  15466. "style": {
  15467. width: Object(unit["a" /* addUnit */])(getRowWidth(i))
  15468. }
  15469. }));
  15470. }
  15471. return Rows;
  15472. }
  15473. function Avatar() {
  15474. if (props.avatar) {
  15475. var size = Object(unit["a" /* addUnit */])(props.avatarSize);
  15476. return h("div", {
  15477. "class": skeleton_bem('avatar', props.avatarShape),
  15478. "style": {
  15479. width: size,
  15480. height: size
  15481. }
  15482. });
  15483. }
  15484. }
  15485. return h("div", helper_default()([{
  15486. "class": skeleton_bem({
  15487. animate: props.animate,
  15488. round: props.round
  15489. })
  15490. }, inherit(ctx)]), [Avatar(), h("div", {
  15491. "class": skeleton_bem('content')
  15492. }, [Title(), Rows()])]);
  15493. }
  15494. Skeleton.props = {
  15495. title: Boolean,
  15496. round: Boolean,
  15497. avatar: Boolean,
  15498. titleWidth: [Number, String],
  15499. avatarSize: [Number, String],
  15500. row: {
  15501. type: [Number, String],
  15502. default: 0
  15503. },
  15504. loading: {
  15505. type: Boolean,
  15506. default: true
  15507. },
  15508. animate: {
  15509. type: Boolean,
  15510. default: true
  15511. },
  15512. avatarShape: {
  15513. type: String,
  15514. default: 'round'
  15515. },
  15516. rowWidth: {
  15517. type: [Number, String, Array],
  15518. default: DEFAULT_ROW_WIDTH
  15519. }
  15520. };
  15521. /* harmony default export */ var skeleton = (skeleton_createComponent(Skeleton));
  15522. // CONCATENATED MODULE: ./es/sku/lang.js
  15523. /**
  15524. * Sku only provide zh-CN lang by default
  15525. */
  15526. /* harmony default export */ var lang = ({
  15527. 'zh-CN': {
  15528. vanSku: {
  15529. select: '请选择',
  15530. selected: '已选',
  15531. selectSku: '请先选择商品规格',
  15532. soldout: '库存不足',
  15533. originPrice: '原价',
  15534. minusTip: '至少选择一件',
  15535. minusStartTip: function minusStartTip(start) {
  15536. return start + "\u4EF6\u8D77\u552E";
  15537. },
  15538. unavailable: '商品已经无法购买啦',
  15539. stock: '剩余',
  15540. stockUnit: '件',
  15541. quotaTip: function quotaTip(quota) {
  15542. return "\u6BCF\u4EBA\u9650\u8D2D" + quota + "\u4EF6";
  15543. },
  15544. quotaUsedTip: function quotaUsedTip(quota, count) {
  15545. return "\u6BCF\u4EBA\u9650\u8D2D" + quota + "\u4EF6\uFF0C\u4F60\u5DF2\u8D2D\u4E70" + count + "\u4EF6";
  15546. }
  15547. },
  15548. vanSkuActions: {
  15549. buy: '立即购买',
  15550. addCart: '加入购物车'
  15551. },
  15552. vanSkuImgUploader: {
  15553. oversize: function oversize(maxSize) {
  15554. return "\u6700\u5927\u53EF\u4E0A\u4F20\u56FE\u7247\u4E3A" + maxSize + "MB\uFF0C\u8BF7\u5C1D\u8BD5\u538B\u7F29\u56FE\u7247\u5C3A\u5BF8";
  15555. },
  15556. fail: '上传失败',
  15557. uploading: '上传中...'
  15558. },
  15559. vanSkuStepper: {
  15560. quotaLimit: function quotaLimit(quota) {
  15561. return "\u9650\u8D2D" + quota + "\u4EF6";
  15562. },
  15563. quotaStart: function quotaStart(start) {
  15564. return start + "\u4EF6\u8D77\u552E";
  15565. },
  15566. comma: ',',
  15567. num: '购买数量'
  15568. },
  15569. vanSkuMessages: {
  15570. fill: '请填写',
  15571. upload: '请上传',
  15572. imageLabel: '仅限一张',
  15573. invalid: {
  15574. tel: '请填写正确的数字格式留言',
  15575. mobile: '手机号长度为6-20位数字',
  15576. email: '请填写正确的邮箱',
  15577. id_no: '请填写正确的身份证号码'
  15578. },
  15579. placeholder: {
  15580. id_no: '请填写身份证号',
  15581. text: '请填写留言',
  15582. tel: '请填写数字',
  15583. email: '请填写邮箱',
  15584. date: '请选择日期',
  15585. time: '请选择时间',
  15586. textarea: '请填写留言',
  15587. mobile: '请填写手机号'
  15588. }
  15589. },
  15590. vanSkuRow: {
  15591. multiple: '可多选'
  15592. },
  15593. vanSkuDatetimeField: {
  15594. title: {
  15595. date: '选择年月日',
  15596. time: '选择时间',
  15597. datetime: '选择日期时间'
  15598. },
  15599. format: {
  15600. year: '年',
  15601. month: '月',
  15602. day: '日',
  15603. hour: '时',
  15604. minute: '分'
  15605. }
  15606. }
  15607. }
  15608. });
  15609. // CONCATENATED MODULE: ./es/sku/constants.js
  15610. var LIMIT_TYPE = {
  15611. QUOTA_LIMIT: 0,
  15612. STOCK_LIMIT: 1
  15613. };
  15614. var UNSELECTED_SKU_VALUE_ID = '';
  15615. /* harmony default export */ var constants = ({
  15616. LIMIT_TYPE: LIMIT_TYPE,
  15617. UNSELECTED_SKU_VALUE_ID: UNSELECTED_SKU_VALUE_ID
  15618. });
  15619. // CONCATENATED MODULE: ./es/sku/utils/sku-helper.js
  15620. /*
  15621. normalize sku tree
  15622. [
  15623. {
  15624. count: 2,
  15625. k: "品种", // 规格名称 skuKeyName
  15626. k_id: "1200", // skuKeyId
  15627. k_s: "s1" // skuKeyStr
  15628. v: [ // skuValues
  15629. { // skuValue
  15630. id: "1201", // skuValueId
  15631. name: "萌" // 具体的规格值 skuValueName
  15632. }, {
  15633. id: "973",
  15634. name: "帅"
  15635. }
  15636. ]
  15637. },
  15638. ...
  15639. ]
  15640. |
  15641. v
  15642. {
  15643. s1: [{
  15644. id: "1201",
  15645. name: "萌"
  15646. }, {
  15647. id: "973",
  15648. name: "帅"
  15649. }],
  15650. ...
  15651. }
  15652. */
  15653. var normalizeSkuTree = function normalizeSkuTree(skuTree) {
  15654. var normalizedTree = {};
  15655. skuTree.forEach(function (treeItem) {
  15656. normalizedTree[treeItem.k_s] = treeItem.v;
  15657. });
  15658. return normalizedTree;
  15659. };
  15660. var normalizePropList = function normalizePropList(propList) {
  15661. var normalizedProp = {};
  15662. propList.forEach(function (item) {
  15663. var itemObj = {};
  15664. item.v.forEach(function (it) {
  15665. itemObj[it.id] = it;
  15666. });
  15667. normalizedProp[item.k_id] = itemObj;
  15668. });
  15669. return normalizedProp;
  15670. }; // 判断是否所有的sku都已经选中
  15671. var sku_helper_isAllSelected = function isAllSelected(skuTree, selectedSku) {
  15672. // 筛选selectedSku对象中key值不为空的值
  15673. var selected = Object.keys(selectedSku).filter(function (skuKeyStr) {
  15674. return selectedSku[skuKeyStr] !== UNSELECTED_SKU_VALUE_ID;
  15675. });
  15676. return skuTree.length === selected.length;
  15677. }; // 根据已选择的 sku 获取 skuComb
  15678. var getSkuComb = function getSkuComb(skuList, selectedSku) {
  15679. var skuComb = skuList.filter(function (item) {
  15680. return Object.keys(selectedSku).every(function (skuKeyStr) {
  15681. return String(item[skuKeyStr]) === String(selectedSku[skuKeyStr]);
  15682. });
  15683. });
  15684. return skuComb[0];
  15685. }; // 获取已选择的sku名称
  15686. var sku_helper_getSelectedSkuValues = function getSelectedSkuValues(skuTree, selectedSku) {
  15687. var normalizedTree = normalizeSkuTree(skuTree);
  15688. return Object.keys(selectedSku).reduce(function (selectedValues, skuKeyStr) {
  15689. var skuValues = normalizedTree[skuKeyStr];
  15690. var skuValueId = selectedSku[skuKeyStr];
  15691. if (skuValueId !== UNSELECTED_SKU_VALUE_ID) {
  15692. var skuValue = skuValues.filter(function (value) {
  15693. return value.id === skuValueId;
  15694. })[0];
  15695. skuValue && selectedValues.push(skuValue);
  15696. }
  15697. return selectedValues;
  15698. }, []);
  15699. }; // 判断sku是否可选
  15700. var sku_helper_isSkuChoosable = function isSkuChoosable(skuList, selectedSku, skuToChoose) {
  15701. var _extends2;
  15702. var key = skuToChoose.key,
  15703. valueId = skuToChoose.valueId; // 先假设sku已选中,拼入已选中sku对象中
  15704. var matchedSku = _extends({}, selectedSku, (_extends2 = {}, _extends2[key] = valueId, _extends2)); // 再判断剩余sku是否全部不可选,若不可选则当前sku不可选中
  15705. var skusToCheck = Object.keys(matchedSku).filter(function (skuKey) {
  15706. return matchedSku[skuKey] !== UNSELECTED_SKU_VALUE_ID;
  15707. });
  15708. var filteredSku = skuList.filter(function (sku) {
  15709. return skusToCheck.every(function (skuKey) {
  15710. return String(matchedSku[skuKey]) === String(sku[skuKey]);
  15711. });
  15712. });
  15713. var stock = filteredSku.reduce(function (total, sku) {
  15714. total += sku.stock_num;
  15715. return total;
  15716. }, 0);
  15717. return stock > 0;
  15718. };
  15719. var sku_helper_getSelectedPropValues = function getSelectedPropValues(propList, selectedProp) {
  15720. var normalizeProp = normalizePropList(propList);
  15721. return Object.keys(selectedProp).reduce(function (acc, cur) {
  15722. selectedProp[cur].forEach(function (it) {
  15723. acc.push(_extends({}, normalizeProp[cur][it]));
  15724. });
  15725. return acc;
  15726. }, []);
  15727. };
  15728. var sku_helper_getSelectedProperties = function getSelectedProperties(propList, selectedProp) {
  15729. var list = [];
  15730. (propList || []).forEach(function (prop) {
  15731. if (selectedProp[prop.k_id] && selectedProp[prop.k_id].length > 0) {
  15732. var v = [];
  15733. prop.v.forEach(function (it) {
  15734. if (selectedProp[prop.k_id].indexOf(it.id) > -1) {
  15735. v.push(_extends({}, it));
  15736. }
  15737. });
  15738. list.push(_extends({}, prop, {
  15739. v: v
  15740. }));
  15741. }
  15742. });
  15743. return list;
  15744. };
  15745. /* harmony default export */ var sku_helper = ({
  15746. normalizeSkuTree: normalizeSkuTree,
  15747. getSkuComb: getSkuComb,
  15748. getSelectedSkuValues: sku_helper_getSelectedSkuValues,
  15749. isAllSelected: sku_helper_isAllSelected,
  15750. isSkuChoosable: sku_helper_isSkuChoosable,
  15751. getSelectedPropValues: sku_helper_getSelectedPropValues,
  15752. getSelectedProperties: sku_helper_getSelectedProperties
  15753. });
  15754. // CONCATENATED MODULE: ./es/sku/components/SkuHeader.js
  15755. // Utils
  15756. // Components
  15757. // Types
  15758. var SkuHeader_createNamespace = Object(create["a" /* createNamespace */])('sku-header'),
  15759. SkuHeader_createComponent = SkuHeader_createNamespace[0],
  15760. SkuHeader_bem = SkuHeader_createNamespace[1];
  15761. function getSkuImgValue(sku, selectedSku) {
  15762. var imgValue;
  15763. sku.tree.some(function (item) {
  15764. var id = selectedSku[item.k_s];
  15765. if (id && item.v) {
  15766. var matchedSku = item.v.filter(function (skuValue) {
  15767. return skuValue.id === id;
  15768. })[0] || {};
  15769. var img = matchedSku.previewImgUrl || matchedSku.imgUrl || matchedSku.img_url;
  15770. if (img) {
  15771. imgValue = _extends({}, matchedSku, {
  15772. ks: item.k_s,
  15773. imgUrl: img
  15774. });
  15775. return true;
  15776. }
  15777. }
  15778. return false;
  15779. });
  15780. return imgValue;
  15781. }
  15782. function SkuHeader(h, props, slots, ctx) {
  15783. var _slots$skuHeaderIma;
  15784. var sku = props.sku,
  15785. goods = props.goods,
  15786. skuEventBus = props.skuEventBus,
  15787. selectedSku = props.selectedSku,
  15788. _props$showHeaderImag = props.showHeaderImage,
  15789. showHeaderImage = _props$showHeaderImag === void 0 ? true : _props$showHeaderImag;
  15790. var selectedValue = getSkuImgValue(sku, selectedSku);
  15791. var imgUrl = selectedValue ? selectedValue.imgUrl : goods.picture;
  15792. var previewImage = function previewImage() {
  15793. skuEventBus.$emit('sku:previewImage', selectedValue);
  15794. };
  15795. return h("div", helper_default()([{
  15796. "class": [SkuHeader_bem(), BORDER_BOTTOM]
  15797. }, inherit(ctx)]), [showHeaderImage && h(es_image, {
  15798. "attrs": {
  15799. "fit": "cover",
  15800. "src": imgUrl
  15801. },
  15802. "class": SkuHeader_bem('img-wrap'),
  15803. "on": {
  15804. "click": previewImage
  15805. }
  15806. }, [(_slots$skuHeaderIma = slots['sku-header-image-extra']) == null ? void 0 : _slots$skuHeaderIma.call(slots)]), h("div", {
  15807. "class": SkuHeader_bem('goods-info')
  15808. }, [slots.default == null ? void 0 : slots.default()])]);
  15809. }
  15810. SkuHeader.props = {
  15811. sku: Object,
  15812. goods: Object,
  15813. skuEventBus: Object,
  15814. selectedSku: Object,
  15815. showHeaderImage: Boolean
  15816. };
  15817. /* harmony default export */ var components_SkuHeader = (SkuHeader_createComponent(SkuHeader));
  15818. // CONCATENATED MODULE: ./es/sku/components/SkuHeaderItem.js
  15819. // Utils
  15820. // Types
  15821. var SkuHeaderItem_createNamespace = Object(create["a" /* createNamespace */])('sku-header-item'),
  15822. SkuHeaderItem_createComponent = SkuHeaderItem_createNamespace[0],
  15823. SkuHeaderItem_bem = SkuHeaderItem_createNamespace[1];
  15824. function SkuHeaderItem_SkuHeader(h, props, slots, ctx) {
  15825. return h("div", helper_default()([{
  15826. "class": SkuHeaderItem_bem()
  15827. }, inherit(ctx)]), [slots.default && slots.default()]);
  15828. }
  15829. /* harmony default export */ var SkuHeaderItem = (SkuHeaderItem_createComponent(SkuHeaderItem_SkuHeader));
  15830. // CONCATENATED MODULE: ./es/sku/components/SkuRow.js
  15831. // Utils
  15832. // Mixins
  15833. var SkuRow_createNamespace = Object(create["a" /* createNamespace */])('sku-row'),
  15834. SkuRow_createComponent = SkuRow_createNamespace[0],
  15835. SkuRow_bem = SkuRow_createNamespace[1],
  15836. SkuRow_t = SkuRow_createNamespace[2];
  15837. /* harmony default export */ var SkuRow = (SkuRow_createComponent({
  15838. mixins: [ParentMixin('vanSkuRows'), BindEventMixin(function (bind) {
  15839. if (this.scrollable && this.$refs.scroller) {
  15840. bind(this.$refs.scroller, 'scroll', this.onScroll);
  15841. }
  15842. })],
  15843. props: {
  15844. skuRow: Object
  15845. },
  15846. data: function data() {
  15847. return {
  15848. progress: 0
  15849. };
  15850. },
  15851. computed: {
  15852. scrollable: function scrollable() {
  15853. return this.skuRow.largeImageMode && this.skuRow.v.length > 6;
  15854. }
  15855. },
  15856. methods: {
  15857. onScroll: function onScroll() {
  15858. var _this$$refs = this.$refs,
  15859. scroller = _this$$refs.scroller,
  15860. row = _this$$refs.row;
  15861. var distance = row.offsetWidth - scroller.offsetWidth;
  15862. this.progress = scroller.scrollLeft / distance;
  15863. },
  15864. genTitle: function genTitle() {
  15865. var h = this.$createElement;
  15866. return h("div", {
  15867. "class": SkuRow_bem('title')
  15868. }, [this.skuRow.k, this.skuRow.is_multiple && h("span", {
  15869. "class": SkuRow_bem('title-multiple')
  15870. }, ["\uFF08", SkuRow_t('multiple'), "\uFF09"])]);
  15871. },
  15872. genIndicator: function genIndicator() {
  15873. var h = this.$createElement;
  15874. if (this.scrollable) {
  15875. var style = {
  15876. transform: "translate3d(" + this.progress * 20 + "px, 0, 0)"
  15877. };
  15878. return h("div", {
  15879. "class": SkuRow_bem('indicator-wrapper')
  15880. }, [h("div", {
  15881. "class": SkuRow_bem('indicator')
  15882. }, [h("div", {
  15883. "class": SkuRow_bem('indicator-slider'),
  15884. "style": style
  15885. })])]);
  15886. }
  15887. },
  15888. genContent: function genContent() {
  15889. var h = this.$createElement;
  15890. var nodes = this.slots();
  15891. if (this.skuRow.largeImageMode) {
  15892. var top = [];
  15893. var bottom = [];
  15894. nodes.forEach(function (node, index) {
  15895. var group = Math.floor(index / 3) % 2 === 0 ? top : bottom;
  15896. group.push(node);
  15897. });
  15898. return h("div", {
  15899. "class": SkuRow_bem('scroller'),
  15900. "ref": "scroller"
  15901. }, [h("div", {
  15902. "class": SkuRow_bem('row'),
  15903. "ref": "row"
  15904. }, [top]), bottom.length ? h("div", {
  15905. "class": SkuRow_bem('row')
  15906. }, [bottom]) : null]);
  15907. }
  15908. return nodes;
  15909. },
  15910. centerItem: function centerItem(selectSkuId) {
  15911. if (!this.skuRow.largeImageMode || !selectSkuId) {
  15912. return;
  15913. }
  15914. var _this$children = this.children,
  15915. children = _this$children === void 0 ? [] : _this$children;
  15916. var _this$$refs2 = this.$refs,
  15917. scroller = _this$$refs2.scroller,
  15918. row = _this$$refs2.row;
  15919. var child = children.find(function (it) {
  15920. return +it.skuValue.id === +selectSkuId;
  15921. });
  15922. if (scroller && row && child && child.$el) {
  15923. var target = child.$el;
  15924. var to = target.offsetLeft - (scroller.offsetWidth - target.offsetWidth) / 2;
  15925. scroller.scrollLeft = to;
  15926. }
  15927. }
  15928. },
  15929. render: function render() {
  15930. var h = arguments[0];
  15931. return h("div", {
  15932. "class": [SkuRow_bem(), BORDER_BOTTOM]
  15933. }, [this.genTitle(), this.genContent(), this.genIndicator()]);
  15934. }
  15935. }));
  15936. // CONCATENATED MODULE: ./es/sku/components/SkuRowItem.js
  15937. var SkuRowItem_createNamespace = Object(create["a" /* createNamespace */])('sku-row-item'),
  15938. SkuRowItem_createComponent = SkuRowItem_createNamespace[0];
  15939. /* harmony default export */ var SkuRowItem = (SkuRowItem_createComponent({
  15940. mixins: [ChildrenMixin('vanSkuRows')],
  15941. props: {
  15942. lazyLoad: Boolean,
  15943. skuValue: Object,
  15944. skuKeyStr: String,
  15945. skuEventBus: Object,
  15946. selectedSku: Object,
  15947. largeImageMode: Boolean,
  15948. disableSoldoutSku: Boolean,
  15949. skuList: {
  15950. type: Array,
  15951. default: function _default() {
  15952. return [];
  15953. }
  15954. }
  15955. },
  15956. computed: {
  15957. imgUrl: function imgUrl() {
  15958. var url = this.skuValue.imgUrl || this.skuValue.img_url;
  15959. return this.largeImageMode ? url || 'https://img01.yzcdn.cn/upload_files/2020/06/24/FmKWDg0bN9rMcTp9ne8MXiQWGtLn.png' : url;
  15960. },
  15961. choosable: function choosable() {
  15962. if (!this.disableSoldoutSku) {
  15963. return true;
  15964. }
  15965. return sku_helper_isSkuChoosable(this.skuList, this.selectedSku, {
  15966. key: this.skuKeyStr,
  15967. valueId: this.skuValue.id
  15968. });
  15969. }
  15970. },
  15971. methods: {
  15972. onSelect: function onSelect() {
  15973. if (this.choosable) {
  15974. this.skuEventBus.$emit('sku:select', _extends({}, this.skuValue, {
  15975. skuKeyStr: this.skuKeyStr
  15976. }));
  15977. }
  15978. },
  15979. onPreviewImg: function onPreviewImg(event) {
  15980. event.stopPropagation();
  15981. var skuValue = this.skuValue,
  15982. skuKeyStr = this.skuKeyStr;
  15983. this.skuEventBus.$emit('sku:previewImage', _extends({}, skuValue, {
  15984. ks: skuKeyStr,
  15985. imgUrl: skuValue.imgUrl || skuValue.img_url
  15986. }));
  15987. },
  15988. genImage: function genImage(classPrefix) {
  15989. var h = this.$createElement;
  15990. if (this.imgUrl) {
  15991. return h(es_image, {
  15992. "attrs": {
  15993. "fit": "cover",
  15994. "src": this.imgUrl,
  15995. "lazyLoad": this.lazyLoad
  15996. },
  15997. "class": classPrefix + "-img"
  15998. });
  15999. }
  16000. }
  16001. },
  16002. render: function render() {
  16003. var h = arguments[0];
  16004. var choosed = this.skuValue.id === this.selectedSku[this.skuKeyStr];
  16005. var classPrefix = this.largeImageMode ? SkuRow_bem('image-item') : SkuRow_bem('item');
  16006. return h("span", {
  16007. "class": [classPrefix, choosed ? classPrefix + "--active" : '', !this.choosable ? classPrefix + "--disabled" : ''],
  16008. "on": {
  16009. "click": this.onSelect
  16010. }
  16011. }, [this.genImage(classPrefix), h("div", {
  16012. "class": classPrefix + "-name"
  16013. }, [this.largeImageMode ? h("span", {
  16014. "class": {
  16015. 'van-multi-ellipsis--l2': this.largeImageMode
  16016. }
  16017. }, [this.skuValue.name]) : this.skuValue.name]), this.largeImageMode && h(es_icon, {
  16018. "attrs": {
  16019. "name": "enlarge"
  16020. },
  16021. "class": classPrefix + "-img-icon",
  16022. "on": {
  16023. "click": this.onPreviewImg
  16024. }
  16025. })]);
  16026. }
  16027. }));
  16028. // CONCATENATED MODULE: ./es/sku/components/SkuRowPropItem.js
  16029. var SkuRowPropItem_createNamespace = Object(create["a" /* createNamespace */])('sku-row-prop-item'),
  16030. SkuRowPropItem_createComponent = SkuRowPropItem_createNamespace[0];
  16031. /* harmony default export */ var SkuRowPropItem = (SkuRowPropItem_createComponent({
  16032. props: {
  16033. skuValue: Object,
  16034. skuKeyStr: String,
  16035. skuEventBus: Object,
  16036. selectedProp: Object,
  16037. multiple: Boolean
  16038. },
  16039. computed: {
  16040. choosed: function choosed() {
  16041. var selectedProp = this.selectedProp,
  16042. skuKeyStr = this.skuKeyStr,
  16043. skuValue = this.skuValue;
  16044. if (selectedProp && selectedProp[skuKeyStr]) {
  16045. return selectedProp[skuKeyStr].indexOf(skuValue.id) > -1;
  16046. }
  16047. return false;
  16048. }
  16049. },
  16050. methods: {
  16051. onSelect: function onSelect() {
  16052. this.skuEventBus.$emit('sku:propSelect', _extends({}, this.skuValue, {
  16053. skuKeyStr: this.skuKeyStr,
  16054. multiple: this.multiple
  16055. }));
  16056. }
  16057. },
  16058. render: function render() {
  16059. var h = arguments[0];
  16060. return h("span", {
  16061. "class": ['van-sku-row__item', {
  16062. 'van-sku-row__item--active': this.choosed
  16063. }],
  16064. "on": {
  16065. "click": this.onSelect
  16066. }
  16067. }, [h("span", {
  16068. "class": "van-sku-row__item-name"
  16069. }, [this.skuValue.name])]);
  16070. }
  16071. }));
  16072. // CONCATENATED MODULE: ./es/stepper/index.js
  16073. var stepper_createNamespace = Object(create["a" /* createNamespace */])('stepper'),
  16074. stepper_createComponent = stepper_createNamespace[0],
  16075. stepper_bem = stepper_createNamespace[1];
  16076. var LONG_PRESS_START_TIME = 600;
  16077. var LONG_PRESS_INTERVAL = 200;
  16078. function stepper_equal(value1, value2) {
  16079. return String(value1) === String(value2);
  16080. }
  16081. /* harmony default export */ var stepper = (stepper_createComponent({
  16082. mixins: [FieldMixin],
  16083. props: {
  16084. value: null,
  16085. theme: String,
  16086. integer: Boolean,
  16087. disabled: Boolean,
  16088. allowEmpty: Boolean,
  16089. inputWidth: [Number, String],
  16090. buttonSize: [Number, String],
  16091. asyncChange: Boolean,
  16092. placeholder: String,
  16093. disablePlus: Boolean,
  16094. disableMinus: Boolean,
  16095. disableInput: Boolean,
  16096. decimalLength: [Number, String],
  16097. name: {
  16098. type: [Number, String],
  16099. default: ''
  16100. },
  16101. min: {
  16102. type: [Number, String],
  16103. default: 1
  16104. },
  16105. max: {
  16106. type: [Number, String],
  16107. default: Infinity
  16108. },
  16109. step: {
  16110. type: [Number, String],
  16111. default: 1
  16112. },
  16113. defaultValue: {
  16114. type: [Number, String],
  16115. default: 1
  16116. },
  16117. showPlus: {
  16118. type: Boolean,
  16119. default: true
  16120. },
  16121. showMinus: {
  16122. type: Boolean,
  16123. default: true
  16124. },
  16125. showInput: {
  16126. type: Boolean,
  16127. default: true
  16128. },
  16129. longPress: {
  16130. type: Boolean,
  16131. default: true
  16132. }
  16133. },
  16134. data: function data() {
  16135. var _this$value;
  16136. var defaultValue = (_this$value = this.value) != null ? _this$value : this.defaultValue;
  16137. var value = this.format(defaultValue);
  16138. if (!stepper_equal(value, this.value)) {
  16139. this.$emit('input', value);
  16140. }
  16141. return {
  16142. currentValue: value
  16143. };
  16144. },
  16145. computed: {
  16146. minusDisabled: function minusDisabled() {
  16147. return this.disabled || this.disableMinus || this.currentValue <= +this.min;
  16148. },
  16149. plusDisabled: function plusDisabled() {
  16150. return this.disabled || this.disablePlus || this.currentValue >= +this.max;
  16151. },
  16152. inputStyle: function inputStyle() {
  16153. var style = {};
  16154. if (this.inputWidth) {
  16155. style.width = Object(unit["a" /* addUnit */])(this.inputWidth);
  16156. }
  16157. if (this.buttonSize) {
  16158. style.height = Object(unit["a" /* addUnit */])(this.buttonSize);
  16159. }
  16160. return style;
  16161. },
  16162. buttonStyle: function buttonStyle() {
  16163. if (this.buttonSize) {
  16164. var size = Object(unit["a" /* addUnit */])(this.buttonSize);
  16165. return {
  16166. width: size,
  16167. height: size
  16168. };
  16169. }
  16170. }
  16171. },
  16172. watch: {
  16173. max: 'check',
  16174. min: 'check',
  16175. integer: 'check',
  16176. decimalLength: 'check',
  16177. value: function value(val) {
  16178. if (!stepper_equal(val, this.currentValue)) {
  16179. this.currentValue = this.format(val);
  16180. }
  16181. },
  16182. currentValue: function currentValue(val) {
  16183. this.$emit('input', val);
  16184. this.$emit('change', val, {
  16185. name: this.name
  16186. });
  16187. }
  16188. },
  16189. methods: {
  16190. check: function check() {
  16191. var val = this.format(this.currentValue);
  16192. if (!stepper_equal(val, this.currentValue)) {
  16193. this.currentValue = val;
  16194. }
  16195. },
  16196. // formatNumber illegal characters
  16197. formatNumber: function formatNumber(value) {
  16198. return number_formatNumber(String(value), !this.integer);
  16199. },
  16200. format: function format(value) {
  16201. if (this.allowEmpty && value === '') {
  16202. return value;
  16203. }
  16204. value = this.formatNumber(value); // format range
  16205. value = value === '' ? 0 : +value;
  16206. value = Object(number["a" /* isNaN */])(value) ? this.min : value;
  16207. value = Math.max(Math.min(this.max, value), this.min); // format decimal
  16208. if (Object(utils["c" /* isDef */])(this.decimalLength)) {
  16209. value = value.toFixed(this.decimalLength);
  16210. }
  16211. return value;
  16212. },
  16213. onInput: function onInput(event) {
  16214. var value = event.target.value;
  16215. var formatted = this.formatNumber(value); // limit max decimal length
  16216. if (Object(utils["c" /* isDef */])(this.decimalLength) && formatted.indexOf('.') !== -1) {
  16217. var pair = formatted.split('.');
  16218. formatted = pair[0] + "." + pair[1].slice(0, this.decimalLength);
  16219. }
  16220. if (!stepper_equal(value, formatted)) {
  16221. event.target.value = formatted;
  16222. } // prefer number type
  16223. if (formatted === String(+formatted)) {
  16224. formatted = +formatted;
  16225. }
  16226. this.emitChange(formatted);
  16227. },
  16228. emitChange: function emitChange(value) {
  16229. if (this.asyncChange) {
  16230. this.$emit('input', value);
  16231. this.$emit('change', value, {
  16232. name: this.name
  16233. });
  16234. } else {
  16235. this.currentValue = value;
  16236. }
  16237. },
  16238. onChange: function onChange() {
  16239. var type = this.type;
  16240. if (this[type + "Disabled"]) {
  16241. this.$emit('overlimit', type);
  16242. return;
  16243. }
  16244. var diff = type === 'minus' ? -this.step : +this.step;
  16245. var value = this.format(addNumber(+this.currentValue, diff));
  16246. this.emitChange(value);
  16247. this.$emit(type);
  16248. },
  16249. onFocus: function onFocus(event) {
  16250. // readonly not work in legacy mobile safari
  16251. if (this.disableInput && this.$refs.input) {
  16252. this.$refs.input.blur();
  16253. } else {
  16254. this.$emit('focus', event);
  16255. }
  16256. },
  16257. onBlur: function onBlur(event) {
  16258. var value = this.format(event.target.value);
  16259. event.target.value = value;
  16260. this.emitChange(value);
  16261. this.$emit('blur', event);
  16262. resetScroll();
  16263. },
  16264. longPressStep: function longPressStep() {
  16265. var _this = this;
  16266. this.longPressTimer = setTimeout(function () {
  16267. _this.onChange();
  16268. _this.longPressStep(_this.type);
  16269. }, LONG_PRESS_INTERVAL);
  16270. },
  16271. onTouchStart: function onTouchStart() {
  16272. var _this2 = this;
  16273. if (!this.longPress) {
  16274. return;
  16275. }
  16276. clearTimeout(this.longPressTimer);
  16277. this.isLongPress = false;
  16278. this.longPressTimer = setTimeout(function () {
  16279. _this2.isLongPress = true;
  16280. _this2.onChange();
  16281. _this2.longPressStep();
  16282. }, LONG_PRESS_START_TIME);
  16283. },
  16284. onTouchEnd: function onTouchEnd(event) {
  16285. if (!this.longPress) {
  16286. return;
  16287. }
  16288. clearTimeout(this.longPressTimer);
  16289. if (this.isLongPress) {
  16290. preventDefault(event);
  16291. }
  16292. },
  16293. onMousedown: function onMousedown(event) {
  16294. // fix mobile safari page scroll down issue
  16295. // see: https://github.com/youzan/vant/issues/7690
  16296. if (this.disableInput) {
  16297. event.preventDefault();
  16298. }
  16299. }
  16300. },
  16301. render: function render() {
  16302. var _this3 = this;
  16303. var h = arguments[0];
  16304. var createListeners = function createListeners(type) {
  16305. return {
  16306. on: {
  16307. click: function click(e) {
  16308. // disable double tap scrolling on mobile safari
  16309. e.preventDefault();
  16310. _this3.type = type;
  16311. _this3.onChange();
  16312. },
  16313. touchstart: function touchstart() {
  16314. _this3.type = type;
  16315. _this3.onTouchStart();
  16316. },
  16317. touchend: _this3.onTouchEnd,
  16318. touchcancel: _this3.onTouchEnd
  16319. }
  16320. };
  16321. };
  16322. return h("div", {
  16323. "class": stepper_bem([this.theme])
  16324. }, [h("button", helper_default()([{
  16325. "directives": [{
  16326. name: "show",
  16327. value: this.showMinus
  16328. }],
  16329. "attrs": {
  16330. "type": "button"
  16331. },
  16332. "style": this.buttonStyle,
  16333. "class": stepper_bem('minus', {
  16334. disabled: this.minusDisabled
  16335. })
  16336. }, createListeners('minus')])), h("input", {
  16337. "directives": [{
  16338. name: "show",
  16339. value: this.showInput
  16340. }],
  16341. "ref": "input",
  16342. "attrs": {
  16343. "type": this.integer ? 'tel' : 'text',
  16344. "role": "spinbutton",
  16345. "disabled": this.disabled,
  16346. "readonly": this.disableInput,
  16347. "inputmode": this.integer ? 'numeric' : 'decimal',
  16348. "placeholder": this.placeholder,
  16349. "aria-valuemax": this.max,
  16350. "aria-valuemin": this.min,
  16351. "aria-valuenow": this.currentValue
  16352. },
  16353. "class": stepper_bem('input'),
  16354. "domProps": {
  16355. "value": this.currentValue
  16356. },
  16357. "style": this.inputStyle,
  16358. "on": {
  16359. "input": this.onInput,
  16360. "focus": this.onFocus,
  16361. "blur": this.onBlur,
  16362. "mousedown": this.onMousedown
  16363. }
  16364. }), h("button", helper_default()([{
  16365. "directives": [{
  16366. name: "show",
  16367. value: this.showPlus
  16368. }],
  16369. "attrs": {
  16370. "type": "button"
  16371. },
  16372. "style": this.buttonStyle,
  16373. "class": stepper_bem('plus', {
  16374. disabled: this.plusDisabled
  16375. })
  16376. }, createListeners('plus')]))]);
  16377. }
  16378. }));
  16379. // CONCATENATED MODULE: ./es/sku/components/SkuStepper.js
  16380. var namespace = Object(create["a" /* createNamespace */])('sku-stepper');
  16381. var SkuStepper_createComponent = namespace[0];
  16382. var SkuStepper_t = namespace[2];
  16383. var QUOTA_LIMIT = LIMIT_TYPE.QUOTA_LIMIT,
  16384. STOCK_LIMIT = LIMIT_TYPE.STOCK_LIMIT;
  16385. /* harmony default export */ var SkuStepper = (SkuStepper_createComponent({
  16386. props: {
  16387. stock: Number,
  16388. skuEventBus: Object,
  16389. skuStockNum: Number,
  16390. selectedNum: Number,
  16391. stepperTitle: String,
  16392. disableStepperInput: Boolean,
  16393. customStepperConfig: Object,
  16394. hideQuotaText: Boolean,
  16395. quota: {
  16396. type: Number,
  16397. default: 0
  16398. },
  16399. quotaUsed: {
  16400. type: Number,
  16401. default: 0
  16402. },
  16403. startSaleNum: {
  16404. type: Number,
  16405. default: 1
  16406. }
  16407. },
  16408. data: function data() {
  16409. return {
  16410. currentNum: this.selectedNum,
  16411. // 购买限制类型: 限购/库存
  16412. limitType: STOCK_LIMIT
  16413. };
  16414. },
  16415. watch: {
  16416. currentNum: function currentNum(num) {
  16417. var intValue = parseInt(num, 10);
  16418. if (intValue >= this.stepperMinLimit && intValue <= this.stepperLimit) {
  16419. this.skuEventBus.$emit('sku:numChange', intValue);
  16420. }
  16421. },
  16422. stepperLimit: function stepperLimit(limit) {
  16423. if (limit < this.currentNum && this.stepperMinLimit <= limit) {
  16424. this.currentNum = limit;
  16425. }
  16426. this.checkState(this.stepperMinLimit, limit);
  16427. },
  16428. stepperMinLimit: function stepperMinLimit(start) {
  16429. if (start > this.currentNum || start > this.stepperLimit) {
  16430. this.currentNum = start;
  16431. }
  16432. this.checkState(start, this.stepperLimit);
  16433. }
  16434. },
  16435. computed: {
  16436. stepperLimit: function stepperLimit() {
  16437. var quotaLimit = this.quota - this.quotaUsed;
  16438. var limit; // 无限购时直接取库存,有限购时取限购数和库存数中小的那个
  16439. if (this.quota > 0 && quotaLimit <= this.stock) {
  16440. // 修正负的limit
  16441. limit = quotaLimit < 0 ? 0 : quotaLimit;
  16442. this.limitType = QUOTA_LIMIT;
  16443. } else {
  16444. limit = this.stock;
  16445. this.limitType = STOCK_LIMIT;
  16446. }
  16447. return limit;
  16448. },
  16449. stepperMinLimit: function stepperMinLimit() {
  16450. return this.startSaleNum < 1 ? 1 : this.startSaleNum;
  16451. },
  16452. quotaText: function quotaText() {
  16453. var _this$customStepperCo = this.customStepperConfig,
  16454. quotaText = _this$customStepperCo.quotaText,
  16455. hideQuotaText = _this$customStepperCo.hideQuotaText;
  16456. if (hideQuotaText) return '';
  16457. var text = '';
  16458. if (quotaText) {
  16459. text = quotaText;
  16460. } else {
  16461. var textArr = [];
  16462. if (this.startSaleNum > 1) {
  16463. textArr.push(SkuStepper_t('quotaStart', this.startSaleNum));
  16464. }
  16465. if (this.quota > 0) {
  16466. textArr.push(SkuStepper_t('quotaLimit', this.quota));
  16467. }
  16468. text = textArr.join(SkuStepper_t('comma'));
  16469. }
  16470. return text;
  16471. }
  16472. },
  16473. created: function created() {
  16474. this.checkState(this.stepperMinLimit, this.stepperLimit);
  16475. },
  16476. methods: {
  16477. setCurrentNum: function setCurrentNum(num) {
  16478. this.currentNum = num;
  16479. this.checkState(this.stepperMinLimit, this.stepperLimit);
  16480. },
  16481. onOverLimit: function onOverLimit(action) {
  16482. this.skuEventBus.$emit('sku:overLimit', {
  16483. action: action,
  16484. limitType: this.limitType,
  16485. quota: this.quota,
  16486. quotaUsed: this.quotaUsed,
  16487. startSaleNum: this.startSaleNum
  16488. });
  16489. },
  16490. onChange: function onChange(currentValue) {
  16491. var intValue = parseInt(currentValue, 10);
  16492. var handleStepperChange = this.customStepperConfig.handleStepperChange;
  16493. handleStepperChange && handleStepperChange(intValue);
  16494. this.$emit('change', intValue);
  16495. },
  16496. checkState: function checkState(min, max) {
  16497. // 如果选择小于起售,则强制变为起售
  16498. if (this.currentNum < min || min > max) {
  16499. this.currentNum = min;
  16500. } else if (this.currentNum > max) {
  16501. // 当前选择数量大于最大可选时,需要重置已选数量
  16502. this.currentNum = max;
  16503. }
  16504. this.skuEventBus.$emit('sku:stepperState', {
  16505. valid: min <= max,
  16506. min: min,
  16507. max: max,
  16508. limitType: this.limitType,
  16509. quota: this.quota,
  16510. quotaUsed: this.quotaUsed,
  16511. startSaleNum: this.startSaleNum
  16512. });
  16513. }
  16514. },
  16515. render: function render() {
  16516. var _this = this;
  16517. var h = arguments[0];
  16518. return h("div", {
  16519. "class": "van-sku-stepper-stock"
  16520. }, [h("div", {
  16521. "class": "van-sku__stepper-title"
  16522. }, [this.stepperTitle || SkuStepper_t('num')]), h(stepper, {
  16523. "attrs": {
  16524. "integer": true,
  16525. "min": this.stepperMinLimit,
  16526. "max": this.stepperLimit,
  16527. "disableInput": this.disableStepperInput
  16528. },
  16529. "class": "van-sku__stepper",
  16530. "on": {
  16531. "overlimit": this.onOverLimit,
  16532. "change": this.onChange
  16533. },
  16534. "model": {
  16535. value: _this.currentNum,
  16536. callback: function callback($$v) {
  16537. _this.currentNum = $$v;
  16538. }
  16539. }
  16540. }), !this.hideQuotaText && this.quotaText && h("span", {
  16541. "class": "van-sku__stepper-quota"
  16542. }, ["(", this.quotaText, ")"])]);
  16543. }
  16544. }));
  16545. // CONCATENATED MODULE: ./es/utils/validate/email.js
  16546. /* eslint-disable */
  16547. function isEmail(value) {
  16548. var reg = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i;
  16549. return reg.test(value);
  16550. }
  16551. // CONCATENATED MODULE: ./es/uploader/utils.js
  16552. function toArray(item) {
  16553. if (Array.isArray(item)) {
  16554. return item;
  16555. }
  16556. return [item];
  16557. }
  16558. function utils_readFile(file, resultType) {
  16559. return new Promise(function (resolve) {
  16560. if (resultType === 'file') {
  16561. resolve(null);
  16562. return;
  16563. }
  16564. var reader = new FileReader();
  16565. reader.onload = function (event) {
  16566. resolve(event.target.result);
  16567. };
  16568. if (resultType === 'dataUrl') {
  16569. reader.readAsDataURL(file);
  16570. } else if (resultType === 'text') {
  16571. reader.readAsText(file);
  16572. }
  16573. });
  16574. }
  16575. function isOversize(files, maxSize) {
  16576. return toArray(files).some(function (file) {
  16577. if (file) {
  16578. if (Object(utils["e" /* isFunction */])(maxSize)) {
  16579. return maxSize(file);
  16580. }
  16581. return file.size > maxSize;
  16582. }
  16583. return false;
  16584. });
  16585. }
  16586. var IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg)/i;
  16587. function isImageUrl(url) {
  16588. return IMAGE_REGEXP.test(url);
  16589. }
  16590. function isImageFile(item) {
  16591. // some special urls cannot be recognized
  16592. // user can add `isImage` flag to mark it as an image url
  16593. if (item.isImage) {
  16594. return true;
  16595. }
  16596. if (item.file && item.file.type) {
  16597. return item.file.type.indexOf('image') === 0;
  16598. }
  16599. if (item.url) {
  16600. return isImageUrl(item.url);
  16601. }
  16602. if (item.content) {
  16603. return item.content.indexOf('data:image') === 0;
  16604. }
  16605. return false;
  16606. }
  16607. // CONCATENATED MODULE: ./es/uploader/index.js
  16608. // Utils
  16609. // Mixins
  16610. // Components
  16611. var uploader_createNamespace = Object(create["a" /* createNamespace */])('uploader'),
  16612. uploader_createComponent = uploader_createNamespace[0],
  16613. uploader_bem = uploader_createNamespace[1];
  16614. /* harmony default export */ var uploader = (uploader_createComponent({
  16615. inheritAttrs: false,
  16616. mixins: [FieldMixin],
  16617. model: {
  16618. prop: 'fileList'
  16619. },
  16620. props: {
  16621. disabled: Boolean,
  16622. readonly: Boolean,
  16623. lazyLoad: Boolean,
  16624. uploadText: String,
  16625. afterRead: Function,
  16626. beforeRead: Function,
  16627. beforeDelete: Function,
  16628. previewSize: [Number, String],
  16629. previewOptions: Object,
  16630. name: {
  16631. type: [Number, String],
  16632. default: ''
  16633. },
  16634. accept: {
  16635. type: String,
  16636. default: 'image/*'
  16637. },
  16638. fileList: {
  16639. type: Array,
  16640. default: function _default() {
  16641. return [];
  16642. }
  16643. },
  16644. maxSize: {
  16645. type: [Number, String, Function],
  16646. default: Number.MAX_VALUE
  16647. },
  16648. maxCount: {
  16649. type: [Number, String],
  16650. default: Number.MAX_VALUE
  16651. },
  16652. deletable: {
  16653. type: Boolean,
  16654. default: true
  16655. },
  16656. showUpload: {
  16657. type: Boolean,
  16658. default: true
  16659. },
  16660. previewImage: {
  16661. type: Boolean,
  16662. default: true
  16663. },
  16664. previewFullImage: {
  16665. type: Boolean,
  16666. default: true
  16667. },
  16668. imageFit: {
  16669. type: String,
  16670. default: 'cover'
  16671. },
  16672. resultType: {
  16673. type: String,
  16674. default: 'dataUrl'
  16675. },
  16676. uploadIcon: {
  16677. type: String,
  16678. default: 'photograph'
  16679. }
  16680. },
  16681. computed: {
  16682. previewSizeWithUnit: function previewSizeWithUnit() {
  16683. return Object(unit["a" /* addUnit */])(this.previewSize);
  16684. },
  16685. // for form
  16686. value: function value() {
  16687. return this.fileList;
  16688. }
  16689. },
  16690. methods: {
  16691. getDetail: function getDetail(index) {
  16692. if (index === void 0) {
  16693. index = this.fileList.length;
  16694. }
  16695. return {
  16696. name: this.name,
  16697. index: index
  16698. };
  16699. },
  16700. onChange: function onChange(event) {
  16701. var _this = this;
  16702. var files = event.target.files;
  16703. if (this.disabled || !files.length) {
  16704. return;
  16705. }
  16706. files = files.length === 1 ? files[0] : [].slice.call(files);
  16707. if (this.beforeRead) {
  16708. var response = this.beforeRead(files, this.getDetail());
  16709. if (!response) {
  16710. this.resetInput();
  16711. return;
  16712. }
  16713. if (Object(utils["g" /* isPromise */])(response)) {
  16714. response.then(function (data) {
  16715. if (data) {
  16716. _this.readFile(data);
  16717. } else {
  16718. _this.readFile(files);
  16719. }
  16720. }).catch(this.resetInput);
  16721. return;
  16722. }
  16723. }
  16724. this.readFile(files);
  16725. },
  16726. readFile: function readFile(files) {
  16727. var _this2 = this;
  16728. var oversize = isOversize(files, this.maxSize);
  16729. if (Array.isArray(files)) {
  16730. var maxCount = this.maxCount - this.fileList.length;
  16731. if (files.length > maxCount) {
  16732. files = files.slice(0, maxCount);
  16733. }
  16734. Promise.all(files.map(function (file) {
  16735. return utils_readFile(file, _this2.resultType);
  16736. })).then(function (contents) {
  16737. var fileList = files.map(function (file, index) {
  16738. var result = {
  16739. file: file,
  16740. status: '',
  16741. message: ''
  16742. };
  16743. if (contents[index]) {
  16744. result.content = contents[index];
  16745. }
  16746. return result;
  16747. });
  16748. _this2.onAfterRead(fileList, oversize);
  16749. });
  16750. } else {
  16751. utils_readFile(files, this.resultType).then(function (content) {
  16752. var result = {
  16753. file: files,
  16754. status: '',
  16755. message: ''
  16756. };
  16757. if (content) {
  16758. result.content = content;
  16759. }
  16760. _this2.onAfterRead(result, oversize);
  16761. });
  16762. }
  16763. },
  16764. onAfterRead: function onAfterRead(files, oversize) {
  16765. var _this3 = this;
  16766. this.resetInput();
  16767. var validFiles = files;
  16768. if (oversize) {
  16769. var oversizeFiles = files;
  16770. if (Array.isArray(files)) {
  16771. oversizeFiles = [];
  16772. validFiles = [];
  16773. files.forEach(function (item) {
  16774. if (item.file) {
  16775. if (isOversize(item.file, _this3.maxSize)) {
  16776. oversizeFiles.push(item);
  16777. } else {
  16778. validFiles.push(item);
  16779. }
  16780. }
  16781. });
  16782. } else {
  16783. validFiles = null;
  16784. }
  16785. this.$emit('oversize', oversizeFiles, this.getDetail());
  16786. }
  16787. var isValidFiles = Array.isArray(validFiles) ? Boolean(validFiles.length) : Boolean(validFiles);
  16788. if (isValidFiles) {
  16789. this.$emit('input', [].concat(this.fileList, toArray(validFiles)));
  16790. if (this.afterRead) {
  16791. this.afterRead(validFiles, this.getDetail());
  16792. }
  16793. }
  16794. },
  16795. onDelete: function onDelete(file, index) {
  16796. var _file$beforeDelete,
  16797. _this4 = this;
  16798. var beforeDelete = (_file$beforeDelete = file.beforeDelete) != null ? _file$beforeDelete : this.beforeDelete;
  16799. if (beforeDelete) {
  16800. var response = beforeDelete(file, this.getDetail(index));
  16801. if (!response) {
  16802. return;
  16803. }
  16804. if (Object(utils["g" /* isPromise */])(response)) {
  16805. response.then(function () {
  16806. _this4.deleteFile(file, index);
  16807. }).catch(utils["i" /* noop */]);
  16808. return;
  16809. }
  16810. }
  16811. this.deleteFile(file, index);
  16812. },
  16813. deleteFile: function deleteFile(file, index) {
  16814. var fileList = this.fileList.slice(0);
  16815. fileList.splice(index, 1);
  16816. this.$emit('input', fileList);
  16817. this.$emit('delete', file, this.getDetail(index));
  16818. },
  16819. resetInput: function resetInput() {
  16820. /* istanbul ignore else */
  16821. if (this.$refs.input) {
  16822. this.$refs.input.value = '';
  16823. }
  16824. },
  16825. onClickUpload: function onClickUpload(event) {
  16826. this.$emit('click-upload', event);
  16827. },
  16828. onPreviewImage: function onPreviewImage(item) {
  16829. var _this5 = this;
  16830. if (!this.previewFullImage) {
  16831. return;
  16832. }
  16833. var imageFiles = this.fileList.filter(function (item) {
  16834. return isImageFile(item);
  16835. });
  16836. var imageContents = imageFiles.map(function (item) {
  16837. return item.content || item.url;
  16838. });
  16839. this.imagePreview = image_preview(_extends({
  16840. images: imageContents,
  16841. startPosition: imageFiles.indexOf(item),
  16842. onClose: function onClose() {
  16843. _this5.$emit('close-preview');
  16844. }
  16845. }, this.previewOptions));
  16846. },
  16847. // @exposed-api
  16848. closeImagePreview: function closeImagePreview() {
  16849. if (this.imagePreview) {
  16850. this.imagePreview.close();
  16851. }
  16852. },
  16853. // @exposed-api
  16854. chooseFile: function chooseFile() {
  16855. if (this.disabled) {
  16856. return;
  16857. }
  16858. /* istanbul ignore else */
  16859. if (this.$refs.input) {
  16860. this.$refs.input.click();
  16861. }
  16862. },
  16863. genPreviewMask: function genPreviewMask(item) {
  16864. var h = this.$createElement;
  16865. var status = item.status,
  16866. message = item.message;
  16867. if (status === 'uploading' || status === 'failed') {
  16868. var MaskIcon = status === 'failed' ? h(es_icon, {
  16869. "attrs": {
  16870. "name": "close"
  16871. },
  16872. "class": uploader_bem('mask-icon')
  16873. }) : h(es_loading, {
  16874. "class": uploader_bem('loading')
  16875. });
  16876. var showMessage = Object(utils["c" /* isDef */])(message) && message !== '';
  16877. return h("div", {
  16878. "class": uploader_bem('mask')
  16879. }, [MaskIcon, showMessage && h("div", {
  16880. "class": uploader_bem('mask-message')
  16881. }, [message])]);
  16882. }
  16883. },
  16884. genPreviewItem: function genPreviewItem(item, index) {
  16885. var _item$deletable,
  16886. _this6 = this,
  16887. _item$previewSize,
  16888. _item$imageFit;
  16889. var h = this.$createElement;
  16890. var deleteAble = (_item$deletable = item.deletable) != null ? _item$deletable : this.deletable;
  16891. var showDelete = item.status !== 'uploading' && deleteAble;
  16892. var DeleteIcon = showDelete && h("div", {
  16893. "class": uploader_bem('preview-delete'),
  16894. "on": {
  16895. "click": function click(event) {
  16896. event.stopPropagation();
  16897. _this6.onDelete(item, index);
  16898. }
  16899. }
  16900. }, [h(es_icon, {
  16901. "attrs": {
  16902. "name": "cross"
  16903. },
  16904. "class": uploader_bem('preview-delete-icon')
  16905. })]);
  16906. var PreviewCoverContent = this.slots('preview-cover', _extends({
  16907. index: index
  16908. }, item));
  16909. var PreviewCover = PreviewCoverContent && h("div", {
  16910. "class": uploader_bem('preview-cover')
  16911. }, [PreviewCoverContent]);
  16912. var previewSize = (_item$previewSize = item.previewSize) != null ? _item$previewSize : this.previewSize;
  16913. var imageFit = (_item$imageFit = item.imageFit) != null ? _item$imageFit : this.imageFit;
  16914. var Preview = isImageFile(item) ? h(es_image, {
  16915. "attrs": {
  16916. "fit": imageFit,
  16917. "src": item.content || item.url,
  16918. "width": previewSize,
  16919. "height": previewSize,
  16920. "lazyLoad": this.lazyLoad
  16921. },
  16922. "class": uploader_bem('preview-image'),
  16923. "on": {
  16924. "click": function click() {
  16925. _this6.onPreviewImage(item);
  16926. }
  16927. }
  16928. }, [PreviewCover]) : h("div", {
  16929. "class": uploader_bem('file'),
  16930. "style": {
  16931. width: this.previewSizeWithUnit,
  16932. height: this.previewSizeWithUnit
  16933. }
  16934. }, [h(es_icon, {
  16935. "class": uploader_bem('file-icon'),
  16936. "attrs": {
  16937. "name": "description"
  16938. }
  16939. }), h("div", {
  16940. "class": [uploader_bem('file-name'), 'van-ellipsis']
  16941. }, [item.file ? item.file.name : item.url]), PreviewCover]);
  16942. return h("div", {
  16943. "class": uploader_bem('preview'),
  16944. "on": {
  16945. "click": function click() {
  16946. _this6.$emit('click-preview', item, _this6.getDetail(index));
  16947. }
  16948. }
  16949. }, [Preview, this.genPreviewMask(item), DeleteIcon]);
  16950. },
  16951. genPreviewList: function genPreviewList() {
  16952. if (this.previewImage) {
  16953. return this.fileList.map(this.genPreviewItem);
  16954. }
  16955. },
  16956. genUpload: function genUpload() {
  16957. var h = this.$createElement;
  16958. if (this.fileList.length >= this.maxCount || !this.showUpload) {
  16959. return;
  16960. }
  16961. var slot = this.slots();
  16962. var Input = this.readonly ? null : h("input", {
  16963. "attrs": _extends({}, this.$attrs, {
  16964. "type": "file",
  16965. "accept": this.accept,
  16966. "disabled": this.disabled
  16967. }),
  16968. "ref": "input",
  16969. "class": uploader_bem('input'),
  16970. "on": {
  16971. "change": this.onChange
  16972. }
  16973. });
  16974. if (slot) {
  16975. return h("div", {
  16976. "class": uploader_bem('input-wrapper'),
  16977. "key": "input-wrapper",
  16978. "on": {
  16979. "click": this.onClickUpload
  16980. }
  16981. }, [slot, Input]);
  16982. }
  16983. var style;
  16984. if (this.previewSize) {
  16985. var size = this.previewSizeWithUnit;
  16986. style = {
  16987. width: size,
  16988. height: size
  16989. };
  16990. }
  16991. return h("div", {
  16992. "class": uploader_bem('upload', {
  16993. readonly: this.readonly
  16994. }),
  16995. "style": style,
  16996. "on": {
  16997. "click": this.onClickUpload
  16998. }
  16999. }, [h(es_icon, {
  17000. "attrs": {
  17001. "name": this.uploadIcon
  17002. },
  17003. "class": uploader_bem('upload-icon')
  17004. }), this.uploadText && h("span", {
  17005. "class": uploader_bem('upload-text')
  17006. }, [this.uploadText]), Input]);
  17007. }
  17008. },
  17009. render: function render() {
  17010. var h = arguments[0];
  17011. return h("div", {
  17012. "class": uploader_bem()
  17013. }, [h("div", {
  17014. "class": uploader_bem('wrapper', {
  17015. disabled: this.disabled
  17016. })
  17017. }, [this.genPreviewList(), this.genUpload()])]);
  17018. }
  17019. }));
  17020. // CONCATENATED MODULE: ./es/sku/components/SkuImgUploader.js
  17021. // Utils
  17022. // Components
  17023. var SkuImgUploader_namespace = Object(create["a" /* createNamespace */])('sku-img-uploader');
  17024. var SkuImgUploader_createComponent = SkuImgUploader_namespace[0];
  17025. var SkuImgUploader_t = SkuImgUploader_namespace[2];
  17026. /* harmony default export */ var SkuImgUploader = (SkuImgUploader_createComponent({
  17027. props: {
  17028. value: String,
  17029. uploadImg: Function,
  17030. customUpload: Function,
  17031. maxSize: {
  17032. type: Number,
  17033. default: 6
  17034. }
  17035. },
  17036. data: function data() {
  17037. return {
  17038. fileList: []
  17039. };
  17040. },
  17041. watch: {
  17042. value: function value(val) {
  17043. if (val) {
  17044. this.fileList = [{
  17045. url: val,
  17046. isImage: true
  17047. }];
  17048. } else {
  17049. this.fileList = [];
  17050. }
  17051. }
  17052. },
  17053. methods: {
  17054. afterReadFile: function afterReadFile(file) {
  17055. var _this = this;
  17056. file.status = 'uploading';
  17057. file.message = SkuImgUploader_t('uploading');
  17058. this.uploadImg(file.file, file.content).then(function (img) {
  17059. file.status = 'done';
  17060. _this.$emit('input', img);
  17061. }).catch(function () {
  17062. file.status = 'failed';
  17063. file.message = SkuImgUploader_t('fail');
  17064. });
  17065. },
  17066. onOversize: function onOversize() {
  17067. this.$toast(SkuImgUploader_t('oversize', this.maxSize));
  17068. },
  17069. onDelete: function onDelete() {
  17070. this.$emit('input', '');
  17071. },
  17072. onClickUpload: function onClickUpload() {
  17073. var _this2 = this;
  17074. if (this.customUpload) {
  17075. this.customUpload().then(function (url) {
  17076. _this2.fileList.push({
  17077. url: url
  17078. });
  17079. _this2.$emit('input', url);
  17080. });
  17081. }
  17082. }
  17083. },
  17084. render: function render() {
  17085. var _this3 = this;
  17086. var h = arguments[0];
  17087. return h(uploader, {
  17088. "attrs": {
  17089. "maxCount": 1,
  17090. "readonly": !!this.customUpload,
  17091. "maxSize": this.maxSize * 1024 * 1024,
  17092. "afterRead": this.afterReadFile
  17093. },
  17094. "on": {
  17095. "oversize": this.onOversize,
  17096. "delete": this.onDelete,
  17097. "click-upload": this.onClickUpload
  17098. },
  17099. "model": {
  17100. value: _this3.fileList,
  17101. callback: function callback($$v) {
  17102. _this3.fileList = $$v;
  17103. }
  17104. }
  17105. });
  17106. }
  17107. }));
  17108. // CONCATENATED MODULE: ./es/sku/utils/time-helper.js
  17109. // 字符串转 Date
  17110. // 只处理 YYYY-MM-DD 或者 YYYY-MM-DD HH:MM 格式
  17111. function stringToDate(timeString) {
  17112. if (!timeString) {
  17113. return null;
  17114. }
  17115. return new Date(timeString.replace(/-/g, '/'));
  17116. } // Date 转字符串
  17117. // type: date or datetime
  17118. function dateToString(date, type) {
  17119. if (type === void 0) {
  17120. type = 'date';
  17121. }
  17122. if (!date) {
  17123. return '';
  17124. }
  17125. var year = date.getFullYear();
  17126. var month = date.getMonth() + 1;
  17127. var day = date.getDate();
  17128. var timeString = year + "-" + Object(string["b" /* padZero */])(month) + "-" + Object(string["b" /* padZero */])(day);
  17129. if (type === 'datetime') {
  17130. var hours = date.getHours();
  17131. var minute = date.getMinutes();
  17132. timeString += " " + Object(string["b" /* padZero */])(hours) + ":" + Object(string["b" /* padZero */])(minute);
  17133. }
  17134. return timeString;
  17135. }
  17136. // CONCATENATED MODULE: ./es/sku/components/SkuDateTimeField.js
  17137. // Utils
  17138. // Components
  17139. var SkuDateTimeField_namespace = Object(create["a" /* createNamespace */])('sku-datetime-field');
  17140. var SkuDateTimeField_createComponent = SkuDateTimeField_namespace[0];
  17141. var SkuDateTimeField_t = SkuDateTimeField_namespace[2];
  17142. /* harmony default export */ var SkuDateTimeField = (SkuDateTimeField_createComponent({
  17143. props: {
  17144. value: String,
  17145. label: String,
  17146. required: Boolean,
  17147. placeholder: String,
  17148. type: {
  17149. type: String,
  17150. default: 'date'
  17151. }
  17152. },
  17153. data: function data() {
  17154. return {
  17155. showDatePicker: false,
  17156. currentDate: this.type === 'time' ? '' : new Date(),
  17157. minDate: new Date(new Date().getFullYear() - 60, 0, 1)
  17158. };
  17159. },
  17160. watch: {
  17161. value: function value(val) {
  17162. switch (this.type) {
  17163. case 'time':
  17164. this.currentDate = val;
  17165. break;
  17166. case 'date':
  17167. case 'datetime':
  17168. this.currentDate = stringToDate(val) || new Date();
  17169. break;
  17170. }
  17171. }
  17172. },
  17173. computed: {
  17174. title: function title() {
  17175. return SkuDateTimeField_t("title." + this.type);
  17176. }
  17177. },
  17178. methods: {
  17179. onClick: function onClick() {
  17180. this.showDatePicker = true;
  17181. },
  17182. onConfirm: function onConfirm(val) {
  17183. var data = val;
  17184. if (this.type !== 'time') {
  17185. data = dateToString(val, this.type);
  17186. }
  17187. this.$emit('input', data);
  17188. this.showDatePicker = false;
  17189. },
  17190. onCancel: function onCancel() {
  17191. this.showDatePicker = false;
  17192. },
  17193. formatter: function formatter(type, val) {
  17194. var word = SkuDateTimeField_t("format." + type);
  17195. return "" + val + word;
  17196. }
  17197. },
  17198. render: function render() {
  17199. var _this = this;
  17200. var h = arguments[0];
  17201. return h(es_field, {
  17202. "attrs": {
  17203. "readonly": true,
  17204. "is-link": true,
  17205. "center": true,
  17206. "value": this.value,
  17207. "label": this.label,
  17208. "required": this.required,
  17209. "placeholder": this.placeholder
  17210. },
  17211. "on": {
  17212. "click": this.onClick
  17213. }
  17214. }, [h(popup, {
  17215. "attrs": {
  17216. "round": true,
  17217. "position": "bottom",
  17218. "getContainer": "body"
  17219. },
  17220. "slot": "extra",
  17221. "model": {
  17222. value: _this.showDatePicker,
  17223. callback: function callback($$v) {
  17224. _this.showDatePicker = $$v;
  17225. }
  17226. }
  17227. }, [h(datetime_picker, {
  17228. "attrs": {
  17229. "type": this.type,
  17230. "title": this.title,
  17231. "value": this.currentDate,
  17232. "minDate": this.minDate,
  17233. "formatter": this.formatter
  17234. },
  17235. "on": {
  17236. "cancel": this.onCancel,
  17237. "confirm": this.onConfirm
  17238. }
  17239. })])]);
  17240. }
  17241. }));
  17242. // CONCATENATED MODULE: ./es/sku/components/SkuMessages.js
  17243. // Utils
  17244. // Components
  17245. var SkuMessages_createNamespace = Object(create["a" /* createNamespace */])('sku-messages'),
  17246. SkuMessages_createComponent = SkuMessages_createNamespace[0],
  17247. SkuMessages_bem = SkuMessages_createNamespace[1],
  17248. SkuMessages_t = SkuMessages_createNamespace[2];
  17249. /* harmony default export */ var SkuMessages = (SkuMessages_createComponent({
  17250. props: {
  17251. messageConfig: Object,
  17252. goodsId: [Number, String],
  17253. messages: {
  17254. type: Array,
  17255. default: function _default() {
  17256. return [];
  17257. }
  17258. }
  17259. },
  17260. data: function data() {
  17261. return {
  17262. messageValues: this.resetMessageValues(this.messages)
  17263. };
  17264. },
  17265. watch: {
  17266. messages: function messages(val) {
  17267. this.messageValues = this.resetMessageValues(val);
  17268. }
  17269. },
  17270. methods: {
  17271. resetMessageValues: function resetMessageValues(messages) {
  17272. var messageConfig = this.messageConfig;
  17273. var _messageConfig$initia = messageConfig.initialMessages,
  17274. initialMessages = _messageConfig$initia === void 0 ? {} : _messageConfig$initia;
  17275. return (messages || []).map(function (message) {
  17276. return {
  17277. value: initialMessages[message.name] || ''
  17278. };
  17279. });
  17280. },
  17281. getType: function getType(message) {
  17282. if (+message.multiple === 1) {
  17283. return 'textarea';
  17284. }
  17285. if (message.type === 'id_no') {
  17286. return 'text';
  17287. }
  17288. return message.datetime > 0 ? 'datetime' : message.type;
  17289. },
  17290. getMessages: function getMessages() {
  17291. var messages = {};
  17292. this.messageValues.forEach(function (item, index) {
  17293. messages["message_" + index] = item.value;
  17294. });
  17295. return messages;
  17296. },
  17297. getCartMessages: function getCartMessages() {
  17298. var _this = this;
  17299. var messages = {};
  17300. this.messageValues.forEach(function (item, index) {
  17301. var message = _this.messages[index];
  17302. messages[message.name] = item.value;
  17303. });
  17304. return messages;
  17305. },
  17306. getPlaceholder: function getPlaceholder(message) {
  17307. var type = +message.multiple === 1 ? 'textarea' : message.type;
  17308. var map = this.messageConfig.placeholderMap || {};
  17309. return message.placeholder || map[type] || SkuMessages_t("placeholder." + type);
  17310. },
  17311. validateMessages: function validateMessages() {
  17312. var values = this.messageValues;
  17313. for (var i = 0; i < values.length; i++) {
  17314. var value = values[i].value;
  17315. var message = this.messages[i];
  17316. if (value === '') {
  17317. // 必填字段的校验
  17318. if (String(message.required) === '1') {
  17319. var textType = SkuMessages_t(message.type === 'image' ? 'upload' : 'fill');
  17320. return textType + message.name;
  17321. }
  17322. } else {
  17323. if (message.type === 'tel' && !Object(number["b" /* isNumeric */])(value)) {
  17324. return SkuMessages_t('invalid.tel');
  17325. }
  17326. if (message.type === 'mobile' && !/^\d{6,20}$/.test(value)) {
  17327. return SkuMessages_t('invalid.mobile');
  17328. }
  17329. if (message.type === 'email' && !isEmail(value)) {
  17330. return SkuMessages_t('invalid.email');
  17331. }
  17332. if (message.type === 'id_no' && (value.length < 15 || value.length > 18)) {
  17333. return SkuMessages_t('invalid.id_no');
  17334. }
  17335. }
  17336. }
  17337. },
  17338. /**
  17339. * The phone number copied from IOS mobile phone address book
  17340. * will add spaces and invisible Unicode characters
  17341. * which cannot pass the /^\d+$/ verification
  17342. * so keep numbers and dots
  17343. */
  17344. getFormatter: function getFormatter(message) {
  17345. return function formatter(value) {
  17346. if (message.type === 'mobile' || message.type === 'tel') {
  17347. return value.replace(/[^\d.]/g, '');
  17348. }
  17349. return value;
  17350. };
  17351. },
  17352. getExtraDesc: function getExtraDesc(message) {
  17353. var h = this.$createElement;
  17354. var extraDesc = message.extraDesc;
  17355. if (extraDesc) {
  17356. return h("div", {
  17357. "class": SkuMessages_bem('extra-message')
  17358. }, [extraDesc]);
  17359. }
  17360. },
  17361. genMessage: function genMessage(message, index) {
  17362. var _this2 = this;
  17363. var h = this.$createElement;
  17364. if (message.type === 'image') {
  17365. return h(cell, {
  17366. "key": this.goodsId + "-" + index,
  17367. "attrs": {
  17368. "title": message.name,
  17369. "required": String(message.required) === '1',
  17370. "valueClass": SkuMessages_bem('image-cell-value')
  17371. },
  17372. "class": SkuMessages_bem('image-cell')
  17373. }, [h(SkuImgUploader, {
  17374. "attrs": {
  17375. "maxSize": this.messageConfig.uploadMaxSize,
  17376. "uploadImg": this.messageConfig.uploadImg,
  17377. "customUpload": this.messageConfig.customUpload
  17378. },
  17379. "model": {
  17380. value: _this2.messageValues[index].value,
  17381. callback: function callback($$v) {
  17382. _this2.$set(_this2.messageValues[index], "value", $$v);
  17383. }
  17384. }
  17385. }), h("div", {
  17386. "class": SkuMessages_bem('image-cell-label')
  17387. }, [SkuMessages_t('imageLabel')])]);
  17388. } // 时间和日期使用的vant选择器
  17389. var isDateOrTime = ['date', 'time'].indexOf(message.type) > -1;
  17390. if (isDateOrTime) {
  17391. return h(SkuDateTimeField, {
  17392. "attrs": {
  17393. "label": message.name,
  17394. "required": String(message.required) === '1',
  17395. "placeholder": this.getPlaceholder(message),
  17396. "type": this.getType(message)
  17397. },
  17398. "key": this.goodsId + "-" + index,
  17399. "model": {
  17400. value: _this2.messageValues[index].value,
  17401. callback: function callback($$v) {
  17402. _this2.$set(_this2.messageValues[index], "value", $$v);
  17403. }
  17404. }
  17405. });
  17406. }
  17407. return h("div", {
  17408. "class": SkuMessages_bem('cell-block')
  17409. }, [h(es_field, {
  17410. "attrs": {
  17411. "maxlength": "200",
  17412. "center": !message.multiple,
  17413. "label": message.name,
  17414. "required": String(message.required) === '1',
  17415. "placeholder": this.getPlaceholder(message),
  17416. "type": this.getType(message),
  17417. "formatter": this.getFormatter(message),
  17418. "border": false
  17419. },
  17420. "key": this.goodsId + "-" + index,
  17421. "model": {
  17422. value: _this2.messageValues[index].value,
  17423. callback: function callback($$v) {
  17424. _this2.$set(_this2.messageValues[index], "value", $$v);
  17425. }
  17426. }
  17427. }), this.getExtraDesc(message)]);
  17428. }
  17429. },
  17430. render: function render() {
  17431. var h = arguments[0];
  17432. return h("div", {
  17433. "class": SkuMessages_bem()
  17434. }, [this.messages.map(this.genMessage)]);
  17435. }
  17436. }));
  17437. // CONCATENATED MODULE: ./es/sku/components/SkuActions.js
  17438. // Utils
  17439. // Components
  17440. // Types
  17441. var SkuActions_createNamespace = Object(create["a" /* createNamespace */])('sku-actions'),
  17442. SkuActions_createComponent = SkuActions_createNamespace[0],
  17443. SkuActions_bem = SkuActions_createNamespace[1],
  17444. SkuActions_t = SkuActions_createNamespace[2];
  17445. function SkuActions(h, props, slots, ctx) {
  17446. var createEmitter = function createEmitter(name) {
  17447. return function () {
  17448. props.skuEventBus.$emit(name);
  17449. };
  17450. };
  17451. return h("div", helper_default()([{
  17452. "class": SkuActions_bem()
  17453. }, inherit(ctx)]), [props.showAddCartBtn && h(es_button, {
  17454. "attrs": {
  17455. "size": "large",
  17456. "type": "warning",
  17457. "text": props.addCartText || SkuActions_t('addCart')
  17458. },
  17459. "on": {
  17460. "click": createEmitter('sku:addCart')
  17461. }
  17462. }), h(es_button, {
  17463. "attrs": {
  17464. "size": "large",
  17465. "type": "danger",
  17466. "text": props.buyText || SkuActions_t('buy')
  17467. },
  17468. "on": {
  17469. "click": createEmitter('sku:buy')
  17470. }
  17471. })]);
  17472. }
  17473. SkuActions.props = {
  17474. buyText: String,
  17475. addCartText: String,
  17476. skuEventBus: Object,
  17477. showAddCartBtn: Boolean
  17478. };
  17479. /* harmony default export */ var components_SkuActions = (SkuActions_createComponent(SkuActions));
  17480. // CONCATENATED MODULE: ./es/sku/Sku.js
  17481. var Sku_namespace = Object(create["a" /* createNamespace */])('sku');
  17482. var Sku_createComponent = Sku_namespace[0],
  17483. Sku_bem = Sku_namespace[1],
  17484. Sku_t = Sku_namespace[2];
  17485. var Sku_QUOTA_LIMIT = LIMIT_TYPE.QUOTA_LIMIT;
  17486. /* harmony default export */ var Sku = (Sku_createComponent({
  17487. props: {
  17488. sku: Object,
  17489. goods: Object,
  17490. value: Boolean,
  17491. buyText: String,
  17492. goodsId: [Number, String],
  17493. priceTag: String,
  17494. lazyLoad: Boolean,
  17495. hideStock: Boolean,
  17496. properties: Array,
  17497. addCartText: String,
  17498. stepperTitle: String,
  17499. getContainer: [String, Function],
  17500. hideQuotaText: Boolean,
  17501. hideSelectedText: Boolean,
  17502. resetStepperOnHide: Boolean,
  17503. customSkuValidator: Function,
  17504. disableStepperInput: Boolean,
  17505. resetSelectedSkuOnHide: Boolean,
  17506. quota: {
  17507. type: Number,
  17508. default: 0
  17509. },
  17510. quotaUsed: {
  17511. type: Number,
  17512. default: 0
  17513. },
  17514. startSaleNum: {
  17515. type: Number,
  17516. default: 1
  17517. },
  17518. initialSku: {
  17519. type: Object,
  17520. default: function _default() {
  17521. return {};
  17522. }
  17523. },
  17524. stockThreshold: {
  17525. type: Number,
  17526. default: 50
  17527. },
  17528. showSoldoutSku: {
  17529. type: Boolean,
  17530. default: true
  17531. },
  17532. showAddCartBtn: {
  17533. type: Boolean,
  17534. default: true
  17535. },
  17536. disableSoldoutSku: {
  17537. type: Boolean,
  17538. default: true
  17539. },
  17540. customStepperConfig: {
  17541. type: Object,
  17542. default: function _default() {
  17543. return {};
  17544. }
  17545. },
  17546. showHeaderImage: {
  17547. type: Boolean,
  17548. default: true
  17549. },
  17550. previewOnClickImage: {
  17551. type: Boolean,
  17552. default: true
  17553. },
  17554. safeAreaInsetBottom: {
  17555. type: Boolean,
  17556. default: true
  17557. },
  17558. closeOnClickOverlay: {
  17559. type: Boolean,
  17560. default: true
  17561. },
  17562. bodyOffsetTop: {
  17563. type: Number,
  17564. default: 200
  17565. },
  17566. messageConfig: {
  17567. type: Object,
  17568. default: function _default() {
  17569. return {
  17570. initialMessages: {},
  17571. placeholderMap: {},
  17572. uploadImg: function uploadImg() {
  17573. return Promise.resolve();
  17574. },
  17575. uploadMaxSize: 5
  17576. };
  17577. }
  17578. }
  17579. },
  17580. data: function data() {
  17581. return {
  17582. selectedSku: {},
  17583. selectedProp: {},
  17584. selectedNum: 1,
  17585. show: this.value
  17586. };
  17587. },
  17588. watch: {
  17589. show: function show(val) {
  17590. this.$emit('input', val);
  17591. if (!val) {
  17592. this.$emit('sku-close', {
  17593. selectedSkuValues: this.selectedSkuValues,
  17594. selectedNum: this.selectedNum,
  17595. selectedSkuComb: this.selectedSkuComb
  17596. });
  17597. if (this.resetStepperOnHide) {
  17598. this.resetStepper();
  17599. }
  17600. if (this.resetSelectedSkuOnHide) {
  17601. this.resetSelectedSku();
  17602. }
  17603. }
  17604. },
  17605. value: function value(val) {
  17606. this.show = val;
  17607. },
  17608. skuTree: 'resetSelectedSku',
  17609. initialSku: function initialSku() {
  17610. this.resetStepper();
  17611. this.resetSelectedSku();
  17612. }
  17613. },
  17614. computed: {
  17615. skuGroupClass: function skuGroupClass() {
  17616. return ['van-sku-group-container', {
  17617. 'van-sku-group-container--hide-soldout': !this.showSoldoutSku
  17618. }];
  17619. },
  17620. bodyStyle: function bodyStyle() {
  17621. if (this.$isServer) {
  17622. return;
  17623. }
  17624. var maxHeight = window.innerHeight - this.bodyOffsetTop;
  17625. return {
  17626. maxHeight: maxHeight + 'px'
  17627. };
  17628. },
  17629. isSkuCombSelected: function isSkuCombSelected() {
  17630. var _this = this; // SKU 未选完
  17631. if (this.hasSku && !sku_helper_isAllSelected(this.skuTree, this.selectedSku)) {
  17632. return false;
  17633. } // 属性未全选
  17634. return !this.propList.filter(function (i) {
  17635. return i.is_necessary !== false;
  17636. }).some(function (i) {
  17637. return (_this.selectedProp[i.k_id] || []).length === 0;
  17638. });
  17639. },
  17640. isSkuEmpty: function isSkuEmpty() {
  17641. return Object.keys(this.sku).length === 0;
  17642. },
  17643. hasSku: function hasSku() {
  17644. return !this.sku.none_sku;
  17645. },
  17646. hasSkuOrAttr: function hasSkuOrAttr() {
  17647. return this.hasSku || this.propList.length > 0;
  17648. },
  17649. selectedSkuComb: function selectedSkuComb() {
  17650. var skuComb = null;
  17651. if (this.isSkuCombSelected) {
  17652. if (this.hasSku) {
  17653. skuComb = getSkuComb(this.skuList, this.selectedSku);
  17654. } else {
  17655. skuComb = {
  17656. id: this.sku.collection_id,
  17657. price: Math.round(this.sku.price * 100),
  17658. stock_num: this.sku.stock_num
  17659. };
  17660. }
  17661. if (skuComb) {
  17662. skuComb.properties = sku_helper_getSelectedProperties(this.propList, this.selectedProp);
  17663. skuComb.property_price = this.selectedPropValues.reduce(function (acc, cur) {
  17664. return acc + (cur.price || 0);
  17665. }, 0);
  17666. }
  17667. }
  17668. return skuComb;
  17669. },
  17670. selectedSkuValues: function selectedSkuValues() {
  17671. return sku_helper_getSelectedSkuValues(this.skuTree, this.selectedSku);
  17672. },
  17673. selectedPropValues: function selectedPropValues() {
  17674. return sku_helper_getSelectedPropValues(this.propList, this.selectedProp);
  17675. },
  17676. price: function price() {
  17677. if (this.selectedSkuComb) {
  17678. return ((this.selectedSkuComb.price + this.selectedSkuComb.property_price) / 100).toFixed(2);
  17679. } // sku.price是一个格式化好的价格区间
  17680. return this.sku.price;
  17681. },
  17682. originPrice: function originPrice() {
  17683. if (this.selectedSkuComb && this.selectedSkuComb.origin_price) {
  17684. return ((this.selectedSkuComb.origin_price + this.selectedSkuComb.property_price) / 100).toFixed(2);
  17685. }
  17686. return this.sku.origin_price;
  17687. },
  17688. skuTree: function skuTree() {
  17689. return this.sku.tree || [];
  17690. },
  17691. skuList: function skuList() {
  17692. return this.sku.list || [];
  17693. },
  17694. propList: function propList() {
  17695. return this.properties || [];
  17696. },
  17697. imageList: function imageList() {
  17698. var imageList = [this.goods.picture];
  17699. if (this.skuTree.length > 0) {
  17700. this.skuTree.forEach(function (treeItem) {
  17701. if (!treeItem.v) {
  17702. return;
  17703. }
  17704. treeItem.v.forEach(function (vItem) {
  17705. var imgUrl = vItem.previewImgUrl || vItem.imgUrl || vItem.img_url;
  17706. if (imgUrl && imageList.indexOf(imgUrl) === -1) {
  17707. imageList.push(imgUrl);
  17708. }
  17709. });
  17710. });
  17711. }
  17712. return imageList;
  17713. },
  17714. stock: function stock() {
  17715. var stockNum = this.customStepperConfig.stockNum;
  17716. if (stockNum !== undefined) {
  17717. return stockNum;
  17718. }
  17719. if (this.selectedSkuComb) {
  17720. return this.selectedSkuComb.stock_num;
  17721. }
  17722. return this.sku.stock_num;
  17723. },
  17724. stockText: function stockText() {
  17725. var h = this.$createElement;
  17726. var stockFormatter = this.customStepperConfig.stockFormatter;
  17727. if (stockFormatter) {
  17728. return stockFormatter(this.stock);
  17729. }
  17730. return [Sku_t('stock') + " ", h("span", {
  17731. "class": Sku_bem('stock-num', {
  17732. highlight: this.stock < this.stockThreshold
  17733. })
  17734. }, [this.stock]), " " + Sku_t('stockUnit')];
  17735. },
  17736. selectedText: function selectedText() {
  17737. var _this2 = this;
  17738. if (this.selectedSkuComb) {
  17739. var values = this.selectedSkuValues.concat(this.selectedPropValues);
  17740. return Sku_t('selected') + " " + values.map(function (item) {
  17741. return item.name;
  17742. }).join(' ');
  17743. }
  17744. var unselectedSku = this.skuTree.filter(function (item) {
  17745. return _this2.selectedSku[item.k_s] === UNSELECTED_SKU_VALUE_ID;
  17746. }).map(function (item) {
  17747. return item.k;
  17748. });
  17749. var unselectedProp = this.propList.filter(function (item) {
  17750. return (_this2.selectedProp[item.k_id] || []).length < 1;
  17751. }).map(function (item) {
  17752. return item.k;
  17753. });
  17754. return Sku_t('select') + " " + unselectedSku.concat(unselectedProp).join(' ');
  17755. }
  17756. },
  17757. created: function created() {
  17758. var skuEventBus = new external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a();
  17759. this.skuEventBus = skuEventBus;
  17760. skuEventBus.$on('sku:select', this.onSelect);
  17761. skuEventBus.$on('sku:propSelect', this.onPropSelect);
  17762. skuEventBus.$on('sku:numChange', this.onNumChange);
  17763. skuEventBus.$on('sku:previewImage', this.onPreviewImage);
  17764. skuEventBus.$on('sku:overLimit', this.onOverLimit);
  17765. skuEventBus.$on('sku:stepperState', this.onStepperState);
  17766. skuEventBus.$on('sku:addCart', this.onAddCart);
  17767. skuEventBus.$on('sku:buy', this.onBuy);
  17768. this.resetStepper();
  17769. this.resetSelectedSku(); // 组件初始化后的钩子,抛出skuEventBus
  17770. this.$emit('after-sku-create', skuEventBus);
  17771. },
  17772. methods: {
  17773. resetStepper: function resetStepper() {
  17774. var skuStepper = this.$refs.skuStepper;
  17775. var selectedNum = this.initialSku.selectedNum;
  17776. var num = selectedNum != null ? selectedNum : this.startSaleNum; // 用来缓存不合法的情况
  17777. this.stepperError = null;
  17778. if (skuStepper) {
  17779. skuStepper.setCurrentNum(num);
  17780. } else {
  17781. // 当首次加载(skuStepper 为空)时,传入数量如果不合法,可能会存在问题
  17782. this.selectedNum = num;
  17783. }
  17784. },
  17785. // @exposed-api
  17786. resetSelectedSku: function resetSelectedSku() {
  17787. var _this3 = this;
  17788. this.selectedSku = {}; // 重置 selectedSku
  17789. this.skuTree.forEach(function (item) {
  17790. _this3.selectedSku[item.k_s] = UNSELECTED_SKU_VALUE_ID;
  17791. });
  17792. this.skuTree.forEach(function (item) {
  17793. var key = item.k_s; // 规格值只有1个时,优先判断
  17794. var valueId = item.v.length === 1 ? item.v[0].id : _this3.initialSku[key];
  17795. if (valueId && sku_helper_isSkuChoosable(_this3.skuList, _this3.selectedSku, {
  17796. key: key,
  17797. valueId: valueId
  17798. })) {
  17799. _this3.selectedSku[key] = valueId;
  17800. }
  17801. });
  17802. var skuValues = this.selectedSkuValues;
  17803. if (skuValues.length > 0) {
  17804. this.$nextTick(function () {
  17805. _this3.$emit('sku-selected', {
  17806. skuValue: skuValues[skuValues.length - 1],
  17807. selectedSku: _this3.selectedSku,
  17808. selectedSkuComb: _this3.selectedSkuComb
  17809. });
  17810. });
  17811. } // 重置商品属性
  17812. this.selectedProp = {};
  17813. var _this$initialSku$sele = this.initialSku.selectedProp,
  17814. selectedProp = _this$initialSku$sele === void 0 ? {} : _this$initialSku$sele; // 选中外部传入信息
  17815. this.propList.forEach(function (item) {
  17816. if (selectedProp[item.k_id]) {
  17817. _this3.selectedProp[item.k_id] = selectedProp[item.k_id];
  17818. }
  17819. });
  17820. if (Object(utils["d" /* isEmpty */])(this.selectedProp)) {
  17821. this.propList.forEach(function (item) {
  17822. var _item$v; // 没有加价的属性,默认选中第一个
  17823. if ((item == null ? void 0 : (_item$v = item.v) == null ? void 0 : _item$v.length) > 0) {
  17824. var v = item.v,
  17825. k_id = item.k_id;
  17826. var isHasConfigPrice = v.some(function (i) {
  17827. return +i.price !== 0;
  17828. });
  17829. if (!isHasConfigPrice) {
  17830. _this3.selectedProp[k_id] = [v[0].id];
  17831. }
  17832. }
  17833. });
  17834. }
  17835. var propValues = this.selectedPropValues;
  17836. if (propValues.length > 0) {
  17837. this.$emit('sku-prop-selected', {
  17838. propValue: propValues[propValues.length - 1],
  17839. selectedProp: this.selectedProp,
  17840. selectedSkuComb: this.selectedSkuComb
  17841. });
  17842. } // 抛出重置事件
  17843. this.$emit('sku-reset', {
  17844. selectedSku: this.selectedSku,
  17845. selectedProp: this.selectedProp,
  17846. selectedSkuComb: this.selectedSkuComb
  17847. });
  17848. this.centerInitialSku();
  17849. },
  17850. getSkuMessages: function getSkuMessages() {
  17851. return this.$refs.skuMessages ? this.$refs.skuMessages.getMessages() : {};
  17852. },
  17853. getSkuCartMessages: function getSkuCartMessages() {
  17854. return this.$refs.skuMessages ? this.$refs.skuMessages.getCartMessages() : {};
  17855. },
  17856. validateSkuMessages: function validateSkuMessages() {
  17857. return this.$refs.skuMessages ? this.$refs.skuMessages.validateMessages() : '';
  17858. },
  17859. validateSku: function validateSku() {
  17860. if (this.selectedNum === 0) {
  17861. return Sku_t('unavailable');
  17862. }
  17863. if (this.isSkuCombSelected) {
  17864. return this.validateSkuMessages();
  17865. } // 自定义sku校验
  17866. if (this.customSkuValidator) {
  17867. var err = this.customSkuValidator(this);
  17868. if (err) return err;
  17869. }
  17870. return Sku_t('selectSku');
  17871. },
  17872. onSelect: function onSelect(skuValue) {
  17873. var _extends2, _extends3; // 点击已选中的sku时则取消选中
  17874. this.selectedSku = this.selectedSku[skuValue.skuKeyStr] === skuValue.id ? _extends({}, this.selectedSku, (_extends2 = {}, _extends2[skuValue.skuKeyStr] = UNSELECTED_SKU_VALUE_ID, _extends2)) : _extends({}, this.selectedSku, (_extends3 = {}, _extends3[skuValue.skuKeyStr] = skuValue.id, _extends3));
  17875. this.$emit('sku-selected', {
  17876. skuValue: skuValue,
  17877. selectedSku: this.selectedSku,
  17878. selectedSkuComb: this.selectedSkuComb
  17879. });
  17880. },
  17881. onPropSelect: function onPropSelect(propValue) {
  17882. var _extends4;
  17883. var arr = this.selectedProp[propValue.skuKeyStr] || [];
  17884. var pos = arr.indexOf(propValue.id);
  17885. if (pos > -1) {
  17886. arr.splice(pos, 1);
  17887. } else if (propValue.multiple) {
  17888. arr.push(propValue.id);
  17889. } else {
  17890. arr.splice(0, 1, propValue.id);
  17891. }
  17892. this.selectedProp = _extends({}, this.selectedProp, (_extends4 = {}, _extends4[propValue.skuKeyStr] = arr, _extends4));
  17893. this.$emit('sku-prop-selected', {
  17894. propValue: propValue,
  17895. selectedProp: this.selectedProp,
  17896. selectedSkuComb: this.selectedSkuComb
  17897. });
  17898. },
  17899. onNumChange: function onNumChange(num) {
  17900. this.selectedNum = num;
  17901. },
  17902. onPreviewImage: function onPreviewImage(selectedValue) {
  17903. var _this4 = this;
  17904. var imageList = this.imageList;
  17905. var index = 0;
  17906. var indexImage = imageList[0];
  17907. if (selectedValue && selectedValue.imgUrl) {
  17908. this.imageList.some(function (image, pos) {
  17909. if (image === selectedValue.imgUrl) {
  17910. index = pos;
  17911. return true;
  17912. }
  17913. return false;
  17914. });
  17915. indexImage = selectedValue.imgUrl;
  17916. }
  17917. var params = _extends({}, selectedValue, {
  17918. index: index,
  17919. imageList: this.imageList,
  17920. indexImage: indexImage
  17921. });
  17922. this.$emit('open-preview', params);
  17923. if (!this.previewOnClickImage) {
  17924. return;
  17925. }
  17926. image_preview({
  17927. images: this.imageList,
  17928. startPosition: index,
  17929. onClose: function onClose() {
  17930. _this4.$emit('close-preview', params);
  17931. }
  17932. });
  17933. },
  17934. onOverLimit: function onOverLimit(data) {
  17935. var action = data.action,
  17936. limitType = data.limitType,
  17937. quota = data.quota,
  17938. quotaUsed = data.quotaUsed;
  17939. var handleOverLimit = this.customStepperConfig.handleOverLimit;
  17940. if (handleOverLimit) {
  17941. handleOverLimit(data);
  17942. return;
  17943. }
  17944. if (action === 'minus') {
  17945. if (this.startSaleNum > 1) {
  17946. es_toast(Sku_t('minusStartTip', this.startSaleNum));
  17947. } else {
  17948. es_toast(Sku_t('minusTip'));
  17949. }
  17950. } else if (action === 'plus') {
  17951. if (limitType === Sku_QUOTA_LIMIT) {
  17952. if (quotaUsed > 0) {
  17953. es_toast(Sku_t('quotaUsedTip', quota, quotaUsed));
  17954. } else {
  17955. es_toast(Sku_t('quotaTip', quota));
  17956. }
  17957. } else {
  17958. es_toast(Sku_t('soldout'));
  17959. }
  17960. }
  17961. },
  17962. onStepperState: function onStepperState(data) {
  17963. this.stepperError = data.valid ? null : _extends({}, data, {
  17964. action: 'plus'
  17965. });
  17966. },
  17967. onAddCart: function onAddCart() {
  17968. this.onBuyOrAddCart('add-cart');
  17969. },
  17970. onBuy: function onBuy() {
  17971. this.onBuyOrAddCart('buy-clicked');
  17972. },
  17973. onBuyOrAddCart: function onBuyOrAddCart(type) {
  17974. // sku 不符合购买条件
  17975. if (this.stepperError) {
  17976. return this.onOverLimit(this.stepperError);
  17977. }
  17978. var error = this.validateSku();
  17979. if (error) {
  17980. es_toast(error);
  17981. } else {
  17982. this.$emit(type, this.getSkuData());
  17983. }
  17984. },
  17985. // @exposed-api
  17986. getSkuData: function getSkuData() {
  17987. return {
  17988. goodsId: this.goodsId,
  17989. messages: this.getSkuMessages(),
  17990. selectedNum: this.selectedNum,
  17991. cartMessages: this.getSkuCartMessages(),
  17992. selectedSkuComb: this.selectedSkuComb
  17993. };
  17994. },
  17995. // 当 popup 完全打开后执行
  17996. onOpened: function onOpened() {
  17997. this.centerInitialSku();
  17998. },
  17999. centerInitialSku: function centerInitialSku() {
  18000. var _this5 = this;
  18001. (this.$refs.skuRows || []).forEach(function (it) {
  18002. var _ref = it.skuRow || {},
  18003. k_s = _ref.k_s;
  18004. it.centerItem(_this5.initialSku[k_s]);
  18005. });
  18006. }
  18007. },
  18008. render: function render() {
  18009. var _this6 = this;
  18010. var h = arguments[0];
  18011. if (this.isSkuEmpty) {
  18012. return;
  18013. }
  18014. var sku = this.sku,
  18015. skuList = this.skuList,
  18016. goods = this.goods,
  18017. price = this.price,
  18018. lazyLoad = this.lazyLoad,
  18019. originPrice = this.originPrice,
  18020. skuEventBus = this.skuEventBus,
  18021. selectedSku = this.selectedSku,
  18022. selectedProp = this.selectedProp,
  18023. selectedNum = this.selectedNum,
  18024. stepperTitle = this.stepperTitle,
  18025. selectedSkuComb = this.selectedSkuComb,
  18026. showHeaderImage = this.showHeaderImage,
  18027. disableSoldoutSku = this.disableSoldoutSku;
  18028. var slotsProps = {
  18029. price: price,
  18030. originPrice: originPrice,
  18031. selectedNum: selectedNum,
  18032. skuEventBus: skuEventBus,
  18033. selectedSku: selectedSku,
  18034. selectedSkuComb: selectedSkuComb
  18035. };
  18036. var slots = function slots(name) {
  18037. return _this6.slots(name, slotsProps);
  18038. };
  18039. var Header = slots('sku-header') || h(components_SkuHeader, {
  18040. "attrs": {
  18041. "sku": sku,
  18042. "goods": goods,
  18043. "skuEventBus": skuEventBus,
  18044. "selectedSku": selectedSku,
  18045. "showHeaderImage": showHeaderImage
  18046. }
  18047. }, [h("template", {
  18048. "slot": "sku-header-image-extra"
  18049. }, [slots('sku-header-image-extra')]), slots('sku-header-price') || h("div", {
  18050. "class": "van-sku__goods-price"
  18051. }, [h("span", {
  18052. "class": "van-sku__price-symbol"
  18053. }, ["\uFFE5"]), h("span", {
  18054. "class": "van-sku__price-num"
  18055. }, [price]), this.priceTag && h("span", {
  18056. "class": "van-sku__price-tag"
  18057. }, [this.priceTag])]), slots('sku-header-origin-price') || originPrice && h(SkuHeaderItem, [Sku_t('originPrice'), " \uFFE5", originPrice]), !this.hideStock && h(SkuHeaderItem, [h("span", {
  18058. "class": "van-sku__stock"
  18059. }, [this.stockText])]), this.hasSkuOrAttr && !this.hideSelectedText && h(SkuHeaderItem, [this.selectedText]), slots('sku-header-extra')]);
  18060. var Group = slots('sku-group') || this.hasSkuOrAttr && h("div", {
  18061. "class": this.skuGroupClass
  18062. }, [this.skuTree.map(function (skuTreeItem) {
  18063. return h(SkuRow, {
  18064. "attrs": {
  18065. "skuRow": skuTreeItem
  18066. },
  18067. "ref": "skuRows",
  18068. "refInFor": true
  18069. }, [skuTreeItem.v.map(function (skuValue) {
  18070. return h(SkuRowItem, {
  18071. "attrs": {
  18072. "skuList": skuList,
  18073. "lazyLoad": lazyLoad,
  18074. "skuValue": skuValue,
  18075. "skuKeyStr": skuTreeItem.k_s,
  18076. "selectedSku": selectedSku,
  18077. "skuEventBus": skuEventBus,
  18078. "disableSoldoutSku": disableSoldoutSku,
  18079. "largeImageMode": skuTreeItem.largeImageMode
  18080. }
  18081. });
  18082. })]);
  18083. }), this.propList.map(function (skuTreeItem) {
  18084. return h(SkuRow, {
  18085. "attrs": {
  18086. "skuRow": skuTreeItem
  18087. }
  18088. }, [skuTreeItem.v.map(function (skuValue) {
  18089. return h(SkuRowPropItem, {
  18090. "attrs": {
  18091. "skuValue": skuValue,
  18092. "skuKeyStr": skuTreeItem.k_id + '',
  18093. "selectedProp": selectedProp,
  18094. "skuEventBus": skuEventBus,
  18095. "multiple": skuTreeItem.is_multiple
  18096. }
  18097. });
  18098. })]);
  18099. })]);
  18100. var Stepper = slots('sku-stepper') || h(SkuStepper, {
  18101. "ref": "skuStepper",
  18102. "attrs": {
  18103. "stock": this.stock,
  18104. "quota": this.quota,
  18105. "quotaUsed": this.quotaUsed,
  18106. "startSaleNum": this.startSaleNum,
  18107. "skuEventBus": skuEventBus,
  18108. "selectedNum": selectedNum,
  18109. "stepperTitle": stepperTitle,
  18110. "skuStockNum": sku.stock_num,
  18111. "disableStepperInput": this.disableStepperInput,
  18112. "customStepperConfig": this.customStepperConfig,
  18113. "hideQuotaText": this.hideQuotaText
  18114. },
  18115. "on": {
  18116. "change": function change(event) {
  18117. _this6.$emit('stepper-change', event);
  18118. }
  18119. }
  18120. });
  18121. var Messages = slots('sku-messages') || h(SkuMessages, {
  18122. "ref": "skuMessages",
  18123. "attrs": {
  18124. "goodsId": this.goodsId,
  18125. "messageConfig": this.messageConfig,
  18126. "messages": sku.messages
  18127. }
  18128. });
  18129. var Actions = slots('sku-actions') || h(components_SkuActions, {
  18130. "attrs": {
  18131. "buyText": this.buyText,
  18132. "skuEventBus": skuEventBus,
  18133. "addCartText": this.addCartText,
  18134. "showAddCartBtn": this.showAddCartBtn
  18135. }
  18136. });
  18137. return h(popup, {
  18138. "attrs": {
  18139. "round": true,
  18140. "closeable": true,
  18141. "position": "bottom",
  18142. "getContainer": this.getContainer,
  18143. "closeOnClickOverlay": this.closeOnClickOverlay,
  18144. "safeAreaInsetBottom": this.safeAreaInsetBottom
  18145. },
  18146. "class": "van-sku-container",
  18147. "on": {
  18148. "opened": this.onOpened
  18149. },
  18150. "model": {
  18151. value: _this6.show,
  18152. callback: function callback($$v) {
  18153. _this6.show = $$v;
  18154. }
  18155. }
  18156. }, [Header, h("div", {
  18157. "class": "van-sku-body",
  18158. "style": this.bodyStyle
  18159. }, [slots('sku-body-top'), Group, slots('extra-sku-group'), Stepper, Messages]), slots('sku-actions-top'), Actions]);
  18160. }
  18161. }));
  18162. // CONCATENATED MODULE: ./es/sku/index.js
  18163. // Utils
  18164. // Components
  18165. locale["a" /* default */].add(lang);
  18166. Sku.SkuActions = components_SkuActions;
  18167. Sku.SkuHeader = components_SkuHeader;
  18168. Sku.SkuHeaderItem = SkuHeaderItem;
  18169. Sku.SkuMessages = SkuMessages;
  18170. Sku.SkuStepper = SkuStepper;
  18171. Sku.SkuRow = SkuRow;
  18172. Sku.SkuRowItem = SkuRowItem;
  18173. Sku.SkuRowPropItem = SkuRowPropItem;
  18174. Sku.skuHelper = sku_helper;
  18175. Sku.skuConstants = constants;
  18176. /* harmony default export */ var es_sku = (Sku);
  18177. // CONCATENATED MODULE: ./es/slider/index.js
  18178. var slider_createNamespace = Object(create["a" /* createNamespace */])('slider'),
  18179. slider_createComponent = slider_createNamespace[0],
  18180. slider_bem = slider_createNamespace[1];
  18181. var isSameValue = function isSameValue(newValue, oldValue) {
  18182. return JSON.stringify(newValue) === JSON.stringify(oldValue);
  18183. };
  18184. /* harmony default export */ var slider = (slider_createComponent({
  18185. mixins: [TouchMixin, FieldMixin],
  18186. props: {
  18187. disabled: Boolean,
  18188. vertical: Boolean,
  18189. range: Boolean,
  18190. barHeight: [Number, String],
  18191. buttonSize: [Number, String],
  18192. activeColor: String,
  18193. inactiveColor: String,
  18194. min: {
  18195. type: [Number, String],
  18196. default: 0
  18197. },
  18198. max: {
  18199. type: [Number, String],
  18200. default: 100
  18201. },
  18202. step: {
  18203. type: [Number, String],
  18204. default: 1
  18205. },
  18206. value: {
  18207. type: [Number, Array],
  18208. default: 0
  18209. }
  18210. },
  18211. data: function data() {
  18212. return {
  18213. dragStatus: ''
  18214. };
  18215. },
  18216. computed: {
  18217. scope: function scope() {
  18218. return this.max - this.min;
  18219. },
  18220. buttonStyle: function buttonStyle() {
  18221. if (this.buttonSize) {
  18222. var size = Object(unit["a" /* addUnit */])(this.buttonSize);
  18223. return {
  18224. width: size,
  18225. height: size
  18226. };
  18227. }
  18228. }
  18229. },
  18230. created: function created() {
  18231. // format initial value
  18232. this.updateValue(this.value);
  18233. },
  18234. mounted: function mounted() {
  18235. if (this.range) {
  18236. this.bindTouchEvent(this.$refs.wrapper0);
  18237. this.bindTouchEvent(this.$refs.wrapper1);
  18238. } else {
  18239. this.bindTouchEvent(this.$refs.wrapper);
  18240. }
  18241. },
  18242. methods: {
  18243. onTouchStart: function onTouchStart(event) {
  18244. if (this.disabled) {
  18245. return;
  18246. }
  18247. this.touchStart(event);
  18248. this.currentValue = this.value;
  18249. if (this.range) {
  18250. this.startValue = this.value.map(this.format);
  18251. } else {
  18252. this.startValue = this.format(this.value);
  18253. }
  18254. this.dragStatus = 'start';
  18255. },
  18256. onTouchMove: function onTouchMove(event) {
  18257. if (this.disabled) {
  18258. return;
  18259. }
  18260. if (this.dragStatus === 'start') {
  18261. this.$emit('drag-start');
  18262. }
  18263. preventDefault(event, true);
  18264. this.touchMove(event);
  18265. this.dragStatus = 'draging';
  18266. var rect = this.$el.getBoundingClientRect();
  18267. var delta = this.vertical ? this.deltaY : this.deltaX;
  18268. var total = this.vertical ? rect.height : rect.width;
  18269. var diff = delta / total * this.scope;
  18270. if (this.range) {
  18271. this.currentValue[this.index] = this.startValue[this.index] + diff;
  18272. } else {
  18273. this.currentValue = this.startValue + diff;
  18274. }
  18275. this.updateValue(this.currentValue);
  18276. },
  18277. onTouchEnd: function onTouchEnd() {
  18278. if (this.disabled) {
  18279. return;
  18280. }
  18281. if (this.dragStatus === 'draging') {
  18282. this.updateValue(this.currentValue, true);
  18283. this.$emit('drag-end');
  18284. }
  18285. this.dragStatus = '';
  18286. },
  18287. onClick: function onClick(event) {
  18288. event.stopPropagation();
  18289. if (this.disabled) return;
  18290. var rect = this.$el.getBoundingClientRect();
  18291. var delta = this.vertical ? event.clientY - rect.top : event.clientX - rect.left;
  18292. var total = this.vertical ? rect.height : rect.width;
  18293. var value = +this.min + delta / total * this.scope;
  18294. if (this.range) {
  18295. var _this$value = this.value,
  18296. left = _this$value[0],
  18297. right = _this$value[1];
  18298. var middle = (left + right) / 2;
  18299. if (value <= middle) {
  18300. left = value;
  18301. } else {
  18302. right = value;
  18303. }
  18304. value = [left, right];
  18305. }
  18306. this.startValue = this.value;
  18307. this.updateValue(value, true);
  18308. },
  18309. // 处理两个滑块重叠之后的情况
  18310. handleOverlap: function handleOverlap(value) {
  18311. if (value[0] > value[1]) {
  18312. value = deepClone(value);
  18313. return value.reverse();
  18314. }
  18315. return value;
  18316. },
  18317. updateValue: function updateValue(value, end) {
  18318. if (this.range) {
  18319. value = this.handleOverlap(value).map(this.format);
  18320. } else {
  18321. value = this.format(value);
  18322. }
  18323. if (!isSameValue(value, this.value)) {
  18324. this.$emit('input', value);
  18325. }
  18326. if (end && !isSameValue(value, this.startValue)) {
  18327. this.$emit('change', value);
  18328. }
  18329. },
  18330. format: function format(value) {
  18331. var min = +this.min;
  18332. var max = +this.max;
  18333. var step = +this.step;
  18334. value = range(value, min, max);
  18335. var diff = Math.round((value - min) / step) * step;
  18336. return addNumber(min, diff);
  18337. }
  18338. },
  18339. render: function render() {
  18340. var _wrapperStyle,
  18341. _this = this,
  18342. _barStyle;
  18343. var h = arguments[0];
  18344. var vertical = this.vertical;
  18345. var mainAxis = vertical ? 'height' : 'width';
  18346. var crossAxis = vertical ? 'width' : 'height';
  18347. var wrapperStyle = (_wrapperStyle = {
  18348. background: this.inactiveColor
  18349. }, _wrapperStyle[crossAxis] = Object(unit["a" /* addUnit */])(this.barHeight), _wrapperStyle); // 计算选中条的长度百分比
  18350. var calcMainAxis = function calcMainAxis() {
  18351. var value = _this.value,
  18352. min = _this.min,
  18353. range = _this.range,
  18354. scope = _this.scope;
  18355. if (range) {
  18356. return (value[1] - value[0]) * 100 / scope + "%";
  18357. }
  18358. return (value - min) * 100 / scope + "%";
  18359. }; // 计算选中条的开始位置的偏移量
  18360. var calcOffset = function calcOffset() {
  18361. var value = _this.value,
  18362. min = _this.min,
  18363. range = _this.range,
  18364. scope = _this.scope;
  18365. if (range) {
  18366. return (value[0] - min) * 100 / scope + "%";
  18367. }
  18368. return null;
  18369. };
  18370. var barStyle = (_barStyle = {}, _barStyle[mainAxis] = calcMainAxis(), _barStyle.left = this.vertical ? null : calcOffset(), _barStyle.top = this.vertical ? calcOffset() : null, _barStyle.background = this.activeColor, _barStyle);
  18371. if (this.dragStatus) {
  18372. barStyle.transition = 'none';
  18373. }
  18374. var renderButton = function renderButton(i) {
  18375. var map = ['left', 'right'];
  18376. var isNumber = typeof i === 'number';
  18377. var getClassName = function getClassName() {
  18378. if (isNumber) {
  18379. return "button-wrapper-" + map[i];
  18380. }
  18381. return "button-wrapper";
  18382. };
  18383. var getRefName = function getRefName() {
  18384. if (isNumber) {
  18385. return "wrapper" + i;
  18386. }
  18387. return "wrapper";
  18388. };
  18389. return h("div", {
  18390. "ref": getRefName(),
  18391. "attrs": {
  18392. "role": "slider",
  18393. "tabindex": _this.disabled ? -1 : 0,
  18394. "aria-valuemin": _this.min,
  18395. "aria-valuenow": _this.value,
  18396. "aria-valuemax": _this.max,
  18397. "aria-orientation": _this.vertical ? 'vertical' : 'horizontal'
  18398. },
  18399. "class": slider_bem(getClassName()),
  18400. "on": {
  18401. "touchstart": function touchstart() {
  18402. if (isNumber) {
  18403. // 保存当前按钮的索引
  18404. _this.index = i;
  18405. }
  18406. },
  18407. "click": function click(e) {
  18408. return e.stopPropagation();
  18409. }
  18410. }
  18411. }, [_this.slots('button') || h("div", {
  18412. "class": slider_bem('button'),
  18413. "style": _this.buttonStyle
  18414. })]);
  18415. };
  18416. return h("div", {
  18417. "style": wrapperStyle,
  18418. "class": slider_bem({
  18419. disabled: this.disabled,
  18420. vertical: vertical
  18421. }),
  18422. "on": {
  18423. "click": this.onClick
  18424. }
  18425. }, [h("div", {
  18426. "class": slider_bem('bar'),
  18427. "style": barStyle
  18428. }, [this.range ? [renderButton(0), renderButton(1)] : renderButton()])]);
  18429. }
  18430. }));
  18431. // CONCATENATED MODULE: ./es/step/index.js
  18432. var step_createNamespace = Object(create["a" /* createNamespace */])('step'),
  18433. step_createComponent = step_createNamespace[0],
  18434. step_bem = step_createNamespace[1];
  18435. /* harmony default export */ var es_step = (step_createComponent({
  18436. mixins: [ChildrenMixin('vanSteps')],
  18437. computed: {
  18438. status: function status() {
  18439. if (this.index < this.parent.active) {
  18440. return 'finish';
  18441. }
  18442. if (this.index === +this.parent.active) {
  18443. return 'process';
  18444. }
  18445. },
  18446. active: function active() {
  18447. return this.status === 'process';
  18448. },
  18449. lineStyle: function lineStyle() {
  18450. if (this.status === 'finish') {
  18451. return {
  18452. background: this.parent.activeColor
  18453. };
  18454. }
  18455. return {
  18456. background: this.parent.inactiveColor
  18457. };
  18458. },
  18459. titleStyle: function titleStyle() {
  18460. if (this.active) {
  18461. return {
  18462. color: this.parent.activeColor
  18463. };
  18464. }
  18465. if (!this.status) {
  18466. return {
  18467. color: this.parent.inactiveColor
  18468. };
  18469. }
  18470. }
  18471. },
  18472. methods: {
  18473. genCircle: function genCircle() {
  18474. var h = this.$createElement;
  18475. var _this$parent = this.parent,
  18476. activeIcon = _this$parent.activeIcon,
  18477. iconPrefix = _this$parent.iconPrefix,
  18478. activeColor = _this$parent.activeColor,
  18479. finishIcon = _this$parent.finishIcon,
  18480. inactiveIcon = _this$parent.inactiveIcon;
  18481. if (this.active) {
  18482. return this.slots('active-icon') || h(es_icon, {
  18483. "class": step_bem('icon', 'active'),
  18484. "attrs": {
  18485. "name": activeIcon,
  18486. "color": activeColor,
  18487. "classPrefix": iconPrefix
  18488. }
  18489. });
  18490. }
  18491. var finishIconSlot = this.slots('finish-icon');
  18492. if (this.status === 'finish' && (finishIcon || finishIconSlot)) {
  18493. return finishIconSlot || h(es_icon, {
  18494. "class": step_bem('icon', 'finish'),
  18495. "attrs": {
  18496. "name": finishIcon,
  18497. "color": activeColor,
  18498. "classPrefix": iconPrefix
  18499. }
  18500. });
  18501. }
  18502. var inactiveIconSlot = this.slots('inactive-icon');
  18503. if (inactiveIcon || inactiveIconSlot) {
  18504. return inactiveIconSlot || h(es_icon, {
  18505. "class": step_bem('icon'),
  18506. "attrs": {
  18507. "name": inactiveIcon,
  18508. "classPrefix": iconPrefix
  18509. }
  18510. });
  18511. }
  18512. return h("i", {
  18513. "class": step_bem('circle'),
  18514. "style": this.lineStyle
  18515. });
  18516. },
  18517. onClickStep: function onClickStep() {
  18518. this.parent.$emit('click-step', this.index);
  18519. }
  18520. },
  18521. render: function render() {
  18522. var _ref;
  18523. var h = arguments[0];
  18524. var status = this.status,
  18525. active = this.active;
  18526. var direction = this.parent.direction;
  18527. return h("div", {
  18528. "class": [BORDER, step_bem([direction, (_ref = {}, _ref[status] = status, _ref)])]
  18529. }, [h("div", {
  18530. "class": step_bem('title', {
  18531. active: active
  18532. }),
  18533. "style": this.titleStyle,
  18534. "on": {
  18535. "click": this.onClickStep
  18536. }
  18537. }, [this.slots()]), h("div", {
  18538. "class": step_bem('circle-container'),
  18539. "on": {
  18540. "click": this.onClickStep
  18541. }
  18542. }, [this.genCircle()]), h("div", {
  18543. "class": step_bem('line'),
  18544. "style": this.lineStyle
  18545. })]);
  18546. }
  18547. }));
  18548. // CONCATENATED MODULE: ./es/steps/index.js
  18549. var steps_createNamespace = Object(create["a" /* createNamespace */])('steps'),
  18550. steps_createComponent = steps_createNamespace[0],
  18551. steps_bem = steps_createNamespace[1];
  18552. /* harmony default export */ var steps = (steps_createComponent({
  18553. mixins: [ParentMixin('vanSteps')],
  18554. props: {
  18555. iconPrefix: String,
  18556. finishIcon: String,
  18557. activeColor: String,
  18558. inactiveIcon: String,
  18559. inactiveColor: String,
  18560. active: {
  18561. type: [Number, String],
  18562. default: 0
  18563. },
  18564. direction: {
  18565. type: String,
  18566. default: 'horizontal'
  18567. },
  18568. activeIcon: {
  18569. type: String,
  18570. default: 'checked'
  18571. }
  18572. },
  18573. render: function render() {
  18574. var h = arguments[0];
  18575. return h("div", {
  18576. "class": steps_bem([this.direction])
  18577. }, [h("div", {
  18578. "class": steps_bem('items')
  18579. }, [this.slots()])]);
  18580. }
  18581. }));
  18582. // CONCATENATED MODULE: ./es/submit-bar/index.js
  18583. // Utils
  18584. // Components
  18585. // Types
  18586. var submit_bar_createNamespace = Object(create["a" /* createNamespace */])('submit-bar'),
  18587. submit_bar_createComponent = submit_bar_createNamespace[0],
  18588. submit_bar_bem = submit_bar_createNamespace[1],
  18589. submit_bar_t = submit_bar_createNamespace[2];
  18590. function SubmitBar(h, props, slots, ctx) {
  18591. var tip = props.tip,
  18592. price = props.price,
  18593. tipIcon = props.tipIcon;
  18594. function Text() {
  18595. if (typeof price === 'number') {
  18596. var priceArr = (price / 100).toFixed(props.decimalLength).split('.');
  18597. var decimalStr = props.decimalLength ? "." + priceArr[1] : '';
  18598. return h("div", {
  18599. "style": {
  18600. textAlign: props.textAlign ? props.textAlign : ''
  18601. },
  18602. "class": submit_bar_bem('text')
  18603. }, [h("span", [props.label || submit_bar_t('label')]), h("span", {
  18604. "class": submit_bar_bem('price')
  18605. }, [props.currency, h("span", {
  18606. "class": submit_bar_bem('price', 'integer')
  18607. }, [priceArr[0]]), decimalStr]), props.suffixLabel && h("span", {
  18608. "class": submit_bar_bem('suffix-label')
  18609. }, [props.suffixLabel])]);
  18610. }
  18611. }
  18612. function Tip() {
  18613. if (slots.tip || tip) {
  18614. return h("div", {
  18615. "class": submit_bar_bem('tip')
  18616. }, [tipIcon && h(es_icon, {
  18617. "class": submit_bar_bem('tip-icon'),
  18618. "attrs": {
  18619. "name": tipIcon
  18620. }
  18621. }), tip && h("span", {
  18622. "class": submit_bar_bem('tip-text')
  18623. }, [tip]), slots.tip && slots.tip()]);
  18624. }
  18625. }
  18626. return h("div", helper_default()([{
  18627. "class": submit_bar_bem({
  18628. unfit: !props.safeAreaInsetBottom
  18629. })
  18630. }, inherit(ctx)]), [slots.top && slots.top(), Tip(), h("div", {
  18631. "class": submit_bar_bem('bar')
  18632. }, [slots.default && slots.default(), Text(), slots.button ? slots.button() : h(es_button, {
  18633. "attrs": {
  18634. "round": true,
  18635. "type": props.buttonType,
  18636. "text": props.loading ? '' : props.buttonText,
  18637. "color": props.buttonColor,
  18638. "loading": props.loading,
  18639. "disabled": props.disabled
  18640. },
  18641. "class": submit_bar_bem('button', props.buttonType),
  18642. "on": {
  18643. "click": function click() {
  18644. functional_emit(ctx, 'submit');
  18645. }
  18646. }
  18647. })])]);
  18648. }
  18649. SubmitBar.props = {
  18650. tip: String,
  18651. label: String,
  18652. price: Number,
  18653. tipIcon: String,
  18654. loading: Boolean,
  18655. disabled: Boolean,
  18656. textAlign: String,
  18657. buttonText: String,
  18658. buttonColor: String,
  18659. suffixLabel: String,
  18660. safeAreaInsetBottom: {
  18661. type: Boolean,
  18662. default: true
  18663. },
  18664. decimalLength: {
  18665. type: [Number, String],
  18666. default: 2
  18667. },
  18668. currency: {
  18669. type: String,
  18670. default: '¥'
  18671. },
  18672. buttonType: {
  18673. type: String,
  18674. default: 'danger'
  18675. }
  18676. };
  18677. /* harmony default export */ var submit_bar = (submit_bar_createComponent(SubmitBar));
  18678. // CONCATENATED MODULE: ./es/swipe-cell/index.js
  18679. // Utils
  18680. // Mixins
  18681. var swipe_cell_createNamespace = Object(create["a" /* createNamespace */])('swipe-cell'),
  18682. swipe_cell_createComponent = swipe_cell_createNamespace[0],
  18683. swipe_cell_bem = swipe_cell_createNamespace[1];
  18684. var THRESHOLD = 0.15;
  18685. /* harmony default export */ var swipe_cell = (swipe_cell_createComponent({
  18686. mixins: [TouchMixin, click_outside_ClickOutsideMixin({
  18687. event: 'touchstart',
  18688. method: 'onClick'
  18689. })],
  18690. props: {
  18691. // @deprecated
  18692. // should be removed in next major version, use beforeClose instead
  18693. onClose: Function,
  18694. disabled: Boolean,
  18695. leftWidth: [Number, String],
  18696. rightWidth: [Number, String],
  18697. beforeClose: Function,
  18698. stopPropagation: Boolean,
  18699. name: {
  18700. type: [Number, String],
  18701. default: ''
  18702. }
  18703. },
  18704. data: function data() {
  18705. return {
  18706. offset: 0,
  18707. dragging: false
  18708. };
  18709. },
  18710. computed: {
  18711. computedLeftWidth: function computedLeftWidth() {
  18712. return +this.leftWidth || this.getWidthByRef('left');
  18713. },
  18714. computedRightWidth: function computedRightWidth() {
  18715. return +this.rightWidth || this.getWidthByRef('right');
  18716. }
  18717. },
  18718. mounted: function mounted() {
  18719. this.bindTouchEvent(this.$el);
  18720. },
  18721. methods: {
  18722. getWidthByRef: function getWidthByRef(ref) {
  18723. if (this.$refs[ref]) {
  18724. var rect = this.$refs[ref].getBoundingClientRect();
  18725. return rect.width;
  18726. }
  18727. return 0;
  18728. },
  18729. // @exposed-api
  18730. open: function open(position) {
  18731. var offset = position === 'left' ? this.computedLeftWidth : -this.computedRightWidth;
  18732. this.opened = true;
  18733. this.offset = offset;
  18734. this.$emit('open', {
  18735. position: position,
  18736. name: this.name,
  18737. // @deprecated
  18738. // should be removed in next major version
  18739. detail: this.name
  18740. });
  18741. },
  18742. // @exposed-api
  18743. close: function close(position) {
  18744. this.offset = 0;
  18745. if (this.opened) {
  18746. this.opened = false;
  18747. this.$emit('close', {
  18748. position: position,
  18749. name: this.name
  18750. });
  18751. }
  18752. },
  18753. onTouchStart: function onTouchStart(event) {
  18754. if (this.disabled) {
  18755. return;
  18756. }
  18757. this.startOffset = this.offset;
  18758. this.touchStart(event);
  18759. },
  18760. onTouchMove: function onTouchMove(event) {
  18761. if (this.disabled) {
  18762. return;
  18763. }
  18764. this.touchMove(event);
  18765. if (this.direction === 'horizontal') {
  18766. this.dragging = true;
  18767. this.lockClick = true;
  18768. var isPrevent = !this.opened || this.deltaX * this.startOffset < 0;
  18769. if (isPrevent) {
  18770. preventDefault(event, this.stopPropagation);
  18771. }
  18772. this.offset = range(this.deltaX + this.startOffset, -this.computedRightWidth, this.computedLeftWidth);
  18773. }
  18774. },
  18775. onTouchEnd: function onTouchEnd() {
  18776. var _this = this;
  18777. if (this.disabled) {
  18778. return;
  18779. }
  18780. if (this.dragging) {
  18781. this.toggle(this.offset > 0 ? 'left' : 'right');
  18782. this.dragging = false; // compatible with desktop scenario
  18783. setTimeout(function () {
  18784. _this.lockClick = false;
  18785. }, 0);
  18786. }
  18787. },
  18788. toggle: function toggle(direction) {
  18789. var offset = Math.abs(this.offset);
  18790. var threshold = this.opened ? 1 - THRESHOLD : THRESHOLD;
  18791. var computedLeftWidth = this.computedLeftWidth,
  18792. computedRightWidth = this.computedRightWidth;
  18793. if (computedRightWidth && direction === 'right' && offset > computedRightWidth * threshold) {
  18794. this.open('right');
  18795. } else if (computedLeftWidth && direction === 'left' && offset > computedLeftWidth * threshold) {
  18796. this.open('left');
  18797. } else {
  18798. this.close();
  18799. }
  18800. },
  18801. onClick: function onClick(position) {
  18802. if (position === void 0) {
  18803. position = 'outside';
  18804. }
  18805. this.$emit('click', position);
  18806. if (this.opened && !this.lockClick) {
  18807. if (this.beforeClose) {
  18808. this.beforeClose({
  18809. position: position,
  18810. name: this.name,
  18811. instance: this
  18812. });
  18813. } else if (this.onClose) {
  18814. this.onClose(position, this, {
  18815. name: this.name
  18816. });
  18817. } else {
  18818. this.close(position);
  18819. }
  18820. }
  18821. },
  18822. getClickHandler: function getClickHandler(position, stop) {
  18823. var _this2 = this;
  18824. return function (event) {
  18825. if (stop) {
  18826. event.stopPropagation();
  18827. }
  18828. _this2.onClick(position);
  18829. };
  18830. },
  18831. genLeftPart: function genLeftPart() {
  18832. var h = this.$createElement;
  18833. var content = this.slots('left');
  18834. if (content) {
  18835. return h("div", {
  18836. "ref": "left",
  18837. "class": swipe_cell_bem('left'),
  18838. "on": {
  18839. "click": this.getClickHandler('left', true)
  18840. }
  18841. }, [content]);
  18842. }
  18843. },
  18844. genRightPart: function genRightPart() {
  18845. var h = this.$createElement;
  18846. var content = this.slots('right');
  18847. if (content) {
  18848. return h("div", {
  18849. "ref": "right",
  18850. "class": swipe_cell_bem('right'),
  18851. "on": {
  18852. "click": this.getClickHandler('right', true)
  18853. }
  18854. }, [content]);
  18855. }
  18856. }
  18857. },
  18858. render: function render() {
  18859. var h = arguments[0];
  18860. var wrapperStyle = {
  18861. transform: "translate3d(" + this.offset + "px, 0, 0)",
  18862. transitionDuration: this.dragging ? '0s' : '.6s'
  18863. };
  18864. return h("div", {
  18865. "class": swipe_cell_bem(),
  18866. "on": {
  18867. "click": this.getClickHandler('cell')
  18868. }
  18869. }, [h("div", {
  18870. "class": swipe_cell_bem('wrapper'),
  18871. "style": wrapperStyle
  18872. }, [this.genLeftPart(), this.slots(), this.genRightPart()])]);
  18873. }
  18874. }));
  18875. // CONCATENATED MODULE: ./es/switch-cell/index.js
  18876. // Utils
  18877. // Components
  18878. // Types
  18879. var switch_cell_createNamespace = Object(create["a" /* createNamespace */])('switch-cell'),
  18880. switch_cell_createComponent = switch_cell_createNamespace[0],
  18881. switch_cell_bem = switch_cell_createNamespace[1];
  18882. function SwitchCell(h, props, slots, ctx) {
  18883. if (false) {}
  18884. return h(cell, helper_default()([{
  18885. "attrs": {
  18886. "center": true,
  18887. "size": props.cellSize,
  18888. "title": props.title,
  18889. "border": props.border
  18890. },
  18891. "class": switch_cell_bem([props.cellSize])
  18892. }, inherit(ctx)]), [h(es_switch, {
  18893. "props": _extends({}, props),
  18894. "on": _extends({}, ctx.listeners)
  18895. })]);
  18896. }
  18897. SwitchCell.props = _extends({}, switchProps, {
  18898. title: String,
  18899. cellSize: String,
  18900. border: {
  18901. type: Boolean,
  18902. default: true
  18903. },
  18904. size: {
  18905. type: String,
  18906. default: '24px'
  18907. }
  18908. });
  18909. /* harmony default export */ var switch_cell = (switch_cell_createComponent(SwitchCell));
  18910. // CONCATENATED MODULE: ./es/tabbar/index.js
  18911. var tabbar_createNamespace = Object(create["a" /* createNamespace */])('tabbar'),
  18912. tabbar_createComponent = tabbar_createNamespace[0],
  18913. tabbar_bem = tabbar_createNamespace[1];
  18914. /* harmony default export */ var tabbar = (tabbar_createComponent({
  18915. mixins: [ParentMixin('vanTabbar')],
  18916. props: {
  18917. route: Boolean,
  18918. zIndex: [Number, String],
  18919. placeholder: Boolean,
  18920. activeColor: String,
  18921. beforeChange: Function,
  18922. inactiveColor: String,
  18923. value: {
  18924. type: [Number, String],
  18925. default: 0
  18926. },
  18927. border: {
  18928. type: Boolean,
  18929. default: true
  18930. },
  18931. fixed: {
  18932. type: Boolean,
  18933. default: true
  18934. },
  18935. safeAreaInsetBottom: {
  18936. type: Boolean,
  18937. default: null
  18938. }
  18939. },
  18940. data: function data() {
  18941. return {
  18942. height: null
  18943. };
  18944. },
  18945. computed: {
  18946. fit: function fit() {
  18947. if (this.safeAreaInsetBottom !== null) {
  18948. return this.safeAreaInsetBottom;
  18949. } // enable safe-area-inset-bottom by default when fixed
  18950. return this.fixed;
  18951. }
  18952. },
  18953. watch: {
  18954. value: 'setActiveItem',
  18955. children: 'setActiveItem'
  18956. },
  18957. mounted: function mounted() {
  18958. if (this.placeholder && this.fixed) {
  18959. this.height = this.$refs.tabbar.getBoundingClientRect().height;
  18960. }
  18961. },
  18962. methods: {
  18963. setActiveItem: function setActiveItem() {
  18964. var _this = this;
  18965. this.children.forEach(function (item, index) {
  18966. item.active = (item.name || index) === _this.value;
  18967. });
  18968. },
  18969. onChange: function onChange(active) {
  18970. var _this2 = this;
  18971. if (active !== this.value) {
  18972. callInterceptor({
  18973. interceptor: this.beforeChange,
  18974. args: [active],
  18975. done: function done() {
  18976. _this2.$emit('input', active);
  18977. _this2.$emit('change', active);
  18978. }
  18979. });
  18980. }
  18981. },
  18982. genTabbar: function genTabbar() {
  18983. var _ref;
  18984. var h = this.$createElement;
  18985. return h("div", {
  18986. "ref": "tabbar",
  18987. "style": {
  18988. zIndex: this.zIndex
  18989. },
  18990. "class": [(_ref = {}, _ref[BORDER_TOP_BOTTOM] = this.border, _ref), tabbar_bem({
  18991. unfit: !this.fit,
  18992. fixed: this.fixed
  18993. })]
  18994. }, [this.slots()]);
  18995. }
  18996. },
  18997. render: function render() {
  18998. var h = arguments[0];
  18999. if (this.placeholder && this.fixed) {
  19000. return h("div", {
  19001. "class": tabbar_bem('placeholder'),
  19002. "style": {
  19003. height: this.height + "px"
  19004. }
  19005. }, [this.genTabbar()]);
  19006. }
  19007. return this.genTabbar();
  19008. }
  19009. }));
  19010. // CONCATENATED MODULE: ./es/tabbar-item/index.js
  19011. // Utils
  19012. // Mixins
  19013. // Components
  19014. var tabbar_item_createNamespace = Object(create["a" /* createNamespace */])('tabbar-item'),
  19015. tabbar_item_createComponent = tabbar_item_createNamespace[0],
  19016. tabbar_item_bem = tabbar_item_createNamespace[1];
  19017. /* harmony default export */ var tabbar_item = (tabbar_item_createComponent({
  19018. mixins: [ChildrenMixin('vanTabbar')],
  19019. props: _extends({}, routeProps, {
  19020. dot: Boolean,
  19021. icon: String,
  19022. name: [Number, String],
  19023. // @deprecated
  19024. info: [Number, String],
  19025. badge: [Number, String],
  19026. iconPrefix: String
  19027. }),
  19028. data: function data() {
  19029. return {
  19030. active: false
  19031. };
  19032. },
  19033. computed: {
  19034. routeActive: function routeActive() {
  19035. var to = this.to,
  19036. $route = this.$route;
  19037. if (to && $route) {
  19038. var config = Object(utils["f" /* isObject */])(to) ? to : {
  19039. path: to
  19040. };
  19041. var pathMatched = config.path === $route.path;
  19042. var nameMatched = Object(utils["c" /* isDef */])(config.name) && config.name === $route.name;
  19043. return pathMatched || nameMatched;
  19044. }
  19045. }
  19046. },
  19047. methods: {
  19048. onClick: function onClick(event) {
  19049. this.parent.onChange(this.name || this.index);
  19050. this.$emit('click', event);
  19051. route(this.$router, this);
  19052. },
  19053. genIcon: function genIcon(active) {
  19054. var h = this.$createElement;
  19055. var slot = this.slots('icon', {
  19056. active: active
  19057. });
  19058. if (slot) {
  19059. return slot;
  19060. }
  19061. if (this.icon) {
  19062. return h(es_icon, {
  19063. "attrs": {
  19064. "name": this.icon,
  19065. "classPrefix": this.iconPrefix
  19066. }
  19067. });
  19068. }
  19069. }
  19070. },
  19071. render: function render() {
  19072. var _this$badge;
  19073. var h = arguments[0];
  19074. var active = this.parent.route ? this.routeActive : this.active;
  19075. var color = this.parent[active ? 'activeColor' : 'inactiveColor'];
  19076. if (false) {}
  19077. return h("div", {
  19078. "class": tabbar_item_bem({
  19079. active: active
  19080. }),
  19081. "style": {
  19082. color: color
  19083. },
  19084. "on": {
  19085. "click": this.onClick
  19086. }
  19087. }, [h("div", {
  19088. "class": tabbar_item_bem('icon')
  19089. }, [this.genIcon(active), h(es_info, {
  19090. "attrs": {
  19091. "dot": this.dot,
  19092. "info": (_this$badge = this.badge) != null ? _this$badge : this.info
  19093. }
  19094. })]), h("div", {
  19095. "class": tabbar_item_bem('text')
  19096. }, [this.slots('default', {
  19097. active: active
  19098. })])]);
  19099. }
  19100. }));
  19101. // CONCATENATED MODULE: ./es/tree-select/index.js
  19102. // Utils
  19103. // Components
  19104. // Types
  19105. var tree_select_createNamespace = Object(create["a" /* createNamespace */])('tree-select'),
  19106. tree_select_createComponent = tree_select_createNamespace[0],
  19107. tree_select_bem = tree_select_createNamespace[1];
  19108. function TreeSelect(h, props, slots, ctx) {
  19109. var items = props.items,
  19110. height = props.height,
  19111. activeId = props.activeId,
  19112. selectedIcon = props.selectedIcon,
  19113. mainActiveIndex = props.mainActiveIndex;
  19114. if (false) {}
  19115. var selectedItem = items[+mainActiveIndex] || {};
  19116. var subItems = selectedItem.children || [];
  19117. var isMultiple = Array.isArray(activeId);
  19118. function isActiveItem(id) {
  19119. return isMultiple ? activeId.indexOf(id) !== -1 : activeId === id;
  19120. }
  19121. var Navs = items.map(function (item) {
  19122. var _item$badge;
  19123. return h(sidebar_item, {
  19124. "attrs": {
  19125. "dot": item.dot,
  19126. "info": (_item$badge = item.badge) != null ? _item$badge : item.info,
  19127. "title": item.text,
  19128. "disabled": item.disabled
  19129. },
  19130. "class": [tree_select_bem('nav-item'), item.className]
  19131. });
  19132. });
  19133. function Content() {
  19134. if (slots.content) {
  19135. return slots.content();
  19136. }
  19137. return subItems.map(function (item) {
  19138. return h("div", {
  19139. "key": item.id,
  19140. "class": ['van-ellipsis', tree_select_bem('item', {
  19141. active: isActiveItem(item.id),
  19142. disabled: item.disabled
  19143. })],
  19144. "on": {
  19145. "click": function click() {
  19146. if (!item.disabled) {
  19147. var newActiveId = item.id;
  19148. if (isMultiple) {
  19149. newActiveId = activeId.slice();
  19150. var index = newActiveId.indexOf(item.id);
  19151. if (index !== -1) {
  19152. newActiveId.splice(index, 1);
  19153. } else if (newActiveId.length < props.max) {
  19154. newActiveId.push(item.id);
  19155. }
  19156. }
  19157. functional_emit(ctx, 'update:active-id', newActiveId);
  19158. functional_emit(ctx, 'click-item', item); // compatible with legacy usage, should be removed in next major version
  19159. functional_emit(ctx, 'itemclick', item);
  19160. }
  19161. }
  19162. }
  19163. }, [item.text, isActiveItem(item.id) && h(es_icon, {
  19164. "attrs": {
  19165. "name": selectedIcon
  19166. },
  19167. "class": tree_select_bem('selected')
  19168. })]);
  19169. });
  19170. }
  19171. return h("div", helper_default()([{
  19172. "class": tree_select_bem(),
  19173. "style": {
  19174. height: Object(unit["a" /* addUnit */])(height)
  19175. }
  19176. }, inherit(ctx)]), [h(sidebar, {
  19177. "class": tree_select_bem('nav'),
  19178. "attrs": {
  19179. "activeKey": mainActiveIndex
  19180. },
  19181. "on": {
  19182. "change": function change(index) {
  19183. functional_emit(ctx, 'update:main-active-index', index);
  19184. functional_emit(ctx, 'click-nav', index); // compatible with legacy usage, should be removed in next major version
  19185. functional_emit(ctx, 'navclick', index);
  19186. }
  19187. }
  19188. }, [Navs]), h("div", {
  19189. "class": tree_select_bem('content')
  19190. }, [Content()])]);
  19191. }
  19192. TreeSelect.props = {
  19193. max: {
  19194. type: [Number, String],
  19195. default: Infinity
  19196. },
  19197. items: {
  19198. type: Array,
  19199. default: function _default() {
  19200. return [];
  19201. }
  19202. },
  19203. height: {
  19204. type: [Number, String],
  19205. default: 300
  19206. },
  19207. activeId: {
  19208. type: [Number, String, Array],
  19209. default: 0
  19210. },
  19211. selectedIcon: {
  19212. type: String,
  19213. default: 'success'
  19214. },
  19215. mainActiveIndex: {
  19216. type: [Number, String],
  19217. default: 0
  19218. }
  19219. };
  19220. /* harmony default export */ var tree_select = (tree_select_createComponent(TreeSelect));
  19221. // CONCATENATED MODULE: ./es/index.js
  19222. var version = '2.12.30';
  19223. function install(Vue) {
  19224. var components = [action_sheet, address_edit, address_list, es_area, badge, es_button, calendar, card, cascader, cell, cell_group, es_checkbox, checkbox_group, circle, col, collapse, collapse_item, contact_card, contact_edit, contact_list, count_down, es_coupon, coupon_cell, coupon_list, datetime_picker, dialog, divider, dropdown_item, dropdown_menu, empty, es_field, es_form, goods_action, goods_action_button, goods_action_icon, grid, grid_item, es_icon, es_image, image_preview, index_anchor, index_bar, es_info, es_list, es_loading, locale["a" /* default */], nav_bar, notice_bar, notify, number_keyboard, es_overlay, pagination, panel, password_input, picker, popover, popup, es_progress, pull_refresh, es_radio, radio_group, es_rate, row, search, share_sheet, sidebar, sidebar_item, skeleton, es_sku, slider, es_step, stepper, steps, es_sticky, submit_bar, swipe, swipe_cell, swipe_item, es_switch, switch_cell, tab, tabbar, tabbar_item, tabs, es_tag, es_toast, tree_select, uploader];
  19225. components.forEach(function (item) {
  19226. if (item.install) {
  19227. Vue.use(item);
  19228. } else if (item.name) {
  19229. Vue.component(item.name, item);
  19230. }
  19231. });
  19232. }
  19233. if (typeof window !== 'undefined' && window.Vue) {
  19234. install(window.Vue);
  19235. }
  19236. /* harmony default export */ var es = __webpack_exports__["default"] = ({
  19237. install: install,
  19238. version: version
  19239. });
  19240. /***/ })
  19241. /******/ ]);
  19242. });