date-picker.js 185 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270
  1. module.exports =
  2. /******/ (function(modules) { // webpackBootstrap
  3. /******/ // The module cache
  4. /******/ var installedModules = {};
  5. /******/
  6. /******/ // The require function
  7. /******/ function __webpack_require__(moduleId) {
  8. /******/
  9. /******/ // Check if module is in cache
  10. /******/ if(installedModules[moduleId]) {
  11. /******/ return installedModules[moduleId].exports;
  12. /******/ }
  13. /******/ // Create a new module (and put it into the cache)
  14. /******/ var module = installedModules[moduleId] = {
  15. /******/ i: moduleId,
  16. /******/ l: false,
  17. /******/ exports: {}
  18. /******/ };
  19. /******/
  20. /******/ // Execute the module function
  21. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  22. /******/
  23. /******/ // Flag the module as loaded
  24. /******/ module.l = true;
  25. /******/
  26. /******/ // Return the exports of the module
  27. /******/ return module.exports;
  28. /******/ }
  29. /******/
  30. /******/
  31. /******/ // expose the modules object (__webpack_modules__)
  32. /******/ __webpack_require__.m = modules;
  33. /******/
  34. /******/ // expose the module cache
  35. /******/ __webpack_require__.c = installedModules;
  36. /******/
  37. /******/ // define getter function for harmony exports
  38. /******/ __webpack_require__.d = function(exports, name, getter) {
  39. /******/ if(!__webpack_require__.o(exports, name)) {
  40. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  41. /******/ }
  42. /******/ };
  43. /******/
  44. /******/ // define __esModule on exports
  45. /******/ __webpack_require__.r = function(exports) {
  46. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  47. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  48. /******/ }
  49. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  50. /******/ };
  51. /******/
  52. /******/ // create a fake namespace object
  53. /******/ // mode & 1: value is a module id, require it
  54. /******/ // mode & 2: merge all properties of value into the ns
  55. /******/ // mode & 4: return value when already ns object
  56. /******/ // mode & 8|1: behave like require
  57. /******/ __webpack_require__.t = function(value, mode) {
  58. /******/ if(mode & 1) value = __webpack_require__(value);
  59. /******/ if(mode & 8) return value;
  60. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  61. /******/ var ns = Object.create(null);
  62. /******/ __webpack_require__.r(ns);
  63. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  64. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  65. /******/ return ns;
  66. /******/ };
  67. /******/
  68. /******/ // getDefaultExport function for compatibility with non-harmony modules
  69. /******/ __webpack_require__.n = function(module) {
  70. /******/ var getter = module && module.__esModule ?
  71. /******/ function getDefault() { return module['default']; } :
  72. /******/ function getModuleExports() { return module; };
  73. /******/ __webpack_require__.d(getter, 'a', getter);
  74. /******/ return getter;
  75. /******/ };
  76. /******/
  77. /******/ // Object.prototype.hasOwnProperty.call
  78. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  79. /******/
  80. /******/ // __webpack_public_path__
  81. /******/ __webpack_require__.p = "/dist/";
  82. /******/
  83. /******/
  84. /******/ // Load entry module and return exports
  85. /******/ return __webpack_require__(__webpack_require__.s = 55);
  86. /******/ })
  87. /************************************************************************/
  88. /******/ ([
  89. /* 0 */
  90. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  91. "use strict";
  92. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
  93. /* globals __VUE_SSR_CONTEXT__ */
  94. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  95. // This module is a runtime utility for cleaner component module output and will
  96. // be included in the final webpack user bundle.
  97. function normalizeComponent (
  98. scriptExports,
  99. render,
  100. staticRenderFns,
  101. functionalTemplate,
  102. injectStyles,
  103. scopeId,
  104. moduleIdentifier, /* server only */
  105. shadowMode /* vue-cli only */
  106. ) {
  107. // Vue.extend constructor export interop
  108. var options = typeof scriptExports === 'function'
  109. ? scriptExports.options
  110. : scriptExports
  111. // render functions
  112. if (render) {
  113. options.render = render
  114. options.staticRenderFns = staticRenderFns
  115. options._compiled = true
  116. }
  117. // functional template
  118. if (functionalTemplate) {
  119. options.functional = true
  120. }
  121. // scopedId
  122. if (scopeId) {
  123. options._scopeId = 'data-v-' + scopeId
  124. }
  125. var hook
  126. if (moduleIdentifier) { // server build
  127. hook = function (context) {
  128. // 2.3 injection
  129. context =
  130. context || // cached call
  131. (this.$vnode && this.$vnode.ssrContext) || // stateful
  132. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  133. // 2.2 with runInNewContext: true
  134. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  135. context = __VUE_SSR_CONTEXT__
  136. }
  137. // inject component styles
  138. if (injectStyles) {
  139. injectStyles.call(this, context)
  140. }
  141. // register component module identifier for async chunk inferrence
  142. if (context && context._registeredComponents) {
  143. context._registeredComponents.add(moduleIdentifier)
  144. }
  145. }
  146. // used by ssr in case component is cached and beforeCreate
  147. // never gets called
  148. options._ssrRegister = hook
  149. } else if (injectStyles) {
  150. hook = shadowMode
  151. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  152. : injectStyles
  153. }
  154. if (hook) {
  155. if (options.functional) {
  156. // for template-only hot-reload because in that case the render fn doesn't
  157. // go through the normalizer
  158. options._injectStyles = hook
  159. // register for functioal component in vue file
  160. var originalRender = options.render
  161. options.render = function renderWithStyleInjection (h, context) {
  162. hook.call(context)
  163. return originalRender(h, context)
  164. }
  165. } else {
  166. // inject component registration as beforeCreate hook
  167. var existing = options.beforeCreate
  168. options.beforeCreate = existing
  169. ? [].concat(existing, hook)
  170. : [hook]
  171. }
  172. }
  173. return {
  174. exports: scriptExports,
  175. options: options
  176. }
  177. }
  178. /***/ }),
  179. /* 1 */
  180. /***/ (function(module, exports) {
  181. module.exports = require("element-ui/lib/utils/date-util");
  182. /***/ }),
  183. /* 2 */
  184. /***/ (function(module, exports) {
  185. module.exports = require("element-ui/lib/utils/dom");
  186. /***/ }),
  187. /* 3 */
  188. /***/ (function(module, exports) {
  189. module.exports = require("element-ui/lib/utils/util");
  190. /***/ }),
  191. /* 4 */
  192. /***/ (function(module, exports) {
  193. module.exports = require("element-ui/lib/mixins/emitter");
  194. /***/ }),
  195. /* 5 */
  196. /***/ (function(module, exports) {
  197. module.exports = require("element-ui/lib/utils/vue-popper");
  198. /***/ }),
  199. /* 6 */
  200. /***/ (function(module, exports) {
  201. module.exports = require("element-ui/lib/mixins/locale");
  202. /***/ }),
  203. /* 7 */
  204. /***/ (function(module, exports) {
  205. module.exports = require("vue");
  206. /***/ }),
  207. /* 8 */,
  208. /* 9 */
  209. /***/ (function(module, exports) {
  210. module.exports = require("element-ui/lib/utils/merge");
  211. /***/ }),
  212. /* 10 */
  213. /***/ (function(module, exports) {
  214. module.exports = require("element-ui/lib/input");
  215. /***/ }),
  216. /* 11 */,
  217. /* 12 */
  218. /***/ (function(module, exports) {
  219. module.exports = require("element-ui/lib/utils/clickoutside");
  220. /***/ }),
  221. /* 13 */,
  222. /* 14 */
  223. /***/ (function(module, exports) {
  224. module.exports = require("element-ui/lib/button");
  225. /***/ }),
  226. /* 15 */
  227. /***/ (function(module, exports) {
  228. module.exports = require("element-ui/lib/scrollbar");
  229. /***/ }),
  230. /* 16 */,
  231. /* 17 */,
  232. /* 18 */,
  233. /* 19 */,
  234. /* 20 */,
  235. /* 21 */,
  236. /* 22 */,
  237. /* 23 */,
  238. /* 24 */,
  239. /* 25 */,
  240. /* 26 */,
  241. /* 27 */
  242. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  243. "use strict";
  244. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/panel/time.vue?vue&type=template&id=3d939089&
  245. var render = function() {
  246. var _vm = this
  247. var _h = _vm.$createElement
  248. var _c = _vm._self._c || _h
  249. return _c(
  250. "transition",
  251. {
  252. attrs: { name: "el-zoom-in-top" },
  253. on: {
  254. "after-leave": function($event) {
  255. _vm.$emit("dodestroy")
  256. }
  257. }
  258. },
  259. [
  260. _c(
  261. "div",
  262. {
  263. directives: [
  264. {
  265. name: "show",
  266. rawName: "v-show",
  267. value: _vm.visible,
  268. expression: "visible"
  269. }
  270. ],
  271. staticClass: "el-time-panel el-popper",
  272. class: _vm.popperClass
  273. },
  274. [
  275. _c(
  276. "div",
  277. {
  278. staticClass: "el-time-panel__content",
  279. class: { "has-seconds": _vm.showSeconds }
  280. },
  281. [
  282. _c("time-spinner", {
  283. ref: "spinner",
  284. attrs: {
  285. "arrow-control": _vm.useArrow,
  286. "show-seconds": _vm.showSeconds,
  287. "am-pm-mode": _vm.amPmMode,
  288. date: _vm.date
  289. },
  290. on: {
  291. change: _vm.handleChange,
  292. "select-range": _vm.setSelectionRange
  293. }
  294. })
  295. ],
  296. 1
  297. ),
  298. _c("div", { staticClass: "el-time-panel__footer" }, [
  299. _c(
  300. "button",
  301. {
  302. staticClass: "el-time-panel__btn cancel",
  303. attrs: { type: "button" },
  304. on: { click: _vm.handleCancel }
  305. },
  306. [_vm._v(_vm._s(_vm.t("el.datepicker.cancel")))]
  307. ),
  308. _c(
  309. "button",
  310. {
  311. staticClass: "el-time-panel__btn",
  312. class: { confirm: !_vm.disabled },
  313. attrs: { type: "button" },
  314. on: {
  315. click: function($event) {
  316. _vm.handleConfirm()
  317. }
  318. }
  319. },
  320. [_vm._v(_vm._s(_vm.t("el.datepicker.confirm")))]
  321. )
  322. ])
  323. ]
  324. )
  325. ]
  326. )
  327. }
  328. var staticRenderFns = []
  329. render._withStripped = true
  330. // CONCATENATED MODULE: ./packages/date-picker/src/panel/time.vue?vue&type=template&id=3d939089&
  331. // EXTERNAL MODULE: external "element-ui/lib/utils/date-util"
  332. var date_util_ = __webpack_require__(1);
  333. // EXTERNAL MODULE: external "element-ui/lib/mixins/locale"
  334. var locale_ = __webpack_require__(6);
  335. var locale_default = /*#__PURE__*/__webpack_require__.n(locale_);
  336. // EXTERNAL MODULE: ./packages/date-picker/src/basic/time-spinner.vue + 4 modules
  337. var time_spinner = __webpack_require__(34);
  338. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/panel/time.vue?vue&type=script&lang=js&
  339. //
  340. //
  341. //
  342. //
  343. //
  344. //
  345. //
  346. //
  347. //
  348. //
  349. //
  350. //
  351. //
  352. //
  353. //
  354. //
  355. //
  356. //
  357. //
  358. //
  359. //
  360. //
  361. //
  362. //
  363. //
  364. //
  365. //
  366. //
  367. //
  368. //
  369. //
  370. //
  371. /* harmony default export */ var timevue_type_script_lang_js_ = ({
  372. mixins: [locale_default.a],
  373. components: {
  374. TimeSpinner: time_spinner["a" /* default */]
  375. },
  376. props: {
  377. visible: Boolean,
  378. timeArrowControl: Boolean
  379. },
  380. watch: {
  381. visible: function visible(val) {
  382. var _this = this;
  383. if (val) {
  384. this.oldValue = this.value;
  385. this.$nextTick(function () {
  386. return _this.$refs.spinner.emitSelectRange('hours');
  387. });
  388. } else {
  389. this.needInitAdjust = true;
  390. }
  391. },
  392. value: function value(newVal) {
  393. var _this2 = this;
  394. var date = void 0;
  395. if (newVal instanceof Date) {
  396. date = Object(date_util_["limitTimeRange"])(newVal, this.selectableRange, this.format);
  397. } else if (!newVal) {
  398. date = this.defaultValue ? new Date(this.defaultValue) : new Date();
  399. }
  400. this.date = date;
  401. if (this.visible && this.needInitAdjust) {
  402. this.$nextTick(function (_) {
  403. return _this2.adjustSpinners();
  404. });
  405. this.needInitAdjust = false;
  406. }
  407. },
  408. selectableRange: function selectableRange(val) {
  409. this.$refs.spinner.selectableRange = val;
  410. },
  411. defaultValue: function defaultValue(val) {
  412. if (!Object(date_util_["isDate"])(this.value)) {
  413. this.date = val ? new Date(val) : new Date();
  414. }
  415. }
  416. },
  417. data: function data() {
  418. return {
  419. popperClass: '',
  420. format: 'HH:mm:ss',
  421. value: '',
  422. defaultValue: null,
  423. date: new Date(),
  424. oldValue: new Date(),
  425. selectableRange: [],
  426. selectionRange: [0, 2],
  427. disabled: false,
  428. arrowControl: false,
  429. needInitAdjust: true
  430. };
  431. },
  432. computed: {
  433. showSeconds: function showSeconds() {
  434. return (this.format || '').indexOf('ss') !== -1;
  435. },
  436. useArrow: function useArrow() {
  437. return this.arrowControl || this.timeArrowControl || false;
  438. },
  439. amPmMode: function amPmMode() {
  440. if ((this.format || '').indexOf('A') !== -1) return 'A';
  441. if ((this.format || '').indexOf('a') !== -1) return 'a';
  442. return '';
  443. }
  444. },
  445. methods: {
  446. handleCancel: function handleCancel() {
  447. this.$emit('pick', this.oldValue, false);
  448. },
  449. handleChange: function handleChange(date) {
  450. // this.visible avoids edge cases, when use scrolls during panel closing animation
  451. if (this.visible) {
  452. this.date = Object(date_util_["clearMilliseconds"])(date);
  453. // if date is out of range, do not emit
  454. if (this.isValidValue(this.date)) {
  455. this.$emit('pick', this.date, true);
  456. }
  457. }
  458. },
  459. setSelectionRange: function setSelectionRange(start, end) {
  460. this.$emit('select-range', start, end);
  461. this.selectionRange = [start, end];
  462. },
  463. handleConfirm: function handleConfirm() {
  464. var visible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  465. var first = arguments[1];
  466. if (first) return;
  467. var date = Object(date_util_["clearMilliseconds"])(Object(date_util_["limitTimeRange"])(this.date, this.selectableRange, this.format));
  468. this.$emit('pick', date, visible, first);
  469. },
  470. handleKeydown: function handleKeydown(event) {
  471. var keyCode = event.keyCode;
  472. var mapping = { 38: -1, 40: 1, 37: -1, 39: 1 };
  473. // Left or Right
  474. if (keyCode === 37 || keyCode === 39) {
  475. var step = mapping[keyCode];
  476. this.changeSelectionRange(step);
  477. event.preventDefault();
  478. return;
  479. }
  480. // Up or Down
  481. if (keyCode === 38 || keyCode === 40) {
  482. var _step = mapping[keyCode];
  483. this.$refs.spinner.scrollDown(_step);
  484. event.preventDefault();
  485. return;
  486. }
  487. },
  488. isValidValue: function isValidValue(date) {
  489. return Object(date_util_["timeWithinRange"])(date, this.selectableRange, this.format);
  490. },
  491. adjustSpinners: function adjustSpinners() {
  492. return this.$refs.spinner.adjustSpinners();
  493. },
  494. changeSelectionRange: function changeSelectionRange(step) {
  495. var list = [0, 3].concat(this.showSeconds ? [6] : []);
  496. var mapping = ['hours', 'minutes'].concat(this.showSeconds ? ['seconds'] : []);
  497. var index = list.indexOf(this.selectionRange[0]);
  498. var next = (index + step + list.length) % list.length;
  499. this.$refs.spinner.emitSelectRange(mapping[next]);
  500. }
  501. },
  502. mounted: function mounted() {
  503. var _this3 = this;
  504. this.$nextTick(function () {
  505. return _this3.handleConfirm(true, true);
  506. });
  507. this.$emit('mounted');
  508. }
  509. });
  510. // CONCATENATED MODULE: ./packages/date-picker/src/panel/time.vue?vue&type=script&lang=js&
  511. /* harmony default export */ var panel_timevue_type_script_lang_js_ = (timevue_type_script_lang_js_);
  512. // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
  513. var componentNormalizer = __webpack_require__(0);
  514. // CONCATENATED MODULE: ./packages/date-picker/src/panel/time.vue
  515. /* normalize component */
  516. var component = Object(componentNormalizer["a" /* default */])(
  517. panel_timevue_type_script_lang_js_,
  518. render,
  519. staticRenderFns,
  520. false,
  521. null,
  522. null,
  523. null
  524. )
  525. /* hot reload */
  526. if (false) { var api; }
  527. component.options.__file = "packages/date-picker/src/panel/time.vue"
  528. /* harmony default export */ var time = __webpack_exports__["a"] = (component.exports);
  529. /***/ }),
  530. /* 28 */,
  531. /* 29 */,
  532. /* 30 */
  533. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  534. "use strict";
  535. /* harmony import */ var element_ui_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
  536. /* harmony import */ var element_ui_src_utils_dom__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(element_ui_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__);
  537. /* harmony default export */ __webpack_exports__["a"] = ({
  538. bind: function bind(el, binding, vnode) {
  539. var interval = null;
  540. var startTime = void 0;
  541. var handler = function handler() {
  542. return vnode.context[binding.expression].apply();
  543. };
  544. var clear = function clear() {
  545. if (Date.now() - startTime < 100) {
  546. handler();
  547. }
  548. clearInterval(interval);
  549. interval = null;
  550. };
  551. Object(element_ui_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__["on"])(el, 'mousedown', function (e) {
  552. if (e.button !== 0) return;
  553. startTime = Date.now();
  554. Object(element_ui_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__["once"])(document, 'mouseup', clear);
  555. clearInterval(interval);
  556. interval = setInterval(handler, 100);
  557. });
  558. }
  559. });
  560. /***/ }),
  561. /* 31 */,
  562. /* 32 */
  563. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  564. "use strict";
  565. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/picker.vue?vue&type=template&id=79ae069f&
  566. var render = function() {
  567. var _vm = this
  568. var _h = _vm.$createElement
  569. var _c = _vm._self._c || _h
  570. return !_vm.ranged
  571. ? _c(
  572. "el-input",
  573. _vm._b(
  574. {
  575. directives: [
  576. {
  577. name: "clickoutside",
  578. rawName: "v-clickoutside",
  579. value: _vm.handleClose,
  580. expression: "handleClose"
  581. }
  582. ],
  583. ref: "reference",
  584. staticClass: "el-date-editor",
  585. class: "el-date-editor--" + _vm.type,
  586. attrs: {
  587. readonly:
  588. !_vm.editable ||
  589. _vm.readonly ||
  590. _vm.type === "dates" ||
  591. _vm.type === "week",
  592. disabled: _vm.pickerDisabled,
  593. size: _vm.pickerSize,
  594. name: _vm.name,
  595. placeholder: _vm.placeholder,
  596. value: _vm.displayValue,
  597. validateEvent: false
  598. },
  599. on: {
  600. focus: _vm.handleFocus,
  601. input: function(value) {
  602. return (_vm.userInput = value)
  603. },
  604. change: _vm.handleChange
  605. },
  606. nativeOn: {
  607. keydown: function($event) {
  608. return _vm.handleKeydown($event)
  609. },
  610. mouseenter: function($event) {
  611. return _vm.handleMouseEnter($event)
  612. },
  613. mouseleave: function($event) {
  614. _vm.showClose = false
  615. }
  616. }
  617. },
  618. "el-input",
  619. _vm.firstInputId,
  620. false
  621. ),
  622. [
  623. _c("i", {
  624. staticClass: "el-input__icon",
  625. class: _vm.triggerClass,
  626. attrs: { slot: "prefix" },
  627. on: { click: _vm.handleFocus },
  628. slot: "prefix"
  629. }),
  630. _vm.haveTrigger
  631. ? _c("i", {
  632. staticClass: "el-input__icon",
  633. class: [_vm.showClose ? "" + _vm.clearIcon : ""],
  634. attrs: { slot: "suffix" },
  635. on: { click: _vm.handleClickIcon },
  636. slot: "suffix"
  637. })
  638. : _vm._e()
  639. ]
  640. )
  641. : _c(
  642. "div",
  643. {
  644. directives: [
  645. {
  646. name: "clickoutside",
  647. rawName: "v-clickoutside",
  648. value: _vm.handleClose,
  649. expression: "handleClose"
  650. }
  651. ],
  652. ref: "reference",
  653. staticClass: "el-date-editor el-range-editor el-input__inner",
  654. class: [
  655. "el-date-editor--" + _vm.type,
  656. _vm.pickerSize ? "el-range-editor--" + _vm.pickerSize : "",
  657. _vm.pickerDisabled ? "is-disabled" : "",
  658. _vm.pickerVisible ? "is-active" : ""
  659. ],
  660. on: {
  661. click: _vm.handleRangeClick,
  662. mouseenter: _vm.handleMouseEnter,
  663. mouseleave: function($event) {
  664. _vm.showClose = false
  665. },
  666. keydown: _vm.handleKeydown
  667. }
  668. },
  669. [
  670. _c("i", {
  671. class: ["el-input__icon", "el-range__icon", _vm.triggerClass]
  672. }),
  673. _c(
  674. "input",
  675. _vm._b(
  676. {
  677. staticClass: "el-range-input",
  678. attrs: {
  679. autocomplete: "off",
  680. placeholder: _vm.startPlaceholder,
  681. disabled: _vm.pickerDisabled,
  682. readonly: !_vm.editable || _vm.readonly,
  683. name: _vm.name && _vm.name[0]
  684. },
  685. domProps: { value: _vm.displayValue && _vm.displayValue[0] },
  686. on: {
  687. input: _vm.handleStartInput,
  688. change: _vm.handleStartChange,
  689. focus: _vm.handleFocus
  690. }
  691. },
  692. "input",
  693. _vm.firstInputId,
  694. false
  695. )
  696. ),
  697. _vm._t("range-separator", [
  698. _c("span", { staticClass: "el-range-separator" }, [
  699. _vm._v(_vm._s(_vm.rangeSeparator))
  700. ])
  701. ]),
  702. _c(
  703. "input",
  704. _vm._b(
  705. {
  706. staticClass: "el-range-input",
  707. attrs: {
  708. autocomplete: "off",
  709. placeholder: _vm.endPlaceholder,
  710. disabled: _vm.pickerDisabled,
  711. readonly: !_vm.editable || _vm.readonly,
  712. name: _vm.name && _vm.name[1]
  713. },
  714. domProps: { value: _vm.displayValue && _vm.displayValue[1] },
  715. on: {
  716. input: _vm.handleEndInput,
  717. change: _vm.handleEndChange,
  718. focus: _vm.handleFocus
  719. }
  720. },
  721. "input",
  722. _vm.secondInputId,
  723. false
  724. )
  725. ),
  726. _vm.haveTrigger
  727. ? _c("i", {
  728. staticClass: "el-input__icon el-range__close-icon",
  729. class: [_vm.showClose ? "" + _vm.clearIcon : ""],
  730. on: { click: _vm.handleClickIcon }
  731. })
  732. : _vm._e()
  733. ],
  734. 2
  735. )
  736. }
  737. var staticRenderFns = []
  738. render._withStripped = true
  739. // CONCATENATED MODULE: ./packages/date-picker/src/picker.vue?vue&type=template&id=79ae069f&
  740. // EXTERNAL MODULE: external "vue"
  741. var external_vue_ = __webpack_require__(7);
  742. var external_vue_default = /*#__PURE__*/__webpack_require__.n(external_vue_);
  743. // EXTERNAL MODULE: external "element-ui/lib/utils/clickoutside"
  744. var clickoutside_ = __webpack_require__(12);
  745. var clickoutside_default = /*#__PURE__*/__webpack_require__.n(clickoutside_);
  746. // EXTERNAL MODULE: external "element-ui/lib/utils/date-util"
  747. var date_util_ = __webpack_require__(1);
  748. // EXTERNAL MODULE: external "element-ui/lib/utils/vue-popper"
  749. var vue_popper_ = __webpack_require__(5);
  750. var vue_popper_default = /*#__PURE__*/__webpack_require__.n(vue_popper_);
  751. // EXTERNAL MODULE: external "element-ui/lib/mixins/emitter"
  752. var emitter_ = __webpack_require__(4);
  753. var emitter_default = /*#__PURE__*/__webpack_require__.n(emitter_);
  754. // EXTERNAL MODULE: external "element-ui/lib/input"
  755. var input_ = __webpack_require__(10);
  756. var input_default = /*#__PURE__*/__webpack_require__.n(input_);
  757. // EXTERNAL MODULE: external "element-ui/lib/utils/merge"
  758. var merge_ = __webpack_require__(9);
  759. var merge_default = /*#__PURE__*/__webpack_require__.n(merge_);
  760. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/picker.vue?vue&type=script&lang=js&
  761. //
  762. //
  763. //
  764. //
  765. //
  766. //
  767. //
  768. //
  769. //
  770. //
  771. //
  772. //
  773. //
  774. //
  775. //
  776. //
  777. //
  778. //
  779. //
  780. //
  781. //
  782. //
  783. //
  784. //
  785. //
  786. //
  787. //
  788. //
  789. //
  790. //
  791. //
  792. //
  793. //
  794. //
  795. //
  796. //
  797. //
  798. //
  799. //
  800. //
  801. //
  802. //
  803. //
  804. //
  805. //
  806. //
  807. //
  808. //
  809. //
  810. //
  811. //
  812. //
  813. //
  814. //
  815. //
  816. //
  817. //
  818. //
  819. //
  820. //
  821. //
  822. //
  823. //
  824. //
  825. //
  826. //
  827. //
  828. //
  829. //
  830. //
  831. //
  832. //
  833. //
  834. //
  835. //
  836. //
  837. //
  838. //
  839. //
  840. //
  841. //
  842. //
  843. //
  844. //
  845. //
  846. var NewPopper = {
  847. props: {
  848. appendToBody: vue_popper_default.a.props.appendToBody,
  849. offset: vue_popper_default.a.props.offset,
  850. boundariesPadding: vue_popper_default.a.props.boundariesPadding,
  851. arrowOffset: vue_popper_default.a.props.arrowOffset
  852. },
  853. methods: vue_popper_default.a.methods,
  854. data: function data() {
  855. return merge_default()({ visibleArrow: true }, vue_popper_default.a.data);
  856. },
  857. beforeDestroy: vue_popper_default.a.beforeDestroy
  858. };
  859. var DEFAULT_FORMATS = {
  860. date: 'yyyy-MM-dd',
  861. month: 'yyyy-MM',
  862. datetime: 'yyyy-MM-dd HH:mm:ss',
  863. time: 'HH:mm:ss',
  864. week: 'yyyywWW',
  865. timerange: 'HH:mm:ss',
  866. daterange: 'yyyy-MM-dd',
  867. monthrange: 'yyyy-MM',
  868. datetimerange: 'yyyy-MM-dd HH:mm:ss',
  869. year: 'yyyy'
  870. };
  871. var HAVE_TRIGGER_TYPES = ['date', 'datetime', 'time', 'time-select', 'week', 'month', 'year', 'daterange', 'monthrange', 'timerange', 'datetimerange', 'dates'];
  872. var pickervue_type_script_lang_js_DATE_FORMATTER = function DATE_FORMATTER(value, format) {
  873. if (format === 'timestamp') return value.getTime();
  874. return Object(date_util_["formatDate"])(value, format);
  875. };
  876. var pickervue_type_script_lang_js_DATE_PARSER = function DATE_PARSER(text, format) {
  877. if (format === 'timestamp') return new Date(Number(text));
  878. return Object(date_util_["parseDate"])(text, format);
  879. };
  880. var RANGE_FORMATTER = function RANGE_FORMATTER(value, format) {
  881. if (Array.isArray(value) && value.length === 2) {
  882. var start = value[0];
  883. var end = value[1];
  884. if (start && end) {
  885. return [pickervue_type_script_lang_js_DATE_FORMATTER(start, format), pickervue_type_script_lang_js_DATE_FORMATTER(end, format)];
  886. }
  887. }
  888. return '';
  889. };
  890. var RANGE_PARSER = function RANGE_PARSER(array, format, separator) {
  891. if (!Array.isArray(array)) {
  892. array = array.split(separator);
  893. }
  894. if (array.length === 2) {
  895. var range1 = array[0];
  896. var range2 = array[1];
  897. return [pickervue_type_script_lang_js_DATE_PARSER(range1, format), pickervue_type_script_lang_js_DATE_PARSER(range2, format)];
  898. }
  899. return [];
  900. };
  901. var TYPE_VALUE_RESOLVER_MAP = {
  902. default: {
  903. formatter: function formatter(value) {
  904. if (!value) return '';
  905. return '' + value;
  906. },
  907. parser: function parser(text) {
  908. if (text === undefined || text === '') return null;
  909. return text;
  910. }
  911. },
  912. week: {
  913. formatter: function formatter(value, format) {
  914. var week = Object(date_util_["getWeekNumber"])(value);
  915. var month = value.getMonth();
  916. var trueDate = new Date(value);
  917. if (week === 1 && month === 11) {
  918. trueDate.setHours(0, 0, 0, 0);
  919. trueDate.setDate(trueDate.getDate() + 3 - (trueDate.getDay() + 6) % 7);
  920. }
  921. var date = Object(date_util_["formatDate"])(trueDate, format);
  922. date = /WW/.test(date) ? date.replace(/WW/, week < 10 ? '0' + week : week) : date.replace(/W/, week);
  923. return date;
  924. },
  925. parser: function parser(text, format) {
  926. // parse as if a normal date
  927. return TYPE_VALUE_RESOLVER_MAP.date.parser(text, format);
  928. }
  929. },
  930. date: {
  931. formatter: pickervue_type_script_lang_js_DATE_FORMATTER,
  932. parser: pickervue_type_script_lang_js_DATE_PARSER
  933. },
  934. datetime: {
  935. formatter: pickervue_type_script_lang_js_DATE_FORMATTER,
  936. parser: pickervue_type_script_lang_js_DATE_PARSER
  937. },
  938. daterange: {
  939. formatter: RANGE_FORMATTER,
  940. parser: RANGE_PARSER
  941. },
  942. monthrange: {
  943. formatter: RANGE_FORMATTER,
  944. parser: RANGE_PARSER
  945. },
  946. datetimerange: {
  947. formatter: RANGE_FORMATTER,
  948. parser: RANGE_PARSER
  949. },
  950. timerange: {
  951. formatter: RANGE_FORMATTER,
  952. parser: RANGE_PARSER
  953. },
  954. time: {
  955. formatter: pickervue_type_script_lang_js_DATE_FORMATTER,
  956. parser: pickervue_type_script_lang_js_DATE_PARSER
  957. },
  958. month: {
  959. formatter: pickervue_type_script_lang_js_DATE_FORMATTER,
  960. parser: pickervue_type_script_lang_js_DATE_PARSER
  961. },
  962. year: {
  963. formatter: pickervue_type_script_lang_js_DATE_FORMATTER,
  964. parser: pickervue_type_script_lang_js_DATE_PARSER
  965. },
  966. number: {
  967. formatter: function formatter(value) {
  968. if (!value) return '';
  969. return '' + value;
  970. },
  971. parser: function parser(text) {
  972. var result = Number(text);
  973. if (!isNaN(text)) {
  974. return result;
  975. } else {
  976. return null;
  977. }
  978. }
  979. },
  980. dates: {
  981. formatter: function formatter(value, format) {
  982. return value.map(function (date) {
  983. return pickervue_type_script_lang_js_DATE_FORMATTER(date, format);
  984. });
  985. },
  986. parser: function parser(value, format) {
  987. return (typeof value === 'string' ? value.split(', ') : value).map(function (date) {
  988. return date instanceof Date ? date : pickervue_type_script_lang_js_DATE_PARSER(date, format);
  989. });
  990. }
  991. }
  992. };
  993. var PLACEMENT_MAP = {
  994. left: 'bottom-start',
  995. center: 'bottom',
  996. right: 'bottom-end'
  997. };
  998. var parseAsFormatAndType = function parseAsFormatAndType(value, customFormat, type) {
  999. var rangeSeparator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '-';
  1000. if (!value) return null;
  1001. var parser = (TYPE_VALUE_RESOLVER_MAP[type] || TYPE_VALUE_RESOLVER_MAP['default']).parser;
  1002. var format = customFormat || DEFAULT_FORMATS[type];
  1003. return parser(value, format, rangeSeparator);
  1004. };
  1005. var formatAsFormatAndType = function formatAsFormatAndType(value, customFormat, type) {
  1006. if (!value) return null;
  1007. var formatter = (TYPE_VALUE_RESOLVER_MAP[type] || TYPE_VALUE_RESOLVER_MAP['default']).formatter;
  1008. var format = customFormat || DEFAULT_FORMATS[type];
  1009. return formatter(value, format);
  1010. };
  1011. /*
  1012. * Considers:
  1013. * 1. Date object
  1014. * 2. date string
  1015. * 3. array of 1 or 2
  1016. */
  1017. var valueEquals = function valueEquals(a, b) {
  1018. // considers Date object and string
  1019. var dateEquals = function dateEquals(a, b) {
  1020. var aIsDate = a instanceof Date;
  1021. var bIsDate = b instanceof Date;
  1022. if (aIsDate && bIsDate) {
  1023. return a.getTime() === b.getTime();
  1024. }
  1025. if (!aIsDate && !bIsDate) {
  1026. return a === b;
  1027. }
  1028. return false;
  1029. };
  1030. var aIsArray = a instanceof Array;
  1031. var bIsArray = b instanceof Array;
  1032. if (aIsArray && bIsArray) {
  1033. if (a.length !== b.length) {
  1034. return false;
  1035. }
  1036. return a.every(function (item, index) {
  1037. return dateEquals(item, b[index]);
  1038. });
  1039. }
  1040. if (!aIsArray && !bIsArray) {
  1041. return dateEquals(a, b);
  1042. }
  1043. return false;
  1044. };
  1045. var isString = function isString(val) {
  1046. return typeof val === 'string' || val instanceof String;
  1047. };
  1048. var validator = function validator(val) {
  1049. // either: String, Array of String, null / undefined
  1050. return val === null || val === undefined || isString(val) || Array.isArray(val) && val.length === 2 && val.every(isString);
  1051. };
  1052. /* harmony default export */ var pickervue_type_script_lang_js_ = ({
  1053. mixins: [emitter_default.a, NewPopper],
  1054. inject: {
  1055. elForm: {
  1056. default: ''
  1057. },
  1058. elFormItem: {
  1059. default: ''
  1060. }
  1061. },
  1062. props: {
  1063. size: String,
  1064. format: String,
  1065. valueFormat: String,
  1066. readonly: Boolean,
  1067. placeholder: String,
  1068. startPlaceholder: String,
  1069. endPlaceholder: String,
  1070. prefixIcon: String,
  1071. clearIcon: {
  1072. type: String,
  1073. default: 'el-icon-circle-close'
  1074. },
  1075. name: {
  1076. default: '',
  1077. validator: validator
  1078. },
  1079. disabled: Boolean,
  1080. clearable: {
  1081. type: Boolean,
  1082. default: true
  1083. },
  1084. id: {
  1085. default: '',
  1086. validator: validator
  1087. },
  1088. popperClass: String,
  1089. editable: {
  1090. type: Boolean,
  1091. default: true
  1092. },
  1093. align: {
  1094. type: String,
  1095. default: 'left'
  1096. },
  1097. value: {},
  1098. defaultValue: {},
  1099. defaultTime: {},
  1100. rangeSeparator: {
  1101. default: '-'
  1102. },
  1103. pickerOptions: {},
  1104. unlinkPanels: Boolean,
  1105. validateEvent: {
  1106. type: Boolean,
  1107. default: true
  1108. }
  1109. },
  1110. components: { ElInput: input_default.a },
  1111. directives: { Clickoutside: clickoutside_default.a },
  1112. data: function data() {
  1113. return {
  1114. pickerVisible: false,
  1115. showClose: false,
  1116. userInput: null,
  1117. valueOnOpen: null, // value when picker opens, used to determine whether to emit change
  1118. unwatchPickerOptions: null
  1119. };
  1120. },
  1121. watch: {
  1122. pickerVisible: function pickerVisible(val) {
  1123. if (this.readonly || this.pickerDisabled) return;
  1124. if (val) {
  1125. this.showPicker();
  1126. this.valueOnOpen = Array.isArray(this.value) ? [].concat(this.value) : this.value;
  1127. } else {
  1128. this.hidePicker();
  1129. this.emitChange(this.value);
  1130. this.userInput = null;
  1131. if (this.validateEvent) {
  1132. this.dispatch('ElFormItem', 'el.form.blur');
  1133. }
  1134. this.$emit('blur', this);
  1135. this.blur();
  1136. }
  1137. },
  1138. parsedValue: {
  1139. immediate: true,
  1140. handler: function handler(val) {
  1141. if (this.picker) {
  1142. this.picker.value = val;
  1143. }
  1144. }
  1145. },
  1146. defaultValue: function defaultValue(val) {
  1147. // NOTE: should eventually move to jsx style picker + panel ?
  1148. if (this.picker) {
  1149. this.picker.defaultValue = val;
  1150. }
  1151. },
  1152. value: function value(val, oldVal) {
  1153. if (!valueEquals(val, oldVal) && !this.pickerVisible && this.validateEvent) {
  1154. this.dispatch('ElFormItem', 'el.form.change', val);
  1155. }
  1156. }
  1157. },
  1158. computed: {
  1159. ranged: function ranged() {
  1160. return this.type.indexOf('range') > -1;
  1161. },
  1162. reference: function reference() {
  1163. var reference = this.$refs.reference;
  1164. return reference.$el || reference;
  1165. },
  1166. refInput: function refInput() {
  1167. if (this.reference) {
  1168. return [].slice.call(this.reference.querySelectorAll('input'));
  1169. }
  1170. return [];
  1171. },
  1172. valueIsEmpty: function valueIsEmpty() {
  1173. var val = this.value;
  1174. if (Array.isArray(val)) {
  1175. for (var i = 0, len = val.length; i < len; i++) {
  1176. if (val[i]) {
  1177. return false;
  1178. }
  1179. }
  1180. } else {
  1181. if (val) {
  1182. return false;
  1183. }
  1184. }
  1185. return true;
  1186. },
  1187. triggerClass: function triggerClass() {
  1188. return this.prefixIcon || (this.type.indexOf('time') !== -1 ? 'el-icon-time' : 'el-icon-date');
  1189. },
  1190. selectionMode: function selectionMode() {
  1191. if (this.type === 'week') {
  1192. return 'week';
  1193. } else if (this.type === 'month') {
  1194. return 'month';
  1195. } else if (this.type === 'year') {
  1196. return 'year';
  1197. } else if (this.type === 'dates') {
  1198. return 'dates';
  1199. }
  1200. return 'day';
  1201. },
  1202. haveTrigger: function haveTrigger() {
  1203. if (typeof this.showTrigger !== 'undefined') {
  1204. return this.showTrigger;
  1205. }
  1206. return HAVE_TRIGGER_TYPES.indexOf(this.type) !== -1;
  1207. },
  1208. displayValue: function displayValue() {
  1209. var formattedValue = formatAsFormatAndType(this.parsedValue, this.format, this.type, this.rangeSeparator);
  1210. if (Array.isArray(this.userInput)) {
  1211. return [this.userInput[0] || formattedValue && formattedValue[0] || '', this.userInput[1] || formattedValue && formattedValue[1] || ''];
  1212. } else if (this.userInput !== null) {
  1213. return this.userInput;
  1214. } else if (formattedValue) {
  1215. return this.type === 'dates' ? formattedValue.join(', ') : formattedValue;
  1216. } else {
  1217. return '';
  1218. }
  1219. },
  1220. parsedValue: function parsedValue() {
  1221. if (!this.value) return this.value; // component value is not set
  1222. if (this.type === 'time-select') return this.value; // time-select does not require parsing, this might change in next major version
  1223. var valueIsDateObject = Object(date_util_["isDateObject"])(this.value) || Array.isArray(this.value) && this.value.every(date_util_["isDateObject"]);
  1224. if (valueIsDateObject) {
  1225. return this.value;
  1226. }
  1227. if (this.valueFormat) {
  1228. return parseAsFormatAndType(this.value, this.valueFormat, this.type, this.rangeSeparator) || this.value;
  1229. }
  1230. // NOTE: deal with common but incorrect usage, should remove in next major version
  1231. // user might provide string / timestamp without value-format, coerce them into date (or array of date)
  1232. return Array.isArray(this.value) ? this.value.map(function (val) {
  1233. return new Date(val);
  1234. }) : new Date(this.value);
  1235. },
  1236. _elFormItemSize: function _elFormItemSize() {
  1237. return (this.elFormItem || {}).elFormItemSize;
  1238. },
  1239. pickerSize: function pickerSize() {
  1240. return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
  1241. },
  1242. pickerDisabled: function pickerDisabled() {
  1243. return this.disabled || (this.elForm || {}).disabled;
  1244. },
  1245. firstInputId: function firstInputId() {
  1246. var obj = {};
  1247. var id = void 0;
  1248. if (this.ranged) {
  1249. id = this.id && this.id[0];
  1250. } else {
  1251. id = this.id;
  1252. }
  1253. if (id) obj.id = id;
  1254. return obj;
  1255. },
  1256. secondInputId: function secondInputId() {
  1257. var obj = {};
  1258. var id = void 0;
  1259. if (this.ranged) {
  1260. id = this.id && this.id[1];
  1261. }
  1262. if (id) obj.id = id;
  1263. return obj;
  1264. }
  1265. },
  1266. created: function created() {
  1267. // vue-popper
  1268. this.popperOptions = {
  1269. boundariesPadding: 0,
  1270. gpuAcceleration: false
  1271. };
  1272. this.placement = PLACEMENT_MAP[this.align] || PLACEMENT_MAP.left;
  1273. this.$on('fieldReset', this.handleFieldReset);
  1274. },
  1275. methods: {
  1276. focus: function focus() {
  1277. if (!this.ranged) {
  1278. this.$refs.reference.focus();
  1279. } else {
  1280. this.handleFocus();
  1281. }
  1282. },
  1283. blur: function blur() {
  1284. this.refInput.forEach(function (input) {
  1285. return input.blur();
  1286. });
  1287. },
  1288. // {parse, formatTo} Value deals maps component value with internal Date
  1289. parseValue: function parseValue(value) {
  1290. var isParsed = Object(date_util_["isDateObject"])(value) || Array.isArray(value) && value.every(date_util_["isDateObject"]);
  1291. if (this.valueFormat && !isParsed) {
  1292. return parseAsFormatAndType(value, this.valueFormat, this.type, this.rangeSeparator) || value;
  1293. } else {
  1294. return value;
  1295. }
  1296. },
  1297. formatToValue: function formatToValue(date) {
  1298. var isFormattable = Object(date_util_["isDateObject"])(date) || Array.isArray(date) && date.every(date_util_["isDateObject"]);
  1299. if (this.valueFormat && isFormattable) {
  1300. return formatAsFormatAndType(date, this.valueFormat, this.type, this.rangeSeparator);
  1301. } else {
  1302. return date;
  1303. }
  1304. },
  1305. // {parse, formatTo} String deals with user input
  1306. parseString: function parseString(value) {
  1307. var type = Array.isArray(value) ? this.type : this.type.replace('range', '');
  1308. return parseAsFormatAndType(value, this.format, type);
  1309. },
  1310. formatToString: function formatToString(value) {
  1311. var type = Array.isArray(value) ? this.type : this.type.replace('range', '');
  1312. return formatAsFormatAndType(value, this.format, type);
  1313. },
  1314. handleMouseEnter: function handleMouseEnter() {
  1315. if (this.readonly || this.pickerDisabled) return;
  1316. if (!this.valueIsEmpty && this.clearable) {
  1317. this.showClose = true;
  1318. }
  1319. },
  1320. handleChange: function handleChange() {
  1321. if (this.userInput) {
  1322. var value = this.parseString(this.displayValue);
  1323. if (value) {
  1324. this.picker.value = value;
  1325. if (this.isValidValue(value)) {
  1326. this.emitInput(value);
  1327. this.userInput = null;
  1328. }
  1329. }
  1330. }
  1331. if (this.userInput === '') {
  1332. this.emitInput(null);
  1333. this.emitChange(null);
  1334. this.userInput = null;
  1335. }
  1336. },
  1337. handleStartInput: function handleStartInput(event) {
  1338. if (this.userInput) {
  1339. this.userInput = [event.target.value, this.userInput[1]];
  1340. } else {
  1341. this.userInput = [event.target.value, null];
  1342. }
  1343. },
  1344. handleEndInput: function handleEndInput(event) {
  1345. if (this.userInput) {
  1346. this.userInput = [this.userInput[0], event.target.value];
  1347. } else {
  1348. this.userInput = [null, event.target.value];
  1349. }
  1350. },
  1351. handleStartChange: function handleStartChange(event) {
  1352. var value = this.parseString(this.userInput && this.userInput[0]);
  1353. if (value) {
  1354. this.userInput = [this.formatToString(value), this.displayValue[1]];
  1355. var newValue = [value, this.picker.value && this.picker.value[1]];
  1356. this.picker.value = newValue;
  1357. if (this.isValidValue(newValue)) {
  1358. this.emitInput(newValue);
  1359. this.userInput = null;
  1360. }
  1361. }
  1362. },
  1363. handleEndChange: function handleEndChange(event) {
  1364. var value = this.parseString(this.userInput && this.userInput[1]);
  1365. if (value) {
  1366. this.userInput = [this.displayValue[0], this.formatToString(value)];
  1367. var newValue = [this.picker.value && this.picker.value[0], value];
  1368. this.picker.value = newValue;
  1369. if (this.isValidValue(newValue)) {
  1370. this.emitInput(newValue);
  1371. this.userInput = null;
  1372. }
  1373. }
  1374. },
  1375. handleClickIcon: function handleClickIcon(event) {
  1376. if (this.readonly || this.pickerDisabled) return;
  1377. if (this.showClose) {
  1378. this.valueOnOpen = this.value;
  1379. event.stopPropagation();
  1380. this.emitInput(null);
  1381. this.emitChange(null);
  1382. this.showClose = false;
  1383. if (this.picker && typeof this.picker.handleClear === 'function') {
  1384. this.picker.handleClear();
  1385. }
  1386. } else {
  1387. this.pickerVisible = !this.pickerVisible;
  1388. }
  1389. },
  1390. handleClose: function handleClose() {
  1391. if (!this.pickerVisible) return;
  1392. this.pickerVisible = false;
  1393. if (this.type === 'dates') {
  1394. // restore to former value
  1395. var oldValue = parseAsFormatAndType(this.valueOnOpen, this.valueFormat, this.type, this.rangeSeparator) || this.valueOnOpen;
  1396. this.emitInput(oldValue);
  1397. }
  1398. },
  1399. handleFieldReset: function handleFieldReset(initialValue) {
  1400. this.userInput = initialValue === '' ? null : initialValue;
  1401. },
  1402. handleFocus: function handleFocus() {
  1403. var type = this.type;
  1404. if (HAVE_TRIGGER_TYPES.indexOf(type) !== -1 && !this.pickerVisible) {
  1405. this.pickerVisible = true;
  1406. }
  1407. this.$emit('focus', this);
  1408. },
  1409. handleKeydown: function handleKeydown(event) {
  1410. var _this = this;
  1411. var keyCode = event.keyCode;
  1412. // ESC
  1413. if (keyCode === 27) {
  1414. this.pickerVisible = false;
  1415. event.stopPropagation();
  1416. return;
  1417. }
  1418. // Tab
  1419. if (keyCode === 9) {
  1420. if (!this.ranged) {
  1421. this.handleChange();
  1422. this.pickerVisible = this.picker.visible = false;
  1423. this.blur();
  1424. event.stopPropagation();
  1425. } else {
  1426. // user may change focus between two input
  1427. setTimeout(function () {
  1428. if (_this.refInput.indexOf(document.activeElement) === -1) {
  1429. _this.pickerVisible = false;
  1430. _this.blur();
  1431. event.stopPropagation();
  1432. }
  1433. }, 0);
  1434. }
  1435. return;
  1436. }
  1437. // Enter
  1438. if (keyCode === 13) {
  1439. if (this.userInput === '' || this.isValidValue(this.parseString(this.displayValue))) {
  1440. this.handleChange();
  1441. this.pickerVisible = this.picker.visible = false;
  1442. this.blur();
  1443. }
  1444. event.stopPropagation();
  1445. return;
  1446. }
  1447. // if user is typing, do not let picker handle key input
  1448. if (this.userInput) {
  1449. event.stopPropagation();
  1450. return;
  1451. }
  1452. // delegate other keys to panel
  1453. if (this.picker && this.picker.handleKeydown) {
  1454. this.picker.handleKeydown(event);
  1455. }
  1456. },
  1457. handleRangeClick: function handleRangeClick() {
  1458. var type = this.type;
  1459. if (HAVE_TRIGGER_TYPES.indexOf(type) !== -1 && !this.pickerVisible) {
  1460. this.pickerVisible = true;
  1461. }
  1462. this.$emit('focus', this);
  1463. },
  1464. hidePicker: function hidePicker() {
  1465. if (this.picker) {
  1466. this.picker.resetView && this.picker.resetView();
  1467. this.pickerVisible = this.picker.visible = false;
  1468. this.destroyPopper();
  1469. }
  1470. },
  1471. showPicker: function showPicker() {
  1472. var _this2 = this;
  1473. if (this.$isServer) return;
  1474. if (!this.picker) {
  1475. this.mountPicker();
  1476. }
  1477. this.pickerVisible = this.picker.visible = true;
  1478. this.updatePopper();
  1479. this.picker.value = this.parsedValue;
  1480. this.picker.resetView && this.picker.resetView();
  1481. this.$nextTick(function () {
  1482. _this2.picker.adjustSpinners && _this2.picker.adjustSpinners();
  1483. });
  1484. },
  1485. mountPicker: function mountPicker() {
  1486. var _this3 = this;
  1487. this.picker = new external_vue_default.a(this.panel).$mount();
  1488. this.picker.defaultValue = this.defaultValue;
  1489. this.picker.defaultTime = this.defaultTime;
  1490. this.picker.popperClass = this.popperClass;
  1491. this.popperElm = this.picker.$el;
  1492. this.picker.width = this.reference.getBoundingClientRect().width;
  1493. this.picker.showTime = this.type === 'datetime' || this.type === 'datetimerange';
  1494. this.picker.selectionMode = this.selectionMode;
  1495. this.picker.unlinkPanels = this.unlinkPanels;
  1496. this.picker.arrowControl = this.arrowControl || this.timeArrowControl || false;
  1497. this.$watch('format', function (format) {
  1498. _this3.picker.format = format;
  1499. });
  1500. var updateOptions = function updateOptions() {
  1501. var options = _this3.pickerOptions;
  1502. if (options && options.selectableRange) {
  1503. var ranges = options.selectableRange;
  1504. var parser = TYPE_VALUE_RESOLVER_MAP.datetimerange.parser;
  1505. var format = DEFAULT_FORMATS.timerange;
  1506. ranges = Array.isArray(ranges) ? ranges : [ranges];
  1507. _this3.picker.selectableRange = ranges.map(function (range) {
  1508. return parser(range, format, _this3.rangeSeparator);
  1509. });
  1510. }
  1511. for (var option in options) {
  1512. if (options.hasOwnProperty(option) &&
  1513. // 忽略 time-picker 的该配置项
  1514. option !== 'selectableRange') {
  1515. _this3.picker[option] = options[option];
  1516. }
  1517. }
  1518. // main format must prevail over undocumented pickerOptions.format
  1519. if (_this3.format) {
  1520. _this3.picker.format = _this3.format;
  1521. }
  1522. };
  1523. updateOptions();
  1524. this.unwatchPickerOptions = this.$watch('pickerOptions', function () {
  1525. return updateOptions();
  1526. }, { deep: true });
  1527. this.$el.appendChild(this.picker.$el);
  1528. this.picker.resetView && this.picker.resetView();
  1529. this.picker.$on('dodestroy', this.doDestroy);
  1530. this.picker.$on('pick', function () {
  1531. var date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
  1532. var visible = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  1533. _this3.userInput = null;
  1534. _this3.pickerVisible = _this3.picker.visible = visible;
  1535. _this3.emitInput(date);
  1536. _this3.picker.resetView && _this3.picker.resetView();
  1537. });
  1538. this.picker.$on('select-range', function (start, end, pos) {
  1539. if (_this3.refInput.length === 0) return;
  1540. if (!pos || pos === 'min') {
  1541. _this3.refInput[0].setSelectionRange(start, end);
  1542. _this3.refInput[0].focus();
  1543. } else if (pos === 'max') {
  1544. _this3.refInput[1].setSelectionRange(start, end);
  1545. _this3.refInput[1].focus();
  1546. }
  1547. });
  1548. },
  1549. unmountPicker: function unmountPicker() {
  1550. if (this.picker) {
  1551. this.picker.$destroy();
  1552. this.picker.$off();
  1553. if (typeof this.unwatchPickerOptions === 'function') {
  1554. this.unwatchPickerOptions();
  1555. }
  1556. this.picker.$el.parentNode.removeChild(this.picker.$el);
  1557. }
  1558. },
  1559. emitChange: function emitChange(val) {
  1560. // determine user real change only
  1561. if (!valueEquals(val, this.valueOnOpen)) {
  1562. this.$emit('change', val);
  1563. this.valueOnOpen = val;
  1564. if (this.validateEvent) {
  1565. this.dispatch('ElFormItem', 'el.form.change', val);
  1566. }
  1567. }
  1568. },
  1569. emitInput: function emitInput(val) {
  1570. var formatted = this.formatToValue(val);
  1571. if (!valueEquals(this.value, formatted)) {
  1572. this.$emit('input', formatted);
  1573. }
  1574. },
  1575. isValidValue: function isValidValue(value) {
  1576. if (!this.picker) {
  1577. this.mountPicker();
  1578. }
  1579. if (this.picker.isValidValue) {
  1580. return value && this.picker.isValidValue(value);
  1581. } else {
  1582. return true;
  1583. }
  1584. }
  1585. }
  1586. });
  1587. // CONCATENATED MODULE: ./packages/date-picker/src/picker.vue?vue&type=script&lang=js&
  1588. /* harmony default export */ var src_pickervue_type_script_lang_js_ = (pickervue_type_script_lang_js_);
  1589. // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
  1590. var componentNormalizer = __webpack_require__(0);
  1591. // CONCATENATED MODULE: ./packages/date-picker/src/picker.vue
  1592. /* normalize component */
  1593. var component = Object(componentNormalizer["a" /* default */])(
  1594. src_pickervue_type_script_lang_js_,
  1595. render,
  1596. staticRenderFns,
  1597. false,
  1598. null,
  1599. null,
  1600. null
  1601. )
  1602. /* hot reload */
  1603. if (false) { var api; }
  1604. component.options.__file = "packages/date-picker/src/picker.vue"
  1605. /* harmony default export */ var picker = __webpack_exports__["a"] = (component.exports);
  1606. /***/ }),
  1607. /* 33 */,
  1608. /* 34 */
  1609. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1610. "use strict";
  1611. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/basic/time-spinner.vue?vue&type=template&id=1facadeb&
  1612. var render = function() {
  1613. var _vm = this
  1614. var _h = _vm.$createElement
  1615. var _c = _vm._self._c || _h
  1616. return _c(
  1617. "div",
  1618. {
  1619. staticClass: "el-time-spinner",
  1620. class: { "has-seconds": _vm.showSeconds }
  1621. },
  1622. [
  1623. !_vm.arrowControl
  1624. ? [
  1625. _c(
  1626. "el-scrollbar",
  1627. {
  1628. ref: "hours",
  1629. staticClass: "el-time-spinner__wrapper",
  1630. attrs: {
  1631. "wrap-style": "max-height: inherit;",
  1632. "view-class": "el-time-spinner__list",
  1633. noresize: "",
  1634. tag: "ul"
  1635. },
  1636. nativeOn: {
  1637. mouseenter: function($event) {
  1638. _vm.emitSelectRange("hours")
  1639. },
  1640. mousemove: function($event) {
  1641. _vm.adjustCurrentSpinner("hours")
  1642. }
  1643. }
  1644. },
  1645. _vm._l(_vm.hoursList, function(disabled, hour) {
  1646. return _c(
  1647. "li",
  1648. {
  1649. key: hour,
  1650. staticClass: "el-time-spinner__item",
  1651. class: { active: hour === _vm.hours, disabled: disabled },
  1652. on: {
  1653. click: function($event) {
  1654. _vm.handleClick("hours", {
  1655. value: hour,
  1656. disabled: disabled
  1657. })
  1658. }
  1659. }
  1660. },
  1661. [
  1662. _vm._v(
  1663. _vm._s(
  1664. ("0" + (_vm.amPmMode ? hour % 12 || 12 : hour)).slice(
  1665. -2
  1666. )
  1667. ) + _vm._s(_vm.amPm(hour))
  1668. )
  1669. ]
  1670. )
  1671. }),
  1672. 0
  1673. ),
  1674. _c(
  1675. "el-scrollbar",
  1676. {
  1677. ref: "minutes",
  1678. staticClass: "el-time-spinner__wrapper",
  1679. attrs: {
  1680. "wrap-style": "max-height: inherit;",
  1681. "view-class": "el-time-spinner__list",
  1682. noresize: "",
  1683. tag: "ul"
  1684. },
  1685. nativeOn: {
  1686. mouseenter: function($event) {
  1687. _vm.emitSelectRange("minutes")
  1688. },
  1689. mousemove: function($event) {
  1690. _vm.adjustCurrentSpinner("minutes")
  1691. }
  1692. }
  1693. },
  1694. _vm._l(_vm.minutesList, function(enabled, key) {
  1695. return _c(
  1696. "li",
  1697. {
  1698. key: key,
  1699. staticClass: "el-time-spinner__item",
  1700. class: { active: key === _vm.minutes, disabled: !enabled },
  1701. on: {
  1702. click: function($event) {
  1703. _vm.handleClick("minutes", {
  1704. value: key,
  1705. disabled: false
  1706. })
  1707. }
  1708. }
  1709. },
  1710. [_vm._v(_vm._s(("0" + key).slice(-2)))]
  1711. )
  1712. }),
  1713. 0
  1714. ),
  1715. _c(
  1716. "el-scrollbar",
  1717. {
  1718. directives: [
  1719. {
  1720. name: "show",
  1721. rawName: "v-show",
  1722. value: _vm.showSeconds,
  1723. expression: "showSeconds"
  1724. }
  1725. ],
  1726. ref: "seconds",
  1727. staticClass: "el-time-spinner__wrapper",
  1728. attrs: {
  1729. "wrap-style": "max-height: inherit;",
  1730. "view-class": "el-time-spinner__list",
  1731. noresize: "",
  1732. tag: "ul"
  1733. },
  1734. nativeOn: {
  1735. mouseenter: function($event) {
  1736. _vm.emitSelectRange("seconds")
  1737. },
  1738. mousemove: function($event) {
  1739. _vm.adjustCurrentSpinner("seconds")
  1740. }
  1741. }
  1742. },
  1743. _vm._l(60, function(second, key) {
  1744. return _c(
  1745. "li",
  1746. {
  1747. key: key,
  1748. staticClass: "el-time-spinner__item",
  1749. class: { active: key === _vm.seconds },
  1750. on: {
  1751. click: function($event) {
  1752. _vm.handleClick("seconds", {
  1753. value: key,
  1754. disabled: false
  1755. })
  1756. }
  1757. }
  1758. },
  1759. [_vm._v(_vm._s(("0" + key).slice(-2)))]
  1760. )
  1761. }),
  1762. 0
  1763. )
  1764. ]
  1765. : _vm._e(),
  1766. _vm.arrowControl
  1767. ? [
  1768. _c(
  1769. "div",
  1770. {
  1771. staticClass: "el-time-spinner__wrapper is-arrow",
  1772. on: {
  1773. mouseenter: function($event) {
  1774. _vm.emitSelectRange("hours")
  1775. }
  1776. }
  1777. },
  1778. [
  1779. _c("i", {
  1780. directives: [
  1781. {
  1782. name: "repeat-click",
  1783. rawName: "v-repeat-click",
  1784. value: _vm.decrease,
  1785. expression: "decrease"
  1786. }
  1787. ],
  1788. staticClass: "el-time-spinner__arrow el-icon-arrow-up"
  1789. }),
  1790. _c("i", {
  1791. directives: [
  1792. {
  1793. name: "repeat-click",
  1794. rawName: "v-repeat-click",
  1795. value: _vm.increase,
  1796. expression: "increase"
  1797. }
  1798. ],
  1799. staticClass: "el-time-spinner__arrow el-icon-arrow-down"
  1800. }),
  1801. _c(
  1802. "ul",
  1803. { ref: "hours", staticClass: "el-time-spinner__list" },
  1804. _vm._l(_vm.arrowHourList, function(hour, key) {
  1805. return _c(
  1806. "li",
  1807. {
  1808. key: key,
  1809. staticClass: "el-time-spinner__item",
  1810. class: {
  1811. active: hour === _vm.hours,
  1812. disabled: _vm.hoursList[hour]
  1813. }
  1814. },
  1815. [
  1816. _vm._v(
  1817. _vm._s(
  1818. hour === undefined
  1819. ? ""
  1820. : (
  1821. "0" + (_vm.amPmMode ? hour % 12 || 12 : hour)
  1822. ).slice(-2) + _vm.amPm(hour)
  1823. )
  1824. )
  1825. ]
  1826. )
  1827. }),
  1828. 0
  1829. )
  1830. ]
  1831. ),
  1832. _c(
  1833. "div",
  1834. {
  1835. staticClass: "el-time-spinner__wrapper is-arrow",
  1836. on: {
  1837. mouseenter: function($event) {
  1838. _vm.emitSelectRange("minutes")
  1839. }
  1840. }
  1841. },
  1842. [
  1843. _c("i", {
  1844. directives: [
  1845. {
  1846. name: "repeat-click",
  1847. rawName: "v-repeat-click",
  1848. value: _vm.decrease,
  1849. expression: "decrease"
  1850. }
  1851. ],
  1852. staticClass: "el-time-spinner__arrow el-icon-arrow-up"
  1853. }),
  1854. _c("i", {
  1855. directives: [
  1856. {
  1857. name: "repeat-click",
  1858. rawName: "v-repeat-click",
  1859. value: _vm.increase,
  1860. expression: "increase"
  1861. }
  1862. ],
  1863. staticClass: "el-time-spinner__arrow el-icon-arrow-down"
  1864. }),
  1865. _c(
  1866. "ul",
  1867. { ref: "minutes", staticClass: "el-time-spinner__list" },
  1868. _vm._l(_vm.arrowMinuteList, function(minute, key) {
  1869. return _c(
  1870. "li",
  1871. {
  1872. key: key,
  1873. staticClass: "el-time-spinner__item",
  1874. class: { active: minute === _vm.minutes }
  1875. },
  1876. [
  1877. _vm._v(
  1878. "\n " +
  1879. _vm._s(
  1880. minute === undefined
  1881. ? ""
  1882. : ("0" + minute).slice(-2)
  1883. ) +
  1884. "\n "
  1885. )
  1886. ]
  1887. )
  1888. }),
  1889. 0
  1890. )
  1891. ]
  1892. ),
  1893. _vm.showSeconds
  1894. ? _c(
  1895. "div",
  1896. {
  1897. staticClass: "el-time-spinner__wrapper is-arrow",
  1898. on: {
  1899. mouseenter: function($event) {
  1900. _vm.emitSelectRange("seconds")
  1901. }
  1902. }
  1903. },
  1904. [
  1905. _c("i", {
  1906. directives: [
  1907. {
  1908. name: "repeat-click",
  1909. rawName: "v-repeat-click",
  1910. value: _vm.decrease,
  1911. expression: "decrease"
  1912. }
  1913. ],
  1914. staticClass: "el-time-spinner__arrow el-icon-arrow-up"
  1915. }),
  1916. _c("i", {
  1917. directives: [
  1918. {
  1919. name: "repeat-click",
  1920. rawName: "v-repeat-click",
  1921. value: _vm.increase,
  1922. expression: "increase"
  1923. }
  1924. ],
  1925. staticClass: "el-time-spinner__arrow el-icon-arrow-down"
  1926. }),
  1927. _c(
  1928. "ul",
  1929. { ref: "seconds", staticClass: "el-time-spinner__list" },
  1930. _vm._l(_vm.arrowSecondList, function(second, key) {
  1931. return _c(
  1932. "li",
  1933. {
  1934. key: key,
  1935. staticClass: "el-time-spinner__item",
  1936. class: { active: second === _vm.seconds }
  1937. },
  1938. [
  1939. _vm._v(
  1940. "\n " +
  1941. _vm._s(
  1942. second === undefined
  1943. ? ""
  1944. : ("0" + second).slice(-2)
  1945. ) +
  1946. "\n "
  1947. )
  1948. ]
  1949. )
  1950. }),
  1951. 0
  1952. )
  1953. ]
  1954. )
  1955. : _vm._e()
  1956. ]
  1957. : _vm._e()
  1958. ],
  1959. 2
  1960. )
  1961. }
  1962. var staticRenderFns = []
  1963. render._withStripped = true
  1964. // CONCATENATED MODULE: ./packages/date-picker/src/basic/time-spinner.vue?vue&type=template&id=1facadeb&
  1965. // EXTERNAL MODULE: external "element-ui/lib/utils/date-util"
  1966. var date_util_ = __webpack_require__(1);
  1967. // EXTERNAL MODULE: external "element-ui/lib/scrollbar"
  1968. var scrollbar_ = __webpack_require__(15);
  1969. var scrollbar_default = /*#__PURE__*/__webpack_require__.n(scrollbar_);
  1970. // EXTERNAL MODULE: ./src/directives/repeat-click.js
  1971. var repeat_click = __webpack_require__(30);
  1972. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/basic/time-spinner.vue?vue&type=script&lang=js&
  1973. //
  1974. //
  1975. //
  1976. //
  1977. //
  1978. //
  1979. //
  1980. //
  1981. //
  1982. //
  1983. //
  1984. //
  1985. //
  1986. //
  1987. //
  1988. //
  1989. //
  1990. //
  1991. //
  1992. //
  1993. //
  1994. //
  1995. //
  1996. //
  1997. //
  1998. //
  1999. //
  2000. //
  2001. //
  2002. //
  2003. //
  2004. //
  2005. //
  2006. //
  2007. //
  2008. //
  2009. //
  2010. //
  2011. //
  2012. //
  2013. //
  2014. //
  2015. //
  2016. //
  2017. //
  2018. //
  2019. //
  2020. //
  2021. //
  2022. //
  2023. //
  2024. //
  2025. //
  2026. //
  2027. //
  2028. //
  2029. //
  2030. //
  2031. //
  2032. //
  2033. //
  2034. //
  2035. //
  2036. //
  2037. //
  2038. //
  2039. //
  2040. //
  2041. //
  2042. //
  2043. //
  2044. //
  2045. //
  2046. //
  2047. //
  2048. //
  2049. //
  2050. //
  2051. //
  2052. //
  2053. //
  2054. //
  2055. //
  2056. //
  2057. //
  2058. //
  2059. //
  2060. //
  2061. //
  2062. //
  2063. //
  2064. //
  2065. //
  2066. //
  2067. //
  2068. //
  2069. //
  2070. //
  2071. //
  2072. //
  2073. //
  2074. //
  2075. /* harmony default export */ var time_spinnervue_type_script_lang_js_ = ({
  2076. components: { ElScrollbar: scrollbar_default.a },
  2077. directives: {
  2078. repeatClick: repeat_click["a" /* default */]
  2079. },
  2080. props: {
  2081. date: {},
  2082. defaultValue: {}, // reserved for future use
  2083. showSeconds: {
  2084. type: Boolean,
  2085. default: true
  2086. },
  2087. arrowControl: Boolean,
  2088. amPmMode: {
  2089. type: String,
  2090. default: '' // 'a': am/pm; 'A': AM/PM
  2091. }
  2092. },
  2093. computed: {
  2094. hours: function hours() {
  2095. return this.date.getHours();
  2096. },
  2097. minutes: function minutes() {
  2098. return this.date.getMinutes();
  2099. },
  2100. seconds: function seconds() {
  2101. return this.date.getSeconds();
  2102. },
  2103. hoursList: function hoursList() {
  2104. return Object(date_util_["getRangeHours"])(this.selectableRange);
  2105. },
  2106. minutesList: function minutesList() {
  2107. return Object(date_util_["getRangeMinutes"])(this.selectableRange, this.hours);
  2108. },
  2109. arrowHourList: function arrowHourList() {
  2110. var hours = this.hours;
  2111. return [hours > 0 ? hours - 1 : undefined, hours, hours < 23 ? hours + 1 : undefined];
  2112. },
  2113. arrowMinuteList: function arrowMinuteList() {
  2114. var minutes = this.minutes;
  2115. return [minutes > 0 ? minutes - 1 : undefined, minutes, minutes < 59 ? minutes + 1 : undefined];
  2116. },
  2117. arrowSecondList: function arrowSecondList() {
  2118. var seconds = this.seconds;
  2119. return [seconds > 0 ? seconds - 1 : undefined, seconds, seconds < 59 ? seconds + 1 : undefined];
  2120. }
  2121. },
  2122. data: function data() {
  2123. return {
  2124. selectableRange: [],
  2125. currentScrollbar: null
  2126. };
  2127. },
  2128. mounted: function mounted() {
  2129. var _this = this;
  2130. this.$nextTick(function () {
  2131. !_this.arrowControl && _this.bindScrollEvent();
  2132. });
  2133. },
  2134. methods: {
  2135. increase: function increase() {
  2136. this.scrollDown(1);
  2137. },
  2138. decrease: function decrease() {
  2139. this.scrollDown(-1);
  2140. },
  2141. modifyDateField: function modifyDateField(type, value) {
  2142. switch (type) {
  2143. case 'hours':
  2144. this.$emit('change', Object(date_util_["modifyTime"])(this.date, value, this.minutes, this.seconds));break;
  2145. case 'minutes':
  2146. this.$emit('change', Object(date_util_["modifyTime"])(this.date, this.hours, value, this.seconds));break;
  2147. case 'seconds':
  2148. this.$emit('change', Object(date_util_["modifyTime"])(this.date, this.hours, this.minutes, value));break;
  2149. }
  2150. },
  2151. handleClick: function handleClick(type, _ref) {
  2152. var value = _ref.value,
  2153. disabled = _ref.disabled;
  2154. if (!disabled) {
  2155. this.modifyDateField(type, value);
  2156. this.emitSelectRange(type);
  2157. this.adjustSpinner(type, value);
  2158. }
  2159. },
  2160. emitSelectRange: function emitSelectRange(type) {
  2161. if (type === 'hours') {
  2162. this.$emit('select-range', 0, 2);
  2163. } else if (type === 'minutes') {
  2164. this.$emit('select-range', 3, 5);
  2165. } else if (type === 'seconds') {
  2166. this.$emit('select-range', 6, 8);
  2167. }
  2168. this.currentScrollbar = type;
  2169. },
  2170. bindScrollEvent: function bindScrollEvent() {
  2171. var _this2 = this;
  2172. var bindFunction = function bindFunction(type) {
  2173. _this2.$refs[type].wrap.onscroll = function (e) {
  2174. // TODO: scroll is emitted when set scrollTop programatically
  2175. // should find better solutions in the future!
  2176. _this2.handleScroll(type, e);
  2177. };
  2178. };
  2179. bindFunction('hours');
  2180. bindFunction('minutes');
  2181. bindFunction('seconds');
  2182. },
  2183. handleScroll: function handleScroll(type) {
  2184. var value = Math.min(Math.round((this.$refs[type].wrap.scrollTop - (this.scrollBarHeight(type) * 0.5 - 10) / this.typeItemHeight(type) + 3) / this.typeItemHeight(type)), type === 'hours' ? 23 : 59);
  2185. this.modifyDateField(type, value);
  2186. },
  2187. // NOTE: used by datetime / date-range panel
  2188. // renamed from adjustScrollTop
  2189. // should try to refactory it
  2190. adjustSpinners: function adjustSpinners() {
  2191. this.adjustSpinner('hours', this.hours);
  2192. this.adjustSpinner('minutes', this.minutes);
  2193. this.adjustSpinner('seconds', this.seconds);
  2194. },
  2195. adjustCurrentSpinner: function adjustCurrentSpinner(type) {
  2196. this.adjustSpinner(type, this[type]);
  2197. },
  2198. adjustSpinner: function adjustSpinner(type, value) {
  2199. if (this.arrowControl) return;
  2200. var el = this.$refs[type].wrap;
  2201. if (el) {
  2202. el.scrollTop = Math.max(0, value * this.typeItemHeight(type));
  2203. }
  2204. },
  2205. scrollDown: function scrollDown(step) {
  2206. var _this3 = this;
  2207. if (!this.currentScrollbar) {
  2208. this.emitSelectRange('hours');
  2209. }
  2210. var label = this.currentScrollbar;
  2211. var hoursList = this.hoursList;
  2212. var now = this[label];
  2213. if (this.currentScrollbar === 'hours') {
  2214. var total = Math.abs(step);
  2215. step = step > 0 ? 1 : -1;
  2216. var length = hoursList.length;
  2217. while (length-- && total) {
  2218. now = (now + step + hoursList.length) % hoursList.length;
  2219. if (hoursList[now]) {
  2220. continue;
  2221. }
  2222. total--;
  2223. }
  2224. if (hoursList[now]) return;
  2225. } else {
  2226. now = (now + step + 60) % 60;
  2227. }
  2228. this.modifyDateField(label, now);
  2229. this.adjustSpinner(label, now);
  2230. this.$nextTick(function () {
  2231. return _this3.emitSelectRange(_this3.currentScrollbar);
  2232. });
  2233. },
  2234. amPm: function amPm(hour) {
  2235. var shouldShowAmPm = this.amPmMode.toLowerCase() === 'a';
  2236. if (!shouldShowAmPm) return '';
  2237. var isCapital = this.amPmMode === 'A';
  2238. var content = hour < 12 ? ' am' : ' pm';
  2239. if (isCapital) content = content.toUpperCase();
  2240. return content;
  2241. },
  2242. typeItemHeight: function typeItemHeight(type) {
  2243. return this.$refs[type].$el.querySelector('li').offsetHeight;
  2244. },
  2245. scrollBarHeight: function scrollBarHeight(type) {
  2246. return this.$refs[type].$el.offsetHeight;
  2247. }
  2248. }
  2249. });
  2250. // CONCATENATED MODULE: ./packages/date-picker/src/basic/time-spinner.vue?vue&type=script&lang=js&
  2251. /* harmony default export */ var basic_time_spinnervue_type_script_lang_js_ = (time_spinnervue_type_script_lang_js_);
  2252. // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
  2253. var componentNormalizer = __webpack_require__(0);
  2254. // CONCATENATED MODULE: ./packages/date-picker/src/basic/time-spinner.vue
  2255. /* normalize component */
  2256. var component = Object(componentNormalizer["a" /* default */])(
  2257. basic_time_spinnervue_type_script_lang_js_,
  2258. render,
  2259. staticRenderFns,
  2260. false,
  2261. null,
  2262. null,
  2263. null
  2264. )
  2265. /* hot reload */
  2266. if (false) { var api; }
  2267. component.options.__file = "packages/date-picker/src/basic/time-spinner.vue"
  2268. /* harmony default export */ var time_spinner = __webpack_exports__["a"] = (component.exports);
  2269. /***/ }),
  2270. /* 35 */,
  2271. /* 36 */,
  2272. /* 37 */,
  2273. /* 38 */,
  2274. /* 39 */,
  2275. /* 40 */,
  2276. /* 41 */,
  2277. /* 42 */,
  2278. /* 43 */,
  2279. /* 44 */,
  2280. /* 45 */,
  2281. /* 46 */,
  2282. /* 47 */,
  2283. /* 48 */,
  2284. /* 49 */,
  2285. /* 50 */,
  2286. /* 51 */,
  2287. /* 52 */,
  2288. /* 53 */,
  2289. /* 54 */,
  2290. /* 55 */
  2291. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2292. "use strict";
  2293. __webpack_require__.r(__webpack_exports__);
  2294. // EXTERNAL MODULE: ./packages/date-picker/src/picker.vue + 4 modules
  2295. var picker = __webpack_require__(32);
  2296. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/panel/date.vue?vue&type=template&id=2440d4ea&
  2297. var render = function() {
  2298. var _vm = this
  2299. var _h = _vm.$createElement
  2300. var _c = _vm._self._c || _h
  2301. return _c(
  2302. "transition",
  2303. {
  2304. attrs: { name: "el-zoom-in-top" },
  2305. on: { "after-enter": _vm.handleEnter, "after-leave": _vm.handleLeave }
  2306. },
  2307. [
  2308. _c(
  2309. "div",
  2310. {
  2311. directives: [
  2312. {
  2313. name: "show",
  2314. rawName: "v-show",
  2315. value: _vm.visible,
  2316. expression: "visible"
  2317. }
  2318. ],
  2319. staticClass: "el-picker-panel el-date-picker el-popper",
  2320. class: [
  2321. {
  2322. "has-sidebar": _vm.$slots.sidebar || _vm.shortcuts,
  2323. "has-time": _vm.showTime
  2324. },
  2325. _vm.popperClass
  2326. ]
  2327. },
  2328. [
  2329. _c(
  2330. "div",
  2331. { staticClass: "el-picker-panel__body-wrapper" },
  2332. [
  2333. _vm._t("sidebar"),
  2334. _vm.shortcuts
  2335. ? _c(
  2336. "div",
  2337. { staticClass: "el-picker-panel__sidebar" },
  2338. _vm._l(_vm.shortcuts, function(shortcut, key) {
  2339. return _c(
  2340. "button",
  2341. {
  2342. key: key,
  2343. staticClass: "el-picker-panel__shortcut",
  2344. attrs: { type: "button" },
  2345. on: {
  2346. click: function($event) {
  2347. _vm.handleShortcutClick(shortcut)
  2348. }
  2349. }
  2350. },
  2351. [_vm._v(_vm._s(shortcut.text))]
  2352. )
  2353. }),
  2354. 0
  2355. )
  2356. : _vm._e(),
  2357. _c("div", { staticClass: "el-picker-panel__body" }, [
  2358. _vm.showTime
  2359. ? _c("div", { staticClass: "el-date-picker__time-header" }, [
  2360. _c(
  2361. "span",
  2362. { staticClass: "el-date-picker__editor-wrap" },
  2363. [
  2364. _c("el-input", {
  2365. attrs: {
  2366. placeholder: _vm.t("el.datepicker.selectDate"),
  2367. value: _vm.visibleDate,
  2368. size: "small"
  2369. },
  2370. on: {
  2371. input: function(val) {
  2372. return (_vm.userInputDate = val)
  2373. },
  2374. change: _vm.handleVisibleDateChange
  2375. }
  2376. })
  2377. ],
  2378. 1
  2379. ),
  2380. _c(
  2381. "span",
  2382. {
  2383. directives: [
  2384. {
  2385. name: "clickoutside",
  2386. rawName: "v-clickoutside",
  2387. value: _vm.handleTimePickClose,
  2388. expression: "handleTimePickClose"
  2389. }
  2390. ],
  2391. staticClass: "el-date-picker__editor-wrap"
  2392. },
  2393. [
  2394. _c("el-input", {
  2395. ref: "input",
  2396. attrs: {
  2397. placeholder: _vm.t("el.datepicker.selectTime"),
  2398. value: _vm.visibleTime,
  2399. size: "small"
  2400. },
  2401. on: {
  2402. focus: function($event) {
  2403. _vm.timePickerVisible = true
  2404. },
  2405. input: function(val) {
  2406. return (_vm.userInputTime = val)
  2407. },
  2408. change: _vm.handleVisibleTimeChange
  2409. }
  2410. }),
  2411. _c("time-picker", {
  2412. ref: "timepicker",
  2413. attrs: {
  2414. "time-arrow-control": _vm.arrowControl,
  2415. visible: _vm.timePickerVisible
  2416. },
  2417. on: {
  2418. pick: _vm.handleTimePick,
  2419. mounted: _vm.proxyTimePickerDataProperties
  2420. }
  2421. })
  2422. ],
  2423. 1
  2424. )
  2425. ])
  2426. : _vm._e(),
  2427. _c(
  2428. "div",
  2429. {
  2430. directives: [
  2431. {
  2432. name: "show",
  2433. rawName: "v-show",
  2434. value: _vm.currentView !== "time",
  2435. expression: "currentView !== 'time'"
  2436. }
  2437. ],
  2438. staticClass: "el-date-picker__header",
  2439. class: {
  2440. "el-date-picker__header--bordered":
  2441. _vm.currentView === "year" ||
  2442. _vm.currentView === "month"
  2443. }
  2444. },
  2445. [
  2446. _c("button", {
  2447. staticClass:
  2448. "el-picker-panel__icon-btn el-date-picker__prev-btn el-icon-d-arrow-left",
  2449. attrs: {
  2450. type: "button",
  2451. "aria-label": _vm.t("el.datepicker.prevYear")
  2452. },
  2453. on: { click: _vm.prevYear }
  2454. }),
  2455. _c("button", {
  2456. directives: [
  2457. {
  2458. name: "show",
  2459. rawName: "v-show",
  2460. value: _vm.currentView === "date",
  2461. expression: "currentView === 'date'"
  2462. }
  2463. ],
  2464. staticClass:
  2465. "el-picker-panel__icon-btn el-date-picker__prev-btn el-icon-arrow-left",
  2466. attrs: {
  2467. type: "button",
  2468. "aria-label": _vm.t("el.datepicker.prevMonth")
  2469. },
  2470. on: { click: _vm.prevMonth }
  2471. }),
  2472. _c(
  2473. "span",
  2474. {
  2475. staticClass: "el-date-picker__header-label",
  2476. attrs: { role: "button" },
  2477. on: { click: _vm.showYearPicker }
  2478. },
  2479. [_vm._v(_vm._s(_vm.yearLabel))]
  2480. ),
  2481. _c(
  2482. "span",
  2483. {
  2484. directives: [
  2485. {
  2486. name: "show",
  2487. rawName: "v-show",
  2488. value: _vm.currentView === "date",
  2489. expression: "currentView === 'date'"
  2490. }
  2491. ],
  2492. staticClass: "el-date-picker__header-label",
  2493. class: { active: _vm.currentView === "month" },
  2494. attrs: { role: "button" },
  2495. on: { click: _vm.showMonthPicker }
  2496. },
  2497. [
  2498. _vm._v(
  2499. _vm._s(_vm.t("el.datepicker.month" + (_vm.month + 1)))
  2500. )
  2501. ]
  2502. ),
  2503. _c("button", {
  2504. staticClass:
  2505. "el-picker-panel__icon-btn el-date-picker__next-btn el-icon-d-arrow-right",
  2506. attrs: {
  2507. type: "button",
  2508. "aria-label": _vm.t("el.datepicker.nextYear")
  2509. },
  2510. on: { click: _vm.nextYear }
  2511. }),
  2512. _c("button", {
  2513. directives: [
  2514. {
  2515. name: "show",
  2516. rawName: "v-show",
  2517. value: _vm.currentView === "date",
  2518. expression: "currentView === 'date'"
  2519. }
  2520. ],
  2521. staticClass:
  2522. "el-picker-panel__icon-btn el-date-picker__next-btn el-icon-arrow-right",
  2523. attrs: {
  2524. type: "button",
  2525. "aria-label": _vm.t("el.datepicker.nextMonth")
  2526. },
  2527. on: { click: _vm.nextMonth }
  2528. })
  2529. ]
  2530. ),
  2531. _c(
  2532. "div",
  2533. { staticClass: "el-picker-panel__content" },
  2534. [
  2535. _c("date-table", {
  2536. directives: [
  2537. {
  2538. name: "show",
  2539. rawName: "v-show",
  2540. value: _vm.currentView === "date",
  2541. expression: "currentView === 'date'"
  2542. }
  2543. ],
  2544. attrs: {
  2545. "selection-mode": _vm.selectionMode,
  2546. "first-day-of-week": _vm.firstDayOfWeek,
  2547. value: _vm.value,
  2548. "default-value": _vm.defaultValue
  2549. ? new Date(_vm.defaultValue)
  2550. : null,
  2551. date: _vm.date,
  2552. "cell-class-name": _vm.cellClassName,
  2553. "disabled-date": _vm.disabledDate
  2554. },
  2555. on: { pick: _vm.handleDatePick }
  2556. }),
  2557. _c("year-table", {
  2558. directives: [
  2559. {
  2560. name: "show",
  2561. rawName: "v-show",
  2562. value: _vm.currentView === "year",
  2563. expression: "currentView === 'year'"
  2564. }
  2565. ],
  2566. attrs: {
  2567. value: _vm.value,
  2568. "default-value": _vm.defaultValue
  2569. ? new Date(_vm.defaultValue)
  2570. : null,
  2571. date: _vm.date,
  2572. "disabled-date": _vm.disabledDate
  2573. },
  2574. on: { pick: _vm.handleYearPick }
  2575. }),
  2576. _c("month-table", {
  2577. directives: [
  2578. {
  2579. name: "show",
  2580. rawName: "v-show",
  2581. value: _vm.currentView === "month",
  2582. expression: "currentView === 'month'"
  2583. }
  2584. ],
  2585. attrs: {
  2586. value: _vm.value,
  2587. "default-value": _vm.defaultValue
  2588. ? new Date(_vm.defaultValue)
  2589. : null,
  2590. date: _vm.date,
  2591. "disabled-date": _vm.disabledDate
  2592. },
  2593. on: { pick: _vm.handleMonthPick }
  2594. })
  2595. ],
  2596. 1
  2597. )
  2598. ])
  2599. ],
  2600. 2
  2601. ),
  2602. _c(
  2603. "div",
  2604. {
  2605. directives: [
  2606. {
  2607. name: "show",
  2608. rawName: "v-show",
  2609. value: _vm.footerVisible && _vm.currentView === "date",
  2610. expression: "footerVisible && currentView === 'date'"
  2611. }
  2612. ],
  2613. staticClass: "el-picker-panel__footer"
  2614. },
  2615. [
  2616. _c(
  2617. "el-button",
  2618. {
  2619. directives: [
  2620. {
  2621. name: "show",
  2622. rawName: "v-show",
  2623. value: _vm.selectionMode !== "dates",
  2624. expression: "selectionMode !== 'dates'"
  2625. }
  2626. ],
  2627. staticClass: "el-picker-panel__link-btn",
  2628. attrs: { size: "mini", type: "text" },
  2629. on: { click: _vm.changeToNow }
  2630. },
  2631. [
  2632. _vm._v(
  2633. "\n " +
  2634. _vm._s(_vm.t("el.datepicker.now")) +
  2635. "\n "
  2636. )
  2637. ]
  2638. ),
  2639. _c(
  2640. "el-button",
  2641. {
  2642. staticClass: "el-picker-panel__link-btn",
  2643. attrs: { plain: "", size: "mini" },
  2644. on: { click: _vm.confirm }
  2645. },
  2646. [
  2647. _vm._v(
  2648. "\n " +
  2649. _vm._s(_vm.t("el.datepicker.confirm")) +
  2650. "\n "
  2651. )
  2652. ]
  2653. )
  2654. ],
  2655. 1
  2656. )
  2657. ]
  2658. )
  2659. ]
  2660. )
  2661. }
  2662. var staticRenderFns = []
  2663. render._withStripped = true
  2664. // CONCATENATED MODULE: ./packages/date-picker/src/panel/date.vue?vue&type=template&id=2440d4ea&
  2665. // EXTERNAL MODULE: external "element-ui/lib/utils/date-util"
  2666. var date_util_ = __webpack_require__(1);
  2667. // EXTERNAL MODULE: external "element-ui/lib/utils/clickoutside"
  2668. var clickoutside_ = __webpack_require__(12);
  2669. var clickoutside_default = /*#__PURE__*/__webpack_require__.n(clickoutside_);
  2670. // EXTERNAL MODULE: external "element-ui/lib/mixins/locale"
  2671. var locale_ = __webpack_require__(6);
  2672. var locale_default = /*#__PURE__*/__webpack_require__.n(locale_);
  2673. // EXTERNAL MODULE: external "element-ui/lib/input"
  2674. var input_ = __webpack_require__(10);
  2675. var input_default = /*#__PURE__*/__webpack_require__.n(input_);
  2676. // EXTERNAL MODULE: external "element-ui/lib/button"
  2677. var button_ = __webpack_require__(14);
  2678. var button_default = /*#__PURE__*/__webpack_require__.n(button_);
  2679. // EXTERNAL MODULE: ./packages/date-picker/src/panel/time.vue + 4 modules
  2680. var panel_time = __webpack_require__(27);
  2681. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/basic/year-table.vue?vue&type=template&id=c86ab5e0&
  2682. var year_tablevue_type_template_id_c86ab5e0_render = function() {
  2683. var _vm = this
  2684. var _h = _vm.$createElement
  2685. var _c = _vm._self._c || _h
  2686. return _c(
  2687. "table",
  2688. { staticClass: "el-year-table", on: { click: _vm.handleYearTableClick } },
  2689. [
  2690. _c("tbody", [
  2691. _c("tr", [
  2692. _c(
  2693. "td",
  2694. {
  2695. staticClass: "available",
  2696. class: _vm.getCellStyle(_vm.startYear + 0)
  2697. },
  2698. [_c("a", { staticClass: "cell" }, [_vm._v(_vm._s(_vm.startYear))])]
  2699. ),
  2700. _c(
  2701. "td",
  2702. {
  2703. staticClass: "available",
  2704. class: _vm.getCellStyle(_vm.startYear + 1)
  2705. },
  2706. [
  2707. _c("a", { staticClass: "cell" }, [
  2708. _vm._v(_vm._s(_vm.startYear + 1))
  2709. ])
  2710. ]
  2711. ),
  2712. _c(
  2713. "td",
  2714. {
  2715. staticClass: "available",
  2716. class: _vm.getCellStyle(_vm.startYear + 2)
  2717. },
  2718. [
  2719. _c("a", { staticClass: "cell" }, [
  2720. _vm._v(_vm._s(_vm.startYear + 2))
  2721. ])
  2722. ]
  2723. ),
  2724. _c(
  2725. "td",
  2726. {
  2727. staticClass: "available",
  2728. class: _vm.getCellStyle(_vm.startYear + 3)
  2729. },
  2730. [
  2731. _c("a", { staticClass: "cell" }, [
  2732. _vm._v(_vm._s(_vm.startYear + 3))
  2733. ])
  2734. ]
  2735. )
  2736. ]),
  2737. _c("tr", [
  2738. _c(
  2739. "td",
  2740. {
  2741. staticClass: "available",
  2742. class: _vm.getCellStyle(_vm.startYear + 4)
  2743. },
  2744. [
  2745. _c("a", { staticClass: "cell" }, [
  2746. _vm._v(_vm._s(_vm.startYear + 4))
  2747. ])
  2748. ]
  2749. ),
  2750. _c(
  2751. "td",
  2752. {
  2753. staticClass: "available",
  2754. class: _vm.getCellStyle(_vm.startYear + 5)
  2755. },
  2756. [
  2757. _c("a", { staticClass: "cell" }, [
  2758. _vm._v(_vm._s(_vm.startYear + 5))
  2759. ])
  2760. ]
  2761. ),
  2762. _c(
  2763. "td",
  2764. {
  2765. staticClass: "available",
  2766. class: _vm.getCellStyle(_vm.startYear + 6)
  2767. },
  2768. [
  2769. _c("a", { staticClass: "cell" }, [
  2770. _vm._v(_vm._s(_vm.startYear + 6))
  2771. ])
  2772. ]
  2773. ),
  2774. _c(
  2775. "td",
  2776. {
  2777. staticClass: "available",
  2778. class: _vm.getCellStyle(_vm.startYear + 7)
  2779. },
  2780. [
  2781. _c("a", { staticClass: "cell" }, [
  2782. _vm._v(_vm._s(_vm.startYear + 7))
  2783. ])
  2784. ]
  2785. )
  2786. ]),
  2787. _c("tr", [
  2788. _c(
  2789. "td",
  2790. {
  2791. staticClass: "available",
  2792. class: _vm.getCellStyle(_vm.startYear + 8)
  2793. },
  2794. [
  2795. _c("a", { staticClass: "cell" }, [
  2796. _vm._v(_vm._s(_vm.startYear + 8))
  2797. ])
  2798. ]
  2799. ),
  2800. _c(
  2801. "td",
  2802. {
  2803. staticClass: "available",
  2804. class: _vm.getCellStyle(_vm.startYear + 9)
  2805. },
  2806. [
  2807. _c("a", { staticClass: "cell" }, [
  2808. _vm._v(_vm._s(_vm.startYear + 9))
  2809. ])
  2810. ]
  2811. ),
  2812. _c("td"),
  2813. _c("td")
  2814. ])
  2815. ])
  2816. ]
  2817. )
  2818. }
  2819. var year_tablevue_type_template_id_c86ab5e0_staticRenderFns = []
  2820. year_tablevue_type_template_id_c86ab5e0_render._withStripped = true
  2821. // CONCATENATED MODULE: ./packages/date-picker/src/basic/year-table.vue?vue&type=template&id=c86ab5e0&
  2822. // EXTERNAL MODULE: external "element-ui/lib/utils/dom"
  2823. var dom_ = __webpack_require__(2);
  2824. // EXTERNAL MODULE: external "element-ui/lib/utils/util"
  2825. var util_ = __webpack_require__(3);
  2826. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/basic/year-table.vue?vue&type=script&lang=js&
  2827. //
  2828. //
  2829. //
  2830. //
  2831. //
  2832. //
  2833. //
  2834. //
  2835. //
  2836. //
  2837. //
  2838. //
  2839. //
  2840. //
  2841. //
  2842. //
  2843. //
  2844. //
  2845. //
  2846. //
  2847. //
  2848. //
  2849. //
  2850. //
  2851. //
  2852. //
  2853. //
  2854. //
  2855. //
  2856. //
  2857. //
  2858. //
  2859. //
  2860. //
  2861. //
  2862. //
  2863. //
  2864. //
  2865. //
  2866. //
  2867. //
  2868. //
  2869. //
  2870. //
  2871. //
  2872. var year_tablevue_type_script_lang_js_datesInYear = function datesInYear(year) {
  2873. var numOfDays = Object(date_util_["getDayCountOfYear"])(year);
  2874. var firstDay = new Date(year, 0, 1);
  2875. return Object(date_util_["range"])(numOfDays).map(function (n) {
  2876. return Object(date_util_["nextDate"])(firstDay, n);
  2877. });
  2878. };
  2879. /* harmony default export */ var year_tablevue_type_script_lang_js_ = ({
  2880. props: {
  2881. disabledDate: {},
  2882. value: {},
  2883. defaultValue: {
  2884. validator: function validator(val) {
  2885. // null or valid Date Object
  2886. return val === null || val instanceof Date && Object(date_util_["isDate"])(val);
  2887. }
  2888. },
  2889. date: {}
  2890. },
  2891. computed: {
  2892. startYear: function startYear() {
  2893. return Math.floor(this.date.getFullYear() / 10) * 10;
  2894. }
  2895. },
  2896. methods: {
  2897. getCellStyle: function getCellStyle(year) {
  2898. var style = {};
  2899. var today = new Date();
  2900. style.disabled = typeof this.disabledDate === 'function' ? year_tablevue_type_script_lang_js_datesInYear(year).every(this.disabledDate) : false;
  2901. style.current = Object(util_["arrayFindIndex"])(Object(util_["coerceTruthyValueToArray"])(this.value), function (date) {
  2902. return date.getFullYear() === year;
  2903. }) >= 0;
  2904. style.today = today.getFullYear() === year;
  2905. style.default = this.defaultValue && this.defaultValue.getFullYear() === year;
  2906. return style;
  2907. },
  2908. handleYearTableClick: function handleYearTableClick(event) {
  2909. var target = event.target;
  2910. if (target.tagName === 'A') {
  2911. if (Object(dom_["hasClass"])(target.parentNode, 'disabled')) return;
  2912. var year = target.textContent || target.innerText;
  2913. this.$emit('pick', Number(year));
  2914. }
  2915. }
  2916. }
  2917. });
  2918. // CONCATENATED MODULE: ./packages/date-picker/src/basic/year-table.vue?vue&type=script&lang=js&
  2919. /* harmony default export */ var basic_year_tablevue_type_script_lang_js_ = (year_tablevue_type_script_lang_js_);
  2920. // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
  2921. var componentNormalizer = __webpack_require__(0);
  2922. // CONCATENATED MODULE: ./packages/date-picker/src/basic/year-table.vue
  2923. /* normalize component */
  2924. var component = Object(componentNormalizer["a" /* default */])(
  2925. basic_year_tablevue_type_script_lang_js_,
  2926. year_tablevue_type_template_id_c86ab5e0_render,
  2927. year_tablevue_type_template_id_c86ab5e0_staticRenderFns,
  2928. false,
  2929. null,
  2930. null,
  2931. null
  2932. )
  2933. /* hot reload */
  2934. if (false) { var api; }
  2935. component.options.__file = "packages/date-picker/src/basic/year-table.vue"
  2936. /* harmony default export */ var year_table = (component.exports);
  2937. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/basic/month-table.vue?vue&type=template&id=654d4f42&
  2938. var month_tablevue_type_template_id_654d4f42_render = function() {
  2939. var _vm = this
  2940. var _h = _vm.$createElement
  2941. var _c = _vm._self._c || _h
  2942. return _c(
  2943. "table",
  2944. {
  2945. staticClass: "el-month-table",
  2946. on: { click: _vm.handleMonthTableClick, mousemove: _vm.handleMouseMove }
  2947. },
  2948. [
  2949. _c(
  2950. "tbody",
  2951. _vm._l(_vm.rows, function(row, key) {
  2952. return _c(
  2953. "tr",
  2954. { key: key },
  2955. _vm._l(row, function(cell, key) {
  2956. return _c("td", { key: key, class: _vm.getCellStyle(cell) }, [
  2957. _c("div", [
  2958. _c("a", { staticClass: "cell" }, [
  2959. _vm._v(
  2960. _vm._s(
  2961. _vm.t("el.datepicker.months." + _vm.months[cell.text])
  2962. )
  2963. )
  2964. ])
  2965. ])
  2966. ])
  2967. }),
  2968. 0
  2969. )
  2970. }),
  2971. 0
  2972. )
  2973. ]
  2974. )
  2975. }
  2976. var month_tablevue_type_template_id_654d4f42_staticRenderFns = []
  2977. month_tablevue_type_template_id_654d4f42_render._withStripped = true
  2978. // CONCATENATED MODULE: ./packages/date-picker/src/basic/month-table.vue?vue&type=template&id=654d4f42&
  2979. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/basic/month-table.vue?vue&type=script&lang=js&
  2980. //
  2981. //
  2982. //
  2983. //
  2984. //
  2985. //
  2986. //
  2987. //
  2988. //
  2989. //
  2990. //
  2991. //
  2992. //
  2993. //
  2994. var month_tablevue_type_script_lang_js_datesInMonth = function datesInMonth(year, month) {
  2995. var numOfDays = Object(date_util_["getDayCountOfMonth"])(year, month);
  2996. var firstDay = new Date(year, month, 1);
  2997. return Object(date_util_["range"])(numOfDays).map(function (n) {
  2998. return Object(date_util_["nextDate"])(firstDay, n);
  2999. });
  3000. };
  3001. var clearDate = function clearDate(date) {
  3002. return new Date(date.getFullYear(), date.getMonth());
  3003. };
  3004. var getMonthTimestamp = function getMonthTimestamp(time) {
  3005. if (typeof time === 'number' || typeof time === 'string') {
  3006. return clearDate(new Date(time)).getTime();
  3007. } else if (time instanceof Date) {
  3008. return clearDate(time).getTime();
  3009. } else {
  3010. return NaN;
  3011. }
  3012. };
  3013. /* harmony default export */ var month_tablevue_type_script_lang_js_ = ({
  3014. props: {
  3015. disabledDate: {},
  3016. value: {},
  3017. selectionMode: {
  3018. default: 'month'
  3019. },
  3020. minDate: {},
  3021. maxDate: {},
  3022. defaultValue: {
  3023. validator: function validator(val) {
  3024. // null or valid Date Object
  3025. return val === null || Object(date_util_["isDate"])(val) || Array.isArray(val) && val.every(date_util_["isDate"]);
  3026. }
  3027. },
  3028. date: {},
  3029. rangeState: {
  3030. default: function _default() {
  3031. return {
  3032. endDate: null,
  3033. selecting: false
  3034. };
  3035. }
  3036. }
  3037. },
  3038. mixins: [locale_default.a],
  3039. watch: {
  3040. 'rangeState.endDate': function rangeStateEndDate(newVal) {
  3041. this.markRange(this.minDate, newVal);
  3042. },
  3043. minDate: function minDate(newVal, oldVal) {
  3044. if (getMonthTimestamp(newVal) !== getMonthTimestamp(oldVal)) {
  3045. this.markRange(this.minDate, this.maxDate);
  3046. }
  3047. },
  3048. maxDate: function maxDate(newVal, oldVal) {
  3049. if (getMonthTimestamp(newVal) !== getMonthTimestamp(oldVal)) {
  3050. this.markRange(this.minDate, this.maxDate);
  3051. }
  3052. }
  3053. },
  3054. data: function data() {
  3055. return {
  3056. months: ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'],
  3057. tableRows: [[], [], []],
  3058. lastRow: null,
  3059. lastColumn: null
  3060. };
  3061. },
  3062. methods: {
  3063. cellMatchesDate: function cellMatchesDate(cell, date) {
  3064. var value = new Date(date);
  3065. return this.date.getFullYear() === value.getFullYear() && Number(cell.text) === value.getMonth();
  3066. },
  3067. getCellStyle: function getCellStyle(cell) {
  3068. var _this = this;
  3069. var style = {};
  3070. var year = this.date.getFullYear();
  3071. var today = new Date();
  3072. var month = cell.text;
  3073. var defaultValue = this.defaultValue ? Array.isArray(this.defaultValue) ? this.defaultValue : [this.defaultValue] : [];
  3074. style.disabled = typeof this.disabledDate === 'function' ? month_tablevue_type_script_lang_js_datesInMonth(year, month).every(this.disabledDate) : false;
  3075. style.current = Object(util_["arrayFindIndex"])(Object(util_["coerceTruthyValueToArray"])(this.value), function (date) {
  3076. return date.getFullYear() === year && date.getMonth() === month;
  3077. }) >= 0;
  3078. style.today = today.getFullYear() === year && today.getMonth() === month;
  3079. style.default = defaultValue.some(function (date) {
  3080. return _this.cellMatchesDate(cell, date);
  3081. });
  3082. if (cell.inRange) {
  3083. style['in-range'] = true;
  3084. if (cell.start) {
  3085. style['start-date'] = true;
  3086. }
  3087. if (cell.end) {
  3088. style['end-date'] = true;
  3089. }
  3090. }
  3091. return style;
  3092. },
  3093. getMonthOfCell: function getMonthOfCell(month) {
  3094. var year = this.date.getFullYear();
  3095. return new Date(year, month, 1);
  3096. },
  3097. markRange: function markRange(minDate, maxDate) {
  3098. minDate = getMonthTimestamp(minDate);
  3099. maxDate = getMonthTimestamp(maxDate) || minDate;
  3100. var _ref = [Math.min(minDate, maxDate), Math.max(minDate, maxDate)];
  3101. minDate = _ref[0];
  3102. maxDate = _ref[1];
  3103. var rows = this.rows;
  3104. for (var i = 0, k = rows.length; i < k; i++) {
  3105. var row = rows[i];
  3106. for (var j = 0, l = row.length; j < l; j++) {
  3107. var cell = row[j];
  3108. var index = i * 4 + j;
  3109. var time = new Date(this.date.getFullYear(), index).getTime();
  3110. cell.inRange = minDate && time >= minDate && time <= maxDate;
  3111. cell.start = minDate && time === minDate;
  3112. cell.end = maxDate && time === maxDate;
  3113. }
  3114. }
  3115. },
  3116. handleMouseMove: function handleMouseMove(event) {
  3117. if (!this.rangeState.selecting) return;
  3118. var target = event.target;
  3119. if (target.tagName === 'A') {
  3120. target = target.parentNode.parentNode;
  3121. }
  3122. if (target.tagName === 'DIV') {
  3123. target = target.parentNode;
  3124. }
  3125. if (target.tagName !== 'TD') return;
  3126. var row = target.parentNode.rowIndex;
  3127. var column = target.cellIndex;
  3128. // can not select disabled date
  3129. if (this.rows[row][column].disabled) return;
  3130. // only update rangeState when mouse moves to a new cell
  3131. // this avoids frequent Date object creation and improves performance
  3132. if (row !== this.lastRow || column !== this.lastColumn) {
  3133. this.lastRow = row;
  3134. this.lastColumn = column;
  3135. this.$emit('changerange', {
  3136. minDate: this.minDate,
  3137. maxDate: this.maxDate,
  3138. rangeState: {
  3139. selecting: true,
  3140. endDate: this.getMonthOfCell(row * 4 + column)
  3141. }
  3142. });
  3143. }
  3144. },
  3145. handleMonthTableClick: function handleMonthTableClick(event) {
  3146. var target = event.target;
  3147. if (target.tagName === 'A') {
  3148. target = target.parentNode.parentNode;
  3149. }
  3150. if (target.tagName === 'DIV') {
  3151. target = target.parentNode;
  3152. }
  3153. if (target.tagName !== 'TD') return;
  3154. if (Object(dom_["hasClass"])(target, 'disabled')) return;
  3155. var column = target.cellIndex;
  3156. var row = target.parentNode.rowIndex;
  3157. var month = row * 4 + column;
  3158. var newDate = this.getMonthOfCell(month);
  3159. if (this.selectionMode === 'range') {
  3160. if (!this.rangeState.selecting) {
  3161. this.$emit('pick', { minDate: newDate, maxDate: null });
  3162. this.rangeState.selecting = true;
  3163. } else {
  3164. if (newDate >= this.minDate) {
  3165. this.$emit('pick', { minDate: this.minDate, maxDate: newDate });
  3166. } else {
  3167. this.$emit('pick', { minDate: newDate, maxDate: this.minDate });
  3168. }
  3169. this.rangeState.selecting = false;
  3170. }
  3171. } else {
  3172. this.$emit('pick', month);
  3173. }
  3174. }
  3175. },
  3176. computed: {
  3177. rows: function rows() {
  3178. var _this2 = this;
  3179. // TODO: refactory rows / getCellClasses
  3180. var rows = this.tableRows;
  3181. var disabledDate = this.disabledDate;
  3182. var selectedDate = [];
  3183. var now = getMonthTimestamp(new Date());
  3184. for (var i = 0; i < 3; i++) {
  3185. var row = rows[i];
  3186. var _loop = function _loop(j) {
  3187. var cell = row[j];
  3188. if (!cell) {
  3189. cell = { row: i, column: j, type: 'normal', inRange: false, start: false, end: false };
  3190. }
  3191. cell.type = 'normal';
  3192. var index = i * 4 + j;
  3193. var time = new Date(_this2.date.getFullYear(), index).getTime();
  3194. cell.inRange = time >= getMonthTimestamp(_this2.minDate) && time <= getMonthTimestamp(_this2.maxDate);
  3195. cell.start = _this2.minDate && time === getMonthTimestamp(_this2.minDate);
  3196. cell.end = _this2.maxDate && time === getMonthTimestamp(_this2.maxDate);
  3197. var isToday = time === now;
  3198. if (isToday) {
  3199. cell.type = 'today';
  3200. }
  3201. cell.text = index;
  3202. var cellDate = new Date(time);
  3203. cell.disabled = typeof disabledDate === 'function' && disabledDate(cellDate);
  3204. cell.selected = Object(util_["arrayFind"])(selectedDate, function (date) {
  3205. return date.getTime() === cellDate.getTime();
  3206. });
  3207. _this2.$set(row, j, cell);
  3208. };
  3209. for (var j = 0; j < 4; j++) {
  3210. _loop(j);
  3211. }
  3212. }
  3213. return rows;
  3214. }
  3215. }
  3216. });
  3217. // CONCATENATED MODULE: ./packages/date-picker/src/basic/month-table.vue?vue&type=script&lang=js&
  3218. /* harmony default export */ var basic_month_tablevue_type_script_lang_js_ = (month_tablevue_type_script_lang_js_);
  3219. // CONCATENATED MODULE: ./packages/date-picker/src/basic/month-table.vue
  3220. /* normalize component */
  3221. var month_table_component = Object(componentNormalizer["a" /* default */])(
  3222. basic_month_tablevue_type_script_lang_js_,
  3223. month_tablevue_type_template_id_654d4f42_render,
  3224. month_tablevue_type_template_id_654d4f42_staticRenderFns,
  3225. false,
  3226. null,
  3227. null,
  3228. null
  3229. )
  3230. /* hot reload */
  3231. if (false) { var month_table_api; }
  3232. month_table_component.options.__file = "packages/date-picker/src/basic/month-table.vue"
  3233. /* harmony default export */ var month_table = (month_table_component.exports);
  3234. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/basic/date-table.vue?vue&type=template&id=5d1f3341&
  3235. var date_tablevue_type_template_id_5d1f3341_render = function() {
  3236. var _vm = this
  3237. var _h = _vm.$createElement
  3238. var _c = _vm._self._c || _h
  3239. return _c(
  3240. "table",
  3241. {
  3242. staticClass: "el-date-table",
  3243. class: { "is-week-mode": _vm.selectionMode === "week" },
  3244. attrs: { cellspacing: "0", cellpadding: "0" },
  3245. on: { click: _vm.handleClick, mousemove: _vm.handleMouseMove }
  3246. },
  3247. [
  3248. _c(
  3249. "tbody",
  3250. [
  3251. _c(
  3252. "tr",
  3253. [
  3254. _vm.showWeekNumber
  3255. ? _c("th", [_vm._v(_vm._s(_vm.t("el.datepicker.week")))])
  3256. : _vm._e(),
  3257. _vm._l(_vm.WEEKS, function(week, key) {
  3258. return _c("th", { key: key }, [
  3259. _vm._v(_vm._s(_vm.t("el.datepicker.weeks." + week)))
  3260. ])
  3261. })
  3262. ],
  3263. 2
  3264. ),
  3265. _vm._l(_vm.rows, function(row, key) {
  3266. return _c(
  3267. "tr",
  3268. {
  3269. key: key,
  3270. staticClass: "el-date-table__row",
  3271. class: { current: _vm.isWeekActive(row[1]) }
  3272. },
  3273. _vm._l(row, function(cell, key) {
  3274. return _c("td", { key: key, class: _vm.getCellClasses(cell) }, [
  3275. _c("div", [
  3276. _c("span", [
  3277. _vm._v("\n " + _vm._s(cell.text) + "\n ")
  3278. ])
  3279. ])
  3280. ])
  3281. }),
  3282. 0
  3283. )
  3284. })
  3285. ],
  3286. 2
  3287. )
  3288. ]
  3289. )
  3290. }
  3291. var date_tablevue_type_template_id_5d1f3341_staticRenderFns = []
  3292. date_tablevue_type_template_id_5d1f3341_render._withStripped = true
  3293. // CONCATENATED MODULE: ./packages/date-picker/src/basic/date-table.vue?vue&type=template&id=5d1f3341&
  3294. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/basic/date-table.vue?vue&type=script&lang=js&
  3295. //
  3296. //
  3297. //
  3298. //
  3299. //
  3300. //
  3301. //
  3302. //
  3303. //
  3304. //
  3305. //
  3306. //
  3307. //
  3308. //
  3309. //
  3310. //
  3311. //
  3312. //
  3313. //
  3314. //
  3315. //
  3316. //
  3317. //
  3318. //
  3319. //
  3320. //
  3321. //
  3322. //
  3323. //
  3324. //
  3325. //
  3326. //
  3327. //
  3328. var _WEEKS = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'];
  3329. var date_tablevue_type_script_lang_js_getDateTimestamp = function getDateTimestamp(time) {
  3330. if (typeof time === 'number' || typeof time === 'string') {
  3331. return Object(date_util_["clearTime"])(new Date(time)).getTime();
  3332. } else if (time instanceof Date) {
  3333. return Object(date_util_["clearTime"])(time).getTime();
  3334. } else {
  3335. return NaN;
  3336. }
  3337. };
  3338. // remove the first element that satisfies `pred` from arr
  3339. // return a new array if modification occurs
  3340. // return the original array otherwise
  3341. var date_tablevue_type_script_lang_js_removeFromArray = function removeFromArray(arr, pred) {
  3342. var idx = typeof pred === 'function' ? Object(util_["arrayFindIndex"])(arr, pred) : arr.indexOf(pred);
  3343. return idx >= 0 ? [].concat(arr.slice(0, idx), arr.slice(idx + 1)) : arr;
  3344. };
  3345. /* harmony default export */ var date_tablevue_type_script_lang_js_ = ({
  3346. mixins: [locale_default.a],
  3347. props: {
  3348. firstDayOfWeek: {
  3349. default: 7,
  3350. type: Number,
  3351. validator: function validator(val) {
  3352. return val >= 1 && val <= 7;
  3353. }
  3354. },
  3355. value: {},
  3356. defaultValue: {
  3357. validator: function validator(val) {
  3358. // either: null, valid Date object, Array of valid Date objects
  3359. return val === null || Object(date_util_["isDate"])(val) || Array.isArray(val) && val.every(date_util_["isDate"]);
  3360. }
  3361. },
  3362. date: {},
  3363. selectionMode: {
  3364. default: 'day'
  3365. },
  3366. showWeekNumber: {
  3367. type: Boolean,
  3368. default: false
  3369. },
  3370. disabledDate: {},
  3371. cellClassName: {},
  3372. minDate: {},
  3373. maxDate: {},
  3374. rangeState: {
  3375. default: function _default() {
  3376. return {
  3377. endDate: null,
  3378. selecting: false
  3379. };
  3380. }
  3381. }
  3382. },
  3383. computed: {
  3384. offsetDay: function offsetDay() {
  3385. var week = this.firstDayOfWeek;
  3386. // 周日为界限,左右偏移的天数,3217654 例如周一就是 -1,目的是调整前两行日期的位置
  3387. return week > 3 ? 7 - week : -week;
  3388. },
  3389. WEEKS: function WEEKS() {
  3390. var week = this.firstDayOfWeek;
  3391. return _WEEKS.concat(_WEEKS).slice(week, week + 7);
  3392. },
  3393. year: function year() {
  3394. return this.date.getFullYear();
  3395. },
  3396. month: function month() {
  3397. return this.date.getMonth();
  3398. },
  3399. startDate: function startDate() {
  3400. return Object(date_util_["getStartDateOfMonth"])(this.year, this.month);
  3401. },
  3402. rows: function rows() {
  3403. var _this = this;
  3404. // TODO: refactory rows / getCellClasses
  3405. var date = new Date(this.year, this.month, 1);
  3406. var day = Object(date_util_["getFirstDayOfMonth"])(date); // day of first day
  3407. var dateCountOfMonth = Object(date_util_["getDayCountOfMonth"])(date.getFullYear(), date.getMonth());
  3408. var dateCountOfLastMonth = Object(date_util_["getDayCountOfMonth"])(date.getFullYear(), date.getMonth() === 0 ? 11 : date.getMonth() - 1);
  3409. day = day === 0 ? 7 : day;
  3410. var offset = this.offsetDay;
  3411. var rows = this.tableRows;
  3412. var count = 1;
  3413. var startDate = this.startDate;
  3414. var disabledDate = this.disabledDate;
  3415. var cellClassName = this.cellClassName;
  3416. var selectedDate = this.selectionMode === 'dates' ? Object(util_["coerceTruthyValueToArray"])(this.value) : [];
  3417. var now = date_tablevue_type_script_lang_js_getDateTimestamp(new Date());
  3418. for (var i = 0; i < 6; i++) {
  3419. var row = rows[i];
  3420. if (this.showWeekNumber) {
  3421. if (!row[0]) {
  3422. row[0] = { type: 'week', text: Object(date_util_["getWeekNumber"])(Object(date_util_["nextDate"])(startDate, i * 7 + 1)) };
  3423. }
  3424. }
  3425. var _loop = function _loop(j) {
  3426. var cell = row[_this.showWeekNumber ? j + 1 : j];
  3427. if (!cell) {
  3428. cell = { row: i, column: j, type: 'normal', inRange: false, start: false, end: false };
  3429. }
  3430. cell.type = 'normal';
  3431. var index = i * 7 + j;
  3432. var time = Object(date_util_["nextDate"])(startDate, index - offset).getTime();
  3433. cell.inRange = time >= date_tablevue_type_script_lang_js_getDateTimestamp(_this.minDate) && time <= date_tablevue_type_script_lang_js_getDateTimestamp(_this.maxDate);
  3434. cell.start = _this.minDate && time === date_tablevue_type_script_lang_js_getDateTimestamp(_this.minDate);
  3435. cell.end = _this.maxDate && time === date_tablevue_type_script_lang_js_getDateTimestamp(_this.maxDate);
  3436. var isToday = time === now;
  3437. if (isToday) {
  3438. cell.type = 'today';
  3439. }
  3440. if (i >= 0 && i <= 1) {
  3441. var numberOfDaysFromPreviousMonth = day + offset < 0 ? 7 + day + offset : day + offset;
  3442. if (j + i * 7 >= numberOfDaysFromPreviousMonth) {
  3443. cell.text = count++;
  3444. } else {
  3445. cell.text = dateCountOfLastMonth - (numberOfDaysFromPreviousMonth - j % 7) + 1 + i * 7;
  3446. cell.type = 'prev-month';
  3447. }
  3448. } else {
  3449. if (count <= dateCountOfMonth) {
  3450. cell.text = count++;
  3451. } else {
  3452. cell.text = count++ - dateCountOfMonth;
  3453. cell.type = 'next-month';
  3454. }
  3455. }
  3456. var cellDate = new Date(time);
  3457. cell.disabled = typeof disabledDate === 'function' && disabledDate(cellDate);
  3458. cell.selected = Object(util_["arrayFind"])(selectedDate, function (date) {
  3459. return date.getTime() === cellDate.getTime();
  3460. });
  3461. cell.customClass = typeof cellClassName === 'function' && cellClassName(cellDate);
  3462. _this.$set(row, _this.showWeekNumber ? j + 1 : j, cell);
  3463. };
  3464. for (var j = 0; j < 7; j++) {
  3465. _loop(j);
  3466. }
  3467. if (this.selectionMode === 'week') {
  3468. var start = this.showWeekNumber ? 1 : 0;
  3469. var end = this.showWeekNumber ? 7 : 6;
  3470. var isWeekActive = this.isWeekActive(row[start + 1]);
  3471. row[start].inRange = isWeekActive;
  3472. row[start].start = isWeekActive;
  3473. row[end].inRange = isWeekActive;
  3474. row[end].end = isWeekActive;
  3475. }
  3476. }
  3477. return rows;
  3478. }
  3479. },
  3480. watch: {
  3481. 'rangeState.endDate': function rangeStateEndDate(newVal) {
  3482. this.markRange(this.minDate, newVal);
  3483. },
  3484. minDate: function minDate(newVal, oldVal) {
  3485. if (date_tablevue_type_script_lang_js_getDateTimestamp(newVal) !== date_tablevue_type_script_lang_js_getDateTimestamp(oldVal)) {
  3486. this.markRange(this.minDate, this.maxDate);
  3487. }
  3488. },
  3489. maxDate: function maxDate(newVal, oldVal) {
  3490. if (date_tablevue_type_script_lang_js_getDateTimestamp(newVal) !== date_tablevue_type_script_lang_js_getDateTimestamp(oldVal)) {
  3491. this.markRange(this.minDate, this.maxDate);
  3492. }
  3493. }
  3494. },
  3495. data: function data() {
  3496. return {
  3497. tableRows: [[], [], [], [], [], []],
  3498. lastRow: null,
  3499. lastColumn: null
  3500. };
  3501. },
  3502. methods: {
  3503. cellMatchesDate: function cellMatchesDate(cell, date) {
  3504. var value = new Date(date);
  3505. return this.year === value.getFullYear() && this.month === value.getMonth() && Number(cell.text) === value.getDate();
  3506. },
  3507. getCellClasses: function getCellClasses(cell) {
  3508. var _this2 = this;
  3509. var selectionMode = this.selectionMode;
  3510. var defaultValue = this.defaultValue ? Array.isArray(this.defaultValue) ? this.defaultValue : [this.defaultValue] : [];
  3511. var classes = [];
  3512. if ((cell.type === 'normal' || cell.type === 'today') && !cell.disabled) {
  3513. classes.push('available');
  3514. if (cell.type === 'today') {
  3515. classes.push('today');
  3516. }
  3517. } else {
  3518. classes.push(cell.type);
  3519. }
  3520. if (cell.type === 'normal' && defaultValue.some(function (date) {
  3521. return _this2.cellMatchesDate(cell, date);
  3522. })) {
  3523. classes.push('default');
  3524. }
  3525. if (selectionMode === 'day' && (cell.type === 'normal' || cell.type === 'today') && this.cellMatchesDate(cell, this.value)) {
  3526. classes.push('current');
  3527. }
  3528. if (cell.inRange && (cell.type === 'normal' || cell.type === 'today' || this.selectionMode === 'week')) {
  3529. classes.push('in-range');
  3530. if (cell.start) {
  3531. classes.push('start-date');
  3532. }
  3533. if (cell.end) {
  3534. classes.push('end-date');
  3535. }
  3536. }
  3537. if (cell.disabled) {
  3538. classes.push('disabled');
  3539. }
  3540. if (cell.selected) {
  3541. classes.push('selected');
  3542. }
  3543. if (cell.customClass) {
  3544. classes.push(cell.customClass);
  3545. }
  3546. return classes.join(' ');
  3547. },
  3548. getDateOfCell: function getDateOfCell(row, column) {
  3549. var offsetFromStart = row * 7 + (column - (this.showWeekNumber ? 1 : 0)) - this.offsetDay;
  3550. return Object(date_util_["nextDate"])(this.startDate, offsetFromStart);
  3551. },
  3552. isWeekActive: function isWeekActive(cell) {
  3553. if (this.selectionMode !== 'week') return false;
  3554. var newDate = new Date(this.year, this.month, 1);
  3555. var year = newDate.getFullYear();
  3556. var month = newDate.getMonth();
  3557. if (cell.type === 'prev-month') {
  3558. newDate.setMonth(month === 0 ? 11 : month - 1);
  3559. newDate.setFullYear(month === 0 ? year - 1 : year);
  3560. }
  3561. if (cell.type === 'next-month') {
  3562. newDate.setMonth(month === 11 ? 0 : month + 1);
  3563. newDate.setFullYear(month === 11 ? year + 1 : year);
  3564. }
  3565. newDate.setDate(parseInt(cell.text, 10));
  3566. if (Object(date_util_["isDate"])(this.value)) {
  3567. var dayOffset = (this.value.getDay() - this.firstDayOfWeek + 7) % 7 - 1;
  3568. var weekDate = Object(date_util_["prevDate"])(this.value, dayOffset);
  3569. return weekDate.getTime() === newDate.getTime();
  3570. }
  3571. return false;
  3572. },
  3573. markRange: function markRange(minDate, maxDate) {
  3574. minDate = date_tablevue_type_script_lang_js_getDateTimestamp(minDate);
  3575. maxDate = date_tablevue_type_script_lang_js_getDateTimestamp(maxDate) || minDate;
  3576. var _ref = [Math.min(minDate, maxDate), Math.max(minDate, maxDate)];
  3577. minDate = _ref[0];
  3578. maxDate = _ref[1];
  3579. var startDate = this.startDate;
  3580. var rows = this.rows;
  3581. for (var i = 0, k = rows.length; i < k; i++) {
  3582. var row = rows[i];
  3583. for (var j = 0, l = row.length; j < l; j++) {
  3584. if (this.showWeekNumber && j === 0) continue;
  3585. var _cell = row[j];
  3586. var index = i * 7 + j + (this.showWeekNumber ? -1 : 0);
  3587. var time = Object(date_util_["nextDate"])(startDate, index - this.offsetDay).getTime();
  3588. _cell.inRange = minDate && time >= minDate && time <= maxDate;
  3589. _cell.start = minDate && time === minDate;
  3590. _cell.end = maxDate && time === maxDate;
  3591. }
  3592. }
  3593. },
  3594. handleMouseMove: function handleMouseMove(event) {
  3595. if (!this.rangeState.selecting) return;
  3596. var target = event.target;
  3597. if (target.tagName === 'SPAN') {
  3598. target = target.parentNode.parentNode;
  3599. }
  3600. if (target.tagName === 'DIV') {
  3601. target = target.parentNode;
  3602. }
  3603. if (target.tagName !== 'TD') return;
  3604. var row = target.parentNode.rowIndex - 1;
  3605. var column = target.cellIndex;
  3606. // can not select disabled date
  3607. if (this.rows[row][column].disabled) return;
  3608. // only update rangeState when mouse moves to a new cell
  3609. // this avoids frequent Date object creation and improves performance
  3610. if (row !== this.lastRow || column !== this.lastColumn) {
  3611. this.lastRow = row;
  3612. this.lastColumn = column;
  3613. this.$emit('changerange', {
  3614. minDate: this.minDate,
  3615. maxDate: this.maxDate,
  3616. rangeState: {
  3617. selecting: true,
  3618. endDate: this.getDateOfCell(row, column)
  3619. }
  3620. });
  3621. }
  3622. },
  3623. handleClick: function handleClick(event) {
  3624. var target = event.target;
  3625. if (target.tagName === 'SPAN') {
  3626. target = target.parentNode.parentNode;
  3627. }
  3628. if (target.tagName === 'DIV') {
  3629. target = target.parentNode;
  3630. }
  3631. if (target.tagName !== 'TD') return;
  3632. var row = target.parentNode.rowIndex - 1;
  3633. var column = this.selectionMode === 'week' ? 1 : target.cellIndex;
  3634. var cell = this.rows[row][column];
  3635. if (cell.disabled || cell.type === 'week') return;
  3636. var newDate = this.getDateOfCell(row, column);
  3637. if (this.selectionMode === 'range') {
  3638. if (!this.rangeState.selecting) {
  3639. this.$emit('pick', { minDate: newDate, maxDate: null });
  3640. this.rangeState.selecting = true;
  3641. } else {
  3642. if (newDate >= this.minDate) {
  3643. this.$emit('pick', { minDate: this.minDate, maxDate: newDate });
  3644. } else {
  3645. this.$emit('pick', { minDate: newDate, maxDate: this.minDate });
  3646. }
  3647. this.rangeState.selecting = false;
  3648. }
  3649. } else if (this.selectionMode === 'day') {
  3650. this.$emit('pick', newDate);
  3651. } else if (this.selectionMode === 'week') {
  3652. var weekNumber = Object(date_util_["getWeekNumber"])(newDate);
  3653. var value = newDate.getFullYear() + 'w' + weekNumber;
  3654. this.$emit('pick', {
  3655. year: newDate.getFullYear(),
  3656. week: weekNumber,
  3657. value: value,
  3658. date: newDate
  3659. });
  3660. } else if (this.selectionMode === 'dates') {
  3661. var _value = this.value || [];
  3662. var newValue = cell.selected ? date_tablevue_type_script_lang_js_removeFromArray(_value, function (date) {
  3663. return date.getTime() === newDate.getTime();
  3664. }) : [].concat(_value, [newDate]);
  3665. this.$emit('pick', newValue);
  3666. }
  3667. }
  3668. }
  3669. });
  3670. // CONCATENATED MODULE: ./packages/date-picker/src/basic/date-table.vue?vue&type=script&lang=js&
  3671. /* harmony default export */ var basic_date_tablevue_type_script_lang_js_ = (date_tablevue_type_script_lang_js_);
  3672. // CONCATENATED MODULE: ./packages/date-picker/src/basic/date-table.vue
  3673. /* normalize component */
  3674. var date_table_component = Object(componentNormalizer["a" /* default */])(
  3675. basic_date_tablevue_type_script_lang_js_,
  3676. date_tablevue_type_template_id_5d1f3341_render,
  3677. date_tablevue_type_template_id_5d1f3341_staticRenderFns,
  3678. false,
  3679. null,
  3680. null,
  3681. null
  3682. )
  3683. /* hot reload */
  3684. if (false) { var date_table_api; }
  3685. date_table_component.options.__file = "packages/date-picker/src/basic/date-table.vue"
  3686. /* harmony default export */ var date_table = (date_table_component.exports);
  3687. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/panel/date.vue?vue&type=script&lang=js&
  3688. //
  3689. //
  3690. //
  3691. //
  3692. //
  3693. //
  3694. //
  3695. //
  3696. //
  3697. //
  3698. //
  3699. //
  3700. //
  3701. //
  3702. //
  3703. //
  3704. //
  3705. //
  3706. //
  3707. //
  3708. //
  3709. //
  3710. //
  3711. //
  3712. //
  3713. //
  3714. //
  3715. //
  3716. //
  3717. //
  3718. //
  3719. //
  3720. //
  3721. //
  3722. //
  3723. //
  3724. //
  3725. //
  3726. //
  3727. //
  3728. //
  3729. //
  3730. //
  3731. //
  3732. //
  3733. //
  3734. //
  3735. //
  3736. //
  3737. //
  3738. //
  3739. //
  3740. //
  3741. //
  3742. //
  3743. //
  3744. //
  3745. //
  3746. //
  3747. //
  3748. //
  3749. //
  3750. //
  3751. //
  3752. //
  3753. //
  3754. //
  3755. //
  3756. //
  3757. //
  3758. //
  3759. //
  3760. //
  3761. //
  3762. //
  3763. //
  3764. //
  3765. //
  3766. //
  3767. //
  3768. //
  3769. //
  3770. //
  3771. //
  3772. //
  3773. //
  3774. //
  3775. //
  3776. //
  3777. //
  3778. //
  3779. //
  3780. //
  3781. //
  3782. //
  3783. //
  3784. //
  3785. //
  3786. //
  3787. //
  3788. //
  3789. //
  3790. //
  3791. //
  3792. //
  3793. //
  3794. //
  3795. //
  3796. //
  3797. //
  3798. //
  3799. //
  3800. //
  3801. //
  3802. //
  3803. //
  3804. //
  3805. //
  3806. //
  3807. //
  3808. //
  3809. //
  3810. //
  3811. //
  3812. //
  3813. //
  3814. //
  3815. //
  3816. //
  3817. //
  3818. //
  3819. //
  3820. //
  3821. //
  3822. //
  3823. //
  3824. //
  3825. //
  3826. //
  3827. //
  3828. //
  3829. //
  3830. //
  3831. //
  3832. /* harmony default export */ var datevue_type_script_lang_js_ = ({
  3833. mixins: [locale_default.a],
  3834. directives: { Clickoutside: clickoutside_default.a },
  3835. watch: {
  3836. showTime: function showTime(val) {
  3837. var _this = this;
  3838. /* istanbul ignore if */
  3839. if (!val) return;
  3840. this.$nextTick(function (_) {
  3841. var inputElm = _this.$refs.input.$el;
  3842. if (inputElm) {
  3843. _this.pickerWidth = inputElm.getBoundingClientRect().width + 10;
  3844. }
  3845. });
  3846. },
  3847. value: function value(val) {
  3848. if (this.selectionMode === 'dates' && this.value) return;
  3849. if (Object(date_util_["isDate"])(val)) {
  3850. this.date = new Date(val);
  3851. } else {
  3852. this.date = this.getDefaultValue();
  3853. }
  3854. },
  3855. defaultValue: function defaultValue(val) {
  3856. if (!Object(date_util_["isDate"])(this.value)) {
  3857. this.date = val ? new Date(val) : new Date();
  3858. }
  3859. },
  3860. timePickerVisible: function timePickerVisible(val) {
  3861. var _this2 = this;
  3862. if (val) this.$nextTick(function () {
  3863. return _this2.$refs.timepicker.adjustSpinners();
  3864. });
  3865. },
  3866. selectionMode: function selectionMode(newVal) {
  3867. if (newVal === 'month') {
  3868. /* istanbul ignore next */
  3869. if (this.currentView !== 'year' || this.currentView !== 'month') {
  3870. this.currentView = 'month';
  3871. }
  3872. } else if (newVal === 'dates') {
  3873. this.currentView = 'date';
  3874. }
  3875. }
  3876. },
  3877. methods: {
  3878. proxyTimePickerDataProperties: function proxyTimePickerDataProperties() {
  3879. var _this3 = this;
  3880. var format = function format(timeFormat) {
  3881. _this3.$refs.timepicker.format = timeFormat;
  3882. };
  3883. var value = function value(_value) {
  3884. _this3.$refs.timepicker.value = _value;
  3885. };
  3886. var date = function date(_date) {
  3887. _this3.$refs.timepicker.date = _date;
  3888. };
  3889. var selectableRange = function selectableRange(_selectableRange) {
  3890. _this3.$refs.timepicker.selectableRange = _selectableRange;
  3891. };
  3892. this.$watch('value', value);
  3893. this.$watch('date', date);
  3894. this.$watch('selectableRange', selectableRange);
  3895. format(this.timeFormat);
  3896. value(this.value);
  3897. date(this.date);
  3898. selectableRange(this.selectableRange);
  3899. },
  3900. handleClear: function handleClear() {
  3901. this.date = this.getDefaultValue();
  3902. this.$emit('pick', null);
  3903. },
  3904. emit: function emit(value) {
  3905. var _this4 = this;
  3906. for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  3907. args[_key - 1] = arguments[_key];
  3908. }
  3909. if (!value) {
  3910. this.$emit.apply(this, ['pick', value].concat(args));
  3911. } else if (Array.isArray(value)) {
  3912. var dates = value.map(function (date) {
  3913. return _this4.showTime ? Object(date_util_["clearMilliseconds"])(date) : Object(date_util_["clearTime"])(date);
  3914. });
  3915. this.$emit.apply(this, ['pick', dates].concat(args));
  3916. } else {
  3917. this.$emit.apply(this, ['pick', this.showTime ? Object(date_util_["clearMilliseconds"])(value) : Object(date_util_["clearTime"])(value)].concat(args));
  3918. }
  3919. this.userInputDate = null;
  3920. this.userInputTime = null;
  3921. },
  3922. // resetDate() {
  3923. // this.date = new Date(this.date);
  3924. // },
  3925. showMonthPicker: function showMonthPicker() {
  3926. this.currentView = 'month';
  3927. },
  3928. showYearPicker: function showYearPicker() {
  3929. this.currentView = 'year';
  3930. },
  3931. // XXX: 没用到
  3932. // handleLabelClick() {
  3933. // if (this.currentView === 'date') {
  3934. // this.showMonthPicker();
  3935. // } else if (this.currentView === 'month') {
  3936. // this.showYearPicker();
  3937. // }
  3938. // },
  3939. prevMonth: function prevMonth() {
  3940. this.date = Object(date_util_["prevMonth"])(this.date);
  3941. },
  3942. nextMonth: function nextMonth() {
  3943. this.date = Object(date_util_["nextMonth"])(this.date);
  3944. },
  3945. prevYear: function prevYear() {
  3946. if (this.currentView === 'year') {
  3947. this.date = Object(date_util_["prevYear"])(this.date, 10);
  3948. } else {
  3949. this.date = Object(date_util_["prevYear"])(this.date);
  3950. }
  3951. },
  3952. nextYear: function nextYear() {
  3953. if (this.currentView === 'year') {
  3954. this.date = Object(date_util_["nextYear"])(this.date, 10);
  3955. } else {
  3956. this.date = Object(date_util_["nextYear"])(this.date);
  3957. }
  3958. },
  3959. handleShortcutClick: function handleShortcutClick(shortcut) {
  3960. if (shortcut.onClick) {
  3961. shortcut.onClick(this);
  3962. }
  3963. },
  3964. handleTimePick: function handleTimePick(value, visible, first) {
  3965. if (Object(date_util_["isDate"])(value)) {
  3966. var newDate = this.value ? Object(date_util_["modifyTime"])(this.value, value.getHours(), value.getMinutes(), value.getSeconds()) : Object(date_util_["modifyWithTimeString"])(this.getDefaultValue(), this.defaultTime);
  3967. this.date = newDate;
  3968. this.emit(this.date, true);
  3969. } else {
  3970. this.emit(value, true);
  3971. }
  3972. if (!first) {
  3973. this.timePickerVisible = visible;
  3974. }
  3975. },
  3976. handleTimePickClose: function handleTimePickClose() {
  3977. this.timePickerVisible = false;
  3978. },
  3979. handleMonthPick: function handleMonthPick(month) {
  3980. if (this.selectionMode === 'month') {
  3981. this.date = Object(date_util_["modifyDate"])(this.date, this.year, month, 1);
  3982. this.emit(this.date);
  3983. } else {
  3984. this.date = Object(date_util_["changeYearMonthAndClampDate"])(this.date, this.year, month);
  3985. // TODO: should emit intermediate value ??
  3986. // this.emit(this.date);
  3987. this.currentView = 'date';
  3988. }
  3989. },
  3990. handleDatePick: function handleDatePick(value) {
  3991. if (this.selectionMode === 'day') {
  3992. var newDate = this.value ? Object(date_util_["modifyDate"])(this.value, value.getFullYear(), value.getMonth(), value.getDate()) : Object(date_util_["modifyWithTimeString"])(value, this.defaultTime);
  3993. // change default time while out of selectableRange
  3994. if (!this.checkDateWithinRange(newDate)) {
  3995. newDate = Object(date_util_["modifyDate"])(this.selectableRange[0][0], value.getFullYear(), value.getMonth(), value.getDate());
  3996. }
  3997. this.date = newDate;
  3998. this.emit(this.date, this.showTime);
  3999. } else if (this.selectionMode === 'week') {
  4000. this.emit(value.date);
  4001. } else if (this.selectionMode === 'dates') {
  4002. this.emit(value, true); // set false to keep panel open
  4003. }
  4004. },
  4005. handleYearPick: function handleYearPick(year) {
  4006. if (this.selectionMode === 'year') {
  4007. this.date = Object(date_util_["modifyDate"])(this.date, year, 0, 1);
  4008. this.emit(this.date);
  4009. } else {
  4010. this.date = Object(date_util_["changeYearMonthAndClampDate"])(this.date, year, this.month);
  4011. // TODO: should emit intermediate value ??
  4012. // this.emit(this.date, true);
  4013. this.currentView = 'month';
  4014. }
  4015. },
  4016. changeToNow: function changeToNow() {
  4017. // NOTE: not a permanent solution
  4018. // consider disable "now" button in the future
  4019. if ((!this.disabledDate || !this.disabledDate(new Date())) && this.checkDateWithinRange(new Date())) {
  4020. this.date = new Date();
  4021. this.emit(this.date);
  4022. }
  4023. },
  4024. confirm: function confirm() {
  4025. if (this.selectionMode === 'dates') {
  4026. this.emit(this.value);
  4027. } else {
  4028. // value were emitted in handle{Date,Time}Pick, nothing to update here
  4029. // deal with the scenario where: user opens the picker, then confirm without doing anything
  4030. var value = this.value ? this.value : Object(date_util_["modifyWithTimeString"])(this.getDefaultValue(), this.defaultTime);
  4031. this.date = new Date(value); // refresh date
  4032. this.emit(value);
  4033. }
  4034. },
  4035. resetView: function resetView() {
  4036. if (this.selectionMode === 'month') {
  4037. this.currentView = 'month';
  4038. } else if (this.selectionMode === 'year') {
  4039. this.currentView = 'year';
  4040. } else {
  4041. this.currentView = 'date';
  4042. }
  4043. },
  4044. handleEnter: function handleEnter() {
  4045. document.body.addEventListener('keydown', this.handleKeydown);
  4046. },
  4047. handleLeave: function handleLeave() {
  4048. this.$emit('dodestroy');
  4049. document.body.removeEventListener('keydown', this.handleKeydown);
  4050. },
  4051. handleKeydown: function handleKeydown(event) {
  4052. var keyCode = event.keyCode;
  4053. var list = [38, 40, 37, 39];
  4054. if (this.visible && !this.timePickerVisible) {
  4055. if (list.indexOf(keyCode) !== -1) {
  4056. this.handleKeyControl(keyCode);
  4057. event.stopPropagation();
  4058. event.preventDefault();
  4059. }
  4060. if (keyCode === 13 && this.userInputDate === null && this.userInputTime === null) {
  4061. // Enter
  4062. this.emit(this.date, false);
  4063. }
  4064. }
  4065. },
  4066. handleKeyControl: function handleKeyControl(keyCode) {
  4067. var mapping = {
  4068. 'year': {
  4069. 38: -4, 40: 4, 37: -1, 39: 1, offset: function offset(date, step) {
  4070. return date.setFullYear(date.getFullYear() + step);
  4071. }
  4072. },
  4073. 'month': {
  4074. 38: -4, 40: 4, 37: -1, 39: 1, offset: function offset(date, step) {
  4075. return date.setMonth(date.getMonth() + step);
  4076. }
  4077. },
  4078. 'week': {
  4079. 38: -1, 40: 1, 37: -1, 39: 1, offset: function offset(date, step) {
  4080. return date.setDate(date.getDate() + step * 7);
  4081. }
  4082. },
  4083. 'day': {
  4084. 38: -7, 40: 7, 37: -1, 39: 1, offset: function offset(date, step) {
  4085. return date.setDate(date.getDate() + step);
  4086. }
  4087. }
  4088. };
  4089. var mode = this.selectionMode;
  4090. var year = 3.1536e10;
  4091. var now = this.date.getTime();
  4092. var newDate = new Date(this.date.getTime());
  4093. while (Math.abs(now - newDate.getTime()) <= year) {
  4094. var map = mapping[mode];
  4095. map.offset(newDate, map[keyCode]);
  4096. if (typeof this.disabledDate === 'function' && this.disabledDate(newDate)) {
  4097. continue;
  4098. }
  4099. this.date = newDate;
  4100. this.$emit('pick', newDate, true);
  4101. break;
  4102. }
  4103. },
  4104. handleVisibleTimeChange: function handleVisibleTimeChange(value) {
  4105. var time = Object(date_util_["parseDate"])(value, this.timeFormat);
  4106. if (time && this.checkDateWithinRange(time)) {
  4107. this.date = Object(date_util_["modifyDate"])(time, this.year, this.month, this.monthDate);
  4108. this.userInputTime = null;
  4109. this.$refs.timepicker.value = this.date;
  4110. this.timePickerVisible = false;
  4111. this.emit(this.date, true);
  4112. }
  4113. },
  4114. handleVisibleDateChange: function handleVisibleDateChange(value) {
  4115. var date = Object(date_util_["parseDate"])(value, this.dateFormat);
  4116. if (date) {
  4117. if (typeof this.disabledDate === 'function' && this.disabledDate(date)) {
  4118. return;
  4119. }
  4120. this.date = Object(date_util_["modifyTime"])(date, this.date.getHours(), this.date.getMinutes(), this.date.getSeconds());
  4121. this.userInputDate = null;
  4122. this.resetView();
  4123. this.emit(this.date, true);
  4124. }
  4125. },
  4126. isValidValue: function isValidValue(value) {
  4127. return value && !isNaN(value) && (typeof this.disabledDate === 'function' ? !this.disabledDate(value) : true) && this.checkDateWithinRange(value);
  4128. },
  4129. getDefaultValue: function getDefaultValue() {
  4130. // if default-value is set, return it
  4131. // otherwise, return now (the moment this method gets called)
  4132. return this.defaultValue ? new Date(this.defaultValue) : new Date();
  4133. },
  4134. checkDateWithinRange: function checkDateWithinRange(date) {
  4135. return this.selectableRange.length > 0 ? Object(date_util_["timeWithinRange"])(date, this.selectableRange, this.format || 'HH:mm:ss') : true;
  4136. }
  4137. },
  4138. components: {
  4139. TimePicker: panel_time["a" /* default */], YearTable: year_table, MonthTable: month_table, DateTable: date_table, ElInput: input_default.a, ElButton: button_default.a
  4140. },
  4141. data: function data() {
  4142. return {
  4143. popperClass: '',
  4144. date: new Date(),
  4145. value: '',
  4146. defaultValue: null, // use getDefaultValue() for time computation
  4147. defaultTime: null,
  4148. showTime: false,
  4149. selectionMode: 'day',
  4150. shortcuts: '',
  4151. visible: false,
  4152. currentView: 'date',
  4153. disabledDate: '',
  4154. cellClassName: '',
  4155. selectableRange: [],
  4156. firstDayOfWeek: 7,
  4157. showWeekNumber: false,
  4158. timePickerVisible: false,
  4159. format: '',
  4160. arrowControl: false,
  4161. userInputDate: null,
  4162. userInputTime: null
  4163. };
  4164. },
  4165. computed: {
  4166. year: function year() {
  4167. return this.date.getFullYear();
  4168. },
  4169. month: function month() {
  4170. return this.date.getMonth();
  4171. },
  4172. week: function week() {
  4173. return Object(date_util_["getWeekNumber"])(this.date);
  4174. },
  4175. monthDate: function monthDate() {
  4176. return this.date.getDate();
  4177. },
  4178. footerVisible: function footerVisible() {
  4179. return this.showTime || this.selectionMode === 'dates';
  4180. },
  4181. visibleTime: function visibleTime() {
  4182. if (this.userInputTime !== null) {
  4183. return this.userInputTime;
  4184. } else {
  4185. return Object(date_util_["formatDate"])(this.value || this.defaultValue, this.timeFormat);
  4186. }
  4187. },
  4188. visibleDate: function visibleDate() {
  4189. if (this.userInputDate !== null) {
  4190. return this.userInputDate;
  4191. } else {
  4192. return Object(date_util_["formatDate"])(this.value || this.defaultValue, this.dateFormat);
  4193. }
  4194. },
  4195. yearLabel: function yearLabel() {
  4196. var yearTranslation = this.t('el.datepicker.year');
  4197. if (this.currentView === 'year') {
  4198. var startYear = Math.floor(this.year / 10) * 10;
  4199. if (yearTranslation) {
  4200. return startYear + ' ' + yearTranslation + ' - ' + (startYear + 9) + ' ' + yearTranslation;
  4201. }
  4202. return startYear + ' - ' + (startYear + 9);
  4203. }
  4204. return this.year + ' ' + yearTranslation;
  4205. },
  4206. timeFormat: function timeFormat() {
  4207. if (this.format) {
  4208. return Object(date_util_["extractTimeFormat"])(this.format);
  4209. } else {
  4210. return 'HH:mm:ss';
  4211. }
  4212. },
  4213. dateFormat: function dateFormat() {
  4214. if (this.format) {
  4215. return Object(date_util_["extractDateFormat"])(this.format);
  4216. } else {
  4217. return 'yyyy-MM-dd';
  4218. }
  4219. }
  4220. }
  4221. });
  4222. // CONCATENATED MODULE: ./packages/date-picker/src/panel/date.vue?vue&type=script&lang=js&
  4223. /* harmony default export */ var panel_datevue_type_script_lang_js_ = (datevue_type_script_lang_js_);
  4224. // CONCATENATED MODULE: ./packages/date-picker/src/panel/date.vue
  4225. /* normalize component */
  4226. var date_component = Object(componentNormalizer["a" /* default */])(
  4227. panel_datevue_type_script_lang_js_,
  4228. render,
  4229. staticRenderFns,
  4230. false,
  4231. null,
  4232. null,
  4233. null
  4234. )
  4235. /* hot reload */
  4236. if (false) { var date_api; }
  4237. date_component.options.__file = "packages/date-picker/src/panel/date.vue"
  4238. /* harmony default export */ var panel_date = (date_component.exports);
  4239. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/panel/date-range.vue?vue&type=template&id=2652849a&
  4240. var date_rangevue_type_template_id_2652849a_render = function() {
  4241. var _vm = this
  4242. var _h = _vm.$createElement
  4243. var _c = _vm._self._c || _h
  4244. return _c(
  4245. "transition",
  4246. {
  4247. attrs: { name: "el-zoom-in-top" },
  4248. on: {
  4249. "after-leave": function($event) {
  4250. _vm.$emit("dodestroy")
  4251. }
  4252. }
  4253. },
  4254. [
  4255. _c(
  4256. "div",
  4257. {
  4258. directives: [
  4259. {
  4260. name: "show",
  4261. rawName: "v-show",
  4262. value: _vm.visible,
  4263. expression: "visible"
  4264. }
  4265. ],
  4266. staticClass: "el-picker-panel el-date-range-picker el-popper",
  4267. class: [
  4268. {
  4269. "has-sidebar": _vm.$slots.sidebar || _vm.shortcuts,
  4270. "has-time": _vm.showTime
  4271. },
  4272. _vm.popperClass
  4273. ]
  4274. },
  4275. [
  4276. _c(
  4277. "div",
  4278. { staticClass: "el-picker-panel__body-wrapper" },
  4279. [
  4280. _vm._t("sidebar"),
  4281. _vm.shortcuts
  4282. ? _c(
  4283. "div",
  4284. { staticClass: "el-picker-panel__sidebar" },
  4285. _vm._l(_vm.shortcuts, function(shortcut, key) {
  4286. return _c(
  4287. "button",
  4288. {
  4289. key: key,
  4290. staticClass: "el-picker-panel__shortcut",
  4291. attrs: { type: "button" },
  4292. on: {
  4293. click: function($event) {
  4294. _vm.handleShortcutClick(shortcut)
  4295. }
  4296. }
  4297. },
  4298. [_vm._v(_vm._s(shortcut.text))]
  4299. )
  4300. }),
  4301. 0
  4302. )
  4303. : _vm._e(),
  4304. _c("div", { staticClass: "el-picker-panel__body" }, [
  4305. _vm.showTime
  4306. ? _c(
  4307. "div",
  4308. { staticClass: "el-date-range-picker__time-header" },
  4309. [
  4310. _c(
  4311. "span",
  4312. { staticClass: "el-date-range-picker__editors-wrap" },
  4313. [
  4314. _c(
  4315. "span",
  4316. {
  4317. staticClass:
  4318. "el-date-range-picker__time-picker-wrap"
  4319. },
  4320. [
  4321. _c("el-input", {
  4322. ref: "minInput",
  4323. staticClass: "el-date-range-picker__editor",
  4324. attrs: {
  4325. size: "small",
  4326. disabled: _vm.rangeState.selecting,
  4327. placeholder: _vm.t(
  4328. "el.datepicker.startDate"
  4329. ),
  4330. value: _vm.minVisibleDate
  4331. },
  4332. on: {
  4333. input: function(val) {
  4334. return _vm.handleDateInput(val, "min")
  4335. },
  4336. change: function(val) {
  4337. return _vm.handleDateChange(val, "min")
  4338. }
  4339. }
  4340. })
  4341. ],
  4342. 1
  4343. ),
  4344. _c(
  4345. "span",
  4346. {
  4347. directives: [
  4348. {
  4349. name: "clickoutside",
  4350. rawName: "v-clickoutside",
  4351. value: _vm.handleMinTimeClose,
  4352. expression: "handleMinTimeClose"
  4353. }
  4354. ],
  4355. staticClass:
  4356. "el-date-range-picker__time-picker-wrap"
  4357. },
  4358. [
  4359. _c("el-input", {
  4360. staticClass: "el-date-range-picker__editor",
  4361. attrs: {
  4362. size: "small",
  4363. disabled: _vm.rangeState.selecting,
  4364. placeholder: _vm.t(
  4365. "el.datepicker.startTime"
  4366. ),
  4367. value: _vm.minVisibleTime
  4368. },
  4369. on: {
  4370. focus: function($event) {
  4371. _vm.minTimePickerVisible = true
  4372. },
  4373. input: function(val) {
  4374. return _vm.handleTimeInput(val, "min")
  4375. },
  4376. change: function(val) {
  4377. return _vm.handleTimeChange(val, "min")
  4378. }
  4379. }
  4380. }),
  4381. _c("time-picker", {
  4382. ref: "minTimePicker",
  4383. attrs: {
  4384. "time-arrow-control": _vm.arrowControl,
  4385. visible: _vm.minTimePickerVisible
  4386. },
  4387. on: {
  4388. pick: _vm.handleMinTimePick,
  4389. mounted: function($event) {
  4390. _vm.$refs.minTimePicker.format =
  4391. _vm.timeFormat
  4392. }
  4393. }
  4394. })
  4395. ],
  4396. 1
  4397. )
  4398. ]
  4399. ),
  4400. _c("span", { staticClass: "el-icon-arrow-right" }),
  4401. _c(
  4402. "span",
  4403. {
  4404. staticClass:
  4405. "el-date-range-picker__editors-wrap is-right"
  4406. },
  4407. [
  4408. _c(
  4409. "span",
  4410. {
  4411. staticClass:
  4412. "el-date-range-picker__time-picker-wrap"
  4413. },
  4414. [
  4415. _c("el-input", {
  4416. staticClass: "el-date-range-picker__editor",
  4417. attrs: {
  4418. size: "small",
  4419. disabled: _vm.rangeState.selecting,
  4420. placeholder: _vm.t("el.datepicker.endDate"),
  4421. value: _vm.maxVisibleDate,
  4422. readonly: !_vm.minDate
  4423. },
  4424. on: {
  4425. input: function(val) {
  4426. return _vm.handleDateInput(val, "max")
  4427. },
  4428. change: function(val) {
  4429. return _vm.handleDateChange(val, "max")
  4430. }
  4431. }
  4432. })
  4433. ],
  4434. 1
  4435. ),
  4436. _c(
  4437. "span",
  4438. {
  4439. directives: [
  4440. {
  4441. name: "clickoutside",
  4442. rawName: "v-clickoutside",
  4443. value: _vm.handleMaxTimeClose,
  4444. expression: "handleMaxTimeClose"
  4445. }
  4446. ],
  4447. staticClass:
  4448. "el-date-range-picker__time-picker-wrap"
  4449. },
  4450. [
  4451. _c("el-input", {
  4452. staticClass: "el-date-range-picker__editor",
  4453. attrs: {
  4454. size: "small",
  4455. disabled: _vm.rangeState.selecting,
  4456. placeholder: _vm.t("el.datepicker.endTime"),
  4457. value: _vm.maxVisibleTime,
  4458. readonly: !_vm.minDate
  4459. },
  4460. on: {
  4461. focus: function($event) {
  4462. _vm.minDate &&
  4463. (_vm.maxTimePickerVisible = true)
  4464. },
  4465. input: function(val) {
  4466. return _vm.handleTimeInput(val, "max")
  4467. },
  4468. change: function(val) {
  4469. return _vm.handleTimeChange(val, "max")
  4470. }
  4471. }
  4472. }),
  4473. _c("time-picker", {
  4474. ref: "maxTimePicker",
  4475. attrs: {
  4476. "time-arrow-control": _vm.arrowControl,
  4477. visible: _vm.maxTimePickerVisible
  4478. },
  4479. on: {
  4480. pick: _vm.handleMaxTimePick,
  4481. mounted: function($event) {
  4482. _vm.$refs.maxTimePicker.format =
  4483. _vm.timeFormat
  4484. }
  4485. }
  4486. })
  4487. ],
  4488. 1
  4489. )
  4490. ]
  4491. )
  4492. ]
  4493. )
  4494. : _vm._e(),
  4495. _c(
  4496. "div",
  4497. {
  4498. staticClass:
  4499. "el-picker-panel__content el-date-range-picker__content is-left"
  4500. },
  4501. [
  4502. _c("div", { staticClass: "el-date-range-picker__header" }, [
  4503. _c("button", {
  4504. staticClass:
  4505. "el-picker-panel__icon-btn el-icon-d-arrow-left",
  4506. attrs: { type: "button" },
  4507. on: { click: _vm.leftPrevYear }
  4508. }),
  4509. _c("button", {
  4510. staticClass:
  4511. "el-picker-panel__icon-btn el-icon-arrow-left",
  4512. attrs: { type: "button" },
  4513. on: { click: _vm.leftPrevMonth }
  4514. }),
  4515. _vm.unlinkPanels
  4516. ? _c("button", {
  4517. staticClass:
  4518. "el-picker-panel__icon-btn el-icon-d-arrow-right",
  4519. class: { "is-disabled": !_vm.enableYearArrow },
  4520. attrs: {
  4521. type: "button",
  4522. disabled: !_vm.enableYearArrow
  4523. },
  4524. on: { click: _vm.leftNextYear }
  4525. })
  4526. : _vm._e(),
  4527. _vm.unlinkPanels
  4528. ? _c("button", {
  4529. staticClass:
  4530. "el-picker-panel__icon-btn el-icon-arrow-right",
  4531. class: { "is-disabled": !_vm.enableMonthArrow },
  4532. attrs: {
  4533. type: "button",
  4534. disabled: !_vm.enableMonthArrow
  4535. },
  4536. on: { click: _vm.leftNextMonth }
  4537. })
  4538. : _vm._e(),
  4539. _c("div", [_vm._v(_vm._s(_vm.leftLabel))])
  4540. ]),
  4541. _c("date-table", {
  4542. attrs: {
  4543. "selection-mode": "range",
  4544. date: _vm.leftDate,
  4545. "default-value": _vm.defaultValue,
  4546. "min-date": _vm.minDate,
  4547. "max-date": _vm.maxDate,
  4548. "range-state": _vm.rangeState,
  4549. "disabled-date": _vm.disabledDate,
  4550. "cell-class-name": _vm.cellClassName,
  4551. "first-day-of-week": _vm.firstDayOfWeek
  4552. },
  4553. on: {
  4554. changerange: _vm.handleChangeRange,
  4555. pick: _vm.handleRangePick
  4556. }
  4557. })
  4558. ],
  4559. 1
  4560. ),
  4561. _c(
  4562. "div",
  4563. {
  4564. staticClass:
  4565. "el-picker-panel__content el-date-range-picker__content is-right"
  4566. },
  4567. [
  4568. _c("div", { staticClass: "el-date-range-picker__header" }, [
  4569. _vm.unlinkPanels
  4570. ? _c("button", {
  4571. staticClass:
  4572. "el-picker-panel__icon-btn el-icon-d-arrow-left",
  4573. class: { "is-disabled": !_vm.enableYearArrow },
  4574. attrs: {
  4575. type: "button",
  4576. disabled: !_vm.enableYearArrow
  4577. },
  4578. on: { click: _vm.rightPrevYear }
  4579. })
  4580. : _vm._e(),
  4581. _vm.unlinkPanels
  4582. ? _c("button", {
  4583. staticClass:
  4584. "el-picker-panel__icon-btn el-icon-arrow-left",
  4585. class: { "is-disabled": !_vm.enableMonthArrow },
  4586. attrs: {
  4587. type: "button",
  4588. disabled: !_vm.enableMonthArrow
  4589. },
  4590. on: { click: _vm.rightPrevMonth }
  4591. })
  4592. : _vm._e(),
  4593. _c("button", {
  4594. staticClass:
  4595. "el-picker-panel__icon-btn el-icon-d-arrow-right",
  4596. attrs: { type: "button" },
  4597. on: { click: _vm.rightNextYear }
  4598. }),
  4599. _c("button", {
  4600. staticClass:
  4601. "el-picker-panel__icon-btn el-icon-arrow-right",
  4602. attrs: { type: "button" },
  4603. on: { click: _vm.rightNextMonth }
  4604. }),
  4605. _c("div", [_vm._v(_vm._s(_vm.rightLabel))])
  4606. ]),
  4607. _c("date-table", {
  4608. attrs: {
  4609. "selection-mode": "range",
  4610. date: _vm.rightDate,
  4611. "default-value": _vm.defaultValue,
  4612. "min-date": _vm.minDate,
  4613. "max-date": _vm.maxDate,
  4614. "range-state": _vm.rangeState,
  4615. "disabled-date": _vm.disabledDate,
  4616. "cell-class-name": _vm.cellClassName,
  4617. "first-day-of-week": _vm.firstDayOfWeek
  4618. },
  4619. on: {
  4620. changerange: _vm.handleChangeRange,
  4621. pick: _vm.handleRangePick
  4622. }
  4623. })
  4624. ],
  4625. 1
  4626. )
  4627. ])
  4628. ],
  4629. 2
  4630. ),
  4631. _vm.showTime
  4632. ? _c(
  4633. "div",
  4634. { staticClass: "el-picker-panel__footer" },
  4635. [
  4636. _c(
  4637. "el-button",
  4638. {
  4639. staticClass: "el-picker-panel__link-btn",
  4640. attrs: { size: "mini", type: "text" },
  4641. on: { click: _vm.handleClear }
  4642. },
  4643. [
  4644. _vm._v(
  4645. "\n " +
  4646. _vm._s(_vm.t("el.datepicker.clear")) +
  4647. "\n "
  4648. )
  4649. ]
  4650. ),
  4651. _c(
  4652. "el-button",
  4653. {
  4654. staticClass: "el-picker-panel__link-btn",
  4655. attrs: {
  4656. plain: "",
  4657. size: "mini",
  4658. disabled: _vm.btnDisabled
  4659. },
  4660. on: {
  4661. click: function($event) {
  4662. _vm.handleConfirm(false)
  4663. }
  4664. }
  4665. },
  4666. [
  4667. _vm._v(
  4668. "\n " +
  4669. _vm._s(_vm.t("el.datepicker.confirm")) +
  4670. "\n "
  4671. )
  4672. ]
  4673. )
  4674. ],
  4675. 1
  4676. )
  4677. : _vm._e()
  4678. ]
  4679. )
  4680. ]
  4681. )
  4682. }
  4683. var date_rangevue_type_template_id_2652849a_staticRenderFns = []
  4684. date_rangevue_type_template_id_2652849a_render._withStripped = true
  4685. // CONCATENATED MODULE: ./packages/date-picker/src/panel/date-range.vue?vue&type=template&id=2652849a&
  4686. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/panel/date-range.vue?vue&type=script&lang=js&
  4687. //
  4688. //
  4689. //
  4690. //
  4691. //
  4692. //
  4693. //
  4694. //
  4695. //
  4696. //
  4697. //
  4698. //
  4699. //
  4700. //
  4701. //
  4702. //
  4703. //
  4704. //
  4705. //
  4706. //
  4707. //
  4708. //
  4709. //
  4710. //
  4711. //
  4712. //
  4713. //
  4714. //
  4715. //
  4716. //
  4717. //
  4718. //
  4719. //
  4720. //
  4721. //
  4722. //
  4723. //
  4724. //
  4725. //
  4726. //
  4727. //
  4728. //
  4729. //
  4730. //
  4731. //
  4732. //
  4733. //
  4734. //
  4735. //
  4736. //
  4737. //
  4738. //
  4739. //
  4740. //
  4741. //
  4742. //
  4743. //
  4744. //
  4745. //
  4746. //
  4747. //
  4748. //
  4749. //
  4750. //
  4751. //
  4752. //
  4753. //
  4754. //
  4755. //
  4756. //
  4757. //
  4758. //
  4759. //
  4760. //
  4761. //
  4762. //
  4763. //
  4764. //
  4765. //
  4766. //
  4767. //
  4768. //
  4769. //
  4770. //
  4771. //
  4772. //
  4773. //
  4774. //
  4775. //
  4776. //
  4777. //
  4778. //
  4779. //
  4780. //
  4781. //
  4782. //
  4783. //
  4784. //
  4785. //
  4786. //
  4787. //
  4788. //
  4789. //
  4790. //
  4791. //
  4792. //
  4793. //
  4794. //
  4795. //
  4796. //
  4797. //
  4798. //
  4799. //
  4800. //
  4801. //
  4802. //
  4803. //
  4804. //
  4805. //
  4806. //
  4807. //
  4808. //
  4809. //
  4810. //
  4811. //
  4812. //
  4813. //
  4814. //
  4815. //
  4816. //
  4817. //
  4818. //
  4819. //
  4820. //
  4821. //
  4822. //
  4823. //
  4824. //
  4825. //
  4826. //
  4827. //
  4828. //
  4829. //
  4830. //
  4831. //
  4832. //
  4833. //
  4834. //
  4835. //
  4836. //
  4837. //
  4838. //
  4839. //
  4840. //
  4841. //
  4842. //
  4843. //
  4844. //
  4845. //
  4846. //
  4847. //
  4848. //
  4849. //
  4850. //
  4851. //
  4852. //
  4853. //
  4854. //
  4855. //
  4856. //
  4857. //
  4858. //
  4859. //
  4860. //
  4861. //
  4862. //
  4863. //
  4864. //
  4865. //
  4866. //
  4867. //
  4868. //
  4869. //
  4870. //
  4871. //
  4872. //
  4873. //
  4874. //
  4875. //
  4876. var date_rangevue_type_script_lang_js_calcDefaultValue = function calcDefaultValue(defaultValue) {
  4877. if (Array.isArray(defaultValue)) {
  4878. return [new Date(defaultValue[0]), new Date(defaultValue[1])];
  4879. } else if (defaultValue) {
  4880. return [new Date(defaultValue), Object(date_util_["nextDate"])(new Date(defaultValue), 1)];
  4881. } else {
  4882. return [new Date(), Object(date_util_["nextDate"])(new Date(), 1)];
  4883. }
  4884. };
  4885. /* harmony default export */ var date_rangevue_type_script_lang_js_ = ({
  4886. mixins: [locale_default.a],
  4887. directives: { Clickoutside: clickoutside_default.a },
  4888. computed: {
  4889. btnDisabled: function btnDisabled() {
  4890. return !(this.minDate && this.maxDate && !this.selecting && this.isValidValue([this.minDate, this.maxDate]));
  4891. },
  4892. leftLabel: function leftLabel() {
  4893. return this.leftDate.getFullYear() + ' ' + this.t('el.datepicker.year') + ' ' + this.t('el.datepicker.month' + (this.leftDate.getMonth() + 1));
  4894. },
  4895. rightLabel: function rightLabel() {
  4896. return this.rightDate.getFullYear() + ' ' + this.t('el.datepicker.year') + ' ' + this.t('el.datepicker.month' + (this.rightDate.getMonth() + 1));
  4897. },
  4898. leftYear: function leftYear() {
  4899. return this.leftDate.getFullYear();
  4900. },
  4901. leftMonth: function leftMonth() {
  4902. return this.leftDate.getMonth();
  4903. },
  4904. leftMonthDate: function leftMonthDate() {
  4905. return this.leftDate.getDate();
  4906. },
  4907. rightYear: function rightYear() {
  4908. return this.rightDate.getFullYear();
  4909. },
  4910. rightMonth: function rightMonth() {
  4911. return this.rightDate.getMonth();
  4912. },
  4913. rightMonthDate: function rightMonthDate() {
  4914. return this.rightDate.getDate();
  4915. },
  4916. minVisibleDate: function minVisibleDate() {
  4917. if (this.dateUserInput.min !== null) return this.dateUserInput.min;
  4918. if (this.minDate) return Object(date_util_["formatDate"])(this.minDate, this.dateFormat);
  4919. return '';
  4920. },
  4921. maxVisibleDate: function maxVisibleDate() {
  4922. if (this.dateUserInput.max !== null) return this.dateUserInput.max;
  4923. if (this.maxDate || this.minDate) return Object(date_util_["formatDate"])(this.maxDate || this.minDate, this.dateFormat);
  4924. return '';
  4925. },
  4926. minVisibleTime: function minVisibleTime() {
  4927. if (this.timeUserInput.min !== null) return this.timeUserInput.min;
  4928. if (this.minDate) return Object(date_util_["formatDate"])(this.minDate, this.timeFormat);
  4929. return '';
  4930. },
  4931. maxVisibleTime: function maxVisibleTime() {
  4932. if (this.timeUserInput.max !== null) return this.timeUserInput.max;
  4933. if (this.maxDate || this.minDate) return Object(date_util_["formatDate"])(this.maxDate || this.minDate, this.timeFormat);
  4934. return '';
  4935. },
  4936. timeFormat: function timeFormat() {
  4937. if (this.format) {
  4938. return Object(date_util_["extractTimeFormat"])(this.format);
  4939. } else {
  4940. return 'HH:mm:ss';
  4941. }
  4942. },
  4943. dateFormat: function dateFormat() {
  4944. if (this.format) {
  4945. return Object(date_util_["extractDateFormat"])(this.format);
  4946. } else {
  4947. return 'yyyy-MM-dd';
  4948. }
  4949. },
  4950. enableMonthArrow: function enableMonthArrow() {
  4951. var nextMonth = (this.leftMonth + 1) % 12;
  4952. var yearOffset = this.leftMonth + 1 >= 12 ? 1 : 0;
  4953. return this.unlinkPanels && new Date(this.leftYear + yearOffset, nextMonth) < new Date(this.rightYear, this.rightMonth);
  4954. },
  4955. enableYearArrow: function enableYearArrow() {
  4956. return this.unlinkPanels && this.rightYear * 12 + this.rightMonth - (this.leftYear * 12 + this.leftMonth + 1) >= 12;
  4957. }
  4958. },
  4959. data: function data() {
  4960. return {
  4961. popperClass: '',
  4962. value: [],
  4963. defaultValue: null,
  4964. defaultTime: null,
  4965. minDate: '',
  4966. maxDate: '',
  4967. leftDate: new Date(),
  4968. rightDate: Object(date_util_["nextMonth"])(new Date()),
  4969. rangeState: {
  4970. endDate: null,
  4971. selecting: false,
  4972. row: null,
  4973. column: null
  4974. },
  4975. showTime: false,
  4976. shortcuts: '',
  4977. visible: '',
  4978. disabledDate: '',
  4979. cellClassName: '',
  4980. firstDayOfWeek: 7,
  4981. minTimePickerVisible: false,
  4982. maxTimePickerVisible: false,
  4983. format: '',
  4984. arrowControl: false,
  4985. unlinkPanels: false,
  4986. dateUserInput: {
  4987. min: null,
  4988. max: null
  4989. },
  4990. timeUserInput: {
  4991. min: null,
  4992. max: null
  4993. }
  4994. };
  4995. },
  4996. watch: {
  4997. minDate: function minDate(val) {
  4998. var _this = this;
  4999. this.dateUserInput.min = null;
  5000. this.timeUserInput.min = null;
  5001. this.$nextTick(function () {
  5002. if (_this.$refs.maxTimePicker && _this.maxDate && _this.maxDate < _this.minDate) {
  5003. var format = 'HH:mm:ss';
  5004. _this.$refs.maxTimePicker.selectableRange = [[Object(date_util_["parseDate"])(Object(date_util_["formatDate"])(_this.minDate, format), format), Object(date_util_["parseDate"])('23:59:59', format)]];
  5005. }
  5006. });
  5007. if (val && this.$refs.minTimePicker) {
  5008. this.$refs.minTimePicker.date = val;
  5009. this.$refs.minTimePicker.value = val;
  5010. }
  5011. },
  5012. maxDate: function maxDate(val) {
  5013. this.dateUserInput.max = null;
  5014. this.timeUserInput.max = null;
  5015. if (val && this.$refs.maxTimePicker) {
  5016. this.$refs.maxTimePicker.date = val;
  5017. this.$refs.maxTimePicker.value = val;
  5018. }
  5019. },
  5020. minTimePickerVisible: function minTimePickerVisible(val) {
  5021. var _this2 = this;
  5022. if (val) {
  5023. this.$nextTick(function () {
  5024. _this2.$refs.minTimePicker.date = _this2.minDate;
  5025. _this2.$refs.minTimePicker.value = _this2.minDate;
  5026. _this2.$refs.minTimePicker.adjustSpinners();
  5027. });
  5028. }
  5029. },
  5030. maxTimePickerVisible: function maxTimePickerVisible(val) {
  5031. var _this3 = this;
  5032. if (val) {
  5033. this.$nextTick(function () {
  5034. _this3.$refs.maxTimePicker.date = _this3.maxDate;
  5035. _this3.$refs.maxTimePicker.value = _this3.maxDate;
  5036. _this3.$refs.maxTimePicker.adjustSpinners();
  5037. });
  5038. }
  5039. },
  5040. value: function value(newVal) {
  5041. if (!newVal) {
  5042. this.minDate = null;
  5043. this.maxDate = null;
  5044. } else if (Array.isArray(newVal)) {
  5045. this.minDate = Object(date_util_["isDate"])(newVal[0]) ? new Date(newVal[0]) : null;
  5046. this.maxDate = Object(date_util_["isDate"])(newVal[1]) ? new Date(newVal[1]) : null;
  5047. if (this.minDate) {
  5048. this.leftDate = this.minDate;
  5049. if (this.unlinkPanels && this.maxDate) {
  5050. var minDateYear = this.minDate.getFullYear();
  5051. var minDateMonth = this.minDate.getMonth();
  5052. var maxDateYear = this.maxDate.getFullYear();
  5053. var maxDateMonth = this.maxDate.getMonth();
  5054. this.rightDate = minDateYear === maxDateYear && minDateMonth === maxDateMonth ? Object(date_util_["nextMonth"])(this.maxDate) : this.maxDate;
  5055. } else {
  5056. this.rightDate = Object(date_util_["nextMonth"])(this.leftDate);
  5057. }
  5058. } else {
  5059. this.leftDate = date_rangevue_type_script_lang_js_calcDefaultValue(this.defaultValue)[0];
  5060. this.rightDate = Object(date_util_["nextMonth"])(this.leftDate);
  5061. }
  5062. }
  5063. },
  5064. defaultValue: function defaultValue(val) {
  5065. if (!Array.isArray(this.value)) {
  5066. var _calcDefaultValue = date_rangevue_type_script_lang_js_calcDefaultValue(val),
  5067. left = _calcDefaultValue[0],
  5068. right = _calcDefaultValue[1];
  5069. this.leftDate = left;
  5070. this.rightDate = val && val[1] && this.unlinkPanels ? right : Object(date_util_["nextMonth"])(this.leftDate);
  5071. }
  5072. }
  5073. },
  5074. methods: {
  5075. handleClear: function handleClear() {
  5076. this.minDate = null;
  5077. this.maxDate = null;
  5078. this.leftDate = date_rangevue_type_script_lang_js_calcDefaultValue(this.defaultValue)[0];
  5079. this.rightDate = Object(date_util_["nextMonth"])(this.leftDate);
  5080. this.$emit('pick', null);
  5081. },
  5082. handleChangeRange: function handleChangeRange(val) {
  5083. this.minDate = val.minDate;
  5084. this.maxDate = val.maxDate;
  5085. this.rangeState = val.rangeState;
  5086. },
  5087. handleDateInput: function handleDateInput(value, type) {
  5088. this.dateUserInput[type] = value;
  5089. if (value.length !== this.dateFormat.length) return;
  5090. var parsedValue = Object(date_util_["parseDate"])(value, this.dateFormat);
  5091. if (parsedValue) {
  5092. if (typeof this.disabledDate === 'function' && this.disabledDate(new Date(parsedValue))) {
  5093. return;
  5094. }
  5095. if (type === 'min') {
  5096. this.minDate = Object(date_util_["modifyDate"])(this.minDate || new Date(), parsedValue.getFullYear(), parsedValue.getMonth(), parsedValue.getDate());
  5097. this.leftDate = new Date(parsedValue);
  5098. if (!this.unlinkPanels) {
  5099. this.rightDate = Object(date_util_["nextMonth"])(this.leftDate);
  5100. }
  5101. } else {
  5102. this.maxDate = Object(date_util_["modifyDate"])(this.maxDate || new Date(), parsedValue.getFullYear(), parsedValue.getMonth(), parsedValue.getDate());
  5103. this.rightDate = new Date(parsedValue);
  5104. if (!this.unlinkPanels) {
  5105. this.leftDate = Object(date_util_["prevMonth"])(parsedValue);
  5106. }
  5107. }
  5108. }
  5109. },
  5110. handleDateChange: function handleDateChange(value, type) {
  5111. var parsedValue = Object(date_util_["parseDate"])(value, this.dateFormat);
  5112. if (parsedValue) {
  5113. if (type === 'min') {
  5114. this.minDate = Object(date_util_["modifyDate"])(this.minDate, parsedValue.getFullYear(), parsedValue.getMonth(), parsedValue.getDate());
  5115. if (this.minDate > this.maxDate) {
  5116. this.maxDate = this.minDate;
  5117. }
  5118. } else {
  5119. this.maxDate = Object(date_util_["modifyDate"])(this.maxDate, parsedValue.getFullYear(), parsedValue.getMonth(), parsedValue.getDate());
  5120. if (this.maxDate < this.minDate) {
  5121. this.minDate = this.maxDate;
  5122. }
  5123. }
  5124. }
  5125. },
  5126. handleTimeInput: function handleTimeInput(value, type) {
  5127. var _this4 = this;
  5128. this.timeUserInput[type] = value;
  5129. if (value.length !== this.timeFormat.length) return;
  5130. var parsedValue = Object(date_util_["parseDate"])(value, this.timeFormat);
  5131. if (parsedValue) {
  5132. if (type === 'min') {
  5133. this.minDate = Object(date_util_["modifyTime"])(this.minDate, parsedValue.getHours(), parsedValue.getMinutes(), parsedValue.getSeconds());
  5134. this.$nextTick(function (_) {
  5135. return _this4.$refs.minTimePicker.adjustSpinners();
  5136. });
  5137. } else {
  5138. this.maxDate = Object(date_util_["modifyTime"])(this.maxDate, parsedValue.getHours(), parsedValue.getMinutes(), parsedValue.getSeconds());
  5139. this.$nextTick(function (_) {
  5140. return _this4.$refs.maxTimePicker.adjustSpinners();
  5141. });
  5142. }
  5143. }
  5144. },
  5145. handleTimeChange: function handleTimeChange(value, type) {
  5146. var parsedValue = Object(date_util_["parseDate"])(value, this.timeFormat);
  5147. if (parsedValue) {
  5148. if (type === 'min') {
  5149. this.minDate = Object(date_util_["modifyTime"])(this.minDate, parsedValue.getHours(), parsedValue.getMinutes(), parsedValue.getSeconds());
  5150. if (this.minDate > this.maxDate) {
  5151. this.maxDate = this.minDate;
  5152. }
  5153. this.$refs.minTimePicker.value = this.minDate;
  5154. this.minTimePickerVisible = false;
  5155. } else {
  5156. this.maxDate = Object(date_util_["modifyTime"])(this.maxDate, parsedValue.getHours(), parsedValue.getMinutes(), parsedValue.getSeconds());
  5157. if (this.maxDate < this.minDate) {
  5158. this.minDate = this.maxDate;
  5159. }
  5160. this.$refs.maxTimePicker.value = this.minDate;
  5161. this.maxTimePickerVisible = false;
  5162. }
  5163. }
  5164. },
  5165. handleRangePick: function handleRangePick(val) {
  5166. var _this5 = this;
  5167. var close = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  5168. var defaultTime = this.defaultTime || [];
  5169. var minDate = Object(date_util_["modifyWithTimeString"])(val.minDate, defaultTime[0]);
  5170. var maxDate = Object(date_util_["modifyWithTimeString"])(val.maxDate, defaultTime[1]);
  5171. if (this.maxDate === maxDate && this.minDate === minDate) {
  5172. return;
  5173. }
  5174. this.onPick && this.onPick(val);
  5175. this.maxDate = maxDate;
  5176. this.minDate = minDate;
  5177. // workaround for https://github.com/ElemeFE/element/issues/7539, should remove this block when we don't have to care about Chromium 55 - 57
  5178. setTimeout(function () {
  5179. _this5.maxDate = maxDate;
  5180. _this5.minDate = minDate;
  5181. }, 10);
  5182. if (!close || this.showTime) return;
  5183. this.handleConfirm();
  5184. },
  5185. handleShortcutClick: function handleShortcutClick(shortcut) {
  5186. if (shortcut.onClick) {
  5187. shortcut.onClick(this);
  5188. }
  5189. },
  5190. handleMinTimePick: function handleMinTimePick(value, visible, first) {
  5191. this.minDate = this.minDate || new Date();
  5192. if (value) {
  5193. this.minDate = Object(date_util_["modifyTime"])(this.minDate, value.getHours(), value.getMinutes(), value.getSeconds());
  5194. }
  5195. if (!first) {
  5196. this.minTimePickerVisible = visible;
  5197. }
  5198. if (!this.maxDate || this.maxDate && this.maxDate.getTime() < this.minDate.getTime()) {
  5199. this.maxDate = new Date(this.minDate);
  5200. }
  5201. },
  5202. handleMinTimeClose: function handleMinTimeClose() {
  5203. this.minTimePickerVisible = false;
  5204. },
  5205. handleMaxTimePick: function handleMaxTimePick(value, visible, first) {
  5206. if (this.maxDate && value) {
  5207. this.maxDate = Object(date_util_["modifyTime"])(this.maxDate, value.getHours(), value.getMinutes(), value.getSeconds());
  5208. }
  5209. if (!first) {
  5210. this.maxTimePickerVisible = visible;
  5211. }
  5212. if (this.maxDate && this.minDate && this.minDate.getTime() > this.maxDate.getTime()) {
  5213. this.minDate = new Date(this.maxDate);
  5214. }
  5215. },
  5216. handleMaxTimeClose: function handleMaxTimeClose() {
  5217. this.maxTimePickerVisible = false;
  5218. },
  5219. // leftPrev*, rightNext* need to take care of `unlinkPanels`
  5220. leftPrevYear: function leftPrevYear() {
  5221. this.leftDate = Object(date_util_["prevYear"])(this.leftDate);
  5222. if (!this.unlinkPanels) {
  5223. this.rightDate = Object(date_util_["nextMonth"])(this.leftDate);
  5224. }
  5225. },
  5226. leftPrevMonth: function leftPrevMonth() {
  5227. this.leftDate = Object(date_util_["prevMonth"])(this.leftDate);
  5228. if (!this.unlinkPanels) {
  5229. this.rightDate = Object(date_util_["nextMonth"])(this.leftDate);
  5230. }
  5231. },
  5232. rightNextYear: function rightNextYear() {
  5233. if (!this.unlinkPanels) {
  5234. this.leftDate = Object(date_util_["nextYear"])(this.leftDate);
  5235. this.rightDate = Object(date_util_["nextMonth"])(this.leftDate);
  5236. } else {
  5237. this.rightDate = Object(date_util_["nextYear"])(this.rightDate);
  5238. }
  5239. },
  5240. rightNextMonth: function rightNextMonth() {
  5241. if (!this.unlinkPanels) {
  5242. this.leftDate = Object(date_util_["nextMonth"])(this.leftDate);
  5243. this.rightDate = Object(date_util_["nextMonth"])(this.leftDate);
  5244. } else {
  5245. this.rightDate = Object(date_util_["nextMonth"])(this.rightDate);
  5246. }
  5247. },
  5248. // leftNext*, rightPrev* are called when `unlinkPanels` is true
  5249. leftNextYear: function leftNextYear() {
  5250. this.leftDate = Object(date_util_["nextYear"])(this.leftDate);
  5251. },
  5252. leftNextMonth: function leftNextMonth() {
  5253. this.leftDate = Object(date_util_["nextMonth"])(this.leftDate);
  5254. },
  5255. rightPrevYear: function rightPrevYear() {
  5256. this.rightDate = Object(date_util_["prevYear"])(this.rightDate);
  5257. },
  5258. rightPrevMonth: function rightPrevMonth() {
  5259. this.rightDate = Object(date_util_["prevMonth"])(this.rightDate);
  5260. },
  5261. handleConfirm: function handleConfirm() {
  5262. var visible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5263. if (this.isValidValue([this.minDate, this.maxDate])) {
  5264. this.$emit('pick', [this.minDate, this.maxDate], visible);
  5265. }
  5266. },
  5267. isValidValue: function isValidValue(value) {
  5268. return Array.isArray(value) && value && value[0] && value[1] && Object(date_util_["isDate"])(value[0]) && Object(date_util_["isDate"])(value[1]) && value[0].getTime() <= value[1].getTime() && (typeof this.disabledDate === 'function' ? !this.disabledDate(value[0]) && !this.disabledDate(value[1]) : true);
  5269. },
  5270. resetView: function resetView() {
  5271. // NOTE: this is a hack to reset {min, max}Date on picker open.
  5272. // TODO: correct way of doing so is to refactor {min, max}Date to be dependent on value and internal selection state
  5273. // an alternative would be resetView whenever picker becomes visible, should also investigate date-panel's resetView
  5274. if (this.minDate && this.maxDate == null) this.rangeState.selecting = false;
  5275. this.minDate = this.value && Object(date_util_["isDate"])(this.value[0]) ? new Date(this.value[0]) : null;
  5276. this.maxDate = this.value && Object(date_util_["isDate"])(this.value[0]) ? new Date(this.value[1]) : null;
  5277. }
  5278. },
  5279. components: { TimePicker: panel_time["a" /* default */], DateTable: date_table, ElInput: input_default.a, ElButton: button_default.a }
  5280. });
  5281. // CONCATENATED MODULE: ./packages/date-picker/src/panel/date-range.vue?vue&type=script&lang=js&
  5282. /* harmony default export */ var panel_date_rangevue_type_script_lang_js_ = (date_rangevue_type_script_lang_js_);
  5283. // CONCATENATED MODULE: ./packages/date-picker/src/panel/date-range.vue
  5284. /* normalize component */
  5285. var date_range_component = Object(componentNormalizer["a" /* default */])(
  5286. panel_date_rangevue_type_script_lang_js_,
  5287. date_rangevue_type_template_id_2652849a_render,
  5288. date_rangevue_type_template_id_2652849a_staticRenderFns,
  5289. false,
  5290. null,
  5291. null,
  5292. null
  5293. )
  5294. /* hot reload */
  5295. if (false) { var date_range_api; }
  5296. date_range_component.options.__file = "packages/date-picker/src/panel/date-range.vue"
  5297. /* harmony default export */ var date_range = (date_range_component.exports);
  5298. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/panel/month-range.vue?vue&type=template&id=f2645fb8&
  5299. var month_rangevue_type_template_id_f2645fb8_render = function() {
  5300. var _vm = this
  5301. var _h = _vm.$createElement
  5302. var _c = _vm._self._c || _h
  5303. return _c(
  5304. "transition",
  5305. {
  5306. attrs: { name: "el-zoom-in-top" },
  5307. on: {
  5308. "after-leave": function($event) {
  5309. _vm.$emit("dodestroy")
  5310. }
  5311. }
  5312. },
  5313. [
  5314. _c(
  5315. "div",
  5316. {
  5317. directives: [
  5318. {
  5319. name: "show",
  5320. rawName: "v-show",
  5321. value: _vm.visible,
  5322. expression: "visible"
  5323. }
  5324. ],
  5325. staticClass: "el-picker-panel el-date-range-picker el-popper",
  5326. class: [
  5327. {
  5328. "has-sidebar": _vm.$slots.sidebar || _vm.shortcuts
  5329. },
  5330. _vm.popperClass
  5331. ]
  5332. },
  5333. [
  5334. _c(
  5335. "div",
  5336. { staticClass: "el-picker-panel__body-wrapper" },
  5337. [
  5338. _vm._t("sidebar"),
  5339. _vm.shortcuts
  5340. ? _c(
  5341. "div",
  5342. { staticClass: "el-picker-panel__sidebar" },
  5343. _vm._l(_vm.shortcuts, function(shortcut, key) {
  5344. return _c(
  5345. "button",
  5346. {
  5347. key: key,
  5348. staticClass: "el-picker-panel__shortcut",
  5349. attrs: { type: "button" },
  5350. on: {
  5351. click: function($event) {
  5352. _vm.handleShortcutClick(shortcut)
  5353. }
  5354. }
  5355. },
  5356. [_vm._v(_vm._s(shortcut.text))]
  5357. )
  5358. }),
  5359. 0
  5360. )
  5361. : _vm._e(),
  5362. _c("div", { staticClass: "el-picker-panel__body" }, [
  5363. _c(
  5364. "div",
  5365. {
  5366. staticClass:
  5367. "el-picker-panel__content el-date-range-picker__content is-left"
  5368. },
  5369. [
  5370. _c("div", { staticClass: "el-date-range-picker__header" }, [
  5371. _c("button", {
  5372. staticClass:
  5373. "el-picker-panel__icon-btn el-icon-d-arrow-left",
  5374. attrs: { type: "button" },
  5375. on: { click: _vm.leftPrevYear }
  5376. }),
  5377. _vm.unlinkPanels
  5378. ? _c("button", {
  5379. staticClass:
  5380. "el-picker-panel__icon-btn el-icon-d-arrow-right",
  5381. class: { "is-disabled": !_vm.enableYearArrow },
  5382. attrs: {
  5383. type: "button",
  5384. disabled: !_vm.enableYearArrow
  5385. },
  5386. on: { click: _vm.leftNextYear }
  5387. })
  5388. : _vm._e(),
  5389. _c("div", [_vm._v(_vm._s(_vm.leftLabel))])
  5390. ]),
  5391. _c("month-table", {
  5392. attrs: {
  5393. "selection-mode": "range",
  5394. date: _vm.leftDate,
  5395. "default-value": _vm.defaultValue,
  5396. "min-date": _vm.minDate,
  5397. "max-date": _vm.maxDate,
  5398. "range-state": _vm.rangeState,
  5399. "disabled-date": _vm.disabledDate
  5400. },
  5401. on: {
  5402. changerange: _vm.handleChangeRange,
  5403. pick: _vm.handleRangePick
  5404. }
  5405. })
  5406. ],
  5407. 1
  5408. ),
  5409. _c(
  5410. "div",
  5411. {
  5412. staticClass:
  5413. "el-picker-panel__content el-date-range-picker__content is-right"
  5414. },
  5415. [
  5416. _c("div", { staticClass: "el-date-range-picker__header" }, [
  5417. _vm.unlinkPanels
  5418. ? _c("button", {
  5419. staticClass:
  5420. "el-picker-panel__icon-btn el-icon-d-arrow-left",
  5421. class: { "is-disabled": !_vm.enableYearArrow },
  5422. attrs: {
  5423. type: "button",
  5424. disabled: !_vm.enableYearArrow
  5425. },
  5426. on: { click: _vm.rightPrevYear }
  5427. })
  5428. : _vm._e(),
  5429. _c("button", {
  5430. staticClass:
  5431. "el-picker-panel__icon-btn el-icon-d-arrow-right",
  5432. attrs: { type: "button" },
  5433. on: { click: _vm.rightNextYear }
  5434. }),
  5435. _c("div", [_vm._v(_vm._s(_vm.rightLabel))])
  5436. ]),
  5437. _c("month-table", {
  5438. attrs: {
  5439. "selection-mode": "range",
  5440. date: _vm.rightDate,
  5441. "default-value": _vm.defaultValue,
  5442. "min-date": _vm.minDate,
  5443. "max-date": _vm.maxDate,
  5444. "range-state": _vm.rangeState,
  5445. "disabled-date": _vm.disabledDate
  5446. },
  5447. on: {
  5448. changerange: _vm.handleChangeRange,
  5449. pick: _vm.handleRangePick
  5450. }
  5451. })
  5452. ],
  5453. 1
  5454. )
  5455. ])
  5456. ],
  5457. 2
  5458. )
  5459. ]
  5460. )
  5461. ]
  5462. )
  5463. }
  5464. var month_rangevue_type_template_id_f2645fb8_staticRenderFns = []
  5465. month_rangevue_type_template_id_f2645fb8_render._withStripped = true
  5466. // CONCATENATED MODULE: ./packages/date-picker/src/panel/month-range.vue?vue&type=template&id=f2645fb8&
  5467. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/panel/month-range.vue?vue&type=script&lang=js&
  5468. //
  5469. //
  5470. //
  5471. //
  5472. //
  5473. //
  5474. //
  5475. //
  5476. //
  5477. //
  5478. //
  5479. //
  5480. //
  5481. //
  5482. //
  5483. //
  5484. //
  5485. //
  5486. //
  5487. //
  5488. //
  5489. //
  5490. //
  5491. //
  5492. //
  5493. //
  5494. //
  5495. //
  5496. //
  5497. //
  5498. //
  5499. //
  5500. //
  5501. //
  5502. //
  5503. //
  5504. //
  5505. //
  5506. //
  5507. //
  5508. //
  5509. //
  5510. //
  5511. //
  5512. //
  5513. //
  5514. //
  5515. //
  5516. //
  5517. //
  5518. //
  5519. //
  5520. //
  5521. //
  5522. //
  5523. //
  5524. //
  5525. //
  5526. //
  5527. //
  5528. //
  5529. //
  5530. //
  5531. //
  5532. //
  5533. //
  5534. //
  5535. //
  5536. //
  5537. //
  5538. //
  5539. //
  5540. //
  5541. //
  5542. //
  5543. //
  5544. //
  5545. //
  5546. //
  5547. var month_rangevue_type_script_lang_js_calcDefaultValue = function calcDefaultValue(defaultValue) {
  5548. if (Array.isArray(defaultValue)) {
  5549. return [new Date(defaultValue[0]), new Date(defaultValue[1])];
  5550. } else if (defaultValue) {
  5551. return [new Date(defaultValue), Object(date_util_["nextMonth"])(new Date(defaultValue))];
  5552. } else {
  5553. return [new Date(), Object(date_util_["nextMonth"])(new Date())];
  5554. }
  5555. };
  5556. /* harmony default export */ var month_rangevue_type_script_lang_js_ = ({
  5557. mixins: [locale_default.a],
  5558. directives: { Clickoutside: clickoutside_default.a },
  5559. computed: {
  5560. btnDisabled: function btnDisabled() {
  5561. return !(this.minDate && this.maxDate && !this.selecting && this.isValidValue([this.minDate, this.maxDate]));
  5562. },
  5563. leftLabel: function leftLabel() {
  5564. return this.leftDate.getFullYear() + ' ' + this.t('el.datepicker.year');
  5565. },
  5566. rightLabel: function rightLabel() {
  5567. return this.rightDate.getFullYear() + ' ' + this.t('el.datepicker.year');
  5568. },
  5569. leftYear: function leftYear() {
  5570. return this.leftDate.getFullYear();
  5571. },
  5572. rightYear: function rightYear() {
  5573. return this.rightDate.getFullYear() === this.leftDate.getFullYear() ? this.leftDate.getFullYear() + 1 : this.rightDate.getFullYear();
  5574. },
  5575. enableYearArrow: function enableYearArrow() {
  5576. return this.unlinkPanels && this.rightYear > this.leftYear + 1;
  5577. }
  5578. },
  5579. data: function data() {
  5580. return {
  5581. popperClass: '',
  5582. value: [],
  5583. defaultValue: null,
  5584. defaultTime: null,
  5585. minDate: '',
  5586. maxDate: '',
  5587. leftDate: new Date(),
  5588. rightDate: Object(date_util_["nextYear"])(new Date()),
  5589. rangeState: {
  5590. endDate: null,
  5591. selecting: false,
  5592. row: null,
  5593. column: null
  5594. },
  5595. shortcuts: '',
  5596. visible: '',
  5597. disabledDate: '',
  5598. format: '',
  5599. arrowControl: false,
  5600. unlinkPanels: false
  5601. };
  5602. },
  5603. watch: {
  5604. value: function value(newVal) {
  5605. if (!newVal) {
  5606. this.minDate = null;
  5607. this.maxDate = null;
  5608. } else if (Array.isArray(newVal)) {
  5609. this.minDate = Object(date_util_["isDate"])(newVal[0]) ? new Date(newVal[0]) : null;
  5610. this.maxDate = Object(date_util_["isDate"])(newVal[1]) ? new Date(newVal[1]) : null;
  5611. if (this.minDate) {
  5612. this.leftDate = this.minDate;
  5613. if (this.unlinkPanels && this.maxDate) {
  5614. var minDateYear = this.minDate.getFullYear();
  5615. var maxDateYear = this.maxDate.getFullYear();
  5616. this.rightDate = minDateYear === maxDateYear ? Object(date_util_["nextYear"])(this.maxDate) : this.maxDate;
  5617. } else {
  5618. this.rightDate = Object(date_util_["nextYear"])(this.leftDate);
  5619. }
  5620. } else {
  5621. this.leftDate = month_rangevue_type_script_lang_js_calcDefaultValue(this.defaultValue)[0];
  5622. this.rightDate = Object(date_util_["nextYear"])(this.leftDate);
  5623. }
  5624. }
  5625. },
  5626. defaultValue: function defaultValue(val) {
  5627. if (!Array.isArray(this.value)) {
  5628. var _calcDefaultValue = month_rangevue_type_script_lang_js_calcDefaultValue(val),
  5629. left = _calcDefaultValue[0],
  5630. right = _calcDefaultValue[1];
  5631. this.leftDate = left;
  5632. this.rightDate = val && val[1] && left.getFullYear() !== right.getFullYear() && this.unlinkPanels ? right : Object(date_util_["nextYear"])(this.leftDate);
  5633. }
  5634. }
  5635. },
  5636. methods: {
  5637. handleClear: function handleClear() {
  5638. this.minDate = null;
  5639. this.maxDate = null;
  5640. this.leftDate = month_rangevue_type_script_lang_js_calcDefaultValue(this.defaultValue)[0];
  5641. this.rightDate = Object(date_util_["nextYear"])(this.leftDate);
  5642. this.$emit('pick', null);
  5643. },
  5644. handleChangeRange: function handleChangeRange(val) {
  5645. this.minDate = val.minDate;
  5646. this.maxDate = val.maxDate;
  5647. this.rangeState = val.rangeState;
  5648. },
  5649. handleRangePick: function handleRangePick(val) {
  5650. var _this = this;
  5651. var close = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  5652. var defaultTime = this.defaultTime || [];
  5653. var minDate = Object(date_util_["modifyWithTimeString"])(val.minDate, defaultTime[0]);
  5654. var maxDate = Object(date_util_["modifyWithTimeString"])(val.maxDate, defaultTime[1]);
  5655. if (this.maxDate === maxDate && this.minDate === minDate) {
  5656. return;
  5657. }
  5658. this.onPick && this.onPick(val);
  5659. this.maxDate = maxDate;
  5660. this.minDate = minDate;
  5661. // workaround for https://github.com/ElemeFE/element/issues/7539, should remove this block when we don't have to care about Chromium 55 - 57
  5662. setTimeout(function () {
  5663. _this.maxDate = maxDate;
  5664. _this.minDate = minDate;
  5665. }, 10);
  5666. if (!close) return;
  5667. this.handleConfirm();
  5668. },
  5669. handleShortcutClick: function handleShortcutClick(shortcut) {
  5670. if (shortcut.onClick) {
  5671. shortcut.onClick(this);
  5672. }
  5673. },
  5674. // leftPrev*, rightNext* need to take care of `unlinkPanels`
  5675. leftPrevYear: function leftPrevYear() {
  5676. this.leftDate = Object(date_util_["prevYear"])(this.leftDate);
  5677. if (!this.unlinkPanels) {
  5678. this.rightDate = Object(date_util_["prevYear"])(this.rightDate);
  5679. }
  5680. },
  5681. rightNextYear: function rightNextYear() {
  5682. if (!this.unlinkPanels) {
  5683. this.leftDate = Object(date_util_["nextYear"])(this.leftDate);
  5684. }
  5685. this.rightDate = Object(date_util_["nextYear"])(this.rightDate);
  5686. },
  5687. // leftNext*, rightPrev* are called when `unlinkPanels` is true
  5688. leftNextYear: function leftNextYear() {
  5689. this.leftDate = Object(date_util_["nextYear"])(this.leftDate);
  5690. },
  5691. rightPrevYear: function rightPrevYear() {
  5692. this.rightDate = Object(date_util_["prevYear"])(this.rightDate);
  5693. },
  5694. handleConfirm: function handleConfirm() {
  5695. var visible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5696. if (this.isValidValue([this.minDate, this.maxDate])) {
  5697. this.$emit('pick', [this.minDate, this.maxDate], visible);
  5698. }
  5699. },
  5700. isValidValue: function isValidValue(value) {
  5701. return Array.isArray(value) && value && value[0] && value[1] && Object(date_util_["isDate"])(value[0]) && Object(date_util_["isDate"])(value[1]) && value[0].getTime() <= value[1].getTime() && (typeof this.disabledDate === 'function' ? !this.disabledDate(value[0]) && !this.disabledDate(value[1]) : true);
  5702. },
  5703. resetView: function resetView() {
  5704. // NOTE: this is a hack to reset {min, max}Date on picker open.
  5705. // TODO: correct way of doing so is to refactor {min, max}Date to be dependent on value and internal selection state
  5706. // an alternative would be resetView whenever picker becomes visible, should also investigate date-panel's resetView
  5707. this.minDate = this.value && Object(date_util_["isDate"])(this.value[0]) ? new Date(this.value[0]) : null;
  5708. this.maxDate = this.value && Object(date_util_["isDate"])(this.value[0]) ? new Date(this.value[1]) : null;
  5709. }
  5710. },
  5711. components: { MonthTable: month_table, ElInput: input_default.a, ElButton: button_default.a }
  5712. });
  5713. // CONCATENATED MODULE: ./packages/date-picker/src/panel/month-range.vue?vue&type=script&lang=js&
  5714. /* harmony default export */ var panel_month_rangevue_type_script_lang_js_ = (month_rangevue_type_script_lang_js_);
  5715. // CONCATENATED MODULE: ./packages/date-picker/src/panel/month-range.vue
  5716. /* normalize component */
  5717. var month_range_component = Object(componentNormalizer["a" /* default */])(
  5718. panel_month_rangevue_type_script_lang_js_,
  5719. month_rangevue_type_template_id_f2645fb8_render,
  5720. month_rangevue_type_template_id_f2645fb8_staticRenderFns,
  5721. false,
  5722. null,
  5723. null,
  5724. null
  5725. )
  5726. /* hot reload */
  5727. if (false) { var month_range_api; }
  5728. month_range_component.options.__file = "packages/date-picker/src/panel/month-range.vue"
  5729. /* harmony default export */ var month_range = (month_range_component.exports);
  5730. // CONCATENATED MODULE: ./packages/date-picker/src/picker/date-picker.js
  5731. var date_picker_getPanel = function getPanel(type) {
  5732. if (type === 'daterange' || type === 'datetimerange') {
  5733. return date_range;
  5734. } else if (type === 'monthrange') {
  5735. return month_range;
  5736. }
  5737. return panel_date;
  5738. };
  5739. /* harmony default export */ var date_picker = ({
  5740. mixins: [picker["a" /* default */]],
  5741. name: 'ElDatePicker',
  5742. props: {
  5743. type: {
  5744. type: String,
  5745. default: 'date'
  5746. },
  5747. timeArrowControl: Boolean
  5748. },
  5749. watch: {
  5750. type: function type(_type) {
  5751. if (this.picker) {
  5752. this.unmountPicker();
  5753. this.panel = date_picker_getPanel(_type);
  5754. this.mountPicker();
  5755. } else {
  5756. this.panel = date_picker_getPanel(_type);
  5757. }
  5758. }
  5759. },
  5760. created: function created() {
  5761. this.panel = date_picker_getPanel(this.type);
  5762. }
  5763. });
  5764. // CONCATENATED MODULE: ./packages/date-picker/index.js
  5765. /* istanbul ignore next */
  5766. date_picker.install = function install(Vue) {
  5767. Vue.component(date_picker.name, date_picker);
  5768. };
  5769. /* harmony default export */ var packages_date_picker = __webpack_exports__["default"] = (date_picker);
  5770. /***/ })
  5771. /******/ ]);