index.es.js 1.1 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094
  1. import './index.css';
  2. var __defProp = Object.defineProperty;
  3. var __defProps = Object.defineProperties;
  4. var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
  5. var __getOwnPropSymbols = Object.getOwnPropertySymbols;
  6. var __hasOwnProp = Object.prototype.hasOwnProperty;
  7. var __propIsEnum = Object.prototype.propertyIsEnumerable;
  8. var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  9. var __spreadValues = (a2, b2) => {
  10. for (var prop in b2 || (b2 = {}))
  11. if (__hasOwnProp.call(b2, prop))
  12. __defNormalProp(a2, prop, b2[prop]);
  13. if (__getOwnPropSymbols)
  14. for (var prop of __getOwnPropSymbols(b2)) {
  15. if (__propIsEnum.call(b2, prop))
  16. __defNormalProp(a2, prop, b2[prop]);
  17. }
  18. return a2;
  19. };
  20. var __spreadProps = (a2, b2) => __defProps(a2, __getOwnPropDescs(b2));
  21. var __objRest = (source, exclude) => {
  22. var target = {};
  23. for (var prop in source)
  24. if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
  25. target[prop] = source[prop];
  26. if (source != null && __getOwnPropSymbols)
  27. for (var prop of __getOwnPropSymbols(source)) {
  28. if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
  29. target[prop] = source[prop];
  30. }
  31. return target;
  32. };
  33. import { ref, watch, getCurrentScope, onScopeDispose, unref, getCurrentInstance, computed, defineComponent, openBlock, createElementBlock, createElementVNode, warn, isVNode, Fragment, Comment, inject, provide, onMounted, watchEffect, onBeforeUnmount, isRef, onBeforeMount, mergeProps, renderSlot, useAttrs as useAttrs$1, useSlots, shallowRef, nextTick, onUpdated, toRef, withDirectives, normalizeClass, normalizeStyle, createCommentVNode, createBlock, withCtx, resolveDynamicComponent, withModifiers, createVNode, toDisplayString, vShow, Transition, resolveComponent, reactive, cloneVNode, Text, Teleport, createTextVNode, readonly, resolveDirective, renderList, h as h$1, vModelCheckbox, toRefs, withKeys, vModelRadio, onBeforeUpdate, vModelText, createSlots, markRaw, effectScope, toRaw, triggerRef, normalizeProps, guardReactiveProps, onUnmounted, TransitionGroup, pushScopeId, popScopeId, createPropsRestProxy } from "vue";
  34. import { ElMessage } from "element-plus";
  35. import Draggable from "vuedraggable";
  36. var elMessage = "";
  37. const rules$1 = {
  38. trigger: "blur",
  39. enum: "",
  40. len: void 0,
  41. max: void 0,
  42. message: "",
  43. min: void 0,
  44. pattern: "",
  45. required: false,
  46. type: "any"
  47. };
  48. const getWidgetForm = () => ({
  49. list: [],
  50. config: {
  51. size: "default",
  52. hideRequiredAsterisk: false,
  53. labelWidth: 100,
  54. labelPosition: "right"
  55. }
  56. });
  57. const basicComponents = [
  58. {
  59. label: "\u5355\u884C\u6587\u672C",
  60. type: "input",
  61. options: {
  62. width: "100%",
  63. defaultValue: "",
  64. placeholder: "",
  65. maxlength: null,
  66. prefix: "",
  67. suffix: "",
  68. prepend: "",
  69. append: "",
  70. disabled: false,
  71. clearable: false,
  72. readonly: false,
  73. rules: rules$1
  74. }
  75. },
  76. {
  77. label: "\u5BC6\u7801\u6846",
  78. type: "password",
  79. options: {
  80. width: "100%",
  81. defaultValue: "",
  82. placeholder: "",
  83. maxlength: null,
  84. prefix: "",
  85. suffix: "",
  86. prepend: "",
  87. append: "",
  88. showPassword: true,
  89. disabled: false,
  90. clearable: false,
  91. readonly: false,
  92. rules: rules$1
  93. }
  94. },
  95. {
  96. label: "\u591A\u884C\u6587\u672C",
  97. type: "textarea",
  98. options: {
  99. width: "100%",
  100. defaultValue: "",
  101. placeholder: "",
  102. maxlength: null,
  103. rows: 4,
  104. autosize: false,
  105. showWordLimit: false,
  106. disabled: false,
  107. clearable: false,
  108. readonly: false,
  109. rules: rules$1
  110. }
  111. },
  112. {
  113. label: "\u8BA1\u6570\u5668",
  114. type: "number",
  115. options: {
  116. width: "",
  117. defaultValue: 0,
  118. min: 0,
  119. max: 100,
  120. step: 1,
  121. disabled: false,
  122. rules: rules$1
  123. }
  124. },
  125. {
  126. label: "\u5355\u9009\u6846\u7EC4",
  127. type: "radio",
  128. options: {
  129. defaultValue: "",
  130. width: "",
  131. inline: true,
  132. remote: false,
  133. showLabel: true,
  134. remoteFunc: "https://raw.githubusercontent.com/fuchengwei/vue-form-create/master/mock/mock.json",
  135. options: [
  136. {
  137. value: "Option 1",
  138. label: "Option 1"
  139. },
  140. {
  141. value: "Option 2",
  142. label: "Option 2"
  143. },
  144. {
  145. value: "Option 3",
  146. label: "Option 3"
  147. }
  148. ],
  149. remoteOptions: [],
  150. props: {
  151. value: "value",
  152. label: "label"
  153. },
  154. disabled: false,
  155. rules: rules$1
  156. }
  157. },
  158. {
  159. label: "\u591A\u9009\u6846\u7EC4",
  160. type: "checkbox",
  161. options: {
  162. defaultValue: [],
  163. width: "",
  164. inline: true,
  165. remote: false,
  166. showLabel: true,
  167. remoteFunc: "https://raw.githubusercontent.com/fuchengwei/vue-form-create/master/mock/mock.json",
  168. options: [
  169. {
  170. label: "Option 1",
  171. value: "Option 1"
  172. },
  173. {
  174. label: "Option 2",
  175. value: "Option 2"
  176. },
  177. {
  178. label: "Option 3",
  179. value: "Option 3"
  180. }
  181. ],
  182. remoteOptions: [],
  183. props: {
  184. value: "value",
  185. label: "label"
  186. },
  187. disabled: false,
  188. rules: rules$1
  189. }
  190. },
  191. {
  192. label: "\u65F6\u95F4\u9009\u62E9\u5668",
  193. type: "time",
  194. options: {
  195. defaultValue: "",
  196. width: "",
  197. placeholder: "\u8BF7\u9009\u62E9\u65F6\u95F4",
  198. format: "HH:mm:ss",
  199. valueFormat: "HH:mm:ss",
  200. readonly: false,
  201. editable: true,
  202. clearable: true,
  203. disabled: false,
  204. rules: rules$1
  205. }
  206. },
  207. {
  208. label: "\u65E5\u671F\u9009\u62E9\u5668",
  209. type: "date",
  210. options: {
  211. defaultValue: "",
  212. width: "",
  213. placeholder: "\u8BF7\u9009\u62E9\u65F6\u95F4",
  214. format: "YYYY-MM-DD",
  215. readonly: false,
  216. editable: true,
  217. clearable: true,
  218. disabled: false,
  219. rules: rules$1
  220. }
  221. },
  222. {
  223. label: "\u8BC4\u5206",
  224. type: "rate",
  225. options: {
  226. defaultValue: 0,
  227. max: 5,
  228. allowHalf: false,
  229. disabled: false,
  230. rules: rules$1
  231. }
  232. },
  233. {
  234. label: "\u4E0B\u62C9\u9009\u62E9\u6846",
  235. type: "select",
  236. options: {
  237. defaultValue: "",
  238. width: "200px",
  239. multiple: false,
  240. placeholder: "",
  241. remote: false,
  242. showLabel: true,
  243. filterable: false,
  244. clearable: false,
  245. disabled: false,
  246. props: {
  247. label: "label",
  248. value: "value"
  249. },
  250. options: [
  251. {
  252. label: "Option 1",
  253. value: "Option 1"
  254. },
  255. {
  256. label: "Option 2",
  257. value: "Option 2"
  258. },
  259. {
  260. label: "Option 3",
  261. value: "Option 3"
  262. }
  263. ],
  264. remoteOptions: [],
  265. remoteFunc: "https://raw.githubusercontent.com/fuchengwei/vue-form-create/master/mock/mock.json",
  266. rules: rules$1
  267. }
  268. },
  269. {
  270. label: "\u5F00\u5173",
  271. type: "switch",
  272. options: {
  273. defaultValue: false,
  274. disabled: false,
  275. activeText: "",
  276. inactiveText: "",
  277. rules: rules$1
  278. }
  279. },
  280. {
  281. label: "\u6ED1\u5757",
  282. type: "slider",
  283. options: {
  284. defaultValue: 0,
  285. width: "",
  286. min: 0,
  287. max: 100,
  288. step: 1,
  289. disabled: false,
  290. range: false,
  291. rules: rules$1
  292. }
  293. },
  294. {
  295. label: "\u6587\u5B57",
  296. type: "text",
  297. options: {
  298. defaultValue: "This is a text"
  299. }
  300. }
  301. ];
  302. const basicFields = basicComponents.map((i) => i.type);
  303. const advanceComponents = [
  304. {
  305. label: "\u56FE\u7247",
  306. type: "img-upload",
  307. options: {
  308. defaultValue: [],
  309. name: "file",
  310. action: "http://example.com/upload",
  311. method: "post",
  312. listType: "text",
  313. accept: "image/*",
  314. limit: 1,
  315. multiple: false,
  316. disabled: true,
  317. rules: rules$1
  318. }
  319. },
  320. {
  321. label: "\u4E0B\u8F7D",
  322. type: "download",
  323. labelWidth: "auto",
  324. options: {
  325. defaultValue: "",
  326. name: "file"
  327. }
  328. },
  329. {
  330. label: "\u7EA7\u8054\u9009\u62E9\u5668",
  331. type: "cascader",
  332. options: {
  333. defaultValue: [],
  334. width: "200px",
  335. placeholder: "",
  336. disabled: false,
  337. clearable: false,
  338. filterable: false,
  339. remote: true,
  340. remoteOptions: [],
  341. props: {
  342. label: "label",
  343. value: "value",
  344. children: "children"
  345. },
  346. remoteFunc: "https://raw.githubusercontent.com/fuchengwei/vue-form-create/master/mock/mock.json",
  347. rules: rules$1
  348. }
  349. }
  350. ];
  351. const advanceFields = advanceComponents.map((i) => i.type);
  352. const layoutComponents = [
  353. {
  354. label: "\u6805\u683C\u5E03\u5C40",
  355. type: "grid",
  356. columns: [
  357. {
  358. span: 12,
  359. list: []
  360. },
  361. {
  362. span: 12,
  363. list: []
  364. }
  365. ],
  366. options: {
  367. gutter: 0,
  368. align: "initial"
  369. }
  370. },
  371. {
  372. label: "\u6570\u636E\u8868\u683C",
  373. type: "table",
  374. columns: [
  375. { label: "\u540D\u79F0", prop: "name" },
  376. { label: "\u521B\u5EFA\u65F6\u95F4", prop: "createTime" }
  377. ],
  378. options: {
  379. defaultValue: [],
  380. disabled: false,
  381. size: "",
  382. align: "center"
  383. }
  384. },
  385. {
  386. label: "\u5206\u5272\u7EBF",
  387. type: "divider",
  388. options: {}
  389. }
  390. ];
  391. const layoutFields = layoutComponents.map((i) => i.type);
  392. var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
  393. var freeGlobal$1 = freeGlobal;
  394. var freeSelf = typeof self == "object" && self && self.Object === Object && self;
  395. var root = freeGlobal$1 || freeSelf || Function("return this")();
  396. var root$1 = root;
  397. var Symbol$1 = root$1.Symbol;
  398. var Symbol$2 = Symbol$1;
  399. var objectProto$e = Object.prototype;
  400. var hasOwnProperty$c = objectProto$e.hasOwnProperty;
  401. var nativeObjectToString$1 = objectProto$e.toString;
  402. var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : void 0;
  403. function getRawTag(value) {
  404. var isOwn = hasOwnProperty$c.call(value, symToStringTag$1), tag = value[symToStringTag$1];
  405. try {
  406. value[symToStringTag$1] = void 0;
  407. var unmasked = true;
  408. } catch (e) {
  409. }
  410. var result = nativeObjectToString$1.call(value);
  411. if (unmasked) {
  412. if (isOwn) {
  413. value[symToStringTag$1] = tag;
  414. } else {
  415. delete value[symToStringTag$1];
  416. }
  417. }
  418. return result;
  419. }
  420. var objectProto$d = Object.prototype;
  421. var nativeObjectToString = objectProto$d.toString;
  422. function objectToString$1(value) {
  423. return nativeObjectToString.call(value);
  424. }
  425. var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
  426. var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : void 0;
  427. function baseGetTag(value) {
  428. if (value == null) {
  429. return value === void 0 ? undefinedTag : nullTag;
  430. }
  431. return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString$1(value);
  432. }
  433. function isObjectLike(value) {
  434. return value != null && typeof value == "object";
  435. }
  436. var symbolTag$3 = "[object Symbol]";
  437. function isSymbol(value) {
  438. return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag$3;
  439. }
  440. function arrayMap(array4, iteratee) {
  441. var index = -1, length = array4 == null ? 0 : array4.length, result = Array(length);
  442. while (++index < length) {
  443. result[index] = iteratee(array4[index], index, array4);
  444. }
  445. return result;
  446. }
  447. var isArray$1 = Array.isArray;
  448. var isArray$2 = isArray$1;
  449. var INFINITY$3 = 1 / 0;
  450. var symbolProto$2 = Symbol$2 ? Symbol$2.prototype : void 0, symbolToString = symbolProto$2 ? symbolProto$2.toString : void 0;
  451. function baseToString(value) {
  452. if (typeof value == "string") {
  453. return value;
  454. }
  455. if (isArray$2(value)) {
  456. return arrayMap(value, baseToString) + "";
  457. }
  458. if (isSymbol(value)) {
  459. return symbolToString ? symbolToString.call(value) : "";
  460. }
  461. var result = value + "";
  462. return result == "0" && 1 / value == -INFINITY$3 ? "-0" : result;
  463. }
  464. var reWhitespace = /\s/;
  465. function trimmedEndIndex(string3) {
  466. var index = string3.length;
  467. while (index-- && reWhitespace.test(string3.charAt(index))) {
  468. }
  469. return index;
  470. }
  471. var reTrimStart = /^\s+/;
  472. function baseTrim(string3) {
  473. return string3 ? string3.slice(0, trimmedEndIndex(string3) + 1).replace(reTrimStart, "") : string3;
  474. }
  475. function isObject$2(value) {
  476. var type4 = typeof value;
  477. return value != null && (type4 == "object" || type4 == "function");
  478. }
  479. var NAN = 0 / 0;
  480. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  481. var reIsBinary = /^0b[01]+$/i;
  482. var reIsOctal = /^0o[0-7]+$/i;
  483. var freeParseInt = parseInt;
  484. function toNumber(value) {
  485. if (typeof value == "number") {
  486. return value;
  487. }
  488. if (isSymbol(value)) {
  489. return NAN;
  490. }
  491. if (isObject$2(value)) {
  492. var other = typeof value.valueOf == "function" ? value.valueOf() : value;
  493. value = isObject$2(other) ? other + "" : other;
  494. }
  495. if (typeof value != "string") {
  496. return value === 0 ? value : +value;
  497. }
  498. value = baseTrim(value);
  499. var isBinary = reIsBinary.test(value);
  500. return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
  501. }
  502. function identity(value) {
  503. return value;
  504. }
  505. var asyncTag = "[object AsyncFunction]", funcTag$2 = "[object Function]", genTag$1 = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
  506. function isFunction$1(value) {
  507. if (!isObject$2(value)) {
  508. return false;
  509. }
  510. var tag = baseGetTag(value);
  511. return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag;
  512. }
  513. var coreJsData = root$1["__core-js_shared__"];
  514. var coreJsData$1 = coreJsData;
  515. var maskSrcKey = function() {
  516. var uid2 = /[^.]+$/.exec(coreJsData$1 && coreJsData$1.keys && coreJsData$1.keys.IE_PROTO || "");
  517. return uid2 ? "Symbol(src)_1." + uid2 : "";
  518. }();
  519. function isMasked(func) {
  520. return !!maskSrcKey && maskSrcKey in func;
  521. }
  522. var funcProto$1 = Function.prototype;
  523. var funcToString$1 = funcProto$1.toString;
  524. function toSource(func) {
  525. if (func != null) {
  526. try {
  527. return funcToString$1.call(func);
  528. } catch (e) {
  529. }
  530. try {
  531. return func + "";
  532. } catch (e) {
  533. }
  534. }
  535. return "";
  536. }
  537. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  538. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  539. var funcProto = Function.prototype, objectProto$c = Object.prototype;
  540. var funcToString = funcProto.toString;
  541. var hasOwnProperty$b = objectProto$c.hasOwnProperty;
  542. var reIsNative = RegExp("^" + funcToString.call(hasOwnProperty$b).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
  543. function baseIsNative(value) {
  544. if (!isObject$2(value) || isMasked(value)) {
  545. return false;
  546. }
  547. var pattern4 = isFunction$1(value) ? reIsNative : reIsHostCtor;
  548. return pattern4.test(toSource(value));
  549. }
  550. function getValue$1(object4, key) {
  551. return object4 == null ? void 0 : object4[key];
  552. }
  553. function getNative(object4, key) {
  554. var value = getValue$1(object4, key);
  555. return baseIsNative(value) ? value : void 0;
  556. }
  557. var WeakMap = getNative(root$1, "WeakMap");
  558. var WeakMap$1 = WeakMap;
  559. var objectCreate = Object.create;
  560. var baseCreate = function() {
  561. function object4() {
  562. }
  563. return function(proto) {
  564. if (!isObject$2(proto)) {
  565. return {};
  566. }
  567. if (objectCreate) {
  568. return objectCreate(proto);
  569. }
  570. object4.prototype = proto;
  571. var result = new object4();
  572. object4.prototype = void 0;
  573. return result;
  574. };
  575. }();
  576. var baseCreate$1 = baseCreate;
  577. function apply(func, thisArg, args) {
  578. switch (args.length) {
  579. case 0:
  580. return func.call(thisArg);
  581. case 1:
  582. return func.call(thisArg, args[0]);
  583. case 2:
  584. return func.call(thisArg, args[0], args[1]);
  585. case 3:
  586. return func.call(thisArg, args[0], args[1], args[2]);
  587. }
  588. return func.apply(thisArg, args);
  589. }
  590. function noop$1() {
  591. }
  592. function copyArray(source, array4) {
  593. var index = -1, length = source.length;
  594. array4 || (array4 = Array(length));
  595. while (++index < length) {
  596. array4[index] = source[index];
  597. }
  598. return array4;
  599. }
  600. var HOT_COUNT = 800, HOT_SPAN = 16;
  601. var nativeNow = Date.now;
  602. function shortOut(func) {
  603. var count = 0, lastCalled = 0;
  604. return function() {
  605. var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
  606. lastCalled = stamp;
  607. if (remaining > 0) {
  608. if (++count >= HOT_COUNT) {
  609. return arguments[0];
  610. }
  611. } else {
  612. count = 0;
  613. }
  614. return func.apply(void 0, arguments);
  615. };
  616. }
  617. function constant(value) {
  618. return function() {
  619. return value;
  620. };
  621. }
  622. var defineProperty = function() {
  623. try {
  624. var func = getNative(Object, "defineProperty");
  625. func({}, "", {});
  626. return func;
  627. } catch (e) {
  628. }
  629. }();
  630. var defineProperty$1 = defineProperty;
  631. var baseSetToString = !defineProperty$1 ? identity : function(func, string3) {
  632. return defineProperty$1(func, "toString", {
  633. "configurable": true,
  634. "enumerable": false,
  635. "value": constant(string3),
  636. "writable": true
  637. });
  638. };
  639. var baseSetToString$1 = baseSetToString;
  640. var setToString = shortOut(baseSetToString$1);
  641. var setToString$1 = setToString;
  642. function arrayEach(array4, iteratee) {
  643. var index = -1, length = array4 == null ? 0 : array4.length;
  644. while (++index < length) {
  645. if (iteratee(array4[index], index, array4) === false) {
  646. break;
  647. }
  648. }
  649. return array4;
  650. }
  651. function baseFindIndex(array4, predicate, fromIndex, fromRight) {
  652. var length = array4.length, index = fromIndex + (fromRight ? 1 : -1);
  653. while (fromRight ? index-- : ++index < length) {
  654. if (predicate(array4[index], index, array4)) {
  655. return index;
  656. }
  657. }
  658. return -1;
  659. }
  660. function baseIsNaN(value) {
  661. return value !== value;
  662. }
  663. function strictIndexOf(array4, value, fromIndex) {
  664. var index = fromIndex - 1, length = array4.length;
  665. while (++index < length) {
  666. if (array4[index] === value) {
  667. return index;
  668. }
  669. }
  670. return -1;
  671. }
  672. function baseIndexOf(array4, value, fromIndex) {
  673. return value === value ? strictIndexOf(array4, value, fromIndex) : baseFindIndex(array4, baseIsNaN, fromIndex);
  674. }
  675. function arrayIncludes(array4, value) {
  676. var length = array4 == null ? 0 : array4.length;
  677. return !!length && baseIndexOf(array4, value, 0) > -1;
  678. }
  679. var MAX_SAFE_INTEGER$1 = 9007199254740991;
  680. var reIsUint = /^(?:0|[1-9]\d*)$/;
  681. function isIndex(value, length) {
  682. var type4 = typeof value;
  683. length = length == null ? MAX_SAFE_INTEGER$1 : length;
  684. return !!length && (type4 == "number" || type4 != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
  685. }
  686. function baseAssignValue(object4, key, value) {
  687. if (key == "__proto__" && defineProperty$1) {
  688. defineProperty$1(object4, key, {
  689. "configurable": true,
  690. "enumerable": true,
  691. "value": value,
  692. "writable": true
  693. });
  694. } else {
  695. object4[key] = value;
  696. }
  697. }
  698. function eq(value, other) {
  699. return value === other || value !== value && other !== other;
  700. }
  701. var objectProto$b = Object.prototype;
  702. var hasOwnProperty$a = objectProto$b.hasOwnProperty;
  703. function assignValue(object4, key, value) {
  704. var objValue = object4[key];
  705. if (!(hasOwnProperty$a.call(object4, key) && eq(objValue, value)) || value === void 0 && !(key in object4)) {
  706. baseAssignValue(object4, key, value);
  707. }
  708. }
  709. function copyObject(source, props, object4, customizer) {
  710. var isNew = !object4;
  711. object4 || (object4 = {});
  712. var index = -1, length = props.length;
  713. while (++index < length) {
  714. var key = props[index];
  715. var newValue = customizer ? customizer(object4[key], source[key], key, object4, source) : void 0;
  716. if (newValue === void 0) {
  717. newValue = source[key];
  718. }
  719. if (isNew) {
  720. baseAssignValue(object4, key, newValue);
  721. } else {
  722. assignValue(object4, key, newValue);
  723. }
  724. }
  725. return object4;
  726. }
  727. var nativeMax$1 = Math.max;
  728. function overRest(func, start2, transform) {
  729. start2 = nativeMax$1(start2 === void 0 ? func.length - 1 : start2, 0);
  730. return function() {
  731. var args = arguments, index = -1, length = nativeMax$1(args.length - start2, 0), array4 = Array(length);
  732. while (++index < length) {
  733. array4[index] = args[start2 + index];
  734. }
  735. index = -1;
  736. var otherArgs = Array(start2 + 1);
  737. while (++index < start2) {
  738. otherArgs[index] = args[index];
  739. }
  740. otherArgs[start2] = transform(array4);
  741. return apply(func, this, otherArgs);
  742. };
  743. }
  744. function baseRest(func, start2) {
  745. return setToString$1(overRest(func, start2, identity), func + "");
  746. }
  747. var MAX_SAFE_INTEGER = 9007199254740991;
  748. function isLength(value) {
  749. return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  750. }
  751. function isArrayLike(value) {
  752. return value != null && isLength(value.length) && !isFunction$1(value);
  753. }
  754. var objectProto$a = Object.prototype;
  755. function isPrototype(value) {
  756. var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$a;
  757. return value === proto;
  758. }
  759. function baseTimes(n, iteratee) {
  760. var index = -1, result = Array(n);
  761. while (++index < n) {
  762. result[index] = iteratee(index);
  763. }
  764. return result;
  765. }
  766. var argsTag$3 = "[object Arguments]";
  767. function baseIsArguments(value) {
  768. return isObjectLike(value) && baseGetTag(value) == argsTag$3;
  769. }
  770. var objectProto$9 = Object.prototype;
  771. var hasOwnProperty$9 = objectProto$9.hasOwnProperty;
  772. var propertyIsEnumerable$1 = objectProto$9.propertyIsEnumerable;
  773. var isArguments = baseIsArguments(function() {
  774. return arguments;
  775. }()) ? baseIsArguments : function(value) {
  776. return isObjectLike(value) && hasOwnProperty$9.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
  777. };
  778. var isArguments$1 = isArguments;
  779. function stubFalse() {
  780. return false;
  781. }
  782. var freeExports$2 = typeof exports == "object" && exports && !exports.nodeType && exports;
  783. var freeModule$2 = freeExports$2 && typeof module == "object" && module && !module.nodeType && module;
  784. var moduleExports$2 = freeModule$2 && freeModule$2.exports === freeExports$2;
  785. var Buffer$1 = moduleExports$2 ? root$1.Buffer : void 0;
  786. var nativeIsBuffer = Buffer$1 ? Buffer$1.isBuffer : void 0;
  787. var isBuffer = nativeIsBuffer || stubFalse;
  788. var isBuffer$1 = isBuffer;
  789. var argsTag$2 = "[object Arguments]", arrayTag$2 = "[object Array]", boolTag$3 = "[object Boolean]", dateTag$3 = "[object Date]", errorTag$2 = "[object Error]", funcTag$1 = "[object Function]", mapTag$5 = "[object Map]", numberTag$3 = "[object Number]", objectTag$3 = "[object Object]", regexpTag$3 = "[object RegExp]", setTag$5 = "[object Set]", stringTag$3 = "[object String]", weakMapTag$2 = "[object WeakMap]";
  790. var arrayBufferTag$3 = "[object ArrayBuffer]", dataViewTag$4 = "[object DataView]", float32Tag$2 = "[object Float32Array]", float64Tag$2 = "[object Float64Array]", int8Tag$2 = "[object Int8Array]", int16Tag$2 = "[object Int16Array]", int32Tag$2 = "[object Int32Array]", uint8Tag$2 = "[object Uint8Array]", uint8ClampedTag$2 = "[object Uint8ClampedArray]", uint16Tag$2 = "[object Uint16Array]", uint32Tag$2 = "[object Uint32Array]";
  791. var typedArrayTags = {};
  792. typedArrayTags[float32Tag$2] = typedArrayTags[float64Tag$2] = typedArrayTags[int8Tag$2] = typedArrayTags[int16Tag$2] = typedArrayTags[int32Tag$2] = typedArrayTags[uint8Tag$2] = typedArrayTags[uint8ClampedTag$2] = typedArrayTags[uint16Tag$2] = typedArrayTags[uint32Tag$2] = true;
  793. typedArrayTags[argsTag$2] = typedArrayTags[arrayTag$2] = typedArrayTags[arrayBufferTag$3] = typedArrayTags[boolTag$3] = typedArrayTags[dataViewTag$4] = typedArrayTags[dateTag$3] = typedArrayTags[errorTag$2] = typedArrayTags[funcTag$1] = typedArrayTags[mapTag$5] = typedArrayTags[numberTag$3] = typedArrayTags[objectTag$3] = typedArrayTags[regexpTag$3] = typedArrayTags[setTag$5] = typedArrayTags[stringTag$3] = typedArrayTags[weakMapTag$2] = false;
  794. function baseIsTypedArray(value) {
  795. return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  796. }
  797. function baseUnary(func) {
  798. return function(value) {
  799. return func(value);
  800. };
  801. }
  802. var freeExports$1 = typeof exports == "object" && exports && !exports.nodeType && exports;
  803. var freeModule$1 = freeExports$1 && typeof module == "object" && module && !module.nodeType && module;
  804. var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
  805. var freeProcess = moduleExports$1 && freeGlobal$1.process;
  806. var nodeUtil = function() {
  807. try {
  808. var types2 = freeModule$1 && freeModule$1.require && freeModule$1.require("util").types;
  809. if (types2) {
  810. return types2;
  811. }
  812. return freeProcess && freeProcess.binding && freeProcess.binding("util");
  813. } catch (e) {
  814. }
  815. }();
  816. var nodeUtil$1 = nodeUtil;
  817. var nodeIsTypedArray = nodeUtil$1 && nodeUtil$1.isTypedArray;
  818. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  819. var isTypedArray$1 = isTypedArray;
  820. var objectProto$8 = Object.prototype;
  821. var hasOwnProperty$8 = objectProto$8.hasOwnProperty;
  822. function arrayLikeKeys(value, inherited) {
  823. var isArr = isArray$2(value), isArg = !isArr && isArguments$1(value), isBuff = !isArr && !isArg && isBuffer$1(value), isType = !isArr && !isArg && !isBuff && isTypedArray$1(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
  824. for (var key in value) {
  825. if ((inherited || hasOwnProperty$8.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || isIndex(key, length)))) {
  826. result.push(key);
  827. }
  828. }
  829. return result;
  830. }
  831. function overArg(func, transform) {
  832. return function(arg) {
  833. return func(transform(arg));
  834. };
  835. }
  836. var nativeKeys = overArg(Object.keys, Object);
  837. var nativeKeys$1 = nativeKeys;
  838. var objectProto$7 = Object.prototype;
  839. var hasOwnProperty$7 = objectProto$7.hasOwnProperty;
  840. function baseKeys(object4) {
  841. if (!isPrototype(object4)) {
  842. return nativeKeys$1(object4);
  843. }
  844. var result = [];
  845. for (var key in Object(object4)) {
  846. if (hasOwnProperty$7.call(object4, key) && key != "constructor") {
  847. result.push(key);
  848. }
  849. }
  850. return result;
  851. }
  852. function keys(object4) {
  853. return isArrayLike(object4) ? arrayLikeKeys(object4) : baseKeys(object4);
  854. }
  855. function nativeKeysIn(object4) {
  856. var result = [];
  857. if (object4 != null) {
  858. for (var key in Object(object4)) {
  859. result.push(key);
  860. }
  861. }
  862. return result;
  863. }
  864. var objectProto$6 = Object.prototype;
  865. var hasOwnProperty$6 = objectProto$6.hasOwnProperty;
  866. function baseKeysIn(object4) {
  867. if (!isObject$2(object4)) {
  868. return nativeKeysIn(object4);
  869. }
  870. var isProto = isPrototype(object4), result = [];
  871. for (var key in object4) {
  872. if (!(key == "constructor" && (isProto || !hasOwnProperty$6.call(object4, key)))) {
  873. result.push(key);
  874. }
  875. }
  876. return result;
  877. }
  878. function keysIn(object4) {
  879. return isArrayLike(object4) ? arrayLikeKeys(object4, true) : baseKeysIn(object4);
  880. }
  881. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/;
  882. function isKey(value, object4) {
  883. if (isArray$2(value)) {
  884. return false;
  885. }
  886. var type4 = typeof value;
  887. if (type4 == "number" || type4 == "symbol" || type4 == "boolean" || value == null || isSymbol(value)) {
  888. return true;
  889. }
  890. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object4 != null && value in Object(object4);
  891. }
  892. var nativeCreate = getNative(Object, "create");
  893. var nativeCreate$1 = nativeCreate;
  894. function hashClear() {
  895. this.__data__ = nativeCreate$1 ? nativeCreate$1(null) : {};
  896. this.size = 0;
  897. }
  898. function hashDelete(key) {
  899. var result = this.has(key) && delete this.__data__[key];
  900. this.size -= result ? 1 : 0;
  901. return result;
  902. }
  903. var HASH_UNDEFINED$2 = "__lodash_hash_undefined__";
  904. var objectProto$5 = Object.prototype;
  905. var hasOwnProperty$5 = objectProto$5.hasOwnProperty;
  906. function hashGet(key) {
  907. var data2 = this.__data__;
  908. if (nativeCreate$1) {
  909. var result = data2[key];
  910. return result === HASH_UNDEFINED$2 ? void 0 : result;
  911. }
  912. return hasOwnProperty$5.call(data2, key) ? data2[key] : void 0;
  913. }
  914. var objectProto$4 = Object.prototype;
  915. var hasOwnProperty$4 = objectProto$4.hasOwnProperty;
  916. function hashHas(key) {
  917. var data2 = this.__data__;
  918. return nativeCreate$1 ? data2[key] !== void 0 : hasOwnProperty$4.call(data2, key);
  919. }
  920. var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
  921. function hashSet(key, value) {
  922. var data2 = this.__data__;
  923. this.size += this.has(key) ? 0 : 1;
  924. data2[key] = nativeCreate$1 && value === void 0 ? HASH_UNDEFINED$1 : value;
  925. return this;
  926. }
  927. function Hash(entries) {
  928. var index = -1, length = entries == null ? 0 : entries.length;
  929. this.clear();
  930. while (++index < length) {
  931. var entry = entries[index];
  932. this.set(entry[0], entry[1]);
  933. }
  934. }
  935. Hash.prototype.clear = hashClear;
  936. Hash.prototype["delete"] = hashDelete;
  937. Hash.prototype.get = hashGet;
  938. Hash.prototype.has = hashHas;
  939. Hash.prototype.set = hashSet;
  940. function listCacheClear() {
  941. this.__data__ = [];
  942. this.size = 0;
  943. }
  944. function assocIndexOf(array4, key) {
  945. var length = array4.length;
  946. while (length--) {
  947. if (eq(array4[length][0], key)) {
  948. return length;
  949. }
  950. }
  951. return -1;
  952. }
  953. var arrayProto = Array.prototype;
  954. var splice = arrayProto.splice;
  955. function listCacheDelete(key) {
  956. var data2 = this.__data__, index = assocIndexOf(data2, key);
  957. if (index < 0) {
  958. return false;
  959. }
  960. var lastIndex = data2.length - 1;
  961. if (index == lastIndex) {
  962. data2.pop();
  963. } else {
  964. splice.call(data2, index, 1);
  965. }
  966. --this.size;
  967. return true;
  968. }
  969. function listCacheGet(key) {
  970. var data2 = this.__data__, index = assocIndexOf(data2, key);
  971. return index < 0 ? void 0 : data2[index][1];
  972. }
  973. function listCacheHas(key) {
  974. return assocIndexOf(this.__data__, key) > -1;
  975. }
  976. function listCacheSet(key, value) {
  977. var data2 = this.__data__, index = assocIndexOf(data2, key);
  978. if (index < 0) {
  979. ++this.size;
  980. data2.push([key, value]);
  981. } else {
  982. data2[index][1] = value;
  983. }
  984. return this;
  985. }
  986. function ListCache(entries) {
  987. var index = -1, length = entries == null ? 0 : entries.length;
  988. this.clear();
  989. while (++index < length) {
  990. var entry = entries[index];
  991. this.set(entry[0], entry[1]);
  992. }
  993. }
  994. ListCache.prototype.clear = listCacheClear;
  995. ListCache.prototype["delete"] = listCacheDelete;
  996. ListCache.prototype.get = listCacheGet;
  997. ListCache.prototype.has = listCacheHas;
  998. ListCache.prototype.set = listCacheSet;
  999. var Map$1 = getNative(root$1, "Map");
  1000. var Map$2 = Map$1;
  1001. function mapCacheClear() {
  1002. this.size = 0;
  1003. this.__data__ = {
  1004. "hash": new Hash(),
  1005. "map": new (Map$2 || ListCache)(),
  1006. "string": new Hash()
  1007. };
  1008. }
  1009. function isKeyable(value) {
  1010. var type4 = typeof value;
  1011. return type4 == "string" || type4 == "number" || type4 == "symbol" || type4 == "boolean" ? value !== "__proto__" : value === null;
  1012. }
  1013. function getMapData(map, key) {
  1014. var data2 = map.__data__;
  1015. return isKeyable(key) ? data2[typeof key == "string" ? "string" : "hash"] : data2.map;
  1016. }
  1017. function mapCacheDelete(key) {
  1018. var result = getMapData(this, key)["delete"](key);
  1019. this.size -= result ? 1 : 0;
  1020. return result;
  1021. }
  1022. function mapCacheGet(key) {
  1023. return getMapData(this, key).get(key);
  1024. }
  1025. function mapCacheHas(key) {
  1026. return getMapData(this, key).has(key);
  1027. }
  1028. function mapCacheSet(key, value) {
  1029. var data2 = getMapData(this, key), size = data2.size;
  1030. data2.set(key, value);
  1031. this.size += data2.size == size ? 0 : 1;
  1032. return this;
  1033. }
  1034. function MapCache(entries) {
  1035. var index = -1, length = entries == null ? 0 : entries.length;
  1036. this.clear();
  1037. while (++index < length) {
  1038. var entry = entries[index];
  1039. this.set(entry[0], entry[1]);
  1040. }
  1041. }
  1042. MapCache.prototype.clear = mapCacheClear;
  1043. MapCache.prototype["delete"] = mapCacheDelete;
  1044. MapCache.prototype.get = mapCacheGet;
  1045. MapCache.prototype.has = mapCacheHas;
  1046. MapCache.prototype.set = mapCacheSet;
  1047. var FUNC_ERROR_TEXT$2 = "Expected a function";
  1048. function memoize(func, resolver) {
  1049. if (typeof func != "function" || resolver != null && typeof resolver != "function") {
  1050. throw new TypeError(FUNC_ERROR_TEXT$2);
  1051. }
  1052. var memoized = function() {
  1053. var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
  1054. if (cache.has(key)) {
  1055. return cache.get(key);
  1056. }
  1057. var result = func.apply(this, args);
  1058. memoized.cache = cache.set(key, result) || cache;
  1059. return result;
  1060. };
  1061. memoized.cache = new (memoize.Cache || MapCache)();
  1062. return memoized;
  1063. }
  1064. memoize.Cache = MapCache;
  1065. var MAX_MEMOIZE_SIZE = 500;
  1066. function memoizeCapped(func) {
  1067. var result = memoize(func, function(key) {
  1068. if (cache.size === MAX_MEMOIZE_SIZE) {
  1069. cache.clear();
  1070. }
  1071. return key;
  1072. });
  1073. var cache = result.cache;
  1074. return result;
  1075. }
  1076. var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  1077. var reEscapeChar = /\\(\\)?/g;
  1078. var stringToPath = memoizeCapped(function(string3) {
  1079. var result = [];
  1080. if (string3.charCodeAt(0) === 46) {
  1081. result.push("");
  1082. }
  1083. string3.replace(rePropName, function(match, number4, quote, subString) {
  1084. result.push(quote ? subString.replace(reEscapeChar, "$1") : number4 || match);
  1085. });
  1086. return result;
  1087. });
  1088. var stringToPath$1 = stringToPath;
  1089. function toString(value) {
  1090. return value == null ? "" : baseToString(value);
  1091. }
  1092. function castPath(value, object4) {
  1093. if (isArray$2(value)) {
  1094. return value;
  1095. }
  1096. return isKey(value, object4) ? [value] : stringToPath$1(toString(value));
  1097. }
  1098. var INFINITY$2 = 1 / 0;
  1099. function toKey(value) {
  1100. if (typeof value == "string" || isSymbol(value)) {
  1101. return value;
  1102. }
  1103. var result = value + "";
  1104. return result == "0" && 1 / value == -INFINITY$2 ? "-0" : result;
  1105. }
  1106. function baseGet(object4, path) {
  1107. path = castPath(path, object4);
  1108. var index = 0, length = path.length;
  1109. while (object4 != null && index < length) {
  1110. object4 = object4[toKey(path[index++])];
  1111. }
  1112. return index && index == length ? object4 : void 0;
  1113. }
  1114. function get(object4, path, defaultValue) {
  1115. var result = object4 == null ? void 0 : baseGet(object4, path);
  1116. return result === void 0 ? defaultValue : result;
  1117. }
  1118. function arrayPush(array4, values) {
  1119. var index = -1, length = values.length, offset2 = array4.length;
  1120. while (++index < length) {
  1121. array4[offset2 + index] = values[index];
  1122. }
  1123. return array4;
  1124. }
  1125. var spreadableSymbol = Symbol$2 ? Symbol$2.isConcatSpreadable : void 0;
  1126. function isFlattenable(value) {
  1127. return isArray$2(value) || isArguments$1(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
  1128. }
  1129. function baseFlatten(array4, depth, predicate, isStrict, result) {
  1130. var index = -1, length = array4.length;
  1131. predicate || (predicate = isFlattenable);
  1132. result || (result = []);
  1133. while (++index < length) {
  1134. var value = array4[index];
  1135. if (depth > 0 && predicate(value)) {
  1136. if (depth > 1) {
  1137. baseFlatten(value, depth - 1, predicate, isStrict, result);
  1138. } else {
  1139. arrayPush(result, value);
  1140. }
  1141. } else if (!isStrict) {
  1142. result[result.length] = value;
  1143. }
  1144. }
  1145. return result;
  1146. }
  1147. var getPrototype = overArg(Object.getPrototypeOf, Object);
  1148. var getPrototype$1 = getPrototype;
  1149. function castArray$1() {
  1150. if (!arguments.length) {
  1151. return [];
  1152. }
  1153. var value = arguments[0];
  1154. return isArray$2(value) ? value : [value];
  1155. }
  1156. function stackClear() {
  1157. this.__data__ = new ListCache();
  1158. this.size = 0;
  1159. }
  1160. function stackDelete(key) {
  1161. var data2 = this.__data__, result = data2["delete"](key);
  1162. this.size = data2.size;
  1163. return result;
  1164. }
  1165. function stackGet(key) {
  1166. return this.__data__.get(key);
  1167. }
  1168. function stackHas(key) {
  1169. return this.__data__.has(key);
  1170. }
  1171. var LARGE_ARRAY_SIZE$1 = 200;
  1172. function stackSet(key, value) {
  1173. var data2 = this.__data__;
  1174. if (data2 instanceof ListCache) {
  1175. var pairs = data2.__data__;
  1176. if (!Map$2 || pairs.length < LARGE_ARRAY_SIZE$1 - 1) {
  1177. pairs.push([key, value]);
  1178. this.size = ++data2.size;
  1179. return this;
  1180. }
  1181. data2 = this.__data__ = new MapCache(pairs);
  1182. }
  1183. data2.set(key, value);
  1184. this.size = data2.size;
  1185. return this;
  1186. }
  1187. function Stack(entries) {
  1188. var data2 = this.__data__ = new ListCache(entries);
  1189. this.size = data2.size;
  1190. }
  1191. Stack.prototype.clear = stackClear;
  1192. Stack.prototype["delete"] = stackDelete;
  1193. Stack.prototype.get = stackGet;
  1194. Stack.prototype.has = stackHas;
  1195. Stack.prototype.set = stackSet;
  1196. function baseAssign(object4, source) {
  1197. return object4 && copyObject(source, keys(source), object4);
  1198. }
  1199. function baseAssignIn(object4, source) {
  1200. return object4 && copyObject(source, keysIn(source), object4);
  1201. }
  1202. var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
  1203. var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
  1204. var moduleExports = freeModule && freeModule.exports === freeExports;
  1205. var Buffer2 = moduleExports ? root$1.Buffer : void 0, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : void 0;
  1206. function cloneBuffer(buffer, isDeep) {
  1207. if (isDeep) {
  1208. return buffer.slice();
  1209. }
  1210. var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  1211. buffer.copy(result);
  1212. return result;
  1213. }
  1214. function arrayFilter(array4, predicate) {
  1215. var index = -1, length = array4 == null ? 0 : array4.length, resIndex = 0, result = [];
  1216. while (++index < length) {
  1217. var value = array4[index];
  1218. if (predicate(value, index, array4)) {
  1219. result[resIndex++] = value;
  1220. }
  1221. }
  1222. return result;
  1223. }
  1224. function stubArray() {
  1225. return [];
  1226. }
  1227. var objectProto$3 = Object.prototype;
  1228. var propertyIsEnumerable = objectProto$3.propertyIsEnumerable;
  1229. var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
  1230. var getSymbols = !nativeGetSymbols$1 ? stubArray : function(object4) {
  1231. if (object4 == null) {
  1232. return [];
  1233. }
  1234. object4 = Object(object4);
  1235. return arrayFilter(nativeGetSymbols$1(object4), function(symbol) {
  1236. return propertyIsEnumerable.call(object4, symbol);
  1237. });
  1238. };
  1239. var getSymbols$1 = getSymbols;
  1240. function copySymbols(source, object4) {
  1241. return copyObject(source, getSymbols$1(source), object4);
  1242. }
  1243. var nativeGetSymbols = Object.getOwnPropertySymbols;
  1244. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object4) {
  1245. var result = [];
  1246. while (object4) {
  1247. arrayPush(result, getSymbols$1(object4));
  1248. object4 = getPrototype$1(object4);
  1249. }
  1250. return result;
  1251. };
  1252. var getSymbolsIn$1 = getSymbolsIn;
  1253. function copySymbolsIn(source, object4) {
  1254. return copyObject(source, getSymbolsIn$1(source), object4);
  1255. }
  1256. function baseGetAllKeys(object4, keysFunc, symbolsFunc) {
  1257. var result = keysFunc(object4);
  1258. return isArray$2(object4) ? result : arrayPush(result, symbolsFunc(object4));
  1259. }
  1260. function getAllKeys(object4) {
  1261. return baseGetAllKeys(object4, keys, getSymbols$1);
  1262. }
  1263. function getAllKeysIn(object4) {
  1264. return baseGetAllKeys(object4, keysIn, getSymbolsIn$1);
  1265. }
  1266. var DataView = getNative(root$1, "DataView");
  1267. var DataView$1 = DataView;
  1268. var Promise$1 = getNative(root$1, "Promise");
  1269. var Promise$2 = Promise$1;
  1270. var Set$1 = getNative(root$1, "Set");
  1271. var Set$2 = Set$1;
  1272. var mapTag$4 = "[object Map]", objectTag$2 = "[object Object]", promiseTag = "[object Promise]", setTag$4 = "[object Set]", weakMapTag$1 = "[object WeakMap]";
  1273. var dataViewTag$3 = "[object DataView]";
  1274. var dataViewCtorString = toSource(DataView$1), mapCtorString = toSource(Map$2), promiseCtorString = toSource(Promise$2), setCtorString = toSource(Set$2), weakMapCtorString = toSource(WeakMap$1);
  1275. var getTag = baseGetTag;
  1276. if (DataView$1 && getTag(new DataView$1(new ArrayBuffer(1))) != dataViewTag$3 || Map$2 && getTag(new Map$2()) != mapTag$4 || Promise$2 && getTag(Promise$2.resolve()) != promiseTag || Set$2 && getTag(new Set$2()) != setTag$4 || WeakMap$1 && getTag(new WeakMap$1()) != weakMapTag$1) {
  1277. getTag = function(value) {
  1278. var result = baseGetTag(value), Ctor = result == objectTag$2 ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
  1279. if (ctorString) {
  1280. switch (ctorString) {
  1281. case dataViewCtorString:
  1282. return dataViewTag$3;
  1283. case mapCtorString:
  1284. return mapTag$4;
  1285. case promiseCtorString:
  1286. return promiseTag;
  1287. case setCtorString:
  1288. return setTag$4;
  1289. case weakMapCtorString:
  1290. return weakMapTag$1;
  1291. }
  1292. }
  1293. return result;
  1294. };
  1295. }
  1296. var getTag$1 = getTag;
  1297. var objectProto$2 = Object.prototype;
  1298. var hasOwnProperty$3 = objectProto$2.hasOwnProperty;
  1299. function initCloneArray(array4) {
  1300. var length = array4.length, result = new array4.constructor(length);
  1301. if (length && typeof array4[0] == "string" && hasOwnProperty$3.call(array4, "index")) {
  1302. result.index = array4.index;
  1303. result.input = array4.input;
  1304. }
  1305. return result;
  1306. }
  1307. var Uint8Array2 = root$1.Uint8Array;
  1308. var Uint8Array$1 = Uint8Array2;
  1309. function cloneArrayBuffer(arrayBuffer) {
  1310. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  1311. new Uint8Array$1(result).set(new Uint8Array$1(arrayBuffer));
  1312. return result;
  1313. }
  1314. function cloneDataView(dataView, isDeep) {
  1315. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  1316. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  1317. }
  1318. var reFlags = /\w*$/;
  1319. function cloneRegExp(regexp4) {
  1320. var result = new regexp4.constructor(regexp4.source, reFlags.exec(regexp4));
  1321. result.lastIndex = regexp4.lastIndex;
  1322. return result;
  1323. }
  1324. var symbolProto$1 = Symbol$2 ? Symbol$2.prototype : void 0, symbolValueOf$1 = symbolProto$1 ? symbolProto$1.valueOf : void 0;
  1325. function cloneSymbol(symbol) {
  1326. return symbolValueOf$1 ? Object(symbolValueOf$1.call(symbol)) : {};
  1327. }
  1328. function cloneTypedArray(typedArray, isDeep) {
  1329. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  1330. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  1331. }
  1332. var boolTag$2 = "[object Boolean]", dateTag$2 = "[object Date]", mapTag$3 = "[object Map]", numberTag$2 = "[object Number]", regexpTag$2 = "[object RegExp]", setTag$3 = "[object Set]", stringTag$2 = "[object String]", symbolTag$2 = "[object Symbol]";
  1333. var arrayBufferTag$2 = "[object ArrayBuffer]", dataViewTag$2 = "[object DataView]", float32Tag$1 = "[object Float32Array]", float64Tag$1 = "[object Float64Array]", int8Tag$1 = "[object Int8Array]", int16Tag$1 = "[object Int16Array]", int32Tag$1 = "[object Int32Array]", uint8Tag$1 = "[object Uint8Array]", uint8ClampedTag$1 = "[object Uint8ClampedArray]", uint16Tag$1 = "[object Uint16Array]", uint32Tag$1 = "[object Uint32Array]";
  1334. function initCloneByTag(object4, tag, isDeep) {
  1335. var Ctor = object4.constructor;
  1336. switch (tag) {
  1337. case arrayBufferTag$2:
  1338. return cloneArrayBuffer(object4);
  1339. case boolTag$2:
  1340. case dateTag$2:
  1341. return new Ctor(+object4);
  1342. case dataViewTag$2:
  1343. return cloneDataView(object4, isDeep);
  1344. case float32Tag$1:
  1345. case float64Tag$1:
  1346. case int8Tag$1:
  1347. case int16Tag$1:
  1348. case int32Tag$1:
  1349. case uint8Tag$1:
  1350. case uint8ClampedTag$1:
  1351. case uint16Tag$1:
  1352. case uint32Tag$1:
  1353. return cloneTypedArray(object4, isDeep);
  1354. case mapTag$3:
  1355. return new Ctor();
  1356. case numberTag$2:
  1357. case stringTag$2:
  1358. return new Ctor(object4);
  1359. case regexpTag$2:
  1360. return cloneRegExp(object4);
  1361. case setTag$3:
  1362. return new Ctor();
  1363. case symbolTag$2:
  1364. return cloneSymbol(object4);
  1365. }
  1366. }
  1367. function initCloneObject(object4) {
  1368. return typeof object4.constructor == "function" && !isPrototype(object4) ? baseCreate$1(getPrototype$1(object4)) : {};
  1369. }
  1370. var mapTag$2 = "[object Map]";
  1371. function baseIsMap(value) {
  1372. return isObjectLike(value) && getTag$1(value) == mapTag$2;
  1373. }
  1374. var nodeIsMap = nodeUtil$1 && nodeUtil$1.isMap;
  1375. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  1376. var isMap$1 = isMap;
  1377. var setTag$2 = "[object Set]";
  1378. function baseIsSet(value) {
  1379. return isObjectLike(value) && getTag$1(value) == setTag$2;
  1380. }
  1381. var nodeIsSet = nodeUtil$1 && nodeUtil$1.isSet;
  1382. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  1383. var isSet$1 = isSet;
  1384. var CLONE_DEEP_FLAG$1 = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG$2 = 4;
  1385. var argsTag$1 = "[object Arguments]", arrayTag$1 = "[object Array]", boolTag$1 = "[object Boolean]", dateTag$1 = "[object Date]", errorTag$1 = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag$1 = "[object Map]", numberTag$1 = "[object Number]", objectTag$1 = "[object Object]", regexpTag$1 = "[object RegExp]", setTag$1 = "[object Set]", stringTag$1 = "[object String]", symbolTag$1 = "[object Symbol]", weakMapTag = "[object WeakMap]";
  1386. var arrayBufferTag$1 = "[object ArrayBuffer]", dataViewTag$1 = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
  1387. var cloneableTags = {};
  1388. cloneableTags[argsTag$1] = cloneableTags[arrayTag$1] = cloneableTags[arrayBufferTag$1] = cloneableTags[dataViewTag$1] = cloneableTags[boolTag$1] = cloneableTags[dateTag$1] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag$1] = cloneableTags[numberTag$1] = cloneableTags[objectTag$1] = cloneableTags[regexpTag$1] = cloneableTags[setTag$1] = cloneableTags[stringTag$1] = cloneableTags[symbolTag$1] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  1389. cloneableTags[errorTag$1] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
  1390. function baseClone(value, bitmask, customizer, key, object4, stack) {
  1391. var result, isDeep = bitmask & CLONE_DEEP_FLAG$1, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG$2;
  1392. if (customizer) {
  1393. result = object4 ? customizer(value, key, object4, stack) : customizer(value);
  1394. }
  1395. if (result !== void 0) {
  1396. return result;
  1397. }
  1398. if (!isObject$2(value)) {
  1399. return value;
  1400. }
  1401. var isArr = isArray$2(value);
  1402. if (isArr) {
  1403. result = initCloneArray(value);
  1404. if (!isDeep) {
  1405. return copyArray(value, result);
  1406. }
  1407. } else {
  1408. var tag = getTag$1(value), isFunc = tag == funcTag || tag == genTag;
  1409. if (isBuffer$1(value)) {
  1410. return cloneBuffer(value, isDeep);
  1411. }
  1412. if (tag == objectTag$1 || tag == argsTag$1 || isFunc && !object4) {
  1413. result = isFlat || isFunc ? {} : initCloneObject(value);
  1414. if (!isDeep) {
  1415. return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value));
  1416. }
  1417. } else {
  1418. if (!cloneableTags[tag]) {
  1419. return object4 ? value : {};
  1420. }
  1421. result = initCloneByTag(value, tag, isDeep);
  1422. }
  1423. }
  1424. stack || (stack = new Stack());
  1425. var stacked = stack.get(value);
  1426. if (stacked) {
  1427. return stacked;
  1428. }
  1429. stack.set(value, result);
  1430. if (isSet$1(value)) {
  1431. value.forEach(function(subValue) {
  1432. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  1433. });
  1434. } else if (isMap$1(value)) {
  1435. value.forEach(function(subValue, key2) {
  1436. result.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
  1437. });
  1438. }
  1439. var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys;
  1440. var props = isArr ? void 0 : keysFunc(value);
  1441. arrayEach(props || value, function(subValue, key2) {
  1442. if (props) {
  1443. key2 = subValue;
  1444. subValue = value[key2];
  1445. }
  1446. assignValue(result, key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
  1447. });
  1448. return result;
  1449. }
  1450. var CLONE_SYMBOLS_FLAG$1 = 4;
  1451. function clone(value) {
  1452. return baseClone(value, CLONE_SYMBOLS_FLAG$1);
  1453. }
  1454. var CLONE_DEEP_FLAG = 1, CLONE_SYMBOLS_FLAG = 4;
  1455. function cloneDeep(value) {
  1456. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  1457. }
  1458. var HASH_UNDEFINED = "__lodash_hash_undefined__";
  1459. function setCacheAdd(value) {
  1460. this.__data__.set(value, HASH_UNDEFINED);
  1461. return this;
  1462. }
  1463. function setCacheHas(value) {
  1464. return this.__data__.has(value);
  1465. }
  1466. function SetCache(values) {
  1467. var index = -1, length = values == null ? 0 : values.length;
  1468. this.__data__ = new MapCache();
  1469. while (++index < length) {
  1470. this.add(values[index]);
  1471. }
  1472. }
  1473. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  1474. SetCache.prototype.has = setCacheHas;
  1475. function arraySome(array4, predicate) {
  1476. var index = -1, length = array4 == null ? 0 : array4.length;
  1477. while (++index < length) {
  1478. if (predicate(array4[index], index, array4)) {
  1479. return true;
  1480. }
  1481. }
  1482. return false;
  1483. }
  1484. function cacheHas(cache, key) {
  1485. return cache.has(key);
  1486. }
  1487. var COMPARE_PARTIAL_FLAG$3 = 1, COMPARE_UNORDERED_FLAG$1 = 2;
  1488. function equalArrays(array4, other, bitmask, customizer, equalFunc, stack) {
  1489. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, arrLength = array4.length, othLength = other.length;
  1490. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  1491. return false;
  1492. }
  1493. var arrStacked = stack.get(array4);
  1494. var othStacked = stack.get(other);
  1495. if (arrStacked && othStacked) {
  1496. return arrStacked == other && othStacked == array4;
  1497. }
  1498. var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG$1 ? new SetCache() : void 0;
  1499. stack.set(array4, other);
  1500. stack.set(other, array4);
  1501. while (++index < arrLength) {
  1502. var arrValue = array4[index], othValue = other[index];
  1503. if (customizer) {
  1504. var compared = isPartial ? customizer(othValue, arrValue, index, other, array4, stack) : customizer(arrValue, othValue, index, array4, other, stack);
  1505. }
  1506. if (compared !== void 0) {
  1507. if (compared) {
  1508. continue;
  1509. }
  1510. result = false;
  1511. break;
  1512. }
  1513. if (seen) {
  1514. if (!arraySome(other, function(othValue2, othIndex) {
  1515. if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
  1516. return seen.push(othIndex);
  1517. }
  1518. })) {
  1519. result = false;
  1520. break;
  1521. }
  1522. } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  1523. result = false;
  1524. break;
  1525. }
  1526. }
  1527. stack["delete"](array4);
  1528. stack["delete"](other);
  1529. return result;
  1530. }
  1531. function mapToArray(map) {
  1532. var index = -1, result = Array(map.size);
  1533. map.forEach(function(value, key) {
  1534. result[++index] = [key, value];
  1535. });
  1536. return result;
  1537. }
  1538. function setToArray(set2) {
  1539. var index = -1, result = Array(set2.size);
  1540. set2.forEach(function(value) {
  1541. result[++index] = value;
  1542. });
  1543. return result;
  1544. }
  1545. var COMPARE_PARTIAL_FLAG$2 = 1, COMPARE_UNORDERED_FLAG = 2;
  1546. var boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", mapTag = "[object Map]", numberTag = "[object Number]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]";
  1547. var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]";
  1548. var symbolProto = Symbol$2 ? Symbol$2.prototype : void 0, symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
  1549. function equalByTag(object4, other, tag, bitmask, customizer, equalFunc, stack) {
  1550. switch (tag) {
  1551. case dataViewTag:
  1552. if (object4.byteLength != other.byteLength || object4.byteOffset != other.byteOffset) {
  1553. return false;
  1554. }
  1555. object4 = object4.buffer;
  1556. other = other.buffer;
  1557. case arrayBufferTag:
  1558. if (object4.byteLength != other.byteLength || !equalFunc(new Uint8Array$1(object4), new Uint8Array$1(other))) {
  1559. return false;
  1560. }
  1561. return true;
  1562. case boolTag:
  1563. case dateTag:
  1564. case numberTag:
  1565. return eq(+object4, +other);
  1566. case errorTag:
  1567. return object4.name == other.name && object4.message == other.message;
  1568. case regexpTag:
  1569. case stringTag:
  1570. return object4 == other + "";
  1571. case mapTag:
  1572. var convert = mapToArray;
  1573. case setTag:
  1574. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$2;
  1575. convert || (convert = setToArray);
  1576. if (object4.size != other.size && !isPartial) {
  1577. return false;
  1578. }
  1579. var stacked = stack.get(object4);
  1580. if (stacked) {
  1581. return stacked == other;
  1582. }
  1583. bitmask |= COMPARE_UNORDERED_FLAG;
  1584. stack.set(object4, other);
  1585. var result = equalArrays(convert(object4), convert(other), bitmask, customizer, equalFunc, stack);
  1586. stack["delete"](object4);
  1587. return result;
  1588. case symbolTag:
  1589. if (symbolValueOf) {
  1590. return symbolValueOf.call(object4) == symbolValueOf.call(other);
  1591. }
  1592. }
  1593. return false;
  1594. }
  1595. var COMPARE_PARTIAL_FLAG$1 = 1;
  1596. var objectProto$1 = Object.prototype;
  1597. var hasOwnProperty$2 = objectProto$1.hasOwnProperty;
  1598. function equalObjects(object4, other, bitmask, customizer, equalFunc, stack) {
  1599. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$1, objProps = getAllKeys(object4), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
  1600. if (objLength != othLength && !isPartial) {
  1601. return false;
  1602. }
  1603. var index = objLength;
  1604. while (index--) {
  1605. var key = objProps[index];
  1606. if (!(isPartial ? key in other : hasOwnProperty$2.call(other, key))) {
  1607. return false;
  1608. }
  1609. }
  1610. var objStacked = stack.get(object4);
  1611. var othStacked = stack.get(other);
  1612. if (objStacked && othStacked) {
  1613. return objStacked == other && othStacked == object4;
  1614. }
  1615. var result = true;
  1616. stack.set(object4, other);
  1617. stack.set(other, object4);
  1618. var skipCtor = isPartial;
  1619. while (++index < objLength) {
  1620. key = objProps[index];
  1621. var objValue = object4[key], othValue = other[key];
  1622. if (customizer) {
  1623. var compared = isPartial ? customizer(othValue, objValue, key, other, object4, stack) : customizer(objValue, othValue, key, object4, other, stack);
  1624. }
  1625. if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
  1626. result = false;
  1627. break;
  1628. }
  1629. skipCtor || (skipCtor = key == "constructor");
  1630. }
  1631. if (result && !skipCtor) {
  1632. var objCtor = object4.constructor, othCtor = other.constructor;
  1633. if (objCtor != othCtor && ("constructor" in object4 && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
  1634. result = false;
  1635. }
  1636. }
  1637. stack["delete"](object4);
  1638. stack["delete"](other);
  1639. return result;
  1640. }
  1641. var COMPARE_PARTIAL_FLAG = 1;
  1642. var argsTag = "[object Arguments]", arrayTag = "[object Array]", objectTag = "[object Object]";
  1643. var objectProto = Object.prototype;
  1644. var hasOwnProperty$1 = objectProto.hasOwnProperty;
  1645. function baseIsEqualDeep(object4, other, bitmask, customizer, equalFunc, stack) {
  1646. var objIsArr = isArray$2(object4), othIsArr = isArray$2(other), objTag = objIsArr ? arrayTag : getTag$1(object4), othTag = othIsArr ? arrayTag : getTag$1(other);
  1647. objTag = objTag == argsTag ? objectTag : objTag;
  1648. othTag = othTag == argsTag ? objectTag : othTag;
  1649. var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
  1650. if (isSameTag && isBuffer$1(object4)) {
  1651. if (!isBuffer$1(other)) {
  1652. return false;
  1653. }
  1654. objIsArr = true;
  1655. objIsObj = false;
  1656. }
  1657. if (isSameTag && !objIsObj) {
  1658. stack || (stack = new Stack());
  1659. return objIsArr || isTypedArray$1(object4) ? equalArrays(object4, other, bitmask, customizer, equalFunc, stack) : equalByTag(object4, other, objTag, bitmask, customizer, equalFunc, stack);
  1660. }
  1661. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  1662. var objIsWrapped = objIsObj && hasOwnProperty$1.call(object4, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty$1.call(other, "__wrapped__");
  1663. if (objIsWrapped || othIsWrapped) {
  1664. var objUnwrapped = objIsWrapped ? object4.value() : object4, othUnwrapped = othIsWrapped ? other.value() : other;
  1665. stack || (stack = new Stack());
  1666. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  1667. }
  1668. }
  1669. if (!isSameTag) {
  1670. return false;
  1671. }
  1672. stack || (stack = new Stack());
  1673. return equalObjects(object4, other, bitmask, customizer, equalFunc, stack);
  1674. }
  1675. function baseIsEqual(value, other, bitmask, customizer, stack) {
  1676. if (value === other) {
  1677. return true;
  1678. }
  1679. if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
  1680. return value !== value && other !== other;
  1681. }
  1682. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  1683. }
  1684. var now = function() {
  1685. return root$1.Date.now();
  1686. };
  1687. var now$1 = now;
  1688. var FUNC_ERROR_TEXT$1 = "Expected a function";
  1689. var nativeMax = Math.max, nativeMin = Math.min;
  1690. function debounce$1(func, wait, options) {
  1691. var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
  1692. if (typeof func != "function") {
  1693. throw new TypeError(FUNC_ERROR_TEXT$1);
  1694. }
  1695. wait = toNumber(wait) || 0;
  1696. if (isObject$2(options)) {
  1697. leading = !!options.leading;
  1698. maxing = "maxWait" in options;
  1699. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  1700. trailing = "trailing" in options ? !!options.trailing : trailing;
  1701. }
  1702. function invokeFunc(time) {
  1703. var args = lastArgs, thisArg = lastThis;
  1704. lastArgs = lastThis = void 0;
  1705. lastInvokeTime = time;
  1706. result = func.apply(thisArg, args);
  1707. return result;
  1708. }
  1709. function leadingEdge(time) {
  1710. lastInvokeTime = time;
  1711. timerId = setTimeout(timerExpired, wait);
  1712. return leading ? invokeFunc(time) : result;
  1713. }
  1714. function remainingWait(time) {
  1715. var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
  1716. return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
  1717. }
  1718. function shouldInvoke(time) {
  1719. var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
  1720. return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
  1721. }
  1722. function timerExpired() {
  1723. var time = now$1();
  1724. if (shouldInvoke(time)) {
  1725. return trailingEdge(time);
  1726. }
  1727. timerId = setTimeout(timerExpired, remainingWait(time));
  1728. }
  1729. function trailingEdge(time) {
  1730. timerId = void 0;
  1731. if (trailing && lastArgs) {
  1732. return invokeFunc(time);
  1733. }
  1734. lastArgs = lastThis = void 0;
  1735. return result;
  1736. }
  1737. function cancel() {
  1738. if (timerId !== void 0) {
  1739. clearTimeout(timerId);
  1740. }
  1741. lastInvokeTime = 0;
  1742. lastArgs = lastCallTime = lastThis = timerId = void 0;
  1743. }
  1744. function flush() {
  1745. return timerId === void 0 ? result : trailingEdge(now$1());
  1746. }
  1747. function debounced() {
  1748. var time = now$1(), isInvoking = shouldInvoke(time);
  1749. lastArgs = arguments;
  1750. lastThis = this;
  1751. lastCallTime = time;
  1752. if (isInvoking) {
  1753. if (timerId === void 0) {
  1754. return leadingEdge(lastCallTime);
  1755. }
  1756. if (maxing) {
  1757. clearTimeout(timerId);
  1758. timerId = setTimeout(timerExpired, wait);
  1759. return invokeFunc(lastCallTime);
  1760. }
  1761. }
  1762. if (timerId === void 0) {
  1763. timerId = setTimeout(timerExpired, wait);
  1764. }
  1765. return result;
  1766. }
  1767. debounced.cancel = cancel;
  1768. debounced.flush = flush;
  1769. return debounced;
  1770. }
  1771. function isArrayLikeObject(value) {
  1772. return isObjectLike(value) && isArrayLike(value);
  1773. }
  1774. function arrayIncludesWith(array4, value, comparator) {
  1775. var index = -1, length = array4 == null ? 0 : array4.length;
  1776. while (++index < length) {
  1777. if (comparator(value, array4[index])) {
  1778. return true;
  1779. }
  1780. }
  1781. return false;
  1782. }
  1783. var INFINITY$1 = 1 / 0;
  1784. function flattenDeep(array4) {
  1785. var length = array4 == null ? 0 : array4.length;
  1786. return length ? baseFlatten(array4, INFINITY$1) : [];
  1787. }
  1788. function fromPairs(pairs) {
  1789. var index = -1, length = pairs == null ? 0 : pairs.length, result = {};
  1790. while (++index < length) {
  1791. var pair = pairs[index];
  1792. result[pair[0]] = pair[1];
  1793. }
  1794. return result;
  1795. }
  1796. function isEqual(value, other) {
  1797. return baseIsEqual(value, other);
  1798. }
  1799. function isNil(value) {
  1800. return value == null;
  1801. }
  1802. function baseSet(object4, path, value, customizer) {
  1803. if (!isObject$2(object4)) {
  1804. return object4;
  1805. }
  1806. path = castPath(path, object4);
  1807. var index = -1, length = path.length, lastIndex = length - 1, nested = object4;
  1808. while (nested != null && ++index < length) {
  1809. var key = toKey(path[index]), newValue = value;
  1810. if (key === "__proto__" || key === "constructor" || key === "prototype") {
  1811. return object4;
  1812. }
  1813. if (index != lastIndex) {
  1814. var objValue = nested[key];
  1815. newValue = customizer ? customizer(objValue, key, nested) : void 0;
  1816. if (newValue === void 0) {
  1817. newValue = isObject$2(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
  1818. }
  1819. }
  1820. assignValue(nested, key, newValue);
  1821. nested = nested[key];
  1822. }
  1823. return object4;
  1824. }
  1825. function set(object4, path, value) {
  1826. return object4 == null ? object4 : baseSet(object4, path, value);
  1827. }
  1828. var FUNC_ERROR_TEXT = "Expected a function";
  1829. function throttle(func, wait, options) {
  1830. var leading = true, trailing = true;
  1831. if (typeof func != "function") {
  1832. throw new TypeError(FUNC_ERROR_TEXT);
  1833. }
  1834. if (isObject$2(options)) {
  1835. leading = "leading" in options ? !!options.leading : leading;
  1836. trailing = "trailing" in options ? !!options.trailing : trailing;
  1837. }
  1838. return debounce$1(func, wait, {
  1839. "leading": leading,
  1840. "maxWait": wait,
  1841. "trailing": trailing
  1842. });
  1843. }
  1844. var INFINITY = 1 / 0;
  1845. var createSet = !(Set$2 && 1 / setToArray(new Set$2([, -0]))[1] == INFINITY) ? noop$1 : function(values) {
  1846. return new Set$2(values);
  1847. };
  1848. var createSet$1 = createSet;
  1849. var LARGE_ARRAY_SIZE = 200;
  1850. function baseUniq(array4, iteratee, comparator) {
  1851. var index = -1, includes = arrayIncludes, length = array4.length, isCommon = true, result = [], seen = result;
  1852. if (comparator) {
  1853. isCommon = false;
  1854. includes = arrayIncludesWith;
  1855. } else if (length >= LARGE_ARRAY_SIZE) {
  1856. var set2 = iteratee ? null : createSet$1(array4);
  1857. if (set2) {
  1858. return setToArray(set2);
  1859. }
  1860. isCommon = false;
  1861. includes = cacheHas;
  1862. seen = new SetCache();
  1863. } else {
  1864. seen = iteratee ? [] : result;
  1865. }
  1866. outer:
  1867. while (++index < length) {
  1868. var value = array4[index], computed2 = iteratee ? iteratee(value) : value;
  1869. value = comparator || value !== 0 ? value : 0;
  1870. if (isCommon && computed2 === computed2) {
  1871. var seenIndex = seen.length;
  1872. while (seenIndex--) {
  1873. if (seen[seenIndex] === computed2) {
  1874. continue outer;
  1875. }
  1876. }
  1877. if (iteratee) {
  1878. seen.push(computed2);
  1879. }
  1880. result.push(value);
  1881. } else if (!includes(seen, computed2, comparator)) {
  1882. if (seen !== result) {
  1883. seen.push(computed2);
  1884. }
  1885. result.push(value);
  1886. }
  1887. }
  1888. return result;
  1889. }
  1890. var union = baseRest(function(arrays) {
  1891. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  1892. });
  1893. var union$1 = union;
  1894. const isLeaf = (el) => !el.getAttribute("aria-owns");
  1895. const getSibling = (el, distance, elClass) => {
  1896. const { parentNode } = el;
  1897. if (!parentNode)
  1898. return null;
  1899. const siblings = parentNode.querySelectorAll(elClass);
  1900. const index = Array.prototype.indexOf.call(siblings, el);
  1901. return siblings[index + distance] || null;
  1902. };
  1903. const focusNode = (el) => {
  1904. if (!el)
  1905. return;
  1906. el.focus();
  1907. !isLeaf(el) && el.click();
  1908. };
  1909. const on = (element, event, handler3, useCapture = false) => {
  1910. if (element && event && handler3) {
  1911. element == null ? void 0 : element.addEventListener(event, handler3, useCapture);
  1912. }
  1913. };
  1914. const off = (element, event, handler3, useCapture = false) => {
  1915. if (element && event && handler3) {
  1916. element == null ? void 0 : element.removeEventListener(event, handler3, useCapture);
  1917. }
  1918. };
  1919. const once = (el, event, fn2) => {
  1920. const listener = function(...args) {
  1921. if (fn2) {
  1922. fn2.apply(this, args);
  1923. }
  1924. off(el, event, listener);
  1925. };
  1926. on(el, event, listener);
  1927. };
  1928. const composeEventHandlers = (theirsHandler, oursHandler, { checkForDefaultPrevented = true } = {}) => {
  1929. const handleEvent = (event) => {
  1930. const shouldPrevent = theirsHandler == null ? void 0 : theirsHandler(event);
  1931. if (checkForDefaultPrevented === false || !shouldPrevent) {
  1932. return oursHandler == null ? void 0 : oursHandler(event);
  1933. }
  1934. };
  1935. return handleEvent;
  1936. };
  1937. function tryOnScopeDispose(fn2) {
  1938. if (getCurrentScope()) {
  1939. onScopeDispose(fn2);
  1940. return true;
  1941. }
  1942. return false;
  1943. }
  1944. const isClient = typeof window !== "undefined";
  1945. const isBoolean = (val) => typeof val === "boolean";
  1946. const isNumber = (val) => typeof val === "number";
  1947. const isString$1 = (val) => typeof val === "string";
  1948. const noop = () => {
  1949. };
  1950. function createFilterWrapper(filter, fn2) {
  1951. function wrapper(...args) {
  1952. filter(() => fn2.apply(this, args), { fn: fn2, thisArg: this, args });
  1953. }
  1954. return wrapper;
  1955. }
  1956. function debounceFilter(ms, options = {}) {
  1957. let timer;
  1958. let maxTimer;
  1959. const filter = (invoke) => {
  1960. const duration = unref(ms);
  1961. const maxDuration = unref(options.maxWait);
  1962. if (timer)
  1963. clearTimeout(timer);
  1964. if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
  1965. if (maxTimer) {
  1966. clearTimeout(maxTimer);
  1967. maxTimer = null;
  1968. }
  1969. return invoke();
  1970. }
  1971. if (maxDuration && !maxTimer) {
  1972. maxTimer = setTimeout(() => {
  1973. if (timer)
  1974. clearTimeout(timer);
  1975. maxTimer = null;
  1976. invoke();
  1977. }, maxDuration);
  1978. }
  1979. timer = setTimeout(() => {
  1980. if (maxTimer)
  1981. clearTimeout(maxTimer);
  1982. maxTimer = null;
  1983. invoke();
  1984. }, duration);
  1985. };
  1986. return filter;
  1987. }
  1988. function throttleFilter(ms, trailing = true, leading = true) {
  1989. let lastExec = 0;
  1990. let timer;
  1991. let preventLeading = !leading;
  1992. const clear = () => {
  1993. if (timer) {
  1994. clearTimeout(timer);
  1995. timer = void 0;
  1996. }
  1997. };
  1998. const filter = (invoke) => {
  1999. const duration = unref(ms);
  2000. const elapsed = Date.now() - lastExec;
  2001. clear();
  2002. if (duration <= 0) {
  2003. lastExec = Date.now();
  2004. return invoke();
  2005. }
  2006. if (elapsed > duration) {
  2007. lastExec = Date.now();
  2008. if (preventLeading)
  2009. preventLeading = false;
  2010. else
  2011. invoke();
  2012. }
  2013. if (trailing) {
  2014. timer = setTimeout(() => {
  2015. lastExec = Date.now();
  2016. if (!leading)
  2017. preventLeading = true;
  2018. clear();
  2019. invoke();
  2020. }, duration);
  2021. }
  2022. if (!leading && !timer)
  2023. timer = setTimeout(() => preventLeading = true, duration);
  2024. };
  2025. return filter;
  2026. }
  2027. function useDebounceFn(fn2, ms = 200, options = {}) {
  2028. return createFilterWrapper(debounceFilter(ms, options), fn2);
  2029. }
  2030. function refDebounced(value, ms = 200, options = {}) {
  2031. if (ms <= 0)
  2032. return value;
  2033. const debounced = ref(value.value);
  2034. const updater = useDebounceFn(() => {
  2035. debounced.value = value.value;
  2036. }, ms, options);
  2037. watch(value, () => updater());
  2038. return debounced;
  2039. }
  2040. function useThrottleFn(fn2, ms = 200, trailing = true, leading = true) {
  2041. return createFilterWrapper(throttleFilter(ms, trailing, leading), fn2);
  2042. }
  2043. function useTimeoutFn(cb, interval, options = {}) {
  2044. const {
  2045. immediate = true
  2046. } = options;
  2047. const isPending = ref(false);
  2048. let timer = null;
  2049. function clear() {
  2050. if (timer) {
  2051. clearTimeout(timer);
  2052. timer = null;
  2053. }
  2054. }
  2055. function stop() {
  2056. isPending.value = false;
  2057. clear();
  2058. }
  2059. function start2(...args) {
  2060. clear();
  2061. isPending.value = true;
  2062. timer = setTimeout(() => {
  2063. isPending.value = false;
  2064. timer = null;
  2065. cb(...args);
  2066. }, unref(interval));
  2067. }
  2068. if (immediate) {
  2069. isPending.value = true;
  2070. if (isClient)
  2071. start2();
  2072. }
  2073. tryOnScopeDispose(stop);
  2074. return {
  2075. isPending,
  2076. start: start2,
  2077. stop
  2078. };
  2079. }
  2080. function unrefElement(elRef) {
  2081. var _a2;
  2082. const plain = unref(elRef);
  2083. return (_a2 = plain == null ? void 0 : plain.$el) != null ? _a2 : plain;
  2084. }
  2085. const defaultWindow = isClient ? window : void 0;
  2086. isClient ? window.document : void 0;
  2087. isClient ? window.navigator : void 0;
  2088. isClient ? window.location : void 0;
  2089. function useEventListener(...args) {
  2090. let target;
  2091. let event;
  2092. let listener;
  2093. let options;
  2094. if (isString$1(args[0])) {
  2095. [event, listener, options] = args;
  2096. target = defaultWindow;
  2097. } else {
  2098. [target, event, listener, options] = args;
  2099. }
  2100. if (!target)
  2101. return noop;
  2102. let cleanup = noop;
  2103. const stopWatch = watch(() => unrefElement(target), (el) => {
  2104. cleanup();
  2105. if (!el)
  2106. return;
  2107. el.addEventListener(event, listener, options);
  2108. cleanup = () => {
  2109. el.removeEventListener(event, listener, options);
  2110. cleanup = noop;
  2111. };
  2112. }, { immediate: true, flush: "post" });
  2113. const stop = () => {
  2114. stopWatch();
  2115. cleanup();
  2116. };
  2117. tryOnScopeDispose(stop);
  2118. return stop;
  2119. }
  2120. function onClickOutside(target, handler3, options = {}) {
  2121. const { window: window2 = defaultWindow, ignore, capture = true } = options;
  2122. if (!window2)
  2123. return;
  2124. const shouldListen = ref(true);
  2125. const listener = (event) => {
  2126. const el = unrefElement(target);
  2127. const composedPath = event.composedPath();
  2128. if (!el || el === event.target || composedPath.includes(el) || !shouldListen.value)
  2129. return;
  2130. if (ignore && ignore.length > 0) {
  2131. if (ignore.some((target2) => {
  2132. const el2 = unrefElement(target2);
  2133. return el2 && (event.target === el2 || composedPath.includes(el2));
  2134. }))
  2135. return;
  2136. }
  2137. handler3(event);
  2138. };
  2139. const cleanup = [
  2140. useEventListener(window2, "click", listener, { passive: true, capture }),
  2141. useEventListener(window2, "pointerdown", (e) => {
  2142. const el = unrefElement(target);
  2143. shouldListen.value = !!el && !e.composedPath().includes(el);
  2144. }, { passive: true })
  2145. ];
  2146. const stop = () => cleanup.forEach((fn2) => fn2());
  2147. return stop;
  2148. }
  2149. const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  2150. const globalKey = "__vueuse_ssr_handlers__";
  2151. _global[globalKey] = _global[globalKey] || {};
  2152. _global[globalKey];
  2153. var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
  2154. var __hasOwnProp$c = Object.prototype.hasOwnProperty;
  2155. var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
  2156. var __objRest$2 = (source, exclude) => {
  2157. var target = {};
  2158. for (var prop in source)
  2159. if (__hasOwnProp$c.call(source, prop) && exclude.indexOf(prop) < 0)
  2160. target[prop] = source[prop];
  2161. if (source != null && __getOwnPropSymbols$c)
  2162. for (var prop of __getOwnPropSymbols$c(source)) {
  2163. if (exclude.indexOf(prop) < 0 && __propIsEnum$c.call(source, prop))
  2164. target[prop] = source[prop];
  2165. }
  2166. return target;
  2167. };
  2168. function useResizeObserver(target, callback, options = {}) {
  2169. const _a2 = options, { window: window2 = defaultWindow } = _a2, observerOptions = __objRest$2(_a2, ["window"]);
  2170. let observer;
  2171. const isSupported = window2 && "ResizeObserver" in window2;
  2172. const cleanup = () => {
  2173. if (observer) {
  2174. observer.disconnect();
  2175. observer = void 0;
  2176. }
  2177. };
  2178. const stopWatch = watch(() => unrefElement(target), (el) => {
  2179. cleanup();
  2180. if (isSupported && window2 && el) {
  2181. observer = new ResizeObserver(callback);
  2182. observer.observe(el, observerOptions);
  2183. }
  2184. }, { immediate: true, flush: "post" });
  2185. const stop = () => {
  2186. cleanup();
  2187. stopWatch();
  2188. };
  2189. tryOnScopeDispose(stop);
  2190. return {
  2191. isSupported,
  2192. stop
  2193. };
  2194. }
  2195. var _a, _b;
  2196. isClient && (window == null ? void 0 : window.navigator) && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.platform) && /iP(ad|hone|od)/.test((_b = window == null ? void 0 : window.navigator) == null ? void 0 : _b.platform);
  2197. function useVModel(props, key, emit, options = {}) {
  2198. var _a2;
  2199. const {
  2200. passive: passive2 = false,
  2201. eventName,
  2202. deep = false
  2203. } = options;
  2204. const vm = getCurrentInstance();
  2205. const _emit = emit || (vm == null ? void 0 : vm.emit) || ((_a2 = vm == null ? void 0 : vm.$emit) == null ? void 0 : _a2.bind(vm));
  2206. let event = eventName;
  2207. if (!key) {
  2208. {
  2209. key = "modelValue";
  2210. }
  2211. }
  2212. event = eventName || event || `update:${key}`;
  2213. if (passive2) {
  2214. const proxy = ref(props[key]);
  2215. watch(() => props[key], (v2) => proxy.value = v2);
  2216. watch(proxy, (v2) => {
  2217. if (v2 !== props[key] || deep)
  2218. _emit(event, v2);
  2219. }, {
  2220. deep
  2221. });
  2222. return proxy;
  2223. } else {
  2224. return computed({
  2225. get() {
  2226. return props[key];
  2227. },
  2228. set(value) {
  2229. _emit(event, value);
  2230. }
  2231. });
  2232. }
  2233. }
  2234. const isInContainer = (el, container) => {
  2235. if (!isClient || !el || !container)
  2236. return false;
  2237. const elRect = el.getBoundingClientRect();
  2238. let containerRect;
  2239. if (container instanceof Element) {
  2240. containerRect = container.getBoundingClientRect();
  2241. } else {
  2242. containerRect = {
  2243. top: 0,
  2244. right: window.innerWidth,
  2245. bottom: window.innerHeight,
  2246. left: 0
  2247. };
  2248. }
  2249. return elRect.top < containerRect.bottom && elRect.bottom > containerRect.top && elRect.right > containerRect.left && elRect.left < containerRect.right;
  2250. };
  2251. const resizeHandler = function(entries) {
  2252. for (const entry of entries) {
  2253. const listeners = entry.target.__resizeListeners__ || [];
  2254. if (listeners.length) {
  2255. listeners.forEach((fn2) => {
  2256. fn2();
  2257. });
  2258. }
  2259. }
  2260. };
  2261. const addResizeListener = function(element, fn2) {
  2262. if (!isClient || !element)
  2263. return;
  2264. if (!element.__resizeListeners__) {
  2265. element.__resizeListeners__ = [];
  2266. element.__ro__ = new ResizeObserver(resizeHandler);
  2267. element.__ro__.observe(element);
  2268. }
  2269. element.__resizeListeners__.push(fn2);
  2270. };
  2271. const removeResizeListener = function(element, fn2) {
  2272. var _a2;
  2273. if (!element || !element.__resizeListeners__)
  2274. return;
  2275. element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn2), 1);
  2276. if (!element.__resizeListeners__.length) {
  2277. (_a2 = element.__ro__) == null ? void 0 : _a2.disconnect();
  2278. }
  2279. };
  2280. const NOOP = () => {
  2281. };
  2282. const hasOwnProperty = Object.prototype.hasOwnProperty;
  2283. const hasOwn = (val, key) => hasOwnProperty.call(val, key);
  2284. const isArray = Array.isArray;
  2285. const isFunction = (val) => typeof val === "function";
  2286. const isString = (val) => typeof val === "string";
  2287. const isObject$1 = (val) => val !== null && typeof val === "object";
  2288. const isPromise = (val) => {
  2289. return isObject$1(val) && isFunction(val.then) && isFunction(val.catch);
  2290. };
  2291. const objectToString = Object.prototype.toString;
  2292. const toTypeString = (value) => objectToString.call(value);
  2293. const toRawType = (value) => {
  2294. return toTypeString(value).slice(8, -1);
  2295. };
  2296. const cacheStringFunction = (fn2) => {
  2297. const cache = /* @__PURE__ */ Object.create(null);
  2298. return (str) => {
  2299. const hit = cache[str];
  2300. return hit || (cache[str] = fn2(str));
  2301. };
  2302. };
  2303. const camelizeRE = /-(\w)/g;
  2304. const camelize = cacheStringFunction((str) => {
  2305. return str.replace(camelizeRE, (_2, c2) => c2 ? c2.toUpperCase() : "");
  2306. });
  2307. const capitalize = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));
  2308. const isUndefined = (val) => val === void 0;
  2309. const isEmpty = (val) => !val && val !== 0 || isArray(val) && val.length === 0 || isObject$1(val) && !Object.keys(val).length;
  2310. const isElement$1 = (e) => {
  2311. if (typeof Element === "undefined")
  2312. return false;
  2313. return e instanceof Element;
  2314. };
  2315. const escapeStringRegexp = (string3 = "") => string3.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
  2316. const keysOf = (arr) => Object.keys(arr);
  2317. const entriesOf = (arr) => Object.entries(arr);
  2318. const getProp = (obj, path, defaultValue) => {
  2319. return {
  2320. get value() {
  2321. return get(obj, path, defaultValue);
  2322. },
  2323. set value(val) {
  2324. set(obj, path, val);
  2325. }
  2326. };
  2327. };
  2328. const classNameToArray = (cls = "") => cls.split(" ").filter((item) => !!item.trim());
  2329. const hasClass = (el, cls) => {
  2330. if (!el || !cls)
  2331. return false;
  2332. if (cls.includes(" "))
  2333. throw new Error("className should not contain space.");
  2334. return el.classList.contains(cls);
  2335. };
  2336. const addClass = (el, cls) => {
  2337. if (!el || !cls.trim())
  2338. return;
  2339. el.classList.add(...classNameToArray(cls));
  2340. };
  2341. const removeClass = (el, cls) => {
  2342. if (!el || !cls.trim())
  2343. return;
  2344. el.classList.remove(...classNameToArray(cls));
  2345. };
  2346. const getStyle = (element, styleName) => {
  2347. var _a2;
  2348. if (!isClient || !element || !styleName)
  2349. return "";
  2350. camelize(styleName);
  2351. try {
  2352. const style = element.style[styleName];
  2353. if (style)
  2354. return style;
  2355. const computed2 = (_a2 = document.defaultView) == null ? void 0 : _a2.getComputedStyle(element, "");
  2356. return computed2 ? computed2[styleName] : "";
  2357. } catch (e) {
  2358. return element.style[styleName];
  2359. }
  2360. };
  2361. const isScroll = (el, isVertical) => {
  2362. if (!isClient)
  2363. return false;
  2364. const key = {
  2365. undefined: "overflow",
  2366. true: "overflow-y",
  2367. false: "overflow-x"
  2368. }[String(isVertical)];
  2369. const overflow = getStyle(el, key);
  2370. return ["scroll", "auto", "overlay"].some((s2) => overflow.includes(s2));
  2371. };
  2372. const getScrollContainer = (el, isVertical) => {
  2373. if (!isClient)
  2374. return;
  2375. let parent = el;
  2376. while (parent) {
  2377. if ([window, document, document.documentElement].includes(parent))
  2378. return window;
  2379. if (isScroll(parent, isVertical))
  2380. return parent;
  2381. parent = parent.parentNode;
  2382. }
  2383. return parent;
  2384. };
  2385. let scrollBarWidth;
  2386. const getScrollBarWidth = () => {
  2387. var _a2;
  2388. if (!isClient)
  2389. return 0;
  2390. if (scrollBarWidth !== void 0)
  2391. return scrollBarWidth;
  2392. const outer = document.createElement("div");
  2393. outer.className = "el-scrollbar__wrap";
  2394. outer.style.visibility = "hidden";
  2395. outer.style.width = "100px";
  2396. outer.style.position = "absolute";
  2397. outer.style.top = "-9999px";
  2398. document.body.appendChild(outer);
  2399. const widthNoScroll = outer.offsetWidth;
  2400. outer.style.overflow = "scroll";
  2401. const inner = document.createElement("div");
  2402. inner.style.width = "100%";
  2403. outer.appendChild(inner);
  2404. const widthWithScroll = inner.offsetWidth;
  2405. (_a2 = outer.parentNode) == null ? void 0 : _a2.removeChild(outer);
  2406. scrollBarWidth = widthNoScroll - widthWithScroll;
  2407. return scrollBarWidth;
  2408. };
  2409. function scrollIntoView(container, selected) {
  2410. if (!isClient)
  2411. return;
  2412. if (!selected) {
  2413. container.scrollTop = 0;
  2414. return;
  2415. }
  2416. const offsetParents = [];
  2417. let pointer = selected.offsetParent;
  2418. while (pointer !== null && container !== pointer && container.contains(pointer)) {
  2419. offsetParents.push(pointer);
  2420. pointer = pointer.offsetParent;
  2421. }
  2422. const top2 = selected.offsetTop + offsetParents.reduce((prev, curr) => prev + curr.offsetTop, 0);
  2423. const bottom2 = top2 + selected.offsetHeight;
  2424. const viewRectTop = container.scrollTop;
  2425. const viewRectBottom = viewRectTop + container.clientHeight;
  2426. if (top2 < viewRectTop) {
  2427. container.scrollTop = top2;
  2428. } else if (bottom2 > viewRectBottom) {
  2429. container.scrollTop = bottom2 - container.clientHeight;
  2430. }
  2431. }
  2432. var _export_sfc$2 = (sfc, props) => {
  2433. const target = sfc.__vccOpts || sfc;
  2434. for (const [key, val] of props) {
  2435. target[key] = val;
  2436. }
  2437. return target;
  2438. };
  2439. const _sfc_main$1y = defineComponent({
  2440. name: "ArrowDown"
  2441. });
  2442. const _hoisted_1$13 = {
  2443. viewBox: "0 0 1024 1024",
  2444. xmlns: "http://www.w3.org/2000/svg"
  2445. };
  2446. const _hoisted_2$W = /* @__PURE__ */ createElementVNode("path", {
  2447. fill: "currentColor",
  2448. d: "M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z"
  2449. }, null, -1);
  2450. const _hoisted_3$J = [
  2451. _hoisted_2$W
  2452. ];
  2453. function _sfc_render$13(_ctx, _cache, $props, $setup, $data, $options) {
  2454. return openBlock(), createElementBlock("svg", _hoisted_1$13, _hoisted_3$J);
  2455. }
  2456. var arrowDown = /* @__PURE__ */ _export_sfc$2(_sfc_main$1y, [["render", _sfc_render$13]]);
  2457. const _sfc_main$1x = defineComponent({
  2458. name: "ArrowLeft"
  2459. });
  2460. const _hoisted_1$12 = {
  2461. viewBox: "0 0 1024 1024",
  2462. xmlns: "http://www.w3.org/2000/svg"
  2463. };
  2464. const _hoisted_2$V = /* @__PURE__ */ createElementVNode("path", {
  2465. fill: "currentColor",
  2466. d: "M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.592 30.592 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.592 30.592 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0z"
  2467. }, null, -1);
  2468. const _hoisted_3$I = [
  2469. _hoisted_2$V
  2470. ];
  2471. function _sfc_render$12(_ctx, _cache, $props, $setup, $data, $options) {
  2472. return openBlock(), createElementBlock("svg", _hoisted_1$12, _hoisted_3$I);
  2473. }
  2474. var arrowLeft = /* @__PURE__ */ _export_sfc$2(_sfc_main$1x, [["render", _sfc_render$12]]);
  2475. const _sfc_main$1w = defineComponent({
  2476. name: "ArrowRight"
  2477. });
  2478. const _hoisted_1$11 = {
  2479. viewBox: "0 0 1024 1024",
  2480. xmlns: "http://www.w3.org/2000/svg"
  2481. };
  2482. const _hoisted_2$U = /* @__PURE__ */ createElementVNode("path", {
  2483. fill: "currentColor",
  2484. d: "M340.864 149.312a30.592 30.592 0 0 0 0 42.752L652.736 512 340.864 831.872a30.592 30.592 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z"
  2485. }, null, -1);
  2486. const _hoisted_3$H = [
  2487. _hoisted_2$U
  2488. ];
  2489. function _sfc_render$11(_ctx, _cache, $props, $setup, $data, $options) {
  2490. return openBlock(), createElementBlock("svg", _hoisted_1$11, _hoisted_3$H);
  2491. }
  2492. var arrowRight = /* @__PURE__ */ _export_sfc$2(_sfc_main$1w, [["render", _sfc_render$11]]);
  2493. const _sfc_main$1v = defineComponent({
  2494. name: "ArrowUp"
  2495. });
  2496. const _hoisted_1$10 = {
  2497. viewBox: "0 0 1024 1024",
  2498. xmlns: "http://www.w3.org/2000/svg"
  2499. };
  2500. const _hoisted_2$T = /* @__PURE__ */ createElementVNode("path", {
  2501. fill: "currentColor",
  2502. d: "m488.832 344.32-339.84 356.672a32 32 0 0 0 0 44.16l.384.384a29.44 29.44 0 0 0 42.688 0l320-335.872 319.872 335.872a29.44 29.44 0 0 0 42.688 0l.384-.384a32 32 0 0 0 0-44.16L535.168 344.32a32 32 0 0 0-46.336 0z"
  2503. }, null, -1);
  2504. const _hoisted_3$G = [
  2505. _hoisted_2$T
  2506. ];
  2507. function _sfc_render$10(_ctx, _cache, $props, $setup, $data, $options) {
  2508. return openBlock(), createElementBlock("svg", _hoisted_1$10, _hoisted_3$G);
  2509. }
  2510. var arrowUp = /* @__PURE__ */ _export_sfc$2(_sfc_main$1v, [["render", _sfc_render$10]]);
  2511. const _sfc_main$1u = defineComponent({
  2512. name: "Calendar"
  2513. });
  2514. const _hoisted_1$$ = {
  2515. viewBox: "0 0 1024 1024",
  2516. xmlns: "http://www.w3.org/2000/svg"
  2517. };
  2518. const _hoisted_2$S = /* @__PURE__ */ createElementVNode("path", {
  2519. fill: "currentColor",
  2520. d: "M128 384v512h768V192H768v32a32 32 0 1 1-64 0v-32H320v32a32 32 0 0 1-64 0v-32H128v128h768v64H128zm192-256h384V96a32 32 0 1 1 64 0v32h160a32 32 0 0 1 32 32v768a32 32 0 0 1-32 32H96a32 32 0 0 1-32-32V160a32 32 0 0 1 32-32h160V96a32 32 0 0 1 64 0v32zm-32 384h64a32 32 0 0 1 0 64h-64a32 32 0 0 1 0-64zm0 192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64zm192-192h64a32 32 0 0 1 0 64h-64a32 32 0 0 1 0-64zm0 192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64zm192-192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64zm0 192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64z"
  2521. }, null, -1);
  2522. const _hoisted_3$F = [
  2523. _hoisted_2$S
  2524. ];
  2525. function _sfc_render$$(_ctx, _cache, $props, $setup, $data, $options) {
  2526. return openBlock(), createElementBlock("svg", _hoisted_1$$, _hoisted_3$F);
  2527. }
  2528. var calendar = /* @__PURE__ */ _export_sfc$2(_sfc_main$1u, [["render", _sfc_render$$]]);
  2529. const _sfc_main$1t = defineComponent({
  2530. name: "Check"
  2531. });
  2532. const _hoisted_1$_ = {
  2533. viewBox: "0 0 1024 1024",
  2534. xmlns: "http://www.w3.org/2000/svg"
  2535. };
  2536. const _hoisted_2$R = /* @__PURE__ */ createElementVNode("path", {
  2537. fill: "currentColor",
  2538. d: "M406.656 706.944 195.84 496.256a32 32 0 1 0-45.248 45.248l256 256 512-512a32 32 0 0 0-45.248-45.248L406.592 706.944z"
  2539. }, null, -1);
  2540. const _hoisted_3$E = [
  2541. _hoisted_2$R
  2542. ];
  2543. function _sfc_render$_(_ctx, _cache, $props, $setup, $data, $options) {
  2544. return openBlock(), createElementBlock("svg", _hoisted_1$_, _hoisted_3$E);
  2545. }
  2546. var check = /* @__PURE__ */ _export_sfc$2(_sfc_main$1t, [["render", _sfc_render$_]]);
  2547. const _sfc_main$1s = defineComponent({
  2548. name: "CircleCheck"
  2549. });
  2550. const _hoisted_1$Z = {
  2551. viewBox: "0 0 1024 1024",
  2552. xmlns: "http://www.w3.org/2000/svg"
  2553. };
  2554. const _hoisted_2$Q = /* @__PURE__ */ createElementVNode("path", {
  2555. fill: "currentColor",
  2556. d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"
  2557. }, null, -1);
  2558. const _hoisted_3$D = /* @__PURE__ */ createElementVNode("path", {
  2559. fill: "currentColor",
  2560. d: "M745.344 361.344a32 32 0 0 1 45.312 45.312l-288 288a32 32 0 0 1-45.312 0l-160-160a32 32 0 1 1 45.312-45.312L480 626.752l265.344-265.408z"
  2561. }, null, -1);
  2562. const _hoisted_4$i = [
  2563. _hoisted_2$Q,
  2564. _hoisted_3$D
  2565. ];
  2566. function _sfc_render$Z(_ctx, _cache, $props, $setup, $data, $options) {
  2567. return openBlock(), createElementBlock("svg", _hoisted_1$Z, _hoisted_4$i);
  2568. }
  2569. var circleCheck = /* @__PURE__ */ _export_sfc$2(_sfc_main$1s, [["render", _sfc_render$Z]]);
  2570. const _sfc_main$1r = defineComponent({
  2571. name: "CircleClose"
  2572. });
  2573. const _hoisted_1$Y = {
  2574. viewBox: "0 0 1024 1024",
  2575. xmlns: "http://www.w3.org/2000/svg"
  2576. };
  2577. const _hoisted_2$P = /* @__PURE__ */ createElementVNode("path", {
  2578. fill: "currentColor",
  2579. d: "m466.752 512-90.496-90.496a32 32 0 0 1 45.248-45.248L512 466.752l90.496-90.496a32 32 0 1 1 45.248 45.248L557.248 512l90.496 90.496a32 32 0 1 1-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 0 1-45.248-45.248L466.752 512z"
  2580. }, null, -1);
  2581. const _hoisted_3$C = /* @__PURE__ */ createElementVNode("path", {
  2582. fill: "currentColor",
  2583. d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"
  2584. }, null, -1);
  2585. const _hoisted_4$h = [
  2586. _hoisted_2$P,
  2587. _hoisted_3$C
  2588. ];
  2589. function _sfc_render$Y(_ctx, _cache, $props, $setup, $data, $options) {
  2590. return openBlock(), createElementBlock("svg", _hoisted_1$Y, _hoisted_4$h);
  2591. }
  2592. var circleClose = /* @__PURE__ */ _export_sfc$2(_sfc_main$1r, [["render", _sfc_render$Y]]);
  2593. const _sfc_main$1q = defineComponent({
  2594. name: "Clock"
  2595. });
  2596. const _hoisted_1$X = {
  2597. viewBox: "0 0 1024 1024",
  2598. xmlns: "http://www.w3.org/2000/svg"
  2599. };
  2600. const _hoisted_2$O = /* @__PURE__ */ createElementVNode("path", {
  2601. fill: "currentColor",
  2602. d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"
  2603. }, null, -1);
  2604. const _hoisted_3$B = /* @__PURE__ */ createElementVNode("path", {
  2605. fill: "currentColor",
  2606. d: "M480 256a32 32 0 0 1 32 32v256a32 32 0 0 1-64 0V288a32 32 0 0 1 32-32z"
  2607. }, null, -1);
  2608. const _hoisted_4$g = /* @__PURE__ */ createElementVNode("path", {
  2609. fill: "currentColor",
  2610. d: "M480 512h256q32 0 32 32t-32 32H480q-32 0-32-32t32-32z"
  2611. }, null, -1);
  2612. const _hoisted_5$d = [
  2613. _hoisted_2$O,
  2614. _hoisted_3$B,
  2615. _hoisted_4$g
  2616. ];
  2617. function _sfc_render$X(_ctx, _cache, $props, $setup, $data, $options) {
  2618. return openBlock(), createElementBlock("svg", _hoisted_1$X, _hoisted_5$d);
  2619. }
  2620. var clock = /* @__PURE__ */ _export_sfc$2(_sfc_main$1q, [["render", _sfc_render$X]]);
  2621. const _sfc_main$1p = defineComponent({
  2622. name: "Close"
  2623. });
  2624. const _hoisted_1$W = {
  2625. viewBox: "0 0 1024 1024",
  2626. xmlns: "http://www.w3.org/2000/svg"
  2627. };
  2628. const _hoisted_2$N = /* @__PURE__ */ createElementVNode("path", {
  2629. fill: "currentColor",
  2630. d: "M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"
  2631. }, null, -1);
  2632. const _hoisted_3$A = [
  2633. _hoisted_2$N
  2634. ];
  2635. function _sfc_render$W(_ctx, _cache, $props, $setup, $data, $options) {
  2636. return openBlock(), createElementBlock("svg", _hoisted_1$W, _hoisted_3$A);
  2637. }
  2638. var close = /* @__PURE__ */ _export_sfc$2(_sfc_main$1p, [["render", _sfc_render$W]]);
  2639. const _sfc_main$1o = defineComponent({
  2640. name: "DArrowLeft"
  2641. });
  2642. const _hoisted_1$V = {
  2643. viewBox: "0 0 1024 1024",
  2644. xmlns: "http://www.w3.org/2000/svg"
  2645. };
  2646. const _hoisted_2$M = /* @__PURE__ */ createElementVNode("path", {
  2647. fill: "currentColor",
  2648. d: "M529.408 149.376a29.12 29.12 0 0 1 41.728 0 30.592 30.592 0 0 1 0 42.688L259.264 511.936l311.872 319.936a30.592 30.592 0 0 1-.512 43.264 29.12 29.12 0 0 1-41.216-.512L197.76 534.272a32 32 0 0 1 0-44.672l331.648-340.224zm256 0a29.12 29.12 0 0 1 41.728 0 30.592 30.592 0 0 1 0 42.688L515.264 511.936l311.872 319.936a30.592 30.592 0 0 1-.512 43.264 29.12 29.12 0 0 1-41.216-.512L453.76 534.272a32 32 0 0 1 0-44.672l331.648-340.224z"
  2649. }, null, -1);
  2650. const _hoisted_3$z = [
  2651. _hoisted_2$M
  2652. ];
  2653. function _sfc_render$V(_ctx, _cache, $props, $setup, $data, $options) {
  2654. return openBlock(), createElementBlock("svg", _hoisted_1$V, _hoisted_3$z);
  2655. }
  2656. var dArrowLeft = /* @__PURE__ */ _export_sfc$2(_sfc_main$1o, [["render", _sfc_render$V]]);
  2657. const _sfc_main$1n = defineComponent({
  2658. name: "DArrowRight"
  2659. });
  2660. const _hoisted_1$U = {
  2661. viewBox: "0 0 1024 1024",
  2662. xmlns: "http://www.w3.org/2000/svg"
  2663. };
  2664. const _hoisted_2$L = /* @__PURE__ */ createElementVNode("path", {
  2665. fill: "currentColor",
  2666. d: "M452.864 149.312a29.12 29.12 0 0 1 41.728.064L826.24 489.664a32 32 0 0 1 0 44.672L494.592 874.624a29.12 29.12 0 0 1-41.728 0 30.592 30.592 0 0 1 0-42.752L764.736 512 452.864 192a30.592 30.592 0 0 1 0-42.688zm-256 0a29.12 29.12 0 0 1 41.728.064L570.24 489.664a32 32 0 0 1 0 44.672L238.592 874.624a29.12 29.12 0 0 1-41.728 0 30.592 30.592 0 0 1 0-42.752L508.736 512 196.864 192a30.592 30.592 0 0 1 0-42.688z"
  2667. }, null, -1);
  2668. const _hoisted_3$y = [
  2669. _hoisted_2$L
  2670. ];
  2671. function _sfc_render$U(_ctx, _cache, $props, $setup, $data, $options) {
  2672. return openBlock(), createElementBlock("svg", _hoisted_1$U, _hoisted_3$y);
  2673. }
  2674. var dArrowRight = /* @__PURE__ */ _export_sfc$2(_sfc_main$1n, [["render", _sfc_render$U]]);
  2675. const _sfc_main$1m = defineComponent({
  2676. name: "Delete"
  2677. });
  2678. const _hoisted_1$T = {
  2679. viewBox: "0 0 1024 1024",
  2680. xmlns: "http://www.w3.org/2000/svg"
  2681. };
  2682. const _hoisted_2$K = /* @__PURE__ */ createElementVNode("path", {
  2683. fill: "currentColor",
  2684. d: "M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32V256zm448-64v-64H416v64h192zM224 896h576V256H224v640zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32zm192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32z"
  2685. }, null, -1);
  2686. const _hoisted_3$x = [
  2687. _hoisted_2$K
  2688. ];
  2689. function _sfc_render$T(_ctx, _cache, $props, $setup, $data, $options) {
  2690. return openBlock(), createElementBlock("svg", _hoisted_1$T, _hoisted_3$x);
  2691. }
  2692. var _delete = /* @__PURE__ */ _export_sfc$2(_sfc_main$1m, [["render", _sfc_render$T]]);
  2693. const _sfc_main$1l = defineComponent({
  2694. name: "Document"
  2695. });
  2696. const _hoisted_1$S = {
  2697. viewBox: "0 0 1024 1024",
  2698. xmlns: "http://www.w3.org/2000/svg"
  2699. };
  2700. const _hoisted_2$J = /* @__PURE__ */ createElementVNode("path", {
  2701. fill: "currentColor",
  2702. d: "M832 384H576V128H192v768h640V384zm-26.496-64L640 154.496V320h165.504zM160 64h480l256 256v608a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V96a32 32 0 0 1 32-32zm160 448h384v64H320v-64zm0-192h160v64H320v-64zm0 384h384v64H320v-64z"
  2703. }, null, -1);
  2704. const _hoisted_3$w = [
  2705. _hoisted_2$J
  2706. ];
  2707. function _sfc_render$S(_ctx, _cache, $props, $setup, $data, $options) {
  2708. return openBlock(), createElementBlock("svg", _hoisted_1$S, _hoisted_3$w);
  2709. }
  2710. var document$1 = /* @__PURE__ */ _export_sfc$2(_sfc_main$1l, [["render", _sfc_render$S]]);
  2711. const _sfc_main$1k = defineComponent({
  2712. name: "FullScreen"
  2713. });
  2714. const _hoisted_1$R = {
  2715. viewBox: "0 0 1024 1024",
  2716. xmlns: "http://www.w3.org/2000/svg"
  2717. };
  2718. const _hoisted_2$I = /* @__PURE__ */ createElementVNode("path", {
  2719. fill: "currentColor",
  2720. d: "m160 96.064 192 .192a32 32 0 0 1 0 64l-192-.192V352a32 32 0 0 1-64 0V96h64v.064zm0 831.872V928H96V672a32 32 0 1 1 64 0v191.936l192-.192a32 32 0 1 1 0 64l-192 .192zM864 96.064V96h64v256a32 32 0 1 1-64 0V160.064l-192 .192a32 32 0 1 1 0-64l192-.192zm0 831.872-192-.192a32 32 0 0 1 0-64l192 .192V672a32 32 0 1 1 64 0v256h-64v-.064z"
  2721. }, null, -1);
  2722. const _hoisted_3$v = [
  2723. _hoisted_2$I
  2724. ];
  2725. function _sfc_render$R(_ctx, _cache, $props, $setup, $data, $options) {
  2726. return openBlock(), createElementBlock("svg", _hoisted_1$R, _hoisted_3$v);
  2727. }
  2728. var fullScreen = /* @__PURE__ */ _export_sfc$2(_sfc_main$1k, [["render", _sfc_render$R]]);
  2729. const _sfc_main$1j = defineComponent({
  2730. name: "Hide"
  2731. });
  2732. const _hoisted_1$Q = {
  2733. viewBox: "0 0 1024 1024",
  2734. xmlns: "http://www.w3.org/2000/svg"
  2735. };
  2736. const _hoisted_2$H = /* @__PURE__ */ createElementVNode("path", {
  2737. d: "M876.8 156.8c0-9.6-3.2-16-9.6-22.4-6.4-6.4-12.8-9.6-22.4-9.6-9.6 0-16 3.2-22.4 9.6L736 220.8c-64-32-137.6-51.2-224-60.8-160 16-288 73.6-377.6 176C44.8 438.4 0 496 0 512s48 73.6 134.4 176c22.4 25.6 44.8 48 73.6 67.2l-86.4 89.6c-6.4 6.4-9.6 12.8-9.6 22.4 0 9.6 3.2 16 9.6 22.4 6.4 6.4 12.8 9.6 22.4 9.6 9.6 0 16-3.2 22.4-9.6l704-710.4c3.2-6.4 6.4-12.8 6.4-22.4Zm-646.4 528c-76.8-70.4-128-128-153.6-172.8 28.8-48 80-105.6 153.6-172.8C304 272 400 230.4 512 224c64 3.2 124.8 19.2 176 44.8l-54.4 54.4C598.4 300.8 560 288 512 288c-64 0-115.2 22.4-160 64s-64 96-64 160c0 48 12.8 89.6 35.2 124.8L256 707.2c-9.6-6.4-19.2-16-25.6-22.4Zm140.8-96c-12.8-22.4-19.2-48-19.2-76.8 0-44.8 16-83.2 48-112 32-28.8 67.2-48 112-48 28.8 0 54.4 6.4 73.6 19.2L371.2 588.8ZM889.599 336c-12.8-16-28.8-28.8-41.6-41.6l-48 48c73.6 67.2 124.8 124.8 150.4 169.6-28.8 48-80 105.6-153.6 172.8-73.6 67.2-172.8 108.8-284.8 115.2-51.2-3.2-99.2-12.8-140.8-28.8l-48 48c57.6 22.4 118.4 38.4 188.8 44.8 160-16 288-73.6 377.6-176C979.199 585.6 1024 528 1024 512s-48.001-73.6-134.401-176Z",
  2738. fill: "currentColor"
  2739. }, null, -1);
  2740. const _hoisted_3$u = /* @__PURE__ */ createElementVNode("path", {
  2741. d: "M511.998 672c-12.8 0-25.6-3.2-38.4-6.4l-51.2 51.2c28.8 12.8 57.6 19.2 89.6 19.2 64 0 115.2-22.4 160-64 41.6-41.6 64-96 64-160 0-32-6.4-64-19.2-89.6l-51.2 51.2c3.2 12.8 6.4 25.6 6.4 38.4 0 44.8-16 83.2-48 112-32 28.8-67.2 48-112 48Z",
  2742. fill: "currentColor"
  2743. }, null, -1);
  2744. const _hoisted_4$f = [
  2745. _hoisted_2$H,
  2746. _hoisted_3$u
  2747. ];
  2748. function _sfc_render$Q(_ctx, _cache, $props, $setup, $data, $options) {
  2749. return openBlock(), createElementBlock("svg", _hoisted_1$Q, _hoisted_4$f);
  2750. }
  2751. var hide$2 = /* @__PURE__ */ _export_sfc$2(_sfc_main$1j, [["render", _sfc_render$Q]]);
  2752. const _sfc_main$1i = defineComponent({
  2753. name: "Loading"
  2754. });
  2755. const _hoisted_1$P = {
  2756. viewBox: "0 0 1024 1024",
  2757. xmlns: "http://www.w3.org/2000/svg"
  2758. };
  2759. const _hoisted_2$G = /* @__PURE__ */ createElementVNode("path", {
  2760. fill: "currentColor",
  2761. d: "M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32zm0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32zm448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32zm-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32zM195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0zm-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z"
  2762. }, null, -1);
  2763. const _hoisted_3$t = [
  2764. _hoisted_2$G
  2765. ];
  2766. function _sfc_render$P(_ctx, _cache, $props, $setup, $data, $options) {
  2767. return openBlock(), createElementBlock("svg", _hoisted_1$P, _hoisted_3$t);
  2768. }
  2769. var loading = /* @__PURE__ */ _export_sfc$2(_sfc_main$1i, [["render", _sfc_render$P]]);
  2770. const _sfc_main$1h = defineComponent({
  2771. name: "Minus"
  2772. });
  2773. const _hoisted_1$O = {
  2774. viewBox: "0 0 1024 1024",
  2775. xmlns: "http://www.w3.org/2000/svg"
  2776. };
  2777. const _hoisted_2$F = /* @__PURE__ */ createElementVNode("path", {
  2778. fill: "currentColor",
  2779. d: "M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64z"
  2780. }, null, -1);
  2781. const _hoisted_3$s = [
  2782. _hoisted_2$F
  2783. ];
  2784. function _sfc_render$O(_ctx, _cache, $props, $setup, $data, $options) {
  2785. return openBlock(), createElementBlock("svg", _hoisted_1$O, _hoisted_3$s);
  2786. }
  2787. var minus = /* @__PURE__ */ _export_sfc$2(_sfc_main$1h, [["render", _sfc_render$O]]);
  2788. const _sfc_main$1g = defineComponent({
  2789. name: "Plus"
  2790. });
  2791. const _hoisted_1$N = {
  2792. viewBox: "0 0 1024 1024",
  2793. xmlns: "http://www.w3.org/2000/svg"
  2794. };
  2795. const _hoisted_2$E = /* @__PURE__ */ createElementVNode("path", {
  2796. fill: "currentColor",
  2797. d: "M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64h352z"
  2798. }, null, -1);
  2799. const _hoisted_3$r = [
  2800. _hoisted_2$E
  2801. ];
  2802. function _sfc_render$N(_ctx, _cache, $props, $setup, $data, $options) {
  2803. return openBlock(), createElementBlock("svg", _hoisted_1$N, _hoisted_3$r);
  2804. }
  2805. var plus = /* @__PURE__ */ _export_sfc$2(_sfc_main$1g, [["render", _sfc_render$N]]);
  2806. const _sfc_main$1f = defineComponent({
  2807. name: "RefreshLeft"
  2808. });
  2809. const _hoisted_1$M = {
  2810. viewBox: "0 0 1024 1024",
  2811. xmlns: "http://www.w3.org/2000/svg"
  2812. };
  2813. const _hoisted_2$D = /* @__PURE__ */ createElementVNode("path", {
  2814. fill: "currentColor",
  2815. d: "M289.088 296.704h92.992a32 32 0 0 1 0 64H232.96a32 32 0 0 1-32-32V179.712a32 32 0 0 1 64 0v50.56a384 384 0 0 1 643.84 282.88 384 384 0 0 1-383.936 384 384 384 0 0 1-384-384h64a320 320 0 1 0 640 0 320 320 0 0 0-555.712-216.448z"
  2816. }, null, -1);
  2817. const _hoisted_3$q = [
  2818. _hoisted_2$D
  2819. ];
  2820. function _sfc_render$M(_ctx, _cache, $props, $setup, $data, $options) {
  2821. return openBlock(), createElementBlock("svg", _hoisted_1$M, _hoisted_3$q);
  2822. }
  2823. var refreshLeft = /* @__PURE__ */ _export_sfc$2(_sfc_main$1f, [["render", _sfc_render$M]]);
  2824. const _sfc_main$1e = defineComponent({
  2825. name: "RefreshRight"
  2826. });
  2827. const _hoisted_1$L = {
  2828. viewBox: "0 0 1024 1024",
  2829. xmlns: "http://www.w3.org/2000/svg"
  2830. };
  2831. const _hoisted_2$C = /* @__PURE__ */ createElementVNode("path", {
  2832. fill: "currentColor",
  2833. d: "M784.512 230.272v-50.56a32 32 0 1 1 64 0v149.056a32 32 0 0 1-32 32H667.52a32 32 0 1 1 0-64h92.992A320 320 0 1 0 524.8 833.152a320 320 0 0 0 320-320h64a384 384 0 0 1-384 384 384 384 0 0 1-384-384 384 384 0 0 1 643.712-282.88z"
  2834. }, null, -1);
  2835. const _hoisted_3$p = [
  2836. _hoisted_2$C
  2837. ];
  2838. function _sfc_render$L(_ctx, _cache, $props, $setup, $data, $options) {
  2839. return openBlock(), createElementBlock("svg", _hoisted_1$L, _hoisted_3$p);
  2840. }
  2841. var refreshRight = /* @__PURE__ */ _export_sfc$2(_sfc_main$1e, [["render", _sfc_render$L]]);
  2842. const _sfc_main$1d = defineComponent({
  2843. name: "ScaleToOriginal"
  2844. });
  2845. const _hoisted_1$K = {
  2846. viewBox: "0 0 1024 1024",
  2847. xmlns: "http://www.w3.org/2000/svg"
  2848. };
  2849. const _hoisted_2$B = /* @__PURE__ */ createElementVNode("path", {
  2850. fill: "currentColor",
  2851. d: "M813.176 180.706a60.235 60.235 0 0 1 60.236 60.235v481.883a60.235 60.235 0 0 1-60.236 60.235H210.824a60.235 60.235 0 0 1-60.236-60.235V240.94a60.235 60.235 0 0 1 60.236-60.235h602.352zm0-60.235H210.824A120.47 120.47 0 0 0 90.353 240.94v481.883a120.47 120.47 0 0 0 120.47 120.47h602.353a120.47 120.47 0 0 0 120.471-120.47V240.94a120.47 120.47 0 0 0-120.47-120.47zm-120.47 180.705a30.118 30.118 0 0 0-30.118 30.118v301.177a30.118 30.118 0 0 0 60.236 0V331.294a30.118 30.118 0 0 0-30.118-30.118zm-361.412 0a30.118 30.118 0 0 0-30.118 30.118v301.177a30.118 30.118 0 1 0 60.236 0V331.294a30.118 30.118 0 0 0-30.118-30.118zM512 361.412a30.118 30.118 0 0 0-30.118 30.117v30.118a30.118 30.118 0 0 0 60.236 0V391.53A30.118 30.118 0 0 0 512 361.412zM512 512a30.118 30.118 0 0 0-30.118 30.118v30.117a30.118 30.118 0 0 0 60.236 0v-30.117A30.118 30.118 0 0 0 512 512z"
  2852. }, null, -1);
  2853. const _hoisted_3$o = [
  2854. _hoisted_2$B
  2855. ];
  2856. function _sfc_render$K(_ctx, _cache, $props, $setup, $data, $options) {
  2857. return openBlock(), createElementBlock("svg", _hoisted_1$K, _hoisted_3$o);
  2858. }
  2859. var scaleToOriginal = /* @__PURE__ */ _export_sfc$2(_sfc_main$1d, [["render", _sfc_render$K]]);
  2860. const _sfc_main$1c = defineComponent({
  2861. name: "StarFilled"
  2862. });
  2863. const _hoisted_1$J = {
  2864. viewBox: "0 0 1024 1024",
  2865. xmlns: "http://www.w3.org/2000/svg"
  2866. };
  2867. const _hoisted_2$A = /* @__PURE__ */ createElementVNode("path", {
  2868. fill: "currentColor",
  2869. d: "M283.84 867.84 512 747.776l228.16 119.936a6.4 6.4 0 0 0 9.28-6.72l-43.52-254.08 184.512-179.904a6.4 6.4 0 0 0-3.52-10.88l-255.104-37.12L517.76 147.904a6.4 6.4 0 0 0-11.52 0L392.192 379.072l-255.104 37.12a6.4 6.4 0 0 0-3.52 10.88L318.08 606.976l-43.584 254.08a6.4 6.4 0 0 0 9.28 6.72z"
  2870. }, null, -1);
  2871. const _hoisted_3$n = [
  2872. _hoisted_2$A
  2873. ];
  2874. function _sfc_render$J(_ctx, _cache, $props, $setup, $data, $options) {
  2875. return openBlock(), createElementBlock("svg", _hoisted_1$J, _hoisted_3$n);
  2876. }
  2877. var starFilled = /* @__PURE__ */ _export_sfc$2(_sfc_main$1c, [["render", _sfc_render$J]]);
  2878. const _sfc_main$1b = defineComponent({
  2879. name: "Star"
  2880. });
  2881. const _hoisted_1$I = {
  2882. viewBox: "0 0 1024 1024",
  2883. xmlns: "http://www.w3.org/2000/svg"
  2884. };
  2885. const _hoisted_2$z = /* @__PURE__ */ createElementVNode("path", {
  2886. fill: "currentColor",
  2887. d: "m512 747.84 228.16 119.936a6.4 6.4 0 0 0 9.28-6.72l-43.52-254.08 184.512-179.904a6.4 6.4 0 0 0-3.52-10.88l-255.104-37.12L517.76 147.904a6.4 6.4 0 0 0-11.52 0L392.192 379.072l-255.104 37.12a6.4 6.4 0 0 0-3.52 10.88L318.08 606.976l-43.584 254.08a6.4 6.4 0 0 0 9.28 6.72L512 747.84zM313.6 924.48a70.4 70.4 0 0 1-102.144-74.24l37.888-220.928L88.96 472.96A70.4 70.4 0 0 1 128 352.896l221.76-32.256 99.2-200.96a70.4 70.4 0 0 1 126.208 0l99.2 200.96 221.824 32.256a70.4 70.4 0 0 1 39.04 120.064L774.72 629.376l37.888 220.928a70.4 70.4 0 0 1-102.144 74.24L512 820.096l-198.4 104.32z"
  2888. }, null, -1);
  2889. const _hoisted_3$m = [
  2890. _hoisted_2$z
  2891. ];
  2892. function _sfc_render$I(_ctx, _cache, $props, $setup, $data, $options) {
  2893. return openBlock(), createElementBlock("svg", _hoisted_1$I, _hoisted_3$m);
  2894. }
  2895. var star = /* @__PURE__ */ _export_sfc$2(_sfc_main$1b, [["render", _sfc_render$I]]);
  2896. const _sfc_main$1a = defineComponent({
  2897. name: "View"
  2898. });
  2899. const _hoisted_1$H = {
  2900. viewBox: "0 0 1024 1024",
  2901. xmlns: "http://www.w3.org/2000/svg"
  2902. };
  2903. const _hoisted_2$y = /* @__PURE__ */ createElementVNode("path", {
  2904. fill: "currentColor",
  2905. d: "M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352zm0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288zm0 64a224 224 0 1 1 0 448 224 224 0 0 1 0-448zm0 64a160.192 160.192 0 0 0-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160z"
  2906. }, null, -1);
  2907. const _hoisted_3$l = [
  2908. _hoisted_2$y
  2909. ];
  2910. function _sfc_render$H(_ctx, _cache, $props, $setup, $data, $options) {
  2911. return openBlock(), createElementBlock("svg", _hoisted_1$H, _hoisted_3$l);
  2912. }
  2913. var view = /* @__PURE__ */ _export_sfc$2(_sfc_main$1a, [["render", _sfc_render$H]]);
  2914. const _sfc_main$19 = defineComponent({
  2915. name: "WarningFilled"
  2916. });
  2917. const _hoisted_1$G = {
  2918. viewBox: "0 0 1024 1024",
  2919. xmlns: "http://www.w3.org/2000/svg"
  2920. };
  2921. const _hoisted_2$x = /* @__PURE__ */ createElementVNode("path", {
  2922. fill: "currentColor",
  2923. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm0 192a58.432 58.432 0 0 0-58.24 63.744l23.36 256.384a35.072 35.072 0 0 0 69.76 0l23.296-256.384A58.432 58.432 0 0 0 512 256zm0 512a51.2 51.2 0 1 0 0-102.4 51.2 51.2 0 0 0 0 102.4z"
  2924. }, null, -1);
  2925. const _hoisted_3$k = [
  2926. _hoisted_2$x
  2927. ];
  2928. function _sfc_render$G(_ctx, _cache, $props, $setup, $data, $options) {
  2929. return openBlock(), createElementBlock("svg", _hoisted_1$G, _hoisted_3$k);
  2930. }
  2931. var warningFilled = /* @__PURE__ */ _export_sfc$2(_sfc_main$19, [["render", _sfc_render$G]]);
  2932. const _sfc_main$18 = defineComponent({
  2933. name: "ZoomIn"
  2934. });
  2935. const _hoisted_1$F = {
  2936. viewBox: "0 0 1024 1024",
  2937. xmlns: "http://www.w3.org/2000/svg"
  2938. };
  2939. const _hoisted_2$w = /* @__PURE__ */ createElementVNode("path", {
  2940. fill: "currentColor",
  2941. d: "m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704zm-32-384v-96a32 32 0 0 1 64 0v96h96a32 32 0 0 1 0 64h-96v96a32 32 0 0 1-64 0v-96h-96a32 32 0 0 1 0-64h96z"
  2942. }, null, -1);
  2943. const _hoisted_3$j = [
  2944. _hoisted_2$w
  2945. ];
  2946. function _sfc_render$F(_ctx, _cache, $props, $setup, $data, $options) {
  2947. return openBlock(), createElementBlock("svg", _hoisted_1$F, _hoisted_3$j);
  2948. }
  2949. var zoomIn = /* @__PURE__ */ _export_sfc$2(_sfc_main$18, [["render", _sfc_render$F]]);
  2950. const _sfc_main$17 = defineComponent({
  2951. name: "ZoomOut"
  2952. });
  2953. const _hoisted_1$E = {
  2954. viewBox: "0 0 1024 1024",
  2955. xmlns: "http://www.w3.org/2000/svg"
  2956. };
  2957. const _hoisted_2$v = /* @__PURE__ */ createElementVNode("path", {
  2958. fill: "currentColor",
  2959. d: "m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704zM352 448h256a32 32 0 0 1 0 64H352a32 32 0 0 1 0-64z"
  2960. }, null, -1);
  2961. const _hoisted_3$i = [
  2962. _hoisted_2$v
  2963. ];
  2964. function _sfc_render$E(_ctx, _cache, $props, $setup, $data, $options) {
  2965. return openBlock(), createElementBlock("svg", _hoisted_1$E, _hoisted_3$i);
  2966. }
  2967. var zoomOut = /* @__PURE__ */ _export_sfc$2(_sfc_main$17, [["render", _sfc_render$E]]);
  2968. const wrapperKey = Symbol();
  2969. const propKey = "__elPropsReservedKey";
  2970. function buildProp(option, key) {
  2971. if (!isObject$1(option) || !!option[propKey])
  2972. return option;
  2973. const { values, required: required4, default: defaultValue, type: type4, validator } = option;
  2974. const _validator = values || validator ? (val) => {
  2975. let valid = false;
  2976. let allowedValues = [];
  2977. if (values) {
  2978. allowedValues = Array.from(values);
  2979. if (hasOwn(option, "default")) {
  2980. allowedValues.push(defaultValue);
  2981. }
  2982. valid || (valid = allowedValues.includes(val));
  2983. }
  2984. if (validator)
  2985. valid || (valid = validator(val));
  2986. if (!valid && allowedValues.length > 0) {
  2987. const allowValuesText = [...new Set(allowedValues)].map((value) => JSON.stringify(value)).join(", ");
  2988. warn(`Invalid prop: validation failed${key ? ` for prop "${key}"` : ""}. Expected one of [${allowValuesText}], got value ${JSON.stringify(val)}.`);
  2989. }
  2990. return valid;
  2991. } : void 0;
  2992. const prop = {
  2993. type: isObject$1(type4) && Object.getOwnPropertySymbols(type4).includes(wrapperKey) ? type4[wrapperKey] : type4,
  2994. required: !!required4,
  2995. validator: _validator,
  2996. [propKey]: true
  2997. };
  2998. if (hasOwn(option, "default"))
  2999. prop.default = defaultValue;
  3000. return prop;
  3001. }
  3002. const buildProps = (props) => fromPairs(Object.entries(props).map(([key, option]) => [
  3003. key,
  3004. buildProp(option, key)
  3005. ]));
  3006. const definePropType = (val) => ({ [wrapperKey]: val });
  3007. const iconPropType = definePropType([
  3008. String,
  3009. Object,
  3010. Function
  3011. ]);
  3012. const CloseComponents = {
  3013. Close: close
  3014. };
  3015. const ValidateComponentsMap = {
  3016. validating: loading,
  3017. success: circleCheck,
  3018. error: circleClose
  3019. };
  3020. const withInstall = (main2, extra) => {
  3021. main2.install = (app) => {
  3022. for (const comp of [main2, ...Object.values(extra != null ? extra : {})]) {
  3023. app.component(comp.name, comp);
  3024. }
  3025. };
  3026. if (extra) {
  3027. for (const [key, comp] of Object.entries(extra)) {
  3028. main2[key] = comp;
  3029. }
  3030. }
  3031. return main2;
  3032. };
  3033. const withNoopInstall = (component) => {
  3034. component.install = NOOP;
  3035. return component;
  3036. };
  3037. class ElementPlusError extends Error {
  3038. constructor(m2) {
  3039. super(m2);
  3040. this.name = "ElementPlusError";
  3041. }
  3042. }
  3043. function throwError(scope, m2) {
  3044. throw new ElementPlusError(`[${scope}] ${m2}`);
  3045. }
  3046. function debugWarn(scope, message) {
  3047. }
  3048. function addUnit(value, defaultUnit = "px") {
  3049. if (!value)
  3050. return "";
  3051. if (isString(value)) {
  3052. return value;
  3053. } else if (isNumber(value)) {
  3054. return `${value}${defaultUnit}`;
  3055. }
  3056. }
  3057. const EVENT_CODE = {
  3058. tab: "Tab",
  3059. enter: "Enter",
  3060. space: "Space",
  3061. left: "ArrowLeft",
  3062. up: "ArrowUp",
  3063. right: "ArrowRight",
  3064. down: "ArrowDown",
  3065. esc: "Escape",
  3066. delete: "Delete",
  3067. backspace: "Backspace",
  3068. numpadEnter: "NumpadEnter",
  3069. pageUp: "PageUp",
  3070. pageDown: "PageDown",
  3071. home: "Home",
  3072. end: "End"
  3073. };
  3074. const datePickTypes = [
  3075. "year",
  3076. "month",
  3077. "date",
  3078. "dates",
  3079. "week",
  3080. "datetime",
  3081. "datetimerange",
  3082. "daterange",
  3083. "monthrange"
  3084. ];
  3085. const UPDATE_MODEL_EVENT = "update:modelValue";
  3086. const CHANGE_EVENT = "change";
  3087. const INPUT_EVENT = "input";
  3088. const componentSizes = ["", "default", "small", "large"];
  3089. const componentSizeMap = {
  3090. large: 40,
  3091. default: 32,
  3092. small: 24
  3093. };
  3094. const getComponentSize = (size = "default") => {
  3095. return componentSizeMap[size || "default"];
  3096. };
  3097. const isValidComponentSize = (val) => ["", ...componentSizes].includes(val);
  3098. const isValidDatePickType = (val) => [...datePickTypes].includes(val);
  3099. var PatchFlags = /* @__PURE__ */ ((PatchFlags2) => {
  3100. PatchFlags2[PatchFlags2["TEXT"] = 1] = "TEXT";
  3101. PatchFlags2[PatchFlags2["CLASS"] = 2] = "CLASS";
  3102. PatchFlags2[PatchFlags2["STYLE"] = 4] = "STYLE";
  3103. PatchFlags2[PatchFlags2["PROPS"] = 8] = "PROPS";
  3104. PatchFlags2[PatchFlags2["FULL_PROPS"] = 16] = "FULL_PROPS";
  3105. PatchFlags2[PatchFlags2["HYDRATE_EVENTS"] = 32] = "HYDRATE_EVENTS";
  3106. PatchFlags2[PatchFlags2["STABLE_FRAGMENT"] = 64] = "STABLE_FRAGMENT";
  3107. PatchFlags2[PatchFlags2["KEYED_FRAGMENT"] = 128] = "KEYED_FRAGMENT";
  3108. PatchFlags2[PatchFlags2["UNKEYED_FRAGMENT"] = 256] = "UNKEYED_FRAGMENT";
  3109. PatchFlags2[PatchFlags2["NEED_PATCH"] = 512] = "NEED_PATCH";
  3110. PatchFlags2[PatchFlags2["DYNAMIC_SLOTS"] = 1024] = "DYNAMIC_SLOTS";
  3111. PatchFlags2[PatchFlags2["HOISTED"] = -1] = "HOISTED";
  3112. PatchFlags2[PatchFlags2["BAIL"] = -2] = "BAIL";
  3113. return PatchFlags2;
  3114. })(PatchFlags || {});
  3115. function isFragment(node) {
  3116. return isVNode(node) && node.type === Fragment;
  3117. }
  3118. function isComment(node) {
  3119. return isVNode(node) && node.type === Comment;
  3120. }
  3121. function isValidElementNode(node) {
  3122. return isVNode(node) && !isFragment(node) && !isComment(node);
  3123. }
  3124. const unique = (arr) => [...new Set(arr)];
  3125. const castArray = (arr) => {
  3126. if (!arr && arr !== 0)
  3127. return [];
  3128. return Array.isArray(arr) ? arr : [arr];
  3129. };
  3130. const isFirefox = () => isClient && /firefox/i.test(window.navigator.userAgent);
  3131. const isKorean = (text) => /([(\uAC00-\uD7AF)|(\u3130-\u318F)])+/gi.test(text);
  3132. const generateId = () => Math.floor(Math.random() * 1e4);
  3133. const mutable = (val) => val;
  3134. const DEFAULT_EXCLUDE_KEYS = ["class", "style"];
  3135. const LISTENER_PREFIX = /^on[A-Z]/;
  3136. const useAttrs = (params = {}) => {
  3137. const { excludeListeners = false, excludeKeys = [] } = params;
  3138. const allExcludeKeys = excludeKeys.concat(DEFAULT_EXCLUDE_KEYS);
  3139. const instance = getCurrentInstance();
  3140. if (!instance) {
  3141. return computed(() => ({}));
  3142. }
  3143. return computed(() => {
  3144. var _a2;
  3145. return fromPairs(Object.entries((_a2 = instance.proxy) == null ? void 0 : _a2.$attrs).filter(([key]) => !allExcludeKeys.includes(key) && !(excludeListeners && LISTENER_PREFIX.test(key))));
  3146. });
  3147. };
  3148. const buttonGroupContextKey = Symbol("buttonGroupContextKey");
  3149. const configProviderContextKey = Symbol();
  3150. const dialogInjectionKey = Symbol("dialogInjectionKey");
  3151. const formContextKey = Symbol("formContextKey");
  3152. const formItemContextKey = Symbol("formItemContextKey");
  3153. const radioGroupKey = Symbol("radioGroupKey");
  3154. const scrollbarContextKey = Symbol("scrollbarContextKey");
  3155. const uploadContextKey = Symbol("uploadContextKey");
  3156. const POPPER_INJECTION_KEY = Symbol("popper");
  3157. const POPPER_CONTENT_INJECTION_KEY = Symbol("popperContent");
  3158. const useProp = (name) => {
  3159. const vm = getCurrentInstance();
  3160. return computed(() => {
  3161. var _a2, _b2;
  3162. return (_b2 = (_a2 = vm.proxy) == null ? void 0 : _a2.$props[name]) != null ? _b2 : void 0;
  3163. });
  3164. };
  3165. const globalConfig = ref();
  3166. function useGlobalConfig(key, defaultValue = void 0) {
  3167. const config = getCurrentInstance() ? inject(configProviderContextKey, globalConfig) : globalConfig;
  3168. if (key) {
  3169. return computed(() => {
  3170. var _a2, _b2;
  3171. return (_b2 = (_a2 = config.value) == null ? void 0 : _a2[key]) != null ? _b2 : defaultValue;
  3172. });
  3173. } else {
  3174. return config;
  3175. }
  3176. }
  3177. const provideGlobalConfig = (config, app, global2 = false) => {
  3178. var _a2;
  3179. const inSetup = !!getCurrentInstance();
  3180. const oldConfig = inSetup ? useGlobalConfig() : void 0;
  3181. const provideFn = (_a2 = app == null ? void 0 : app.provide) != null ? _a2 : inSetup ? provide : void 0;
  3182. if (!provideFn) {
  3183. return;
  3184. }
  3185. const context = computed(() => {
  3186. const cfg = unref(config);
  3187. if (!(oldConfig == null ? void 0 : oldConfig.value))
  3188. return cfg;
  3189. return mergeConfig(oldConfig.value, cfg);
  3190. });
  3191. provideFn(configProviderContextKey, context);
  3192. if (global2 || !globalConfig.value) {
  3193. globalConfig.value = context.value;
  3194. }
  3195. return context;
  3196. };
  3197. const mergeConfig = (a2, b2) => {
  3198. var _a2;
  3199. const keys2 = [.../* @__PURE__ */ new Set([...keysOf(a2), ...keysOf(b2)])];
  3200. const obj = {};
  3201. for (const key of keys2) {
  3202. obj[key] = (_a2 = b2[key]) != null ? _a2 : a2[key];
  3203. }
  3204. return obj;
  3205. };
  3206. const useSizeProp = buildProp({
  3207. type: String,
  3208. values: componentSizes,
  3209. required: false
  3210. });
  3211. const useSize = (fallback, ignore = {}) => {
  3212. const emptyRef = ref(void 0);
  3213. const size = ignore.prop ? emptyRef : useProp("size");
  3214. const globalConfig2 = ignore.global ? emptyRef : useGlobalConfig("size");
  3215. const form = ignore.form ? { size: void 0 } : inject(formContextKey, void 0);
  3216. const formItem = ignore.formItem ? { size: void 0 } : inject(formItemContextKey, void 0);
  3217. return computed(() => size.value || unref(fallback) || (formItem == null ? void 0 : formItem.size) || (form == null ? void 0 : form.size) || globalConfig2.value || "");
  3218. };
  3219. const useDisabled$1 = (fallback) => {
  3220. const disabled = useProp("disabled");
  3221. const form = inject(formContextKey, void 0);
  3222. return computed(() => disabled.value || unref(fallback) || (form == null ? void 0 : form.disabled) || false);
  3223. };
  3224. const useDeprecated = ({ from, replacement, scope, version, ref: ref2, type: type4 = "API" }, condition) => {
  3225. watch(() => unref(condition), (val) => {
  3226. }, {
  3227. immediate: true
  3228. });
  3229. };
  3230. const useDraggable = (targetRef, dragRef, draggable) => {
  3231. let transform = {
  3232. offsetX: 0,
  3233. offsetY: 0
  3234. };
  3235. const onMousedown = (e) => {
  3236. const downX = e.clientX;
  3237. const downY = e.clientY;
  3238. const { offsetX, offsetY } = transform;
  3239. const targetRect = targetRef.value.getBoundingClientRect();
  3240. const targetLeft = targetRect.left;
  3241. const targetTop = targetRect.top;
  3242. const targetWidth = targetRect.width;
  3243. const targetHeight = targetRect.height;
  3244. const clientWidth = document.documentElement.clientWidth;
  3245. const clientHeight = document.documentElement.clientHeight;
  3246. const minLeft = -targetLeft + offsetX;
  3247. const minTop = -targetTop + offsetY;
  3248. const maxLeft = clientWidth - targetLeft - targetWidth + offsetX;
  3249. const maxTop = clientHeight - targetTop - targetHeight + offsetY;
  3250. const onMousemove = (e2) => {
  3251. const moveX = Math.min(Math.max(offsetX + e2.clientX - downX, minLeft), maxLeft);
  3252. const moveY = Math.min(Math.max(offsetY + e2.clientY - downY, minTop), maxTop);
  3253. transform = {
  3254. offsetX: moveX,
  3255. offsetY: moveY
  3256. };
  3257. targetRef.value.style.transform = `translate(${addUnit(moveX)}, ${addUnit(moveY)})`;
  3258. };
  3259. const onMouseup = () => {
  3260. document.removeEventListener("mousemove", onMousemove);
  3261. document.removeEventListener("mouseup", onMouseup);
  3262. };
  3263. document.addEventListener("mousemove", onMousemove);
  3264. document.addEventListener("mouseup", onMouseup);
  3265. };
  3266. const onDraggable = () => {
  3267. if (dragRef.value && targetRef.value) {
  3268. dragRef.value.addEventListener("mousedown", onMousedown);
  3269. }
  3270. };
  3271. const offDraggable = () => {
  3272. if (dragRef.value && targetRef.value) {
  3273. dragRef.value.removeEventListener("mousedown", onMousedown);
  3274. }
  3275. };
  3276. onMounted(() => {
  3277. watchEffect(() => {
  3278. if (draggable.value) {
  3279. onDraggable();
  3280. } else {
  3281. offDraggable();
  3282. }
  3283. });
  3284. });
  3285. onBeforeUnmount(() => {
  3286. offDraggable();
  3287. });
  3288. };
  3289. const useFocus = (el) => {
  3290. return {
  3291. focus: () => {
  3292. var _a2, _b2;
  3293. (_b2 = (_a2 = el.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b2.call(_a2);
  3294. }
  3295. };
  3296. };
  3297. const useFormItem = () => {
  3298. const form = inject(formContextKey, void 0);
  3299. const formItem = inject(formItemContextKey, void 0);
  3300. return {
  3301. form,
  3302. formItem
  3303. };
  3304. };
  3305. var English = {
  3306. name: "en",
  3307. el: {
  3308. colorpicker: {
  3309. confirm: "OK",
  3310. clear: "Clear"
  3311. },
  3312. datepicker: {
  3313. now: "Now",
  3314. today: "Today",
  3315. cancel: "Cancel",
  3316. clear: "Clear",
  3317. confirm: "OK",
  3318. selectDate: "Select date",
  3319. selectTime: "Select time",
  3320. startDate: "Start Date",
  3321. startTime: "Start Time",
  3322. endDate: "End Date",
  3323. endTime: "End Time",
  3324. prevYear: "Previous Year",
  3325. nextYear: "Next Year",
  3326. prevMonth: "Previous Month",
  3327. nextMonth: "Next Month",
  3328. year: "",
  3329. month1: "January",
  3330. month2: "February",
  3331. month3: "March",
  3332. month4: "April",
  3333. month5: "May",
  3334. month6: "June",
  3335. month7: "July",
  3336. month8: "August",
  3337. month9: "September",
  3338. month10: "October",
  3339. month11: "November",
  3340. month12: "December",
  3341. week: "week",
  3342. weeks: {
  3343. sun: "Sun",
  3344. mon: "Mon",
  3345. tue: "Tue",
  3346. wed: "Wed",
  3347. thu: "Thu",
  3348. fri: "Fri",
  3349. sat: "Sat"
  3350. },
  3351. months: {
  3352. jan: "Jan",
  3353. feb: "Feb",
  3354. mar: "Mar",
  3355. apr: "Apr",
  3356. may: "May",
  3357. jun: "Jun",
  3358. jul: "Jul",
  3359. aug: "Aug",
  3360. sep: "Sep",
  3361. oct: "Oct",
  3362. nov: "Nov",
  3363. dec: "Dec"
  3364. }
  3365. },
  3366. select: {
  3367. loading: "Loading",
  3368. noMatch: "No matching data",
  3369. noData: "No data",
  3370. placeholder: "Select"
  3371. },
  3372. cascader: {
  3373. noMatch: "No matching data",
  3374. loading: "Loading",
  3375. placeholder: "Select",
  3376. noData: "No data"
  3377. },
  3378. pagination: {
  3379. goto: "Go to",
  3380. pagesize: "/page",
  3381. total: "Total {total}",
  3382. pageClassifier: "",
  3383. deprecationWarning: "Deprecated usages detected, please refer to the el-pagination documentation for more details"
  3384. },
  3385. messagebox: {
  3386. title: "Message",
  3387. confirm: "OK",
  3388. cancel: "Cancel",
  3389. error: "Illegal input"
  3390. },
  3391. upload: {
  3392. deleteTip: "press delete to remove",
  3393. delete: "Delete",
  3394. preview: "Preview",
  3395. continue: "Continue"
  3396. },
  3397. table: {
  3398. emptyText: "No Data",
  3399. confirmFilter: "Confirm",
  3400. resetFilter: "Reset",
  3401. clearFilter: "All",
  3402. sumText: "Sum"
  3403. },
  3404. tree: {
  3405. emptyText: "No Data"
  3406. },
  3407. transfer: {
  3408. noMatch: "No matching data",
  3409. noData: "No data",
  3410. titles: ["List 1", "List 2"],
  3411. filterPlaceholder: "Enter keyword",
  3412. noCheckedFormat: "{total} items",
  3413. hasCheckedFormat: "{checked}/{total} checked"
  3414. },
  3415. image: {
  3416. error: "FAILED"
  3417. },
  3418. pageHeader: {
  3419. title: "Back"
  3420. },
  3421. popconfirm: {
  3422. confirmButtonText: "Yes",
  3423. cancelButtonText: "No"
  3424. }
  3425. }
  3426. };
  3427. const buildTranslator = (locale) => (path, option) => translate(path, option, unref(locale));
  3428. const translate = (path, option, locale) => get(locale, path, path).replace(/\{(\w+)\}/g, (_2, key) => {
  3429. var _a2;
  3430. return `${(_a2 = option == null ? void 0 : option[key]) != null ? _a2 : `{${key}}`}`;
  3431. });
  3432. const buildLocaleContext = (locale) => {
  3433. const lang = computed(() => unref(locale).name);
  3434. const localeRef = isRef(locale) ? locale : ref(locale);
  3435. return {
  3436. lang,
  3437. locale: localeRef,
  3438. t: buildTranslator(locale)
  3439. };
  3440. };
  3441. const useLocale = () => {
  3442. const locale = useGlobalConfig("locale");
  3443. return buildLocaleContext(computed(() => locale.value || English));
  3444. };
  3445. const useLockscreen = (trigger) => {
  3446. if (!isRef(trigger)) {
  3447. throwError("[useLockscreen]", "You need to pass a ref param to this function");
  3448. }
  3449. if (!isClient || hasClass(document.body, "el-popup-parent--hidden")) {
  3450. return;
  3451. }
  3452. let scrollBarWidth2 = 0;
  3453. let withoutHiddenClass = false;
  3454. let bodyPaddingRight = "0";
  3455. let computedBodyPaddingRight = 0;
  3456. const cleanup = () => {
  3457. removeClass(document.body, "el-popup-parent--hidden");
  3458. if (withoutHiddenClass) {
  3459. document.body.style.paddingRight = bodyPaddingRight;
  3460. }
  3461. };
  3462. watch(trigger, (val) => {
  3463. if (!val) {
  3464. cleanup();
  3465. return;
  3466. }
  3467. withoutHiddenClass = !hasClass(document.body, "el-popup-parent--hidden");
  3468. if (withoutHiddenClass) {
  3469. bodyPaddingRight = document.body.style.paddingRight;
  3470. computedBodyPaddingRight = Number.parseInt(getStyle(document.body, "paddingRight"), 10);
  3471. }
  3472. scrollBarWidth2 = getScrollBarWidth();
  3473. const bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
  3474. const bodyOverflowY = getStyle(document.body, "overflowY");
  3475. if (scrollBarWidth2 > 0 && (bodyHasOverflow || bodyOverflowY === "scroll") && withoutHiddenClass) {
  3476. document.body.style.paddingRight = `${computedBodyPaddingRight + scrollBarWidth2}px`;
  3477. }
  3478. addClass(document.body, "el-popup-parent--hidden");
  3479. });
  3480. onScopeDispose(() => cleanup());
  3481. };
  3482. const modalStack = [];
  3483. const closeModal = (e) => {
  3484. if (modalStack.length === 0)
  3485. return;
  3486. if (e.code === EVENT_CODE.esc) {
  3487. e.stopPropagation();
  3488. const topModal = modalStack[modalStack.length - 1];
  3489. topModal.handleClose();
  3490. }
  3491. };
  3492. const useModal = (instance, visibleRef) => {
  3493. watch(visibleRef, (val) => {
  3494. if (val) {
  3495. modalStack.push(instance);
  3496. } else {
  3497. modalStack.splice(modalStack.indexOf(instance), 1);
  3498. }
  3499. });
  3500. };
  3501. if (isClient)
  3502. useEventListener(document, "keydown", closeModal);
  3503. const _prop = buildProp({
  3504. type: definePropType(Boolean),
  3505. default: null
  3506. });
  3507. const _event = buildProp({
  3508. type: definePropType(Function)
  3509. });
  3510. const createModelToggleComposable = (name) => {
  3511. const useModelToggleProps2 = {
  3512. [name]: _prop,
  3513. [`onUpdate:${name}`]: _event
  3514. };
  3515. const useModelToggleEmits2 = [`update:${name}`];
  3516. const useModelToggle2 = ({
  3517. indicator,
  3518. shouldHideWhenRouteChanges,
  3519. shouldProceed,
  3520. onShow,
  3521. onHide
  3522. }) => {
  3523. const instance = getCurrentInstance();
  3524. const props = instance.props;
  3525. const { emit } = instance;
  3526. const updateEventKey = `update:${name}`;
  3527. const hasUpdateHandler = computed(() => isFunction(props[`onUpdate:${name}`]));
  3528. const isModelBindingAbsent = computed(() => props[name] === null);
  3529. const doShow = () => {
  3530. if (indicator.value === true) {
  3531. return;
  3532. }
  3533. indicator.value = true;
  3534. if (isFunction(onShow)) {
  3535. onShow();
  3536. }
  3537. };
  3538. const doHide = () => {
  3539. if (indicator.value === false) {
  3540. return;
  3541. }
  3542. indicator.value = false;
  3543. if (isFunction(onHide)) {
  3544. onHide();
  3545. }
  3546. };
  3547. const show = () => {
  3548. if (props.disabled === true || isFunction(shouldProceed) && !shouldProceed())
  3549. return;
  3550. const shouldEmit = hasUpdateHandler.value && isClient;
  3551. if (shouldEmit) {
  3552. emit(updateEventKey, true);
  3553. }
  3554. if (isModelBindingAbsent.value || !shouldEmit) {
  3555. doShow();
  3556. }
  3557. };
  3558. const hide2 = () => {
  3559. if (props.disabled === true || !isClient)
  3560. return;
  3561. const shouldEmit = hasUpdateHandler.value && isClient;
  3562. if (shouldEmit) {
  3563. emit(updateEventKey, false);
  3564. }
  3565. if (isModelBindingAbsent.value || !shouldEmit) {
  3566. doHide();
  3567. }
  3568. };
  3569. const onChange = (val) => {
  3570. if (!isBoolean(val))
  3571. return;
  3572. if (props.disabled && val) {
  3573. if (hasUpdateHandler.value) {
  3574. emit(updateEventKey, false);
  3575. }
  3576. } else if (indicator.value !== val) {
  3577. if (val) {
  3578. doShow();
  3579. } else {
  3580. doHide();
  3581. }
  3582. }
  3583. };
  3584. const toggle = () => {
  3585. if (indicator.value) {
  3586. hide2();
  3587. } else {
  3588. show();
  3589. }
  3590. };
  3591. watch(() => props[name], onChange);
  3592. if (shouldHideWhenRouteChanges && instance.appContext.config.globalProperties.$route !== void 0) {
  3593. watch(() => __spreadValues({}, instance.proxy.$route), () => {
  3594. if (shouldHideWhenRouteChanges.value && indicator.value) {
  3595. hide2();
  3596. }
  3597. });
  3598. }
  3599. onMounted(() => {
  3600. onChange(props[name]);
  3601. });
  3602. return {
  3603. hide: hide2,
  3604. show,
  3605. toggle
  3606. };
  3607. };
  3608. return {
  3609. useModelToggle: useModelToggle2,
  3610. useModelToggleProps: useModelToggleProps2,
  3611. useModelToggleEmits: useModelToggleEmits2
  3612. };
  3613. };
  3614. const useRestoreActive = (toggle, initialFocus) => {
  3615. let previousActive;
  3616. watch(() => toggle.value, (val) => {
  3617. var _a2, _b2;
  3618. if (val) {
  3619. previousActive = document.activeElement;
  3620. if (isRef(initialFocus)) {
  3621. (_b2 = (_a2 = initialFocus.value).focus) == null ? void 0 : _b2.call(_a2);
  3622. }
  3623. } else {
  3624. {
  3625. previousActive.focus();
  3626. }
  3627. }
  3628. });
  3629. };
  3630. const useSameTarget = (handleClick) => {
  3631. if (!handleClick) {
  3632. return { onClick: NOOP, onMousedown: NOOP, onMouseup: NOOP };
  3633. }
  3634. let mousedownTarget = false;
  3635. let mouseupTarget = false;
  3636. const onClick = (e) => {
  3637. if (mousedownTarget && mouseupTarget) {
  3638. handleClick(e);
  3639. }
  3640. mousedownTarget = mouseupTarget = false;
  3641. };
  3642. const onMousedown = (e) => {
  3643. mousedownTarget = e.target === e.currentTarget;
  3644. };
  3645. const onMouseup = (e) => {
  3646. mouseupTarget = e.target === e.currentTarget;
  3647. };
  3648. return { onClick, onMousedown, onMouseup };
  3649. };
  3650. function useTimeout() {
  3651. let timeoutHandle;
  3652. const registerTimeout = (fn2, delay) => {
  3653. cancelTimeout();
  3654. timeoutHandle = window.setTimeout(fn2, delay);
  3655. };
  3656. const cancelTimeout = () => window.clearTimeout(timeoutHandle);
  3657. tryOnScopeDispose(() => cancelTimeout());
  3658. return {
  3659. registerTimeout,
  3660. cancelTimeout
  3661. };
  3662. }
  3663. const defaultIdInjection = {
  3664. prefix: Math.floor(Math.random() * 1e4),
  3665. current: 0
  3666. };
  3667. const ID_INJECTION_KEY = Symbol("elIdInjection");
  3668. const useId = (deterministicId) => {
  3669. const idInjection = inject(ID_INJECTION_KEY, defaultIdInjection);
  3670. const idRef = computed(() => unref(deterministicId) || `el-id-${idInjection.prefix}-${idInjection.current++}`);
  3671. return idRef;
  3672. };
  3673. const useEscapeKeydown = (handler3) => {
  3674. const cachedHandler = (e) => {
  3675. const event = e;
  3676. if (event.key === EVENT_CODE.esc) {
  3677. handler3 == null ? void 0 : handler3(event);
  3678. }
  3679. };
  3680. onMounted(() => {
  3681. on(document, "keydown", cachedHandler);
  3682. });
  3683. onBeforeUnmount(() => {
  3684. off(document, "keydown", cachedHandler);
  3685. });
  3686. };
  3687. let cachedContainer;
  3688. const POPPER_CONTAINER_ID = `el-popper-container-${generateId()}`;
  3689. const POPPER_CONTAINER_SELECTOR = `#${POPPER_CONTAINER_ID}`;
  3690. const createContainer = () => {
  3691. const container = document.createElement("div");
  3692. container.id = POPPER_CONTAINER_ID;
  3693. document.body.appendChild(container);
  3694. return container;
  3695. };
  3696. const usePopperContainer = () => {
  3697. onBeforeMount(() => {
  3698. if (!isClient)
  3699. return;
  3700. if (!cachedContainer || !document.body.querySelector(POPPER_CONTAINER_SELECTOR)) {
  3701. cachedContainer = createContainer();
  3702. }
  3703. });
  3704. };
  3705. const useDelayedToggleProps = buildProps({
  3706. showAfter: {
  3707. type: Number,
  3708. default: 0
  3709. },
  3710. hideAfter: {
  3711. type: Number,
  3712. default: 200
  3713. }
  3714. });
  3715. const useDelayedToggle = ({
  3716. showAfter,
  3717. hideAfter,
  3718. open,
  3719. close: close2
  3720. }) => {
  3721. const { registerTimeout } = useTimeout();
  3722. const onOpen = () => {
  3723. registerTimeout(() => {
  3724. open();
  3725. }, unref(showAfter));
  3726. };
  3727. const onClose = () => {
  3728. registerTimeout(() => {
  3729. close2();
  3730. }, unref(hideAfter));
  3731. };
  3732. return {
  3733. onOpen,
  3734. onClose
  3735. };
  3736. };
  3737. const FORWARD_REF_INJECTION_KEY = Symbol("elForwardRef");
  3738. const useForwardRef = (forwardRef) => {
  3739. const setForwardRef = (el) => {
  3740. forwardRef.value = el;
  3741. };
  3742. provide(FORWARD_REF_INJECTION_KEY, {
  3743. setForwardRef
  3744. });
  3745. };
  3746. const useForwardRefDirective = (setForwardRef) => {
  3747. return {
  3748. mounted(el) {
  3749. setForwardRef(el);
  3750. },
  3751. updated(el) {
  3752. setForwardRef(el);
  3753. },
  3754. unmounted() {
  3755. setForwardRef(null);
  3756. }
  3757. };
  3758. };
  3759. const defaultNamespace = "el";
  3760. const statePrefix = "is-";
  3761. const _bem = (namespace, block, blockSuffix, element, modifier) => {
  3762. let cls = `${namespace}-${block}`;
  3763. if (blockSuffix) {
  3764. cls += `-${blockSuffix}`;
  3765. }
  3766. if (element) {
  3767. cls += `__${element}`;
  3768. }
  3769. if (modifier) {
  3770. cls += `--${modifier}`;
  3771. }
  3772. return cls;
  3773. };
  3774. const useNamespace = (block) => {
  3775. const globalConfig2 = useGlobalConfig("namespace");
  3776. const namespace = computed(() => globalConfig2.value || defaultNamespace);
  3777. const b2 = (blockSuffix = "") => _bem(unref(namespace), block, blockSuffix, "", "");
  3778. const e = (element) => element ? _bem(unref(namespace), block, "", element, "") : "";
  3779. const m2 = (modifier) => modifier ? _bem(unref(namespace), block, "", "", modifier) : "";
  3780. const be = (blockSuffix, element) => blockSuffix && element ? _bem(unref(namespace), block, blockSuffix, element, "") : "";
  3781. const em = (element, modifier) => element && modifier ? _bem(unref(namespace), block, "", element, modifier) : "";
  3782. const bm = (blockSuffix, modifier) => blockSuffix && modifier ? _bem(unref(namespace), block, blockSuffix, "", modifier) : "";
  3783. const bem = (blockSuffix, element, modifier) => blockSuffix && element && modifier ? _bem(unref(namespace), block, blockSuffix, element, modifier) : "";
  3784. const is = (name, ...args) => {
  3785. const state = args.length >= 1 ? args[0] : true;
  3786. return name && state ? `${statePrefix}${name}` : "";
  3787. };
  3788. return {
  3789. namespace,
  3790. b: b2,
  3791. e,
  3792. m: m2,
  3793. be,
  3794. em,
  3795. bm,
  3796. bem,
  3797. is
  3798. };
  3799. };
  3800. const zIndex = ref(0);
  3801. const useZIndex = () => {
  3802. const initialZIndex = useGlobalConfig("zIndex", 2e3);
  3803. const currentZIndex = computed(() => initialZIndex.value + zIndex.value);
  3804. const nextZIndex = () => {
  3805. zIndex.value++;
  3806. return currentZIndex.value;
  3807. };
  3808. return {
  3809. initialZIndex,
  3810. currentZIndex,
  3811. nextZIndex
  3812. };
  3813. };
  3814. var _export_sfc$1 = (sfc, props) => {
  3815. const target = sfc.__vccOpts || sfc;
  3816. for (const [key, val] of props) {
  3817. target[key] = val;
  3818. }
  3819. return target;
  3820. };
  3821. const iconProps = buildProps({
  3822. size: {
  3823. type: definePropType([Number, String])
  3824. },
  3825. color: {
  3826. type: String
  3827. }
  3828. });
  3829. const __default__$l = {
  3830. name: "ElIcon",
  3831. inheritAttrs: false
  3832. };
  3833. const _sfc_main$16 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$l), {
  3834. props: iconProps,
  3835. setup(__props) {
  3836. const props = __props;
  3837. const ns = useNamespace("icon");
  3838. const style = computed(() => {
  3839. if (!props.size && !props.color)
  3840. return {};
  3841. return {
  3842. fontSize: isUndefined(props.size) ? void 0 : addUnit(props.size),
  3843. "--color": props.color
  3844. };
  3845. });
  3846. return (_ctx, _cache) => {
  3847. return openBlock(), createElementBlock("i", mergeProps({
  3848. class: unref(ns).b(),
  3849. style: unref(style)
  3850. }, _ctx.$attrs), [
  3851. renderSlot(_ctx.$slots, "default")
  3852. ], 16);
  3853. };
  3854. }
  3855. }));
  3856. var Icon = /* @__PURE__ */ _export_sfc$1(_sfc_main$16, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/icon/src/icon.vue"]]);
  3857. const ElIcon = withInstall(Icon);
  3858. let hiddenTextarea = void 0;
  3859. const HIDDEN_STYLE = `
  3860. height:0 !important;
  3861. visibility:hidden !important;
  3862. overflow:hidden !important;
  3863. position:absolute !important;
  3864. z-index:-1000 !important;
  3865. top:0 !important;
  3866. right:0 !important;
  3867. `;
  3868. const CONTEXT_STYLE = [
  3869. "letter-spacing",
  3870. "line-height",
  3871. "padding-top",
  3872. "padding-bottom",
  3873. "font-family",
  3874. "font-weight",
  3875. "font-size",
  3876. "text-rendering",
  3877. "text-transform",
  3878. "width",
  3879. "text-indent",
  3880. "padding-left",
  3881. "padding-right",
  3882. "border-width",
  3883. "box-sizing"
  3884. ];
  3885. function calculateNodeStyling(targetElement) {
  3886. const style = window.getComputedStyle(targetElement);
  3887. const boxSizing = style.getPropertyValue("box-sizing");
  3888. const paddingSize = Number.parseFloat(style.getPropertyValue("padding-bottom")) + Number.parseFloat(style.getPropertyValue("padding-top"));
  3889. const borderSize = Number.parseFloat(style.getPropertyValue("border-bottom-width")) + Number.parseFloat(style.getPropertyValue("border-top-width"));
  3890. const contextStyle = CONTEXT_STYLE.map((name) => `${name}:${style.getPropertyValue(name)}`).join(";");
  3891. return { contextStyle, paddingSize, borderSize, boxSizing };
  3892. }
  3893. function calcTextareaHeight(targetElement, minRows = 1, maxRows) {
  3894. var _a2;
  3895. if (!hiddenTextarea) {
  3896. hiddenTextarea = document.createElement("textarea");
  3897. document.body.appendChild(hiddenTextarea);
  3898. }
  3899. const { paddingSize, borderSize, boxSizing, contextStyle } = calculateNodeStyling(targetElement);
  3900. hiddenTextarea.setAttribute("style", `${contextStyle};${HIDDEN_STYLE}`);
  3901. hiddenTextarea.value = targetElement.value || targetElement.placeholder || "";
  3902. let height = hiddenTextarea.scrollHeight;
  3903. const result = {};
  3904. if (boxSizing === "border-box") {
  3905. height = height + borderSize;
  3906. } else if (boxSizing === "content-box") {
  3907. height = height - paddingSize;
  3908. }
  3909. hiddenTextarea.value = "";
  3910. const singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
  3911. if (isNumber(minRows)) {
  3912. let minHeight = singleRowHeight * minRows;
  3913. if (boxSizing === "border-box") {
  3914. minHeight = minHeight + paddingSize + borderSize;
  3915. }
  3916. height = Math.max(minHeight, height);
  3917. result.minHeight = `${minHeight}px`;
  3918. }
  3919. if (isNumber(maxRows)) {
  3920. let maxHeight = singleRowHeight * maxRows;
  3921. if (boxSizing === "border-box") {
  3922. maxHeight = maxHeight + paddingSize + borderSize;
  3923. }
  3924. height = Math.min(maxHeight, height);
  3925. }
  3926. result.height = `${height}px`;
  3927. (_a2 = hiddenTextarea.parentNode) == null ? void 0 : _a2.removeChild(hiddenTextarea);
  3928. hiddenTextarea = void 0;
  3929. return result;
  3930. }
  3931. const inputProps = buildProps({
  3932. size: useSizeProp,
  3933. disabled: Boolean,
  3934. modelValue: {
  3935. type: definePropType([
  3936. String,
  3937. Number,
  3938. Object
  3939. ]),
  3940. default: ""
  3941. },
  3942. type: {
  3943. type: String,
  3944. default: "text"
  3945. },
  3946. resize: {
  3947. type: String,
  3948. values: ["none", "both", "horizontal", "vertical"]
  3949. },
  3950. autosize: {
  3951. type: definePropType([Boolean, Object]),
  3952. default: false
  3953. },
  3954. autocomplete: {
  3955. type: String,
  3956. default: "off"
  3957. },
  3958. placeholder: {
  3959. type: String
  3960. },
  3961. form: {
  3962. type: String,
  3963. default: ""
  3964. },
  3965. readonly: {
  3966. type: Boolean,
  3967. default: false
  3968. },
  3969. clearable: {
  3970. type: Boolean,
  3971. default: false
  3972. },
  3973. showPassword: {
  3974. type: Boolean,
  3975. default: false
  3976. },
  3977. showWordLimit: {
  3978. type: Boolean,
  3979. default: false
  3980. },
  3981. suffixIcon: {
  3982. type: iconPropType,
  3983. default: ""
  3984. },
  3985. prefixIcon: {
  3986. type: iconPropType,
  3987. default: ""
  3988. },
  3989. label: {
  3990. type: String
  3991. },
  3992. tabindex: {
  3993. type: [Number, String]
  3994. },
  3995. validateEvent: {
  3996. type: Boolean,
  3997. default: true
  3998. },
  3999. inputStyle: {
  4000. type: definePropType([Object, Array, String]),
  4001. default: () => mutable({})
  4002. }
  4003. });
  4004. const inputEmits = {
  4005. [UPDATE_MODEL_EVENT]: (value) => isString(value),
  4006. input: (value) => isString(value),
  4007. change: (value) => isString(value),
  4008. focus: (evt) => evt instanceof FocusEvent,
  4009. blur: (evt) => evt instanceof FocusEvent,
  4010. clear: () => true,
  4011. mouseleave: (evt) => evt instanceof MouseEvent,
  4012. mouseenter: (evt) => evt instanceof MouseEvent,
  4013. keydown: (evt) => evt instanceof Event,
  4014. compositionstart: (evt) => evt instanceof CompositionEvent,
  4015. compositionupdate: (evt) => evt instanceof CompositionEvent,
  4016. compositionend: (evt) => evt instanceof CompositionEvent
  4017. };
  4018. const _hoisted_1$D = ["type", "disabled", "readonly", "autocomplete", "tabindex", "aria-label", "placeholder"];
  4019. const _hoisted_2$u = ["tabindex", "disabled", "readonly", "autocomplete", "aria-label", "placeholder"];
  4020. const __default__$k = {
  4021. name: "ElInput",
  4022. inheritAttrs: false
  4023. };
  4024. const _sfc_main$15 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$k), {
  4025. props: inputProps,
  4026. emits: inputEmits,
  4027. setup(__props, { expose, emit }) {
  4028. const props = __props;
  4029. const PENDANT_MAP = {
  4030. suffix: "append",
  4031. prefix: "prepend"
  4032. };
  4033. const instance = getCurrentInstance();
  4034. const rawAttrs = useAttrs$1();
  4035. const slots = useSlots();
  4036. const attrs = useAttrs();
  4037. const { form, formItem } = useFormItem();
  4038. const inputSize = useSize();
  4039. const inputDisabled = useDisabled$1();
  4040. const nsInput = useNamespace("input");
  4041. const nsTextarea = useNamespace("textarea");
  4042. const input = shallowRef();
  4043. const textarea = shallowRef();
  4044. const focused = ref(false);
  4045. const hovering = ref(false);
  4046. const isComposing = ref(false);
  4047. const passwordVisible = ref(false);
  4048. const textareaCalcStyle = shallowRef(props.inputStyle);
  4049. const _ref = computed(() => input.value || textarea.value);
  4050. const needStatusIcon = computed(() => {
  4051. var _a2;
  4052. return (_a2 = form == null ? void 0 : form.statusIcon) != null ? _a2 : false;
  4053. });
  4054. const validateState = computed(() => (formItem == null ? void 0 : formItem.validateState) || "");
  4055. const validateIcon = computed(() => ValidateComponentsMap[validateState.value]);
  4056. const passwordIcon = computed(() => passwordVisible.value ? view : hide$2);
  4057. const containerStyle = computed(() => [
  4058. rawAttrs.style,
  4059. props.inputStyle
  4060. ]);
  4061. const textareaStyle = computed(() => [
  4062. props.inputStyle,
  4063. textareaCalcStyle.value,
  4064. { resize: props.resize }
  4065. ]);
  4066. const nativeInputValue = computed(() => isNil(props.modelValue) ? "" : String(props.modelValue));
  4067. const showClear = computed(() => props.clearable && !inputDisabled.value && !props.readonly && !!nativeInputValue.value && (focused.value || hovering.value));
  4068. const showPwdVisible = computed(() => props.showPassword && !inputDisabled.value && !props.readonly && (!!nativeInputValue.value || focused.value));
  4069. const isWordLimitVisible = computed(() => props.showWordLimit && !!attrs.value.maxlength && (props.type === "text" || props.type === "textarea") && !inputDisabled.value && !props.readonly && !props.showPassword);
  4070. const textLength = computed(() => Array.from(nativeInputValue.value).length);
  4071. const inputExceed = computed(() => !!isWordLimitVisible.value && textLength.value > Number(attrs.value.maxlength));
  4072. const suffixVisible = computed(() => !!slots.suffix || !!props.suffixIcon || showClear.value || props.showPassword || isWordLimitVisible.value || !!validateState.value && needStatusIcon.value);
  4073. const resizeTextarea = () => {
  4074. const { type: type4, autosize } = props;
  4075. if (!isClient || type4 !== "textarea")
  4076. return;
  4077. if (autosize) {
  4078. const minRows = isObject$1(autosize) ? autosize.minRows : void 0;
  4079. const maxRows = isObject$1(autosize) ? autosize.maxRows : void 0;
  4080. textareaCalcStyle.value = __spreadValues({}, calcTextareaHeight(textarea.value, minRows, maxRows));
  4081. } else {
  4082. textareaCalcStyle.value = {
  4083. minHeight: calcTextareaHeight(textarea.value).minHeight
  4084. };
  4085. }
  4086. };
  4087. const setNativeInputValue = () => {
  4088. const input2 = _ref.value;
  4089. if (!input2 || input2.value === nativeInputValue.value)
  4090. return;
  4091. input2.value = nativeInputValue.value;
  4092. };
  4093. const calcIconOffset = (place) => {
  4094. const { el } = instance.vnode;
  4095. if (!el)
  4096. return;
  4097. const elList = Array.from(el.querySelectorAll(`.${nsInput.e(place)}`));
  4098. const target = elList.find((item) => item.parentNode === el);
  4099. if (!target)
  4100. return;
  4101. const pendant = PENDANT_MAP[place];
  4102. if (slots[pendant]) {
  4103. target.style.transform = `translateX(${place === "suffix" ? "-" : ""}${el.querySelector(`.${nsInput.be("group", pendant)}`).offsetWidth}px)`;
  4104. } else {
  4105. target.removeAttribute("style");
  4106. }
  4107. };
  4108. const updateIconOffset = () => {
  4109. calcIconOffset("prefix");
  4110. calcIconOffset("suffix");
  4111. };
  4112. const handleInput = async (event) => {
  4113. const { value } = event.target;
  4114. if (isComposing.value)
  4115. return;
  4116. if (value === nativeInputValue.value)
  4117. return;
  4118. emit(UPDATE_MODEL_EVENT, value);
  4119. emit("input", value);
  4120. await nextTick();
  4121. setNativeInputValue();
  4122. };
  4123. const handleChange2 = (event) => {
  4124. emit("change", event.target.value);
  4125. };
  4126. const handleCompositionStart = (event) => {
  4127. emit("compositionstart", event);
  4128. isComposing.value = true;
  4129. };
  4130. const handleCompositionUpdate = (event) => {
  4131. var _a2;
  4132. emit("compositionupdate", event);
  4133. const text = (_a2 = event.target) == null ? void 0 : _a2.value;
  4134. const lastCharacter = text[text.length - 1] || "";
  4135. isComposing.value = !isKorean(lastCharacter);
  4136. };
  4137. const handleCompositionEnd = (event) => {
  4138. emit("compositionend", event);
  4139. if (isComposing.value) {
  4140. isComposing.value = false;
  4141. handleInput(event);
  4142. }
  4143. };
  4144. const handlePasswordVisible = () => {
  4145. passwordVisible.value = !passwordVisible.value;
  4146. focus();
  4147. };
  4148. const focus = async () => {
  4149. var _a2;
  4150. await nextTick();
  4151. (_a2 = _ref.value) == null ? void 0 : _a2.focus();
  4152. };
  4153. const blur = () => {
  4154. var _a2;
  4155. return (_a2 = _ref.value) == null ? void 0 : _a2.blur();
  4156. };
  4157. const handleFocus = (event) => {
  4158. focused.value = true;
  4159. emit("focus", event);
  4160. };
  4161. const handleBlur = (event) => {
  4162. var _a2;
  4163. focused.value = false;
  4164. emit("blur", event);
  4165. if (props.validateEvent) {
  4166. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "blur").catch((err) => debugWarn());
  4167. }
  4168. };
  4169. const handleMouseLeave = (evt) => {
  4170. hovering.value = false;
  4171. emit("mouseleave", evt);
  4172. };
  4173. const handleMouseEnter = (evt) => {
  4174. hovering.value = true;
  4175. emit("mouseenter", evt);
  4176. };
  4177. const handleKeydown = (evt) => {
  4178. emit("keydown", evt);
  4179. };
  4180. const select = () => {
  4181. var _a2;
  4182. (_a2 = _ref.value) == null ? void 0 : _a2.select();
  4183. };
  4184. const clear = () => {
  4185. emit(UPDATE_MODEL_EVENT, "");
  4186. emit("change", "");
  4187. emit("clear");
  4188. emit("input", "");
  4189. };
  4190. watch(() => props.modelValue, () => {
  4191. var _a2;
  4192. nextTick(() => resizeTextarea());
  4193. if (props.validateEvent) {
  4194. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "change").catch((err) => debugWarn());
  4195. }
  4196. });
  4197. watch(nativeInputValue, () => setNativeInputValue());
  4198. watch(() => props.type, async () => {
  4199. await nextTick();
  4200. setNativeInputValue();
  4201. resizeTextarea();
  4202. updateIconOffset();
  4203. });
  4204. onMounted(async () => {
  4205. setNativeInputValue();
  4206. updateIconOffset();
  4207. await nextTick();
  4208. resizeTextarea();
  4209. });
  4210. onUpdated(async () => {
  4211. await nextTick();
  4212. updateIconOffset();
  4213. });
  4214. expose({
  4215. input,
  4216. textarea,
  4217. ref: _ref,
  4218. textareaStyle,
  4219. autosize: toRef(props, "autosize"),
  4220. focus,
  4221. blur,
  4222. select,
  4223. clear,
  4224. resizeTextarea
  4225. });
  4226. return (_ctx, _cache) => {
  4227. return withDirectives((openBlock(), createElementBlock("div", {
  4228. class: normalizeClass([
  4229. _ctx.type === "textarea" ? unref(nsTextarea).b() : unref(nsInput).b(),
  4230. unref(nsInput).m(unref(inputSize)),
  4231. unref(nsInput).is("disabled", unref(inputDisabled)),
  4232. unref(nsInput).is("exceed", unref(inputExceed)),
  4233. {
  4234. [unref(nsInput).b("group")]: _ctx.$slots.prepend || _ctx.$slots.append,
  4235. [unref(nsInput).bm("group", "append")]: _ctx.$slots.append,
  4236. [unref(nsInput).bm("group", "prepend")]: _ctx.$slots.prepend,
  4237. [unref(nsInput).m("prefix")]: _ctx.$slots.prefix || _ctx.prefixIcon,
  4238. [unref(nsInput).m("suffix")]: _ctx.$slots.suffix || _ctx.suffixIcon || _ctx.clearable || _ctx.showPassword,
  4239. [unref(nsInput).bm("suffix", "password-clear")]: unref(showClear) && unref(showPwdVisible)
  4240. },
  4241. _ctx.$attrs.class
  4242. ]),
  4243. style: normalizeStyle(unref(containerStyle)),
  4244. onMouseenter: handleMouseEnter,
  4245. onMouseleave: handleMouseLeave
  4246. }, [
  4247. createCommentVNode(" input "),
  4248. _ctx.type !== "textarea" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  4249. createCommentVNode(" prepend slot "),
  4250. _ctx.$slots.prepend ? (openBlock(), createElementBlock("div", {
  4251. key: 0,
  4252. class: normalizeClass(unref(nsInput).be("group", "prepend"))
  4253. }, [
  4254. renderSlot(_ctx.$slots, "prepend")
  4255. ], 2)) : createCommentVNode("v-if", true),
  4256. createElementVNode("div", {
  4257. class: normalizeClass([unref(nsInput).e("wrapper"), unref(nsInput).is("focus", focused.value)])
  4258. }, [
  4259. createCommentVNode(" prefix slot "),
  4260. _ctx.$slots.prefix || _ctx.prefixIcon ? (openBlock(), createElementBlock("span", {
  4261. key: 0,
  4262. class: normalizeClass(unref(nsInput).e("prefix"))
  4263. }, [
  4264. createElementVNode("span", {
  4265. class: normalizeClass(unref(nsInput).e("prefix-inner"))
  4266. }, [
  4267. renderSlot(_ctx.$slots, "prefix"),
  4268. _ctx.prefixIcon ? (openBlock(), createBlock(unref(ElIcon), {
  4269. key: 0,
  4270. class: normalizeClass(unref(nsInput).e("icon"))
  4271. }, {
  4272. default: withCtx(() => [
  4273. (openBlock(), createBlock(resolveDynamicComponent(_ctx.prefixIcon)))
  4274. ]),
  4275. _: 1
  4276. }, 8, ["class"])) : createCommentVNode("v-if", true)
  4277. ], 2)
  4278. ], 2)) : createCommentVNode("v-if", true),
  4279. createElementVNode("input", mergeProps({
  4280. ref_key: "input",
  4281. ref: input,
  4282. class: unref(nsInput).e("inner")
  4283. }, unref(attrs), {
  4284. type: _ctx.showPassword ? passwordVisible.value ? "text" : "password" : _ctx.type,
  4285. disabled: unref(inputDisabled),
  4286. readonly: _ctx.readonly,
  4287. autocomplete: _ctx.autocomplete,
  4288. tabindex: _ctx.tabindex,
  4289. "aria-label": _ctx.label,
  4290. placeholder: _ctx.placeholder,
  4291. style: _ctx.inputStyle,
  4292. onCompositionstart: handleCompositionStart,
  4293. onCompositionupdate: handleCompositionUpdate,
  4294. onCompositionend: handleCompositionEnd,
  4295. onInput: handleInput,
  4296. onFocus: handleFocus,
  4297. onBlur: handleBlur,
  4298. onChange: handleChange2,
  4299. onKeydown: handleKeydown
  4300. }), null, 16, _hoisted_1$D),
  4301. createCommentVNode(" suffix slot "),
  4302. unref(suffixVisible) ? (openBlock(), createElementBlock("span", {
  4303. key: 1,
  4304. class: normalizeClass(unref(nsInput).e("suffix"))
  4305. }, [
  4306. createElementVNode("span", {
  4307. class: normalizeClass(unref(nsInput).e("suffix-inner"))
  4308. }, [
  4309. !unref(showClear) || !unref(showPwdVisible) || !unref(isWordLimitVisible) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  4310. renderSlot(_ctx.$slots, "suffix"),
  4311. _ctx.suffixIcon ? (openBlock(), createBlock(unref(ElIcon), {
  4312. key: 0,
  4313. class: normalizeClass(unref(nsInput).e("icon"))
  4314. }, {
  4315. default: withCtx(() => [
  4316. (openBlock(), createBlock(resolveDynamicComponent(_ctx.suffixIcon)))
  4317. ]),
  4318. _: 1
  4319. }, 8, ["class"])) : createCommentVNode("v-if", true)
  4320. ], 64)) : createCommentVNode("v-if", true),
  4321. unref(showClear) ? (openBlock(), createBlock(unref(ElIcon), {
  4322. key: 1,
  4323. class: normalizeClass([unref(nsInput).e("icon"), unref(nsInput).e("clear")]),
  4324. onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {
  4325. }, ["prevent"])),
  4326. onClick: clear
  4327. }, {
  4328. default: withCtx(() => [
  4329. createVNode(unref(circleClose))
  4330. ]),
  4331. _: 1
  4332. }, 8, ["class"])) : createCommentVNode("v-if", true),
  4333. unref(showPwdVisible) ? (openBlock(), createBlock(unref(ElIcon), {
  4334. key: 2,
  4335. class: normalizeClass([unref(nsInput).e("icon"), unref(nsInput).e("password")]),
  4336. onClick: handlePasswordVisible
  4337. }, {
  4338. default: withCtx(() => [
  4339. (openBlock(), createBlock(resolveDynamicComponent(unref(passwordIcon))))
  4340. ]),
  4341. _: 1
  4342. }, 8, ["class"])) : createCommentVNode("v-if", true),
  4343. unref(isWordLimitVisible) ? (openBlock(), createElementBlock("span", {
  4344. key: 3,
  4345. class: normalizeClass(unref(nsInput).e("count"))
  4346. }, [
  4347. createElementVNode("span", {
  4348. class: normalizeClass(unref(nsInput).e("count-inner"))
  4349. }, toDisplayString(unref(textLength)) + " / " + toDisplayString(unref(attrs).maxlength), 3)
  4350. ], 2)) : createCommentVNode("v-if", true)
  4351. ], 2),
  4352. unref(validateState) && unref(validateIcon) && unref(needStatusIcon) ? (openBlock(), createBlock(unref(ElIcon), {
  4353. key: 0,
  4354. class: normalizeClass([
  4355. unref(nsInput).e("icon"),
  4356. unref(nsInput).e("validateIcon"),
  4357. unref(nsInput).is("loading", unref(validateState) === "validating")
  4358. ])
  4359. }, {
  4360. default: withCtx(() => [
  4361. (openBlock(), createBlock(resolveDynamicComponent(unref(validateIcon))))
  4362. ]),
  4363. _: 1
  4364. }, 8, ["class"])) : createCommentVNode("v-if", true)
  4365. ], 2)) : createCommentVNode("v-if", true)
  4366. ], 2),
  4367. createCommentVNode(" append slot "),
  4368. _ctx.$slots.append ? (openBlock(), createElementBlock("div", {
  4369. key: 1,
  4370. class: normalizeClass(unref(nsInput).be("group", "append"))
  4371. }, [
  4372. renderSlot(_ctx.$slots, "append")
  4373. ], 2)) : createCommentVNode("v-if", true)
  4374. ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  4375. createCommentVNode(" textarea "),
  4376. createElementVNode("textarea", mergeProps({
  4377. ref_key: "textarea",
  4378. ref: textarea,
  4379. class: unref(nsTextarea).e("inner")
  4380. }, unref(attrs), {
  4381. tabindex: _ctx.tabindex,
  4382. disabled: unref(inputDisabled),
  4383. readonly: _ctx.readonly,
  4384. autocomplete: _ctx.autocomplete,
  4385. style: unref(textareaStyle),
  4386. "aria-label": _ctx.label,
  4387. placeholder: _ctx.placeholder,
  4388. onCompositionstart: handleCompositionStart,
  4389. onCompositionupdate: handleCompositionUpdate,
  4390. onCompositionend: handleCompositionEnd,
  4391. onInput: handleInput,
  4392. onFocus: handleFocus,
  4393. onBlur: handleBlur,
  4394. onChange: handleChange2,
  4395. onKeydown: handleKeydown
  4396. }), null, 16, _hoisted_2$u),
  4397. unref(isWordLimitVisible) ? (openBlock(), createElementBlock("span", {
  4398. key: 0,
  4399. class: normalizeClass(unref(nsInput).e("count"))
  4400. }, toDisplayString(unref(textLength)) + " / " + toDisplayString(unref(attrs).maxlength), 3)) : createCommentVNode("v-if", true)
  4401. ], 64))
  4402. ], 38)), [
  4403. [vShow, _ctx.type !== "hidden"]
  4404. ]);
  4405. };
  4406. }
  4407. }));
  4408. var Input = /* @__PURE__ */ _export_sfc$1(_sfc_main$15, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/input/src/input.vue"]]);
  4409. const ElInput = withInstall(Input);
  4410. const BAR_MAP = {
  4411. vertical: {
  4412. offset: "offsetHeight",
  4413. scroll: "scrollTop",
  4414. scrollSize: "scrollHeight",
  4415. size: "height",
  4416. key: "vertical",
  4417. axis: "Y",
  4418. client: "clientY",
  4419. direction: "top"
  4420. },
  4421. horizontal: {
  4422. offset: "offsetWidth",
  4423. scroll: "scrollLeft",
  4424. scrollSize: "scrollWidth",
  4425. size: "width",
  4426. key: "horizontal",
  4427. axis: "X",
  4428. client: "clientX",
  4429. direction: "left"
  4430. }
  4431. };
  4432. const renderThumbStyle = ({ move, size, bar }) => ({
  4433. [bar.size]: size,
  4434. transform: `translate${bar.axis}(${move}%)`
  4435. });
  4436. const thumbProps = buildProps({
  4437. vertical: Boolean,
  4438. size: String,
  4439. move: Number,
  4440. ratio: {
  4441. type: Number,
  4442. required: true
  4443. },
  4444. always: Boolean
  4445. });
  4446. const COMPONENT_NAME$4 = "Thumb";
  4447. const _sfc_main$14 = defineComponent({
  4448. name: COMPONENT_NAME$4,
  4449. props: thumbProps,
  4450. setup(props) {
  4451. const scrollbar = inject(scrollbarContextKey);
  4452. const ns = useNamespace("scrollbar");
  4453. if (!scrollbar)
  4454. throwError(COMPONENT_NAME$4, "can not inject scrollbar context");
  4455. const instance = ref();
  4456. const thumb = ref();
  4457. const thumbState = ref({});
  4458. const visible = ref(false);
  4459. let cursorDown = false;
  4460. let cursorLeave = false;
  4461. let originalOnSelectStart = isClient ? document.onselectstart : null;
  4462. const bar = computed(() => BAR_MAP[props.vertical ? "vertical" : "horizontal"]);
  4463. const thumbStyle = computed(() => renderThumbStyle({
  4464. size: props.size,
  4465. move: props.move,
  4466. bar: bar.value
  4467. }));
  4468. const offsetRatio = computed(() => instance.value[bar.value.offset] ** 2 / scrollbar.wrapElement[bar.value.scrollSize] / props.ratio / thumb.value[bar.value.offset]);
  4469. const clickThumbHandler = (e) => {
  4470. var _a2;
  4471. e.stopPropagation();
  4472. if (e.ctrlKey || [1, 2].includes(e.button))
  4473. return;
  4474. (_a2 = window.getSelection()) == null ? void 0 : _a2.removeAllRanges();
  4475. startDrag(e);
  4476. const el = e.currentTarget;
  4477. if (!el)
  4478. return;
  4479. thumbState.value[bar.value.axis] = el[bar.value.offset] - (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction]);
  4480. };
  4481. const clickTrackHandler = (e) => {
  4482. if (!thumb.value || !instance.value || !scrollbar.wrapElement)
  4483. return;
  4484. const offset2 = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]);
  4485. const thumbHalf = thumb.value[bar.value.offset] / 2;
  4486. const thumbPositionPercentage = (offset2 - thumbHalf) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  4487. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  4488. };
  4489. const startDrag = (e) => {
  4490. e.stopImmediatePropagation();
  4491. cursorDown = true;
  4492. document.addEventListener("mousemove", mouseMoveDocumentHandler);
  4493. document.addEventListener("mouseup", mouseUpDocumentHandler);
  4494. originalOnSelectStart = document.onselectstart;
  4495. document.onselectstart = () => false;
  4496. };
  4497. const mouseMoveDocumentHandler = (e) => {
  4498. if (!instance.value || !thumb.value)
  4499. return;
  4500. if (cursorDown === false)
  4501. return;
  4502. const prevPage = thumbState.value[bar.value.axis];
  4503. if (!prevPage)
  4504. return;
  4505. const offset2 = (instance.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
  4506. const thumbClickPosition = thumb.value[bar.value.offset] - prevPage;
  4507. const thumbPositionPercentage = (offset2 - thumbClickPosition) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  4508. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  4509. };
  4510. const mouseUpDocumentHandler = () => {
  4511. cursorDown = false;
  4512. thumbState.value[bar.value.axis] = 0;
  4513. document.removeEventListener("mousemove", mouseMoveDocumentHandler);
  4514. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  4515. restoreOnselectstart();
  4516. if (cursorLeave)
  4517. visible.value = false;
  4518. };
  4519. const mouseMoveScrollbarHandler = () => {
  4520. cursorLeave = false;
  4521. visible.value = !!props.size;
  4522. };
  4523. const mouseLeaveScrollbarHandler = () => {
  4524. cursorLeave = true;
  4525. visible.value = cursorDown;
  4526. };
  4527. onBeforeUnmount(() => {
  4528. restoreOnselectstart();
  4529. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  4530. });
  4531. const restoreOnselectstart = () => {
  4532. if (document.onselectstart !== originalOnSelectStart)
  4533. document.onselectstart = originalOnSelectStart;
  4534. };
  4535. useEventListener(toRef(scrollbar, "scrollbarElement"), "mousemove", mouseMoveScrollbarHandler);
  4536. useEventListener(toRef(scrollbar, "scrollbarElement"), "mouseleave", mouseLeaveScrollbarHandler);
  4537. return {
  4538. ns,
  4539. instance,
  4540. thumb,
  4541. bar,
  4542. thumbStyle,
  4543. visible,
  4544. clickTrackHandler,
  4545. clickThumbHandler
  4546. };
  4547. }
  4548. });
  4549. function _sfc_render$D(_ctx, _cache, $props, $setup, $data, $options) {
  4550. return openBlock(), createBlock(Transition, {
  4551. name: _ctx.ns.b("fade")
  4552. }, {
  4553. default: withCtx(() => [
  4554. withDirectives(createElementVNode("div", {
  4555. ref: "instance",
  4556. class: normalizeClass([_ctx.ns.e("bar"), _ctx.ns.is(_ctx.bar.key)]),
  4557. onMousedown: _cache[1] || (_cache[1] = (...args) => _ctx.clickTrackHandler && _ctx.clickTrackHandler(...args))
  4558. }, [
  4559. createElementVNode("div", {
  4560. ref: "thumb",
  4561. class: normalizeClass(_ctx.ns.e("thumb")),
  4562. style: normalizeStyle(_ctx.thumbStyle),
  4563. onMousedown: _cache[0] || (_cache[0] = (...args) => _ctx.clickThumbHandler && _ctx.clickThumbHandler(...args))
  4564. }, null, 38)
  4565. ], 34), [
  4566. [vShow, _ctx.always || _ctx.visible]
  4567. ])
  4568. ]),
  4569. _: 1
  4570. }, 8, ["name"]);
  4571. }
  4572. var Thumb = /* @__PURE__ */ _export_sfc$1(_sfc_main$14, [["render", _sfc_render$D], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/thumb.vue"]]);
  4573. const barProps = buildProps({
  4574. always: {
  4575. type: Boolean,
  4576. default: true
  4577. },
  4578. width: {
  4579. type: String,
  4580. default: ""
  4581. },
  4582. height: {
  4583. type: String,
  4584. default: ""
  4585. },
  4586. ratioX: {
  4587. type: Number,
  4588. default: 1
  4589. },
  4590. ratioY: {
  4591. type: Number,
  4592. default: 1
  4593. }
  4594. });
  4595. const _sfc_main$13 = defineComponent({
  4596. components: {
  4597. Thumb
  4598. },
  4599. props: barProps,
  4600. setup(props) {
  4601. const moveX = ref(0);
  4602. const moveY = ref(0);
  4603. const GAP = 4;
  4604. const handleScroll = (wrap) => {
  4605. if (wrap) {
  4606. const offsetHeight = wrap.offsetHeight - GAP;
  4607. const offsetWidth = wrap.offsetWidth - GAP;
  4608. moveY.value = wrap.scrollTop * 100 / offsetHeight * props.ratioY;
  4609. moveX.value = wrap.scrollLeft * 100 / offsetWidth * props.ratioX;
  4610. }
  4611. };
  4612. return {
  4613. handleScroll,
  4614. moveX,
  4615. moveY
  4616. };
  4617. }
  4618. });
  4619. function _sfc_render$C(_ctx, _cache, $props, $setup, $data, $options) {
  4620. const _component_thumb = resolveComponent("thumb");
  4621. return openBlock(), createElementBlock(Fragment, null, [
  4622. createVNode(_component_thumb, {
  4623. move: _ctx.moveX,
  4624. ratio: _ctx.ratioX,
  4625. size: _ctx.width,
  4626. always: _ctx.always
  4627. }, null, 8, ["move", "ratio", "size", "always"]),
  4628. createVNode(_component_thumb, {
  4629. move: _ctx.moveY,
  4630. ratio: _ctx.ratioY,
  4631. size: _ctx.height,
  4632. vertical: "",
  4633. always: _ctx.always
  4634. }, null, 8, ["move", "ratio", "size", "always"])
  4635. ], 64);
  4636. }
  4637. var Bar = /* @__PURE__ */ _export_sfc$1(_sfc_main$13, [["render", _sfc_render$C], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/bar.vue"]]);
  4638. const scrollbarProps = buildProps({
  4639. height: {
  4640. type: [String, Number],
  4641. default: ""
  4642. },
  4643. maxHeight: {
  4644. type: [String, Number],
  4645. default: ""
  4646. },
  4647. native: {
  4648. type: Boolean,
  4649. default: false
  4650. },
  4651. wrapStyle: {
  4652. type: definePropType([String, Object, Array]),
  4653. default: ""
  4654. },
  4655. wrapClass: {
  4656. type: [String, Array],
  4657. default: ""
  4658. },
  4659. viewClass: {
  4660. type: [String, Array],
  4661. default: ""
  4662. },
  4663. viewStyle: {
  4664. type: [String, Array, Object],
  4665. default: ""
  4666. },
  4667. noresize: Boolean,
  4668. tag: {
  4669. type: String,
  4670. default: "div"
  4671. },
  4672. always: {
  4673. type: Boolean,
  4674. default: false
  4675. },
  4676. minSize: {
  4677. type: Number,
  4678. default: 20
  4679. }
  4680. });
  4681. const scrollbarEmits = {
  4682. scroll: ({
  4683. scrollTop,
  4684. scrollLeft
  4685. }) => isNumber(scrollTop) && isNumber(scrollLeft)
  4686. };
  4687. const _sfc_main$12 = defineComponent({
  4688. name: "ElScrollbar",
  4689. components: {
  4690. Bar
  4691. },
  4692. props: scrollbarProps,
  4693. emits: scrollbarEmits,
  4694. setup(props, { emit }) {
  4695. const ns = useNamespace("scrollbar");
  4696. let stopResizeObserver = void 0;
  4697. let stopResizeListener = void 0;
  4698. const scrollbar$ = ref();
  4699. const wrap$ = ref();
  4700. const resize$ = ref();
  4701. const sizeWidth = ref("0");
  4702. const sizeHeight = ref("0");
  4703. const barRef = ref();
  4704. const moveX = ref(0);
  4705. const moveY = ref(0);
  4706. const ratioY = ref(1);
  4707. const ratioX = ref(1);
  4708. const GAP = 4;
  4709. const style = computed(() => {
  4710. const style2 = {};
  4711. if (props.height)
  4712. style2.height = addUnit(props.height);
  4713. if (props.maxHeight)
  4714. style2.maxHeight = addUnit(props.maxHeight);
  4715. return [props.wrapStyle, style2];
  4716. });
  4717. const handleScroll = () => {
  4718. var _a2;
  4719. if (wrap$.value) {
  4720. (_a2 = barRef.value) == null ? void 0 : _a2.handleScroll(wrap$.value);
  4721. emit("scroll", {
  4722. scrollTop: wrap$.value.scrollTop,
  4723. scrollLeft: wrap$.value.scrollLeft
  4724. });
  4725. }
  4726. };
  4727. function scrollTo(arg1, arg2) {
  4728. if (isObject$1(arg1)) {
  4729. wrap$.value.scrollTo(arg1);
  4730. } else if (isNumber(arg1) && isNumber(arg2)) {
  4731. wrap$.value.scrollTo(arg1, arg2);
  4732. }
  4733. }
  4734. const setScrollTop = (value) => {
  4735. if (!isNumber(value)) {
  4736. return;
  4737. }
  4738. wrap$.value.scrollTop = value;
  4739. };
  4740. const setScrollLeft = (value) => {
  4741. if (!isNumber(value)) {
  4742. return;
  4743. }
  4744. wrap$.value.scrollLeft = value;
  4745. };
  4746. const update = () => {
  4747. if (!wrap$.value)
  4748. return;
  4749. const offsetHeight = wrap$.value.offsetHeight - GAP;
  4750. const offsetWidth = wrap$.value.offsetWidth - GAP;
  4751. const originalHeight = offsetHeight ** 2 / wrap$.value.scrollHeight;
  4752. const originalWidth = offsetWidth ** 2 / wrap$.value.scrollWidth;
  4753. const height = Math.max(originalHeight, props.minSize);
  4754. const width = Math.max(originalWidth, props.minSize);
  4755. ratioY.value = originalHeight / (offsetHeight - originalHeight) / (height / (offsetHeight - height));
  4756. ratioX.value = originalWidth / (offsetWidth - originalWidth) / (width / (offsetWidth - width));
  4757. sizeHeight.value = height + GAP < offsetHeight ? `${height}px` : "";
  4758. sizeWidth.value = width + GAP < offsetWidth ? `${width}px` : "";
  4759. };
  4760. watch(() => props.noresize, (noresize) => {
  4761. if (noresize) {
  4762. stopResizeObserver == null ? void 0 : stopResizeObserver();
  4763. stopResizeListener == null ? void 0 : stopResizeListener();
  4764. } else {
  4765. ({ stop: stopResizeObserver } = useResizeObserver(resize$, update));
  4766. stopResizeListener = useEventListener("resize", update);
  4767. }
  4768. }, { immediate: true });
  4769. watch(() => [props.maxHeight, props.height], () => {
  4770. if (!props.native)
  4771. nextTick(() => {
  4772. var _a2;
  4773. update();
  4774. if (wrap$.value) {
  4775. (_a2 = barRef.value) == null ? void 0 : _a2.handleScroll(wrap$.value);
  4776. }
  4777. });
  4778. });
  4779. provide(scrollbarContextKey, reactive({
  4780. scrollbarElement: scrollbar$,
  4781. wrapElement: wrap$
  4782. }));
  4783. onMounted(() => {
  4784. if (!props.native)
  4785. nextTick(() => update());
  4786. });
  4787. onUpdated(() => update());
  4788. return {
  4789. ns,
  4790. scrollbar$,
  4791. wrap$,
  4792. resize$,
  4793. barRef,
  4794. moveX,
  4795. moveY,
  4796. ratioX,
  4797. ratioY,
  4798. sizeWidth,
  4799. sizeHeight,
  4800. style,
  4801. update,
  4802. handleScroll,
  4803. scrollTo,
  4804. setScrollTop,
  4805. setScrollLeft
  4806. };
  4807. }
  4808. });
  4809. function _sfc_render$B(_ctx, _cache, $props, $setup, $data, $options) {
  4810. const _component_bar = resolveComponent("bar");
  4811. return openBlock(), createElementBlock("div", {
  4812. ref: "scrollbar$",
  4813. class: normalizeClass(_ctx.ns.b())
  4814. }, [
  4815. createElementVNode("div", {
  4816. ref: "wrap$",
  4817. class: normalizeClass([
  4818. _ctx.wrapClass,
  4819. _ctx.ns.e("wrap"),
  4820. { [_ctx.ns.em("wrap", "hidden-default")]: !_ctx.native }
  4821. ]),
  4822. style: normalizeStyle(_ctx.style),
  4823. onScroll: _cache[0] || (_cache[0] = (...args) => _ctx.handleScroll && _ctx.handleScroll(...args))
  4824. }, [
  4825. (openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
  4826. ref: "resize$",
  4827. class: normalizeClass([_ctx.ns.e("view"), _ctx.viewClass]),
  4828. style: normalizeStyle(_ctx.viewStyle)
  4829. }, {
  4830. default: withCtx(() => [
  4831. renderSlot(_ctx.$slots, "default")
  4832. ]),
  4833. _: 3
  4834. }, 8, ["class", "style"]))
  4835. ], 38),
  4836. !_ctx.native ? (openBlock(), createBlock(_component_bar, {
  4837. key: 0,
  4838. ref: "barRef",
  4839. height: _ctx.sizeHeight,
  4840. width: _ctx.sizeWidth,
  4841. always: _ctx.always,
  4842. "ratio-x": _ctx.ratioX,
  4843. "ratio-y": _ctx.ratioY
  4844. }, null, 8, ["height", "width", "always", "ratio-x", "ratio-y"])) : createCommentVNode("v-if", true)
  4845. ], 2);
  4846. }
  4847. var Scrollbar = /* @__PURE__ */ _export_sfc$1(_sfc_main$12, [["render", _sfc_render$B], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/scrollbar.vue"]]);
  4848. const ElScrollbar = withInstall(Scrollbar);
  4849. const __default__$j = {
  4850. name: "ElPopperRoot",
  4851. inheritAttrs: false
  4852. };
  4853. const _sfc_main$11 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$j), {
  4854. setup(__props, { expose }) {
  4855. const triggerRef2 = ref();
  4856. const popperInstanceRef = ref();
  4857. const contentRef = ref();
  4858. const referenceRef = ref();
  4859. const popperProvides = {
  4860. triggerRef: triggerRef2,
  4861. popperInstanceRef,
  4862. contentRef,
  4863. referenceRef
  4864. };
  4865. expose(popperProvides);
  4866. provide(POPPER_INJECTION_KEY, popperProvides);
  4867. return (_ctx, _cache) => {
  4868. return renderSlot(_ctx.$slots, "default");
  4869. };
  4870. }
  4871. }));
  4872. var Popper = /* @__PURE__ */ _export_sfc$1(_sfc_main$11, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/popper.vue"]]);
  4873. const usePopperArrowProps = buildProps({
  4874. arrowOffset: {
  4875. type: Number,
  4876. default: 5
  4877. }
  4878. });
  4879. const __default__$i = {
  4880. name: "ElPopperArrow",
  4881. inheritAttrs: false
  4882. };
  4883. const _sfc_main$10 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$i), {
  4884. props: usePopperArrowProps,
  4885. setup(__props, { expose }) {
  4886. const props = __props;
  4887. const ns = useNamespace("popper");
  4888. const { arrowOffset, arrowRef } = inject(POPPER_CONTENT_INJECTION_KEY, void 0);
  4889. watch(() => props.arrowOffset, (val) => {
  4890. arrowOffset.value = val;
  4891. });
  4892. onBeforeUnmount(() => {
  4893. arrowRef.value = void 0;
  4894. });
  4895. expose({
  4896. arrowRef
  4897. });
  4898. return (_ctx, _cache) => {
  4899. return openBlock(), createElementBlock("span", {
  4900. ref_key: "arrowRef",
  4901. ref: arrowRef,
  4902. class: normalizeClass(unref(ns).e("arrow")),
  4903. "data-popper-arrow": ""
  4904. }, null, 2);
  4905. };
  4906. }
  4907. }));
  4908. var ElPopperArrow = /* @__PURE__ */ _export_sfc$1(_sfc_main$10, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/arrow.vue"]]);
  4909. const NAME = "ElOnlyChild";
  4910. const OnlyChild = defineComponent({
  4911. name: NAME,
  4912. setup(_2, {
  4913. slots,
  4914. attrs
  4915. }) {
  4916. var _a2;
  4917. const forwardRefInjection = inject(FORWARD_REF_INJECTION_KEY);
  4918. const forwardRefDirective = useForwardRefDirective((_a2 = forwardRefInjection == null ? void 0 : forwardRefInjection.setForwardRef) != null ? _a2 : NOOP);
  4919. return () => {
  4920. var _a22;
  4921. const defaultSlot = (_a22 = slots.default) == null ? void 0 : _a22.call(slots, attrs);
  4922. if (!defaultSlot)
  4923. return null;
  4924. if (defaultSlot.length > 1) {
  4925. return null;
  4926. }
  4927. const firstLegitNode = findFirstLegitChild(defaultSlot);
  4928. if (!firstLegitNode) {
  4929. return null;
  4930. }
  4931. return withDirectives(cloneVNode(firstLegitNode, attrs), [[forwardRefDirective]]);
  4932. };
  4933. }
  4934. });
  4935. function findFirstLegitChild(node) {
  4936. if (!node)
  4937. return null;
  4938. const children = node;
  4939. for (const child of children) {
  4940. if (isObject$1(child)) {
  4941. switch (child.type) {
  4942. case Comment:
  4943. continue;
  4944. case Text:
  4945. return wrapTextContent(child);
  4946. case "svg":
  4947. return wrapTextContent(child);
  4948. case Fragment:
  4949. return findFirstLegitChild(child.children);
  4950. default:
  4951. return child;
  4952. }
  4953. }
  4954. return wrapTextContent(child);
  4955. }
  4956. return null;
  4957. }
  4958. function wrapTextContent(s2) {
  4959. return createVNode("span", {
  4960. "class": "el-only-child__content"
  4961. }, [s2]);
  4962. }
  4963. const usePopperTriggerProps = buildProps({
  4964. virtualRef: {
  4965. type: definePropType(Object)
  4966. },
  4967. virtualTriggering: Boolean,
  4968. onMouseenter: Function,
  4969. onMouseleave: Function,
  4970. onClick: Function,
  4971. onKeydown: Function,
  4972. onFocus: Function,
  4973. onBlur: Function,
  4974. onContextmenu: Function,
  4975. id: String,
  4976. open: Boolean
  4977. });
  4978. const __default__$h = {
  4979. name: "ElPopperTrigger",
  4980. inheritAttrs: false
  4981. };
  4982. const _sfc_main$$ = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$h), {
  4983. props: usePopperTriggerProps,
  4984. setup(__props, { expose }) {
  4985. const props = __props;
  4986. const { triggerRef: triggerRef2 } = inject(POPPER_INJECTION_KEY, void 0);
  4987. useForwardRef(triggerRef2);
  4988. onMounted(() => {
  4989. watch(() => props.virtualRef, (virtualEl) => {
  4990. if (virtualEl) {
  4991. triggerRef2.value = unrefElement(virtualEl);
  4992. }
  4993. }, {
  4994. immediate: true
  4995. });
  4996. watch(() => triggerRef2.value, (el, prevEl) => {
  4997. if (isElement$1(el)) {
  4998. [
  4999. "onMouseenter",
  5000. "onMouseleave",
  5001. "onClick",
  5002. "onKeydown",
  5003. "onFocus",
  5004. "onBlur",
  5005. "onContextmenu"
  5006. ].forEach((eventName) => {
  5007. var _a2;
  5008. const handler3 = props[eventName];
  5009. if (handler3) {
  5010. el.addEventListener(eventName.slice(2).toLowerCase(), handler3);
  5011. (_a2 = prevEl == null ? void 0 : prevEl.removeEventListener) == null ? void 0 : _a2.call(prevEl, eventName.slice(2).toLowerCase(), handler3);
  5012. }
  5013. });
  5014. }
  5015. }, {
  5016. immediate: true
  5017. });
  5018. });
  5019. expose({
  5020. triggerRef: triggerRef2
  5021. });
  5022. return (_ctx, _cache) => {
  5023. return !_ctx.virtualTriggering ? (openBlock(), createBlock(unref(OnlyChild), mergeProps({ key: 0 }, _ctx.$attrs, {
  5024. "aria-describedby": _ctx.open ? _ctx.id : void 0
  5025. }), {
  5026. default: withCtx(() => [
  5027. renderSlot(_ctx.$slots, "default")
  5028. ]),
  5029. _: 3
  5030. }, 16, ["aria-describedby"])) : createCommentVNode("v-if", true);
  5031. };
  5032. }
  5033. }));
  5034. var ElPopperTrigger = /* @__PURE__ */ _export_sfc$1(_sfc_main$$, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/trigger.vue"]]);
  5035. var top = "top";
  5036. var bottom = "bottom";
  5037. var right = "right";
  5038. var left = "left";
  5039. var auto = "auto";
  5040. var basePlacements = [top, bottom, right, left];
  5041. var start = "start";
  5042. var end = "end";
  5043. var clippingParents = "clippingParents";
  5044. var viewport = "viewport";
  5045. var popper = "popper";
  5046. var reference = "reference";
  5047. var variationPlacements = /* @__PURE__ */ basePlacements.reduce(function(acc, placement) {
  5048. return acc.concat([placement + "-" + start, placement + "-" + end]);
  5049. }, []);
  5050. var placements = /* @__PURE__ */ [].concat(basePlacements, [auto]).reduce(function(acc, placement) {
  5051. return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
  5052. }, []);
  5053. var beforeRead = "beforeRead";
  5054. var read = "read";
  5055. var afterRead = "afterRead";
  5056. var beforeMain = "beforeMain";
  5057. var main = "main";
  5058. var afterMain = "afterMain";
  5059. var beforeWrite = "beforeWrite";
  5060. var write = "write";
  5061. var afterWrite = "afterWrite";
  5062. var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
  5063. function getNodeName(element) {
  5064. return element ? (element.nodeName || "").toLowerCase() : null;
  5065. }
  5066. function getWindow(node) {
  5067. if (node == null) {
  5068. return window;
  5069. }
  5070. if (node.toString() !== "[object Window]") {
  5071. var ownerDocument = node.ownerDocument;
  5072. return ownerDocument ? ownerDocument.defaultView || window : window;
  5073. }
  5074. return node;
  5075. }
  5076. function isElement(node) {
  5077. var OwnElement = getWindow(node).Element;
  5078. return node instanceof OwnElement || node instanceof Element;
  5079. }
  5080. function isHTMLElement(node) {
  5081. var OwnElement = getWindow(node).HTMLElement;
  5082. return node instanceof OwnElement || node instanceof HTMLElement;
  5083. }
  5084. function isShadowRoot(node) {
  5085. if (typeof ShadowRoot === "undefined") {
  5086. return false;
  5087. }
  5088. var OwnElement = getWindow(node).ShadowRoot;
  5089. return node instanceof OwnElement || node instanceof ShadowRoot;
  5090. }
  5091. function applyStyles(_ref) {
  5092. var state = _ref.state;
  5093. Object.keys(state.elements).forEach(function(name) {
  5094. var style = state.styles[name] || {};
  5095. var attributes = state.attributes[name] || {};
  5096. var element = state.elements[name];
  5097. if (!isHTMLElement(element) || !getNodeName(element)) {
  5098. return;
  5099. }
  5100. Object.assign(element.style, style);
  5101. Object.keys(attributes).forEach(function(name2) {
  5102. var value = attributes[name2];
  5103. if (value === false) {
  5104. element.removeAttribute(name2);
  5105. } else {
  5106. element.setAttribute(name2, value === true ? "" : value);
  5107. }
  5108. });
  5109. });
  5110. }
  5111. function effect$2(_ref2) {
  5112. var state = _ref2.state;
  5113. var initialStyles = {
  5114. popper: {
  5115. position: state.options.strategy,
  5116. left: "0",
  5117. top: "0",
  5118. margin: "0"
  5119. },
  5120. arrow: {
  5121. position: "absolute"
  5122. },
  5123. reference: {}
  5124. };
  5125. Object.assign(state.elements.popper.style, initialStyles.popper);
  5126. state.styles = initialStyles;
  5127. if (state.elements.arrow) {
  5128. Object.assign(state.elements.arrow.style, initialStyles.arrow);
  5129. }
  5130. return function() {
  5131. Object.keys(state.elements).forEach(function(name) {
  5132. var element = state.elements[name];
  5133. var attributes = state.attributes[name] || {};
  5134. var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]);
  5135. var style = styleProperties.reduce(function(style2, property) {
  5136. style2[property] = "";
  5137. return style2;
  5138. }, {});
  5139. if (!isHTMLElement(element) || !getNodeName(element)) {
  5140. return;
  5141. }
  5142. Object.assign(element.style, style);
  5143. Object.keys(attributes).forEach(function(attribute) {
  5144. element.removeAttribute(attribute);
  5145. });
  5146. });
  5147. };
  5148. }
  5149. var applyStyles$1 = {
  5150. name: "applyStyles",
  5151. enabled: true,
  5152. phase: "write",
  5153. fn: applyStyles,
  5154. effect: effect$2,
  5155. requires: ["computeStyles"]
  5156. };
  5157. function getBasePlacement(placement) {
  5158. return placement.split("-")[0];
  5159. }
  5160. var max = Math.max;
  5161. var min = Math.min;
  5162. var round = Math.round;
  5163. function getUAString() {
  5164. var uaData = navigator.userAgentData;
  5165. if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
  5166. return uaData.brands.map(function(item) {
  5167. return item.brand + "/" + item.version;
  5168. }).join(" ");
  5169. }
  5170. return navigator.userAgent;
  5171. }
  5172. function isLayoutViewport() {
  5173. return !/^((?!chrome|android).)*safari/i.test(getUAString());
  5174. }
  5175. function getBoundingClientRect(element, includeScale, isFixedStrategy) {
  5176. if (includeScale === void 0) {
  5177. includeScale = false;
  5178. }
  5179. if (isFixedStrategy === void 0) {
  5180. isFixedStrategy = false;
  5181. }
  5182. var clientRect = element.getBoundingClientRect();
  5183. var scaleX = 1;
  5184. var scaleY = 1;
  5185. if (includeScale && isHTMLElement(element)) {
  5186. scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
  5187. scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
  5188. }
  5189. var _ref = isElement(element) ? getWindow(element) : window, visualViewport = _ref.visualViewport;
  5190. var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
  5191. var x2 = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
  5192. var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
  5193. var width = clientRect.width / scaleX;
  5194. var height = clientRect.height / scaleY;
  5195. return {
  5196. width,
  5197. height,
  5198. top: y,
  5199. right: x2 + width,
  5200. bottom: y + height,
  5201. left: x2,
  5202. x: x2,
  5203. y
  5204. };
  5205. }
  5206. function getLayoutRect(element) {
  5207. var clientRect = getBoundingClientRect(element);
  5208. var width = element.offsetWidth;
  5209. var height = element.offsetHeight;
  5210. if (Math.abs(clientRect.width - width) <= 1) {
  5211. width = clientRect.width;
  5212. }
  5213. if (Math.abs(clientRect.height - height) <= 1) {
  5214. height = clientRect.height;
  5215. }
  5216. return {
  5217. x: element.offsetLeft,
  5218. y: element.offsetTop,
  5219. width,
  5220. height
  5221. };
  5222. }
  5223. function contains(parent, child) {
  5224. var rootNode = child.getRootNode && child.getRootNode();
  5225. if (parent.contains(child)) {
  5226. return true;
  5227. } else if (rootNode && isShadowRoot(rootNode)) {
  5228. var next = child;
  5229. do {
  5230. if (next && parent.isSameNode(next)) {
  5231. return true;
  5232. }
  5233. next = next.parentNode || next.host;
  5234. } while (next);
  5235. }
  5236. return false;
  5237. }
  5238. function getComputedStyle$1(element) {
  5239. return getWindow(element).getComputedStyle(element);
  5240. }
  5241. function isTableElement(element) {
  5242. return ["table", "td", "th"].indexOf(getNodeName(element)) >= 0;
  5243. }
  5244. function getDocumentElement(element) {
  5245. return ((isElement(element) ? element.ownerDocument : element.document) || window.document).documentElement;
  5246. }
  5247. function getParentNode(element) {
  5248. if (getNodeName(element) === "html") {
  5249. return element;
  5250. }
  5251. return element.assignedSlot || element.parentNode || (isShadowRoot(element) ? element.host : null) || getDocumentElement(element);
  5252. }
  5253. function getTrueOffsetParent(element) {
  5254. if (!isHTMLElement(element) || getComputedStyle$1(element).position === "fixed") {
  5255. return null;
  5256. }
  5257. return element.offsetParent;
  5258. }
  5259. function getContainingBlock(element) {
  5260. var isFirefox2 = /firefox/i.test(getUAString());
  5261. var isIE = /Trident/i.test(getUAString());
  5262. if (isIE && isHTMLElement(element)) {
  5263. var elementCss = getComputedStyle$1(element);
  5264. if (elementCss.position === "fixed") {
  5265. return null;
  5266. }
  5267. }
  5268. var currentNode = getParentNode(element);
  5269. if (isShadowRoot(currentNode)) {
  5270. currentNode = currentNode.host;
  5271. }
  5272. while (isHTMLElement(currentNode) && ["html", "body"].indexOf(getNodeName(currentNode)) < 0) {
  5273. var css = getComputedStyle$1(currentNode);
  5274. if (css.transform !== "none" || css.perspective !== "none" || css.contain === "paint" || ["transform", "perspective"].indexOf(css.willChange) !== -1 || isFirefox2 && css.willChange === "filter" || isFirefox2 && css.filter && css.filter !== "none") {
  5275. return currentNode;
  5276. } else {
  5277. currentNode = currentNode.parentNode;
  5278. }
  5279. }
  5280. return null;
  5281. }
  5282. function getOffsetParent(element) {
  5283. var window2 = getWindow(element);
  5284. var offsetParent = getTrueOffsetParent(element);
  5285. while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === "static") {
  5286. offsetParent = getTrueOffsetParent(offsetParent);
  5287. }
  5288. if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle$1(offsetParent).position === "static")) {
  5289. return window2;
  5290. }
  5291. return offsetParent || getContainingBlock(element) || window2;
  5292. }
  5293. function getMainAxisFromPlacement(placement) {
  5294. return ["top", "bottom"].indexOf(placement) >= 0 ? "x" : "y";
  5295. }
  5296. function within(min$1, value, max$1) {
  5297. return max(min$1, min(value, max$1));
  5298. }
  5299. function withinMaxClamp(min2, value, max2) {
  5300. var v2 = within(min2, value, max2);
  5301. return v2 > max2 ? max2 : v2;
  5302. }
  5303. function getFreshSideObject() {
  5304. return {
  5305. top: 0,
  5306. right: 0,
  5307. bottom: 0,
  5308. left: 0
  5309. };
  5310. }
  5311. function mergePaddingObject(paddingObject) {
  5312. return Object.assign({}, getFreshSideObject(), paddingObject);
  5313. }
  5314. function expandToHashMap(value, keys2) {
  5315. return keys2.reduce(function(hashMap, key) {
  5316. hashMap[key] = value;
  5317. return hashMap;
  5318. }, {});
  5319. }
  5320. var toPaddingObject = function toPaddingObject2(padding, state) {
  5321. padding = typeof padding === "function" ? padding(Object.assign({}, state.rects, {
  5322. placement: state.placement
  5323. })) : padding;
  5324. return mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
  5325. };
  5326. function arrow(_ref) {
  5327. var _state$modifiersData$;
  5328. var state = _ref.state, name = _ref.name, options = _ref.options;
  5329. var arrowElement = state.elements.arrow;
  5330. var popperOffsets2 = state.modifiersData.popperOffsets;
  5331. var basePlacement = getBasePlacement(state.placement);
  5332. var axis = getMainAxisFromPlacement(basePlacement);
  5333. var isVertical = [left, right].indexOf(basePlacement) >= 0;
  5334. var len = isVertical ? "height" : "width";
  5335. if (!arrowElement || !popperOffsets2) {
  5336. return;
  5337. }
  5338. var paddingObject = toPaddingObject(options.padding, state);
  5339. var arrowRect = getLayoutRect(arrowElement);
  5340. var minProp = axis === "y" ? top : left;
  5341. var maxProp = axis === "y" ? bottom : right;
  5342. var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets2[axis] - state.rects.popper[len];
  5343. var startDiff = popperOffsets2[axis] - state.rects.reference[axis];
  5344. var arrowOffsetParent = getOffsetParent(arrowElement);
  5345. var clientSize = arrowOffsetParent ? axis === "y" ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
  5346. var centerToReference = endDiff / 2 - startDiff / 2;
  5347. var min2 = paddingObject[minProp];
  5348. var max2 = clientSize - arrowRect[len] - paddingObject[maxProp];
  5349. var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
  5350. var offset2 = within(min2, center, max2);
  5351. var axisProp = axis;
  5352. state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset2, _state$modifiersData$.centerOffset = offset2 - center, _state$modifiersData$);
  5353. }
  5354. function effect$1(_ref2) {
  5355. var state = _ref2.state, options = _ref2.options;
  5356. var _options$element = options.element, arrowElement = _options$element === void 0 ? "[data-popper-arrow]" : _options$element;
  5357. if (arrowElement == null) {
  5358. return;
  5359. }
  5360. if (typeof arrowElement === "string") {
  5361. arrowElement = state.elements.popper.querySelector(arrowElement);
  5362. if (!arrowElement) {
  5363. return;
  5364. }
  5365. }
  5366. if (!contains(state.elements.popper, arrowElement)) {
  5367. return;
  5368. }
  5369. state.elements.arrow = arrowElement;
  5370. }
  5371. var arrow$1 = {
  5372. name: "arrow",
  5373. enabled: true,
  5374. phase: "main",
  5375. fn: arrow,
  5376. effect: effect$1,
  5377. requires: ["popperOffsets"],
  5378. requiresIfExists: ["preventOverflow"]
  5379. };
  5380. function getVariation(placement) {
  5381. return placement.split("-")[1];
  5382. }
  5383. var unsetSides = {
  5384. top: "auto",
  5385. right: "auto",
  5386. bottom: "auto",
  5387. left: "auto"
  5388. };
  5389. function roundOffsetsByDPR(_ref, win) {
  5390. var x2 = _ref.x, y = _ref.y;
  5391. var dpr = win.devicePixelRatio || 1;
  5392. return {
  5393. x: round(x2 * dpr) / dpr || 0,
  5394. y: round(y * dpr) / dpr || 0
  5395. };
  5396. }
  5397. function mapToStyles(_ref2) {
  5398. var _Object$assign2;
  5399. var popper2 = _ref2.popper, popperRect = _ref2.popperRect, placement = _ref2.placement, variation = _ref2.variation, offsets = _ref2.offsets, position = _ref2.position, gpuAcceleration = _ref2.gpuAcceleration, adaptive = _ref2.adaptive, roundOffsets = _ref2.roundOffsets, isFixed = _ref2.isFixed;
  5400. var _offsets$x = offsets.x, x2 = _offsets$x === void 0 ? 0 : _offsets$x, _offsets$y = offsets.y, y = _offsets$y === void 0 ? 0 : _offsets$y;
  5401. var _ref3 = typeof roundOffsets === "function" ? roundOffsets({
  5402. x: x2,
  5403. y
  5404. }) : {
  5405. x: x2,
  5406. y
  5407. };
  5408. x2 = _ref3.x;
  5409. y = _ref3.y;
  5410. var hasX = offsets.hasOwnProperty("x");
  5411. var hasY = offsets.hasOwnProperty("y");
  5412. var sideX = left;
  5413. var sideY = top;
  5414. var win = window;
  5415. if (adaptive) {
  5416. var offsetParent = getOffsetParent(popper2);
  5417. var heightProp = "clientHeight";
  5418. var widthProp = "clientWidth";
  5419. if (offsetParent === getWindow(popper2)) {
  5420. offsetParent = getDocumentElement(popper2);
  5421. if (getComputedStyle$1(offsetParent).position !== "static" && position === "absolute") {
  5422. heightProp = "scrollHeight";
  5423. widthProp = "scrollWidth";
  5424. }
  5425. }
  5426. offsetParent = offsetParent;
  5427. if (placement === top || (placement === left || placement === right) && variation === end) {
  5428. sideY = bottom;
  5429. var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : offsetParent[heightProp];
  5430. y -= offsetY - popperRect.height;
  5431. y *= gpuAcceleration ? 1 : -1;
  5432. }
  5433. if (placement === left || (placement === top || placement === bottom) && variation === end) {
  5434. sideX = right;
  5435. var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : offsetParent[widthProp];
  5436. x2 -= offsetX - popperRect.width;
  5437. x2 *= gpuAcceleration ? 1 : -1;
  5438. }
  5439. }
  5440. var commonStyles = Object.assign({
  5441. position
  5442. }, adaptive && unsetSides);
  5443. var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
  5444. x: x2,
  5445. y
  5446. }, getWindow(popper2)) : {
  5447. x: x2,
  5448. y
  5449. };
  5450. x2 = _ref4.x;
  5451. y = _ref4.y;
  5452. if (gpuAcceleration) {
  5453. var _Object$assign;
  5454. return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? "0" : "", _Object$assign[sideX] = hasX ? "0" : "", _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x2 + "px, " + y + "px)" : "translate3d(" + x2 + "px, " + y + "px, 0)", _Object$assign));
  5455. }
  5456. return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : "", _Object$assign2[sideX] = hasX ? x2 + "px" : "", _Object$assign2.transform = "", _Object$assign2));
  5457. }
  5458. function computeStyles(_ref5) {
  5459. var state = _ref5.state, options = _ref5.options;
  5460. var _options$gpuAccelerat = options.gpuAcceleration, gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat, _options$adaptive = options.adaptive, adaptive = _options$adaptive === void 0 ? true : _options$adaptive, _options$roundOffsets = options.roundOffsets, roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
  5461. var commonStyles = {
  5462. placement: getBasePlacement(state.placement),
  5463. variation: getVariation(state.placement),
  5464. popper: state.elements.popper,
  5465. popperRect: state.rects.popper,
  5466. gpuAcceleration,
  5467. isFixed: state.options.strategy === "fixed"
  5468. };
  5469. if (state.modifiersData.popperOffsets != null) {
  5470. state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
  5471. offsets: state.modifiersData.popperOffsets,
  5472. position: state.options.strategy,
  5473. adaptive,
  5474. roundOffsets
  5475. })));
  5476. }
  5477. if (state.modifiersData.arrow != null) {
  5478. state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
  5479. offsets: state.modifiersData.arrow,
  5480. position: "absolute",
  5481. adaptive: false,
  5482. roundOffsets
  5483. })));
  5484. }
  5485. state.attributes.popper = Object.assign({}, state.attributes.popper, {
  5486. "data-popper-placement": state.placement
  5487. });
  5488. }
  5489. var computeStyles$1 = {
  5490. name: "computeStyles",
  5491. enabled: true,
  5492. phase: "beforeWrite",
  5493. fn: computeStyles,
  5494. data: {}
  5495. };
  5496. var passive = {
  5497. passive: true
  5498. };
  5499. function effect(_ref) {
  5500. var state = _ref.state, instance = _ref.instance, options = _ref.options;
  5501. var _options$scroll = options.scroll, scroll = _options$scroll === void 0 ? true : _options$scroll, _options$resize = options.resize, resize = _options$resize === void 0 ? true : _options$resize;
  5502. var window2 = getWindow(state.elements.popper);
  5503. var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
  5504. if (scroll) {
  5505. scrollParents.forEach(function(scrollParent) {
  5506. scrollParent.addEventListener("scroll", instance.update, passive);
  5507. });
  5508. }
  5509. if (resize) {
  5510. window2.addEventListener("resize", instance.update, passive);
  5511. }
  5512. return function() {
  5513. if (scroll) {
  5514. scrollParents.forEach(function(scrollParent) {
  5515. scrollParent.removeEventListener("scroll", instance.update, passive);
  5516. });
  5517. }
  5518. if (resize) {
  5519. window2.removeEventListener("resize", instance.update, passive);
  5520. }
  5521. };
  5522. }
  5523. var eventListeners = {
  5524. name: "eventListeners",
  5525. enabled: true,
  5526. phase: "write",
  5527. fn: function fn() {
  5528. },
  5529. effect,
  5530. data: {}
  5531. };
  5532. var hash$1 = {
  5533. left: "right",
  5534. right: "left",
  5535. bottom: "top",
  5536. top: "bottom"
  5537. };
  5538. function getOppositePlacement(placement) {
  5539. return placement.replace(/left|right|bottom|top/g, function(matched) {
  5540. return hash$1[matched];
  5541. });
  5542. }
  5543. var hash = {
  5544. start: "end",
  5545. end: "start"
  5546. };
  5547. function getOppositeVariationPlacement(placement) {
  5548. return placement.replace(/start|end/g, function(matched) {
  5549. return hash[matched];
  5550. });
  5551. }
  5552. function getWindowScroll(node) {
  5553. var win = getWindow(node);
  5554. var scrollLeft = win.pageXOffset;
  5555. var scrollTop = win.pageYOffset;
  5556. return {
  5557. scrollLeft,
  5558. scrollTop
  5559. };
  5560. }
  5561. function getWindowScrollBarX(element) {
  5562. return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
  5563. }
  5564. function getViewportRect(element, strategy) {
  5565. var win = getWindow(element);
  5566. var html = getDocumentElement(element);
  5567. var visualViewport = win.visualViewport;
  5568. var width = html.clientWidth;
  5569. var height = html.clientHeight;
  5570. var x2 = 0;
  5571. var y = 0;
  5572. if (visualViewport) {
  5573. width = visualViewport.width;
  5574. height = visualViewport.height;
  5575. var layoutViewport = isLayoutViewport();
  5576. if (layoutViewport || !layoutViewport && strategy === "fixed") {
  5577. x2 = visualViewport.offsetLeft;
  5578. y = visualViewport.offsetTop;
  5579. }
  5580. }
  5581. return {
  5582. width,
  5583. height,
  5584. x: x2 + getWindowScrollBarX(element),
  5585. y
  5586. };
  5587. }
  5588. function getDocumentRect(element) {
  5589. var _element$ownerDocumen;
  5590. var html = getDocumentElement(element);
  5591. var winScroll = getWindowScroll(element);
  5592. var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
  5593. var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
  5594. var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
  5595. var x2 = -winScroll.scrollLeft + getWindowScrollBarX(element);
  5596. var y = -winScroll.scrollTop;
  5597. if (getComputedStyle$1(body || html).direction === "rtl") {
  5598. x2 += max(html.clientWidth, body ? body.clientWidth : 0) - width;
  5599. }
  5600. return {
  5601. width,
  5602. height,
  5603. x: x2,
  5604. y
  5605. };
  5606. }
  5607. function isScrollParent(element) {
  5608. var _getComputedStyle = getComputedStyle$1(element), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY;
  5609. return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
  5610. }
  5611. function getScrollParent(node) {
  5612. if (["html", "body", "#document"].indexOf(getNodeName(node)) >= 0) {
  5613. return node.ownerDocument.body;
  5614. }
  5615. if (isHTMLElement(node) && isScrollParent(node)) {
  5616. return node;
  5617. }
  5618. return getScrollParent(getParentNode(node));
  5619. }
  5620. function listScrollParents(element, list) {
  5621. var _element$ownerDocumen;
  5622. if (list === void 0) {
  5623. list = [];
  5624. }
  5625. var scrollParent = getScrollParent(element);
  5626. var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
  5627. var win = getWindow(scrollParent);
  5628. var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
  5629. var updatedList = list.concat(target);
  5630. return isBody ? updatedList : updatedList.concat(listScrollParents(getParentNode(target)));
  5631. }
  5632. function rectToClientRect(rect) {
  5633. return Object.assign({}, rect, {
  5634. left: rect.x,
  5635. top: rect.y,
  5636. right: rect.x + rect.width,
  5637. bottom: rect.y + rect.height
  5638. });
  5639. }
  5640. function getInnerBoundingClientRect(element, strategy) {
  5641. var rect = getBoundingClientRect(element, false, strategy === "fixed");
  5642. rect.top = rect.top + element.clientTop;
  5643. rect.left = rect.left + element.clientLeft;
  5644. rect.bottom = rect.top + element.clientHeight;
  5645. rect.right = rect.left + element.clientWidth;
  5646. rect.width = element.clientWidth;
  5647. rect.height = element.clientHeight;
  5648. rect.x = rect.left;
  5649. rect.y = rect.top;
  5650. return rect;
  5651. }
  5652. function getClientRectFromMixedType(element, clippingParent, strategy) {
  5653. return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
  5654. }
  5655. function getClippingParents(element) {
  5656. var clippingParents2 = listScrollParents(getParentNode(element));
  5657. var canEscapeClipping = ["absolute", "fixed"].indexOf(getComputedStyle$1(element).position) >= 0;
  5658. var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
  5659. if (!isElement(clipperElement)) {
  5660. return [];
  5661. }
  5662. return clippingParents2.filter(function(clippingParent) {
  5663. return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== "body";
  5664. });
  5665. }
  5666. function getClippingRect(element, boundary, rootBoundary, strategy) {
  5667. var mainClippingParents = boundary === "clippingParents" ? getClippingParents(element) : [].concat(boundary);
  5668. var clippingParents2 = [].concat(mainClippingParents, [rootBoundary]);
  5669. var firstClippingParent = clippingParents2[0];
  5670. var clippingRect = clippingParents2.reduce(function(accRect, clippingParent) {
  5671. var rect = getClientRectFromMixedType(element, clippingParent, strategy);
  5672. accRect.top = max(rect.top, accRect.top);
  5673. accRect.right = min(rect.right, accRect.right);
  5674. accRect.bottom = min(rect.bottom, accRect.bottom);
  5675. accRect.left = max(rect.left, accRect.left);
  5676. return accRect;
  5677. }, getClientRectFromMixedType(element, firstClippingParent, strategy));
  5678. clippingRect.width = clippingRect.right - clippingRect.left;
  5679. clippingRect.height = clippingRect.bottom - clippingRect.top;
  5680. clippingRect.x = clippingRect.left;
  5681. clippingRect.y = clippingRect.top;
  5682. return clippingRect;
  5683. }
  5684. function computeOffsets(_ref) {
  5685. var reference2 = _ref.reference, element = _ref.element, placement = _ref.placement;
  5686. var basePlacement = placement ? getBasePlacement(placement) : null;
  5687. var variation = placement ? getVariation(placement) : null;
  5688. var commonX = reference2.x + reference2.width / 2 - element.width / 2;
  5689. var commonY = reference2.y + reference2.height / 2 - element.height / 2;
  5690. var offsets;
  5691. switch (basePlacement) {
  5692. case top:
  5693. offsets = {
  5694. x: commonX,
  5695. y: reference2.y - element.height
  5696. };
  5697. break;
  5698. case bottom:
  5699. offsets = {
  5700. x: commonX,
  5701. y: reference2.y + reference2.height
  5702. };
  5703. break;
  5704. case right:
  5705. offsets = {
  5706. x: reference2.x + reference2.width,
  5707. y: commonY
  5708. };
  5709. break;
  5710. case left:
  5711. offsets = {
  5712. x: reference2.x - element.width,
  5713. y: commonY
  5714. };
  5715. break;
  5716. default:
  5717. offsets = {
  5718. x: reference2.x,
  5719. y: reference2.y
  5720. };
  5721. }
  5722. var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
  5723. if (mainAxis != null) {
  5724. var len = mainAxis === "y" ? "height" : "width";
  5725. switch (variation) {
  5726. case start:
  5727. offsets[mainAxis] = offsets[mainAxis] - (reference2[len] / 2 - element[len] / 2);
  5728. break;
  5729. case end:
  5730. offsets[mainAxis] = offsets[mainAxis] + (reference2[len] / 2 - element[len] / 2);
  5731. break;
  5732. }
  5733. }
  5734. return offsets;
  5735. }
  5736. function detectOverflow(state, options) {
  5737. if (options === void 0) {
  5738. options = {};
  5739. }
  5740. var _options = options, _options$placement = _options.placement, placement = _options$placement === void 0 ? state.placement : _options$placement, _options$strategy = _options.strategy, strategy = _options$strategy === void 0 ? state.strategy : _options$strategy, _options$boundary = _options.boundary, boundary = _options$boundary === void 0 ? clippingParents : _options$boundary, _options$rootBoundary = _options.rootBoundary, rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary, _options$elementConte = _options.elementContext, elementContext = _options$elementConte === void 0 ? popper : _options$elementConte, _options$altBoundary = _options.altBoundary, altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary, _options$padding = _options.padding, padding = _options$padding === void 0 ? 0 : _options$padding;
  5741. var paddingObject = mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
  5742. var altContext = elementContext === popper ? reference : popper;
  5743. var popperRect = state.rects.popper;
  5744. var element = state.elements[altBoundary ? altContext : elementContext];
  5745. var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);
  5746. var referenceClientRect = getBoundingClientRect(state.elements.reference);
  5747. var popperOffsets2 = computeOffsets({
  5748. reference: referenceClientRect,
  5749. element: popperRect,
  5750. strategy: "absolute",
  5751. placement
  5752. });
  5753. var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets2));
  5754. var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect;
  5755. var overflowOffsets = {
  5756. top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
  5757. bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
  5758. left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
  5759. right: elementClientRect.right - clippingClientRect.right + paddingObject.right
  5760. };
  5761. var offsetData = state.modifiersData.offset;
  5762. if (elementContext === popper && offsetData) {
  5763. var offset2 = offsetData[placement];
  5764. Object.keys(overflowOffsets).forEach(function(key) {
  5765. var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
  5766. var axis = [top, bottom].indexOf(key) >= 0 ? "y" : "x";
  5767. overflowOffsets[key] += offset2[axis] * multiply;
  5768. });
  5769. }
  5770. return overflowOffsets;
  5771. }
  5772. function computeAutoPlacement(state, options) {
  5773. if (options === void 0) {
  5774. options = {};
  5775. }
  5776. var _options = options, placement = _options.placement, boundary = _options.boundary, rootBoundary = _options.rootBoundary, padding = _options.padding, flipVariations = _options.flipVariations, _options$allowedAutoP = _options.allowedAutoPlacements, allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
  5777. var variation = getVariation(placement);
  5778. var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function(placement2) {
  5779. return getVariation(placement2) === variation;
  5780. }) : basePlacements;
  5781. var allowedPlacements = placements$1.filter(function(placement2) {
  5782. return allowedAutoPlacements.indexOf(placement2) >= 0;
  5783. });
  5784. if (allowedPlacements.length === 0) {
  5785. allowedPlacements = placements$1;
  5786. }
  5787. var overflows = allowedPlacements.reduce(function(acc, placement2) {
  5788. acc[placement2] = detectOverflow(state, {
  5789. placement: placement2,
  5790. boundary,
  5791. rootBoundary,
  5792. padding
  5793. })[getBasePlacement(placement2)];
  5794. return acc;
  5795. }, {});
  5796. return Object.keys(overflows).sort(function(a2, b2) {
  5797. return overflows[a2] - overflows[b2];
  5798. });
  5799. }
  5800. function getExpandedFallbackPlacements(placement) {
  5801. if (getBasePlacement(placement) === auto) {
  5802. return [];
  5803. }
  5804. var oppositePlacement = getOppositePlacement(placement);
  5805. return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
  5806. }
  5807. function flip(_ref) {
  5808. var state = _ref.state, options = _ref.options, name = _ref.name;
  5809. if (state.modifiersData[name]._skip) {
  5810. return;
  5811. }
  5812. var _options$mainAxis = options.mainAxis, checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, _options$altAxis = options.altAxis, checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis, specifiedFallbackPlacements = options.fallbackPlacements, padding = options.padding, boundary = options.boundary, rootBoundary = options.rootBoundary, altBoundary = options.altBoundary, _options$flipVariatio = options.flipVariations, flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio, allowedAutoPlacements = options.allowedAutoPlacements;
  5813. var preferredPlacement = state.options.placement;
  5814. var basePlacement = getBasePlacement(preferredPlacement);
  5815. var isBasePlacement = basePlacement === preferredPlacement;
  5816. var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
  5817. var placements2 = [preferredPlacement].concat(fallbackPlacements).reduce(function(acc, placement2) {
  5818. return acc.concat(getBasePlacement(placement2) === auto ? computeAutoPlacement(state, {
  5819. placement: placement2,
  5820. boundary,
  5821. rootBoundary,
  5822. padding,
  5823. flipVariations,
  5824. allowedAutoPlacements
  5825. }) : placement2);
  5826. }, []);
  5827. var referenceRect = state.rects.reference;
  5828. var popperRect = state.rects.popper;
  5829. var checksMap = /* @__PURE__ */ new Map();
  5830. var makeFallbackChecks = true;
  5831. var firstFittingPlacement = placements2[0];
  5832. for (var i = 0; i < placements2.length; i++) {
  5833. var placement = placements2[i];
  5834. var _basePlacement = getBasePlacement(placement);
  5835. var isStartVariation = getVariation(placement) === start;
  5836. var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
  5837. var len = isVertical ? "width" : "height";
  5838. var overflow = detectOverflow(state, {
  5839. placement,
  5840. boundary,
  5841. rootBoundary,
  5842. altBoundary,
  5843. padding
  5844. });
  5845. var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
  5846. if (referenceRect[len] > popperRect[len]) {
  5847. mainVariationSide = getOppositePlacement(mainVariationSide);
  5848. }
  5849. var altVariationSide = getOppositePlacement(mainVariationSide);
  5850. var checks = [];
  5851. if (checkMainAxis) {
  5852. checks.push(overflow[_basePlacement] <= 0);
  5853. }
  5854. if (checkAltAxis) {
  5855. checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
  5856. }
  5857. if (checks.every(function(check2) {
  5858. return check2;
  5859. })) {
  5860. firstFittingPlacement = placement;
  5861. makeFallbackChecks = false;
  5862. break;
  5863. }
  5864. checksMap.set(placement, checks);
  5865. }
  5866. if (makeFallbackChecks) {
  5867. var numberOfChecks = flipVariations ? 3 : 1;
  5868. var _loop = function _loop2(_i2) {
  5869. var fittingPlacement = placements2.find(function(placement2) {
  5870. var checks2 = checksMap.get(placement2);
  5871. if (checks2) {
  5872. return checks2.slice(0, _i2).every(function(check2) {
  5873. return check2;
  5874. });
  5875. }
  5876. });
  5877. if (fittingPlacement) {
  5878. firstFittingPlacement = fittingPlacement;
  5879. return "break";
  5880. }
  5881. };
  5882. for (var _i = numberOfChecks; _i > 0; _i--) {
  5883. var _ret = _loop(_i);
  5884. if (_ret === "break")
  5885. break;
  5886. }
  5887. }
  5888. if (state.placement !== firstFittingPlacement) {
  5889. state.modifiersData[name]._skip = true;
  5890. state.placement = firstFittingPlacement;
  5891. state.reset = true;
  5892. }
  5893. }
  5894. var flip$1 = {
  5895. name: "flip",
  5896. enabled: true,
  5897. phase: "main",
  5898. fn: flip,
  5899. requiresIfExists: ["offset"],
  5900. data: {
  5901. _skip: false
  5902. }
  5903. };
  5904. function getSideOffsets(overflow, rect, preventedOffsets) {
  5905. if (preventedOffsets === void 0) {
  5906. preventedOffsets = {
  5907. x: 0,
  5908. y: 0
  5909. };
  5910. }
  5911. return {
  5912. top: overflow.top - rect.height - preventedOffsets.y,
  5913. right: overflow.right - rect.width + preventedOffsets.x,
  5914. bottom: overflow.bottom - rect.height + preventedOffsets.y,
  5915. left: overflow.left - rect.width - preventedOffsets.x
  5916. };
  5917. }
  5918. function isAnySideFullyClipped(overflow) {
  5919. return [top, right, bottom, left].some(function(side) {
  5920. return overflow[side] >= 0;
  5921. });
  5922. }
  5923. function hide(_ref) {
  5924. var state = _ref.state, name = _ref.name;
  5925. var referenceRect = state.rects.reference;
  5926. var popperRect = state.rects.popper;
  5927. var preventedOffsets = state.modifiersData.preventOverflow;
  5928. var referenceOverflow = detectOverflow(state, {
  5929. elementContext: "reference"
  5930. });
  5931. var popperAltOverflow = detectOverflow(state, {
  5932. altBoundary: true
  5933. });
  5934. var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
  5935. var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
  5936. var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
  5937. var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
  5938. state.modifiersData[name] = {
  5939. referenceClippingOffsets,
  5940. popperEscapeOffsets,
  5941. isReferenceHidden,
  5942. hasPopperEscaped
  5943. };
  5944. state.attributes.popper = Object.assign({}, state.attributes.popper, {
  5945. "data-popper-reference-hidden": isReferenceHidden,
  5946. "data-popper-escaped": hasPopperEscaped
  5947. });
  5948. }
  5949. var hide$1 = {
  5950. name: "hide",
  5951. enabled: true,
  5952. phase: "main",
  5953. requiresIfExists: ["preventOverflow"],
  5954. fn: hide
  5955. };
  5956. function distanceAndSkiddingToXY(placement, rects, offset2) {
  5957. var basePlacement = getBasePlacement(placement);
  5958. var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
  5959. var _ref = typeof offset2 === "function" ? offset2(Object.assign({}, rects, {
  5960. placement
  5961. })) : offset2, skidding = _ref[0], distance = _ref[1];
  5962. skidding = skidding || 0;
  5963. distance = (distance || 0) * invertDistance;
  5964. return [left, right].indexOf(basePlacement) >= 0 ? {
  5965. x: distance,
  5966. y: skidding
  5967. } : {
  5968. x: skidding,
  5969. y: distance
  5970. };
  5971. }
  5972. function offset(_ref2) {
  5973. var state = _ref2.state, options = _ref2.options, name = _ref2.name;
  5974. var _options$offset = options.offset, offset2 = _options$offset === void 0 ? [0, 0] : _options$offset;
  5975. var data2 = placements.reduce(function(acc, placement) {
  5976. acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset2);
  5977. return acc;
  5978. }, {});
  5979. var _data$state$placement = data2[state.placement], x2 = _data$state$placement.x, y = _data$state$placement.y;
  5980. if (state.modifiersData.popperOffsets != null) {
  5981. state.modifiersData.popperOffsets.x += x2;
  5982. state.modifiersData.popperOffsets.y += y;
  5983. }
  5984. state.modifiersData[name] = data2;
  5985. }
  5986. var offset$1 = {
  5987. name: "offset",
  5988. enabled: true,
  5989. phase: "main",
  5990. requires: ["popperOffsets"],
  5991. fn: offset
  5992. };
  5993. function popperOffsets(_ref) {
  5994. var state = _ref.state, name = _ref.name;
  5995. state.modifiersData[name] = computeOffsets({
  5996. reference: state.rects.reference,
  5997. element: state.rects.popper,
  5998. strategy: "absolute",
  5999. placement: state.placement
  6000. });
  6001. }
  6002. var popperOffsets$1 = {
  6003. name: "popperOffsets",
  6004. enabled: true,
  6005. phase: "read",
  6006. fn: popperOffsets,
  6007. data: {}
  6008. };
  6009. function getAltAxis(axis) {
  6010. return axis === "x" ? "y" : "x";
  6011. }
  6012. function preventOverflow(_ref) {
  6013. var state = _ref.state, options = _ref.options, name = _ref.name;
  6014. var _options$mainAxis = options.mainAxis, checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, _options$altAxis = options.altAxis, checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis, boundary = options.boundary, rootBoundary = options.rootBoundary, altBoundary = options.altBoundary, padding = options.padding, _options$tether = options.tether, tether = _options$tether === void 0 ? true : _options$tether, _options$tetherOffset = options.tetherOffset, tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
  6015. var overflow = detectOverflow(state, {
  6016. boundary,
  6017. rootBoundary,
  6018. padding,
  6019. altBoundary
  6020. });
  6021. var basePlacement = getBasePlacement(state.placement);
  6022. var variation = getVariation(state.placement);
  6023. var isBasePlacement = !variation;
  6024. var mainAxis = getMainAxisFromPlacement(basePlacement);
  6025. var altAxis = getAltAxis(mainAxis);
  6026. var popperOffsets2 = state.modifiersData.popperOffsets;
  6027. var referenceRect = state.rects.reference;
  6028. var popperRect = state.rects.popper;
  6029. var tetherOffsetValue = typeof tetherOffset === "function" ? tetherOffset(Object.assign({}, state.rects, {
  6030. placement: state.placement
  6031. })) : tetherOffset;
  6032. var normalizedTetherOffsetValue = typeof tetherOffsetValue === "number" ? {
  6033. mainAxis: tetherOffsetValue,
  6034. altAxis: tetherOffsetValue
  6035. } : Object.assign({
  6036. mainAxis: 0,
  6037. altAxis: 0
  6038. }, tetherOffsetValue);
  6039. var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
  6040. var data2 = {
  6041. x: 0,
  6042. y: 0
  6043. };
  6044. if (!popperOffsets2) {
  6045. return;
  6046. }
  6047. if (checkMainAxis) {
  6048. var _offsetModifierState$;
  6049. var mainSide = mainAxis === "y" ? top : left;
  6050. var altSide = mainAxis === "y" ? bottom : right;
  6051. var len = mainAxis === "y" ? "height" : "width";
  6052. var offset2 = popperOffsets2[mainAxis];
  6053. var min$1 = offset2 + overflow[mainSide];
  6054. var max$1 = offset2 - overflow[altSide];
  6055. var additive = tether ? -popperRect[len] / 2 : 0;
  6056. var minLen = variation === start ? referenceRect[len] : popperRect[len];
  6057. var maxLen = variation === start ? -popperRect[len] : -referenceRect[len];
  6058. var arrowElement = state.elements.arrow;
  6059. var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
  6060. width: 0,
  6061. height: 0
  6062. };
  6063. var arrowPaddingObject = state.modifiersData["arrow#persistent"] ? state.modifiersData["arrow#persistent"].padding : getFreshSideObject();
  6064. var arrowPaddingMin = arrowPaddingObject[mainSide];
  6065. var arrowPaddingMax = arrowPaddingObject[altSide];
  6066. var arrowLen = within(0, referenceRect[len], arrowRect[len]);
  6067. var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
  6068. var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
  6069. var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
  6070. var clientOffset = arrowOffsetParent ? mainAxis === "y" ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
  6071. var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
  6072. var tetherMin = offset2 + minOffset - offsetModifierValue - clientOffset;
  6073. var tetherMax = offset2 + maxOffset - offsetModifierValue;
  6074. var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset2, tether ? max(max$1, tetherMax) : max$1);
  6075. popperOffsets2[mainAxis] = preventedOffset;
  6076. data2[mainAxis] = preventedOffset - offset2;
  6077. }
  6078. if (checkAltAxis) {
  6079. var _offsetModifierState$2;
  6080. var _mainSide = mainAxis === "x" ? top : left;
  6081. var _altSide = mainAxis === "x" ? bottom : right;
  6082. var _offset = popperOffsets2[altAxis];
  6083. var _len = altAxis === "y" ? "height" : "width";
  6084. var _min = _offset + overflow[_mainSide];
  6085. var _max = _offset - overflow[_altSide];
  6086. var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
  6087. var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
  6088. var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
  6089. var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
  6090. var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
  6091. popperOffsets2[altAxis] = _preventedOffset;
  6092. data2[altAxis] = _preventedOffset - _offset;
  6093. }
  6094. state.modifiersData[name] = data2;
  6095. }
  6096. var preventOverflow$1 = {
  6097. name: "preventOverflow",
  6098. enabled: true,
  6099. phase: "main",
  6100. fn: preventOverflow,
  6101. requiresIfExists: ["offset"]
  6102. };
  6103. function getHTMLElementScroll(element) {
  6104. return {
  6105. scrollLeft: element.scrollLeft,
  6106. scrollTop: element.scrollTop
  6107. };
  6108. }
  6109. function getNodeScroll(node) {
  6110. if (node === getWindow(node) || !isHTMLElement(node)) {
  6111. return getWindowScroll(node);
  6112. } else {
  6113. return getHTMLElementScroll(node);
  6114. }
  6115. }
  6116. function isElementScaled(element) {
  6117. var rect = element.getBoundingClientRect();
  6118. var scaleX = round(rect.width) / element.offsetWidth || 1;
  6119. var scaleY = round(rect.height) / element.offsetHeight || 1;
  6120. return scaleX !== 1 || scaleY !== 1;
  6121. }
  6122. function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
  6123. if (isFixed === void 0) {
  6124. isFixed = false;
  6125. }
  6126. var isOffsetParentAnElement = isHTMLElement(offsetParent);
  6127. var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
  6128. var documentElement = getDocumentElement(offsetParent);
  6129. var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
  6130. var scroll = {
  6131. scrollLeft: 0,
  6132. scrollTop: 0
  6133. };
  6134. var offsets = {
  6135. x: 0,
  6136. y: 0
  6137. };
  6138. if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
  6139. if (getNodeName(offsetParent) !== "body" || isScrollParent(documentElement)) {
  6140. scroll = getNodeScroll(offsetParent);
  6141. }
  6142. if (isHTMLElement(offsetParent)) {
  6143. offsets = getBoundingClientRect(offsetParent, true);
  6144. offsets.x += offsetParent.clientLeft;
  6145. offsets.y += offsetParent.clientTop;
  6146. } else if (documentElement) {
  6147. offsets.x = getWindowScrollBarX(documentElement);
  6148. }
  6149. }
  6150. return {
  6151. x: rect.left + scroll.scrollLeft - offsets.x,
  6152. y: rect.top + scroll.scrollTop - offsets.y,
  6153. width: rect.width,
  6154. height: rect.height
  6155. };
  6156. }
  6157. function order(modifiers) {
  6158. var map = /* @__PURE__ */ new Map();
  6159. var visited = /* @__PURE__ */ new Set();
  6160. var result = [];
  6161. modifiers.forEach(function(modifier) {
  6162. map.set(modifier.name, modifier);
  6163. });
  6164. function sort(modifier) {
  6165. visited.add(modifier.name);
  6166. var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
  6167. requires.forEach(function(dep) {
  6168. if (!visited.has(dep)) {
  6169. var depModifier = map.get(dep);
  6170. if (depModifier) {
  6171. sort(depModifier);
  6172. }
  6173. }
  6174. });
  6175. result.push(modifier);
  6176. }
  6177. modifiers.forEach(function(modifier) {
  6178. if (!visited.has(modifier.name)) {
  6179. sort(modifier);
  6180. }
  6181. });
  6182. return result;
  6183. }
  6184. function orderModifiers(modifiers) {
  6185. var orderedModifiers = order(modifiers);
  6186. return modifierPhases.reduce(function(acc, phase) {
  6187. return acc.concat(orderedModifiers.filter(function(modifier) {
  6188. return modifier.phase === phase;
  6189. }));
  6190. }, []);
  6191. }
  6192. function debounce(fn2) {
  6193. var pending;
  6194. return function() {
  6195. if (!pending) {
  6196. pending = new Promise(function(resolve) {
  6197. Promise.resolve().then(function() {
  6198. pending = void 0;
  6199. resolve(fn2());
  6200. });
  6201. });
  6202. }
  6203. return pending;
  6204. };
  6205. }
  6206. function mergeByName(modifiers) {
  6207. var merged = modifiers.reduce(function(merged2, current) {
  6208. var existing = merged2[current.name];
  6209. merged2[current.name] = existing ? Object.assign({}, existing, current, {
  6210. options: Object.assign({}, existing.options, current.options),
  6211. data: Object.assign({}, existing.data, current.data)
  6212. }) : current;
  6213. return merged2;
  6214. }, {});
  6215. return Object.keys(merged).map(function(key) {
  6216. return merged[key];
  6217. });
  6218. }
  6219. var DEFAULT_OPTIONS = {
  6220. placement: "bottom",
  6221. modifiers: [],
  6222. strategy: "absolute"
  6223. };
  6224. function areValidElements() {
  6225. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  6226. args[_key] = arguments[_key];
  6227. }
  6228. return !args.some(function(element) {
  6229. return !(element && typeof element.getBoundingClientRect === "function");
  6230. });
  6231. }
  6232. function popperGenerator(generatorOptions) {
  6233. if (generatorOptions === void 0) {
  6234. generatorOptions = {};
  6235. }
  6236. var _generatorOptions = generatorOptions, _generatorOptions$def = _generatorOptions.defaultModifiers, defaultModifiers2 = _generatorOptions$def === void 0 ? [] : _generatorOptions$def, _generatorOptions$def2 = _generatorOptions.defaultOptions, defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
  6237. return function createPopper2(reference2, popper2, options) {
  6238. if (options === void 0) {
  6239. options = defaultOptions;
  6240. }
  6241. var state = {
  6242. placement: "bottom",
  6243. orderedModifiers: [],
  6244. options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
  6245. modifiersData: {},
  6246. elements: {
  6247. reference: reference2,
  6248. popper: popper2
  6249. },
  6250. attributes: {},
  6251. styles: {}
  6252. };
  6253. var effectCleanupFns = [];
  6254. var isDestroyed = false;
  6255. var instance = {
  6256. state,
  6257. setOptions: function setOptions(setOptionsAction) {
  6258. var options2 = typeof setOptionsAction === "function" ? setOptionsAction(state.options) : setOptionsAction;
  6259. cleanupModifierEffects();
  6260. state.options = Object.assign({}, defaultOptions, state.options, options2);
  6261. state.scrollParents = {
  6262. reference: isElement(reference2) ? listScrollParents(reference2) : reference2.contextElement ? listScrollParents(reference2.contextElement) : [],
  6263. popper: listScrollParents(popper2)
  6264. };
  6265. var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers2, state.options.modifiers)));
  6266. state.orderedModifiers = orderedModifiers.filter(function(m2) {
  6267. return m2.enabled;
  6268. });
  6269. runModifierEffects();
  6270. return instance.update();
  6271. },
  6272. forceUpdate: function forceUpdate() {
  6273. if (isDestroyed) {
  6274. return;
  6275. }
  6276. var _state$elements = state.elements, reference3 = _state$elements.reference, popper3 = _state$elements.popper;
  6277. if (!areValidElements(reference3, popper3)) {
  6278. return;
  6279. }
  6280. state.rects = {
  6281. reference: getCompositeRect(reference3, getOffsetParent(popper3), state.options.strategy === "fixed"),
  6282. popper: getLayoutRect(popper3)
  6283. };
  6284. state.reset = false;
  6285. state.placement = state.options.placement;
  6286. state.orderedModifiers.forEach(function(modifier) {
  6287. return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
  6288. });
  6289. for (var index = 0; index < state.orderedModifiers.length; index++) {
  6290. if (state.reset === true) {
  6291. state.reset = false;
  6292. index = -1;
  6293. continue;
  6294. }
  6295. var _state$orderedModifie = state.orderedModifiers[index], fn2 = _state$orderedModifie.fn, _state$orderedModifie2 = _state$orderedModifie.options, _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2, name = _state$orderedModifie.name;
  6296. if (typeof fn2 === "function") {
  6297. state = fn2({
  6298. state,
  6299. options: _options,
  6300. name,
  6301. instance
  6302. }) || state;
  6303. }
  6304. }
  6305. },
  6306. update: debounce(function() {
  6307. return new Promise(function(resolve) {
  6308. instance.forceUpdate();
  6309. resolve(state);
  6310. });
  6311. }),
  6312. destroy: function destroy() {
  6313. cleanupModifierEffects();
  6314. isDestroyed = true;
  6315. }
  6316. };
  6317. if (!areValidElements(reference2, popper2)) {
  6318. return instance;
  6319. }
  6320. instance.setOptions(options).then(function(state2) {
  6321. if (!isDestroyed && options.onFirstUpdate) {
  6322. options.onFirstUpdate(state2);
  6323. }
  6324. });
  6325. function runModifierEffects() {
  6326. state.orderedModifiers.forEach(function(_ref) {
  6327. var name = _ref.name, _ref$options = _ref.options, options2 = _ref$options === void 0 ? {} : _ref$options, effect2 = _ref.effect;
  6328. if (typeof effect2 === "function") {
  6329. var cleanupFn = effect2({
  6330. state,
  6331. name,
  6332. instance,
  6333. options: options2
  6334. });
  6335. var noopFn = function noopFn2() {
  6336. };
  6337. effectCleanupFns.push(cleanupFn || noopFn);
  6338. }
  6339. });
  6340. }
  6341. function cleanupModifierEffects() {
  6342. effectCleanupFns.forEach(function(fn2) {
  6343. return fn2();
  6344. });
  6345. effectCleanupFns = [];
  6346. }
  6347. return instance;
  6348. };
  6349. }
  6350. var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
  6351. var createPopper = /* @__PURE__ */ popperGenerator({
  6352. defaultModifiers
  6353. });
  6354. const POSITIONING_STRATEGIES = ["fixed", "absolute"];
  6355. const usePopperCoreConfigProps = buildProps({
  6356. boundariesPadding: {
  6357. type: Number,
  6358. default: 0
  6359. },
  6360. fallbackPlacements: {
  6361. type: definePropType(Array),
  6362. default: () => []
  6363. },
  6364. gpuAcceleration: {
  6365. type: Boolean,
  6366. default: true
  6367. },
  6368. offset: {
  6369. type: Number,
  6370. default: 12
  6371. },
  6372. placement: {
  6373. type: String,
  6374. values: placements,
  6375. default: "bottom"
  6376. },
  6377. popperOptions: {
  6378. type: definePropType(Object),
  6379. default: () => ({})
  6380. },
  6381. strategy: {
  6382. type: String,
  6383. values: POSITIONING_STRATEGIES,
  6384. default: "absolute"
  6385. }
  6386. });
  6387. const usePopperContentProps = buildProps(__spreadProps(__spreadValues({}, usePopperCoreConfigProps), {
  6388. style: { type: definePropType([String, Array, Object]) },
  6389. className: { type: definePropType([String, Array, Object]) },
  6390. effect: {
  6391. type: String,
  6392. default: "dark"
  6393. },
  6394. visible: Boolean,
  6395. enterable: {
  6396. type: Boolean,
  6397. default: true
  6398. },
  6399. pure: Boolean,
  6400. popperClass: {
  6401. type: definePropType([String, Array, Object])
  6402. },
  6403. popperStyle: {
  6404. type: definePropType([String, Array, Object])
  6405. },
  6406. referenceEl: {
  6407. type: definePropType(Object)
  6408. },
  6409. stopPopperMouseEvent: {
  6410. type: Boolean,
  6411. default: true
  6412. },
  6413. zIndex: Number
  6414. }));
  6415. const buildPopperOptions = (props, arrowProps) => {
  6416. const { placement, strategy, popperOptions: popperOptions2 } = props;
  6417. const options = __spreadProps(__spreadValues({
  6418. placement,
  6419. strategy
  6420. }, popperOptions2), {
  6421. modifiers: genModifiers(props)
  6422. });
  6423. attachArrow(options, arrowProps);
  6424. deriveExtraModifiers(options, popperOptions2 == null ? void 0 : popperOptions2.modifiers);
  6425. return options;
  6426. };
  6427. const unwrapMeasurableEl = ($el) => {
  6428. if (!isClient)
  6429. return;
  6430. return unrefElement($el);
  6431. };
  6432. function genModifiers(options) {
  6433. const { offset: offset2, gpuAcceleration, fallbackPlacements } = options;
  6434. return [
  6435. {
  6436. name: "offset",
  6437. options: {
  6438. offset: [0, offset2 != null ? offset2 : 12]
  6439. }
  6440. },
  6441. {
  6442. name: "preventOverflow",
  6443. options: {
  6444. padding: {
  6445. top: 2,
  6446. bottom: 2,
  6447. left: 5,
  6448. right: 5
  6449. }
  6450. }
  6451. },
  6452. {
  6453. name: "flip",
  6454. options: {
  6455. padding: 5,
  6456. fallbackPlacements: fallbackPlacements != null ? fallbackPlacements : []
  6457. }
  6458. },
  6459. {
  6460. name: "computeStyles",
  6461. options: {
  6462. gpuAcceleration,
  6463. adaptive: gpuAcceleration
  6464. }
  6465. }
  6466. ];
  6467. }
  6468. function attachArrow(options, { arrowEl, arrowOffset }) {
  6469. options.modifiers.push({
  6470. name: "arrow",
  6471. options: {
  6472. element: arrowEl,
  6473. padding: arrowOffset != null ? arrowOffset : 5
  6474. }
  6475. });
  6476. }
  6477. function deriveExtraModifiers(options, modifiers) {
  6478. if (modifiers) {
  6479. options.modifiers = [...options.modifiers, ...modifiers != null ? modifiers : []];
  6480. }
  6481. }
  6482. const __default__$g = {
  6483. name: "ElPopperContent"
  6484. };
  6485. const _sfc_main$_ = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$g), {
  6486. props: usePopperContentProps,
  6487. emits: ["mouseenter", "mouseleave"],
  6488. setup(__props, { expose }) {
  6489. const props = __props;
  6490. const { popperInstanceRef, contentRef, triggerRef: triggerRef2 } = inject(POPPER_INJECTION_KEY, void 0);
  6491. const { nextZIndex } = useZIndex();
  6492. const ns = useNamespace("popper");
  6493. const popperContentRef = ref();
  6494. const arrowRef = ref();
  6495. const arrowOffset = ref();
  6496. provide(POPPER_CONTENT_INJECTION_KEY, {
  6497. arrowRef,
  6498. arrowOffset
  6499. });
  6500. const contentZIndex = ref(props.zIndex || nextZIndex());
  6501. const computedReference = computed(() => unwrapMeasurableEl(props.referenceEl) || unref(triggerRef2));
  6502. const contentStyle = computed(() => [{ zIndex: unref(contentZIndex) }, props.popperStyle]);
  6503. const contentClass = computed(() => [
  6504. ns.b(),
  6505. ns.is("pure", props.pure),
  6506. ns.is(props.effect),
  6507. props.popperClass
  6508. ]);
  6509. const createPopperInstance = ({ referenceEl, popperContentEl, arrowEl }) => {
  6510. const options = buildPopperOptions(props, {
  6511. arrowEl,
  6512. arrowOffset: unref(arrowOffset)
  6513. });
  6514. return createPopper(referenceEl, popperContentEl, options);
  6515. };
  6516. const updatePopper = (shouldUpdateZIndex = true) => {
  6517. var _a2;
  6518. (_a2 = unref(popperInstanceRef)) == null ? void 0 : _a2.update();
  6519. shouldUpdateZIndex && (contentZIndex.value = props.zIndex || nextZIndex());
  6520. };
  6521. const togglePopperAlive = () => {
  6522. var _a2, _b2;
  6523. const monitorable = { name: "eventListeners", enabled: props.visible };
  6524. (_b2 = (_a2 = unref(popperInstanceRef)) == null ? void 0 : _a2.setOptions) == null ? void 0 : _b2.call(_a2, (options) => __spreadProps(__spreadValues({}, options), {
  6525. modifiers: [...options.modifiers || [], monitorable]
  6526. }));
  6527. updatePopper(false);
  6528. };
  6529. onMounted(() => {
  6530. let updateHandle;
  6531. watch(computedReference, (referenceEl) => {
  6532. var _a2;
  6533. updateHandle == null ? void 0 : updateHandle();
  6534. const popperInstance = unref(popperInstanceRef);
  6535. (_a2 = popperInstance == null ? void 0 : popperInstance.destroy) == null ? void 0 : _a2.call(popperInstance);
  6536. if (referenceEl) {
  6537. const popperContentEl = unref(popperContentRef);
  6538. contentRef.value = popperContentEl;
  6539. popperInstanceRef.value = createPopperInstance({
  6540. referenceEl,
  6541. popperContentEl,
  6542. arrowEl: unref(arrowRef)
  6543. });
  6544. updateHandle = watch(() => referenceEl.getBoundingClientRect(), () => updatePopper(), {
  6545. immediate: true
  6546. });
  6547. } else {
  6548. popperInstanceRef.value = void 0;
  6549. }
  6550. }, {
  6551. immediate: true
  6552. });
  6553. watch(() => props.visible, togglePopperAlive, { immediate: true });
  6554. watch(() => buildPopperOptions(props, {
  6555. arrowEl: unref(arrowRef),
  6556. arrowOffset: unref(arrowOffset)
  6557. }), (option) => {
  6558. var _a2;
  6559. return (_a2 = popperInstanceRef.value) == null ? void 0 : _a2.setOptions(option);
  6560. });
  6561. });
  6562. expose({
  6563. popperContentRef,
  6564. popperInstanceRef,
  6565. updatePopper,
  6566. contentStyle
  6567. });
  6568. return (_ctx, _cache) => {
  6569. return openBlock(), createElementBlock("div", {
  6570. ref_key: "popperContentRef",
  6571. ref: popperContentRef,
  6572. style: normalizeStyle(unref(contentStyle)),
  6573. class: normalizeClass(unref(contentClass)),
  6574. role: "tooltip",
  6575. onMouseenter: _cache[0] || (_cache[0] = (e) => _ctx.$emit("mouseenter", e)),
  6576. onMouseleave: _cache[1] || (_cache[1] = (e) => _ctx.$emit("mouseleave", e))
  6577. }, [
  6578. renderSlot(_ctx.$slots, "default")
  6579. ], 38);
  6580. };
  6581. }
  6582. }));
  6583. var ElPopperContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$_, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/content.vue"]]);
  6584. function useDeprecateAppendToBody(scope, from) {
  6585. const vm = getCurrentInstance();
  6586. const compatTeleported = computed(() => {
  6587. return isBoolean(vm.props[from]) ? vm.props[from] : vm.props.teleported;
  6588. });
  6589. useDeprecated({
  6590. scope,
  6591. from,
  6592. replacement: "teleported",
  6593. version: "2.1.0",
  6594. ref: "https://element-plus.org/en-US/component/tooltip.html#attributes"
  6595. }, computed(() => isBoolean(vm.props[from])));
  6596. return {
  6597. compatTeleported
  6598. };
  6599. }
  6600. const ElPopper = withInstall(Popper);
  6601. const _sfc_main$Z = defineComponent({
  6602. name: "ElVisuallyHidden",
  6603. props: {
  6604. style: {
  6605. type: [String, Object, Array]
  6606. }
  6607. },
  6608. setup(props) {
  6609. return {
  6610. computedStyle: computed(() => {
  6611. return [
  6612. props.style,
  6613. {
  6614. position: "absolute",
  6615. border: 0,
  6616. width: 1,
  6617. height: 1,
  6618. padding: 0,
  6619. margin: -1,
  6620. overflow: "hidden",
  6621. clip: "rect(0, 0, 0, 0)",
  6622. whiteSpace: "nowrap",
  6623. wordWrap: "normal"
  6624. }
  6625. ];
  6626. })
  6627. };
  6628. }
  6629. });
  6630. function _sfc_render$A(_ctx, _cache, $props, $setup, $data, $options) {
  6631. return openBlock(), createElementBlock("span", mergeProps(_ctx.$attrs, { style: _ctx.computedStyle }), [
  6632. renderSlot(_ctx.$slots, "default")
  6633. ], 16);
  6634. }
  6635. var ElVisuallyHidden = /* @__PURE__ */ _export_sfc$1(_sfc_main$Z, [["render", _sfc_render$A], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/visual-hidden/src/visual-hidden.vue"]]);
  6636. const useTooltipContentProps = buildProps(__spreadProps(__spreadValues(__spreadValues({}, useDelayedToggleProps), usePopperContentProps), {
  6637. appendTo: {
  6638. type: definePropType([String, Object]),
  6639. default: POPPER_CONTAINER_SELECTOR
  6640. },
  6641. content: {
  6642. type: String,
  6643. default: ""
  6644. },
  6645. rawContent: {
  6646. type: Boolean,
  6647. default: false
  6648. },
  6649. persistent: Boolean,
  6650. ariaLabel: String,
  6651. visible: {
  6652. type: definePropType(Boolean),
  6653. default: null
  6654. },
  6655. transition: {
  6656. type: String,
  6657. default: "el-fade-in-linear"
  6658. },
  6659. teleported: {
  6660. type: Boolean,
  6661. default: true
  6662. },
  6663. disabled: {
  6664. type: Boolean
  6665. }
  6666. }));
  6667. const useTooltipTriggerProps = buildProps(__spreadProps(__spreadValues({}, usePopperTriggerProps), {
  6668. disabled: Boolean,
  6669. trigger: {
  6670. type: definePropType([String, Array]),
  6671. default: "hover"
  6672. }
  6673. }));
  6674. const useTooltipProps = buildProps({
  6675. openDelay: {
  6676. type: Number
  6677. },
  6678. visibleArrow: {
  6679. type: Boolean,
  6680. default: void 0
  6681. },
  6682. hideAfter: {
  6683. type: Number,
  6684. default: 200
  6685. },
  6686. showArrow: {
  6687. type: Boolean,
  6688. default: true
  6689. }
  6690. });
  6691. const TOOLTIP_INJECTION_KEY = Symbol("elTooltip");
  6692. const _sfc_main$Y = defineComponent({
  6693. name: "ElTooltipContent",
  6694. components: {
  6695. ElPopperContent,
  6696. ElVisuallyHidden
  6697. },
  6698. inheritAttrs: false,
  6699. props: useTooltipContentProps,
  6700. setup(props) {
  6701. const contentRef = ref(null);
  6702. const intermediateOpen = ref(false);
  6703. const entering = ref(false);
  6704. const leaving = ref(false);
  6705. const destroyed = ref(false);
  6706. const {
  6707. controlled,
  6708. id,
  6709. open,
  6710. trigger,
  6711. onClose,
  6712. onOpen,
  6713. onShow,
  6714. onHide,
  6715. onBeforeShow,
  6716. onBeforeHide
  6717. } = inject(TOOLTIP_INJECTION_KEY, void 0);
  6718. const persistentRef = computed(() => {
  6719. return props.persistent;
  6720. });
  6721. onBeforeUnmount(() => {
  6722. destroyed.value = true;
  6723. });
  6724. const shouldRender = computed(() => {
  6725. return unref(persistentRef) ? true : unref(open);
  6726. });
  6727. const shouldShow = computed(() => {
  6728. return props.disabled ? false : unref(open);
  6729. });
  6730. const contentStyle = computed(() => {
  6731. var _a2;
  6732. return (_a2 = props.style) != null ? _a2 : {};
  6733. });
  6734. const ariaHidden = computed(() => !unref(open));
  6735. useEscapeKeydown(onClose);
  6736. const onTransitionLeave = () => {
  6737. onHide();
  6738. };
  6739. const stopWhenControlled = () => {
  6740. if (unref(controlled))
  6741. return true;
  6742. };
  6743. const onContentEnter = composeEventHandlers(stopWhenControlled, () => {
  6744. if (props.enterable && unref(trigger) === "hover") {
  6745. onOpen();
  6746. }
  6747. });
  6748. const onContentLeave = composeEventHandlers(stopWhenControlled, () => {
  6749. if (unref(trigger) === "hover") {
  6750. onClose();
  6751. }
  6752. });
  6753. const onBeforeEnter = () => {
  6754. var _a2, _b2;
  6755. (_b2 = (_a2 = contentRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
  6756. onBeforeShow == null ? void 0 : onBeforeShow();
  6757. };
  6758. const onBeforeLeave = () => {
  6759. onBeforeHide == null ? void 0 : onBeforeHide();
  6760. };
  6761. const onAfterShow = () => {
  6762. onShow();
  6763. };
  6764. let stopHandle;
  6765. watch(() => unref(open), (val) => {
  6766. if (val) {
  6767. stopHandle = onClickOutside(computed(() => {
  6768. var _a2;
  6769. return (_a2 = contentRef.value) == null ? void 0 : _a2.popperContentRef;
  6770. }), () => {
  6771. if (unref(controlled))
  6772. return;
  6773. const $trigger = unref(trigger);
  6774. if ($trigger !== "hover") {
  6775. onClose();
  6776. }
  6777. });
  6778. } else {
  6779. stopHandle == null ? void 0 : stopHandle();
  6780. }
  6781. }, {
  6782. flush: "post"
  6783. });
  6784. return {
  6785. ariaHidden,
  6786. entering,
  6787. leaving,
  6788. id,
  6789. intermediateOpen,
  6790. contentStyle,
  6791. contentRef,
  6792. destroyed,
  6793. shouldRender,
  6794. shouldShow,
  6795. open,
  6796. onAfterShow,
  6797. onBeforeEnter,
  6798. onBeforeLeave,
  6799. onContentEnter,
  6800. onContentLeave,
  6801. onTransitionLeave
  6802. };
  6803. }
  6804. });
  6805. function _sfc_render$z(_ctx, _cache, $props, $setup, $data, $options) {
  6806. const _component_el_visually_hidden = resolveComponent("el-visually-hidden");
  6807. const _component_el_popper_content = resolveComponent("el-popper-content");
  6808. return openBlock(), createBlock(Teleport, {
  6809. disabled: !_ctx.teleported,
  6810. to: _ctx.appendTo
  6811. }, [
  6812. createVNode(Transition, {
  6813. name: _ctx.transition,
  6814. onAfterLeave: _ctx.onTransitionLeave,
  6815. onBeforeEnter: _ctx.onBeforeEnter,
  6816. onAfterEnter: _ctx.onAfterShow,
  6817. onBeforeLeave: _ctx.onBeforeLeave
  6818. }, {
  6819. default: withCtx(() => [
  6820. _ctx.shouldRender ? withDirectives((openBlock(), createBlock(_component_el_popper_content, mergeProps({
  6821. key: 0,
  6822. ref: "contentRef"
  6823. }, _ctx.$attrs, {
  6824. "aria-hidden": _ctx.ariaHidden,
  6825. "boundaries-padding": _ctx.boundariesPadding,
  6826. "fallback-placements": _ctx.fallbackPlacements,
  6827. "gpu-acceleration": _ctx.gpuAcceleration,
  6828. offset: _ctx.offset,
  6829. placement: _ctx.placement,
  6830. "popper-options": _ctx.popperOptions,
  6831. strategy: _ctx.strategy,
  6832. effect: _ctx.effect,
  6833. enterable: _ctx.enterable,
  6834. pure: _ctx.pure,
  6835. "popper-class": _ctx.popperClass,
  6836. "popper-style": [_ctx.popperStyle, _ctx.contentStyle],
  6837. "reference-el": _ctx.referenceEl,
  6838. visible: _ctx.shouldShow,
  6839. "z-index": _ctx.zIndex,
  6840. onMouseenter: _ctx.onContentEnter,
  6841. onMouseleave: _ctx.onContentLeave
  6842. }), {
  6843. default: withCtx(() => [
  6844. createCommentVNode(" Workaround bug #6378 "),
  6845. !_ctx.destroyed ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  6846. renderSlot(_ctx.$slots, "default"),
  6847. createVNode(_component_el_visually_hidden, {
  6848. id: _ctx.id,
  6849. role: "tooltip"
  6850. }, {
  6851. default: withCtx(() => [
  6852. createTextVNode(toDisplayString(_ctx.ariaLabel), 1)
  6853. ]),
  6854. _: 1
  6855. }, 8, ["id"])
  6856. ], 64)) : createCommentVNode("v-if", true)
  6857. ]),
  6858. _: 3
  6859. }, 16, ["aria-hidden", "boundaries-padding", "fallback-placements", "gpu-acceleration", "offset", "placement", "popper-options", "strategy", "effect", "enterable", "pure", "popper-class", "popper-style", "reference-el", "visible", "z-index", "onMouseenter", "onMouseleave"])), [
  6860. [vShow, _ctx.shouldShow]
  6861. ]) : createCommentVNode("v-if", true)
  6862. ]),
  6863. _: 3
  6864. }, 8, ["name", "onAfterLeave", "onBeforeEnter", "onAfterEnter", "onBeforeLeave"])
  6865. ], 8, ["disabled", "to"]);
  6866. }
  6867. var ElTooltipContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$Y, [["render", _sfc_render$z], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/content.vue"]]);
  6868. const isTriggerType = (trigger, type4) => {
  6869. if (isArray(trigger)) {
  6870. return trigger.includes(type4);
  6871. }
  6872. return trigger === type4;
  6873. };
  6874. const whenTrigger = (trigger, type4, handler3) => {
  6875. return (e) => {
  6876. isTriggerType(unref(trigger), type4) && handler3(e);
  6877. };
  6878. };
  6879. const _sfc_main$X = defineComponent({
  6880. name: "ElTooltipTrigger",
  6881. components: {
  6882. ElPopperTrigger
  6883. },
  6884. props: useTooltipTriggerProps,
  6885. setup(props) {
  6886. const ns = useNamespace("tooltip");
  6887. const { controlled, id, open, onOpen, onClose, onToggle } = inject(TOOLTIP_INJECTION_KEY, void 0);
  6888. const triggerRef2 = ref(null);
  6889. const stopWhenControlledOrDisabled = () => {
  6890. if (unref(controlled) || props.disabled) {
  6891. return true;
  6892. }
  6893. };
  6894. const trigger = toRef(props, "trigger");
  6895. const onMouseenter = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onOpen));
  6896. const onMouseleave = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onClose));
  6897. const onClick = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "click", (e) => {
  6898. if (e.button === 0) {
  6899. onToggle(e);
  6900. }
  6901. }));
  6902. const onFocus = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onOpen));
  6903. const onBlur = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onClose));
  6904. const onContextMenu = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "contextmenu", (e) => {
  6905. e.preventDefault();
  6906. onToggle(e);
  6907. }));
  6908. const onKeydown = composeEventHandlers(stopWhenControlledOrDisabled, (e) => {
  6909. const { code } = e;
  6910. if (code === EVENT_CODE.enter || code === EVENT_CODE.space) {
  6911. onToggle(e);
  6912. }
  6913. });
  6914. return {
  6915. onBlur,
  6916. onContextMenu,
  6917. onFocus,
  6918. onMouseenter,
  6919. onMouseleave,
  6920. onClick,
  6921. onKeydown,
  6922. open,
  6923. id,
  6924. triggerRef: triggerRef2,
  6925. ns
  6926. };
  6927. }
  6928. });
  6929. function _sfc_render$y(_ctx, _cache, $props, $setup, $data, $options) {
  6930. const _component_el_popper_trigger = resolveComponent("el-popper-trigger");
  6931. return openBlock(), createBlock(_component_el_popper_trigger, {
  6932. id: _ctx.id,
  6933. "virtual-ref": _ctx.virtualRef,
  6934. open: _ctx.open,
  6935. "virtual-triggering": _ctx.virtualTriggering,
  6936. class: normalizeClass(_ctx.ns.e("trigger")),
  6937. onBlur: _ctx.onBlur,
  6938. onClick: _ctx.onClick,
  6939. onContextmenu: _ctx.onContextMenu,
  6940. onFocus: _ctx.onFocus,
  6941. onMouseenter: _ctx.onMouseenter,
  6942. onMouseleave: _ctx.onMouseleave,
  6943. onKeydown: _ctx.onKeydown
  6944. }, {
  6945. default: withCtx(() => [
  6946. renderSlot(_ctx.$slots, "default")
  6947. ]),
  6948. _: 3
  6949. }, 8, ["id", "virtual-ref", "open", "virtual-triggering", "class", "onBlur", "onClick", "onContextmenu", "onFocus", "onMouseenter", "onMouseleave", "onKeydown"]);
  6950. }
  6951. var ElTooltipTrigger = /* @__PURE__ */ _export_sfc$1(_sfc_main$X, [["render", _sfc_render$y], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/trigger.vue"]]);
  6952. const { useModelToggleProps, useModelToggle, useModelToggleEmits } = createModelToggleComposable("visible");
  6953. const _sfc_main$W = defineComponent({
  6954. name: "ElTooltip",
  6955. components: {
  6956. ElPopper,
  6957. ElPopperArrow,
  6958. ElTooltipContent,
  6959. ElTooltipTrigger
  6960. },
  6961. props: __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, useModelToggleProps), useTooltipContentProps), useTooltipTriggerProps), usePopperArrowProps), useTooltipProps),
  6962. emits: [...useModelToggleEmits, "before-show", "before-hide", "show", "hide"],
  6963. setup(props, { emit }) {
  6964. usePopperContainer();
  6965. const compatShowAfter = computed(() => {
  6966. if (!isUndefined(props.openDelay))
  6967. ;
  6968. return props.openDelay || props.showAfter;
  6969. });
  6970. const compatShowArrow = computed(() => {
  6971. if (!isUndefined(props.visibleArrow))
  6972. ;
  6973. return isBoolean(props.visibleArrow) ? props.visibleArrow : props.showArrow;
  6974. });
  6975. const id = useId();
  6976. const popperRef = ref(null);
  6977. const updatePopper = () => {
  6978. var _a2;
  6979. const popperComponent = unref(popperRef);
  6980. if (popperComponent) {
  6981. (_a2 = popperComponent.popperInstanceRef) == null ? void 0 : _a2.update();
  6982. }
  6983. };
  6984. const open = ref(false);
  6985. const { show, hide: hide2 } = useModelToggle({
  6986. indicator: open
  6987. });
  6988. const { onOpen, onClose } = useDelayedToggle({
  6989. showAfter: compatShowAfter,
  6990. hideAfter: toRef(props, "hideAfter"),
  6991. open: show,
  6992. close: hide2
  6993. });
  6994. const controlled = computed(() => isBoolean(props.visible));
  6995. provide(TOOLTIP_INJECTION_KEY, {
  6996. controlled,
  6997. id,
  6998. open: readonly(open),
  6999. trigger: toRef(props, "trigger"),
  7000. onOpen,
  7001. onClose,
  7002. onToggle: () => {
  7003. if (unref(open)) {
  7004. onClose();
  7005. } else {
  7006. onOpen();
  7007. }
  7008. },
  7009. onShow: () => {
  7010. emit("show");
  7011. },
  7012. onHide: () => {
  7013. emit("hide");
  7014. },
  7015. onBeforeShow: () => {
  7016. emit("before-show");
  7017. },
  7018. onBeforeHide: () => {
  7019. emit("before-hide");
  7020. },
  7021. updatePopper
  7022. });
  7023. watch(() => props.disabled, (disabled) => {
  7024. if (disabled && open.value) {
  7025. open.value = false;
  7026. }
  7027. });
  7028. return {
  7029. compatShowAfter,
  7030. compatShowArrow,
  7031. popperRef,
  7032. open,
  7033. hide: hide2,
  7034. updatePopper,
  7035. onOpen,
  7036. onClose
  7037. };
  7038. }
  7039. });
  7040. const _hoisted_1$C = ["innerHTML"];
  7041. const _hoisted_2$t = { key: 1 };
  7042. function _sfc_render$x(_ctx, _cache, $props, $setup, $data, $options) {
  7043. const _component_el_tooltip_trigger = resolveComponent("el-tooltip-trigger");
  7044. const _component_el_popper_arrow = resolveComponent("el-popper-arrow");
  7045. const _component_el_tooltip_content = resolveComponent("el-tooltip-content");
  7046. const _component_el_popper = resolveComponent("el-popper");
  7047. return openBlock(), createBlock(_component_el_popper, { ref: "popperRef" }, {
  7048. default: withCtx(() => [
  7049. createVNode(_component_el_tooltip_trigger, {
  7050. disabled: _ctx.disabled,
  7051. trigger: _ctx.trigger,
  7052. "virtual-ref": _ctx.virtualRef,
  7053. "virtual-triggering": _ctx.virtualTriggering
  7054. }, {
  7055. default: withCtx(() => [
  7056. _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("v-if", true)
  7057. ]),
  7058. _: 3
  7059. }, 8, ["disabled", "trigger", "virtual-ref", "virtual-triggering"]),
  7060. createVNode(_component_el_tooltip_content, {
  7061. "aria-label": _ctx.ariaLabel,
  7062. "boundaries-padding": _ctx.boundariesPadding,
  7063. content: _ctx.content,
  7064. disabled: _ctx.disabled,
  7065. effect: _ctx.effect,
  7066. enterable: _ctx.enterable,
  7067. "fallback-placements": _ctx.fallbackPlacements,
  7068. "hide-after": _ctx.hideAfter,
  7069. "gpu-acceleration": _ctx.gpuAcceleration,
  7070. offset: _ctx.offset,
  7071. persistent: _ctx.persistent,
  7072. "popper-class": _ctx.popperClass,
  7073. "popper-style": _ctx.popperStyle,
  7074. placement: _ctx.placement,
  7075. "popper-options": _ctx.popperOptions,
  7076. pure: _ctx.pure,
  7077. "raw-content": _ctx.rawContent,
  7078. "reference-el": _ctx.referenceEl,
  7079. "show-after": _ctx.compatShowAfter,
  7080. strategy: _ctx.strategy,
  7081. teleported: _ctx.teleported,
  7082. transition: _ctx.transition,
  7083. "z-index": _ctx.zIndex,
  7084. "append-to": _ctx.appendTo
  7085. }, {
  7086. default: withCtx(() => [
  7087. renderSlot(_ctx.$slots, "content", {}, () => [
  7088. _ctx.rawContent ? (openBlock(), createElementBlock("span", {
  7089. key: 0,
  7090. innerHTML: _ctx.content
  7091. }, null, 8, _hoisted_1$C)) : (openBlock(), createElementBlock("span", _hoisted_2$t, toDisplayString(_ctx.content), 1))
  7092. ]),
  7093. _ctx.compatShowArrow ? (openBlock(), createBlock(_component_el_popper_arrow, {
  7094. key: 0,
  7095. "arrow-offset": _ctx.arrowOffset
  7096. }, null, 8, ["arrow-offset"])) : createCommentVNode("v-if", true)
  7097. ]),
  7098. _: 3
  7099. }, 8, ["aria-label", "boundaries-padding", "content", "disabled", "effect", "enterable", "fallback-placements", "hide-after", "gpu-acceleration", "offset", "persistent", "popper-class", "popper-style", "placement", "popper-options", "pure", "raw-content", "reference-el", "show-after", "strategy", "teleported", "transition", "z-index", "append-to"])
  7100. ]),
  7101. _: 3
  7102. }, 512);
  7103. }
  7104. var Tooltip = /* @__PURE__ */ _export_sfc$1(_sfc_main$W, [["render", _sfc_render$x], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/tooltip.vue"]]);
  7105. const ElTooltip = withInstall(Tooltip);
  7106. const buttonTypes = [
  7107. "default",
  7108. "primary",
  7109. "success",
  7110. "warning",
  7111. "info",
  7112. "danger",
  7113. "text",
  7114. ""
  7115. ];
  7116. const buttonNativeTypes = ["button", "submit", "reset"];
  7117. const buttonProps = buildProps({
  7118. size: useSizeProp,
  7119. disabled: Boolean,
  7120. type: {
  7121. type: String,
  7122. values: buttonTypes,
  7123. default: ""
  7124. },
  7125. icon: {
  7126. type: iconPropType,
  7127. default: ""
  7128. },
  7129. nativeType: {
  7130. type: String,
  7131. values: buttonNativeTypes,
  7132. default: "button"
  7133. },
  7134. loading: Boolean,
  7135. loadingIcon: {
  7136. type: iconPropType,
  7137. default: () => loading
  7138. },
  7139. plain: Boolean,
  7140. autofocus: Boolean,
  7141. round: Boolean,
  7142. circle: Boolean,
  7143. color: String,
  7144. dark: Boolean,
  7145. autoInsertSpace: {
  7146. type: Boolean,
  7147. default: void 0
  7148. }
  7149. });
  7150. const buttonEmits = {
  7151. click: (evt) => evt instanceof MouseEvent
  7152. };
  7153. function bound01(n, max2) {
  7154. if (isOnePointZero(n)) {
  7155. n = "100%";
  7156. }
  7157. var isPercent = isPercentage(n);
  7158. n = max2 === 360 ? n : Math.min(max2, Math.max(0, parseFloat(n)));
  7159. if (isPercent) {
  7160. n = parseInt(String(n * max2), 10) / 100;
  7161. }
  7162. if (Math.abs(n - max2) < 1e-6) {
  7163. return 1;
  7164. }
  7165. if (max2 === 360) {
  7166. n = (n < 0 ? n % max2 + max2 : n % max2) / parseFloat(String(max2));
  7167. } else {
  7168. n = n % max2 / parseFloat(String(max2));
  7169. }
  7170. return n;
  7171. }
  7172. function clamp01(val) {
  7173. return Math.min(1, Math.max(0, val));
  7174. }
  7175. function isOnePointZero(n) {
  7176. return typeof n === "string" && n.indexOf(".") !== -1 && parseFloat(n) === 1;
  7177. }
  7178. function isPercentage(n) {
  7179. return typeof n === "string" && n.indexOf("%") !== -1;
  7180. }
  7181. function boundAlpha(a2) {
  7182. a2 = parseFloat(a2);
  7183. if (isNaN(a2) || a2 < 0 || a2 > 1) {
  7184. a2 = 1;
  7185. }
  7186. return a2;
  7187. }
  7188. function convertToPercentage(n) {
  7189. if (n <= 1) {
  7190. return "".concat(Number(n) * 100, "%");
  7191. }
  7192. return n;
  7193. }
  7194. function pad2(c2) {
  7195. return c2.length === 1 ? "0" + c2 : String(c2);
  7196. }
  7197. function rgbToRgb(r, g, b2) {
  7198. return {
  7199. r: bound01(r, 255) * 255,
  7200. g: bound01(g, 255) * 255,
  7201. b: bound01(b2, 255) * 255
  7202. };
  7203. }
  7204. function rgbToHsl(r, g, b2) {
  7205. r = bound01(r, 255);
  7206. g = bound01(g, 255);
  7207. b2 = bound01(b2, 255);
  7208. var max2 = Math.max(r, g, b2);
  7209. var min2 = Math.min(r, g, b2);
  7210. var h2 = 0;
  7211. var s2 = 0;
  7212. var l2 = (max2 + min2) / 2;
  7213. if (max2 === min2) {
  7214. s2 = 0;
  7215. h2 = 0;
  7216. } else {
  7217. var d2 = max2 - min2;
  7218. s2 = l2 > 0.5 ? d2 / (2 - max2 - min2) : d2 / (max2 + min2);
  7219. switch (max2) {
  7220. case r:
  7221. h2 = (g - b2) / d2 + (g < b2 ? 6 : 0);
  7222. break;
  7223. case g:
  7224. h2 = (b2 - r) / d2 + 2;
  7225. break;
  7226. case b2:
  7227. h2 = (r - g) / d2 + 4;
  7228. break;
  7229. }
  7230. h2 /= 6;
  7231. }
  7232. return { h: h2, s: s2, l: l2 };
  7233. }
  7234. function hue2rgb(p2, q, t) {
  7235. if (t < 0) {
  7236. t += 1;
  7237. }
  7238. if (t > 1) {
  7239. t -= 1;
  7240. }
  7241. if (t < 1 / 6) {
  7242. return p2 + (q - p2) * (6 * t);
  7243. }
  7244. if (t < 1 / 2) {
  7245. return q;
  7246. }
  7247. if (t < 2 / 3) {
  7248. return p2 + (q - p2) * (2 / 3 - t) * 6;
  7249. }
  7250. return p2;
  7251. }
  7252. function hslToRgb(h2, s2, l2) {
  7253. var r;
  7254. var g;
  7255. var b2;
  7256. h2 = bound01(h2, 360);
  7257. s2 = bound01(s2, 100);
  7258. l2 = bound01(l2, 100);
  7259. if (s2 === 0) {
  7260. g = l2;
  7261. b2 = l2;
  7262. r = l2;
  7263. } else {
  7264. var q = l2 < 0.5 ? l2 * (1 + s2) : l2 + s2 - l2 * s2;
  7265. var p2 = 2 * l2 - q;
  7266. r = hue2rgb(p2, q, h2 + 1 / 3);
  7267. g = hue2rgb(p2, q, h2);
  7268. b2 = hue2rgb(p2, q, h2 - 1 / 3);
  7269. }
  7270. return { r: r * 255, g: g * 255, b: b2 * 255 };
  7271. }
  7272. function rgbToHsv(r, g, b2) {
  7273. r = bound01(r, 255);
  7274. g = bound01(g, 255);
  7275. b2 = bound01(b2, 255);
  7276. var max2 = Math.max(r, g, b2);
  7277. var min2 = Math.min(r, g, b2);
  7278. var h2 = 0;
  7279. var v2 = max2;
  7280. var d2 = max2 - min2;
  7281. var s2 = max2 === 0 ? 0 : d2 / max2;
  7282. if (max2 === min2) {
  7283. h2 = 0;
  7284. } else {
  7285. switch (max2) {
  7286. case r:
  7287. h2 = (g - b2) / d2 + (g < b2 ? 6 : 0);
  7288. break;
  7289. case g:
  7290. h2 = (b2 - r) / d2 + 2;
  7291. break;
  7292. case b2:
  7293. h2 = (r - g) / d2 + 4;
  7294. break;
  7295. }
  7296. h2 /= 6;
  7297. }
  7298. return { h: h2, s: s2, v: v2 };
  7299. }
  7300. function hsvToRgb(h2, s2, v2) {
  7301. h2 = bound01(h2, 360) * 6;
  7302. s2 = bound01(s2, 100);
  7303. v2 = bound01(v2, 100);
  7304. var i = Math.floor(h2);
  7305. var f2 = h2 - i;
  7306. var p2 = v2 * (1 - s2);
  7307. var q = v2 * (1 - f2 * s2);
  7308. var t = v2 * (1 - (1 - f2) * s2);
  7309. var mod = i % 6;
  7310. var r = [v2, q, p2, p2, t, v2][mod];
  7311. var g = [t, v2, v2, q, p2, p2][mod];
  7312. var b2 = [p2, p2, t, v2, v2, q][mod];
  7313. return { r: r * 255, g: g * 255, b: b2 * 255 };
  7314. }
  7315. function rgbToHex(r, g, b2, allow3Char) {
  7316. var hex2 = [
  7317. pad2(Math.round(r).toString(16)),
  7318. pad2(Math.round(g).toString(16)),
  7319. pad2(Math.round(b2).toString(16))
  7320. ];
  7321. if (allow3Char && hex2[0].startsWith(hex2[0].charAt(1)) && hex2[1].startsWith(hex2[1].charAt(1)) && hex2[2].startsWith(hex2[2].charAt(1))) {
  7322. return hex2[0].charAt(0) + hex2[1].charAt(0) + hex2[2].charAt(0);
  7323. }
  7324. return hex2.join("");
  7325. }
  7326. function rgbaToHex(r, g, b2, a2, allow4Char) {
  7327. var hex2 = [
  7328. pad2(Math.round(r).toString(16)),
  7329. pad2(Math.round(g).toString(16)),
  7330. pad2(Math.round(b2).toString(16)),
  7331. pad2(convertDecimalToHex(a2))
  7332. ];
  7333. if (allow4Char && hex2[0].startsWith(hex2[0].charAt(1)) && hex2[1].startsWith(hex2[1].charAt(1)) && hex2[2].startsWith(hex2[2].charAt(1)) && hex2[3].startsWith(hex2[3].charAt(1))) {
  7334. return hex2[0].charAt(0) + hex2[1].charAt(0) + hex2[2].charAt(0) + hex2[3].charAt(0);
  7335. }
  7336. return hex2.join("");
  7337. }
  7338. function convertDecimalToHex(d2) {
  7339. return Math.round(parseFloat(d2) * 255).toString(16);
  7340. }
  7341. function convertHexToDecimal(h2) {
  7342. return parseIntFromHex(h2) / 255;
  7343. }
  7344. function parseIntFromHex(val) {
  7345. return parseInt(val, 16);
  7346. }
  7347. function numberInputToObject(color) {
  7348. return {
  7349. r: color >> 16,
  7350. g: (color & 65280) >> 8,
  7351. b: color & 255
  7352. };
  7353. }
  7354. var names = {
  7355. aliceblue: "#f0f8ff",
  7356. antiquewhite: "#faebd7",
  7357. aqua: "#00ffff",
  7358. aquamarine: "#7fffd4",
  7359. azure: "#f0ffff",
  7360. beige: "#f5f5dc",
  7361. bisque: "#ffe4c4",
  7362. black: "#000000",
  7363. blanchedalmond: "#ffebcd",
  7364. blue: "#0000ff",
  7365. blueviolet: "#8a2be2",
  7366. brown: "#a52a2a",
  7367. burlywood: "#deb887",
  7368. cadetblue: "#5f9ea0",
  7369. chartreuse: "#7fff00",
  7370. chocolate: "#d2691e",
  7371. coral: "#ff7f50",
  7372. cornflowerblue: "#6495ed",
  7373. cornsilk: "#fff8dc",
  7374. crimson: "#dc143c",
  7375. cyan: "#00ffff",
  7376. darkblue: "#00008b",
  7377. darkcyan: "#008b8b",
  7378. darkgoldenrod: "#b8860b",
  7379. darkgray: "#a9a9a9",
  7380. darkgreen: "#006400",
  7381. darkgrey: "#a9a9a9",
  7382. darkkhaki: "#bdb76b",
  7383. darkmagenta: "#8b008b",
  7384. darkolivegreen: "#556b2f",
  7385. darkorange: "#ff8c00",
  7386. darkorchid: "#9932cc",
  7387. darkred: "#8b0000",
  7388. darksalmon: "#e9967a",
  7389. darkseagreen: "#8fbc8f",
  7390. darkslateblue: "#483d8b",
  7391. darkslategray: "#2f4f4f",
  7392. darkslategrey: "#2f4f4f",
  7393. darkturquoise: "#00ced1",
  7394. darkviolet: "#9400d3",
  7395. deeppink: "#ff1493",
  7396. deepskyblue: "#00bfff",
  7397. dimgray: "#696969",
  7398. dimgrey: "#696969",
  7399. dodgerblue: "#1e90ff",
  7400. firebrick: "#b22222",
  7401. floralwhite: "#fffaf0",
  7402. forestgreen: "#228b22",
  7403. fuchsia: "#ff00ff",
  7404. gainsboro: "#dcdcdc",
  7405. ghostwhite: "#f8f8ff",
  7406. goldenrod: "#daa520",
  7407. gold: "#ffd700",
  7408. gray: "#808080",
  7409. green: "#008000",
  7410. greenyellow: "#adff2f",
  7411. grey: "#808080",
  7412. honeydew: "#f0fff0",
  7413. hotpink: "#ff69b4",
  7414. indianred: "#cd5c5c",
  7415. indigo: "#4b0082",
  7416. ivory: "#fffff0",
  7417. khaki: "#f0e68c",
  7418. lavenderblush: "#fff0f5",
  7419. lavender: "#e6e6fa",
  7420. lawngreen: "#7cfc00",
  7421. lemonchiffon: "#fffacd",
  7422. lightblue: "#add8e6",
  7423. lightcoral: "#f08080",
  7424. lightcyan: "#e0ffff",
  7425. lightgoldenrodyellow: "#fafad2",
  7426. lightgray: "#d3d3d3",
  7427. lightgreen: "#90ee90",
  7428. lightgrey: "#d3d3d3",
  7429. lightpink: "#ffb6c1",
  7430. lightsalmon: "#ffa07a",
  7431. lightseagreen: "#20b2aa",
  7432. lightskyblue: "#87cefa",
  7433. lightslategray: "#778899",
  7434. lightslategrey: "#778899",
  7435. lightsteelblue: "#b0c4de",
  7436. lightyellow: "#ffffe0",
  7437. lime: "#00ff00",
  7438. limegreen: "#32cd32",
  7439. linen: "#faf0e6",
  7440. magenta: "#ff00ff",
  7441. maroon: "#800000",
  7442. mediumaquamarine: "#66cdaa",
  7443. mediumblue: "#0000cd",
  7444. mediumorchid: "#ba55d3",
  7445. mediumpurple: "#9370db",
  7446. mediumseagreen: "#3cb371",
  7447. mediumslateblue: "#7b68ee",
  7448. mediumspringgreen: "#00fa9a",
  7449. mediumturquoise: "#48d1cc",
  7450. mediumvioletred: "#c71585",
  7451. midnightblue: "#191970",
  7452. mintcream: "#f5fffa",
  7453. mistyrose: "#ffe4e1",
  7454. moccasin: "#ffe4b5",
  7455. navajowhite: "#ffdead",
  7456. navy: "#000080",
  7457. oldlace: "#fdf5e6",
  7458. olive: "#808000",
  7459. olivedrab: "#6b8e23",
  7460. orange: "#ffa500",
  7461. orangered: "#ff4500",
  7462. orchid: "#da70d6",
  7463. palegoldenrod: "#eee8aa",
  7464. palegreen: "#98fb98",
  7465. paleturquoise: "#afeeee",
  7466. palevioletred: "#db7093",
  7467. papayawhip: "#ffefd5",
  7468. peachpuff: "#ffdab9",
  7469. peru: "#cd853f",
  7470. pink: "#ffc0cb",
  7471. plum: "#dda0dd",
  7472. powderblue: "#b0e0e6",
  7473. purple: "#800080",
  7474. rebeccapurple: "#663399",
  7475. red: "#ff0000",
  7476. rosybrown: "#bc8f8f",
  7477. royalblue: "#4169e1",
  7478. saddlebrown: "#8b4513",
  7479. salmon: "#fa8072",
  7480. sandybrown: "#f4a460",
  7481. seagreen: "#2e8b57",
  7482. seashell: "#fff5ee",
  7483. sienna: "#a0522d",
  7484. silver: "#c0c0c0",
  7485. skyblue: "#87ceeb",
  7486. slateblue: "#6a5acd",
  7487. slategray: "#708090",
  7488. slategrey: "#708090",
  7489. snow: "#fffafa",
  7490. springgreen: "#00ff7f",
  7491. steelblue: "#4682b4",
  7492. tan: "#d2b48c",
  7493. teal: "#008080",
  7494. thistle: "#d8bfd8",
  7495. tomato: "#ff6347",
  7496. turquoise: "#40e0d0",
  7497. violet: "#ee82ee",
  7498. wheat: "#f5deb3",
  7499. white: "#ffffff",
  7500. whitesmoke: "#f5f5f5",
  7501. yellow: "#ffff00",
  7502. yellowgreen: "#9acd32"
  7503. };
  7504. function inputToRGB(color) {
  7505. var rgb = { r: 0, g: 0, b: 0 };
  7506. var a2 = 1;
  7507. var s2 = null;
  7508. var v2 = null;
  7509. var l2 = null;
  7510. var ok = false;
  7511. var format2 = false;
  7512. if (typeof color === "string") {
  7513. color = stringInputToObject(color);
  7514. }
  7515. if (typeof color === "object") {
  7516. if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
  7517. rgb = rgbToRgb(color.r, color.g, color.b);
  7518. ok = true;
  7519. format2 = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
  7520. } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
  7521. s2 = convertToPercentage(color.s);
  7522. v2 = convertToPercentage(color.v);
  7523. rgb = hsvToRgb(color.h, s2, v2);
  7524. ok = true;
  7525. format2 = "hsv";
  7526. } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
  7527. s2 = convertToPercentage(color.s);
  7528. l2 = convertToPercentage(color.l);
  7529. rgb = hslToRgb(color.h, s2, l2);
  7530. ok = true;
  7531. format2 = "hsl";
  7532. }
  7533. if (Object.prototype.hasOwnProperty.call(color, "a")) {
  7534. a2 = color.a;
  7535. }
  7536. }
  7537. a2 = boundAlpha(a2);
  7538. return {
  7539. ok,
  7540. format: color.format || format2,
  7541. r: Math.min(255, Math.max(rgb.r, 0)),
  7542. g: Math.min(255, Math.max(rgb.g, 0)),
  7543. b: Math.min(255, Math.max(rgb.b, 0)),
  7544. a: a2
  7545. };
  7546. }
  7547. var CSS_INTEGER = "[-\\+]?\\d+%?";
  7548. var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
  7549. var CSS_UNIT = "(?:".concat(CSS_NUMBER, ")|(?:").concat(CSS_INTEGER, ")");
  7550. var PERMISSIVE_MATCH3 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  7551. var PERMISSIVE_MATCH4 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  7552. var matchers = {
  7553. CSS_UNIT: new RegExp(CSS_UNIT),
  7554. rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
  7555. rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
  7556. hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
  7557. hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
  7558. hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
  7559. hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
  7560. hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  7561. hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
  7562. hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  7563. hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
  7564. };
  7565. function stringInputToObject(color) {
  7566. color = color.trim().toLowerCase();
  7567. if (color.length === 0) {
  7568. return false;
  7569. }
  7570. var named = false;
  7571. if (names[color]) {
  7572. color = names[color];
  7573. named = true;
  7574. } else if (color === "transparent") {
  7575. return { r: 0, g: 0, b: 0, a: 0, format: "name" };
  7576. }
  7577. var match = matchers.rgb.exec(color);
  7578. if (match) {
  7579. return { r: match[1], g: match[2], b: match[3] };
  7580. }
  7581. match = matchers.rgba.exec(color);
  7582. if (match) {
  7583. return { r: match[1], g: match[2], b: match[3], a: match[4] };
  7584. }
  7585. match = matchers.hsl.exec(color);
  7586. if (match) {
  7587. return { h: match[1], s: match[2], l: match[3] };
  7588. }
  7589. match = matchers.hsla.exec(color);
  7590. if (match) {
  7591. return { h: match[1], s: match[2], l: match[3], a: match[4] };
  7592. }
  7593. match = matchers.hsv.exec(color);
  7594. if (match) {
  7595. return { h: match[1], s: match[2], v: match[3] };
  7596. }
  7597. match = matchers.hsva.exec(color);
  7598. if (match) {
  7599. return { h: match[1], s: match[2], v: match[3], a: match[4] };
  7600. }
  7601. match = matchers.hex8.exec(color);
  7602. if (match) {
  7603. return {
  7604. r: parseIntFromHex(match[1]),
  7605. g: parseIntFromHex(match[2]),
  7606. b: parseIntFromHex(match[3]),
  7607. a: convertHexToDecimal(match[4]),
  7608. format: named ? "name" : "hex8"
  7609. };
  7610. }
  7611. match = matchers.hex6.exec(color);
  7612. if (match) {
  7613. return {
  7614. r: parseIntFromHex(match[1]),
  7615. g: parseIntFromHex(match[2]),
  7616. b: parseIntFromHex(match[3]),
  7617. format: named ? "name" : "hex"
  7618. };
  7619. }
  7620. match = matchers.hex4.exec(color);
  7621. if (match) {
  7622. return {
  7623. r: parseIntFromHex(match[1] + match[1]),
  7624. g: parseIntFromHex(match[2] + match[2]),
  7625. b: parseIntFromHex(match[3] + match[3]),
  7626. a: convertHexToDecimal(match[4] + match[4]),
  7627. format: named ? "name" : "hex8"
  7628. };
  7629. }
  7630. match = matchers.hex3.exec(color);
  7631. if (match) {
  7632. return {
  7633. r: parseIntFromHex(match[1] + match[1]),
  7634. g: parseIntFromHex(match[2] + match[2]),
  7635. b: parseIntFromHex(match[3] + match[3]),
  7636. format: named ? "name" : "hex"
  7637. };
  7638. }
  7639. return false;
  7640. }
  7641. function isValidCSSUnit(color) {
  7642. return Boolean(matchers.CSS_UNIT.exec(String(color)));
  7643. }
  7644. var TinyColor = function() {
  7645. function TinyColor2(color, opts) {
  7646. if (color === void 0) {
  7647. color = "";
  7648. }
  7649. if (opts === void 0) {
  7650. opts = {};
  7651. }
  7652. var _a2;
  7653. if (color instanceof TinyColor2) {
  7654. return color;
  7655. }
  7656. if (typeof color === "number") {
  7657. color = numberInputToObject(color);
  7658. }
  7659. this.originalInput = color;
  7660. var rgb = inputToRGB(color);
  7661. this.originalInput = color;
  7662. this.r = rgb.r;
  7663. this.g = rgb.g;
  7664. this.b = rgb.b;
  7665. this.a = rgb.a;
  7666. this.roundA = Math.round(100 * this.a) / 100;
  7667. this.format = (_a2 = opts.format) !== null && _a2 !== void 0 ? _a2 : rgb.format;
  7668. this.gradientType = opts.gradientType;
  7669. if (this.r < 1) {
  7670. this.r = Math.round(this.r);
  7671. }
  7672. if (this.g < 1) {
  7673. this.g = Math.round(this.g);
  7674. }
  7675. if (this.b < 1) {
  7676. this.b = Math.round(this.b);
  7677. }
  7678. this.isValid = rgb.ok;
  7679. }
  7680. TinyColor2.prototype.isDark = function() {
  7681. return this.getBrightness() < 128;
  7682. };
  7683. TinyColor2.prototype.isLight = function() {
  7684. return !this.isDark();
  7685. };
  7686. TinyColor2.prototype.getBrightness = function() {
  7687. var rgb = this.toRgb();
  7688. return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
  7689. };
  7690. TinyColor2.prototype.getLuminance = function() {
  7691. var rgb = this.toRgb();
  7692. var R;
  7693. var G;
  7694. var B;
  7695. var RsRGB = rgb.r / 255;
  7696. var GsRGB = rgb.g / 255;
  7697. var BsRGB = rgb.b / 255;
  7698. if (RsRGB <= 0.03928) {
  7699. R = RsRGB / 12.92;
  7700. } else {
  7701. R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
  7702. }
  7703. if (GsRGB <= 0.03928) {
  7704. G = GsRGB / 12.92;
  7705. } else {
  7706. G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
  7707. }
  7708. if (BsRGB <= 0.03928) {
  7709. B = BsRGB / 12.92;
  7710. } else {
  7711. B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
  7712. }
  7713. return 0.2126 * R + 0.7152 * G + 0.0722 * B;
  7714. };
  7715. TinyColor2.prototype.getAlpha = function() {
  7716. return this.a;
  7717. };
  7718. TinyColor2.prototype.setAlpha = function(alpha) {
  7719. this.a = boundAlpha(alpha);
  7720. this.roundA = Math.round(100 * this.a) / 100;
  7721. return this;
  7722. };
  7723. TinyColor2.prototype.toHsv = function() {
  7724. var hsv = rgbToHsv(this.r, this.g, this.b);
  7725. return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this.a };
  7726. };
  7727. TinyColor2.prototype.toHsvString = function() {
  7728. var hsv = rgbToHsv(this.r, this.g, this.b);
  7729. var h2 = Math.round(hsv.h * 360);
  7730. var s2 = Math.round(hsv.s * 100);
  7731. var v2 = Math.round(hsv.v * 100);
  7732. return this.a === 1 ? "hsv(".concat(h2, ", ").concat(s2, "%, ").concat(v2, "%)") : "hsva(".concat(h2, ", ").concat(s2, "%, ").concat(v2, "%, ").concat(this.roundA, ")");
  7733. };
  7734. TinyColor2.prototype.toHsl = function() {
  7735. var hsl = rgbToHsl(this.r, this.g, this.b);
  7736. return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this.a };
  7737. };
  7738. TinyColor2.prototype.toHslString = function() {
  7739. var hsl = rgbToHsl(this.r, this.g, this.b);
  7740. var h2 = Math.round(hsl.h * 360);
  7741. var s2 = Math.round(hsl.s * 100);
  7742. var l2 = Math.round(hsl.l * 100);
  7743. return this.a === 1 ? "hsl(".concat(h2, ", ").concat(s2, "%, ").concat(l2, "%)") : "hsla(".concat(h2, ", ").concat(s2, "%, ").concat(l2, "%, ").concat(this.roundA, ")");
  7744. };
  7745. TinyColor2.prototype.toHex = function(allow3Char) {
  7746. if (allow3Char === void 0) {
  7747. allow3Char = false;
  7748. }
  7749. return rgbToHex(this.r, this.g, this.b, allow3Char);
  7750. };
  7751. TinyColor2.prototype.toHexString = function(allow3Char) {
  7752. if (allow3Char === void 0) {
  7753. allow3Char = false;
  7754. }
  7755. return "#" + this.toHex(allow3Char);
  7756. };
  7757. TinyColor2.prototype.toHex8 = function(allow4Char) {
  7758. if (allow4Char === void 0) {
  7759. allow4Char = false;
  7760. }
  7761. return rgbaToHex(this.r, this.g, this.b, this.a, allow4Char);
  7762. };
  7763. TinyColor2.prototype.toHex8String = function(allow4Char) {
  7764. if (allow4Char === void 0) {
  7765. allow4Char = false;
  7766. }
  7767. return "#" + this.toHex8(allow4Char);
  7768. };
  7769. TinyColor2.prototype.toRgb = function() {
  7770. return {
  7771. r: Math.round(this.r),
  7772. g: Math.round(this.g),
  7773. b: Math.round(this.b),
  7774. a: this.a
  7775. };
  7776. };
  7777. TinyColor2.prototype.toRgbString = function() {
  7778. var r = Math.round(this.r);
  7779. var g = Math.round(this.g);
  7780. var b2 = Math.round(this.b);
  7781. return this.a === 1 ? "rgb(".concat(r, ", ").concat(g, ", ").concat(b2, ")") : "rgba(".concat(r, ", ").concat(g, ", ").concat(b2, ", ").concat(this.roundA, ")");
  7782. };
  7783. TinyColor2.prototype.toPercentageRgb = function() {
  7784. var fmt = function(x2) {
  7785. return "".concat(Math.round(bound01(x2, 255) * 100), "%");
  7786. };
  7787. return {
  7788. r: fmt(this.r),
  7789. g: fmt(this.g),
  7790. b: fmt(this.b),
  7791. a: this.a
  7792. };
  7793. };
  7794. TinyColor2.prototype.toPercentageRgbString = function() {
  7795. var rnd = function(x2) {
  7796. return Math.round(bound01(x2, 255) * 100);
  7797. };
  7798. return this.a === 1 ? "rgb(".concat(rnd(this.r), "%, ").concat(rnd(this.g), "%, ").concat(rnd(this.b), "%)") : "rgba(".concat(rnd(this.r), "%, ").concat(rnd(this.g), "%, ").concat(rnd(this.b), "%, ").concat(this.roundA, ")");
  7799. };
  7800. TinyColor2.prototype.toName = function() {
  7801. if (this.a === 0) {
  7802. return "transparent";
  7803. }
  7804. if (this.a < 1) {
  7805. return false;
  7806. }
  7807. var hex2 = "#" + rgbToHex(this.r, this.g, this.b, false);
  7808. for (var _i = 0, _a2 = Object.entries(names); _i < _a2.length; _i++) {
  7809. var _b2 = _a2[_i], key = _b2[0], value = _b2[1];
  7810. if (hex2 === value) {
  7811. return key;
  7812. }
  7813. }
  7814. return false;
  7815. };
  7816. TinyColor2.prototype.toString = function(format2) {
  7817. var formatSet = Boolean(format2);
  7818. format2 = format2 !== null && format2 !== void 0 ? format2 : this.format;
  7819. var formattedString = false;
  7820. var hasAlpha = this.a < 1 && this.a >= 0;
  7821. var needsAlphaFormat = !formatSet && hasAlpha && (format2.startsWith("hex") || format2 === "name");
  7822. if (needsAlphaFormat) {
  7823. if (format2 === "name" && this.a === 0) {
  7824. return this.toName();
  7825. }
  7826. return this.toRgbString();
  7827. }
  7828. if (format2 === "rgb") {
  7829. formattedString = this.toRgbString();
  7830. }
  7831. if (format2 === "prgb") {
  7832. formattedString = this.toPercentageRgbString();
  7833. }
  7834. if (format2 === "hex" || format2 === "hex6") {
  7835. formattedString = this.toHexString();
  7836. }
  7837. if (format2 === "hex3") {
  7838. formattedString = this.toHexString(true);
  7839. }
  7840. if (format2 === "hex4") {
  7841. formattedString = this.toHex8String(true);
  7842. }
  7843. if (format2 === "hex8") {
  7844. formattedString = this.toHex8String();
  7845. }
  7846. if (format2 === "name") {
  7847. formattedString = this.toName();
  7848. }
  7849. if (format2 === "hsl") {
  7850. formattedString = this.toHslString();
  7851. }
  7852. if (format2 === "hsv") {
  7853. formattedString = this.toHsvString();
  7854. }
  7855. return formattedString || this.toHexString();
  7856. };
  7857. TinyColor2.prototype.toNumber = function() {
  7858. return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
  7859. };
  7860. TinyColor2.prototype.clone = function() {
  7861. return new TinyColor2(this.toString());
  7862. };
  7863. TinyColor2.prototype.lighten = function(amount) {
  7864. if (amount === void 0) {
  7865. amount = 10;
  7866. }
  7867. var hsl = this.toHsl();
  7868. hsl.l += amount / 100;
  7869. hsl.l = clamp01(hsl.l);
  7870. return new TinyColor2(hsl);
  7871. };
  7872. TinyColor2.prototype.brighten = function(amount) {
  7873. if (amount === void 0) {
  7874. amount = 10;
  7875. }
  7876. var rgb = this.toRgb();
  7877. rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
  7878. rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
  7879. rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
  7880. return new TinyColor2(rgb);
  7881. };
  7882. TinyColor2.prototype.darken = function(amount) {
  7883. if (amount === void 0) {
  7884. amount = 10;
  7885. }
  7886. var hsl = this.toHsl();
  7887. hsl.l -= amount / 100;
  7888. hsl.l = clamp01(hsl.l);
  7889. return new TinyColor2(hsl);
  7890. };
  7891. TinyColor2.prototype.tint = function(amount) {
  7892. if (amount === void 0) {
  7893. amount = 10;
  7894. }
  7895. return this.mix("white", amount);
  7896. };
  7897. TinyColor2.prototype.shade = function(amount) {
  7898. if (amount === void 0) {
  7899. amount = 10;
  7900. }
  7901. return this.mix("black", amount);
  7902. };
  7903. TinyColor2.prototype.desaturate = function(amount) {
  7904. if (amount === void 0) {
  7905. amount = 10;
  7906. }
  7907. var hsl = this.toHsl();
  7908. hsl.s -= amount / 100;
  7909. hsl.s = clamp01(hsl.s);
  7910. return new TinyColor2(hsl);
  7911. };
  7912. TinyColor2.prototype.saturate = function(amount) {
  7913. if (amount === void 0) {
  7914. amount = 10;
  7915. }
  7916. var hsl = this.toHsl();
  7917. hsl.s += amount / 100;
  7918. hsl.s = clamp01(hsl.s);
  7919. return new TinyColor2(hsl);
  7920. };
  7921. TinyColor2.prototype.greyscale = function() {
  7922. return this.desaturate(100);
  7923. };
  7924. TinyColor2.prototype.spin = function(amount) {
  7925. var hsl = this.toHsl();
  7926. var hue = (hsl.h + amount) % 360;
  7927. hsl.h = hue < 0 ? 360 + hue : hue;
  7928. return new TinyColor2(hsl);
  7929. };
  7930. TinyColor2.prototype.mix = function(color, amount) {
  7931. if (amount === void 0) {
  7932. amount = 50;
  7933. }
  7934. var rgb1 = this.toRgb();
  7935. var rgb2 = new TinyColor2(color).toRgb();
  7936. var p2 = amount / 100;
  7937. var rgba = {
  7938. r: (rgb2.r - rgb1.r) * p2 + rgb1.r,
  7939. g: (rgb2.g - rgb1.g) * p2 + rgb1.g,
  7940. b: (rgb2.b - rgb1.b) * p2 + rgb1.b,
  7941. a: (rgb2.a - rgb1.a) * p2 + rgb1.a
  7942. };
  7943. return new TinyColor2(rgba);
  7944. };
  7945. TinyColor2.prototype.analogous = function(results, slices) {
  7946. if (results === void 0) {
  7947. results = 6;
  7948. }
  7949. if (slices === void 0) {
  7950. slices = 30;
  7951. }
  7952. var hsl = this.toHsl();
  7953. var part = 360 / slices;
  7954. var ret = [this];
  7955. for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) {
  7956. hsl.h = (hsl.h + part) % 360;
  7957. ret.push(new TinyColor2(hsl));
  7958. }
  7959. return ret;
  7960. };
  7961. TinyColor2.prototype.complement = function() {
  7962. var hsl = this.toHsl();
  7963. hsl.h = (hsl.h + 180) % 360;
  7964. return new TinyColor2(hsl);
  7965. };
  7966. TinyColor2.prototype.monochromatic = function(results) {
  7967. if (results === void 0) {
  7968. results = 6;
  7969. }
  7970. var hsv = this.toHsv();
  7971. var h2 = hsv.h;
  7972. var s2 = hsv.s;
  7973. var v2 = hsv.v;
  7974. var res = [];
  7975. var modification = 1 / results;
  7976. while (results--) {
  7977. res.push(new TinyColor2({ h: h2, s: s2, v: v2 }));
  7978. v2 = (v2 + modification) % 1;
  7979. }
  7980. return res;
  7981. };
  7982. TinyColor2.prototype.splitcomplement = function() {
  7983. var hsl = this.toHsl();
  7984. var h2 = hsl.h;
  7985. return [
  7986. this,
  7987. new TinyColor2({ h: (h2 + 72) % 360, s: hsl.s, l: hsl.l }),
  7988. new TinyColor2({ h: (h2 + 216) % 360, s: hsl.s, l: hsl.l })
  7989. ];
  7990. };
  7991. TinyColor2.prototype.onBackground = function(background) {
  7992. var fg = this.toRgb();
  7993. var bg = new TinyColor2(background).toRgb();
  7994. return new TinyColor2({
  7995. r: bg.r + (fg.r - bg.r) * fg.a,
  7996. g: bg.g + (fg.g - bg.g) * fg.a,
  7997. b: bg.b + (fg.b - bg.b) * fg.a
  7998. });
  7999. };
  8000. TinyColor2.prototype.triad = function() {
  8001. return this.polyad(3);
  8002. };
  8003. TinyColor2.prototype.tetrad = function() {
  8004. return this.polyad(4);
  8005. };
  8006. TinyColor2.prototype.polyad = function(n) {
  8007. var hsl = this.toHsl();
  8008. var h2 = hsl.h;
  8009. var result = [this];
  8010. var increment = 360 / n;
  8011. for (var i = 1; i < n; i++) {
  8012. result.push(new TinyColor2({ h: (h2 + i * increment) % 360, s: hsl.s, l: hsl.l }));
  8013. }
  8014. return result;
  8015. };
  8016. TinyColor2.prototype.equals = function(color) {
  8017. return this.toRgbString() === new TinyColor2(color).toRgbString();
  8018. };
  8019. return TinyColor2;
  8020. }();
  8021. function darken(color, amount = 20) {
  8022. return color.mix("#141414", amount).toString();
  8023. }
  8024. function useButtonCustomStyle(props) {
  8025. const _disabled = useDisabled$1();
  8026. return computed(() => {
  8027. let styles = {};
  8028. const buttonColor = props.color;
  8029. if (buttonColor) {
  8030. const color = new TinyColor(buttonColor);
  8031. const activeBgColor = props.dark ? color.tint(20).toString() : darken(color, 20);
  8032. if (props.plain) {
  8033. styles = {
  8034. "--el-button-bg-color": props.dark ? darken(color, 90) : color.tint(90).toString(),
  8035. "--el-button-text-color": buttonColor,
  8036. "--el-button-border-color": props.dark ? darken(color, 50) : color.tint(50).toString(),
  8037. "--el-button-hover-text-color": "var(--el-color-white)",
  8038. "--el-button-hover-bg-color": buttonColor,
  8039. "--el-button-hover-border-color": buttonColor,
  8040. "--el-button-active-bg-color": activeBgColor,
  8041. "--el-button-active-text-color": "var(--el-color-white)",
  8042. "--el-button-active-border-color": activeBgColor
  8043. };
  8044. if (_disabled.value) {
  8045. styles["--el-button-disabled-bg-color"] = props.dark ? darken(color, 90) : color.tint(90).toString();
  8046. styles["--el-button-disabled-text-color"] = props.dark ? darken(color, 50) : color.tint(50).toString();
  8047. styles["--el-button-disabled-border-color"] = props.dark ? darken(color, 80) : color.tint(80).toString();
  8048. }
  8049. } else {
  8050. const hoverBgColor = props.dark ? darken(color, 30) : color.tint(30).toString();
  8051. const textColor = color.isDark() ? "var(--el-color-white)" : "var(--el-color-black)";
  8052. styles = {
  8053. "--el-button-bg-color": buttonColor,
  8054. "--el-button-text-color": textColor,
  8055. "--el-button-border-color": buttonColor,
  8056. "--el-button-hover-bg-color": hoverBgColor,
  8057. "--el-button-hover-text-color": textColor,
  8058. "--el-button-hover-border-color": hoverBgColor,
  8059. "--el-button-active-bg-color": activeBgColor,
  8060. "--el-button-active-border-color": activeBgColor
  8061. };
  8062. if (_disabled.value) {
  8063. const disabledButtonColor = props.dark ? darken(color, 50) : color.tint(50).toString();
  8064. styles["--el-button-disabled-bg-color"] = disabledButtonColor;
  8065. styles["--el-button-disabled-text-color"] = props.dark ? "rgba(255, 255, 255, 0.5)" : "var(--el-color-white)";
  8066. styles["--el-button-disabled-border-color"] = disabledButtonColor;
  8067. }
  8068. }
  8069. }
  8070. return styles;
  8071. });
  8072. }
  8073. const _hoisted_1$B = ["disabled", "autofocus", "type"];
  8074. const __default__$f = {
  8075. name: "ElButton"
  8076. };
  8077. const _sfc_main$V = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$f), {
  8078. props: buttonProps,
  8079. emits: buttonEmits,
  8080. setup(__props, { expose, emit }) {
  8081. const props = __props;
  8082. const slots = useSlots();
  8083. const buttonGroupContext = inject(buttonGroupContextKey, void 0);
  8084. const globalConfig2 = useGlobalConfig("button");
  8085. const ns = useNamespace("button");
  8086. const { form } = useFormItem();
  8087. const _size = useSize(computed(() => buttonGroupContext == null ? void 0 : buttonGroupContext.size));
  8088. const _disabled = useDisabled$1();
  8089. const _ref = ref();
  8090. const _type = computed(() => props.type || (buttonGroupContext == null ? void 0 : buttonGroupContext.type) || "");
  8091. const autoInsertSpace = computed(() => {
  8092. var _a2, _b2, _c;
  8093. return (_c = (_b2 = props.autoInsertSpace) != null ? _b2 : (_a2 = globalConfig2.value) == null ? void 0 : _a2.autoInsertSpace) != null ? _c : false;
  8094. });
  8095. const shouldAddSpace = computed(() => {
  8096. var _a2;
  8097. const defaultSlot = (_a2 = slots.default) == null ? void 0 : _a2.call(slots);
  8098. if (autoInsertSpace.value && (defaultSlot == null ? void 0 : defaultSlot.length) === 1) {
  8099. const slot = defaultSlot[0];
  8100. if ((slot == null ? void 0 : slot.type) === Text) {
  8101. const text = slot.children;
  8102. return /^\p{Unified_Ideograph}{2}$/u.test(text.trim());
  8103. }
  8104. }
  8105. return false;
  8106. });
  8107. const buttonStyle = useButtonCustomStyle(props);
  8108. const handleClick = (evt) => {
  8109. if (props.nativeType === "reset") {
  8110. form == null ? void 0 : form.resetFields();
  8111. }
  8112. emit("click", evt);
  8113. };
  8114. expose({
  8115. ref: _ref,
  8116. size: _size,
  8117. type: _type,
  8118. disabled: _disabled,
  8119. shouldAddSpace
  8120. });
  8121. return (_ctx, _cache) => {
  8122. return openBlock(), createElementBlock("button", {
  8123. ref_key: "_ref",
  8124. ref: _ref,
  8125. class: normalizeClass([
  8126. unref(ns).b(),
  8127. unref(ns).m(unref(_type)),
  8128. unref(ns).m(unref(_size)),
  8129. unref(ns).is("disabled", unref(_disabled)),
  8130. unref(ns).is("loading", _ctx.loading),
  8131. unref(ns).is("plain", _ctx.plain),
  8132. unref(ns).is("round", _ctx.round),
  8133. unref(ns).is("circle", _ctx.circle)
  8134. ]),
  8135. disabled: unref(_disabled) || _ctx.loading,
  8136. autofocus: _ctx.autofocus,
  8137. type: _ctx.nativeType,
  8138. style: normalizeStyle(unref(buttonStyle)),
  8139. onClick: handleClick
  8140. }, [
  8141. _ctx.loading ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  8142. _ctx.$slots.loading ? renderSlot(_ctx.$slots, "loading", { key: 0 }) : (openBlock(), createBlock(unref(ElIcon), {
  8143. key: 1,
  8144. class: normalizeClass(unref(ns).is("loading"))
  8145. }, {
  8146. default: withCtx(() => [
  8147. (openBlock(), createBlock(resolveDynamicComponent(_ctx.loadingIcon)))
  8148. ]),
  8149. _: 1
  8150. }, 8, ["class"]))
  8151. ], 2112)) : _ctx.icon || _ctx.$slots.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
  8152. default: withCtx(() => [
  8153. _ctx.icon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon), { key: 0 })) : renderSlot(_ctx.$slots, "icon", { key: 1 })
  8154. ]),
  8155. _: 3
  8156. })) : createCommentVNode("v-if", true),
  8157. _ctx.$slots.default ? (openBlock(), createElementBlock("span", {
  8158. key: 2,
  8159. class: normalizeClass({ [unref(ns).em("text", "expand")]: unref(shouldAddSpace) })
  8160. }, [
  8161. renderSlot(_ctx.$slots, "default")
  8162. ], 2)) : createCommentVNode("v-if", true)
  8163. ], 14, _hoisted_1$B);
  8164. };
  8165. }
  8166. }));
  8167. var Button = /* @__PURE__ */ _export_sfc$1(_sfc_main$V, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/button/src/button.vue"]]);
  8168. const buttonGroupProps = {
  8169. size: buttonProps.size,
  8170. type: buttonProps.type
  8171. };
  8172. const __default__$e = {
  8173. name: "ElButtonGroup"
  8174. };
  8175. const _sfc_main$U = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$e), {
  8176. props: buttonGroupProps,
  8177. setup(__props) {
  8178. const props = __props;
  8179. provide(buttonGroupContextKey, reactive({
  8180. size: toRef(props, "size"),
  8181. type: toRef(props, "type")
  8182. }));
  8183. const ns = useNamespace("button");
  8184. return (_ctx, _cache) => {
  8185. return openBlock(), createElementBlock("div", {
  8186. class: normalizeClass(`${unref(ns).b("group")}`)
  8187. }, [
  8188. renderSlot(_ctx.$slots, "default")
  8189. ], 2);
  8190. };
  8191. }
  8192. }));
  8193. var ButtonGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$U, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/button/src/button-group.vue"]]);
  8194. const ElButton = withInstall(Button, {
  8195. ButtonGroup
  8196. });
  8197. withNoopInstall(ButtonGroup);
  8198. var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  8199. var dayjs_min = { exports: {} };
  8200. (function(module2, exports2) {
  8201. !function(t, e) {
  8202. module2.exports = e();
  8203. }(commonjsGlobal, function() {
  8204. var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s2 = "minute", u2 = "hour", a2 = "day", o2 = "week", c2 = "month", f2 = "quarter", h2 = "year", d2 = "date", l2 = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M2 = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t2) {
  8205. var e2 = ["th", "st", "nd", "rd"], n2 = t2 % 100;
  8206. return "[" + t2 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
  8207. } }, m2 = function(t2, e2, n2) {
  8208. var r2 = String(t2);
  8209. return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
  8210. }, v2 = { s: m2, z: function(t2) {
  8211. var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
  8212. return (e2 <= 0 ? "+" : "-") + m2(r2, 2, "0") + ":" + m2(i2, 2, "0");
  8213. }, m: function t2(e2, n2) {
  8214. if (e2.date() < n2.date())
  8215. return -t2(n2, e2);
  8216. var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r2, c2), s3 = n2 - i2 < 0, u3 = e2.clone().add(r2 + (s3 ? -1 : 1), c2);
  8217. return +(-(r2 + (n2 - i2) / (s3 ? i2 - u3 : u3 - i2)) || 0);
  8218. }, a: function(t2) {
  8219. return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
  8220. }, p: function(t2) {
  8221. return { M: c2, y: h2, w: o2, d: a2, D: d2, h: u2, m: s2, s: i, ms: r, Q: f2 }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
  8222. }, u: function(t2) {
  8223. return t2 === void 0;
  8224. } }, g = "en", D2 = {};
  8225. D2[g] = M2;
  8226. var p2 = "$isDayjsObject", S2 = function(t2) {
  8227. return t2 instanceof _2 || !(!t2 || !t2[p2]);
  8228. }, w2 = function t2(e2, n2, r2) {
  8229. var i2;
  8230. if (!e2)
  8231. return g;
  8232. if (typeof e2 == "string") {
  8233. var s3 = e2.toLowerCase();
  8234. D2[s3] && (i2 = s3), n2 && (D2[s3] = n2, i2 = s3);
  8235. var u3 = e2.split("-");
  8236. if (!i2 && u3.length > 1)
  8237. return t2(u3[0]);
  8238. } else {
  8239. var a3 = e2.name;
  8240. D2[a3] = e2, i2 = a3;
  8241. }
  8242. return !r2 && i2 && (g = i2), i2 || !r2 && g;
  8243. }, O2 = function(t2, e2) {
  8244. if (S2(t2))
  8245. return t2.clone();
  8246. var n2 = typeof e2 == "object" ? e2 : {};
  8247. return n2.date = t2, n2.args = arguments, new _2(n2);
  8248. }, b2 = v2;
  8249. b2.l = w2, b2.i = S2, b2.w = function(t2, e2) {
  8250. return O2(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
  8251. };
  8252. var _2 = function() {
  8253. function M3(t2) {
  8254. this.$L = w2(t2.locale, null, true), this.parse(t2), this.$x = this.$x || t2.x || {}, this[p2] = true;
  8255. }
  8256. var m3 = M3.prototype;
  8257. return m3.parse = function(t2) {
  8258. this.$d = function(t3) {
  8259. var e2 = t3.date, n2 = t3.utc;
  8260. if (e2 === null)
  8261. return new Date(NaN);
  8262. if (b2.u(e2))
  8263. return new Date();
  8264. if (e2 instanceof Date)
  8265. return new Date(e2);
  8266. if (typeof e2 == "string" && !/Z$/i.test(e2)) {
  8267. var r2 = e2.match($);
  8268. if (r2) {
  8269. var i2 = r2[2] - 1 || 0, s3 = (r2[7] || "0").substring(0, 3);
  8270. return n2 ? new Date(Date.UTC(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s3)) : new Date(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s3);
  8271. }
  8272. }
  8273. return new Date(e2);
  8274. }(t2), this.init();
  8275. }, m3.init = function() {
  8276. var t2 = this.$d;
  8277. this.$y = t2.getFullYear(), this.$M = t2.getMonth(), this.$D = t2.getDate(), this.$W = t2.getDay(), this.$H = t2.getHours(), this.$m = t2.getMinutes(), this.$s = t2.getSeconds(), this.$ms = t2.getMilliseconds();
  8278. }, m3.$utils = function() {
  8279. return b2;
  8280. }, m3.isValid = function() {
  8281. return !(this.$d.toString() === l2);
  8282. }, m3.isSame = function(t2, e2) {
  8283. var n2 = O2(t2);
  8284. return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
  8285. }, m3.isAfter = function(t2, e2) {
  8286. return O2(t2) < this.startOf(e2);
  8287. }, m3.isBefore = function(t2, e2) {
  8288. return this.endOf(e2) < O2(t2);
  8289. }, m3.$g = function(t2, e2, n2) {
  8290. return b2.u(t2) ? this[e2] : this.set(n2, t2);
  8291. }, m3.unix = function() {
  8292. return Math.floor(this.valueOf() / 1e3);
  8293. }, m3.valueOf = function() {
  8294. return this.$d.getTime();
  8295. }, m3.startOf = function(t2, e2) {
  8296. var n2 = this, r2 = !!b2.u(e2) || e2, f3 = b2.p(t2), l3 = function(t3, e3) {
  8297. var i2 = b2.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
  8298. return r2 ? i2 : i2.endOf(a2);
  8299. }, $2 = function(t3, e3) {
  8300. return b2.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
  8301. }, y2 = this.$W, M4 = this.$M, m4 = this.$D, v3 = "set" + (this.$u ? "UTC" : "");
  8302. switch (f3) {
  8303. case h2:
  8304. return r2 ? l3(1, 0) : l3(31, 11);
  8305. case c2:
  8306. return r2 ? l3(1, M4) : l3(0, M4 + 1);
  8307. case o2:
  8308. var g2 = this.$locale().weekStart || 0, D3 = (y2 < g2 ? y2 + 7 : y2) - g2;
  8309. return l3(r2 ? m4 - D3 : m4 + (6 - D3), M4);
  8310. case a2:
  8311. case d2:
  8312. return $2(v3 + "Hours", 0);
  8313. case u2:
  8314. return $2(v3 + "Minutes", 1);
  8315. case s2:
  8316. return $2(v3 + "Seconds", 2);
  8317. case i:
  8318. return $2(v3 + "Milliseconds", 3);
  8319. default:
  8320. return this.clone();
  8321. }
  8322. }, m3.endOf = function(t2) {
  8323. return this.startOf(t2, false);
  8324. }, m3.$set = function(t2, e2) {
  8325. var n2, o3 = b2.p(t2), f3 = "set" + (this.$u ? "UTC" : ""), l3 = (n2 = {}, n2[a2] = f3 + "Date", n2[d2] = f3 + "Date", n2[c2] = f3 + "Month", n2[h2] = f3 + "FullYear", n2[u2] = f3 + "Hours", n2[s2] = f3 + "Minutes", n2[i] = f3 + "Seconds", n2[r] = f3 + "Milliseconds", n2)[o3], $2 = o3 === a2 ? this.$D + (e2 - this.$W) : e2;
  8326. if (o3 === c2 || o3 === h2) {
  8327. var y2 = this.clone().set(d2, 1);
  8328. y2.$d[l3]($2), y2.init(), this.$d = y2.set(d2, Math.min(this.$D, y2.daysInMonth())).$d;
  8329. } else
  8330. l3 && this.$d[l3]($2);
  8331. return this.init(), this;
  8332. }, m3.set = function(t2, e2) {
  8333. return this.clone().$set(t2, e2);
  8334. }, m3.get = function(t2) {
  8335. return this[b2.p(t2)]();
  8336. }, m3.add = function(r2, f3) {
  8337. var d3, l3 = this;
  8338. r2 = Number(r2);
  8339. var $2 = b2.p(f3), y2 = function(t2) {
  8340. var e2 = O2(l3);
  8341. return b2.w(e2.date(e2.date() + Math.round(t2 * r2)), l3);
  8342. };
  8343. if ($2 === c2)
  8344. return this.set(c2, this.$M + r2);
  8345. if ($2 === h2)
  8346. return this.set(h2, this.$y + r2);
  8347. if ($2 === a2)
  8348. return y2(1);
  8349. if ($2 === o2)
  8350. return y2(7);
  8351. var M4 = (d3 = {}, d3[s2] = e, d3[u2] = n, d3[i] = t, d3)[$2] || 1, m4 = this.$d.getTime() + r2 * M4;
  8352. return b2.w(m4, this);
  8353. }, m3.subtract = function(t2, e2) {
  8354. return this.add(-1 * t2, e2);
  8355. }, m3.format = function(t2) {
  8356. var e2 = this, n2 = this.$locale();
  8357. if (!this.isValid())
  8358. return n2.invalidDate || l2;
  8359. var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = b2.z(this), s3 = this.$H, u3 = this.$m, a3 = this.$M, o3 = n2.weekdays, c3 = n2.months, f3 = n2.meridiem, h3 = function(t3, n3, i3, s4) {
  8360. return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s4);
  8361. }, d3 = function(t3) {
  8362. return b2.s(s3 % 12 || 12, t3, "0");
  8363. }, $2 = f3 || function(t3, e3, n3) {
  8364. var r3 = t3 < 12 ? "AM" : "PM";
  8365. return n3 ? r3.toLowerCase() : r3;
  8366. };
  8367. return r2.replace(y, function(t3, r3) {
  8368. return r3 || function(t4) {
  8369. switch (t4) {
  8370. case "YY":
  8371. return String(e2.$y).slice(-2);
  8372. case "YYYY":
  8373. return b2.s(e2.$y, 4, "0");
  8374. case "M":
  8375. return a3 + 1;
  8376. case "MM":
  8377. return b2.s(a3 + 1, 2, "0");
  8378. case "MMM":
  8379. return h3(n2.monthsShort, a3, c3, 3);
  8380. case "MMMM":
  8381. return h3(c3, a3);
  8382. case "D":
  8383. return e2.$D;
  8384. case "DD":
  8385. return b2.s(e2.$D, 2, "0");
  8386. case "d":
  8387. return String(e2.$W);
  8388. case "dd":
  8389. return h3(n2.weekdaysMin, e2.$W, o3, 2);
  8390. case "ddd":
  8391. return h3(n2.weekdaysShort, e2.$W, o3, 3);
  8392. case "dddd":
  8393. return o3[e2.$W];
  8394. case "H":
  8395. return String(s3);
  8396. case "HH":
  8397. return b2.s(s3, 2, "0");
  8398. case "h":
  8399. return d3(1);
  8400. case "hh":
  8401. return d3(2);
  8402. case "a":
  8403. return $2(s3, u3, true);
  8404. case "A":
  8405. return $2(s3, u3, false);
  8406. case "m":
  8407. return String(u3);
  8408. case "mm":
  8409. return b2.s(u3, 2, "0");
  8410. case "s":
  8411. return String(e2.$s);
  8412. case "ss":
  8413. return b2.s(e2.$s, 2, "0");
  8414. case "SSS":
  8415. return b2.s(e2.$ms, 3, "0");
  8416. case "Z":
  8417. return i2;
  8418. }
  8419. return null;
  8420. }(t3) || i2.replace(":", "");
  8421. });
  8422. }, m3.utcOffset = function() {
  8423. return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
  8424. }, m3.diff = function(r2, d3, l3) {
  8425. var $2, y2 = this, M4 = b2.p(d3), m4 = O2(r2), v3 = (m4.utcOffset() - this.utcOffset()) * e, g2 = this - m4, D3 = function() {
  8426. return b2.m(y2, m4);
  8427. };
  8428. switch (M4) {
  8429. case h2:
  8430. $2 = D3() / 12;
  8431. break;
  8432. case c2:
  8433. $2 = D3();
  8434. break;
  8435. case f2:
  8436. $2 = D3() / 3;
  8437. break;
  8438. case o2:
  8439. $2 = (g2 - v3) / 6048e5;
  8440. break;
  8441. case a2:
  8442. $2 = (g2 - v3) / 864e5;
  8443. break;
  8444. case u2:
  8445. $2 = g2 / n;
  8446. break;
  8447. case s2:
  8448. $2 = g2 / e;
  8449. break;
  8450. case i:
  8451. $2 = g2 / t;
  8452. break;
  8453. default:
  8454. $2 = g2;
  8455. }
  8456. return l3 ? $2 : b2.a($2);
  8457. }, m3.daysInMonth = function() {
  8458. return this.endOf(c2).$D;
  8459. }, m3.$locale = function() {
  8460. return D2[this.$L];
  8461. }, m3.locale = function(t2, e2) {
  8462. if (!t2)
  8463. return this.$L;
  8464. var n2 = this.clone(), r2 = w2(t2, e2, true);
  8465. return r2 && (n2.$L = r2), n2;
  8466. }, m3.clone = function() {
  8467. return b2.w(this.$d, this);
  8468. }, m3.toDate = function() {
  8469. return new Date(this.valueOf());
  8470. }, m3.toJSON = function() {
  8471. return this.isValid() ? this.toISOString() : null;
  8472. }, m3.toISOString = function() {
  8473. return this.$d.toISOString();
  8474. }, m3.toString = function() {
  8475. return this.$d.toUTCString();
  8476. }, M3;
  8477. }(), k = _2.prototype;
  8478. return O2.prototype = k, [["$ms", r], ["$s", i], ["$m", s2], ["$H", u2], ["$W", a2], ["$M", c2], ["$y", h2], ["$D", d2]].forEach(function(t2) {
  8479. k[t2[1]] = function(e2) {
  8480. return this.$g(e2, t2[0], t2[1]);
  8481. };
  8482. }), O2.extend = function(t2, e2) {
  8483. return t2.$i || (t2(e2, _2, O2), t2.$i = true), O2;
  8484. }, O2.locale = w2, O2.isDayjs = S2, O2.unix = function(t2) {
  8485. return O2(1e3 * t2);
  8486. }, O2.en = D2[g], O2.Ls = D2, O2.p = {}, O2;
  8487. });
  8488. })(dayjs_min);
  8489. var dayjs = dayjs_min.exports;
  8490. var localeData$1 = { exports: {} };
  8491. (function(module2, exports2) {
  8492. !function(n, e) {
  8493. module2.exports = e();
  8494. }(commonjsGlobal, function() {
  8495. return function(n, e, t) {
  8496. var r = e.prototype, o2 = function(n2) {
  8497. return n2 && (n2.indexOf ? n2 : n2.s);
  8498. }, u2 = function(n2, e2, t2, r2, u3) {
  8499. var i2 = n2.name ? n2 : n2.$locale(), a3 = o2(i2[e2]), s3 = o2(i2[t2]), f2 = a3 || s3.map(function(n3) {
  8500. return n3.slice(0, r2);
  8501. });
  8502. if (!u3)
  8503. return f2;
  8504. var d2 = i2.weekStart;
  8505. return f2.map(function(n3, e3) {
  8506. return f2[(e3 + (d2 || 0)) % 7];
  8507. });
  8508. }, i = function() {
  8509. return t.Ls[t.locale()];
  8510. }, a2 = function(n2, e2) {
  8511. return n2.formats[e2] || function(n3) {
  8512. return n3.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(n4, e3, t2) {
  8513. return e3 || t2.slice(1);
  8514. });
  8515. }(n2.formats[e2.toUpperCase()]);
  8516. }, s2 = function() {
  8517. var n2 = this;
  8518. return { months: function(e2) {
  8519. return e2 ? e2.format("MMMM") : u2(n2, "months");
  8520. }, monthsShort: function(e2) {
  8521. return e2 ? e2.format("MMM") : u2(n2, "monthsShort", "months", 3);
  8522. }, firstDayOfWeek: function() {
  8523. return n2.$locale().weekStart || 0;
  8524. }, weekdays: function(e2) {
  8525. return e2 ? e2.format("dddd") : u2(n2, "weekdays");
  8526. }, weekdaysMin: function(e2) {
  8527. return e2 ? e2.format("dd") : u2(n2, "weekdaysMin", "weekdays", 2);
  8528. }, weekdaysShort: function(e2) {
  8529. return e2 ? e2.format("ddd") : u2(n2, "weekdaysShort", "weekdays", 3);
  8530. }, longDateFormat: function(e2) {
  8531. return a2(n2.$locale(), e2);
  8532. }, meridiem: this.$locale().meridiem, ordinal: this.$locale().ordinal };
  8533. };
  8534. r.localeData = function() {
  8535. return s2.bind(this)();
  8536. }, t.localeData = function() {
  8537. var n2 = i();
  8538. return { firstDayOfWeek: function() {
  8539. return n2.weekStart || 0;
  8540. }, weekdays: function() {
  8541. return t.weekdays();
  8542. }, weekdaysShort: function() {
  8543. return t.weekdaysShort();
  8544. }, weekdaysMin: function() {
  8545. return t.weekdaysMin();
  8546. }, months: function() {
  8547. return t.months();
  8548. }, monthsShort: function() {
  8549. return t.monthsShort();
  8550. }, longDateFormat: function(e2) {
  8551. return a2(n2, e2);
  8552. }, meridiem: n2.meridiem, ordinal: n2.ordinal };
  8553. }, t.months = function() {
  8554. return u2(i(), "months");
  8555. }, t.monthsShort = function() {
  8556. return u2(i(), "monthsShort", "months", 3);
  8557. }, t.weekdays = function(n2) {
  8558. return u2(i(), "weekdays", null, null, n2);
  8559. }, t.weekdaysShort = function(n2) {
  8560. return u2(i(), "weekdaysShort", "weekdays", 3, n2);
  8561. }, t.weekdaysMin = function(n2) {
  8562. return u2(i(), "weekdaysMin", "weekdays", 2, n2);
  8563. };
  8564. };
  8565. });
  8566. })(localeData$1);
  8567. var localeData = localeData$1.exports;
  8568. var customParseFormat$1 = { exports: {} };
  8569. (function(module2, exports2) {
  8570. !function(e, t) {
  8571. module2.exports = t();
  8572. }(commonjsGlobal, function() {
  8573. var e = { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY h:mm A", LLLL: "dddd, MMMM D, YYYY h:mm A" }, t = /(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g, n = /\d/, r = /\d\d/, i = /\d\d?/, o2 = /\d*[^-_:/,()\s\d]+/, s2 = {}, a2 = function(e2) {
  8574. return (e2 = +e2) + (e2 > 68 ? 1900 : 2e3);
  8575. };
  8576. var f2 = function(e2) {
  8577. return function(t2) {
  8578. this[e2] = +t2;
  8579. };
  8580. }, h2 = [/[+-]\d\d:?(\d\d)?|Z/, function(e2) {
  8581. (this.zone || (this.zone = {})).offset = function(e3) {
  8582. if (!e3)
  8583. return 0;
  8584. if (e3 === "Z")
  8585. return 0;
  8586. var t2 = e3.match(/([+-]|\d\d)/g), n2 = 60 * t2[1] + (+t2[2] || 0);
  8587. return n2 === 0 ? 0 : t2[0] === "+" ? -n2 : n2;
  8588. }(e2);
  8589. }], u2 = function(e2) {
  8590. var t2 = s2[e2];
  8591. return t2 && (t2.indexOf ? t2 : t2.s.concat(t2.f));
  8592. }, d2 = function(e2, t2) {
  8593. var n2, r2 = s2.meridiem;
  8594. if (r2) {
  8595. for (var i2 = 1; i2 <= 24; i2 += 1)
  8596. if (e2.indexOf(r2(i2, 0, t2)) > -1) {
  8597. n2 = i2 > 12;
  8598. break;
  8599. }
  8600. } else
  8601. n2 = e2 === (t2 ? "pm" : "PM");
  8602. return n2;
  8603. }, c2 = { A: [o2, function(e2) {
  8604. this.afternoon = d2(e2, false);
  8605. }], a: [o2, function(e2) {
  8606. this.afternoon = d2(e2, true);
  8607. }], Q: [n, function(e2) {
  8608. this.month = 3 * (e2 - 1) + 1;
  8609. }], S: [n, function(e2) {
  8610. this.milliseconds = 100 * +e2;
  8611. }], SS: [r, function(e2) {
  8612. this.milliseconds = 10 * +e2;
  8613. }], SSS: [/\d{3}/, function(e2) {
  8614. this.milliseconds = +e2;
  8615. }], s: [i, f2("seconds")], ss: [i, f2("seconds")], m: [i, f2("minutes")], mm: [i, f2("minutes")], H: [i, f2("hours")], h: [i, f2("hours")], HH: [i, f2("hours")], hh: [i, f2("hours")], D: [i, f2("day")], DD: [r, f2("day")], Do: [o2, function(e2) {
  8616. var t2 = s2.ordinal, n2 = e2.match(/\d+/);
  8617. if (this.day = n2[0], t2)
  8618. for (var r2 = 1; r2 <= 31; r2 += 1)
  8619. t2(r2).replace(/\[|\]/g, "") === e2 && (this.day = r2);
  8620. }], w: [i, f2("week")], ww: [r, f2("week")], M: [i, f2("month")], MM: [r, f2("month")], MMM: [o2, function(e2) {
  8621. var t2 = u2("months"), n2 = (u2("monthsShort") || t2.map(function(e3) {
  8622. return e3.slice(0, 3);
  8623. })).indexOf(e2) + 1;
  8624. if (n2 < 1)
  8625. throw new Error();
  8626. this.month = n2 % 12 || n2;
  8627. }], MMMM: [o2, function(e2) {
  8628. var t2 = u2("months").indexOf(e2) + 1;
  8629. if (t2 < 1)
  8630. throw new Error();
  8631. this.month = t2 % 12 || t2;
  8632. }], Y: [/[+-]?\d+/, f2("year")], YY: [r, function(e2) {
  8633. this.year = a2(e2);
  8634. }], YYYY: [/\d{4}/, f2("year")], Z: h2, ZZ: h2 };
  8635. function l2(n2) {
  8636. var r2, i2;
  8637. r2 = n2, i2 = s2 && s2.formats;
  8638. for (var o3 = (n2 = r2.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function(t2, n3, r3) {
  8639. var o4 = r3 && r3.toUpperCase();
  8640. return n3 || i2[r3] || e[r3] || i2[o4].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(e2, t3, n4) {
  8641. return t3 || n4.slice(1);
  8642. });
  8643. })).match(t), a3 = o3.length, f3 = 0; f3 < a3; f3 += 1) {
  8644. var h3 = o3[f3], u3 = c2[h3], d3 = u3 && u3[0], l3 = u3 && u3[1];
  8645. o3[f3] = l3 ? { regex: d3, parser: l3 } : h3.replace(/^\[|\]$/g, "");
  8646. }
  8647. return function(e2) {
  8648. for (var t2 = {}, n3 = 0, r3 = 0; n3 < a3; n3 += 1) {
  8649. var i3 = o3[n3];
  8650. if (typeof i3 == "string")
  8651. r3 += i3.length;
  8652. else {
  8653. var s3 = i3.regex, f4 = i3.parser, h4 = e2.slice(r3), u4 = s3.exec(h4)[0];
  8654. f4.call(t2, u4), e2 = e2.replace(u4, "");
  8655. }
  8656. }
  8657. return function(e3) {
  8658. var t3 = e3.afternoon;
  8659. if (t3 !== void 0) {
  8660. var n4 = e3.hours;
  8661. t3 ? n4 < 12 && (e3.hours += 12) : n4 === 12 && (e3.hours = 0), delete e3.afternoon;
  8662. }
  8663. }(t2), t2;
  8664. };
  8665. }
  8666. return function(e2, t2, n2) {
  8667. n2.p.customParseFormat = true, e2 && e2.parseTwoDigitYear && (a2 = e2.parseTwoDigitYear);
  8668. var r2 = t2.prototype, i2 = r2.parse;
  8669. r2.parse = function(e3) {
  8670. var t3 = e3.date, r3 = e3.utc, o3 = e3.args;
  8671. this.$u = r3;
  8672. var a3 = o3[1];
  8673. if (typeof a3 == "string") {
  8674. var f3 = o3[2] === true, h3 = o3[3] === true, u3 = f3 || h3, d3 = o3[2];
  8675. h3 && (d3 = o3[2]), s2 = this.$locale(), !f3 && d3 && (s2 = n2.Ls[d3]), this.$d = function(e4, t4, n3, r4) {
  8676. try {
  8677. if (["x", "X"].indexOf(t4) > -1)
  8678. return new Date((t4 === "X" ? 1e3 : 1) * e4);
  8679. var i3 = l2(t4)(e4), o4 = i3.year, s3 = i3.month, a4 = i3.day, f4 = i3.hours, h4 = i3.minutes, u4 = i3.seconds, d4 = i3.milliseconds, c4 = i3.zone, m3 = i3.week, M3 = new Date(), Y2 = a4 || (o4 || s3 ? 1 : M3.getDate()), p2 = o4 || M3.getFullYear(), v2 = 0;
  8680. o4 && !s3 || (v2 = s3 > 0 ? s3 - 1 : M3.getMonth());
  8681. var D2, w2 = f4 || 0, g = h4 || 0, y = u4 || 0, L = d4 || 0;
  8682. return c4 ? new Date(Date.UTC(p2, v2, Y2, w2, g, y, L + 60 * c4.offset * 1e3)) : n3 ? new Date(Date.UTC(p2, v2, Y2, w2, g, y, L)) : (D2 = new Date(p2, v2, Y2, w2, g, y, L), m3 && (D2 = r4(D2).week(m3).toDate()), D2);
  8683. } catch (e5) {
  8684. return new Date("");
  8685. }
  8686. }(t3, a3, r3, n2), this.init(), d3 && d3 !== true && (this.$L = this.locale(d3).$L), u3 && t3 != this.format(a3) && (this.$d = new Date("")), s2 = {};
  8687. } else if (a3 instanceof Array)
  8688. for (var c3 = a3.length, m2 = 1; m2 <= c3; m2 += 1) {
  8689. o3[1] = a3[m2 - 1];
  8690. var M2 = n2.apply(this, o3);
  8691. if (M2.isValid()) {
  8692. this.$d = M2.$d, this.$L = M2.$L, this.init();
  8693. break;
  8694. }
  8695. m2 === c3 && (this.$d = new Date(""));
  8696. }
  8697. else
  8698. i2.call(this, e3);
  8699. };
  8700. };
  8701. });
  8702. })(customParseFormat$1);
  8703. var customParseFormat = customParseFormat$1.exports;
  8704. const DEFAULT_FORMATS_TIME = "HH:mm:ss";
  8705. const DEFAULT_FORMATS_DATE = "YYYY-MM-DD";
  8706. const DEFAULT_FORMATS_DATEPICKER = {
  8707. date: DEFAULT_FORMATS_DATE,
  8708. week: "gggg[w]ww",
  8709. year: "YYYY",
  8710. month: "YYYY-MM",
  8711. datetime: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`,
  8712. monthrange: "YYYY-MM",
  8713. daterange: DEFAULT_FORMATS_DATE,
  8714. datetimerange: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`
  8715. };
  8716. const timePickerDefaultProps = {
  8717. id: {
  8718. type: [Array, String]
  8719. },
  8720. name: {
  8721. type: [Array, String],
  8722. default: ""
  8723. },
  8724. popperClass: {
  8725. type: String,
  8726. default: ""
  8727. },
  8728. format: {
  8729. type: String
  8730. },
  8731. valueFormat: {
  8732. type: String
  8733. },
  8734. type: {
  8735. type: String,
  8736. default: ""
  8737. },
  8738. clearable: {
  8739. type: Boolean,
  8740. default: true
  8741. },
  8742. clearIcon: {
  8743. type: [String, Object],
  8744. default: circleClose
  8745. },
  8746. editable: {
  8747. type: Boolean,
  8748. default: true
  8749. },
  8750. prefixIcon: {
  8751. type: [String, Object],
  8752. default: ""
  8753. },
  8754. size: {
  8755. type: String,
  8756. validator: isValidComponentSize
  8757. },
  8758. readonly: {
  8759. type: Boolean,
  8760. default: false
  8761. },
  8762. disabled: {
  8763. type: Boolean,
  8764. default: false
  8765. },
  8766. placeholder: {
  8767. type: String,
  8768. default: ""
  8769. },
  8770. popperOptions: {
  8771. type: Object,
  8772. default: () => ({})
  8773. },
  8774. modelValue: {
  8775. type: [Date, Array, String, Number],
  8776. default: ""
  8777. },
  8778. rangeSeparator: {
  8779. type: String,
  8780. default: "-"
  8781. },
  8782. startPlaceholder: String,
  8783. endPlaceholder: String,
  8784. defaultValue: {
  8785. type: [Date, Array]
  8786. },
  8787. defaultTime: {
  8788. type: [Date, Array]
  8789. },
  8790. isRange: {
  8791. type: Boolean,
  8792. default: false
  8793. },
  8794. disabledHours: {
  8795. type: Function
  8796. },
  8797. disabledMinutes: {
  8798. type: Function
  8799. },
  8800. disabledSeconds: {
  8801. type: Function
  8802. },
  8803. disabledDate: {
  8804. type: Function
  8805. },
  8806. cellClassName: {
  8807. type: Function
  8808. },
  8809. shortcuts: {
  8810. type: Array,
  8811. default: () => []
  8812. },
  8813. arrowControl: {
  8814. type: Boolean,
  8815. default: false
  8816. },
  8817. validateEvent: {
  8818. type: Boolean,
  8819. default: true
  8820. },
  8821. unlinkPanels: Boolean
  8822. };
  8823. const dateEquals = function(a2, b2) {
  8824. const aIsDate = a2 instanceof Date;
  8825. const bIsDate = b2 instanceof Date;
  8826. if (aIsDate && bIsDate) {
  8827. return a2.getTime() === b2.getTime();
  8828. }
  8829. if (!aIsDate && !bIsDate) {
  8830. return a2 === b2;
  8831. }
  8832. return false;
  8833. };
  8834. const valueEquals = function(a2, b2) {
  8835. const aIsArray = Array.isArray(a2);
  8836. const bIsArray = Array.isArray(b2);
  8837. if (aIsArray && bIsArray) {
  8838. if (a2.length !== b2.length) {
  8839. return false;
  8840. }
  8841. return a2.every((item, index) => dateEquals(item, b2[index]));
  8842. }
  8843. if (!aIsArray && !bIsArray) {
  8844. return dateEquals(a2, b2);
  8845. }
  8846. return false;
  8847. };
  8848. const parser = function(date4, format2, lang) {
  8849. const day = isEmpty(format2) || format2 === "x" ? dayjs(date4).locale(lang) : dayjs(date4, format2).locale(lang);
  8850. return day.isValid() ? day : void 0;
  8851. };
  8852. const formatter = function(date4, format2, lang) {
  8853. if (isEmpty(format2))
  8854. return date4;
  8855. if (format2 === "x")
  8856. return +date4;
  8857. return dayjs(date4).locale(lang).format(format2);
  8858. };
  8859. const _sfc_main$T = defineComponent({
  8860. name: "Picker",
  8861. components: {
  8862. ElInput,
  8863. ElTooltip,
  8864. ElIcon
  8865. },
  8866. props: timePickerDefaultProps,
  8867. emits: [
  8868. "update:modelValue",
  8869. "change",
  8870. "focus",
  8871. "blur",
  8872. "calendar-change",
  8873. "panel-change",
  8874. "visible-change"
  8875. ],
  8876. setup(props, ctx) {
  8877. const { lang } = useLocale();
  8878. const nsDate = useNamespace("date");
  8879. const nsInput = useNamespace("input");
  8880. const nsRange = useNamespace("range");
  8881. const elForm2 = inject(formContextKey, {});
  8882. const elFormItem2 = inject(formItemContextKey, {});
  8883. const elPopperOptions = inject("ElPopperOptions", {});
  8884. const refPopper = ref();
  8885. const inputRef = ref();
  8886. const pickerVisible = ref(false);
  8887. const pickerActualVisible = ref(false);
  8888. const valueOnOpen = ref(null);
  8889. watch(pickerVisible, (val) => {
  8890. var _a2;
  8891. if (!val) {
  8892. userInput.value = null;
  8893. nextTick(() => {
  8894. emitChange(props.modelValue);
  8895. });
  8896. ctx.emit("blur");
  8897. blurInput();
  8898. props.validateEvent && ((_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "blur").catch((err) => debugWarn()));
  8899. } else {
  8900. valueOnOpen.value = props.modelValue;
  8901. }
  8902. });
  8903. const emitChange = (val, isClear) => {
  8904. var _a2;
  8905. if (isClear || !valueEquals(val, valueOnOpen.value)) {
  8906. ctx.emit("change", val);
  8907. props.validateEvent && ((_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "change").catch((err) => debugWarn()));
  8908. }
  8909. };
  8910. const emitInput = (val) => {
  8911. if (!valueEquals(props.modelValue, val)) {
  8912. let formatValue;
  8913. if (Array.isArray(val)) {
  8914. formatValue = val.map((_2) => formatter(_2, props.valueFormat, lang.value));
  8915. } else if (val) {
  8916. formatValue = formatter(val, props.valueFormat, lang.value);
  8917. }
  8918. ctx.emit("update:modelValue", val ? formatValue : val, lang.value);
  8919. }
  8920. };
  8921. const refInput = computed(() => {
  8922. if (inputRef.value) {
  8923. const _r = isRangeInput.value ? inputRef.value : inputRef.value.$el;
  8924. return Array.from(_r.querySelectorAll("input"));
  8925. }
  8926. return [];
  8927. });
  8928. const refStartInput = computed(() => {
  8929. return refInput == null ? void 0 : refInput.value[0];
  8930. });
  8931. const refEndInput = computed(() => {
  8932. return refInput == null ? void 0 : refInput.value[1];
  8933. });
  8934. const setSelectionRange = (start2, end2, pos) => {
  8935. const _inputs = refInput.value;
  8936. if (!_inputs.length)
  8937. return;
  8938. if (!pos || pos === "min") {
  8939. _inputs[0].setSelectionRange(start2, end2);
  8940. _inputs[0].focus();
  8941. } else if (pos === "max") {
  8942. _inputs[1].setSelectionRange(start2, end2);
  8943. _inputs[1].focus();
  8944. }
  8945. };
  8946. const onPick = (date4 = "", visible = false) => {
  8947. pickerVisible.value = visible;
  8948. let result;
  8949. if (Array.isArray(date4)) {
  8950. result = date4.map((_2) => _2.toDate());
  8951. } else {
  8952. result = date4 ? date4.toDate() : date4;
  8953. }
  8954. userInput.value = null;
  8955. emitInput(result);
  8956. };
  8957. const onBeforeShow = () => {
  8958. pickerActualVisible.value = true;
  8959. };
  8960. const onShow = () => {
  8961. ctx.emit("visible-change", true);
  8962. };
  8963. const onHide = () => {
  8964. pickerActualVisible.value = false;
  8965. ctx.emit("visible-change", false);
  8966. };
  8967. const focus = (focusStartInput = true) => {
  8968. let input = refStartInput.value;
  8969. if (!focusStartInput && isRangeInput.value) {
  8970. input = refEndInput.value;
  8971. }
  8972. if (input) {
  8973. input.focus();
  8974. }
  8975. };
  8976. const handleFocus = (e) => {
  8977. if (props.readonly || pickerDisabled.value || pickerVisible.value)
  8978. return;
  8979. pickerVisible.value = true;
  8980. ctx.emit("focus", e);
  8981. };
  8982. const handleBlur = () => {
  8983. var _a2;
  8984. (_a2 = refPopper.value) == null ? void 0 : _a2.onClose();
  8985. blurInput();
  8986. };
  8987. const pickerDisabled = computed(() => {
  8988. return props.disabled || elForm2.disabled;
  8989. });
  8990. const parsedValue = computed(() => {
  8991. let result;
  8992. if (valueIsEmpty.value) {
  8993. if (pickerOptions.value.getDefaultValue) {
  8994. result = pickerOptions.value.getDefaultValue();
  8995. }
  8996. } else {
  8997. if (Array.isArray(props.modelValue)) {
  8998. result = props.modelValue.map((_2) => parser(_2, props.valueFormat, lang.value));
  8999. } else {
  9000. result = parser(props.modelValue, props.valueFormat, lang.value);
  9001. }
  9002. }
  9003. if (pickerOptions.value.getRangeAvailableTime) {
  9004. const availableResult = pickerOptions.value.getRangeAvailableTime(result);
  9005. if (!isEqual(availableResult, result)) {
  9006. result = availableResult;
  9007. emitInput(Array.isArray(result) ? result.map((_2) => _2.toDate()) : result.toDate());
  9008. }
  9009. }
  9010. if (Array.isArray(result) && result.some((_2) => !_2)) {
  9011. result = [];
  9012. }
  9013. return result;
  9014. });
  9015. const displayValue = computed(() => {
  9016. if (!pickerOptions.value.panelReady)
  9017. return;
  9018. const formattedValue = formatDayjsToString(parsedValue.value);
  9019. if (Array.isArray(userInput.value)) {
  9020. return [
  9021. userInput.value[0] || formattedValue && formattedValue[0] || "",
  9022. userInput.value[1] || formattedValue && formattedValue[1] || ""
  9023. ];
  9024. } else if (userInput.value !== null) {
  9025. return userInput.value;
  9026. }
  9027. if (!isTimePicker.value && valueIsEmpty.value)
  9028. return;
  9029. if (!pickerVisible.value && valueIsEmpty.value)
  9030. return;
  9031. if (formattedValue) {
  9032. return isDatesPicker.value ? formattedValue.join(", ") : formattedValue;
  9033. }
  9034. return "";
  9035. });
  9036. const isTimeLikePicker = computed(() => props.type.includes("time"));
  9037. const isTimePicker = computed(() => props.type.startsWith("time"));
  9038. const isDatesPicker = computed(() => props.type === "dates");
  9039. const triggerIcon = computed(() => props.prefixIcon || (isTimeLikePicker.value ? clock : calendar));
  9040. const showClose = ref(false);
  9041. const onClearIconClick = (event) => {
  9042. if (props.readonly || pickerDisabled.value)
  9043. return;
  9044. if (showClose.value) {
  9045. event.stopPropagation();
  9046. emitInput(null);
  9047. emitChange(null, true);
  9048. showClose.value = false;
  9049. pickerVisible.value = false;
  9050. pickerOptions.value.handleClear && pickerOptions.value.handleClear();
  9051. }
  9052. };
  9053. const valueIsEmpty = computed(() => {
  9054. return !props.modelValue || Array.isArray(props.modelValue) && !props.modelValue.length;
  9055. });
  9056. const onMouseEnter = () => {
  9057. if (props.readonly || pickerDisabled.value)
  9058. return;
  9059. if (!valueIsEmpty.value && props.clearable) {
  9060. showClose.value = true;
  9061. }
  9062. };
  9063. const onMouseLeave = () => {
  9064. showClose.value = false;
  9065. };
  9066. const isRangeInput = computed(() => {
  9067. return props.type.includes("range");
  9068. });
  9069. const pickerSize = useSize();
  9070. const popperPaneRef = computed(() => {
  9071. var _a2, _b2;
  9072. return (_b2 = (_a2 = refPopper.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b2.contentRef;
  9073. });
  9074. const popperEl = computed(() => {
  9075. var _a2, _b2;
  9076. return (_b2 = (_a2 = unref(refPopper)) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b2.contentRef;
  9077. });
  9078. const actualInputRef = computed(() => {
  9079. var _a2;
  9080. if (unref(isRangeInput)) {
  9081. return unref(inputRef);
  9082. }
  9083. return (_a2 = unref(inputRef)) == null ? void 0 : _a2.$el;
  9084. });
  9085. onClickOutside(actualInputRef, (e) => {
  9086. const unrefedPopperEl = unref(popperEl);
  9087. const inputEl = unref(actualInputRef);
  9088. if (unrefedPopperEl && (e.target === unrefedPopperEl || e.composedPath().includes(unrefedPopperEl)) || e.target === inputEl || e.composedPath().includes(inputEl))
  9089. return;
  9090. pickerVisible.value = false;
  9091. });
  9092. const userInput = ref(null);
  9093. const handleChange2 = () => {
  9094. if (userInput.value) {
  9095. const value = parseUserInputToDayjs(displayValue.value);
  9096. if (value) {
  9097. if (isValidValue(value)) {
  9098. emitInput(Array.isArray(value) ? value.map((_2) => _2.toDate()) : value.toDate());
  9099. userInput.value = null;
  9100. }
  9101. }
  9102. }
  9103. if (userInput.value === "") {
  9104. emitInput(null);
  9105. emitChange(null);
  9106. userInput.value = null;
  9107. }
  9108. };
  9109. const blurInput = () => {
  9110. refInput.value.forEach((input) => input.blur());
  9111. };
  9112. const parseUserInputToDayjs = (value) => {
  9113. if (!value)
  9114. return null;
  9115. return pickerOptions.value.parseUserInput(value);
  9116. };
  9117. const formatDayjsToString = (value) => {
  9118. if (!value)
  9119. return null;
  9120. return pickerOptions.value.formatToString(value);
  9121. };
  9122. const isValidValue = (value) => {
  9123. return pickerOptions.value.isValidValue(value);
  9124. };
  9125. const handleKeydown = (event) => {
  9126. const code = event.code;
  9127. if (code === EVENT_CODE.esc) {
  9128. pickerVisible.value = false;
  9129. event.stopPropagation();
  9130. return;
  9131. }
  9132. if (code === EVENT_CODE.tab) {
  9133. if (!isRangeInput.value) {
  9134. handleChange2();
  9135. pickerVisible.value = false;
  9136. event.stopPropagation();
  9137. } else {
  9138. setTimeout(() => {
  9139. if (!refInput.value.includes(document.activeElement)) {
  9140. pickerVisible.value = false;
  9141. blurInput();
  9142. }
  9143. }, 0);
  9144. }
  9145. return;
  9146. }
  9147. if (code === EVENT_CODE.enter || code === EVENT_CODE.numpadEnter) {
  9148. if (userInput.value === null || userInput.value === "" || isValidValue(parseUserInputToDayjs(displayValue.value))) {
  9149. handleChange2();
  9150. pickerVisible.value = false;
  9151. }
  9152. event.stopPropagation();
  9153. return;
  9154. }
  9155. if (userInput.value) {
  9156. event.stopPropagation();
  9157. return;
  9158. }
  9159. if (pickerOptions.value.handleKeydown) {
  9160. pickerOptions.value.handleKeydown(event);
  9161. }
  9162. };
  9163. const onUserInput = (e) => {
  9164. userInput.value = e;
  9165. };
  9166. const handleStartInput = (event) => {
  9167. if (userInput.value) {
  9168. userInput.value = [event.target.value, userInput.value[1]];
  9169. } else {
  9170. userInput.value = [event.target.value, null];
  9171. }
  9172. };
  9173. const handleEndInput = (event) => {
  9174. if (userInput.value) {
  9175. userInput.value = [userInput.value[0], event.target.value];
  9176. } else {
  9177. userInput.value = [null, event.target.value];
  9178. }
  9179. };
  9180. const handleStartChange = () => {
  9181. const value = parseUserInputToDayjs(userInput.value && userInput.value[0]);
  9182. if (value && value.isValid()) {
  9183. userInput.value = [formatDayjsToString(value), displayValue.value[1]];
  9184. const newValue = [value, parsedValue.value && parsedValue.value[1]];
  9185. if (isValidValue(newValue)) {
  9186. emitInput(newValue);
  9187. userInput.value = null;
  9188. }
  9189. }
  9190. };
  9191. const handleEndChange = () => {
  9192. const value = parseUserInputToDayjs(userInput.value && userInput.value[1]);
  9193. if (value && value.isValid()) {
  9194. userInput.value = [displayValue.value[0], formatDayjsToString(value)];
  9195. const newValue = [parsedValue.value && parsedValue.value[0], value];
  9196. if (isValidValue(newValue)) {
  9197. emitInput(newValue);
  9198. userInput.value = null;
  9199. }
  9200. }
  9201. };
  9202. const pickerOptions = ref({});
  9203. const onSetPickerOption = (e) => {
  9204. pickerOptions.value[e[0]] = e[1];
  9205. pickerOptions.value.panelReady = true;
  9206. };
  9207. const onCalendarChange = (e) => {
  9208. ctx.emit("calendar-change", e);
  9209. };
  9210. const onPanelChange = (value, mode, view2) => {
  9211. ctx.emit("panel-change", value, mode, view2);
  9212. };
  9213. provide("EP_PICKER_BASE", {
  9214. props
  9215. });
  9216. return {
  9217. nsDate,
  9218. nsInput,
  9219. nsRange,
  9220. elPopperOptions,
  9221. isDatesPicker,
  9222. handleEndChange,
  9223. handleStartChange,
  9224. handleStartInput,
  9225. handleEndInput,
  9226. onUserInput,
  9227. handleChange: handleChange2,
  9228. handleKeydown,
  9229. popperPaneRef,
  9230. onClickOutside,
  9231. pickerSize,
  9232. isRangeInput,
  9233. onMouseLeave,
  9234. onMouseEnter,
  9235. onClearIconClick,
  9236. showClose,
  9237. triggerIcon,
  9238. onPick,
  9239. handleFocus,
  9240. handleBlur,
  9241. pickerVisible,
  9242. pickerActualVisible,
  9243. displayValue,
  9244. parsedValue,
  9245. setSelectionRange,
  9246. refPopper,
  9247. inputRef,
  9248. pickerDisabled,
  9249. onSetPickerOption,
  9250. onCalendarChange,
  9251. onPanelChange,
  9252. focus,
  9253. onShow,
  9254. onBeforeShow,
  9255. onHide
  9256. };
  9257. }
  9258. });
  9259. const _hoisted_1$A = ["id", "name", "placeholder", "value", "disabled", "readonly"];
  9260. const _hoisted_2$s = ["id", "name", "placeholder", "value", "disabled", "readonly"];
  9261. function _sfc_render$w(_ctx, _cache, $props, $setup, $data, $options) {
  9262. const _component_el_icon = resolveComponent("el-icon");
  9263. const _component_el_input = resolveComponent("el-input");
  9264. const _component_el_tooltip = resolveComponent("el-tooltip");
  9265. return openBlock(), createBlock(_component_el_tooltip, mergeProps({
  9266. ref: "refPopper",
  9267. visible: _ctx.pickerVisible,
  9268. "onUpdate:visible": _cache[17] || (_cache[17] = ($event) => _ctx.pickerVisible = $event),
  9269. effect: "light",
  9270. pure: "",
  9271. trigger: "click"
  9272. }, _ctx.$attrs, {
  9273. "append-to-body": "",
  9274. transition: `${_ctx.nsDate.namespace.value}-zoom-in-top`,
  9275. "popper-class": [`${_ctx.nsDate.namespace.value}-picker__popper`, _ctx.popperClass],
  9276. "popper-options": _ctx.elPopperOptions,
  9277. "fallback-placements": ["bottom", "top", "right", "left"],
  9278. "gpu-acceleration": false,
  9279. "stop-popper-mouse-event": false,
  9280. "hide-after": 0,
  9281. persistent: "",
  9282. onBeforeShow: _ctx.onBeforeShow,
  9283. onShow: _ctx.onShow,
  9284. onHide: _ctx.onHide
  9285. }), {
  9286. default: withCtx(() => [
  9287. !_ctx.isRangeInput ? (openBlock(), createBlock(_component_el_input, {
  9288. key: 0,
  9289. id: _ctx.id,
  9290. ref: "inputRef",
  9291. "model-value": _ctx.displayValue,
  9292. name: _ctx.name,
  9293. size: _ctx.pickerSize,
  9294. disabled: _ctx.pickerDisabled,
  9295. placeholder: _ctx.placeholder,
  9296. class: normalizeClass([_ctx.nsDate.b("editor"), _ctx.nsDate.bm("editor", _ctx.type), _ctx.$attrs.class]),
  9297. style: normalizeStyle(_ctx.$attrs.style),
  9298. readonly: !_ctx.editable || _ctx.readonly || _ctx.isDatesPicker || _ctx.type === "week",
  9299. onInput: _ctx.onUserInput,
  9300. onFocus: _ctx.handleFocus,
  9301. onKeydown: _ctx.handleKeydown,
  9302. onChange: _ctx.handleChange,
  9303. onMouseenter: _ctx.onMouseEnter,
  9304. onMouseleave: _ctx.onMouseLeave,
  9305. onClick: _cache[0] || (_cache[0] = withModifiers(() => {
  9306. }, ["stop"]))
  9307. }, {
  9308. prefix: withCtx(() => [
  9309. _ctx.triggerIcon ? (openBlock(), createBlock(_component_el_icon, {
  9310. key: 0,
  9311. class: normalizeClass(_ctx.nsInput.e("icon")),
  9312. onClick: _ctx.handleFocus
  9313. }, {
  9314. default: withCtx(() => [
  9315. (openBlock(), createBlock(resolveDynamicComponent(_ctx.triggerIcon)))
  9316. ]),
  9317. _: 1
  9318. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  9319. ]),
  9320. suffix: withCtx(() => [
  9321. _ctx.showClose && _ctx.clearIcon ? (openBlock(), createBlock(_component_el_icon, {
  9322. key: 0,
  9323. class: normalizeClass(`${_ctx.nsInput.e("icon")} clear-icon`),
  9324. onClick: _ctx.onClearIconClick
  9325. }, {
  9326. default: withCtx(() => [
  9327. (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
  9328. ]),
  9329. _: 1
  9330. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  9331. ]),
  9332. _: 1
  9333. }, 8, ["id", "model-value", "name", "size", "disabled", "placeholder", "class", "style", "readonly", "onInput", "onFocus", "onKeydown", "onChange", "onMouseenter", "onMouseleave"])) : (openBlock(), createElementBlock("div", {
  9334. key: 1,
  9335. ref: "inputRef",
  9336. class: normalizeClass([
  9337. _ctx.nsDate.b("editor"),
  9338. _ctx.nsDate.bm("editor", _ctx.type),
  9339. _ctx.nsInput.e("inner"),
  9340. _ctx.nsDate.is("disabled", _ctx.pickerDisabled),
  9341. _ctx.nsDate.is("active", _ctx.pickerVisible),
  9342. _ctx.nsRange.b("editor"),
  9343. _ctx.pickerSize ? _ctx.nsRange.bm("editor", _ctx.pickerSize) : "",
  9344. _ctx.$attrs.class
  9345. ]),
  9346. style: normalizeStyle(_ctx.$attrs.style),
  9347. onClick: _cache[7] || (_cache[7] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  9348. onMouseenter: _cache[8] || (_cache[8] = (...args) => _ctx.onMouseEnter && _ctx.onMouseEnter(...args)),
  9349. onMouseleave: _cache[9] || (_cache[9] = (...args) => _ctx.onMouseLeave && _ctx.onMouseLeave(...args)),
  9350. onKeydown: _cache[10] || (_cache[10] = (...args) => _ctx.handleKeydown && _ctx.handleKeydown(...args))
  9351. }, [
  9352. _ctx.triggerIcon ? (openBlock(), createBlock(_component_el_icon, {
  9353. key: 0,
  9354. class: normalizeClass([_ctx.nsInput.e("icon"), _ctx.nsRange.e("icon")]),
  9355. onClick: _ctx.handleFocus
  9356. }, {
  9357. default: withCtx(() => [
  9358. (openBlock(), createBlock(resolveDynamicComponent(_ctx.triggerIcon)))
  9359. ]),
  9360. _: 1
  9361. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true),
  9362. createElementVNode("input", {
  9363. id: _ctx.id && _ctx.id[0],
  9364. autocomplete: "off",
  9365. name: _ctx.name && _ctx.name[0],
  9366. placeholder: _ctx.startPlaceholder,
  9367. value: _ctx.displayValue && _ctx.displayValue[0],
  9368. disabled: _ctx.pickerDisabled,
  9369. readonly: !_ctx.editable || _ctx.readonly,
  9370. class: normalizeClass(_ctx.nsRange.b("input")),
  9371. onInput: _cache[1] || (_cache[1] = (...args) => _ctx.handleStartInput && _ctx.handleStartInput(...args)),
  9372. onChange: _cache[2] || (_cache[2] = (...args) => _ctx.handleStartChange && _ctx.handleStartChange(...args)),
  9373. onFocus: _cache[3] || (_cache[3] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args))
  9374. }, null, 42, _hoisted_1$A),
  9375. renderSlot(_ctx.$slots, "range-separator", {}, () => [
  9376. createElementVNode("span", {
  9377. class: normalizeClass(_ctx.nsRange.b("separator"))
  9378. }, toDisplayString(_ctx.rangeSeparator), 3)
  9379. ]),
  9380. createElementVNode("input", {
  9381. id: _ctx.id && _ctx.id[1],
  9382. autocomplete: "off",
  9383. name: _ctx.name && _ctx.name[1],
  9384. placeholder: _ctx.endPlaceholder,
  9385. value: _ctx.displayValue && _ctx.displayValue[1],
  9386. disabled: _ctx.pickerDisabled,
  9387. readonly: !_ctx.editable || _ctx.readonly,
  9388. class: normalizeClass(_ctx.nsRange.b("input")),
  9389. onFocus: _cache[4] || (_cache[4] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  9390. onInput: _cache[5] || (_cache[5] = (...args) => _ctx.handleEndInput && _ctx.handleEndInput(...args)),
  9391. onChange: _cache[6] || (_cache[6] = (...args) => _ctx.handleEndChange && _ctx.handleEndChange(...args))
  9392. }, null, 42, _hoisted_2$s),
  9393. _ctx.clearIcon ? (openBlock(), createBlock(_component_el_icon, {
  9394. key: 1,
  9395. class: normalizeClass([
  9396. _ctx.nsInput.e("icon"),
  9397. _ctx.nsRange.e("close-icon"),
  9398. {
  9399. [_ctx.nsRange.e("close-icon--hidden")]: !_ctx.showClose
  9400. }
  9401. ]),
  9402. onClick: _ctx.onClearIconClick
  9403. }, {
  9404. default: withCtx(() => [
  9405. (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
  9406. ]),
  9407. _: 1
  9408. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  9409. ], 38))
  9410. ]),
  9411. content: withCtx(() => [
  9412. renderSlot(_ctx.$slots, "default", {
  9413. visible: _ctx.pickerVisible,
  9414. actualVisible: _ctx.pickerActualVisible,
  9415. parsedValue: _ctx.parsedValue,
  9416. format: _ctx.format,
  9417. unlinkPanels: _ctx.unlinkPanels,
  9418. type: _ctx.type,
  9419. defaultValue: _ctx.defaultValue,
  9420. onPick: _cache[11] || (_cache[11] = (...args) => _ctx.onPick && _ctx.onPick(...args)),
  9421. onSelectRange: _cache[12] || (_cache[12] = (...args) => _ctx.setSelectionRange && _ctx.setSelectionRange(...args)),
  9422. onSetPickerOption: _cache[13] || (_cache[13] = (...args) => _ctx.onSetPickerOption && _ctx.onSetPickerOption(...args)),
  9423. onCalendarChange: _cache[14] || (_cache[14] = (...args) => _ctx.onCalendarChange && _ctx.onCalendarChange(...args)),
  9424. onPanelChange: _cache[15] || (_cache[15] = (...args) => _ctx.onPanelChange && _ctx.onPanelChange(...args)),
  9425. onMousedown: _cache[16] || (_cache[16] = withModifiers(() => {
  9426. }, ["stop"]))
  9427. })
  9428. ]),
  9429. _: 3
  9430. }, 16, ["visible", "transition", "popper-class", "popper-options", "onBeforeShow", "onShow", "onHide"]);
  9431. }
  9432. var CommonPicker = /* @__PURE__ */ _export_sfc$1(_sfc_main$T, [["render", _sfc_render$w], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/time-picker/src/common/picker.vue"]]);
  9433. const nodeList = /* @__PURE__ */ new Map();
  9434. let startClick;
  9435. if (isClient) {
  9436. document.addEventListener("mousedown", (e) => startClick = e);
  9437. document.addEventListener("mouseup", (e) => {
  9438. for (const handlers of nodeList.values()) {
  9439. for (const { documentHandler } of handlers) {
  9440. documentHandler(e, startClick);
  9441. }
  9442. }
  9443. });
  9444. }
  9445. function createDocumentHandler(el, binding) {
  9446. let excludes = [];
  9447. if (Array.isArray(binding.arg)) {
  9448. excludes = binding.arg;
  9449. } else if (isElement$1(binding.arg)) {
  9450. excludes.push(binding.arg);
  9451. }
  9452. return function(mouseup, mousedown) {
  9453. const popperRef = binding.instance.popperRef;
  9454. const mouseUpTarget = mouseup.target;
  9455. const mouseDownTarget = mousedown == null ? void 0 : mousedown.target;
  9456. const isBound = !binding || !binding.instance;
  9457. const isTargetExists = !mouseUpTarget || !mouseDownTarget;
  9458. const isContainedByEl = el.contains(mouseUpTarget) || el.contains(mouseDownTarget);
  9459. const isSelf = el === mouseUpTarget;
  9460. const isTargetExcluded = excludes.length && excludes.some((item) => item == null ? void 0 : item.contains(mouseUpTarget)) || excludes.length && excludes.includes(mouseDownTarget);
  9461. const isContainedByPopper = popperRef && (popperRef.contains(mouseUpTarget) || popperRef.contains(mouseDownTarget));
  9462. if (isBound || isTargetExists || isContainedByEl || isSelf || isTargetExcluded || isContainedByPopper) {
  9463. return;
  9464. }
  9465. binding.value(mouseup, mousedown);
  9466. };
  9467. }
  9468. const ClickOutside = {
  9469. beforeMount(el, binding) {
  9470. if (!nodeList.has(el)) {
  9471. nodeList.set(el, []);
  9472. }
  9473. nodeList.get(el).push({
  9474. documentHandler: createDocumentHandler(el, binding),
  9475. bindingFn: binding.value
  9476. });
  9477. },
  9478. updated(el, binding) {
  9479. if (!nodeList.has(el)) {
  9480. nodeList.set(el, []);
  9481. }
  9482. const handlers = nodeList.get(el);
  9483. const oldHandlerIndex = handlers.findIndex((item) => item.bindingFn === binding.oldValue);
  9484. const newHandler = {
  9485. documentHandler: createDocumentHandler(el, binding),
  9486. bindingFn: binding.value
  9487. };
  9488. if (oldHandlerIndex >= 0) {
  9489. handlers.splice(oldHandlerIndex, 1, newHandler);
  9490. } else {
  9491. handlers.push(newHandler);
  9492. }
  9493. },
  9494. unmounted(el) {
  9495. nodeList.delete(el);
  9496. }
  9497. };
  9498. var RepeatClick = {
  9499. beforeMount(el, binding) {
  9500. let interval = null;
  9501. let startTime;
  9502. const handler3 = () => binding.value && binding.value();
  9503. const clear = () => {
  9504. if (Date.now() - startTime < 100) {
  9505. handler3();
  9506. }
  9507. clearInterval(interval);
  9508. interval = null;
  9509. };
  9510. on(el, "mousedown", (e) => {
  9511. if (e.button !== 0)
  9512. return;
  9513. startTime = Date.now();
  9514. once(document, "mouseup", clear);
  9515. clearInterval(interval);
  9516. interval = setInterval(handler3, 100);
  9517. });
  9518. }
  9519. };
  9520. var v = false, o, f, s, u, d, N, l, p, m, w, D, x, E, M, F;
  9521. function a() {
  9522. if (!v) {
  9523. v = true;
  9524. var e = navigator.userAgent, n = /(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(e), i = /(Mac OS X)|(Windows)|(Linux)/.exec(e);
  9525. if (x = /\b(iPhone|iP[ao]d)/.exec(e), E = /\b(iP[ao]d)/.exec(e), w = /Android/i.exec(e), M = /FBAN\/\w+;/i.exec(e), F = /Mobile/i.exec(e), D = !!/Win64/.exec(e), n) {
  9526. o = n[1] ? parseFloat(n[1]) : n[5] ? parseFloat(n[5]) : NaN, o && document && document.documentMode && (o = document.documentMode);
  9527. var r = /(?:Trident\/(\d+.\d+))/.exec(e);
  9528. N = r ? parseFloat(r[1]) + 4 : o, f = n[2] ? parseFloat(n[2]) : NaN, s = n[3] ? parseFloat(n[3]) : NaN, u = n[4] ? parseFloat(n[4]) : NaN, u ? (n = /(?:Chrome\/(\d+\.\d+))/.exec(e), d = n && n[1] ? parseFloat(n[1]) : NaN) : d = NaN;
  9529. } else
  9530. o = f = s = d = u = NaN;
  9531. if (i) {
  9532. if (i[1]) {
  9533. var t = /(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(e);
  9534. l = t ? parseFloat(t[1].replace("_", ".")) : true;
  9535. } else
  9536. l = false;
  9537. p = !!i[2], m = !!i[3];
  9538. } else
  9539. l = p = m = false;
  9540. }
  9541. }
  9542. var _ = { ie: function() {
  9543. return a() || o;
  9544. }, ieCompatibilityMode: function() {
  9545. return a() || N > o;
  9546. }, ie64: function() {
  9547. return _.ie() && D;
  9548. }, firefox: function() {
  9549. return a() || f;
  9550. }, opera: function() {
  9551. return a() || s;
  9552. }, webkit: function() {
  9553. return a() || u;
  9554. }, safari: function() {
  9555. return _.webkit();
  9556. }, chrome: function() {
  9557. return a() || d;
  9558. }, windows: function() {
  9559. return a() || p;
  9560. }, osx: function() {
  9561. return a() || l;
  9562. }, linux: function() {
  9563. return a() || m;
  9564. }, iphone: function() {
  9565. return a() || x;
  9566. }, mobile: function() {
  9567. return a() || x || E || w || F;
  9568. }, nativeApp: function() {
  9569. return a() || M;
  9570. }, android: function() {
  9571. return a() || w;
  9572. }, ipad: function() {
  9573. return a() || E;
  9574. } }, A = _;
  9575. var c = !!(typeof window < "u" && window.document && window.document.createElement), U = { canUseDOM: c, canUseWorkers: typeof Worker < "u", canUseEventListeners: c && !!(window.addEventListener || window.attachEvent), canUseViewport: c && !!window.screen, isInWorker: !c }, h = U;
  9576. var X;
  9577. h.canUseDOM && (X = document.implementation && document.implementation.hasFeature && document.implementation.hasFeature("", "") !== true);
  9578. function S(e, n) {
  9579. if (!h.canUseDOM || n && !("addEventListener" in document))
  9580. return false;
  9581. var i = "on" + e, r = i in document;
  9582. if (!r) {
  9583. var t = document.createElement("div");
  9584. t.setAttribute(i, "return;"), r = typeof t[i] == "function";
  9585. }
  9586. return !r && X && e === "wheel" && (r = document.implementation.hasFeature("Events.wheel", "3.0")), r;
  9587. }
  9588. var b = S;
  9589. var O = 10, I = 40, P = 800;
  9590. function T(e) {
  9591. var n = 0, i = 0, r = 0, t = 0;
  9592. return "detail" in e && (i = e.detail), "wheelDelta" in e && (i = -e.wheelDelta / 120), "wheelDeltaY" in e && (i = -e.wheelDeltaY / 120), "wheelDeltaX" in e && (n = -e.wheelDeltaX / 120), "axis" in e && e.axis === e.HORIZONTAL_AXIS && (n = i, i = 0), r = n * O, t = i * O, "deltaY" in e && (t = e.deltaY), "deltaX" in e && (r = e.deltaX), (r || t) && e.deltaMode && (e.deltaMode == 1 ? (r *= I, t *= I) : (r *= P, t *= P)), r && !n && (n = r < 1 ? -1 : 1), t && !i && (i = t < 1 ? -1 : 1), { spinX: n, spinY: i, pixelX: r, pixelY: t };
  9593. }
  9594. T.getEventType = function() {
  9595. return A.firefox() ? "DOMMouseScroll" : b("wheel") ? "wheel" : "mousewheel";
  9596. };
  9597. var Y = T;
  9598. /**
  9599. * Checks if an event is supported in the current execution environment.
  9600. *
  9601. * NOTE: This will not work correctly for non-generic events such as `change`,
  9602. * `reset`, `load`, `error`, and `select`.
  9603. *
  9604. * Borrows from Modernizr.
  9605. *
  9606. * @param {string} eventNameSuffix Event name, e.g. "click".
  9607. * @param {?boolean} capture Check if the capture phase is supported.
  9608. * @return {boolean} True if the event is supported.
  9609. * @internal
  9610. * @license Modernizr 3.0.0pre (Custom Build) | MIT
  9611. */
  9612. const mousewheel = function(element, callback) {
  9613. if (element && element.addEventListener) {
  9614. const fn2 = function(event) {
  9615. const normalized = Y(event);
  9616. callback && Reflect.apply(callback, this, [event, normalized]);
  9617. };
  9618. if (isFirefox()) {
  9619. element.addEventListener("DOMMouseScroll", fn2);
  9620. } else {
  9621. element.onmousewheel = fn2;
  9622. }
  9623. }
  9624. };
  9625. const Mousewheel = {
  9626. beforeMount(el, binding) {
  9627. mousewheel(el, binding.value);
  9628. }
  9629. };
  9630. const makeList = (total, method4, methodFunc) => {
  9631. const arr = [];
  9632. const disabledArr = method4 && methodFunc();
  9633. for (let i = 0; i < total; i++) {
  9634. arr[i] = disabledArr ? disabledArr.includes(i) : false;
  9635. }
  9636. return arr;
  9637. };
  9638. const makeAvailableArr = (list) => {
  9639. return list.map((_2, index) => !_2 ? index : _2).filter((_2) => _2 !== true);
  9640. };
  9641. const getTimeLists = (disabledHours, disabledMinutes, disabledSeconds) => {
  9642. const getHoursList = (role, compare) => {
  9643. return makeList(24, disabledHours, () => disabledHours(role, compare));
  9644. };
  9645. const getMinutesList = (hour, role, compare) => {
  9646. return makeList(60, disabledMinutes, () => disabledMinutes(hour, role, compare));
  9647. };
  9648. const getSecondsList = (hour, minute, role, compare) => {
  9649. return makeList(60, disabledSeconds, () => disabledSeconds(hour, minute, role, compare));
  9650. };
  9651. return {
  9652. getHoursList,
  9653. getMinutesList,
  9654. getSecondsList
  9655. };
  9656. };
  9657. const getAvailableArrs = (disabledHours, disabledMinutes, disabledSeconds) => {
  9658. const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(disabledHours, disabledMinutes, disabledSeconds);
  9659. const getAvailableHours = (role, compare) => {
  9660. return makeAvailableArr(getHoursList(role, compare));
  9661. };
  9662. const getAvailableMinutes = (hour, role, compare) => {
  9663. return makeAvailableArr(getMinutesList(hour, role, compare));
  9664. };
  9665. const getAvailableSeconds = (hour, minute, role, compare) => {
  9666. return makeAvailableArr(getSecondsList(hour, minute, role, compare));
  9667. };
  9668. return {
  9669. getAvailableHours,
  9670. getAvailableMinutes,
  9671. getAvailableSeconds
  9672. };
  9673. };
  9674. const useOldValue = (props) => {
  9675. const oldValue = ref(props.parsedValue);
  9676. watch(() => props.visible, (val) => {
  9677. if (!val) {
  9678. oldValue.value = props.parsedValue;
  9679. }
  9680. });
  9681. return oldValue;
  9682. };
  9683. const _sfc_main$S = defineComponent({
  9684. directives: {
  9685. repeatClick: RepeatClick
  9686. },
  9687. components: {
  9688. ElScrollbar,
  9689. ElIcon,
  9690. ArrowUp: arrowUp,
  9691. ArrowDown: arrowDown
  9692. },
  9693. props: {
  9694. role: {
  9695. type: String,
  9696. required: true
  9697. },
  9698. spinnerDate: {
  9699. type: Object,
  9700. required: true
  9701. },
  9702. showSeconds: {
  9703. type: Boolean,
  9704. default: true
  9705. },
  9706. arrowControl: Boolean,
  9707. amPmMode: {
  9708. type: String,
  9709. default: ""
  9710. },
  9711. disabledHours: {
  9712. type: Function
  9713. },
  9714. disabledMinutes: {
  9715. type: Function
  9716. },
  9717. disabledSeconds: {
  9718. type: Function
  9719. }
  9720. },
  9721. emits: ["change", "select-range", "set-option"],
  9722. setup(props, ctx) {
  9723. const ns = useNamespace("time");
  9724. let isScrolling = false;
  9725. const debouncedResetScroll = debounce$1((type4) => {
  9726. isScrolling = false;
  9727. adjustCurrentSpinner(type4);
  9728. }, 200);
  9729. const currentScrollbar = ref(null);
  9730. const listHoursRef = ref(null);
  9731. const listMinutesRef = ref(null);
  9732. const listSecondsRef = ref(null);
  9733. const listRefsMap = {
  9734. hours: listHoursRef,
  9735. minutes: listMinutesRef,
  9736. seconds: listSecondsRef
  9737. };
  9738. const spinnerItems = computed(() => {
  9739. const arr = ["hours", "minutes", "seconds"];
  9740. return props.showSeconds ? arr : arr.slice(0, 2);
  9741. });
  9742. const hours = computed(() => {
  9743. return props.spinnerDate.hour();
  9744. });
  9745. const minutes = computed(() => {
  9746. return props.spinnerDate.minute();
  9747. });
  9748. const seconds = computed(() => {
  9749. return props.spinnerDate.second();
  9750. });
  9751. const timePartsMap = computed(() => ({
  9752. hours,
  9753. minutes,
  9754. seconds
  9755. }));
  9756. const hoursList = computed(() => {
  9757. return getHoursList(props.role);
  9758. });
  9759. const minutesList = computed(() => {
  9760. return getMinutesList(hours.value, props.role);
  9761. });
  9762. const secondsList = computed(() => {
  9763. return getSecondsList(hours.value, minutes.value, props.role);
  9764. });
  9765. const listMap = computed(() => ({
  9766. hours: hoursList,
  9767. minutes: minutesList,
  9768. seconds: secondsList
  9769. }));
  9770. const arrowHourList = computed(() => {
  9771. const hour = hours.value;
  9772. return [
  9773. hour > 0 ? hour - 1 : void 0,
  9774. hour,
  9775. hour < 23 ? hour + 1 : void 0
  9776. ];
  9777. });
  9778. const arrowMinuteList = computed(() => {
  9779. const minute = minutes.value;
  9780. return [
  9781. minute > 0 ? minute - 1 : void 0,
  9782. minute,
  9783. minute < 59 ? minute + 1 : void 0
  9784. ];
  9785. });
  9786. const arrowSecondList = computed(() => {
  9787. const second = seconds.value;
  9788. return [
  9789. second > 0 ? second - 1 : void 0,
  9790. second,
  9791. second < 59 ? second + 1 : void 0
  9792. ];
  9793. });
  9794. const arrowListMap = computed(() => ({
  9795. hours: arrowHourList,
  9796. minutes: arrowMinuteList,
  9797. seconds: arrowSecondList
  9798. }));
  9799. const getAmPmFlag = (hour) => {
  9800. const shouldShowAmPm = !!props.amPmMode;
  9801. if (!shouldShowAmPm)
  9802. return "";
  9803. const isCapital = props.amPmMode === "A";
  9804. let content2 = hour < 12 ? " am" : " pm";
  9805. if (isCapital)
  9806. content2 = content2.toUpperCase();
  9807. return content2;
  9808. };
  9809. const emitSelectRange = (type4) => {
  9810. if (type4 === "hours") {
  9811. ctx.emit("select-range", 0, 2);
  9812. } else if (type4 === "minutes") {
  9813. ctx.emit("select-range", 3, 5);
  9814. } else if (type4 === "seconds") {
  9815. ctx.emit("select-range", 6, 8);
  9816. }
  9817. currentScrollbar.value = type4;
  9818. };
  9819. const adjustCurrentSpinner = (type4) => {
  9820. adjustSpinner(type4, timePartsMap.value[type4].value);
  9821. };
  9822. const adjustSpinners = () => {
  9823. adjustCurrentSpinner("hours");
  9824. adjustCurrentSpinner("minutes");
  9825. adjustCurrentSpinner("seconds");
  9826. };
  9827. const getScrollbarElement = (el) => el.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
  9828. const adjustSpinner = (type4, value) => {
  9829. if (props.arrowControl)
  9830. return;
  9831. const el = listRefsMap[type4];
  9832. if (el && el.$el) {
  9833. getScrollbarElement(el.$el).scrollTop = Math.max(0, value * typeItemHeight(type4));
  9834. }
  9835. };
  9836. const typeItemHeight = (type4) => {
  9837. const el = listRefsMap[type4];
  9838. return el.$el.querySelector("li").offsetHeight;
  9839. };
  9840. const onIncreaseClick = () => {
  9841. scrollDown(1);
  9842. };
  9843. const onDecreaseClick = () => {
  9844. scrollDown(-1);
  9845. };
  9846. const scrollDown = (step) => {
  9847. if (!currentScrollbar.value) {
  9848. emitSelectRange("hours");
  9849. }
  9850. const label = currentScrollbar.value;
  9851. let now2 = timePartsMap.value[label].value;
  9852. const total = currentScrollbar.value === "hours" ? 24 : 60;
  9853. now2 = (now2 + step + total) % total;
  9854. modifyDateField(label, now2);
  9855. adjustSpinner(label, now2);
  9856. nextTick(() => emitSelectRange(currentScrollbar.value));
  9857. };
  9858. const modifyDateField = (type4, value) => {
  9859. const list = listMap.value[type4].value;
  9860. const isDisabled = list[value];
  9861. if (isDisabled)
  9862. return;
  9863. switch (type4) {
  9864. case "hours":
  9865. ctx.emit("change", props.spinnerDate.hour(value).minute(minutes.value).second(seconds.value));
  9866. break;
  9867. case "minutes":
  9868. ctx.emit("change", props.spinnerDate.hour(hours.value).minute(value).second(seconds.value));
  9869. break;
  9870. case "seconds":
  9871. ctx.emit("change", props.spinnerDate.hour(hours.value).minute(minutes.value).second(value));
  9872. break;
  9873. }
  9874. };
  9875. const handleClick = (type4, { value, disabled }) => {
  9876. if (!disabled) {
  9877. modifyDateField(type4, value);
  9878. emitSelectRange(type4);
  9879. adjustSpinner(type4, value);
  9880. }
  9881. };
  9882. const handleScroll = (type4) => {
  9883. isScrolling = true;
  9884. debouncedResetScroll(type4);
  9885. const value = Math.min(Math.round((getScrollbarElement(listRefsMap[type4].$el).scrollTop - (scrollBarHeight(type4) * 0.5 - 10) / typeItemHeight(type4) + 3) / typeItemHeight(type4)), type4 === "hours" ? 23 : 59);
  9886. modifyDateField(type4, value);
  9887. };
  9888. const scrollBarHeight = (type4) => {
  9889. return listRefsMap[type4].$el.offsetHeight;
  9890. };
  9891. const bindScrollEvent = () => {
  9892. const bindFunction = (type4) => {
  9893. if (listRefsMap[type4] && listRefsMap[type4].$el) {
  9894. getScrollbarElement(listRefsMap[type4].$el).onscroll = () => {
  9895. handleScroll(type4);
  9896. };
  9897. }
  9898. };
  9899. bindFunction("hours");
  9900. bindFunction("minutes");
  9901. bindFunction("seconds");
  9902. };
  9903. onMounted(() => {
  9904. nextTick(() => {
  9905. !props.arrowControl && bindScrollEvent();
  9906. adjustSpinners();
  9907. if (props.role === "start")
  9908. emitSelectRange("hours");
  9909. });
  9910. });
  9911. const setRef = (scrollbar, type4) => {
  9912. listRefsMap[type4] = scrollbar;
  9913. };
  9914. ctx.emit("set-option", [`${props.role}_scrollDown`, scrollDown]);
  9915. ctx.emit("set-option", [`${props.role}_emitSelectRange`, emitSelectRange]);
  9916. const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(props.disabledHours, props.disabledMinutes, props.disabledSeconds);
  9917. watch(() => props.spinnerDate, () => {
  9918. if (isScrolling)
  9919. return;
  9920. adjustSpinners();
  9921. });
  9922. return {
  9923. ns,
  9924. setRef,
  9925. spinnerItems,
  9926. currentScrollbar,
  9927. hours,
  9928. minutes,
  9929. seconds,
  9930. hoursList,
  9931. minutesList,
  9932. arrowHourList,
  9933. arrowMinuteList,
  9934. arrowSecondList,
  9935. getAmPmFlag,
  9936. emitSelectRange,
  9937. adjustCurrentSpinner,
  9938. typeItemHeight,
  9939. listHoursRef,
  9940. listMinutesRef,
  9941. listSecondsRef,
  9942. onIncreaseClick,
  9943. onDecreaseClick,
  9944. handleClick,
  9945. secondsList,
  9946. timePartsMap,
  9947. arrowListMap,
  9948. listMap
  9949. };
  9950. }
  9951. });
  9952. const _hoisted_1$z = ["onClick"];
  9953. const _hoisted_2$r = ["onMouseenter"];
  9954. function _sfc_render$v(_ctx, _cache, $props, $setup, $data, $options) {
  9955. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  9956. const _component_arrow_up = resolveComponent("arrow-up");
  9957. const _component_el_icon = resolveComponent("el-icon");
  9958. const _component_arrow_down = resolveComponent("arrow-down");
  9959. const _directive_repeat_click = resolveDirective("repeat-click");
  9960. return openBlock(), createElementBlock("div", {
  9961. class: normalizeClass([_ctx.ns.b("spinner"), { "has-seconds": _ctx.showSeconds }])
  9962. }, [
  9963. !_ctx.arrowControl ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.spinnerItems, (item) => {
  9964. return openBlock(), createBlock(_component_el_scrollbar, {
  9965. key: item,
  9966. ref_for: true,
  9967. ref: (scollbar) => _ctx.setRef(scollbar, item),
  9968. class: normalizeClass(_ctx.ns.be("spinner", "wrapper")),
  9969. "wrap-style": "max-height: inherit;",
  9970. "view-class": _ctx.ns.be("spinner", "list"),
  9971. noresize: "",
  9972. tag: "ul",
  9973. onMouseenter: ($event) => _ctx.emitSelectRange(item),
  9974. onMousemove: ($event) => _ctx.adjustCurrentSpinner(item)
  9975. }, {
  9976. default: withCtx(() => [
  9977. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.listMap[item].value, (disabled, key) => {
  9978. return openBlock(), createElementBlock("li", {
  9979. key,
  9980. class: normalizeClass([
  9981. _ctx.ns.be("spinner", "item"),
  9982. _ctx.ns.is("active", key === _ctx.timePartsMap[item].value),
  9983. _ctx.ns.is("disabled", disabled)
  9984. ]),
  9985. onClick: ($event) => _ctx.handleClick(item, { value: key, disabled })
  9986. }, [
  9987. item === "hours" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  9988. createTextVNode(toDisplayString(("0" + (_ctx.amPmMode ? key % 12 || 12 : key)).slice(-2)) + toDisplayString(_ctx.getAmPmFlag(key)), 1)
  9989. ], 2112)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  9990. createTextVNode(toDisplayString(("0" + key).slice(-2)), 1)
  9991. ], 2112))
  9992. ], 10, _hoisted_1$z);
  9993. }), 128))
  9994. ]),
  9995. _: 2
  9996. }, 1032, ["class", "view-class", "onMouseenter", "onMousemove"]);
  9997. }), 128)) : createCommentVNode("v-if", true),
  9998. _ctx.arrowControl ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(_ctx.spinnerItems, (item) => {
  9999. return openBlock(), createElementBlock("div", {
  10000. key: item,
  10001. class: normalizeClass([_ctx.ns.be("spinner", "wrapper"), _ctx.ns.is("arrow")]),
  10002. onMouseenter: ($event) => _ctx.emitSelectRange(item)
  10003. }, [
  10004. withDirectives((openBlock(), createBlock(_component_el_icon, {
  10005. class: normalizeClass(["arrow-up", _ctx.ns.be("spinner", "arrow")])
  10006. }, {
  10007. default: withCtx(() => [
  10008. createVNode(_component_arrow_up)
  10009. ]),
  10010. _: 1
  10011. }, 8, ["class"])), [
  10012. [_directive_repeat_click, _ctx.onDecreaseClick]
  10013. ]),
  10014. withDirectives((openBlock(), createBlock(_component_el_icon, {
  10015. class: normalizeClass(["arrow-down", _ctx.ns.be("spinner", "arrow")])
  10016. }, {
  10017. default: withCtx(() => [
  10018. createVNode(_component_arrow_down)
  10019. ]),
  10020. _: 1
  10021. }, 8, ["class"])), [
  10022. [_directive_repeat_click, _ctx.onIncreaseClick]
  10023. ]),
  10024. createElementVNode("ul", {
  10025. class: normalizeClass(_ctx.ns.be("spinner", "list"))
  10026. }, [
  10027. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.arrowListMap[item].value, (time, key) => {
  10028. return openBlock(), createElementBlock("li", {
  10029. key,
  10030. class: normalizeClass([
  10031. _ctx.ns.be("spinner", "item"),
  10032. _ctx.ns.is("active", time === _ctx.timePartsMap[item].value),
  10033. _ctx.ns.is("disabled", _ctx.listMap[item].value[time])
  10034. ])
  10035. }, [
  10036. typeof time === "number" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  10037. item === "hours" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  10038. createTextVNode(toDisplayString(("0" + (_ctx.amPmMode ? time % 12 || 12 : time)).slice(-2)) + toDisplayString(_ctx.getAmPmFlag(time)), 1)
  10039. ], 2112)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  10040. createTextVNode(toDisplayString(("0" + time).slice(-2)), 1)
  10041. ], 2112))
  10042. ], 2112)) : createCommentVNode("v-if", true)
  10043. ], 2);
  10044. }), 128))
  10045. ], 2)
  10046. ], 42, _hoisted_2$r);
  10047. }), 128)) : createCommentVNode("v-if", true)
  10048. ], 2);
  10049. }
  10050. var TimeSpinner = /* @__PURE__ */ _export_sfc$1(_sfc_main$S, [["render", _sfc_render$v], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/time-picker/src/time-picker-com/basic-time-spinner.vue"]]);
  10051. const _sfc_main$R = defineComponent({
  10052. components: {
  10053. TimeSpinner
  10054. },
  10055. props: {
  10056. visible: Boolean,
  10057. actualVisible: {
  10058. type: Boolean,
  10059. default: void 0
  10060. },
  10061. datetimeRole: {
  10062. type: String
  10063. },
  10064. parsedValue: {
  10065. type: [Object, String]
  10066. },
  10067. format: {
  10068. type: String,
  10069. default: ""
  10070. }
  10071. },
  10072. emits: ["pick", "select-range", "set-picker-option"],
  10073. setup(props, ctx) {
  10074. const ns = useNamespace("time");
  10075. const { t, lang } = useLocale();
  10076. const selectionRange = ref([0, 2]);
  10077. const oldValue = useOldValue(props);
  10078. const transitionName = computed(() => {
  10079. return isUndefined(props.actualVisible) ? `${ns.namespace.value}-zoom-in-top` : "";
  10080. });
  10081. const showSeconds = computed(() => {
  10082. return props.format.includes("ss");
  10083. });
  10084. const amPmMode = computed(() => {
  10085. if (props.format.includes("A"))
  10086. return "A";
  10087. if (props.format.includes("a"))
  10088. return "a";
  10089. return "";
  10090. });
  10091. const isValidValue = (_date) => {
  10092. const parsedDate = dayjs(_date).locale(lang.value);
  10093. const result = getRangeAvailableTime(parsedDate);
  10094. return parsedDate.isSame(result);
  10095. };
  10096. const handleCancel = () => {
  10097. ctx.emit("pick", oldValue.value, false);
  10098. };
  10099. const handleConfirm = (visible = false, first = false) => {
  10100. if (first)
  10101. return;
  10102. ctx.emit("pick", props.parsedValue, visible);
  10103. };
  10104. const handleChange2 = (_date) => {
  10105. if (!props.visible) {
  10106. return;
  10107. }
  10108. const result = getRangeAvailableTime(_date).millisecond(0);
  10109. ctx.emit("pick", result, true);
  10110. };
  10111. const setSelectionRange = (start2, end2) => {
  10112. ctx.emit("select-range", start2, end2);
  10113. selectionRange.value = [start2, end2];
  10114. };
  10115. const changeSelectionRange = (step) => {
  10116. const list = [0, 3].concat(showSeconds.value ? [6] : []);
  10117. const mapping = ["hours", "minutes"].concat(showSeconds.value ? ["seconds"] : []);
  10118. const index = list.indexOf(selectionRange.value[0]);
  10119. const next = (index + step + list.length) % list.length;
  10120. timePickerOptions["start_emitSelectRange"](mapping[next]);
  10121. };
  10122. const handleKeydown = (event) => {
  10123. const code = event.code;
  10124. if (code === EVENT_CODE.left || code === EVENT_CODE.right) {
  10125. const step = code === EVENT_CODE.left ? -1 : 1;
  10126. changeSelectionRange(step);
  10127. event.preventDefault();
  10128. return;
  10129. }
  10130. if (code === EVENT_CODE.up || code === EVENT_CODE.down) {
  10131. const step = code === EVENT_CODE.up ? -1 : 1;
  10132. timePickerOptions["start_scrollDown"](step);
  10133. event.preventDefault();
  10134. return;
  10135. }
  10136. };
  10137. const getRangeAvailableTime = (date4) => {
  10138. const availableMap = {
  10139. hour: getAvailableHours,
  10140. minute: getAvailableMinutes,
  10141. second: getAvailableSeconds
  10142. };
  10143. let result = date4;
  10144. ["hour", "minute", "second"].forEach((_2) => {
  10145. if (availableMap[_2]) {
  10146. let availableArr;
  10147. const method4 = availableMap[_2];
  10148. if (_2 === "minute") {
  10149. availableArr = method4(result.hour(), props.datetimeRole);
  10150. } else if (_2 === "second") {
  10151. availableArr = method4(result.hour(), result.minute(), props.datetimeRole);
  10152. } else {
  10153. availableArr = method4(props.datetimeRole);
  10154. }
  10155. if (availableArr && availableArr.length && !availableArr.includes(result[_2]())) {
  10156. result = result[_2](availableArr[0]);
  10157. }
  10158. }
  10159. });
  10160. return result;
  10161. };
  10162. const parseUserInput = (value) => {
  10163. if (!value)
  10164. return null;
  10165. return dayjs(value, props.format).locale(lang.value);
  10166. };
  10167. const formatToString = (value) => {
  10168. if (!value)
  10169. return null;
  10170. return value.format(props.format);
  10171. };
  10172. const getDefaultValue = () => {
  10173. return dayjs(defaultValue).locale(lang.value);
  10174. };
  10175. ctx.emit("set-picker-option", ["isValidValue", isValidValue]);
  10176. ctx.emit("set-picker-option", ["formatToString", formatToString]);
  10177. ctx.emit("set-picker-option", ["parseUserInput", parseUserInput]);
  10178. ctx.emit("set-picker-option", ["handleKeydown", handleKeydown]);
  10179. ctx.emit("set-picker-option", [
  10180. "getRangeAvailableTime",
  10181. getRangeAvailableTime
  10182. ]);
  10183. ctx.emit("set-picker-option", ["getDefaultValue", getDefaultValue]);
  10184. const timePickerOptions = {};
  10185. const onSetOption = (e) => {
  10186. timePickerOptions[e[0]] = e[1];
  10187. };
  10188. const pickerBase = inject("EP_PICKER_BASE");
  10189. const {
  10190. arrowControl,
  10191. disabledHours,
  10192. disabledMinutes,
  10193. disabledSeconds,
  10194. defaultValue
  10195. } = pickerBase.props;
  10196. const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = getAvailableArrs(disabledHours, disabledMinutes, disabledSeconds);
  10197. return {
  10198. ns,
  10199. transitionName,
  10200. arrowControl,
  10201. onSetOption,
  10202. t,
  10203. handleConfirm,
  10204. handleChange: handleChange2,
  10205. setSelectionRange,
  10206. amPmMode,
  10207. showSeconds,
  10208. handleCancel,
  10209. disabledHours,
  10210. disabledMinutes,
  10211. disabledSeconds
  10212. };
  10213. }
  10214. });
  10215. function _sfc_render$u(_ctx, _cache, $props, $setup, $data, $options) {
  10216. const _component_time_spinner = resolveComponent("time-spinner");
  10217. return openBlock(), createBlock(Transition, { name: _ctx.transitionName }, {
  10218. default: withCtx(() => [
  10219. _ctx.actualVisible || _ctx.visible ? (openBlock(), createElementBlock("div", {
  10220. key: 0,
  10221. class: normalizeClass(_ctx.ns.b("panel"))
  10222. }, [
  10223. createElementVNode("div", {
  10224. class: normalizeClass([_ctx.ns.be("panel", "content"), { "has-seconds": _ctx.showSeconds }])
  10225. }, [
  10226. createVNode(_component_time_spinner, {
  10227. ref: "spinner",
  10228. role: _ctx.datetimeRole || "start",
  10229. "arrow-control": _ctx.arrowControl,
  10230. "show-seconds": _ctx.showSeconds,
  10231. "am-pm-mode": _ctx.amPmMode,
  10232. "spinner-date": _ctx.parsedValue,
  10233. "disabled-hours": _ctx.disabledHours,
  10234. "disabled-minutes": _ctx.disabledMinutes,
  10235. "disabled-seconds": _ctx.disabledSeconds,
  10236. onChange: _ctx.handleChange,
  10237. onSetOption: _ctx.onSetOption,
  10238. onSelectRange: _ctx.setSelectionRange
  10239. }, null, 8, ["role", "arrow-control", "show-seconds", "am-pm-mode", "spinner-date", "disabled-hours", "disabled-minutes", "disabled-seconds", "onChange", "onSetOption", "onSelectRange"])
  10240. ], 2),
  10241. createElementVNode("div", {
  10242. class: normalizeClass(_ctx.ns.be("panel", "footer"))
  10243. }, [
  10244. createElementVNode("button", {
  10245. type: "button",
  10246. class: normalizeClass([_ctx.ns.be("panel", "btn"), "cancel"]),
  10247. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleCancel && _ctx.handleCancel(...args))
  10248. }, toDisplayString(_ctx.t("el.datepicker.cancel")), 3),
  10249. createElementVNode("button", {
  10250. type: "button",
  10251. class: normalizeClass([_ctx.ns.be("panel", "btn"), "confirm"]),
  10252. onClick: _cache[1] || (_cache[1] = ($event) => _ctx.handleConfirm())
  10253. }, toDisplayString(_ctx.t("el.datepicker.confirm")), 3)
  10254. ], 2)
  10255. ], 2)) : createCommentVNode("v-if", true)
  10256. ]),
  10257. _: 1
  10258. }, 8, ["name"]);
  10259. }
  10260. var TimePickPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$R, [["render", _sfc_render$u], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/time-picker/src/time-picker-com/panel-time-pick.vue"]]);
  10261. const makeSelectRange = (start2, end2) => {
  10262. const result = [];
  10263. for (let i = start2; i <= end2; i++) {
  10264. result.push(i);
  10265. }
  10266. return result;
  10267. };
  10268. const _sfc_main$Q = defineComponent({
  10269. components: { TimeSpinner },
  10270. props: {
  10271. visible: Boolean,
  10272. actualVisible: Boolean,
  10273. parsedValue: {
  10274. type: [Array]
  10275. },
  10276. format: {
  10277. type: String,
  10278. default: ""
  10279. }
  10280. },
  10281. emits: ["pick", "select-range", "set-picker-option"],
  10282. setup(props, ctx) {
  10283. const { t, lang } = useLocale();
  10284. const nsTime = useNamespace("time");
  10285. const nsPicker = useNamespace("picker");
  10286. const minDate = computed(() => props.parsedValue[0]);
  10287. const maxDate = computed(() => props.parsedValue[1]);
  10288. const oldValue = useOldValue(props);
  10289. const handleCancel = () => {
  10290. ctx.emit("pick", oldValue.value, false);
  10291. };
  10292. const showSeconds = computed(() => {
  10293. return props.format.includes("ss");
  10294. });
  10295. const amPmMode = computed(() => {
  10296. if (props.format.includes("A"))
  10297. return "A";
  10298. if (props.format.includes("a"))
  10299. return "a";
  10300. return "";
  10301. });
  10302. const minSelectableRange = ref([]);
  10303. const maxSelectableRange = ref([]);
  10304. const handleConfirm = (visible = false) => {
  10305. ctx.emit("pick", [minDate.value, maxDate.value], visible);
  10306. };
  10307. const handleMinChange = (date4) => {
  10308. handleChange2(date4.millisecond(0), maxDate.value);
  10309. };
  10310. const handleMaxChange = (date4) => {
  10311. handleChange2(minDate.value, date4.millisecond(0));
  10312. };
  10313. const isValidValue = (_date) => {
  10314. const parsedDate = _date.map((_2) => dayjs(_2).locale(lang.value));
  10315. const result = getRangeAvailableTime(parsedDate);
  10316. return parsedDate[0].isSame(result[0]) && parsedDate[1].isSame(result[1]);
  10317. };
  10318. const handleChange2 = (_minDate, _maxDate) => {
  10319. ctx.emit("pick", [_minDate, _maxDate], true);
  10320. };
  10321. const btnConfirmDisabled = computed(() => {
  10322. return minDate.value > maxDate.value;
  10323. });
  10324. const selectionRange = ref([0, 2]);
  10325. const setMinSelectionRange = (start2, end2) => {
  10326. ctx.emit("select-range", start2, end2, "min");
  10327. selectionRange.value = [start2, end2];
  10328. };
  10329. const offset2 = computed(() => showSeconds.value ? 11 : 8);
  10330. const setMaxSelectionRange = (start2, end2) => {
  10331. ctx.emit("select-range", start2, end2, "max");
  10332. selectionRange.value = [start2 + offset2.value, end2 + offset2.value];
  10333. };
  10334. const changeSelectionRange = (step) => {
  10335. const list = showSeconds.value ? [0, 3, 6, 11, 14, 17] : [0, 3, 8, 11];
  10336. const mapping = ["hours", "minutes"].concat(showSeconds.value ? ["seconds"] : []);
  10337. const index = list.indexOf(selectionRange.value[0]);
  10338. const next = (index + step + list.length) % list.length;
  10339. const half = list.length / 2;
  10340. if (next < half) {
  10341. timePickerOptions["start_emitSelectRange"](mapping[next]);
  10342. } else {
  10343. timePickerOptions["end_emitSelectRange"](mapping[next - half]);
  10344. }
  10345. };
  10346. const handleKeydown = (event) => {
  10347. const code = event.code;
  10348. if (code === EVENT_CODE.left || code === EVENT_CODE.right) {
  10349. const step = code === EVENT_CODE.left ? -1 : 1;
  10350. changeSelectionRange(step);
  10351. event.preventDefault();
  10352. return;
  10353. }
  10354. if (code === EVENT_CODE.up || code === EVENT_CODE.down) {
  10355. const step = code === EVENT_CODE.up ? -1 : 1;
  10356. const role = selectionRange.value[0] < offset2.value ? "start" : "end";
  10357. timePickerOptions[`${role}_scrollDown`](step);
  10358. event.preventDefault();
  10359. return;
  10360. }
  10361. };
  10362. const disabledHours_ = (role, compare) => {
  10363. const defaultDisable = disabledHours ? disabledHours(role) : [];
  10364. const isStart = role === "start";
  10365. const compareDate = compare || (isStart ? maxDate.value : minDate.value);
  10366. const compareHour = compareDate.hour();
  10367. const nextDisable = isStart ? makeSelectRange(compareHour + 1, 23) : makeSelectRange(0, compareHour - 1);
  10368. return union$1(defaultDisable, nextDisable);
  10369. };
  10370. const disabledMinutes_ = (hour, role, compare) => {
  10371. const defaultDisable = disabledMinutes ? disabledMinutes(hour, role) : [];
  10372. const isStart = role === "start";
  10373. const compareDate = compare || (isStart ? maxDate.value : minDate.value);
  10374. const compareHour = compareDate.hour();
  10375. if (hour !== compareHour) {
  10376. return defaultDisable;
  10377. }
  10378. const compareMinute = compareDate.minute();
  10379. const nextDisable = isStart ? makeSelectRange(compareMinute + 1, 59) : makeSelectRange(0, compareMinute - 1);
  10380. return union$1(defaultDisable, nextDisable);
  10381. };
  10382. const disabledSeconds_ = (hour, minute, role, compare) => {
  10383. const defaultDisable = disabledSeconds ? disabledSeconds(hour, minute, role) : [];
  10384. const isStart = role === "start";
  10385. const compareDate = compare || (isStart ? maxDate.value : minDate.value);
  10386. const compareHour = compareDate.hour();
  10387. const compareMinute = compareDate.minute();
  10388. if (hour !== compareHour || minute !== compareMinute) {
  10389. return defaultDisable;
  10390. }
  10391. const compareSecond = compareDate.second();
  10392. const nextDisable = isStart ? makeSelectRange(compareSecond + 1, 59) : makeSelectRange(0, compareSecond - 1);
  10393. return union$1(defaultDisable, nextDisable);
  10394. };
  10395. const getRangeAvailableTime = (dates) => {
  10396. return dates.map((_2, index) => getRangeAvailableTimeEach(dates[0], dates[1], index === 0 ? "start" : "end"));
  10397. };
  10398. const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = getAvailableArrs(disabledHours_, disabledMinutes_, disabledSeconds_);
  10399. const getRangeAvailableTimeEach = (startDate, endDate, role) => {
  10400. const availableMap = {
  10401. hour: getAvailableHours,
  10402. minute: getAvailableMinutes,
  10403. second: getAvailableSeconds
  10404. };
  10405. const isStart = role === "start";
  10406. let result = isStart ? startDate : endDate;
  10407. const compareDate = isStart ? endDate : startDate;
  10408. ["hour", "minute", "second"].forEach((_2) => {
  10409. if (availableMap[_2]) {
  10410. let availableArr;
  10411. const method4 = availableMap[_2];
  10412. if (_2 === "minute") {
  10413. availableArr = method4(result.hour(), role, compareDate);
  10414. } else if (_2 === "second") {
  10415. availableArr = method4(result.hour(), result.minute(), role, compareDate);
  10416. } else {
  10417. availableArr = method4(role, compareDate);
  10418. }
  10419. if (availableArr && availableArr.length && !availableArr.includes(result[_2]())) {
  10420. const pos = isStart ? 0 : availableArr.length - 1;
  10421. result = result[_2](availableArr[pos]);
  10422. }
  10423. }
  10424. });
  10425. return result;
  10426. };
  10427. const parseUserInput = (value) => {
  10428. if (!value)
  10429. return null;
  10430. if (Array.isArray(value)) {
  10431. return value.map((_2) => dayjs(_2, props.format).locale(lang.value));
  10432. }
  10433. return dayjs(value, props.format).locale(lang.value);
  10434. };
  10435. const formatToString = (value) => {
  10436. if (!value)
  10437. return null;
  10438. if (Array.isArray(value)) {
  10439. return value.map((_2) => _2.format(props.format));
  10440. }
  10441. return value.format(props.format);
  10442. };
  10443. const getDefaultValue = () => {
  10444. if (Array.isArray(defaultValue)) {
  10445. return defaultValue.map((_2) => dayjs(_2).locale(lang.value));
  10446. }
  10447. const defaultDay = dayjs(defaultValue).locale(lang.value);
  10448. return [defaultDay, defaultDay.add(60, "m")];
  10449. };
  10450. ctx.emit("set-picker-option", ["formatToString", formatToString]);
  10451. ctx.emit("set-picker-option", ["parseUserInput", parseUserInput]);
  10452. ctx.emit("set-picker-option", ["isValidValue", isValidValue]);
  10453. ctx.emit("set-picker-option", ["handleKeydown", handleKeydown]);
  10454. ctx.emit("set-picker-option", ["getDefaultValue", getDefaultValue]);
  10455. ctx.emit("set-picker-option", [
  10456. "getRangeAvailableTime",
  10457. getRangeAvailableTime
  10458. ]);
  10459. const timePickerOptions = {};
  10460. const onSetOption = (e) => {
  10461. timePickerOptions[e[0]] = e[1];
  10462. };
  10463. const pickerBase = inject("EP_PICKER_BASE");
  10464. const {
  10465. arrowControl,
  10466. disabledHours,
  10467. disabledMinutes,
  10468. disabledSeconds,
  10469. defaultValue
  10470. } = pickerBase.props;
  10471. return {
  10472. nsTime,
  10473. nsPicker,
  10474. arrowControl,
  10475. onSetOption,
  10476. setMaxSelectionRange,
  10477. setMinSelectionRange,
  10478. btnConfirmDisabled,
  10479. handleCancel,
  10480. handleConfirm,
  10481. t,
  10482. showSeconds,
  10483. minDate,
  10484. maxDate,
  10485. amPmMode,
  10486. handleMinChange,
  10487. handleMaxChange,
  10488. minSelectableRange,
  10489. maxSelectableRange,
  10490. disabledHours_,
  10491. disabledMinutes_,
  10492. disabledSeconds_
  10493. };
  10494. }
  10495. });
  10496. const _hoisted_1$y = ["disabled"];
  10497. function _sfc_render$t(_ctx, _cache, $props, $setup, $data, $options) {
  10498. const _component_time_spinner = resolveComponent("time-spinner");
  10499. return _ctx.actualVisible ? (openBlock(), createElementBlock("div", {
  10500. key: 0,
  10501. class: normalizeClass([_ctx.nsTime.b("range-picker"), _ctx.nsPicker.b("panel")])
  10502. }, [
  10503. createElementVNode("div", {
  10504. class: normalizeClass(_ctx.nsTime.be("range-picker", "content"))
  10505. }, [
  10506. createElementVNode("div", {
  10507. class: normalizeClass(_ctx.nsTime.be("range-picker", "cell"))
  10508. }, [
  10509. createElementVNode("div", {
  10510. class: normalizeClass(_ctx.nsTime.be("range-picker", "header"))
  10511. }, toDisplayString(_ctx.t("el.datepicker.startTime")), 3),
  10512. createElementVNode("div", {
  10513. class: normalizeClass([
  10514. _ctx.nsTime.be("range-picker", "body"),
  10515. _ctx.nsTime.be("panel", "content"),
  10516. _ctx.nsTime.is("arrow", _ctx.arrowControl),
  10517. { "has-seconds": _ctx.showSeconds }
  10518. ])
  10519. }, [
  10520. createVNode(_component_time_spinner, {
  10521. ref: "minSpinner",
  10522. role: "start",
  10523. "show-seconds": _ctx.showSeconds,
  10524. "am-pm-mode": _ctx.amPmMode,
  10525. "arrow-control": _ctx.arrowControl,
  10526. "spinner-date": _ctx.minDate,
  10527. "disabled-hours": _ctx.disabledHours_,
  10528. "disabled-minutes": _ctx.disabledMinutes_,
  10529. "disabled-seconds": _ctx.disabledSeconds_,
  10530. onChange: _ctx.handleMinChange,
  10531. onSetOption: _ctx.onSetOption,
  10532. onSelectRange: _ctx.setMinSelectionRange
  10533. }, null, 8, ["show-seconds", "am-pm-mode", "arrow-control", "spinner-date", "disabled-hours", "disabled-minutes", "disabled-seconds", "onChange", "onSetOption", "onSelectRange"])
  10534. ], 2)
  10535. ], 2),
  10536. createElementVNode("div", {
  10537. class: normalizeClass(_ctx.nsTime.be("range-picker", "cell"))
  10538. }, [
  10539. createElementVNode("div", {
  10540. class: normalizeClass(_ctx.nsTime.be("range-picker", "header"))
  10541. }, toDisplayString(_ctx.t("el.datepicker.endTime")), 3),
  10542. createElementVNode("div", {
  10543. class: normalizeClass([
  10544. _ctx.nsTime.be("range-picker", "body"),
  10545. _ctx.nsTime.be("panel", "content"),
  10546. _ctx.nsTime.is("arrow", _ctx.arrowControl),
  10547. { "has-seconds": _ctx.showSeconds }
  10548. ])
  10549. }, [
  10550. createVNode(_component_time_spinner, {
  10551. ref: "maxSpinner",
  10552. role: "end",
  10553. "show-seconds": _ctx.showSeconds,
  10554. "am-pm-mode": _ctx.amPmMode,
  10555. "arrow-control": _ctx.arrowControl,
  10556. "spinner-date": _ctx.maxDate,
  10557. "disabled-hours": _ctx.disabledHours_,
  10558. "disabled-minutes": _ctx.disabledMinutes_,
  10559. "disabled-seconds": _ctx.disabledSeconds_,
  10560. onChange: _ctx.handleMaxChange,
  10561. onSetOption: _ctx.onSetOption,
  10562. onSelectRange: _ctx.setMaxSelectionRange
  10563. }, null, 8, ["show-seconds", "am-pm-mode", "arrow-control", "spinner-date", "disabled-hours", "disabled-minutes", "disabled-seconds", "onChange", "onSetOption", "onSelectRange"])
  10564. ], 2)
  10565. ], 2)
  10566. ], 2),
  10567. createElementVNode("div", {
  10568. class: normalizeClass(_ctx.nsTime.be("panel", "footer"))
  10569. }, [
  10570. createElementVNode("button", {
  10571. type: "button",
  10572. class: normalizeClass([_ctx.nsTime.be("panel", "btn"), "cancel"]),
  10573. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.handleCancel())
  10574. }, toDisplayString(_ctx.t("el.datepicker.cancel")), 3),
  10575. createElementVNode("button", {
  10576. type: "button",
  10577. class: normalizeClass([_ctx.nsTime.be("panel", "btn"), "confirm"]),
  10578. disabled: _ctx.btnConfirmDisabled,
  10579. onClick: _cache[1] || (_cache[1] = ($event) => _ctx.handleConfirm())
  10580. }, toDisplayString(_ctx.t("el.datepicker.confirm")), 11, _hoisted_1$y)
  10581. ], 2)
  10582. ], 2)) : createCommentVNode("v-if", true);
  10583. }
  10584. var TimeRangePanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$Q, [["render", _sfc_render$t], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/time-picker/src/time-picker-com/panel-time-range.vue"]]);
  10585. dayjs.extend(customParseFormat);
  10586. var TimePicker = defineComponent({
  10587. name: "ElTimePicker",
  10588. install: null,
  10589. props: __spreadProps(__spreadValues({}, timePickerDefaultProps), {
  10590. isRange: {
  10591. type: Boolean,
  10592. default: false
  10593. }
  10594. }),
  10595. emits: ["update:modelValue"],
  10596. setup(props, ctx) {
  10597. const commonPicker = ref(null);
  10598. const type4 = props.isRange ? "timerange" : "time";
  10599. const panel = props.isRange ? TimeRangePanel : TimePickPanel;
  10600. const refProps = __spreadProps(__spreadValues({}, props), {
  10601. focus: () => {
  10602. var _a2;
  10603. (_a2 = commonPicker.value) == null ? void 0 : _a2.handleFocus();
  10604. },
  10605. blur: () => {
  10606. var _a2;
  10607. (_a2 = commonPicker.value) == null ? void 0 : _a2.handleBlur();
  10608. }
  10609. });
  10610. provide("ElPopperOptions", props.popperOptions);
  10611. ctx.expose(refProps);
  10612. return () => {
  10613. var _a2;
  10614. const format2 = (_a2 = props.format) != null ? _a2 : DEFAULT_FORMATS_TIME;
  10615. return h$1(CommonPicker, __spreadProps(__spreadValues({}, props), {
  10616. format: format2,
  10617. type: type4,
  10618. ref: commonPicker,
  10619. "onUpdate:modelValue": (value) => ctx.emit("update:modelValue", value)
  10620. }), {
  10621. default: (scopedProps) => h$1(panel, scopedProps)
  10622. });
  10623. };
  10624. }
  10625. });
  10626. const rangeArr = (n) => Array.from(Array.from({ length: n }).keys());
  10627. const extractDateFormat = (format2) => {
  10628. return format2.replace(/\W?m{1,2}|\W?ZZ/g, "").replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, "").trim();
  10629. };
  10630. const extractTimeFormat = (format2) => {
  10631. return format2.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?Y{2,4}/g, "").trim();
  10632. };
  10633. const _TimePicker = TimePicker;
  10634. _TimePicker.install = (app) => {
  10635. app.component(_TimePicker.name, _TimePicker);
  10636. };
  10637. const ElTimePicker = _TimePicker;
  10638. const useCheckboxProps = {
  10639. modelValue: {
  10640. type: [Boolean, Number, String],
  10641. default: () => void 0
  10642. },
  10643. label: {
  10644. type: [String, Boolean, Number, Object]
  10645. },
  10646. indeterminate: Boolean,
  10647. disabled: Boolean,
  10648. checked: Boolean,
  10649. name: {
  10650. type: String,
  10651. default: void 0
  10652. },
  10653. trueLabel: {
  10654. type: [String, Number],
  10655. default: void 0
  10656. },
  10657. falseLabel: {
  10658. type: [String, Number],
  10659. default: void 0
  10660. },
  10661. tabindex: [String, Number],
  10662. size: String
  10663. };
  10664. const useCheckboxGroup = () => {
  10665. const elForm2 = inject(formContextKey, {});
  10666. const elFormItem2 = inject(formItemContextKey, {});
  10667. const checkboxGroup = inject("CheckboxGroup", {});
  10668. const isGroup = computed(() => checkboxGroup && (checkboxGroup == null ? void 0 : checkboxGroup.name) === "ElCheckboxGroup");
  10669. const elFormItemSize = computed(() => {
  10670. return elFormItem2.size;
  10671. });
  10672. return {
  10673. isGroup,
  10674. checkboxGroup,
  10675. elForm: elForm2,
  10676. elFormItemSize,
  10677. elFormItem: elFormItem2
  10678. };
  10679. };
  10680. const useModel = (props) => {
  10681. const selfModel = ref(false);
  10682. const { emit } = getCurrentInstance();
  10683. const { isGroup, checkboxGroup } = useCheckboxGroup();
  10684. const isLimitExceeded = ref(false);
  10685. const model = computed({
  10686. get() {
  10687. var _a2, _b2;
  10688. return isGroup.value ? (_a2 = checkboxGroup.modelValue) == null ? void 0 : _a2.value : (_b2 = props.modelValue) != null ? _b2 : selfModel.value;
  10689. },
  10690. set(val) {
  10691. var _a2;
  10692. if (isGroup.value && Array.isArray(val)) {
  10693. isLimitExceeded.value = checkboxGroup.max !== void 0 && val.length > checkboxGroup.max.value;
  10694. isLimitExceeded.value === false && ((_a2 = checkboxGroup == null ? void 0 : checkboxGroup.changeEvent) == null ? void 0 : _a2.call(checkboxGroup, val));
  10695. } else {
  10696. emit(UPDATE_MODEL_EVENT, val);
  10697. selfModel.value = val;
  10698. }
  10699. }
  10700. });
  10701. return {
  10702. model,
  10703. isLimitExceeded
  10704. };
  10705. };
  10706. const useCheckboxStatus = (props, { model }) => {
  10707. const { isGroup, checkboxGroup } = useCheckboxGroup();
  10708. const focus = ref(false);
  10709. const size = useSize(checkboxGroup == null ? void 0 : checkboxGroup.checkboxGroupSize, { prop: true });
  10710. const isChecked = computed(() => {
  10711. const value = model.value;
  10712. if (toTypeString(value) === "[object Boolean]") {
  10713. return value;
  10714. } else if (Array.isArray(value)) {
  10715. return value.includes(props.label);
  10716. } else if (value !== null && value !== void 0) {
  10717. return value === props.trueLabel;
  10718. } else {
  10719. return !!value;
  10720. }
  10721. });
  10722. const checkboxSize = useSize(computed(() => {
  10723. var _a2;
  10724. return isGroup.value ? (_a2 = checkboxGroup == null ? void 0 : checkboxGroup.checkboxGroupSize) == null ? void 0 : _a2.value : void 0;
  10725. }));
  10726. return {
  10727. isChecked,
  10728. focus,
  10729. size,
  10730. checkboxSize
  10731. };
  10732. };
  10733. const useDisabled = (props, {
  10734. model,
  10735. isChecked
  10736. }) => {
  10737. const { elForm: elForm2, isGroup, checkboxGroup } = useCheckboxGroup();
  10738. const isLimitDisabled = computed(() => {
  10739. var _a2, _b2;
  10740. const max2 = (_a2 = checkboxGroup.max) == null ? void 0 : _a2.value;
  10741. const min2 = (_b2 = checkboxGroup.min) == null ? void 0 : _b2.value;
  10742. return !!(max2 || min2) && model.value.length >= max2 && !isChecked.value || model.value.length <= min2 && isChecked.value;
  10743. });
  10744. const isDisabled = computed(() => {
  10745. var _a2, _b2;
  10746. const disabled = props.disabled || elForm2.disabled;
  10747. return (_b2 = isGroup.value ? ((_a2 = checkboxGroup.disabled) == null ? void 0 : _a2.value) || disabled || isLimitDisabled.value : props.disabled || elForm2.disabled) != null ? _b2 : false;
  10748. });
  10749. return {
  10750. isDisabled,
  10751. isLimitDisabled
  10752. };
  10753. };
  10754. const setStoreValue = (props, { model }) => {
  10755. function addToStore() {
  10756. if (Array.isArray(model.value) && !model.value.includes(props.label)) {
  10757. model.value.push(props.label);
  10758. } else {
  10759. model.value = props.trueLabel || true;
  10760. }
  10761. }
  10762. props.checked && addToStore();
  10763. };
  10764. const useEvent$1 = (props, { isLimitExceeded }) => {
  10765. const { elFormItem: elFormItem2 } = useCheckboxGroup();
  10766. const { emit } = getCurrentInstance();
  10767. function handleChange2(e) {
  10768. var _a2, _b2;
  10769. if (isLimitExceeded.value)
  10770. return;
  10771. const target = e.target;
  10772. const value = target.checked ? (_a2 = props.trueLabel) != null ? _a2 : true : (_b2 = props.falseLabel) != null ? _b2 : false;
  10773. emit("change", value, e);
  10774. }
  10775. watch(() => props.modelValue, () => {
  10776. var _a2;
  10777. (_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "change").catch((err) => debugWarn());
  10778. });
  10779. return {
  10780. handleChange: handleChange2
  10781. };
  10782. };
  10783. const useCheckbox = (props) => {
  10784. const { model, isLimitExceeded } = useModel(props);
  10785. const { focus, size, isChecked, checkboxSize } = useCheckboxStatus(props, {
  10786. model
  10787. });
  10788. const { isDisabled } = useDisabled(props, { model, isChecked });
  10789. const { handleChange: handleChange2 } = useEvent$1(props, { isLimitExceeded });
  10790. setStoreValue(props, { model });
  10791. return {
  10792. isChecked,
  10793. isDisabled,
  10794. checkboxSize,
  10795. model,
  10796. handleChange: handleChange2,
  10797. focus,
  10798. size
  10799. };
  10800. };
  10801. const _sfc_main$P = defineComponent({
  10802. name: "ElCheckbox",
  10803. props: {
  10804. modelValue: {
  10805. type: [Number, String, Boolean],
  10806. default: () => void 0
  10807. },
  10808. label: {
  10809. type: [String, Boolean, Number, Object]
  10810. },
  10811. indeterminate: Boolean,
  10812. disabled: Boolean,
  10813. checked: Boolean,
  10814. name: {
  10815. type: String,
  10816. default: void 0
  10817. },
  10818. trueLabel: {
  10819. type: [String, Number],
  10820. default: void 0
  10821. },
  10822. falseLabel: {
  10823. type: [String, Number],
  10824. default: void 0
  10825. },
  10826. id: {
  10827. type: String,
  10828. default: void 0
  10829. },
  10830. controls: {
  10831. type: String,
  10832. default: void 0
  10833. },
  10834. border: Boolean,
  10835. size: {
  10836. type: String,
  10837. validator: isValidComponentSize
  10838. },
  10839. tabindex: [String, Number]
  10840. },
  10841. emits: [UPDATE_MODEL_EVENT, "change"],
  10842. setup(props) {
  10843. const ns = useNamespace("checkbox");
  10844. return __spreadValues({
  10845. ns
  10846. }, useCheckbox(props));
  10847. }
  10848. });
  10849. const _hoisted_1$x = ["id", "aria-controls"];
  10850. const _hoisted_2$q = ["tabindex", "role", "aria-checked"];
  10851. const _hoisted_3$h = ["aria-hidden", "name", "tabindex", "disabled", "true-value", "false-value"];
  10852. const _hoisted_4$e = ["aria-hidden", "disabled", "value", "name", "tabindex"];
  10853. function _sfc_render$s(_ctx, _cache, $props, $setup, $data, $options) {
  10854. return openBlock(), createElementBlock("label", {
  10855. id: _ctx.id,
  10856. class: normalizeClass([
  10857. _ctx.ns.b(),
  10858. _ctx.ns.m(_ctx.checkboxSize),
  10859. _ctx.ns.is("disabled", _ctx.isDisabled),
  10860. _ctx.ns.is("bordered", _ctx.border),
  10861. _ctx.ns.is("checked", _ctx.isChecked)
  10862. ]),
  10863. "aria-controls": _ctx.indeterminate ? _ctx.controls : null
  10864. }, [
  10865. createElementVNode("span", {
  10866. class: normalizeClass([
  10867. _ctx.ns.e("input"),
  10868. _ctx.ns.is("disabled", _ctx.isDisabled),
  10869. _ctx.ns.is("checked", _ctx.isChecked),
  10870. _ctx.ns.is("indeterminate", _ctx.indeterminate),
  10871. _ctx.ns.is("focus", _ctx.focus)
  10872. ]),
  10873. tabindex: _ctx.indeterminate ? 0 : void 0,
  10874. role: _ctx.indeterminate ? "checkbox" : void 0,
  10875. "aria-checked": _ctx.indeterminate ? "mixed" : false
  10876. }, [
  10877. createElementVNode("span", {
  10878. class: normalizeClass(_ctx.ns.e("inner"))
  10879. }, null, 2),
  10880. _ctx.trueLabel || _ctx.falseLabel ? withDirectives((openBlock(), createElementBlock("input", {
  10881. key: 0,
  10882. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model = $event),
  10883. class: normalizeClass(_ctx.ns.e("original")),
  10884. type: "checkbox",
  10885. "aria-hidden": _ctx.indeterminate ? "true" : "false",
  10886. name: _ctx.name,
  10887. tabindex: _ctx.tabindex,
  10888. disabled: _ctx.isDisabled,
  10889. "true-value": _ctx.trueLabel,
  10890. "false-value": _ctx.falseLabel,
  10891. onChange: _cache[1] || (_cache[1] = (...args) => _ctx.handleChange && _ctx.handleChange(...args)),
  10892. onFocus: _cache[2] || (_cache[2] = ($event) => _ctx.focus = true),
  10893. onBlur: _cache[3] || (_cache[3] = ($event) => _ctx.focus = false)
  10894. }, null, 42, _hoisted_3$h)), [
  10895. [vModelCheckbox, _ctx.model]
  10896. ]) : withDirectives((openBlock(), createElementBlock("input", {
  10897. key: 1,
  10898. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => _ctx.model = $event),
  10899. class: normalizeClass(_ctx.ns.e("original")),
  10900. type: "checkbox",
  10901. "aria-hidden": _ctx.indeterminate ? "true" : "false",
  10902. disabled: _ctx.isDisabled,
  10903. value: _ctx.label,
  10904. name: _ctx.name,
  10905. tabindex: _ctx.tabindex,
  10906. onChange: _cache[5] || (_cache[5] = (...args) => _ctx.handleChange && _ctx.handleChange(...args)),
  10907. onFocus: _cache[6] || (_cache[6] = ($event) => _ctx.focus = true),
  10908. onBlur: _cache[7] || (_cache[7] = ($event) => _ctx.focus = false)
  10909. }, null, 42, _hoisted_4$e)), [
  10910. [vModelCheckbox, _ctx.model]
  10911. ])
  10912. ], 10, _hoisted_2$q),
  10913. _ctx.$slots.default || _ctx.label ? (openBlock(), createElementBlock("span", {
  10914. key: 0,
  10915. class: normalizeClass(_ctx.ns.e("label"))
  10916. }, [
  10917. renderSlot(_ctx.$slots, "default"),
  10918. !_ctx.$slots.default ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  10919. createTextVNode(toDisplayString(_ctx.label), 1)
  10920. ], 2112)) : createCommentVNode("v-if", true)
  10921. ], 2)) : createCommentVNode("v-if", true)
  10922. ], 10, _hoisted_1$x);
  10923. }
  10924. var Checkbox = /* @__PURE__ */ _export_sfc$1(_sfc_main$P, [["render", _sfc_render$s], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/checkbox/src/checkbox.vue"]]);
  10925. const _sfc_main$O = defineComponent({
  10926. name: "ElCheckboxButton",
  10927. props: useCheckboxProps,
  10928. emits: [UPDATE_MODEL_EVENT, "change"],
  10929. setup(props) {
  10930. const { focus, isChecked, isDisabled, size, model, handleChange: handleChange2 } = useCheckbox(props);
  10931. const { checkboxGroup } = useCheckboxGroup();
  10932. const ns = useNamespace("checkbox");
  10933. const activeStyle = computed(() => {
  10934. var _a2, _b2, _c, _d;
  10935. const fillValue = (_b2 = (_a2 = checkboxGroup == null ? void 0 : checkboxGroup.fill) == null ? void 0 : _a2.value) != null ? _b2 : "";
  10936. return {
  10937. backgroundColor: fillValue,
  10938. borderColor: fillValue,
  10939. color: (_d = (_c = checkboxGroup == null ? void 0 : checkboxGroup.textColor) == null ? void 0 : _c.value) != null ? _d : "",
  10940. boxShadow: fillValue ? `-1px 0 0 0 ${fillValue}` : null
  10941. };
  10942. });
  10943. return {
  10944. focus,
  10945. isChecked,
  10946. isDisabled,
  10947. model,
  10948. handleChange: handleChange2,
  10949. activeStyle,
  10950. size,
  10951. ns
  10952. };
  10953. }
  10954. });
  10955. const _hoisted_1$w = ["aria-checked", "aria-disabled"];
  10956. const _hoisted_2$p = ["name", "tabindex", "disabled", "true-value", "false-value"];
  10957. const _hoisted_3$g = ["name", "tabindex", "disabled", "value"];
  10958. function _sfc_render$r(_ctx, _cache, $props, $setup, $data, $options) {
  10959. return openBlock(), createElementBlock("label", {
  10960. class: normalizeClass([
  10961. _ctx.ns.b("button"),
  10962. _ctx.ns.bm("button", _ctx.size),
  10963. _ctx.ns.is("disabled", _ctx.isDisabled),
  10964. _ctx.ns.is("checked", _ctx.isChecked),
  10965. _ctx.ns.is("focus", _ctx.focus)
  10966. ]),
  10967. role: "checkbox",
  10968. "aria-checked": _ctx.isChecked,
  10969. "aria-disabled": _ctx.isDisabled
  10970. }, [
  10971. _ctx.trueLabel || _ctx.falseLabel ? withDirectives((openBlock(), createElementBlock("input", {
  10972. key: 0,
  10973. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model = $event),
  10974. class: normalizeClass(_ctx.ns.be("button", "original")),
  10975. type: "checkbox",
  10976. name: _ctx.name,
  10977. tabindex: _ctx.tabindex,
  10978. disabled: _ctx.isDisabled,
  10979. "true-value": _ctx.trueLabel,
  10980. "false-value": _ctx.falseLabel,
  10981. onChange: _cache[1] || (_cache[1] = (...args) => _ctx.handleChange && _ctx.handleChange(...args)),
  10982. onFocus: _cache[2] || (_cache[2] = ($event) => _ctx.focus = true),
  10983. onBlur: _cache[3] || (_cache[3] = ($event) => _ctx.focus = false)
  10984. }, null, 42, _hoisted_2$p)), [
  10985. [vModelCheckbox, _ctx.model]
  10986. ]) : withDirectives((openBlock(), createElementBlock("input", {
  10987. key: 1,
  10988. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => _ctx.model = $event),
  10989. class: normalizeClass(_ctx.ns.be("button", "original")),
  10990. type: "checkbox",
  10991. name: _ctx.name,
  10992. tabindex: _ctx.tabindex,
  10993. disabled: _ctx.isDisabled,
  10994. value: _ctx.label,
  10995. onChange: _cache[5] || (_cache[5] = (...args) => _ctx.handleChange && _ctx.handleChange(...args)),
  10996. onFocus: _cache[6] || (_cache[6] = ($event) => _ctx.focus = true),
  10997. onBlur: _cache[7] || (_cache[7] = ($event) => _ctx.focus = false)
  10998. }, null, 42, _hoisted_3$g)), [
  10999. [vModelCheckbox, _ctx.model]
  11000. ]),
  11001. _ctx.$slots.default || _ctx.label ? (openBlock(), createElementBlock("span", {
  11002. key: 2,
  11003. class: normalizeClass(_ctx.ns.be("button", "inner")),
  11004. style: normalizeStyle(_ctx.isChecked ? _ctx.activeStyle : null)
  11005. }, [
  11006. renderSlot(_ctx.$slots, "default", {}, () => [
  11007. createTextVNode(toDisplayString(_ctx.label), 1)
  11008. ])
  11009. ], 6)) : createCommentVNode("v-if", true)
  11010. ], 10, _hoisted_1$w);
  11011. }
  11012. var CheckboxButton = /* @__PURE__ */ _export_sfc$1(_sfc_main$O, [["render", _sfc_render$r], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/checkbox/src/checkbox-button.vue"]]);
  11013. const _sfc_main$N = defineComponent({
  11014. name: "ElCheckboxGroup",
  11015. props: {
  11016. modelValue: {
  11017. type: Array,
  11018. default: () => []
  11019. },
  11020. disabled: Boolean,
  11021. min: {
  11022. type: Number,
  11023. default: void 0
  11024. },
  11025. max: {
  11026. type: Number,
  11027. default: void 0
  11028. },
  11029. size: {
  11030. type: String,
  11031. validator: isValidComponentSize
  11032. },
  11033. fill: {
  11034. type: String,
  11035. default: void 0
  11036. },
  11037. textColor: {
  11038. type: String,
  11039. default: void 0
  11040. },
  11041. tag: {
  11042. type: String,
  11043. default: "div"
  11044. }
  11045. },
  11046. emits: [UPDATE_MODEL_EVENT, "change"],
  11047. setup(props, { emit, slots }) {
  11048. const { elFormItem: elFormItem2 } = useCheckboxGroup();
  11049. const checkboxGroupSize = useSize();
  11050. const ns = useNamespace("checkbox");
  11051. const changeEvent = (value) => {
  11052. emit(UPDATE_MODEL_EVENT, value);
  11053. nextTick(() => {
  11054. emit("change", value);
  11055. });
  11056. };
  11057. const modelValue = computed({
  11058. get() {
  11059. return props.modelValue;
  11060. },
  11061. set(val) {
  11062. changeEvent(val);
  11063. }
  11064. });
  11065. provide("CheckboxGroup", __spreadProps(__spreadValues({
  11066. name: "ElCheckboxGroup",
  11067. modelValue
  11068. }, toRefs(props)), {
  11069. checkboxGroupSize,
  11070. changeEvent
  11071. }));
  11072. watch(() => props.modelValue, () => {
  11073. var _a2;
  11074. (_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "change").catch((err) => debugWarn());
  11075. });
  11076. return () => {
  11077. return h$1(props.tag, {
  11078. class: ns.b("group"),
  11079. role: "group",
  11080. "aria-label": "checkbox-group"
  11081. }, [renderSlot(slots, "default")]);
  11082. };
  11083. }
  11084. });
  11085. var CheckboxGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$N, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/checkbox/src/checkbox-group.vue"]]);
  11086. const ElCheckbox = withInstall(Checkbox, {
  11087. CheckboxButton,
  11088. CheckboxGroup
  11089. });
  11090. withNoopInstall(CheckboxButton);
  11091. const ElCheckboxGroup$1 = withNoopInstall(CheckboxGroup);
  11092. const radioPropsBase = buildProps({
  11093. size: useSizeProp,
  11094. disabled: Boolean,
  11095. label: {
  11096. type: [String, Number, Boolean],
  11097. default: ""
  11098. }
  11099. });
  11100. const radioProps = buildProps(__spreadProps(__spreadValues({}, radioPropsBase), {
  11101. modelValue: {
  11102. type: [String, Number, Boolean],
  11103. default: ""
  11104. },
  11105. name: {
  11106. type: String,
  11107. default: ""
  11108. },
  11109. border: Boolean
  11110. }));
  11111. const radioEmits = {
  11112. [UPDATE_MODEL_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val),
  11113. change: (val) => isString(val) || isNumber(val) || isBoolean(val)
  11114. };
  11115. const useRadio = (props, emit) => {
  11116. const radioRef = ref();
  11117. const radioGroup = inject(radioGroupKey, void 0);
  11118. const isGroup = computed(() => !!radioGroup);
  11119. const modelValue = computed({
  11120. get() {
  11121. return isGroup.value ? radioGroup.modelValue : props.modelValue;
  11122. },
  11123. set(val) {
  11124. if (isGroup.value) {
  11125. radioGroup.changeEvent(val);
  11126. } else {
  11127. emit(UPDATE_MODEL_EVENT, val);
  11128. }
  11129. radioRef.value.checked = props.modelValue === props.label;
  11130. }
  11131. });
  11132. const size = useSize(computed(() => radioGroup == null ? void 0 : radioGroup.size));
  11133. const disabled = useDisabled$1(computed(() => radioGroup == null ? void 0 : radioGroup.disabled));
  11134. const focus = ref(false);
  11135. const tabIndex = computed(() => {
  11136. return disabled.value || isGroup.value && modelValue.value !== props.label ? -1 : 0;
  11137. });
  11138. return {
  11139. radioRef,
  11140. isGroup,
  11141. radioGroup,
  11142. focus,
  11143. size,
  11144. disabled,
  11145. tabIndex,
  11146. modelValue
  11147. };
  11148. };
  11149. const _sfc_main$M = defineComponent({
  11150. name: "ElRadio",
  11151. props: radioProps,
  11152. emits: radioEmits,
  11153. setup(props, { emit }) {
  11154. const ns = useNamespace("radio");
  11155. const { radioRef, isGroup, focus, size, disabled, tabIndex, modelValue } = useRadio(props, emit);
  11156. function handleChange2() {
  11157. nextTick(() => emit("change", modelValue.value));
  11158. }
  11159. return {
  11160. ns,
  11161. focus,
  11162. isGroup,
  11163. modelValue,
  11164. tabIndex,
  11165. size,
  11166. disabled,
  11167. radioRef,
  11168. handleChange: handleChange2
  11169. };
  11170. }
  11171. });
  11172. const _hoisted_1$v = ["aria-checked", "aria-disabled", "tabindex"];
  11173. const _hoisted_2$o = ["value", "name", "disabled"];
  11174. function _sfc_render$q(_ctx, _cache, $props, $setup, $data, $options) {
  11175. return openBlock(), createElementBlock("label", {
  11176. class: normalizeClass([
  11177. _ctx.ns.b(),
  11178. _ctx.ns.is("disabled", _ctx.disabled),
  11179. _ctx.ns.is("focus", _ctx.focus),
  11180. _ctx.ns.is("bordered", _ctx.border),
  11181. _ctx.ns.is("checked", _ctx.modelValue === _ctx.label),
  11182. _ctx.ns.m(_ctx.size)
  11183. ]),
  11184. role: "radio",
  11185. "aria-checked": _ctx.modelValue === _ctx.label,
  11186. "aria-disabled": _ctx.disabled,
  11187. tabindex: _ctx.tabIndex,
  11188. onKeydown: _cache[5] || (_cache[5] = withKeys(withModifiers(($event) => _ctx.modelValue = _ctx.disabled ? _ctx.modelValue : _ctx.label, ["stop", "prevent"]), ["space"]))
  11189. }, [
  11190. createElementVNode("span", {
  11191. class: normalizeClass([
  11192. _ctx.ns.e("input"),
  11193. _ctx.ns.is("disabled", _ctx.disabled),
  11194. _ctx.ns.is("checked", _ctx.modelValue === _ctx.label)
  11195. ])
  11196. }, [
  11197. createElementVNode("span", {
  11198. class: normalizeClass(_ctx.ns.e("inner"))
  11199. }, null, 2),
  11200. withDirectives(createElementVNode("input", {
  11201. ref: "radioRef",
  11202. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.modelValue = $event),
  11203. class: normalizeClass(_ctx.ns.e("original")),
  11204. value: _ctx.label,
  11205. type: "radio",
  11206. "aria-hidden": "true",
  11207. name: _ctx.name,
  11208. disabled: _ctx.disabled,
  11209. tabindex: "-1",
  11210. onFocus: _cache[1] || (_cache[1] = ($event) => _ctx.focus = true),
  11211. onBlur: _cache[2] || (_cache[2] = ($event) => _ctx.focus = false),
  11212. onChange: _cache[3] || (_cache[3] = (...args) => _ctx.handleChange && _ctx.handleChange(...args))
  11213. }, null, 42, _hoisted_2$o), [
  11214. [vModelRadio, _ctx.modelValue]
  11215. ])
  11216. ], 2),
  11217. createElementVNode("span", {
  11218. class: normalizeClass(_ctx.ns.e("label")),
  11219. onKeydown: _cache[4] || (_cache[4] = withModifiers(() => {
  11220. }, ["stop"]))
  11221. }, [
  11222. renderSlot(_ctx.$slots, "default", {}, () => [
  11223. createTextVNode(toDisplayString(_ctx.label), 1)
  11224. ])
  11225. ], 34)
  11226. ], 42, _hoisted_1$v);
  11227. }
  11228. var Radio = /* @__PURE__ */ _export_sfc$1(_sfc_main$M, [["render", _sfc_render$q], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/radio/src/radio.vue"]]);
  11229. const radioButtonProps = buildProps(__spreadProps(__spreadValues({}, radioPropsBase), {
  11230. name: {
  11231. type: String,
  11232. default: ""
  11233. }
  11234. }));
  11235. const _sfc_main$L = defineComponent({
  11236. name: "ElRadioButton",
  11237. props: radioButtonProps,
  11238. setup(props, { emit }) {
  11239. const ns = useNamespace("radio");
  11240. const {
  11241. radioRef,
  11242. isGroup,
  11243. focus,
  11244. size,
  11245. disabled,
  11246. tabIndex,
  11247. modelValue,
  11248. radioGroup
  11249. } = useRadio(props, emit);
  11250. const activeStyle = computed(() => {
  11251. return {
  11252. backgroundColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
  11253. borderColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
  11254. boxShadow: (radioGroup == null ? void 0 : radioGroup.fill) ? `-1px 0 0 0 ${radioGroup.fill}` : "",
  11255. color: (radioGroup == null ? void 0 : radioGroup.textColor) || ""
  11256. };
  11257. });
  11258. return {
  11259. ns,
  11260. isGroup,
  11261. size,
  11262. disabled,
  11263. tabIndex,
  11264. modelValue,
  11265. focus,
  11266. activeStyle,
  11267. radioRef
  11268. };
  11269. }
  11270. });
  11271. const _hoisted_1$u = ["aria-checked", "aria-disabled", "tabindex"];
  11272. const _hoisted_2$n = ["value", "name", "disabled"];
  11273. function _sfc_render$p(_ctx, _cache, $props, $setup, $data, $options) {
  11274. return openBlock(), createElementBlock("label", {
  11275. class: normalizeClass([
  11276. _ctx.ns.b("button"),
  11277. _ctx.ns.is("active", _ctx.modelValue === _ctx.label),
  11278. _ctx.ns.is("disabled", _ctx.disabled),
  11279. _ctx.ns.is("focus", _ctx.focus),
  11280. _ctx.ns.bm("button", _ctx.size)
  11281. ]),
  11282. role: "radio",
  11283. "aria-checked": _ctx.modelValue === _ctx.label,
  11284. "aria-disabled": _ctx.disabled,
  11285. tabindex: _ctx.tabIndex,
  11286. onKeydown: _cache[4] || (_cache[4] = withKeys(withModifiers(($event) => _ctx.modelValue = _ctx.disabled ? _ctx.modelValue : _ctx.label, ["stop", "prevent"]), ["space"]))
  11287. }, [
  11288. withDirectives(createElementVNode("input", {
  11289. ref: "radioRef",
  11290. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.modelValue = $event),
  11291. class: normalizeClass(_ctx.ns.be("button", "original-radio")),
  11292. value: _ctx.label,
  11293. type: "radio",
  11294. name: _ctx.name,
  11295. disabled: _ctx.disabled,
  11296. tabindex: "-1",
  11297. onFocus: _cache[1] || (_cache[1] = ($event) => _ctx.focus = true),
  11298. onBlur: _cache[2] || (_cache[2] = ($event) => _ctx.focus = false)
  11299. }, null, 42, _hoisted_2$n), [
  11300. [vModelRadio, _ctx.modelValue]
  11301. ]),
  11302. createElementVNode("span", {
  11303. class: normalizeClass(_ctx.ns.be("button", "inner")),
  11304. style: normalizeStyle(_ctx.modelValue === _ctx.label ? _ctx.activeStyle : {}),
  11305. onKeydown: _cache[3] || (_cache[3] = withModifiers(() => {
  11306. }, ["stop"]))
  11307. }, [
  11308. renderSlot(_ctx.$slots, "default", {}, () => [
  11309. createTextVNode(toDisplayString(_ctx.label), 1)
  11310. ])
  11311. ], 38)
  11312. ], 42, _hoisted_1$u);
  11313. }
  11314. var RadioButton = /* @__PURE__ */ _export_sfc$1(_sfc_main$L, [["render", _sfc_render$p], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/radio/src/radio-button.vue"]]);
  11315. const radioGroupProps = buildProps({
  11316. size: useSizeProp,
  11317. disabled: Boolean,
  11318. modelValue: {
  11319. type: [String, Number, Boolean],
  11320. default: ""
  11321. },
  11322. fill: {
  11323. type: String,
  11324. default: ""
  11325. },
  11326. textColor: {
  11327. type: String,
  11328. default: ""
  11329. }
  11330. });
  11331. const radioGroupEmits = radioEmits;
  11332. const _sfc_main$K = defineComponent({
  11333. name: "ElRadioGroup",
  11334. props: radioGroupProps,
  11335. emits: radioGroupEmits,
  11336. setup(props, ctx) {
  11337. const ns = useNamespace("radio");
  11338. const radioGroupRef = ref();
  11339. const { formItem } = useFormItem();
  11340. const changeEvent = (value) => {
  11341. ctx.emit(UPDATE_MODEL_EVENT, value);
  11342. nextTick(() => ctx.emit("change", value));
  11343. };
  11344. const handleKeydown = (e) => {
  11345. if (!radioGroupRef.value)
  11346. return;
  11347. const target = e.target;
  11348. const className = target.nodeName === "INPUT" ? "[type=radio]" : "[role=radio]";
  11349. const radios = radioGroupRef.value.querySelectorAll(className);
  11350. const length = radios.length;
  11351. const index = Array.from(radios).indexOf(target);
  11352. const roleRadios = radioGroupRef.value.querySelectorAll("[role=radio]");
  11353. let nextIndex = null;
  11354. switch (e.code) {
  11355. case EVENT_CODE.left:
  11356. case EVENT_CODE.up:
  11357. e.stopPropagation();
  11358. e.preventDefault();
  11359. nextIndex = index === 0 ? length - 1 : index - 1;
  11360. break;
  11361. case EVENT_CODE.right:
  11362. case EVENT_CODE.down:
  11363. e.stopPropagation();
  11364. e.preventDefault();
  11365. nextIndex = index === length - 1 ? 0 : index + 1;
  11366. break;
  11367. }
  11368. if (nextIndex === null)
  11369. return;
  11370. roleRadios[nextIndex].click();
  11371. roleRadios[nextIndex].focus();
  11372. };
  11373. onMounted(() => {
  11374. const radios = radioGroupRef.value.querySelectorAll("[type=radio]");
  11375. const firstLabel = radios[0];
  11376. if (!Array.from(radios).some((radio) => radio.checked) && firstLabel) {
  11377. firstLabel.tabIndex = 0;
  11378. }
  11379. });
  11380. provide(radioGroupKey, reactive(__spreadProps(__spreadValues({}, toRefs(props)), {
  11381. changeEvent
  11382. })));
  11383. watch(() => props.modelValue, () => formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn()));
  11384. return {
  11385. ns,
  11386. radioGroupRef,
  11387. handleKeydown
  11388. };
  11389. }
  11390. });
  11391. function _sfc_render$o(_ctx, _cache, $props, $setup, $data, $options) {
  11392. return openBlock(), createElementBlock("div", {
  11393. ref: "radioGroupRef",
  11394. class: normalizeClass(_ctx.ns.b("group")),
  11395. role: "radiogroup",
  11396. onKeydown: _cache[0] || (_cache[0] = (...args) => _ctx.handleKeydown && _ctx.handleKeydown(...args))
  11397. }, [
  11398. renderSlot(_ctx.$slots, "default")
  11399. ], 34);
  11400. }
  11401. var RadioGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$K, [["render", _sfc_render$o], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/radio/src/radio-group.vue"]]);
  11402. const ElRadio = withInstall(Radio, {
  11403. RadioButton,
  11404. RadioGroup
  11405. });
  11406. const ElRadioGroup = withNoopInstall(RadioGroup);
  11407. const ElRadioButton = withNoopInstall(RadioButton);
  11408. var NodeContent = defineComponent({
  11409. name: "NodeContent",
  11410. setup() {
  11411. const ns = useNamespace("cascader-node");
  11412. return {
  11413. ns
  11414. };
  11415. },
  11416. render() {
  11417. const { ns } = this;
  11418. const { node, panel } = this.$parent;
  11419. const { data: data2, label } = node;
  11420. const { renderLabelFn } = panel;
  11421. return h$1("span", { class: ns.e("label") }, renderLabelFn ? renderLabelFn({ node, data: data2 }) : label);
  11422. }
  11423. });
  11424. const CASCADER_PANEL_INJECTION_KEY = Symbol();
  11425. const _sfc_main$J = defineComponent({
  11426. name: "ElCascaderNode",
  11427. components: {
  11428. ElCheckbox,
  11429. ElRadio,
  11430. NodeContent,
  11431. ElIcon,
  11432. Check: check,
  11433. Loading: loading,
  11434. ArrowRight: arrowRight
  11435. },
  11436. props: {
  11437. node: {
  11438. type: Object,
  11439. required: true
  11440. },
  11441. menuId: String
  11442. },
  11443. emits: ["expand"],
  11444. setup(props, { emit }) {
  11445. const panel = inject(CASCADER_PANEL_INJECTION_KEY);
  11446. const ns = useNamespace("cascader-node");
  11447. const isHoverMenu = computed(() => panel.isHoverMenu);
  11448. const multiple = computed(() => panel.config.multiple);
  11449. const checkStrictly = computed(() => panel.config.checkStrictly);
  11450. const checkedNodeId = computed(() => {
  11451. var _a2;
  11452. return (_a2 = panel.checkedNodes[0]) == null ? void 0 : _a2.uid;
  11453. });
  11454. const isDisabled = computed(() => props.node.isDisabled);
  11455. const isLeaf2 = computed(() => props.node.isLeaf);
  11456. const expandable = computed(() => checkStrictly.value && !isLeaf2.value || !isDisabled.value);
  11457. const inExpandingPath = computed(() => isInPath(panel.expandingNode));
  11458. const inCheckedPath = computed(() => checkStrictly.value && panel.checkedNodes.some(isInPath));
  11459. const isInPath = (node) => {
  11460. var _a2;
  11461. const { level, uid: uid2 } = props.node;
  11462. return ((_a2 = node == null ? void 0 : node.pathNodes[level - 1]) == null ? void 0 : _a2.uid) === uid2;
  11463. };
  11464. const doExpand = () => {
  11465. if (inExpandingPath.value)
  11466. return;
  11467. panel.expandNode(props.node);
  11468. };
  11469. const doCheck = (checked) => {
  11470. const { node } = props;
  11471. if (checked === node.checked)
  11472. return;
  11473. panel.handleCheckChange(node, checked);
  11474. };
  11475. const doLoad = () => {
  11476. panel.lazyLoad(props.node, () => {
  11477. if (!isLeaf2.value)
  11478. doExpand();
  11479. });
  11480. };
  11481. const handleHoverExpand = (e) => {
  11482. if (!isHoverMenu.value)
  11483. return;
  11484. handleExpand();
  11485. !isLeaf2.value && emit("expand", e);
  11486. };
  11487. const handleExpand = () => {
  11488. const { node } = props;
  11489. if (!expandable.value || node.loading)
  11490. return;
  11491. node.loaded ? doExpand() : doLoad();
  11492. };
  11493. const handleClick = () => {
  11494. if (isHoverMenu.value && !isLeaf2.value)
  11495. return;
  11496. if (isLeaf2.value && !isDisabled.value && !checkStrictly.value && !multiple.value) {
  11497. handleCheck(true);
  11498. } else {
  11499. handleExpand();
  11500. }
  11501. };
  11502. const handleSelectCheck = (checked) => {
  11503. if (checkStrictly.value) {
  11504. doCheck(checked);
  11505. if (props.node.loaded) {
  11506. doExpand();
  11507. }
  11508. } else {
  11509. handleCheck(checked);
  11510. }
  11511. };
  11512. const handleCheck = (checked) => {
  11513. if (!props.node.loaded) {
  11514. doLoad();
  11515. } else {
  11516. doCheck(checked);
  11517. !checkStrictly.value && doExpand();
  11518. }
  11519. };
  11520. return {
  11521. panel,
  11522. isHoverMenu,
  11523. multiple,
  11524. checkStrictly,
  11525. checkedNodeId,
  11526. isDisabled,
  11527. isLeaf: isLeaf2,
  11528. expandable,
  11529. inExpandingPath,
  11530. inCheckedPath,
  11531. ns,
  11532. handleHoverExpand,
  11533. handleExpand,
  11534. handleClick,
  11535. handleCheck,
  11536. handleSelectCheck
  11537. };
  11538. }
  11539. });
  11540. const _hoisted_1$t = ["id", "aria-haspopup", "aria-owns", "aria-expanded", "tabindex"];
  11541. const _hoisted_2$m = /* @__PURE__ */ createElementVNode("span", null, null, -1);
  11542. function _sfc_render$n(_ctx, _cache, $props, $setup, $data, $options) {
  11543. const _component_el_checkbox = resolveComponent("el-checkbox");
  11544. const _component_el_radio = resolveComponent("el-radio");
  11545. const _component_check = resolveComponent("check");
  11546. const _component_el_icon = resolveComponent("el-icon");
  11547. const _component_node_content = resolveComponent("node-content");
  11548. const _component_loading = resolveComponent("loading");
  11549. const _component_arrow_right = resolveComponent("arrow-right");
  11550. return openBlock(), createElementBlock("li", {
  11551. id: `${_ctx.menuId}-${_ctx.node.uid}`,
  11552. role: "menuitem",
  11553. "aria-haspopup": !_ctx.isLeaf,
  11554. "aria-owns": _ctx.isLeaf ? null : _ctx.menuId,
  11555. "aria-expanded": _ctx.inExpandingPath,
  11556. tabindex: _ctx.expandable ? -1 : void 0,
  11557. class: normalizeClass([
  11558. _ctx.ns.b(),
  11559. _ctx.ns.is("selectable", _ctx.checkStrictly),
  11560. _ctx.ns.is("active", _ctx.node.checked),
  11561. _ctx.ns.is("disabled", !_ctx.expandable),
  11562. _ctx.inExpandingPath && "in-active-path",
  11563. _ctx.inCheckedPath && "in-checked-path"
  11564. ]),
  11565. onMouseenter: _cache[2] || (_cache[2] = (...args) => _ctx.handleHoverExpand && _ctx.handleHoverExpand(...args)),
  11566. onFocus: _cache[3] || (_cache[3] = (...args) => _ctx.handleHoverExpand && _ctx.handleHoverExpand(...args)),
  11567. onClick: _cache[4] || (_cache[4] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
  11568. }, [
  11569. createCommentVNode(" prefix "),
  11570. _ctx.multiple ? (openBlock(), createBlock(_component_el_checkbox, {
  11571. key: 0,
  11572. "model-value": _ctx.node.checked,
  11573. indeterminate: _ctx.node.indeterminate,
  11574. disabled: _ctx.isDisabled,
  11575. onClick: _cache[0] || (_cache[0] = withModifiers(() => {
  11576. }, ["stop"])),
  11577. "onUpdate:modelValue": _ctx.handleSelectCheck
  11578. }, null, 8, ["model-value", "indeterminate", "disabled", "onUpdate:modelValue"])) : _ctx.checkStrictly ? (openBlock(), createBlock(_component_el_radio, {
  11579. key: 1,
  11580. "model-value": _ctx.checkedNodeId,
  11581. label: _ctx.node.uid,
  11582. disabled: _ctx.isDisabled,
  11583. "onUpdate:modelValue": _ctx.handleSelectCheck,
  11584. onClick: _cache[1] || (_cache[1] = withModifiers(() => {
  11585. }, ["stop"]))
  11586. }, {
  11587. default: withCtx(() => [
  11588. createCommentVNode("\n Add an empty element to avoid render label,\n do not use empty fragment here for https://github.com/vuejs/vue-next/pull/2485\n "),
  11589. _hoisted_2$m
  11590. ]),
  11591. _: 1
  11592. }, 8, ["model-value", "label", "disabled", "onUpdate:modelValue"])) : _ctx.isLeaf && _ctx.node.checked ? (openBlock(), createBlock(_component_el_icon, {
  11593. key: 2,
  11594. class: normalizeClass(_ctx.ns.e("prefix"))
  11595. }, {
  11596. default: withCtx(() => [
  11597. createVNode(_component_check)
  11598. ]),
  11599. _: 1
  11600. }, 8, ["class"])) : createCommentVNode("v-if", true),
  11601. createCommentVNode(" content "),
  11602. createVNode(_component_node_content),
  11603. createCommentVNode(" postfix "),
  11604. !_ctx.isLeaf ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
  11605. _ctx.node.loading ? (openBlock(), createBlock(_component_el_icon, {
  11606. key: 0,
  11607. class: normalizeClass([_ctx.ns.is("loading"), _ctx.ns.e("postfix")])
  11608. }, {
  11609. default: withCtx(() => [
  11610. createVNode(_component_loading)
  11611. ]),
  11612. _: 1
  11613. }, 8, ["class"])) : (openBlock(), createBlock(_component_el_icon, {
  11614. key: 1,
  11615. class: normalizeClass(["arrow-right", _ctx.ns.e("postfix")])
  11616. }, {
  11617. default: withCtx(() => [
  11618. createVNode(_component_arrow_right)
  11619. ]),
  11620. _: 1
  11621. }, 8, ["class"]))
  11622. ], 2112)) : createCommentVNode("v-if", true)
  11623. ], 42, _hoisted_1$t);
  11624. }
  11625. var ElCascaderNode = /* @__PURE__ */ _export_sfc$1(_sfc_main$J, [["render", _sfc_render$n], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/cascader-panel/src/node.vue"]]);
  11626. const _sfc_main$I = defineComponent({
  11627. name: "ElCascaderMenu",
  11628. components: {
  11629. Loading: loading,
  11630. ElIcon,
  11631. ElScrollbar,
  11632. ElCascaderNode
  11633. },
  11634. props: {
  11635. nodes: {
  11636. type: Array,
  11637. required: true
  11638. },
  11639. index: {
  11640. type: Number,
  11641. required: true
  11642. }
  11643. },
  11644. setup(props) {
  11645. const instance = getCurrentInstance();
  11646. const ns = useNamespace("cascader-menu");
  11647. const { t } = useLocale();
  11648. const id = generateId();
  11649. let activeNode = null;
  11650. let hoverTimer = null;
  11651. const panel = inject(CASCADER_PANEL_INJECTION_KEY);
  11652. const hoverZone = ref(null);
  11653. const isEmpty3 = computed(() => !props.nodes.length);
  11654. const isLoading = computed(() => !panel.initialLoaded);
  11655. const menuId = computed(() => `cascader-menu-${id}-${props.index}`);
  11656. const handleExpand = (e) => {
  11657. activeNode = e.target;
  11658. };
  11659. const handleMouseMove = (e) => {
  11660. if (!panel.isHoverMenu || !activeNode || !hoverZone.value)
  11661. return;
  11662. if (activeNode.contains(e.target)) {
  11663. clearHoverTimer();
  11664. const el = instance.vnode.el;
  11665. const { left: left2 } = el.getBoundingClientRect();
  11666. const { offsetWidth, offsetHeight } = el;
  11667. const startX = e.clientX - left2;
  11668. const top2 = activeNode.offsetTop;
  11669. const bottom2 = top2 + activeNode.offsetHeight;
  11670. hoverZone.value.innerHTML = `
  11671. <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${top2} L${offsetWidth} 0 V${top2} Z" />
  11672. <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${bottom2} L${offsetWidth} ${offsetHeight} V${bottom2} Z" />
  11673. `;
  11674. } else if (!hoverTimer) {
  11675. hoverTimer = window.setTimeout(clearHoverZone, panel.config.hoverThreshold);
  11676. }
  11677. };
  11678. const clearHoverTimer = () => {
  11679. if (!hoverTimer)
  11680. return;
  11681. clearTimeout(hoverTimer);
  11682. hoverTimer = null;
  11683. };
  11684. const clearHoverZone = () => {
  11685. if (!hoverZone.value)
  11686. return;
  11687. hoverZone.value.innerHTML = "";
  11688. clearHoverTimer();
  11689. };
  11690. return {
  11691. ns,
  11692. panel,
  11693. hoverZone,
  11694. isEmpty: isEmpty3,
  11695. isLoading,
  11696. menuId,
  11697. t,
  11698. handleExpand,
  11699. handleMouseMove,
  11700. clearHoverZone
  11701. };
  11702. }
  11703. });
  11704. function _sfc_render$m(_ctx, _cache, $props, $setup, $data, $options) {
  11705. const _component_el_cascader_node = resolveComponent("el-cascader-node");
  11706. const _component_loading = resolveComponent("loading");
  11707. const _component_el_icon = resolveComponent("el-icon");
  11708. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  11709. return openBlock(), createBlock(_component_el_scrollbar, {
  11710. key: _ctx.menuId,
  11711. tag: "ul",
  11712. role: "menu",
  11713. class: normalizeClass(_ctx.ns.b()),
  11714. "wrap-class": _ctx.ns.e("wrap"),
  11715. "view-class": [_ctx.ns.e("list"), _ctx.ns.is("empty", _ctx.isEmpty)],
  11716. onMousemove: _ctx.handleMouseMove,
  11717. onMouseleave: _ctx.clearHoverZone
  11718. }, {
  11719. default: withCtx(() => {
  11720. var _a2;
  11721. return [
  11722. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.nodes, (node) => {
  11723. return openBlock(), createBlock(_component_el_cascader_node, {
  11724. key: node.uid,
  11725. node,
  11726. "menu-id": _ctx.menuId,
  11727. onExpand: _ctx.handleExpand
  11728. }, null, 8, ["node", "menu-id", "onExpand"]);
  11729. }), 128)),
  11730. _ctx.isLoading ? (openBlock(), createElementBlock("div", {
  11731. key: 0,
  11732. class: normalizeClass(_ctx.ns.e("empty-text"))
  11733. }, [
  11734. createVNode(_component_el_icon, {
  11735. size: "14",
  11736. class: normalizeClass(_ctx.ns.is("loading"))
  11737. }, {
  11738. default: withCtx(() => [
  11739. createVNode(_component_loading)
  11740. ]),
  11741. _: 1
  11742. }, 8, ["class"]),
  11743. createTextVNode(" " + toDisplayString(_ctx.t("el.cascader.loading")), 1)
  11744. ], 2)) : _ctx.isEmpty ? (openBlock(), createElementBlock("div", {
  11745. key: 1,
  11746. class: normalizeClass(_ctx.ns.e("empty-text"))
  11747. }, toDisplayString(_ctx.t("el.cascader.noData")), 3)) : ((_a2 = _ctx.panel) == null ? void 0 : _a2.isHoverMenu) ? (openBlock(), createElementBlock("svg", {
  11748. key: 2,
  11749. ref: "hoverZone",
  11750. class: normalizeClass(_ctx.ns.e("hover-zone"))
  11751. }, null, 2)) : createCommentVNode("v-if", true)
  11752. ];
  11753. }),
  11754. _: 1
  11755. }, 8, ["class", "wrap-class", "view-class", "onMousemove", "onMouseleave"]);
  11756. }
  11757. var ElCascaderMenu = /* @__PURE__ */ _export_sfc$1(_sfc_main$I, [["render", _sfc_render$m], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/cascader-panel/src/menu.vue"]]);
  11758. var ExpandTrigger = /* @__PURE__ */ ((ExpandTrigger2) => {
  11759. ExpandTrigger2["CLICK"] = "click";
  11760. ExpandTrigger2["HOVER"] = "hover";
  11761. return ExpandTrigger2;
  11762. })(ExpandTrigger || {});
  11763. let uid = 0;
  11764. const calculatePathNodes = (node) => {
  11765. const nodes = [node];
  11766. let { parent } = node;
  11767. while (parent) {
  11768. nodes.unshift(parent);
  11769. parent = parent.parent;
  11770. }
  11771. return nodes;
  11772. };
  11773. class Node {
  11774. constructor(data2, config, parent, root2 = false) {
  11775. this.data = data2;
  11776. this.config = config;
  11777. this.parent = parent;
  11778. this.root = root2;
  11779. this.uid = uid++;
  11780. this.checked = false;
  11781. this.indeterminate = false;
  11782. this.loading = false;
  11783. const { value: valueKey, label: labelKey, children: childrenKey } = config;
  11784. const childrenData = data2[childrenKey];
  11785. const pathNodes = calculatePathNodes(this);
  11786. this.level = root2 ? 0 : parent ? parent.level + 1 : 1;
  11787. this.value = data2[valueKey];
  11788. this.label = data2[labelKey];
  11789. this.pathNodes = pathNodes;
  11790. this.pathValues = pathNodes.map((node) => node.value);
  11791. this.pathLabels = pathNodes.map((node) => node.label);
  11792. this.childrenData = childrenData;
  11793. this.children = (childrenData || []).map((child) => new Node(child, config, this));
  11794. this.loaded = !config.lazy || this.isLeaf || !isEmpty(childrenData);
  11795. }
  11796. get isDisabled() {
  11797. const { data: data2, parent, config } = this;
  11798. const { disabled, checkStrictly } = config;
  11799. const isDisabled = isFunction(disabled) ? disabled(data2, this) : !!data2[disabled];
  11800. return isDisabled || !checkStrictly && (parent == null ? void 0 : parent.isDisabled);
  11801. }
  11802. get isLeaf() {
  11803. const { data: data2, config, childrenData, loaded } = this;
  11804. const { lazy, leaf } = config;
  11805. const isLeaf2 = isFunction(leaf) ? leaf(data2, this) : data2[leaf];
  11806. return isUndefined(isLeaf2) ? lazy && !loaded ? false : !(Array.isArray(childrenData) && childrenData.length) : !!isLeaf2;
  11807. }
  11808. get valueByOption() {
  11809. return this.config.emitPath ? this.pathValues : this.value;
  11810. }
  11811. appendChild(childData) {
  11812. const { childrenData, children } = this;
  11813. const node = new Node(childData, this.config, this);
  11814. if (Array.isArray(childrenData)) {
  11815. childrenData.push(childData);
  11816. } else {
  11817. this.childrenData = [childData];
  11818. }
  11819. children.push(node);
  11820. return node;
  11821. }
  11822. calcText(allLevels, separator) {
  11823. const text = allLevels ? this.pathLabels.join(separator) : this.label;
  11824. this.text = text;
  11825. return text;
  11826. }
  11827. broadcast(event, ...args) {
  11828. const handlerName = `onParent${capitalize(event)}`;
  11829. this.children.forEach((child) => {
  11830. if (child) {
  11831. child.broadcast(event, ...args);
  11832. child[handlerName] && child[handlerName](...args);
  11833. }
  11834. });
  11835. }
  11836. emit(event, ...args) {
  11837. const { parent } = this;
  11838. const handlerName = `onChild${capitalize(event)}`;
  11839. if (parent) {
  11840. parent[handlerName] && parent[handlerName](...args);
  11841. parent.emit(event, ...args);
  11842. }
  11843. }
  11844. onParentCheck(checked) {
  11845. if (!this.isDisabled) {
  11846. this.setCheckState(checked);
  11847. }
  11848. }
  11849. onChildCheck() {
  11850. const { children } = this;
  11851. const validChildren = children.filter((child) => !child.isDisabled);
  11852. const checked = validChildren.length ? validChildren.every((child) => child.checked) : false;
  11853. this.setCheckState(checked);
  11854. }
  11855. setCheckState(checked) {
  11856. const totalNum = this.children.length;
  11857. const checkedNum = this.children.reduce((c2, p2) => {
  11858. const num = p2.checked ? 1 : p2.indeterminate ? 0.5 : 0;
  11859. return c2 + num;
  11860. }, 0);
  11861. this.checked = this.loaded && this.children.every((child) => child.loaded && child.checked) && checked;
  11862. this.indeterminate = this.loaded && checkedNum !== totalNum && checkedNum > 0;
  11863. }
  11864. doCheck(checked) {
  11865. if (this.checked === checked)
  11866. return;
  11867. const { checkStrictly, multiple } = this.config;
  11868. if (checkStrictly || !multiple) {
  11869. this.checked = checked;
  11870. } else {
  11871. this.broadcast("check", checked);
  11872. this.setCheckState(checked);
  11873. this.emit("check");
  11874. }
  11875. }
  11876. }
  11877. const flatNodes = (nodes, leafOnly) => {
  11878. return nodes.reduce((res, node) => {
  11879. if (node.isLeaf) {
  11880. res.push(node);
  11881. } else {
  11882. !leafOnly && res.push(node);
  11883. res = res.concat(flatNodes(node.children, leafOnly));
  11884. }
  11885. return res;
  11886. }, []);
  11887. };
  11888. class Store {
  11889. constructor(data2, config) {
  11890. this.config = config;
  11891. const nodes = (data2 || []).map((nodeData) => new Node(nodeData, this.config));
  11892. this.nodes = nodes;
  11893. this.allNodes = flatNodes(nodes, false);
  11894. this.leafNodes = flatNodes(nodes, true);
  11895. }
  11896. getNodes() {
  11897. return this.nodes;
  11898. }
  11899. getFlattedNodes(leafOnly) {
  11900. return leafOnly ? this.leafNodes : this.allNodes;
  11901. }
  11902. appendNode(nodeData, parentNode) {
  11903. const node = parentNode ? parentNode.appendChild(nodeData) : new Node(nodeData, this.config);
  11904. if (!parentNode)
  11905. this.nodes.push(node);
  11906. this.allNodes.push(node);
  11907. node.isLeaf && this.leafNodes.push(node);
  11908. }
  11909. appendNodes(nodeDataList, parentNode) {
  11910. nodeDataList.forEach((nodeData) => this.appendNode(nodeData, parentNode));
  11911. }
  11912. getNodeByValue(value, leafOnly = false) {
  11913. if (!value && value !== 0)
  11914. return null;
  11915. const node = this.getFlattedNodes(leafOnly).find((node2) => isEqual(node2.value, value) || isEqual(node2.pathValues, value));
  11916. return node || null;
  11917. }
  11918. getSameNode(node) {
  11919. if (!node)
  11920. return null;
  11921. const node_ = this.getFlattedNodes(false).find(({ value, level }) => isEqual(node.value, value) && node.level === level);
  11922. return node_ || null;
  11923. }
  11924. }
  11925. const CommonProps = {
  11926. modelValue: [Number, String, Array],
  11927. options: {
  11928. type: Array,
  11929. default: () => []
  11930. },
  11931. props: {
  11932. type: Object,
  11933. default: () => ({})
  11934. }
  11935. };
  11936. const DefaultProps = {
  11937. expandTrigger: ExpandTrigger.CLICK,
  11938. multiple: false,
  11939. checkStrictly: false,
  11940. emitPath: true,
  11941. lazy: false,
  11942. lazyLoad: NOOP,
  11943. value: "value",
  11944. label: "label",
  11945. children: "children",
  11946. leaf: "leaf",
  11947. disabled: "disabled",
  11948. hoverThreshold: 500
  11949. };
  11950. const useCascaderConfig = (props) => {
  11951. return computed(() => __spreadValues(__spreadValues({}, DefaultProps), props.props));
  11952. };
  11953. const getMenuIndex = (el) => {
  11954. if (!el)
  11955. return 0;
  11956. const pieces = el.id.split("-");
  11957. return Number(pieces[pieces.length - 2]);
  11958. };
  11959. const checkNode = (el) => {
  11960. if (!el)
  11961. return;
  11962. const input = el.querySelector("input");
  11963. if (input) {
  11964. input.click();
  11965. } else if (isLeaf(el)) {
  11966. el.click();
  11967. }
  11968. };
  11969. const sortByOriginalOrder = (oldNodes, newNodes) => {
  11970. const newNodesCopy = newNodes.slice(0);
  11971. const newIds = newNodesCopy.map((node) => node.uid);
  11972. const res = oldNodes.reduce((acc, item) => {
  11973. const index = newIds.indexOf(item.uid);
  11974. if (index > -1) {
  11975. acc.push(item);
  11976. newNodesCopy.splice(index, 1);
  11977. newIds.splice(index, 1);
  11978. }
  11979. return acc;
  11980. }, []);
  11981. res.push(...newNodesCopy);
  11982. return res;
  11983. };
  11984. const _sfc_main$H = defineComponent({
  11985. name: "ElCascaderPanel",
  11986. components: {
  11987. ElCascaderMenu
  11988. },
  11989. props: __spreadProps(__spreadValues({}, CommonProps), {
  11990. border: {
  11991. type: Boolean,
  11992. default: true
  11993. },
  11994. renderLabel: Function
  11995. }),
  11996. emits: [UPDATE_MODEL_EVENT, CHANGE_EVENT, "close", "expand-change"],
  11997. setup(props, { emit, slots }) {
  11998. let manualChecked = false;
  11999. const ns = useNamespace("cascader");
  12000. const config = useCascaderConfig(props);
  12001. let store = null;
  12002. const initialLoaded = ref(true);
  12003. const menuList = ref([]);
  12004. const checkedValue = ref(null);
  12005. const menus = ref([]);
  12006. const expandingNode = ref(null);
  12007. const checkedNodes = ref([]);
  12008. const isHoverMenu = computed(() => config.value.expandTrigger === ExpandTrigger.HOVER);
  12009. const renderLabelFn = computed(() => props.renderLabel || slots.default);
  12010. const initStore = () => {
  12011. const { options } = props;
  12012. const cfg = config.value;
  12013. manualChecked = false;
  12014. store = new Store(options, cfg);
  12015. menus.value = [store.getNodes()];
  12016. if (cfg.lazy && isEmpty(props.options)) {
  12017. initialLoaded.value = false;
  12018. lazyLoad(void 0, (list) => {
  12019. if (list) {
  12020. store = new Store(list, cfg);
  12021. menus.value = [store.getNodes()];
  12022. }
  12023. initialLoaded.value = true;
  12024. syncCheckedValue(false, true);
  12025. });
  12026. } else {
  12027. syncCheckedValue(false, true);
  12028. }
  12029. };
  12030. const lazyLoad = (node, cb) => {
  12031. const cfg = config.value;
  12032. node = node || new Node({}, cfg, void 0, true);
  12033. node.loading = true;
  12034. const resolve = (dataList) => {
  12035. const _node = node;
  12036. const parent = _node.root ? null : _node;
  12037. dataList && (store == null ? void 0 : store.appendNodes(dataList, parent));
  12038. _node.loading = false;
  12039. _node.loaded = true;
  12040. _node.childrenData = _node.childrenData || [];
  12041. cb && cb(dataList);
  12042. };
  12043. cfg.lazyLoad(node, resolve);
  12044. };
  12045. const expandNode = (node, silent) => {
  12046. var _a2;
  12047. const { level } = node;
  12048. const newMenus = menus.value.slice(0, level);
  12049. let newExpandingNode;
  12050. if (node.isLeaf) {
  12051. newExpandingNode = node.pathNodes[level - 2];
  12052. } else {
  12053. newExpandingNode = node;
  12054. newMenus.push(node.children);
  12055. }
  12056. if (((_a2 = expandingNode.value) == null ? void 0 : _a2.uid) !== (newExpandingNode == null ? void 0 : newExpandingNode.uid)) {
  12057. expandingNode.value = node;
  12058. menus.value = newMenus;
  12059. !silent && emit("expand-change", (node == null ? void 0 : node.pathValues) || []);
  12060. }
  12061. };
  12062. const handleCheckChange = (node, checked, emitClose = true) => {
  12063. const { checkStrictly, multiple } = config.value;
  12064. const oldNode = checkedNodes.value[0];
  12065. manualChecked = true;
  12066. !multiple && (oldNode == null ? void 0 : oldNode.doCheck(false));
  12067. node.doCheck(checked);
  12068. calculateCheckedValue();
  12069. emitClose && !multiple && !checkStrictly && emit("close");
  12070. !emitClose && !multiple && !checkStrictly && expandParentNode(node);
  12071. };
  12072. const expandParentNode = (node) => {
  12073. if (!node)
  12074. return;
  12075. node = node.parent;
  12076. expandParentNode(node);
  12077. node && expandNode(node);
  12078. };
  12079. const getFlattedNodes = (leafOnly) => {
  12080. return store == null ? void 0 : store.getFlattedNodes(leafOnly);
  12081. };
  12082. const getCheckedNodes = (leafOnly) => {
  12083. var _a2;
  12084. return (_a2 = getFlattedNodes(leafOnly)) == null ? void 0 : _a2.filter((node) => node.checked !== false);
  12085. };
  12086. const clearCheckedNodes = () => {
  12087. checkedNodes.value.forEach((node) => node.doCheck(false));
  12088. calculateCheckedValue();
  12089. };
  12090. const calculateCheckedValue = () => {
  12091. var _a2;
  12092. const { checkStrictly, multiple } = config.value;
  12093. const oldNodes = checkedNodes.value;
  12094. const newNodes = getCheckedNodes(!checkStrictly);
  12095. const nodes = sortByOriginalOrder(oldNodes, newNodes);
  12096. const values = nodes.map((node) => node.valueByOption);
  12097. checkedNodes.value = nodes;
  12098. checkedValue.value = multiple ? values : (_a2 = values[0]) != null ? _a2 : null;
  12099. };
  12100. const syncCheckedValue = (loaded = false, forced = false) => {
  12101. const { modelValue } = props;
  12102. const { lazy, multiple, checkStrictly } = config.value;
  12103. const leafOnly = !checkStrictly;
  12104. if (!initialLoaded.value || manualChecked || !forced && isEqual(modelValue, checkedValue.value))
  12105. return;
  12106. if (lazy && !loaded) {
  12107. const values = unique(flattenDeep(castArray(modelValue)));
  12108. const nodes = values.map((val) => store == null ? void 0 : store.getNodeByValue(val)).filter((node) => !!node && !node.loaded && !node.loading);
  12109. if (nodes.length) {
  12110. nodes.forEach((node) => {
  12111. lazyLoad(node, () => syncCheckedValue(false, forced));
  12112. });
  12113. } else {
  12114. syncCheckedValue(true, forced);
  12115. }
  12116. } else {
  12117. const values = multiple ? castArray(modelValue) : [modelValue];
  12118. const nodes = unique(values.map((val) => store == null ? void 0 : store.getNodeByValue(val, leafOnly)));
  12119. syncMenuState(nodes, false);
  12120. checkedValue.value = modelValue;
  12121. }
  12122. };
  12123. const syncMenuState = (newCheckedNodes, reserveExpandingState = true) => {
  12124. const { checkStrictly } = config.value;
  12125. const oldNodes = checkedNodes.value;
  12126. const newNodes = newCheckedNodes.filter((node) => !!node && (checkStrictly || node.isLeaf));
  12127. const oldExpandingNode = store == null ? void 0 : store.getSameNode(expandingNode.value);
  12128. const newExpandingNode = reserveExpandingState && oldExpandingNode || newNodes[0];
  12129. if (newExpandingNode) {
  12130. newExpandingNode.pathNodes.forEach((node) => expandNode(node, true));
  12131. } else {
  12132. expandingNode.value = null;
  12133. }
  12134. oldNodes.forEach((node) => node.doCheck(false));
  12135. newNodes.forEach((node) => node.doCheck(true));
  12136. checkedNodes.value = newNodes;
  12137. nextTick(scrollToExpandingNode);
  12138. };
  12139. const scrollToExpandingNode = () => {
  12140. if (!isClient)
  12141. return;
  12142. menuList.value.forEach((menu) => {
  12143. const menuElement = menu == null ? void 0 : menu.$el;
  12144. if (menuElement) {
  12145. const container = menuElement.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
  12146. const activeNode = menuElement.querySelector(`.${ns.b("node")}.${ns.is("active")}`) || menuElement.querySelector(`.${ns.b("node")}.in-active-path`);
  12147. scrollIntoView(container, activeNode);
  12148. }
  12149. });
  12150. };
  12151. const handleKeyDown2 = (e) => {
  12152. const target = e.target;
  12153. const { code } = e;
  12154. switch (code) {
  12155. case EVENT_CODE.up:
  12156. case EVENT_CODE.down: {
  12157. e.preventDefault();
  12158. const distance = code === EVENT_CODE.up ? -1 : 1;
  12159. focusNode(getSibling(target, distance, `.${ns.b("node")}[tabindex="-1"]`));
  12160. break;
  12161. }
  12162. case EVENT_CODE.left: {
  12163. e.preventDefault();
  12164. const preMenu = menuList.value[getMenuIndex(target) - 1];
  12165. const expandedNode = preMenu == null ? void 0 : preMenu.$el.querySelector(`.${ns.b("node")}[aria-expanded="true"]`);
  12166. focusNode(expandedNode);
  12167. break;
  12168. }
  12169. case EVENT_CODE.right: {
  12170. e.preventDefault();
  12171. const nextMenu = menuList.value[getMenuIndex(target) + 1];
  12172. const firstNode = nextMenu == null ? void 0 : nextMenu.$el.querySelector(`.${ns.b("node")}[tabindex="-1"]`);
  12173. focusNode(firstNode);
  12174. break;
  12175. }
  12176. case EVENT_CODE.enter:
  12177. checkNode(target);
  12178. break;
  12179. case EVENT_CODE.esc:
  12180. case EVENT_CODE.tab:
  12181. emit("close");
  12182. break;
  12183. }
  12184. };
  12185. provide(CASCADER_PANEL_INJECTION_KEY, reactive({
  12186. config,
  12187. expandingNode,
  12188. checkedNodes,
  12189. isHoverMenu,
  12190. initialLoaded,
  12191. renderLabelFn,
  12192. lazyLoad,
  12193. expandNode,
  12194. handleCheckChange
  12195. }));
  12196. watch([config, () => props.options], initStore, {
  12197. deep: true,
  12198. immediate: true
  12199. });
  12200. watch(() => props.modelValue, () => {
  12201. manualChecked = false;
  12202. syncCheckedValue();
  12203. });
  12204. watch(checkedValue, (val) => {
  12205. if (!isEqual(val, props.modelValue)) {
  12206. emit(UPDATE_MODEL_EVENT, val);
  12207. emit(CHANGE_EVENT, val);
  12208. }
  12209. });
  12210. onBeforeUpdate(() => menuList.value = []);
  12211. onMounted(() => !isEmpty(props.modelValue) && syncCheckedValue());
  12212. return {
  12213. ns,
  12214. menuList,
  12215. menus,
  12216. checkedNodes,
  12217. handleKeyDown: handleKeyDown2,
  12218. handleCheckChange,
  12219. getFlattedNodes,
  12220. getCheckedNodes,
  12221. clearCheckedNodes,
  12222. calculateCheckedValue,
  12223. scrollToExpandingNode
  12224. };
  12225. }
  12226. });
  12227. function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
  12228. const _component_el_cascader_menu = resolveComponent("el-cascader-menu");
  12229. return openBlock(), createElementBlock("div", {
  12230. class: normalizeClass([_ctx.ns.b("panel"), _ctx.ns.is("bordered", _ctx.border)]),
  12231. onKeydown: _cache[0] || (_cache[0] = (...args) => _ctx.handleKeyDown && _ctx.handleKeyDown(...args))
  12232. }, [
  12233. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menus, (menu, index) => {
  12234. return openBlock(), createBlock(_component_el_cascader_menu, {
  12235. key: index,
  12236. ref_for: true,
  12237. ref: (item) => _ctx.menuList[index] = item,
  12238. index,
  12239. nodes: [...menu]
  12240. }, null, 8, ["index", "nodes"]);
  12241. }), 128))
  12242. ], 34);
  12243. }
  12244. var CascaderPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$H, [["render", _sfc_render$l], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/cascader-panel/src/index.vue"]]);
  12245. CascaderPanel.install = (app) => {
  12246. app.component(CascaderPanel.name, CascaderPanel);
  12247. };
  12248. const _CascaderPanel = CascaderPanel;
  12249. const tagProps = buildProps({
  12250. closable: Boolean,
  12251. type: {
  12252. type: String,
  12253. values: ["success", "info", "warning", "danger", ""],
  12254. default: ""
  12255. },
  12256. hit: Boolean,
  12257. disableTransitions: Boolean,
  12258. color: {
  12259. type: String,
  12260. default: ""
  12261. },
  12262. size: {
  12263. type: String,
  12264. values: componentSizes,
  12265. default: ""
  12266. },
  12267. effect: {
  12268. type: String,
  12269. values: ["dark", "light", "plain"],
  12270. default: "light"
  12271. },
  12272. round: Boolean
  12273. });
  12274. const tagEmits = {
  12275. close: (evt) => evt instanceof MouseEvent,
  12276. click: (evt) => evt instanceof MouseEvent
  12277. };
  12278. const __default__$d = {
  12279. name: "ElTag"
  12280. };
  12281. const _sfc_main$G = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$d), {
  12282. props: tagProps,
  12283. emits: tagEmits,
  12284. setup(__props, { emit }) {
  12285. const props = __props;
  12286. const tagSize = useSize();
  12287. const ns = useNamespace("tag");
  12288. const classes = computed(() => {
  12289. const { type: type4, hit, effect: effect2, closable, round: round2 } = props;
  12290. return [
  12291. ns.b(),
  12292. ns.is("closable", closable),
  12293. ns.m(type4),
  12294. ns.m(tagSize.value),
  12295. ns.m(effect2),
  12296. ns.is("hit", hit),
  12297. ns.is("round", round2)
  12298. ];
  12299. });
  12300. const handleClose = (event) => {
  12301. event.stopPropagation();
  12302. emit("close", event);
  12303. };
  12304. const handleClick = (event) => {
  12305. emit("click", event);
  12306. };
  12307. return (_ctx, _cache) => {
  12308. return !_ctx.disableTransitions ? (openBlock(), createElementBlock("span", {
  12309. key: 0,
  12310. class: normalizeClass(unref(classes)),
  12311. style: normalizeStyle({ backgroundColor: _ctx.color }),
  12312. onClick: handleClick
  12313. }, [
  12314. createElementVNode("span", {
  12315. class: normalizeClass(unref(ns).e("content"))
  12316. }, [
  12317. renderSlot(_ctx.$slots, "default")
  12318. ], 2),
  12319. _ctx.closable ? (openBlock(), createBlock(unref(ElIcon), {
  12320. key: 0,
  12321. class: normalizeClass(unref(ns).e("close")),
  12322. onClick: handleClose
  12323. }, {
  12324. default: withCtx(() => [
  12325. createVNode(unref(close))
  12326. ]),
  12327. _: 1
  12328. }, 8, ["class"])) : createCommentVNode("v-if", true)
  12329. ], 6)) : (openBlock(), createBlock(Transition, {
  12330. key: 1,
  12331. name: `${unref(ns).namespace.value}-zoom-in-center`
  12332. }, {
  12333. default: withCtx(() => [
  12334. createElementVNode("span", {
  12335. class: normalizeClass(unref(classes)),
  12336. style: normalizeStyle({ backgroundColor: _ctx.color }),
  12337. onClick: handleClick
  12338. }, [
  12339. createElementVNode("span", {
  12340. class: normalizeClass(unref(ns).e("content"))
  12341. }, [
  12342. renderSlot(_ctx.$slots, "default")
  12343. ], 2),
  12344. _ctx.closable ? (openBlock(), createBlock(unref(ElIcon), {
  12345. key: 0,
  12346. class: normalizeClass(unref(ns).e("close")),
  12347. onClick: handleClose
  12348. }, {
  12349. default: withCtx(() => [
  12350. createVNode(unref(close))
  12351. ]),
  12352. _: 1
  12353. }, 8, ["class"])) : createCommentVNode("v-if", true)
  12354. ], 6)
  12355. ]),
  12356. _: 3
  12357. }, 8, ["name"]));
  12358. };
  12359. }
  12360. }));
  12361. var Tag = /* @__PURE__ */ _export_sfc$1(_sfc_main$G, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tag/src/tag.vue"]]);
  12362. const ElTag = withInstall(Tag);
  12363. const DEFAULT_INPUT_HEIGHT = 40;
  12364. const INPUT_HEIGHT_MAP = {
  12365. large: 36,
  12366. default: 32,
  12367. small: 28
  12368. };
  12369. const popperOptions = {
  12370. modifiers: [
  12371. {
  12372. name: "arrowPosition",
  12373. enabled: true,
  12374. phase: "main",
  12375. fn: ({ state }) => {
  12376. const { modifiersData, placement } = state;
  12377. if (["right", "left", "bottom", "top"].includes(placement))
  12378. return;
  12379. modifiersData.arrow.x = 35;
  12380. },
  12381. requires: ["arrow"]
  12382. }
  12383. ]
  12384. };
  12385. const COMPONENT_NAME$3 = "ElCascader";
  12386. const _sfc_main$F = defineComponent({
  12387. name: COMPONENT_NAME$3,
  12388. components: {
  12389. ElCascaderPanel: _CascaderPanel,
  12390. ElInput,
  12391. ElTooltip,
  12392. ElScrollbar,
  12393. ElTag,
  12394. ElIcon,
  12395. CircleClose: circleClose,
  12396. Check: check,
  12397. ArrowDown: arrowDown
  12398. },
  12399. directives: {
  12400. Clickoutside: ClickOutside
  12401. },
  12402. props: __spreadProps(__spreadValues({}, CommonProps), {
  12403. size: {
  12404. type: String,
  12405. validator: isValidComponentSize
  12406. },
  12407. placeholder: {
  12408. type: String
  12409. },
  12410. disabled: Boolean,
  12411. clearable: Boolean,
  12412. filterable: Boolean,
  12413. filterMethod: {
  12414. type: Function,
  12415. default: (node, keyword) => node.text.includes(keyword)
  12416. },
  12417. separator: {
  12418. type: String,
  12419. default: " / "
  12420. },
  12421. showAllLevels: {
  12422. type: Boolean,
  12423. default: true
  12424. },
  12425. collapseTags: Boolean,
  12426. collapseTagsTooltip: {
  12427. type: Boolean,
  12428. default: false
  12429. },
  12430. debounce: {
  12431. type: Number,
  12432. default: 300
  12433. },
  12434. beforeFilter: {
  12435. type: Function,
  12436. default: () => true
  12437. },
  12438. popperClass: {
  12439. type: String,
  12440. default: ""
  12441. },
  12442. popperAppendToBody: {
  12443. type: Boolean,
  12444. default: void 0
  12445. },
  12446. teleported: useTooltipContentProps.teleported,
  12447. tagType: __spreadProps(__spreadValues({}, tagProps.type), { default: "info" })
  12448. }),
  12449. emits: [
  12450. UPDATE_MODEL_EVENT,
  12451. CHANGE_EVENT,
  12452. "focus",
  12453. "blur",
  12454. "visible-change",
  12455. "expand-change",
  12456. "remove-tag"
  12457. ],
  12458. setup(props, { emit }) {
  12459. let inputInitialHeight = 0;
  12460. let pressDeleteCount = 0;
  12461. const { compatTeleported } = useDeprecateAppendToBody(COMPONENT_NAME$3, "popperAppendToBody");
  12462. const nsCascader = useNamespace("cascader");
  12463. const nsInput = useNamespace("input");
  12464. const { t } = useLocale();
  12465. const elForm2 = inject(formContextKey, {});
  12466. const elFormItem2 = inject(formItemContextKey, {});
  12467. const tooltipRef = ref(null);
  12468. const input = ref(null);
  12469. const tagWrapper = ref(null);
  12470. const panel = ref(null);
  12471. const suggestionPanel = ref(null);
  12472. const popperVisible = ref(false);
  12473. const inputHover = ref(false);
  12474. const filtering = ref(false);
  12475. const inputValue = ref("");
  12476. const searchInputValue = ref("");
  12477. const presentTags = ref([]);
  12478. const allPresentTags = ref([]);
  12479. const suggestions = ref([]);
  12480. const isOnComposition = ref(false);
  12481. const isDisabled = computed(() => props.disabled || elForm2.disabled);
  12482. const inputPlaceholder = computed(() => props.placeholder || t("el.cascader.placeholder"));
  12483. const realSize = useSize();
  12484. const tagSize = computed(() => ["small"].includes(realSize.value) ? "small" : "default");
  12485. const multiple = computed(() => !!props.props.multiple);
  12486. const readonly2 = computed(() => !props.filterable || multiple.value);
  12487. const searchKeyword = computed(() => multiple.value ? searchInputValue.value : inputValue.value);
  12488. const checkedNodes = computed(() => {
  12489. var _a2;
  12490. return ((_a2 = panel.value) == null ? void 0 : _a2.checkedNodes) || [];
  12491. });
  12492. const clearBtnVisible = computed(() => {
  12493. if (!props.clearable || isDisabled.value || filtering.value || !inputHover.value)
  12494. return false;
  12495. return !!checkedNodes.value.length;
  12496. });
  12497. const presentText = computed(() => {
  12498. const { showAllLevels, separator } = props;
  12499. const nodes = checkedNodes.value;
  12500. return nodes.length ? multiple.value ? " " : nodes[0].calcText(showAllLevels, separator) : "";
  12501. });
  12502. const checkedValue = computed({
  12503. get() {
  12504. return props.modelValue;
  12505. },
  12506. set(val) {
  12507. var _a2;
  12508. emit(UPDATE_MODEL_EVENT, val);
  12509. emit(CHANGE_EVENT, val);
  12510. (_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "change").catch((err) => debugWarn());
  12511. }
  12512. });
  12513. const popperPaneRef = computed(() => {
  12514. var _a2, _b2;
  12515. return (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b2.contentRef;
  12516. });
  12517. const togglePopperVisible = (visible) => {
  12518. var _a2, _b2, _c;
  12519. if (isDisabled.value)
  12520. return;
  12521. visible = visible != null ? visible : !popperVisible.value;
  12522. if (visible !== popperVisible.value) {
  12523. popperVisible.value = visible;
  12524. (_b2 = (_a2 = input.value) == null ? void 0 : _a2.input) == null ? void 0 : _b2.setAttribute("aria-expanded", `${visible}`);
  12525. if (visible) {
  12526. updatePopperPosition();
  12527. nextTick((_c = panel.value) == null ? void 0 : _c.scrollToExpandingNode);
  12528. } else if (props.filterable) {
  12529. const { value } = presentText;
  12530. inputValue.value = value;
  12531. searchInputValue.value = value;
  12532. }
  12533. emit("visible-change", visible);
  12534. }
  12535. };
  12536. const updatePopperPosition = () => {
  12537. nextTick(() => {
  12538. var _a2;
  12539. (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper();
  12540. });
  12541. };
  12542. const hideSuggestionPanel = () => {
  12543. filtering.value = false;
  12544. };
  12545. const genTag2 = (node) => {
  12546. const { showAllLevels, separator } = props;
  12547. return {
  12548. node,
  12549. key: node.uid,
  12550. text: node.calcText(showAllLevels, separator),
  12551. hitState: false,
  12552. closable: !isDisabled.value && !node.isDisabled,
  12553. isCollapseTag: false
  12554. };
  12555. };
  12556. const deleteTag = (tag) => {
  12557. var _a2;
  12558. const node = tag.node;
  12559. node.doCheck(false);
  12560. (_a2 = panel.value) == null ? void 0 : _a2.calculateCheckedValue();
  12561. emit("remove-tag", node.valueByOption);
  12562. };
  12563. const calculatePresentTags = () => {
  12564. if (!multiple.value)
  12565. return;
  12566. const nodes = checkedNodes.value;
  12567. const tags = [];
  12568. const allTags = [];
  12569. nodes.forEach((node) => allTags.push(genTag2(node)));
  12570. allPresentTags.value = allTags;
  12571. if (nodes.length) {
  12572. const [first, ...rest] = nodes;
  12573. const restCount = rest.length;
  12574. tags.push(genTag2(first));
  12575. if (restCount) {
  12576. if (props.collapseTags) {
  12577. tags.push({
  12578. key: -1,
  12579. text: `+ ${restCount}`,
  12580. closable: false,
  12581. isCollapseTag: true
  12582. });
  12583. } else {
  12584. rest.forEach((node) => tags.push(genTag2(node)));
  12585. }
  12586. }
  12587. }
  12588. presentTags.value = tags;
  12589. };
  12590. const calculateSuggestions = () => {
  12591. var _a2, _b2;
  12592. const { filterMethod, showAllLevels, separator } = props;
  12593. const res = (_b2 = (_a2 = panel.value) == null ? void 0 : _a2.getFlattedNodes(!props.props.checkStrictly)) == null ? void 0 : _b2.filter((node) => {
  12594. if (node.isDisabled)
  12595. return false;
  12596. node.calcText(showAllLevels, separator);
  12597. return filterMethod(node, searchKeyword.value);
  12598. });
  12599. if (multiple.value) {
  12600. presentTags.value.forEach((tag) => {
  12601. tag.hitState = false;
  12602. });
  12603. allPresentTags.value.forEach((tag) => {
  12604. tag.hitState = false;
  12605. });
  12606. }
  12607. filtering.value = true;
  12608. suggestions.value = res;
  12609. updatePopperPosition();
  12610. };
  12611. const focusFirstNode = () => {
  12612. var _a2;
  12613. let firstNode;
  12614. if (filtering.value && suggestionPanel.value) {
  12615. firstNode = suggestionPanel.value.$el.querySelector(`.${nsCascader.e("suggestion-item")}`);
  12616. } else {
  12617. firstNode = (_a2 = panel.value) == null ? void 0 : _a2.$el.querySelector(`.${nsCascader.b("node")}[tabindex="-1"]`);
  12618. }
  12619. if (firstNode) {
  12620. firstNode.focus();
  12621. !filtering.value && firstNode.click();
  12622. }
  12623. };
  12624. const updateStyle = () => {
  12625. var _a2, _b2;
  12626. const inputInner = (_a2 = input.value) == null ? void 0 : _a2.input;
  12627. const tagWrapperEl = tagWrapper.value;
  12628. const suggestionPanelEl = (_b2 = suggestionPanel.value) == null ? void 0 : _b2.$el;
  12629. if (!isClient || !inputInner)
  12630. return;
  12631. if (suggestionPanelEl) {
  12632. const suggestionList = suggestionPanelEl.querySelector(`.${nsCascader.e("suggestion-list")}`);
  12633. suggestionList.style.minWidth = `${inputInner.offsetWidth}px`;
  12634. }
  12635. if (tagWrapperEl) {
  12636. const { offsetHeight } = tagWrapperEl;
  12637. const height = presentTags.value.length > 0 ? `${Math.max(offsetHeight + 6, inputInitialHeight)}px` : `${inputInitialHeight}px`;
  12638. inputInner.style.height = height;
  12639. updatePopperPosition();
  12640. }
  12641. };
  12642. const getCheckedNodes = (leafOnly) => {
  12643. var _a2;
  12644. return (_a2 = panel.value) == null ? void 0 : _a2.getCheckedNodes(leafOnly);
  12645. };
  12646. const handleExpandChange = (value) => {
  12647. updatePopperPosition();
  12648. emit("expand-change", value);
  12649. };
  12650. const handleComposition = (event) => {
  12651. var _a2;
  12652. const text = (_a2 = event.target) == null ? void 0 : _a2.value;
  12653. if (event.type === "compositionend") {
  12654. isOnComposition.value = false;
  12655. nextTick(() => handleInput(text));
  12656. } else {
  12657. const lastCharacter = text[text.length - 1] || "";
  12658. isOnComposition.value = !isKorean(lastCharacter);
  12659. }
  12660. };
  12661. const handleKeyDown2 = (e) => {
  12662. if (isOnComposition.value)
  12663. return;
  12664. switch (e.code) {
  12665. case EVENT_CODE.enter:
  12666. togglePopperVisible();
  12667. break;
  12668. case EVENT_CODE.down:
  12669. togglePopperVisible(true);
  12670. nextTick(focusFirstNode);
  12671. e.preventDefault();
  12672. break;
  12673. case EVENT_CODE.esc:
  12674. case EVENT_CODE.tab:
  12675. togglePopperVisible(false);
  12676. break;
  12677. }
  12678. };
  12679. const handleClear = () => {
  12680. var _a2;
  12681. (_a2 = panel.value) == null ? void 0 : _a2.clearCheckedNodes();
  12682. togglePopperVisible(false);
  12683. };
  12684. const handleSuggestionClick = (node) => {
  12685. var _a2, _b2;
  12686. const { checked } = node;
  12687. if (multiple.value) {
  12688. (_a2 = panel.value) == null ? void 0 : _a2.handleCheckChange(node, !checked, false);
  12689. } else {
  12690. !checked && ((_b2 = panel.value) == null ? void 0 : _b2.handleCheckChange(node, true, false));
  12691. togglePopperVisible(false);
  12692. }
  12693. };
  12694. const handleSuggestionKeyDown = (e) => {
  12695. const target = e.target;
  12696. const { code } = e;
  12697. switch (code) {
  12698. case EVENT_CODE.up:
  12699. case EVENT_CODE.down: {
  12700. const distance = code === EVENT_CODE.up ? -1 : 1;
  12701. focusNode(getSibling(target, distance, `.${nsCascader.e("suggestion-item")}[tabindex="-1"]`));
  12702. break;
  12703. }
  12704. case EVENT_CODE.enter:
  12705. target.click();
  12706. break;
  12707. case EVENT_CODE.esc:
  12708. case EVENT_CODE.tab:
  12709. togglePopperVisible(false);
  12710. break;
  12711. }
  12712. };
  12713. const handleDelete = () => {
  12714. const tags = presentTags.value;
  12715. const lastTag = tags[tags.length - 1];
  12716. pressDeleteCount = searchInputValue.value ? 0 : pressDeleteCount + 1;
  12717. if (!lastTag || !pressDeleteCount)
  12718. return;
  12719. if (lastTag.hitState) {
  12720. deleteTag(lastTag);
  12721. } else {
  12722. lastTag.hitState = true;
  12723. }
  12724. };
  12725. const handleFilter = debounce$1(() => {
  12726. const { value } = searchKeyword;
  12727. if (!value)
  12728. return;
  12729. const passed = props.beforeFilter(value);
  12730. if (isPromise(passed)) {
  12731. passed.then(calculateSuggestions).catch(() => {
  12732. });
  12733. } else if (passed !== false) {
  12734. calculateSuggestions();
  12735. } else {
  12736. hideSuggestionPanel();
  12737. }
  12738. }, props.debounce);
  12739. const handleInput = (val, e) => {
  12740. !popperVisible.value && togglePopperVisible(true);
  12741. if (e == null ? void 0 : e.isComposing)
  12742. return;
  12743. val ? handleFilter() : hideSuggestionPanel();
  12744. };
  12745. watch(filtering, updatePopperPosition);
  12746. watch([checkedNodes, isDisabled], calculatePresentTags);
  12747. watch(presentTags, () => {
  12748. nextTick(() => updateStyle());
  12749. });
  12750. watch(presentText, (val) => inputValue.value = val, { immediate: true });
  12751. onMounted(() => {
  12752. var _a2;
  12753. const inputEl = (_a2 = input.value) == null ? void 0 : _a2.$el;
  12754. inputInitialHeight = (inputEl == null ? void 0 : inputEl.offsetHeight) || INPUT_HEIGHT_MAP[realSize.value] || DEFAULT_INPUT_HEIGHT;
  12755. addResizeListener(inputEl, updateStyle);
  12756. });
  12757. onBeforeUnmount(() => {
  12758. var _a2;
  12759. removeResizeListener((_a2 = input.value) == null ? void 0 : _a2.$el, updateStyle);
  12760. });
  12761. return {
  12762. popperOptions,
  12763. tooltipRef,
  12764. popperPaneRef,
  12765. input,
  12766. tagWrapper,
  12767. panel,
  12768. suggestionPanel,
  12769. popperVisible,
  12770. inputHover,
  12771. inputPlaceholder,
  12772. filtering,
  12773. presentText,
  12774. checkedValue,
  12775. inputValue,
  12776. searchInputValue,
  12777. presentTags,
  12778. allPresentTags,
  12779. suggestions,
  12780. isDisabled,
  12781. isOnComposition,
  12782. realSize,
  12783. tagSize,
  12784. multiple,
  12785. readonly: readonly2,
  12786. clearBtnVisible,
  12787. compatTeleported,
  12788. nsCascader,
  12789. nsInput,
  12790. t,
  12791. togglePopperVisible,
  12792. hideSuggestionPanel,
  12793. deleteTag,
  12794. focusFirstNode,
  12795. getCheckedNodes,
  12796. handleExpandChange,
  12797. handleKeyDown: handleKeyDown2,
  12798. handleComposition,
  12799. handleClear,
  12800. handleSuggestionClick,
  12801. handleSuggestionKeyDown,
  12802. handleDelete,
  12803. handleInput
  12804. };
  12805. }
  12806. });
  12807. const _hoisted_1$s = { key: 0 };
  12808. const _hoisted_2$l = { class: "el-cascader__collapse-tags" };
  12809. const _hoisted_3$f = ["placeholder"];
  12810. const _hoisted_4$d = ["onClick"];
  12811. function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
  12812. const _component_circle_close = resolveComponent("circle-close");
  12813. const _component_el_icon = resolveComponent("el-icon");
  12814. const _component_arrow_down = resolveComponent("arrow-down");
  12815. const _component_el_input = resolveComponent("el-input");
  12816. const _component_el_tag = resolveComponent("el-tag");
  12817. const _component_el_tooltip = resolveComponent("el-tooltip");
  12818. const _component_el_cascader_panel = resolveComponent("el-cascader-panel");
  12819. const _component_check = resolveComponent("check");
  12820. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  12821. const _directive_clickoutside = resolveDirective("clickoutside");
  12822. return openBlock(), createBlock(_component_el_tooltip, {
  12823. ref: "tooltipRef",
  12824. visible: _ctx.popperVisible,
  12825. "onUpdate:visible": _cache[17] || (_cache[17] = ($event) => _ctx.popperVisible = $event),
  12826. teleported: _ctx.compatTeleported,
  12827. "popper-class": [_ctx.nsCascader.e("dropdown"), _ctx.popperClass],
  12828. "popper-options": _ctx.popperOptions,
  12829. "fallback-placements": [
  12830. "bottom-start",
  12831. "bottom",
  12832. "top-start",
  12833. "top",
  12834. "right",
  12835. "left"
  12836. ],
  12837. "stop-popper-mouse-event": false,
  12838. "gpu-acceleration": false,
  12839. placement: "bottom-start",
  12840. transition: `${_ctx.nsCascader.namespace.value}-zoom-in-top`,
  12841. effect: "light",
  12842. pure: "",
  12843. persistent: "",
  12844. onHide: _ctx.hideSuggestionPanel
  12845. }, {
  12846. default: withCtx(() => [
  12847. withDirectives((openBlock(), createElementBlock("div", {
  12848. class: normalizeClass([
  12849. _ctx.nsCascader.b(),
  12850. _ctx.nsCascader.m(_ctx.realSize),
  12851. _ctx.nsCascader.is("disabled", _ctx.isDisabled),
  12852. _ctx.$attrs.class
  12853. ]),
  12854. style: normalizeStyle(_ctx.$attrs.style),
  12855. onClick: _cache[11] || (_cache[11] = () => _ctx.togglePopperVisible(_ctx.readonly ? void 0 : true)),
  12856. onKeydown: _cache[12] || (_cache[12] = (...args) => _ctx.handleKeyDown && _ctx.handleKeyDown(...args)),
  12857. onMouseenter: _cache[13] || (_cache[13] = ($event) => _ctx.inputHover = true),
  12858. onMouseleave: _cache[14] || (_cache[14] = ($event) => _ctx.inputHover = false)
  12859. }, [
  12860. createVNode(_component_el_input, {
  12861. ref: "input",
  12862. modelValue: _ctx.inputValue,
  12863. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.inputValue = $event),
  12864. placeholder: _ctx.inputPlaceholder,
  12865. readonly: _ctx.readonly,
  12866. disabled: _ctx.isDisabled,
  12867. "validate-event": false,
  12868. size: _ctx.realSize,
  12869. class: normalizeClass(_ctx.nsCascader.is("focus", _ctx.popperVisible)),
  12870. onCompositionstart: _ctx.handleComposition,
  12871. onCompositionupdate: _ctx.handleComposition,
  12872. onCompositionend: _ctx.handleComposition,
  12873. onFocus: _cache[2] || (_cache[2] = (e) => _ctx.$emit("focus", e)),
  12874. onBlur: _cache[3] || (_cache[3] = (e) => _ctx.$emit("blur", e)),
  12875. onInput: _ctx.handleInput
  12876. }, {
  12877. suffix: withCtx(() => [
  12878. _ctx.clearBtnVisible ? (openBlock(), createBlock(_component_el_icon, {
  12879. key: "clear",
  12880. class: normalizeClass([_ctx.nsInput.e("icon"), "icon-circle-close"]),
  12881. onClick: withModifiers(_ctx.handleClear, ["stop"])
  12882. }, {
  12883. default: withCtx(() => [
  12884. createVNode(_component_circle_close)
  12885. ]),
  12886. _: 1
  12887. }, 8, ["class", "onClick"])) : (openBlock(), createBlock(_component_el_icon, {
  12888. key: "arrow-down",
  12889. class: normalizeClass([
  12890. _ctx.nsInput.e("icon"),
  12891. "icon-arrow-down",
  12892. _ctx.nsCascader.is("reverse", _ctx.popperVisible)
  12893. ]),
  12894. onClick: _cache[0] || (_cache[0] = withModifiers(($event) => _ctx.togglePopperVisible(), ["stop"]))
  12895. }, {
  12896. default: withCtx(() => [
  12897. createVNode(_component_arrow_down)
  12898. ]),
  12899. _: 1
  12900. }, 8, ["class"]))
  12901. ]),
  12902. _: 1
  12903. }, 8, ["modelValue", "placeholder", "readonly", "disabled", "size", "class", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onInput"]),
  12904. _ctx.multiple ? (openBlock(), createElementBlock("div", {
  12905. key: 0,
  12906. ref: "tagWrapper",
  12907. class: normalizeClass(_ctx.nsCascader.e("tags"))
  12908. }, [
  12909. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.presentTags, (tag) => {
  12910. return openBlock(), createBlock(_component_el_tag, {
  12911. key: tag.key,
  12912. type: _ctx.tagType,
  12913. size: _ctx.tagSize,
  12914. hit: tag.hitState,
  12915. closable: tag.closable,
  12916. "disable-transitions": "",
  12917. onClose: ($event) => _ctx.deleteTag(tag)
  12918. }, {
  12919. default: withCtx(() => [
  12920. tag.isCollapseTag === false ? (openBlock(), createElementBlock("span", _hoisted_1$s, toDisplayString(tag.text), 1)) : (openBlock(), createBlock(_component_el_tooltip, {
  12921. key: 1,
  12922. teleported: false,
  12923. disabled: _ctx.popperVisible || !_ctx.collapseTagsTooltip,
  12924. "fallback-placements": ["bottom", "top", "right", "left"],
  12925. placement: "bottom",
  12926. effect: "light"
  12927. }, {
  12928. default: withCtx(() => [
  12929. createElementVNode("span", null, toDisplayString(tag.text), 1)
  12930. ]),
  12931. content: withCtx(() => [
  12932. createElementVNode("div", _hoisted_2$l, [
  12933. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.allPresentTags, (tag2, idx) => {
  12934. return openBlock(), createElementBlock("div", {
  12935. key: idx,
  12936. class: "el-cascader__collapse-tag"
  12937. }, [
  12938. (openBlock(), createBlock(_component_el_tag, {
  12939. key: tag2.key,
  12940. class: "in-tooltip",
  12941. type: _ctx.tagType,
  12942. size: _ctx.tagSize,
  12943. hit: tag2.hitState,
  12944. closable: tag2.closable,
  12945. "disable-transitions": "",
  12946. onClose: ($event) => _ctx.deleteTag(tag2)
  12947. }, {
  12948. default: withCtx(() => [
  12949. createElementVNode("span", null, toDisplayString(tag2.text), 1)
  12950. ]),
  12951. _: 2
  12952. }, 1032, ["type", "size", "hit", "closable", "onClose"]))
  12953. ]);
  12954. }), 128))
  12955. ])
  12956. ]),
  12957. _: 2
  12958. }, 1032, ["disabled"]))
  12959. ]),
  12960. _: 2
  12961. }, 1032, ["type", "size", "hit", "closable", "onClose"]);
  12962. }), 128)),
  12963. _ctx.filterable && !_ctx.isDisabled ? withDirectives((openBlock(), createElementBlock("input", {
  12964. key: 0,
  12965. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => _ctx.searchInputValue = $event),
  12966. type: "text",
  12967. class: normalizeClass(_ctx.nsCascader.e("search-input")),
  12968. placeholder: _ctx.presentText ? "" : _ctx.inputPlaceholder,
  12969. onInput: _cache[5] || (_cache[5] = (e) => _ctx.handleInput(_ctx.searchInputValue, e)),
  12970. onClick: _cache[6] || (_cache[6] = withModifiers(($event) => _ctx.togglePopperVisible(true), ["stop"])),
  12971. onKeydown: _cache[7] || (_cache[7] = withKeys((...args) => _ctx.handleDelete && _ctx.handleDelete(...args), ["delete"])),
  12972. onCompositionstart: _cache[8] || (_cache[8] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  12973. onCompositionupdate: _cache[9] || (_cache[9] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  12974. onCompositionend: _cache[10] || (_cache[10] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args))
  12975. }, null, 42, _hoisted_3$f)), [
  12976. [vModelText, _ctx.searchInputValue]
  12977. ]) : createCommentVNode("v-if", true)
  12978. ], 2)) : createCommentVNode("v-if", true)
  12979. ], 38)), [
  12980. [_directive_clickoutside, () => _ctx.togglePopperVisible(false), _ctx.popperPaneRef]
  12981. ])
  12982. ]),
  12983. content: withCtx(() => [
  12984. withDirectives(createVNode(_component_el_cascader_panel, {
  12985. ref: "panel",
  12986. modelValue: _ctx.checkedValue,
  12987. "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => _ctx.checkedValue = $event),
  12988. options: _ctx.options,
  12989. props: _ctx.props,
  12990. border: false,
  12991. "render-label": _ctx.$slots.default,
  12992. onExpandChange: _ctx.handleExpandChange,
  12993. onClose: _cache[16] || (_cache[16] = ($event) => _ctx.$nextTick(() => _ctx.togglePopperVisible(false)))
  12994. }, null, 8, ["modelValue", "options", "props", "render-label", "onExpandChange"]), [
  12995. [vShow, !_ctx.filtering]
  12996. ]),
  12997. _ctx.filterable ? withDirectives((openBlock(), createBlock(_component_el_scrollbar, {
  12998. key: 0,
  12999. ref: "suggestionPanel",
  13000. tag: "ul",
  13001. class: normalizeClass(_ctx.nsCascader.e("suggestion-panel")),
  13002. "view-class": _ctx.nsCascader.e("suggestion-list"),
  13003. onKeydown: _ctx.handleSuggestionKeyDown
  13004. }, {
  13005. default: withCtx(() => [
  13006. _ctx.suggestions.length ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.suggestions, (item) => {
  13007. return openBlock(), createElementBlock("li", {
  13008. key: item.uid,
  13009. class: normalizeClass([
  13010. _ctx.nsCascader.e("suggestion-item"),
  13011. _ctx.nsCascader.is("checked", item.checked)
  13012. ]),
  13013. tabindex: -1,
  13014. onClick: ($event) => _ctx.handleSuggestionClick(item)
  13015. }, [
  13016. createElementVNode("span", null, toDisplayString(item.text), 1),
  13017. item.checked ? (openBlock(), createBlock(_component_el_icon, { key: 0 }, {
  13018. default: withCtx(() => [
  13019. createVNode(_component_check)
  13020. ]),
  13021. _: 1
  13022. })) : createCommentVNode("v-if", true)
  13023. ], 10, _hoisted_4$d);
  13024. }), 128)) : renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
  13025. createElementVNode("li", {
  13026. class: normalizeClass(_ctx.nsCascader.e("empty-text"))
  13027. }, toDisplayString(_ctx.t("el.cascader.noMatch")), 3)
  13028. ])
  13029. ]),
  13030. _: 3
  13031. }, 8, ["class", "view-class", "onKeydown"])), [
  13032. [vShow, _ctx.filtering]
  13033. ]) : createCommentVNode("v-if", true)
  13034. ]),
  13035. _: 3
  13036. }, 8, ["visible", "teleported", "popper-class", "popper-options", "transition", "onHide"]);
  13037. }
  13038. var Cascader = /* @__PURE__ */ _export_sfc$1(_sfc_main$F, [["render", _sfc_render$k], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/cascader/src/index.vue"]]);
  13039. Cascader.install = (app) => {
  13040. app.component(Cascader.name, Cascader);
  13041. };
  13042. const _Cascader = Cascader;
  13043. const ElCascader = _Cascader;
  13044. const messageConfig = {};
  13045. const configProviderProps = buildProps({
  13046. a11y: {
  13047. type: Boolean,
  13048. default: true
  13049. },
  13050. locale: {
  13051. type: definePropType(Object)
  13052. },
  13053. size: {
  13054. type: String,
  13055. values: componentSizes,
  13056. default: ""
  13057. },
  13058. button: {
  13059. type: definePropType(Object)
  13060. },
  13061. experimentalFeatures: {
  13062. type: definePropType(Object)
  13063. },
  13064. keyboardNavigation: {
  13065. type: Boolean,
  13066. default: true
  13067. },
  13068. message: {
  13069. type: definePropType(Object)
  13070. },
  13071. zIndex: {
  13072. type: Number
  13073. },
  13074. namespace: {
  13075. type: String,
  13076. default: "el"
  13077. }
  13078. });
  13079. var ConfigProvider = defineComponent({
  13080. name: "ElConfigProvider",
  13081. props: configProviderProps,
  13082. setup(props, { slots }) {
  13083. watch(() => props.message, (val) => {
  13084. Object.assign(messageConfig, val != null ? val : {});
  13085. }, { immediate: true, deep: true });
  13086. const config = provideGlobalConfig(props);
  13087. return () => renderSlot(slots, "default", { config: config == null ? void 0 : config.value });
  13088. }
  13089. });
  13090. const ElConfigProvider = withInstall(ConfigProvider);
  13091. var advancedFormat$1 = { exports: {} };
  13092. (function(module2, exports2) {
  13093. !function(e, t) {
  13094. module2.exports = t();
  13095. }(commonjsGlobal, function() {
  13096. return function(e, t) {
  13097. var r = t.prototype, n = r.format;
  13098. r.format = function(e2) {
  13099. var t2 = this, r2 = this.$locale();
  13100. if (!this.isValid())
  13101. return n.bind(this)(e2);
  13102. var s2 = this.$utils(), a2 = (e2 || "YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g, function(e3) {
  13103. switch (e3) {
  13104. case "Q":
  13105. return Math.ceil((t2.$M + 1) / 3);
  13106. case "Do":
  13107. return r2.ordinal(t2.$D);
  13108. case "gggg":
  13109. return t2.weekYear();
  13110. case "GGGG":
  13111. return t2.isoWeekYear();
  13112. case "wo":
  13113. return r2.ordinal(t2.week(), "W");
  13114. case "w":
  13115. case "ww":
  13116. return s2.s(t2.week(), e3 === "w" ? 1 : 2, "0");
  13117. case "W":
  13118. case "WW":
  13119. return s2.s(t2.isoWeek(), e3 === "W" ? 1 : 2, "0");
  13120. case "k":
  13121. case "kk":
  13122. return s2.s(String(t2.$H === 0 ? 24 : t2.$H), e3 === "k" ? 1 : 2, "0");
  13123. case "X":
  13124. return Math.floor(t2.$d.getTime() / 1e3);
  13125. case "x":
  13126. return t2.$d.getTime();
  13127. case "z":
  13128. return "[" + t2.offsetName() + "]";
  13129. case "zzz":
  13130. return "[" + t2.offsetName("long") + "]";
  13131. default:
  13132. return e3;
  13133. }
  13134. });
  13135. return n.bind(this)(a2);
  13136. };
  13137. };
  13138. });
  13139. })(advancedFormat$1);
  13140. var advancedFormat = advancedFormat$1.exports;
  13141. var weekOfYear$1 = { exports: {} };
  13142. (function(module2, exports2) {
  13143. !function(e, t) {
  13144. module2.exports = t();
  13145. }(commonjsGlobal, function() {
  13146. var e = "week", t = "year";
  13147. return function(i, n, r) {
  13148. var f2 = n.prototype;
  13149. f2.week = function(i2) {
  13150. if (i2 === void 0 && (i2 = null), i2 !== null)
  13151. return this.add(7 * (i2 - this.week()), "day");
  13152. var n2 = this.$locale().yearStart || 1;
  13153. if (this.month() === 11 && this.date() > 25) {
  13154. var f3 = r(this).startOf(t).add(1, t).date(n2), s2 = r(this).endOf(e);
  13155. if (f3.isBefore(s2))
  13156. return 1;
  13157. }
  13158. var a2 = r(this).startOf(t).date(n2).startOf(e).subtract(1, "millisecond"), o2 = this.diff(a2, e, true);
  13159. return o2 < 0 ? r(this).startOf("week").week() : Math.ceil(o2);
  13160. }, f2.weeks = function(e2) {
  13161. return e2 === void 0 && (e2 = null), this.week(e2);
  13162. };
  13163. };
  13164. });
  13165. })(weekOfYear$1);
  13166. var weekOfYear = weekOfYear$1.exports;
  13167. var weekYear$1 = { exports: {} };
  13168. (function(module2, exports2) {
  13169. !function(e, t) {
  13170. module2.exports = t();
  13171. }(commonjsGlobal, function() {
  13172. return function(e, t) {
  13173. t.prototype.weekYear = function() {
  13174. var e2 = this.month(), t2 = this.week(), n = this.year();
  13175. return t2 === 1 && e2 === 11 ? n + 1 : e2 === 0 && t2 >= 52 ? n - 1 : n;
  13176. };
  13177. };
  13178. });
  13179. })(weekYear$1);
  13180. var weekYear = weekYear$1.exports;
  13181. var dayOfYear$1 = { exports: {} };
  13182. (function(module2, exports2) {
  13183. !function(e, t) {
  13184. module2.exports = t();
  13185. }(commonjsGlobal, function() {
  13186. return function(e, t, n) {
  13187. t.prototype.dayOfYear = function(e2) {
  13188. var t2 = Math.round((n(this).startOf("day") - n(this).startOf("year")) / 864e5) + 1;
  13189. return e2 == null ? t2 : this.add(e2 - t2, "day");
  13190. };
  13191. };
  13192. });
  13193. })(dayOfYear$1);
  13194. var dayOfYear = dayOfYear$1.exports;
  13195. var isSameOrAfter$1 = { exports: {} };
  13196. (function(module2, exports2) {
  13197. !function(e, t) {
  13198. module2.exports = t();
  13199. }(commonjsGlobal, function() {
  13200. return function(e, t) {
  13201. t.prototype.isSameOrAfter = function(e2, t2) {
  13202. return this.isSame(e2, t2) || this.isAfter(e2, t2);
  13203. };
  13204. };
  13205. });
  13206. })(isSameOrAfter$1);
  13207. var isSameOrAfter = isSameOrAfter$1.exports;
  13208. var isSameOrBefore$1 = { exports: {} };
  13209. (function(module2, exports2) {
  13210. !function(e, i) {
  13211. module2.exports = i();
  13212. }(commonjsGlobal, function() {
  13213. return function(e, i) {
  13214. i.prototype.isSameOrBefore = function(e2, i2) {
  13215. return this.isSame(e2, i2) || this.isBefore(e2, i2);
  13216. };
  13217. };
  13218. });
  13219. })(isSameOrBefore$1);
  13220. var isSameOrBefore = isSameOrBefore$1.exports;
  13221. const ROOT_PICKER_INJECTION_KEY = Symbol();
  13222. var ElDatePickerCell = defineComponent({
  13223. name: "ElDatePickerCell",
  13224. props: buildProps({
  13225. cell: {
  13226. type: definePropType(Object)
  13227. }
  13228. }),
  13229. setup(props) {
  13230. const picker = inject(ROOT_PICKER_INJECTION_KEY);
  13231. return () => {
  13232. const cell = props.cell;
  13233. if (picker == null ? void 0 : picker.ctx.slots.default) {
  13234. const list = picker.ctx.slots.default(cell).filter((item) => {
  13235. return item.patchFlag !== -2 && item.type.toString() !== "Symbol(Comment)";
  13236. });
  13237. if (list.length) {
  13238. return list;
  13239. }
  13240. }
  13241. return h$1("div", {
  13242. class: "el-date-table-cell"
  13243. }, [
  13244. h$1("span", {
  13245. class: "el-date-table-cell__text"
  13246. }, [cell == null ? void 0 : cell.text])
  13247. ]);
  13248. };
  13249. }
  13250. });
  13251. const _sfc_main$E = defineComponent({
  13252. components: {
  13253. ElDatePickerCell
  13254. },
  13255. props: {
  13256. date: {
  13257. type: Object
  13258. },
  13259. minDate: {
  13260. type: Object
  13261. },
  13262. maxDate: {
  13263. type: Object
  13264. },
  13265. parsedValue: {
  13266. type: [Object, Array]
  13267. },
  13268. selectionMode: {
  13269. type: String,
  13270. default: "day"
  13271. },
  13272. showWeekNumber: {
  13273. type: Boolean,
  13274. default: false
  13275. },
  13276. disabledDate: {
  13277. type: Function
  13278. },
  13279. cellClassName: {
  13280. type: Function
  13281. },
  13282. rangeState: {
  13283. type: Object,
  13284. default: () => ({
  13285. endDate: null,
  13286. selecting: false
  13287. })
  13288. }
  13289. },
  13290. emits: ["changerange", "pick", "select"],
  13291. setup(props, ctx) {
  13292. const { t, lang } = useLocale();
  13293. const lastRow = ref(null);
  13294. const lastColumn = ref(null);
  13295. const tableRows = ref([[], [], [], [], [], []]);
  13296. const firstDayOfWeek = props.date.$locale().weekStart || 7;
  13297. const WEEKS_CONSTANT = props.date.locale("en").localeData().weekdaysShort().map((_2) => _2.toLowerCase());
  13298. const offsetDay = computed(() => {
  13299. return firstDayOfWeek > 3 ? 7 - firstDayOfWeek : -firstDayOfWeek;
  13300. });
  13301. const startDate = computed(() => {
  13302. const startDayOfMonth = props.date.startOf("month");
  13303. return startDayOfMonth.subtract(startDayOfMonth.day() || 7, "day");
  13304. });
  13305. const WEEKS = computed(() => {
  13306. return WEEKS_CONSTANT.concat(WEEKS_CONSTANT).slice(firstDayOfWeek, firstDayOfWeek + 7);
  13307. });
  13308. const rows = computed(() => {
  13309. var _a2;
  13310. const startOfMonth = props.date.startOf("month");
  13311. const startOfMonthDay = startOfMonth.day() || 7;
  13312. const dateCountOfMonth = startOfMonth.daysInMonth();
  13313. const dateCountOfLastMonth = startOfMonth.subtract(1, "month").daysInMonth();
  13314. const offset2 = offsetDay.value;
  13315. const rows_ = tableRows.value;
  13316. let count = 1;
  13317. const selectedDate = props.selectionMode === "dates" ? castArray(props.parsedValue) : [];
  13318. const calNow = dayjs().locale(lang.value).startOf("day");
  13319. for (let i = 0; i < 6; i++) {
  13320. const row = rows_[i];
  13321. if (props.showWeekNumber) {
  13322. if (!row[0]) {
  13323. row[0] = {
  13324. type: "week",
  13325. text: startDate.value.add(i * 7 + 1, "day").week()
  13326. };
  13327. }
  13328. }
  13329. for (let j = 0; j < 7; j++) {
  13330. let cell = row[props.showWeekNumber ? j + 1 : j];
  13331. if (!cell) {
  13332. cell = {
  13333. row: i,
  13334. column: j,
  13335. type: "normal",
  13336. inRange: false,
  13337. start: false,
  13338. end: false
  13339. };
  13340. }
  13341. const index = i * 7 + j;
  13342. const calTime = startDate.value.add(index - offset2, "day");
  13343. cell.dayjs = calTime;
  13344. cell.date = calTime.toDate();
  13345. cell.timestamp = calTime.valueOf();
  13346. cell.type = "normal";
  13347. const calEndDate = props.rangeState.endDate || props.maxDate || props.rangeState.selecting && props.minDate;
  13348. cell.inRange = props.minDate && calTime.isSameOrAfter(props.minDate, "day") && calEndDate && calTime.isSameOrBefore(calEndDate, "day") || props.minDate && calTime.isSameOrBefore(props.minDate, "day") && calEndDate && calTime.isSameOrAfter(calEndDate, "day");
  13349. if ((_a2 = props.minDate) == null ? void 0 : _a2.isSameOrAfter(calEndDate)) {
  13350. cell.start = calEndDate && calTime.isSame(calEndDate, "day");
  13351. cell.end = props.minDate && calTime.isSame(props.minDate, "day");
  13352. } else {
  13353. cell.start = props.minDate && calTime.isSame(props.minDate, "day");
  13354. cell.end = calEndDate && calTime.isSame(calEndDate, "day");
  13355. }
  13356. const isToday = calTime.isSame(calNow, "day");
  13357. if (isToday) {
  13358. cell.type = "today";
  13359. }
  13360. if (i >= 0 && i <= 1) {
  13361. const numberOfDaysFromPreviousMonth = startOfMonthDay + offset2 < 0 ? 7 + startOfMonthDay + offset2 : startOfMonthDay + offset2;
  13362. if (j + i * 7 >= numberOfDaysFromPreviousMonth) {
  13363. cell.text = count++;
  13364. } else {
  13365. cell.text = dateCountOfLastMonth - (numberOfDaysFromPreviousMonth - j % 7) + 1 + i * 7;
  13366. cell.type = "prev-month";
  13367. }
  13368. } else {
  13369. if (count <= dateCountOfMonth) {
  13370. cell.text = count++;
  13371. } else {
  13372. cell.text = count++ - dateCountOfMonth;
  13373. cell.type = "next-month";
  13374. }
  13375. }
  13376. const cellDate = calTime.toDate();
  13377. cell.selected = selectedDate.find((_2) => _2.valueOf() === calTime.valueOf());
  13378. cell.isSelected = !!cell.selected;
  13379. cell.isCurrent = isCurrent(cell);
  13380. cell.disabled = props.disabledDate && props.disabledDate(cellDate);
  13381. cell.customClass = props.cellClassName && props.cellClassName(cellDate);
  13382. row[props.showWeekNumber ? j + 1 : j] = cell;
  13383. }
  13384. if (props.selectionMode === "week") {
  13385. const start2 = props.showWeekNumber ? 1 : 0;
  13386. const end2 = props.showWeekNumber ? 7 : 6;
  13387. const isActive = isWeekActive(row[start2 + 1]);
  13388. row[start2].inRange = isActive;
  13389. row[start2].start = isActive;
  13390. row[end2].inRange = isActive;
  13391. row[end2].end = isActive;
  13392. }
  13393. }
  13394. return rows_;
  13395. });
  13396. const isCurrent = (cell) => {
  13397. return props.selectionMode === "day" && (cell.type === "normal" || cell.type === "today") && cellMatchesDate(cell, props.parsedValue);
  13398. };
  13399. const cellMatchesDate = (cell, date4) => {
  13400. if (!date4)
  13401. return false;
  13402. return dayjs(date4).locale(lang.value).isSame(props.date.date(Number(cell.text)), "day");
  13403. };
  13404. const getCellClasses = (cell) => {
  13405. const classes = [];
  13406. if ((cell.type === "normal" || cell.type === "today") && !cell.disabled) {
  13407. classes.push("available");
  13408. if (cell.type === "today") {
  13409. classes.push("today");
  13410. }
  13411. } else {
  13412. classes.push(cell.type);
  13413. }
  13414. if (isCurrent(cell)) {
  13415. classes.push("current");
  13416. }
  13417. if (cell.inRange && (cell.type === "normal" || cell.type === "today" || props.selectionMode === "week")) {
  13418. classes.push("in-range");
  13419. if (cell.start) {
  13420. classes.push("start-date");
  13421. }
  13422. if (cell.end) {
  13423. classes.push("end-date");
  13424. }
  13425. }
  13426. if (cell.disabled) {
  13427. classes.push("disabled");
  13428. }
  13429. if (cell.selected) {
  13430. classes.push("selected");
  13431. }
  13432. if (cell.customClass) {
  13433. classes.push(cell.customClass);
  13434. }
  13435. return classes.join(" ");
  13436. };
  13437. const getDateOfCell = (row, column) => {
  13438. const offsetFromStart = row * 7 + (column - (props.showWeekNumber ? 1 : 0)) - offsetDay.value;
  13439. return startDate.value.add(offsetFromStart, "day");
  13440. };
  13441. const handleMouseMove = (event) => {
  13442. if (!props.rangeState.selecting)
  13443. return;
  13444. let target = event.target;
  13445. if (target.tagName === "SPAN") {
  13446. target = target.parentNode.parentNode;
  13447. }
  13448. if (target.tagName === "DIV") {
  13449. target = target.parentNode;
  13450. }
  13451. if (target.tagName !== "TD")
  13452. return;
  13453. const row = target.parentNode.rowIndex - 1;
  13454. const column = target.cellIndex;
  13455. if (rows.value[row][column].disabled)
  13456. return;
  13457. if (row !== lastRow.value || column !== lastColumn.value) {
  13458. lastRow.value = row;
  13459. lastColumn.value = column;
  13460. ctx.emit("changerange", {
  13461. selecting: true,
  13462. endDate: getDateOfCell(row, column)
  13463. });
  13464. }
  13465. };
  13466. const handleClick = (event) => {
  13467. let target = event.target;
  13468. while (target) {
  13469. if (target.tagName === "TD") {
  13470. break;
  13471. }
  13472. target = target.parentNode;
  13473. }
  13474. if (!target || target.tagName !== "TD")
  13475. return;
  13476. const row = target.parentNode.rowIndex - 1;
  13477. const column = target.cellIndex;
  13478. const cell = rows.value[row][column];
  13479. if (cell.disabled || cell.type === "week")
  13480. return;
  13481. const newDate = getDateOfCell(row, column);
  13482. if (props.selectionMode === "range") {
  13483. if (!props.rangeState.selecting) {
  13484. ctx.emit("pick", { minDate: newDate, maxDate: null });
  13485. ctx.emit("select", true);
  13486. } else {
  13487. if (newDate >= props.minDate) {
  13488. ctx.emit("pick", { minDate: props.minDate, maxDate: newDate });
  13489. } else {
  13490. ctx.emit("pick", { minDate: newDate, maxDate: props.minDate });
  13491. }
  13492. ctx.emit("select", false);
  13493. }
  13494. } else if (props.selectionMode === "day") {
  13495. ctx.emit("pick", newDate);
  13496. } else if (props.selectionMode === "week") {
  13497. const weekNumber = newDate.week();
  13498. const value = `${newDate.year()}w${weekNumber}`;
  13499. ctx.emit("pick", {
  13500. year: newDate.year(),
  13501. week: weekNumber,
  13502. value,
  13503. date: newDate.startOf("week")
  13504. });
  13505. } else if (props.selectionMode === "dates") {
  13506. const newValue = cell.selected ? castArray(props.parsedValue).filter((_2) => _2.valueOf() !== newDate.valueOf()) : castArray(props.parsedValue).concat([newDate]);
  13507. ctx.emit("pick", newValue);
  13508. }
  13509. };
  13510. const isWeekActive = (cell) => {
  13511. if (props.selectionMode !== "week")
  13512. return false;
  13513. let newDate = props.date.startOf("day");
  13514. if (cell.type === "prev-month") {
  13515. newDate = newDate.subtract(1, "month");
  13516. }
  13517. if (cell.type === "next-month") {
  13518. newDate = newDate.add(1, "month");
  13519. }
  13520. newDate = newDate.date(Number.parseInt(cell.text, 10));
  13521. if (props.parsedValue && !Array.isArray(props.parsedValue)) {
  13522. const dayOffset = (props.parsedValue.day() - firstDayOfWeek + 7) % 7 - 1;
  13523. const weekDate = props.parsedValue.subtract(dayOffset, "day");
  13524. return weekDate.isSame(newDate, "day");
  13525. }
  13526. return false;
  13527. };
  13528. return {
  13529. handleMouseMove,
  13530. t,
  13531. rows,
  13532. isWeekActive,
  13533. getCellClasses,
  13534. WEEKS,
  13535. handleClick
  13536. };
  13537. }
  13538. });
  13539. const _hoisted_1$r = { key: 0 };
  13540. function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
  13541. const _component_el_date_picker_cell = resolveComponent("el-date-picker-cell");
  13542. return openBlock(), createElementBlock("table", {
  13543. cellspacing: "0",
  13544. cellpadding: "0",
  13545. class: normalizeClass(["el-date-table", { "is-week-mode": _ctx.selectionMode === "week" }]),
  13546. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args)),
  13547. onMousemove: _cache[1] || (_cache[1] = (...args) => _ctx.handleMouseMove && _ctx.handleMouseMove(...args))
  13548. }, [
  13549. createElementVNode("tbody", null, [
  13550. createElementVNode("tr", null, [
  13551. _ctx.showWeekNumber ? (openBlock(), createElementBlock("th", _hoisted_1$r, toDisplayString(_ctx.t("el.datepicker.week")), 1)) : createCommentVNode("v-if", true),
  13552. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.WEEKS, (week, key) => {
  13553. return openBlock(), createElementBlock("th", { key }, toDisplayString(_ctx.t("el.datepicker.weeks." + week)), 1);
  13554. }), 128))
  13555. ]),
  13556. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.rows, (row, key) => {
  13557. return openBlock(), createElementBlock("tr", {
  13558. key,
  13559. class: normalizeClass(["el-date-table__row", { current: _ctx.isWeekActive(row[1]) }])
  13560. }, [
  13561. (openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, key_) => {
  13562. return openBlock(), createElementBlock("td", {
  13563. key: key_,
  13564. class: normalizeClass(_ctx.getCellClasses(cell))
  13565. }, [
  13566. createVNode(_component_el_date_picker_cell, { cell }, null, 8, ["cell"])
  13567. ], 2);
  13568. }), 128))
  13569. ], 2);
  13570. }), 128))
  13571. ])
  13572. ], 34);
  13573. }
  13574. var DateTable = /* @__PURE__ */ _export_sfc$1(_sfc_main$E, [["render", _sfc_render$j], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/basic-date-table.vue"]]);
  13575. const datesInMonth = (year, month, lang) => {
  13576. const firstDay = dayjs().locale(lang).startOf("month").month(month).year(year);
  13577. const numOfDays = firstDay.daysInMonth();
  13578. return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
  13579. };
  13580. const _sfc_main$D = defineComponent({
  13581. props: {
  13582. disabledDate: {
  13583. type: Function
  13584. },
  13585. selectionMode: {
  13586. type: String,
  13587. default: "month"
  13588. },
  13589. minDate: {
  13590. type: Object
  13591. },
  13592. maxDate: {
  13593. type: Object
  13594. },
  13595. date: {
  13596. type: Object
  13597. },
  13598. parsedValue: {
  13599. type: Object
  13600. },
  13601. rangeState: {
  13602. type: Object,
  13603. default: () => ({
  13604. endDate: null,
  13605. selecting: false
  13606. })
  13607. }
  13608. },
  13609. emits: ["changerange", "pick", "select"],
  13610. setup(props, ctx) {
  13611. const { t, lang } = useLocale();
  13612. const months = ref(props.date.locale("en").localeData().monthsShort().map((_2) => _2.toLowerCase()));
  13613. const tableRows = ref([[], [], []]);
  13614. const lastRow = ref(null);
  13615. const lastColumn = ref(null);
  13616. const rows = computed(() => {
  13617. var _a2;
  13618. const rows2 = tableRows.value;
  13619. const now2 = dayjs().locale(lang.value).startOf("month");
  13620. for (let i = 0; i < 3; i++) {
  13621. const row = rows2[i];
  13622. for (let j = 0; j < 4; j++) {
  13623. let cell = row[j];
  13624. if (!cell) {
  13625. cell = {
  13626. row: i,
  13627. column: j,
  13628. type: "normal",
  13629. inRange: false,
  13630. start: false,
  13631. end: false
  13632. };
  13633. }
  13634. cell.type = "normal";
  13635. const index = i * 4 + j;
  13636. const calTime = props.date.startOf("year").month(index);
  13637. const calEndDate = props.rangeState.endDate || props.maxDate || props.rangeState.selecting && props.minDate;
  13638. cell.inRange = props.minDate && calTime.isSameOrAfter(props.minDate, "month") && calEndDate && calTime.isSameOrBefore(calEndDate, "month") || props.minDate && calTime.isSameOrBefore(props.minDate, "month") && calEndDate && calTime.isSameOrAfter(calEndDate, "month");
  13639. if ((_a2 = props.minDate) == null ? void 0 : _a2.isSameOrAfter(calEndDate)) {
  13640. cell.start = calEndDate && calTime.isSame(calEndDate, "month");
  13641. cell.end = props.minDate && calTime.isSame(props.minDate, "month");
  13642. } else {
  13643. cell.start = props.minDate && calTime.isSame(props.minDate, "month");
  13644. cell.end = calEndDate && calTime.isSame(calEndDate, "month");
  13645. }
  13646. const isToday = now2.isSame(calTime);
  13647. if (isToday) {
  13648. cell.type = "today";
  13649. }
  13650. cell.text = index;
  13651. const cellDate = calTime.toDate();
  13652. cell.disabled = props.disabledDate && props.disabledDate(cellDate);
  13653. row[j] = cell;
  13654. }
  13655. }
  13656. return rows2;
  13657. });
  13658. const getCellStyle = (cell) => {
  13659. const style = {};
  13660. const year = props.date.year();
  13661. const today = new Date();
  13662. const month = cell.text;
  13663. style.disabled = props.disabledDate ? datesInMonth(year, month, lang.value).every(props.disabledDate) : false;
  13664. style.current = castArray(props.parsedValue).findIndex((date4) => date4.year() === year && date4.month() === month) >= 0;
  13665. style.today = today.getFullYear() === year && today.getMonth() === month;
  13666. if (cell.inRange) {
  13667. style["in-range"] = true;
  13668. if (cell.start) {
  13669. style["start-date"] = true;
  13670. }
  13671. if (cell.end) {
  13672. style["end-date"] = true;
  13673. }
  13674. }
  13675. return style;
  13676. };
  13677. const handleMouseMove = (event) => {
  13678. if (!props.rangeState.selecting)
  13679. return;
  13680. let target = event.target;
  13681. if (target.tagName === "A") {
  13682. target = target.parentNode.parentNode;
  13683. }
  13684. if (target.tagName === "DIV") {
  13685. target = target.parentNode;
  13686. }
  13687. if (target.tagName !== "TD")
  13688. return;
  13689. const row = target.parentNode.rowIndex;
  13690. const column = target.cellIndex;
  13691. if (rows.value[row][column].disabled)
  13692. return;
  13693. if (row !== lastRow.value || column !== lastColumn.value) {
  13694. lastRow.value = row;
  13695. lastColumn.value = column;
  13696. ctx.emit("changerange", {
  13697. selecting: true,
  13698. endDate: props.date.startOf("year").month(row * 4 + column)
  13699. });
  13700. }
  13701. };
  13702. const handleMonthTableClick = (event) => {
  13703. let target = event.target;
  13704. if (target.tagName === "A") {
  13705. target = target.parentNode.parentNode;
  13706. }
  13707. if (target.tagName === "DIV") {
  13708. target = target.parentNode;
  13709. }
  13710. if (target.tagName !== "TD")
  13711. return;
  13712. if (hasClass(target, "disabled"))
  13713. return;
  13714. const column = target.cellIndex;
  13715. const row = target.parentNode.rowIndex;
  13716. const month = row * 4 + column;
  13717. const newDate = props.date.startOf("year").month(month);
  13718. if (props.selectionMode === "range") {
  13719. if (!props.rangeState.selecting) {
  13720. ctx.emit("pick", { minDate: newDate, maxDate: null });
  13721. ctx.emit("select", true);
  13722. } else {
  13723. if (newDate >= props.minDate) {
  13724. ctx.emit("pick", { minDate: props.minDate, maxDate: newDate });
  13725. } else {
  13726. ctx.emit("pick", { minDate: newDate, maxDate: props.minDate });
  13727. }
  13728. ctx.emit("select", false);
  13729. }
  13730. } else {
  13731. ctx.emit("pick", month);
  13732. }
  13733. };
  13734. return {
  13735. handleMouseMove,
  13736. handleMonthTableClick,
  13737. rows,
  13738. getCellStyle,
  13739. t,
  13740. months
  13741. };
  13742. }
  13743. });
  13744. const _hoisted_1$q = { class: "cell" };
  13745. function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
  13746. return openBlock(), createElementBlock("table", {
  13747. class: "el-month-table",
  13748. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleMonthTableClick && _ctx.handleMonthTableClick(...args)),
  13749. onMousemove: _cache[1] || (_cache[1] = (...args) => _ctx.handleMouseMove && _ctx.handleMouseMove(...args))
  13750. }, [
  13751. createElementVNode("tbody", null, [
  13752. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.rows, (row, key) => {
  13753. return openBlock(), createElementBlock("tr", { key }, [
  13754. (openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, key_) => {
  13755. return openBlock(), createElementBlock("td", {
  13756. key: key_,
  13757. class: normalizeClass(_ctx.getCellStyle(cell))
  13758. }, [
  13759. createElementVNode("div", null, [
  13760. createElementVNode("a", _hoisted_1$q, toDisplayString(_ctx.t("el.datepicker.months." + _ctx.months[cell.text])), 1)
  13761. ])
  13762. ], 2);
  13763. }), 128))
  13764. ]);
  13765. }), 128))
  13766. ])
  13767. ], 32);
  13768. }
  13769. var MonthTable = /* @__PURE__ */ _export_sfc$1(_sfc_main$D, [["render", _sfc_render$i], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/basic-month-table.vue"]]);
  13770. const datesInYear = (year, lang) => {
  13771. const firstDay = dayjs(String(year)).locale(lang).startOf("year");
  13772. const lastDay = firstDay.endOf("year");
  13773. const numOfDays = lastDay.dayOfYear();
  13774. return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
  13775. };
  13776. const _sfc_main$C = defineComponent({
  13777. props: {
  13778. disabledDate: {
  13779. type: Function
  13780. },
  13781. parsedValue: {
  13782. type: Object
  13783. },
  13784. date: {
  13785. type: Object
  13786. }
  13787. },
  13788. emits: ["pick"],
  13789. setup(props, ctx) {
  13790. const { lang } = useLocale();
  13791. const startYear = computed(() => {
  13792. return Math.floor(props.date.year() / 10) * 10;
  13793. });
  13794. const getCellStyle = (year) => {
  13795. const style = {};
  13796. const today = dayjs().locale(lang.value);
  13797. style.disabled = props.disabledDate ? datesInYear(year, lang.value).every(props.disabledDate) : false;
  13798. style.current = castArray(props.parsedValue).findIndex((_2) => _2.year() === year) >= 0;
  13799. style.today = today.year() === year;
  13800. return style;
  13801. };
  13802. const handleYearTableClick = (event) => {
  13803. const target = event.target;
  13804. if (target.tagName === "A") {
  13805. if (hasClass(target.parentNode, "disabled"))
  13806. return;
  13807. const year = target.textContent || target.innerText;
  13808. ctx.emit("pick", Number(year));
  13809. }
  13810. };
  13811. return {
  13812. startYear,
  13813. getCellStyle,
  13814. handleYearTableClick
  13815. };
  13816. }
  13817. });
  13818. const _hoisted_1$p = { class: "cell" };
  13819. const _hoisted_2$k = { class: "cell" };
  13820. const _hoisted_3$e = { class: "cell" };
  13821. const _hoisted_4$c = { class: "cell" };
  13822. const _hoisted_5$c = { class: "cell" };
  13823. const _hoisted_6$a = { class: "cell" };
  13824. const _hoisted_7$6 = { class: "cell" };
  13825. const _hoisted_8$5 = { class: "cell" };
  13826. const _hoisted_9$5 = { class: "cell" };
  13827. const _hoisted_10$5 = { class: "cell" };
  13828. const _hoisted_11$4 = /* @__PURE__ */ createElementVNode("td", null, null, -1);
  13829. const _hoisted_12$4 = /* @__PURE__ */ createElementVNode("td", null, null, -1);
  13830. function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
  13831. return openBlock(), createElementBlock("table", {
  13832. class: "el-year-table",
  13833. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleYearTableClick && _ctx.handleYearTableClick(...args))
  13834. }, [
  13835. createElementVNode("tbody", null, [
  13836. createElementVNode("tr", null, [
  13837. createElementVNode("td", {
  13838. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 0)])
  13839. }, [
  13840. createElementVNode("a", _hoisted_1$p, toDisplayString(_ctx.startYear), 1)
  13841. ], 2),
  13842. createElementVNode("td", {
  13843. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 1)])
  13844. }, [
  13845. createElementVNode("a", _hoisted_2$k, toDisplayString(_ctx.startYear + 1), 1)
  13846. ], 2),
  13847. createElementVNode("td", {
  13848. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 2)])
  13849. }, [
  13850. createElementVNode("a", _hoisted_3$e, toDisplayString(_ctx.startYear + 2), 1)
  13851. ], 2),
  13852. createElementVNode("td", {
  13853. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 3)])
  13854. }, [
  13855. createElementVNode("a", _hoisted_4$c, toDisplayString(_ctx.startYear + 3), 1)
  13856. ], 2)
  13857. ]),
  13858. createElementVNode("tr", null, [
  13859. createElementVNode("td", {
  13860. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 4)])
  13861. }, [
  13862. createElementVNode("a", _hoisted_5$c, toDisplayString(_ctx.startYear + 4), 1)
  13863. ], 2),
  13864. createElementVNode("td", {
  13865. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 5)])
  13866. }, [
  13867. createElementVNode("a", _hoisted_6$a, toDisplayString(_ctx.startYear + 5), 1)
  13868. ], 2),
  13869. createElementVNode("td", {
  13870. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 6)])
  13871. }, [
  13872. createElementVNode("a", _hoisted_7$6, toDisplayString(_ctx.startYear + 6), 1)
  13873. ], 2),
  13874. createElementVNode("td", {
  13875. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 7)])
  13876. }, [
  13877. createElementVNode("a", _hoisted_8$5, toDisplayString(_ctx.startYear + 7), 1)
  13878. ], 2)
  13879. ]),
  13880. createElementVNode("tr", null, [
  13881. createElementVNode("td", {
  13882. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 8)])
  13883. }, [
  13884. createElementVNode("a", _hoisted_9$5, toDisplayString(_ctx.startYear + 8), 1)
  13885. ], 2),
  13886. createElementVNode("td", {
  13887. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 9)])
  13888. }, [
  13889. createElementVNode("a", _hoisted_10$5, toDisplayString(_ctx.startYear + 9), 1)
  13890. ], 2),
  13891. _hoisted_11$4,
  13892. _hoisted_12$4
  13893. ])
  13894. ])
  13895. ]);
  13896. }
  13897. var YearTable = /* @__PURE__ */ _export_sfc$1(_sfc_main$C, [["render", _sfc_render$h], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/basic-year-table.vue"]]);
  13898. const timeWithinRange = (_2, __, ___) => true;
  13899. const _sfc_main$B = defineComponent({
  13900. components: {
  13901. DateTable,
  13902. ElInput,
  13903. ElButton,
  13904. ElIcon,
  13905. TimePickPanel,
  13906. MonthTable,
  13907. YearTable,
  13908. DArrowLeft: dArrowLeft,
  13909. ArrowLeft: arrowLeft,
  13910. DArrowRight: dArrowRight,
  13911. ArrowRight: arrowRight
  13912. },
  13913. directives: { clickoutside: ClickOutside },
  13914. props: {
  13915. visible: {
  13916. type: Boolean,
  13917. default: false
  13918. },
  13919. parsedValue: {
  13920. type: [Object, Array]
  13921. },
  13922. format: {
  13923. type: String,
  13924. default: ""
  13925. },
  13926. type: {
  13927. type: String,
  13928. required: true,
  13929. validator: isValidDatePickType
  13930. }
  13931. },
  13932. emits: ["pick", "set-picker-option", "panel-change"],
  13933. setup(props, ctx) {
  13934. const { t, lang } = useLocale();
  13935. const pickerBase = inject("EP_PICKER_BASE");
  13936. const popper2 = inject(TOOLTIP_INJECTION_KEY);
  13937. const {
  13938. shortcuts,
  13939. disabledDate,
  13940. cellClassName,
  13941. defaultTime,
  13942. arrowControl
  13943. } = pickerBase.props;
  13944. const defaultValue = toRef(pickerBase.props, "defaultValue");
  13945. const innerDate = ref(dayjs().locale(lang.value));
  13946. const defaultTimeD = computed(() => {
  13947. return dayjs(defaultTime).locale(lang.value);
  13948. });
  13949. const month = computed(() => {
  13950. return innerDate.value.month();
  13951. });
  13952. const year = computed(() => {
  13953. return innerDate.value.year();
  13954. });
  13955. const selectableRange = ref([]);
  13956. const userInputDate = ref(null);
  13957. const userInputTime = ref(null);
  13958. const checkDateWithinRange = (date4) => {
  13959. return selectableRange.value.length > 0 ? timeWithinRange(date4, selectableRange.value, props.format || "HH:mm:ss") : true;
  13960. };
  13961. const formatEmit = (emitDayjs) => {
  13962. if (defaultTime && !visibleTime.value) {
  13963. return defaultTimeD.value.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
  13964. }
  13965. if (showTime.value)
  13966. return emitDayjs.millisecond(0);
  13967. return emitDayjs.startOf("day");
  13968. };
  13969. const emit = (value, ...args) => {
  13970. if (!value) {
  13971. ctx.emit("pick", value, ...args);
  13972. } else if (Array.isArray(value)) {
  13973. const dates = value.map(formatEmit);
  13974. ctx.emit("pick", dates, ...args);
  13975. } else {
  13976. ctx.emit("pick", formatEmit(value), ...args);
  13977. }
  13978. userInputDate.value = null;
  13979. userInputTime.value = null;
  13980. };
  13981. const handleDatePick = (value) => {
  13982. if (selectionMode.value === "day") {
  13983. let newDate = props.parsedValue ? props.parsedValue.year(value.year()).month(value.month()).date(value.date()) : value;
  13984. if (!checkDateWithinRange(newDate)) {
  13985. newDate = selectableRange.value[0][0].year(value.year()).month(value.month()).date(value.date());
  13986. }
  13987. innerDate.value = newDate;
  13988. emit(newDate, showTime.value);
  13989. } else if (selectionMode.value === "week") {
  13990. emit(value.date);
  13991. } else if (selectionMode.value === "dates") {
  13992. emit(value, true);
  13993. }
  13994. };
  13995. const prevMonth_ = () => {
  13996. innerDate.value = innerDate.value.subtract(1, "month");
  13997. handlePanelChange("month");
  13998. };
  13999. const nextMonth_ = () => {
  14000. innerDate.value = innerDate.value.add(1, "month");
  14001. handlePanelChange("month");
  14002. };
  14003. const prevYear_ = () => {
  14004. if (currentView.value === "year") {
  14005. innerDate.value = innerDate.value.subtract(10, "year");
  14006. } else {
  14007. innerDate.value = innerDate.value.subtract(1, "year");
  14008. }
  14009. handlePanelChange("year");
  14010. };
  14011. const nextYear_ = () => {
  14012. if (currentView.value === "year") {
  14013. innerDate.value = innerDate.value.add(10, "year");
  14014. } else {
  14015. innerDate.value = innerDate.value.add(1, "year");
  14016. }
  14017. handlePanelChange("year");
  14018. };
  14019. const currentView = ref("date");
  14020. const yearLabel = computed(() => {
  14021. const yearTranslation = t("el.datepicker.year");
  14022. if (currentView.value === "year") {
  14023. const startYear = Math.floor(year.value / 10) * 10;
  14024. if (yearTranslation) {
  14025. return `${startYear} ${yearTranslation} - ${startYear + 9} ${yearTranslation}`;
  14026. }
  14027. return `${startYear} - ${startYear + 9}`;
  14028. }
  14029. return `${year.value} ${yearTranslation}`;
  14030. });
  14031. const handleShortcutClick = (shortcut) => {
  14032. const shortcutValue = typeof shortcut.value === "function" ? shortcut.value() : shortcut.value;
  14033. if (shortcutValue) {
  14034. emit(dayjs(shortcutValue).locale(lang.value));
  14035. return;
  14036. }
  14037. if (shortcut.onClick) {
  14038. shortcut.onClick(ctx);
  14039. }
  14040. };
  14041. const selectionMode = computed(() => {
  14042. if (["week", "month", "year", "dates"].includes(props.type)) {
  14043. return props.type;
  14044. }
  14045. return "day";
  14046. });
  14047. watch(() => selectionMode.value, (val) => {
  14048. if (["month", "year"].includes(val)) {
  14049. currentView.value = val;
  14050. return;
  14051. }
  14052. currentView.value = "date";
  14053. }, { immediate: true });
  14054. watch(() => currentView.value, () => {
  14055. popper2 == null ? void 0 : popper2.updatePopper();
  14056. });
  14057. const hasShortcuts = computed(() => !!shortcuts.length);
  14058. const handleMonthPick = (month2) => {
  14059. innerDate.value = innerDate.value.startOf("month").month(month2);
  14060. if (selectionMode.value === "month") {
  14061. emit(innerDate.value);
  14062. } else {
  14063. currentView.value = "date";
  14064. }
  14065. handlePanelChange("month");
  14066. };
  14067. const handleYearPick = (year2) => {
  14068. if (selectionMode.value === "year") {
  14069. innerDate.value = innerDate.value.startOf("year").year(year2);
  14070. emit(innerDate.value);
  14071. } else {
  14072. innerDate.value = innerDate.value.year(year2);
  14073. currentView.value = "month";
  14074. }
  14075. handlePanelChange("year");
  14076. };
  14077. const showMonthPicker = () => {
  14078. currentView.value = "month";
  14079. };
  14080. const showYearPicker = () => {
  14081. currentView.value = "year";
  14082. };
  14083. const showTime = computed(() => props.type === "datetime" || props.type === "datetimerange");
  14084. const footerVisible = computed(() => {
  14085. return showTime.value || selectionMode.value === "dates";
  14086. });
  14087. const onConfirm = () => {
  14088. if (selectionMode.value === "dates") {
  14089. emit(props.parsedValue);
  14090. } else {
  14091. let result = props.parsedValue;
  14092. if (!result) {
  14093. const defaultTimeD2 = dayjs(defaultTime).locale(lang.value);
  14094. const defaultValueD = getDefaultValue();
  14095. result = defaultTimeD2.year(defaultValueD.year()).month(defaultValueD.month()).date(defaultValueD.date());
  14096. }
  14097. innerDate.value = result;
  14098. emit(result);
  14099. }
  14100. };
  14101. const changeToNow = () => {
  14102. const now2 = dayjs().locale(lang.value);
  14103. const nowDate = now2.toDate();
  14104. if ((!disabledDate || !disabledDate(nowDate)) && checkDateWithinRange(nowDate)) {
  14105. innerDate.value = dayjs().locale(lang.value);
  14106. emit(innerDate.value);
  14107. }
  14108. };
  14109. const timeFormat = computed(() => {
  14110. return extractTimeFormat(props.format);
  14111. });
  14112. const dateFormat = computed(() => {
  14113. return extractDateFormat(props.format);
  14114. });
  14115. const visibleTime = computed(() => {
  14116. if (userInputTime.value)
  14117. return userInputTime.value;
  14118. if (!props.parsedValue && !defaultValue.value)
  14119. return;
  14120. return (props.parsedValue || innerDate.value).format(timeFormat.value);
  14121. });
  14122. const visibleDate = computed(() => {
  14123. if (userInputDate.value)
  14124. return userInputDate.value;
  14125. if (!props.parsedValue && !defaultValue.value)
  14126. return;
  14127. return (props.parsedValue || innerDate.value).format(dateFormat.value);
  14128. });
  14129. const timePickerVisible = ref(false);
  14130. const onTimePickerInputFocus = () => {
  14131. timePickerVisible.value = true;
  14132. };
  14133. const handleTimePickClose = () => {
  14134. timePickerVisible.value = false;
  14135. };
  14136. const handleTimePick = (value, visible, first) => {
  14137. const newDate = props.parsedValue ? props.parsedValue.hour(value.hour()).minute(value.minute()).second(value.second()) : value;
  14138. innerDate.value = newDate;
  14139. emit(innerDate.value, true);
  14140. if (!first) {
  14141. timePickerVisible.value = visible;
  14142. }
  14143. };
  14144. const handleVisibleTimeChange = (value) => {
  14145. const newDate = dayjs(value, timeFormat.value).locale(lang.value);
  14146. if (newDate.isValid() && checkDateWithinRange(newDate)) {
  14147. innerDate.value = newDate.year(innerDate.value.year()).month(innerDate.value.month()).date(innerDate.value.date());
  14148. userInputTime.value = null;
  14149. timePickerVisible.value = false;
  14150. emit(innerDate.value, true);
  14151. }
  14152. };
  14153. const handleVisibleDateChange = (value) => {
  14154. const newDate = dayjs(value, dateFormat.value).locale(lang.value);
  14155. if (newDate.isValid()) {
  14156. if (disabledDate && disabledDate(newDate.toDate())) {
  14157. return;
  14158. }
  14159. innerDate.value = newDate.hour(innerDate.value.hour()).minute(innerDate.value.minute()).second(innerDate.value.second());
  14160. userInputDate.value = null;
  14161. emit(innerDate.value, true);
  14162. }
  14163. };
  14164. const isValidValue = (date4) => {
  14165. return dayjs.isDayjs(date4) && date4.isValid() && (disabledDate ? !disabledDate(date4.toDate()) : true);
  14166. };
  14167. const formatToString = (value) => {
  14168. if (selectionMode.value === "dates") {
  14169. return value.map((_2) => _2.format(props.format));
  14170. }
  14171. return value.format(props.format);
  14172. };
  14173. const parseUserInput = (value) => {
  14174. return dayjs(value, props.format).locale(lang.value);
  14175. };
  14176. const getDefaultValue = () => {
  14177. const parseDate = dayjs(defaultValue.value).locale(lang.value);
  14178. if (!defaultValue.value) {
  14179. const defaultTimeDValue = defaultTimeD.value;
  14180. return dayjs().hour(defaultTimeDValue.hour()).minute(defaultTimeDValue.minute()).second(defaultTimeDValue.second()).locale(lang.value);
  14181. }
  14182. return parseDate;
  14183. };
  14184. const handleKeydown = (event) => {
  14185. const { code, keyCode } = event;
  14186. const list = [
  14187. EVENT_CODE.up,
  14188. EVENT_CODE.down,
  14189. EVENT_CODE.left,
  14190. EVENT_CODE.right
  14191. ];
  14192. if (props.visible && !timePickerVisible.value) {
  14193. if (list.includes(code)) {
  14194. handleKeyControl(keyCode);
  14195. event.stopPropagation();
  14196. event.preventDefault();
  14197. }
  14198. if (code === EVENT_CODE.enter && userInputDate.value === null && userInputTime.value === null) {
  14199. emit(innerDate, false);
  14200. }
  14201. }
  14202. };
  14203. const handleKeyControl = (keyCode) => {
  14204. const mapping = {
  14205. year: {
  14206. 38: -4,
  14207. 40: 4,
  14208. 37: -1,
  14209. 39: 1,
  14210. offset: (date4, step) => date4.setFullYear(date4.getFullYear() + step)
  14211. },
  14212. month: {
  14213. 38: -4,
  14214. 40: 4,
  14215. 37: -1,
  14216. 39: 1,
  14217. offset: (date4, step) => date4.setMonth(date4.getMonth() + step)
  14218. },
  14219. week: {
  14220. 38: -1,
  14221. 40: 1,
  14222. 37: -1,
  14223. 39: 1,
  14224. offset: (date4, step) => date4.setDate(date4.getDate() + step * 7)
  14225. },
  14226. day: {
  14227. 38: -7,
  14228. 40: 7,
  14229. 37: -1,
  14230. 39: 1,
  14231. offset: (date4, step) => date4.setDate(date4.getDate() + step)
  14232. }
  14233. };
  14234. const newDate = innerDate.value.toDate();
  14235. while (Math.abs(innerDate.value.diff(newDate, "year", true)) < 1) {
  14236. const map = mapping[selectionMode.value];
  14237. map.offset(newDate, map[keyCode]);
  14238. if (disabledDate && disabledDate(newDate)) {
  14239. continue;
  14240. }
  14241. const result = dayjs(newDate).locale(lang.value);
  14242. innerDate.value = result;
  14243. ctx.emit("pick", result, true);
  14244. break;
  14245. }
  14246. };
  14247. const handlePanelChange = (mode) => {
  14248. ctx.emit("panel-change", innerDate.value.toDate(), mode, currentView.value);
  14249. };
  14250. ctx.emit("set-picker-option", ["isValidValue", isValidValue]);
  14251. ctx.emit("set-picker-option", ["formatToString", formatToString]);
  14252. ctx.emit("set-picker-option", ["parseUserInput", parseUserInput]);
  14253. ctx.emit("set-picker-option", ["handleKeydown", handleKeydown]);
  14254. watch(() => defaultValue.value, (val) => {
  14255. if (val) {
  14256. innerDate.value = getDefaultValue();
  14257. }
  14258. }, { immediate: true });
  14259. watch(() => props.parsedValue, (val) => {
  14260. if (val) {
  14261. if (selectionMode.value === "dates")
  14262. return;
  14263. if (Array.isArray(val))
  14264. return;
  14265. innerDate.value = val;
  14266. } else {
  14267. innerDate.value = getDefaultValue();
  14268. }
  14269. }, { immediate: true });
  14270. return {
  14271. handleTimePick,
  14272. handleTimePickClose,
  14273. onTimePickerInputFocus,
  14274. timePickerVisible,
  14275. visibleTime,
  14276. visibleDate,
  14277. showTime,
  14278. changeToNow,
  14279. onConfirm,
  14280. footerVisible,
  14281. handleYearPick,
  14282. showMonthPicker,
  14283. showYearPicker,
  14284. handleMonthPick,
  14285. hasShortcuts,
  14286. shortcuts,
  14287. arrowControl,
  14288. disabledDate,
  14289. cellClassName,
  14290. selectionMode,
  14291. handleShortcutClick,
  14292. prevYear_,
  14293. nextYear_,
  14294. prevMonth_,
  14295. nextMonth_,
  14296. innerDate,
  14297. t,
  14298. yearLabel,
  14299. currentView,
  14300. month,
  14301. handleDatePick,
  14302. handleVisibleTimeChange,
  14303. handleVisibleDateChange,
  14304. timeFormat,
  14305. userInputTime,
  14306. userInputDate
  14307. };
  14308. }
  14309. });
  14310. const _hoisted_1$o = { class: "el-picker-panel__body-wrapper" };
  14311. const _hoisted_2$j = {
  14312. key: 0,
  14313. class: "el-picker-panel__sidebar"
  14314. };
  14315. const _hoisted_3$d = ["onClick"];
  14316. const _hoisted_4$b = { class: "el-picker-panel__body" };
  14317. const _hoisted_5$b = {
  14318. key: 0,
  14319. class: "el-date-picker__time-header"
  14320. };
  14321. const _hoisted_6$9 = { class: "el-date-picker__editor-wrap" };
  14322. const _hoisted_7$5 = { class: "el-date-picker__editor-wrap" };
  14323. const _hoisted_8$4 = ["aria-label"];
  14324. const _hoisted_9$4 = ["aria-label"];
  14325. const _hoisted_10$4 = ["aria-label"];
  14326. const _hoisted_11$3 = ["aria-label"];
  14327. const _hoisted_12$3 = { class: "el-picker-panel__content" };
  14328. const _hoisted_13$3 = { class: "el-picker-panel__footer" };
  14329. function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
  14330. const _component_el_input = resolveComponent("el-input");
  14331. const _component_time_pick_panel = resolveComponent("time-pick-panel");
  14332. const _component_d_arrow_left = resolveComponent("d-arrow-left");
  14333. const _component_el_icon = resolveComponent("el-icon");
  14334. const _component_arrow_left = resolveComponent("arrow-left");
  14335. const _component_d_arrow_right = resolveComponent("d-arrow-right");
  14336. const _component_arrow_right = resolveComponent("arrow-right");
  14337. const _component_date_table = resolveComponent("date-table");
  14338. const _component_year_table = resolveComponent("year-table");
  14339. const _component_month_table = resolveComponent("month-table");
  14340. const _component_el_button = resolveComponent("el-button");
  14341. const _directive_clickoutside = resolveDirective("clickoutside");
  14342. return openBlock(), createElementBlock("div", {
  14343. class: normalizeClass(["el-picker-panel el-date-picker", [
  14344. {
  14345. "has-sidebar": _ctx.$slots.sidebar || _ctx.hasShortcuts,
  14346. "has-time": _ctx.showTime
  14347. }
  14348. ]])
  14349. }, [
  14350. createElementVNode("div", _hoisted_1$o, [
  14351. renderSlot(_ctx.$slots, "sidebar", { class: "el-picker-panel__sidebar" }),
  14352. _ctx.hasShortcuts ? (openBlock(), createElementBlock("div", _hoisted_2$j, [
  14353. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.shortcuts, (shortcut, key) => {
  14354. return openBlock(), createElementBlock("button", {
  14355. key,
  14356. type: "button",
  14357. class: "el-picker-panel__shortcut",
  14358. onClick: ($event) => _ctx.handleShortcutClick(shortcut)
  14359. }, toDisplayString(shortcut.text), 9, _hoisted_3$d);
  14360. }), 128))
  14361. ])) : createCommentVNode("v-if", true),
  14362. createElementVNode("div", _hoisted_4$b, [
  14363. _ctx.showTime ? (openBlock(), createElementBlock("div", _hoisted_5$b, [
  14364. createElementVNode("span", _hoisted_6$9, [
  14365. createVNode(_component_el_input, {
  14366. placeholder: _ctx.t("el.datepicker.selectDate"),
  14367. "model-value": _ctx.visibleDate,
  14368. size: "small",
  14369. onInput: _cache[0] || (_cache[0] = (val) => _ctx.userInputDate = val),
  14370. onChange: _ctx.handleVisibleDateChange
  14371. }, null, 8, ["placeholder", "model-value", "onChange"])
  14372. ]),
  14373. withDirectives((openBlock(), createElementBlock("span", _hoisted_7$5, [
  14374. createVNode(_component_el_input, {
  14375. placeholder: _ctx.t("el.datepicker.selectTime"),
  14376. "model-value": _ctx.visibleTime,
  14377. size: "small",
  14378. onFocus: _ctx.onTimePickerInputFocus,
  14379. onInput: _cache[1] || (_cache[1] = (val) => _ctx.userInputTime = val),
  14380. onChange: _ctx.handleVisibleTimeChange
  14381. }, null, 8, ["placeholder", "model-value", "onFocus", "onChange"]),
  14382. createVNode(_component_time_pick_panel, {
  14383. visible: _ctx.timePickerVisible,
  14384. format: _ctx.timeFormat,
  14385. "time-arrow-control": _ctx.arrowControl,
  14386. "parsed-value": _ctx.innerDate,
  14387. onPick: _ctx.handleTimePick
  14388. }, null, 8, ["visible", "format", "time-arrow-control", "parsed-value", "onPick"])
  14389. ])), [
  14390. [_directive_clickoutside, _ctx.handleTimePickClose]
  14391. ])
  14392. ])) : createCommentVNode("v-if", true),
  14393. withDirectives(createElementVNode("div", {
  14394. class: normalizeClass(["el-date-picker__header", {
  14395. "el-date-picker__header--bordered": _ctx.currentView === "year" || _ctx.currentView === "month"
  14396. }])
  14397. }, [
  14398. createElementVNode("button", {
  14399. type: "button",
  14400. "aria-label": _ctx.t(`el.datepicker.prevYear`),
  14401. class: "el-picker-panel__icon-btn el-date-picker__prev-btn d-arrow-left",
  14402. onClick: _cache[2] || (_cache[2] = (...args) => _ctx.prevYear_ && _ctx.prevYear_(...args))
  14403. }, [
  14404. createVNode(_component_el_icon, null, {
  14405. default: withCtx(() => [
  14406. createVNode(_component_d_arrow_left)
  14407. ]),
  14408. _: 1
  14409. })
  14410. ], 8, _hoisted_8$4),
  14411. withDirectives(createElementVNode("button", {
  14412. type: "button",
  14413. "aria-label": _ctx.t(`el.datepicker.prevMonth`),
  14414. class: "el-picker-panel__icon-btn el-date-picker__prev-btn arrow-left",
  14415. onClick: _cache[3] || (_cache[3] = (...args) => _ctx.prevMonth_ && _ctx.prevMonth_(...args))
  14416. }, [
  14417. createVNode(_component_el_icon, null, {
  14418. default: withCtx(() => [
  14419. createVNode(_component_arrow_left)
  14420. ]),
  14421. _: 1
  14422. })
  14423. ], 8, _hoisted_9$4), [
  14424. [vShow, _ctx.currentView === "date"]
  14425. ]),
  14426. createElementVNode("span", {
  14427. role: "button",
  14428. class: "el-date-picker__header-label",
  14429. onClick: _cache[4] || (_cache[4] = (...args) => _ctx.showYearPicker && _ctx.showYearPicker(...args))
  14430. }, toDisplayString(_ctx.yearLabel), 1),
  14431. withDirectives(createElementVNode("span", {
  14432. role: "button",
  14433. class: normalizeClass(["el-date-picker__header-label", { active: _ctx.currentView === "month" }]),
  14434. onClick: _cache[5] || (_cache[5] = (...args) => _ctx.showMonthPicker && _ctx.showMonthPicker(...args))
  14435. }, toDisplayString(_ctx.t(`el.datepicker.month${_ctx.month + 1}`)), 3), [
  14436. [vShow, _ctx.currentView === "date"]
  14437. ]),
  14438. createElementVNode("button", {
  14439. type: "button",
  14440. "aria-label": _ctx.t(`el.datepicker.nextYear`),
  14441. class: "el-picker-panel__icon-btn el-date-picker__next-btn d-arrow-right",
  14442. onClick: _cache[6] || (_cache[6] = (...args) => _ctx.nextYear_ && _ctx.nextYear_(...args))
  14443. }, [
  14444. createVNode(_component_el_icon, null, {
  14445. default: withCtx(() => [
  14446. createVNode(_component_d_arrow_right)
  14447. ]),
  14448. _: 1
  14449. })
  14450. ], 8, _hoisted_10$4),
  14451. withDirectives(createElementVNode("button", {
  14452. type: "button",
  14453. "aria-label": _ctx.t(`el.datepicker.nextMonth`),
  14454. class: "el-picker-panel__icon-btn el-date-picker__next-btn arrow-right",
  14455. onClick: _cache[7] || (_cache[7] = (...args) => _ctx.nextMonth_ && _ctx.nextMonth_(...args))
  14456. }, [
  14457. createVNode(_component_el_icon, null, {
  14458. default: withCtx(() => [
  14459. createVNode(_component_arrow_right)
  14460. ]),
  14461. _: 1
  14462. })
  14463. ], 8, _hoisted_11$3), [
  14464. [vShow, _ctx.currentView === "date"]
  14465. ])
  14466. ], 2), [
  14467. [vShow, _ctx.currentView !== "time"]
  14468. ]),
  14469. createElementVNode("div", _hoisted_12$3, [
  14470. _ctx.currentView === "date" ? (openBlock(), createBlock(_component_date_table, {
  14471. key: 0,
  14472. "selection-mode": _ctx.selectionMode,
  14473. date: _ctx.innerDate,
  14474. "parsed-value": _ctx.parsedValue,
  14475. "disabled-date": _ctx.disabledDate,
  14476. "cell-class-name": _ctx.cellClassName,
  14477. onPick: _ctx.handleDatePick
  14478. }, null, 8, ["selection-mode", "date", "parsed-value", "disabled-date", "cell-class-name", "onPick"])) : createCommentVNode("v-if", true),
  14479. _ctx.currentView === "year" ? (openBlock(), createBlock(_component_year_table, {
  14480. key: 1,
  14481. date: _ctx.innerDate,
  14482. "disabled-date": _ctx.disabledDate,
  14483. "parsed-value": _ctx.parsedValue,
  14484. onPick: _ctx.handleYearPick
  14485. }, null, 8, ["date", "disabled-date", "parsed-value", "onPick"])) : createCommentVNode("v-if", true),
  14486. _ctx.currentView === "month" ? (openBlock(), createBlock(_component_month_table, {
  14487. key: 2,
  14488. date: _ctx.innerDate,
  14489. "parsed-value": _ctx.parsedValue,
  14490. "disabled-date": _ctx.disabledDate,
  14491. onPick: _ctx.handleMonthPick
  14492. }, null, 8, ["date", "parsed-value", "disabled-date", "onPick"])) : createCommentVNode("v-if", true)
  14493. ])
  14494. ])
  14495. ]),
  14496. withDirectives(createElementVNode("div", _hoisted_13$3, [
  14497. withDirectives(createVNode(_component_el_button, {
  14498. size: "small",
  14499. type: "text",
  14500. class: "el-picker-panel__link-btn",
  14501. onClick: _ctx.changeToNow
  14502. }, {
  14503. default: withCtx(() => [
  14504. createTextVNode(toDisplayString(_ctx.t("el.datepicker.now")), 1)
  14505. ]),
  14506. _: 1
  14507. }, 8, ["onClick"]), [
  14508. [vShow, _ctx.selectionMode !== "dates"]
  14509. ]),
  14510. createVNode(_component_el_button, {
  14511. plain: "",
  14512. size: "small",
  14513. class: "el-picker-panel__link-btn",
  14514. onClick: _ctx.onConfirm
  14515. }, {
  14516. default: withCtx(() => [
  14517. createTextVNode(toDisplayString(_ctx.t("el.datepicker.confirm")), 1)
  14518. ]),
  14519. _: 1
  14520. }, 8, ["onClick"])
  14521. ], 512), [
  14522. [vShow, _ctx.footerVisible && _ctx.currentView === "date"]
  14523. ])
  14524. ], 2);
  14525. }
  14526. var DatePickPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$B, [["render", _sfc_render$g], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/panel-date-pick.vue"]]);
  14527. const _sfc_main$A = defineComponent({
  14528. directives: { clickoutside: ClickOutside },
  14529. components: {
  14530. TimePickPanel,
  14531. DateTable,
  14532. ElInput,
  14533. ElButton,
  14534. ElIcon,
  14535. DArrowLeft: dArrowLeft,
  14536. ArrowLeft: arrowLeft,
  14537. DArrowRight: dArrowRight,
  14538. ArrowRight: arrowRight
  14539. },
  14540. props: {
  14541. unlinkPanels: Boolean,
  14542. parsedValue: {
  14543. type: Array
  14544. },
  14545. type: {
  14546. type: String,
  14547. required: true,
  14548. validator: isValidDatePickType
  14549. }
  14550. },
  14551. emits: ["pick", "set-picker-option", "calendar-change", "panel-change"],
  14552. setup(props, ctx) {
  14553. const { t, lang } = useLocale();
  14554. const leftDate = ref(dayjs().locale(lang.value));
  14555. const rightDate = ref(dayjs().locale(lang.value).add(1, "month"));
  14556. const minDate = ref(null);
  14557. const maxDate = ref(null);
  14558. const dateUserInput = ref({
  14559. min: null,
  14560. max: null
  14561. });
  14562. const timeUserInput = ref({
  14563. min: null,
  14564. max: null
  14565. });
  14566. const leftLabel = computed(() => {
  14567. return `${leftDate.value.year()} ${t("el.datepicker.year")} ${t(`el.datepicker.month${leftDate.value.month() + 1}`)}`;
  14568. });
  14569. const rightLabel = computed(() => {
  14570. return `${rightDate.value.year()} ${t("el.datepicker.year")} ${t(`el.datepicker.month${rightDate.value.month() + 1}`)}`;
  14571. });
  14572. const leftYear = computed(() => {
  14573. return leftDate.value.year();
  14574. });
  14575. const leftMonth = computed(() => {
  14576. return leftDate.value.month();
  14577. });
  14578. const rightYear = computed(() => {
  14579. return rightDate.value.year();
  14580. });
  14581. const rightMonth = computed(() => {
  14582. return rightDate.value.month();
  14583. });
  14584. const hasShortcuts = computed(() => !!shortcuts.length);
  14585. const minVisibleDate = computed(() => {
  14586. if (dateUserInput.value.min !== null)
  14587. return dateUserInput.value.min;
  14588. if (minDate.value)
  14589. return minDate.value.format(dateFormat.value);
  14590. return "";
  14591. });
  14592. const maxVisibleDate = computed(() => {
  14593. if (dateUserInput.value.max !== null)
  14594. return dateUserInput.value.max;
  14595. if (maxDate.value || minDate.value)
  14596. return (maxDate.value || minDate.value).format(dateFormat.value);
  14597. return "";
  14598. });
  14599. const minVisibleTime = computed(() => {
  14600. if (timeUserInput.value.min !== null)
  14601. return timeUserInput.value.min;
  14602. if (minDate.value)
  14603. return minDate.value.format(timeFormat.value);
  14604. return "";
  14605. });
  14606. const maxVisibleTime = computed(() => {
  14607. if (timeUserInput.value.max !== null)
  14608. return timeUserInput.value.max;
  14609. if (maxDate.value || minDate.value)
  14610. return (maxDate.value || minDate.value).format(timeFormat.value);
  14611. return "";
  14612. });
  14613. const timeFormat = computed(() => {
  14614. return extractTimeFormat(format2);
  14615. });
  14616. const dateFormat = computed(() => {
  14617. return extractDateFormat(format2);
  14618. });
  14619. const leftPrevYear = () => {
  14620. leftDate.value = leftDate.value.subtract(1, "year");
  14621. if (!props.unlinkPanels) {
  14622. rightDate.value = leftDate.value.add(1, "month");
  14623. }
  14624. handlePanelChange("year");
  14625. };
  14626. const leftPrevMonth = () => {
  14627. leftDate.value = leftDate.value.subtract(1, "month");
  14628. if (!props.unlinkPanels) {
  14629. rightDate.value = leftDate.value.add(1, "month");
  14630. }
  14631. handlePanelChange("month");
  14632. };
  14633. const rightNextYear = () => {
  14634. if (!props.unlinkPanels) {
  14635. leftDate.value = leftDate.value.add(1, "year");
  14636. rightDate.value = leftDate.value.add(1, "month");
  14637. } else {
  14638. rightDate.value = rightDate.value.add(1, "year");
  14639. }
  14640. handlePanelChange("year");
  14641. };
  14642. const rightNextMonth = () => {
  14643. if (!props.unlinkPanels) {
  14644. leftDate.value = leftDate.value.add(1, "month");
  14645. rightDate.value = leftDate.value.add(1, "month");
  14646. } else {
  14647. rightDate.value = rightDate.value.add(1, "month");
  14648. }
  14649. handlePanelChange("month");
  14650. };
  14651. const leftNextYear = () => {
  14652. leftDate.value = leftDate.value.add(1, "year");
  14653. handlePanelChange("year");
  14654. };
  14655. const leftNextMonth = () => {
  14656. leftDate.value = leftDate.value.add(1, "month");
  14657. handlePanelChange("month");
  14658. };
  14659. const rightPrevYear = () => {
  14660. rightDate.value = rightDate.value.subtract(1, "year");
  14661. handlePanelChange("year");
  14662. };
  14663. const rightPrevMonth = () => {
  14664. rightDate.value = rightDate.value.subtract(1, "month");
  14665. handlePanelChange("month");
  14666. };
  14667. const handlePanelChange = (mode) => {
  14668. ctx.emit("panel-change", [leftDate.value.toDate(), rightDate.value.toDate()], mode);
  14669. };
  14670. const enableMonthArrow = computed(() => {
  14671. const nextMonth = (leftMonth.value + 1) % 12;
  14672. const yearOffset = leftMonth.value + 1 >= 12 ? 1 : 0;
  14673. return props.unlinkPanels && new Date(leftYear.value + yearOffset, nextMonth) < new Date(rightYear.value, rightMonth.value);
  14674. });
  14675. const enableYearArrow = computed(() => {
  14676. return props.unlinkPanels && rightYear.value * 12 + rightMonth.value - (leftYear.value * 12 + leftMonth.value + 1) >= 12;
  14677. });
  14678. const isValidValue = (value) => {
  14679. return Array.isArray(value) && value[0] && value[1] && value[0].valueOf() <= value[1].valueOf();
  14680. };
  14681. const rangeState = ref({
  14682. endDate: null,
  14683. selecting: false
  14684. });
  14685. const btnDisabled = computed(() => {
  14686. return !(minDate.value && maxDate.value && !rangeState.value.selecting && isValidValue([minDate.value, maxDate.value]));
  14687. });
  14688. const handleChangeRange = (val) => {
  14689. rangeState.value = val;
  14690. };
  14691. const onSelect = (selecting) => {
  14692. rangeState.value.selecting = selecting;
  14693. if (!selecting) {
  14694. rangeState.value.endDate = null;
  14695. }
  14696. };
  14697. const showTime = computed(() => props.type === "datetime" || props.type === "datetimerange");
  14698. const handleConfirm = (visible = false) => {
  14699. if (isValidValue([minDate.value, maxDate.value])) {
  14700. ctx.emit("pick", [minDate.value, maxDate.value], visible);
  14701. }
  14702. };
  14703. const formatEmit = (emitDayjs, index) => {
  14704. if (!emitDayjs)
  14705. return;
  14706. if (defaultTime) {
  14707. const defaultTimeD = dayjs(defaultTime[index] || defaultTime).locale(lang.value);
  14708. return defaultTimeD.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
  14709. }
  14710. return emitDayjs;
  14711. };
  14712. const handleRangePick = (val, close2 = true) => {
  14713. const min_ = val.minDate;
  14714. const max_ = val.maxDate;
  14715. const minDate_ = formatEmit(min_, 0);
  14716. const maxDate_ = formatEmit(max_, 1);
  14717. if (maxDate.value === maxDate_ && minDate.value === minDate_) {
  14718. return;
  14719. }
  14720. ctx.emit("calendar-change", [min_.toDate(), max_ && max_.toDate()]);
  14721. maxDate.value = maxDate_;
  14722. minDate.value = minDate_;
  14723. if (!close2 || showTime.value)
  14724. return;
  14725. handleConfirm();
  14726. };
  14727. const handleShortcutClick = (shortcut) => {
  14728. const shortcutValues = typeof shortcut.value === "function" ? shortcut.value() : shortcut.value;
  14729. if (shortcutValues) {
  14730. ctx.emit("pick", [
  14731. dayjs(shortcutValues[0]).locale(lang.value),
  14732. dayjs(shortcutValues[1]).locale(lang.value)
  14733. ]);
  14734. return;
  14735. }
  14736. if (shortcut.onClick) {
  14737. shortcut.onClick(ctx);
  14738. }
  14739. };
  14740. const minTimePickerVisible = ref(false);
  14741. const maxTimePickerVisible = ref(false);
  14742. const handleMinTimeClose = () => {
  14743. minTimePickerVisible.value = false;
  14744. };
  14745. const handleMaxTimeClose = () => {
  14746. maxTimePickerVisible.value = false;
  14747. };
  14748. const handleDateInput = (value, type4) => {
  14749. dateUserInput.value[type4] = value;
  14750. const parsedValueD = dayjs(value, dateFormat.value).locale(lang.value);
  14751. if (parsedValueD.isValid()) {
  14752. if (disabledDate && disabledDate(parsedValueD.toDate())) {
  14753. return;
  14754. }
  14755. if (type4 === "min") {
  14756. leftDate.value = parsedValueD;
  14757. minDate.value = (minDate.value || leftDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
  14758. if (!props.unlinkPanels) {
  14759. rightDate.value = parsedValueD.add(1, "month");
  14760. maxDate.value = minDate.value.add(1, "month");
  14761. }
  14762. } else {
  14763. rightDate.value = parsedValueD;
  14764. maxDate.value = (maxDate.value || rightDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
  14765. if (!props.unlinkPanels) {
  14766. leftDate.value = parsedValueD.subtract(1, "month");
  14767. minDate.value = maxDate.value.subtract(1, "month");
  14768. }
  14769. }
  14770. }
  14771. };
  14772. const handleDateChange = (_2, type4) => {
  14773. dateUserInput.value[type4] = null;
  14774. };
  14775. const handleTimeInput = (value, type4) => {
  14776. timeUserInput.value[type4] = value;
  14777. const parsedValueD = dayjs(value, timeFormat.value).locale(lang.value);
  14778. if (parsedValueD.isValid()) {
  14779. if (type4 === "min") {
  14780. minTimePickerVisible.value = true;
  14781. minDate.value = (minDate.value || leftDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
  14782. if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
  14783. maxDate.value = minDate.value;
  14784. }
  14785. } else {
  14786. maxTimePickerVisible.value = true;
  14787. maxDate.value = (maxDate.value || rightDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
  14788. rightDate.value = maxDate.value;
  14789. if (maxDate.value && maxDate.value.isBefore(minDate.value)) {
  14790. minDate.value = maxDate.value;
  14791. }
  14792. }
  14793. }
  14794. };
  14795. const handleTimeChange = (value, type4) => {
  14796. timeUserInput.value[type4] = null;
  14797. if (type4 === "min") {
  14798. leftDate.value = minDate.value;
  14799. minTimePickerVisible.value = false;
  14800. } else {
  14801. rightDate.value = maxDate.value;
  14802. maxTimePickerVisible.value = false;
  14803. }
  14804. };
  14805. const handleMinTimePick = (value, visible, first) => {
  14806. if (timeUserInput.value.min)
  14807. return;
  14808. if (value) {
  14809. leftDate.value = value;
  14810. minDate.value = (minDate.value || leftDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
  14811. }
  14812. if (!first) {
  14813. minTimePickerVisible.value = visible;
  14814. }
  14815. if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
  14816. maxDate.value = minDate.value;
  14817. rightDate.value = value;
  14818. }
  14819. };
  14820. const handleMaxTimePick = (value, visible, first) => {
  14821. if (timeUserInput.value.max)
  14822. return;
  14823. if (value) {
  14824. rightDate.value = value;
  14825. maxDate.value = (maxDate.value || rightDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
  14826. }
  14827. if (!first) {
  14828. maxTimePickerVisible.value = visible;
  14829. }
  14830. if (maxDate.value && maxDate.value.isBefore(minDate.value)) {
  14831. minDate.value = maxDate.value;
  14832. }
  14833. };
  14834. const handleClear = () => {
  14835. leftDate.value = getDefaultValue()[0];
  14836. rightDate.value = leftDate.value.add(1, "month");
  14837. ctx.emit("pick", null);
  14838. };
  14839. const formatToString = (value) => {
  14840. return Array.isArray(value) ? value.map((_2) => _2.format(format2)) : value.format(format2);
  14841. };
  14842. const parseUserInput = (value) => {
  14843. return Array.isArray(value) ? value.map((_2) => dayjs(_2, format2).locale(lang.value)) : dayjs(value, format2).locale(lang.value);
  14844. };
  14845. const getDefaultValue = () => {
  14846. let start2;
  14847. if (Array.isArray(defaultValue.value)) {
  14848. const left2 = dayjs(defaultValue.value[0]);
  14849. let right2 = dayjs(defaultValue.value[1]);
  14850. if (!props.unlinkPanels) {
  14851. right2 = left2.add(1, "month");
  14852. }
  14853. return [left2, right2];
  14854. } else if (defaultValue.value) {
  14855. start2 = dayjs(defaultValue.value);
  14856. } else {
  14857. start2 = dayjs();
  14858. }
  14859. start2 = start2.locale(lang.value);
  14860. return [start2, start2.add(1, "month")];
  14861. };
  14862. ctx.emit("set-picker-option", ["isValidValue", isValidValue]);
  14863. ctx.emit("set-picker-option", ["parseUserInput", parseUserInput]);
  14864. ctx.emit("set-picker-option", ["formatToString", formatToString]);
  14865. ctx.emit("set-picker-option", ["handleClear", handleClear]);
  14866. const pickerBase = inject("EP_PICKER_BASE");
  14867. const {
  14868. shortcuts,
  14869. disabledDate,
  14870. cellClassName,
  14871. format: format2,
  14872. defaultTime,
  14873. arrowControl,
  14874. clearable
  14875. } = pickerBase.props;
  14876. const defaultValue = toRef(pickerBase.props, "defaultValue");
  14877. watch(() => defaultValue.value, (val) => {
  14878. if (val) {
  14879. const defaultArr = getDefaultValue();
  14880. minDate.value = null;
  14881. maxDate.value = null;
  14882. leftDate.value = defaultArr[0];
  14883. rightDate.value = defaultArr[1];
  14884. }
  14885. }, { immediate: true });
  14886. watch(() => props.parsedValue, (newVal) => {
  14887. if (newVal && newVal.length === 2) {
  14888. minDate.value = newVal[0];
  14889. maxDate.value = newVal[1];
  14890. leftDate.value = minDate.value;
  14891. if (props.unlinkPanels && maxDate.value) {
  14892. const minDateYear = minDate.value.year();
  14893. const minDateMonth = minDate.value.month();
  14894. const maxDateYear = maxDate.value.year();
  14895. const maxDateMonth = maxDate.value.month();
  14896. rightDate.value = minDateYear === maxDateYear && minDateMonth === maxDateMonth ? maxDate.value.add(1, "month") : maxDate.value;
  14897. } else {
  14898. rightDate.value = leftDate.value.add(1, "month");
  14899. if (maxDate.value) {
  14900. rightDate.value = rightDate.value.hour(maxDate.value.hour()).minute(maxDate.value.minute()).second(maxDate.value.second());
  14901. }
  14902. }
  14903. } else {
  14904. const defaultArr = getDefaultValue();
  14905. minDate.value = null;
  14906. maxDate.value = null;
  14907. leftDate.value = defaultArr[0];
  14908. rightDate.value = defaultArr[1];
  14909. }
  14910. }, { immediate: true });
  14911. return {
  14912. shortcuts,
  14913. disabledDate,
  14914. cellClassName,
  14915. minTimePickerVisible,
  14916. maxTimePickerVisible,
  14917. handleMinTimeClose,
  14918. handleMaxTimeClose,
  14919. handleShortcutClick,
  14920. rangeState,
  14921. minDate,
  14922. maxDate,
  14923. handleRangePick,
  14924. onSelect,
  14925. handleChangeRange,
  14926. btnDisabled,
  14927. enableYearArrow,
  14928. enableMonthArrow,
  14929. rightPrevMonth,
  14930. rightPrevYear,
  14931. rightNextMonth,
  14932. rightNextYear,
  14933. leftPrevMonth,
  14934. leftPrevYear,
  14935. leftNextMonth,
  14936. leftNextYear,
  14937. hasShortcuts,
  14938. leftLabel,
  14939. rightLabel,
  14940. leftDate,
  14941. rightDate,
  14942. showTime,
  14943. t,
  14944. minVisibleDate,
  14945. maxVisibleDate,
  14946. minVisibleTime,
  14947. maxVisibleTime,
  14948. arrowControl,
  14949. handleDateInput,
  14950. handleDateChange,
  14951. handleTimeInput,
  14952. handleTimeChange,
  14953. handleMinTimePick,
  14954. handleMaxTimePick,
  14955. handleClear,
  14956. handleConfirm,
  14957. timeFormat,
  14958. clearable
  14959. };
  14960. }
  14961. });
  14962. const _hoisted_1$n = { class: "el-picker-panel__body-wrapper" };
  14963. const _hoisted_2$i = {
  14964. key: 0,
  14965. class: "el-picker-panel__sidebar"
  14966. };
  14967. const _hoisted_3$c = ["onClick"];
  14968. const _hoisted_4$a = { class: "el-picker-panel__body" };
  14969. const _hoisted_5$a = {
  14970. key: 0,
  14971. class: "el-date-range-picker__time-header"
  14972. };
  14973. const _hoisted_6$8 = { class: "el-date-range-picker__editors-wrap" };
  14974. const _hoisted_7$4 = { class: "el-date-range-picker__time-picker-wrap" };
  14975. const _hoisted_8$3 = { class: "el-date-range-picker__time-picker-wrap" };
  14976. const _hoisted_9$3 = { class: "el-date-range-picker__editors-wrap is-right" };
  14977. const _hoisted_10$3 = { class: "el-date-range-picker__time-picker-wrap" };
  14978. const _hoisted_11$2 = { class: "el-date-range-picker__time-picker-wrap" };
  14979. const _hoisted_12$2 = { class: "el-picker-panel__content el-date-range-picker__content is-left" };
  14980. const _hoisted_13$2 = { class: "el-date-range-picker__header" };
  14981. const _hoisted_14$2 = ["disabled"];
  14982. const _hoisted_15$1 = ["disabled"];
  14983. const _hoisted_16$1 = { class: "el-picker-panel__content el-date-range-picker__content is-right" };
  14984. const _hoisted_17$1 = { class: "el-date-range-picker__header" };
  14985. const _hoisted_18$1 = ["disabled"];
  14986. const _hoisted_19$1 = ["disabled"];
  14987. const _hoisted_20$1 = {
  14988. key: 0,
  14989. class: "el-picker-panel__footer"
  14990. };
  14991. function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
  14992. const _component_el_input = resolveComponent("el-input");
  14993. const _component_time_pick_panel = resolveComponent("time-pick-panel");
  14994. const _component_arrow_right = resolveComponent("arrow-right");
  14995. const _component_el_icon = resolveComponent("el-icon");
  14996. const _component_d_arrow_left = resolveComponent("d-arrow-left");
  14997. const _component_arrow_left = resolveComponent("arrow-left");
  14998. const _component_d_arrow_right = resolveComponent("d-arrow-right");
  14999. const _component_date_table = resolveComponent("date-table");
  15000. const _component_el_button = resolveComponent("el-button");
  15001. const _directive_clickoutside = resolveDirective("clickoutside");
  15002. return openBlock(), createElementBlock("div", {
  15003. class: normalizeClass(["el-picker-panel el-date-range-picker", [
  15004. {
  15005. "has-sidebar": _ctx.$slots.sidebar || _ctx.hasShortcuts,
  15006. "has-time": _ctx.showTime
  15007. }
  15008. ]])
  15009. }, [
  15010. createElementVNode("div", _hoisted_1$n, [
  15011. renderSlot(_ctx.$slots, "sidebar", { class: "el-picker-panel__sidebar" }),
  15012. _ctx.hasShortcuts ? (openBlock(), createElementBlock("div", _hoisted_2$i, [
  15013. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.shortcuts, (shortcut, key) => {
  15014. return openBlock(), createElementBlock("button", {
  15015. key,
  15016. type: "button",
  15017. class: "el-picker-panel__shortcut",
  15018. onClick: ($event) => _ctx.handleShortcutClick(shortcut)
  15019. }, toDisplayString(shortcut.text), 9, _hoisted_3$c);
  15020. }), 128))
  15021. ])) : createCommentVNode("v-if", true),
  15022. createElementVNode("div", _hoisted_4$a, [
  15023. _ctx.showTime ? (openBlock(), createElementBlock("div", _hoisted_5$a, [
  15024. createElementVNode("span", _hoisted_6$8, [
  15025. createElementVNode("span", _hoisted_7$4, [
  15026. createVNode(_component_el_input, {
  15027. size: "small",
  15028. disabled: _ctx.rangeState.selecting,
  15029. placeholder: _ctx.t("el.datepicker.startDate"),
  15030. class: "el-date-range-picker__editor",
  15031. "model-value": _ctx.minVisibleDate,
  15032. onInput: _cache[0] || (_cache[0] = (val) => _ctx.handleDateInput(val, "min")),
  15033. onChange: _cache[1] || (_cache[1] = (val) => _ctx.handleDateChange(val, "min"))
  15034. }, null, 8, ["disabled", "placeholder", "model-value"])
  15035. ]),
  15036. withDirectives((openBlock(), createElementBlock("span", _hoisted_8$3, [
  15037. createVNode(_component_el_input, {
  15038. size: "small",
  15039. class: "el-date-range-picker__editor",
  15040. disabled: _ctx.rangeState.selecting,
  15041. placeholder: _ctx.t("el.datepicker.startTime"),
  15042. "model-value": _ctx.minVisibleTime,
  15043. onFocus: _cache[2] || (_cache[2] = ($event) => _ctx.minTimePickerVisible = true),
  15044. onInput: _cache[3] || (_cache[3] = (val) => _ctx.handleTimeInput(val, "min")),
  15045. onChange: _cache[4] || (_cache[4] = (val) => _ctx.handleTimeChange(val, "min"))
  15046. }, null, 8, ["disabled", "placeholder", "model-value"]),
  15047. createVNode(_component_time_pick_panel, {
  15048. visible: _ctx.minTimePickerVisible,
  15049. format: _ctx.timeFormat,
  15050. "datetime-role": "start",
  15051. "time-arrow-control": _ctx.arrowControl,
  15052. "parsed-value": _ctx.leftDate,
  15053. onPick: _ctx.handleMinTimePick
  15054. }, null, 8, ["visible", "format", "time-arrow-control", "parsed-value", "onPick"])
  15055. ])), [
  15056. [_directive_clickoutside, _ctx.handleMinTimeClose]
  15057. ])
  15058. ]),
  15059. createElementVNode("span", null, [
  15060. createVNode(_component_el_icon, null, {
  15061. default: withCtx(() => [
  15062. createVNode(_component_arrow_right)
  15063. ]),
  15064. _: 1
  15065. })
  15066. ]),
  15067. createElementVNode("span", _hoisted_9$3, [
  15068. createElementVNode("span", _hoisted_10$3, [
  15069. createVNode(_component_el_input, {
  15070. size: "small",
  15071. class: "el-date-range-picker__editor",
  15072. disabled: _ctx.rangeState.selecting,
  15073. placeholder: _ctx.t("el.datepicker.endDate"),
  15074. "model-value": _ctx.maxVisibleDate,
  15075. readonly: !_ctx.minDate,
  15076. onInput: _cache[5] || (_cache[5] = (val) => _ctx.handleDateInput(val, "max")),
  15077. onChange: _cache[6] || (_cache[6] = (val) => _ctx.handleDateChange(val, "max"))
  15078. }, null, 8, ["disabled", "placeholder", "model-value", "readonly"])
  15079. ]),
  15080. withDirectives((openBlock(), createElementBlock("span", _hoisted_11$2, [
  15081. createVNode(_component_el_input, {
  15082. size: "small",
  15083. class: "el-date-range-picker__editor",
  15084. disabled: _ctx.rangeState.selecting,
  15085. placeholder: _ctx.t("el.datepicker.endTime"),
  15086. "model-value": _ctx.maxVisibleTime,
  15087. readonly: !_ctx.minDate,
  15088. onFocus: _cache[7] || (_cache[7] = ($event) => _ctx.minDate && (_ctx.maxTimePickerVisible = true)),
  15089. onInput: _cache[8] || (_cache[8] = (val) => _ctx.handleTimeInput(val, "max")),
  15090. onChange: _cache[9] || (_cache[9] = (val) => _ctx.handleTimeChange(val, "max"))
  15091. }, null, 8, ["disabled", "placeholder", "model-value", "readonly"]),
  15092. createVNode(_component_time_pick_panel, {
  15093. "datetime-role": "end",
  15094. visible: _ctx.maxTimePickerVisible,
  15095. format: _ctx.timeFormat,
  15096. "time-arrow-control": _ctx.arrowControl,
  15097. "parsed-value": _ctx.rightDate,
  15098. onPick: _ctx.handleMaxTimePick
  15099. }, null, 8, ["visible", "format", "time-arrow-control", "parsed-value", "onPick"])
  15100. ])), [
  15101. [_directive_clickoutside, _ctx.handleMaxTimeClose]
  15102. ])
  15103. ])
  15104. ])) : createCommentVNode("v-if", true),
  15105. createElementVNode("div", _hoisted_12$2, [
  15106. createElementVNode("div", _hoisted_13$2, [
  15107. createElementVNode("button", {
  15108. type: "button",
  15109. class: "el-picker-panel__icon-btn d-arrow-left",
  15110. onClick: _cache[10] || (_cache[10] = (...args) => _ctx.leftPrevYear && _ctx.leftPrevYear(...args))
  15111. }, [
  15112. createVNode(_component_el_icon, null, {
  15113. default: withCtx(() => [
  15114. createVNode(_component_d_arrow_left)
  15115. ]),
  15116. _: 1
  15117. })
  15118. ]),
  15119. createElementVNode("button", {
  15120. type: "button",
  15121. class: "el-picker-panel__icon-btn arrow-left",
  15122. onClick: _cache[11] || (_cache[11] = (...args) => _ctx.leftPrevMonth && _ctx.leftPrevMonth(...args))
  15123. }, [
  15124. createVNode(_component_el_icon, null, {
  15125. default: withCtx(() => [
  15126. createVNode(_component_arrow_left)
  15127. ]),
  15128. _: 1
  15129. })
  15130. ]),
  15131. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  15132. key: 0,
  15133. type: "button",
  15134. disabled: !_ctx.enableYearArrow,
  15135. class: normalizeClass([{ "is-disabled": !_ctx.enableYearArrow }, "el-picker-panel__icon-btn d-arrow-right"]),
  15136. onClick: _cache[12] || (_cache[12] = (...args) => _ctx.leftNextYear && _ctx.leftNextYear(...args))
  15137. }, [
  15138. createVNode(_component_el_icon, null, {
  15139. default: withCtx(() => [
  15140. createVNode(_component_d_arrow_right)
  15141. ]),
  15142. _: 1
  15143. })
  15144. ], 10, _hoisted_14$2)) : createCommentVNode("v-if", true),
  15145. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  15146. key: 1,
  15147. type: "button",
  15148. disabled: !_ctx.enableMonthArrow,
  15149. class: normalizeClass([{ "is-disabled": !_ctx.enableMonthArrow }, "el-picker-panel__icon-btn arrow-right"]),
  15150. onClick: _cache[13] || (_cache[13] = (...args) => _ctx.leftNextMonth && _ctx.leftNextMonth(...args))
  15151. }, [
  15152. createVNode(_component_el_icon, null, {
  15153. default: withCtx(() => [
  15154. createVNode(_component_arrow_right)
  15155. ]),
  15156. _: 1
  15157. })
  15158. ], 10, _hoisted_15$1)) : createCommentVNode("v-if", true),
  15159. createElementVNode("div", null, toDisplayString(_ctx.leftLabel), 1)
  15160. ]),
  15161. createVNode(_component_date_table, {
  15162. "selection-mode": "range",
  15163. date: _ctx.leftDate,
  15164. "min-date": _ctx.minDate,
  15165. "max-date": _ctx.maxDate,
  15166. "range-state": _ctx.rangeState,
  15167. "disabled-date": _ctx.disabledDate,
  15168. "cell-class-name": _ctx.cellClassName,
  15169. onChangerange: _ctx.handleChangeRange,
  15170. onPick: _ctx.handleRangePick,
  15171. onSelect: _ctx.onSelect
  15172. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "onChangerange", "onPick", "onSelect"])
  15173. ]),
  15174. createElementVNode("div", _hoisted_16$1, [
  15175. createElementVNode("div", _hoisted_17$1, [
  15176. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  15177. key: 0,
  15178. type: "button",
  15179. disabled: !_ctx.enableYearArrow,
  15180. class: normalizeClass([{ "is-disabled": !_ctx.enableYearArrow }, "el-picker-panel__icon-btn d-arrow-left"]),
  15181. onClick: _cache[14] || (_cache[14] = (...args) => _ctx.rightPrevYear && _ctx.rightPrevYear(...args))
  15182. }, [
  15183. createVNode(_component_el_icon, null, {
  15184. default: withCtx(() => [
  15185. createVNode(_component_d_arrow_left)
  15186. ]),
  15187. _: 1
  15188. })
  15189. ], 10, _hoisted_18$1)) : createCommentVNode("v-if", true),
  15190. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  15191. key: 1,
  15192. type: "button",
  15193. disabled: !_ctx.enableMonthArrow,
  15194. class: normalizeClass([{ "is-disabled": !_ctx.enableMonthArrow }, "el-picker-panel__icon-btn arrow-left"]),
  15195. onClick: _cache[15] || (_cache[15] = (...args) => _ctx.rightPrevMonth && _ctx.rightPrevMonth(...args))
  15196. }, [
  15197. createVNode(_component_el_icon, null, {
  15198. default: withCtx(() => [
  15199. createVNode(_component_arrow_left)
  15200. ]),
  15201. _: 1
  15202. })
  15203. ], 10, _hoisted_19$1)) : createCommentVNode("v-if", true),
  15204. createElementVNode("button", {
  15205. type: "button",
  15206. class: "el-picker-panel__icon-btn d-arrow-right",
  15207. onClick: _cache[16] || (_cache[16] = (...args) => _ctx.rightNextYear && _ctx.rightNextYear(...args))
  15208. }, [
  15209. createVNode(_component_el_icon, null, {
  15210. default: withCtx(() => [
  15211. createVNode(_component_d_arrow_right)
  15212. ]),
  15213. _: 1
  15214. })
  15215. ]),
  15216. createElementVNode("button", {
  15217. type: "button",
  15218. class: "el-picker-panel__icon-btn arrow-right",
  15219. onClick: _cache[17] || (_cache[17] = (...args) => _ctx.rightNextMonth && _ctx.rightNextMonth(...args))
  15220. }, [
  15221. createVNode(_component_el_icon, null, {
  15222. default: withCtx(() => [
  15223. createVNode(_component_arrow_right)
  15224. ]),
  15225. _: 1
  15226. })
  15227. ]),
  15228. createElementVNode("div", null, toDisplayString(_ctx.rightLabel), 1)
  15229. ]),
  15230. createVNode(_component_date_table, {
  15231. "selection-mode": "range",
  15232. date: _ctx.rightDate,
  15233. "min-date": _ctx.minDate,
  15234. "max-date": _ctx.maxDate,
  15235. "range-state": _ctx.rangeState,
  15236. "disabled-date": _ctx.disabledDate,
  15237. "cell-class-name": _ctx.cellClassName,
  15238. onChangerange: _ctx.handleChangeRange,
  15239. onPick: _ctx.handleRangePick,
  15240. onSelect: _ctx.onSelect
  15241. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "onChangerange", "onPick", "onSelect"])
  15242. ])
  15243. ])
  15244. ]),
  15245. _ctx.showTime ? (openBlock(), createElementBlock("div", _hoisted_20$1, [
  15246. _ctx.clearable ? (openBlock(), createBlock(_component_el_button, {
  15247. key: 0,
  15248. size: "small",
  15249. type: "text",
  15250. class: "el-picker-panel__link-btn",
  15251. onClick: _ctx.handleClear
  15252. }, {
  15253. default: withCtx(() => [
  15254. createTextVNode(toDisplayString(_ctx.t("el.datepicker.clear")), 1)
  15255. ]),
  15256. _: 1
  15257. }, 8, ["onClick"])) : createCommentVNode("v-if", true),
  15258. createVNode(_component_el_button, {
  15259. plain: "",
  15260. size: "small",
  15261. class: "el-picker-panel__link-btn",
  15262. disabled: _ctx.btnDisabled,
  15263. onClick: _cache[18] || (_cache[18] = ($event) => _ctx.handleConfirm(false))
  15264. }, {
  15265. default: withCtx(() => [
  15266. createTextVNode(toDisplayString(_ctx.t("el.datepicker.confirm")), 1)
  15267. ]),
  15268. _: 1
  15269. }, 8, ["disabled"])
  15270. ])) : createCommentVNode("v-if", true)
  15271. ], 2);
  15272. }
  15273. var DateRangePickPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$A, [["render", _sfc_render$f], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/panel-date-range.vue"]]);
  15274. const _sfc_main$z = defineComponent({
  15275. components: { MonthTable, ElIcon, DArrowLeft: dArrowLeft, DArrowRight: dArrowRight },
  15276. props: {
  15277. unlinkPanels: Boolean,
  15278. parsedValue: {
  15279. type: Array
  15280. }
  15281. },
  15282. emits: ["pick", "set-picker-option"],
  15283. setup(props, ctx) {
  15284. const { t, lang } = useLocale();
  15285. const leftDate = ref(dayjs().locale(lang.value));
  15286. const rightDate = ref(dayjs().locale(lang.value).add(1, "year"));
  15287. const hasShortcuts = computed(() => !!shortcuts.length);
  15288. const handleShortcutClick = (shortcut) => {
  15289. const shortcutValues = typeof shortcut.value === "function" ? shortcut.value() : shortcut.value;
  15290. if (shortcutValues) {
  15291. ctx.emit("pick", [
  15292. dayjs(shortcutValues[0]).locale(lang.value),
  15293. dayjs(shortcutValues[1]).locale(lang.value)
  15294. ]);
  15295. return;
  15296. }
  15297. if (shortcut.onClick) {
  15298. shortcut.onClick(ctx);
  15299. }
  15300. };
  15301. const leftPrevYear = () => {
  15302. leftDate.value = leftDate.value.subtract(1, "year");
  15303. if (!props.unlinkPanels) {
  15304. rightDate.value = rightDate.value.subtract(1, "year");
  15305. }
  15306. };
  15307. const rightNextYear = () => {
  15308. if (!props.unlinkPanels) {
  15309. leftDate.value = leftDate.value.add(1, "year");
  15310. }
  15311. rightDate.value = rightDate.value.add(1, "year");
  15312. };
  15313. const leftNextYear = () => {
  15314. leftDate.value = leftDate.value.add(1, "year");
  15315. };
  15316. const rightPrevYear = () => {
  15317. rightDate.value = rightDate.value.subtract(1, "year");
  15318. };
  15319. const leftLabel = computed(() => {
  15320. return `${leftDate.value.year()} ${t("el.datepicker.year")}`;
  15321. });
  15322. const rightLabel = computed(() => {
  15323. return `${rightDate.value.year()} ${t("el.datepicker.year")}`;
  15324. });
  15325. const leftYear = computed(() => {
  15326. return leftDate.value.year();
  15327. });
  15328. const rightYear = computed(() => {
  15329. return rightDate.value.year() === leftDate.value.year() ? leftDate.value.year() + 1 : rightDate.value.year();
  15330. });
  15331. const enableYearArrow = computed(() => {
  15332. return props.unlinkPanels && rightYear.value > leftYear.value + 1;
  15333. });
  15334. const minDate = ref(null);
  15335. const maxDate = ref(null);
  15336. const rangeState = ref({
  15337. endDate: null,
  15338. selecting: false
  15339. });
  15340. const handleChangeRange = (val) => {
  15341. rangeState.value = val;
  15342. };
  15343. const handleRangePick = (val, close2 = true) => {
  15344. const minDate_ = val.minDate;
  15345. const maxDate_ = val.maxDate;
  15346. if (maxDate.value === maxDate_ && minDate.value === minDate_) {
  15347. return;
  15348. }
  15349. maxDate.value = maxDate_;
  15350. minDate.value = minDate_;
  15351. if (!close2)
  15352. return;
  15353. handleConfirm();
  15354. };
  15355. const isValidValue = (value) => {
  15356. return Array.isArray(value) && value && value[0] && value[1] && value[0].valueOf() <= value[1].valueOf();
  15357. };
  15358. const handleConfirm = (visible = false) => {
  15359. if (isValidValue([minDate.value, maxDate.value])) {
  15360. ctx.emit("pick", [minDate.value, maxDate.value], visible);
  15361. }
  15362. };
  15363. const onSelect = (selecting) => {
  15364. rangeState.value.selecting = selecting;
  15365. if (!selecting) {
  15366. rangeState.value.endDate = null;
  15367. }
  15368. };
  15369. const formatToString = (value) => {
  15370. return value.map((_2) => _2.format(format2));
  15371. };
  15372. const getDefaultValue = () => {
  15373. let start2;
  15374. if (Array.isArray(defaultValue.value)) {
  15375. const left2 = dayjs(defaultValue.value[0]);
  15376. let right2 = dayjs(defaultValue.value[1]);
  15377. if (!props.unlinkPanels) {
  15378. right2 = left2.add(1, "year");
  15379. }
  15380. return [left2, right2];
  15381. } else if (defaultValue.value) {
  15382. start2 = dayjs(defaultValue.value);
  15383. } else {
  15384. start2 = dayjs();
  15385. }
  15386. start2 = start2.locale(lang.value);
  15387. return [start2, start2.add(1, "year")];
  15388. };
  15389. ctx.emit("set-picker-option", ["formatToString", formatToString]);
  15390. const pickerBase = inject("EP_PICKER_BASE");
  15391. const { shortcuts, disabledDate, format: format2 } = pickerBase.props;
  15392. const defaultValue = toRef(pickerBase.props, "defaultValue");
  15393. watch(() => defaultValue.value, (val) => {
  15394. if (val) {
  15395. const defaultArr = getDefaultValue();
  15396. leftDate.value = defaultArr[0];
  15397. rightDate.value = defaultArr[1];
  15398. }
  15399. }, { immediate: true });
  15400. watch(() => props.parsedValue, (newVal) => {
  15401. if (newVal && newVal.length === 2) {
  15402. minDate.value = newVal[0];
  15403. maxDate.value = newVal[1];
  15404. leftDate.value = minDate.value;
  15405. if (props.unlinkPanels && maxDate.value) {
  15406. const minDateYear = minDate.value.year();
  15407. const maxDateYear = maxDate.value.year();
  15408. rightDate.value = minDateYear === maxDateYear ? maxDate.value.add(1, "year") : maxDate.value;
  15409. } else {
  15410. rightDate.value = leftDate.value.add(1, "year");
  15411. }
  15412. } else {
  15413. const defaultArr = getDefaultValue();
  15414. minDate.value = null;
  15415. maxDate.value = null;
  15416. leftDate.value = defaultArr[0];
  15417. rightDate.value = defaultArr[1];
  15418. }
  15419. }, { immediate: true });
  15420. return {
  15421. shortcuts,
  15422. disabledDate,
  15423. onSelect,
  15424. handleRangePick,
  15425. rangeState,
  15426. handleChangeRange,
  15427. minDate,
  15428. maxDate,
  15429. enableYearArrow,
  15430. leftLabel,
  15431. rightLabel,
  15432. leftNextYear,
  15433. leftPrevYear,
  15434. rightNextYear,
  15435. rightPrevYear,
  15436. t,
  15437. leftDate,
  15438. rightDate,
  15439. hasShortcuts,
  15440. handleShortcutClick
  15441. };
  15442. }
  15443. });
  15444. const _hoisted_1$m = { class: "el-picker-panel__body-wrapper" };
  15445. const _hoisted_2$h = {
  15446. key: 0,
  15447. class: "el-picker-panel__sidebar"
  15448. };
  15449. const _hoisted_3$b = ["onClick"];
  15450. const _hoisted_4$9 = { class: "el-picker-panel__body" };
  15451. const _hoisted_5$9 = { class: "el-picker-panel__content el-date-range-picker__content is-left" };
  15452. const _hoisted_6$7 = { class: "el-date-range-picker__header" };
  15453. const _hoisted_7$3 = ["disabled"];
  15454. const _hoisted_8$2 = { class: "el-picker-panel__content el-date-range-picker__content is-right" };
  15455. const _hoisted_9$2 = { class: "el-date-range-picker__header" };
  15456. const _hoisted_10$2 = ["disabled"];
  15457. function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
  15458. const _component_d_arrow_left = resolveComponent("d-arrow-left");
  15459. const _component_el_icon = resolveComponent("el-icon");
  15460. const _component_d_arrow_right = resolveComponent("d-arrow-right");
  15461. const _component_month_table = resolveComponent("month-table");
  15462. return openBlock(), createElementBlock("div", {
  15463. class: normalizeClass(["el-picker-panel el-date-range-picker", [
  15464. {
  15465. "has-sidebar": _ctx.$slots.sidebar || _ctx.hasShortcuts
  15466. }
  15467. ]])
  15468. }, [
  15469. createElementVNode("div", _hoisted_1$m, [
  15470. renderSlot(_ctx.$slots, "sidebar", { class: "el-picker-panel__sidebar" }),
  15471. _ctx.hasShortcuts ? (openBlock(), createElementBlock("div", _hoisted_2$h, [
  15472. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.shortcuts, (shortcut, key) => {
  15473. return openBlock(), createElementBlock("button", {
  15474. key,
  15475. type: "button",
  15476. class: "el-picker-panel__shortcut",
  15477. onClick: ($event) => _ctx.handleShortcutClick(shortcut)
  15478. }, toDisplayString(shortcut.text), 9, _hoisted_3$b);
  15479. }), 128))
  15480. ])) : createCommentVNode("v-if", true),
  15481. createElementVNode("div", _hoisted_4$9, [
  15482. createElementVNode("div", _hoisted_5$9, [
  15483. createElementVNode("div", _hoisted_6$7, [
  15484. createElementVNode("button", {
  15485. type: "button",
  15486. class: "el-picker-panel__icon-btn d-arrow-left",
  15487. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.leftPrevYear && _ctx.leftPrevYear(...args))
  15488. }, [
  15489. createVNode(_component_el_icon, null, {
  15490. default: withCtx(() => [
  15491. createVNode(_component_d_arrow_left)
  15492. ]),
  15493. _: 1
  15494. })
  15495. ]),
  15496. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  15497. key: 0,
  15498. type: "button",
  15499. disabled: !_ctx.enableYearArrow,
  15500. class: normalizeClass([{ "is-disabled": !_ctx.enableYearArrow }, "el-picker-panel__icon-btn d-arrow-right"]),
  15501. onClick: _cache[1] || (_cache[1] = (...args) => _ctx.leftNextYear && _ctx.leftNextYear(...args))
  15502. }, [
  15503. createVNode(_component_el_icon, null, {
  15504. default: withCtx(() => [
  15505. createVNode(_component_d_arrow_right)
  15506. ]),
  15507. _: 1
  15508. })
  15509. ], 10, _hoisted_7$3)) : createCommentVNode("v-if", true),
  15510. createElementVNode("div", null, toDisplayString(_ctx.leftLabel), 1)
  15511. ]),
  15512. createVNode(_component_month_table, {
  15513. "selection-mode": "range",
  15514. date: _ctx.leftDate,
  15515. "min-date": _ctx.minDate,
  15516. "max-date": _ctx.maxDate,
  15517. "range-state": _ctx.rangeState,
  15518. "disabled-date": _ctx.disabledDate,
  15519. onChangerange: _ctx.handleChangeRange,
  15520. onPick: _ctx.handleRangePick,
  15521. onSelect: _ctx.onSelect
  15522. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "onChangerange", "onPick", "onSelect"])
  15523. ]),
  15524. createElementVNode("div", _hoisted_8$2, [
  15525. createElementVNode("div", _hoisted_9$2, [
  15526. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  15527. key: 0,
  15528. type: "button",
  15529. disabled: !_ctx.enableYearArrow,
  15530. class: normalizeClass([{ "is-disabled": !_ctx.enableYearArrow }, "el-picker-panel__icon-btn d-arrow-left"]),
  15531. onClick: _cache[2] || (_cache[2] = (...args) => _ctx.rightPrevYear && _ctx.rightPrevYear(...args))
  15532. }, [
  15533. createVNode(_component_el_icon, null, {
  15534. default: withCtx(() => [
  15535. createVNode(_component_d_arrow_left)
  15536. ]),
  15537. _: 1
  15538. })
  15539. ], 10, _hoisted_10$2)) : createCommentVNode("v-if", true),
  15540. createElementVNode("button", {
  15541. type: "button",
  15542. class: "el-picker-panel__icon-btn d-arrow-right",
  15543. onClick: _cache[3] || (_cache[3] = (...args) => _ctx.rightNextYear && _ctx.rightNextYear(...args))
  15544. }, [
  15545. createVNode(_component_el_icon, null, {
  15546. default: withCtx(() => [
  15547. createVNode(_component_d_arrow_right)
  15548. ]),
  15549. _: 1
  15550. })
  15551. ]),
  15552. createElementVNode("div", null, toDisplayString(_ctx.rightLabel), 1)
  15553. ]),
  15554. createVNode(_component_month_table, {
  15555. "selection-mode": "range",
  15556. date: _ctx.rightDate,
  15557. "min-date": _ctx.minDate,
  15558. "max-date": _ctx.maxDate,
  15559. "range-state": _ctx.rangeState,
  15560. "disabled-date": _ctx.disabledDate,
  15561. onChangerange: _ctx.handleChangeRange,
  15562. onPick: _ctx.handleRangePick,
  15563. onSelect: _ctx.onSelect
  15564. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "onChangerange", "onPick", "onSelect"])
  15565. ])
  15566. ])
  15567. ])
  15568. ], 2);
  15569. }
  15570. var MonthRangePickPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$z, [["render", _sfc_render$e], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/panel-month-range.vue"]]);
  15571. dayjs.extend(localeData);
  15572. dayjs.extend(advancedFormat);
  15573. dayjs.extend(customParseFormat);
  15574. dayjs.extend(weekOfYear);
  15575. dayjs.extend(weekYear);
  15576. dayjs.extend(dayOfYear);
  15577. dayjs.extend(isSameOrAfter);
  15578. dayjs.extend(isSameOrBefore);
  15579. const getPanel = function(type4) {
  15580. if (type4 === "daterange" || type4 === "datetimerange") {
  15581. return DateRangePickPanel;
  15582. } else if (type4 === "monthrange") {
  15583. return MonthRangePickPanel;
  15584. }
  15585. return DatePickPanel;
  15586. };
  15587. var DatePicker = defineComponent({
  15588. name: "ElDatePicker",
  15589. install: null,
  15590. props: __spreadProps(__spreadValues({}, timePickerDefaultProps), {
  15591. type: {
  15592. type: String,
  15593. default: "date"
  15594. }
  15595. }),
  15596. emits: ["update:modelValue"],
  15597. setup(props, ctx) {
  15598. provide("ElPopperOptions", props.popperOptions);
  15599. provide(ROOT_PICKER_INJECTION_KEY, {
  15600. ctx
  15601. });
  15602. const commonPicker = ref(null);
  15603. const refProps = __spreadProps(__spreadValues({}, props), {
  15604. focus: (focusStartInput = true) => {
  15605. var _a2;
  15606. (_a2 = commonPicker.value) == null ? void 0 : _a2.focus(focusStartInput);
  15607. }
  15608. });
  15609. ctx.expose(refProps);
  15610. return () => {
  15611. var _a2;
  15612. const format2 = (_a2 = props.format) != null ? _a2 : DEFAULT_FORMATS_DATEPICKER[props.type] || DEFAULT_FORMATS_DATE;
  15613. return h$1(CommonPicker, __spreadProps(__spreadValues({}, props), {
  15614. format: format2,
  15615. type: props.type,
  15616. ref: commonPicker,
  15617. "onUpdate:modelValue": (value) => ctx.emit("update:modelValue", value)
  15618. }), {
  15619. default: (scopedProps) => h$1(getPanel(props.type), scopedProps),
  15620. "range-separator": () => renderSlot(ctx.slots, "range-separator")
  15621. });
  15622. };
  15623. }
  15624. });
  15625. const _DatePicker = DatePicker;
  15626. _DatePicker.install = (app) => {
  15627. app.component(_DatePicker.name, _DatePicker);
  15628. };
  15629. const ElDatePicker = _DatePicker;
  15630. const overlayProps = buildProps({
  15631. mask: {
  15632. type: Boolean,
  15633. default: true
  15634. },
  15635. customMaskEvent: {
  15636. type: Boolean,
  15637. default: false
  15638. },
  15639. overlayClass: {
  15640. type: definePropType([
  15641. String,
  15642. Array,
  15643. Object
  15644. ])
  15645. },
  15646. zIndex: {
  15647. type: definePropType([String, Number])
  15648. }
  15649. });
  15650. const overlayEmits = {
  15651. click: (evt) => evt instanceof MouseEvent
  15652. };
  15653. var Overlay = defineComponent({
  15654. name: "ElOverlay",
  15655. props: overlayProps,
  15656. emits: overlayEmits,
  15657. setup(props, { slots, emit }) {
  15658. const ns = useNamespace("overlay");
  15659. const onMaskClick = (e) => {
  15660. emit("click", e);
  15661. };
  15662. const { onClick, onMousedown, onMouseup } = useSameTarget(props.customMaskEvent ? void 0 : onMaskClick);
  15663. return () => {
  15664. return props.mask ? createVNode("div", {
  15665. class: [ns.b(), props.overlayClass],
  15666. style: {
  15667. zIndex: props.zIndex
  15668. },
  15669. onClick,
  15670. onMousedown,
  15671. onMouseup
  15672. }, [renderSlot(slots, "default")], PatchFlags.STYLE | PatchFlags.CLASS | PatchFlags.PROPS, ["onClick", "onMouseup", "onMousedown"]) : h$1("div", {
  15673. class: props.overlayClass,
  15674. style: {
  15675. zIndex: props.zIndex,
  15676. position: "fixed",
  15677. top: "0px",
  15678. right: "0px",
  15679. bottom: "0px",
  15680. left: "0px"
  15681. }
  15682. }, [renderSlot(slots, "default")]);
  15683. };
  15684. }
  15685. });
  15686. const ElOverlay = Overlay;
  15687. const dialogContentProps = buildProps({
  15688. center: {
  15689. type: Boolean,
  15690. default: false
  15691. },
  15692. closeIcon: {
  15693. type: iconPropType,
  15694. default: ""
  15695. },
  15696. customClass: {
  15697. type: String,
  15698. default: ""
  15699. },
  15700. draggable: {
  15701. type: Boolean,
  15702. default: false
  15703. },
  15704. fullscreen: {
  15705. type: Boolean,
  15706. default: false
  15707. },
  15708. showClose: {
  15709. type: Boolean,
  15710. default: true
  15711. },
  15712. title: {
  15713. type: String,
  15714. default: ""
  15715. }
  15716. });
  15717. const dialogContentEmits = {
  15718. close: () => true
  15719. };
  15720. const _hoisted_1$l = ["aria-label"];
  15721. const __default__$c = { name: "ElDialogContent" };
  15722. const _sfc_main$y = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$c), {
  15723. props: dialogContentProps,
  15724. emits: dialogContentEmits,
  15725. setup(__props) {
  15726. const { Close } = CloseComponents;
  15727. const { dialogRef, headerRef, ns, style } = inject(dialogInjectionKey);
  15728. return (_ctx, _cache) => {
  15729. return openBlock(), createElementBlock("div", {
  15730. ref_key: "dialogRef",
  15731. ref: dialogRef,
  15732. class: normalizeClass([
  15733. unref(ns).b(),
  15734. unref(ns).is("fullscreen", _ctx.fullscreen),
  15735. unref(ns).is("draggable", _ctx.draggable),
  15736. { [unref(ns).m("center")]: _ctx.center },
  15737. _ctx.customClass
  15738. ]),
  15739. "aria-modal": "true",
  15740. role: "dialog",
  15741. "aria-label": _ctx.title || "dialog",
  15742. style: normalizeStyle(unref(style)),
  15743. onClick: _cache[1] || (_cache[1] = withModifiers(() => {
  15744. }, ["stop"]))
  15745. }, [
  15746. createElementVNode("div", {
  15747. ref_key: "headerRef",
  15748. ref: headerRef,
  15749. class: normalizeClass(unref(ns).e("header"))
  15750. }, [
  15751. renderSlot(_ctx.$slots, "title", {}, () => [
  15752. createElementVNode("span", {
  15753. class: normalizeClass(unref(ns).e("title"))
  15754. }, toDisplayString(_ctx.title), 3)
  15755. ])
  15756. ], 2),
  15757. createElementVNode("div", {
  15758. class: normalizeClass(unref(ns).e("body"))
  15759. }, [
  15760. renderSlot(_ctx.$slots, "default")
  15761. ], 2),
  15762. _ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
  15763. key: 0,
  15764. class: normalizeClass(unref(ns).e("footer"))
  15765. }, [
  15766. renderSlot(_ctx.$slots, "footer")
  15767. ], 2)) : createCommentVNode("v-if", true),
  15768. _ctx.showClose ? (openBlock(), createElementBlock("button", {
  15769. key: 1,
  15770. "aria-label": "close",
  15771. class: normalizeClass(unref(ns).e("headerbtn")),
  15772. type: "button",
  15773. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("close"))
  15774. }, [
  15775. createVNode(unref(ElIcon), {
  15776. class: normalizeClass(unref(ns).e("close"))
  15777. }, {
  15778. default: withCtx(() => [
  15779. (openBlock(), createBlock(resolveDynamicComponent(_ctx.closeIcon || unref(Close))))
  15780. ]),
  15781. _: 1
  15782. }, 8, ["class"])
  15783. ], 2)) : createCommentVNode("v-if", true)
  15784. ], 14, _hoisted_1$l);
  15785. };
  15786. }
  15787. }));
  15788. var ElDialogContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$y, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/dialog/src/dialog-content.vue"]]);
  15789. const dialogProps = buildProps(__spreadProps(__spreadValues({}, dialogContentProps), {
  15790. appendToBody: {
  15791. type: Boolean,
  15792. default: false
  15793. },
  15794. beforeClose: {
  15795. type: definePropType(Function)
  15796. },
  15797. destroyOnClose: {
  15798. type: Boolean,
  15799. default: false
  15800. },
  15801. closeOnClickModal: {
  15802. type: Boolean,
  15803. default: true
  15804. },
  15805. closeOnPressEscape: {
  15806. type: Boolean,
  15807. default: true
  15808. },
  15809. lockScroll: {
  15810. type: Boolean,
  15811. default: true
  15812. },
  15813. modal: {
  15814. type: Boolean,
  15815. default: true
  15816. },
  15817. openDelay: {
  15818. type: Number,
  15819. default: 0
  15820. },
  15821. closeDelay: {
  15822. type: Number,
  15823. default: 0
  15824. },
  15825. top: {
  15826. type: String
  15827. },
  15828. modelValue: {
  15829. type: Boolean,
  15830. required: true
  15831. },
  15832. modalClass: String,
  15833. width: {
  15834. type: [String, Number]
  15835. },
  15836. zIndex: {
  15837. type: Number
  15838. },
  15839. trapFocus: {
  15840. type: Boolean,
  15841. default: false
  15842. }
  15843. }));
  15844. const dialogEmits = {
  15845. open: () => true,
  15846. opened: () => true,
  15847. close: () => true,
  15848. closed: () => true,
  15849. [UPDATE_MODEL_EVENT]: (value) => isBoolean(value),
  15850. openAutoFocus: () => true,
  15851. closeAutoFocus: () => true
  15852. };
  15853. const useDialog = (props, targetRef) => {
  15854. const instance = getCurrentInstance();
  15855. const emit = instance.emit;
  15856. const { nextZIndex } = useZIndex();
  15857. let lastPosition = "";
  15858. const visible = ref(false);
  15859. const closed = ref(false);
  15860. const rendered = ref(false);
  15861. const zIndex2 = ref(props.zIndex || nextZIndex());
  15862. let openTimer = void 0;
  15863. let closeTimer = void 0;
  15864. const normalizeWidth = computed(() => isNumber(props.width) ? `${props.width}px` : props.width);
  15865. const style = computed(() => {
  15866. const style2 = {};
  15867. const varPrefix = `--el-dialog`;
  15868. if (!props.fullscreen) {
  15869. if (props.top) {
  15870. style2[`${varPrefix}-margin-top`] = props.top;
  15871. }
  15872. if (props.width) {
  15873. style2[`${varPrefix}-width`] = normalizeWidth.value;
  15874. }
  15875. }
  15876. return style2;
  15877. });
  15878. function afterEnter() {
  15879. emit("opened");
  15880. }
  15881. function afterLeave() {
  15882. emit("closed");
  15883. emit(UPDATE_MODEL_EVENT, false);
  15884. if (props.destroyOnClose) {
  15885. rendered.value = false;
  15886. }
  15887. }
  15888. function beforeLeave() {
  15889. emit("close");
  15890. }
  15891. function open() {
  15892. closeTimer == null ? void 0 : closeTimer();
  15893. openTimer == null ? void 0 : openTimer();
  15894. if (props.openDelay && props.openDelay > 0) {
  15895. ({ stop: openTimer } = useTimeoutFn(() => doOpen(), props.openDelay));
  15896. } else {
  15897. doOpen();
  15898. }
  15899. }
  15900. function close2() {
  15901. openTimer == null ? void 0 : openTimer();
  15902. closeTimer == null ? void 0 : closeTimer();
  15903. if (props.closeDelay && props.closeDelay > 0) {
  15904. ({ stop: closeTimer } = useTimeoutFn(() => doClose(), props.closeDelay));
  15905. } else {
  15906. doClose();
  15907. }
  15908. }
  15909. function handleClose() {
  15910. function hide2(shouldCancel) {
  15911. if (shouldCancel)
  15912. return;
  15913. closed.value = true;
  15914. visible.value = false;
  15915. }
  15916. if (props.beforeClose) {
  15917. props.beforeClose(hide2);
  15918. } else {
  15919. close2();
  15920. }
  15921. }
  15922. function onModalClick() {
  15923. if (props.closeOnClickModal) {
  15924. handleClose();
  15925. }
  15926. }
  15927. function doOpen() {
  15928. if (!isClient)
  15929. return;
  15930. visible.value = true;
  15931. }
  15932. function doClose() {
  15933. visible.value = false;
  15934. }
  15935. if (props.lockScroll) {
  15936. useLockscreen(visible);
  15937. }
  15938. if (props.closeOnPressEscape) {
  15939. useModal({
  15940. handleClose
  15941. }, visible);
  15942. }
  15943. useRestoreActive(visible);
  15944. watch(() => props.modelValue, (val) => {
  15945. if (val) {
  15946. closed.value = false;
  15947. open();
  15948. rendered.value = true;
  15949. emit("open");
  15950. zIndex2.value = props.zIndex ? zIndex2.value++ : nextZIndex();
  15951. nextTick(() => {
  15952. if (targetRef.value) {
  15953. targetRef.value.scrollTop = 0;
  15954. }
  15955. });
  15956. } else {
  15957. if (visible.value) {
  15958. close2();
  15959. }
  15960. }
  15961. });
  15962. watch(() => props.fullscreen, (val) => {
  15963. if (!targetRef.value)
  15964. return;
  15965. if (val) {
  15966. lastPosition = targetRef.value.style.transform;
  15967. targetRef.value.style.transform = "";
  15968. } else {
  15969. targetRef.value.style.transform = lastPosition;
  15970. }
  15971. });
  15972. onMounted(() => {
  15973. if (props.modelValue) {
  15974. visible.value = true;
  15975. rendered.value = true;
  15976. open();
  15977. }
  15978. });
  15979. return {
  15980. afterEnter,
  15981. afterLeave,
  15982. beforeLeave,
  15983. handleClose,
  15984. onModalClick,
  15985. close: close2,
  15986. doClose,
  15987. closed,
  15988. style,
  15989. rendered,
  15990. visible,
  15991. zIndex: zIndex2
  15992. };
  15993. };
  15994. const __default__$b = {
  15995. name: "ElDialog"
  15996. };
  15997. const _sfc_main$x = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$b), {
  15998. props: dialogProps,
  15999. emits: dialogEmits,
  16000. setup(__props, { expose }) {
  16001. const props = __props;
  16002. const ns = useNamespace("dialog");
  16003. const dialogRef = ref();
  16004. const headerRef = ref();
  16005. const {
  16006. visible,
  16007. style,
  16008. rendered,
  16009. zIndex: zIndex2,
  16010. afterEnter,
  16011. afterLeave,
  16012. beforeLeave,
  16013. handleClose,
  16014. onModalClick
  16015. } = useDialog(props, dialogRef);
  16016. provide(dialogInjectionKey, {
  16017. dialogRef,
  16018. headerRef,
  16019. ns,
  16020. rendered,
  16021. style
  16022. });
  16023. const overlayEvent = useSameTarget(onModalClick);
  16024. const draggable = computed(() => props.draggable && !props.fullscreen);
  16025. useDraggable(dialogRef, headerRef, draggable);
  16026. expose({
  16027. visible
  16028. });
  16029. return (_ctx, _cache) => {
  16030. return openBlock(), createBlock(Teleport, {
  16031. to: "body",
  16032. disabled: !_ctx.appendToBody
  16033. }, [
  16034. createVNode(Transition, {
  16035. name: "dialog-fade",
  16036. onAfterEnter: unref(afterEnter),
  16037. onAfterLeave: unref(afterLeave),
  16038. onBeforeLeave: unref(beforeLeave)
  16039. }, {
  16040. default: withCtx(() => [
  16041. withDirectives(createVNode(unref(ElOverlay), {
  16042. "custom-mask-event": "",
  16043. mask: _ctx.modal,
  16044. "overlay-class": _ctx.modalClass,
  16045. "z-index": unref(zIndex2)
  16046. }, {
  16047. default: withCtx(() => [
  16048. createElementVNode("div", {
  16049. class: normalizeClass(`${unref(ns).namespace.value}-overlay-dialog`),
  16050. onClick: _cache[0] || (_cache[0] = (...args) => unref(overlayEvent).onClick && unref(overlayEvent).onClick(...args)),
  16051. onMousedown: _cache[1] || (_cache[1] = (...args) => unref(overlayEvent).onMousedown && unref(overlayEvent).onMousedown(...args)),
  16052. onMouseup: _cache[2] || (_cache[2] = (...args) => unref(overlayEvent).onMouseup && unref(overlayEvent).onMouseup(...args))
  16053. }, [
  16054. unref(rendered) ? (openBlock(), createBlock(ElDialogContent, {
  16055. key: 0,
  16056. "custom-class": _ctx.customClass,
  16057. center: _ctx.center,
  16058. "close-icon": _ctx.closeIcon,
  16059. draggable: unref(draggable),
  16060. fullscreen: _ctx.fullscreen,
  16061. "show-close": _ctx.showClose,
  16062. style: normalizeStyle(unref(style)),
  16063. title: _ctx.title,
  16064. onClose: unref(handleClose)
  16065. }, createSlots({
  16066. title: withCtx(() => [
  16067. renderSlot(_ctx.$slots, "title")
  16068. ]),
  16069. default: withCtx(() => [
  16070. renderSlot(_ctx.$slots, "default")
  16071. ]),
  16072. _: 2
  16073. }, [
  16074. _ctx.$slots.footer ? {
  16075. name: "footer",
  16076. fn: withCtx(() => [
  16077. renderSlot(_ctx.$slots, "footer")
  16078. ])
  16079. } : void 0
  16080. ]), 1032, ["custom-class", "center", "close-icon", "draggable", "fullscreen", "show-close", "style", "title", "onClose"])) : createCommentVNode("v-if", true)
  16081. ], 34)
  16082. ]),
  16083. _: 3
  16084. }, 8, ["mask", "overlay-class", "z-index"]), [
  16085. [vShow, unref(visible)]
  16086. ])
  16087. ]),
  16088. _: 3
  16089. }, 8, ["onAfterEnter", "onAfterLeave", "onBeforeLeave"])
  16090. ], 8, ["disabled"]);
  16091. };
  16092. }
  16093. }));
  16094. var Dialog = /* @__PURE__ */ _export_sfc$1(_sfc_main$x, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/dialog/src/dialog.vue"]]);
  16095. const ElDialog = withInstall(Dialog);
  16096. const dividerProps = buildProps({
  16097. direction: {
  16098. type: String,
  16099. values: ["horizontal", "vertical"],
  16100. default: "horizontal"
  16101. },
  16102. contentPosition: {
  16103. type: String,
  16104. values: ["left", "center", "right"],
  16105. default: "center"
  16106. },
  16107. borderStyle: {
  16108. type: definePropType(String),
  16109. default: "solid"
  16110. }
  16111. });
  16112. const __default__$a = {
  16113. name: "ElDivider"
  16114. };
  16115. const _sfc_main$w = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$a), {
  16116. props: dividerProps,
  16117. setup(__props) {
  16118. const props = __props;
  16119. const ns = useNamespace("divider");
  16120. const dividerStyle = computed(() => {
  16121. return {
  16122. "--el-border-style": props.borderStyle
  16123. };
  16124. });
  16125. return (_ctx, _cache) => {
  16126. return openBlock(), createElementBlock("div", {
  16127. class: normalizeClass([unref(ns).b(), unref(ns).m(_ctx.direction)]),
  16128. style: normalizeStyle(unref(dividerStyle))
  16129. }, [
  16130. _ctx.$slots.default && _ctx.direction !== "vertical" ? (openBlock(), createElementBlock("div", {
  16131. key: 0,
  16132. class: normalizeClass([unref(ns).e("text"), unref(ns).is(_ctx.contentPosition)])
  16133. }, [
  16134. renderSlot(_ctx.$slots, "default")
  16135. ], 2)) : createCommentVNode("v-if", true)
  16136. ], 6);
  16137. };
  16138. }
  16139. }));
  16140. var Divider = /* @__PURE__ */ _export_sfc$1(_sfc_main$w, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/divider/src/divider.vue"]]);
  16141. const ElDivider = withInstall(Divider);
  16142. const formProps = buildProps({
  16143. model: Object,
  16144. rules: {
  16145. type: definePropType(Object)
  16146. },
  16147. labelPosition: String,
  16148. labelWidth: {
  16149. type: [String, Number],
  16150. default: ""
  16151. },
  16152. labelSuffix: {
  16153. type: String,
  16154. default: ""
  16155. },
  16156. inline: Boolean,
  16157. inlineMessage: Boolean,
  16158. statusIcon: Boolean,
  16159. showMessage: {
  16160. type: Boolean,
  16161. default: true
  16162. },
  16163. size: {
  16164. type: String,
  16165. values: componentSizes
  16166. },
  16167. disabled: Boolean,
  16168. validateOnRuleChange: {
  16169. type: Boolean,
  16170. default: true
  16171. },
  16172. hideRequiredAsterisk: {
  16173. type: Boolean,
  16174. default: false
  16175. },
  16176. scrollToError: Boolean
  16177. });
  16178. const formEmits = {
  16179. validate: (prop, isValid, message) => (isArray(prop) || isString(prop)) && isBoolean(isValid) && isString(message)
  16180. };
  16181. function useFormLabelWidth() {
  16182. const potentialLabelWidthArr = ref([]);
  16183. const autoLabelWidth = computed(() => {
  16184. if (!potentialLabelWidthArr.value.length)
  16185. return "0";
  16186. const max2 = Math.max(...potentialLabelWidthArr.value);
  16187. return max2 ? `${max2}px` : "";
  16188. });
  16189. function getLabelWidthIndex(width) {
  16190. const index = potentialLabelWidthArr.value.indexOf(width);
  16191. return index;
  16192. }
  16193. function registerLabelWidth(val, oldVal) {
  16194. if (val && oldVal) {
  16195. const index = getLabelWidthIndex(oldVal);
  16196. potentialLabelWidthArr.value.splice(index, 1, val);
  16197. } else if (val) {
  16198. potentialLabelWidthArr.value.push(val);
  16199. }
  16200. }
  16201. function deregisterLabelWidth(val) {
  16202. const index = getLabelWidthIndex(val);
  16203. if (index > -1) {
  16204. potentialLabelWidthArr.value.splice(index, 1);
  16205. }
  16206. }
  16207. return {
  16208. autoLabelWidth,
  16209. registerLabelWidth,
  16210. deregisterLabelWidth
  16211. };
  16212. }
  16213. const filterFields = (fields, props) => {
  16214. const normalized = castArray$1(props);
  16215. return normalized.length > 0 ? fields.filter((field) => field.prop && normalized.includes(field.prop)) : fields;
  16216. };
  16217. const __default__$9 = {
  16218. name: "ElForm"
  16219. };
  16220. const _sfc_main$v = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$9), {
  16221. props: formProps,
  16222. emits: formEmits,
  16223. setup(__props, { expose, emit }) {
  16224. const props = __props;
  16225. const fields = [];
  16226. const formSize = useSize();
  16227. const ns = useNamespace("form");
  16228. const formClasses = computed(() => {
  16229. const { labelPosition, inline } = props;
  16230. return [
  16231. ns.b(),
  16232. ns.m(formSize.value || "default"),
  16233. {
  16234. [ns.m(`label-${labelPosition}`)]: labelPosition,
  16235. [ns.m("inline")]: inline
  16236. }
  16237. ];
  16238. });
  16239. const addField = (field) => {
  16240. fields.push(field);
  16241. };
  16242. const removeField = (field) => {
  16243. if (field.prop) {
  16244. fields.splice(fields.indexOf(field), 1);
  16245. }
  16246. };
  16247. const resetFields = (properties = []) => {
  16248. if (!props.model) {
  16249. return;
  16250. }
  16251. filterFields(fields, properties).forEach((field) => field.resetField());
  16252. };
  16253. const clearValidate = (props2 = []) => {
  16254. filterFields(fields, props2).forEach((field) => field.clearValidate());
  16255. };
  16256. const isValidatable = computed(() => {
  16257. const hasModel = !!props.model;
  16258. return hasModel;
  16259. });
  16260. const obtainValidateFields = (props2) => {
  16261. if (fields.length === 0)
  16262. return [];
  16263. const filteredFields = filterFields(fields, props2);
  16264. if (!filteredFields.length) {
  16265. return [];
  16266. }
  16267. return filteredFields;
  16268. };
  16269. const validate = async (callback) => validateField(void 0, callback);
  16270. const doValidateField = async (props2 = []) => {
  16271. if (!isValidatable.value)
  16272. return false;
  16273. const fields2 = obtainValidateFields(props2);
  16274. if (fields2.length === 0)
  16275. return true;
  16276. let validationErrors = {};
  16277. for (const field of fields2) {
  16278. try {
  16279. await field.validate("");
  16280. } catch (fields3) {
  16281. validationErrors = __spreadValues(__spreadValues({}, validationErrors), fields3);
  16282. }
  16283. }
  16284. if (Object.keys(validationErrors).length === 0)
  16285. return true;
  16286. return Promise.reject(validationErrors);
  16287. };
  16288. const validateField = async (modelProps = [], callback) => {
  16289. const shouldThrow = !isFunction(callback);
  16290. try {
  16291. const result = await doValidateField(modelProps);
  16292. if (result === true) {
  16293. callback == null ? void 0 : callback(result);
  16294. }
  16295. return result;
  16296. } catch (e) {
  16297. const invalidFields = e;
  16298. if (props.scrollToError) {
  16299. scrollToField(Object.keys(invalidFields)[0]);
  16300. }
  16301. callback == null ? void 0 : callback(false, invalidFields);
  16302. return shouldThrow && Promise.reject(invalidFields);
  16303. }
  16304. };
  16305. const scrollToField = (prop) => {
  16306. var _a2;
  16307. const field = filterFields(fields, prop)[0];
  16308. if (field) {
  16309. (_a2 = field.$el) == null ? void 0 : _a2.scrollIntoView();
  16310. }
  16311. };
  16312. watch(() => props.rules, () => {
  16313. if (props.validateOnRuleChange)
  16314. validate();
  16315. }, { deep: true });
  16316. provide(formContextKey, reactive(__spreadValues(__spreadProps(__spreadValues({}, toRefs(props)), {
  16317. emit,
  16318. resetFields,
  16319. clearValidate,
  16320. validateField,
  16321. addField,
  16322. removeField
  16323. }), useFormLabelWidth())));
  16324. expose({
  16325. validate,
  16326. validateField,
  16327. resetFields,
  16328. clearValidate,
  16329. scrollToField
  16330. });
  16331. return (_ctx, _cache) => {
  16332. return openBlock(), createElementBlock("form", {
  16333. class: normalizeClass(unref(formClasses))
  16334. }, [
  16335. renderSlot(_ctx.$slots, "default")
  16336. ], 2);
  16337. };
  16338. }
  16339. }));
  16340. var Form = /* @__PURE__ */ _export_sfc$1(_sfc_main$v, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/form/src/form.vue"]]);
  16341. function _extends$1() {
  16342. _extends$1 = Object.assign ? Object.assign.bind() : function(target) {
  16343. for (var i = 1; i < arguments.length; i++) {
  16344. var source = arguments[i];
  16345. for (var key in source) {
  16346. if (Object.prototype.hasOwnProperty.call(source, key)) {
  16347. target[key] = source[key];
  16348. }
  16349. }
  16350. }
  16351. return target;
  16352. };
  16353. return _extends$1.apply(this, arguments);
  16354. }
  16355. function _inheritsLoose(subClass, superClass) {
  16356. subClass.prototype = Object.create(superClass.prototype);
  16357. subClass.prototype.constructor = subClass;
  16358. _setPrototypeOf(subClass, superClass);
  16359. }
  16360. function _getPrototypeOf(o2) {
  16361. _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o3) {
  16362. return o3.__proto__ || Object.getPrototypeOf(o3);
  16363. };
  16364. return _getPrototypeOf(o2);
  16365. }
  16366. function _setPrototypeOf(o2, p2) {
  16367. _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o3, p3) {
  16368. o3.__proto__ = p3;
  16369. return o3;
  16370. };
  16371. return _setPrototypeOf(o2, p2);
  16372. }
  16373. function _isNativeReflectConstruct() {
  16374. if (typeof Reflect === "undefined" || !Reflect.construct)
  16375. return false;
  16376. if (Reflect.construct.sham)
  16377. return false;
  16378. if (typeof Proxy === "function")
  16379. return true;
  16380. try {
  16381. Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
  16382. }));
  16383. return true;
  16384. } catch (e) {
  16385. return false;
  16386. }
  16387. }
  16388. function _construct(Parent, args, Class) {
  16389. if (_isNativeReflectConstruct()) {
  16390. _construct = Reflect.construct.bind();
  16391. } else {
  16392. _construct = function _construct2(Parent2, args2, Class2) {
  16393. var a2 = [null];
  16394. a2.push.apply(a2, args2);
  16395. var Constructor = Function.bind.apply(Parent2, a2);
  16396. var instance = new Constructor();
  16397. if (Class2)
  16398. _setPrototypeOf(instance, Class2.prototype);
  16399. return instance;
  16400. };
  16401. }
  16402. return _construct.apply(null, arguments);
  16403. }
  16404. function _isNativeFunction(fn2) {
  16405. return Function.toString.call(fn2).indexOf("[native code]") !== -1;
  16406. }
  16407. function _wrapNativeSuper(Class) {
  16408. var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0;
  16409. _wrapNativeSuper = function _wrapNativeSuper2(Class2) {
  16410. if (Class2 === null || !_isNativeFunction(Class2))
  16411. return Class2;
  16412. if (typeof Class2 !== "function") {
  16413. throw new TypeError("Super expression must either be null or a function");
  16414. }
  16415. if (typeof _cache !== "undefined") {
  16416. if (_cache.has(Class2))
  16417. return _cache.get(Class2);
  16418. _cache.set(Class2, Wrapper);
  16419. }
  16420. function Wrapper() {
  16421. return _construct(Class2, arguments, _getPrototypeOf(this).constructor);
  16422. }
  16423. Wrapper.prototype = Object.create(Class2.prototype, {
  16424. constructor: {
  16425. value: Wrapper,
  16426. enumerable: false,
  16427. writable: true,
  16428. configurable: true
  16429. }
  16430. });
  16431. return _setPrototypeOf(Wrapper, Class2);
  16432. };
  16433. return _wrapNativeSuper(Class);
  16434. }
  16435. var formatRegExp = /%[sdj%]/g;
  16436. var warning = function warning2() {
  16437. };
  16438. if (typeof process !== "undefined" && process.env && false) {
  16439. warning = function warning3(type4, errors) {
  16440. if (typeof console !== "undefined" && console.warn && typeof ASYNC_VALIDATOR_NO_WARNING === "undefined") {
  16441. if (errors.every(function(e) {
  16442. return typeof e === "string";
  16443. })) {
  16444. console.warn(type4, errors);
  16445. }
  16446. }
  16447. };
  16448. }
  16449. function convertFieldsError(errors) {
  16450. if (!errors || !errors.length)
  16451. return null;
  16452. var fields = {};
  16453. errors.forEach(function(error) {
  16454. var field = error.field;
  16455. fields[field] = fields[field] || [];
  16456. fields[field].push(error);
  16457. });
  16458. return fields;
  16459. }
  16460. function format(template) {
  16461. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  16462. args[_key - 1] = arguments[_key];
  16463. }
  16464. var i = 0;
  16465. var len = args.length;
  16466. if (typeof template === "function") {
  16467. return template.apply(null, args);
  16468. }
  16469. if (typeof template === "string") {
  16470. var str = template.replace(formatRegExp, function(x2) {
  16471. if (x2 === "%%") {
  16472. return "%";
  16473. }
  16474. if (i >= len) {
  16475. return x2;
  16476. }
  16477. switch (x2) {
  16478. case "%s":
  16479. return String(args[i++]);
  16480. case "%d":
  16481. return Number(args[i++]);
  16482. case "%j":
  16483. try {
  16484. return JSON.stringify(args[i++]);
  16485. } catch (_2) {
  16486. return "[Circular]";
  16487. }
  16488. break;
  16489. default:
  16490. return x2;
  16491. }
  16492. });
  16493. return str;
  16494. }
  16495. return template;
  16496. }
  16497. function isNativeStringType(type4) {
  16498. return type4 === "string" || type4 === "url" || type4 === "hex" || type4 === "email" || type4 === "date" || type4 === "pattern";
  16499. }
  16500. function isEmptyValue(value, type4) {
  16501. if (value === void 0 || value === null) {
  16502. return true;
  16503. }
  16504. if (type4 === "array" && Array.isArray(value) && !value.length) {
  16505. return true;
  16506. }
  16507. if (isNativeStringType(type4) && typeof value === "string" && !value) {
  16508. return true;
  16509. }
  16510. return false;
  16511. }
  16512. function asyncParallelArray(arr, func, callback) {
  16513. var results = [];
  16514. var total = 0;
  16515. var arrLength = arr.length;
  16516. function count(errors) {
  16517. results.push.apply(results, errors || []);
  16518. total++;
  16519. if (total === arrLength) {
  16520. callback(results);
  16521. }
  16522. }
  16523. arr.forEach(function(a2) {
  16524. func(a2, count);
  16525. });
  16526. }
  16527. function asyncSerialArray(arr, func, callback) {
  16528. var index = 0;
  16529. var arrLength = arr.length;
  16530. function next(errors) {
  16531. if (errors && errors.length) {
  16532. callback(errors);
  16533. return;
  16534. }
  16535. var original = index;
  16536. index = index + 1;
  16537. if (original < arrLength) {
  16538. func(arr[original], next);
  16539. } else {
  16540. callback([]);
  16541. }
  16542. }
  16543. next([]);
  16544. }
  16545. function flattenObjArr(objArr) {
  16546. var ret = [];
  16547. Object.keys(objArr).forEach(function(k) {
  16548. ret.push.apply(ret, objArr[k] || []);
  16549. });
  16550. return ret;
  16551. }
  16552. var AsyncValidationError = /* @__PURE__ */ function(_Error) {
  16553. _inheritsLoose(AsyncValidationError2, _Error);
  16554. function AsyncValidationError2(errors, fields) {
  16555. var _this;
  16556. _this = _Error.call(this, "Async Validation Error") || this;
  16557. _this.errors = errors;
  16558. _this.fields = fields;
  16559. return _this;
  16560. }
  16561. return AsyncValidationError2;
  16562. }(/* @__PURE__ */ _wrapNativeSuper(Error));
  16563. function asyncMap(objArr, option, func, callback, source) {
  16564. if (option.first) {
  16565. var _pending = new Promise(function(resolve, reject) {
  16566. var next = function next2(errors) {
  16567. callback(errors);
  16568. return errors.length ? reject(new AsyncValidationError(errors, convertFieldsError(errors))) : resolve(source);
  16569. };
  16570. var flattenArr = flattenObjArr(objArr);
  16571. asyncSerialArray(flattenArr, func, next);
  16572. });
  16573. _pending["catch"](function(e) {
  16574. return e;
  16575. });
  16576. return _pending;
  16577. }
  16578. var firstFields = option.firstFields === true ? Object.keys(objArr) : option.firstFields || [];
  16579. var objArrKeys = Object.keys(objArr);
  16580. var objArrLength = objArrKeys.length;
  16581. var total = 0;
  16582. var results = [];
  16583. var pending = new Promise(function(resolve, reject) {
  16584. var next = function next2(errors) {
  16585. results.push.apply(results, errors);
  16586. total++;
  16587. if (total === objArrLength) {
  16588. callback(results);
  16589. return results.length ? reject(new AsyncValidationError(results, convertFieldsError(results))) : resolve(source);
  16590. }
  16591. };
  16592. if (!objArrKeys.length) {
  16593. callback(results);
  16594. resolve(source);
  16595. }
  16596. objArrKeys.forEach(function(key) {
  16597. var arr = objArr[key];
  16598. if (firstFields.indexOf(key) !== -1) {
  16599. asyncSerialArray(arr, func, next);
  16600. } else {
  16601. asyncParallelArray(arr, func, next);
  16602. }
  16603. });
  16604. });
  16605. pending["catch"](function(e) {
  16606. return e;
  16607. });
  16608. return pending;
  16609. }
  16610. function isErrorObj(obj) {
  16611. return !!(obj && obj.message !== void 0);
  16612. }
  16613. function getValue(value, path) {
  16614. var v2 = value;
  16615. for (var i = 0; i < path.length; i++) {
  16616. if (v2 == void 0) {
  16617. return v2;
  16618. }
  16619. v2 = v2[path[i]];
  16620. }
  16621. return v2;
  16622. }
  16623. function complementError(rule, source) {
  16624. return function(oe) {
  16625. var fieldValue;
  16626. if (rule.fullFields) {
  16627. fieldValue = getValue(source, rule.fullFields);
  16628. } else {
  16629. fieldValue = source[oe.field || rule.fullField];
  16630. }
  16631. if (isErrorObj(oe)) {
  16632. oe.field = oe.field || rule.fullField;
  16633. oe.fieldValue = fieldValue;
  16634. return oe;
  16635. }
  16636. return {
  16637. message: typeof oe === "function" ? oe() : oe,
  16638. fieldValue,
  16639. field: oe.field || rule.fullField
  16640. };
  16641. };
  16642. }
  16643. function deepMerge(target, source) {
  16644. if (source) {
  16645. for (var s2 in source) {
  16646. if (source.hasOwnProperty(s2)) {
  16647. var value = source[s2];
  16648. if (typeof value === "object" && typeof target[s2] === "object") {
  16649. target[s2] = _extends$1({}, target[s2], value);
  16650. } else {
  16651. target[s2] = value;
  16652. }
  16653. }
  16654. }
  16655. }
  16656. return target;
  16657. }
  16658. var required$1 = function required(rule, value, source, errors, options, type4) {
  16659. if (rule.required && (!source.hasOwnProperty(rule.field) || isEmptyValue(value, type4 || rule.type))) {
  16660. errors.push(format(options.messages.required, rule.fullField));
  16661. }
  16662. };
  16663. var whitespace = function whitespace2(rule, value, source, errors, options) {
  16664. if (/^\s+$/.test(value) || value === "") {
  16665. errors.push(format(options.messages.whitespace, rule.fullField));
  16666. }
  16667. };
  16668. var urlReg;
  16669. var getUrlRegex = function() {
  16670. if (urlReg) {
  16671. return urlReg;
  16672. }
  16673. var word = "[a-fA-F\\d:]";
  16674. var b2 = function b3(options) {
  16675. return options && options.includeBoundaries ? "(?:(?<=\\s|^)(?=" + word + ")|(?<=" + word + ")(?=\\s|$))" : "";
  16676. };
  16677. var v4 = "(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}";
  16678. var v6seg = "[a-fA-F\\d]{1,4}";
  16679. var v6 = ("\n(?:\n(?:" + v6seg + ":){7}(?:" + v6seg + "|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:" + v6seg + ":){6}(?:" + v4 + "|:" + v6seg + "|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4\n(?:" + v6seg + ":){5}(?::" + v4 + "|(?::" + v6seg + "){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4\n(?:" + v6seg + ":){4}(?:(?::" + v6seg + "){0,1}:" + v4 + "|(?::" + v6seg + "){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4\n(?:" + v6seg + ":){3}(?:(?::" + v6seg + "){0,2}:" + v4 + "|(?::" + v6seg + "){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4\n(?:" + v6seg + ":){2}(?:(?::" + v6seg + "){0,3}:" + v4 + "|(?::" + v6seg + "){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:" + v6seg + ":){1}(?:(?::" + v6seg + "){0,4}:" + v4 + "|(?::" + v6seg + "){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::(?:(?::" + v6seg + "){0,5}:" + v4 + "|(?::" + v6seg + "){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1\n").replace(/\s*\/\/.*$/gm, "").replace(/\n/g, "").trim();
  16680. var v46Exact = new RegExp("(?:^" + v4 + "$)|(?:^" + v6 + "$)");
  16681. var v4exact = new RegExp("^" + v4 + "$");
  16682. var v6exact = new RegExp("^" + v6 + "$");
  16683. var ip = function ip2(options) {
  16684. return options && options.exact ? v46Exact : new RegExp("(?:" + b2(options) + v4 + b2(options) + ")|(?:" + b2(options) + v6 + b2(options) + ")", "g");
  16685. };
  16686. ip.v4 = function(options) {
  16687. return options && options.exact ? v4exact : new RegExp("" + b2(options) + v4 + b2(options), "g");
  16688. };
  16689. ip.v6 = function(options) {
  16690. return options && options.exact ? v6exact : new RegExp("" + b2(options) + v6 + b2(options), "g");
  16691. };
  16692. var protocol = "(?:(?:[a-z]+:)?//)";
  16693. var auth = "(?:\\S+(?::\\S*)?@)?";
  16694. var ipv4 = ip.v4().source;
  16695. var ipv6 = ip.v6().source;
  16696. var host = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)";
  16697. var domain = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*";
  16698. var tld = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))";
  16699. var port = "(?::\\d{2,5})?";
  16700. var path = '(?:[/?#][^\\s"]*)?';
  16701. var regex = "(?:" + protocol + "|www\\.)" + auth + "(?:localhost|" + ipv4 + "|" + ipv6 + "|" + host + domain + tld + ")" + port + path;
  16702. urlReg = new RegExp("(?:^" + regex + "$)", "i");
  16703. return urlReg;
  16704. };
  16705. var pattern$2 = {
  16706. email: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/,
  16707. hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i
  16708. };
  16709. var types = {
  16710. integer: function integer(value) {
  16711. return types.number(value) && parseInt(value, 10) === value;
  16712. },
  16713. "float": function float(value) {
  16714. return types.number(value) && !types.integer(value);
  16715. },
  16716. array: function array(value) {
  16717. return Array.isArray(value);
  16718. },
  16719. regexp: function regexp(value) {
  16720. if (value instanceof RegExp) {
  16721. return true;
  16722. }
  16723. try {
  16724. return !!new RegExp(value);
  16725. } catch (e) {
  16726. return false;
  16727. }
  16728. },
  16729. date: function date(value) {
  16730. return typeof value.getTime === "function" && typeof value.getMonth === "function" && typeof value.getYear === "function" && !isNaN(value.getTime());
  16731. },
  16732. number: function number(value) {
  16733. if (isNaN(value)) {
  16734. return false;
  16735. }
  16736. return typeof value === "number";
  16737. },
  16738. object: function object(value) {
  16739. return typeof value === "object" && !types.array(value);
  16740. },
  16741. method: function method(value) {
  16742. return typeof value === "function";
  16743. },
  16744. email: function email(value) {
  16745. return typeof value === "string" && value.length <= 320 && !!value.match(pattern$2.email);
  16746. },
  16747. url: function url(value) {
  16748. return typeof value === "string" && value.length <= 2048 && !!value.match(getUrlRegex());
  16749. },
  16750. hex: function hex(value) {
  16751. return typeof value === "string" && !!value.match(pattern$2.hex);
  16752. }
  16753. };
  16754. var type$1 = function type(rule, value, source, errors, options) {
  16755. if (rule.required && value === void 0) {
  16756. required$1(rule, value, source, errors, options);
  16757. return;
  16758. }
  16759. var custom = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"];
  16760. var ruleType = rule.type;
  16761. if (custom.indexOf(ruleType) > -1) {
  16762. if (!types[ruleType](value)) {
  16763. errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  16764. }
  16765. } else if (ruleType && typeof value !== rule.type) {
  16766. errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  16767. }
  16768. };
  16769. var range = function range2(rule, value, source, errors, options) {
  16770. var len = typeof rule.len === "number";
  16771. var min2 = typeof rule.min === "number";
  16772. var max2 = typeof rule.max === "number";
  16773. var spRegexp = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
  16774. var val = value;
  16775. var key = null;
  16776. var num = typeof value === "number";
  16777. var str = typeof value === "string";
  16778. var arr = Array.isArray(value);
  16779. if (num) {
  16780. key = "number";
  16781. } else if (str) {
  16782. key = "string";
  16783. } else if (arr) {
  16784. key = "array";
  16785. }
  16786. if (!key) {
  16787. return false;
  16788. }
  16789. if (arr) {
  16790. val = value.length;
  16791. }
  16792. if (str) {
  16793. val = value.replace(spRegexp, "_").length;
  16794. }
  16795. if (len) {
  16796. if (val !== rule.len) {
  16797. errors.push(format(options.messages[key].len, rule.fullField, rule.len));
  16798. }
  16799. } else if (min2 && !max2 && val < rule.min) {
  16800. errors.push(format(options.messages[key].min, rule.fullField, rule.min));
  16801. } else if (max2 && !min2 && val > rule.max) {
  16802. errors.push(format(options.messages[key].max, rule.fullField, rule.max));
  16803. } else if (min2 && max2 && (val < rule.min || val > rule.max)) {
  16804. errors.push(format(options.messages[key].range, rule.fullField, rule.min, rule.max));
  16805. }
  16806. };
  16807. var ENUM$1 = "enum";
  16808. var enumerable$1 = function enumerable(rule, value, source, errors, options) {
  16809. rule[ENUM$1] = Array.isArray(rule[ENUM$1]) ? rule[ENUM$1] : [];
  16810. if (rule[ENUM$1].indexOf(value) === -1) {
  16811. errors.push(format(options.messages[ENUM$1], rule.fullField, rule[ENUM$1].join(", ")));
  16812. }
  16813. };
  16814. var pattern$1 = function pattern(rule, value, source, errors, options) {
  16815. if (rule.pattern) {
  16816. if (rule.pattern instanceof RegExp) {
  16817. rule.pattern.lastIndex = 0;
  16818. if (!rule.pattern.test(value)) {
  16819. errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  16820. }
  16821. } else if (typeof rule.pattern === "string") {
  16822. var _pattern = new RegExp(rule.pattern);
  16823. if (!_pattern.test(value)) {
  16824. errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  16825. }
  16826. }
  16827. }
  16828. };
  16829. var rules = {
  16830. required: required$1,
  16831. whitespace,
  16832. type: type$1,
  16833. range,
  16834. "enum": enumerable$1,
  16835. pattern: pattern$1
  16836. };
  16837. var string = function string2(rule, value, callback, source, options) {
  16838. var errors = [];
  16839. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16840. if (validate) {
  16841. if (isEmptyValue(value, "string") && !rule.required) {
  16842. return callback();
  16843. }
  16844. rules.required(rule, value, source, errors, options, "string");
  16845. if (!isEmptyValue(value, "string")) {
  16846. rules.type(rule, value, source, errors, options);
  16847. rules.range(rule, value, source, errors, options);
  16848. rules.pattern(rule, value, source, errors, options);
  16849. if (rule.whitespace === true) {
  16850. rules.whitespace(rule, value, source, errors, options);
  16851. }
  16852. }
  16853. }
  16854. callback(errors);
  16855. };
  16856. var method2 = function method3(rule, value, callback, source, options) {
  16857. var errors = [];
  16858. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16859. if (validate) {
  16860. if (isEmptyValue(value) && !rule.required) {
  16861. return callback();
  16862. }
  16863. rules.required(rule, value, source, errors, options);
  16864. if (value !== void 0) {
  16865. rules.type(rule, value, source, errors, options);
  16866. }
  16867. }
  16868. callback(errors);
  16869. };
  16870. var number2 = function number3(rule, value, callback, source, options) {
  16871. var errors = [];
  16872. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16873. if (validate) {
  16874. if (value === "") {
  16875. value = void 0;
  16876. }
  16877. if (isEmptyValue(value) && !rule.required) {
  16878. return callback();
  16879. }
  16880. rules.required(rule, value, source, errors, options);
  16881. if (value !== void 0) {
  16882. rules.type(rule, value, source, errors, options);
  16883. rules.range(rule, value, source, errors, options);
  16884. }
  16885. }
  16886. callback(errors);
  16887. };
  16888. var _boolean = function _boolean2(rule, value, callback, source, options) {
  16889. var errors = [];
  16890. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16891. if (validate) {
  16892. if (isEmptyValue(value) && !rule.required) {
  16893. return callback();
  16894. }
  16895. rules.required(rule, value, source, errors, options);
  16896. if (value !== void 0) {
  16897. rules.type(rule, value, source, errors, options);
  16898. }
  16899. }
  16900. callback(errors);
  16901. };
  16902. var regexp2 = function regexp3(rule, value, callback, source, options) {
  16903. var errors = [];
  16904. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16905. if (validate) {
  16906. if (isEmptyValue(value) && !rule.required) {
  16907. return callback();
  16908. }
  16909. rules.required(rule, value, source, errors, options);
  16910. if (!isEmptyValue(value)) {
  16911. rules.type(rule, value, source, errors, options);
  16912. }
  16913. }
  16914. callback(errors);
  16915. };
  16916. var integer2 = function integer3(rule, value, callback, source, options) {
  16917. var errors = [];
  16918. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16919. if (validate) {
  16920. if (isEmptyValue(value) && !rule.required) {
  16921. return callback();
  16922. }
  16923. rules.required(rule, value, source, errors, options);
  16924. if (value !== void 0) {
  16925. rules.type(rule, value, source, errors, options);
  16926. rules.range(rule, value, source, errors, options);
  16927. }
  16928. }
  16929. callback(errors);
  16930. };
  16931. var floatFn = function floatFn2(rule, value, callback, source, options) {
  16932. var errors = [];
  16933. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16934. if (validate) {
  16935. if (isEmptyValue(value) && !rule.required) {
  16936. return callback();
  16937. }
  16938. rules.required(rule, value, source, errors, options);
  16939. if (value !== void 0) {
  16940. rules.type(rule, value, source, errors, options);
  16941. rules.range(rule, value, source, errors, options);
  16942. }
  16943. }
  16944. callback(errors);
  16945. };
  16946. var array2 = function array3(rule, value, callback, source, options) {
  16947. var errors = [];
  16948. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16949. if (validate) {
  16950. if ((value === void 0 || value === null) && !rule.required) {
  16951. return callback();
  16952. }
  16953. rules.required(rule, value, source, errors, options, "array");
  16954. if (value !== void 0 && value !== null) {
  16955. rules.type(rule, value, source, errors, options);
  16956. rules.range(rule, value, source, errors, options);
  16957. }
  16958. }
  16959. callback(errors);
  16960. };
  16961. var object2 = function object3(rule, value, callback, source, options) {
  16962. var errors = [];
  16963. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16964. if (validate) {
  16965. if (isEmptyValue(value) && !rule.required) {
  16966. return callback();
  16967. }
  16968. rules.required(rule, value, source, errors, options);
  16969. if (value !== void 0) {
  16970. rules.type(rule, value, source, errors, options);
  16971. }
  16972. }
  16973. callback(errors);
  16974. };
  16975. var ENUM = "enum";
  16976. var enumerable2 = function enumerable3(rule, value, callback, source, options) {
  16977. var errors = [];
  16978. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16979. if (validate) {
  16980. if (isEmptyValue(value) && !rule.required) {
  16981. return callback();
  16982. }
  16983. rules.required(rule, value, source, errors, options);
  16984. if (value !== void 0) {
  16985. rules[ENUM](rule, value, source, errors, options);
  16986. }
  16987. }
  16988. callback(errors);
  16989. };
  16990. var pattern2 = function pattern3(rule, value, callback, source, options) {
  16991. var errors = [];
  16992. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16993. if (validate) {
  16994. if (isEmptyValue(value, "string") && !rule.required) {
  16995. return callback();
  16996. }
  16997. rules.required(rule, value, source, errors, options);
  16998. if (!isEmptyValue(value, "string")) {
  16999. rules.pattern(rule, value, source, errors, options);
  17000. }
  17001. }
  17002. callback(errors);
  17003. };
  17004. var date2 = function date3(rule, value, callback, source, options) {
  17005. var errors = [];
  17006. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  17007. if (validate) {
  17008. if (isEmptyValue(value, "date") && !rule.required) {
  17009. return callback();
  17010. }
  17011. rules.required(rule, value, source, errors, options);
  17012. if (!isEmptyValue(value, "date")) {
  17013. var dateObject;
  17014. if (value instanceof Date) {
  17015. dateObject = value;
  17016. } else {
  17017. dateObject = new Date(value);
  17018. }
  17019. rules.type(rule, dateObject, source, errors, options);
  17020. if (dateObject) {
  17021. rules.range(rule, dateObject.getTime(), source, errors, options);
  17022. }
  17023. }
  17024. }
  17025. callback(errors);
  17026. };
  17027. var required2 = function required3(rule, value, callback, source, options) {
  17028. var errors = [];
  17029. var type4 = Array.isArray(value) ? "array" : typeof value;
  17030. rules.required(rule, value, source, errors, options, type4);
  17031. callback(errors);
  17032. };
  17033. var type2 = function type3(rule, value, callback, source, options) {
  17034. var ruleType = rule.type;
  17035. var errors = [];
  17036. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  17037. if (validate) {
  17038. if (isEmptyValue(value, ruleType) && !rule.required) {
  17039. return callback();
  17040. }
  17041. rules.required(rule, value, source, errors, options, ruleType);
  17042. if (!isEmptyValue(value, ruleType)) {
  17043. rules.type(rule, value, source, errors, options);
  17044. }
  17045. }
  17046. callback(errors);
  17047. };
  17048. var any = function any2(rule, value, callback, source, options) {
  17049. var errors = [];
  17050. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  17051. if (validate) {
  17052. if (isEmptyValue(value) && !rule.required) {
  17053. return callback();
  17054. }
  17055. rules.required(rule, value, source, errors, options);
  17056. }
  17057. callback(errors);
  17058. };
  17059. var validators = {
  17060. string,
  17061. method: method2,
  17062. number: number2,
  17063. "boolean": _boolean,
  17064. regexp: regexp2,
  17065. integer: integer2,
  17066. "float": floatFn,
  17067. array: array2,
  17068. object: object2,
  17069. "enum": enumerable2,
  17070. pattern: pattern2,
  17071. date: date2,
  17072. url: type2,
  17073. hex: type2,
  17074. email: type2,
  17075. required: required2,
  17076. any
  17077. };
  17078. function newMessages() {
  17079. return {
  17080. "default": "Validation error on field %s",
  17081. required: "%s is required",
  17082. "enum": "%s must be one of %s",
  17083. whitespace: "%s cannot be empty",
  17084. date: {
  17085. format: "%s date %s is invalid for format %s",
  17086. parse: "%s date could not be parsed, %s is invalid ",
  17087. invalid: "%s date %s is invalid"
  17088. },
  17089. types: {
  17090. string: "%s is not a %s",
  17091. method: "%s is not a %s (function)",
  17092. array: "%s is not an %s",
  17093. object: "%s is not an %s",
  17094. number: "%s is not a %s",
  17095. date: "%s is not a %s",
  17096. "boolean": "%s is not a %s",
  17097. integer: "%s is not an %s",
  17098. "float": "%s is not a %s",
  17099. regexp: "%s is not a valid %s",
  17100. email: "%s is not a valid %s",
  17101. url: "%s is not a valid %s",
  17102. hex: "%s is not a valid %s"
  17103. },
  17104. string: {
  17105. len: "%s must be exactly %s characters",
  17106. min: "%s must be at least %s characters",
  17107. max: "%s cannot be longer than %s characters",
  17108. range: "%s must be between %s and %s characters"
  17109. },
  17110. number: {
  17111. len: "%s must equal %s",
  17112. min: "%s cannot be less than %s",
  17113. max: "%s cannot be greater than %s",
  17114. range: "%s must be between %s and %s"
  17115. },
  17116. array: {
  17117. len: "%s must be exactly %s in length",
  17118. min: "%s cannot be less than %s in length",
  17119. max: "%s cannot be greater than %s in length",
  17120. range: "%s must be between %s and %s in length"
  17121. },
  17122. pattern: {
  17123. mismatch: "%s value %s does not match pattern %s"
  17124. },
  17125. clone: function clone2() {
  17126. var cloned = JSON.parse(JSON.stringify(this));
  17127. cloned.clone = this.clone;
  17128. return cloned;
  17129. }
  17130. };
  17131. }
  17132. var messages = newMessages();
  17133. var Schema = /* @__PURE__ */ function() {
  17134. function Schema2(descriptor) {
  17135. this.rules = null;
  17136. this._messages = messages;
  17137. this.define(descriptor);
  17138. }
  17139. var _proto = Schema2.prototype;
  17140. _proto.define = function define(rules2) {
  17141. var _this = this;
  17142. if (!rules2) {
  17143. throw new Error("Cannot configure a schema with no rules");
  17144. }
  17145. if (typeof rules2 !== "object" || Array.isArray(rules2)) {
  17146. throw new Error("Rules must be an object");
  17147. }
  17148. this.rules = {};
  17149. Object.keys(rules2).forEach(function(name) {
  17150. var item = rules2[name];
  17151. _this.rules[name] = Array.isArray(item) ? item : [item];
  17152. });
  17153. };
  17154. _proto.messages = function messages2(_messages) {
  17155. if (_messages) {
  17156. this._messages = deepMerge(newMessages(), _messages);
  17157. }
  17158. return this._messages;
  17159. };
  17160. _proto.validate = function validate(source_, o2, oc) {
  17161. var _this2 = this;
  17162. if (o2 === void 0) {
  17163. o2 = {};
  17164. }
  17165. if (oc === void 0) {
  17166. oc = function oc2() {
  17167. };
  17168. }
  17169. var source = source_;
  17170. var options = o2;
  17171. var callback = oc;
  17172. if (typeof options === "function") {
  17173. callback = options;
  17174. options = {};
  17175. }
  17176. if (!this.rules || Object.keys(this.rules).length === 0) {
  17177. if (callback) {
  17178. callback(null, source);
  17179. }
  17180. return Promise.resolve(source);
  17181. }
  17182. function complete(results) {
  17183. var errors = [];
  17184. var fields = {};
  17185. function add(e) {
  17186. if (Array.isArray(e)) {
  17187. var _errors;
  17188. errors = (_errors = errors).concat.apply(_errors, e);
  17189. } else {
  17190. errors.push(e);
  17191. }
  17192. }
  17193. for (var i = 0; i < results.length; i++) {
  17194. add(results[i]);
  17195. }
  17196. if (!errors.length) {
  17197. callback(null, source);
  17198. } else {
  17199. fields = convertFieldsError(errors);
  17200. callback(errors, fields);
  17201. }
  17202. }
  17203. if (options.messages) {
  17204. var messages$1 = this.messages();
  17205. if (messages$1 === messages) {
  17206. messages$1 = newMessages();
  17207. }
  17208. deepMerge(messages$1, options.messages);
  17209. options.messages = messages$1;
  17210. } else {
  17211. options.messages = this.messages();
  17212. }
  17213. var series = {};
  17214. var keys2 = options.keys || Object.keys(this.rules);
  17215. keys2.forEach(function(z) {
  17216. var arr = _this2.rules[z];
  17217. var value = source[z];
  17218. arr.forEach(function(r) {
  17219. var rule = r;
  17220. if (typeof rule.transform === "function") {
  17221. if (source === source_) {
  17222. source = _extends$1({}, source);
  17223. }
  17224. value = source[z] = rule.transform(value);
  17225. }
  17226. if (typeof rule === "function") {
  17227. rule = {
  17228. validator: rule
  17229. };
  17230. } else {
  17231. rule = _extends$1({}, rule);
  17232. }
  17233. rule.validator = _this2.getValidationMethod(rule);
  17234. if (!rule.validator) {
  17235. return;
  17236. }
  17237. rule.field = z;
  17238. rule.fullField = rule.fullField || z;
  17239. rule.type = _this2.getType(rule);
  17240. series[z] = series[z] || [];
  17241. series[z].push({
  17242. rule,
  17243. value,
  17244. source,
  17245. field: z
  17246. });
  17247. });
  17248. });
  17249. var errorFields = {};
  17250. return asyncMap(series, options, function(data2, doIt) {
  17251. var rule = data2.rule;
  17252. var deep = (rule.type === "object" || rule.type === "array") && (typeof rule.fields === "object" || typeof rule.defaultField === "object");
  17253. deep = deep && (rule.required || !rule.required && data2.value);
  17254. rule.field = data2.field;
  17255. function addFullField(key, schema) {
  17256. return _extends$1({}, schema, {
  17257. fullField: rule.fullField + "." + key,
  17258. fullFields: rule.fullFields ? [].concat(rule.fullFields, [key]) : [key]
  17259. });
  17260. }
  17261. function cb(e) {
  17262. if (e === void 0) {
  17263. e = [];
  17264. }
  17265. var errorList = Array.isArray(e) ? e : [e];
  17266. if (!options.suppressWarning && errorList.length) {
  17267. Schema2.warning("async-validator:", errorList);
  17268. }
  17269. if (errorList.length && rule.message !== void 0) {
  17270. errorList = [].concat(rule.message);
  17271. }
  17272. var filledErrors = errorList.map(complementError(rule, source));
  17273. if (options.first && filledErrors.length) {
  17274. errorFields[rule.field] = 1;
  17275. return doIt(filledErrors);
  17276. }
  17277. if (!deep) {
  17278. doIt(filledErrors);
  17279. } else {
  17280. if (rule.required && !data2.value) {
  17281. if (rule.message !== void 0) {
  17282. filledErrors = [].concat(rule.message).map(complementError(rule, source));
  17283. } else if (options.error) {
  17284. filledErrors = [options.error(rule, format(options.messages.required, rule.field))];
  17285. }
  17286. return doIt(filledErrors);
  17287. }
  17288. var fieldsSchema = {};
  17289. if (rule.defaultField) {
  17290. Object.keys(data2.value).map(function(key) {
  17291. fieldsSchema[key] = rule.defaultField;
  17292. });
  17293. }
  17294. fieldsSchema = _extends$1({}, fieldsSchema, data2.rule.fields);
  17295. var paredFieldsSchema = {};
  17296. Object.keys(fieldsSchema).forEach(function(field) {
  17297. var fieldSchema = fieldsSchema[field];
  17298. var fieldSchemaList = Array.isArray(fieldSchema) ? fieldSchema : [fieldSchema];
  17299. paredFieldsSchema[field] = fieldSchemaList.map(addFullField.bind(null, field));
  17300. });
  17301. var schema = new Schema2(paredFieldsSchema);
  17302. schema.messages(options.messages);
  17303. if (data2.rule.options) {
  17304. data2.rule.options.messages = options.messages;
  17305. data2.rule.options.error = options.error;
  17306. }
  17307. schema.validate(data2.value, data2.rule.options || options, function(errs) {
  17308. var finalErrors = [];
  17309. if (filledErrors && filledErrors.length) {
  17310. finalErrors.push.apply(finalErrors, filledErrors);
  17311. }
  17312. if (errs && errs.length) {
  17313. finalErrors.push.apply(finalErrors, errs);
  17314. }
  17315. doIt(finalErrors.length ? finalErrors : null);
  17316. });
  17317. }
  17318. }
  17319. var res;
  17320. if (rule.asyncValidator) {
  17321. res = rule.asyncValidator(rule, data2.value, cb, data2.source, options);
  17322. } else if (rule.validator) {
  17323. try {
  17324. res = rule.validator(rule, data2.value, cb, data2.source, options);
  17325. } catch (error) {
  17326. console.error == null ? void 0 : console.error(error);
  17327. if (!options.suppressValidatorError) {
  17328. setTimeout(function() {
  17329. throw error;
  17330. }, 0);
  17331. }
  17332. cb(error.message);
  17333. }
  17334. if (res === true) {
  17335. cb();
  17336. } else if (res === false) {
  17337. cb(typeof rule.message === "function" ? rule.message(rule.fullField || rule.field) : rule.message || (rule.fullField || rule.field) + " fails");
  17338. } else if (res instanceof Array) {
  17339. cb(res);
  17340. } else if (res instanceof Error) {
  17341. cb(res.message);
  17342. }
  17343. }
  17344. if (res && res.then) {
  17345. res.then(function() {
  17346. return cb();
  17347. }, function(e) {
  17348. return cb(e);
  17349. });
  17350. }
  17351. }, function(results) {
  17352. complete(results);
  17353. }, source);
  17354. };
  17355. _proto.getType = function getType(rule) {
  17356. if (rule.type === void 0 && rule.pattern instanceof RegExp) {
  17357. rule.type = "pattern";
  17358. }
  17359. if (typeof rule.validator !== "function" && rule.type && !validators.hasOwnProperty(rule.type)) {
  17360. throw new Error(format("Unknown rule type %s", rule.type));
  17361. }
  17362. return rule.type || "string";
  17363. };
  17364. _proto.getValidationMethod = function getValidationMethod(rule) {
  17365. if (typeof rule.validator === "function") {
  17366. return rule.validator;
  17367. }
  17368. var keys2 = Object.keys(rule);
  17369. var messageIndex = keys2.indexOf("message");
  17370. if (messageIndex !== -1) {
  17371. keys2.splice(messageIndex, 1);
  17372. }
  17373. if (keys2.length === 1 && keys2[0] === "required") {
  17374. return validators.required;
  17375. }
  17376. return validators[this.getType(rule)] || void 0;
  17377. };
  17378. return Schema2;
  17379. }();
  17380. Schema.register = function register(type4, validator) {
  17381. if (typeof validator !== "function") {
  17382. throw new Error("Cannot register a validator by type, validator is not a function");
  17383. }
  17384. validators[type4] = validator;
  17385. };
  17386. Schema.warning = warning;
  17387. Schema.messages = messages;
  17388. Schema.validators = validators;
  17389. const formItemValidateStates = [
  17390. "",
  17391. "error",
  17392. "validating",
  17393. "success"
  17394. ];
  17395. const formItemProps = buildProps({
  17396. label: String,
  17397. labelWidth: {
  17398. type: [String, Number],
  17399. default: ""
  17400. },
  17401. prop: {
  17402. type: definePropType([String, Array])
  17403. },
  17404. required: {
  17405. type: Boolean,
  17406. default: void 0
  17407. },
  17408. rules: {
  17409. type: definePropType([Object, Array])
  17410. },
  17411. error: String,
  17412. validateStatus: {
  17413. type: String,
  17414. values: formItemValidateStates
  17415. },
  17416. for: String,
  17417. inlineMessage: {
  17418. type: [String, Boolean],
  17419. default: ""
  17420. },
  17421. showMessage: {
  17422. type: Boolean,
  17423. default: true
  17424. },
  17425. size: {
  17426. type: String,
  17427. values: componentSizes
  17428. }
  17429. });
  17430. const COMPONENT_NAME$2 = "ElLabelWrap";
  17431. var FormLabelWrap = defineComponent({
  17432. name: COMPONENT_NAME$2,
  17433. props: {
  17434. isAutoWidth: Boolean,
  17435. updateAll: Boolean
  17436. },
  17437. setup(props, {
  17438. slots
  17439. }) {
  17440. const formContext = inject(formContextKey, void 0);
  17441. const formItemContext = inject(formItemContextKey);
  17442. if (!formItemContext)
  17443. throwError(COMPONENT_NAME$2, "usage: <el-form-item><label-wrap /></el-form-item>");
  17444. const ns = useNamespace("form");
  17445. const el = ref();
  17446. const computedWidth = ref(0);
  17447. const getLabelWidth = () => {
  17448. var _a2;
  17449. if ((_a2 = el.value) == null ? void 0 : _a2.firstElementChild) {
  17450. const width = window.getComputedStyle(el.value.firstElementChild).width;
  17451. return Math.ceil(Number.parseFloat(width));
  17452. } else {
  17453. return 0;
  17454. }
  17455. };
  17456. const updateLabelWidth = (action = "update") => {
  17457. nextTick(() => {
  17458. if (slots.default && props.isAutoWidth) {
  17459. if (action === "update") {
  17460. computedWidth.value = getLabelWidth();
  17461. } else if (action === "remove") {
  17462. formContext == null ? void 0 : formContext.deregisterLabelWidth(computedWidth.value);
  17463. }
  17464. }
  17465. });
  17466. };
  17467. const updateLabelWidthFn = () => updateLabelWidth("update");
  17468. onMounted(() => {
  17469. updateLabelWidthFn();
  17470. });
  17471. onBeforeUnmount(() => {
  17472. updateLabelWidth("remove");
  17473. });
  17474. onUpdated(() => updateLabelWidthFn());
  17475. watch(computedWidth, (val, oldVal) => {
  17476. if (props.updateAll) {
  17477. formContext == null ? void 0 : formContext.registerLabelWidth(val, oldVal);
  17478. }
  17479. });
  17480. useResizeObserver(computed(() => {
  17481. var _a2, _b2;
  17482. return (_b2 = (_a2 = el.value) == null ? void 0 : _a2.firstElementChild) != null ? _b2 : null;
  17483. }), updateLabelWidthFn);
  17484. return () => {
  17485. var _a2, _b2;
  17486. if (!slots)
  17487. return null;
  17488. const {
  17489. isAutoWidth
  17490. } = props;
  17491. if (isAutoWidth) {
  17492. const autoLabelWidth = formContext == null ? void 0 : formContext.autoLabelWidth;
  17493. const style = {};
  17494. if (autoLabelWidth && autoLabelWidth !== "auto") {
  17495. const marginWidth = Math.max(0, Number.parseInt(autoLabelWidth, 10) - computedWidth.value);
  17496. const marginPosition = formContext.labelPosition === "left" ? "marginRight" : "marginLeft";
  17497. if (marginWidth) {
  17498. style[marginPosition] = `${marginWidth}px`;
  17499. }
  17500. }
  17501. return createVNode("div", {
  17502. "ref": el,
  17503. "class": [ns.be("item", "label-wrap")],
  17504. "style": style
  17505. }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)]);
  17506. } else {
  17507. return createVNode(Fragment, {
  17508. "ref": el
  17509. }, [(_b2 = slots.default) == null ? void 0 : _b2.call(slots)]);
  17510. }
  17511. };
  17512. }
  17513. });
  17514. const _hoisted_1$k = ["for"];
  17515. const __default__$8 = {
  17516. name: "ElFormItem"
  17517. };
  17518. const _sfc_main$u = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$8), {
  17519. props: formItemProps,
  17520. setup(__props, { expose }) {
  17521. const props = __props;
  17522. const slots = useSlots();
  17523. const formContext = inject(formContextKey, void 0);
  17524. const parentFormItemContext = inject(formItemContextKey, void 0);
  17525. const _size = useSize(void 0, { formItem: false });
  17526. const ns = useNamespace("form-item");
  17527. const validateState = ref("");
  17528. const validateStateDebounced = refDebounced(validateState, 100);
  17529. const validateMessage = ref("");
  17530. const formItemRef = ref();
  17531. let initialValue = void 0;
  17532. let isResettingField = false;
  17533. const labelStyle = computed(() => {
  17534. if ((formContext == null ? void 0 : formContext.labelPosition) === "top") {
  17535. return {};
  17536. }
  17537. const labelWidth = addUnit(props.labelWidth || (formContext == null ? void 0 : formContext.labelWidth) || "");
  17538. if (labelWidth)
  17539. return { width: labelWidth };
  17540. return {};
  17541. });
  17542. const contentStyle = computed(() => {
  17543. if ((formContext == null ? void 0 : formContext.labelPosition) === "top" || (formContext == null ? void 0 : formContext.inline)) {
  17544. return {};
  17545. }
  17546. if (!props.label && !props.labelWidth && isNested) {
  17547. return {};
  17548. }
  17549. const labelWidth = addUnit(props.labelWidth || (formContext == null ? void 0 : formContext.labelWidth) || "");
  17550. if (!props.label && !slots.label) {
  17551. return { marginLeft: labelWidth };
  17552. }
  17553. return {};
  17554. });
  17555. const formItemClasses = computed(() => [
  17556. ns.b(),
  17557. ns.m(_size.value),
  17558. ns.is("error", validateState.value === "error"),
  17559. ns.is("validating", validateState.value === "validating"),
  17560. ns.is("success", validateState.value === "success"),
  17561. ns.is("required", isRequired.value || props.required),
  17562. ns.is("no-asterisk", formContext == null ? void 0 : formContext.hideRequiredAsterisk),
  17563. { [ns.m("feedback")]: formContext == null ? void 0 : formContext.statusIcon }
  17564. ]);
  17565. const _inlineMessage = computed(() => isBoolean(props.inlineMessage) ? props.inlineMessage : (formContext == null ? void 0 : formContext.inlineMessage) || false);
  17566. const validateClasses = computed(() => [
  17567. ns.e("error"),
  17568. { [ns.em("error", "inline")]: _inlineMessage.value }
  17569. ]);
  17570. const propString = computed(() => {
  17571. if (!props.prop)
  17572. return "";
  17573. return isString(props.prop) ? props.prop : props.prop.join(".");
  17574. });
  17575. const labelFor = computed(() => props.for || propString.value);
  17576. const isNested = !!parentFormItemContext;
  17577. const fieldValue = computed(() => {
  17578. const model = formContext == null ? void 0 : formContext.model;
  17579. if (!model || !props.prop) {
  17580. return;
  17581. }
  17582. return getProp(model, props.prop).value;
  17583. });
  17584. const _rules = computed(() => {
  17585. const rules2 = props.rules ? castArray$1(props.rules) : [];
  17586. const formRules = formContext == null ? void 0 : formContext.rules;
  17587. if (formRules && props.prop) {
  17588. const _rules2 = getProp(formRules, props.prop).value;
  17589. if (_rules2) {
  17590. rules2.push(...castArray$1(_rules2));
  17591. }
  17592. }
  17593. if (props.required !== void 0) {
  17594. rules2.push({ required: !!props.required });
  17595. }
  17596. return rules2;
  17597. });
  17598. const validateEnabled = computed(() => _rules.value.length > 0);
  17599. const getFilteredRule = (trigger) => {
  17600. const rules2 = _rules.value;
  17601. return rules2.filter((rule) => {
  17602. if (!rule.trigger || !trigger)
  17603. return true;
  17604. if (Array.isArray(rule.trigger)) {
  17605. return rule.trigger.includes(trigger);
  17606. } else {
  17607. return rule.trigger === trigger;
  17608. }
  17609. }).map((_a2) => {
  17610. var _b2 = _a2, { trigger: trigger2 } = _b2, rule = __objRest(_b2, ["trigger"]);
  17611. return rule;
  17612. });
  17613. };
  17614. const isRequired = computed(() => _rules.value.some((rule) => rule.required === true));
  17615. const shouldShowError = computed(() => {
  17616. var _a2;
  17617. return validateStateDebounced.value === "error" && props.showMessage && ((_a2 = formContext == null ? void 0 : formContext.showMessage) != null ? _a2 : true);
  17618. });
  17619. const currentLabel = computed(() => `${props.label || ""}${(formContext == null ? void 0 : formContext.labelSuffix) || ""}`);
  17620. const setValidationState = (state) => {
  17621. validateState.value = state;
  17622. };
  17623. const onValidationFailed = (error) => {
  17624. var _a2, _b2;
  17625. const { errors, fields } = error;
  17626. if (!errors || !fields) {
  17627. console.error(error);
  17628. }
  17629. setValidationState("error");
  17630. validateMessage.value = errors ? (_b2 = (_a2 = errors == null ? void 0 : errors[0]) == null ? void 0 : _a2.message) != null ? _b2 : `${props.prop} is required` : "";
  17631. formContext == null ? void 0 : formContext.emit("validate", props.prop, false, validateMessage.value);
  17632. };
  17633. const onValidationSucceeded = () => {
  17634. setValidationState("success");
  17635. formContext == null ? void 0 : formContext.emit("validate", props.prop, true, "");
  17636. };
  17637. const doValidate = async (rules2) => {
  17638. const modelName = propString.value;
  17639. const validator = new Schema({
  17640. [modelName]: rules2
  17641. });
  17642. return validator.validate({ [modelName]: fieldValue.value }, { firstFields: true }).then(() => {
  17643. onValidationSucceeded();
  17644. return true;
  17645. }).catch((err) => {
  17646. onValidationFailed(err);
  17647. return Promise.reject(err);
  17648. });
  17649. };
  17650. const validate = async (trigger, callback) => {
  17651. if (isResettingField) {
  17652. isResettingField = false;
  17653. return false;
  17654. }
  17655. const hasCallback = isFunction(callback);
  17656. if (!validateEnabled.value) {
  17657. callback == null ? void 0 : callback(false);
  17658. return false;
  17659. }
  17660. const rules2 = getFilteredRule(trigger);
  17661. if (rules2.length === 0) {
  17662. callback == null ? void 0 : callback(true);
  17663. return true;
  17664. }
  17665. setValidationState("validating");
  17666. return doValidate(rules2).then(() => {
  17667. callback == null ? void 0 : callback(true);
  17668. return true;
  17669. }).catch((err) => {
  17670. const { fields } = err;
  17671. callback == null ? void 0 : callback(false, fields);
  17672. return hasCallback ? false : Promise.reject(fields);
  17673. });
  17674. };
  17675. const clearValidate = () => {
  17676. setValidationState("");
  17677. validateMessage.value = "";
  17678. };
  17679. const resetField = async () => {
  17680. const model = formContext == null ? void 0 : formContext.model;
  17681. if (!model || !props.prop)
  17682. return;
  17683. const computedValue = getProp(model, props.prop);
  17684. if (!isEqual(computedValue.value, initialValue)) {
  17685. isResettingField = true;
  17686. }
  17687. computedValue.value = initialValue;
  17688. await nextTick();
  17689. clearValidate();
  17690. };
  17691. watch(() => props.error, (val) => {
  17692. validateMessage.value = val || "";
  17693. setValidationState(val ? "error" : "");
  17694. }, { immediate: true });
  17695. watch(() => props.validateStatus, (val) => setValidationState(val || ""));
  17696. const context = reactive(__spreadProps(__spreadValues({}, toRefs(props)), {
  17697. $el: formItemRef,
  17698. size: _size,
  17699. validateState,
  17700. resetField,
  17701. clearValidate,
  17702. validate
  17703. }));
  17704. provide(formItemContextKey, context);
  17705. onMounted(() => {
  17706. if (props.prop) {
  17707. formContext == null ? void 0 : formContext.addField(context);
  17708. initialValue = clone(fieldValue.value);
  17709. }
  17710. });
  17711. onBeforeUnmount(() => {
  17712. formContext == null ? void 0 : formContext.removeField(context);
  17713. });
  17714. expose({
  17715. size: _size,
  17716. validateMessage,
  17717. validateState,
  17718. validate,
  17719. clearValidate,
  17720. resetField
  17721. });
  17722. return (_ctx, _cache) => {
  17723. var _a2;
  17724. return openBlock(), createElementBlock("div", {
  17725. ref_key: "formItemRef",
  17726. ref: formItemRef,
  17727. class: normalizeClass(unref(formItemClasses))
  17728. }, [
  17729. createVNode(unref(FormLabelWrap), {
  17730. "is-auto-width": unref(labelStyle).width === "auto",
  17731. "update-all": ((_a2 = unref(formContext)) == null ? void 0 : _a2.labelWidth) === "auto"
  17732. }, {
  17733. default: withCtx(() => [
  17734. _ctx.label || _ctx.$slots.label ? (openBlock(), createElementBlock("label", {
  17735. key: 0,
  17736. for: unref(labelFor),
  17737. class: normalizeClass(unref(ns).e("label")),
  17738. style: normalizeStyle(unref(labelStyle))
  17739. }, [
  17740. renderSlot(_ctx.$slots, "label", { label: unref(currentLabel) }, () => [
  17741. createTextVNode(toDisplayString(unref(currentLabel)), 1)
  17742. ])
  17743. ], 14, _hoisted_1$k)) : createCommentVNode("v-if", true)
  17744. ]),
  17745. _: 3
  17746. }, 8, ["is-auto-width", "update-all"]),
  17747. createElementVNode("div", {
  17748. class: normalizeClass(unref(ns).e("content")),
  17749. style: normalizeStyle(unref(contentStyle))
  17750. }, [
  17751. renderSlot(_ctx.$slots, "default"),
  17752. createVNode(Transition, {
  17753. name: `${unref(ns).namespace.value}-zoom-in-top`
  17754. }, {
  17755. default: withCtx(() => [
  17756. unref(shouldShowError) ? renderSlot(_ctx.$slots, "error", {
  17757. key: 0,
  17758. error: validateMessage.value
  17759. }, () => [
  17760. createElementVNode("div", {
  17761. class: normalizeClass(unref(validateClasses))
  17762. }, toDisplayString(validateMessage.value), 3)
  17763. ]) : createCommentVNode("v-if", true)
  17764. ]),
  17765. _: 3
  17766. }, 8, ["name"])
  17767. ], 6)
  17768. ], 2);
  17769. };
  17770. }
  17771. }));
  17772. var FormItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$u, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/form/src/form-item.vue"]]);
  17773. const ElForm = withInstall(Form, {
  17774. FormItem
  17775. });
  17776. const ElFormItem = withNoopInstall(FormItem);
  17777. const imageViewerProps = buildProps({
  17778. urlList: {
  17779. type: definePropType(Array),
  17780. default: () => mutable([])
  17781. },
  17782. zIndex: {
  17783. type: Number
  17784. },
  17785. initialIndex: {
  17786. type: Number,
  17787. default: 0
  17788. },
  17789. infinite: {
  17790. type: Boolean,
  17791. default: true
  17792. },
  17793. hideOnClickModal: {
  17794. type: Boolean,
  17795. default: false
  17796. },
  17797. teleported: {
  17798. type: Boolean,
  17799. default: false
  17800. }
  17801. });
  17802. const imageViewerEmits = {
  17803. close: () => true,
  17804. switch: (index) => typeof index === "number"
  17805. };
  17806. const _hoisted_1$j = ["src"];
  17807. const __default__$7 = {
  17808. name: "ElImageViewer"
  17809. };
  17810. const _sfc_main$t = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$7), {
  17811. props: imageViewerProps,
  17812. emits: imageViewerEmits,
  17813. setup(__props, { emit }) {
  17814. const props = __props;
  17815. const Mode = {
  17816. CONTAIN: {
  17817. name: "contain",
  17818. icon: markRaw(fullScreen)
  17819. },
  17820. ORIGINAL: {
  17821. name: "original",
  17822. icon: markRaw(scaleToOriginal)
  17823. }
  17824. };
  17825. const mousewheelEventName = isFirefox() ? "DOMMouseScroll" : "mousewheel";
  17826. const { t } = useLocale();
  17827. const ns = useNamespace("image-viewer");
  17828. const { nextZIndex } = useZIndex();
  17829. const wrapper = ref();
  17830. const imgRefs = ref([]);
  17831. const scopeEventListener = effectScope();
  17832. const loading2 = ref(true);
  17833. const index = ref(props.initialIndex);
  17834. const mode = ref(Mode.CONTAIN);
  17835. const transform = ref({
  17836. scale: 1,
  17837. deg: 0,
  17838. offsetX: 0,
  17839. offsetY: 0,
  17840. enableTransition: false
  17841. });
  17842. const isSingle = computed(() => {
  17843. const { urlList } = props;
  17844. return urlList.length <= 1;
  17845. });
  17846. const isFirst = computed(() => {
  17847. return index.value === 0;
  17848. });
  17849. const isLast = computed(() => {
  17850. return index.value === props.urlList.length - 1;
  17851. });
  17852. const currentImg = computed(() => {
  17853. return props.urlList[index.value];
  17854. });
  17855. const imgStyle = computed(() => {
  17856. const { scale, deg, offsetX, offsetY, enableTransition } = transform.value;
  17857. let translateX = offsetX / scale;
  17858. let translateY = offsetY / scale;
  17859. switch (deg % 360) {
  17860. case 90:
  17861. case -270:
  17862. [translateX, translateY] = [translateY, -translateX];
  17863. break;
  17864. case 180:
  17865. case -180:
  17866. [translateX, translateY] = [-translateX, -translateY];
  17867. break;
  17868. case 270:
  17869. case -90:
  17870. [translateX, translateY] = [-translateY, translateX];
  17871. break;
  17872. }
  17873. const style = {
  17874. transform: `scale(${scale}) rotate(${deg}deg) translate(${translateX}px, ${translateY}px)`,
  17875. transition: enableTransition ? "transform .3s" : ""
  17876. };
  17877. if (mode.value.name === Mode.CONTAIN.name) {
  17878. style.maxWidth = style.maxHeight = "100%";
  17879. }
  17880. return style;
  17881. });
  17882. const computedZIndex = computed(() => {
  17883. return isNumber(props.zIndex) ? props.zIndex : nextZIndex();
  17884. });
  17885. function hide2() {
  17886. unregisterEventListener();
  17887. emit("close");
  17888. }
  17889. function registerEventListener() {
  17890. const keydownHandler = throttle((e) => {
  17891. switch (e.code) {
  17892. case EVENT_CODE.esc:
  17893. hide2();
  17894. break;
  17895. case EVENT_CODE.space:
  17896. toggleMode();
  17897. break;
  17898. case EVENT_CODE.left:
  17899. prev();
  17900. break;
  17901. case EVENT_CODE.up:
  17902. handleActions("zoomIn");
  17903. break;
  17904. case EVENT_CODE.right:
  17905. next();
  17906. break;
  17907. case EVENT_CODE.down:
  17908. handleActions("zoomOut");
  17909. break;
  17910. }
  17911. });
  17912. const mousewheelHandler = throttle((e) => {
  17913. const delta = e.wheelDelta ? e.wheelDelta : -e.detail;
  17914. if (delta > 0) {
  17915. handleActions("zoomIn", {
  17916. zoomRate: 1.2,
  17917. enableTransition: false
  17918. });
  17919. } else {
  17920. handleActions("zoomOut", {
  17921. zoomRate: 1.2,
  17922. enableTransition: false
  17923. });
  17924. }
  17925. });
  17926. scopeEventListener.run(() => {
  17927. useEventListener(document, "keydown", keydownHandler);
  17928. useEventListener(document, mousewheelEventName, mousewheelHandler);
  17929. });
  17930. }
  17931. function unregisterEventListener() {
  17932. scopeEventListener.stop();
  17933. }
  17934. function handleImgLoad() {
  17935. loading2.value = false;
  17936. }
  17937. function handleImgError(e) {
  17938. loading2.value = false;
  17939. e.target.alt = t("el.image.error");
  17940. }
  17941. function handleMouseDown(e) {
  17942. if (loading2.value || e.button !== 0 || !wrapper.value)
  17943. return;
  17944. transform.value.enableTransition = false;
  17945. const { offsetX, offsetY } = transform.value;
  17946. const startX = e.pageX;
  17947. const startY = e.pageY;
  17948. const dragHandler = throttle((ev) => {
  17949. transform.value = __spreadProps(__spreadValues({}, transform.value), {
  17950. offsetX: offsetX + ev.pageX - startX,
  17951. offsetY: offsetY + ev.pageY - startY
  17952. });
  17953. });
  17954. const removeMousemove = useEventListener(document, "mousemove", dragHandler);
  17955. useEventListener(document, "mouseup", () => {
  17956. removeMousemove();
  17957. });
  17958. e.preventDefault();
  17959. }
  17960. function reset() {
  17961. transform.value = {
  17962. scale: 1,
  17963. deg: 0,
  17964. offsetX: 0,
  17965. offsetY: 0,
  17966. enableTransition: false
  17967. };
  17968. }
  17969. function toggleMode() {
  17970. if (loading2.value)
  17971. return;
  17972. const modeNames = Object.keys(Mode);
  17973. const modeValues = Object.values(Mode);
  17974. const currentMode = mode.value.name;
  17975. const index2 = modeValues.findIndex((i) => i.name === currentMode);
  17976. const nextIndex = (index2 + 1) % modeNames.length;
  17977. mode.value = Mode[modeNames[nextIndex]];
  17978. reset();
  17979. }
  17980. function prev() {
  17981. if (isFirst.value && !props.infinite)
  17982. return;
  17983. const len = props.urlList.length;
  17984. index.value = (index.value - 1 + len) % len;
  17985. }
  17986. function next() {
  17987. if (isLast.value && !props.infinite)
  17988. return;
  17989. const len = props.urlList.length;
  17990. index.value = (index.value + 1) % len;
  17991. }
  17992. function handleActions(action, options = {}) {
  17993. if (loading2.value)
  17994. return;
  17995. const { zoomRate, rotateDeg, enableTransition } = __spreadValues({
  17996. zoomRate: 1.4,
  17997. rotateDeg: 90,
  17998. enableTransition: true
  17999. }, options);
  18000. switch (action) {
  18001. case "zoomOut":
  18002. if (transform.value.scale > 0.2) {
  18003. transform.value.scale = Number.parseFloat((transform.value.scale / zoomRate).toFixed(3));
  18004. }
  18005. break;
  18006. case "zoomIn":
  18007. if (transform.value.scale < 7) {
  18008. transform.value.scale = Number.parseFloat((transform.value.scale * zoomRate).toFixed(3));
  18009. }
  18010. break;
  18011. case "clockwise":
  18012. transform.value.deg += rotateDeg;
  18013. break;
  18014. case "anticlockwise":
  18015. transform.value.deg -= rotateDeg;
  18016. break;
  18017. }
  18018. transform.value.enableTransition = enableTransition;
  18019. }
  18020. watch(currentImg, () => {
  18021. nextTick(() => {
  18022. const $img = imgRefs.value[0];
  18023. if (!($img == null ? void 0 : $img.complete)) {
  18024. loading2.value = true;
  18025. }
  18026. });
  18027. });
  18028. watch(index, (val) => {
  18029. reset();
  18030. emit("switch", val);
  18031. });
  18032. onMounted(() => {
  18033. var _a2, _b2;
  18034. registerEventListener();
  18035. (_b2 = (_a2 = wrapper.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b2.call(_a2);
  18036. });
  18037. return (_ctx, _cache) => {
  18038. return openBlock(), createBlock(Teleport, {
  18039. to: "body",
  18040. disabled: !_ctx.teleported
  18041. }, [
  18042. createVNode(Transition, {
  18043. name: "viewer-fade",
  18044. appear: ""
  18045. }, {
  18046. default: withCtx(() => [
  18047. createElementVNode("div", {
  18048. ref_key: "wrapper",
  18049. ref: wrapper,
  18050. tabindex: -1,
  18051. class: normalizeClass(unref(ns).e("wrapper")),
  18052. style: normalizeStyle({ zIndex: unref(computedZIndex) })
  18053. }, [
  18054. createElementVNode("div", {
  18055. class: normalizeClass(unref(ns).e("mask")),
  18056. onClick: _cache[0] || (_cache[0] = withModifiers(($event) => _ctx.hideOnClickModal && hide2(), ["self"]))
  18057. }, null, 2),
  18058. createCommentVNode(" CLOSE "),
  18059. createElementVNode("span", {
  18060. class: normalizeClass([unref(ns).e("btn"), unref(ns).e("close")]),
  18061. onClick: hide2
  18062. }, [
  18063. createVNode(unref(ElIcon), null, {
  18064. default: withCtx(() => [
  18065. createVNode(unref(close))
  18066. ]),
  18067. _: 1
  18068. })
  18069. ], 2),
  18070. createCommentVNode(" ARROW "),
  18071. !unref(isSingle) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  18072. createElementVNode("span", {
  18073. class: normalizeClass([
  18074. unref(ns).e("btn"),
  18075. unref(ns).e("prev"),
  18076. unref(ns).is("disabled", !_ctx.infinite && unref(isFirst))
  18077. ]),
  18078. onClick: prev
  18079. }, [
  18080. createVNode(unref(ElIcon), null, {
  18081. default: withCtx(() => [
  18082. createVNode(unref(arrowLeft))
  18083. ]),
  18084. _: 1
  18085. })
  18086. ], 2),
  18087. createElementVNode("span", {
  18088. class: normalizeClass([
  18089. unref(ns).e("btn"),
  18090. unref(ns).e("next"),
  18091. unref(ns).is("disabled", !_ctx.infinite && unref(isLast))
  18092. ]),
  18093. onClick: next
  18094. }, [
  18095. createVNode(unref(ElIcon), null, {
  18096. default: withCtx(() => [
  18097. createVNode(unref(arrowRight))
  18098. ]),
  18099. _: 1
  18100. })
  18101. ], 2)
  18102. ], 64)) : createCommentVNode("v-if", true),
  18103. createCommentVNode(" ACTIONS "),
  18104. createElementVNode("div", {
  18105. class: normalizeClass([unref(ns).e("btn"), unref(ns).e("actions")])
  18106. }, [
  18107. createElementVNode("div", {
  18108. class: normalizeClass(unref(ns).e("actions__inner"))
  18109. }, [
  18110. createVNode(unref(ElIcon), {
  18111. onClick: _cache[1] || (_cache[1] = ($event) => handleActions("zoomOut"))
  18112. }, {
  18113. default: withCtx(() => [
  18114. createVNode(unref(zoomOut))
  18115. ]),
  18116. _: 1
  18117. }),
  18118. createVNode(unref(ElIcon), {
  18119. onClick: _cache[2] || (_cache[2] = ($event) => handleActions("zoomIn"))
  18120. }, {
  18121. default: withCtx(() => [
  18122. createVNode(unref(zoomIn))
  18123. ]),
  18124. _: 1
  18125. }),
  18126. createElementVNode("i", {
  18127. class: normalizeClass(unref(ns).e("actions__divider"))
  18128. }, null, 2),
  18129. createVNode(unref(ElIcon), { onClick: toggleMode }, {
  18130. default: withCtx(() => [
  18131. (openBlock(), createBlock(resolveDynamicComponent(mode.value.icon)))
  18132. ]),
  18133. _: 1
  18134. }),
  18135. createElementVNode("i", {
  18136. class: normalizeClass(unref(ns).e("actions__divider"))
  18137. }, null, 2),
  18138. createVNode(unref(ElIcon), {
  18139. onClick: _cache[3] || (_cache[3] = ($event) => handleActions("anticlockwise"))
  18140. }, {
  18141. default: withCtx(() => [
  18142. createVNode(unref(refreshLeft))
  18143. ]),
  18144. _: 1
  18145. }),
  18146. createVNode(unref(ElIcon), {
  18147. onClick: _cache[4] || (_cache[4] = ($event) => handleActions("clockwise"))
  18148. }, {
  18149. default: withCtx(() => [
  18150. createVNode(unref(refreshRight))
  18151. ]),
  18152. _: 1
  18153. })
  18154. ], 2)
  18155. ], 2),
  18156. createCommentVNode(" CANVAS "),
  18157. createElementVNode("div", {
  18158. class: normalizeClass(unref(ns).e("canvas"))
  18159. }, [
  18160. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.urlList, (url2, i) => {
  18161. return withDirectives((openBlock(), createElementBlock("img", {
  18162. ref_for: true,
  18163. ref: (el) => imgRefs.value[i] = el,
  18164. key: url2,
  18165. src: url2,
  18166. style: normalizeStyle(unref(imgStyle)),
  18167. class: normalizeClass(unref(ns).e("img")),
  18168. onLoad: handleImgLoad,
  18169. onError: handleImgError,
  18170. onMousedown: handleMouseDown
  18171. }, null, 46, _hoisted_1$j)), [
  18172. [vShow, i === index.value]
  18173. ]);
  18174. }), 128))
  18175. ], 2),
  18176. renderSlot(_ctx.$slots, "default")
  18177. ], 6)
  18178. ]),
  18179. _: 3
  18180. })
  18181. ], 8, ["disabled"]);
  18182. };
  18183. }
  18184. }));
  18185. var ImageViewer = /* @__PURE__ */ _export_sfc$1(_sfc_main$t, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/image-viewer/src/image-viewer.vue"]]);
  18186. const ElImageViewer = withInstall(ImageViewer);
  18187. const imageProps = buildProps({
  18188. appendToBody: {
  18189. type: Boolean,
  18190. default: void 0
  18191. },
  18192. hideOnClickModal: {
  18193. type: Boolean,
  18194. default: false
  18195. },
  18196. src: {
  18197. type: String,
  18198. default: ""
  18199. },
  18200. fit: {
  18201. type: String,
  18202. values: ["", "contain", "cover", "fill", "none", "scale-down"],
  18203. default: ""
  18204. },
  18205. lazy: {
  18206. type: Boolean,
  18207. default: false
  18208. },
  18209. scrollContainer: {
  18210. type: definePropType([String, Object])
  18211. },
  18212. previewSrcList: {
  18213. type: definePropType(Array),
  18214. default: () => mutable([])
  18215. },
  18216. previewTeleported: {
  18217. type: Boolean,
  18218. default: false
  18219. },
  18220. zIndex: {
  18221. type: Number
  18222. },
  18223. initialIndex: {
  18224. type: Number,
  18225. default: 0
  18226. },
  18227. infinite: {
  18228. type: Boolean,
  18229. default: true
  18230. }
  18231. });
  18232. const imageEmits = {
  18233. error: (evt) => evt instanceof Event,
  18234. switch: (val) => isNumber(val),
  18235. close: () => true
  18236. };
  18237. const _hoisted_1$i = ["src"];
  18238. const _hoisted_2$g = { key: 0 };
  18239. const __default__$6 = {
  18240. name: "ElImage"
  18241. };
  18242. const _sfc_main$s = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$6), {
  18243. props: imageProps,
  18244. emits: imageEmits,
  18245. setup(__props, { emit }) {
  18246. const props = __props;
  18247. let prevOverflow = "";
  18248. useDeprecated({
  18249. scope: "el-image",
  18250. from: "append-to-body",
  18251. replacement: "preview-teleported",
  18252. version: "2.2.0",
  18253. ref: "https://element-plus.org/en-US/component/image.html#image-attributess"
  18254. }, computed(() => isBoolean(props.appendToBody)));
  18255. const { t } = useLocale();
  18256. const ns = useNamespace("image");
  18257. const attrs = useAttrs();
  18258. const hasLoadError = ref(false);
  18259. const loading2 = ref(true);
  18260. const imgWidth = ref(0);
  18261. const imgHeight = ref(0);
  18262. const showViewer = ref(false);
  18263. const container = ref();
  18264. const _scrollContainer = ref();
  18265. let stopScrollListener;
  18266. let stopWheelListener;
  18267. const containerStyle = computed(() => attrs.value.style);
  18268. const imageStyle = computed(() => {
  18269. const { fit } = props;
  18270. if (isClient && fit) {
  18271. return { objectFit: fit };
  18272. }
  18273. return {};
  18274. });
  18275. const preview = computed(() => {
  18276. const { previewSrcList } = props;
  18277. return Array.isArray(previewSrcList) && previewSrcList.length > 0;
  18278. });
  18279. const teleported = computed(() => {
  18280. return props.appendToBody || props.previewTeleported;
  18281. });
  18282. const imageIndex = computed(() => {
  18283. const { previewSrcList, initialIndex } = props;
  18284. let previewIndex = initialIndex;
  18285. if (initialIndex > previewSrcList.length - 1) {
  18286. previewIndex = 0;
  18287. }
  18288. return previewIndex;
  18289. });
  18290. const loadImage = () => {
  18291. if (!isClient)
  18292. return;
  18293. loading2.value = true;
  18294. hasLoadError.value = false;
  18295. const img = new Image();
  18296. const currentImageSrc = props.src;
  18297. img.addEventListener("load", (e) => {
  18298. if (currentImageSrc !== props.src) {
  18299. return;
  18300. }
  18301. handleLoad(e, img);
  18302. });
  18303. img.addEventListener("error", (e) => {
  18304. if (currentImageSrc !== props.src) {
  18305. return;
  18306. }
  18307. handleError(e);
  18308. });
  18309. Object.entries(attrs.value).forEach(([key, value]) => {
  18310. if (key.toLowerCase() === "onload")
  18311. return;
  18312. img.setAttribute(key, value);
  18313. });
  18314. img.src = currentImageSrc;
  18315. };
  18316. function handleLoad(e, img) {
  18317. imgWidth.value = img.width;
  18318. imgHeight.value = img.height;
  18319. loading2.value = false;
  18320. hasLoadError.value = false;
  18321. }
  18322. function handleError(event) {
  18323. loading2.value = false;
  18324. hasLoadError.value = true;
  18325. emit("error", event);
  18326. }
  18327. function handleLazyLoad() {
  18328. if (isInContainer(container.value, _scrollContainer.value)) {
  18329. loadImage();
  18330. removeLazyLoadListener();
  18331. }
  18332. }
  18333. const lazyLoadHandler = useThrottleFn(handleLazyLoad, 200);
  18334. async function addLazyLoadListener() {
  18335. var _a2;
  18336. if (!isClient)
  18337. return;
  18338. await nextTick();
  18339. const { scrollContainer } = props;
  18340. if (isElement$1(scrollContainer)) {
  18341. _scrollContainer.value = scrollContainer;
  18342. } else if (isString(scrollContainer) && scrollContainer !== "") {
  18343. _scrollContainer.value = (_a2 = document.querySelector(scrollContainer)) != null ? _a2 : void 0;
  18344. } else if (container.value) {
  18345. _scrollContainer.value = getScrollContainer(container.value);
  18346. }
  18347. if (_scrollContainer.value) {
  18348. stopScrollListener = useEventListener(_scrollContainer, "scroll", lazyLoadHandler);
  18349. setTimeout(() => handleLazyLoad(), 100);
  18350. }
  18351. }
  18352. function removeLazyLoadListener() {
  18353. if (!isClient || !_scrollContainer.value || !lazyLoadHandler)
  18354. return;
  18355. stopScrollListener();
  18356. _scrollContainer.value = void 0;
  18357. }
  18358. function wheelHandler(e) {
  18359. if (!e.ctrlKey)
  18360. return;
  18361. if (e.deltaY < 0) {
  18362. e.preventDefault();
  18363. return false;
  18364. } else if (e.deltaY > 0) {
  18365. e.preventDefault();
  18366. return false;
  18367. }
  18368. }
  18369. function clickHandler() {
  18370. if (!preview.value)
  18371. return;
  18372. stopWheelListener = useEventListener("wheel", wheelHandler, {
  18373. passive: false
  18374. });
  18375. prevOverflow = document.body.style.overflow;
  18376. document.body.style.overflow = "hidden";
  18377. showViewer.value = true;
  18378. }
  18379. function closeViewer() {
  18380. stopWheelListener == null ? void 0 : stopWheelListener();
  18381. document.body.style.overflow = prevOverflow;
  18382. showViewer.value = false;
  18383. emit("close");
  18384. }
  18385. function switchViewer(val) {
  18386. emit("switch", val);
  18387. }
  18388. watch(() => props.src, () => {
  18389. if (props.lazy) {
  18390. loading2.value = true;
  18391. hasLoadError.value = false;
  18392. removeLazyLoadListener();
  18393. addLazyLoadListener();
  18394. } else {
  18395. loadImage();
  18396. }
  18397. });
  18398. onMounted(() => {
  18399. if (props.lazy) {
  18400. addLazyLoadListener();
  18401. } else {
  18402. loadImage();
  18403. }
  18404. });
  18405. return (_ctx, _cache) => {
  18406. return openBlock(), createElementBlock("div", {
  18407. ref_key: "container",
  18408. ref: container,
  18409. class: normalizeClass([unref(ns).b(), _ctx.$attrs.class]),
  18410. style: normalizeStyle(unref(containerStyle))
  18411. }, [
  18412. loading2.value ? renderSlot(_ctx.$slots, "placeholder", { key: 0 }, () => [
  18413. createElementVNode("div", {
  18414. class: normalizeClass(unref(ns).e("placeholder"))
  18415. }, null, 2)
  18416. ]) : hasLoadError.value ? renderSlot(_ctx.$slots, "error", { key: 1 }, () => [
  18417. createElementVNode("div", {
  18418. class: normalizeClass(unref(ns).e("error"))
  18419. }, toDisplayString(unref(t)("el.image.error")), 3)
  18420. ]) : (openBlock(), createElementBlock("img", mergeProps({ key: 2 }, unref(attrs), {
  18421. src: _ctx.src,
  18422. style: unref(imageStyle),
  18423. class: [unref(ns).e("inner"), unref(preview) ? unref(ns).e("preview") : ""],
  18424. onClick: clickHandler
  18425. }), null, 16, _hoisted_1$i)),
  18426. unref(preview) ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
  18427. showViewer.value ? (openBlock(), createBlock(unref(ElImageViewer), {
  18428. key: 0,
  18429. "z-index": _ctx.zIndex,
  18430. "initial-index": unref(imageIndex),
  18431. infinite: _ctx.infinite,
  18432. "url-list": _ctx.previewSrcList,
  18433. "hide-on-click-modal": _ctx.hideOnClickModal,
  18434. teleported: unref(teleported),
  18435. onClose: closeViewer,
  18436. onSwitch: switchViewer
  18437. }, {
  18438. default: withCtx(() => [
  18439. _ctx.$slots.viewer ? (openBlock(), createElementBlock("div", _hoisted_2$g, [
  18440. renderSlot(_ctx.$slots, "viewer")
  18441. ])) : createCommentVNode("v-if", true)
  18442. ]),
  18443. _: 3
  18444. }, 8, ["z-index", "initial-index", "infinite", "url-list", "hide-on-click-modal", "teleported"])) : createCommentVNode("v-if", true)
  18445. ], 2112)) : createCommentVNode("v-if", true)
  18446. ], 6);
  18447. };
  18448. }
  18449. }));
  18450. var Image$1 = /* @__PURE__ */ _export_sfc$1(_sfc_main$s, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/image/src/image.vue"]]);
  18451. const ElImage = withInstall(Image$1);
  18452. const inputNumberProps = buildProps({
  18453. step: {
  18454. type: Number,
  18455. default: 1
  18456. },
  18457. stepStrictly: {
  18458. type: Boolean,
  18459. default: false
  18460. },
  18461. max: {
  18462. type: Number,
  18463. default: Number.POSITIVE_INFINITY
  18464. },
  18465. min: {
  18466. type: Number,
  18467. default: Number.NEGATIVE_INFINITY
  18468. },
  18469. modelValue: {
  18470. type: Number
  18471. },
  18472. disabled: {
  18473. type: Boolean,
  18474. default: false
  18475. },
  18476. size: {
  18477. type: String,
  18478. values: componentSizes
  18479. },
  18480. controls: {
  18481. type: Boolean,
  18482. default: true
  18483. },
  18484. controlsPosition: {
  18485. type: String,
  18486. default: "",
  18487. values: ["", "right"]
  18488. },
  18489. name: String,
  18490. label: String,
  18491. placeholder: String,
  18492. precision: {
  18493. type: Number,
  18494. validator: (val) => val >= 0 && val === Number.parseInt(`${val}`, 10)
  18495. }
  18496. });
  18497. const inputNumberEmits = {
  18498. change: (prev, cur) => prev !== cur,
  18499. blur: (e) => e instanceof FocusEvent,
  18500. focus: (e) => e instanceof FocusEvent,
  18501. input: (val) => isNumber(val),
  18502. "update:modelValue": (val) => isNumber(val) || val === void 0
  18503. };
  18504. const _sfc_main$r = defineComponent({
  18505. name: "ElInputNumber",
  18506. components: {
  18507. ElInput,
  18508. ElIcon,
  18509. ArrowUp: arrowUp,
  18510. ArrowDown: arrowDown,
  18511. Plus: plus,
  18512. Minus: minus
  18513. },
  18514. directives: {
  18515. RepeatClick
  18516. },
  18517. props: inputNumberProps,
  18518. emits: inputNumberEmits,
  18519. setup(props, { emit }) {
  18520. const input = ref();
  18521. const data2 = reactive({
  18522. currentValue: props.modelValue,
  18523. userInput: null
  18524. });
  18525. const { formItem } = useFormItem();
  18526. const ns = useNamespace("input-number");
  18527. const minDisabled = computed(() => ensurePrecision(props.modelValue, -1) < props.min);
  18528. const maxDisabled = computed(() => ensurePrecision(props.modelValue) > props.max);
  18529. const numPrecision = computed(() => {
  18530. const stepPrecision = getPrecision(props.step);
  18531. if (!isUndefined(props.precision)) {
  18532. if (stepPrecision > props.precision)
  18533. ;
  18534. return props.precision;
  18535. } else {
  18536. return Math.max(getPrecision(props.modelValue), stepPrecision);
  18537. }
  18538. });
  18539. const controlsAtRight = computed(() => {
  18540. return props.controls && props.controlsPosition === "right";
  18541. });
  18542. const inputNumberSize = useSize();
  18543. const inputNumberDisabled = useDisabled$1();
  18544. const displayValue = computed(() => {
  18545. if (data2.userInput !== null) {
  18546. return data2.userInput;
  18547. }
  18548. let currentValue = data2.currentValue;
  18549. if (isNumber(currentValue)) {
  18550. if (Number.isNaN(currentValue))
  18551. return "";
  18552. if (!isUndefined(props.precision)) {
  18553. currentValue = currentValue.toFixed(props.precision);
  18554. }
  18555. }
  18556. return currentValue;
  18557. });
  18558. const toPrecision = (num, pre) => {
  18559. if (isUndefined(pre))
  18560. pre = numPrecision.value;
  18561. return Number.parseFloat(`${Math.round(num * 10 ** pre) / 10 ** pre}`);
  18562. };
  18563. const getPrecision = (value) => {
  18564. if (isUndefined(value))
  18565. return 0;
  18566. const valueString = value.toString();
  18567. const dotPosition = valueString.indexOf(".");
  18568. let precision = 0;
  18569. if (dotPosition !== -1) {
  18570. precision = valueString.length - dotPosition - 1;
  18571. }
  18572. return precision;
  18573. };
  18574. const ensurePrecision = (val, coefficient = 1) => {
  18575. if (!isNumber(val))
  18576. return data2.currentValue;
  18577. val = isNumber(val) ? val : Number.NaN;
  18578. return toPrecision(val + props.step * coefficient);
  18579. };
  18580. const increase = () => {
  18581. if (inputNumberDisabled.value || maxDisabled.value)
  18582. return;
  18583. const value = props.modelValue || 0;
  18584. const newVal = ensurePrecision(value);
  18585. setCurrentValue(newVal);
  18586. };
  18587. const decrease = () => {
  18588. if (inputNumberDisabled.value || minDisabled.value)
  18589. return;
  18590. const value = props.modelValue || 0;
  18591. const newVal = ensurePrecision(value, -1);
  18592. setCurrentValue(newVal);
  18593. };
  18594. const verifyValue = (value, update) => {
  18595. const { max: max2, min: min2, step, precision, stepStrictly } = props;
  18596. let newVal = Number(value);
  18597. if (value === null) {
  18598. newVal = Number.NaN;
  18599. }
  18600. if (!Number.isNaN(newVal)) {
  18601. if (stepStrictly) {
  18602. newVal = Math.round(newVal / step) * step;
  18603. }
  18604. if (!isUndefined(precision)) {
  18605. newVal = toPrecision(newVal, precision);
  18606. }
  18607. if (newVal > max2 || newVal < min2) {
  18608. newVal = newVal > max2 ? max2 : min2;
  18609. update && emit("update:modelValue", newVal);
  18610. }
  18611. }
  18612. return newVal;
  18613. };
  18614. const setCurrentValue = (value) => {
  18615. var _a2;
  18616. const oldVal = data2.currentValue;
  18617. let newVal = verifyValue(value);
  18618. if (oldVal === newVal)
  18619. return;
  18620. if (Number.isNaN(newVal)) {
  18621. newVal = void 0;
  18622. }
  18623. data2.userInput = null;
  18624. emit("update:modelValue", newVal);
  18625. emit("input", newVal);
  18626. emit("change", newVal, oldVal);
  18627. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "change").catch((err) => debugWarn());
  18628. data2.currentValue = newVal;
  18629. };
  18630. const handleInput = (value) => {
  18631. return data2.userInput = value;
  18632. };
  18633. const handleInputChange = (value) => {
  18634. const newVal = value !== "" ? Number(value) : "";
  18635. if (isNumber(newVal) && !Number.isNaN(newVal) || value === "") {
  18636. setCurrentValue(newVal);
  18637. }
  18638. data2.userInput = null;
  18639. };
  18640. const focus = () => {
  18641. var _a2, _b2;
  18642. (_b2 = (_a2 = input.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b2.call(_a2);
  18643. };
  18644. const blur = () => {
  18645. var _a2, _b2;
  18646. (_b2 = (_a2 = input.value) == null ? void 0 : _a2.blur) == null ? void 0 : _b2.call(_a2);
  18647. };
  18648. const handleFocus = (event) => {
  18649. emit("focus", event);
  18650. };
  18651. const handleBlur = (event) => {
  18652. var _a2;
  18653. emit("blur", event);
  18654. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "blur").catch((err) => debugWarn());
  18655. };
  18656. watch(() => props.modelValue, (value) => {
  18657. const newVal = verifyValue(value, true);
  18658. data2.currentValue = newVal;
  18659. data2.userInput = null;
  18660. }, { immediate: true });
  18661. onMounted(() => {
  18662. var _a2;
  18663. const innerInput = (_a2 = input.value) == null ? void 0 : _a2.input;
  18664. innerInput.setAttribute("role", "spinbutton");
  18665. innerInput.setAttribute("aria-valuemax", String(props.max));
  18666. innerInput.setAttribute("aria-valuemin", String(props.min));
  18667. innerInput.setAttribute("aria-valuenow", String(data2.currentValue));
  18668. innerInput.setAttribute("aria-disabled", String(inputNumberDisabled.value));
  18669. if (!isNumber(props.modelValue)) {
  18670. let val = Number(props.modelValue);
  18671. if (Number.isNaN(val)) {
  18672. val = void 0;
  18673. }
  18674. emit("update:modelValue", val);
  18675. }
  18676. });
  18677. onUpdated(() => {
  18678. var _a2;
  18679. const innerInput = (_a2 = input.value) == null ? void 0 : _a2.input;
  18680. innerInput == null ? void 0 : innerInput.setAttribute("aria-valuenow", data2.currentValue);
  18681. });
  18682. return {
  18683. input,
  18684. displayValue,
  18685. handleInput,
  18686. handleInputChange,
  18687. controlsAtRight,
  18688. decrease,
  18689. increase,
  18690. inputNumberSize,
  18691. inputNumberDisabled,
  18692. maxDisabled,
  18693. minDisabled,
  18694. focus,
  18695. blur,
  18696. handleFocus,
  18697. handleBlur,
  18698. ns
  18699. };
  18700. }
  18701. });
  18702. function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
  18703. const _component_arrow_down = resolveComponent("arrow-down");
  18704. const _component_minus = resolveComponent("minus");
  18705. const _component_el_icon = resolveComponent("el-icon");
  18706. const _component_arrow_up = resolveComponent("arrow-up");
  18707. const _component_plus = resolveComponent("plus");
  18708. const _component_el_input = resolveComponent("el-input");
  18709. const _directive_repeat_click = resolveDirective("repeat-click");
  18710. return openBlock(), createElementBlock("div", {
  18711. class: normalizeClass([
  18712. _ctx.ns.b(),
  18713. _ctx.ns.m(_ctx.inputNumberSize),
  18714. _ctx.ns.is("disabled", _ctx.inputNumberDisabled),
  18715. _ctx.ns.is("without-controls", !_ctx.controls),
  18716. _ctx.ns.is("controls-right", _ctx.controlsAtRight)
  18717. ]),
  18718. onDragstart: _cache[2] || (_cache[2] = withModifiers(() => {
  18719. }, ["prevent"]))
  18720. }, [
  18721. _ctx.controls ? withDirectives((openBlock(), createElementBlock("span", {
  18722. key: 0,
  18723. role: "button",
  18724. class: normalizeClass([_ctx.ns.e("decrease"), _ctx.ns.is("disabled", _ctx.minDisabled)]),
  18725. onKeydown: _cache[0] || (_cache[0] = withKeys((...args) => _ctx.decrease && _ctx.decrease(...args), ["enter"]))
  18726. }, [
  18727. createVNode(_component_el_icon, null, {
  18728. default: withCtx(() => [
  18729. _ctx.controlsAtRight ? (openBlock(), createBlock(_component_arrow_down, { key: 0 })) : (openBlock(), createBlock(_component_minus, { key: 1 }))
  18730. ]),
  18731. _: 1
  18732. })
  18733. ], 34)), [
  18734. [_directive_repeat_click, _ctx.decrease]
  18735. ]) : createCommentVNode("v-if", true),
  18736. _ctx.controls ? withDirectives((openBlock(), createElementBlock("span", {
  18737. key: 1,
  18738. role: "button",
  18739. class: normalizeClass([_ctx.ns.e("increase"), _ctx.ns.is("disabled", _ctx.maxDisabled)]),
  18740. onKeydown: _cache[1] || (_cache[1] = withKeys((...args) => _ctx.increase && _ctx.increase(...args), ["enter"]))
  18741. }, [
  18742. createVNode(_component_el_icon, null, {
  18743. default: withCtx(() => [
  18744. _ctx.controlsAtRight ? (openBlock(), createBlock(_component_arrow_up, { key: 0 })) : (openBlock(), createBlock(_component_plus, { key: 1 }))
  18745. ]),
  18746. _: 1
  18747. })
  18748. ], 34)), [
  18749. [_directive_repeat_click, _ctx.increase]
  18750. ]) : createCommentVNode("v-if", true),
  18751. createVNode(_component_el_input, {
  18752. ref: "input",
  18753. type: "number",
  18754. step: _ctx.step,
  18755. "model-value": _ctx.displayValue,
  18756. placeholder: _ctx.placeholder,
  18757. disabled: _ctx.inputNumberDisabled,
  18758. size: _ctx.inputNumberSize,
  18759. max: _ctx.max,
  18760. min: _ctx.min,
  18761. name: _ctx.name,
  18762. label: _ctx.label,
  18763. "validate-event": false,
  18764. onKeydown: [
  18765. withKeys(withModifiers(_ctx.increase, ["prevent"]), ["up"]),
  18766. withKeys(withModifiers(_ctx.decrease, ["prevent"]), ["down"])
  18767. ],
  18768. onBlur: _ctx.handleBlur,
  18769. onFocus: _ctx.handleFocus,
  18770. onInput: _ctx.handleInput,
  18771. onChange: _ctx.handleInputChange
  18772. }, null, 8, ["step", "model-value", "placeholder", "disabled", "size", "max", "min", "name", "label", "onKeydown", "onBlur", "onFocus", "onInput", "onChange"])
  18773. ], 34);
  18774. }
  18775. var InputNumber = /* @__PURE__ */ _export_sfc$1(_sfc_main$r, [["render", _sfc_render$d], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/input-number/src/input-number.vue"]]);
  18776. const ElInputNumber = withInstall(InputNumber);
  18777. const selectGroupKey = "ElSelectGroup";
  18778. const selectKey = "ElSelect";
  18779. function useOption(props, states) {
  18780. const select = inject(selectKey);
  18781. const selectGroup = inject(selectGroupKey, { disabled: false });
  18782. const isObject2 = computed(() => {
  18783. return Object.prototype.toString.call(props.value).toLowerCase() === "[object object]";
  18784. });
  18785. const itemSelected = computed(() => {
  18786. if (!select.props.multiple) {
  18787. return isEqual2(props.value, select.props.modelValue);
  18788. } else {
  18789. return contains2(select.props.modelValue, props.value);
  18790. }
  18791. });
  18792. const limitReached = computed(() => {
  18793. if (select.props.multiple) {
  18794. const modelValue = select.props.modelValue || [];
  18795. return !itemSelected.value && modelValue.length >= select.props.multipleLimit && select.props.multipleLimit > 0;
  18796. } else {
  18797. return false;
  18798. }
  18799. });
  18800. const currentLabel = computed(() => {
  18801. return props.label || (isObject2.value ? "" : props.value);
  18802. });
  18803. const currentValue = computed(() => {
  18804. return props.value || props.label || "";
  18805. });
  18806. const isDisabled = computed(() => {
  18807. return props.disabled || states.groupDisabled || limitReached.value;
  18808. });
  18809. const instance = getCurrentInstance();
  18810. const contains2 = (arr = [], target) => {
  18811. if (!isObject2.value) {
  18812. return arr && arr.includes(target);
  18813. } else {
  18814. const valueKey = select.props.valueKey;
  18815. return arr && arr.some((item) => {
  18816. return get(item, valueKey) === get(target, valueKey);
  18817. });
  18818. }
  18819. };
  18820. const isEqual2 = (a2, b2) => {
  18821. if (!isObject2.value) {
  18822. return a2 === b2;
  18823. } else {
  18824. const { valueKey } = select.props;
  18825. return get(a2, valueKey) === get(b2, valueKey);
  18826. }
  18827. };
  18828. const hoverItem = () => {
  18829. if (!props.disabled && !selectGroup.disabled) {
  18830. select.hoverIndex = select.optionsArray.indexOf(instance.proxy);
  18831. }
  18832. };
  18833. watch(() => currentLabel.value, () => {
  18834. if (!props.created && !select.props.remote)
  18835. select.setSelected();
  18836. });
  18837. watch(() => props.value, (val, oldVal) => {
  18838. const { remote, valueKey } = select.props;
  18839. if (!props.created && !remote) {
  18840. if (valueKey && typeof val === "object" && typeof oldVal === "object" && val[valueKey] === oldVal[valueKey]) {
  18841. return;
  18842. }
  18843. select.setSelected();
  18844. }
  18845. });
  18846. watch(() => selectGroup.disabled, () => {
  18847. states.groupDisabled = selectGroup.disabled;
  18848. }, { immediate: true });
  18849. const { queryChange } = toRaw(select);
  18850. watch(queryChange, (changes) => {
  18851. const { query } = unref(changes);
  18852. const regexp4 = new RegExp(escapeStringRegexp(query), "i");
  18853. states.visible = regexp4.test(currentLabel.value) || props.created;
  18854. if (!states.visible) {
  18855. select.filteredOptionsCount--;
  18856. }
  18857. });
  18858. return {
  18859. select,
  18860. currentLabel,
  18861. currentValue,
  18862. itemSelected,
  18863. isDisabled,
  18864. hoverItem
  18865. };
  18866. }
  18867. const _sfc_main$q = defineComponent({
  18868. name: "ElOption",
  18869. componentName: "ElOption",
  18870. props: {
  18871. value: {
  18872. required: true,
  18873. type: [String, Number, Boolean, Object]
  18874. },
  18875. label: [String, Number],
  18876. created: Boolean,
  18877. disabled: {
  18878. type: Boolean,
  18879. default: false
  18880. }
  18881. },
  18882. setup(props) {
  18883. const ns = useNamespace("select");
  18884. const states = reactive({
  18885. index: -1,
  18886. groupDisabled: false,
  18887. visible: true,
  18888. hitState: false,
  18889. hover: false
  18890. });
  18891. const { currentLabel, itemSelected, isDisabled, select, hoverItem } = useOption(props, states);
  18892. const { visible, hover } = toRefs(states);
  18893. const vm = getCurrentInstance().proxy;
  18894. const key = vm.value;
  18895. select.onOptionCreate(vm);
  18896. onBeforeUnmount(() => {
  18897. const { selected } = select;
  18898. const selectedOptions = select.props.multiple ? selected : [selected];
  18899. const doesSelected = selectedOptions.some((item) => {
  18900. return item.value === vm.value;
  18901. });
  18902. if (select.cachedOptions.get(key) === vm && !doesSelected) {
  18903. nextTick(() => {
  18904. select.cachedOptions.delete(key);
  18905. });
  18906. }
  18907. select.onOptionDestroy(key, vm);
  18908. });
  18909. function selectOptionClick() {
  18910. if (props.disabled !== true && states.groupDisabled !== true) {
  18911. select.handleOptionSelect(vm, true);
  18912. }
  18913. }
  18914. return {
  18915. ns,
  18916. currentLabel,
  18917. itemSelected,
  18918. isDisabled,
  18919. select,
  18920. hoverItem,
  18921. visible,
  18922. hover,
  18923. selectOptionClick,
  18924. states
  18925. };
  18926. }
  18927. });
  18928. function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
  18929. return withDirectives((openBlock(), createElementBlock("li", {
  18930. class: normalizeClass([
  18931. _ctx.ns.be("dropdown", "item"),
  18932. _ctx.ns.is("disabled", _ctx.isDisabled),
  18933. {
  18934. selected: _ctx.itemSelected,
  18935. hover: _ctx.hover
  18936. }
  18937. ]),
  18938. onMouseenter: _cache[0] || (_cache[0] = (...args) => _ctx.hoverItem && _ctx.hoverItem(...args)),
  18939. onClick: _cache[1] || (_cache[1] = withModifiers((...args) => _ctx.selectOptionClick && _ctx.selectOptionClick(...args), ["stop"]))
  18940. }, [
  18941. renderSlot(_ctx.$slots, "default", {}, () => [
  18942. createElementVNode("span", null, toDisplayString(_ctx.currentLabel), 1)
  18943. ])
  18944. ], 34)), [
  18945. [vShow, _ctx.visible]
  18946. ]);
  18947. }
  18948. var Option = /* @__PURE__ */ _export_sfc$1(_sfc_main$q, [["render", _sfc_render$c], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/select/src/option.vue"]]);
  18949. const _sfc_main$p = defineComponent({
  18950. name: "ElSelectDropdown",
  18951. componentName: "ElSelectDropdown",
  18952. setup() {
  18953. const select = inject(selectKey);
  18954. const ns = useNamespace("select");
  18955. const popperClass = computed(() => select.props.popperClass);
  18956. const isMultiple = computed(() => select.props.multiple);
  18957. const isFitInputWidth = computed(() => select.props.fitInputWidth);
  18958. const minWidth = ref("");
  18959. function updateMinWidth() {
  18960. var _a2;
  18961. minWidth.value = `${(_a2 = select.selectWrapper) == null ? void 0 : _a2.getBoundingClientRect().width}px`;
  18962. }
  18963. onMounted(() => {
  18964. updateMinWidth();
  18965. addResizeListener(select.selectWrapper, updateMinWidth);
  18966. });
  18967. onBeforeUnmount(() => {
  18968. removeResizeListener(select.selectWrapper, updateMinWidth);
  18969. });
  18970. return {
  18971. ns,
  18972. minWidth,
  18973. popperClass,
  18974. isMultiple,
  18975. isFitInputWidth
  18976. };
  18977. }
  18978. });
  18979. function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
  18980. return openBlock(), createElementBlock("div", {
  18981. class: normalizeClass([_ctx.ns.b("dropdown"), _ctx.ns.is("multiple", _ctx.isMultiple), _ctx.popperClass]),
  18982. style: normalizeStyle({ [_ctx.isFitInputWidth ? "width" : "minWidth"]: _ctx.minWidth })
  18983. }, [
  18984. renderSlot(_ctx.$slots, "default")
  18985. ], 6);
  18986. }
  18987. var ElSelectMenu = /* @__PURE__ */ _export_sfc$1(_sfc_main$p, [["render", _sfc_render$b], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/select/src/select-dropdown.vue"]]);
  18988. function useSelectStates(props) {
  18989. const { t } = useLocale();
  18990. return reactive({
  18991. options: /* @__PURE__ */ new Map(),
  18992. cachedOptions: /* @__PURE__ */ new Map(),
  18993. createdLabel: null,
  18994. createdSelected: false,
  18995. selected: props.multiple ? [] : {},
  18996. inputLength: 20,
  18997. inputWidth: 0,
  18998. initialInputHeight: 0,
  18999. optionsCount: 0,
  19000. filteredOptionsCount: 0,
  19001. visible: false,
  19002. softFocus: false,
  19003. selectedLabel: "",
  19004. hoverIndex: -1,
  19005. query: "",
  19006. previousQuery: null,
  19007. inputHovering: false,
  19008. cachedPlaceHolder: "",
  19009. currentPlaceholder: t("el.select.placeholder"),
  19010. menuVisibleOnFocus: false,
  19011. isOnComposition: false,
  19012. isSilentBlur: false,
  19013. prefixWidth: 11,
  19014. tagInMultiLine: false
  19015. });
  19016. }
  19017. const useSelect = (props, states, ctx) => {
  19018. const { t } = useLocale();
  19019. const ns = useNamespace("select");
  19020. const reference2 = ref(null);
  19021. const input = ref(null);
  19022. const tooltipRef = ref(null);
  19023. const tags = ref(null);
  19024. const selectWrapper = ref(null);
  19025. const scrollbar = ref(null);
  19026. const hoverOption = ref(-1);
  19027. const queryChange = shallowRef({ query: "" });
  19028. const groupQueryChange = shallowRef("");
  19029. const elForm2 = inject(formContextKey, {});
  19030. const elFormItem2 = inject(formItemContextKey, {});
  19031. const readonly2 = computed(() => !props.filterable || props.multiple || !states.visible);
  19032. const selectDisabled = computed(() => props.disabled || elForm2.disabled);
  19033. const showClose = computed(() => {
  19034. const hasValue = props.multiple ? Array.isArray(props.modelValue) && props.modelValue.length > 0 : props.modelValue !== void 0 && props.modelValue !== null && props.modelValue !== "";
  19035. const criteria = props.clearable && !selectDisabled.value && states.inputHovering && hasValue;
  19036. return criteria;
  19037. });
  19038. const iconComponent = computed(() => props.remote && props.filterable ? "" : props.suffixIcon);
  19039. const iconReverse = computed(() => ns.is("reverse", iconComponent.value && states.visible));
  19040. const debounce$1$1 = computed(() => props.remote ? 300 : 0);
  19041. const emptyText = computed(() => {
  19042. if (props.loading) {
  19043. return props.loadingText || t("el.select.loading");
  19044. } else {
  19045. if (props.remote && states.query === "" && states.options.size === 0)
  19046. return false;
  19047. if (props.filterable && states.query && states.options.size > 0 && states.filteredOptionsCount === 0) {
  19048. return props.noMatchText || t("el.select.noMatch");
  19049. }
  19050. if (states.options.size === 0) {
  19051. return props.noDataText || t("el.select.noData");
  19052. }
  19053. }
  19054. return null;
  19055. });
  19056. const optionsArray = computed(() => Array.from(states.options.values()));
  19057. const cachedOptionsArray = computed(() => Array.from(states.cachedOptions.values()));
  19058. const showNewOption = computed(() => {
  19059. const hasExistingOption = optionsArray.value.filter((option) => {
  19060. return !option.created;
  19061. }).some((option) => {
  19062. return option.currentLabel === states.query;
  19063. });
  19064. return props.filterable && props.allowCreate && states.query !== "" && !hasExistingOption;
  19065. });
  19066. const selectSize = useSize();
  19067. const collapseTagSize = computed(() => ["small"].includes(selectSize.value) ? "small" : "default");
  19068. const dropMenuVisible = computed({
  19069. get() {
  19070. return states.visible && emptyText.value !== false;
  19071. },
  19072. set(val) {
  19073. states.visible = val;
  19074. }
  19075. });
  19076. watch(() => selectDisabled.value, () => {
  19077. nextTick(() => {
  19078. resetInputHeight();
  19079. });
  19080. });
  19081. watch(() => props.placeholder, (val) => {
  19082. states.cachedPlaceHolder = states.currentPlaceholder = val;
  19083. });
  19084. watch(() => props.modelValue, (val, oldVal) => {
  19085. var _a2;
  19086. if (props.multiple) {
  19087. resetInputHeight();
  19088. if (val && val.length > 0 || input.value && states.query !== "") {
  19089. states.currentPlaceholder = "";
  19090. } else {
  19091. states.currentPlaceholder = states.cachedPlaceHolder;
  19092. }
  19093. if (props.filterable && !props.reserveKeyword) {
  19094. states.query = "";
  19095. handleQueryChange(states.query);
  19096. }
  19097. }
  19098. setSelected();
  19099. if (props.filterable && !props.multiple) {
  19100. states.inputLength = 20;
  19101. }
  19102. if (!isEqual(val, oldVal)) {
  19103. (_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "change").catch((err) => debugWarn());
  19104. }
  19105. }, {
  19106. flush: "post",
  19107. deep: true
  19108. });
  19109. watch(() => states.visible, (val) => {
  19110. var _a2, _b2, _c;
  19111. if (!val) {
  19112. input.value && input.value.blur();
  19113. states.query = "";
  19114. states.previousQuery = null;
  19115. states.selectedLabel = "";
  19116. states.inputLength = 20;
  19117. states.menuVisibleOnFocus = false;
  19118. resetHoverIndex();
  19119. nextTick(() => {
  19120. if (input.value && input.value.value === "" && states.selected.length === 0) {
  19121. states.currentPlaceholder = states.cachedPlaceHolder;
  19122. }
  19123. });
  19124. if (!props.multiple) {
  19125. if (states.selected) {
  19126. if (props.filterable && props.allowCreate && states.createdSelected && states.createdLabel) {
  19127. states.selectedLabel = states.createdLabel;
  19128. } else {
  19129. states.selectedLabel = states.selected.currentLabel;
  19130. }
  19131. if (props.filterable)
  19132. states.query = states.selectedLabel;
  19133. }
  19134. if (props.filterable) {
  19135. states.currentPlaceholder = states.cachedPlaceHolder;
  19136. }
  19137. }
  19138. } else {
  19139. (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
  19140. if (props.filterable) {
  19141. states.filteredOptionsCount = states.optionsCount;
  19142. states.query = props.remote ? "" : states.selectedLabel;
  19143. if (props.multiple) {
  19144. (_c = input.value) == null ? void 0 : _c.focus();
  19145. } else {
  19146. if (states.selectedLabel) {
  19147. states.currentPlaceholder = `${states.selectedLabel}`;
  19148. states.selectedLabel = "";
  19149. }
  19150. }
  19151. handleQueryChange(states.query);
  19152. if (!props.multiple && !props.remote) {
  19153. queryChange.value.query = "";
  19154. triggerRef(queryChange);
  19155. triggerRef(groupQueryChange);
  19156. }
  19157. }
  19158. }
  19159. ctx.emit("visible-change", val);
  19160. });
  19161. watch(() => states.options.entries(), () => {
  19162. var _a2, _b2, _c;
  19163. if (!isClient)
  19164. return;
  19165. (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
  19166. if (props.multiple) {
  19167. resetInputHeight();
  19168. }
  19169. const inputs = ((_c = selectWrapper.value) == null ? void 0 : _c.querySelectorAll("input")) || [];
  19170. if (!Array.from(inputs).includes(document.activeElement)) {
  19171. setSelected();
  19172. }
  19173. if (props.defaultFirstOption && (props.filterable || props.remote) && states.filteredOptionsCount) {
  19174. checkDefaultFirstOption();
  19175. }
  19176. }, {
  19177. flush: "post"
  19178. });
  19179. watch(() => states.hoverIndex, (val) => {
  19180. if (typeof val === "number" && val > -1) {
  19181. hoverOption.value = optionsArray.value[val] || {};
  19182. }
  19183. optionsArray.value.forEach((option) => {
  19184. option.hover = hoverOption.value === option;
  19185. });
  19186. });
  19187. const resetInputHeight = () => {
  19188. if (props.collapseTags && !props.filterable)
  19189. return;
  19190. nextTick(() => {
  19191. var _a2, _b2;
  19192. if (!reference2.value)
  19193. return;
  19194. const input2 = reference2.value.$el.querySelector("input");
  19195. const _tags = tags.value;
  19196. const sizeInMap = states.initialInputHeight || getComponentSize(selectSize.value || elForm2.size);
  19197. input2.style.height = states.selected.length === 0 ? `${sizeInMap}px` : `${Math.max(_tags ? _tags.clientHeight + (_tags.clientHeight > sizeInMap ? 6 : 0) : 0, sizeInMap)}px`;
  19198. states.tagInMultiLine = Number.parseFloat(input2.style.height) >= sizeInMap;
  19199. if (states.visible && emptyText.value !== false) {
  19200. (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
  19201. }
  19202. });
  19203. };
  19204. const handleQueryChange = (val) => {
  19205. if (states.previousQuery === val || states.isOnComposition)
  19206. return;
  19207. if (states.previousQuery === null && (typeof props.filterMethod === "function" || typeof props.remoteMethod === "function")) {
  19208. states.previousQuery = val;
  19209. return;
  19210. }
  19211. states.previousQuery = val;
  19212. nextTick(() => {
  19213. var _a2, _b2;
  19214. if (states.visible)
  19215. (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
  19216. });
  19217. states.hoverIndex = -1;
  19218. if (props.multiple && props.filterable) {
  19219. nextTick(() => {
  19220. const length = input.value.value.length * 15 + 20;
  19221. states.inputLength = props.collapseTags ? Math.min(50, length) : length;
  19222. managePlaceholder();
  19223. resetInputHeight();
  19224. });
  19225. }
  19226. if (props.remote && typeof props.remoteMethod === "function") {
  19227. states.hoverIndex = -1;
  19228. props.remoteMethod(val);
  19229. } else if (typeof props.filterMethod === "function") {
  19230. props.filterMethod(val);
  19231. triggerRef(groupQueryChange);
  19232. } else {
  19233. states.filteredOptionsCount = states.optionsCount;
  19234. queryChange.value.query = val;
  19235. triggerRef(queryChange);
  19236. triggerRef(groupQueryChange);
  19237. }
  19238. if (props.defaultFirstOption && (props.filterable || props.remote) && states.filteredOptionsCount) {
  19239. checkDefaultFirstOption();
  19240. }
  19241. };
  19242. const managePlaceholder = () => {
  19243. if (states.currentPlaceholder !== "") {
  19244. states.currentPlaceholder = input.value.value ? "" : states.cachedPlaceHolder;
  19245. }
  19246. };
  19247. const checkDefaultFirstOption = () => {
  19248. const optionsInDropdown = optionsArray.value.filter((n) => n.visible && !n.disabled && !n.states.groupDisabled);
  19249. const userCreatedOption = optionsInDropdown.find((n) => n.created);
  19250. const firstOriginOption = optionsInDropdown[0];
  19251. states.hoverIndex = getValueIndex(optionsArray.value, userCreatedOption || firstOriginOption);
  19252. };
  19253. const setSelected = () => {
  19254. var _a2;
  19255. if (!props.multiple) {
  19256. const option = getOption(props.modelValue);
  19257. if ((_a2 = option.props) == null ? void 0 : _a2.created) {
  19258. states.createdLabel = option.props.value;
  19259. states.createdSelected = true;
  19260. } else {
  19261. states.createdSelected = false;
  19262. }
  19263. states.selectedLabel = option.currentLabel;
  19264. states.selected = option;
  19265. if (props.filterable)
  19266. states.query = states.selectedLabel;
  19267. return;
  19268. } else {
  19269. states.selectedLabel = "";
  19270. }
  19271. const result = [];
  19272. if (Array.isArray(props.modelValue)) {
  19273. props.modelValue.forEach((value) => {
  19274. result.push(getOption(value));
  19275. });
  19276. }
  19277. states.selected = result;
  19278. nextTick(() => {
  19279. resetInputHeight();
  19280. });
  19281. };
  19282. const getOption = (value) => {
  19283. let option;
  19284. const isObjectValue = toRawType(value).toLowerCase() === "object";
  19285. const isNull = toRawType(value).toLowerCase() === "null";
  19286. const isUndefined2 = toRawType(value).toLowerCase() === "undefined";
  19287. for (let i = states.cachedOptions.size - 1; i >= 0; i--) {
  19288. const cachedOption = cachedOptionsArray.value[i];
  19289. const isEqualValue = isObjectValue ? get(cachedOption, props.valueKey) === get(value, props.valueKey) : cachedOption.value === value;
  19290. if (isEqualValue) {
  19291. option = {
  19292. value,
  19293. currentLabel: cachedOption.currentLabel,
  19294. isDisabled: cachedOption.isDisabled
  19295. };
  19296. break;
  19297. }
  19298. }
  19299. if (option)
  19300. return option;
  19301. const label = isObjectValue ? value.label : !isNull && !isUndefined2 ? value : "";
  19302. const newOption = {
  19303. value,
  19304. currentLabel: label
  19305. };
  19306. if (props.multiple) {
  19307. newOption.hitState = false;
  19308. }
  19309. return newOption;
  19310. };
  19311. const resetHoverIndex = () => {
  19312. setTimeout(() => {
  19313. const valueKey = props.valueKey;
  19314. if (!props.multiple) {
  19315. states.hoverIndex = optionsArray.value.findIndex((item) => {
  19316. return getValueKey(item) === getValueKey(states.selected);
  19317. });
  19318. } else {
  19319. if (states.selected.length > 0) {
  19320. states.hoverIndex = Math.min.apply(null, states.selected.map((selected) => {
  19321. return optionsArray.value.findIndex((item) => {
  19322. return get(item, valueKey) === get(selected, valueKey);
  19323. });
  19324. }));
  19325. } else {
  19326. states.hoverIndex = -1;
  19327. }
  19328. }
  19329. }, 300);
  19330. };
  19331. const handleResize = () => {
  19332. var _a2, _b2;
  19333. resetInputWidth();
  19334. (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
  19335. if (props.multiple && !props.filterable)
  19336. resetInputHeight();
  19337. };
  19338. const resetInputWidth = () => {
  19339. var _a2;
  19340. states.inputWidth = (_a2 = reference2.value) == null ? void 0 : _a2.$el.getBoundingClientRect().width;
  19341. };
  19342. const onInputChange = () => {
  19343. if (props.filterable && states.query !== states.selectedLabel) {
  19344. states.query = states.selectedLabel;
  19345. handleQueryChange(states.query);
  19346. }
  19347. };
  19348. const debouncedOnInputChange = debounce$1(() => {
  19349. onInputChange();
  19350. }, debounce$1$1.value);
  19351. const debouncedQueryChange = debounce$1((e) => {
  19352. handleQueryChange(e.target.value);
  19353. }, debounce$1$1.value);
  19354. const emitChange = (val) => {
  19355. if (!isEqual(props.modelValue, val)) {
  19356. ctx.emit(CHANGE_EVENT, val);
  19357. }
  19358. };
  19359. const deletePrevTag = (e) => {
  19360. if (e.target.value.length <= 0 && !toggleLastOptionHitState()) {
  19361. const value = props.modelValue.slice();
  19362. value.pop();
  19363. ctx.emit(UPDATE_MODEL_EVENT, value);
  19364. emitChange(value);
  19365. }
  19366. if (e.target.value.length === 1 && props.modelValue.length === 0) {
  19367. states.currentPlaceholder = states.cachedPlaceHolder;
  19368. }
  19369. };
  19370. const deleteTag = (event, tag) => {
  19371. const index = states.selected.indexOf(tag);
  19372. if (index > -1 && !selectDisabled.value) {
  19373. const value = props.modelValue.slice();
  19374. value.splice(index, 1);
  19375. ctx.emit(UPDATE_MODEL_EVENT, value);
  19376. emitChange(value);
  19377. ctx.emit("remove-tag", tag.value);
  19378. }
  19379. event.stopPropagation();
  19380. };
  19381. const deleteSelected = (event) => {
  19382. event.stopPropagation();
  19383. const value = props.multiple ? [] : "";
  19384. if (typeof value !== "string") {
  19385. for (const item of states.selected) {
  19386. if (item.isDisabled)
  19387. value.push(item.value);
  19388. }
  19389. }
  19390. ctx.emit(UPDATE_MODEL_EVENT, value);
  19391. emitChange(value);
  19392. states.visible = false;
  19393. ctx.emit("clear");
  19394. };
  19395. const handleOptionSelect = (option, byClick) => {
  19396. var _a2;
  19397. if (props.multiple) {
  19398. const value = (props.modelValue || []).slice();
  19399. const optionIndex = getValueIndex(value, option.value);
  19400. if (optionIndex > -1) {
  19401. value.splice(optionIndex, 1);
  19402. } else if (props.multipleLimit <= 0 || value.length < props.multipleLimit) {
  19403. value.push(option.value);
  19404. }
  19405. ctx.emit(UPDATE_MODEL_EVENT, value);
  19406. emitChange(value);
  19407. if (option.created) {
  19408. states.query = "";
  19409. handleQueryChange("");
  19410. states.inputLength = 20;
  19411. }
  19412. if (props.filterable)
  19413. (_a2 = input.value) == null ? void 0 : _a2.focus();
  19414. } else {
  19415. ctx.emit(UPDATE_MODEL_EVENT, option.value);
  19416. emitChange(option.value);
  19417. states.visible = false;
  19418. }
  19419. states.isSilentBlur = byClick;
  19420. setSoftFocus();
  19421. if (states.visible)
  19422. return;
  19423. nextTick(() => {
  19424. scrollToOption(option);
  19425. });
  19426. };
  19427. const getValueIndex = (arr = [], value) => {
  19428. if (!isObject$1(value))
  19429. return arr.indexOf(value);
  19430. const valueKey = props.valueKey;
  19431. let index = -1;
  19432. arr.some((item, i) => {
  19433. if (get(item, valueKey) === get(value, valueKey)) {
  19434. index = i;
  19435. return true;
  19436. }
  19437. return false;
  19438. });
  19439. return index;
  19440. };
  19441. const setSoftFocus = () => {
  19442. states.softFocus = true;
  19443. const _input = input.value || reference2.value;
  19444. if (_input) {
  19445. _input == null ? void 0 : _input.focus();
  19446. }
  19447. };
  19448. const scrollToOption = (option) => {
  19449. var _a2, _b2, _c, _d, _e;
  19450. const targetOption = Array.isArray(option) ? option[0] : option;
  19451. let target = null;
  19452. if (targetOption == null ? void 0 : targetOption.value) {
  19453. const options = optionsArray.value.filter((item) => item.value === targetOption.value);
  19454. if (options.length > 0) {
  19455. target = options[0].$el;
  19456. }
  19457. }
  19458. if (tooltipRef.value && target) {
  19459. const menu = (_d = (_c = (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b2.contentRef) == null ? void 0 : _c.querySelector) == null ? void 0 : _d.call(_c, `.${ns.be("dropdown", "wrap")}`);
  19460. if (menu) {
  19461. scrollIntoView(menu, target);
  19462. }
  19463. }
  19464. (_e = scrollbar.value) == null ? void 0 : _e.handleScroll();
  19465. };
  19466. const onOptionCreate = (vm) => {
  19467. states.optionsCount++;
  19468. states.filteredOptionsCount++;
  19469. states.options.set(vm.value, vm);
  19470. states.cachedOptions.set(vm.value, vm);
  19471. };
  19472. const onOptionDestroy = (key, vm) => {
  19473. if (states.options.get(key) === vm) {
  19474. states.optionsCount--;
  19475. states.filteredOptionsCount--;
  19476. states.options.delete(key);
  19477. }
  19478. };
  19479. const resetInputState = (e) => {
  19480. if (e.code !== EVENT_CODE.backspace)
  19481. toggleLastOptionHitState(false);
  19482. states.inputLength = input.value.value.length * 15 + 20;
  19483. resetInputHeight();
  19484. };
  19485. const toggleLastOptionHitState = (hit) => {
  19486. if (!Array.isArray(states.selected))
  19487. return;
  19488. const option = states.selected[states.selected.length - 1];
  19489. if (!option)
  19490. return;
  19491. if (hit === true || hit === false) {
  19492. option.hitState = hit;
  19493. return hit;
  19494. }
  19495. option.hitState = !option.hitState;
  19496. return option.hitState;
  19497. };
  19498. const handleComposition = (event) => {
  19499. const text = event.target.value;
  19500. if (event.type === "compositionend") {
  19501. states.isOnComposition = false;
  19502. nextTick(() => handleQueryChange(text));
  19503. } else {
  19504. const lastCharacter = text[text.length - 1] || "";
  19505. states.isOnComposition = !isKorean(lastCharacter);
  19506. }
  19507. };
  19508. const handleMenuEnter = () => {
  19509. nextTick(() => scrollToOption(states.selected));
  19510. };
  19511. const handleFocus = (event) => {
  19512. if (!states.softFocus) {
  19513. if (props.automaticDropdown || props.filterable) {
  19514. if (props.filterable && !states.visible) {
  19515. states.menuVisibleOnFocus = true;
  19516. }
  19517. states.visible = true;
  19518. }
  19519. ctx.emit("focus", event);
  19520. } else {
  19521. states.softFocus = false;
  19522. }
  19523. };
  19524. const blur = () => {
  19525. var _a2;
  19526. states.visible = false;
  19527. (_a2 = reference2.value) == null ? void 0 : _a2.blur();
  19528. };
  19529. const handleBlur = (event) => {
  19530. nextTick(() => {
  19531. if (states.isSilentBlur) {
  19532. states.isSilentBlur = false;
  19533. } else {
  19534. ctx.emit("blur", event);
  19535. }
  19536. });
  19537. states.softFocus = false;
  19538. };
  19539. const handleClearClick = (event) => {
  19540. deleteSelected(event);
  19541. };
  19542. const handleClose = () => {
  19543. states.visible = false;
  19544. };
  19545. const toggleMenu = () => {
  19546. var _a2;
  19547. if (props.automaticDropdown)
  19548. return;
  19549. if (!selectDisabled.value) {
  19550. if (states.menuVisibleOnFocus) {
  19551. states.menuVisibleOnFocus = false;
  19552. } else {
  19553. states.visible = !states.visible;
  19554. }
  19555. if (states.visible) {
  19556. (_a2 = input.value || reference2.value) == null ? void 0 : _a2.focus();
  19557. }
  19558. }
  19559. };
  19560. const selectOption = () => {
  19561. if (!states.visible) {
  19562. toggleMenu();
  19563. } else {
  19564. if (optionsArray.value[states.hoverIndex]) {
  19565. handleOptionSelect(optionsArray.value[states.hoverIndex], void 0);
  19566. }
  19567. }
  19568. };
  19569. const getValueKey = (item) => {
  19570. return isObject$1(item.value) ? get(item.value, props.valueKey) : item.value;
  19571. };
  19572. const optionsAllDisabled = computed(() => optionsArray.value.filter((option) => option.visible).every((option) => option.disabled));
  19573. const navigateOptions = (direction) => {
  19574. if (!states.visible) {
  19575. states.visible = true;
  19576. return;
  19577. }
  19578. if (states.options.size === 0 || states.filteredOptionsCount === 0)
  19579. return;
  19580. if (states.isOnComposition)
  19581. return;
  19582. if (!optionsAllDisabled.value) {
  19583. if (direction === "next") {
  19584. states.hoverIndex++;
  19585. if (states.hoverIndex === states.options.size) {
  19586. states.hoverIndex = 0;
  19587. }
  19588. } else if (direction === "prev") {
  19589. states.hoverIndex--;
  19590. if (states.hoverIndex < 0) {
  19591. states.hoverIndex = states.options.size - 1;
  19592. }
  19593. }
  19594. const option = optionsArray.value[states.hoverIndex];
  19595. if (option.disabled === true || option.states.groupDisabled === true || !option.visible) {
  19596. navigateOptions(direction);
  19597. }
  19598. nextTick(() => scrollToOption(hoverOption.value));
  19599. }
  19600. };
  19601. return {
  19602. optionsArray,
  19603. selectSize,
  19604. handleResize,
  19605. debouncedOnInputChange,
  19606. debouncedQueryChange,
  19607. deletePrevTag,
  19608. deleteTag,
  19609. deleteSelected,
  19610. handleOptionSelect,
  19611. scrollToOption,
  19612. readonly: readonly2,
  19613. resetInputHeight,
  19614. showClose,
  19615. iconComponent,
  19616. iconReverse,
  19617. showNewOption,
  19618. collapseTagSize,
  19619. setSelected,
  19620. managePlaceholder,
  19621. selectDisabled,
  19622. emptyText,
  19623. toggleLastOptionHitState,
  19624. resetInputState,
  19625. handleComposition,
  19626. onOptionCreate,
  19627. onOptionDestroy,
  19628. handleMenuEnter,
  19629. handleFocus,
  19630. blur,
  19631. handleBlur,
  19632. handleClearClick,
  19633. handleClose,
  19634. toggleMenu,
  19635. selectOption,
  19636. getValueKey,
  19637. navigateOptions,
  19638. dropMenuVisible,
  19639. queryChange,
  19640. groupQueryChange,
  19641. reference: reference2,
  19642. input,
  19643. tooltipRef,
  19644. tags,
  19645. selectWrapper,
  19646. scrollbar
  19647. };
  19648. };
  19649. const COMPONENT_NAME$1 = "ElSelect";
  19650. const _sfc_main$o = defineComponent({
  19651. name: COMPONENT_NAME$1,
  19652. componentName: COMPONENT_NAME$1,
  19653. components: {
  19654. ElInput,
  19655. ElSelectMenu,
  19656. ElOption: Option,
  19657. ElTag,
  19658. ElScrollbar,
  19659. ElTooltip,
  19660. ElIcon
  19661. },
  19662. directives: { ClickOutside },
  19663. props: {
  19664. name: String,
  19665. id: String,
  19666. modelValue: {
  19667. type: [Array, String, Number, Boolean, Object],
  19668. default: void 0
  19669. },
  19670. autocomplete: {
  19671. type: String,
  19672. default: "off"
  19673. },
  19674. automaticDropdown: Boolean,
  19675. size: {
  19676. type: String,
  19677. validator: isValidComponentSize
  19678. },
  19679. effect: {
  19680. type: String,
  19681. default: "light"
  19682. },
  19683. disabled: Boolean,
  19684. clearable: Boolean,
  19685. filterable: Boolean,
  19686. allowCreate: Boolean,
  19687. loading: Boolean,
  19688. popperClass: {
  19689. type: String,
  19690. default: ""
  19691. },
  19692. remote: Boolean,
  19693. loadingText: String,
  19694. noMatchText: String,
  19695. noDataText: String,
  19696. remoteMethod: Function,
  19697. filterMethod: Function,
  19698. multiple: Boolean,
  19699. multipleLimit: {
  19700. type: Number,
  19701. default: 0
  19702. },
  19703. placeholder: {
  19704. type: String
  19705. },
  19706. defaultFirstOption: Boolean,
  19707. reserveKeyword: {
  19708. type: Boolean,
  19709. default: true
  19710. },
  19711. valueKey: {
  19712. type: String,
  19713. default: "value"
  19714. },
  19715. collapseTags: Boolean,
  19716. collapseTagsTooltip: {
  19717. type: Boolean,
  19718. default: false
  19719. },
  19720. popperAppendToBody: {
  19721. type: Boolean,
  19722. default: void 0
  19723. },
  19724. teleported: useTooltipContentProps.teleported,
  19725. persistent: {
  19726. type: Boolean,
  19727. default: true
  19728. },
  19729. clearIcon: {
  19730. type: [String, Object],
  19731. default: circleClose
  19732. },
  19733. fitInputWidth: {
  19734. type: Boolean,
  19735. default: false
  19736. },
  19737. suffixIcon: {
  19738. type: [String, Object],
  19739. default: arrowUp
  19740. },
  19741. tagType: __spreadProps(__spreadValues({}, tagProps.type), { default: "info" })
  19742. },
  19743. emits: [
  19744. UPDATE_MODEL_EVENT,
  19745. CHANGE_EVENT,
  19746. "remove-tag",
  19747. "clear",
  19748. "visible-change",
  19749. "focus",
  19750. "blur"
  19751. ],
  19752. setup(props, ctx) {
  19753. const nsSelect = useNamespace("select");
  19754. const nsInput = useNamespace("input");
  19755. const { t } = useLocale();
  19756. const states = useSelectStates(props);
  19757. const {
  19758. optionsArray,
  19759. selectSize,
  19760. readonly: readonly2,
  19761. handleResize,
  19762. collapseTagSize,
  19763. debouncedOnInputChange,
  19764. debouncedQueryChange,
  19765. deletePrevTag,
  19766. deleteTag,
  19767. deleteSelected,
  19768. handleOptionSelect,
  19769. scrollToOption,
  19770. setSelected,
  19771. resetInputHeight,
  19772. managePlaceholder,
  19773. showClose,
  19774. selectDisabled,
  19775. iconComponent,
  19776. iconReverse,
  19777. showNewOption,
  19778. emptyText,
  19779. toggleLastOptionHitState,
  19780. resetInputState,
  19781. handleComposition,
  19782. onOptionCreate,
  19783. onOptionDestroy,
  19784. handleMenuEnter,
  19785. handleFocus,
  19786. blur,
  19787. handleBlur,
  19788. handleClearClick,
  19789. handleClose,
  19790. toggleMenu,
  19791. selectOption,
  19792. getValueKey,
  19793. navigateOptions,
  19794. dropMenuVisible,
  19795. reference: reference2,
  19796. input,
  19797. tooltipRef,
  19798. tags,
  19799. selectWrapper,
  19800. scrollbar,
  19801. queryChange,
  19802. groupQueryChange
  19803. } = useSelect(props, states, ctx);
  19804. const { focus } = useFocus(reference2);
  19805. const {
  19806. inputWidth,
  19807. selected,
  19808. inputLength,
  19809. filteredOptionsCount,
  19810. visible,
  19811. softFocus,
  19812. selectedLabel,
  19813. hoverIndex,
  19814. query,
  19815. inputHovering,
  19816. currentPlaceholder,
  19817. menuVisibleOnFocus,
  19818. isOnComposition,
  19819. isSilentBlur,
  19820. options,
  19821. cachedOptions,
  19822. optionsCount,
  19823. prefixWidth,
  19824. tagInMultiLine
  19825. } = toRefs(states);
  19826. const wrapperKls = computed(() => {
  19827. const classList = [nsSelect.b()];
  19828. const _selectSize = unref(selectSize);
  19829. if (_selectSize) {
  19830. classList.push(nsSelect.m(_selectSize));
  19831. }
  19832. if (props.disabled) {
  19833. classList.push(nsSelect.m("disabled"));
  19834. }
  19835. return classList;
  19836. });
  19837. const selectTagsStyle = computed(() => ({
  19838. maxWidth: `${unref(inputWidth) - 32}px`,
  19839. width: "100%"
  19840. }));
  19841. provide(selectKey, reactive({
  19842. props,
  19843. options,
  19844. optionsArray,
  19845. cachedOptions,
  19846. optionsCount,
  19847. filteredOptionsCount,
  19848. hoverIndex,
  19849. handleOptionSelect,
  19850. onOptionCreate,
  19851. onOptionDestroy,
  19852. selectWrapper,
  19853. selected,
  19854. setSelected,
  19855. queryChange,
  19856. groupQueryChange
  19857. }));
  19858. onMounted(() => {
  19859. states.cachedPlaceHolder = currentPlaceholder.value = props.placeholder || t("el.select.placeholder");
  19860. if (props.multiple && Array.isArray(props.modelValue) && props.modelValue.length > 0) {
  19861. currentPlaceholder.value = "";
  19862. }
  19863. addResizeListener(selectWrapper.value, handleResize);
  19864. if (reference2.value && reference2.value.$el) {
  19865. const input2 = reference2.value.input;
  19866. states.initialInputHeight = input2.getBoundingClientRect().height || getComponentSize(selectSize.value);
  19867. }
  19868. if (props.remote && props.multiple) {
  19869. resetInputHeight();
  19870. }
  19871. nextTick(() => {
  19872. if (!reference2.value)
  19873. return;
  19874. if (reference2.value.$el) {
  19875. inputWidth.value = reference2.value.$el.getBoundingClientRect().width;
  19876. }
  19877. if (ctx.slots.prefix) {
  19878. const inputChildNodes = reference2.value.$el.childNodes;
  19879. const input2 = Array.from(inputChildNodes).find((item) => item.tagName === "INPUT");
  19880. const prefix = reference2.value.$el.querySelector(`.${nsInput.e("prefix")}`);
  19881. prefixWidth.value = Math.max(prefix.getBoundingClientRect().width + 5, 30);
  19882. if (states.prefixWidth) {
  19883. input2.style.paddingLeft = `${Math.max(states.prefixWidth, 30)}px`;
  19884. }
  19885. }
  19886. });
  19887. setSelected();
  19888. });
  19889. onBeforeUnmount(() => {
  19890. removeResizeListener(selectWrapper.value, handleResize);
  19891. });
  19892. if (props.multiple && !Array.isArray(props.modelValue)) {
  19893. ctx.emit(UPDATE_MODEL_EVENT, []);
  19894. }
  19895. if (!props.multiple && Array.isArray(props.modelValue)) {
  19896. ctx.emit(UPDATE_MODEL_EVENT, "");
  19897. }
  19898. const popperPaneRef = computed(() => {
  19899. var _a2, _b2;
  19900. return (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b2.contentRef;
  19901. });
  19902. const { compatTeleported } = useDeprecateAppendToBody(COMPONENT_NAME$1, "popperAppendToBody");
  19903. return {
  19904. tagInMultiLine,
  19905. prefixWidth,
  19906. selectSize,
  19907. readonly: readonly2,
  19908. handleResize,
  19909. collapseTagSize,
  19910. debouncedOnInputChange,
  19911. debouncedQueryChange,
  19912. deletePrevTag,
  19913. deleteTag,
  19914. deleteSelected,
  19915. handleOptionSelect,
  19916. scrollToOption,
  19917. inputWidth,
  19918. selected,
  19919. inputLength,
  19920. filteredOptionsCount,
  19921. visible,
  19922. softFocus,
  19923. selectedLabel,
  19924. hoverIndex,
  19925. query,
  19926. inputHovering,
  19927. currentPlaceholder,
  19928. menuVisibleOnFocus,
  19929. isOnComposition,
  19930. isSilentBlur,
  19931. options,
  19932. resetInputHeight,
  19933. managePlaceholder,
  19934. showClose,
  19935. selectDisabled,
  19936. iconComponent,
  19937. iconReverse,
  19938. showNewOption,
  19939. emptyText,
  19940. toggleLastOptionHitState,
  19941. resetInputState,
  19942. handleComposition,
  19943. handleMenuEnter,
  19944. handleFocus,
  19945. blur,
  19946. handleBlur,
  19947. handleClearClick,
  19948. handleClose,
  19949. toggleMenu,
  19950. selectOption,
  19951. getValueKey,
  19952. navigateOptions,
  19953. dropMenuVisible,
  19954. focus,
  19955. reference: reference2,
  19956. input,
  19957. tooltipRef,
  19958. popperPaneRef,
  19959. tags,
  19960. selectWrapper,
  19961. scrollbar,
  19962. wrapperKls,
  19963. selectTagsStyle,
  19964. compatTeleported,
  19965. nsSelect
  19966. };
  19967. }
  19968. });
  19969. const _hoisted_1$h = { class: "select-trigger" };
  19970. const _hoisted_2$f = ["disabled", "autocomplete"];
  19971. const _hoisted_3$a = { style: { "height": "100%", "display": "flex", "justify-content": "center", "align-items": "center" } };
  19972. function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
  19973. const _component_el_tag = resolveComponent("el-tag");
  19974. const _component_el_tooltip = resolveComponent("el-tooltip");
  19975. const _component_el_icon = resolveComponent("el-icon");
  19976. const _component_el_input = resolveComponent("el-input");
  19977. const _component_el_option = resolveComponent("el-option");
  19978. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  19979. const _component_el_select_menu = resolveComponent("el-select-menu");
  19980. const _directive_click_outside = resolveDirective("click-outside");
  19981. return withDirectives((openBlock(), createElementBlock("div", {
  19982. ref: "selectWrapper",
  19983. class: normalizeClass(_ctx.wrapperKls),
  19984. onClick: _cache[24] || (_cache[24] = withModifiers((...args) => _ctx.toggleMenu && _ctx.toggleMenu(...args), ["stop"]))
  19985. }, [
  19986. createVNode(_component_el_tooltip, {
  19987. ref: "tooltipRef",
  19988. visible: _ctx.dropMenuVisible,
  19989. "onUpdate:visible": _cache[23] || (_cache[23] = ($event) => _ctx.dropMenuVisible = $event),
  19990. placement: "bottom-start",
  19991. teleported: _ctx.compatTeleported,
  19992. "popper-class": [_ctx.nsSelect.e("popper"), _ctx.popperClass],
  19993. "fallback-placements": ["bottom-start", "top-start", "right", "left"],
  19994. effect: _ctx.effect,
  19995. pure: "",
  19996. trigger: "click",
  19997. transition: `${_ctx.nsSelect.namespace.value}-zoom-in-top`,
  19998. "stop-popper-mouse-event": false,
  19999. "gpu-acceleration": false,
  20000. persistent: _ctx.persistent,
  20001. onShow: _ctx.handleMenuEnter
  20002. }, {
  20003. default: withCtx(() => [
  20004. createElementVNode("div", _hoisted_1$h, [
  20005. _ctx.multiple ? (openBlock(), createElementBlock("div", {
  20006. key: 0,
  20007. ref: "tags",
  20008. class: normalizeClass(_ctx.nsSelect.e("tags")),
  20009. style: normalizeStyle(_ctx.selectTagsStyle)
  20010. }, [
  20011. _ctx.collapseTags && _ctx.selected.length ? (openBlock(), createElementBlock("span", {
  20012. key: 0,
  20013. class: normalizeClass([
  20014. _ctx.nsSelect.b("tags-wrapper"),
  20015. { "has-prefix": _ctx.prefixWidth && _ctx.selected.length }
  20016. ])
  20017. }, [
  20018. createVNode(_component_el_tag, {
  20019. closable: !_ctx.selectDisabled && !_ctx.selected[0].isDisabled,
  20020. size: _ctx.collapseTagSize,
  20021. hit: _ctx.selected[0].hitState,
  20022. type: _ctx.tagType,
  20023. "disable-transitions": "",
  20024. onClose: _cache[0] || (_cache[0] = ($event) => _ctx.deleteTag($event, _ctx.selected[0]))
  20025. }, {
  20026. default: withCtx(() => [
  20027. createElementVNode("span", {
  20028. class: normalizeClass(_ctx.nsSelect.e("tags-text")),
  20029. style: normalizeStyle({ maxWidth: _ctx.inputWidth - 123 + "px" })
  20030. }, toDisplayString(_ctx.selected[0].currentLabel), 7)
  20031. ]),
  20032. _: 1
  20033. }, 8, ["closable", "size", "hit", "type"]),
  20034. _ctx.selected.length > 1 ? (openBlock(), createBlock(_component_el_tag, {
  20035. key: 0,
  20036. closable: false,
  20037. size: _ctx.collapseTagSize,
  20038. type: _ctx.tagType,
  20039. "disable-transitions": ""
  20040. }, {
  20041. default: withCtx(() => [
  20042. _ctx.collapseTagsTooltip ? (openBlock(), createBlock(_component_el_tooltip, {
  20043. key: 0,
  20044. disabled: _ctx.dropMenuVisible,
  20045. "fallback-placements": ["bottom", "top", "right", "left"],
  20046. effect: _ctx.effect,
  20047. placement: "bottom",
  20048. teleported: false
  20049. }, {
  20050. default: withCtx(() => [
  20051. createElementVNode("span", {
  20052. class: normalizeClass(_ctx.nsSelect.e("tags-text"))
  20053. }, "+ " + toDisplayString(_ctx.selected.length - 1), 3)
  20054. ]),
  20055. content: withCtx(() => [
  20056. createElementVNode("div", {
  20057. class: normalizeClass(_ctx.nsSelect.e("collapse-tags"))
  20058. }, [
  20059. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.selected, (item, idx) => {
  20060. return openBlock(), createElementBlock("div", {
  20061. key: idx,
  20062. class: normalizeClass(_ctx.nsSelect.e("collapse-tag"))
  20063. }, [
  20064. (openBlock(), createBlock(_component_el_tag, {
  20065. key: _ctx.getValueKey(item),
  20066. class: "in-tooltip",
  20067. closable: !_ctx.selectDisabled && !item.isDisabled,
  20068. size: _ctx.collapseTagSize,
  20069. hit: item.hitState,
  20070. type: _ctx.tagType,
  20071. "disable-transitions": "",
  20072. style: { margin: "2px" },
  20073. onClose: ($event) => _ctx.deleteTag($event, item)
  20074. }, {
  20075. default: withCtx(() => [
  20076. createElementVNode("span", {
  20077. class: normalizeClass(_ctx.nsSelect.e("tags-text")),
  20078. style: normalizeStyle({
  20079. maxWidth: _ctx.inputWidth - 75 + "px"
  20080. })
  20081. }, toDisplayString(item.currentLabel), 7)
  20082. ]),
  20083. _: 2
  20084. }, 1032, ["closable", "size", "hit", "type", "onClose"]))
  20085. ], 2);
  20086. }), 128))
  20087. ], 2)
  20088. ]),
  20089. _: 1
  20090. }, 8, ["disabled", "effect"])) : (openBlock(), createElementBlock("span", {
  20091. key: 1,
  20092. class: normalizeClass(_ctx.nsSelect.e("tags-text"))
  20093. }, "+ " + toDisplayString(_ctx.selected.length - 1), 3))
  20094. ]),
  20095. _: 1
  20096. }, 8, ["size", "type"])) : createCommentVNode("v-if", true)
  20097. ], 2)) : createCommentVNode("v-if", true),
  20098. createCommentVNode(" <div> "),
  20099. !_ctx.collapseTags ? (openBlock(), createBlock(Transition, {
  20100. key: 1,
  20101. onAfterLeave: _ctx.resetInputHeight
  20102. }, {
  20103. default: withCtx(() => [
  20104. createElementVNode("span", {
  20105. class: normalizeClass([
  20106. _ctx.nsSelect.b("tags-wrapper"),
  20107. { "has-prefix": _ctx.prefixWidth && _ctx.selected.length }
  20108. ])
  20109. }, [
  20110. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.selected, (item) => {
  20111. return openBlock(), createBlock(_component_el_tag, {
  20112. key: _ctx.getValueKey(item),
  20113. closable: !_ctx.selectDisabled && !item.isDisabled,
  20114. size: _ctx.collapseTagSize,
  20115. hit: item.hitState,
  20116. type: _ctx.tagType,
  20117. "disable-transitions": "",
  20118. onClose: ($event) => _ctx.deleteTag($event, item)
  20119. }, {
  20120. default: withCtx(() => [
  20121. createElementVNode("span", {
  20122. class: normalizeClass(_ctx.nsSelect.e("tags-text")),
  20123. style: normalizeStyle({ maxWidth: _ctx.inputWidth - 75 + "px" })
  20124. }, toDisplayString(item.currentLabel), 7)
  20125. ]),
  20126. _: 2
  20127. }, 1032, ["closable", "size", "hit", "type", "onClose"]);
  20128. }), 128))
  20129. ], 2)
  20130. ]),
  20131. _: 1
  20132. }, 8, ["onAfterLeave"])) : createCommentVNode("v-if", true),
  20133. createCommentVNode(" </div> "),
  20134. _ctx.filterable ? withDirectives((openBlock(), createElementBlock("input", {
  20135. key: 2,
  20136. ref: "input",
  20137. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.query = $event),
  20138. type: "text",
  20139. class: normalizeClass([_ctx.nsSelect.e("input"), _ctx.nsSelect.is(_ctx.selectSize)]),
  20140. disabled: _ctx.selectDisabled,
  20141. autocomplete: _ctx.autocomplete,
  20142. style: normalizeStyle({
  20143. marginLeft: _ctx.prefixWidth && !_ctx.selected.length || _ctx.tagInMultiLine ? `${_ctx.prefixWidth}px` : "",
  20144. flexGrow: 1,
  20145. width: `${_ctx.inputLength / (_ctx.inputWidth - 32)}%`,
  20146. maxWidth: `${_ctx.inputWidth - 42}px`
  20147. }),
  20148. onFocus: _cache[2] || (_cache[2] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  20149. onBlur: _cache[3] || (_cache[3] = (...args) => _ctx.handleBlur && _ctx.handleBlur(...args)),
  20150. onKeyup: _cache[4] || (_cache[4] = (...args) => _ctx.managePlaceholder && _ctx.managePlaceholder(...args)),
  20151. onKeydown: [
  20152. _cache[5] || (_cache[5] = (...args) => _ctx.resetInputState && _ctx.resetInputState(...args)),
  20153. _cache[6] || (_cache[6] = withKeys(withModifiers(($event) => _ctx.navigateOptions("next"), ["prevent"]), ["down"])),
  20154. _cache[7] || (_cache[7] = withKeys(withModifiers(($event) => _ctx.navigateOptions("prev"), ["prevent"]), ["up"])),
  20155. _cache[8] || (_cache[8] = withKeys(withModifiers(($event) => _ctx.visible = false, ["stop", "prevent"]), ["esc"])),
  20156. _cache[9] || (_cache[9] = withKeys(withModifiers((...args) => _ctx.selectOption && _ctx.selectOption(...args), ["stop", "prevent"]), ["enter"])),
  20157. _cache[10] || (_cache[10] = withKeys((...args) => _ctx.deletePrevTag && _ctx.deletePrevTag(...args), ["delete"])),
  20158. _cache[11] || (_cache[11] = withKeys(($event) => _ctx.visible = false, ["tab"]))
  20159. ],
  20160. onCompositionstart: _cache[12] || (_cache[12] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  20161. onCompositionupdate: _cache[13] || (_cache[13] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  20162. onCompositionend: _cache[14] || (_cache[14] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  20163. onInput: _cache[15] || (_cache[15] = (...args) => _ctx.debouncedQueryChange && _ctx.debouncedQueryChange(...args))
  20164. }, null, 46, _hoisted_2$f)), [
  20165. [vModelText, _ctx.query]
  20166. ]) : createCommentVNode("v-if", true)
  20167. ], 6)) : createCommentVNode("v-if", true),
  20168. createVNode(_component_el_input, {
  20169. id: _ctx.id,
  20170. ref: "reference",
  20171. modelValue: _ctx.selectedLabel,
  20172. "onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => _ctx.selectedLabel = $event),
  20173. type: "text",
  20174. placeholder: _ctx.currentPlaceholder,
  20175. name: _ctx.name,
  20176. autocomplete: _ctx.autocomplete,
  20177. size: _ctx.selectSize,
  20178. disabled: _ctx.selectDisabled,
  20179. readonly: _ctx.readonly,
  20180. "validate-event": false,
  20181. class: normalizeClass([_ctx.nsSelect.is("focus", _ctx.visible)]),
  20182. tabindex: _ctx.multiple && _ctx.filterable ? -1 : void 0,
  20183. onFocus: _ctx.handleFocus,
  20184. onBlur: _ctx.handleBlur,
  20185. onInput: _ctx.debouncedOnInputChange,
  20186. onPaste: _ctx.debouncedOnInputChange,
  20187. onCompositionstart: _ctx.handleComposition,
  20188. onCompositionupdate: _ctx.handleComposition,
  20189. onCompositionend: _ctx.handleComposition,
  20190. onKeydown: [
  20191. _cache[17] || (_cache[17] = withKeys(withModifiers(($event) => _ctx.navigateOptions("next"), ["stop", "prevent"]), ["down"])),
  20192. _cache[18] || (_cache[18] = withKeys(withModifiers(($event) => _ctx.navigateOptions("prev"), ["stop", "prevent"]), ["up"])),
  20193. withKeys(withModifiers(_ctx.selectOption, ["stop", "prevent"]), ["enter"]),
  20194. _cache[19] || (_cache[19] = withKeys(withModifiers(($event) => _ctx.visible = false, ["stop", "prevent"]), ["esc"])),
  20195. _cache[20] || (_cache[20] = withKeys(($event) => _ctx.visible = false, ["tab"]))
  20196. ],
  20197. onMouseenter: _cache[21] || (_cache[21] = ($event) => _ctx.inputHovering = true),
  20198. onMouseleave: _cache[22] || (_cache[22] = ($event) => _ctx.inputHovering = false)
  20199. }, createSlots({
  20200. suffix: withCtx(() => [
  20201. _ctx.iconComponent && !_ctx.showClose ? (openBlock(), createBlock(_component_el_icon, {
  20202. key: 0,
  20203. class: normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsSelect.e("icon"), _ctx.iconReverse])
  20204. }, {
  20205. default: withCtx(() => [
  20206. (openBlock(), createBlock(resolveDynamicComponent(_ctx.iconComponent)))
  20207. ]),
  20208. _: 1
  20209. }, 8, ["class"])) : createCommentVNode("v-if", true),
  20210. _ctx.showClose && _ctx.clearIcon ? (openBlock(), createBlock(_component_el_icon, {
  20211. key: 1,
  20212. class: normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsSelect.e("icon")]),
  20213. onClick: _ctx.handleClearClick
  20214. }, {
  20215. default: withCtx(() => [
  20216. (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
  20217. ]),
  20218. _: 1
  20219. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  20220. ]),
  20221. _: 2
  20222. }, [
  20223. _ctx.$slots.prefix ? {
  20224. name: "prefix",
  20225. fn: withCtx(() => [
  20226. createElementVNode("div", _hoisted_3$a, [
  20227. renderSlot(_ctx.$slots, "prefix")
  20228. ])
  20229. ])
  20230. } : void 0
  20231. ]), 1032, ["id", "modelValue", "placeholder", "name", "autocomplete", "size", "disabled", "readonly", "class", "tabindex", "onFocus", "onBlur", "onInput", "onPaste", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onKeydown"])
  20232. ])
  20233. ]),
  20234. content: withCtx(() => [
  20235. createVNode(_component_el_select_menu, null, {
  20236. default: withCtx(() => [
  20237. withDirectives(createVNode(_component_el_scrollbar, {
  20238. ref: "scrollbar",
  20239. tag: "ul",
  20240. "wrap-class": _ctx.nsSelect.be("dropdown", "wrap"),
  20241. "view-class": _ctx.nsSelect.be("dropdown", "list"),
  20242. class: normalizeClass([
  20243. _ctx.nsSelect.is("empty", !_ctx.allowCreate && Boolean(_ctx.query) && _ctx.filteredOptionsCount === 0)
  20244. ])
  20245. }, {
  20246. default: withCtx(() => [
  20247. _ctx.showNewOption ? (openBlock(), createBlock(_component_el_option, {
  20248. key: 0,
  20249. value: _ctx.query,
  20250. created: true
  20251. }, null, 8, ["value"])) : createCommentVNode("v-if", true),
  20252. renderSlot(_ctx.$slots, "default")
  20253. ]),
  20254. _: 3
  20255. }, 8, ["wrap-class", "view-class", "class"]), [
  20256. [vShow, _ctx.options.size > 0 && !_ctx.loading]
  20257. ]),
  20258. _ctx.emptyText && (!_ctx.allowCreate || _ctx.loading || _ctx.allowCreate && _ctx.options.size === 0) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  20259. _ctx.$slots.empty ? renderSlot(_ctx.$slots, "empty", { key: 0 }) : (openBlock(), createElementBlock("p", {
  20260. key: 1,
  20261. class: normalizeClass(_ctx.nsSelect.be("dropdown", "empty"))
  20262. }, toDisplayString(_ctx.emptyText), 3))
  20263. ], 2112)) : createCommentVNode("v-if", true)
  20264. ]),
  20265. _: 3
  20266. })
  20267. ]),
  20268. _: 3
  20269. }, 8, ["visible", "teleported", "popper-class", "effect", "transition", "persistent", "onShow"])
  20270. ], 2)), [
  20271. [_directive_click_outside, _ctx.handleClose, _ctx.popperPaneRef]
  20272. ]);
  20273. }
  20274. var Select = /* @__PURE__ */ _export_sfc$1(_sfc_main$o, [["render", _sfc_render$a], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/select/src/select.vue"]]);
  20275. const _sfc_main$n = defineComponent({
  20276. name: "ElOptionGroup",
  20277. componentName: "ElOptionGroup",
  20278. props: {
  20279. label: String,
  20280. disabled: {
  20281. type: Boolean,
  20282. default: false
  20283. }
  20284. },
  20285. setup(props) {
  20286. const ns = useNamespace("select");
  20287. const visible = ref(true);
  20288. const instance = getCurrentInstance();
  20289. const children = ref([]);
  20290. provide(selectGroupKey, reactive(__spreadValues({}, toRefs(props))));
  20291. const select = inject(selectKey);
  20292. onMounted(() => {
  20293. children.value = flattedChildren(instance.subTree);
  20294. });
  20295. const flattedChildren = (node) => {
  20296. const children2 = [];
  20297. if (Array.isArray(node.children)) {
  20298. node.children.forEach((child) => {
  20299. var _a2;
  20300. if (child.type && child.type.name === "ElOption" && child.component && child.component.proxy) {
  20301. children2.push(child.component.proxy);
  20302. } else if ((_a2 = child.children) == null ? void 0 : _a2.length) {
  20303. children2.push(...flattedChildren(child));
  20304. }
  20305. });
  20306. }
  20307. return children2;
  20308. };
  20309. const { groupQueryChange } = toRaw(select);
  20310. watch(groupQueryChange, () => {
  20311. visible.value = children.value.some((option) => option.visible === true);
  20312. });
  20313. return {
  20314. visible,
  20315. ns
  20316. };
  20317. }
  20318. });
  20319. function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
  20320. return withDirectives((openBlock(), createElementBlock("ul", {
  20321. class: normalizeClass(_ctx.ns.be("group", "wrap"))
  20322. }, [
  20323. createElementVNode("li", {
  20324. class: normalizeClass(_ctx.ns.be("group", "title"))
  20325. }, toDisplayString(_ctx.label), 3),
  20326. createElementVNode("li", null, [
  20327. createElementVNode("ul", {
  20328. class: normalizeClass(_ctx.ns.b("group"))
  20329. }, [
  20330. renderSlot(_ctx.$slots, "default")
  20331. ], 2)
  20332. ])
  20333. ], 2)), [
  20334. [vShow, _ctx.visible]
  20335. ]);
  20336. }
  20337. var OptionGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$n, [["render", _sfc_render$9], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/select/src/option-group.vue"]]);
  20338. const ElSelect = withInstall(Select, {
  20339. Option,
  20340. OptionGroup
  20341. });
  20342. const ElOption = withNoopInstall(Option);
  20343. withNoopInstall(OptionGroup);
  20344. const progressProps = buildProps({
  20345. type: {
  20346. type: String,
  20347. default: "line",
  20348. values: ["line", "circle", "dashboard"]
  20349. },
  20350. percentage: {
  20351. type: Number,
  20352. default: 0,
  20353. validator: (val) => val >= 0 && val <= 100
  20354. },
  20355. status: {
  20356. type: String,
  20357. default: "",
  20358. values: ["", "success", "exception", "warning"]
  20359. },
  20360. indeterminate: {
  20361. type: Boolean,
  20362. default: false
  20363. },
  20364. duration: {
  20365. type: Number,
  20366. default: 3
  20367. },
  20368. strokeWidth: {
  20369. type: Number,
  20370. default: 6
  20371. },
  20372. strokeLinecap: {
  20373. type: definePropType(String),
  20374. default: "round"
  20375. },
  20376. textInside: {
  20377. type: Boolean,
  20378. default: false
  20379. },
  20380. width: {
  20381. type: Number,
  20382. default: 126
  20383. },
  20384. showText: {
  20385. type: Boolean,
  20386. default: true
  20387. },
  20388. color: {
  20389. type: definePropType([
  20390. String,
  20391. Array,
  20392. Function
  20393. ]),
  20394. default: ""
  20395. },
  20396. format: {
  20397. type: definePropType(Function),
  20398. default: (percentage) => `${percentage}%`
  20399. }
  20400. });
  20401. const _sfc_main$m = defineComponent({
  20402. name: "ElProgress",
  20403. components: {
  20404. ElIcon,
  20405. CircleCheck: circleCheck,
  20406. CircleClose: circleClose,
  20407. Check: check,
  20408. Close: close,
  20409. WarningFilled: warningFilled
  20410. },
  20411. props: progressProps,
  20412. setup(props) {
  20413. const ns = useNamespace("progress");
  20414. const barStyle = computed(() => ({
  20415. width: `${props.percentage}%`,
  20416. animationDuration: `${props.duration}s`,
  20417. backgroundColor: getCurrentColor(props.percentage)
  20418. }));
  20419. const relativeStrokeWidth = computed(() => (props.strokeWidth / props.width * 100).toFixed(1));
  20420. const radius = computed(() => {
  20421. if (props.type === "circle" || props.type === "dashboard") {
  20422. return Number.parseInt(`${50 - Number.parseFloat(relativeStrokeWidth.value) / 2}`, 10);
  20423. } else {
  20424. return 0;
  20425. }
  20426. });
  20427. const trackPath = computed(() => {
  20428. const r = radius.value;
  20429. const isDashboard = props.type === "dashboard";
  20430. return `
  20431. M 50 50
  20432. m 0 ${isDashboard ? "" : "-"}${r}
  20433. a ${r} ${r} 0 1 1 0 ${isDashboard ? "-" : ""}${r * 2}
  20434. a ${r} ${r} 0 1 1 0 ${isDashboard ? "" : "-"}${r * 2}
  20435. `;
  20436. });
  20437. const perimeter = computed(() => 2 * Math.PI * radius.value);
  20438. const rate = computed(() => props.type === "dashboard" ? 0.75 : 1);
  20439. const strokeDashoffset = computed(() => {
  20440. const offset2 = -1 * perimeter.value * (1 - rate.value) / 2;
  20441. return `${offset2}px`;
  20442. });
  20443. const trailPathStyle = computed(() => ({
  20444. strokeDasharray: `${perimeter.value * rate.value}px, ${perimeter.value}px`,
  20445. strokeDashoffset: strokeDashoffset.value
  20446. }));
  20447. const circlePathStyle = computed(() => ({
  20448. strokeDasharray: `${perimeter.value * rate.value * (props.percentage / 100)}px, ${perimeter.value}px`,
  20449. strokeDashoffset: strokeDashoffset.value,
  20450. transition: "stroke-dasharray 0.6s ease 0s, stroke 0.6s ease"
  20451. }));
  20452. const stroke = computed(() => {
  20453. let ret;
  20454. if (props.color) {
  20455. ret = getCurrentColor(props.percentage);
  20456. } else {
  20457. switch (props.status) {
  20458. case "success":
  20459. ret = "#13ce66";
  20460. break;
  20461. case "exception":
  20462. ret = "#ff4949";
  20463. break;
  20464. case "warning":
  20465. ret = "#e6a23c";
  20466. break;
  20467. default:
  20468. ret = "#20a0ff";
  20469. }
  20470. }
  20471. return ret;
  20472. });
  20473. const statusIcon = computed(() => {
  20474. if (props.status === "warning") {
  20475. return warningFilled;
  20476. }
  20477. if (props.type === "line") {
  20478. return props.status === "success" ? circleCheck : circleClose;
  20479. } else {
  20480. return props.status === "success" ? check : close;
  20481. }
  20482. });
  20483. const progressTextSize = computed(() => {
  20484. return props.type === "line" ? 12 + props.strokeWidth * 0.4 : props.width * 0.111111 + 2;
  20485. });
  20486. const content2 = computed(() => props.format(props.percentage));
  20487. const getCurrentColor = (percentage) => {
  20488. var _a2;
  20489. const { color } = props;
  20490. if (typeof color === "function") {
  20491. return color(percentage);
  20492. } else if (typeof color === "string") {
  20493. return color;
  20494. } else {
  20495. const span = 100 / color.length;
  20496. const seriesColors = color.map((seriesColor, index) => {
  20497. if (typeof seriesColor === "string") {
  20498. return {
  20499. color: seriesColor,
  20500. percentage: (index + 1) * span
  20501. };
  20502. }
  20503. return seriesColor;
  20504. });
  20505. const colors = seriesColors.sort((a2, b2) => a2.percentage - b2.percentage);
  20506. for (const color2 of colors) {
  20507. if (color2.percentage > percentage)
  20508. return color2.color;
  20509. }
  20510. return (_a2 = colors[colors.length - 1]) == null ? void 0 : _a2.color;
  20511. }
  20512. };
  20513. const slotData = computed(() => {
  20514. return {
  20515. percentage: props.percentage
  20516. };
  20517. });
  20518. return {
  20519. ns,
  20520. barStyle,
  20521. relativeStrokeWidth,
  20522. radius,
  20523. trackPath,
  20524. perimeter,
  20525. rate,
  20526. strokeDashoffset,
  20527. trailPathStyle,
  20528. circlePathStyle,
  20529. stroke,
  20530. statusIcon,
  20531. progressTextSize,
  20532. content: content2,
  20533. slotData
  20534. };
  20535. }
  20536. });
  20537. const _hoisted_1$g = ["aria-valuenow"];
  20538. const _hoisted_2$e = { viewBox: "0 0 100 100" };
  20539. const _hoisted_3$9 = ["d", "stroke-width"];
  20540. const _hoisted_4$8 = ["d", "stroke", "stroke-linecap", "stroke-width"];
  20541. const _hoisted_5$8 = { key: 0 };
  20542. function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
  20543. const _component_el_icon = resolveComponent("el-icon");
  20544. return openBlock(), createElementBlock("div", {
  20545. class: normalizeClass([
  20546. _ctx.ns.b(),
  20547. _ctx.ns.m(_ctx.type),
  20548. _ctx.ns.is(_ctx.status),
  20549. {
  20550. [_ctx.ns.m("without-text")]: !_ctx.showText,
  20551. [_ctx.ns.m("text-inside")]: _ctx.textInside
  20552. }
  20553. ]),
  20554. role: "progressbar",
  20555. "aria-valuenow": _ctx.percentage,
  20556. "aria-valuemin": "0",
  20557. "aria-valuemax": "100"
  20558. }, [
  20559. _ctx.type === "line" ? (openBlock(), createElementBlock("div", {
  20560. key: 0,
  20561. class: normalizeClass(_ctx.ns.b("bar"))
  20562. }, [
  20563. createElementVNode("div", {
  20564. class: normalizeClass(_ctx.ns.be("bar", "outer")),
  20565. style: normalizeStyle({ height: `${_ctx.strokeWidth}px` })
  20566. }, [
  20567. createElementVNode("div", {
  20568. class: normalizeClass([
  20569. _ctx.ns.be("bar", "inner"),
  20570. { [_ctx.ns.bem("bar", "inner", "indeterminate")]: _ctx.indeterminate }
  20571. ]),
  20572. style: normalizeStyle(_ctx.barStyle)
  20573. }, [
  20574. (_ctx.showText || _ctx.$slots.default) && _ctx.textInside ? (openBlock(), createElementBlock("div", {
  20575. key: 0,
  20576. class: normalizeClass(_ctx.ns.be("bar", "innerText"))
  20577. }, [
  20578. renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(_ctx.slotData)), () => [
  20579. createElementVNode("span", null, toDisplayString(_ctx.content), 1)
  20580. ])
  20581. ], 2)) : createCommentVNode("v-if", true)
  20582. ], 6)
  20583. ], 6)
  20584. ], 2)) : (openBlock(), createElementBlock("div", {
  20585. key: 1,
  20586. class: normalizeClass(_ctx.ns.b("circle")),
  20587. style: normalizeStyle({ height: `${_ctx.width}px`, width: `${_ctx.width}px` })
  20588. }, [
  20589. (openBlock(), createElementBlock("svg", _hoisted_2$e, [
  20590. createElementVNode("path", {
  20591. class: normalizeClass(_ctx.ns.be("circle", "track")),
  20592. d: _ctx.trackPath,
  20593. stroke: "var(--el-fill-color-light, #e5e9f2)",
  20594. "stroke-width": _ctx.relativeStrokeWidth,
  20595. fill: "none",
  20596. style: normalizeStyle(_ctx.trailPathStyle)
  20597. }, null, 14, _hoisted_3$9),
  20598. createElementVNode("path", {
  20599. class: normalizeClass(_ctx.ns.be("circle", "path")),
  20600. d: _ctx.trackPath,
  20601. stroke: _ctx.stroke,
  20602. fill: "none",
  20603. "stroke-linecap": _ctx.strokeLinecap,
  20604. "stroke-width": _ctx.percentage ? _ctx.relativeStrokeWidth : 0,
  20605. style: normalizeStyle(_ctx.circlePathStyle)
  20606. }, null, 14, _hoisted_4$8)
  20607. ]))
  20608. ], 6)),
  20609. (_ctx.showText || _ctx.$slots.default) && !_ctx.textInside ? (openBlock(), createElementBlock("div", {
  20610. key: 2,
  20611. class: normalizeClass(_ctx.ns.e("text")),
  20612. style: normalizeStyle({ fontSize: `${_ctx.progressTextSize}px` })
  20613. }, [
  20614. renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(_ctx.slotData)), () => [
  20615. !_ctx.status ? (openBlock(), createElementBlock("span", _hoisted_5$8, toDisplayString(_ctx.content), 1)) : (openBlock(), createBlock(_component_el_icon, { key: 1 }, {
  20616. default: withCtx(() => [
  20617. (openBlock(), createBlock(resolveDynamicComponent(_ctx.statusIcon)))
  20618. ]),
  20619. _: 1
  20620. }))
  20621. ])
  20622. ], 6)) : createCommentVNode("v-if", true)
  20623. ], 10, _hoisted_1$g);
  20624. }
  20625. var Progress = /* @__PURE__ */ _export_sfc$1(_sfc_main$m, [["render", _sfc_render$8], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/progress/src/progress.vue"]]);
  20626. const ElProgress = withInstall(Progress);
  20627. const rateProps = buildProps({
  20628. modelValue: {
  20629. type: Number,
  20630. default: 0
  20631. },
  20632. lowThreshold: {
  20633. type: Number,
  20634. default: 2
  20635. },
  20636. highThreshold: {
  20637. type: Number,
  20638. default: 4
  20639. },
  20640. max: {
  20641. type: Number,
  20642. default: 5
  20643. },
  20644. colors: {
  20645. type: definePropType([Array, Object]),
  20646. default: () => mutable(["", "", ""])
  20647. },
  20648. voidColor: {
  20649. type: String,
  20650. default: ""
  20651. },
  20652. disabledVoidColor: {
  20653. type: String,
  20654. default: ""
  20655. },
  20656. icons: {
  20657. type: definePropType([Array, Object]),
  20658. default: () => [starFilled, starFilled, starFilled]
  20659. },
  20660. voidIcon: {
  20661. type: iconPropType,
  20662. default: () => star
  20663. },
  20664. disabledVoidIcon: {
  20665. type: iconPropType,
  20666. default: () => starFilled
  20667. },
  20668. disabled: {
  20669. type: Boolean,
  20670. default: false
  20671. },
  20672. allowHalf: {
  20673. type: Boolean,
  20674. default: false
  20675. },
  20676. showText: {
  20677. type: Boolean,
  20678. default: false
  20679. },
  20680. showScore: {
  20681. type: Boolean,
  20682. default: false
  20683. },
  20684. textColor: {
  20685. type: String,
  20686. default: ""
  20687. },
  20688. texts: {
  20689. type: definePropType(Array),
  20690. default: () => mutable([
  20691. "Extremely bad",
  20692. "Disappointed",
  20693. "Fair",
  20694. "Satisfied",
  20695. "Surprise"
  20696. ])
  20697. },
  20698. scoreTemplate: {
  20699. type: String,
  20700. default: "{value}"
  20701. },
  20702. size: {
  20703. type: String,
  20704. validator: isValidComponentSize
  20705. }
  20706. });
  20707. const rateEmits = {
  20708. change: (value) => typeof value === "number",
  20709. [UPDATE_MODEL_EVENT]: (value) => typeof value === "number"
  20710. };
  20711. const _hoisted_1$f = ["aria-valuenow", "aria-valuetext", "aria-valuemax"];
  20712. const _hoisted_2$d = ["onMousemove", "onClick"];
  20713. const __default__$5 = {
  20714. name: "ElRate"
  20715. };
  20716. const _sfc_main$l = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$5), {
  20717. props: rateProps,
  20718. emits: rateEmits,
  20719. setup(__props, { expose, emit }) {
  20720. const props = __props;
  20721. function getValueFromMap(value, map) {
  20722. const isExcludedObject = (val) => isObject$1(val);
  20723. const matchedKeys = Object.keys(map).map((key) => +key).filter((key) => {
  20724. const val = map[key];
  20725. const excluded = isExcludedObject(val) ? val.excluded : false;
  20726. return excluded ? value < key : value <= key;
  20727. }).sort((a2, b2) => a2 - b2);
  20728. const matchedValue = map[matchedKeys[0]];
  20729. return isExcludedObject(matchedValue) && matchedValue.value || matchedValue;
  20730. }
  20731. const formContext = inject(formContextKey, void 0);
  20732. const rateSize = useSize();
  20733. const ns = useNamespace("rate");
  20734. const currentValue = ref(props.modelValue);
  20735. const hoverIndex = ref(-1);
  20736. const pointerAtLeftHalf = ref(true);
  20737. const rateClasses = computed(() => [ns.b(), ns.m(rateSize.value)]);
  20738. const rateDisabled = computed(() => props.disabled || (formContext == null ? void 0 : formContext.disabled));
  20739. const rateStyles = computed(() => {
  20740. return {
  20741. "--el-rate-void-color": props.voidColor,
  20742. "--el-rate-disabled-void-color": props.disabledVoidColor,
  20743. "--el-rate-fill-color": activeColor.value
  20744. };
  20745. });
  20746. const text = computed(() => {
  20747. let result = "";
  20748. if (props.showScore) {
  20749. result = props.scoreTemplate.replace(/\{\s*value\s*\}/, rateDisabled.value ? `${props.modelValue}` : `${currentValue.value}`);
  20750. } else if (props.showText) {
  20751. result = props.texts[Math.ceil(currentValue.value) - 1];
  20752. }
  20753. return result;
  20754. });
  20755. const valueDecimal = computed(() => props.modelValue * 100 - Math.floor(props.modelValue) * 100);
  20756. const colorMap = computed(() => isArray(props.colors) ? {
  20757. [props.lowThreshold]: props.colors[0],
  20758. [props.highThreshold]: { value: props.colors[1], excluded: true },
  20759. [props.max]: props.colors[2]
  20760. } : props.colors);
  20761. const activeColor = computed(() => {
  20762. const color = getValueFromMap(currentValue.value, colorMap.value);
  20763. return isObject$1(color) ? "" : color;
  20764. });
  20765. const decimalStyle = computed(() => {
  20766. let width = "";
  20767. if (rateDisabled.value) {
  20768. width = `${valueDecimal.value}%`;
  20769. } else if (props.allowHalf) {
  20770. width = "50%";
  20771. }
  20772. return {
  20773. color: activeColor.value,
  20774. width
  20775. };
  20776. });
  20777. const componentMap = computed(() => isArray(props.icons) ? {
  20778. [props.lowThreshold]: props.icons[0],
  20779. [props.highThreshold]: {
  20780. value: props.icons[1],
  20781. excluded: true
  20782. },
  20783. [props.max]: props.icons[2]
  20784. } : props.icons);
  20785. const decimalIconComponent = computed(() => getValueFromMap(props.modelValue, componentMap.value));
  20786. const voidComponent = computed(() => rateDisabled.value ? props.disabledVoidIcon : props.voidIcon);
  20787. const activeComponent = computed(() => getValueFromMap(currentValue.value, componentMap.value));
  20788. const iconComponents = computed(() => {
  20789. const result = Array.from({ length: props.max });
  20790. const threshold = currentValue.value;
  20791. result.fill(activeComponent.value, 0, threshold);
  20792. result.fill(voidComponent.value, threshold, props.max);
  20793. return result;
  20794. });
  20795. function showDecimalIcon(item) {
  20796. const showWhenDisabled = rateDisabled.value && valueDecimal.value > 0 && item - 1 < props.modelValue && item > props.modelValue;
  20797. const showWhenAllowHalf = props.allowHalf && pointerAtLeftHalf.value && item - 0.5 <= currentValue.value && item > currentValue.value;
  20798. return showWhenDisabled || showWhenAllowHalf;
  20799. }
  20800. function selectValue(value) {
  20801. if (rateDisabled.value) {
  20802. return;
  20803. }
  20804. if (props.allowHalf && pointerAtLeftHalf.value) {
  20805. emit(UPDATE_MODEL_EVENT, currentValue.value);
  20806. if (props.modelValue !== currentValue.value) {
  20807. emit("change", currentValue.value);
  20808. }
  20809. } else {
  20810. emit(UPDATE_MODEL_EVENT, value);
  20811. if (props.modelValue !== value) {
  20812. emit("change", value);
  20813. }
  20814. }
  20815. }
  20816. function handleKey(e) {
  20817. if (rateDisabled.value) {
  20818. return;
  20819. }
  20820. let _currentValue = currentValue.value;
  20821. const code = e.code;
  20822. if (code === EVENT_CODE.up || code === EVENT_CODE.right) {
  20823. if (props.allowHalf) {
  20824. _currentValue += 0.5;
  20825. } else {
  20826. _currentValue += 1;
  20827. }
  20828. e.stopPropagation();
  20829. e.preventDefault();
  20830. } else if (code === EVENT_CODE.left || code === EVENT_CODE.down) {
  20831. if (props.allowHalf) {
  20832. _currentValue -= 0.5;
  20833. } else {
  20834. _currentValue -= 1;
  20835. }
  20836. e.stopPropagation();
  20837. e.preventDefault();
  20838. }
  20839. _currentValue = _currentValue < 0 ? 0 : _currentValue;
  20840. _currentValue = _currentValue > props.max ? props.max : _currentValue;
  20841. emit(UPDATE_MODEL_EVENT, _currentValue);
  20842. emit("change", _currentValue);
  20843. return _currentValue;
  20844. }
  20845. function setCurrentValue(value, event) {
  20846. if (rateDisabled.value) {
  20847. return;
  20848. }
  20849. if (props.allowHalf) {
  20850. let target = event.target;
  20851. if (hasClass(target, ns.e("item"))) {
  20852. target = target.querySelector(`.${ns.e("icon")}`);
  20853. }
  20854. if (target.clientWidth === 0 || hasClass(target, ns.e("decimal"))) {
  20855. target = target.parentNode;
  20856. }
  20857. pointerAtLeftHalf.value = event.offsetX * 2 <= target.clientWidth;
  20858. currentValue.value = pointerAtLeftHalf.value ? value - 0.5 : value;
  20859. } else {
  20860. currentValue.value = value;
  20861. }
  20862. hoverIndex.value = value;
  20863. }
  20864. function resetCurrentValue() {
  20865. if (rateDisabled.value) {
  20866. return;
  20867. }
  20868. if (props.allowHalf) {
  20869. pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
  20870. }
  20871. currentValue.value = props.modelValue;
  20872. hoverIndex.value = -1;
  20873. }
  20874. watch(() => props.modelValue, (val) => {
  20875. currentValue.value = val;
  20876. pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
  20877. });
  20878. if (!props.modelValue) {
  20879. emit(UPDATE_MODEL_EVENT, 0);
  20880. }
  20881. expose({
  20882. setCurrentValue,
  20883. resetCurrentValue
  20884. });
  20885. return (_ctx, _cache) => {
  20886. return openBlock(), createElementBlock("div", {
  20887. class: normalizeClass([unref(rateClasses), unref(ns).is("disabled", unref(rateDisabled))]),
  20888. role: "slider",
  20889. "aria-valuenow": currentValue.value,
  20890. "aria-valuetext": unref(text),
  20891. "aria-valuemin": "0",
  20892. "aria-valuemax": _ctx.max,
  20893. tabindex: "0",
  20894. style: normalizeStyle(unref(rateStyles)),
  20895. onKeydown: handleKey
  20896. }, [
  20897. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.max, (item, key) => {
  20898. return openBlock(), createElementBlock("span", {
  20899. key,
  20900. class: normalizeClass(unref(ns).e("item")),
  20901. onMousemove: ($event) => setCurrentValue(item, $event),
  20902. onMouseleave: resetCurrentValue,
  20903. onClick: ($event) => selectValue(item)
  20904. }, [
  20905. createVNode(unref(ElIcon), {
  20906. class: normalizeClass([
  20907. unref(ns).e("icon"),
  20908. { hover: hoverIndex.value === item },
  20909. unref(ns).is("active", item <= currentValue.value)
  20910. ])
  20911. }, {
  20912. default: withCtx(() => [
  20913. !showDecimalIcon(item) ? (openBlock(), createBlock(resolveDynamicComponent(unref(iconComponents)[item - 1]), { key: 0 })) : createCommentVNode("v-if", true),
  20914. showDecimalIcon(item) ? (openBlock(), createBlock(unref(ElIcon), {
  20915. key: 1,
  20916. style: normalizeStyle(unref(decimalStyle)),
  20917. class: normalizeClass([unref(ns).e("icon"), unref(ns).e("decimal")])
  20918. }, {
  20919. default: withCtx(() => [
  20920. (openBlock(), createBlock(resolveDynamicComponent(unref(decimalIconComponent))))
  20921. ]),
  20922. _: 1
  20923. }, 8, ["style", "class"])) : createCommentVNode("v-if", true)
  20924. ]),
  20925. _: 2
  20926. }, 1032, ["class"])
  20927. ], 42, _hoisted_2$d);
  20928. }), 128)),
  20929. _ctx.showText || _ctx.showScore ? (openBlock(), createElementBlock("span", {
  20930. key: 0,
  20931. class: normalizeClass(unref(ns).e("text"))
  20932. }, toDisplayString(unref(text)), 3)) : createCommentVNode("v-if", true)
  20933. ], 46, _hoisted_1$f);
  20934. };
  20935. }
  20936. }));
  20937. var Rate = /* @__PURE__ */ _export_sfc$1(_sfc_main$l, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/rate/src/rate.vue"]]);
  20938. const ElRate = withInstall(Rate);
  20939. const useTooltip = (props, formatTooltip, showTooltip) => {
  20940. const tooltip = ref(null);
  20941. const tooltipVisible = ref(false);
  20942. const enableFormat = computed(() => {
  20943. return formatTooltip.value instanceof Function;
  20944. });
  20945. const formatValue = computed(() => {
  20946. return enableFormat.value && formatTooltip.value(props.modelValue) || props.modelValue;
  20947. });
  20948. const displayTooltip = debounce$1(() => {
  20949. showTooltip.value && (tooltipVisible.value = true);
  20950. }, 50);
  20951. const hideTooltip = debounce$1(() => {
  20952. showTooltip.value && (tooltipVisible.value = false);
  20953. }, 50);
  20954. return {
  20955. tooltip,
  20956. tooltipVisible,
  20957. formatValue,
  20958. displayTooltip,
  20959. hideTooltip
  20960. };
  20961. };
  20962. const useSliderButton = (props, initData, emit) => {
  20963. const {
  20964. disabled,
  20965. min: min2,
  20966. max: max2,
  20967. step,
  20968. showTooltip,
  20969. precision,
  20970. sliderSize,
  20971. formatTooltip,
  20972. emitChange,
  20973. resetSize,
  20974. updateDragging
  20975. } = inject("SliderProvider");
  20976. const { tooltip, tooltipVisible, formatValue, displayTooltip, hideTooltip } = useTooltip(props, formatTooltip, showTooltip);
  20977. const currentPosition = computed(() => {
  20978. return `${(props.modelValue - min2.value) / (max2.value - min2.value) * 100}%`;
  20979. });
  20980. const wrapperStyle = computed(() => {
  20981. return props.vertical ? { bottom: currentPosition.value } : { left: currentPosition.value };
  20982. });
  20983. const handleMouseEnter = () => {
  20984. initData.hovering = true;
  20985. displayTooltip();
  20986. };
  20987. const handleMouseLeave = () => {
  20988. initData.hovering = false;
  20989. if (!initData.dragging) {
  20990. hideTooltip();
  20991. }
  20992. };
  20993. const onButtonDown = (event) => {
  20994. if (disabled.value)
  20995. return;
  20996. event.preventDefault();
  20997. onDragStart(event);
  20998. on(window, "mousemove", onDragging);
  20999. on(window, "touchmove", onDragging);
  21000. on(window, "mouseup", onDragEnd);
  21001. on(window, "touchend", onDragEnd);
  21002. on(window, "contextmenu", onDragEnd);
  21003. };
  21004. const onLeftKeyDown = () => {
  21005. if (disabled.value)
  21006. return;
  21007. initData.newPosition = Number.parseFloat(currentPosition.value) - step.value / (max2.value - min2.value) * 100;
  21008. setPosition(initData.newPosition);
  21009. emitChange();
  21010. };
  21011. const onRightKeyDown = () => {
  21012. if (disabled.value)
  21013. return;
  21014. initData.newPosition = Number.parseFloat(currentPosition.value) + step.value / (max2.value - min2.value) * 100;
  21015. setPosition(initData.newPosition);
  21016. emitChange();
  21017. };
  21018. const getClientXY = (event) => {
  21019. let clientX;
  21020. let clientY;
  21021. if (event.type.startsWith("touch")) {
  21022. clientY = event.touches[0].clientY;
  21023. clientX = event.touches[0].clientX;
  21024. } else {
  21025. clientY = event.clientY;
  21026. clientX = event.clientX;
  21027. }
  21028. return {
  21029. clientX,
  21030. clientY
  21031. };
  21032. };
  21033. const onDragStart = (event) => {
  21034. initData.dragging = true;
  21035. initData.isClick = true;
  21036. const { clientX, clientY } = getClientXY(event);
  21037. if (props.vertical) {
  21038. initData.startY = clientY;
  21039. } else {
  21040. initData.startX = clientX;
  21041. }
  21042. initData.startPosition = Number.parseFloat(currentPosition.value);
  21043. initData.newPosition = initData.startPosition;
  21044. };
  21045. const onDragging = (event) => {
  21046. if (initData.dragging) {
  21047. initData.isClick = false;
  21048. displayTooltip();
  21049. resetSize();
  21050. let diff;
  21051. const { clientX, clientY } = getClientXY(event);
  21052. if (props.vertical) {
  21053. initData.currentY = clientY;
  21054. diff = (initData.startY - initData.currentY) / sliderSize.value * 100;
  21055. } else {
  21056. initData.currentX = clientX;
  21057. diff = (initData.currentX - initData.startX) / sliderSize.value * 100;
  21058. }
  21059. initData.newPosition = initData.startPosition + diff;
  21060. setPosition(initData.newPosition);
  21061. }
  21062. };
  21063. const onDragEnd = () => {
  21064. if (initData.dragging) {
  21065. setTimeout(() => {
  21066. initData.dragging = false;
  21067. if (!initData.hovering) {
  21068. hideTooltip();
  21069. }
  21070. if (!initData.isClick) {
  21071. setPosition(initData.newPosition);
  21072. emitChange();
  21073. }
  21074. }, 0);
  21075. off(window, "mousemove", onDragging);
  21076. off(window, "touchmove", onDragging);
  21077. off(window, "mouseup", onDragEnd);
  21078. off(window, "touchend", onDragEnd);
  21079. off(window, "contextmenu", onDragEnd);
  21080. }
  21081. };
  21082. const setPosition = async (newPosition) => {
  21083. if (newPosition === null || Number.isNaN(+newPosition))
  21084. return;
  21085. if (newPosition < 0) {
  21086. newPosition = 0;
  21087. } else if (newPosition > 100) {
  21088. newPosition = 100;
  21089. }
  21090. const lengthPerStep = 100 / ((max2.value - min2.value) / step.value);
  21091. const steps = Math.round(newPosition / lengthPerStep);
  21092. let value = steps * lengthPerStep * (max2.value - min2.value) * 0.01 + min2.value;
  21093. value = Number.parseFloat(value.toFixed(precision.value));
  21094. emit(UPDATE_MODEL_EVENT, value);
  21095. if (!initData.dragging && props.modelValue !== initData.oldValue) {
  21096. initData.oldValue = props.modelValue;
  21097. }
  21098. await nextTick();
  21099. initData.dragging && displayTooltip();
  21100. tooltip.value.updatePopper();
  21101. };
  21102. watch(() => initData.dragging, (val) => {
  21103. updateDragging(val);
  21104. });
  21105. return {
  21106. tooltip,
  21107. tooltipVisible,
  21108. showTooltip,
  21109. wrapperStyle,
  21110. formatValue,
  21111. handleMouseEnter,
  21112. handleMouseLeave,
  21113. onButtonDown,
  21114. onLeftKeyDown,
  21115. onRightKeyDown,
  21116. setPosition
  21117. };
  21118. };
  21119. const _sfc_main$k = defineComponent({
  21120. name: "ElSliderButton",
  21121. components: {
  21122. ElTooltip
  21123. },
  21124. props: {
  21125. modelValue: {
  21126. type: Number,
  21127. default: 0
  21128. },
  21129. vertical: {
  21130. type: Boolean,
  21131. default: false
  21132. },
  21133. tooltipClass: {
  21134. type: String,
  21135. default: ""
  21136. }
  21137. },
  21138. emits: [UPDATE_MODEL_EVENT],
  21139. setup(props, { emit }) {
  21140. const ns = useNamespace("slider");
  21141. const initData = reactive({
  21142. hovering: false,
  21143. dragging: false,
  21144. isClick: false,
  21145. startX: 0,
  21146. currentX: 0,
  21147. startY: 0,
  21148. currentY: 0,
  21149. startPosition: 0,
  21150. newPosition: 0,
  21151. oldValue: props.modelValue
  21152. });
  21153. const {
  21154. tooltip,
  21155. showTooltip,
  21156. tooltipVisible,
  21157. wrapperStyle,
  21158. formatValue,
  21159. handleMouseEnter,
  21160. handleMouseLeave,
  21161. onButtonDown,
  21162. onLeftKeyDown,
  21163. onRightKeyDown,
  21164. setPosition
  21165. } = useSliderButton(props, initData, emit);
  21166. const { hovering, dragging } = toRefs(initData);
  21167. return {
  21168. ns,
  21169. tooltip,
  21170. tooltipVisible,
  21171. showTooltip,
  21172. wrapperStyle,
  21173. formatValue,
  21174. handleMouseEnter,
  21175. handleMouseLeave,
  21176. onButtonDown,
  21177. onLeftKeyDown,
  21178. onRightKeyDown,
  21179. setPosition,
  21180. hovering,
  21181. dragging
  21182. };
  21183. }
  21184. });
  21185. function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
  21186. const _component_el_tooltip = resolveComponent("el-tooltip");
  21187. return openBlock(), createElementBlock("div", {
  21188. ref: "button",
  21189. class: normalizeClass([_ctx.ns.e("button-wrapper"), { hover: _ctx.hovering, dragging: _ctx.dragging }]),
  21190. style: normalizeStyle(_ctx.wrapperStyle),
  21191. tabindex: "0",
  21192. onMouseenter: _cache[1] || (_cache[1] = (...args) => _ctx.handleMouseEnter && _ctx.handleMouseEnter(...args)),
  21193. onMouseleave: _cache[2] || (_cache[2] = (...args) => _ctx.handleMouseLeave && _ctx.handleMouseLeave(...args)),
  21194. onMousedown: _cache[3] || (_cache[3] = (...args) => _ctx.onButtonDown && _ctx.onButtonDown(...args)),
  21195. onTouchstart: _cache[4] || (_cache[4] = (...args) => _ctx.onButtonDown && _ctx.onButtonDown(...args)),
  21196. onFocus: _cache[5] || (_cache[5] = (...args) => _ctx.handleMouseEnter && _ctx.handleMouseEnter(...args)),
  21197. onBlur: _cache[6] || (_cache[6] = (...args) => _ctx.handleMouseLeave && _ctx.handleMouseLeave(...args)),
  21198. onKeydown: [
  21199. _cache[7] || (_cache[7] = withKeys((...args) => _ctx.onLeftKeyDown && _ctx.onLeftKeyDown(...args), ["left"])),
  21200. _cache[8] || (_cache[8] = withKeys((...args) => _ctx.onRightKeyDown && _ctx.onRightKeyDown(...args), ["right"])),
  21201. _cache[9] || (_cache[9] = withKeys(withModifiers((...args) => _ctx.onLeftKeyDown && _ctx.onLeftKeyDown(...args), ["prevent"]), ["down"])),
  21202. _cache[10] || (_cache[10] = withKeys(withModifiers((...args) => _ctx.onRightKeyDown && _ctx.onRightKeyDown(...args), ["prevent"]), ["up"]))
  21203. ]
  21204. }, [
  21205. createVNode(_component_el_tooltip, {
  21206. ref: "tooltip",
  21207. visible: _ctx.tooltipVisible,
  21208. "onUpdate:visible": _cache[0] || (_cache[0] = ($event) => _ctx.tooltipVisible = $event),
  21209. placement: "top",
  21210. "stop-popper-mouse-event": false,
  21211. "popper-class": _ctx.tooltipClass,
  21212. disabled: !_ctx.showTooltip,
  21213. persistent: ""
  21214. }, {
  21215. content: withCtx(() => [
  21216. createElementVNode("span", null, toDisplayString(_ctx.formatValue), 1)
  21217. ]),
  21218. default: withCtx(() => [
  21219. createElementVNode("div", {
  21220. class: normalizeClass([_ctx.ns.e("button"), { hover: _ctx.hovering, dragging: _ctx.dragging }])
  21221. }, null, 2)
  21222. ]),
  21223. _: 1
  21224. }, 8, ["visible", "popper-class", "disabled"])
  21225. ], 38);
  21226. }
  21227. var SliderButton = /* @__PURE__ */ _export_sfc$1(_sfc_main$k, [["render", _sfc_render$7], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/slider/src/button.vue"]]);
  21228. const _sfc_main$j = defineComponent({
  21229. name: "ElMarker",
  21230. props: {
  21231. mark: {
  21232. type: [String, Object],
  21233. default: () => void 0
  21234. }
  21235. },
  21236. setup(props) {
  21237. const ns = useNamespace("slider");
  21238. const label = computed(() => {
  21239. return typeof props.mark === "string" ? props.mark : props.mark.label;
  21240. });
  21241. return {
  21242. ns,
  21243. label
  21244. };
  21245. },
  21246. render() {
  21247. var _a2;
  21248. return h$1("div", {
  21249. class: this.ns.e("marks-text"),
  21250. style: (_a2 = this.mark) == null ? void 0 : _a2.style
  21251. }, this.label);
  21252. }
  21253. });
  21254. var SliderMarker = /* @__PURE__ */ _export_sfc$1(_sfc_main$j, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/slider/src/marker.vue"]]);
  21255. const useMarks = (props) => {
  21256. return computed(() => {
  21257. if (!props.marks) {
  21258. return [];
  21259. }
  21260. const marksKeys = Object.keys(props.marks);
  21261. return marksKeys.map(parseFloat).sort((a2, b2) => a2 - b2).filter((point) => point <= props.max && point >= props.min).map((point) => ({
  21262. point,
  21263. position: (point - props.min) * 100 / (props.max - props.min),
  21264. mark: props.marks[point]
  21265. }));
  21266. });
  21267. };
  21268. const useSlide = (props, initData, emit) => {
  21269. const elForm2 = inject(formContextKey, {});
  21270. const elFormItem2 = inject(formItemContextKey, {});
  21271. const slider = shallowRef(null);
  21272. const firstButton = ref(null);
  21273. const secondButton = ref(null);
  21274. const buttonRefs = {
  21275. firstButton,
  21276. secondButton
  21277. };
  21278. const sliderDisabled = computed(() => {
  21279. return props.disabled || elForm2.disabled || false;
  21280. });
  21281. const minValue = computed(() => {
  21282. return Math.min(initData.firstValue, initData.secondValue);
  21283. });
  21284. const maxValue = computed(() => {
  21285. return Math.max(initData.firstValue, initData.secondValue);
  21286. });
  21287. const barSize = computed(() => {
  21288. return props.range ? `${100 * (maxValue.value - minValue.value) / (props.max - props.min)}%` : `${100 * (initData.firstValue - props.min) / (props.max - props.min)}%`;
  21289. });
  21290. const barStart = computed(() => {
  21291. return props.range ? `${100 * (minValue.value - props.min) / (props.max - props.min)}%` : "0%";
  21292. });
  21293. const runwayStyle = computed(() => {
  21294. return props.vertical ? { height: props.height } : {};
  21295. });
  21296. const barStyle = computed(() => {
  21297. return props.vertical ? {
  21298. height: barSize.value,
  21299. bottom: barStart.value
  21300. } : {
  21301. width: barSize.value,
  21302. left: barStart.value
  21303. };
  21304. });
  21305. const resetSize = () => {
  21306. if (slider.value) {
  21307. initData.sliderSize = slider.value[`client${props.vertical ? "Height" : "Width"}`];
  21308. }
  21309. };
  21310. const setPosition = (percent) => {
  21311. const targetValue = props.min + percent * (props.max - props.min) / 100;
  21312. if (!props.range) {
  21313. firstButton.value.setPosition(percent);
  21314. return;
  21315. }
  21316. let buttonRefName;
  21317. if (Math.abs(minValue.value - targetValue) < Math.abs(maxValue.value - targetValue)) {
  21318. buttonRefName = initData.firstValue < initData.secondValue ? "firstButton" : "secondButton";
  21319. } else {
  21320. buttonRefName = initData.firstValue > initData.secondValue ? "firstButton" : "secondButton";
  21321. }
  21322. buttonRefs[buttonRefName].value.setPosition(percent);
  21323. };
  21324. const setFirstValue = (firstValue) => {
  21325. initData.firstValue = firstValue;
  21326. _emit(props.range ? [minValue.value, maxValue.value] : firstValue);
  21327. };
  21328. const setSecondValue = (secondValue) => {
  21329. initData.secondValue = secondValue;
  21330. if (props.range) {
  21331. _emit([minValue.value, maxValue.value]);
  21332. }
  21333. };
  21334. const _emit = (val) => {
  21335. emit(UPDATE_MODEL_EVENT, val);
  21336. emit(INPUT_EVENT, val);
  21337. };
  21338. const emitChange = async () => {
  21339. await nextTick();
  21340. emit(CHANGE_EVENT, props.range ? [minValue.value, maxValue.value] : props.modelValue);
  21341. };
  21342. const onSliderClick = (event) => {
  21343. if (sliderDisabled.value || initData.dragging)
  21344. return;
  21345. resetSize();
  21346. if (props.vertical) {
  21347. const sliderOffsetBottom = slider.value.getBoundingClientRect().bottom;
  21348. setPosition((sliderOffsetBottom - event.clientY) / initData.sliderSize * 100);
  21349. } else {
  21350. const sliderOffsetLeft = slider.value.getBoundingClientRect().left;
  21351. setPosition((event.clientX - sliderOffsetLeft) / initData.sliderSize * 100);
  21352. }
  21353. emitChange();
  21354. };
  21355. return {
  21356. elFormItem: elFormItem2,
  21357. slider,
  21358. firstButton,
  21359. secondButton,
  21360. sliderDisabled,
  21361. minValue,
  21362. maxValue,
  21363. runwayStyle,
  21364. barStyle,
  21365. resetSize,
  21366. setPosition,
  21367. emitChange,
  21368. onSliderClick,
  21369. setFirstValue,
  21370. setSecondValue
  21371. };
  21372. };
  21373. const useStops = (props, initData, minValue, maxValue) => {
  21374. const stops = computed(() => {
  21375. if (!props.showStops || props.min > props.max)
  21376. return [];
  21377. if (props.step === 0) {
  21378. return [];
  21379. }
  21380. const stopCount = (props.max - props.min) / props.step;
  21381. const stepWidth = 100 * props.step / (props.max - props.min);
  21382. const result = Array.from({ length: stopCount - 1 }).map((_2, index) => (index + 1) * stepWidth);
  21383. if (props.range) {
  21384. return result.filter((step) => {
  21385. return step < 100 * (minValue.value - props.min) / (props.max - props.min) || step > 100 * (maxValue.value - props.min) / (props.max - props.min);
  21386. });
  21387. } else {
  21388. return result.filter((step) => step > 100 * (initData.firstValue - props.min) / (props.max - props.min));
  21389. }
  21390. });
  21391. const getStopStyle = (position) => {
  21392. return props.vertical ? { bottom: `${position}%` } : { left: `${position}%` };
  21393. };
  21394. return {
  21395. stops,
  21396. getStopStyle
  21397. };
  21398. };
  21399. const _sfc_main$i = defineComponent({
  21400. name: "ElSlider",
  21401. components: {
  21402. ElInputNumber,
  21403. SliderButton,
  21404. SliderMarker
  21405. },
  21406. props: {
  21407. modelValue: {
  21408. type: [Number, Array],
  21409. default: 0
  21410. },
  21411. min: {
  21412. type: Number,
  21413. default: 0
  21414. },
  21415. max: {
  21416. type: Number,
  21417. default: 100
  21418. },
  21419. step: {
  21420. type: Number,
  21421. default: 1
  21422. },
  21423. showInput: {
  21424. type: Boolean,
  21425. default: false
  21426. },
  21427. showInputControls: {
  21428. type: Boolean,
  21429. default: true
  21430. },
  21431. size: {
  21432. type: String,
  21433. validator: isValidComponentSize
  21434. },
  21435. inputSize: {
  21436. type: String,
  21437. validator: isValidComponentSize
  21438. },
  21439. showStops: {
  21440. type: Boolean,
  21441. default: false
  21442. },
  21443. showTooltip: {
  21444. type: Boolean,
  21445. default: true
  21446. },
  21447. formatTooltip: {
  21448. type: Function,
  21449. default: void 0
  21450. },
  21451. disabled: {
  21452. type: Boolean,
  21453. default: false
  21454. },
  21455. range: {
  21456. type: Boolean,
  21457. default: false
  21458. },
  21459. vertical: {
  21460. type: Boolean,
  21461. default: false
  21462. },
  21463. height: {
  21464. type: String,
  21465. default: ""
  21466. },
  21467. debounce: {
  21468. type: Number,
  21469. default: 300
  21470. },
  21471. label: {
  21472. type: String,
  21473. default: void 0
  21474. },
  21475. tooltipClass: {
  21476. type: String,
  21477. default: void 0
  21478. },
  21479. marks: Object
  21480. },
  21481. emits: [UPDATE_MODEL_EVENT, CHANGE_EVENT, INPUT_EVENT],
  21482. setup(props, { emit }) {
  21483. const ns = useNamespace("slider");
  21484. const initData = reactive({
  21485. firstValue: 0,
  21486. secondValue: 0,
  21487. oldValue: 0,
  21488. dragging: false,
  21489. sliderSize: 1
  21490. });
  21491. const {
  21492. elFormItem: elFormItem2,
  21493. slider,
  21494. firstButton,
  21495. secondButton,
  21496. sliderDisabled,
  21497. minValue,
  21498. maxValue,
  21499. runwayStyle,
  21500. barStyle,
  21501. resetSize,
  21502. emitChange,
  21503. onSliderClick,
  21504. setFirstValue,
  21505. setSecondValue
  21506. } = useSlide(props, initData, emit);
  21507. const { stops, getStopStyle } = useStops(props, initData, minValue, maxValue);
  21508. const sliderWrapperSize = useSize();
  21509. const sliderInputSize = computed(() => props.inputSize || sliderWrapperSize.value);
  21510. const sliderKls = computed(() => [
  21511. ns.b(),
  21512. ns.m(sliderWrapperSize.value),
  21513. ns.is("vertical", props.vertical),
  21514. { [ns.m("with-input")]: props.showInput }
  21515. ]);
  21516. const markList = useMarks(props);
  21517. useWatch(props, initData, minValue, maxValue, emit, elFormItem2);
  21518. const precision = computed(() => {
  21519. const precisions = [props.min, props.max, props.step].map((item) => {
  21520. const decimal = `${item}`.split(".")[1];
  21521. return decimal ? decimal.length : 0;
  21522. });
  21523. return Math.max.apply(null, precisions);
  21524. });
  21525. const { sliderWrapper } = useLifecycle(props, initData, resetSize);
  21526. const { firstValue, secondValue, oldValue, dragging, sliderSize } = toRefs(initData);
  21527. const updateDragging = (val) => {
  21528. initData.dragging = val;
  21529. };
  21530. provide("SliderProvider", __spreadProps(__spreadValues({}, toRefs(props)), {
  21531. sliderSize,
  21532. disabled: sliderDisabled,
  21533. precision,
  21534. emitChange,
  21535. resetSize,
  21536. updateDragging
  21537. }));
  21538. return {
  21539. ns,
  21540. firstValue,
  21541. secondValue,
  21542. oldValue,
  21543. dragging,
  21544. sliderSize,
  21545. slider,
  21546. firstButton,
  21547. secondButton,
  21548. sliderDisabled,
  21549. runwayStyle,
  21550. barStyle,
  21551. emitChange,
  21552. onSliderClick,
  21553. getStopStyle,
  21554. setFirstValue,
  21555. setSecondValue,
  21556. stops,
  21557. markList,
  21558. sliderWrapper,
  21559. sliderWrapperSize,
  21560. sliderInputSize,
  21561. sliderKls
  21562. };
  21563. }
  21564. });
  21565. const useWatch = (props, initData, minValue, maxValue, emit, elFormItem2) => {
  21566. const _emit = (val) => {
  21567. emit(UPDATE_MODEL_EVENT, val);
  21568. emit(INPUT_EVENT, val);
  21569. };
  21570. const valueChanged = () => {
  21571. if (props.range) {
  21572. return ![minValue.value, maxValue.value].every((item, index) => item === initData.oldValue[index]);
  21573. } else {
  21574. return props.modelValue !== initData.oldValue;
  21575. }
  21576. };
  21577. const setValues = () => {
  21578. var _a2, _b2;
  21579. if (props.min > props.max) {
  21580. throwError("Slider", "min should not be greater than max.");
  21581. return;
  21582. }
  21583. const val = props.modelValue;
  21584. if (props.range && Array.isArray(val)) {
  21585. if (val[1] < props.min) {
  21586. _emit([props.min, props.min]);
  21587. } else if (val[0] > props.max) {
  21588. _emit([props.max, props.max]);
  21589. } else if (val[0] < props.min) {
  21590. _emit([props.min, val[1]]);
  21591. } else if (val[1] > props.max) {
  21592. _emit([val[0], props.max]);
  21593. } else {
  21594. initData.firstValue = val[0];
  21595. initData.secondValue = val[1];
  21596. if (valueChanged()) {
  21597. (_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "change").catch((err) => debugWarn());
  21598. initData.oldValue = val.slice();
  21599. }
  21600. }
  21601. } else if (!props.range && typeof val === "number" && !Number.isNaN(val)) {
  21602. if (val < props.min) {
  21603. _emit(props.min);
  21604. } else if (val > props.max) {
  21605. _emit(props.max);
  21606. } else {
  21607. initData.firstValue = val;
  21608. if (valueChanged()) {
  21609. (_b2 = elFormItem2.validate) == null ? void 0 : _b2.call(elFormItem2, "change").catch((err) => debugWarn());
  21610. initData.oldValue = val;
  21611. }
  21612. }
  21613. }
  21614. };
  21615. setValues();
  21616. watch(() => initData.dragging, (val) => {
  21617. if (!val) {
  21618. setValues();
  21619. }
  21620. });
  21621. watch(() => props.modelValue, (val, oldVal) => {
  21622. if (initData.dragging || Array.isArray(val) && Array.isArray(oldVal) && val.every((item, index) => item === oldVal[index]) && initData.firstValue === val[0] && initData.secondValue === val[1]) {
  21623. return;
  21624. }
  21625. setValues();
  21626. }, {
  21627. deep: true
  21628. });
  21629. watch(() => [props.min, props.max], () => {
  21630. setValues();
  21631. });
  21632. };
  21633. const useLifecycle = (props, initData, resetSize) => {
  21634. const sliderWrapper = ref(null);
  21635. onMounted(async () => {
  21636. let valuetext;
  21637. if (props.range) {
  21638. if (Array.isArray(props.modelValue)) {
  21639. initData.firstValue = Math.max(props.min, props.modelValue[0]);
  21640. initData.secondValue = Math.min(props.max, props.modelValue[1]);
  21641. } else {
  21642. initData.firstValue = props.min;
  21643. initData.secondValue = props.max;
  21644. }
  21645. initData.oldValue = [initData.firstValue, initData.secondValue];
  21646. valuetext = `${initData.firstValue}-${initData.secondValue}`;
  21647. } else {
  21648. if (typeof props.modelValue !== "number" || Number.isNaN(props.modelValue)) {
  21649. initData.firstValue = props.min;
  21650. } else {
  21651. initData.firstValue = Math.min(props.max, Math.max(props.min, props.modelValue));
  21652. }
  21653. initData.oldValue = initData.firstValue;
  21654. valuetext = initData.firstValue;
  21655. }
  21656. sliderWrapper.value.setAttribute("aria-valuetext", valuetext);
  21657. sliderWrapper.value.setAttribute("aria-label", props.label ? props.label : `slider between ${props.min} and ${props.max}`);
  21658. on(window, "resize", resetSize);
  21659. await nextTick();
  21660. resetSize();
  21661. });
  21662. onBeforeUnmount(() => {
  21663. off(window, "resize", resetSize);
  21664. });
  21665. return {
  21666. sliderWrapper
  21667. };
  21668. };
  21669. const _hoisted_1$e = ["aria-valuemin", "aria-valuemax", "aria-orientation", "aria-disabled"];
  21670. const _hoisted_2$c = { key: 1 };
  21671. function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
  21672. const _component_slider_button = resolveComponent("slider-button");
  21673. const _component_slider_marker = resolveComponent("slider-marker");
  21674. const _component_el_input_number = resolveComponent("el-input-number");
  21675. return openBlock(), createElementBlock("div", {
  21676. ref: "sliderWrapper",
  21677. class: normalizeClass(_ctx.sliderKls),
  21678. role: "slider",
  21679. "aria-valuemin": _ctx.min,
  21680. "aria-valuemax": _ctx.max,
  21681. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  21682. "aria-disabled": _ctx.sliderDisabled
  21683. }, [
  21684. createElementVNode("div", {
  21685. ref: "slider",
  21686. class: normalizeClass([
  21687. _ctx.ns.e("runway"),
  21688. { "show-input": _ctx.showInput && !_ctx.range },
  21689. _ctx.ns.is("disabled", _ctx.sliderDisabled)
  21690. ]),
  21691. style: normalizeStyle(_ctx.runwayStyle),
  21692. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onSliderClick && _ctx.onSliderClick(...args))
  21693. }, [
  21694. createElementVNode("div", {
  21695. class: normalizeClass(_ctx.ns.e("bar")),
  21696. style: normalizeStyle(_ctx.barStyle)
  21697. }, null, 6),
  21698. createVNode(_component_slider_button, {
  21699. ref: "firstButton",
  21700. "model-value": _ctx.firstValue,
  21701. vertical: _ctx.vertical,
  21702. "tooltip-class": _ctx.tooltipClass,
  21703. "onUpdate:modelValue": _ctx.setFirstValue
  21704. }, null, 8, ["model-value", "vertical", "tooltip-class", "onUpdate:modelValue"]),
  21705. _ctx.range ? (openBlock(), createBlock(_component_slider_button, {
  21706. key: 0,
  21707. ref: "secondButton",
  21708. "model-value": _ctx.secondValue,
  21709. vertical: _ctx.vertical,
  21710. "tooltip-class": _ctx.tooltipClass,
  21711. "onUpdate:modelValue": _ctx.setSecondValue
  21712. }, null, 8, ["model-value", "vertical", "tooltip-class", "onUpdate:modelValue"])) : createCommentVNode("v-if", true),
  21713. _ctx.showStops ? (openBlock(), createElementBlock("div", _hoisted_2$c, [
  21714. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.stops, (item, key) => {
  21715. return openBlock(), createElementBlock("div", {
  21716. key,
  21717. class: normalizeClass(_ctx.ns.e("stop")),
  21718. style: normalizeStyle(_ctx.getStopStyle(item))
  21719. }, null, 6);
  21720. }), 128))
  21721. ])) : createCommentVNode("v-if", true),
  21722. _ctx.markList.length > 0 ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
  21723. createElementVNode("div", null, [
  21724. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.markList, (item, key) => {
  21725. return openBlock(), createElementBlock("div", {
  21726. key,
  21727. style: normalizeStyle(_ctx.getStopStyle(item.position)),
  21728. class: normalizeClass([_ctx.ns.e("stop"), _ctx.ns.e("marks-stop")])
  21729. }, null, 6);
  21730. }), 128))
  21731. ]),
  21732. createElementVNode("div", {
  21733. class: normalizeClass(_ctx.ns.e("marks"))
  21734. }, [
  21735. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.markList, (item, key) => {
  21736. return openBlock(), createBlock(_component_slider_marker, {
  21737. key,
  21738. mark: item.mark,
  21739. style: normalizeStyle(_ctx.getStopStyle(item.position))
  21740. }, null, 8, ["mark", "style"]);
  21741. }), 128))
  21742. ], 2)
  21743. ], 64)) : createCommentVNode("v-if", true)
  21744. ], 6),
  21745. _ctx.showInput && !_ctx.range ? (openBlock(), createBlock(_component_el_input_number, {
  21746. key: 0,
  21747. ref: "input",
  21748. "model-value": _ctx.firstValue,
  21749. class: normalizeClass(_ctx.ns.e("input")),
  21750. step: _ctx.step,
  21751. disabled: _ctx.sliderDisabled,
  21752. controls: _ctx.showInputControls,
  21753. min: _ctx.min,
  21754. max: _ctx.max,
  21755. debounce: _ctx.debounce,
  21756. size: _ctx.sliderInputSize,
  21757. "onUpdate:modelValue": _ctx.setFirstValue,
  21758. onChange: _ctx.emitChange
  21759. }, null, 8, ["model-value", "class", "step", "disabled", "controls", "min", "max", "debounce", "size", "onUpdate:modelValue", "onChange"])) : createCommentVNode("v-if", true)
  21760. ], 10, _hoisted_1$e);
  21761. }
  21762. var Slider = /* @__PURE__ */ _export_sfc$1(_sfc_main$i, [["render", _sfc_render$6], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/slider/src/index.vue"]]);
  21763. Slider.install = (app) => {
  21764. app.component(Slider.name, Slider);
  21765. };
  21766. const _Slider = Slider;
  21767. const ElSlider = _Slider;
  21768. const spaceItem = buildProps({
  21769. prefixCls: {
  21770. type: String,
  21771. default: ""
  21772. }
  21773. });
  21774. const _sfc_main$h = defineComponent({
  21775. props: spaceItem,
  21776. setup(props) {
  21777. const ns = useNamespace("space");
  21778. const classes = computed(() => `${props.prefixCls || ns.b()}__item`);
  21779. return {
  21780. classes
  21781. };
  21782. }
  21783. });
  21784. function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
  21785. return openBlock(), createElementBlock("div", {
  21786. class: normalizeClass(_ctx.classes)
  21787. }, [
  21788. renderSlot(_ctx.$slots, "default")
  21789. ], 2);
  21790. }
  21791. var Item = /* @__PURE__ */ _export_sfc$1(_sfc_main$h, [["render", _sfc_render$5], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/space/src/item.vue"]]);
  21792. const SIZE_MAP = {
  21793. small: 8,
  21794. default: 12,
  21795. large: 16
  21796. };
  21797. function useSpace(props) {
  21798. const ns = useNamespace("space");
  21799. const classes = computed(() => [ns.b(), ns.m(props.direction), props.class]);
  21800. const horizontalSize = ref(0);
  21801. const verticalSize = ref(0);
  21802. const containerStyle = computed(() => {
  21803. const wrapKls = props.wrap || props.fill ? { flexWrap: "wrap", marginBottom: `-${verticalSize.value}px` } : {};
  21804. const alignment = {
  21805. alignItems: props.alignment
  21806. };
  21807. return [wrapKls, alignment, props.style];
  21808. });
  21809. const itemStyle = computed(() => {
  21810. const itemBaseStyle = {
  21811. paddingBottom: `${verticalSize.value}px`,
  21812. marginRight: `${horizontalSize.value}px`
  21813. };
  21814. const fillStyle = props.fill ? { flexGrow: 1, minWidth: `${props.fillRatio}%` } : {};
  21815. return [itemBaseStyle, fillStyle];
  21816. });
  21817. watchEffect(() => {
  21818. const { size = "small", wrap, direction: dir, fill } = props;
  21819. if (Array.isArray(size)) {
  21820. const [h2 = 0, v2 = 0] = size;
  21821. horizontalSize.value = h2;
  21822. verticalSize.value = v2;
  21823. } else {
  21824. let val;
  21825. if (isNumber(size)) {
  21826. val = size;
  21827. } else {
  21828. val = SIZE_MAP[size] || SIZE_MAP.small;
  21829. }
  21830. if ((wrap || fill) && dir === "horizontal") {
  21831. horizontalSize.value = verticalSize.value = val;
  21832. } else {
  21833. if (dir === "horizontal") {
  21834. horizontalSize.value = val;
  21835. verticalSize.value = 0;
  21836. } else {
  21837. verticalSize.value = val;
  21838. horizontalSize.value = 0;
  21839. }
  21840. }
  21841. }
  21842. });
  21843. return {
  21844. classes,
  21845. containerStyle,
  21846. itemStyle
  21847. };
  21848. }
  21849. const spaceProps = buildProps({
  21850. direction: {
  21851. type: String,
  21852. values: ["horizontal", "vertical"],
  21853. default: "horizontal"
  21854. },
  21855. class: {
  21856. type: definePropType([
  21857. String,
  21858. Object,
  21859. Array
  21860. ]),
  21861. default: ""
  21862. },
  21863. style: {
  21864. type: definePropType([String, Array, Object]),
  21865. default: ""
  21866. },
  21867. alignment: {
  21868. type: definePropType(String),
  21869. default: "center"
  21870. },
  21871. prefixCls: {
  21872. type: String
  21873. },
  21874. spacer: {
  21875. type: definePropType([Object, String, Number, Array]),
  21876. default: null,
  21877. validator: (val) => isVNode(val) || isNumber(val) || isString(val)
  21878. },
  21879. wrap: {
  21880. type: Boolean,
  21881. default: false
  21882. },
  21883. fill: {
  21884. type: Boolean,
  21885. default: false
  21886. },
  21887. fillRatio: {
  21888. type: Number,
  21889. default: 100
  21890. },
  21891. size: {
  21892. type: [String, Array, Number],
  21893. values: componentSizes,
  21894. validator: (val) => {
  21895. return isNumber(val) || isArray(val) && val.length === 2 && val.every((i) => isNumber(i));
  21896. }
  21897. }
  21898. });
  21899. var Space = defineComponent({
  21900. name: "ElSpace",
  21901. props: spaceProps,
  21902. setup(props, { slots }) {
  21903. const { classes, containerStyle, itemStyle } = useSpace(props);
  21904. return () => {
  21905. var _a2;
  21906. const { spacer, prefixCls, direction } = props;
  21907. const children = renderSlot(slots, "default", { key: 0 }, () => []);
  21908. if (((_a2 = children.children) != null ? _a2 : []).length === 0)
  21909. return null;
  21910. if (isArray(children.children)) {
  21911. let extractedChildren = [];
  21912. children.children.forEach((child, loopKey) => {
  21913. if (isFragment(child)) {
  21914. if (isArray(child.children)) {
  21915. child.children.forEach((nested, key) => {
  21916. extractedChildren.push(createVNode(Item, {
  21917. style: itemStyle.value,
  21918. prefixCls,
  21919. key: `nested-${key}`
  21920. }, {
  21921. default: () => [nested]
  21922. }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"]));
  21923. });
  21924. }
  21925. } else if (isValidElementNode(child)) {
  21926. extractedChildren.push(createVNode(Item, {
  21927. style: itemStyle.value,
  21928. prefixCls,
  21929. key: `LoopKey${loopKey}`
  21930. }, {
  21931. default: () => [child]
  21932. }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"]));
  21933. }
  21934. });
  21935. if (spacer) {
  21936. const len = extractedChildren.length - 1;
  21937. extractedChildren = extractedChildren.reduce((acc, child, idx) => {
  21938. const children2 = [...acc, child];
  21939. if (idx !== len) {
  21940. children2.push(createVNode("span", {
  21941. style: [
  21942. itemStyle.value,
  21943. direction === "vertical" ? "width: 100%" : null
  21944. ],
  21945. key: idx
  21946. }, [
  21947. isVNode(spacer) ? spacer : createTextVNode(spacer, PatchFlags.TEXT)
  21948. ], PatchFlags.STYLE));
  21949. }
  21950. return children2;
  21951. }, []);
  21952. }
  21953. return createVNode("div", {
  21954. class: classes.value,
  21955. style: containerStyle.value
  21956. }, extractedChildren, PatchFlags.STYLE | PatchFlags.CLASS);
  21957. }
  21958. return children.children;
  21959. };
  21960. }
  21961. });
  21962. const ElSpace = withInstall(Space);
  21963. const switchProps = buildProps({
  21964. modelValue: {
  21965. type: [Boolean, String, Number],
  21966. default: false
  21967. },
  21968. value: {
  21969. type: [Boolean, String, Number],
  21970. default: false
  21971. },
  21972. disabled: {
  21973. type: Boolean,
  21974. default: false
  21975. },
  21976. width: {
  21977. type: Number,
  21978. default: 40
  21979. },
  21980. inlinePrompt: {
  21981. type: Boolean,
  21982. default: false
  21983. },
  21984. activeIcon: {
  21985. type: iconPropType,
  21986. default: ""
  21987. },
  21988. inactiveIcon: {
  21989. type: iconPropType,
  21990. default: ""
  21991. },
  21992. activeText: {
  21993. type: String,
  21994. default: ""
  21995. },
  21996. inactiveText: {
  21997. type: String,
  21998. default: ""
  21999. },
  22000. activeColor: {
  22001. type: String,
  22002. default: ""
  22003. },
  22004. inactiveColor: {
  22005. type: String,
  22006. default: ""
  22007. },
  22008. borderColor: {
  22009. type: String,
  22010. default: ""
  22011. },
  22012. activeValue: {
  22013. type: [Boolean, String, Number],
  22014. default: true
  22015. },
  22016. inactiveValue: {
  22017. type: [Boolean, String, Number],
  22018. default: false
  22019. },
  22020. name: {
  22021. type: String,
  22022. default: ""
  22023. },
  22024. validateEvent: {
  22025. type: Boolean,
  22026. default: true
  22027. },
  22028. id: String,
  22029. loading: {
  22030. type: Boolean,
  22031. default: false
  22032. },
  22033. beforeChange: {
  22034. type: definePropType(Function)
  22035. },
  22036. size: {
  22037. type: String,
  22038. validator: isValidComponentSize
  22039. }
  22040. });
  22041. const switchEmits = {
  22042. [UPDATE_MODEL_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val),
  22043. [CHANGE_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val),
  22044. [INPUT_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val)
  22045. };
  22046. const COMPONENT_NAME = "ElSwitch";
  22047. const _sfc_main$g = defineComponent({
  22048. name: COMPONENT_NAME,
  22049. components: { ElIcon, Loading: loading },
  22050. props: switchProps,
  22051. emits: switchEmits,
  22052. setup(props, { emit }) {
  22053. const { formItem } = useFormItem();
  22054. const switchDisabled = useDisabled$1(computed(() => props.loading));
  22055. const ns = useNamespace("switch");
  22056. const switchSize = useSize();
  22057. const isModelValue = ref(props.modelValue !== false);
  22058. const input = ref();
  22059. const core = ref();
  22060. const switchKls = computed(() => [
  22061. ns.b(),
  22062. ns.m(switchSize.value),
  22063. ns.is("disabled", switchDisabled.value),
  22064. ns.is("checked", checked.value)
  22065. ]);
  22066. watch(() => props.modelValue, () => {
  22067. isModelValue.value = true;
  22068. });
  22069. watch(() => props.value, () => {
  22070. isModelValue.value = false;
  22071. });
  22072. const actualValue = computed(() => {
  22073. return isModelValue.value ? props.modelValue : props.value;
  22074. });
  22075. const checked = computed(() => actualValue.value === props.activeValue);
  22076. if (![props.activeValue, props.inactiveValue].includes(actualValue.value)) {
  22077. emit(UPDATE_MODEL_EVENT, props.inactiveValue);
  22078. emit(CHANGE_EVENT, props.inactiveValue);
  22079. emit(INPUT_EVENT, props.inactiveValue);
  22080. }
  22081. watch(checked, () => {
  22082. var _a2;
  22083. input.value.checked = checked.value;
  22084. if (props.activeColor || props.inactiveColor) {
  22085. setBackgroundColor();
  22086. }
  22087. if (props.validateEvent) {
  22088. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "change").catch((err) => debugWarn());
  22089. }
  22090. });
  22091. const handleChange2 = () => {
  22092. const val = checked.value ? props.inactiveValue : props.activeValue;
  22093. emit(UPDATE_MODEL_EVENT, val);
  22094. emit(CHANGE_EVENT, val);
  22095. emit(INPUT_EVENT, val);
  22096. nextTick(() => {
  22097. input.value.checked = checked.value;
  22098. });
  22099. };
  22100. const switchValue = () => {
  22101. if (switchDisabled.value)
  22102. return;
  22103. const { beforeChange } = props;
  22104. if (!beforeChange) {
  22105. handleChange2();
  22106. return;
  22107. }
  22108. const shouldChange = beforeChange();
  22109. const isExpectType = [
  22110. isPromise(shouldChange),
  22111. isBoolean(shouldChange)
  22112. ].some((i) => i);
  22113. if (!isExpectType) {
  22114. throwError(COMPONENT_NAME, "beforeChange must return type `Promise<boolean>` or `boolean`");
  22115. }
  22116. if (isPromise(shouldChange)) {
  22117. shouldChange.then((result) => {
  22118. if (result) {
  22119. handleChange2();
  22120. }
  22121. }).catch((e) => {
  22122. });
  22123. } else if (shouldChange) {
  22124. handleChange2();
  22125. }
  22126. };
  22127. const setBackgroundColor = () => {
  22128. const newColor = checked.value ? props.activeColor : props.inactiveColor;
  22129. const coreEl = core.value;
  22130. if (props.borderColor)
  22131. coreEl.style.borderColor = props.borderColor;
  22132. else if (!props.borderColor)
  22133. coreEl.style.borderColor = newColor;
  22134. coreEl.style.backgroundColor = newColor;
  22135. coreEl.children[0].style.color = newColor;
  22136. };
  22137. const focus = () => {
  22138. var _a2, _b2;
  22139. (_b2 = (_a2 = input.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b2.call(_a2);
  22140. };
  22141. onMounted(() => {
  22142. if (props.activeColor || props.inactiveColor || props.borderColor) {
  22143. setBackgroundColor();
  22144. }
  22145. input.value.checked = checked.value;
  22146. });
  22147. return {
  22148. ns,
  22149. input,
  22150. core,
  22151. switchDisabled,
  22152. checked,
  22153. switchKls,
  22154. handleChange: handleChange2,
  22155. switchValue,
  22156. focus
  22157. };
  22158. }
  22159. });
  22160. const _hoisted_1$d = ["aria-checked", "aria-disabled"];
  22161. const _hoisted_2$b = ["id", "name", "true-value", "false-value", "disabled"];
  22162. const _hoisted_3$8 = ["aria-hidden"];
  22163. const _hoisted_4$7 = ["aria-hidden"];
  22164. const _hoisted_5$7 = ["aria-hidden"];
  22165. const _hoisted_6$6 = ["aria-hidden"];
  22166. function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
  22167. const _component_el_icon = resolveComponent("el-icon");
  22168. const _component_loading = resolveComponent("loading");
  22169. return openBlock(), createElementBlock("div", {
  22170. class: normalizeClass(_ctx.switchKls),
  22171. role: "switch",
  22172. "aria-checked": _ctx.checked,
  22173. "aria-disabled": _ctx.switchDisabled,
  22174. onClick: _cache[2] || (_cache[2] = withModifiers((...args) => _ctx.switchValue && _ctx.switchValue(...args), ["prevent"]))
  22175. }, [
  22176. createElementVNode("input", {
  22177. id: _ctx.id,
  22178. ref: "input",
  22179. class: normalizeClass(_ctx.ns.e("input")),
  22180. type: "checkbox",
  22181. name: _ctx.name,
  22182. "true-value": _ctx.activeValue,
  22183. "false-value": _ctx.inactiveValue,
  22184. disabled: _ctx.switchDisabled,
  22185. onChange: _cache[0] || (_cache[0] = (...args) => _ctx.handleChange && _ctx.handleChange(...args)),
  22186. onKeydown: _cache[1] || (_cache[1] = withKeys((...args) => _ctx.switchValue && _ctx.switchValue(...args), ["enter"]))
  22187. }, null, 42, _hoisted_2$b),
  22188. !_ctx.inlinePrompt && (_ctx.inactiveIcon || _ctx.inactiveText) ? (openBlock(), createElementBlock("span", {
  22189. key: 0,
  22190. class: normalizeClass([
  22191. _ctx.ns.e("label"),
  22192. _ctx.ns.em("label", "left"),
  22193. _ctx.ns.is("active", !_ctx.checked)
  22194. ])
  22195. }, [
  22196. _ctx.inactiveIcon ? (openBlock(), createBlock(_component_el_icon, { key: 0 }, {
  22197. default: withCtx(() => [
  22198. (openBlock(), createBlock(resolveDynamicComponent(_ctx.inactiveIcon)))
  22199. ]),
  22200. _: 1
  22201. })) : createCommentVNode("v-if", true),
  22202. !_ctx.inactiveIcon && _ctx.inactiveText ? (openBlock(), createElementBlock("span", {
  22203. key: 1,
  22204. "aria-hidden": _ctx.checked
  22205. }, toDisplayString(_ctx.inactiveText), 9, _hoisted_3$8)) : createCommentVNode("v-if", true)
  22206. ], 2)) : createCommentVNode("v-if", true),
  22207. createElementVNode("span", {
  22208. ref: "core",
  22209. class: normalizeClass(_ctx.ns.e("core")),
  22210. style: normalizeStyle({ width: (_ctx.width || 40) + "px" })
  22211. }, [
  22212. _ctx.inlinePrompt ? (openBlock(), createElementBlock("div", {
  22213. key: 0,
  22214. class: normalizeClass(_ctx.ns.e("inner"))
  22215. }, [
  22216. _ctx.activeIcon || _ctx.inactiveIcon ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  22217. _ctx.activeIcon ? (openBlock(), createBlock(_component_el_icon, {
  22218. key: 0,
  22219. class: normalizeClass([_ctx.ns.is("icon"), _ctx.checked ? _ctx.ns.is("show") : _ctx.ns.is("hide")])
  22220. }, {
  22221. default: withCtx(() => [
  22222. (openBlock(), createBlock(resolveDynamicComponent(_ctx.activeIcon)))
  22223. ]),
  22224. _: 1
  22225. }, 8, ["class"])) : createCommentVNode("v-if", true),
  22226. _ctx.inactiveIcon ? (openBlock(), createBlock(_component_el_icon, {
  22227. key: 1,
  22228. class: normalizeClass([_ctx.ns.is("icon"), !_ctx.checked ? _ctx.ns.is("show") : _ctx.ns.is("hide")])
  22229. }, {
  22230. default: withCtx(() => [
  22231. (openBlock(), createBlock(resolveDynamicComponent(_ctx.inactiveIcon)))
  22232. ]),
  22233. _: 1
  22234. }, 8, ["class"])) : createCommentVNode("v-if", true)
  22235. ], 64)) : _ctx.activeText || _ctx.inactiveIcon ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  22236. _ctx.activeText ? (openBlock(), createElementBlock("span", {
  22237. key: 0,
  22238. class: normalizeClass([_ctx.ns.is("text"), _ctx.checked ? _ctx.ns.is("show") : _ctx.ns.is("hide")]),
  22239. "aria-hidden": !_ctx.checked
  22240. }, toDisplayString(_ctx.activeText.substring(0, 3)), 11, _hoisted_4$7)) : createCommentVNode("v-if", true),
  22241. _ctx.inactiveText ? (openBlock(), createElementBlock("span", {
  22242. key: 1,
  22243. class: normalizeClass([_ctx.ns.is("text"), !_ctx.checked ? _ctx.ns.is("show") : _ctx.ns.is("hide")]),
  22244. "aria-hidden": _ctx.checked
  22245. }, toDisplayString(_ctx.inactiveText.substring(0, 3)), 11, _hoisted_5$7)) : createCommentVNode("v-if", true)
  22246. ], 64)) : createCommentVNode("v-if", true)
  22247. ], 2)) : createCommentVNode("v-if", true),
  22248. createElementVNode("div", {
  22249. class: normalizeClass(_ctx.ns.e("action"))
  22250. }, [
  22251. _ctx.loading ? (openBlock(), createBlock(_component_el_icon, {
  22252. key: 0,
  22253. class: normalizeClass(_ctx.ns.is("loading"))
  22254. }, {
  22255. default: withCtx(() => [
  22256. createVNode(_component_loading)
  22257. ]),
  22258. _: 1
  22259. }, 8, ["class"])) : createCommentVNode("v-if", true)
  22260. ], 2)
  22261. ], 6),
  22262. !_ctx.inlinePrompt && (_ctx.activeIcon || _ctx.activeText) ? (openBlock(), createElementBlock("span", {
  22263. key: 1,
  22264. class: normalizeClass([
  22265. _ctx.ns.e("label"),
  22266. _ctx.ns.em("label", "right"),
  22267. _ctx.ns.is("active", _ctx.checked)
  22268. ])
  22269. }, [
  22270. _ctx.activeIcon ? (openBlock(), createBlock(_component_el_icon, { key: 0 }, {
  22271. default: withCtx(() => [
  22272. (openBlock(), createBlock(resolveDynamicComponent(_ctx.activeIcon)))
  22273. ]),
  22274. _: 1
  22275. })) : createCommentVNode("v-if", true),
  22276. !_ctx.activeIcon && _ctx.activeText ? (openBlock(), createElementBlock("span", {
  22277. key: 1,
  22278. "aria-hidden": !_ctx.checked
  22279. }, toDisplayString(_ctx.activeText), 9, _hoisted_6$6)) : createCommentVNode("v-if", true)
  22280. ], 2)) : createCommentVNode("v-if", true)
  22281. ], 10, _hoisted_1$d);
  22282. }
  22283. var Switch = /* @__PURE__ */ _export_sfc$1(_sfc_main$g, [["render", _sfc_render$4], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/switch/src/switch.vue"]]);
  22284. const ElSwitch = withInstall(Switch);
  22285. /*!
  22286. * escape-html
  22287. * Copyright(c) 2012-2013 TJ Holowaychuk
  22288. * Copyright(c) 2015 Andreas Lubbe
  22289. * Copyright(c) 2015 Tiancheng "Timothy" Gu
  22290. * MIT Licensed
  22291. */
  22292. var matchHtmlRegExp = /["'&<>]/;
  22293. var escapeHtml_1 = escapeHtml;
  22294. function escapeHtml(string3) {
  22295. var str = "" + string3;
  22296. var match = matchHtmlRegExp.exec(str);
  22297. if (!match) {
  22298. return str;
  22299. }
  22300. var escape;
  22301. var html = "";
  22302. var index = 0;
  22303. var lastIndex = 0;
  22304. for (index = match.index; index < str.length; index++) {
  22305. switch (str.charCodeAt(index)) {
  22306. case 34:
  22307. escape = "&quot;";
  22308. break;
  22309. case 38:
  22310. escape = "&amp;";
  22311. break;
  22312. case 39:
  22313. escape = "&#39;";
  22314. break;
  22315. case 60:
  22316. escape = "&lt;";
  22317. break;
  22318. case 62:
  22319. escape = "&gt;";
  22320. break;
  22321. default:
  22322. continue;
  22323. }
  22324. if (lastIndex !== index) {
  22325. html += str.substring(lastIndex, index);
  22326. }
  22327. lastIndex = index + 1;
  22328. html += escape;
  22329. }
  22330. return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
  22331. }
  22332. const getCell = function(event) {
  22333. let cell = event.target;
  22334. while (cell && cell.tagName.toUpperCase() !== "HTML") {
  22335. if (cell.tagName.toUpperCase() === "TD") {
  22336. return cell;
  22337. }
  22338. cell = cell.parentNode;
  22339. }
  22340. return null;
  22341. };
  22342. const isObject = function(obj) {
  22343. return obj !== null && typeof obj === "object";
  22344. };
  22345. const orderBy = function(array4, sortKey, reverse, sortMethod, sortBy) {
  22346. if (!sortKey && !sortMethod && (!sortBy || Array.isArray(sortBy) && !sortBy.length)) {
  22347. return array4;
  22348. }
  22349. if (typeof reverse === "string") {
  22350. reverse = reverse === "descending" ? -1 : 1;
  22351. } else {
  22352. reverse = reverse && reverse < 0 ? -1 : 1;
  22353. }
  22354. const getKey = sortMethod ? null : function(value, index) {
  22355. if (sortBy) {
  22356. if (!Array.isArray(sortBy)) {
  22357. sortBy = [sortBy];
  22358. }
  22359. return sortBy.map((by) => {
  22360. if (typeof by === "string") {
  22361. return get(value, by);
  22362. } else {
  22363. return by(value, index, array4);
  22364. }
  22365. });
  22366. }
  22367. if (sortKey !== "$key") {
  22368. if (isObject(value) && "$value" in value)
  22369. value = value.$value;
  22370. }
  22371. return [isObject(value) ? get(value, sortKey) : value];
  22372. };
  22373. const compare = function(a2, b2) {
  22374. if (sortMethod) {
  22375. return sortMethod(a2.value, b2.value);
  22376. }
  22377. for (let i = 0, len = a2.key.length; i < len; i++) {
  22378. if (a2.key[i] < b2.key[i]) {
  22379. return -1;
  22380. }
  22381. if (a2.key[i] > b2.key[i]) {
  22382. return 1;
  22383. }
  22384. }
  22385. return 0;
  22386. };
  22387. return array4.map((value, index) => {
  22388. return {
  22389. value,
  22390. index,
  22391. key: getKey ? getKey(value, index) : null
  22392. };
  22393. }).sort((a2, b2) => {
  22394. let order2 = compare(a2, b2);
  22395. if (!order2) {
  22396. order2 = a2.index - b2.index;
  22397. }
  22398. return order2 * +reverse;
  22399. }).map((item) => item.value);
  22400. };
  22401. const getColumnById = function(table, columnId) {
  22402. let column = null;
  22403. table.columns.forEach((item) => {
  22404. if (item.id === columnId) {
  22405. column = item;
  22406. }
  22407. });
  22408. return column;
  22409. };
  22410. const getColumnByKey = function(table, columnKey) {
  22411. let column = null;
  22412. for (let i = 0; i < table.columns.length; i++) {
  22413. const item = table.columns[i];
  22414. if (item.columnKey === columnKey) {
  22415. column = item;
  22416. break;
  22417. }
  22418. }
  22419. return column;
  22420. };
  22421. const getColumnByCell = function(table, cell, namespace) {
  22422. const matches = (cell.className || "").match(new RegExp(`${namespace}-table_[^\\s]+`, "gm"));
  22423. if (matches) {
  22424. return getColumnById(table, matches[0]);
  22425. }
  22426. return null;
  22427. };
  22428. const getRowIdentity = (row, rowKey) => {
  22429. if (!row)
  22430. throw new Error("Row is required when get row identity");
  22431. if (typeof rowKey === "string") {
  22432. if (!rowKey.includes(".")) {
  22433. return `${row[rowKey]}`;
  22434. }
  22435. const key = rowKey.split(".");
  22436. let current = row;
  22437. for (const element of key) {
  22438. current = current[element];
  22439. }
  22440. return `${current}`;
  22441. } else if (typeof rowKey === "function") {
  22442. return rowKey.call(null, row);
  22443. }
  22444. };
  22445. const getKeysMap = function(array4, rowKey) {
  22446. const arrayMap2 = {};
  22447. (array4 || []).forEach((row, index) => {
  22448. arrayMap2[getRowIdentity(row, rowKey)] = { row, index };
  22449. });
  22450. return arrayMap2;
  22451. };
  22452. function mergeOptions(defaults, config) {
  22453. const options = {};
  22454. let key;
  22455. for (key in defaults) {
  22456. options[key] = defaults[key];
  22457. }
  22458. for (key in config) {
  22459. if (hasOwn(config, key)) {
  22460. const value = config[key];
  22461. if (typeof value !== "undefined") {
  22462. options[key] = value;
  22463. }
  22464. }
  22465. }
  22466. return options;
  22467. }
  22468. function parseWidth(width) {
  22469. if (width === "")
  22470. return width;
  22471. if (width !== void 0) {
  22472. width = Number.parseInt(width, 10);
  22473. if (Number.isNaN(width)) {
  22474. width = "";
  22475. }
  22476. }
  22477. return width;
  22478. }
  22479. function parseMinWidth(minWidth) {
  22480. if (minWidth === "")
  22481. return minWidth;
  22482. if (minWidth !== void 0) {
  22483. minWidth = parseWidth(minWidth);
  22484. if (Number.isNaN(minWidth)) {
  22485. minWidth = 80;
  22486. }
  22487. }
  22488. return minWidth;
  22489. }
  22490. function parseHeight(height) {
  22491. if (typeof height === "number") {
  22492. return height;
  22493. }
  22494. if (typeof height === "string") {
  22495. if (/^\d+(?:px)?$/.test(height)) {
  22496. return Number.parseInt(height, 10);
  22497. } else {
  22498. return height;
  22499. }
  22500. }
  22501. return null;
  22502. }
  22503. function compose(...funcs) {
  22504. if (funcs.length === 0) {
  22505. return (arg) => arg;
  22506. }
  22507. if (funcs.length === 1) {
  22508. return funcs[0];
  22509. }
  22510. return funcs.reduce((a2, b2) => (...args) => a2(b2(...args)));
  22511. }
  22512. function toggleRowStatus(statusArr, row, newVal) {
  22513. let changed = false;
  22514. const index = statusArr.indexOf(row);
  22515. const included = index !== -1;
  22516. const addRow = () => {
  22517. statusArr.push(row);
  22518. changed = true;
  22519. };
  22520. const removeRow = () => {
  22521. statusArr.splice(index, 1);
  22522. changed = true;
  22523. };
  22524. if (typeof newVal === "boolean") {
  22525. if (newVal && !included) {
  22526. addRow();
  22527. } else if (!newVal && included) {
  22528. removeRow();
  22529. }
  22530. } else {
  22531. if (included) {
  22532. removeRow();
  22533. } else {
  22534. addRow();
  22535. }
  22536. }
  22537. return changed;
  22538. }
  22539. function walkTreeNode(root2, cb, childrenKey = "children", lazyKey = "hasChildren") {
  22540. const isNil2 = (array4) => !(Array.isArray(array4) && array4.length);
  22541. function _walker(parent, children, level) {
  22542. cb(parent, children, level);
  22543. children.forEach((item) => {
  22544. if (item[lazyKey]) {
  22545. cb(item, null, level + 1);
  22546. return;
  22547. }
  22548. const children2 = item[childrenKey];
  22549. if (!isNil2(children2)) {
  22550. _walker(item, children2, level + 1);
  22551. }
  22552. });
  22553. }
  22554. root2.forEach((item) => {
  22555. if (item[lazyKey]) {
  22556. cb(item, null, 0);
  22557. return;
  22558. }
  22559. const children = item[childrenKey];
  22560. if (!isNil2(children)) {
  22561. _walker(item, children, 0);
  22562. }
  22563. });
  22564. }
  22565. let removePopper;
  22566. function createTablePopper(trigger, popperContent, popperOptions2, tooltipEffect) {
  22567. const { nextZIndex } = useZIndex();
  22568. function renderContent() {
  22569. const isLight = tooltipEffect === "light";
  22570. const content22 = document.createElement("div");
  22571. content22.className = `el-popper ${isLight ? "is-light" : "is-dark"}`;
  22572. popperContent = escapeHtml_1(popperContent);
  22573. content22.innerHTML = popperContent;
  22574. content22.style.zIndex = String(nextZIndex());
  22575. document.body.appendChild(content22);
  22576. return content22;
  22577. }
  22578. function renderArrow() {
  22579. const arrow22 = document.createElement("div");
  22580. arrow22.className = "el-popper__arrow";
  22581. return arrow22;
  22582. }
  22583. function showPopper() {
  22584. popperInstance && popperInstance.update();
  22585. }
  22586. removePopper = function removePopper2() {
  22587. try {
  22588. popperInstance && popperInstance.destroy();
  22589. content2 && document.body.removeChild(content2);
  22590. off(trigger, "mouseenter", showPopper);
  22591. off(trigger, "mouseleave", removePopper2);
  22592. } catch (e) {
  22593. }
  22594. };
  22595. let popperInstance = null;
  22596. const content2 = renderContent();
  22597. const arrow2 = renderArrow();
  22598. content2.appendChild(arrow2);
  22599. popperInstance = createPopper(trigger, content2, __spreadValues({
  22600. modifiers: [
  22601. {
  22602. name: "offset",
  22603. options: {
  22604. offset: [0, 8]
  22605. }
  22606. },
  22607. {
  22608. name: "arrow",
  22609. options: {
  22610. element: arrow2,
  22611. padding: 10
  22612. }
  22613. }
  22614. ]
  22615. }, popperOptions2));
  22616. on(trigger, "mouseenter", showPopper);
  22617. on(trigger, "mouseleave", removePopper);
  22618. return popperInstance;
  22619. }
  22620. const isFixedColumn = (index, fixed, store, realColumns) => {
  22621. let start2 = 0;
  22622. let after = index;
  22623. if (realColumns) {
  22624. if (realColumns[index].colSpan > 1) {
  22625. return {};
  22626. }
  22627. for (let i = 0; i < index; i++) {
  22628. start2 += realColumns[i].colSpan;
  22629. }
  22630. after = start2 + realColumns[index].colSpan - 1;
  22631. } else {
  22632. start2 = index;
  22633. }
  22634. let fixedLayout;
  22635. const columns = store.states.columns;
  22636. switch (fixed) {
  22637. case "left":
  22638. if (after < store.states.fixedLeafColumnsLength.value) {
  22639. fixedLayout = "left";
  22640. }
  22641. break;
  22642. case "right":
  22643. if (start2 >= columns.value.length - store.states.rightFixedLeafColumnsLength.value) {
  22644. fixedLayout = "right";
  22645. }
  22646. break;
  22647. default:
  22648. if (after < store.states.fixedLeafColumnsLength.value) {
  22649. fixedLayout = "left";
  22650. } else if (start2 >= columns.value.length - store.states.rightFixedLeafColumnsLength.value) {
  22651. fixedLayout = "right";
  22652. }
  22653. }
  22654. return fixedLayout ? {
  22655. direction: fixedLayout,
  22656. start: start2,
  22657. after
  22658. } : {};
  22659. };
  22660. const getFixedColumnsClass = (namespace, index, fixed, store, realColumns) => {
  22661. const classes = [];
  22662. const { direction, start: start2 } = isFixedColumn(index, fixed, store, realColumns);
  22663. if (direction) {
  22664. const isLeft = direction === "left";
  22665. classes.push(`${namespace}-fixed-column--${direction}`);
  22666. if (isLeft && start2 === store.states.fixedLeafColumnsLength.value - 1) {
  22667. classes.push("is-last-column");
  22668. } else if (!isLeft && start2 === store.states.columns.value.length - store.states.rightFixedLeafColumnsLength.value) {
  22669. classes.push("is-first-column");
  22670. }
  22671. }
  22672. return classes;
  22673. };
  22674. function getOffset(offset2, column) {
  22675. return offset2 + (column.realWidth === null || Number.isNaN(column.realWidth) ? Number(column.width) : column.realWidth);
  22676. }
  22677. const getFixedColumnOffset = (index, fixed, store, realColumns) => {
  22678. const { direction, start: start2 = 0 } = isFixedColumn(index, fixed, store, realColumns);
  22679. if (!direction) {
  22680. return;
  22681. }
  22682. const styles = {};
  22683. const isLeft = direction === "left";
  22684. const columns = store.states.columns.value;
  22685. if (isLeft) {
  22686. styles.left = columns.slice(0, index).reduce(getOffset, 0);
  22687. } else {
  22688. styles.right = columns.slice(start2 + 1).reverse().reduce(getOffset, 0);
  22689. }
  22690. return styles;
  22691. };
  22692. const ensurePosition = (style, key) => {
  22693. if (!style)
  22694. return;
  22695. if (!Number.isNaN(style[key])) {
  22696. style[key] = `${style[key]}px`;
  22697. }
  22698. };
  22699. function useExpand(watcherData) {
  22700. const instance = getCurrentInstance();
  22701. const defaultExpandAll = ref(false);
  22702. const expandRows = ref([]);
  22703. const updateExpandRows = () => {
  22704. const data2 = watcherData.data.value || [];
  22705. const rowKey = watcherData.rowKey.value;
  22706. if (defaultExpandAll.value) {
  22707. expandRows.value = data2.slice();
  22708. } else if (rowKey) {
  22709. const expandRowsMap = getKeysMap(expandRows.value, rowKey);
  22710. expandRows.value = data2.reduce((prev, row) => {
  22711. const rowId = getRowIdentity(row, rowKey);
  22712. const rowInfo = expandRowsMap[rowId];
  22713. if (rowInfo) {
  22714. prev.push(row);
  22715. }
  22716. return prev;
  22717. }, []);
  22718. } else {
  22719. expandRows.value = [];
  22720. }
  22721. };
  22722. const toggleRowExpansion = (row, expanded) => {
  22723. const changed = toggleRowStatus(expandRows.value, row, expanded);
  22724. if (changed) {
  22725. instance.emit("expand-change", row, expandRows.value.slice());
  22726. }
  22727. };
  22728. const setExpandRowKeys = (rowKeys) => {
  22729. instance.store.assertRowKey();
  22730. const data2 = watcherData.data.value || [];
  22731. const rowKey = watcherData.rowKey.value;
  22732. const keysMap = getKeysMap(data2, rowKey);
  22733. expandRows.value = rowKeys.reduce((prev, cur) => {
  22734. const info = keysMap[cur];
  22735. if (info) {
  22736. prev.push(info.row);
  22737. }
  22738. return prev;
  22739. }, []);
  22740. };
  22741. const isRowExpanded = (row) => {
  22742. const rowKey = watcherData.rowKey.value;
  22743. if (rowKey) {
  22744. const expandMap = getKeysMap(expandRows.value, rowKey);
  22745. return !!expandMap[getRowIdentity(row, rowKey)];
  22746. }
  22747. return expandRows.value.includes(row);
  22748. };
  22749. return {
  22750. updateExpandRows,
  22751. toggleRowExpansion,
  22752. setExpandRowKeys,
  22753. isRowExpanded,
  22754. states: {
  22755. expandRows,
  22756. defaultExpandAll
  22757. }
  22758. };
  22759. }
  22760. function useCurrent(watcherData) {
  22761. const instance = getCurrentInstance();
  22762. const _currentRowKey = ref(null);
  22763. const currentRow = ref(null);
  22764. const setCurrentRowKey = (key) => {
  22765. instance.store.assertRowKey();
  22766. _currentRowKey.value = key;
  22767. setCurrentRowByKey(key);
  22768. };
  22769. const restoreCurrentRowKey = () => {
  22770. _currentRowKey.value = null;
  22771. };
  22772. const setCurrentRowByKey = (key) => {
  22773. const { data: data2, rowKey } = watcherData;
  22774. let _currentRow = null;
  22775. if (rowKey.value) {
  22776. _currentRow = (unref(data2) || []).find((item) => getRowIdentity(item, rowKey.value) === key);
  22777. }
  22778. currentRow.value = _currentRow;
  22779. instance.emit("current-change", currentRow.value, null);
  22780. };
  22781. const updateCurrentRow = (_currentRow) => {
  22782. const oldCurrentRow = currentRow.value;
  22783. if (_currentRow && _currentRow !== oldCurrentRow) {
  22784. currentRow.value = _currentRow;
  22785. instance.emit("current-change", currentRow.value, oldCurrentRow);
  22786. return;
  22787. }
  22788. if (!_currentRow && oldCurrentRow) {
  22789. currentRow.value = null;
  22790. instance.emit("current-change", null, oldCurrentRow);
  22791. }
  22792. };
  22793. const updateCurrentRowData = () => {
  22794. const rowKey = watcherData.rowKey.value;
  22795. const data2 = watcherData.data.value || [];
  22796. const oldCurrentRow = currentRow.value;
  22797. if (!data2.includes(oldCurrentRow) && oldCurrentRow) {
  22798. if (rowKey) {
  22799. const currentRowKey = getRowIdentity(oldCurrentRow, rowKey);
  22800. setCurrentRowByKey(currentRowKey);
  22801. } else {
  22802. currentRow.value = null;
  22803. }
  22804. if (currentRow.value === null) {
  22805. instance.emit("current-change", null, oldCurrentRow);
  22806. }
  22807. } else if (_currentRowKey.value) {
  22808. setCurrentRowByKey(_currentRowKey.value);
  22809. restoreCurrentRowKey();
  22810. }
  22811. };
  22812. return {
  22813. setCurrentRowKey,
  22814. restoreCurrentRowKey,
  22815. setCurrentRowByKey,
  22816. updateCurrentRow,
  22817. updateCurrentRowData,
  22818. states: {
  22819. _currentRowKey,
  22820. currentRow
  22821. }
  22822. };
  22823. }
  22824. function useTree(watcherData) {
  22825. const expandRowKeys = ref([]);
  22826. const treeData = ref({});
  22827. const indent = ref(16);
  22828. const lazy = ref(false);
  22829. const lazyTreeNodeMap = ref({});
  22830. const lazyColumnIdentifier = ref("hasChildren");
  22831. const childrenColumnName = ref("children");
  22832. const instance = getCurrentInstance();
  22833. const normalizedData = computed(() => {
  22834. if (!watcherData.rowKey.value)
  22835. return {};
  22836. const data2 = watcherData.data.value || [];
  22837. return normalize(data2);
  22838. });
  22839. const normalizedLazyNode = computed(() => {
  22840. const rowKey = watcherData.rowKey.value;
  22841. const keys2 = Object.keys(lazyTreeNodeMap.value);
  22842. const res = {};
  22843. if (!keys2.length)
  22844. return res;
  22845. keys2.forEach((key) => {
  22846. if (lazyTreeNodeMap.value[key].length) {
  22847. const item = { children: [] };
  22848. lazyTreeNodeMap.value[key].forEach((row) => {
  22849. const currentRowKey = getRowIdentity(row, rowKey);
  22850. item.children.push(currentRowKey);
  22851. if (row[lazyColumnIdentifier.value] && !res[currentRowKey]) {
  22852. res[currentRowKey] = { children: [] };
  22853. }
  22854. });
  22855. res[key] = item;
  22856. }
  22857. });
  22858. return res;
  22859. });
  22860. const normalize = (data2) => {
  22861. const rowKey = watcherData.rowKey.value;
  22862. const res = {};
  22863. walkTreeNode(data2, (parent, children, level) => {
  22864. const parentId = getRowIdentity(parent, rowKey);
  22865. if (Array.isArray(children)) {
  22866. res[parentId] = {
  22867. children: children.map((row) => getRowIdentity(row, rowKey)),
  22868. level
  22869. };
  22870. } else if (lazy.value) {
  22871. res[parentId] = {
  22872. children: [],
  22873. lazy: true,
  22874. level
  22875. };
  22876. }
  22877. }, childrenColumnName.value, lazyColumnIdentifier.value);
  22878. return res;
  22879. };
  22880. const updateTreeData = (ifChangeExpandRowKeys = false, ifExpandAll = ((_a2) => (_a2 = instance.store) == null ? void 0 : _a2.states.defaultExpandAll.value)()) => {
  22881. var _a2;
  22882. const nested = normalizedData.value;
  22883. const normalizedLazyNode_ = normalizedLazyNode.value;
  22884. const keys2 = Object.keys(nested);
  22885. const newTreeData = {};
  22886. if (keys2.length) {
  22887. const oldTreeData = unref(treeData);
  22888. const rootLazyRowKeys = [];
  22889. const getExpanded = (oldValue, key) => {
  22890. if (ifChangeExpandRowKeys) {
  22891. if (expandRowKeys.value) {
  22892. return ifExpandAll || expandRowKeys.value.includes(key);
  22893. } else {
  22894. return !!(ifExpandAll || (oldValue == null ? void 0 : oldValue.expanded));
  22895. }
  22896. } else {
  22897. const included = ifExpandAll || expandRowKeys.value && expandRowKeys.value.includes(key);
  22898. return !!((oldValue == null ? void 0 : oldValue.expanded) || included);
  22899. }
  22900. };
  22901. keys2.forEach((key) => {
  22902. const oldValue = oldTreeData[key];
  22903. const newValue = __spreadValues({}, nested[key]);
  22904. newValue.expanded = getExpanded(oldValue, key);
  22905. if (newValue.lazy) {
  22906. const { loaded = false, loading: loading2 = false } = oldValue || {};
  22907. newValue.loaded = !!loaded;
  22908. newValue.loading = !!loading2;
  22909. rootLazyRowKeys.push(key);
  22910. }
  22911. newTreeData[key] = newValue;
  22912. });
  22913. const lazyKeys = Object.keys(normalizedLazyNode_);
  22914. if (lazy.value && lazyKeys.length && rootLazyRowKeys.length) {
  22915. lazyKeys.forEach((key) => {
  22916. const oldValue = oldTreeData[key];
  22917. const lazyNodeChildren = normalizedLazyNode_[key].children;
  22918. if (rootLazyRowKeys.includes(key)) {
  22919. if (newTreeData[key].children.length !== 0) {
  22920. throw new Error("[ElTable]children must be an empty array.");
  22921. }
  22922. newTreeData[key].children = lazyNodeChildren;
  22923. } else {
  22924. const { loaded = false, loading: loading2 = false } = oldValue || {};
  22925. newTreeData[key] = {
  22926. lazy: true,
  22927. loaded: !!loaded,
  22928. loading: !!loading2,
  22929. expanded: getExpanded(oldValue, key),
  22930. children: lazyNodeChildren,
  22931. level: ""
  22932. };
  22933. }
  22934. });
  22935. }
  22936. }
  22937. treeData.value = newTreeData;
  22938. (_a2 = instance.store) == null ? void 0 : _a2.updateTableScrollY();
  22939. };
  22940. watch(() => expandRowKeys.value, () => {
  22941. updateTreeData(true);
  22942. });
  22943. watch(() => normalizedData.value, () => {
  22944. updateTreeData();
  22945. });
  22946. watch(() => normalizedLazyNode.value, () => {
  22947. updateTreeData();
  22948. });
  22949. const updateTreeExpandKeys = (value) => {
  22950. expandRowKeys.value = value;
  22951. updateTreeData();
  22952. };
  22953. const toggleTreeExpansion = (row, expanded) => {
  22954. instance.store.assertRowKey();
  22955. const rowKey = watcherData.rowKey.value;
  22956. const id = getRowIdentity(row, rowKey);
  22957. const data2 = id && treeData.value[id];
  22958. if (id && data2 && "expanded" in data2) {
  22959. const oldExpanded = data2.expanded;
  22960. expanded = typeof expanded === "undefined" ? !data2.expanded : expanded;
  22961. treeData.value[id].expanded = expanded;
  22962. if (oldExpanded !== expanded) {
  22963. instance.emit("expand-change", row, expanded);
  22964. }
  22965. instance.store.updateTableScrollY();
  22966. }
  22967. };
  22968. const loadOrToggle = (row) => {
  22969. instance.store.assertRowKey();
  22970. const rowKey = watcherData.rowKey.value;
  22971. const id = getRowIdentity(row, rowKey);
  22972. const data2 = treeData.value[id];
  22973. if (lazy.value && data2 && "loaded" in data2 && !data2.loaded) {
  22974. loadData(row, id, data2);
  22975. } else {
  22976. toggleTreeExpansion(row, void 0);
  22977. }
  22978. };
  22979. const loadData = (row, key, treeNode) => {
  22980. const { load } = instance.props;
  22981. if (load && !treeData.value[key].loaded) {
  22982. treeData.value[key].loading = true;
  22983. load(row, treeNode, (data2) => {
  22984. if (!Array.isArray(data2)) {
  22985. throw new TypeError("[ElTable] data must be an array");
  22986. }
  22987. treeData.value[key].loading = false;
  22988. treeData.value[key].loaded = true;
  22989. treeData.value[key].expanded = true;
  22990. if (data2.length) {
  22991. lazyTreeNodeMap.value[key] = data2;
  22992. }
  22993. instance.emit("expand-change", row, true);
  22994. });
  22995. }
  22996. };
  22997. return {
  22998. loadData,
  22999. loadOrToggle,
  23000. toggleTreeExpansion,
  23001. updateTreeExpandKeys,
  23002. updateTreeData,
  23003. normalize,
  23004. states: {
  23005. expandRowKeys,
  23006. treeData,
  23007. indent,
  23008. lazy,
  23009. lazyTreeNodeMap,
  23010. lazyColumnIdentifier,
  23011. childrenColumnName
  23012. }
  23013. };
  23014. }
  23015. const sortData = (data2, states) => {
  23016. const sortingColumn = states.sortingColumn;
  23017. if (!sortingColumn || typeof sortingColumn.sortable === "string") {
  23018. return data2;
  23019. }
  23020. return orderBy(data2, states.sortProp, states.sortOrder, sortingColumn.sortMethod, sortingColumn.sortBy);
  23021. };
  23022. const doFlattenColumns = (columns) => {
  23023. const result = [];
  23024. columns.forEach((column) => {
  23025. if (column.children) {
  23026. result.push.apply(result, doFlattenColumns(column.children));
  23027. } else {
  23028. result.push(column);
  23029. }
  23030. });
  23031. return result;
  23032. };
  23033. function useWatcher$1() {
  23034. var _a2;
  23035. const instance = getCurrentInstance();
  23036. const { size: tableSize } = toRefs((_a2 = instance.proxy) == null ? void 0 : _a2.$props);
  23037. const rowKey = ref(null);
  23038. const data2 = ref([]);
  23039. const _data = ref([]);
  23040. const isComplex = ref(false);
  23041. const _columns = ref([]);
  23042. const originColumns = ref([]);
  23043. const columns = ref([]);
  23044. const fixedColumns = ref([]);
  23045. const rightFixedColumns = ref([]);
  23046. const leafColumns = ref([]);
  23047. const fixedLeafColumns = ref([]);
  23048. const rightFixedLeafColumns = ref([]);
  23049. const leafColumnsLength = ref(0);
  23050. const fixedLeafColumnsLength = ref(0);
  23051. const rightFixedLeafColumnsLength = ref(0);
  23052. const isAllSelected = ref(false);
  23053. const selection = ref([]);
  23054. const reserveSelection = ref(false);
  23055. const selectOnIndeterminate = ref(false);
  23056. const selectable = ref(null);
  23057. const filters = ref({});
  23058. const filteredData = ref(null);
  23059. const sortingColumn = ref(null);
  23060. const sortProp = ref(null);
  23061. const sortOrder = ref(null);
  23062. const hoverRow = ref(null);
  23063. watch(data2, () => instance.state && scheduleLayout(false), {
  23064. deep: true
  23065. });
  23066. const assertRowKey = () => {
  23067. if (!rowKey.value)
  23068. throw new Error("[ElTable] prop row-key is required");
  23069. };
  23070. const updateColumns = () => {
  23071. fixedColumns.value = _columns.value.filter((column) => column.fixed === true || column.fixed === "left");
  23072. rightFixedColumns.value = _columns.value.filter((column) => column.fixed === "right");
  23073. if (fixedColumns.value.length > 0 && _columns.value[0] && _columns.value[0].type === "selection" && !_columns.value[0].fixed) {
  23074. _columns.value[0].fixed = true;
  23075. fixedColumns.value.unshift(_columns.value[0]);
  23076. }
  23077. const notFixedColumns = _columns.value.filter((column) => !column.fixed);
  23078. originColumns.value = [].concat(fixedColumns.value).concat(notFixedColumns).concat(rightFixedColumns.value);
  23079. const leafColumns2 = doFlattenColumns(notFixedColumns);
  23080. const fixedLeafColumns2 = doFlattenColumns(fixedColumns.value);
  23081. const rightFixedLeafColumns2 = doFlattenColumns(rightFixedColumns.value);
  23082. leafColumnsLength.value = leafColumns2.length;
  23083. fixedLeafColumnsLength.value = fixedLeafColumns2.length;
  23084. rightFixedLeafColumnsLength.value = rightFixedLeafColumns2.length;
  23085. columns.value = [].concat(fixedLeafColumns2).concat(leafColumns2).concat(rightFixedLeafColumns2);
  23086. isComplex.value = fixedColumns.value.length > 0 || rightFixedColumns.value.length > 0;
  23087. };
  23088. const scheduleLayout = (needUpdateColumns, immediate = false) => {
  23089. if (needUpdateColumns) {
  23090. updateColumns();
  23091. }
  23092. if (immediate) {
  23093. instance.state.doLayout();
  23094. } else {
  23095. instance.state.debouncedUpdateLayout();
  23096. }
  23097. };
  23098. const isSelected = (row) => {
  23099. return selection.value.includes(row);
  23100. };
  23101. const clearSelection = () => {
  23102. isAllSelected.value = false;
  23103. const oldSelection = selection.value;
  23104. if (oldSelection.length) {
  23105. selection.value = [];
  23106. instance.emit("selection-change", []);
  23107. }
  23108. };
  23109. const cleanSelection = () => {
  23110. let deleted;
  23111. if (rowKey.value) {
  23112. deleted = [];
  23113. const selectedMap = getKeysMap(selection.value, rowKey.value);
  23114. const dataMap = getKeysMap(data2.value, rowKey.value);
  23115. for (const key in selectedMap) {
  23116. if (hasOwn(selectedMap, key) && !dataMap[key]) {
  23117. deleted.push(selectedMap[key].row);
  23118. }
  23119. }
  23120. } else {
  23121. deleted = selection.value.filter((item) => !data2.value.includes(item));
  23122. }
  23123. if (deleted.length) {
  23124. const newSelection = selection.value.filter((item) => !deleted.includes(item));
  23125. selection.value = newSelection;
  23126. instance.emit("selection-change", newSelection.slice());
  23127. }
  23128. };
  23129. const getSelectionRows = () => {
  23130. return (selection.value || []).slice();
  23131. };
  23132. const toggleRowSelection = (row, selected = void 0, emitChange = true) => {
  23133. const changed = toggleRowStatus(selection.value, row, selected);
  23134. if (changed) {
  23135. const newSelection = (selection.value || []).slice();
  23136. if (emitChange) {
  23137. instance.emit("select", newSelection, row);
  23138. }
  23139. instance.emit("selection-change", newSelection);
  23140. }
  23141. };
  23142. const _toggleAllSelection = () => {
  23143. var _a22, _b2;
  23144. const value = selectOnIndeterminate.value ? !isAllSelected.value : !(isAllSelected.value || selection.value.length);
  23145. isAllSelected.value = value;
  23146. let selectionChanged = false;
  23147. let childrenCount = 0;
  23148. const rowKey2 = (_b2 = (_a22 = instance == null ? void 0 : instance.store) == null ? void 0 : _a22.states) == null ? void 0 : _b2.rowKey.value;
  23149. data2.value.forEach((row, index) => {
  23150. const rowIndex = index + childrenCount;
  23151. if (selectable.value) {
  23152. if (selectable.value.call(null, row, rowIndex) && toggleRowStatus(selection.value, row, value)) {
  23153. selectionChanged = true;
  23154. }
  23155. } else {
  23156. if (toggleRowStatus(selection.value, row, value)) {
  23157. selectionChanged = true;
  23158. }
  23159. }
  23160. childrenCount += getChildrenCount(getRowIdentity(row, rowKey2));
  23161. });
  23162. if (selectionChanged) {
  23163. instance.emit("selection-change", selection.value ? selection.value.slice() : []);
  23164. }
  23165. instance.emit("select-all", selection.value);
  23166. };
  23167. const updateSelectionByRowKey = () => {
  23168. const selectedMap = getKeysMap(selection.value, rowKey.value);
  23169. data2.value.forEach((row) => {
  23170. const rowId = getRowIdentity(row, rowKey.value);
  23171. const rowInfo = selectedMap[rowId];
  23172. if (rowInfo) {
  23173. selection.value[rowInfo.index] = row;
  23174. }
  23175. });
  23176. };
  23177. const updateAllSelected = () => {
  23178. var _a22, _b2, _c;
  23179. if (((_a22 = data2.value) == null ? void 0 : _a22.length) === 0) {
  23180. isAllSelected.value = false;
  23181. return;
  23182. }
  23183. let selectedMap;
  23184. if (rowKey.value) {
  23185. selectedMap = getKeysMap(selection.value, rowKey.value);
  23186. }
  23187. const isSelected2 = function(row) {
  23188. if (selectedMap) {
  23189. return !!selectedMap[getRowIdentity(row, rowKey.value)];
  23190. } else {
  23191. return selection.value.includes(row);
  23192. }
  23193. };
  23194. let isAllSelected_ = true;
  23195. let selectedCount = 0;
  23196. let childrenCount = 0;
  23197. for (let i = 0, j = (data2.value || []).length; i < j; i++) {
  23198. const keyProp = (_c = (_b2 = instance == null ? void 0 : instance.store) == null ? void 0 : _b2.states) == null ? void 0 : _c.rowKey.value;
  23199. const rowIndex = i + childrenCount;
  23200. const item = data2.value[i];
  23201. const isRowSelectable = selectable.value && selectable.value.call(null, item, rowIndex);
  23202. if (!isSelected2(item)) {
  23203. if (!selectable.value || isRowSelectable) {
  23204. isAllSelected_ = false;
  23205. break;
  23206. }
  23207. } else {
  23208. selectedCount++;
  23209. }
  23210. childrenCount += getChildrenCount(getRowIdentity(item, keyProp));
  23211. }
  23212. if (selectedCount === 0)
  23213. isAllSelected_ = false;
  23214. isAllSelected.value = isAllSelected_;
  23215. };
  23216. const getChildrenCount = (rowKey2) => {
  23217. var _a22;
  23218. if (!instance || !instance.store)
  23219. return 0;
  23220. const { treeData } = instance.store.states;
  23221. let count = 0;
  23222. const children = (_a22 = treeData.value[rowKey2]) == null ? void 0 : _a22.children;
  23223. if (children) {
  23224. count += children.length;
  23225. children.forEach((childKey) => {
  23226. count += getChildrenCount(childKey);
  23227. });
  23228. }
  23229. return count;
  23230. };
  23231. const updateFilters = (columns2, values) => {
  23232. if (!Array.isArray(columns2)) {
  23233. columns2 = [columns2];
  23234. }
  23235. const filters_ = {};
  23236. columns2.forEach((col) => {
  23237. filters.value[col.id] = values;
  23238. filters_[col.columnKey || col.id] = values;
  23239. });
  23240. return filters_;
  23241. };
  23242. const updateSort = (column, prop, order2) => {
  23243. if (sortingColumn.value && sortingColumn.value !== column) {
  23244. sortingColumn.value.order = null;
  23245. }
  23246. sortingColumn.value = column;
  23247. sortProp.value = prop;
  23248. sortOrder.value = order2;
  23249. };
  23250. const execFilter = () => {
  23251. let sourceData = unref(_data);
  23252. Object.keys(filters.value).forEach((columnId) => {
  23253. const values = filters.value[columnId];
  23254. if (!values || values.length === 0)
  23255. return;
  23256. const column = getColumnById({
  23257. columns: columns.value
  23258. }, columnId);
  23259. if (column && column.filterMethod) {
  23260. sourceData = sourceData.filter((row) => {
  23261. return values.some((value) => column.filterMethod.call(null, value, row, column));
  23262. });
  23263. }
  23264. });
  23265. filteredData.value = sourceData;
  23266. };
  23267. const execSort = () => {
  23268. data2.value = sortData(filteredData.value, {
  23269. sortingColumn: sortingColumn.value,
  23270. sortProp: sortProp.value,
  23271. sortOrder: sortOrder.value
  23272. });
  23273. };
  23274. const execQuery = (ignore = void 0) => {
  23275. if (!(ignore && ignore.filter)) {
  23276. execFilter();
  23277. }
  23278. execSort();
  23279. };
  23280. const clearFilter = (columnKeys) => {
  23281. const { tableHeaderRef } = instance.refs;
  23282. if (!tableHeaderRef)
  23283. return;
  23284. const panels = Object.assign({}, tableHeaderRef.filterPanels);
  23285. const keys2 = Object.keys(panels);
  23286. if (!keys2.length)
  23287. return;
  23288. if (typeof columnKeys === "string") {
  23289. columnKeys = [columnKeys];
  23290. }
  23291. if (Array.isArray(columnKeys)) {
  23292. const columns_ = columnKeys.map((key) => getColumnByKey({
  23293. columns: columns.value
  23294. }, key));
  23295. keys2.forEach((key) => {
  23296. const column = columns_.find((col) => col.id === key);
  23297. if (column) {
  23298. column.filteredValue = [];
  23299. }
  23300. });
  23301. instance.store.commit("filterChange", {
  23302. column: columns_,
  23303. values: [],
  23304. silent: true,
  23305. multi: true
  23306. });
  23307. } else {
  23308. keys2.forEach((key) => {
  23309. const column = columns.value.find((col) => col.id === key);
  23310. if (column) {
  23311. column.filteredValue = [];
  23312. }
  23313. });
  23314. filters.value = {};
  23315. instance.store.commit("filterChange", {
  23316. column: {},
  23317. values: [],
  23318. silent: true
  23319. });
  23320. }
  23321. };
  23322. const clearSort = () => {
  23323. if (!sortingColumn.value)
  23324. return;
  23325. updateSort(null, null, null);
  23326. instance.store.commit("changeSortCondition", {
  23327. silent: true
  23328. });
  23329. };
  23330. const {
  23331. setExpandRowKeys,
  23332. toggleRowExpansion,
  23333. updateExpandRows,
  23334. states: expandStates,
  23335. isRowExpanded
  23336. } = useExpand({
  23337. data: data2,
  23338. rowKey
  23339. });
  23340. const {
  23341. updateTreeExpandKeys,
  23342. toggleTreeExpansion,
  23343. updateTreeData,
  23344. loadOrToggle,
  23345. states: treeStates
  23346. } = useTree({
  23347. data: data2,
  23348. rowKey
  23349. });
  23350. const {
  23351. updateCurrentRowData,
  23352. updateCurrentRow,
  23353. setCurrentRowKey,
  23354. states: currentData
  23355. } = useCurrent({
  23356. data: data2,
  23357. rowKey
  23358. });
  23359. const setExpandRowKeysAdapter = (val) => {
  23360. setExpandRowKeys(val);
  23361. updateTreeExpandKeys(val);
  23362. };
  23363. const toggleRowExpansionAdapter = (row, expanded) => {
  23364. const hasExpandColumn = columns.value.some(({ type: type4 }) => type4 === "expand");
  23365. if (hasExpandColumn) {
  23366. toggleRowExpansion(row, expanded);
  23367. } else {
  23368. toggleTreeExpansion(row, expanded);
  23369. }
  23370. };
  23371. return {
  23372. assertRowKey,
  23373. updateColumns,
  23374. scheduleLayout,
  23375. isSelected,
  23376. clearSelection,
  23377. cleanSelection,
  23378. getSelectionRows,
  23379. toggleRowSelection,
  23380. _toggleAllSelection,
  23381. toggleAllSelection: null,
  23382. updateSelectionByRowKey,
  23383. updateAllSelected,
  23384. updateFilters,
  23385. updateCurrentRow,
  23386. updateSort,
  23387. execFilter,
  23388. execSort,
  23389. execQuery,
  23390. clearFilter,
  23391. clearSort,
  23392. toggleRowExpansion,
  23393. setExpandRowKeysAdapter,
  23394. setCurrentRowKey,
  23395. toggleRowExpansionAdapter,
  23396. isRowExpanded,
  23397. updateExpandRows,
  23398. updateCurrentRowData,
  23399. loadOrToggle,
  23400. updateTreeData,
  23401. states: __spreadValues(__spreadValues(__spreadValues({
  23402. tableSize,
  23403. rowKey,
  23404. data: data2,
  23405. _data,
  23406. isComplex,
  23407. _columns,
  23408. originColumns,
  23409. columns,
  23410. fixedColumns,
  23411. rightFixedColumns,
  23412. leafColumns,
  23413. fixedLeafColumns,
  23414. rightFixedLeafColumns,
  23415. leafColumnsLength,
  23416. fixedLeafColumnsLength,
  23417. rightFixedLeafColumnsLength,
  23418. isAllSelected,
  23419. selection,
  23420. reserveSelection,
  23421. selectOnIndeterminate,
  23422. selectable,
  23423. filters,
  23424. filteredData,
  23425. sortingColumn,
  23426. sortProp,
  23427. sortOrder,
  23428. hoverRow
  23429. }, expandStates), treeStates), currentData)
  23430. };
  23431. }
  23432. function replaceColumn(array4, column) {
  23433. return array4.map((item) => {
  23434. var _a2;
  23435. if (item.id === column.id) {
  23436. return column;
  23437. } else if ((_a2 = item.children) == null ? void 0 : _a2.length) {
  23438. item.children = replaceColumn(item.children, column);
  23439. }
  23440. return item;
  23441. });
  23442. }
  23443. function sortColumn(array4) {
  23444. array4.forEach((item) => {
  23445. var _a2, _b2;
  23446. item.no = (_a2 = item.getColumnIndex) == null ? void 0 : _a2.call(item);
  23447. if ((_b2 = item.children) == null ? void 0 : _b2.length) {
  23448. sortColumn(item.children);
  23449. }
  23450. });
  23451. array4.sort((cur, pre) => cur.no - pre.no);
  23452. }
  23453. function useStore() {
  23454. const instance = getCurrentInstance();
  23455. const watcher = useWatcher$1();
  23456. const ns = useNamespace("table");
  23457. const mutations = {
  23458. setData(states, data2) {
  23459. const dataInstanceChanged = unref(states._data) !== data2;
  23460. states.data.value = data2;
  23461. states._data.value = data2;
  23462. instance.store.execQuery();
  23463. instance.store.updateCurrentRowData();
  23464. instance.store.updateExpandRows();
  23465. instance.store.updateTreeData(instance.store.states.defaultExpandAll.value);
  23466. if (unref(states.reserveSelection)) {
  23467. instance.store.assertRowKey();
  23468. instance.store.updateSelectionByRowKey();
  23469. } else {
  23470. if (dataInstanceChanged) {
  23471. instance.store.clearSelection();
  23472. } else {
  23473. instance.store.cleanSelection();
  23474. }
  23475. }
  23476. instance.store.updateAllSelected();
  23477. if (instance.$ready) {
  23478. instance.store.scheduleLayout();
  23479. }
  23480. },
  23481. insertColumn(states, column, parent) {
  23482. const array4 = unref(states._columns);
  23483. let newColumns = [];
  23484. if (!parent) {
  23485. array4.push(column);
  23486. newColumns = array4;
  23487. } else {
  23488. if (parent && !parent.children) {
  23489. parent.children = [];
  23490. }
  23491. parent.children.push(column);
  23492. newColumns = replaceColumn(array4, parent);
  23493. }
  23494. sortColumn(newColumns);
  23495. states._columns.value = newColumns;
  23496. if (column.type === "selection") {
  23497. states.selectable.value = column.selectable;
  23498. states.reserveSelection.value = column.reserveSelection;
  23499. }
  23500. if (instance.$ready) {
  23501. instance.store.updateColumns();
  23502. instance.store.scheduleLayout();
  23503. }
  23504. },
  23505. removeColumn(states, column, parent) {
  23506. const array4 = unref(states._columns) || [];
  23507. if (parent) {
  23508. parent.children.splice(parent.children.findIndex((item) => item.id === column.id), 1);
  23509. if (parent.children.length === 0) {
  23510. delete parent.children;
  23511. }
  23512. states._columns.value = replaceColumn(array4, parent);
  23513. } else {
  23514. const index = array4.indexOf(column);
  23515. if (index > -1) {
  23516. array4.splice(index, 1);
  23517. states._columns.value = array4;
  23518. }
  23519. }
  23520. if (instance.$ready) {
  23521. instance.store.updateColumns();
  23522. instance.store.scheduleLayout();
  23523. }
  23524. },
  23525. sort(states, options) {
  23526. const { prop, order: order2, init } = options;
  23527. if (prop) {
  23528. const column = unref(states.columns).find((column2) => column2.property === prop);
  23529. if (column) {
  23530. column.order = order2;
  23531. instance.store.updateSort(column, prop, order2);
  23532. instance.store.commit("changeSortCondition", { init });
  23533. }
  23534. }
  23535. },
  23536. changeSortCondition(states, options) {
  23537. const { sortingColumn: column, sortProp: prop, sortOrder: order2 } = states;
  23538. if (unref(order2) === null) {
  23539. states.sortingColumn.value = null;
  23540. states.sortProp.value = null;
  23541. }
  23542. const ingore = { filter: true };
  23543. instance.store.execQuery(ingore);
  23544. if (!options || !(options.silent || options.init)) {
  23545. instance.emit("sort-change", {
  23546. column: unref(column),
  23547. prop: unref(prop),
  23548. order: unref(order2)
  23549. });
  23550. }
  23551. instance.store.updateTableScrollY();
  23552. },
  23553. filterChange(_states, options) {
  23554. const { column, values, silent } = options;
  23555. const newFilters = instance.store.updateFilters(column, values);
  23556. instance.store.execQuery();
  23557. if (!silent) {
  23558. instance.emit("filter-change", newFilters);
  23559. }
  23560. instance.store.updateTableScrollY();
  23561. },
  23562. toggleAllSelection() {
  23563. instance.store.toggleAllSelection();
  23564. },
  23565. rowSelectedChanged(_states, row) {
  23566. instance.store.toggleRowSelection(row);
  23567. instance.store.updateAllSelected();
  23568. },
  23569. setHoverRow(states, row) {
  23570. states.hoverRow.value = row;
  23571. },
  23572. setCurrentRow(_states, row) {
  23573. instance.store.updateCurrentRow(row);
  23574. }
  23575. };
  23576. const commit = function(name, ...args) {
  23577. const mutations2 = instance.store.mutations;
  23578. if (mutations2[name]) {
  23579. mutations2[name].apply(instance, [instance.store.states].concat(args));
  23580. } else {
  23581. throw new Error(`Action not found: ${name}`);
  23582. }
  23583. };
  23584. const updateTableScrollY = function() {
  23585. nextTick(() => instance.layout.updateScrollY.apply(instance.layout));
  23586. };
  23587. return __spreadProps(__spreadValues({
  23588. ns
  23589. }, watcher), {
  23590. mutations,
  23591. commit,
  23592. updateTableScrollY
  23593. });
  23594. }
  23595. const InitialStateMap = {
  23596. rowKey: "rowKey",
  23597. defaultExpandAll: "defaultExpandAll",
  23598. selectOnIndeterminate: "selectOnIndeterminate",
  23599. indent: "indent",
  23600. lazy: "lazy",
  23601. data: "data",
  23602. ["treeProps.hasChildren"]: {
  23603. key: "lazyColumnIdentifier",
  23604. default: "hasChildren"
  23605. },
  23606. ["treeProps.children"]: {
  23607. key: "childrenColumnName",
  23608. default: "children"
  23609. }
  23610. };
  23611. function createStore(table, props) {
  23612. if (!table) {
  23613. throw new Error("Table is required.");
  23614. }
  23615. const store = useStore();
  23616. store.toggleAllSelection = debounce$1(store._toggleAllSelection, 10);
  23617. Object.keys(InitialStateMap).forEach((key) => {
  23618. handleValue(getArrKeysValue(props, key), key, store);
  23619. });
  23620. proxyTableProps(store, props);
  23621. return store;
  23622. }
  23623. function proxyTableProps(store, props) {
  23624. Object.keys(InitialStateMap).forEach((key) => {
  23625. watch(() => getArrKeysValue(props, key), (value) => {
  23626. handleValue(value, key, store);
  23627. });
  23628. });
  23629. }
  23630. function handleValue(value, propsKey, store) {
  23631. let newVal = value;
  23632. let storeKey = InitialStateMap[propsKey];
  23633. if (typeof InitialStateMap[propsKey] === "object") {
  23634. storeKey = storeKey.key;
  23635. newVal = newVal || InitialStateMap[propsKey].default;
  23636. }
  23637. store.states[storeKey].value = newVal;
  23638. }
  23639. function getArrKeysValue(props, keys2) {
  23640. if (keys2.includes(".")) {
  23641. const keyList = keys2.split(".");
  23642. let value = props;
  23643. keyList.forEach((key) => {
  23644. value = value[key];
  23645. });
  23646. return value;
  23647. } else {
  23648. return props[keys2];
  23649. }
  23650. }
  23651. class TableLayout {
  23652. constructor(options) {
  23653. this.observers = [];
  23654. this.table = null;
  23655. this.store = null;
  23656. this.columns = [];
  23657. this.fit = true;
  23658. this.showHeader = true;
  23659. this.height = ref(null);
  23660. this.scrollX = ref(false);
  23661. this.scrollY = ref(false);
  23662. this.bodyWidth = ref(null);
  23663. this.fixedWidth = ref(null);
  23664. this.rightFixedWidth = ref(null);
  23665. this.tableHeight = ref(null);
  23666. this.headerHeight = ref(44);
  23667. this.appendHeight = ref(0);
  23668. this.footerHeight = ref(44);
  23669. this.viewportHeight = ref(null);
  23670. this.bodyHeight = ref(null);
  23671. this.bodyScrollHeight = ref(0);
  23672. this.fixedBodyHeight = ref(null);
  23673. this.gutterWidth = 0;
  23674. for (const name in options) {
  23675. if (hasOwn(options, name)) {
  23676. if (isRef(this[name])) {
  23677. this[name].value = options[name];
  23678. } else {
  23679. this[name] = options[name];
  23680. }
  23681. }
  23682. }
  23683. if (!this.table) {
  23684. throw new Error("Table is required for Table Layout");
  23685. }
  23686. if (!this.store) {
  23687. throw new Error("Store is required for Table Layout");
  23688. }
  23689. }
  23690. updateScrollY() {
  23691. const height = this.height.value;
  23692. if (height === null)
  23693. return false;
  23694. const bodyWrapper = this.table.refs.bodyWrapper;
  23695. if (this.table.vnode.el && bodyWrapper) {
  23696. let scrollY = true;
  23697. const prevScrollY = this.scrollY.value;
  23698. if (this.bodyHeight.value === null) {
  23699. scrollY = false;
  23700. } else {
  23701. scrollY = bodyWrapper.scrollHeight > this.bodyHeight.value;
  23702. }
  23703. this.scrollY.value = scrollY;
  23704. return prevScrollY !== scrollY;
  23705. }
  23706. return false;
  23707. }
  23708. setHeight(value, prop = "height") {
  23709. if (!isClient)
  23710. return;
  23711. const el = this.table.vnode.el;
  23712. value = parseHeight(value);
  23713. this.height.value = Number(value);
  23714. if (!el && (value || value === 0))
  23715. return nextTick(() => this.setHeight(value, prop));
  23716. if (typeof value === "number") {
  23717. el.style[prop] = `${value}px`;
  23718. this.updateElsHeight();
  23719. } else if (typeof value === "string") {
  23720. el.style[prop] = value;
  23721. this.updateElsHeight();
  23722. }
  23723. }
  23724. setMaxHeight(value) {
  23725. this.setHeight(value, "max-height");
  23726. }
  23727. getFlattenColumns() {
  23728. const flattenColumns = [];
  23729. const columns = this.table.store.states.columns.value;
  23730. columns.forEach((column) => {
  23731. if (column.isColumnGroup) {
  23732. flattenColumns.push.apply(flattenColumns, column.columns);
  23733. } else {
  23734. flattenColumns.push(column);
  23735. }
  23736. });
  23737. return flattenColumns;
  23738. }
  23739. updateElsHeight() {
  23740. var _a2, _b2;
  23741. if (!this.table.$ready)
  23742. return nextTick(() => this.updateElsHeight());
  23743. const {
  23744. tableWrapper,
  23745. headerWrapper,
  23746. appendWrapper,
  23747. footerWrapper,
  23748. tableHeader,
  23749. tableBody
  23750. } = this.table.refs;
  23751. if (tableWrapper && tableWrapper.style.display === "none") {
  23752. return;
  23753. }
  23754. const { tableLayout } = this.table.props;
  23755. this.appendHeight.value = appendWrapper ? appendWrapper.offsetHeight : 0;
  23756. if (this.showHeader && !headerWrapper && tableLayout === "fixed") {
  23757. return;
  23758. }
  23759. const headerTrElm = tableHeader ? tableHeader : null;
  23760. const noneHeader = this.headerDisplayNone(headerTrElm);
  23761. const headerWrapperOffsetHeight = (headerWrapper == null ? void 0 : headerWrapper.offsetHeight) || 0;
  23762. const headerHeight = this.headerHeight.value = !this.showHeader ? 0 : headerWrapperOffsetHeight;
  23763. if (this.showHeader && !noneHeader && headerWrapperOffsetHeight > 0 && (this.table.store.states.columns.value || []).length > 0 && headerHeight < 2) {
  23764. return nextTick(() => this.updateElsHeight());
  23765. }
  23766. const tableHeight = this.tableHeight.value = (_b2 = (_a2 = this.table) == null ? void 0 : _a2.vnode.el) == null ? void 0 : _b2.clientHeight;
  23767. const footerHeight = this.footerHeight.value = footerWrapper ? footerWrapper.offsetHeight : 0;
  23768. if (this.height.value !== null) {
  23769. if (this.bodyHeight.value === null) {
  23770. requestAnimationFrame(() => this.updateElsHeight());
  23771. }
  23772. this.bodyHeight.value = tableHeight - headerHeight - footerHeight + (footerWrapper ? 1 : 0);
  23773. this.bodyScrollHeight.value = tableBody == null ? void 0 : tableBody.scrollHeight;
  23774. }
  23775. this.fixedBodyHeight.value = this.scrollX.value ? this.bodyHeight.value - this.gutterWidth : this.bodyHeight.value;
  23776. this.viewportHeight.value = this.scrollX.value ? tableHeight - this.gutterWidth : tableHeight;
  23777. this.updateScrollY();
  23778. this.notifyObservers("scrollable");
  23779. }
  23780. headerDisplayNone(elm) {
  23781. if (!elm)
  23782. return true;
  23783. let headerChild = elm;
  23784. while (headerChild.tagName !== "DIV") {
  23785. if (getComputedStyle(headerChild).display === "none") {
  23786. return true;
  23787. }
  23788. headerChild = headerChild.parentElement;
  23789. }
  23790. return false;
  23791. }
  23792. updateColumnsWidth() {
  23793. if (!isClient)
  23794. return;
  23795. const fit = this.fit;
  23796. const bodyWidth = this.table.vnode.el.clientWidth;
  23797. let bodyMinWidth = 0;
  23798. const flattenColumns = this.getFlattenColumns();
  23799. const flexColumns = flattenColumns.filter((column) => typeof column.width !== "number");
  23800. flattenColumns.forEach((column) => {
  23801. if (typeof column.width === "number" && column.realWidth)
  23802. column.realWidth = null;
  23803. });
  23804. if (flexColumns.length > 0 && fit) {
  23805. flattenColumns.forEach((column) => {
  23806. bodyMinWidth += Number(column.width || column.minWidth || 80);
  23807. });
  23808. if (bodyMinWidth <= bodyWidth) {
  23809. this.scrollX.value = false;
  23810. const totalFlexWidth = bodyWidth - bodyMinWidth;
  23811. if (flexColumns.length === 1) {
  23812. flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth;
  23813. } else {
  23814. const allColumnsWidth = flexColumns.reduce((prev, column) => prev + Number(column.minWidth || 80), 0);
  23815. const flexWidthPerPixel = totalFlexWidth / allColumnsWidth;
  23816. let noneFirstWidth = 0;
  23817. flexColumns.forEach((column, index) => {
  23818. if (index === 0)
  23819. return;
  23820. const flexWidth = Math.floor(Number(column.minWidth || 80) * flexWidthPerPixel);
  23821. noneFirstWidth += flexWidth;
  23822. column.realWidth = Number(column.minWidth || 80) + flexWidth;
  23823. });
  23824. flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth - noneFirstWidth;
  23825. }
  23826. } else {
  23827. this.scrollX.value = true;
  23828. flexColumns.forEach((column) => {
  23829. column.realWidth = Number(column.minWidth);
  23830. });
  23831. }
  23832. this.bodyWidth.value = Math.max(bodyMinWidth, bodyWidth);
  23833. this.table.state.resizeState.value.width = this.bodyWidth.value;
  23834. } else {
  23835. flattenColumns.forEach((column) => {
  23836. if (!column.width && !column.minWidth) {
  23837. column.realWidth = 80;
  23838. } else {
  23839. column.realWidth = Number(column.width || column.minWidth);
  23840. }
  23841. bodyMinWidth += column.realWidth;
  23842. });
  23843. this.scrollX.value = bodyMinWidth > bodyWidth;
  23844. this.bodyWidth.value = bodyMinWidth;
  23845. }
  23846. const fixedColumns = this.store.states.fixedColumns.value;
  23847. if (fixedColumns.length > 0) {
  23848. let fixedWidth = 0;
  23849. fixedColumns.forEach((column) => {
  23850. fixedWidth += Number(column.realWidth || column.width);
  23851. });
  23852. this.fixedWidth.value = fixedWidth;
  23853. }
  23854. const rightFixedColumns = this.store.states.rightFixedColumns.value;
  23855. if (rightFixedColumns.length > 0) {
  23856. let rightFixedWidth = 0;
  23857. rightFixedColumns.forEach((column) => {
  23858. rightFixedWidth += Number(column.realWidth || column.width);
  23859. });
  23860. this.rightFixedWidth.value = rightFixedWidth;
  23861. }
  23862. this.notifyObservers("columns");
  23863. }
  23864. addObserver(observer) {
  23865. this.observers.push(observer);
  23866. }
  23867. removeObserver(observer) {
  23868. const index = this.observers.indexOf(observer);
  23869. if (index !== -1) {
  23870. this.observers.splice(index, 1);
  23871. }
  23872. }
  23873. notifyObservers(event) {
  23874. const observers = this.observers;
  23875. observers.forEach((observer) => {
  23876. var _a2, _b2;
  23877. switch (event) {
  23878. case "columns":
  23879. (_a2 = observer.state) == null ? void 0 : _a2.onColumnsChange(this);
  23880. break;
  23881. case "scrollable":
  23882. (_b2 = observer.state) == null ? void 0 : _b2.onScrollableChange(this);
  23883. break;
  23884. default:
  23885. throw new Error(`Table Layout don't have event ${event}.`);
  23886. }
  23887. });
  23888. }
  23889. }
  23890. const { CheckboxGroup: ElCheckboxGroup } = ElCheckbox;
  23891. const _sfc_main$f = defineComponent({
  23892. name: "ElTableFilterPanel",
  23893. components: {
  23894. ElCheckbox,
  23895. ElCheckboxGroup,
  23896. ElScrollbar,
  23897. ElTooltip,
  23898. ElIcon,
  23899. ArrowDown: arrowDown,
  23900. ArrowUp: arrowUp
  23901. },
  23902. directives: { ClickOutside },
  23903. props: {
  23904. placement: {
  23905. type: String,
  23906. default: "bottom-start"
  23907. },
  23908. store: {
  23909. type: Object
  23910. },
  23911. column: {
  23912. type: Object
  23913. },
  23914. upDataColumn: {
  23915. type: Function
  23916. }
  23917. },
  23918. setup(props) {
  23919. const instance = getCurrentInstance();
  23920. const { t } = useLocale();
  23921. const ns = useNamespace("table-filter");
  23922. const parent = instance == null ? void 0 : instance.parent;
  23923. if (!parent.filterPanels.value[props.column.id]) {
  23924. parent.filterPanels.value[props.column.id] = instance;
  23925. }
  23926. const tooltipVisible = ref(false);
  23927. const tooltip = ref(null);
  23928. const filters = computed(() => {
  23929. return props.column && props.column.filters;
  23930. });
  23931. const filterValue = computed({
  23932. get: () => {
  23933. var _a2;
  23934. return (((_a2 = props.column) == null ? void 0 : _a2.filteredValue) || [])[0];
  23935. },
  23936. set: (value) => {
  23937. if (filteredValue.value) {
  23938. if (typeof value !== "undefined" && value !== null) {
  23939. filteredValue.value.splice(0, 1, value);
  23940. } else {
  23941. filteredValue.value.splice(0, 1);
  23942. }
  23943. }
  23944. }
  23945. });
  23946. const filteredValue = computed({
  23947. get() {
  23948. if (props.column) {
  23949. return props.column.filteredValue || [];
  23950. }
  23951. return [];
  23952. },
  23953. set(value) {
  23954. if (props.column) {
  23955. props.upDataColumn("filteredValue", value);
  23956. }
  23957. }
  23958. });
  23959. const multiple = computed(() => {
  23960. if (props.column) {
  23961. return props.column.filterMultiple;
  23962. }
  23963. return true;
  23964. });
  23965. const isActive = (filter) => {
  23966. return filter.value === filterValue.value;
  23967. };
  23968. const hidden = () => {
  23969. tooltipVisible.value = false;
  23970. };
  23971. const showFilterPanel = (e) => {
  23972. e.stopPropagation();
  23973. tooltipVisible.value = !tooltipVisible.value;
  23974. };
  23975. const hideFilterPanel = () => {
  23976. tooltipVisible.value = false;
  23977. };
  23978. const handleConfirm = () => {
  23979. confirmFilter(filteredValue.value);
  23980. hidden();
  23981. };
  23982. const handleReset = () => {
  23983. filteredValue.value = [];
  23984. confirmFilter(filteredValue.value);
  23985. hidden();
  23986. };
  23987. const handleSelect = (_filterValue) => {
  23988. filterValue.value = _filterValue;
  23989. if (typeof _filterValue !== "undefined" && _filterValue !== null) {
  23990. confirmFilter(filteredValue.value);
  23991. } else {
  23992. confirmFilter([]);
  23993. }
  23994. hidden();
  23995. };
  23996. const confirmFilter = (filteredValue2) => {
  23997. props.store.commit("filterChange", {
  23998. column: props.column,
  23999. values: filteredValue2
  24000. });
  24001. props.store.updateAllSelected();
  24002. };
  24003. watch(tooltipVisible, (value) => {
  24004. if (props.column) {
  24005. props.upDataColumn("filterOpened", value);
  24006. }
  24007. }, {
  24008. immediate: true
  24009. });
  24010. const popperPaneRef = computed(() => {
  24011. var _a2, _b2;
  24012. return (_b2 = (_a2 = tooltip.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b2.contentRef;
  24013. });
  24014. return {
  24015. tooltipVisible,
  24016. multiple,
  24017. filteredValue,
  24018. filterValue,
  24019. filters,
  24020. handleConfirm,
  24021. handleReset,
  24022. handleSelect,
  24023. isActive,
  24024. t,
  24025. ns,
  24026. showFilterPanel,
  24027. hideFilterPanel,
  24028. popperPaneRef,
  24029. tooltip
  24030. };
  24031. }
  24032. });
  24033. const _hoisted_1$c = { key: 0 };
  24034. const _hoisted_2$a = ["disabled"];
  24035. const _hoisted_3$7 = ["label", "onClick"];
  24036. function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
  24037. const _component_el_checkbox = resolveComponent("el-checkbox");
  24038. const _component_el_checkbox_group = resolveComponent("el-checkbox-group");
  24039. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  24040. const _component_arrow_up = resolveComponent("arrow-up");
  24041. const _component_arrow_down = resolveComponent("arrow-down");
  24042. const _component_el_icon = resolveComponent("el-icon");
  24043. const _component_el_tooltip = resolveComponent("el-tooltip");
  24044. const _directive_click_outside = resolveDirective("click-outside");
  24045. return openBlock(), createBlock(_component_el_tooltip, {
  24046. ref: "tooltip",
  24047. visible: _ctx.tooltipVisible,
  24048. "onUpdate:visible": _cache[5] || (_cache[5] = ($event) => _ctx.tooltipVisible = $event),
  24049. offset: 0,
  24050. placement: _ctx.placement,
  24051. "show-arrow": false,
  24052. "stop-popper-mouse-event": false,
  24053. "append-to-body": "",
  24054. effect: "light",
  24055. pure: "",
  24056. "popper-class": _ctx.ns.b(),
  24057. persistent: ""
  24058. }, {
  24059. content: withCtx(() => [
  24060. _ctx.multiple ? (openBlock(), createElementBlock("div", _hoisted_1$c, [
  24061. createElementVNode("div", {
  24062. class: normalizeClass(_ctx.ns.e("content"))
  24063. }, [
  24064. createVNode(_component_el_scrollbar, {
  24065. "wrap-class": _ctx.ns.e("wrap")
  24066. }, {
  24067. default: withCtx(() => [
  24068. createVNode(_component_el_checkbox_group, {
  24069. modelValue: _ctx.filteredValue,
  24070. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.filteredValue = $event),
  24071. class: normalizeClass(_ctx.ns.e("checkbox-group"))
  24072. }, {
  24073. default: withCtx(() => [
  24074. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.filters, (filter) => {
  24075. return openBlock(), createBlock(_component_el_checkbox, {
  24076. key: filter.value,
  24077. label: filter.value
  24078. }, {
  24079. default: withCtx(() => [
  24080. createTextVNode(toDisplayString(filter.text), 1)
  24081. ]),
  24082. _: 2
  24083. }, 1032, ["label"]);
  24084. }), 128))
  24085. ]),
  24086. _: 1
  24087. }, 8, ["modelValue", "class"])
  24088. ]),
  24089. _: 1
  24090. }, 8, ["wrap-class"])
  24091. ], 2),
  24092. createElementVNode("div", {
  24093. class: normalizeClass(_ctx.ns.e("bottom"))
  24094. }, [
  24095. createElementVNode("button", {
  24096. class: normalizeClass({ [_ctx.ns.is("disabled")]: _ctx.filteredValue.length === 0 }),
  24097. disabled: _ctx.filteredValue.length === 0,
  24098. type: "button",
  24099. onClick: _cache[1] || (_cache[1] = (...args) => _ctx.handleConfirm && _ctx.handleConfirm(...args))
  24100. }, toDisplayString(_ctx.t("el.table.confirmFilter")), 11, _hoisted_2$a),
  24101. createElementVNode("button", {
  24102. type: "button",
  24103. onClick: _cache[2] || (_cache[2] = (...args) => _ctx.handleReset && _ctx.handleReset(...args))
  24104. }, toDisplayString(_ctx.t("el.table.resetFilter")), 1)
  24105. ], 2)
  24106. ])) : (openBlock(), createElementBlock("ul", {
  24107. key: 1,
  24108. class: normalizeClass(_ctx.ns.e("list"))
  24109. }, [
  24110. createElementVNode("li", {
  24111. class: normalizeClass([
  24112. _ctx.ns.e("list-item"),
  24113. {
  24114. [_ctx.ns.is("active")]: _ctx.filterValue === void 0 || _ctx.filterValue === null
  24115. }
  24116. ]),
  24117. onClick: _cache[3] || (_cache[3] = ($event) => _ctx.handleSelect(null))
  24118. }, toDisplayString(_ctx.t("el.table.clearFilter")), 3),
  24119. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.filters, (filter) => {
  24120. return openBlock(), createElementBlock("li", {
  24121. key: filter.value,
  24122. class: normalizeClass([_ctx.ns.e("list-item"), _ctx.ns.is("active", _ctx.isActive(filter))]),
  24123. label: filter.value,
  24124. onClick: ($event) => _ctx.handleSelect(filter.value)
  24125. }, toDisplayString(filter.text), 11, _hoisted_3$7);
  24126. }), 128))
  24127. ], 2))
  24128. ]),
  24129. default: withCtx(() => [
  24130. withDirectives((openBlock(), createElementBlock("span", {
  24131. class: normalizeClass([
  24132. `${_ctx.ns.namespace.value}-table__column-filter-trigger`,
  24133. `${_ctx.ns.namespace.value}-none-outline`
  24134. ]),
  24135. onClick: _cache[4] || (_cache[4] = (...args) => _ctx.showFilterPanel && _ctx.showFilterPanel(...args))
  24136. }, [
  24137. createVNode(_component_el_icon, null, {
  24138. default: withCtx(() => [
  24139. _ctx.column.filterOpened ? (openBlock(), createBlock(_component_arrow_up, { key: 0 })) : (openBlock(), createBlock(_component_arrow_down, { key: 1 }))
  24140. ]),
  24141. _: 1
  24142. })
  24143. ], 2)), [
  24144. [_directive_click_outside, _ctx.hideFilterPanel, _ctx.popperPaneRef]
  24145. ])
  24146. ]),
  24147. _: 1
  24148. }, 8, ["visible", "placement", "popper-class"]);
  24149. }
  24150. var FilterPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$f, [["render", _sfc_render$3], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/table/src/filter-panel.vue"]]);
  24151. function useLayoutObserver(root2) {
  24152. const instance = getCurrentInstance();
  24153. onBeforeMount(() => {
  24154. tableLayout.value.addObserver(instance);
  24155. });
  24156. onMounted(() => {
  24157. onColumnsChange(tableLayout.value);
  24158. onScrollableChange(tableLayout.value);
  24159. });
  24160. onUpdated(() => {
  24161. onColumnsChange(tableLayout.value);
  24162. onScrollableChange(tableLayout.value);
  24163. });
  24164. onUnmounted(() => {
  24165. tableLayout.value.removeObserver(instance);
  24166. });
  24167. const tableLayout = computed(() => {
  24168. const layout = root2.layout;
  24169. if (!layout) {
  24170. throw new Error("Can not find table layout.");
  24171. }
  24172. return layout;
  24173. });
  24174. const onColumnsChange = (layout) => {
  24175. var _a2;
  24176. const cols = ((_a2 = root2.vnode.el) == null ? void 0 : _a2.querySelectorAll("colgroup > col")) || [];
  24177. if (!cols.length)
  24178. return;
  24179. const flattenColumns = layout.getFlattenColumns();
  24180. const columnsMap = {};
  24181. flattenColumns.forEach((column) => {
  24182. columnsMap[column.id] = column;
  24183. });
  24184. for (let i = 0, j = cols.length; i < j; i++) {
  24185. const col = cols[i];
  24186. const name = col.getAttribute("name");
  24187. const column = columnsMap[name];
  24188. if (column) {
  24189. col.setAttribute("width", column.realWidth || column.width);
  24190. }
  24191. }
  24192. };
  24193. const onScrollableChange = (layout) => {
  24194. var _a2, _b2;
  24195. const cols = ((_a2 = root2.vnode.el) == null ? void 0 : _a2.querySelectorAll("colgroup > col[name=gutter]")) || [];
  24196. for (let i = 0, j = cols.length; i < j; i++) {
  24197. const col = cols[i];
  24198. col.setAttribute("width", layout.scrollY.value ? layout.gutterWidth : "0");
  24199. }
  24200. const ths = ((_b2 = root2.vnode.el) == null ? void 0 : _b2.querySelectorAll("th.gutter")) || [];
  24201. for (let i = 0, j = ths.length; i < j; i++) {
  24202. const th = ths[i];
  24203. th.style.width = layout.scrollY.value ? `${layout.gutterWidth}px` : "0";
  24204. th.style.display = layout.scrollY.value ? "" : "none";
  24205. }
  24206. };
  24207. return {
  24208. tableLayout: tableLayout.value,
  24209. onColumnsChange,
  24210. onScrollableChange
  24211. };
  24212. }
  24213. const TABLE_INJECTION_KEY = Symbol("ElTable");
  24214. function useEvent(props, emit) {
  24215. const instance = getCurrentInstance();
  24216. const parent = inject(TABLE_INJECTION_KEY);
  24217. const handleFilterClick = (event) => {
  24218. event.stopPropagation();
  24219. return;
  24220. };
  24221. const handleHeaderClick = (event, column) => {
  24222. if (!column.filters && column.sortable) {
  24223. handleSortClick(event, column, false);
  24224. } else if (column.filterable && !column.sortable) {
  24225. handleFilterClick(event);
  24226. }
  24227. parent == null ? void 0 : parent.emit("header-click", column, event);
  24228. };
  24229. const handleHeaderContextMenu = (event, column) => {
  24230. parent == null ? void 0 : parent.emit("header-contextmenu", column, event);
  24231. };
  24232. const draggingColumn = ref(null);
  24233. const dragging = ref(false);
  24234. const dragState = ref({});
  24235. const handleMouseDown = (event, column) => {
  24236. if (!isClient)
  24237. return;
  24238. if (column.children && column.children.length > 0)
  24239. return;
  24240. if (draggingColumn.value && props.border) {
  24241. dragging.value = true;
  24242. const table = parent;
  24243. emit("set-drag-visible", true);
  24244. const tableEl = table == null ? void 0 : table.vnode.el;
  24245. const tableLeft = tableEl.getBoundingClientRect().left;
  24246. const columnEl = instance.vnode.el.querySelector(`th.${column.id}`);
  24247. const columnRect = columnEl.getBoundingClientRect();
  24248. const minLeft = columnRect.left - tableLeft + 30;
  24249. addClass(columnEl, "noclick");
  24250. dragState.value = {
  24251. startMouseLeft: event.clientX,
  24252. startLeft: columnRect.right - tableLeft,
  24253. startColumnLeft: columnRect.left - tableLeft,
  24254. tableLeft
  24255. };
  24256. const resizeProxy = table == null ? void 0 : table.refs.resizeProxy;
  24257. resizeProxy.style.left = `${dragState.value.startLeft}px`;
  24258. document.onselectstart = function() {
  24259. return false;
  24260. };
  24261. document.ondragstart = function() {
  24262. return false;
  24263. };
  24264. const handleMouseMove2 = (event2) => {
  24265. const deltaLeft = event2.clientX - dragState.value.startMouseLeft;
  24266. const proxyLeft = dragState.value.startLeft + deltaLeft;
  24267. resizeProxy.style.left = `${Math.max(minLeft, proxyLeft)}px`;
  24268. };
  24269. const handleMouseUp = () => {
  24270. if (dragging.value) {
  24271. const { startColumnLeft, startLeft } = dragState.value;
  24272. const finalLeft = Number.parseInt(resizeProxy.style.left, 10);
  24273. const columnWidth = finalLeft - startColumnLeft;
  24274. column.width = column.realWidth = columnWidth;
  24275. table == null ? void 0 : table.emit("header-dragend", column.width, startLeft - startColumnLeft, column, event);
  24276. requestAnimationFrame(() => {
  24277. props.store.scheduleLayout(false, true);
  24278. });
  24279. document.body.style.cursor = "";
  24280. dragging.value = false;
  24281. draggingColumn.value = null;
  24282. dragState.value = {};
  24283. emit("set-drag-visible", false);
  24284. }
  24285. document.removeEventListener("mousemove", handleMouseMove2);
  24286. document.removeEventListener("mouseup", handleMouseUp);
  24287. document.onselectstart = null;
  24288. document.ondragstart = null;
  24289. setTimeout(() => {
  24290. removeClass(columnEl, "noclick");
  24291. }, 0);
  24292. };
  24293. document.addEventListener("mousemove", handleMouseMove2);
  24294. document.addEventListener("mouseup", handleMouseUp);
  24295. }
  24296. };
  24297. const handleMouseMove = (event, column) => {
  24298. if (column.children && column.children.length > 0)
  24299. return;
  24300. let target = event.target;
  24301. while (target && target.tagName !== "TH") {
  24302. target = target.parentNode;
  24303. }
  24304. if (!column || !column.resizable)
  24305. return;
  24306. if (!dragging.value && props.border) {
  24307. const rect = target.getBoundingClientRect();
  24308. const bodyStyle = document.body.style;
  24309. if (rect.width > 12 && rect.right - event.pageX < 8) {
  24310. bodyStyle.cursor = "col-resize";
  24311. if (hasClass(target, "is-sortable")) {
  24312. target.style.cursor = "col-resize";
  24313. }
  24314. draggingColumn.value = column;
  24315. } else if (!dragging.value) {
  24316. bodyStyle.cursor = "";
  24317. if (hasClass(target, "is-sortable")) {
  24318. target.style.cursor = "pointer";
  24319. }
  24320. draggingColumn.value = null;
  24321. }
  24322. }
  24323. };
  24324. const handleMouseOut = () => {
  24325. if (!isClient)
  24326. return;
  24327. document.body.style.cursor = "";
  24328. };
  24329. const toggleOrder = ({ order: order2, sortOrders }) => {
  24330. if (order2 === "")
  24331. return sortOrders[0];
  24332. const index = sortOrders.indexOf(order2 || null);
  24333. return sortOrders[index > sortOrders.length - 2 ? 0 : index + 1];
  24334. };
  24335. const handleSortClick = (event, column, givenOrder) => {
  24336. event.stopPropagation();
  24337. const order2 = column.order === givenOrder ? null : givenOrder || toggleOrder(column);
  24338. let target = event.target;
  24339. while (target && target.tagName !== "TH") {
  24340. target = target.parentNode;
  24341. }
  24342. if (target && target.tagName === "TH") {
  24343. if (hasClass(target, "noclick")) {
  24344. removeClass(target, "noclick");
  24345. return;
  24346. }
  24347. }
  24348. if (!column.sortable)
  24349. return;
  24350. const states = props.store.states;
  24351. let sortProp = states.sortProp.value;
  24352. let sortOrder;
  24353. const sortingColumn = states.sortingColumn.value;
  24354. if (sortingColumn !== column || sortingColumn === column && sortingColumn.order === null) {
  24355. if (sortingColumn) {
  24356. sortingColumn.order = null;
  24357. }
  24358. states.sortingColumn.value = column;
  24359. sortProp = column.property;
  24360. }
  24361. if (!order2) {
  24362. sortOrder = column.order = null;
  24363. } else {
  24364. sortOrder = column.order = order2;
  24365. }
  24366. states.sortProp.value = sortProp;
  24367. states.sortOrder.value = sortOrder;
  24368. parent == null ? void 0 : parent.store.commit("changeSortCondition");
  24369. };
  24370. return {
  24371. handleHeaderClick,
  24372. handleHeaderContextMenu,
  24373. handleMouseDown,
  24374. handleMouseMove,
  24375. handleMouseOut,
  24376. handleSortClick,
  24377. handleFilterClick
  24378. };
  24379. }
  24380. function useStyle$2(props) {
  24381. const parent = inject(TABLE_INJECTION_KEY);
  24382. const ns = useNamespace("table");
  24383. const getHeaderRowStyle = (rowIndex) => {
  24384. const headerRowStyle = parent == null ? void 0 : parent.props.headerRowStyle;
  24385. if (typeof headerRowStyle === "function") {
  24386. return headerRowStyle.call(null, { rowIndex });
  24387. }
  24388. return headerRowStyle;
  24389. };
  24390. const getHeaderRowClass = (rowIndex) => {
  24391. const classes = [];
  24392. const headerRowClassName = parent == null ? void 0 : parent.props.headerRowClassName;
  24393. if (typeof headerRowClassName === "string") {
  24394. classes.push(headerRowClassName);
  24395. } else if (typeof headerRowClassName === "function") {
  24396. classes.push(headerRowClassName.call(null, { rowIndex }));
  24397. }
  24398. return classes.join(" ");
  24399. };
  24400. const getHeaderCellStyle = (rowIndex, columnIndex, row, column) => {
  24401. var _a2;
  24402. let headerCellStyles = (_a2 = parent == null ? void 0 : parent.props.headerCellStyle) != null ? _a2 : {};
  24403. if (typeof headerCellStyles === "function") {
  24404. headerCellStyles = headerCellStyles.call(null, {
  24405. rowIndex,
  24406. columnIndex,
  24407. row,
  24408. column
  24409. });
  24410. }
  24411. const fixedStyle = column.isSubColumn ? null : getFixedColumnOffset(columnIndex, column.fixed, props.store, row);
  24412. ensurePosition(fixedStyle, "left");
  24413. ensurePosition(fixedStyle, "right");
  24414. return Object.assign({}, headerCellStyles, fixedStyle);
  24415. };
  24416. const getHeaderCellClass = (rowIndex, columnIndex, row, column) => {
  24417. const fixedClasses = column.isSubColumn ? [] : getFixedColumnsClass(ns.b(), columnIndex, column.fixed, props.store, row);
  24418. const classes = [
  24419. column.id,
  24420. column.order,
  24421. column.headerAlign,
  24422. column.className,
  24423. column.labelClassName,
  24424. ...fixedClasses
  24425. ];
  24426. if (!column.children) {
  24427. classes.push("is-leaf");
  24428. }
  24429. if (column.sortable) {
  24430. classes.push("is-sortable");
  24431. }
  24432. const headerCellClassName = parent == null ? void 0 : parent.props.headerCellClassName;
  24433. if (typeof headerCellClassName === "string") {
  24434. classes.push(headerCellClassName);
  24435. } else if (typeof headerCellClassName === "function") {
  24436. classes.push(headerCellClassName.call(null, {
  24437. rowIndex,
  24438. columnIndex,
  24439. row,
  24440. column
  24441. }));
  24442. }
  24443. classes.push(ns.e("cell"));
  24444. return classes.filter((className) => Boolean(className)).join(" ");
  24445. };
  24446. return {
  24447. getHeaderRowStyle,
  24448. getHeaderRowClass,
  24449. getHeaderCellStyle,
  24450. getHeaderCellClass
  24451. };
  24452. }
  24453. const getAllColumns = (columns) => {
  24454. const result = [];
  24455. columns.forEach((column) => {
  24456. if (column.children) {
  24457. result.push(column);
  24458. result.push.apply(result, getAllColumns(column.children));
  24459. } else {
  24460. result.push(column);
  24461. }
  24462. });
  24463. return result;
  24464. };
  24465. const convertToRows = (originColumns) => {
  24466. let maxLevel = 1;
  24467. const traverse = (column, parent) => {
  24468. if (parent) {
  24469. column.level = parent.level + 1;
  24470. if (maxLevel < column.level) {
  24471. maxLevel = column.level;
  24472. }
  24473. }
  24474. if (column.children) {
  24475. let colSpan = 0;
  24476. column.children.forEach((subColumn) => {
  24477. traverse(subColumn, column);
  24478. colSpan += subColumn.colSpan;
  24479. });
  24480. column.colSpan = colSpan;
  24481. } else {
  24482. column.colSpan = 1;
  24483. }
  24484. };
  24485. originColumns.forEach((column) => {
  24486. column.level = 1;
  24487. traverse(column, void 0);
  24488. });
  24489. const rows = [];
  24490. for (let i = 0; i < maxLevel; i++) {
  24491. rows.push([]);
  24492. }
  24493. const allColumns = getAllColumns(originColumns);
  24494. allColumns.forEach((column) => {
  24495. if (!column.children) {
  24496. column.rowSpan = maxLevel - column.level + 1;
  24497. } else {
  24498. column.rowSpan = 1;
  24499. column.children.forEach((col) => col.isSubColumn = true);
  24500. }
  24501. rows[column.level - 1].push(column);
  24502. });
  24503. return rows;
  24504. };
  24505. function useUtils$1(props) {
  24506. const parent = inject(TABLE_INJECTION_KEY);
  24507. const columnRows = computed(() => {
  24508. return convertToRows(props.store.states.originColumns.value);
  24509. });
  24510. const isGroup = computed(() => {
  24511. const result = columnRows.value.length > 1;
  24512. if (result && parent) {
  24513. parent.state.isGroup.value = true;
  24514. }
  24515. return result;
  24516. });
  24517. const toggleAllSelection = (event) => {
  24518. event.stopPropagation();
  24519. parent == null ? void 0 : parent.store.commit("toggleAllSelection");
  24520. };
  24521. return {
  24522. isGroup,
  24523. toggleAllSelection,
  24524. columnRows
  24525. };
  24526. }
  24527. var TableHeader = defineComponent({
  24528. name: "ElTableHeader",
  24529. components: {
  24530. ElCheckbox
  24531. },
  24532. props: {
  24533. fixed: {
  24534. type: String,
  24535. default: ""
  24536. },
  24537. store: {
  24538. required: true,
  24539. type: Object
  24540. },
  24541. border: Boolean,
  24542. defaultSort: {
  24543. type: Object,
  24544. default: () => {
  24545. return {
  24546. prop: "",
  24547. order: ""
  24548. };
  24549. }
  24550. }
  24551. },
  24552. setup(props, { emit }) {
  24553. const instance = getCurrentInstance();
  24554. const parent = inject(TABLE_INJECTION_KEY);
  24555. const ns = useNamespace("table");
  24556. const filterPanels = ref({});
  24557. const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
  24558. onMounted(async () => {
  24559. await nextTick();
  24560. await nextTick();
  24561. const { prop, order: order2 } = props.defaultSort;
  24562. parent == null ? void 0 : parent.store.commit("sort", { prop, order: order2, init: true });
  24563. });
  24564. const {
  24565. handleHeaderClick,
  24566. handleHeaderContextMenu,
  24567. handleMouseDown,
  24568. handleMouseMove,
  24569. handleMouseOut,
  24570. handleSortClick,
  24571. handleFilterClick
  24572. } = useEvent(props, emit);
  24573. const {
  24574. getHeaderRowStyle,
  24575. getHeaderRowClass,
  24576. getHeaderCellStyle,
  24577. getHeaderCellClass
  24578. } = useStyle$2(props);
  24579. const { isGroup, toggleAllSelection, columnRows } = useUtils$1(props);
  24580. instance.state = {
  24581. onColumnsChange,
  24582. onScrollableChange
  24583. };
  24584. instance.filterPanels = filterPanels;
  24585. return {
  24586. ns,
  24587. filterPanels,
  24588. onColumnsChange,
  24589. onScrollableChange,
  24590. columnRows,
  24591. getHeaderRowClass,
  24592. getHeaderRowStyle,
  24593. getHeaderCellClass,
  24594. getHeaderCellStyle,
  24595. handleHeaderClick,
  24596. handleHeaderContextMenu,
  24597. handleMouseDown,
  24598. handleMouseMove,
  24599. handleMouseOut,
  24600. handleSortClick,
  24601. handleFilterClick,
  24602. isGroup,
  24603. toggleAllSelection
  24604. };
  24605. },
  24606. render() {
  24607. const {
  24608. ns,
  24609. isGroup,
  24610. columnRows,
  24611. getHeaderCellStyle,
  24612. getHeaderCellClass,
  24613. getHeaderRowClass,
  24614. getHeaderRowStyle,
  24615. handleHeaderClick,
  24616. handleHeaderContextMenu,
  24617. handleMouseDown,
  24618. handleMouseMove,
  24619. handleSortClick,
  24620. handleMouseOut,
  24621. store,
  24622. $parent
  24623. } = this;
  24624. let rowSpan = 1;
  24625. return h$1("thead", {
  24626. class: { [ns.is("group")]: isGroup }
  24627. }, columnRows.map((subColumns, rowIndex) => h$1("tr", {
  24628. class: getHeaderRowClass(rowIndex),
  24629. key: rowIndex,
  24630. style: getHeaderRowStyle(rowIndex)
  24631. }, subColumns.map((column, cellIndex) => {
  24632. if (column.rowSpan > rowSpan) {
  24633. rowSpan = column.rowSpan;
  24634. }
  24635. return h$1("th", {
  24636. class: getHeaderCellClass(rowIndex, cellIndex, subColumns, column),
  24637. colspan: column.colSpan,
  24638. key: `${column.id}-thead`,
  24639. rowspan: column.rowSpan,
  24640. style: getHeaderCellStyle(rowIndex, cellIndex, subColumns, column),
  24641. onClick: ($event) => handleHeaderClick($event, column),
  24642. onContextmenu: ($event) => handleHeaderContextMenu($event, column),
  24643. onMousedown: ($event) => handleMouseDown($event, column),
  24644. onMousemove: ($event) => handleMouseMove($event, column),
  24645. onMouseout: handleMouseOut
  24646. }, [
  24647. h$1("div", {
  24648. class: [
  24649. "cell",
  24650. column.filteredValue && column.filteredValue.length > 0 ? "highlight" : "",
  24651. column.labelClassName
  24652. ]
  24653. }, [
  24654. column.renderHeader ? column.renderHeader({
  24655. column,
  24656. $index: cellIndex,
  24657. store,
  24658. _self: $parent
  24659. }) : column.label,
  24660. column.sortable && h$1("span", {
  24661. onClick: ($event) => handleSortClick($event, column),
  24662. class: "caret-wrapper"
  24663. }, [
  24664. h$1("i", {
  24665. onClick: ($event) => handleSortClick($event, column, "ascending"),
  24666. class: "sort-caret ascending"
  24667. }),
  24668. h$1("i", {
  24669. onClick: ($event) => handleSortClick($event, column, "descending"),
  24670. class: "sort-caret descending"
  24671. })
  24672. ]),
  24673. column.filterable && h$1(FilterPanel, {
  24674. store,
  24675. placement: column.filterPlacement || "bottom-start",
  24676. column,
  24677. upDataColumn: (key, value) => {
  24678. column[key] = value;
  24679. }
  24680. })
  24681. ])
  24682. ]);
  24683. }))));
  24684. }
  24685. });
  24686. function useEvents(props) {
  24687. const parent = inject(TABLE_INJECTION_KEY);
  24688. const tooltipContent = ref("");
  24689. const tooltipTrigger = ref(h$1("div"));
  24690. const handleEvent = (event, row, name) => {
  24691. var _a2;
  24692. const table = parent;
  24693. const cell = getCell(event);
  24694. let column;
  24695. const namespace = (_a2 = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a2.dataset.prefix;
  24696. if (cell) {
  24697. column = getColumnByCell({
  24698. columns: props.store.states.columns.value
  24699. }, cell, namespace);
  24700. if (column) {
  24701. table == null ? void 0 : table.emit(`cell-${name}`, row, column, cell, event);
  24702. }
  24703. }
  24704. table == null ? void 0 : table.emit(`row-${name}`, row, column, event);
  24705. };
  24706. const handleDoubleClick = (event, row) => {
  24707. handleEvent(event, row, "dblclick");
  24708. };
  24709. const handleClick = (event, row) => {
  24710. props.store.commit("setCurrentRow", row);
  24711. handleEvent(event, row, "click");
  24712. };
  24713. const handleContextMenu = (event, row) => {
  24714. handleEvent(event, row, "contextmenu");
  24715. };
  24716. const handleMouseEnter = debounce$1((index) => {
  24717. props.store.commit("setHoverRow", index);
  24718. }, 30);
  24719. const handleMouseLeave = debounce$1(() => {
  24720. props.store.commit("setHoverRow", null);
  24721. }, 30);
  24722. const handleCellMouseEnter = (event, row) => {
  24723. var _a2;
  24724. const table = parent;
  24725. const cell = getCell(event);
  24726. const namespace = (_a2 = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a2.dataset.prefix;
  24727. if (cell) {
  24728. const column = getColumnByCell({
  24729. columns: props.store.states.columns.value
  24730. }, cell, namespace);
  24731. const hoverState = table.hoverState = { cell, column, row };
  24732. table == null ? void 0 : table.emit("cell-mouse-enter", hoverState.row, hoverState.column, hoverState.cell, event);
  24733. }
  24734. const cellChild = event.target.querySelector(".cell");
  24735. if (!(hasClass(cellChild, `${namespace}-tooltip`) && cellChild.childNodes.length)) {
  24736. return;
  24737. }
  24738. const range3 = document.createRange();
  24739. range3.setStart(cellChild, 0);
  24740. range3.setEnd(cellChild, cellChild.childNodes.length);
  24741. const rangeWidth = range3.getBoundingClientRect().width;
  24742. const padding = (Number.parseInt(getStyle(cellChild, "paddingLeft"), 10) || 0) + (Number.parseInt(getStyle(cellChild, "paddingRight"), 10) || 0);
  24743. if (rangeWidth + padding > cellChild.offsetWidth || cellChild.scrollWidth > cellChild.offsetWidth) {
  24744. createTablePopper(cell, cell.innerText || cell.textContent, {
  24745. placement: "top",
  24746. strategy: "fixed"
  24747. }, row.tooltipEffect);
  24748. }
  24749. };
  24750. const handleCellMouseLeave = (event) => {
  24751. const cell = getCell(event);
  24752. if (!cell)
  24753. return;
  24754. const oldHoverState = parent == null ? void 0 : parent.hoverState;
  24755. parent == null ? void 0 : parent.emit("cell-mouse-leave", oldHoverState == null ? void 0 : oldHoverState.row, oldHoverState == null ? void 0 : oldHoverState.column, oldHoverState == null ? void 0 : oldHoverState.cell, event);
  24756. };
  24757. return {
  24758. handleDoubleClick,
  24759. handleClick,
  24760. handleContextMenu,
  24761. handleMouseEnter,
  24762. handleMouseLeave,
  24763. handleCellMouseEnter,
  24764. handleCellMouseLeave,
  24765. tooltipContent,
  24766. tooltipTrigger
  24767. };
  24768. }
  24769. function useStyles(props) {
  24770. const parent = inject(TABLE_INJECTION_KEY);
  24771. const ns = useNamespace("table");
  24772. const getRowStyle = (row, rowIndex) => {
  24773. const rowStyle = parent == null ? void 0 : parent.props.rowStyle;
  24774. if (typeof rowStyle === "function") {
  24775. return rowStyle.call(null, {
  24776. row,
  24777. rowIndex
  24778. });
  24779. }
  24780. return rowStyle || null;
  24781. };
  24782. const getRowClass = (row, rowIndex) => {
  24783. const classes = [ns.e("row")];
  24784. if ((parent == null ? void 0 : parent.props.highlightCurrentRow) && row === props.store.states.currentRow.value) {
  24785. classes.push("current-row");
  24786. }
  24787. if (props.stripe && rowIndex % 2 === 1) {
  24788. classes.push(ns.em("row", "striped"));
  24789. }
  24790. const rowClassName = parent == null ? void 0 : parent.props.rowClassName;
  24791. if (typeof rowClassName === "string") {
  24792. classes.push(rowClassName);
  24793. } else if (typeof rowClassName === "function") {
  24794. classes.push(rowClassName.call(null, {
  24795. row,
  24796. rowIndex
  24797. }));
  24798. }
  24799. return classes;
  24800. };
  24801. const getCellStyle = (rowIndex, columnIndex, row, column) => {
  24802. const cellStyle = parent == null ? void 0 : parent.props.cellStyle;
  24803. let cellStyles = cellStyle != null ? cellStyle : {};
  24804. if (typeof cellStyle === "function") {
  24805. cellStyles = cellStyle.call(null, {
  24806. rowIndex,
  24807. columnIndex,
  24808. row,
  24809. column
  24810. });
  24811. }
  24812. const fixedStyle = column.isSubColumn ? null : getFixedColumnOffset(columnIndex, props == null ? void 0 : props.fixed, props.store);
  24813. ensurePosition(fixedStyle, "left");
  24814. ensurePosition(fixedStyle, "right");
  24815. return Object.assign({}, cellStyles, fixedStyle);
  24816. };
  24817. const getCellClass = (rowIndex, columnIndex, row, column) => {
  24818. const fixedClasses = column.isSubColumn ? [] : getFixedColumnsClass(ns.b(), columnIndex, props == null ? void 0 : props.fixed, props.store);
  24819. const classes = [column.id, column.align, column.className, ...fixedClasses];
  24820. const cellClassName = parent == null ? void 0 : parent.props.cellClassName;
  24821. if (typeof cellClassName === "string") {
  24822. classes.push(cellClassName);
  24823. } else if (typeof cellClassName === "function") {
  24824. classes.push(cellClassName.call(null, {
  24825. rowIndex,
  24826. columnIndex,
  24827. row,
  24828. column
  24829. }));
  24830. }
  24831. classes.push(ns.e("cell"));
  24832. return classes.filter((className) => Boolean(className)).join(" ");
  24833. };
  24834. const getSpan = (row, column, rowIndex, columnIndex) => {
  24835. let rowspan = 1;
  24836. let colspan = 1;
  24837. const fn2 = parent == null ? void 0 : parent.props.spanMethod;
  24838. if (typeof fn2 === "function") {
  24839. const result = fn2({
  24840. row,
  24841. column,
  24842. rowIndex,
  24843. columnIndex
  24844. });
  24845. if (Array.isArray(result)) {
  24846. rowspan = result[0];
  24847. colspan = result[1];
  24848. } else if (typeof result === "object") {
  24849. rowspan = result.rowspan;
  24850. colspan = result.colspan;
  24851. }
  24852. }
  24853. return { rowspan, colspan };
  24854. };
  24855. const getColspanRealWidth = (columns, colspan, index) => {
  24856. if (colspan < 1) {
  24857. return columns[index].realWidth;
  24858. }
  24859. const widthArr = columns.map(({ realWidth, width }) => realWidth || width).slice(index, index + colspan);
  24860. return Number(widthArr.reduce((acc, width) => Number(acc) + Number(width), -1));
  24861. };
  24862. return {
  24863. getRowStyle,
  24864. getRowClass,
  24865. getCellStyle,
  24866. getCellClass,
  24867. getSpan,
  24868. getColspanRealWidth
  24869. };
  24870. }
  24871. function useRender$1(props) {
  24872. const parent = inject(TABLE_INJECTION_KEY);
  24873. const {
  24874. handleDoubleClick,
  24875. handleClick,
  24876. handleContextMenu,
  24877. handleMouseEnter,
  24878. handleMouseLeave,
  24879. handleCellMouseEnter,
  24880. handleCellMouseLeave,
  24881. tooltipContent,
  24882. tooltipTrigger
  24883. } = useEvents(props);
  24884. const {
  24885. getRowStyle,
  24886. getRowClass,
  24887. getCellStyle,
  24888. getCellClass,
  24889. getSpan,
  24890. getColspanRealWidth
  24891. } = useStyles(props);
  24892. const firstDefaultColumnIndex = computed(() => {
  24893. return props.store.states.columns.value.findIndex(({ type: type4 }) => type4 === "default");
  24894. });
  24895. const getKeyOfRow = (row, index) => {
  24896. const rowKey = parent.props.rowKey;
  24897. if (rowKey) {
  24898. return getRowIdentity(row, rowKey);
  24899. }
  24900. return index;
  24901. };
  24902. const rowRender = (row, $index, treeRowData, expanded = false) => {
  24903. const { tooltipEffect, store } = props;
  24904. const { indent, columns } = store.states;
  24905. const rowClasses = getRowClass(row, $index);
  24906. let display = true;
  24907. if (treeRowData) {
  24908. rowClasses.push(`el-table__row--level-${treeRowData.level}`);
  24909. display = treeRowData.display;
  24910. }
  24911. const displayStyle = display ? null : {
  24912. display: "none"
  24913. };
  24914. return h$1("tr", {
  24915. style: [displayStyle, getRowStyle(row, $index)],
  24916. class: rowClasses,
  24917. key: getKeyOfRow(row, $index),
  24918. onDblclick: ($event) => handleDoubleClick($event, row),
  24919. onClick: ($event) => handleClick($event, row),
  24920. onContextmenu: ($event) => handleContextMenu($event, row),
  24921. onMouseenter: () => handleMouseEnter($index),
  24922. onMouseleave: handleMouseLeave
  24923. }, columns.value.map((column, cellIndex) => {
  24924. const { rowspan, colspan } = getSpan(row, column, $index, cellIndex);
  24925. if (!rowspan || !colspan) {
  24926. return null;
  24927. }
  24928. const columnData = __spreadValues({}, column);
  24929. columnData.realWidth = getColspanRealWidth(columns.value, colspan, cellIndex);
  24930. const data2 = {
  24931. store: props.store,
  24932. _self: props.context || parent,
  24933. column: columnData,
  24934. row,
  24935. $index,
  24936. cellIndex,
  24937. expanded
  24938. };
  24939. if (cellIndex === firstDefaultColumnIndex.value && treeRowData) {
  24940. data2.treeNode = {
  24941. indent: treeRowData.level * indent.value,
  24942. level: treeRowData.level
  24943. };
  24944. if (typeof treeRowData.expanded === "boolean") {
  24945. data2.treeNode.expanded = treeRowData.expanded;
  24946. if ("loading" in treeRowData) {
  24947. data2.treeNode.loading = treeRowData.loading;
  24948. }
  24949. if ("noLazyChildren" in treeRowData) {
  24950. data2.treeNode.noLazyChildren = treeRowData.noLazyChildren;
  24951. }
  24952. }
  24953. }
  24954. const baseKey = `${$index},${cellIndex}`;
  24955. const patchKey = columnData.columnKey || columnData.rawColumnKey || "";
  24956. const tdChildren = cellChildren(cellIndex, column, data2);
  24957. return h$1("td", {
  24958. style: getCellStyle($index, cellIndex, row, column),
  24959. class: getCellClass($index, cellIndex, row, column),
  24960. key: `${patchKey}${baseKey}`,
  24961. rowspan,
  24962. colspan,
  24963. onMouseenter: ($event) => handleCellMouseEnter($event, __spreadProps(__spreadValues({}, row), { tooltipEffect })),
  24964. onMouseleave: handleCellMouseLeave
  24965. }, [tdChildren]);
  24966. }));
  24967. };
  24968. const cellChildren = (cellIndex, column, data2) => {
  24969. return column.renderCell(data2);
  24970. };
  24971. const wrappedRowRender = (row, $index) => {
  24972. const store = props.store;
  24973. const { isRowExpanded, assertRowKey } = store;
  24974. const { treeData, lazyTreeNodeMap, childrenColumnName, rowKey } = store.states;
  24975. const columns = store.states.columns.value;
  24976. const hasExpandColumn = columns.some(({ type: type4 }) => type4 === "expand");
  24977. if (hasExpandColumn) {
  24978. const expanded = isRowExpanded(row);
  24979. const tr = rowRender(row, $index, void 0, expanded);
  24980. const renderExpanded = parent.renderExpanded;
  24981. if (expanded) {
  24982. if (!renderExpanded) {
  24983. console.error("[Element Error]renderExpanded is required.");
  24984. return tr;
  24985. }
  24986. return [
  24987. [
  24988. tr,
  24989. h$1("tr", {
  24990. key: `expanded-row__${tr.key}`
  24991. }, [
  24992. h$1("td", {
  24993. colspan: columns.length,
  24994. class: "el-table__cell el-table__expanded-cell"
  24995. }, [renderExpanded({ row, $index, store, expanded })])
  24996. ])
  24997. ]
  24998. ];
  24999. } else {
  25000. return [[tr]];
  25001. }
  25002. } else if (Object.keys(treeData.value).length) {
  25003. assertRowKey();
  25004. const key = getRowIdentity(row, rowKey.value);
  25005. let cur = treeData.value[key];
  25006. let treeRowData = null;
  25007. if (cur) {
  25008. treeRowData = {
  25009. expanded: cur.expanded,
  25010. level: cur.level,
  25011. display: true
  25012. };
  25013. if (typeof cur.lazy === "boolean") {
  25014. if (typeof cur.loaded === "boolean" && cur.loaded) {
  25015. treeRowData.noLazyChildren = !(cur.children && cur.children.length);
  25016. }
  25017. treeRowData.loading = cur.loading;
  25018. }
  25019. }
  25020. const tmp = [rowRender(row, $index, treeRowData)];
  25021. if (cur) {
  25022. let i = 0;
  25023. const traverse = (children, parent2) => {
  25024. if (!(children && children.length && parent2))
  25025. return;
  25026. children.forEach((node) => {
  25027. const innerTreeRowData = {
  25028. display: parent2.display && parent2.expanded,
  25029. level: parent2.level + 1,
  25030. expanded: false,
  25031. noLazyChildren: false,
  25032. loading: false
  25033. };
  25034. const childKey = getRowIdentity(node, rowKey.value);
  25035. if (childKey === void 0 || childKey === null) {
  25036. throw new Error("For nested data item, row-key is required.");
  25037. }
  25038. cur = __spreadValues({}, treeData.value[childKey]);
  25039. if (cur) {
  25040. innerTreeRowData.expanded = cur.expanded;
  25041. cur.level = cur.level || innerTreeRowData.level;
  25042. cur.display = !!(cur.expanded && innerTreeRowData.display);
  25043. if (typeof cur.lazy === "boolean") {
  25044. if (typeof cur.loaded === "boolean" && cur.loaded) {
  25045. innerTreeRowData.noLazyChildren = !(cur.children && cur.children.length);
  25046. }
  25047. innerTreeRowData.loading = cur.loading;
  25048. }
  25049. }
  25050. i++;
  25051. tmp.push(rowRender(node, $index + i, innerTreeRowData));
  25052. if (cur) {
  25053. const nodes2 = lazyTreeNodeMap.value[childKey] || node[childrenColumnName.value];
  25054. traverse(nodes2, cur);
  25055. }
  25056. });
  25057. };
  25058. cur.display = true;
  25059. const nodes = lazyTreeNodeMap.value[key] || row[childrenColumnName.value];
  25060. traverse(nodes, cur);
  25061. }
  25062. return tmp;
  25063. } else {
  25064. return rowRender(row, $index, void 0);
  25065. }
  25066. };
  25067. return {
  25068. wrappedRowRender,
  25069. tooltipContent,
  25070. tooltipTrigger
  25071. };
  25072. }
  25073. const defaultProps$2 = {
  25074. store: {
  25075. required: true,
  25076. type: Object
  25077. },
  25078. stripe: Boolean,
  25079. tooltipEffect: String,
  25080. context: {
  25081. default: () => ({}),
  25082. type: Object
  25083. },
  25084. rowClassName: [String, Function],
  25085. rowStyle: [Object, Function],
  25086. fixed: {
  25087. type: String,
  25088. default: ""
  25089. },
  25090. highlight: Boolean
  25091. };
  25092. var TableBody = defineComponent({
  25093. name: "ElTableBody",
  25094. props: defaultProps$2,
  25095. setup(props) {
  25096. const instance = getCurrentInstance();
  25097. const parent = inject(TABLE_INJECTION_KEY);
  25098. const ns = useNamespace("table");
  25099. const { wrappedRowRender, tooltipContent, tooltipTrigger } = useRender$1(props);
  25100. const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
  25101. watch(props.store.states.hoverRow, (newVal, oldVal) => {
  25102. if (!props.store.states.isComplex.value || !isClient)
  25103. return;
  25104. let raf = window.requestAnimationFrame;
  25105. if (!raf) {
  25106. raf = (fn2) => window.setTimeout(fn2, 16);
  25107. }
  25108. raf(() => {
  25109. var _a2;
  25110. const rows = (_a2 = instance == null ? void 0 : instance.vnode.el) == null ? void 0 : _a2.querySelectorAll(`.${ns.e("row")}`);
  25111. const oldRow = rows[oldVal];
  25112. const newRow = rows[newVal];
  25113. if (oldRow) {
  25114. removeClass(oldRow, "hover-row");
  25115. }
  25116. if (newRow) {
  25117. addClass(newRow, "hover-row");
  25118. }
  25119. });
  25120. });
  25121. onUnmounted(() => {
  25122. var _a2;
  25123. (_a2 = removePopper) == null ? void 0 : _a2();
  25124. });
  25125. onUpdated(() => {
  25126. var _a2;
  25127. (_a2 = removePopper) == null ? void 0 : _a2();
  25128. });
  25129. return {
  25130. ns,
  25131. onColumnsChange,
  25132. onScrollableChange,
  25133. wrappedRowRender,
  25134. tooltipContent,
  25135. tooltipTrigger
  25136. };
  25137. },
  25138. render() {
  25139. const { wrappedRowRender, store } = this;
  25140. const data2 = store.states.data.value || [];
  25141. return h$1("tbody", {}, [
  25142. data2.reduce((acc, row) => {
  25143. return acc.concat(wrappedRowRender(row, acc.length));
  25144. }, [])
  25145. ]);
  25146. }
  25147. });
  25148. function hColgroup(props) {
  25149. const isAuto = props.tableLayout === "auto";
  25150. let columns = props.columns || [];
  25151. if (isAuto) {
  25152. if (columns.every((column) => column.width === void 0)) {
  25153. columns = [];
  25154. }
  25155. }
  25156. const getPropsData = (column) => {
  25157. const propsData = {
  25158. key: `${props.tableLayout}_${column.id}`,
  25159. style: {},
  25160. name: void 0
  25161. };
  25162. if (isAuto) {
  25163. propsData.style = {
  25164. width: `${column.width}px`
  25165. };
  25166. } else {
  25167. propsData.name = column.id;
  25168. }
  25169. return propsData;
  25170. };
  25171. return h$1("colgroup", {}, columns.map((column) => h$1("col", getPropsData(column))));
  25172. }
  25173. hColgroup.props = ["columns", "tableLayout"];
  25174. function useMapState() {
  25175. const table = inject(TABLE_INJECTION_KEY);
  25176. const store = table == null ? void 0 : table.store;
  25177. const leftFixedLeafCount = computed(() => {
  25178. return store.states.fixedLeafColumnsLength.value;
  25179. });
  25180. const rightFixedLeafCount = computed(() => {
  25181. return store.states.rightFixedColumns.value.length;
  25182. });
  25183. const columnsCount = computed(() => {
  25184. return store.states.columns.value.length;
  25185. });
  25186. const leftFixedCount = computed(() => {
  25187. return store.states.fixedColumns.value.length;
  25188. });
  25189. const rightFixedCount = computed(() => {
  25190. return store.states.rightFixedColumns.value.length;
  25191. });
  25192. return {
  25193. leftFixedLeafCount,
  25194. rightFixedLeafCount,
  25195. columnsCount,
  25196. leftFixedCount,
  25197. rightFixedCount,
  25198. columns: store.states.columns
  25199. };
  25200. }
  25201. function useStyle$1(props) {
  25202. const { columns } = useMapState();
  25203. const ns = useNamespace("table");
  25204. const getCellClasses = (columns2, cellIndex) => {
  25205. const column = columns2[cellIndex];
  25206. const classes = [
  25207. ns.e("cell"),
  25208. column.id,
  25209. column.align,
  25210. column.labelClassName,
  25211. ...getFixedColumnsClass(ns.b(), cellIndex, column.fixed, props.store)
  25212. ];
  25213. if (column.className) {
  25214. classes.push(column.className);
  25215. }
  25216. if (!column.children) {
  25217. classes.push(ns.is("leaf"));
  25218. }
  25219. return classes;
  25220. };
  25221. const getCellStyles = (column, cellIndex) => {
  25222. const fixedStyle = getFixedColumnOffset(cellIndex, column.fixed, props.store);
  25223. ensurePosition(fixedStyle, "left");
  25224. ensurePosition(fixedStyle, "right");
  25225. return fixedStyle;
  25226. };
  25227. return {
  25228. getCellClasses,
  25229. getCellStyles,
  25230. columns
  25231. };
  25232. }
  25233. var TableFooter = defineComponent({
  25234. name: "ElTableFooter",
  25235. props: {
  25236. fixed: {
  25237. type: String,
  25238. default: ""
  25239. },
  25240. store: {
  25241. required: true,
  25242. type: Object
  25243. },
  25244. summaryMethod: Function,
  25245. sumText: String,
  25246. border: Boolean,
  25247. defaultSort: {
  25248. type: Object,
  25249. default: () => {
  25250. return {
  25251. prop: "",
  25252. order: ""
  25253. };
  25254. }
  25255. }
  25256. },
  25257. setup(props) {
  25258. const { getCellClasses, getCellStyles, columns } = useStyle$1(props);
  25259. const ns = useNamespace("table");
  25260. return {
  25261. ns,
  25262. getCellClasses,
  25263. getCellStyles,
  25264. columns
  25265. };
  25266. },
  25267. render() {
  25268. const {
  25269. columns,
  25270. getCellStyles,
  25271. getCellClasses,
  25272. summaryMethod,
  25273. sumText,
  25274. ns
  25275. } = this;
  25276. const data2 = this.store.states.data.value;
  25277. let sums = [];
  25278. if (summaryMethod) {
  25279. sums = summaryMethod({
  25280. columns,
  25281. data: data2
  25282. });
  25283. } else {
  25284. columns.forEach((column, index) => {
  25285. if (index === 0) {
  25286. sums[index] = sumText;
  25287. return;
  25288. }
  25289. const values = data2.map((item) => Number(item[column.property]));
  25290. const precisions = [];
  25291. let notNumber = true;
  25292. values.forEach((value) => {
  25293. if (!Number.isNaN(+value)) {
  25294. notNumber = false;
  25295. const decimal = `${value}`.split(".")[1];
  25296. precisions.push(decimal ? decimal.length : 0);
  25297. }
  25298. });
  25299. const precision = Math.max.apply(null, precisions);
  25300. if (!notNumber) {
  25301. sums[index] = values.reduce((prev, curr) => {
  25302. const value = Number(curr);
  25303. if (!Number.isNaN(+value)) {
  25304. return Number.parseFloat((prev + curr).toFixed(Math.min(precision, 20)));
  25305. } else {
  25306. return prev;
  25307. }
  25308. }, 0);
  25309. } else {
  25310. sums[index] = "";
  25311. }
  25312. });
  25313. }
  25314. return h$1("table", {
  25315. class: ns.e("footer"),
  25316. cellspacing: "0",
  25317. cellpadding: "0",
  25318. border: "0"
  25319. }, [
  25320. hColgroup({
  25321. columns
  25322. }),
  25323. h$1("tbody", [
  25324. h$1("tr", {}, [
  25325. ...columns.map((column, cellIndex) => h$1("td", {
  25326. key: cellIndex,
  25327. colspan: column.colSpan,
  25328. rowspan: column.rowSpan,
  25329. class: getCellClasses(columns, cellIndex),
  25330. style: getCellStyles(column, cellIndex)
  25331. }, [
  25332. h$1("div", {
  25333. class: ["cell", column.labelClassName]
  25334. }, [sums[cellIndex]])
  25335. ]))
  25336. ])
  25337. ])
  25338. ]);
  25339. }
  25340. });
  25341. function useUtils(store) {
  25342. const setCurrentRow = (row) => {
  25343. store.commit("setCurrentRow", row);
  25344. };
  25345. const getSelectionRows = () => {
  25346. return store.getSelectionRows();
  25347. };
  25348. const toggleRowSelection = (row, selected) => {
  25349. store.toggleRowSelection(row, selected, false);
  25350. store.updateAllSelected();
  25351. };
  25352. const clearSelection = () => {
  25353. store.clearSelection();
  25354. };
  25355. const clearFilter = (columnKeys) => {
  25356. store.clearFilter(columnKeys);
  25357. };
  25358. const toggleAllSelection = () => {
  25359. store.commit("toggleAllSelection");
  25360. };
  25361. const toggleRowExpansion = (row, expanded) => {
  25362. store.toggleRowExpansionAdapter(row, expanded);
  25363. };
  25364. const clearSort = () => {
  25365. store.clearSort();
  25366. };
  25367. const sort = (prop, order2) => {
  25368. store.commit("sort", { prop, order: order2 });
  25369. };
  25370. return {
  25371. setCurrentRow,
  25372. getSelectionRows,
  25373. toggleRowSelection,
  25374. clearSelection,
  25375. clearFilter,
  25376. toggleAllSelection,
  25377. toggleRowExpansion,
  25378. clearSort,
  25379. sort
  25380. };
  25381. }
  25382. function useStyle(props, layout, store, table) {
  25383. const isHidden = ref(false);
  25384. const renderExpanded = ref(null);
  25385. const resizeProxyVisible = ref(false);
  25386. const setDragVisible = (visible) => {
  25387. resizeProxyVisible.value = visible;
  25388. };
  25389. const resizeState = ref({
  25390. width: null,
  25391. height: null
  25392. });
  25393. const isGroup = ref(false);
  25394. const scrollbarViewStyle = {
  25395. display: "inline-block",
  25396. verticalAlign: "middle"
  25397. };
  25398. const tableWidth = ref();
  25399. watchEffect(() => {
  25400. layout.setHeight(props.height);
  25401. });
  25402. watchEffect(() => {
  25403. layout.setMaxHeight(props.maxHeight);
  25404. });
  25405. watch(() => [props.currentRowKey, store.states.rowKey], ([currentRowKey, rowKey]) => {
  25406. if (!unref(rowKey))
  25407. return;
  25408. store.setCurrentRowKey(`${currentRowKey}`);
  25409. }, {
  25410. immediate: true
  25411. });
  25412. watch(() => props.data, (data2) => {
  25413. table.store.commit("setData", data2);
  25414. }, {
  25415. immediate: true,
  25416. deep: true
  25417. });
  25418. watchEffect(() => {
  25419. if (props.expandRowKeys) {
  25420. store.setExpandRowKeysAdapter(props.expandRowKeys);
  25421. }
  25422. });
  25423. const handleMouseLeave = () => {
  25424. table.store.commit("setHoverRow", null);
  25425. if (table.hoverState)
  25426. table.hoverState = null;
  25427. };
  25428. const handleHeaderFooterMousewheel = (event, data2) => {
  25429. const { pixelX, pixelY } = data2;
  25430. if (Math.abs(pixelX) >= Math.abs(pixelY)) {
  25431. table.refs.bodyWrapper.scrollLeft += data2.pixelX / 5;
  25432. }
  25433. };
  25434. const shouldUpdateHeight = computed(() => {
  25435. return props.height || props.maxHeight || store.states.fixedColumns.value.length > 0 || store.states.rightFixedColumns.value.length > 0;
  25436. });
  25437. const tableBodyStyles = computed(() => {
  25438. return {
  25439. width: layout.bodyWidth.value ? `${layout.bodyWidth.value}px` : ""
  25440. };
  25441. });
  25442. const doLayout = () => {
  25443. if (shouldUpdateHeight.value) {
  25444. layout.updateElsHeight();
  25445. }
  25446. layout.updateColumnsWidth();
  25447. requestAnimationFrame(syncPostion);
  25448. };
  25449. onMounted(async () => {
  25450. await nextTick();
  25451. store.updateColumns();
  25452. bindEvents();
  25453. requestAnimationFrame(doLayout);
  25454. resizeState.value = {
  25455. width: tableWidth.value = table.vnode.el.offsetWidth,
  25456. height: table.vnode.el.offsetHeight
  25457. };
  25458. store.states.columns.value.forEach((column) => {
  25459. if (column.filteredValue && column.filteredValue.length) {
  25460. table.store.commit("filterChange", {
  25461. column,
  25462. values: column.filteredValue,
  25463. silent: true
  25464. });
  25465. }
  25466. });
  25467. table.$ready = true;
  25468. });
  25469. const setScrollClassByEl = (el, className) => {
  25470. if (!el)
  25471. return;
  25472. const classList = Array.from(el.classList).filter((item) => !item.startsWith("is-scrolling-"));
  25473. classList.push(layout.scrollX.value ? className : "is-scrolling-none");
  25474. el.className = classList.join(" ");
  25475. };
  25476. const setScrollClass = (className) => {
  25477. const { tableWrapper } = table.refs;
  25478. setScrollClassByEl(tableWrapper, className);
  25479. };
  25480. const hasScrollClass = (className) => {
  25481. const { tableWrapper } = table.refs;
  25482. if (tableWrapper && tableWrapper.classList.contains(className)) {
  25483. return true;
  25484. }
  25485. return false;
  25486. };
  25487. const syncPostion = function() {
  25488. if (!table.refs.scrollBarRef)
  25489. return;
  25490. if (!layout.scrollX.value) {
  25491. const scrollingNoneClass = "is-scrolling-none";
  25492. if (!hasScrollClass(scrollingNoneClass)) {
  25493. setScrollClass(scrollingNoneClass);
  25494. }
  25495. return;
  25496. }
  25497. const scrollContainer = table.refs.scrollBarRef.wrap$;
  25498. if (!scrollContainer)
  25499. return;
  25500. const { scrollLeft, offsetWidth, scrollWidth } = scrollContainer;
  25501. const { headerWrapper, footerWrapper } = table.refs;
  25502. if (headerWrapper)
  25503. headerWrapper.scrollLeft = scrollLeft;
  25504. if (footerWrapper)
  25505. footerWrapper.scrollLeft = scrollLeft;
  25506. const maxScrollLeftPosition = scrollWidth - offsetWidth - 1;
  25507. if (scrollLeft >= maxScrollLeftPosition) {
  25508. setScrollClass("is-scrolling-right");
  25509. } else if (scrollLeft === 0) {
  25510. setScrollClass("is-scrolling-left");
  25511. } else {
  25512. setScrollClass("is-scrolling-middle");
  25513. }
  25514. };
  25515. const bindEvents = () => {
  25516. var _a2;
  25517. if (!table.refs.scrollBarRef)
  25518. return;
  25519. (_a2 = table.refs.scrollBarRef.wrap$) == null ? void 0 : _a2.addEventListener("scroll", syncPostion, {
  25520. passive: true
  25521. });
  25522. if (props.fit) {
  25523. addResizeListener(table.vnode.el, resizeListener);
  25524. } else {
  25525. on(window, "resize", doLayout);
  25526. }
  25527. };
  25528. onBeforeUnmount(() => {
  25529. unbindEvents();
  25530. });
  25531. const unbindEvents = () => {
  25532. var _a2;
  25533. (_a2 = table.refs.scrollBarRef.wrap$) == null ? void 0 : _a2.removeEventListener("scroll", syncPostion, true);
  25534. if (props.fit) {
  25535. removeResizeListener(table.vnode.el, resizeListener);
  25536. } else {
  25537. off(window, "resize", doLayout);
  25538. }
  25539. };
  25540. const resizeListener = () => {
  25541. if (!table.$ready)
  25542. return;
  25543. let shouldUpdateLayout = false;
  25544. const el = table.vnode.el;
  25545. const { width: oldWidth, height: oldHeight } = resizeState.value;
  25546. const width = tableWidth.value = el.offsetWidth;
  25547. if (oldWidth !== width) {
  25548. shouldUpdateLayout = true;
  25549. }
  25550. const height2 = el.offsetHeight;
  25551. if ((props.height || shouldUpdateHeight.value) && oldHeight !== height2) {
  25552. shouldUpdateLayout = true;
  25553. }
  25554. if (shouldUpdateLayout) {
  25555. resizeState.value = {
  25556. width,
  25557. height: height2
  25558. };
  25559. doLayout();
  25560. }
  25561. };
  25562. const tableSize = useSize();
  25563. const bodyWidth = computed(() => {
  25564. const { bodyWidth: bodyWidth_, scrollY, gutterWidth } = layout;
  25565. return bodyWidth_.value ? `${bodyWidth_.value - (scrollY.value ? gutterWidth : 0)}px` : "";
  25566. });
  25567. const tableLayout = computed(() => {
  25568. if (props.maxHeight)
  25569. return "fixed";
  25570. return props.tableLayout;
  25571. });
  25572. function calcMaxHeight(maxHeight, footerHeight, headerHeight) {
  25573. const parsedMaxHeight = parseHeight(maxHeight);
  25574. const tableHeaderHeight = props.showHeader ? headerHeight : 0;
  25575. if (parsedMaxHeight === null)
  25576. return;
  25577. if (isString(parsedMaxHeight)) {
  25578. return `calc(${parsedMaxHeight} - ${footerHeight}px - ${tableHeaderHeight}px)`;
  25579. }
  25580. return parsedMaxHeight - footerHeight - tableHeaderHeight;
  25581. }
  25582. const height = computed(() => {
  25583. const headerHeight = layout.headerHeight.value || 0;
  25584. const bodyHeight2 = layout.bodyHeight.value;
  25585. const footerHeight = layout.footerHeight.value || 0;
  25586. if (props.height) {
  25587. return bodyHeight2 ? bodyHeight2 : void 0;
  25588. } else if (props.maxHeight) {
  25589. return calcMaxHeight(props.maxHeight, footerHeight, headerHeight);
  25590. }
  25591. return void 0;
  25592. });
  25593. const bodyHeight = computed(() => {
  25594. const headerHeight = layout.headerHeight.value || 0;
  25595. const bodyHeight2 = layout.bodyHeight.value;
  25596. const footerHeight = layout.footerHeight.value || 0;
  25597. if (props.height) {
  25598. return {
  25599. height: bodyHeight2 ? `${bodyHeight2}px` : ""
  25600. };
  25601. } else if (props.maxHeight) {
  25602. const maxHeight = calcMaxHeight(props.maxHeight, footerHeight, headerHeight);
  25603. if (maxHeight !== null) {
  25604. return {
  25605. "max-height": `${maxHeight}${isNumber(maxHeight) ? "px" : ""}`
  25606. };
  25607. }
  25608. }
  25609. return {};
  25610. });
  25611. const emptyBlockStyle = computed(() => {
  25612. if (props.data && props.data.length)
  25613. return null;
  25614. let height2 = "100%";
  25615. if (layout.appendHeight.value) {
  25616. height2 = `calc(100% - ${layout.appendHeight.value}px)`;
  25617. }
  25618. return {
  25619. width: tableWidth.value ? `${tableWidth.value}px` : "",
  25620. height: height2
  25621. };
  25622. });
  25623. const handleFixedMousewheel = (event, data2) => {
  25624. const bodyWrapper = table.refs.bodyWrapper;
  25625. if (Math.abs(data2.spinY) > 0) {
  25626. const currentScrollTop = bodyWrapper.scrollTop;
  25627. if (data2.pixelY < 0 && currentScrollTop !== 0) {
  25628. event.preventDefault();
  25629. }
  25630. if (data2.pixelY > 0 && bodyWrapper.scrollHeight - bodyWrapper.clientHeight > currentScrollTop) {
  25631. event.preventDefault();
  25632. }
  25633. bodyWrapper.scrollTop += Math.ceil(data2.pixelY / 5);
  25634. } else {
  25635. bodyWrapper.scrollLeft += Math.ceil(data2.pixelX / 5);
  25636. }
  25637. };
  25638. const fixedHeight = computed(() => {
  25639. if (props.maxHeight) {
  25640. if (props.showSummary) {
  25641. return {
  25642. bottom: 0
  25643. };
  25644. }
  25645. return {
  25646. bottom: layout.scrollX.value && props.data.length ? `${layout.gutterWidth}px` : ""
  25647. };
  25648. } else {
  25649. if (props.showSummary) {
  25650. return {
  25651. height: layout.tableHeight.value ? `${layout.tableHeight.value}px` : ""
  25652. };
  25653. }
  25654. return {
  25655. height: layout.viewportHeight.value ? `${layout.viewportHeight.value}px` : ""
  25656. };
  25657. }
  25658. });
  25659. const fixedBodyHeight = computed(() => {
  25660. if (props.height) {
  25661. return {
  25662. height: layout.fixedBodyHeight.value ? `${layout.fixedBodyHeight.value}px` : ""
  25663. };
  25664. } else if (props.maxHeight) {
  25665. let maxHeight = parseHeight(props.maxHeight);
  25666. if (typeof maxHeight === "number") {
  25667. maxHeight = layout.scrollX.value ? maxHeight - layout.gutterWidth : maxHeight;
  25668. if (props.showHeader) {
  25669. maxHeight -= layout.headerHeight.value;
  25670. }
  25671. maxHeight -= layout.footerHeight.value;
  25672. return {
  25673. "max-height": `${maxHeight}px`
  25674. };
  25675. }
  25676. }
  25677. return {};
  25678. });
  25679. return {
  25680. isHidden,
  25681. renderExpanded,
  25682. setDragVisible,
  25683. isGroup,
  25684. handleMouseLeave,
  25685. handleHeaderFooterMousewheel,
  25686. tableSize,
  25687. bodyHeight,
  25688. height,
  25689. emptyBlockStyle,
  25690. handleFixedMousewheel,
  25691. fixedHeight,
  25692. fixedBodyHeight,
  25693. resizeProxyVisible,
  25694. bodyWidth,
  25695. resizeState,
  25696. doLayout,
  25697. tableBodyStyles,
  25698. tableLayout,
  25699. scrollbarViewStyle
  25700. };
  25701. }
  25702. var defaultProps$1 = {
  25703. data: {
  25704. type: Array,
  25705. default: () => {
  25706. return [];
  25707. }
  25708. },
  25709. size: String,
  25710. width: [String, Number],
  25711. height: [String, Number],
  25712. maxHeight: [String, Number],
  25713. fit: {
  25714. type: Boolean,
  25715. default: true
  25716. },
  25717. stripe: Boolean,
  25718. border: Boolean,
  25719. rowKey: [String, Function],
  25720. showHeader: {
  25721. type: Boolean,
  25722. default: true
  25723. },
  25724. showSummary: Boolean,
  25725. sumText: String,
  25726. summaryMethod: Function,
  25727. rowClassName: [String, Function],
  25728. rowStyle: [Object, Function],
  25729. cellClassName: [String, Function],
  25730. cellStyle: [Object, Function],
  25731. headerRowClassName: [String, Function],
  25732. headerRowStyle: [Object, Function],
  25733. headerCellClassName: [String, Function],
  25734. headerCellStyle: [Object, Function],
  25735. highlightCurrentRow: Boolean,
  25736. currentRowKey: [String, Number],
  25737. emptyText: String,
  25738. expandRowKeys: Array,
  25739. defaultExpandAll: Boolean,
  25740. defaultSort: Object,
  25741. tooltipEffect: String,
  25742. spanMethod: Function,
  25743. selectOnIndeterminate: {
  25744. type: Boolean,
  25745. default: true
  25746. },
  25747. indent: {
  25748. type: Number,
  25749. default: 16
  25750. },
  25751. treeProps: {
  25752. type: Object,
  25753. default: () => {
  25754. return {
  25755. hasChildren: "hasChildren",
  25756. children: "children"
  25757. };
  25758. }
  25759. },
  25760. lazy: Boolean,
  25761. load: Function,
  25762. style: {
  25763. type: Object,
  25764. default: () => ({})
  25765. },
  25766. className: {
  25767. type: String,
  25768. default: ""
  25769. },
  25770. tableLayout: {
  25771. type: String,
  25772. default: "fixed"
  25773. },
  25774. scrollbarAlwaysOn: {
  25775. type: Boolean,
  25776. default: false
  25777. }
  25778. };
  25779. const useScrollbar = () => {
  25780. const scrollBarRef = ref();
  25781. const scrollTo = (options, yCoord) => {
  25782. const scrollbar = scrollBarRef.value;
  25783. if (scrollbar) {
  25784. scrollbar.scrollTo(options, yCoord);
  25785. }
  25786. };
  25787. const setScrollPosition = (position, offset2) => {
  25788. const scrollbar = scrollBarRef.value;
  25789. if (scrollbar && isNumber(offset2) && ["Top", "Left"].includes(position)) {
  25790. scrollbar[`setScroll${position}`](offset2);
  25791. }
  25792. };
  25793. const setScrollTop = (top2) => setScrollPosition("Top", top2);
  25794. const setScrollLeft = (left2) => setScrollPosition("Left", left2);
  25795. return {
  25796. scrollBarRef,
  25797. scrollTo,
  25798. setScrollTop,
  25799. setScrollLeft
  25800. };
  25801. };
  25802. let tableIdSeed = 1;
  25803. const _sfc_main$e = defineComponent({
  25804. name: "ElTable",
  25805. directives: {
  25806. Mousewheel
  25807. },
  25808. components: {
  25809. TableHeader,
  25810. TableBody,
  25811. TableFooter,
  25812. ElScrollbar,
  25813. hColgroup
  25814. },
  25815. props: defaultProps$1,
  25816. emits: [
  25817. "select",
  25818. "select-all",
  25819. "selection-change",
  25820. "cell-mouse-enter",
  25821. "cell-mouse-leave",
  25822. "cell-contextmenu",
  25823. "cell-click",
  25824. "cell-dblclick",
  25825. "row-click",
  25826. "row-contextmenu",
  25827. "row-dblclick",
  25828. "header-click",
  25829. "header-contextmenu",
  25830. "sort-change",
  25831. "filter-change",
  25832. "current-change",
  25833. "header-dragend",
  25834. "expand-change"
  25835. ],
  25836. setup(props) {
  25837. const { t } = useLocale();
  25838. const ns = useNamespace("table");
  25839. const table = getCurrentInstance();
  25840. provide(TABLE_INJECTION_KEY, table);
  25841. const store = createStore(table, props);
  25842. table.store = store;
  25843. const layout = new TableLayout({
  25844. store: table.store,
  25845. table,
  25846. fit: props.fit,
  25847. showHeader: props.showHeader
  25848. });
  25849. table.layout = layout;
  25850. const isEmpty3 = computed(() => (store.states.data.value || []).length === 0);
  25851. const {
  25852. setCurrentRow,
  25853. getSelectionRows,
  25854. toggleRowSelection,
  25855. clearSelection,
  25856. clearFilter,
  25857. toggleAllSelection,
  25858. toggleRowExpansion,
  25859. clearSort,
  25860. sort
  25861. } = useUtils(store);
  25862. const {
  25863. isHidden,
  25864. renderExpanded,
  25865. setDragVisible,
  25866. isGroup,
  25867. handleMouseLeave,
  25868. handleHeaderFooterMousewheel,
  25869. tableSize,
  25870. bodyHeight,
  25871. height,
  25872. emptyBlockStyle,
  25873. handleFixedMousewheel,
  25874. fixedHeight,
  25875. fixedBodyHeight,
  25876. resizeProxyVisible,
  25877. bodyWidth,
  25878. resizeState,
  25879. doLayout,
  25880. tableBodyStyles,
  25881. tableLayout,
  25882. scrollbarViewStyle
  25883. } = useStyle(props, layout, store, table);
  25884. const { scrollBarRef, scrollTo, setScrollLeft, setScrollTop } = useScrollbar();
  25885. const debouncedUpdateLayout = debounce$1(doLayout, 50);
  25886. const tableId = `el-table_${tableIdSeed++}`;
  25887. table.tableId = tableId;
  25888. table.state = {
  25889. isGroup,
  25890. resizeState,
  25891. doLayout,
  25892. debouncedUpdateLayout
  25893. };
  25894. const computedSumText = computed(() => props.sumText || t("el.table.sumText"));
  25895. const computedEmptyText = computed(() => {
  25896. return props.emptyText || t("el.table.emptyText");
  25897. });
  25898. return {
  25899. ns,
  25900. layout,
  25901. store,
  25902. handleHeaderFooterMousewheel,
  25903. handleMouseLeave,
  25904. tableId,
  25905. tableSize,
  25906. isHidden,
  25907. isEmpty: isEmpty3,
  25908. renderExpanded,
  25909. resizeProxyVisible,
  25910. resizeState,
  25911. isGroup,
  25912. bodyWidth,
  25913. bodyHeight,
  25914. height,
  25915. tableBodyStyles,
  25916. emptyBlockStyle,
  25917. debouncedUpdateLayout,
  25918. handleFixedMousewheel,
  25919. fixedHeight,
  25920. fixedBodyHeight,
  25921. setCurrentRow,
  25922. getSelectionRows,
  25923. toggleRowSelection,
  25924. clearSelection,
  25925. clearFilter,
  25926. toggleAllSelection,
  25927. toggleRowExpansion,
  25928. clearSort,
  25929. doLayout,
  25930. sort,
  25931. t,
  25932. setDragVisible,
  25933. context: table,
  25934. computedSumText,
  25935. computedEmptyText,
  25936. tableLayout,
  25937. scrollbarViewStyle,
  25938. scrollBarRef,
  25939. scrollTo,
  25940. setScrollLeft,
  25941. setScrollTop
  25942. };
  25943. }
  25944. });
  25945. const _hoisted_1$b = ["data-prefix"];
  25946. const _hoisted_2$9 = {
  25947. ref: "hiddenColumns",
  25948. class: "hidden-columns"
  25949. };
  25950. function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
  25951. const _component_hColgroup = resolveComponent("hColgroup");
  25952. const _component_table_header = resolveComponent("table-header");
  25953. const _component_table_body = resolveComponent("table-body");
  25954. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  25955. const _component_table_footer = resolveComponent("table-footer");
  25956. const _directive_mousewheel = resolveDirective("mousewheel");
  25957. return openBlock(), createElementBlock("div", {
  25958. ref: "tableWrapper",
  25959. class: normalizeClass([
  25960. {
  25961. [_ctx.ns.m("fit")]: _ctx.fit,
  25962. [_ctx.ns.m("striped")]: _ctx.stripe,
  25963. [_ctx.ns.m("border")]: _ctx.border || _ctx.isGroup,
  25964. [_ctx.ns.m("hidden")]: _ctx.isHidden,
  25965. [_ctx.ns.m("group")]: _ctx.isGroup,
  25966. [_ctx.ns.m("fluid-height")]: _ctx.maxHeight,
  25967. [_ctx.ns.m("scrollable-x")]: _ctx.layout.scrollX.value,
  25968. [_ctx.ns.m("scrollable-y")]: _ctx.layout.scrollY.value,
  25969. [_ctx.ns.m("enable-row-hover")]: !_ctx.store.states.isComplex.value,
  25970. [_ctx.ns.m("enable-row-transition")]: (_ctx.store.states.data.value || []).length !== 0 && (_ctx.store.states.data.value || []).length < 100,
  25971. "has-footer": _ctx.showSummary
  25972. },
  25973. _ctx.ns.m(_ctx.tableSize),
  25974. _ctx.className,
  25975. _ctx.ns.b(),
  25976. _ctx.ns.m(`layout-${_ctx.tableLayout}`)
  25977. ]),
  25978. style: normalizeStyle(_ctx.style),
  25979. "data-prefix": _ctx.ns.namespace.value,
  25980. onMouseleave: _cache[0] || (_cache[0] = ($event) => _ctx.handleMouseLeave())
  25981. }, [
  25982. createElementVNode("div", {
  25983. class: normalizeClass(_ctx.ns.e("inner-wrapper"))
  25984. }, [
  25985. createElementVNode("div", _hoisted_2$9, [
  25986. renderSlot(_ctx.$slots, "default")
  25987. ], 512),
  25988. _ctx.showHeader && _ctx.tableLayout === "fixed" ? withDirectives((openBlock(), createElementBlock("div", {
  25989. key: 0,
  25990. ref: "headerWrapper",
  25991. class: normalizeClass(_ctx.ns.e("header-wrapper"))
  25992. }, [
  25993. createElementVNode("table", {
  25994. ref: "tableHeader",
  25995. class: normalizeClass(_ctx.ns.e("header")),
  25996. style: normalizeStyle(_ctx.tableBodyStyles),
  25997. border: "0",
  25998. cellpadding: "0",
  25999. cellspacing: "0"
  26000. }, [
  26001. createVNode(_component_hColgroup, {
  26002. columns: _ctx.store.states.columns.value,
  26003. "table-layout": _ctx.tableLayout
  26004. }, null, 8, ["columns", "table-layout"]),
  26005. createVNode(_component_table_header, {
  26006. ref: "tableHeaderRef",
  26007. border: _ctx.border,
  26008. "default-sort": _ctx.defaultSort,
  26009. store: _ctx.store,
  26010. onSetDragVisible: _ctx.setDragVisible
  26011. }, null, 8, ["border", "default-sort", "store", "onSetDragVisible"])
  26012. ], 6)
  26013. ], 2)), [
  26014. [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]
  26015. ]) : createCommentVNode("v-if", true),
  26016. createElementVNode("div", {
  26017. ref: "bodyWrapper",
  26018. style: normalizeStyle(_ctx.bodyHeight),
  26019. class: normalizeClass(_ctx.ns.e("body-wrapper"))
  26020. }, [
  26021. createVNode(_component_el_scrollbar, {
  26022. ref: "scrollBarRef",
  26023. height: _ctx.maxHeight ? void 0 : _ctx.height,
  26024. "max-height": _ctx.maxHeight ? _ctx.height : void 0,
  26025. "view-style": _ctx.scrollbarViewStyle,
  26026. always: _ctx.scrollbarAlwaysOn
  26027. }, {
  26028. default: withCtx(() => [
  26029. createElementVNode("table", {
  26030. ref: "tableBody",
  26031. class: normalizeClass(_ctx.ns.e("body")),
  26032. cellspacing: "0",
  26033. cellpadding: "0",
  26034. border: "0",
  26035. style: normalizeStyle({
  26036. width: _ctx.bodyWidth,
  26037. tableLayout: _ctx.tableLayout
  26038. })
  26039. }, [
  26040. createVNode(_component_hColgroup, {
  26041. columns: _ctx.store.states.columns.value,
  26042. "table-layout": _ctx.tableLayout
  26043. }, null, 8, ["columns", "table-layout"]),
  26044. _ctx.showHeader && _ctx.tableLayout === "auto" ? (openBlock(), createBlock(_component_table_header, {
  26045. key: 0,
  26046. border: _ctx.border,
  26047. "default-sort": _ctx.defaultSort,
  26048. store: _ctx.store,
  26049. onSetDragVisible: _ctx.setDragVisible
  26050. }, null, 8, ["border", "default-sort", "store", "onSetDragVisible"])) : createCommentVNode("v-if", true),
  26051. createVNode(_component_table_body, {
  26052. context: _ctx.context,
  26053. highlight: _ctx.highlightCurrentRow,
  26054. "row-class-name": _ctx.rowClassName,
  26055. "tooltip-effect": _ctx.tooltipEffect,
  26056. "row-style": _ctx.rowStyle,
  26057. store: _ctx.store,
  26058. stripe: _ctx.stripe
  26059. }, null, 8, ["context", "highlight", "row-class-name", "tooltip-effect", "row-style", "store", "stripe"])
  26060. ], 6),
  26061. _ctx.isEmpty ? (openBlock(), createElementBlock("div", {
  26062. key: 0,
  26063. ref: "emptyBlock",
  26064. style: normalizeStyle(_ctx.emptyBlockStyle),
  26065. class: normalizeClass(_ctx.ns.e("empty-block"))
  26066. }, [
  26067. createElementVNode("span", {
  26068. class: normalizeClass(_ctx.ns.e("empty-text"))
  26069. }, [
  26070. renderSlot(_ctx.$slots, "empty", {}, () => [
  26071. createTextVNode(toDisplayString(_ctx.computedEmptyText), 1)
  26072. ])
  26073. ], 2)
  26074. ], 6)) : createCommentVNode("v-if", true),
  26075. _ctx.$slots.append ? (openBlock(), createElementBlock("div", {
  26076. key: 1,
  26077. ref: "appendWrapper",
  26078. class: normalizeClass(_ctx.ns.e("append-wrapper"))
  26079. }, [
  26080. renderSlot(_ctx.$slots, "append")
  26081. ], 2)) : createCommentVNode("v-if", true)
  26082. ]),
  26083. _: 3
  26084. }, 8, ["height", "max-height", "view-style", "always"])
  26085. ], 6),
  26086. _ctx.border || _ctx.isGroup ? (openBlock(), createElementBlock("div", {
  26087. key: 1,
  26088. class: normalizeClass(_ctx.ns.e("border-left-patch"))
  26089. }, null, 2)) : createCommentVNode("v-if", true)
  26090. ], 2),
  26091. _ctx.showSummary ? withDirectives((openBlock(), createElementBlock("div", {
  26092. key: 0,
  26093. ref: "footerWrapper",
  26094. class: normalizeClass(_ctx.ns.e("footer-wrapper"))
  26095. }, [
  26096. createVNode(_component_table_footer, {
  26097. border: _ctx.border,
  26098. "default-sort": _ctx.defaultSort,
  26099. store: _ctx.store,
  26100. style: normalizeStyle(_ctx.tableBodyStyles),
  26101. "sum-text": _ctx.computedSumText,
  26102. "summary-method": _ctx.summaryMethod
  26103. }, null, 8, ["border", "default-sort", "store", "style", "sum-text", "summary-method"])
  26104. ], 2)), [
  26105. [vShow, !_ctx.isEmpty],
  26106. [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]
  26107. ]) : createCommentVNode("v-if", true),
  26108. withDirectives(createElementVNode("div", {
  26109. ref: "resizeProxy",
  26110. class: normalizeClass(_ctx.ns.e("column-resize-proxy"))
  26111. }, null, 2), [
  26112. [vShow, _ctx.resizeProxyVisible]
  26113. ])
  26114. ], 46, _hoisted_1$b);
  26115. }
  26116. var Table = /* @__PURE__ */ _export_sfc$1(_sfc_main$e, [["render", _sfc_render$2], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/table/src/table.vue"]]);
  26117. const defaultClassNames = {
  26118. selection: "table-column--selection",
  26119. expand: "table__expand-column"
  26120. };
  26121. const cellStarts = {
  26122. default: {
  26123. order: ""
  26124. },
  26125. selection: {
  26126. width: 48,
  26127. minWidth: 48,
  26128. realWidth: 48,
  26129. order: ""
  26130. },
  26131. expand: {
  26132. width: 48,
  26133. minWidth: 48,
  26134. realWidth: 48,
  26135. order: ""
  26136. },
  26137. index: {
  26138. width: 48,
  26139. minWidth: 48,
  26140. realWidth: 48,
  26141. order: ""
  26142. }
  26143. };
  26144. const getDefaultClassName = (type4) => {
  26145. return defaultClassNames[type4] || "";
  26146. };
  26147. const cellForced = {
  26148. selection: {
  26149. renderHeader({ store }) {
  26150. function isDisabled() {
  26151. return store.states.data.value && store.states.data.value.length === 0;
  26152. }
  26153. return h$1(ElCheckbox, {
  26154. disabled: isDisabled(),
  26155. size: store.states.tableSize.value,
  26156. indeterminate: store.states.selection.value.length > 0 && !store.states.isAllSelected.value,
  26157. "onUpdate:modelValue": store.toggleAllSelection,
  26158. modelValue: store.states.isAllSelected.value
  26159. });
  26160. },
  26161. renderCell({
  26162. row,
  26163. column,
  26164. store,
  26165. $index
  26166. }) {
  26167. return h$1(ElCheckbox, {
  26168. disabled: column.selectable ? !column.selectable.call(null, row, $index) : false,
  26169. size: store.states.tableSize.value,
  26170. onChange: () => {
  26171. store.commit("rowSelectedChanged", row);
  26172. },
  26173. onClick: (event) => event.stopPropagation(),
  26174. modelValue: store.isSelected(row)
  26175. });
  26176. },
  26177. sortable: false,
  26178. resizable: false
  26179. },
  26180. index: {
  26181. renderHeader({ column }) {
  26182. return column.label || "#";
  26183. },
  26184. renderCell({
  26185. column,
  26186. $index
  26187. }) {
  26188. let i = $index + 1;
  26189. const index = column.index;
  26190. if (typeof index === "number") {
  26191. i = $index + index;
  26192. } else if (typeof index === "function") {
  26193. i = index($index);
  26194. }
  26195. return h$1("div", {}, [i]);
  26196. },
  26197. sortable: false
  26198. },
  26199. expand: {
  26200. renderHeader({ column }) {
  26201. return column.label || "";
  26202. },
  26203. renderCell({
  26204. row,
  26205. store,
  26206. expanded
  26207. }) {
  26208. const { ns } = store;
  26209. const classes = [ns.e("expand-icon")];
  26210. if (expanded) {
  26211. classes.push(ns.em("expand-icon", "expanded"));
  26212. }
  26213. const callback = function(e) {
  26214. e.stopPropagation();
  26215. store.toggleRowExpansion(row);
  26216. };
  26217. return h$1("div", {
  26218. class: classes,
  26219. onClick: callback
  26220. }, {
  26221. default: () => {
  26222. return [
  26223. h$1(ElIcon, null, {
  26224. default: () => {
  26225. return [h$1(arrowRight)];
  26226. }
  26227. })
  26228. ];
  26229. }
  26230. });
  26231. },
  26232. sortable: false,
  26233. resizable: false
  26234. }
  26235. };
  26236. function defaultRenderCell({
  26237. row,
  26238. column,
  26239. $index
  26240. }) {
  26241. var _a2;
  26242. const property = column.property;
  26243. const value = property && getProp(row, property).value;
  26244. if (column && column.formatter) {
  26245. return column.formatter(row, column, value, $index);
  26246. }
  26247. return ((_a2 = value == null ? void 0 : value.toString) == null ? void 0 : _a2.call(value)) || "";
  26248. }
  26249. function treeCellPrefix({
  26250. row,
  26251. treeNode,
  26252. store
  26253. }, createPlacehoder = false) {
  26254. const { ns } = store;
  26255. if (!treeNode) {
  26256. if (createPlacehoder) {
  26257. return [
  26258. h$1("span", {
  26259. class: ns.e("placeholder")
  26260. })
  26261. ];
  26262. }
  26263. return null;
  26264. }
  26265. const ele = [];
  26266. const callback = function(e) {
  26267. e.stopPropagation();
  26268. store.loadOrToggle(row);
  26269. };
  26270. if (treeNode.indent) {
  26271. ele.push(h$1("span", {
  26272. class: ns.e("indent"),
  26273. style: { "padding-left": `${treeNode.indent}px` }
  26274. }));
  26275. }
  26276. if (typeof treeNode.expanded === "boolean" && !treeNode.noLazyChildren) {
  26277. const expandClasses = [
  26278. ns.e("expand-icon"),
  26279. treeNode.expanded ? ns.em("expand-icon", "expanded") : ""
  26280. ];
  26281. let icon = arrowRight;
  26282. if (treeNode.loading) {
  26283. icon = loading;
  26284. }
  26285. ele.push(h$1("div", {
  26286. class: expandClasses,
  26287. onClick: callback
  26288. }, {
  26289. default: () => {
  26290. return [
  26291. h$1(ElIcon, { class: { [ns.is("loading")]: treeNode.loading } }, {
  26292. default: () => [h$1(icon)]
  26293. })
  26294. ];
  26295. }
  26296. }));
  26297. } else {
  26298. ele.push(h$1("span", {
  26299. class: ns.e("placeholder")
  26300. }));
  26301. }
  26302. return ele;
  26303. }
  26304. function getAllAliases(props, aliases) {
  26305. return props.reduce((prev, cur) => {
  26306. prev[cur] = cur;
  26307. return prev;
  26308. }, aliases);
  26309. }
  26310. function useWatcher(owner, props_) {
  26311. const instance = getCurrentInstance();
  26312. const registerComplexWatchers = () => {
  26313. const props = ["fixed"];
  26314. const aliases = {
  26315. realWidth: "width",
  26316. realMinWidth: "minWidth"
  26317. };
  26318. const allAliases = getAllAliases(props, aliases);
  26319. Object.keys(allAliases).forEach((key) => {
  26320. const columnKey = aliases[key];
  26321. if (hasOwn(props_, columnKey)) {
  26322. watch(() => props_[columnKey], (newVal) => {
  26323. let value = newVal;
  26324. if (columnKey === "width" && key === "realWidth") {
  26325. value = parseWidth(newVal);
  26326. }
  26327. if (columnKey === "minWidth" && key === "realMinWidth") {
  26328. value = parseMinWidth(newVal);
  26329. }
  26330. instance.columnConfig.value[columnKey] = value;
  26331. instance.columnConfig.value[key] = value;
  26332. const updateColumns = columnKey === "fixed";
  26333. owner.value.store.scheduleLayout(updateColumns);
  26334. });
  26335. }
  26336. });
  26337. };
  26338. const registerNormalWatchers = () => {
  26339. const props = [
  26340. "label",
  26341. "filters",
  26342. "filterMultiple",
  26343. "sortable",
  26344. "index",
  26345. "formatter",
  26346. "className",
  26347. "labelClassName",
  26348. "showOverflowTooltip"
  26349. ];
  26350. const aliases = {
  26351. property: "prop",
  26352. align: "realAlign",
  26353. headerAlign: "realHeaderAlign"
  26354. };
  26355. const allAliases = getAllAliases(props, aliases);
  26356. Object.keys(allAliases).forEach((key) => {
  26357. const columnKey = aliases[key];
  26358. if (hasOwn(props_, columnKey)) {
  26359. watch(() => props_[columnKey], (newVal) => {
  26360. instance.columnConfig.value[key] = newVal;
  26361. });
  26362. }
  26363. });
  26364. };
  26365. return {
  26366. registerComplexWatchers,
  26367. registerNormalWatchers
  26368. };
  26369. }
  26370. function useRender(props, slots, owner) {
  26371. const instance = getCurrentInstance();
  26372. const columnId = ref("");
  26373. const isSubColumn = ref(false);
  26374. const realAlign = ref();
  26375. const realHeaderAlign = ref();
  26376. const ns = useNamespace("table");
  26377. watchEffect(() => {
  26378. realAlign.value = props.align ? `is-${props.align}` : null;
  26379. realAlign.value;
  26380. });
  26381. watchEffect(() => {
  26382. realHeaderAlign.value = props.headerAlign ? `is-${props.headerAlign}` : realAlign.value;
  26383. realHeaderAlign.value;
  26384. });
  26385. const columnOrTableParent = computed(() => {
  26386. let parent = instance.vnode.vParent || instance.parent;
  26387. while (parent && !parent.tableId && !parent.columnId) {
  26388. parent = parent.vnode.vParent || parent.parent;
  26389. }
  26390. return parent;
  26391. });
  26392. const hasTreeColumn = computed(() => {
  26393. const { store } = instance.parent;
  26394. if (!store)
  26395. return false;
  26396. const { treeData } = store.states;
  26397. const treeDataValue = treeData.value;
  26398. return treeDataValue && Object.keys(treeDataValue).length > 0;
  26399. });
  26400. const realWidth = ref(parseWidth(props.width));
  26401. const realMinWidth = ref(parseMinWidth(props.minWidth));
  26402. const setColumnWidth = (column) => {
  26403. if (realWidth.value)
  26404. column.width = realWidth.value;
  26405. if (realMinWidth.value) {
  26406. column.minWidth = realMinWidth.value;
  26407. }
  26408. if (!column.minWidth) {
  26409. column.minWidth = 80;
  26410. }
  26411. column.realWidth = Number(column.width === void 0 ? column.minWidth : column.width);
  26412. return column;
  26413. };
  26414. const setColumnForcedProps = (column) => {
  26415. const type4 = column.type;
  26416. const source = cellForced[type4] || {};
  26417. Object.keys(source).forEach((prop) => {
  26418. const value = source[prop];
  26419. if (prop !== "className" && value !== void 0) {
  26420. column[prop] = value;
  26421. }
  26422. });
  26423. const className = getDefaultClassName(type4);
  26424. if (className) {
  26425. const forceClass = `${unref(ns.namespace)}-${className}`;
  26426. column.className = column.className ? `${column.className} ${forceClass}` : forceClass;
  26427. }
  26428. return column;
  26429. };
  26430. const checkSubColumn = (children) => {
  26431. if (Array.isArray(children)) {
  26432. children.forEach((child) => check2(child));
  26433. } else {
  26434. check2(children);
  26435. }
  26436. function check2(item) {
  26437. var _a2;
  26438. if (((_a2 = item == null ? void 0 : item.type) == null ? void 0 : _a2.name) === "ElTableColumn") {
  26439. item.vParent = instance;
  26440. }
  26441. }
  26442. };
  26443. const setColumnRenders = (column) => {
  26444. if (props.renderHeader)
  26445. ;
  26446. else if (column.type !== "selection") {
  26447. column.renderHeader = (scope) => {
  26448. instance.columnConfig.value["label"];
  26449. const renderHeader = slots.header;
  26450. return renderHeader ? renderHeader(scope) : column.label;
  26451. };
  26452. }
  26453. let originRenderCell = column.renderCell;
  26454. const hasTreeColumnValue = hasTreeColumn.value;
  26455. if (column.type === "expand") {
  26456. column.renderCell = (data2) => h$1("div", {
  26457. class: "cell"
  26458. }, [originRenderCell(data2)]);
  26459. owner.value.renderExpanded = (data2) => {
  26460. return slots.default ? slots.default(data2) : slots.default;
  26461. };
  26462. } else {
  26463. originRenderCell = originRenderCell || defaultRenderCell;
  26464. column.renderCell = (data2) => {
  26465. let children = null;
  26466. if (slots.default) {
  26467. const vnodes = slots.default(data2);
  26468. children = vnodes.some((v2) => v2.type !== Comment) ? vnodes : originRenderCell(data2);
  26469. } else {
  26470. children = originRenderCell(data2);
  26471. }
  26472. const shouldCreatePlaceholder = hasTreeColumnValue && data2.cellIndex === 0;
  26473. const prefix = treeCellPrefix(data2, shouldCreatePlaceholder);
  26474. const props2 = {
  26475. class: "cell",
  26476. style: {}
  26477. };
  26478. if (column.showOverflowTooltip) {
  26479. props2.class = `${props2.class} ${unref(ns.namespace)}-tooltip`;
  26480. props2.style = {
  26481. width: `${(data2.column.realWidth || Number(data2.column.width)) - 1}px`
  26482. };
  26483. }
  26484. checkSubColumn(children);
  26485. return h$1("div", props2, [prefix, children]);
  26486. };
  26487. }
  26488. return column;
  26489. };
  26490. const getPropsData = (...propsKey) => {
  26491. return propsKey.reduce((prev, cur) => {
  26492. if (Array.isArray(cur)) {
  26493. cur.forEach((key) => {
  26494. prev[key] = props[key];
  26495. });
  26496. }
  26497. return prev;
  26498. }, {});
  26499. };
  26500. const getColumnElIndex = (children, child) => {
  26501. return Array.prototype.indexOf.call(children, child);
  26502. };
  26503. return {
  26504. columnId,
  26505. realAlign,
  26506. isSubColumn,
  26507. realHeaderAlign,
  26508. columnOrTableParent,
  26509. setColumnWidth,
  26510. setColumnForcedProps,
  26511. setColumnRenders,
  26512. getPropsData,
  26513. getColumnElIndex
  26514. };
  26515. }
  26516. var defaultProps = {
  26517. type: {
  26518. type: String,
  26519. default: "default"
  26520. },
  26521. label: String,
  26522. className: String,
  26523. labelClassName: String,
  26524. property: String,
  26525. prop: String,
  26526. width: {
  26527. type: [String, Number],
  26528. default: ""
  26529. },
  26530. minWidth: {
  26531. type: [String, Number],
  26532. default: ""
  26533. },
  26534. renderHeader: Function,
  26535. sortable: {
  26536. type: [Boolean, String],
  26537. default: false
  26538. },
  26539. sortMethod: Function,
  26540. sortBy: [String, Function, Array],
  26541. resizable: {
  26542. type: Boolean,
  26543. default: true
  26544. },
  26545. columnKey: String,
  26546. align: String,
  26547. headerAlign: String,
  26548. showTooltipWhenOverflow: Boolean,
  26549. showOverflowTooltip: Boolean,
  26550. fixed: [Boolean, String],
  26551. formatter: Function,
  26552. selectable: Function,
  26553. reserveSelection: Boolean,
  26554. filterMethod: Function,
  26555. filteredValue: Array,
  26556. filters: Array,
  26557. filterPlacement: String,
  26558. filterMultiple: {
  26559. type: Boolean,
  26560. default: true
  26561. },
  26562. index: [Number, Function],
  26563. sortOrders: {
  26564. type: Array,
  26565. default: () => {
  26566. return ["ascending", "descending", null];
  26567. },
  26568. validator: (val) => {
  26569. return val.every((order2) => ["ascending", "descending", null].includes(order2));
  26570. }
  26571. }
  26572. };
  26573. let columnIdSeed = 1;
  26574. var ElTableColumn$1 = defineComponent({
  26575. name: "ElTableColumn",
  26576. components: {
  26577. ElCheckbox
  26578. },
  26579. props: defaultProps,
  26580. setup(props, { slots }) {
  26581. const instance = getCurrentInstance();
  26582. const columnConfig = ref({});
  26583. const owner = computed(() => {
  26584. let parent2 = instance.parent;
  26585. while (parent2 && !parent2.tableId) {
  26586. parent2 = parent2.parent;
  26587. }
  26588. return parent2;
  26589. });
  26590. const { registerNormalWatchers, registerComplexWatchers } = useWatcher(owner, props);
  26591. const {
  26592. columnId,
  26593. isSubColumn,
  26594. realHeaderAlign,
  26595. columnOrTableParent,
  26596. setColumnWidth,
  26597. setColumnForcedProps,
  26598. setColumnRenders,
  26599. getPropsData,
  26600. getColumnElIndex,
  26601. realAlign
  26602. } = useRender(props, slots, owner);
  26603. const parent = columnOrTableParent.value;
  26604. columnId.value = `${parent.tableId || parent.columnId}_column_${columnIdSeed++}`;
  26605. onBeforeMount(() => {
  26606. isSubColumn.value = owner.value !== parent;
  26607. const type4 = props.type || "default";
  26608. const sortable = props.sortable === "" ? true : props.sortable;
  26609. const defaults = __spreadProps(__spreadValues({}, cellStarts[type4]), {
  26610. id: columnId.value,
  26611. type: type4,
  26612. property: props.prop || props.property,
  26613. align: realAlign,
  26614. headerAlign: realHeaderAlign,
  26615. showOverflowTooltip: props.showOverflowTooltip || props.showTooltipWhenOverflow,
  26616. filterable: props.filters || props.filterMethod,
  26617. filteredValue: [],
  26618. filterPlacement: "",
  26619. isColumnGroup: false,
  26620. isSubColumn: false,
  26621. filterOpened: false,
  26622. sortable,
  26623. index: props.index,
  26624. rawColumnKey: instance.vnode.key
  26625. });
  26626. const basicProps = [
  26627. "columnKey",
  26628. "label",
  26629. "className",
  26630. "labelClassName",
  26631. "type",
  26632. "renderHeader",
  26633. "formatter",
  26634. "fixed",
  26635. "resizable"
  26636. ];
  26637. const sortProps = ["sortMethod", "sortBy", "sortOrders"];
  26638. const selectProps = ["selectable", "reserveSelection"];
  26639. const filterProps = [
  26640. "filterMethod",
  26641. "filters",
  26642. "filterMultiple",
  26643. "filterOpened",
  26644. "filteredValue",
  26645. "filterPlacement"
  26646. ];
  26647. let column = getPropsData(basicProps, sortProps, selectProps, filterProps);
  26648. column = mergeOptions(defaults, column);
  26649. const chains = compose(setColumnRenders, setColumnWidth, setColumnForcedProps);
  26650. column = chains(column);
  26651. columnConfig.value = column;
  26652. registerNormalWatchers();
  26653. registerComplexWatchers();
  26654. });
  26655. onMounted(() => {
  26656. var _a2;
  26657. const parent2 = columnOrTableParent.value;
  26658. const children = isSubColumn.value ? parent2.vnode.el.children : (_a2 = parent2.refs.hiddenColumns) == null ? void 0 : _a2.children;
  26659. const getColumnIndex = () => getColumnElIndex(children || [], instance.vnode.el);
  26660. columnConfig.value.getColumnIndex = getColumnIndex;
  26661. const columnIndex = getColumnIndex();
  26662. columnIndex > -1 && owner.value.store.commit("insertColumn", columnConfig.value, isSubColumn.value ? parent2.columnConfig.value : null);
  26663. });
  26664. onBeforeUnmount(() => {
  26665. owner.value.store.commit("removeColumn", columnConfig.value, isSubColumn.value ? parent.columnConfig.value : null);
  26666. });
  26667. instance.columnId = columnId.value;
  26668. instance.columnConfig = columnConfig;
  26669. return;
  26670. },
  26671. render() {
  26672. var _a2, _b2, _c;
  26673. try {
  26674. const renderDefault = (_b2 = (_a2 = this.$slots).default) == null ? void 0 : _b2.call(_a2, {
  26675. row: {},
  26676. column: {},
  26677. $index: -1
  26678. });
  26679. const children = [];
  26680. if (Array.isArray(renderDefault)) {
  26681. for (const childNode of renderDefault) {
  26682. if (((_c = childNode.type) == null ? void 0 : _c.name) === "ElTableColumn" || childNode.shapeFlag & 2) {
  26683. children.push(childNode);
  26684. } else if (childNode.type === Fragment && Array.isArray(childNode.children)) {
  26685. childNode.children.forEach((vnode2) => {
  26686. if ((vnode2 == null ? void 0 : vnode2.patchFlag) !== 1024 && !isString(vnode2 == null ? void 0 : vnode2.children)) {
  26687. children.push(vnode2);
  26688. }
  26689. });
  26690. }
  26691. }
  26692. }
  26693. const vnode = h$1("div", children);
  26694. return vnode;
  26695. } catch (e) {
  26696. return h$1("div", []);
  26697. }
  26698. }
  26699. });
  26700. const ElTable = withInstall(Table, {
  26701. TableColumn: ElTableColumn$1
  26702. });
  26703. const ElTableColumn = withNoopInstall(ElTableColumn$1);
  26704. const SCOPE$1 = "ElUpload";
  26705. class UploadAjaxError extends Error {
  26706. constructor(message, status, method4, url2) {
  26707. super(message);
  26708. this.name = "UploadAjaxError";
  26709. this.status = status;
  26710. this.method = method4;
  26711. this.url = url2;
  26712. }
  26713. }
  26714. function getError(action, option, xhr) {
  26715. let msg;
  26716. if (xhr.response) {
  26717. msg = `${xhr.response.error || xhr.response}`;
  26718. } else if (xhr.responseText) {
  26719. msg = `${xhr.responseText}`;
  26720. } else {
  26721. msg = `fail to ${option.method} ${action} ${xhr.status}`;
  26722. }
  26723. return new UploadAjaxError(msg, xhr.status, option.method, action);
  26724. }
  26725. function getBody(xhr) {
  26726. const text = xhr.responseText || xhr.response;
  26727. if (!text) {
  26728. return text;
  26729. }
  26730. try {
  26731. return JSON.parse(text);
  26732. } catch (e) {
  26733. return text;
  26734. }
  26735. }
  26736. const ajaxUpload = (option) => {
  26737. if (typeof XMLHttpRequest === "undefined")
  26738. throwError(SCOPE$1, "XMLHttpRequest is undefined");
  26739. const xhr = new XMLHttpRequest();
  26740. const action = option.action;
  26741. if (xhr.upload) {
  26742. xhr.upload.addEventListener("progress", (evt) => {
  26743. const progressEvt = evt;
  26744. progressEvt.percent = evt.total > 0 ? evt.loaded / evt.total * 100 : 0;
  26745. option.onProgress(progressEvt);
  26746. });
  26747. }
  26748. const formData = new FormData();
  26749. if (option.data) {
  26750. for (const [key, value] of Object.entries(option.data)) {
  26751. if (Array.isArray(value))
  26752. formData.append(key, ...value);
  26753. else
  26754. formData.append(key, value);
  26755. }
  26756. }
  26757. formData.append(option.filename, option.file, option.file.name);
  26758. xhr.addEventListener("error", () => {
  26759. option.onError(getError(action, option, xhr));
  26760. });
  26761. xhr.addEventListener("load", () => {
  26762. if (xhr.status < 200 || xhr.status >= 300) {
  26763. return option.onError(getError(action, option, xhr));
  26764. }
  26765. option.onSuccess(getBody(xhr));
  26766. });
  26767. xhr.open(option.method, action, true);
  26768. if (option.withCredentials && "withCredentials" in xhr) {
  26769. xhr.withCredentials = true;
  26770. }
  26771. const headers = option.headers || {};
  26772. if (headers instanceof Headers) {
  26773. headers.forEach((value, key) => xhr.setRequestHeader(key, value));
  26774. } else {
  26775. for (const [key, value] of Object.entries(headers)) {
  26776. if (isNil(value))
  26777. continue;
  26778. xhr.setRequestHeader(key, String(value));
  26779. }
  26780. }
  26781. xhr.send(formData);
  26782. return xhr;
  26783. };
  26784. const uploadListTypes = ["text", "picture", "picture-card"];
  26785. let fileId = 1;
  26786. const genFileId = () => Date.now() + fileId++;
  26787. const uploadBaseProps = buildProps({
  26788. action: {
  26789. type: String,
  26790. required: true
  26791. },
  26792. headers: {
  26793. type: definePropType(Object)
  26794. },
  26795. method: {
  26796. type: String,
  26797. default: "post"
  26798. },
  26799. data: {
  26800. type: Object,
  26801. default: () => mutable({})
  26802. },
  26803. multiple: {
  26804. type: Boolean,
  26805. default: false
  26806. },
  26807. name: {
  26808. type: String,
  26809. default: "file"
  26810. },
  26811. drag: {
  26812. type: Boolean,
  26813. default: false
  26814. },
  26815. withCredentials: Boolean,
  26816. showFileList: {
  26817. type: Boolean,
  26818. default: true
  26819. },
  26820. accept: {
  26821. type: String,
  26822. default: ""
  26823. },
  26824. type: {
  26825. type: String,
  26826. default: "select"
  26827. },
  26828. fileList: {
  26829. type: definePropType(Array),
  26830. default: () => mutable([])
  26831. },
  26832. autoUpload: {
  26833. type: Boolean,
  26834. default: true
  26835. },
  26836. listType: {
  26837. type: String,
  26838. values: uploadListTypes,
  26839. default: "text"
  26840. },
  26841. httpRequest: {
  26842. type: definePropType(Function),
  26843. default: ajaxUpload
  26844. },
  26845. disabled: Boolean,
  26846. limit: Number
  26847. });
  26848. const uploadProps = buildProps(__spreadProps(__spreadValues({}, uploadBaseProps), {
  26849. beforeUpload: {
  26850. type: definePropType(Function),
  26851. default: NOOP
  26852. },
  26853. beforeRemove: {
  26854. type: definePropType(Function)
  26855. },
  26856. onRemove: {
  26857. type: definePropType(Function),
  26858. default: NOOP
  26859. },
  26860. onChange: {
  26861. type: definePropType(Function),
  26862. default: NOOP
  26863. },
  26864. onPreview: {
  26865. type: definePropType(Function),
  26866. default: NOOP
  26867. },
  26868. onSuccess: {
  26869. type: definePropType(Function),
  26870. default: NOOP
  26871. },
  26872. onProgress: {
  26873. type: definePropType(Function),
  26874. default: NOOP
  26875. },
  26876. onError: {
  26877. type: definePropType(Function),
  26878. default: NOOP
  26879. },
  26880. onExceed: {
  26881. type: definePropType(Function),
  26882. default: NOOP
  26883. }
  26884. }));
  26885. const uploadListProps = buildProps({
  26886. files: {
  26887. type: definePropType(Array),
  26888. default: () => mutable([])
  26889. },
  26890. disabled: {
  26891. type: Boolean,
  26892. default: false
  26893. },
  26894. handlePreview: {
  26895. type: definePropType(Function),
  26896. default: NOOP
  26897. },
  26898. listType: {
  26899. type: String,
  26900. values: uploadListTypes,
  26901. default: "text"
  26902. }
  26903. });
  26904. const uploadListEmits = {
  26905. remove: (file) => !!file
  26906. };
  26907. const _hoisted_1$a = ["onKeydown"];
  26908. const _hoisted_2$8 = ["src"];
  26909. const _hoisted_3$6 = ["onClick"];
  26910. const _hoisted_4$6 = ["onClick"];
  26911. const _hoisted_5$6 = ["onClick"];
  26912. const __default__$4 = {
  26913. name: "ElUploadList"
  26914. };
  26915. const _sfc_main$d = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$4), {
  26916. props: uploadListProps,
  26917. emits: uploadListEmits,
  26918. setup(__props, { emit }) {
  26919. const props = __props;
  26920. const { t } = useLocale();
  26921. const nsUpload = useNamespace("upload");
  26922. const nsIcon = useNamespace("icon");
  26923. const nsList = useNamespace("list");
  26924. const focusing = ref(false);
  26925. const handleClick = (file) => {
  26926. props.handlePreview(file);
  26927. };
  26928. const onFileClicked = (e) => {
  26929. e.target.focus();
  26930. };
  26931. const handleRemove = (file) => {
  26932. emit("remove", file);
  26933. };
  26934. return (_ctx, _cache) => {
  26935. return openBlock(), createBlock(TransitionGroup, {
  26936. tag: "ul",
  26937. class: normalizeClass([
  26938. unref(nsUpload).b("list"),
  26939. unref(nsUpload).bm("list", _ctx.listType),
  26940. unref(nsUpload).is("disabled", _ctx.disabled)
  26941. ]),
  26942. name: unref(nsList).b()
  26943. }, {
  26944. default: withCtx(() => [
  26945. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.files, (file) => {
  26946. return openBlock(), createElementBlock("li", {
  26947. key: file.uid || file.name,
  26948. class: normalizeClass([
  26949. unref(nsUpload).be("list", "item"),
  26950. unref(nsUpload).is(file.status),
  26951. { focusing: focusing.value }
  26952. ]),
  26953. tabindex: "0",
  26954. onKeydown: withKeys(($event) => !_ctx.disabled && handleRemove(file), ["delete"]),
  26955. onFocus: _cache[0] || (_cache[0] = ($event) => focusing.value = true),
  26956. onBlur: _cache[1] || (_cache[1] = ($event) => focusing.value = false),
  26957. onClick: onFileClicked
  26958. }, [
  26959. renderSlot(_ctx.$slots, "default", { file }, () => [
  26960. _ctx.listType === "picture" || file.status !== "uploading" && _ctx.listType === "picture-card" ? (openBlock(), createElementBlock("img", {
  26961. key: 0,
  26962. class: normalizeClass(unref(nsUpload).be("list", "item-thumbnail")),
  26963. src: file.url,
  26964. alt: ""
  26965. }, null, 10, _hoisted_2$8)) : createCommentVNode("v-if", true),
  26966. _ctx.listType !== "picture" && (file.status === "uploading" || _ctx.listType !== "picture-card") ? (openBlock(), createElementBlock("div", {
  26967. key: 1,
  26968. class: normalizeClass(unref(nsUpload).be("list", "item-info"))
  26969. }, [
  26970. createElementVNode("a", {
  26971. class: normalizeClass(unref(nsUpload).be("list", "item-name")),
  26972. onClick: ($event) => handleClick(file)
  26973. }, [
  26974. createVNode(unref(ElIcon), {
  26975. class: normalizeClass(unref(nsIcon).m("document"))
  26976. }, {
  26977. default: withCtx(() => [
  26978. createVNode(unref(document$1))
  26979. ]),
  26980. _: 1
  26981. }, 8, ["class"]),
  26982. createTextVNode(" " + toDisplayString(file.name), 1)
  26983. ], 10, _hoisted_3$6),
  26984. file.status === "uploading" ? (openBlock(), createBlock(unref(ElProgress), {
  26985. key: 0,
  26986. type: _ctx.listType === "picture-card" ? "circle" : "line",
  26987. "stroke-width": _ctx.listType === "picture-card" ? 6 : 2,
  26988. percentage: Number(file.percentage),
  26989. style: normalizeStyle(_ctx.listType === "picture-card" ? "" : "margin-top: 0.5rem")
  26990. }, null, 8, ["type", "stroke-width", "percentage", "style"])) : createCommentVNode("v-if", true)
  26991. ], 2)) : createCommentVNode("v-if", true),
  26992. createElementVNode("label", {
  26993. class: normalizeClass(unref(nsUpload).be("list", "item-status-label"))
  26994. }, [
  26995. _ctx.listType === "text" ? (openBlock(), createBlock(unref(ElIcon), {
  26996. key: 0,
  26997. class: normalizeClass([unref(nsIcon).m("upload-success"), unref(nsIcon).m("circle-check")])
  26998. }, {
  26999. default: withCtx(() => [
  27000. createVNode(unref(circleCheck))
  27001. ]),
  27002. _: 1
  27003. }, 8, ["class"])) : ["picture-card", "picture"].includes(_ctx.listType) ? (openBlock(), createBlock(unref(ElIcon), {
  27004. key: 1,
  27005. class: normalizeClass([unref(nsIcon).m("upload-success"), unref(nsIcon).m("check")])
  27006. }, {
  27007. default: withCtx(() => [
  27008. createVNode(unref(check))
  27009. ]),
  27010. _: 1
  27011. }, 8, ["class"])) : createCommentVNode("v-if", true)
  27012. ], 2),
  27013. !_ctx.disabled ? (openBlock(), createBlock(unref(ElIcon), {
  27014. key: 2,
  27015. class: normalizeClass(unref(nsIcon).m("close")),
  27016. onClick: ($event) => handleRemove(file)
  27017. }, {
  27018. default: withCtx(() => [
  27019. createVNode(unref(close))
  27020. ]),
  27021. _: 2
  27022. }, 1032, ["class", "onClick"])) : createCommentVNode("v-if", true),
  27023. createCommentVNode(" Due to close btn only appears when li gets focused disappears after li gets blurred, thus keyboard navigation can never reach close btn"),
  27024. createCommentVNode(" This is a bug which needs to be fixed "),
  27025. createCommentVNode(" TODO: Fix the incorrect navigation interaction "),
  27026. !_ctx.disabled ? (openBlock(), createElementBlock("i", {
  27027. key: 3,
  27028. class: normalizeClass(unref(nsIcon).m("close-tip"))
  27029. }, toDisplayString(unref(t)("el.upload.deleteTip")), 3)) : createCommentVNode("v-if", true),
  27030. _ctx.listType === "picture-card" ? (openBlock(), createElementBlock("span", {
  27031. key: 4,
  27032. class: normalizeClass(unref(nsUpload).be("list", "item-actions"))
  27033. }, [
  27034. createElementVNode("span", {
  27035. class: normalizeClass(unref(nsUpload).be("list", "item-preview")),
  27036. onClick: ($event) => _ctx.handlePreview(file)
  27037. }, [
  27038. createVNode(unref(ElIcon), {
  27039. class: normalizeClass(unref(nsIcon).m("zoom-in"))
  27040. }, {
  27041. default: withCtx(() => [
  27042. createVNode(unref(zoomIn))
  27043. ]),
  27044. _: 1
  27045. }, 8, ["class"])
  27046. ], 10, _hoisted_4$6),
  27047. !_ctx.disabled ? (openBlock(), createElementBlock("span", {
  27048. key: 0,
  27049. class: normalizeClass(unref(nsUpload).be("list", "item-delete")),
  27050. onClick: ($event) => handleRemove(file)
  27051. }, [
  27052. createVNode(unref(ElIcon), {
  27053. class: normalizeClass(unref(nsIcon).m("delete"))
  27054. }, {
  27055. default: withCtx(() => [
  27056. createVNode(unref(_delete))
  27057. ]),
  27058. _: 1
  27059. }, 8, ["class"])
  27060. ], 10, _hoisted_5$6)) : createCommentVNode("v-if", true)
  27061. ], 2)) : createCommentVNode("v-if", true)
  27062. ])
  27063. ], 42, _hoisted_1$a);
  27064. }), 128)),
  27065. renderSlot(_ctx.$slots, "append")
  27066. ]),
  27067. _: 3
  27068. }, 8, ["class", "name"]);
  27069. };
  27070. }
  27071. }));
  27072. var UploadList = /* @__PURE__ */ _export_sfc$1(_sfc_main$d, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload-list.vue"]]);
  27073. const uploadDraggerProps = buildProps({
  27074. disabled: {
  27075. type: Boolean,
  27076. default: false
  27077. }
  27078. });
  27079. const uploadDraggerEmits = {
  27080. file: (file) => isArray(file)
  27081. };
  27082. const _hoisted_1$9 = ["onDrop", "onDragover"];
  27083. const __default__$3 = {
  27084. name: "ElUploadDrag"
  27085. };
  27086. const _sfc_main$c = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$3), {
  27087. props: uploadDraggerProps,
  27088. emits: uploadDraggerEmits,
  27089. setup(__props, { emit }) {
  27090. const props = __props;
  27091. const COMPONENT_NAME2 = "ElUploadDrag";
  27092. const uploaderContext = inject(uploadContextKey);
  27093. if (!uploaderContext) {
  27094. throwError(COMPONENT_NAME2, "usage: <el-upload><el-upload-dragger /></el-upload>");
  27095. }
  27096. const ns = useNamespace("upload");
  27097. const dragover = ref(false);
  27098. const onDrop = (e) => {
  27099. if (props.disabled)
  27100. return;
  27101. dragover.value = false;
  27102. const files = Array.from(e.dataTransfer.files);
  27103. const accept = uploaderContext.accept.value;
  27104. if (!accept) {
  27105. emit("file", files);
  27106. return;
  27107. }
  27108. const filesFiltered = files.filter((file) => {
  27109. const { type: type4, name } = file;
  27110. const extension = name.includes(".") ? `.${name.split(".").pop()}` : "";
  27111. const baseType = type4.replace(/\/.*$/, "");
  27112. return accept.split(",").map((type22) => type22.trim()).filter((type22) => type22).some((acceptedType) => {
  27113. if (acceptedType.startsWith(".")) {
  27114. return extension === acceptedType;
  27115. }
  27116. if (/\/\*$/.test(acceptedType)) {
  27117. return baseType === acceptedType.replace(/\/\*$/, "");
  27118. }
  27119. if (/^[^/]+\/[^/]+$/.test(acceptedType)) {
  27120. return type4 === acceptedType;
  27121. }
  27122. return false;
  27123. });
  27124. });
  27125. emit("file", filesFiltered);
  27126. };
  27127. const onDragover = () => {
  27128. if (!props.disabled)
  27129. dragover.value = true;
  27130. };
  27131. return (_ctx, _cache) => {
  27132. return openBlock(), createElementBlock("div", {
  27133. class: normalizeClass([unref(ns).b("dragger"), unref(ns).is("dragover", dragover.value)]),
  27134. onDrop: withModifiers(onDrop, ["prevent"]),
  27135. onDragover: withModifiers(onDragover, ["prevent"]),
  27136. onDragleave: _cache[0] || (_cache[0] = withModifiers(($event) => dragover.value = false, ["prevent"]))
  27137. }, [
  27138. renderSlot(_ctx.$slots, "default")
  27139. ], 42, _hoisted_1$9);
  27140. };
  27141. }
  27142. }));
  27143. var UploadDragger = /* @__PURE__ */ _export_sfc$1(_sfc_main$c, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload-dragger.vue"]]);
  27144. const uploadContentProps = buildProps(__spreadProps(__spreadValues({}, uploadBaseProps), {
  27145. fileList: {
  27146. type: definePropType(Array),
  27147. default: () => mutable([])
  27148. },
  27149. beforeUpload: {
  27150. type: definePropType(Function),
  27151. default: NOOP
  27152. },
  27153. onRemove: {
  27154. type: definePropType(Function),
  27155. default: NOOP
  27156. },
  27157. onStart: {
  27158. type: definePropType(Function),
  27159. default: NOOP
  27160. },
  27161. onSuccess: {
  27162. type: definePropType(Function),
  27163. default: NOOP
  27164. },
  27165. onProgress: {
  27166. type: definePropType(Function),
  27167. default: NOOP
  27168. },
  27169. onError: {
  27170. type: definePropType(Function),
  27171. default: NOOP
  27172. },
  27173. onExceed: {
  27174. type: definePropType(Function),
  27175. default: NOOP
  27176. }
  27177. }));
  27178. const _hoisted_1$8 = ["onKeydown"];
  27179. const _hoisted_2$7 = ["name", "multiple", "accept"];
  27180. const __default__$2 = {
  27181. name: "ElUploadContent",
  27182. inheritAttrs: false
  27183. };
  27184. const _sfc_main$b = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$2), {
  27185. props: uploadContentProps,
  27186. setup(__props, { expose }) {
  27187. const props = __props;
  27188. const ns = useNamespace("upload");
  27189. const requests = shallowRef({});
  27190. const inputRef = shallowRef();
  27191. const uploadFiles = (files) => {
  27192. if (files.length === 0)
  27193. return;
  27194. const { autoUpload, limit, fileList, multiple, onStart, onExceed } = props;
  27195. if (limit && fileList.length + files.length > limit) {
  27196. onExceed(files, fileList);
  27197. return;
  27198. }
  27199. if (!multiple) {
  27200. files = files.slice(0, 1);
  27201. }
  27202. for (const file of files) {
  27203. const rawFile = file;
  27204. rawFile.uid = genFileId();
  27205. onStart(rawFile);
  27206. if (autoUpload)
  27207. upload(rawFile);
  27208. }
  27209. };
  27210. const upload = async (rawFile) => {
  27211. inputRef.value.value = "";
  27212. if (!props.beforeUpload) {
  27213. return doUpload(rawFile);
  27214. }
  27215. let hookResult;
  27216. try {
  27217. hookResult = await props.beforeUpload(rawFile);
  27218. } catch (e) {
  27219. hookResult = false;
  27220. }
  27221. if (hookResult === false) {
  27222. props.onRemove(rawFile);
  27223. return;
  27224. }
  27225. let file = rawFile;
  27226. if (hookResult instanceof Blob) {
  27227. if (hookResult instanceof File) {
  27228. file = hookResult;
  27229. } else {
  27230. file = new File([hookResult], rawFile.name, {
  27231. type: rawFile.type
  27232. });
  27233. }
  27234. for (const key of Object.keys(rawFile)) {
  27235. file[key] = rawFile[key];
  27236. }
  27237. }
  27238. doUpload(rawFile);
  27239. };
  27240. const doUpload = (rawFile) => {
  27241. const {
  27242. headers,
  27243. data: data2,
  27244. method: method4,
  27245. withCredentials,
  27246. name: filename,
  27247. action,
  27248. onProgress,
  27249. onSuccess,
  27250. onError,
  27251. httpRequest
  27252. } = props;
  27253. const { uid: uid2 } = rawFile;
  27254. const options = {
  27255. headers: headers || {},
  27256. withCredentials,
  27257. file: rawFile,
  27258. data: data2,
  27259. method: method4,
  27260. filename,
  27261. action,
  27262. onProgress: (evt) => {
  27263. onProgress(evt, rawFile);
  27264. },
  27265. onSuccess: (res) => {
  27266. onSuccess(res, rawFile);
  27267. delete requests.value[uid2];
  27268. },
  27269. onError: (err) => {
  27270. onError(err, rawFile);
  27271. delete requests.value[uid2];
  27272. }
  27273. };
  27274. const request = httpRequest(options);
  27275. requests.value[uid2] = request;
  27276. if (request instanceof Promise) {
  27277. request.then(options.onSuccess, options.onError);
  27278. }
  27279. };
  27280. const handleChange2 = (e) => {
  27281. const files = e.target.files;
  27282. if (!files)
  27283. return;
  27284. uploadFiles(Array.from(files));
  27285. };
  27286. const handleClick = () => {
  27287. if (!props.disabled) {
  27288. inputRef.value.value = "";
  27289. inputRef.value.click();
  27290. }
  27291. };
  27292. const handleKeydown = () => {
  27293. handleClick();
  27294. };
  27295. const abort = (file) => {
  27296. const _reqs = entriesOf(requests.value).filter(file ? ([uid2]) => String(file.uid) === uid2 : () => true);
  27297. _reqs.forEach(([uid2, req]) => {
  27298. if (req instanceof XMLHttpRequest)
  27299. req.abort();
  27300. delete requests.value[uid2];
  27301. });
  27302. };
  27303. expose({
  27304. abort,
  27305. upload
  27306. });
  27307. return (_ctx, _cache) => {
  27308. return openBlock(), createElementBlock("div", {
  27309. class: normalizeClass([unref(ns).b(), unref(ns).m(_ctx.listType)]),
  27310. tabindex: "0",
  27311. onClick: handleClick,
  27312. onKeydown: withKeys(withModifiers(handleKeydown, ["self"]), ["enter", "space"])
  27313. }, [
  27314. _ctx.drag ? (openBlock(), createBlock(UploadDragger, {
  27315. key: 0,
  27316. disabled: _ctx.disabled,
  27317. onFile: uploadFiles
  27318. }, {
  27319. default: withCtx(() => [
  27320. renderSlot(_ctx.$slots, "default")
  27321. ]),
  27322. _: 3
  27323. }, 8, ["disabled"])) : renderSlot(_ctx.$slots, "default", { key: 1 }),
  27324. createElementVNode("input", {
  27325. ref_key: "inputRef",
  27326. ref: inputRef,
  27327. class: normalizeClass(unref(ns).e("input")),
  27328. name: _ctx.name,
  27329. multiple: _ctx.multiple,
  27330. accept: _ctx.accept,
  27331. type: "file",
  27332. onChange: handleChange2
  27333. }, null, 42, _hoisted_2$7)
  27334. ], 42, _hoisted_1$8);
  27335. };
  27336. }
  27337. }));
  27338. var UploadContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$b, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload-content.vue"]]);
  27339. const SCOPE = "ElUpload";
  27340. const revokeObjectURL = (file) => {
  27341. var _a2;
  27342. if ((_a2 = file.url) == null ? void 0 : _a2.startsWith("blob:")) {
  27343. URL.revokeObjectURL(file.url);
  27344. }
  27345. };
  27346. const useHandlers = (props, uploadRef) => {
  27347. const uploadFiles = ref([]);
  27348. const getFile = (rawFile) => uploadFiles.value.find((file) => file.uid === rawFile.uid);
  27349. function abort(file) {
  27350. var _a2;
  27351. (_a2 = uploadRef.value) == null ? void 0 : _a2.abort(file);
  27352. }
  27353. function clearFiles(states = ["ready", "uploading", "success", "fail"]) {
  27354. uploadFiles.value = uploadFiles.value.filter((row) => !states.includes(row.status));
  27355. }
  27356. const handleError = (err, rawFile) => {
  27357. const file = getFile(rawFile);
  27358. if (!file)
  27359. return;
  27360. file.status = "fail";
  27361. uploadFiles.value.splice(uploadFiles.value.indexOf(file), 1);
  27362. props.onError(err, file, uploadFiles.value);
  27363. props.onChange(file, uploadFiles.value);
  27364. };
  27365. const handleProgress = (evt, rawFile) => {
  27366. const file = getFile(rawFile);
  27367. if (!file)
  27368. return;
  27369. props.onProgress(evt, file, uploadFiles.value);
  27370. file.status = "uploading";
  27371. file.percentage = Math.round(evt.percent);
  27372. };
  27373. const handleSuccess = (response, rawFile) => {
  27374. const file = getFile(rawFile);
  27375. if (!file)
  27376. return;
  27377. file.status = "success";
  27378. file.response = response;
  27379. props.onSuccess(response, file, uploadFiles.value);
  27380. props.onChange(file, uploadFiles.value);
  27381. };
  27382. const handleStart = (file) => {
  27383. const uploadFile = {
  27384. name: file.name,
  27385. percentage: 0,
  27386. status: "ready",
  27387. size: file.size,
  27388. raw: file,
  27389. uid: file.uid
  27390. };
  27391. if (props.listType === "picture-card" || props.listType === "picture") {
  27392. try {
  27393. uploadFile.url = URL.createObjectURL(file);
  27394. } catch (err) {
  27395. debugWarn(SCOPE, err.message);
  27396. props.onError(err, uploadFile, uploadFiles.value);
  27397. }
  27398. }
  27399. uploadFiles.value.push(uploadFile);
  27400. props.onChange(uploadFile, uploadFiles.value);
  27401. };
  27402. const handleRemove = async (file, rawFile) => {
  27403. if (rawFile) {
  27404. useDeprecated({
  27405. scope: SCOPE,
  27406. from: "handleRemove second argument",
  27407. version: "2.2",
  27408. replacement: "first argument `file`",
  27409. ref: "https://element-plus.org/en-US/component/upload.html#methods"
  27410. }, true);
  27411. }
  27412. const _file = rawFile || file;
  27413. const uploadFile = _file instanceof File ? getFile(_file) : _file;
  27414. if (!uploadFile)
  27415. throwError(SCOPE, "file to be removed not found");
  27416. const doRemove = (file2) => {
  27417. abort(file2);
  27418. const fileList = uploadFiles.value;
  27419. fileList.splice(fileList.indexOf(file2), 1);
  27420. props.onRemove(file2, fileList);
  27421. revokeObjectURL(file2);
  27422. };
  27423. if (props.beforeRemove) {
  27424. const before = await props.beforeRemove(uploadFile, uploadFiles.value);
  27425. if (before !== false)
  27426. doRemove(uploadFile);
  27427. } else {
  27428. doRemove(uploadFile);
  27429. }
  27430. };
  27431. function submit() {
  27432. uploadFiles.value.filter(({ status }) => status === "ready").forEach(({ raw }) => {
  27433. var _a2;
  27434. return raw && ((_a2 = uploadRef.value) == null ? void 0 : _a2.upload(raw));
  27435. });
  27436. }
  27437. watch(() => props.listType, (val) => {
  27438. if (val !== "picture-card" && val !== "picture") {
  27439. return;
  27440. }
  27441. uploadFiles.value = uploadFiles.value.map((file) => {
  27442. const { raw, url: url2 } = file;
  27443. if (!url2 && raw) {
  27444. try {
  27445. file.url = URL.createObjectURL(raw);
  27446. } catch (err) {
  27447. props.onError(err, file, uploadFiles.value);
  27448. }
  27449. }
  27450. return file;
  27451. });
  27452. });
  27453. watch(() => props.fileList, (fileList) => {
  27454. for (const file of fileList) {
  27455. file.uid || (file.uid = genFileId());
  27456. file.status || (file.status = "success");
  27457. }
  27458. uploadFiles.value = fileList;
  27459. }, { immediate: true, deep: true });
  27460. return {
  27461. abort,
  27462. clearFiles,
  27463. handleError,
  27464. handleProgress,
  27465. handleStart,
  27466. handleSuccess,
  27467. handleRemove,
  27468. submit,
  27469. uploadFiles
  27470. };
  27471. };
  27472. const __default__$1 = {
  27473. name: "ElUpload"
  27474. };
  27475. const _sfc_main$a = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$1), {
  27476. props: uploadProps,
  27477. setup(__props, { expose }) {
  27478. const props = __props;
  27479. const slots = useSlots();
  27480. const disabled = useDisabled$1();
  27481. const uploadRef = shallowRef();
  27482. const {
  27483. abort,
  27484. submit,
  27485. clearFiles,
  27486. uploadFiles,
  27487. handleStart,
  27488. handleError,
  27489. handleRemove,
  27490. handleSuccess,
  27491. handleProgress
  27492. } = useHandlers(props, uploadRef);
  27493. const isPictureCard = computed(() => props.listType === "picture-card");
  27494. const uploadContentProps2 = computed(() => __spreadProps(__spreadValues({}, props), {
  27495. onStart: handleStart,
  27496. onProgress: handleProgress,
  27497. onSuccess: handleSuccess,
  27498. onError: handleError,
  27499. onRemove: handleRemove
  27500. }));
  27501. onBeforeUnmount(() => {
  27502. uploadFiles.value.forEach(({ url: url2 }) => {
  27503. if (url2 == null ? void 0 : url2.startsWith("blob:"))
  27504. URL.revokeObjectURL(url2);
  27505. });
  27506. });
  27507. provide(uploadContextKey, {
  27508. accept: toRef(props, "accept")
  27509. });
  27510. expose({
  27511. abort,
  27512. submit,
  27513. clearFiles,
  27514. handleStart,
  27515. handleRemove
  27516. });
  27517. return (_ctx, _cache) => {
  27518. return openBlock(), createElementBlock("div", null, [
  27519. unref(isPictureCard) && _ctx.showFileList ? (openBlock(), createBlock(UploadList, {
  27520. key: 0,
  27521. disabled: unref(disabled),
  27522. "list-type": _ctx.listType,
  27523. files: unref(uploadFiles),
  27524. "handle-preview": _ctx.onPreview,
  27525. onRemove: unref(handleRemove)
  27526. }, createSlots({
  27527. append: withCtx(() => [
  27528. _ctx.listType === "picture-card" ? (openBlock(), createBlock(UploadContent, mergeProps({
  27529. key: 0,
  27530. ref_key: "uploadRef",
  27531. ref: uploadRef
  27532. }, unref(uploadContentProps2)), {
  27533. default: withCtx(() => [
  27534. unref(slots).trigger ? renderSlot(_ctx.$slots, "trigger", { key: 0 }) : createCommentVNode("v-if", true),
  27535. !unref(slots).trigger && unref(slots).default ? renderSlot(_ctx.$slots, "default", { key: 1 }) : createCommentVNode("v-if", true)
  27536. ]),
  27537. _: 3
  27538. }, 16)) : createCommentVNode("v-if", true)
  27539. ]),
  27540. _: 2
  27541. }, [
  27542. _ctx.$slots.file ? {
  27543. name: "default",
  27544. fn: withCtx(({ file }) => [
  27545. renderSlot(_ctx.$slots, "file", { file })
  27546. ])
  27547. } : void 0
  27548. ]), 1032, ["disabled", "list-type", "files", "handle-preview", "onRemove"])) : createCommentVNode("v-if", true),
  27549. _ctx.listType !== "picture-card" ? (openBlock(), createBlock(UploadContent, mergeProps({
  27550. key: 1,
  27551. ref_key: "uploadRef",
  27552. ref: uploadRef
  27553. }, unref(uploadContentProps2)), {
  27554. default: withCtx(() => [
  27555. unref(slots).trigger ? renderSlot(_ctx.$slots, "trigger", { key: 0 }) : createCommentVNode("v-if", true),
  27556. !unref(slots).trigger && unref(slots).default ? renderSlot(_ctx.$slots, "default", { key: 1 }) : createCommentVNode("v-if", true)
  27557. ]),
  27558. _: 3
  27559. }, 16)) : createCommentVNode("v-if", true),
  27560. _ctx.$slots.trigger ? renderSlot(_ctx.$slots, "default", { key: 2 }) : createCommentVNode("v-if", true),
  27561. renderSlot(_ctx.$slots, "tip"),
  27562. !unref(isPictureCard) && _ctx.showFileList ? (openBlock(), createBlock(UploadList, {
  27563. key: 3,
  27564. disabled: unref(disabled),
  27565. "list-type": _ctx.listType,
  27566. files: unref(uploadFiles),
  27567. "handle-preview": _ctx.onPreview,
  27568. onRemove: unref(handleRemove)
  27569. }, createSlots({ _: 2 }, [
  27570. _ctx.$slots.file ? {
  27571. name: "default",
  27572. fn: withCtx(({ file }) => [
  27573. renderSlot(_ctx.$slots, "file", { file })
  27574. ])
  27575. } : void 0
  27576. ]), 1032, ["disabled", "list-type", "files", "handle-preview", "onRemove"])) : createCommentVNode("v-if", true)
  27577. ]);
  27578. };
  27579. }
  27580. }));
  27581. var Upload = /* @__PURE__ */ _export_sfc$1(_sfc_main$a, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload.vue"]]);
  27582. const ElUpload = withInstall(Upload);
  27583. var base = "";
  27584. var elDialog = "";
  27585. var elOverlay = "";
  27586. var elButton = "";
  27587. var elForm = "";
  27588. var elFormItem = "";
  27589. var elCascader = "";
  27590. var elInput = "";
  27591. var elPopper = "";
  27592. var elTag = "";
  27593. var elCascaderPanel = "";
  27594. var elCheckbox = "";
  27595. var elRadio = "";
  27596. var elScrollbar = "";
  27597. var elUpload = "";
  27598. var elProgress = "";
  27599. var elImage = "";
  27600. var elImageViewer = "";
  27601. var elSlider = "";
  27602. var elInputNumber = "";
  27603. var elTooltip = "";
  27604. var elSwitch = "";
  27605. var elOption = "";
  27606. var elOptionGroup = "";
  27607. var elSelect = "";
  27608. var elRate = "";
  27609. var elDatePicker = "";
  27610. var elConfigProvider = "";
  27611. var elTimePicker = "";
  27612. var elCheckboxGroup = "";
  27613. var elRadioGroup = "";
  27614. var elDivider = "";
  27615. var elTable = "";
  27616. var elTableColumn = "";
  27617. var zhCn = {
  27618. name: "zh-cn",
  27619. el: {
  27620. colorpicker: {
  27621. confirm: "\u786E\u5B9A",
  27622. clear: "\u6E05\u7A7A"
  27623. },
  27624. datepicker: {
  27625. now: "\u6B64\u523B",
  27626. today: "\u4ECA\u5929",
  27627. cancel: "\u53D6\u6D88",
  27628. clear: "\u6E05\u7A7A",
  27629. confirm: "\u786E\u5B9A",
  27630. selectDate: "\u9009\u62E9\u65E5\u671F",
  27631. selectTime: "\u9009\u62E9\u65F6\u95F4",
  27632. startDate: "\u5F00\u59CB\u65E5\u671F",
  27633. startTime: "\u5F00\u59CB\u65F6\u95F4",
  27634. endDate: "\u7ED3\u675F\u65E5\u671F",
  27635. endTime: "\u7ED3\u675F\u65F6\u95F4",
  27636. prevYear: "\u524D\u4E00\u5E74",
  27637. nextYear: "\u540E\u4E00\u5E74",
  27638. prevMonth: "\u4E0A\u4E2A\u6708",
  27639. nextMonth: "\u4E0B\u4E2A\u6708",
  27640. year: "\u5E74",
  27641. month1: "1 \u6708",
  27642. month2: "2 \u6708",
  27643. month3: "3 \u6708",
  27644. month4: "4 \u6708",
  27645. month5: "5 \u6708",
  27646. month6: "6 \u6708",
  27647. month7: "7 \u6708",
  27648. month8: "8 \u6708",
  27649. month9: "9 \u6708",
  27650. month10: "10 \u6708",
  27651. month11: "11 \u6708",
  27652. month12: "12 \u6708",
  27653. weeks: {
  27654. sun: "\u65E5",
  27655. mon: "\u4E00",
  27656. tue: "\u4E8C",
  27657. wed: "\u4E09",
  27658. thu: "\u56DB",
  27659. fri: "\u4E94",
  27660. sat: "\u516D"
  27661. },
  27662. months: {
  27663. jan: "\u4E00\u6708",
  27664. feb: "\u4E8C\u6708",
  27665. mar: "\u4E09\u6708",
  27666. apr: "\u56DB\u6708",
  27667. may: "\u4E94\u6708",
  27668. jun: "\u516D\u6708",
  27669. jul: "\u4E03\u6708",
  27670. aug: "\u516B\u6708",
  27671. sep: "\u4E5D\u6708",
  27672. oct: "\u5341\u6708",
  27673. nov: "\u5341\u4E00\u6708",
  27674. dec: "\u5341\u4E8C\u6708"
  27675. }
  27676. },
  27677. select: {
  27678. loading: "\u52A0\u8F7D\u4E2D",
  27679. noMatch: "\u65E0\u5339\u914D\u6570\u636E",
  27680. noData: "\u65E0\u6570\u636E",
  27681. placeholder: "\u8BF7\u9009\u62E9"
  27682. },
  27683. cascader: {
  27684. noMatch: "\u65E0\u5339\u914D\u6570\u636E",
  27685. loading: "\u52A0\u8F7D\u4E2D",
  27686. placeholder: "\u8BF7\u9009\u62E9",
  27687. noData: "\u6682\u65E0\u6570\u636E"
  27688. },
  27689. pagination: {
  27690. goto: "\u524D\u5F80",
  27691. pagesize: "\u6761/\u9875",
  27692. total: "\u5171 {total} \u6761",
  27693. pageClassifier: "\u9875",
  27694. deprecationWarning: "\u4F60\u4F7F\u7528\u4E86\u4E00\u4E9B\u5DF2\u88AB\u5E9F\u5F03\u7684\u7528\u6CD5\uFF0C\u8BF7\u53C2\u8003 el-pagination \u7684\u5B98\u65B9\u6587\u6863"
  27695. },
  27696. messagebox: {
  27697. title: "\u63D0\u793A",
  27698. confirm: "\u786E\u5B9A",
  27699. cancel: "\u53D6\u6D88",
  27700. error: "\u8F93\u5165\u7684\u6570\u636E\u4E0D\u5408\u6CD5!"
  27701. },
  27702. upload: {
  27703. deleteTip: "\u6309 delete \u952E\u53EF\u5220\u9664",
  27704. delete: "\u5220\u9664",
  27705. preview: "\u67E5\u770B\u56FE\u7247",
  27706. continue: "\u7EE7\u7EED\u4E0A\u4F20"
  27707. },
  27708. table: {
  27709. emptyText: "\u6682\u65E0\u6570\u636E",
  27710. confirmFilter: "\u7B5B\u9009",
  27711. resetFilter: "\u91CD\u7F6E",
  27712. clearFilter: "\u5168\u90E8",
  27713. sumText: "\u5408\u8BA1"
  27714. },
  27715. tree: {
  27716. emptyText: "\u6682\u65E0\u6570\u636E"
  27717. },
  27718. transfer: {
  27719. noMatch: "\u65E0\u5339\u914D\u6570\u636E",
  27720. noData: "\u65E0\u6570\u636E",
  27721. titles: ["\u5217\u8868 1", "\u5217\u8868 2"],
  27722. filterPlaceholder: "\u8BF7\u8F93\u5165\u641C\u7D22\u5185\u5BB9",
  27723. noCheckedFormat: "\u5171 {total} \u9879",
  27724. hasCheckedFormat: "\u5DF2\u9009 {checked}/{total} \u9879"
  27725. },
  27726. image: {
  27727. error: "\u52A0\u8F7D\u5931\u8D25"
  27728. },
  27729. pageHeader: {
  27730. title: "\u8FD4\u56DE"
  27731. },
  27732. popconfirm: {
  27733. confirmButtonText: "\u786E\u5B9A",
  27734. cancelButtonText: "\u53D6\u6D88"
  27735. }
  27736. }
  27737. };
  27738. var personnelSearch_vue_vue_type_style_index_0_lang = "";
  27739. const _hoisted_1$7 = { class: "selectV2SingleChoiceReset" };
  27740. const _hoisted_2$6 = {
  27741. key: 0,
  27742. style: { "color": "#A8ABB2" }
  27743. };
  27744. const _hoisted_3$5 = {
  27745. key: 1,
  27746. style: { "color": "#606266" }
  27747. };
  27748. const _hoisted_4$5 = { class: "selectV2SingleChoiceTwoReset" };
  27749. const _hoisted_5$5 = {
  27750. key: 0,
  27751. style: { "color": "#A8ABB2" }
  27752. };
  27753. const _hoisted_6$5 = { style: { "float": "left" } };
  27754. const _sfc_main$9 = /* @__PURE__ */ defineComponent({
  27755. props: {
  27756. modelValue: { type: null, required: true },
  27757. multiple: { type: Boolean, required: false, default: false },
  27758. size: { type: String, required: true, default: () => "" },
  27759. placeholder: { type: String, required: false, default: () => "\u8BF7\u9009\u62E9" },
  27760. disabled: { type: Boolean, required: false, default: false },
  27761. options: { type: Array, required: false, default: () => [] },
  27762. clearable: { type: Boolean, required: false, default: true },
  27763. width: { type: String, required: false, default: () => "100%" },
  27764. url: { type: String, required: false, default: () => "" }
  27765. },
  27766. emits: ["change", "update:modelValue"],
  27767. setup(__props, { emit }) {
  27768. const props = __props;
  27769. const personnelArray = ref([]);
  27770. const { userInfo = {}, personnelList = [] } = JSON.parse(sessionStorage.getItem("storeInfo") || "{}");
  27771. const textSize = ref({
  27772. "small": { height: "20px", fontSize: "12px" },
  27773. "default": { height: "28px", fontSize: "14px" },
  27774. "": { height: "28px", fontSize: "14px" },
  27775. "large": { height: "36px", fontSize: "14px" }
  27776. });
  27777. const selectLoading = ref(false);
  27778. const controlTranslation = reactive({
  27779. visibleFlag: false
  27780. });
  27781. const selectedValue = ref(props.modelValue);
  27782. watch(() => props.modelValue, (newValue, _oldValue) => {
  27783. if (newValue != selectedValue.value) {
  27784. selectedValue.value = newValue;
  27785. }
  27786. });
  27787. const getSelectedLabel = computed(() => {
  27788. if (!props.multiple) {
  27789. const item = getPersonnelListItems(selectedValue.value || props.modelValue);
  27790. return item ? item.label : props.placeholder;
  27791. }
  27792. if (props.multiple) {
  27793. if (Array.isArray(selectedValue.value)) {
  27794. if (selectedValue.value.length <= 0) {
  27795. return props.placeholder;
  27796. }
  27797. const item = getPersonnelListItems(selectedValue.value || props.modelValue);
  27798. return item ? item.label : props.placeholder;
  27799. } else {
  27800. return props.placeholder;
  27801. }
  27802. }
  27803. return props.placeholder;
  27804. });
  27805. function tagClose(_evt) {
  27806. if (Array.isArray(selectedValue.value)) {
  27807. selectedValue.value.shift();
  27808. updateValue(selectedValue.value);
  27809. }
  27810. }
  27811. function getPersonnelListItems(val) {
  27812. let value = val;
  27813. if (Array.isArray(val) && val.length > 0) {
  27814. value = val[0];
  27815. }
  27816. return personnelList.find((item) => item.value == value);
  27817. }
  27818. function getUserList(keyword = "") {
  27819. newPost(props.url, keyword).then((res) => {
  27820. personnelArray.value = res || [];
  27821. }).finally(() => {
  27822. selectLoading.value = false;
  27823. });
  27824. }
  27825. function newPost(url2, keyword) {
  27826. return new Promise((resolve, reject) => {
  27827. const token = sessionStorage.getItem("token");
  27828. if (!token) {
  27829. reject(new Error("Token is missing"));
  27830. return;
  27831. }
  27832. const body = new URLSearchParams();
  27833. body.append("keyword", keyword);
  27834. fetch(url2, {
  27835. method: "POST",
  27836. headers: {
  27837. "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
  27838. "Token": token
  27839. },
  27840. body: body.toString()
  27841. }).then((resp) => {
  27842. if (!resp.ok) {
  27843. reject(new Error(`Error: ${resp.statusText}`));
  27844. }
  27845. return resp.json();
  27846. }).then((json) => {
  27847. const res = json.data;
  27848. if (Array.isArray(res)) {
  27849. const personnelArray2 = res.map((data2) => ({
  27850. label: data2["label"],
  27851. value: data2["value"]
  27852. }));
  27853. resolve(personnelArray2);
  27854. } else {
  27855. reject(new Error("Invalid data format"));
  27856. }
  27857. }).catch((error) => {
  27858. reject(error);
  27859. });
  27860. });
  27861. }
  27862. function visibleChange(visible) {
  27863. if (visible) {
  27864. personnelArray.value = personnelList;
  27865. }
  27866. controlTranslation.visibleFlag = visible;
  27867. }
  27868. const filterMethod = debounce2(filterMethods, 500);
  27869. function filterMethods(val) {
  27870. if (val == "") {
  27871. personnelArray.value = personnelList;
  27872. selectLoading.value = false;
  27873. return personnelArray.value;
  27874. }
  27875. selectLoading.value = true;
  27876. getUserList(val);
  27877. }
  27878. function updateValue(val) {
  27879. emit("update:modelValue", selectedValue.value);
  27880. emit("change", val);
  27881. }
  27882. function debounce2(func, delay) {
  27883. let timer;
  27884. return (...args) => {
  27885. if (timer) {
  27886. clearTimeout(timer);
  27887. }
  27888. timer = setTimeout(() => {
  27889. func(...args);
  27890. }, delay);
  27891. };
  27892. }
  27893. onMounted(() => {
  27894. if (personnelList.length == 0) {
  27895. getUserList();
  27896. } else {
  27897. personnelArray.value = personnelList;
  27898. }
  27899. });
  27900. return (_ctx, _cache) => {
  27901. const _component_el_tag = ElTag;
  27902. const _component_el_option = ElOption;
  27903. const _component_el_select = ElSelect;
  27904. return openBlock(), createBlock(_component_el_select, {
  27905. modelValue: selectedValue.value,
  27906. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => selectedValue.value = $event),
  27907. multiple: __props.multiple,
  27908. size: __props.size,
  27909. loading: selectLoading.value,
  27910. placeholder: __props.placeholder,
  27911. disabled: __props.disabled,
  27912. clearable: __props.clearable,
  27913. filterable: "",
  27914. "collapse-tags": "",
  27915. style: normalizeStyle(`width: ${__props.width}`),
  27916. class: normalizeClass(`custom-select-v2-reset ${!unref(controlTranslation).visibleFlag ? "setUpInputReset" : ""}`),
  27917. onChange: updateValue,
  27918. onVisibleChange: visibleChange,
  27919. "filter-method": unref(filterMethod)
  27920. }, createSlots({
  27921. default: withCtx(() => [
  27922. (openBlock(true), createElementBlock(Fragment, null, renderList(personnelArray.value || [], (item) => {
  27923. return openBlock(), createBlock(_component_el_option, {
  27924. key: item.value,
  27925. label: item.label,
  27926. value: item.value
  27927. }, {
  27928. default: withCtx(() => [
  27929. createElementVNode("span", _hoisted_6$5, toDisplayString(item.label), 1)
  27930. ]),
  27931. _: 2
  27932. }, 1032, ["label", "value"]);
  27933. }), 128))
  27934. ]),
  27935. _: 2
  27936. }, [
  27937. !__props.multiple ? {
  27938. name: "prefix",
  27939. fn: withCtx(() => [
  27940. createElementVNode("div", _hoisted_1$7, [
  27941. !unref(controlTranslation).visibleFlag ? (openBlock(), createElementBlock("div", {
  27942. key: 0,
  27943. class: "selectSingleChoice",
  27944. style: normalizeStyle(`line-height: ${textSize.value[__props.size].height};font-size:${textSize.value[__props.size].fontSize}`)
  27945. }, [
  27946. unref(getSelectedLabel) == __props.placeholder ? (openBlock(), createElementBlock("span", _hoisted_2$6, toDisplayString(__props.placeholder), 1)) : (openBlock(), createElementBlock("span", _hoisted_3$5, toDisplayString(unref(getSelectedLabel)) + " a ", 1))
  27947. ], 4)) : createCommentVNode("", true)
  27948. ])
  27949. ])
  27950. } : void 0,
  27951. __props.multiple ? {
  27952. name: "prefix",
  27953. fn: withCtx(() => [
  27954. createElementVNode("div", _hoisted_4$5, [
  27955. createElementVNode("div", {
  27956. class: "selectSingleChoice",
  27957. style: normalizeStyle(`line-height: ${textSize.value[__props.size].height};font-size:${textSize.value[__props.size].fontSize}`)
  27958. }, [
  27959. unref(getSelectedLabel) == __props.placeholder ? (openBlock(), createElementBlock("span", _hoisted_5$5, toDisplayString(__props.placeholder), 1)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  27960. createVNode(_component_el_tag, {
  27961. type: "info",
  27962. size: __props.size,
  27963. closable: "",
  27964. onClose: tagClose,
  27965. style: { "margin-right": "5px" }
  27966. }, {
  27967. default: withCtx(() => [
  27968. createTextVNode(toDisplayString(unref(getSelectedLabel)) + " a ", 1)
  27969. ]),
  27970. _: 1
  27971. }, 8, ["size"]),
  27972. selectedValue.value.length > 1 ? (openBlock(), createBlock(_component_el_tag, {
  27973. key: 0,
  27974. type: "info",
  27975. size: __props.size
  27976. }, {
  27977. default: withCtx(() => [
  27978. createTextVNode("+" + toDisplayString(selectedValue.value.length), 1)
  27979. ]),
  27980. _: 1
  27981. }, 8, ["size"])) : createCommentVNode("", true)
  27982. ], 64))
  27983. ], 4)
  27984. ])
  27985. ])
  27986. } : void 0
  27987. ]), 1032, ["modelValue", "multiple", "size", "loading", "placeholder", "disabled", "clearable", "style", "class", "filter-method"]);
  27988. };
  27989. }
  27990. });
  27991. var GenerateFormItem_vue_vue_type_style_index_0_scoped_true_lang = "";
  27992. var _export_sfc = (sfc, props) => {
  27993. const target = sfc.__vccOpts || sfc;
  27994. for (const [key, val] of props) {
  27995. target[key] = val;
  27996. }
  27997. return target;
  27998. };
  27999. const _withScopeId = (n) => (pushScopeId("data-v-38ee7c8b"), n = n(), popScopeId(), n);
  28000. const _hoisted_1$6 = { key: 12 };
  28001. const _hoisted_2$5 = {
  28002. key: 1,
  28003. class: "custom:insert"
  28004. };
  28005. const _hoisted_3$4 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("i", { class: "custom:img-upload mr-2" }, null, -1));
  28006. const _hoisted_4$4 = /* @__PURE__ */ createTextVNode("\u70B9\u51FB\u4E0A\u4F20 ");
  28007. const _hoisted_5$4 = ["href"];
  28008. const _hoisted_6$4 = /* @__PURE__ */ createTextVNode(" \u4E0B\u8F7D ");
  28009. const _sfc_main$8 = /* @__PURE__ */ defineComponent({
  28010. props: {
  28011. config: null,
  28012. element: null,
  28013. model: null,
  28014. updatedModel: null,
  28015. disabled: { type: Boolean },
  28016. request: null,
  28017. widgetFormData: null
  28018. },
  28019. emits: ["updateWidgetForm"],
  28020. setup(__props, { emit: emits }) {
  28021. const props = __props;
  28022. const { userInfo = {} } = JSON.parse(sessionStorage.getItem("storeInfo") || "{}");
  28023. const originData = props.model[props.element.model];
  28024. const data2 = computed({
  28025. get: () => props.model[props.element.model],
  28026. set: (val) => {
  28027. props.model[props.element.model] = val;
  28028. if (JSON.stringify(originData) === JSON.stringify(val)) {
  28029. Reflect.deleteProperty(props.updatedModel, props.element.model);
  28030. } else {
  28031. props.updatedModel[props.element.model] = val;
  28032. }
  28033. }
  28034. });
  28035. const handleUploadSuccess = (_res, _file, fileList) => {
  28036. data2.value = fileList;
  28037. };
  28038. async function download(defaultValue, label) {
  28039. const a2 = document.createElement("a");
  28040. if (!props.request)
  28041. return;
  28042. a2.href = await props.request({
  28043. url: `/sys/common/static/${defaultValue}`,
  28044. responseType: "blob"
  28045. }).then((i) => {
  28046. if (i.size === 0)
  28047. return "";
  28048. return URL.createObjectURL(i);
  28049. });
  28050. a2.download = `${label}.${defaultValue.split(".")[1]}`;
  28051. a2.click();
  28052. }
  28053. const specializedHandleSelect = (val, element) => {
  28054. const field = element.model;
  28055. if (field == "customerId") {
  28056. let list = JSON.parse(JSON.stringify(props.widgetFormData));
  28057. for (var i in list) {
  28058. if (list[i].list[0].model == "contactsId") {
  28059. let item = list[i].list[0];
  28060. const token = sessionStorage.getItem("token");
  28061. fetch(`${item.options.remoteFunc}?customerId=${val}`, {
  28062. headers: {
  28063. "Content-type": " application/x-www-form-urlencoded; charset=UTF-8",
  28064. "Token": token
  28065. }
  28066. }).then((resp) => resp.json()).then((json) => {
  28067. const res = json.data;
  28068. if (res instanceof Array) {
  28069. item.options.remoteOptions = res.map((data22) => ({
  28070. label: data22[item.options.props.label],
  28071. value: data22[item.options.props.value],
  28072. children: data22[item.options.props.children]
  28073. }));
  28074. }
  28075. list[i].list[0].options = __spreadProps(__spreadValues({}, list[i].list[0].options), { disabled: false, defaultValue: "" });
  28076. });
  28077. }
  28078. }
  28079. setTimeout(() => {
  28080. console.log("\u5F00\u59CB\u6267\u884C");
  28081. updateWidgetForm(list);
  28082. }, 100);
  28083. }
  28084. };
  28085. const updateWidgetForm = (list) => {
  28086. emits("updateWidgetForm", list);
  28087. };
  28088. return (_ctx, _cache) => {
  28089. const _component_GenerateFormItem = resolveComponent("GenerateFormItem", true);
  28090. const _component_el_table_column = ElTableColumn;
  28091. const _component_el_table = ElTable;
  28092. const _component_el_divider = ElDivider;
  28093. const _component_el_input = ElInput;
  28094. const _component_el_input_number = ElInputNumber;
  28095. const _component_el_radio = ElRadio;
  28096. const _component_el_radio_group = ElRadioGroup;
  28097. const _component_el_checkbox = ElCheckbox;
  28098. const _component_el_checkbox_group = ElCheckboxGroup$1;
  28099. const _component_el_time_picker = ElTimePicker;
  28100. const _component_el_config_provider = ElConfigProvider;
  28101. const _component_el_date_picker = ElDatePicker;
  28102. const _component_el_rate = ElRate;
  28103. const _component_el_option = ElOption;
  28104. const _component_el_select = ElSelect;
  28105. const _component_el_switch = ElSwitch;
  28106. const _component_el_slider = ElSlider;
  28107. const _component_el_image = ElImage;
  28108. const _component_el_button = ElButton;
  28109. const _component_el_upload = ElUpload;
  28110. const _component_el_cascader = ElCascader;
  28111. const _component_el_form_item = ElFormItem;
  28112. return __props.element.type === "grid" ? (openBlock(), createElementBlock("div", {
  28113. key: 0,
  28114. grid: "~ cols-24",
  28115. style: normalizeStyle(`gap: ${__props.element.options.gutter}px; align-items: ${__props.element.options.align};`)
  28116. }, [
  28117. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.columns, (col, colIndex) => {
  28118. return openBlock(), createElementBlock("div", {
  28119. key: colIndex,
  28120. style: normalizeStyle(`grid-column: span ${col.span}`)
  28121. }, [
  28122. (openBlock(true), createElementBlock(Fragment, null, renderList(col.list, (colItem) => {
  28123. return openBlock(), createBlock(_component_GenerateFormItem, {
  28124. key: colItem.key,
  28125. request: __props.request,
  28126. model: __props.model,
  28127. "updated-model": __props.updatedModel,
  28128. element: colItem,
  28129. config: __props.config,
  28130. disabled: __props.disabled,
  28131. widgetFormData: __props.element.columns,
  28132. onUpdateWidgetForm: updateWidgetForm
  28133. }, null, 8, ["request", "model", "updated-model", "element", "config", "disabled", "widgetFormData"]);
  28134. }), 128))
  28135. ], 4);
  28136. }), 128))
  28137. ], 4)) : __props.element.type === "table" ? (openBlock(), createBlock(_component_el_table, {
  28138. key: 1,
  28139. border: "",
  28140. class: "mb-4.5",
  28141. data: __props.element.options.defaultValue
  28142. }, {
  28143. default: withCtx(() => [
  28144. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.columns, (i) => {
  28145. return openBlock(), createBlock(_component_el_table_column, mergeProps({
  28146. key: i.prop,
  28147. align: __props.element.options.align
  28148. }, i), null, 16, ["align"]);
  28149. }), 128))
  28150. ]),
  28151. _: 1
  28152. }, 8, ["data"])) : __props.element.type === "divider" ? (openBlock(), createBlock(_component_el_divider, {
  28153. key: 2,
  28154. data: __props.element.options.defaultValue,
  28155. "content-position": "left"
  28156. }, {
  28157. default: withCtx(() => [
  28158. createTextVNode(toDisplayString(__props.element.label), 1)
  28159. ]),
  28160. _: 1
  28161. }, 8, ["data"])) : __props.element ? (openBlock(), createBlock(_component_el_form_item, {
  28162. key: __props.element.key,
  28163. label: __props.element.label,
  28164. prop: __props.element.model,
  28165. style: normalizeStyle(__props.element.type === "download" ? "display:inline-flex;margin-right:40px" : ""),
  28166. "label-width": __props.element.labelWidth
  28167. }, createSlots({
  28168. default: withCtx(() => [
  28169. __props.element.type === "input" ? (openBlock(), createBlock(_component_el_input, {
  28170. key: 0,
  28171. modelValue: unref(data2),
  28172. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(data2) ? data2.value = $event : null),
  28173. modelModifiers: { trim: true },
  28174. style: normalizeStyle({ width: __props.element.options.width }),
  28175. placeholder: __props.element.options.placeholder,
  28176. maxlength: parseInt(__props.element.options.maxlength),
  28177. clearable: __props.element.options.clearable,
  28178. readonly: __props.element.options.readonly,
  28179. disabled: __props.disabled || __props.element.options.disabled
  28180. }, createSlots({ _: 2 }, [
  28181. __props.element.options.prefix ? {
  28182. name: "prefix",
  28183. fn: withCtx(() => [
  28184. createTextVNode(toDisplayString(__props.element.options.prefix), 1)
  28185. ])
  28186. } : void 0,
  28187. __props.element.options.suffix ? {
  28188. name: "suffix",
  28189. fn: withCtx(() => [
  28190. createTextVNode(toDisplayString(__props.element.options.suffix), 1)
  28191. ])
  28192. } : void 0,
  28193. __props.element.options.prepend ? {
  28194. name: "prepend",
  28195. fn: withCtx(() => [
  28196. createTextVNode(toDisplayString(__props.element.options.prepend), 1)
  28197. ])
  28198. } : void 0,
  28199. __props.element.options.append ? {
  28200. name: "append",
  28201. fn: withCtx(() => [
  28202. createTextVNode(toDisplayString(__props.element.options.append), 1)
  28203. ])
  28204. } : void 0
  28205. ]), 1032, ["modelValue", "style", "placeholder", "maxlength", "clearable", "readonly", "disabled"])) : createCommentVNode("", true),
  28206. __props.element.type === "password" ? (openBlock(), createBlock(_component_el_input, {
  28207. key: 1,
  28208. modelValue: unref(data2),
  28209. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(data2) ? data2.value = $event : null),
  28210. modelModifiers: { trim: true },
  28211. style: normalizeStyle({ width: __props.element.options.width }),
  28212. placeholder: __props.element.options.placeholder,
  28213. maxlength: parseInt(__props.element.options.maxlength),
  28214. clearable: __props.element.options.clearable,
  28215. disabled: __props.disabled || __props.element.options.disabled,
  28216. readonly: __props.element.options.readonly,
  28217. "show-password": __props.element.options.showPassword
  28218. }, createSlots({ _: 2 }, [
  28219. __props.element.options.prefix ? {
  28220. name: "prefix",
  28221. fn: withCtx(() => [
  28222. createTextVNode(toDisplayString(__props.element.options.prefix), 1)
  28223. ])
  28224. } : void 0,
  28225. __props.element.options.suffix ? {
  28226. name: "suffix",
  28227. fn: withCtx(() => [
  28228. createTextVNode(toDisplayString(__props.element.options.suffix), 1)
  28229. ])
  28230. } : void 0,
  28231. __props.element.options.prepend ? {
  28232. name: "prepend",
  28233. fn: withCtx(() => [
  28234. createTextVNode(toDisplayString(__props.element.options.prepend), 1)
  28235. ])
  28236. } : void 0,
  28237. __props.element.options.append ? {
  28238. name: "append",
  28239. fn: withCtx(() => [
  28240. createTextVNode(toDisplayString(__props.element.options.append), 1)
  28241. ])
  28242. } : void 0
  28243. ]), 1032, ["modelValue", "style", "placeholder", "maxlength", "clearable", "disabled", "readonly", "show-password"])) : createCommentVNode("", true),
  28244. __props.element.type === "textarea" ? (openBlock(), createBlock(_component_el_input, {
  28245. key: 2,
  28246. modelValue: unref(data2),
  28247. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(data2) ? data2.value = $event : null),
  28248. modelModifiers: { trim: true },
  28249. type: "textarea",
  28250. resize: "none",
  28251. rows: __props.element.options.rows,
  28252. style: normalizeStyle({ width: __props.element.options.width }),
  28253. placeholder: __props.element.options.placeholder,
  28254. maxlength: parseInt(__props.element.options.maxlength),
  28255. "show-word-limit": __props.element.options.showWordLimit,
  28256. autosize: __props.element.options.autosize,
  28257. clearable: __props.element.options.clearable,
  28258. readonly: __props.element.options.readonly,
  28259. disabled: __props.disabled || __props.element.options.disabled
  28260. }, null, 8, ["modelValue", "rows", "style", "placeholder", "maxlength", "show-word-limit", "autosize", "clearable", "readonly", "disabled"])) : createCommentVNode("", true),
  28261. __props.element.type === "number" ? (openBlock(), createBlock(_component_el_input_number, {
  28262. key: 3,
  28263. modelValue: unref(data2),
  28264. "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => isRef(data2) ? data2.value = $event : null),
  28265. style: normalizeStyle({ width: __props.element.options.width }),
  28266. max: __props.element.options.max,
  28267. min: __props.element.options.min,
  28268. disabled: __props.disabled || __props.element.options.disabled,
  28269. "controls-position": "right"
  28270. }, null, 8, ["modelValue", "style", "max", "min", "disabled"])) : createCommentVNode("", true),
  28271. __props.element.type === "radio" ? (openBlock(), createBlock(_component_el_radio_group, {
  28272. key: 4,
  28273. modelValue: unref(data2),
  28274. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => isRef(data2) ? data2.value = $event : null),
  28275. style: normalizeStyle({ width: __props.element.options.width }),
  28276. disabled: __props.disabled || __props.element.options.disabled
  28277. }, {
  28278. default: withCtx(() => [
  28279. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.options.remote ? __props.element.options.remoteOptions : __props.element.options.options, (item) => {
  28280. return openBlock(), createBlock(_component_el_radio, {
  28281. key: item.value,
  28282. label: item.value,
  28283. style: normalizeStyle({
  28284. display: __props.element.options.inline ? "inline-block" : "block"
  28285. })
  28286. }, {
  28287. default: withCtx(() => [
  28288. createTextVNode(toDisplayString(__props.element.options.showLabel ? item.label : item.value), 1)
  28289. ]),
  28290. _: 2
  28291. }, 1032, ["label", "style"]);
  28292. }), 128))
  28293. ]),
  28294. _: 1
  28295. }, 8, ["modelValue", "style", "disabled"])) : createCommentVNode("", true),
  28296. __props.element.type === "checkbox" ? (openBlock(), createBlock(_component_el_checkbox_group, {
  28297. key: 5,
  28298. modelValue: unref(data2),
  28299. "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => isRef(data2) ? data2.value = $event : null),
  28300. style: normalizeStyle({ width: __props.element.options.width }),
  28301. disabled: __props.disabled || __props.element.options.disabled
  28302. }, {
  28303. default: withCtx(() => [
  28304. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.options.remote ? __props.element.options.remoteOptions : __props.element.options.options, (item) => {
  28305. return openBlock(), createBlock(_component_el_checkbox, {
  28306. key: item.value,
  28307. label: item.value,
  28308. style: normalizeStyle({
  28309. display: __props.element.options.inline ? "inline-block" : "block"
  28310. })
  28311. }, {
  28312. default: withCtx(() => [
  28313. createTextVNode(toDisplayString(__props.element.options.showLabel ? item.label : item.value), 1)
  28314. ]),
  28315. _: 2
  28316. }, 1032, ["label", "style"]);
  28317. }), 128))
  28318. ]),
  28319. _: 1
  28320. }, 8, ["modelValue", "style", "disabled"])) : createCommentVNode("", true),
  28321. __props.element.type === "time" ? (openBlock(), createBlock(_component_el_config_provider, {
  28322. key: 6,
  28323. locale: unref(zhCn)
  28324. }, {
  28325. default: withCtx(() => [
  28326. createVNode(_component_el_time_picker, {
  28327. modelValue: unref(data2),
  28328. "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => isRef(data2) ? data2.value = $event : null),
  28329. placeholder: __props.element.options.placeholder,
  28330. readonly: __props.element.options.readonly,
  28331. editable: __props.element.options.editable,
  28332. clearable: __props.element.options.clearable,
  28333. format: __props.element.options.format,
  28334. disabled: __props.disabled || __props.element.options.disabled,
  28335. style: normalizeStyle({ width: __props.element.options.width })
  28336. }, null, 8, ["modelValue", "placeholder", "readonly", "editable", "clearable", "format", "disabled", "style"])
  28337. ]),
  28338. _: 1
  28339. }, 8, ["locale"])) : createCommentVNode("", true),
  28340. __props.element.type === "date" ? (openBlock(), createBlock(_component_el_config_provider, {
  28341. key: 7,
  28342. locale: unref(zhCn)
  28343. }, {
  28344. default: withCtx(() => [
  28345. createVNode(_component_el_date_picker, {
  28346. modelValue: unref(data2),
  28347. "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => isRef(data2) ? data2.value = $event : null),
  28348. placeholder: __props.element.options.placeholder,
  28349. readonly: __props.element.options.readonly,
  28350. editable: __props.element.options.editable,
  28351. clearable: __props.element.options.clearable,
  28352. format: __props.element.options.format,
  28353. disabled: __props.disabled || __props.element.options.disabled,
  28354. style: normalizeStyle({ width: __props.element.options.width })
  28355. }, null, 8, ["modelValue", "placeholder", "readonly", "editable", "clearable", "format", "disabled", "style"])
  28356. ]),
  28357. _: 1
  28358. }, 8, ["locale"])) : createCommentVNode("", true),
  28359. __props.element.type === "rate" ? (openBlock(), createBlock(_component_el_rate, {
  28360. key: 8,
  28361. modelValue: unref(data2),
  28362. "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => isRef(data2) ? data2.value = $event : null),
  28363. max: __props.element.options.max,
  28364. "allow-half": __props.element.options.allowHalf,
  28365. disabled: __props.disabled || __props.element.options.disabled
  28366. }, null, 8, ["modelValue", "max", "allow-half", "disabled"])) : createCommentVNode("", true),
  28367. __props.element.type === "select" ? (openBlock(), createElementBlock(Fragment, { key: 9 }, [
  28368. unref(userInfo).userNameNeedTranslate == 1 && __props.element.options.remoteFunc.indexOf("getSimpleActiveUserListNew") > -1 ? (openBlock(), createBlock(_sfc_main$9, {
  28369. key: 0,
  28370. modelValue: unref(data2),
  28371. "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => isRef(data2) ? data2.value = $event : null),
  28372. multiple: __props.element.options.multiple,
  28373. placeholder: __props.element.options.placeholder,
  28374. clearable: __props.element.options.clearable,
  28375. filterable: __props.element.options.filterable,
  28376. disabled: __props.disabled || __props.element.options.disabled,
  28377. url: __props.element.options.remoteFunc,
  28378. size: __props.config.size,
  28379. options: [],
  28380. style: normalizeStyle({ width: __props.element.options.width }),
  28381. onChange: _cache[10] || (_cache[10] = (value) => specializedHandleSelect(value, __props.element))
  28382. }, null, 8, ["modelValue", "multiple", "placeholder", "clearable", "filterable", "disabled", "url", "size", "style"])) : (openBlock(), createBlock(_component_el_select, {
  28383. key: 1,
  28384. modelValue: unref(data2),
  28385. "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => isRef(data2) ? data2.value = $event : null),
  28386. multiple: __props.element.options.multiple,
  28387. placeholder: __props.element.options.placeholder,
  28388. clearable: __props.element.options.clearable,
  28389. filterable: __props.element.options.filterable,
  28390. disabled: __props.disabled || __props.element.options.disabled,
  28391. style: normalizeStyle({ width: __props.element.options.width }),
  28392. onChange: _cache[12] || (_cache[12] = (value) => specializedHandleSelect(value, __props.element))
  28393. }, {
  28394. default: withCtx(() => [
  28395. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.options.remote ? __props.element.options.remoteOptions : __props.element.options.options, (item) => {
  28396. return openBlock(), createBlock(_component_el_option, {
  28397. key: item.value,
  28398. value: item.value,
  28399. label: __props.element.options.showLabel ? item.label : item.value
  28400. }, null, 8, ["value", "label"]);
  28401. }), 128))
  28402. ]),
  28403. _: 1
  28404. }, 8, ["modelValue", "multiple", "placeholder", "clearable", "filterable", "disabled", "style"]))
  28405. ], 64)) : createCommentVNode("", true),
  28406. __props.element.type === "switch" ? (openBlock(), createBlock(_component_el_switch, {
  28407. key: 10,
  28408. modelValue: unref(data2),
  28409. "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => isRef(data2) ? data2.value = $event : null),
  28410. "active-text": __props.element.options.activeText,
  28411. "inactive-text": __props.element.options.inactiveText,
  28412. disabled: __props.disabled || __props.element.options.disabled
  28413. }, null, 8, ["modelValue", "active-text", "inactive-text", "disabled"])) : createCommentVNode("", true),
  28414. __props.element.type === "slider" ? (openBlock(), createBlock(_component_el_slider, {
  28415. key: 11,
  28416. modelValue: unref(data2),
  28417. "onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => isRef(data2) ? data2.value = $event : null),
  28418. min: __props.element.options.min,
  28419. max: __props.element.options.max,
  28420. step: __props.element.options.step,
  28421. range: __props.element.options.range,
  28422. disabled: __props.disabled || __props.element.options.disabled,
  28423. style: normalizeStyle({ width: __props.element.options.width })
  28424. }, null, 8, ["modelValue", "min", "max", "step", "range", "disabled", "style"])) : createCommentVNode("", true),
  28425. __props.element.type == "text" ? (openBlock(), createElementBlock("span", _hoisted_1$6, toDisplayString(__props.element.options.defaultValue), 1)) : createCommentVNode("", true),
  28426. __props.element.type === "img-upload" ? (openBlock(), createBlock(_component_el_upload, {
  28427. key: 13,
  28428. name: __props.element.options.file,
  28429. action: __props.element.options.action,
  28430. accept: __props.element.options.accept,
  28431. "list-type": __props.element.options.listType,
  28432. multiple: __props.element.options.multiple,
  28433. limit: __props.element.options.limit,
  28434. disabled: __props.disabled || __props.element.options.disabled,
  28435. "on-success": handleUploadSuccess
  28436. }, {
  28437. default: withCtx(() => {
  28438. var _a2;
  28439. return [
  28440. __props.element.options.listType === "picture-card" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  28441. ((_a2 = __props.element.options.defaultValue) == null ? void 0 : _a2.length) ? (openBlock(), createBlock(_component_el_image, {
  28442. key: 0,
  28443. style: { "width": "100%", "height": "100%" },
  28444. "preview-src-list": [
  28445. "/api/sys/common/static/" + __props.element.options.defaultValue
  28446. ],
  28447. src: "/api/sys/common/static/" + __props.element.options.defaultValue
  28448. }, null, 8, ["preview-src-list", "src"])) : (openBlock(), createElementBlock("i", _hoisted_2$5))
  28449. ], 64)) : (openBlock(), createBlock(_component_el_button, { key: 1 }, {
  28450. default: withCtx(() => [
  28451. _hoisted_3$4,
  28452. _hoisted_4$4
  28453. ]),
  28454. _: 1
  28455. }))
  28456. ];
  28457. }),
  28458. _: 1
  28459. }, 8, ["name", "action", "accept", "list-type", "multiple", "limit", "disabled"])) : createCommentVNode("", true),
  28460. __props.element.type === "download" ? (openBlock(), createBlock(_component_el_button, {
  28461. key: 14,
  28462. style: { "margin-top": "-4px" },
  28463. type: "text",
  28464. onClick: _cache[15] || (_cache[15] = ($event) => download(__props.element.options.defaultValue, __props.element.label))
  28465. }, {
  28466. default: withCtx(() => [
  28467. _hoisted_6$4
  28468. ]),
  28469. _: 1
  28470. })) : createCommentVNode("", true),
  28471. __props.element.type === "cascader" ? (openBlock(), createBlock(_component_el_cascader, {
  28472. key: 15,
  28473. modelValue: unref(data2),
  28474. "onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => isRef(data2) ? data2.value = $event : null),
  28475. options: __props.element.options.remoteOptions,
  28476. placeholder: __props.element.options.placeholder,
  28477. filterable: __props.element.options.filterable,
  28478. clearable: __props.element.options.clearable,
  28479. disabled: __props.disabled || __props.element.options.disabled,
  28480. style: normalizeStyle({ width: __props.element.options.width })
  28481. }, null, 8, ["modelValue", "options", "placeholder", "filterable", "clearable", "disabled", "style"])) : createCommentVNode("", true)
  28482. ]),
  28483. _: 2
  28484. }, [
  28485. __props.element.type === "download" ? {
  28486. name: "label",
  28487. fn: withCtx(({ label }) => [
  28488. createElementVNode("a", {
  28489. href: `/api/sys/common/static/${__props.element.options.defaultValue}?inline=1`,
  28490. style: { "color": "#606266" },
  28491. target: "_blank"
  28492. }, toDisplayString(label), 9, _hoisted_5$4)
  28493. ])
  28494. } : void 0
  28495. ]), 1032, ["label", "prop", "style", "label-width"])) : createCommentVNode("", true);
  28496. };
  28497. }
  28498. });
  28499. var GenerateFormItem = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-38ee7c8b"]]);
  28500. const _sfc_main$7 = defineComponent({
  28501. name: "FormGenerate",
  28502. components: {
  28503. GenerateFormItem
  28504. },
  28505. props: {
  28506. data: {
  28507. type: Object,
  28508. default: getWidgetForm()
  28509. },
  28510. value: {
  28511. type: Object
  28512. },
  28513. disabled: {
  28514. type: Boolean,
  28515. default: false
  28516. },
  28517. request: {
  28518. type: Function
  28519. }
  28520. },
  28521. setup(props) {
  28522. var _a2;
  28523. const state = reactive({
  28524. generateForm: null,
  28525. model: {},
  28526. updatedModel: {},
  28527. rules: {},
  28528. widgetForm: (_a2 = props.data && JSON.parse(JSON.stringify(props.data))) != null ? _a2 : getWidgetForm()
  28529. });
  28530. const generateModel = (list) => {
  28531. for (let index = 0; index < list.length; index++) {
  28532. const model = list[index].model;
  28533. if (!model)
  28534. return;
  28535. if (list[index].type === "grid") {
  28536. list[index].columns.forEach((col) => generateModel(col.list));
  28537. } else {
  28538. if (props.value && Object.keys(props.value).includes(model))
  28539. state.model[model] = props.value[model];
  28540. else
  28541. state.model[model] = list[index].options.defaultValue;
  28542. state.rules[model] = list[index].options.rules;
  28543. }
  28544. }
  28545. };
  28546. const generateOptions = (list) => {
  28547. list.forEach(async (item) => {
  28548. if (item.type === "grid") {
  28549. item.columns.forEach((col) => generateOptions(col.list));
  28550. } else {
  28551. if (item.options.remote && item.options.remoteFunc) {
  28552. if (props.request) {
  28553. const { data: data2 } = await props.request({
  28554. url: item.options.remoteFunc
  28555. });
  28556. item.options.remoteOptions = data2.map((i) => ({
  28557. label: i[item.options.props.label],
  28558. value: i[item.options.props.value],
  28559. children: i[item.options.props.children]
  28560. }));
  28561. return;
  28562. }
  28563. const token = sessionStorage.getItem("token");
  28564. fetch(item.options.remoteFunc, {
  28565. headers: {
  28566. "Content-type": " application/x-www-form-urlencoded; charset=UTF-8",
  28567. "Token": token
  28568. }
  28569. }).then((resp) => resp.json()).then((json) => {
  28570. const res = json.data;
  28571. if (res instanceof Array) {
  28572. item.options.remoteOptions = res.map((data2) => ({
  28573. label: data2[item.options.props.label],
  28574. value: data2[item.options.props.value],
  28575. children: data2[item.options.props.children]
  28576. }));
  28577. }
  28578. });
  28579. }
  28580. }
  28581. });
  28582. };
  28583. const updateWidgetForm = (list) => {
  28584. const listIndex2 = state.widgetForm.list.findIndex((item) => item.type === "grid");
  28585. state.widgetForm.list[listIndex2].columns = list;
  28586. state.model = __spreadProps(__spreadValues({}, state.model), { contactsId: "" });
  28587. };
  28588. watch(() => props.data, (val) => {
  28589. var _a3;
  28590. state.widgetForm = (_a3 = val && JSON.parse(JSON.stringify(val))) != null ? _a3 : getWidgetForm();
  28591. state.model = {};
  28592. state.rules = {};
  28593. generateModel(state.widgetForm.list);
  28594. generateOptions(state.widgetForm.list);
  28595. }, { deep: true, immediate: true });
  28596. const getData = () => {
  28597. return new Promise((resolve, reject) => {
  28598. state.generateForm.validate().then((validate) => {
  28599. if (validate)
  28600. resolve(state.updatedModel);
  28601. else
  28602. ElMessage.error("\u9A8C\u8BC1\u5931\u8D25");
  28603. }).catch((error) => {
  28604. reject(error);
  28605. });
  28606. });
  28607. };
  28608. const reset = () => {
  28609. state.generateForm.resetFields();
  28610. };
  28611. return __spreadProps(__spreadValues({}, toRefs(state)), {
  28612. getData,
  28613. reset,
  28614. updateWidgetForm
  28615. });
  28616. }
  28617. });
  28618. function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
  28619. const _component_GenerateFormItem = resolveComponent("GenerateFormItem");
  28620. const _component_el_form = ElForm;
  28621. return openBlock(), createBlock(_component_el_form, {
  28622. ref: "generateForm",
  28623. "label-suffix": ":",
  28624. model: _ctx.model,
  28625. rules: _ctx.rules,
  28626. size: _ctx.widgetForm.config.size,
  28627. "label-position": _ctx.widgetForm.config.labelPosition,
  28628. "label-width": `${_ctx.widgetForm.config.labelWidth}px`,
  28629. "hide-required-asterisk": _ctx.widgetForm.config.hideRequiredAsterisk
  28630. }, {
  28631. default: withCtx(() => [
  28632. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.widgetForm.list, (element, index) => {
  28633. return openBlock(), createBlock(_component_GenerateFormItem, {
  28634. key: element.key,
  28635. model: _ctx.model,
  28636. "updated-model": _ctx.updatedModel,
  28637. element: _ctx.widgetForm.list[index],
  28638. config: _ctx.data.config,
  28639. disabled: _ctx.disabled,
  28640. request: _ctx.request,
  28641. widgetFormData: _ctx.widgetForm.list,
  28642. onUpdateWidgetForm: _ctx.updateWidgetForm
  28643. }, null, 8, ["model", "updated-model", "element", "config", "disabled", "request", "widgetFormData", "onUpdateWidgetForm"]);
  28644. }), 128))
  28645. ]),
  28646. _: 1
  28647. }, 8, ["model", "rules", "size", "label-position", "label-width", "hide-required-asterisk"]);
  28648. }
  28649. var GenerateForm = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$1]]);
  28650. const _hoisted_1$5 = { class: "px-3 py-2 text-sm text-gray-700" };
  28651. const _hoisted_2$4 = {
  28652. key: 0,
  28653. class: "bg-gray-100 text-xs text-gray-700 hover:text-blue-500 leading-8 cursor-move -outline-offset-1 hover:outline-dashed outline-1 outline-blue-500 list-none flex items-center"
  28654. };
  28655. let listIndex = 1;
  28656. function setListIndex(list) {
  28657. if (list.list.length > 0) {
  28658. const array4 = list.list.map((item) => item.model);
  28659. const plateNumbers = array4.filter((item) => item.includes("plate")).map((item) => {
  28660. const match = item.match(/plate(\d+)/);
  28661. return match ? match[1] : null;
  28662. });
  28663. listIndex = findMissingPositive(plateNumbers);
  28664. }
  28665. }
  28666. function cloneWidget(params) {
  28667. const key = Math.random().toString(36).substring(2, 9);
  28668. params = cloneDeep(__spreadProps(__spreadValues({}, params), {
  28669. key,
  28670. model: `plate${listIndex}`
  28671. }));
  28672. if (params.type === "grid") {
  28673. params.columns.forEach((i) => {
  28674. i.list = i.list.map(cloneWidget);
  28675. });
  28676. }
  28677. return params;
  28678. }
  28679. function findMissingPositive(nums) {
  28680. let numbers = nums.map(Number);
  28681. numbers.sort((a2, b2) => a2 - b2);
  28682. let missing = 1;
  28683. for (let i = 0; i < numbers.length; i++) {
  28684. if (numbers[i] === missing) {
  28685. missing++;
  28686. }
  28687. }
  28688. return missing;
  28689. }
  28690. const _sfc_main$6 = /* @__PURE__ */ defineComponent({
  28691. props: {
  28692. fields: null,
  28693. title: null,
  28694. list: null,
  28695. allList: null
  28696. },
  28697. setup(__props) {
  28698. const props = __props;
  28699. let moveFlag = ref(false);
  28700. const moveStart = () => {
  28701. const array4 = props.allList.list.map((item) => item.model);
  28702. const plateNumbers = array4.filter((item) => item.includes("plate")).map((item) => {
  28703. const match = item.match(/plate(\d+)/);
  28704. return match ? match[1] : null;
  28705. });
  28706. const flag = plateNumbers.length < 5;
  28707. if (!flag && !moveFlag.value) {
  28708. moveFlag.value = true;
  28709. ElMessage.warning("\u6700\u591A\u6DFB\u52A0\u4E94\u4E2A");
  28710. return false;
  28711. }
  28712. return flag;
  28713. };
  28714. const stopMove = () => {
  28715. moveFlag.value = false;
  28716. };
  28717. return (_ctx, _cache) => {
  28718. return openBlock(), createElementBlock(Fragment, null, [
  28719. createElementVNode("div", _hoisted_1$5, toDisplayString(__props.title), 1),
  28720. createVNode(unref(Draggable), {
  28721. tag: "ul",
  28722. class: "m-0 p-3 pt-0 grid grid-cols-2 gap-1",
  28723. "item-key": "type",
  28724. group: { name: "form-design", pull: "clone", put: false },
  28725. clone: cloneWidget,
  28726. sort: false,
  28727. list: __props.list,
  28728. allList: __props.allList,
  28729. move: moveStart,
  28730. choose: setListIndex(__props.allList),
  28731. onAdd: _cache[0] || (_cache[0] = ($event) => stopMove())
  28732. }, {
  28733. item: withCtx(({ element }) => [
  28734. __props.fields.includes(element.type) ? (openBlock(), createElementBlock("li", _hoisted_2$4, [
  28735. createElementVNode("i", {
  28736. class: normalizeClass(["custom:" + element.type, "ml-2 mr-1"])
  28737. }, null, 2),
  28738. createElementVNode("span", null, toDisplayString(element.label), 1)
  28739. ])) : createCommentVNode("", true)
  28740. ]),
  28741. _: 1
  28742. }, 8, ["list", "allList", "choose"])
  28743. ], 64);
  28744. };
  28745. }
  28746. });
  28747. const _hoisted_1$4 = { key: 12 };
  28748. const _hoisted_2$3 = {
  28749. key: 1,
  28750. class: "custom:insert"
  28751. };
  28752. const _hoisted_3$3 = /* @__PURE__ */ createElementVNode("i", {
  28753. "icon-class": "custom:img-upload",
  28754. style: { "margin-right": "10px" }
  28755. }, null, -1);
  28756. const _hoisted_4$3 = /* @__PURE__ */ createTextVNode(" \u70B9\u51FB\u4E0A\u4F20 ");
  28757. const _hoisted_5$3 = /* @__PURE__ */ createTextVNode(" \u4E0B\u8F7D ");
  28758. const _hoisted_6$3 = /* @__PURE__ */ createElementVNode("i", {
  28759. class: "eva:move-outline",
  28760. "text-lg": ""
  28761. }, null, -1);
  28762. const _hoisted_7$2 = [
  28763. _hoisted_6$3
  28764. ];
  28765. const _sfc_main$5 = /* @__PURE__ */ defineComponent({
  28766. props: {
  28767. list: null,
  28768. element: null,
  28769. index: null,
  28770. selectWidget: null,
  28771. configurationItems: null
  28772. },
  28773. emits: ["itemClick", "delete", "update:selectWidget"],
  28774. setup(__props) {
  28775. const props = createPropsRestProxy(__props, ["element", "index", "list"]);
  28776. let selectWidget = useVModel(props, "selectWidget");
  28777. const { userInfo = {} } = JSON.parse(sessionStorage.getItem("storeInfo") || "{}");
  28778. const handleDeleteClick = () => {
  28779. __props.list.splice(__props.index, 1);
  28780. selectWidget.value = __props.list[__props.list.length === __props.index ? __props.index - 1 : __props.index];
  28781. };
  28782. return (_ctx, _cache) => {
  28783. var _a2, _b2;
  28784. const _component_WidgetFormItem = resolveComponent("WidgetFormItem", true);
  28785. const _component_el_table_column = ElTableColumn;
  28786. const _component_el_table = ElTable;
  28787. const _component_el_divider = ElDivider;
  28788. const _component_el_input = ElInput;
  28789. const _component_el_input_number = ElInputNumber;
  28790. const _component_el_radio = ElRadio;
  28791. const _component_el_radio_group = ElRadioGroup;
  28792. const _component_el_checkbox = ElCheckbox;
  28793. const _component_el_checkbox_group = ElCheckboxGroup$1;
  28794. const _component_el_time_picker = ElTimePicker;
  28795. const _component_el_date_picker = ElDatePicker;
  28796. const _component_el_rate = ElRate;
  28797. const _component_el_option = ElOption;
  28798. const _component_el_select = ElSelect;
  28799. const _component_el_switch = ElSwitch;
  28800. const _component_el_slider = ElSlider;
  28801. const _component_el_image = ElImage;
  28802. const _component_el_button = ElButton;
  28803. const _component_el_upload = ElUpload;
  28804. const _component_el_cascader = ElCascader;
  28805. const _component_el_form_item = ElFormItem;
  28806. return openBlock(), createElementBlock("div", {
  28807. class: normalizeClass(["widget-view", { active: ((_a2 = selectWidget.value) == null ? void 0 : _a2.key) === __props.element.key, col: __props.element.type === "grid" }]),
  28808. style: normalizeStyle(__props.element.type === "grid" ? `gap: ${__props.element.options.gutter}px; align-items: ${__props.element.options.align};` : ""),
  28809. onClick: _cache[3] || (_cache[3] = withModifiers(($event) => selectWidget.value = __props.element, ["stop"]))
  28810. }, [
  28811. __props.element.type === "grid" ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(__props.element.columns, (col, key) => {
  28812. return openBlock(), createBlock(unref(Draggable), {
  28813. key,
  28814. class: "bg-white min-h-12 border border-dashed border-gray-300",
  28815. style: normalizeStyle(`grid-column: span ${col.span}`),
  28816. "item-key": "key",
  28817. handle: "[cursor-move]",
  28818. animation: 200,
  28819. group: "form-design",
  28820. "no-transition-on-drag": true,
  28821. list: col.list,
  28822. onAdd: ($event) => selectWidget.value = col.list[$event.newIndex]
  28823. }, {
  28824. item: withCtx(({ element: colElement, index: colIndex }) => [
  28825. createVNode(_component_WidgetFormItem, {
  28826. selectWidget: selectWidget.value,
  28827. "onUpdate:selectWidget": _cache[0] || (_cache[0] = ($event) => selectWidget.value = $event),
  28828. element: colElement,
  28829. list: col.list,
  28830. index: colIndex,
  28831. configurationItems: __props.configurationItems
  28832. }, null, 8, ["selectWidget", "element", "list", "index", "configurationItems"])
  28833. ]),
  28834. _: 2
  28835. }, 1032, ["style", "list", "onAdd"]);
  28836. }), 128)) : __props.element.type === "table" ? (openBlock(), createBlock(_component_el_table, {
  28837. key: 1,
  28838. class: "w-0 flex-1",
  28839. border: "",
  28840. data: __props.element.options.defaultValue
  28841. }, {
  28842. default: withCtx(() => [
  28843. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.columns, (i) => {
  28844. return openBlock(), createBlock(_component_el_table_column, mergeProps({
  28845. key: i.prop,
  28846. "header-align": __props.element.options.align,
  28847. align: __props.element.options.align
  28848. }, i), null, 16, ["header-align", "align"]);
  28849. }), 128))
  28850. ]),
  28851. _: 1
  28852. }, 8, ["data"])) : __props.element.type === "divider" ? (openBlock(), createBlock(_component_el_divider, {
  28853. key: 2,
  28854. class: "pb-0",
  28855. data: __props.element.options.defaultValue,
  28856. "content-position": "left"
  28857. }, {
  28858. default: withCtx(() => [
  28859. createTextVNode(toDisplayString(__props.element.label), 1)
  28860. ]),
  28861. _: 1
  28862. }, 8, ["data"])) : __props.element ? (openBlock(), createBlock(_component_el_form_item, {
  28863. key: __props.element.key,
  28864. label: __props.element.label,
  28865. "label-width": __props.element.labelWidth,
  28866. rules: __props.element.options.rules
  28867. }, {
  28868. default: withCtx(() => [
  28869. __props.element.type === "input" ? (openBlock(), createBlock(_component_el_input, {
  28870. key: 0,
  28871. readonly: "",
  28872. "model-value": __props.element.options.defaultValue,
  28873. style: normalizeStyle({ width: __props.element.options.width }),
  28874. placeholder: __props.element.options.placeholder,
  28875. maxlength: parseInt(__props.element.options.maxlength),
  28876. clearable: __props.element.options.clearable,
  28877. disabled: __props.element.options.disabled
  28878. }, createSlots({ _: 2 }, [
  28879. __props.element.options.prefix ? {
  28880. name: "prefix",
  28881. fn: withCtx(() => [
  28882. createTextVNode(toDisplayString(__props.element.options.prefix), 1)
  28883. ])
  28884. } : void 0,
  28885. __props.element.options.suffix ? {
  28886. name: "suffix",
  28887. fn: withCtx(() => [
  28888. createTextVNode(toDisplayString(__props.element.options.suffix), 1)
  28889. ])
  28890. } : void 0,
  28891. __props.element.options.prepend ? {
  28892. name: "prepend",
  28893. fn: withCtx(() => [
  28894. createTextVNode(toDisplayString(__props.element.options.prepend), 1)
  28895. ])
  28896. } : void 0,
  28897. __props.element.options.append ? {
  28898. name: "append",
  28899. fn: withCtx(() => [
  28900. createTextVNode(toDisplayString(__props.element.options.append), 1)
  28901. ])
  28902. } : void 0
  28903. ]), 1032, ["model-value", "style", "placeholder", "maxlength", "clearable", "disabled"])) : createCommentVNode("", true),
  28904. __props.element.type === "password" ? (openBlock(), createBlock(_component_el_input, {
  28905. key: 1,
  28906. readonly: "",
  28907. "model-value": __props.element.options.defaultValue,
  28908. style: normalizeStyle({ width: __props.element.options.width }),
  28909. placeholder: __props.element.options.placeholder,
  28910. maxlength: parseInt(__props.element.options.maxlength),
  28911. clearable: __props.element.options.clearable,
  28912. disabled: __props.element.options.disabled,
  28913. "show-password": __props.element.options.showPassword
  28914. }, createSlots({ _: 2 }, [
  28915. __props.element.options.prefix ? {
  28916. name: "prefix",
  28917. fn: withCtx(() => [
  28918. createTextVNode(toDisplayString(__props.element.options.prefix), 1)
  28919. ])
  28920. } : void 0,
  28921. __props.element.options.suffix ? {
  28922. name: "suffix",
  28923. fn: withCtx(() => [
  28924. createTextVNode(toDisplayString(__props.element.options.suffix), 1)
  28925. ])
  28926. } : void 0,
  28927. __props.element.options.prepend ? {
  28928. name: "prepend",
  28929. fn: withCtx(() => [
  28930. createTextVNode(toDisplayString(__props.element.options.prepend), 1)
  28931. ])
  28932. } : void 0,
  28933. __props.element.options.append ? {
  28934. name: "append",
  28935. fn: withCtx(() => [
  28936. createTextVNode(toDisplayString(__props.element.options.append), 1)
  28937. ])
  28938. } : void 0
  28939. ]), 1032, ["model-value", "style", "placeholder", "maxlength", "clearable", "disabled", "show-password"])) : createCommentVNode("", true),
  28940. __props.element.type === "textarea" ? (openBlock(), createBlock(_component_el_input, {
  28941. key: 2,
  28942. type: "textarea",
  28943. resize: "none",
  28944. readonly: "",
  28945. rows: __props.element.options.rows,
  28946. "model-value": __props.element.options.defaultValue,
  28947. style: normalizeStyle({ width: __props.element.options.width }),
  28948. placeholder: __props.element.options.placeholder,
  28949. maxlength: parseInt(__props.element.options.maxlength),
  28950. "show-word-limit": __props.element.options.showWordLimit,
  28951. autosize: __props.element.options.autosize,
  28952. clearable: __props.element.options.clearable,
  28953. disabled: __props.element.options.disabled
  28954. }, null, 8, ["rows", "model-value", "style", "placeholder", "maxlength", "show-word-limit", "autosize", "clearable", "disabled"])) : createCommentVNode("", true),
  28955. __props.element.type === "number" ? (openBlock(), createBlock(_component_el_input_number, {
  28956. key: 3,
  28957. "model-value": __props.element.options.defaultValue,
  28958. style: normalizeStyle({ width: __props.element.options.width }),
  28959. max: __props.element.options.max,
  28960. min: __props.element.options.min,
  28961. disabled: __props.element.options.disabled,
  28962. "controls-position": "right"
  28963. }, null, 8, ["model-value", "style", "max", "min", "disabled"])) : createCommentVNode("", true),
  28964. __props.element.type === "radio" ? (openBlock(), createBlock(_component_el_radio_group, {
  28965. key: 4,
  28966. "model-value": __props.element.options.defaultValue,
  28967. style: normalizeStyle({ width: __props.element.options.width }),
  28968. disabled: __props.element.options.disabled
  28969. }, {
  28970. default: withCtx(() => [
  28971. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.options.options, (item) => {
  28972. return openBlock(), createBlock(_component_el_radio, {
  28973. key: item.value,
  28974. label: item.value,
  28975. style: normalizeStyle({
  28976. display: __props.element.options.inline ? "inline-block" : "block"
  28977. })
  28978. }, {
  28979. default: withCtx(() => [
  28980. createTextVNode(toDisplayString(__props.element.options.showLabel ? item.label : item.value), 1)
  28981. ]),
  28982. _: 2
  28983. }, 1032, ["label", "style"]);
  28984. }), 128))
  28985. ]),
  28986. _: 1
  28987. }, 8, ["model-value", "style", "disabled"])) : createCommentVNode("", true),
  28988. __props.element.type === "checkbox" ? (openBlock(), createBlock(_component_el_checkbox_group, {
  28989. key: 5,
  28990. "model-value": __props.element.options.defaultValue,
  28991. style: normalizeStyle({ width: __props.element.options.width }),
  28992. disabled: __props.element.options.disabled
  28993. }, {
  28994. default: withCtx(() => [
  28995. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.options.options, (item) => {
  28996. return openBlock(), createBlock(_component_el_checkbox, {
  28997. key: item.value,
  28998. label: item.value,
  28999. style: normalizeStyle({
  29000. display: __props.element.options.inline ? "inline-block" : "block"
  29001. })
  29002. }, {
  29003. default: withCtx(() => [
  29004. createTextVNode(toDisplayString(__props.element.options.showLabel ? item.label : item.value), 1)
  29005. ]),
  29006. _: 2
  29007. }, 1032, ["label", "style"]);
  29008. }), 128))
  29009. ]),
  29010. _: 1
  29011. }, 8, ["model-value", "style", "disabled"])) : createCommentVNode("", true),
  29012. __props.element.type === "time" ? (openBlock(), createBlock(_component_el_time_picker, {
  29013. key: 6,
  29014. "model-value": __props.element.options.defaultValue,
  29015. placeholder: __props.element.options.placeholder,
  29016. readonly: __props.element.options.readonly,
  29017. editable: __props.element.options.editable,
  29018. clearable: __props.element.options.clearable,
  29019. format: __props.element.options.format,
  29020. disabled: __props.element.options.disabled,
  29021. style: normalizeStyle({ width: __props.element.options.width })
  29022. }, null, 8, ["model-value", "placeholder", "readonly", "editable", "clearable", "format", "disabled", "style"])) : createCommentVNode("", true),
  29023. __props.element.type === "date" ? (openBlock(), createBlock(_component_el_date_picker, {
  29024. key: 7,
  29025. "model-value": __props.element.options.defaultValue,
  29026. placeholder: __props.element.options.placeholder,
  29027. readonly: __props.element.options.readonly,
  29028. editable: __props.element.options.editable,
  29029. clearable: __props.element.options.clearable,
  29030. format: __props.element.options.format,
  29031. disabled: __props.element.options.disabled,
  29032. style: normalizeStyle({ width: __props.element.options.width })
  29033. }, null, 8, ["model-value", "placeholder", "readonly", "editable", "clearable", "format", "disabled", "style"])) : createCommentVNode("", true),
  29034. __props.element.type === "rate" ? (openBlock(), createBlock(_component_el_rate, {
  29035. key: 8,
  29036. "model-value": __props.element.options.defaultValue,
  29037. max: __props.element.options.max,
  29038. "allow-half": __props.element.options.allowHalf,
  29039. disabled: __props.element.options.disabled
  29040. }, null, 8, ["model-value", "max", "allow-half", "disabled"])) : createCommentVNode("", true),
  29041. __props.element.type === "select" ? (openBlock(), createElementBlock(Fragment, { key: 9 }, [
  29042. unref(userInfo).userNameNeedTranslate == 1 && __props.element.options.remoteFunc.indexOf("getSimpleActiveUserListNew") > -1 ? (openBlock(), createBlock(_sfc_main$9, {
  29043. key: 0,
  29044. "model-value": __props.element.options.defaultValue,
  29045. multiple: __props.element.options.multiple,
  29046. placeholder: __props.element.options.placeholder,
  29047. clearable: __props.element.options.clearable,
  29048. filterable: __props.element.options.filterable,
  29049. disabled: __props.element.options.disabled,
  29050. url: __props.element.options.remoteFunc,
  29051. size: __props.configurationItems.size,
  29052. options: [],
  29053. style: normalizeStyle({ width: __props.element.options.width })
  29054. }, null, 8, ["model-value", "multiple", "placeholder", "clearable", "filterable", "disabled", "url", "size", "style"])) : (openBlock(), createBlock(_component_el_select, {
  29055. key: 1,
  29056. "model-value": __props.element.options.defaultValue,
  29057. multiple: __props.element.options.multiple,
  29058. placeholder: __props.element.options.placeholder,
  29059. clearable: __props.element.options.clearable,
  29060. filterable: __props.element.options.filterable,
  29061. disabled: __props.element.options.disabled,
  29062. style: normalizeStyle({ width: __props.element.options.width })
  29063. }, {
  29064. default: withCtx(() => [
  29065. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.options.options, (item) => {
  29066. return openBlock(), createBlock(_component_el_option, {
  29067. key: item.value,
  29068. value: item.value,
  29069. label: __props.element.options.showLabel ? item.label : item.value
  29070. }, null, 8, ["value", "label"]);
  29071. }), 128))
  29072. ]),
  29073. _: 1
  29074. }, 8, ["model-value", "multiple", "placeholder", "clearable", "filterable", "disabled", "style"]))
  29075. ], 64)) : createCommentVNode("", true),
  29076. __props.element.type === "switch" ? (openBlock(), createBlock(_component_el_switch, {
  29077. key: 10,
  29078. "model-value": __props.element.options.defaultValue,
  29079. "active-text": __props.element.options.activeText,
  29080. "inactive-text": __props.element.options.inactiveText,
  29081. disabled: __props.element.options.disabled
  29082. }, null, 8, ["model-value", "active-text", "inactive-text", "disabled"])) : createCommentVNode("", true),
  29083. __props.element.type === "slider" ? (openBlock(), createBlock(_component_el_slider, {
  29084. key: 11,
  29085. "model-value": __props.element.options.defaultValue,
  29086. min: __props.element.options.min,
  29087. max: __props.element.options.max,
  29088. step: __props.element.options.step,
  29089. range: __props.element.options.range,
  29090. disabled: __props.element.options.disabled,
  29091. style: normalizeStyle({ width: __props.element.options.width })
  29092. }, null, 8, ["model-value", "min", "max", "step", "range", "disabled", "style"])) : createCommentVNode("", true),
  29093. __props.element.type == "text" ? (openBlock(), createElementBlock("span", _hoisted_1$4, toDisplayString(__props.element.options.defaultValue), 1)) : createCommentVNode("", true),
  29094. __props.element.type === "img-upload" ? (openBlock(), createBlock(_component_el_upload, {
  29095. key: 13,
  29096. name: __props.element.options.file,
  29097. action: __props.element.options.action,
  29098. accept: __props.element.options.accept,
  29099. "list-type": __props.element.options.listType,
  29100. multiple: __props.element.options.multiple,
  29101. limit: __props.element.options.limit,
  29102. disabled: __props.element.options.disabled
  29103. }, {
  29104. default: withCtx(() => {
  29105. var _a3;
  29106. return [
  29107. __props.element.options.listType === "picture-card" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  29108. ((_a3 = __props.element.options.defaultValue) == null ? void 0 : _a3.length) ? (openBlock(), createBlock(_component_el_image, {
  29109. key: 0,
  29110. style: { "width": "100%", "height": "100%" },
  29111. "preview-src-list": [
  29112. "/api/sys/common/static/" + __props.element.options.defaultValue
  29113. ],
  29114. src: "/api/sys/common/static/" + __props.element.options.defaultValue
  29115. }, null, 8, ["preview-src-list", "src"])) : (openBlock(), createElementBlock("i", _hoisted_2$3))
  29116. ], 64)) : (openBlock(), createBlock(_component_el_button, { key: 1 }, {
  29117. default: withCtx(() => [
  29118. _hoisted_3$3,
  29119. _hoisted_4$3
  29120. ]),
  29121. _: 1
  29122. }))
  29123. ];
  29124. }),
  29125. _: 1
  29126. }, 8, ["name", "action", "accept", "list-type", "multiple", "limit", "disabled"])) : createCommentVNode("", true),
  29127. __props.element.type === "download" ? (openBlock(), createBlock(_component_el_button, {
  29128. key: 14,
  29129. type: "text",
  29130. style: { "margin-top": "-4px" }
  29131. }, {
  29132. default: withCtx(() => [
  29133. _hoisted_5$3
  29134. ]),
  29135. _: 1
  29136. })) : createCommentVNode("", true),
  29137. __props.element.type === "cascader" ? (openBlock(), createBlock(_component_el_cascader, {
  29138. key: 15,
  29139. "model-value": __props.element.options.defaultValue,
  29140. options: __props.element.options.remoteOptions,
  29141. placeholder: __props.element.options.placeholder,
  29142. filterable: __props.element.options.filterable,
  29143. clearable: __props.element.options.clearable,
  29144. disabled: __props.element.options.disabled,
  29145. style: normalizeStyle({ width: __props.element.options.width })
  29146. }, null, 8, ["model-value", "options", "placeholder", "filterable", "clearable", "disabled", "style"])) : createCommentVNode("", true)
  29147. ]),
  29148. _: 1
  29149. }, 8, ["label", "label-width", "rules"])) : createCommentVNode("", true),
  29150. ((_b2 = selectWidget.value) == null ? void 0 : _b2.key) === __props.element.key ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [
  29151. createElementVNode("div", {
  29152. absolute: "",
  29153. "z-10": "",
  29154. "left-0": "",
  29155. top: "-.5",
  29156. "bg-blue-500": "",
  29157. "text-white": "",
  29158. p: ".5 l-0 t-0",
  29159. "cursor-move": "",
  29160. class: normalizeClass({ "bg-yellow-500": __props.element.type === "grid" })
  29161. }, _hoisted_7$2, 2),
  29162. createElementVNode("div", {
  29163. absolute: "",
  29164. "z-10": "",
  29165. "right-0": "",
  29166. bottom: "-0.5",
  29167. "bg-blue-500": "",
  29168. flex: "",
  29169. "gap-1": "",
  29170. p: "1 r-.5",
  29171. "text-white": "",
  29172. "cursor-pointer": "",
  29173. class: normalizeClass({ "bg-yellow-500": __props.element.type === "grid" })
  29174. }, [
  29175. createCommentVNode("", true),
  29176. !__props.element.allDisable ? (openBlock(), createElementBlock("i", {
  29177. key: 1,
  29178. class: "fa6-regular:trash-can",
  29179. onClick: _cache[2] || (_cache[2] = withModifiers(($event) => handleDeleteClick(), ["stop"]))
  29180. })) : createCommentVNode("", true)
  29181. ], 2)
  29182. ], 64)) : createCommentVNode("", true)
  29183. ], 6);
  29184. };
  29185. }
  29186. });
  29187. var WidgetForm_vue_vue_type_style_index_0_lang = "";
  29188. const _hoisted_1$3 = {
  29189. key: 0,
  29190. text: "gray-400 lg",
  29191. absolute: "",
  29192. "top-50": "",
  29193. left: "1/2",
  29194. "translate-x": "-1/2"
  29195. };
  29196. const _sfc_main$4 = /* @__PURE__ */ defineComponent({
  29197. props: {
  29198. list: null,
  29199. config: null,
  29200. selectWidget: null
  29201. },
  29202. emits: ["update:selectWidget"],
  29203. setup(__props) {
  29204. const props = __props;
  29205. const selectWidget = useVModel(props, "selectWidget");
  29206. return (_ctx, _cache) => {
  29207. const _component_el_form = ElForm;
  29208. return openBlock(), createBlock(_component_el_form, mergeProps({
  29209. "label-suffix": ":",
  29210. "bg-gray-50": "",
  29211. relative: "",
  29212. flex: "~ 1"
  29213. }, __props.config, { class: "layoutForm" }), {
  29214. default: withCtx(() => {
  29215. var _a2;
  29216. return [
  29217. !((_a2 = __props.list) == null ? void 0 : _a2.length) ? (openBlock(), createElementBlock("div", _hoisted_1$3, " \u4ECE\u5DE6\u4FA7\u62D6\u62FD\u6765\u6DFB\u52A0\u5B57\u6BB5 ")) : createCommentVNode("", true),
  29218. createVNode(unref(Draggable), {
  29219. class: "flex-1 m-2 bg-white shadow p-1",
  29220. "item-key": "key",
  29221. handle: "[cursor-move]",
  29222. animation: 200,
  29223. group: "form-design",
  29224. list: __props.list,
  29225. onAdd: _cache[1] || (_cache[1] = ($event) => selectWidget.value = __props.list[$event.newIndex])
  29226. }, {
  29227. item: withCtx(({ element, index }) => [
  29228. createVNode(_sfc_main$5, {
  29229. selectWidget: unref(selectWidget),
  29230. "onUpdate:selectWidget": _cache[0] || (_cache[0] = ($event) => isRef(selectWidget) ? selectWidget.value = $event : null),
  29231. element,
  29232. index,
  29233. list: __props.list,
  29234. configurationItems: __props.config
  29235. }, null, 8, ["selectWidget", "element", "index", "list", "configurationItems"])
  29236. ]),
  29237. _: 1
  29238. }, 8, ["list"])
  29239. ];
  29240. }),
  29241. _: 1
  29242. }, 16);
  29243. };
  29244. }
  29245. });
  29246. var elSpace = "";
  29247. var elRadioButton = "";
  29248. var WidgetConfig_vue_vue_type_style_index_0_lang = "";
  29249. const _sfc_main$3 = defineComponent({
  29250. name: "ElWidgetConfig",
  29251. components: {
  29252. Draggable
  29253. },
  29254. props: {
  29255. select: {
  29256. type: Object
  29257. }
  29258. },
  29259. emits: ["update:select"],
  29260. setup(props, context) {
  29261. const data2 = ref(props.select);
  29262. watch(() => props.select, (val) => data2.value = val);
  29263. watch(data2, (val) => context.emit("update:select", val), { deep: true });
  29264. const hasKey = (key) => Object.keys(data2.value.options).includes(key);
  29265. const handleInsertColumn = () => {
  29266. data2.value.columns.push({
  29267. span: 0,
  29268. list: []
  29269. });
  29270. };
  29271. const handleInsertOption = () => {
  29272. const index = data2.value.options.options.length + 1;
  29273. data2.value.options.options.push({
  29274. label: `Option ${index}`,
  29275. value: `Option ${index}`
  29276. });
  29277. };
  29278. const handleOptionsRemove = (index) => {
  29279. if (data2.value.type === "grid")
  29280. data2.value.columns.splice(index, 1);
  29281. else
  29282. data2.value.options.options.splice(index, 1);
  29283. };
  29284. const handleSliderModeChange = (checked) => {
  29285. checked ? data2.value.options.defaultValue = [10, 90] : data2.value.options.defaultValue = 0;
  29286. };
  29287. const handleSelectModeChange = (val) => {
  29288. if (data2.value.type === "img-upload")
  29289. return;
  29290. if (val) {
  29291. if (data2.value.options.defaultValue) {
  29292. if (!(data2.value.options.defaultValue instanceof Array))
  29293. data2.value.options.defaultValue = [data2.value.options.defaultValue];
  29294. } else {
  29295. data2.value.options.defaultValue = [];
  29296. }
  29297. } else {
  29298. data2.value.options.defaultValue.length ? data2.value.options.defaultValue = data2.value.options.defaultValue[0] : data2.value.options.defaultValue = null;
  29299. }
  29300. };
  29301. return {
  29302. data: data2,
  29303. hasKey,
  29304. handleInsertColumn,
  29305. handleInsertOption,
  29306. handleOptionsRemove,
  29307. handleSliderModeChange,
  29308. handleSelectModeChange
  29309. };
  29310. }
  29311. });
  29312. const _hoisted_1$2 = /* @__PURE__ */ createTextVNode(" \u884C\u5185 ");
  29313. const _hoisted_2$2 = /* @__PURE__ */ createTextVNode(" \u5757\u7EA7 ");
  29314. const _hoisted_3$2 = /* @__PURE__ */ createTextVNode(" \u9759\u6001\u6570\u636E ");
  29315. const _hoisted_4$2 = /* @__PURE__ */ createTextVNode(" \u8FDC\u7AEF\u6570\u636E ");
  29316. const _hoisted_5$2 = /* @__PURE__ */ createTextVNode(" \u8FDC\u7AEF\u65B9\u6CD5 ");
  29317. const _hoisted_6$2 = /* @__PURE__ */ createTextVNode(" \u6807\u7B7E ");
  29318. const _hoisted_7$1 = /* @__PURE__ */ createTextVNode(" \u503C ");
  29319. const _hoisted_8$1 = { class: "flex items-center" };
  29320. const _hoisted_9$1 = /* @__PURE__ */ createElementVNode("i", {
  29321. style: { "margin": "0 5px", "cursor": "move" },
  29322. class: "drag-item custom:item"
  29323. }, null, -1);
  29324. const _hoisted_10$1 = /* @__PURE__ */ createElementVNode("i", { class: "fa6-regular:trash-can" }, null, -1);
  29325. const _hoisted_11$1 = { class: "flex items-center justify-center gap-2 mb-2" };
  29326. const _hoisted_12$1 = /* @__PURE__ */ createTextVNode(/* @__PURE__ */ toDisplayString(""));
  29327. const _hoisted_13$1 = /* @__PURE__ */ createElementVNode("i", { class: "cursor-move text-sm custom:item" }, null, -1);
  29328. const _hoisted_14$1 = /* @__PURE__ */ createElementVNode("i", { class: "fa6-regular:trash-can" }, null, -1);
  29329. const _hoisted_15 = { style: { "margin-top": "5px" } };
  29330. const _hoisted_16 = /* @__PURE__ */ createTextVNode(" \u6DFB\u52A0\u9009\u9879 ");
  29331. const _hoisted_17 = /* @__PURE__ */ createTextVNode(" text ");
  29332. const _hoisted_18 = /* @__PURE__ */ createTextVNode(" picture ");
  29333. const _hoisted_19 = /* @__PURE__ */ createTextVNode(" picture-card ");
  29334. const _hoisted_20 = /* @__PURE__ */ createTextVNode(" POST ");
  29335. const _hoisted_21 = /* @__PURE__ */ createTextVNode(" PUT ");
  29336. const _hoisted_22 = /* @__PURE__ */ createTextVNode(" GET ");
  29337. const _hoisted_23 = /* @__PURE__ */ createTextVNode(" DELETE ");
  29338. const _hoisted_24 = /* @__PURE__ */ createTextVNode(" \u8FDC\u7AEF\u65B9\u6CD5 ");
  29339. const _hoisted_25 = /* @__PURE__ */ createTextVNode(" \u6807\u7B7E ");
  29340. const _hoisted_26 = /* @__PURE__ */ createTextVNode(" \u503C ");
  29341. const _hoisted_27 = /* @__PURE__ */ createTextVNode(" \u5B50\u9009\u9879 ");
  29342. const _hoisted_28 = { style: { "display": "flex", "gap": "5px", "margin-bottom": "5px" } };
  29343. const _hoisted_29 = /* @__PURE__ */ createElementVNode("i", { class: "drag-item custom:item" }, null, -1);
  29344. const _hoisted_30 = /* @__PURE__ */ createElementVNode("i", { class: "fa6-regular:trash-can" }, null, -1);
  29345. const _hoisted_31 = /* @__PURE__ */ createTextVNode(" \u6DFB\u52A0\u5217 ");
  29346. const _hoisted_32 = /* @__PURE__ */ createTextVNode(" \u5C45\u5DE6\u5BF9\u9F50 ");
  29347. const _hoisted_33 = /* @__PURE__ */ createTextVNode(" \u5C45\u4E2D\u5BF9\u9F50 ");
  29348. const _hoisted_34 = /* @__PURE__ */ createTextVNode(" \u5DE8\u53F3\u5BF9\u9F50 ");
  29349. const _hoisted_35 = { style: { "margin-bottom": "5px" } };
  29350. const _hoisted_36 = /* @__PURE__ */ createElementVNode("i", { class: "drag-item custom:item" }, null, -1);
  29351. const _hoisted_37 = /* @__PURE__ */ createElementVNode("i", { class: "fa6-regular:trash-can" }, null, -1);
  29352. const _hoisted_38 = /* @__PURE__ */ createTextVNode(" \u6DFB\u52A0\u5217 ");
  29353. const _hoisted_39 = /* @__PURE__ */ createTextVNode(" \u9876\u90E8\u5BF9\u9F50 ");
  29354. const _hoisted_40 = /* @__PURE__ */ createTextVNode(" \u5C45\u4E2D\u5BF9\u9F50 ");
  29355. const _hoisted_41 = /* @__PURE__ */ createTextVNode(" \u5E95\u90E8\u5BF9\u9F50 ");
  29356. const _hoisted_42 = /* @__PURE__ */ createTextVNode(" \u5FC5\u586B ");
  29357. const _hoisted_43 = /* @__PURE__ */ createTextVNode(" \u53EA\u8BFB ");
  29358. const _hoisted_44 = /* @__PURE__ */ createTextVNode(" \u7981\u7528 ");
  29359. const _hoisted_45 = /* @__PURE__ */ createTextVNode(" \u6E05\u9664 ");
  29360. const _hoisted_46 = /* @__PURE__ */ createElementVNode("h4", { class: "pb-2 text-gray-700 border-0 border-b-1 border-gray-200" }, " \u9A8C\u8BC1\u89C4\u5219 ", -1);
  29361. const _hoisted_47 = /* @__PURE__ */ createTextVNode(" Blur ");
  29362. const _hoisted_48 = /* @__PURE__ */ createTextVNode(" Change ");
  29363. const _hoisted_49 = /* @__PURE__ */ createTextVNode(" \u5B57\u7B26\u4E32 ");
  29364. const _hoisted_50 = /* @__PURE__ */ createTextVNode(" \u6570\u5B57 ");
  29365. const _hoisted_51 = /* @__PURE__ */ createTextVNode(" \u5E03\u5C14\u503C ");
  29366. const _hoisted_52 = /* @__PURE__ */ createTextVNode(" \u65B9\u6CD5 ");
  29367. const _hoisted_53 = /* @__PURE__ */ createTextVNode(" \u6B63\u5219\u8868\u8FBE\u5F0F ");
  29368. const _hoisted_54 = /* @__PURE__ */ createTextVNode(" \u6574\u6570 ");
  29369. const _hoisted_55 = /* @__PURE__ */ createTextVNode(" \u6D6E\u70B9\u6570 ");
  29370. const _hoisted_56 = /* @__PURE__ */ createTextVNode(" \u6570\u7EC4 ");
  29371. const _hoisted_57 = /* @__PURE__ */ createTextVNode(" \u5BF9\u8C61 ");
  29372. const _hoisted_58 = /* @__PURE__ */ createTextVNode(" \u679A\u4E3E ");
  29373. const _hoisted_59 = /* @__PURE__ */ createTextVNode(" \u65E5\u671F ");
  29374. const _hoisted_60 = /* @__PURE__ */ createTextVNode(" URL\u5730\u5740 ");
  29375. const _hoisted_61 = /* @__PURE__ */ createTextVNode(" \u5341\u516D\u8FDB\u5236 ");
  29376. const _hoisted_62 = /* @__PURE__ */ createTextVNode(" \u90AE\u7BB1\u5730\u5740 ");
  29377. const _hoisted_63 = /* @__PURE__ */ createTextVNode(" \u4EFB\u610F\u7C7B\u578B ");
  29378. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  29379. const _component_el_input = ElInput;
  29380. const _component_el_form_item = ElFormItem;
  29381. const _component_el_rate = ElRate;
  29382. const _component_el_switch = ElSwitch;
  29383. const _component_el_input_number = ElInputNumber;
  29384. const _component_el_radio_button = ElRadioButton;
  29385. const _component_el_radio_group = ElRadioGroup;
  29386. const _component_el_space = ElSpace;
  29387. const _component_el_radio = ElRadio;
  29388. const _component_el_button = ElButton;
  29389. const _component_Draggable = resolveComponent("Draggable");
  29390. const _component_el_checkbox = ElCheckbox;
  29391. const _component_el_checkbox_group = ElCheckboxGroup$1;
  29392. const _component_el_time_picker = ElTimePicker;
  29393. const _component_el_date_picker = ElDatePicker;
  29394. const _component_el_option = ElOption;
  29395. const _component_el_select = ElSelect;
  29396. const _component_el_form = ElForm;
  29397. return _ctx.data ? (openBlock(), createBlock(_component_el_form, {
  29398. key: _ctx.data.key,
  29399. "label-position": "top",
  29400. "p-2": "",
  29401. "flex-1": "",
  29402. "overflow-auto": ""
  29403. }, {
  29404. default: withCtx(() => [
  29405. !["grid"].includes(_ctx.data.type) ? (openBlock(), createBlock(_component_el_form_item, {
  29406. key: 0,
  29407. label: "\u5B57\u6BB5\u6807\u8BC6"
  29408. }, {
  29409. default: withCtx(() => [
  29410. createVNode(_component_el_input, {
  29411. modelValue: _ctx.data.model,
  29412. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.data.model = $event),
  29413. disabled: true
  29414. }, null, 8, ["modelValue"])
  29415. ]),
  29416. _: 1
  29417. })) : createCommentVNode("", true),
  29418. !["grid", "table"].includes(_ctx.data.type) ? (openBlock(), createBlock(_component_el_form_item, {
  29419. key: 1,
  29420. label: "\u6807\u9898"
  29421. }, {
  29422. default: withCtx(() => [
  29423. createVNode(_component_el_input, {
  29424. modelValue: _ctx.data.label,
  29425. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.data.label = $event),
  29426. disabled: _ctx.data.allDisable
  29427. }, null, 8, ["modelValue", "disabled"])
  29428. ]),
  29429. _: 1
  29430. })) : createCommentVNode("", true),
  29431. _ctx.hasKey("width") ? (openBlock(), createBlock(_component_el_form_item, {
  29432. key: 2,
  29433. label: "\u5BBD\u5EA6"
  29434. }, {
  29435. default: withCtx(() => [
  29436. createVNode(_component_el_input, {
  29437. modelValue: _ctx.data.options.width,
  29438. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => _ctx.data.options.width = $event)
  29439. }, null, 8, ["modelValue"])
  29440. ]),
  29441. _: 1
  29442. })) : createCommentVNode("", true),
  29443. _ctx.hasKey("placeholder") ? (openBlock(), createBlock(_component_el_form_item, {
  29444. key: 3,
  29445. label: "\u5360\u4F4D\u5185\u5BB9"
  29446. }, {
  29447. default: withCtx(() => [
  29448. createVNode(_component_el_input, {
  29449. modelValue: _ctx.data.options.placeholder,
  29450. "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => _ctx.data.options.placeholder = $event),
  29451. disabled: _ctx.data.allDisable
  29452. }, null, 8, ["modelValue", "disabled"])
  29453. ]),
  29454. _: 1
  29455. })) : createCommentVNode("", true),
  29456. _ctx.hasKey("defaultValue") && (_ctx.data.type === "input" || _ctx.data.type === "password" || _ctx.data.type === "textarea" || _ctx.data.type === "text" || _ctx.data.type === "rate" || _ctx.data.type === "switch" || _ctx.data.type === "slider") ? (openBlock(), createBlock(_component_el_form_item, {
  29457. key: 4,
  29458. label: "\u9ED8\u8BA4\u5185\u5BB9"
  29459. }, {
  29460. default: withCtx(() => [
  29461. _ctx.data.type === "input" || _ctx.data.type === "password" || _ctx.data.type === "text" ? (openBlock(), createBlock(_component_el_input, {
  29462. key: 0,
  29463. modelValue: _ctx.data.options.defaultValue,
  29464. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => _ctx.data.options.defaultValue = $event)
  29465. }, null, 8, ["modelValue"])) : createCommentVNode("", true),
  29466. _ctx.data.type === "textarea" ? (openBlock(), createBlock(_component_el_input, {
  29467. key: 1,
  29468. modelValue: _ctx.data.options.defaultValue,
  29469. "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => _ctx.data.options.defaultValue = $event),
  29470. type: "textarea"
  29471. }, null, 8, ["modelValue"])) : createCommentVNode("", true),
  29472. _ctx.data.type === "rate" ? (openBlock(), createBlock(_component_el_rate, {
  29473. key: 2,
  29474. modelValue: _ctx.data.options.defaultValue,
  29475. "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => _ctx.data.options.defaultValue = $event),
  29476. max: _ctx.data.options.max,
  29477. "allow-half": _ctx.data.options.allowHalf
  29478. }, null, 8, ["modelValue", "max", "allow-half"])) : createCommentVNode("", true),
  29479. _ctx.data.type === "switch" ? (openBlock(), createBlock(_component_el_switch, {
  29480. key: 3,
  29481. modelValue: _ctx.data.options.defaultValue,
  29482. "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => _ctx.data.options.defaultValue = $event)
  29483. }, null, 8, ["modelValue"])) : createCommentVNode("", true),
  29484. _ctx.data.type === "slider" ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [
  29485. !_ctx.data.options.range ? (openBlock(), createBlock(_component_el_input_number, {
  29486. key: 0,
  29487. modelValue: _ctx.data.options.defaultValue,
  29488. "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => _ctx.data.options.defaultValue = $event),
  29489. modelModifiers: { number: true }
  29490. }, null, 8, ["modelValue"])) : createCommentVNode("", true),
  29491. _ctx.data.options.range ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  29492. createVNode(_component_el_input_number, {
  29493. modelValue: _ctx.data.options.defaultValue[0],
  29494. "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => _ctx.data.options.defaultValue[0] = $event),
  29495. modelModifiers: { number: true },
  29496. max: _ctx.data.options.max
  29497. }, null, 8, ["modelValue", "max"]),
  29498. createVNode(_component_el_input_number, {
  29499. modelValue: _ctx.data.options.defaultValue[1],
  29500. "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => _ctx.data.options.defaultValue[1] = $event),
  29501. modelModifiers: { number: true },
  29502. max: _ctx.data.options.max
  29503. }, null, 8, ["modelValue", "max"])
  29504. ], 64)) : createCommentVNode("", true)
  29505. ], 64)) : createCommentVNode("", true)
  29506. ]),
  29507. _: 1
  29508. })) : createCommentVNode("", true),
  29509. _ctx.hasKey("maxlength") ? (openBlock(), createBlock(_component_el_form_item, {
  29510. key: 5,
  29511. label: "\u6700\u5927\u957F\u5EA6"
  29512. }, {
  29513. default: withCtx(() => [
  29514. createVNode(_component_el_input, {
  29515. modelValue: _ctx.data.options.maxlength,
  29516. "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => _ctx.data.options.maxlength = $event),
  29517. modelModifiers: { number: true },
  29518. disabled: _ctx.data.allDisable
  29519. }, null, 8, ["modelValue", "disabled"])
  29520. ]),
  29521. _: 1
  29522. })) : createCommentVNode("", true),
  29523. _ctx.hasKey("max") ? (openBlock(), createBlock(_component_el_form_item, {
  29524. key: 6,
  29525. label: "\u6700\u5927\u503C"
  29526. }, {
  29527. default: withCtx(() => [
  29528. createVNode(_component_el_input_number, {
  29529. modelValue: _ctx.data.options.max,
  29530. "onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => _ctx.data.options.max = $event),
  29531. modelModifiers: { number: true },
  29532. disabled: _ctx.data.allDisable
  29533. }, null, 8, ["modelValue", "disabled"])
  29534. ]),
  29535. _: 1
  29536. })) : createCommentVNode("", true),
  29537. _ctx.hasKey("min") ? (openBlock(), createBlock(_component_el_form_item, {
  29538. key: 7,
  29539. label: "\u6700\u5C0F\u503C"
  29540. }, {
  29541. default: withCtx(() => [
  29542. createVNode(_component_el_input_number, {
  29543. modelValue: _ctx.data.options.min,
  29544. "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => _ctx.data.options.min = $event),
  29545. modelModifiers: { number: true },
  29546. disabled: _ctx.data.allDisable
  29547. }, null, 8, ["modelValue", "disabled"])
  29548. ]),
  29549. _: 1
  29550. })) : createCommentVNode("", true),
  29551. _ctx.hasKey("step") ? (openBlock(), createBlock(_component_el_form_item, {
  29552. key: 8,
  29553. label: "\u6B65\u957F"
  29554. }, {
  29555. default: withCtx(() => [
  29556. createVNode(_component_el_input_number, {
  29557. modelValue: _ctx.data.options.step,
  29558. "onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => _ctx.data.options.step = $event),
  29559. modelModifiers: { number: true },
  29560. min: 0,
  29561. disabled: _ctx.data.allDisable
  29562. }, null, 8, ["modelValue", "disabled"])
  29563. ]),
  29564. _: 1
  29565. })) : createCommentVNode("", true),
  29566. _ctx.hasKey("prefix") ? (openBlock(), createBlock(_component_el_form_item, {
  29567. key: 9,
  29568. label: "\u524D\u7F00"
  29569. }, {
  29570. default: withCtx(() => [
  29571. createVNode(_component_el_input, {
  29572. modelValue: _ctx.data.options.prefix,
  29573. "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => _ctx.data.options.prefix = $event),
  29574. disabled: _ctx.data.allDisable
  29575. }, null, 8, ["modelValue", "disabled"])
  29576. ]),
  29577. _: 1
  29578. })) : createCommentVNode("", true),
  29579. _ctx.hasKey("suffix") ? (openBlock(), createBlock(_component_el_form_item, {
  29580. key: 10,
  29581. label: "\u540E\u7F00"
  29582. }, {
  29583. default: withCtx(() => [
  29584. createVNode(_component_el_input, {
  29585. modelValue: _ctx.data.options.suffix,
  29586. "onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => _ctx.data.options.suffix = $event),
  29587. disabled: _ctx.data.allDisable
  29588. }, null, 8, ["modelValue", "disabled"])
  29589. ]),
  29590. _: 1
  29591. })) : createCommentVNode("", true),
  29592. _ctx.hasKey("prepend") ? (openBlock(), createBlock(_component_el_form_item, {
  29593. key: 11,
  29594. label: "\u524D\u7F6E\u6807\u7B7E"
  29595. }, {
  29596. default: withCtx(() => [
  29597. createVNode(_component_el_input, {
  29598. modelValue: _ctx.data.options.prepend,
  29599. "onUpdate:modelValue": _cache[17] || (_cache[17] = ($event) => _ctx.data.options.prepend = $event),
  29600. disabled: _ctx.data.allDisable
  29601. }, null, 8, ["modelValue", "disabled"])
  29602. ]),
  29603. _: 1
  29604. })) : createCommentVNode("", true),
  29605. _ctx.hasKey("append") ? (openBlock(), createBlock(_component_el_form_item, {
  29606. key: 12,
  29607. label: "\u540E\u7F6E\u6807\u7B7E"
  29608. }, {
  29609. default: withCtx(() => [
  29610. createVNode(_component_el_input, {
  29611. modelValue: _ctx.data.options.append,
  29612. "onUpdate:modelValue": _cache[18] || (_cache[18] = ($event) => _ctx.data.options.append = $event),
  29613. disabled: _ctx.data.allDisable
  29614. }, null, 8, ["modelValue", "disabled"])
  29615. ]),
  29616. _: 1
  29617. })) : createCommentVNode("", true),
  29618. _ctx.hasKey("activeText") ? (openBlock(), createBlock(_component_el_form_item, {
  29619. key: 13,
  29620. label: "\u9009\u4E2D\u65F6\u7684\u5185\u5BB9"
  29621. }, {
  29622. default: withCtx(() => [
  29623. createVNode(_component_el_input, {
  29624. modelValue: _ctx.data.options.activeText,
  29625. "onUpdate:modelValue": _cache[19] || (_cache[19] = ($event) => _ctx.data.options.activeText = $event)
  29626. }, null, 8, ["modelValue"])
  29627. ]),
  29628. _: 1
  29629. })) : createCommentVNode("", true),
  29630. _ctx.hasKey("inactiveText") ? (openBlock(), createBlock(_component_el_form_item, {
  29631. key: 14,
  29632. label: "\u975E\u9009\u4E2D\u65F6\u7684\u5185\u5BB9"
  29633. }, {
  29634. default: withCtx(() => [
  29635. createVNode(_component_el_input, {
  29636. modelValue: _ctx.data.options.inactiveText,
  29637. "onUpdate:modelValue": _cache[20] || (_cache[20] = ($event) => _ctx.data.options.inactiveText = $event)
  29638. }, null, 8, ["modelValue"])
  29639. ]),
  29640. _: 1
  29641. })) : createCommentVNode("", true),
  29642. _ctx.hasKey("editable") ? (openBlock(), createBlock(_component_el_form_item, {
  29643. key: 15,
  29644. label: "\u6587\u672C\u6846\u53EF\u8F93\u5165"
  29645. }, {
  29646. default: withCtx(() => [
  29647. createVNode(_component_el_switch, {
  29648. modelValue: _ctx.data.options.editable,
  29649. "onUpdate:modelValue": _cache[21] || (_cache[21] = ($event) => _ctx.data.options.editable = $event)
  29650. }, null, 8, ["modelValue"])
  29651. ]),
  29652. _: 1
  29653. })) : createCommentVNode("", true),
  29654. _ctx.hasKey("range") ? (openBlock(), createBlock(_component_el_form_item, {
  29655. key: 16,
  29656. label: "\u8303\u56F4\u9009\u62E9"
  29657. }, {
  29658. default: withCtx(() => [
  29659. createVNode(_component_el_switch, {
  29660. modelValue: _ctx.data.options.range,
  29661. "onUpdate:modelValue": _cache[22] || (_cache[22] = ($event) => _ctx.data.options.range = $event),
  29662. onChange: _ctx.handleSliderModeChange
  29663. }, null, 8, ["modelValue", "onChange"])
  29664. ]),
  29665. _: 1
  29666. })) : createCommentVNode("", true),
  29667. _ctx.hasKey("showPassword") ? (openBlock(), createBlock(_component_el_form_item, {
  29668. key: 17,
  29669. label: "\u662F\u5426\u663E\u793A\u5207\u6362\u6309\u94AE"
  29670. }, {
  29671. default: withCtx(() => [
  29672. createVNode(_component_el_switch, {
  29673. modelValue: _ctx.data.options.showPassword,
  29674. "onUpdate:modelValue": _cache[23] || (_cache[23] = ($event) => _ctx.data.options.showPassword = $event)
  29675. }, null, 8, ["modelValue"])
  29676. ]),
  29677. _: 1
  29678. })) : createCommentVNode("", true),
  29679. _ctx.hasKey("showWordLimit") ? (openBlock(), createBlock(_component_el_form_item, {
  29680. key: 18,
  29681. label: "\u662F\u5426\u663E\u793A\u5B57\u6570"
  29682. }, {
  29683. default: withCtx(() => [
  29684. createVNode(_component_el_switch, {
  29685. modelValue: _ctx.data.options.showWordLimit,
  29686. "onUpdate:modelValue": _cache[24] || (_cache[24] = ($event) => _ctx.data.options.showWordLimit = $event)
  29687. }, null, 8, ["modelValue"])
  29688. ]),
  29689. _: 1
  29690. })) : createCommentVNode("", true),
  29691. _ctx.hasKey("autosize") ? (openBlock(), createBlock(_component_el_form_item, {
  29692. key: 19,
  29693. label: "\u662F\u5426\u81EA\u9002\u5E94\u5185\u5BB9\u9AD8\u5EA6"
  29694. }, {
  29695. default: withCtx(() => [
  29696. createVNode(_component_el_switch, {
  29697. modelValue: _ctx.data.options.autosize,
  29698. "onUpdate:modelValue": _cache[25] || (_cache[25] = ($event) => _ctx.data.options.autosize = $event)
  29699. }, null, 8, ["modelValue"])
  29700. ]),
  29701. _: 1
  29702. })) : createCommentVNode("", true),
  29703. _ctx.hasKey("rows") && !_ctx.data.options.autosize ? (openBlock(), createBlock(_component_el_form_item, {
  29704. key: 20,
  29705. label: "\u884C\u6570"
  29706. }, {
  29707. default: withCtx(() => [
  29708. createVNode(_component_el_input_number, {
  29709. modelValue: _ctx.data.options.rows,
  29710. "onUpdate:modelValue": _cache[26] || (_cache[26] = ($event) => _ctx.data.options.rows = $event),
  29711. min: 0
  29712. }, null, 8, ["modelValue"])
  29713. ]),
  29714. _: 1
  29715. })) : createCommentVNode("", true),
  29716. _ctx.hasKey("allowHalf") ? (openBlock(), createBlock(_component_el_form_item, {
  29717. key: 21,
  29718. label: "\u662F\u5426\u5141\u8BB8\u534A\u9009"
  29719. }, {
  29720. default: withCtx(() => [
  29721. createVNode(_component_el_switch, {
  29722. modelValue: _ctx.data.options.allowHalf,
  29723. "onUpdate:modelValue": _cache[27] || (_cache[27] = ($event) => _ctx.data.options.allowHalf = $event)
  29724. }, null, 8, ["modelValue"])
  29725. ]),
  29726. _: 1
  29727. })) : createCommentVNode("", true),
  29728. _ctx.hasKey("inline") ? (openBlock(), createBlock(_component_el_form_item, {
  29729. key: 22,
  29730. label: "\u5E03\u5C40\u65B9\u5F0F"
  29731. }, {
  29732. default: withCtx(() => [
  29733. createVNode(_component_el_radio_group, {
  29734. modelValue: _ctx.data.options.inline,
  29735. "onUpdate:modelValue": _cache[28] || (_cache[28] = ($event) => _ctx.data.options.inline = $event)
  29736. }, {
  29737. default: withCtx(() => [
  29738. createVNode(_component_el_radio_button, { label: true }, {
  29739. default: withCtx(() => [
  29740. _hoisted_1$2
  29741. ]),
  29742. _: 1
  29743. }),
  29744. createVNode(_component_el_radio_button, { label: false }, {
  29745. default: withCtx(() => [
  29746. _hoisted_2$2
  29747. ]),
  29748. _: 1
  29749. })
  29750. ]),
  29751. _: 1
  29752. }, 8, ["modelValue"])
  29753. ]),
  29754. _: 1
  29755. })) : createCommentVNode("", true),
  29756. _ctx.hasKey("multiple") ? (openBlock(), createBlock(_component_el_form_item, {
  29757. key: 23,
  29758. label: "\u662F\u5426\u591A\u9009"
  29759. }, {
  29760. default: withCtx(() => [
  29761. createVNode(_component_el_switch, {
  29762. modelValue: _ctx.data.options.multiple,
  29763. "onUpdate:modelValue": _cache[29] || (_cache[29] = ($event) => _ctx.data.options.multiple = $event),
  29764. onChange: _ctx.handleSelectModeChange,
  29765. disabled: _ctx.data.allDisable
  29766. }, null, 8, ["modelValue", "onChange", "disabled"])
  29767. ]),
  29768. _: 1
  29769. })) : createCommentVNode("", true),
  29770. _ctx.hasKey("filterable") ? (openBlock(), createBlock(_component_el_form_item, {
  29771. key: 24,
  29772. label: "\u662F\u5426\u53EF\u641C\u7D22"
  29773. }, {
  29774. default: withCtx(() => [
  29775. createVNode(_component_el_switch, {
  29776. modelValue: _ctx.data.options.filterable,
  29777. "onUpdate:modelValue": _cache[30] || (_cache[30] = ($event) => _ctx.data.options.filterable = $event),
  29778. disabled: _ctx.data.allDisable
  29779. }, null, 8, ["modelValue", "disabled"])
  29780. ]),
  29781. _: 1
  29782. })) : createCommentVNode("", true),
  29783. _ctx.hasKey("showLabel") ? (openBlock(), createBlock(_component_el_form_item, {
  29784. key: 25,
  29785. label: "\u662F\u5426\u663E\u793A\u6807\u7B7E"
  29786. }, {
  29787. default: withCtx(() => [
  29788. createVNode(_component_el_switch, {
  29789. modelValue: _ctx.data.options.showLabel,
  29790. "onUpdate:modelValue": _cache[31] || (_cache[31] = ($event) => _ctx.data.options.showLabel = $event)
  29791. }, null, 8, ["modelValue"])
  29792. ]),
  29793. _: 1
  29794. })) : createCommentVNode("", true),
  29795. _ctx.hasKey("options") ? (openBlock(), createBlock(_component_el_form_item, {
  29796. key: 26,
  29797. label: "\u9009\u9879"
  29798. }, {
  29799. default: withCtx(() => [
  29800. createVNode(_component_el_radio_group, {
  29801. modelValue: _ctx.data.options.remote,
  29802. "onUpdate:modelValue": _cache[32] || (_cache[32] = ($event) => _ctx.data.options.remote = $event)
  29803. }, {
  29804. default: withCtx(() => [
  29805. createVNode(_component_el_radio_button, { label: false }, {
  29806. default: withCtx(() => [
  29807. _hoisted_3$2
  29808. ]),
  29809. _: 1
  29810. }),
  29811. createVNode(_component_el_radio_button, { label: true }, {
  29812. default: withCtx(() => [
  29813. _hoisted_4$2
  29814. ]),
  29815. _: 1
  29816. })
  29817. ]),
  29818. _: 1
  29819. }, 8, ["modelValue"]),
  29820. _ctx.data.options.remote ? (openBlock(), createBlock(_component_el_space, {
  29821. key: 0,
  29822. alignment: "start",
  29823. direction: "vertical",
  29824. style: { "margin-top": "10px" }
  29825. }, {
  29826. default: withCtx(() => [
  29827. createVNode(_component_el_input, {
  29828. modelValue: _ctx.data.options.remoteFunc,
  29829. "onUpdate:modelValue": _cache[33] || (_cache[33] = ($event) => _ctx.data.options.remoteFunc = $event)
  29830. }, {
  29831. prepend: withCtx(() => [
  29832. _hoisted_5$2
  29833. ]),
  29834. _: 1
  29835. }, 8, ["modelValue"]),
  29836. createVNode(_component_el_input, {
  29837. modelValue: _ctx.data.options.props.label,
  29838. "onUpdate:modelValue": _cache[34] || (_cache[34] = ($event) => _ctx.data.options.props.label = $event)
  29839. }, {
  29840. prepend: withCtx(() => [
  29841. _hoisted_6$2
  29842. ]),
  29843. _: 1
  29844. }, 8, ["modelValue"]),
  29845. createVNode(_component_el_input, {
  29846. modelValue: _ctx.data.options.props.value,
  29847. "onUpdate:modelValue": _cache[35] || (_cache[35] = ($event) => _ctx.data.options.props.value = $event)
  29848. }, {
  29849. prepend: withCtx(() => [
  29850. _hoisted_7$1
  29851. ]),
  29852. _: 1
  29853. }, 8, ["modelValue"])
  29854. ]),
  29855. _: 1
  29856. })) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  29857. _ctx.data.type === "radio" || _ctx.data.type === "select" && !_ctx.data.options.multiple ? (openBlock(), createBlock(_component_el_radio_group, {
  29858. key: 0,
  29859. modelValue: _ctx.data.options.defaultValue,
  29860. "onUpdate:modelValue": _cache[36] || (_cache[36] = ($event) => _ctx.data.options.defaultValue = $event),
  29861. style: { "margin-top": "8px" }
  29862. }, {
  29863. default: withCtx(() => [
  29864. createVNode(_component_Draggable, {
  29865. "item-key": "index",
  29866. "ghost-class": "ghost",
  29867. handle: ".drag-item",
  29868. group: { name: "options" },
  29869. list: _ctx.data.options.options
  29870. }, {
  29871. item: withCtx(({ element, index }) => [
  29872. createElementVNode("div", _hoisted_8$1, [
  29873. createVNode(_component_el_radio, {
  29874. label: element.value,
  29875. style: { "margin-right": "0", "margin-bottom": "0" }
  29876. }, {
  29877. default: withCtx(() => [
  29878. createVNode(_component_el_input, {
  29879. modelValue: element.value,
  29880. "onUpdate:modelValue": ($event) => element.value = $event,
  29881. style: normalizeStyle({
  29882. width: _ctx.data.options.showLabel ? "90px" : "180px"
  29883. })
  29884. }, null, 8, ["modelValue", "onUpdate:modelValue", "style"]),
  29885. _ctx.data.options.showLabel ? (openBlock(), createBlock(_component_el_input, {
  29886. key: 0,
  29887. modelValue: element.label,
  29888. "onUpdate:modelValue": ($event) => element.label = $event,
  29889. class: "ml-1",
  29890. style: {
  29891. width: "90px"
  29892. }
  29893. }, null, 8, ["modelValue", "onUpdate:modelValue"])) : createCommentVNode("", true)
  29894. ]),
  29895. _: 2
  29896. }, 1032, ["label"]),
  29897. _hoisted_9$1,
  29898. createVNode(_component_el_button, {
  29899. type: "primary",
  29900. circle: "",
  29901. onClick: ($event) => _ctx.handleOptionsRemove(index)
  29902. }, {
  29903. default: withCtx(() => [
  29904. _hoisted_10$1
  29905. ]),
  29906. _: 2
  29907. }, 1032, ["onClick"])
  29908. ])
  29909. ]),
  29910. _: 1
  29911. }, 8, ["list"])
  29912. ]),
  29913. _: 1
  29914. }, 8, ["modelValue"])) : createCommentVNode("", true),
  29915. _ctx.data.type === "checkbox" || _ctx.data.type === "select" && _ctx.data.options.multiple ? (openBlock(), createBlock(_component_el_checkbox_group, {
  29916. key: 1,
  29917. modelValue: _ctx.data.options.defaultValue,
  29918. "onUpdate:modelValue": _cache[37] || (_cache[37] = ($event) => _ctx.data.options.defaultValue = $event),
  29919. style: { "margin-top": "8px" }
  29920. }, {
  29921. default: withCtx(() => [
  29922. createVNode(_component_Draggable, {
  29923. "item-key": "index",
  29924. "ghost-class": "ghost",
  29925. handle: "[cursor-move]",
  29926. group: { name: "options" },
  29927. list: _ctx.data.options.options
  29928. }, {
  29929. item: withCtx(({ element, index }) => [
  29930. createElementVNode("div", _hoisted_11$1, [
  29931. createVNode(_component_el_checkbox, {
  29932. label: element.value
  29933. }, {
  29934. default: withCtx(() => [
  29935. _hoisted_12$1
  29936. ]),
  29937. _: 2
  29938. }, 1032, ["label"]),
  29939. createVNode(_component_el_input, {
  29940. modelValue: element.value,
  29941. "onUpdate:modelValue": ($event) => element.value = $event,
  29942. style: normalizeStyle({
  29943. width: _ctx.data.options.showLabel ? "90px" : "180px"
  29944. })
  29945. }, null, 8, ["modelValue", "onUpdate:modelValue", "style"]),
  29946. _ctx.data.options.showLabel ? (openBlock(), createBlock(_component_el_input, {
  29947. key: 0,
  29948. modelValue: element.label,
  29949. "onUpdate:modelValue": ($event) => element.label = $event,
  29950. style: { width: "90px" }
  29951. }, null, 8, ["modelValue", "onUpdate:modelValue"])) : createCommentVNode("", true),
  29952. _hoisted_13$1,
  29953. createVNode(_component_el_button, {
  29954. type: "primary",
  29955. circle: "",
  29956. onClick: ($event) => _ctx.handleOptionsRemove(index)
  29957. }, {
  29958. default: withCtx(() => [
  29959. _hoisted_14$1
  29960. ]),
  29961. _: 2
  29962. }, 1032, ["onClick"])
  29963. ])
  29964. ]),
  29965. _: 1
  29966. }, 8, ["list"])
  29967. ]),
  29968. _: 1
  29969. }, 8, ["modelValue"])) : createCommentVNode("", true),
  29970. createElementVNode("div", _hoisted_15, [
  29971. createVNode(_component_el_button, {
  29972. type: "text",
  29973. onClick: _ctx.handleInsertOption
  29974. }, {
  29975. default: withCtx(() => [
  29976. _hoisted_16
  29977. ]),
  29978. _: 1
  29979. }, 8, ["onClick"])
  29980. ])
  29981. ], 64))
  29982. ]),
  29983. _: 1
  29984. })) : createCommentVNode("", true),
  29985. _ctx.data.type === "time" ? (openBlock(), createBlock(_component_el_form_item, {
  29986. key: 27,
  29987. label: "\u9ED8\u8BA4\u503C"
  29988. }, {
  29989. default: withCtx(() => [
  29990. createVNode(_component_el_time_picker, {
  29991. modelValue: _ctx.data.options.defaultValue,
  29992. "onUpdate:modelValue": _cache[38] || (_cache[38] = ($event) => _ctx.data.options.defaultValue = $event),
  29993. style: { "width": "100%" },
  29994. format: _ctx.data.options.format,
  29995. placeholder: _ctx.data.options.placeholder
  29996. }, null, 8, ["modelValue", "format", "placeholder"])
  29997. ]),
  29998. _: 1
  29999. })) : createCommentVNode("", true),
  30000. _ctx.data.type === "date" ? (openBlock(), createBlock(_component_el_form_item, {
  30001. key: 28,
  30002. label: "\u9ED8\u8BA4\u503C"
  30003. }, {
  30004. default: withCtx(() => [
  30005. createVNode(_component_el_date_picker, {
  30006. modelValue: _ctx.data.options.defaultValue,
  30007. "onUpdate:modelValue": _cache[39] || (_cache[39] = ($event) => _ctx.data.options.defaultValue = $event),
  30008. style: { "width": "100%" },
  30009. format: _ctx.data.options.format,
  30010. placeholder: _ctx.data.options.placeholder
  30011. }, null, 8, ["modelValue", "format", "placeholder"])
  30012. ]),
  30013. _: 1
  30014. })) : createCommentVNode("", true),
  30015. _ctx.data.type === "time" || _ctx.data.type === "date" ? (openBlock(), createBlock(_component_el_form_item, {
  30016. key: 29,
  30017. label: "\u683C\u5F0F"
  30018. }, {
  30019. default: withCtx(() => [
  30020. createVNode(_component_el_input, {
  30021. modelValue: _ctx.data.options.format,
  30022. "onUpdate:modelValue": _cache[40] || (_cache[40] = ($event) => _ctx.data.options.format = $event)
  30023. }, null, 8, ["modelValue"])
  30024. ]),
  30025. _: 1
  30026. })) : createCommentVNode("", true),
  30027. _ctx.data.type === "download" ? (openBlock(), createBlock(_component_el_form_item, {
  30028. key: 30,
  30029. label: "\u5730\u5740"
  30030. }, {
  30031. default: withCtx(() => [
  30032. createVNode(_component_el_input, {
  30033. modelValue: _ctx.data.options.defaultValue,
  30034. "onUpdate:modelValue": _cache[41] || (_cache[41] = ($event) => _ctx.data.options.defaultValue = $event)
  30035. }, null, 8, ["modelValue"])
  30036. ]),
  30037. _: 1
  30038. })) : createCommentVNode("", true),
  30039. _ctx.data.type === "img-upload" ? (openBlock(), createElementBlock(Fragment, { key: 31 }, [
  30040. createVNode(_component_el_form_item, { label: "\u6A21\u5F0F" }, {
  30041. default: withCtx(() => [
  30042. createVNode(_component_el_radio_group, {
  30043. modelValue: _ctx.data.options.listType,
  30044. "onUpdate:modelValue": _cache[42] || (_cache[42] = ($event) => _ctx.data.options.listType = $event)
  30045. }, {
  30046. default: withCtx(() => [
  30047. createVNode(_component_el_radio_button, { label: "text" }, {
  30048. default: withCtx(() => [
  30049. _hoisted_17
  30050. ]),
  30051. _: 1
  30052. }),
  30053. createVNode(_component_el_radio_button, { label: "picture" }, {
  30054. default: withCtx(() => [
  30055. _hoisted_18
  30056. ]),
  30057. _: 1
  30058. }),
  30059. createVNode(_component_el_radio_button, { label: "picture-card" }, {
  30060. default: withCtx(() => [
  30061. _hoisted_19
  30062. ]),
  30063. _: 1
  30064. })
  30065. ]),
  30066. _: 1
  30067. }, 8, ["modelValue"])
  30068. ]),
  30069. _: 1
  30070. }),
  30071. createVNode(_component_el_form_item, { label: "\u6587\u4EF6\u53C2\u6570\u540D" }, {
  30072. default: withCtx(() => [
  30073. createVNode(_component_el_input, {
  30074. modelValue: _ctx.data.options.name,
  30075. "onUpdate:modelValue": _cache[43] || (_cache[43] = ($event) => _ctx.data.options.name = $event)
  30076. }, null, 8, ["modelValue"])
  30077. ]),
  30078. _: 1
  30079. }),
  30080. createVNode(_component_el_form_item, { label: "\u4E0A\u4F20\u5730\u5740" }, {
  30081. default: withCtx(() => [
  30082. createVNode(_component_el_input, {
  30083. modelValue: _ctx.data.options.action,
  30084. "onUpdate:modelValue": _cache[44] || (_cache[44] = ($event) => _ctx.data.options.action = $event)
  30085. }, null, 8, ["modelValue"])
  30086. ]),
  30087. _: 1
  30088. }),
  30089. createVNode(_component_el_form_item, { label: "\u63A5\u53D7\u4E0A\u4F20\u7684\u6587\u4EF6\u7C7B\u578B(\u591A\u4E2A\u4F7F\u7528 , \u9694\u5F00)" }, {
  30090. default: withCtx(() => [
  30091. createVNode(_component_el_input, {
  30092. modelValue: _ctx.data.options.accept,
  30093. "onUpdate:modelValue": _cache[45] || (_cache[45] = ($event) => _ctx.data.options.accept = $event)
  30094. }, null, 8, ["modelValue"])
  30095. ]),
  30096. _: 1
  30097. }),
  30098. createVNode(_component_el_form_item, { label: "\u6700\u5927\u4E0A\u4F20\u6570\u91CF" }, {
  30099. default: withCtx(() => [
  30100. createVNode(_component_el_input_number, {
  30101. modelValue: _ctx.data.options.limit,
  30102. "onUpdate:modelValue": _cache[46] || (_cache[46] = ($event) => _ctx.data.options.limit = $event),
  30103. modelModifiers: { number: true },
  30104. min: 1
  30105. }, null, 8, ["modelValue"])
  30106. ]),
  30107. _: 1
  30108. }),
  30109. createVNode(_component_el_form_item, { label: "\u4E0A\u4F20\u8BF7\u6C42\u65B9\u6CD5" }, {
  30110. default: withCtx(() => [
  30111. createVNode(_component_el_radio_group, {
  30112. modelValue: _ctx.data.options.method,
  30113. "onUpdate:modelValue": _cache[47] || (_cache[47] = ($event) => _ctx.data.options.method = $event)
  30114. }, {
  30115. default: withCtx(() => [
  30116. createVNode(_component_el_radio_button, { label: "post" }, {
  30117. default: withCtx(() => [
  30118. _hoisted_20
  30119. ]),
  30120. _: 1
  30121. }),
  30122. createVNode(_component_el_radio_button, { label: "put" }, {
  30123. default: withCtx(() => [
  30124. _hoisted_21
  30125. ]),
  30126. _: 1
  30127. }),
  30128. createVNode(_component_el_radio_button, { label: "get" }, {
  30129. default: withCtx(() => [
  30130. _hoisted_22
  30131. ]),
  30132. _: 1
  30133. }),
  30134. createVNode(_component_el_radio_button, { label: "delete" }, {
  30135. default: withCtx(() => [
  30136. _hoisted_23
  30137. ]),
  30138. _: 1
  30139. })
  30140. ]),
  30141. _: 1
  30142. }, 8, ["modelValue"])
  30143. ]),
  30144. _: 1
  30145. })
  30146. ], 64)) : createCommentVNode("", true),
  30147. _ctx.data.type === "cascader" ? (openBlock(), createBlock(_component_el_form_item, {
  30148. key: 32,
  30149. label: "\u8FDC\u7AEF\u6570\u636E"
  30150. }, {
  30151. default: withCtx(() => [
  30152. createVNode(_component_el_space, {
  30153. direction: "vertical",
  30154. alignment: "start"
  30155. }, {
  30156. default: withCtx(() => [
  30157. createVNode(_component_el_input, {
  30158. modelValue: _ctx.data.options.remoteFunc,
  30159. "onUpdate:modelValue": _cache[48] || (_cache[48] = ($event) => _ctx.data.options.remoteFunc = $event)
  30160. }, {
  30161. prepend: withCtx(() => [
  30162. _hoisted_24
  30163. ]),
  30164. _: 1
  30165. }, 8, ["modelValue"]),
  30166. createVNode(_component_el_input, {
  30167. modelValue: _ctx.data.options.props.label,
  30168. "onUpdate:modelValue": _cache[49] || (_cache[49] = ($event) => _ctx.data.options.props.label = $event)
  30169. }, {
  30170. prepend: withCtx(() => [
  30171. _hoisted_25
  30172. ]),
  30173. _: 1
  30174. }, 8, ["modelValue"]),
  30175. createVNode(_component_el_input, {
  30176. modelValue: _ctx.data.options.props.value,
  30177. "onUpdate:modelValue": _cache[50] || (_cache[50] = ($event) => _ctx.data.options.props.value = $event)
  30178. }, {
  30179. prepend: withCtx(() => [
  30180. _hoisted_26
  30181. ]),
  30182. _: 1
  30183. }, 8, ["modelValue"]),
  30184. createVNode(_component_el_input, {
  30185. modelValue: _ctx.data.options.props.children,
  30186. "onUpdate:modelValue": _cache[51] || (_cache[51] = ($event) => _ctx.data.options.props.children = $event)
  30187. }, {
  30188. prepend: withCtx(() => [
  30189. _hoisted_27
  30190. ]),
  30191. _: 1
  30192. }, 8, ["modelValue"])
  30193. ]),
  30194. _: 1
  30195. })
  30196. ]),
  30197. _: 1
  30198. })) : createCommentVNode("", true),
  30199. _ctx.data.type === "table" ? (openBlock(), createElementBlock(Fragment, { key: 33 }, [
  30200. createVNode(_component_el_form_item, { label: "\u5217\u914D\u7F6E\u9879" }, {
  30201. default: withCtx(() => [
  30202. createVNode(_component_Draggable, {
  30203. tag: "ul",
  30204. "item-key": "index",
  30205. "ghost-class": "ghost",
  30206. handle: ".drag-item",
  30207. group: { name: "options" },
  30208. list: _ctx.data.columns
  30209. }, {
  30210. item: withCtx(({ element, index }) => [
  30211. createElementVNode("li", _hoisted_28, [
  30212. _hoisted_29,
  30213. createVNode(_component_el_input, {
  30214. modelValue: element.label,
  30215. "onUpdate:modelValue": ($event) => element.label = $event,
  30216. placeholder: "\u663E\u793A\u540D\u79F0"
  30217. }, null, 8, ["modelValue", "onUpdate:modelValue"]),
  30218. createVNode(_component_el_input, {
  30219. modelValue: element.prop,
  30220. "onUpdate:modelValue": ($event) => element.prop = $event,
  30221. placeholder: "\u5B57\u6BB5\u5B57\u6BB5"
  30222. }, null, 8, ["modelValue", "onUpdate:modelValue"]),
  30223. createVNode(_component_el_button, {
  30224. type: "primary",
  30225. circle: "",
  30226. style: { "margin-left": "5px" },
  30227. onClick: ($event) => _ctx.data.columns.splice(index, 1)
  30228. }, {
  30229. default: withCtx(() => [
  30230. _hoisted_30
  30231. ]),
  30232. _: 2
  30233. }, 1032, ["onClick"])
  30234. ])
  30235. ]),
  30236. _: 1
  30237. }, 8, ["list"]),
  30238. createElementVNode("div", null, [
  30239. createVNode(_component_el_button, {
  30240. type: "text",
  30241. onClick: _cache[52] || (_cache[52] = ($event) => _ctx.data.columns.push({}))
  30242. }, {
  30243. default: withCtx(() => [
  30244. _hoisted_31
  30245. ]),
  30246. _: 1
  30247. })
  30248. ])
  30249. ]),
  30250. _: 1
  30251. }),
  30252. createVNode(_component_el_form_item, { label: "\u5BF9\u9F50\u65B9\u5F0F" }, {
  30253. default: withCtx(() => [
  30254. createVNode(_component_el_radio_group, {
  30255. modelValue: _ctx.data.options.align,
  30256. "onUpdate:modelValue": _cache[53] || (_cache[53] = ($event) => _ctx.data.options.align = $event)
  30257. }, {
  30258. default: withCtx(() => [
  30259. createVNode(_component_el_radio_button, { label: "left" }, {
  30260. default: withCtx(() => [
  30261. _hoisted_32
  30262. ]),
  30263. _: 1
  30264. }),
  30265. createVNode(_component_el_radio_button, { label: "center" }, {
  30266. default: withCtx(() => [
  30267. _hoisted_33
  30268. ]),
  30269. _: 1
  30270. }),
  30271. createVNode(_component_el_radio_button, { label: "right" }, {
  30272. default: withCtx(() => [
  30273. _hoisted_34
  30274. ]),
  30275. _: 1
  30276. })
  30277. ]),
  30278. _: 1
  30279. }, 8, ["modelValue"])
  30280. ]),
  30281. _: 1
  30282. })
  30283. ], 64)) : createCommentVNode("", true),
  30284. _ctx.data.type === "grid" ? (openBlock(), createElementBlock(Fragment, { key: 34 }, [
  30285. createVNode(_component_el_form_item, { label: "\u6805\u683C\u95F4\u9694" }, {
  30286. default: withCtx(() => [
  30287. createVNode(_component_el_input_number, {
  30288. modelValue: _ctx.data.options.gutter,
  30289. "onUpdate:modelValue": _cache[54] || (_cache[54] = ($event) => _ctx.data.options.gutter = $event),
  30290. modelModifiers: { number: true },
  30291. min: 0
  30292. }, null, 8, ["modelValue"])
  30293. ]),
  30294. _: 1
  30295. }),
  30296. createVNode(_component_el_form_item, { label: "\u5217\u914D\u7F6E\u9879" }, {
  30297. default: withCtx(() => [
  30298. createVNode(_component_Draggable, {
  30299. tag: "ul",
  30300. "item-key": "index",
  30301. "ghost-class": "ghost",
  30302. handle: ".drag-item",
  30303. group: { name: "options" },
  30304. list: _ctx.data.columns
  30305. }, {
  30306. item: withCtx(({ element, index }) => [
  30307. createElementVNode("li", _hoisted_35, [
  30308. _hoisted_36,
  30309. createVNode(_component_el_input_number, {
  30310. modelValue: element.span,
  30311. "onUpdate:modelValue": ($event) => element.span = $event,
  30312. modelModifiers: { number: true },
  30313. placeholder: "\u6805\u683C\u503C",
  30314. min: 0,
  30315. max: 24
  30316. }, null, 8, ["modelValue", "onUpdate:modelValue"]),
  30317. createVNode(_component_el_button, {
  30318. type: "primary",
  30319. circle: "",
  30320. style: { "margin-left": "5px" },
  30321. onClick: ($event) => _ctx.handleOptionsRemove(index)
  30322. }, {
  30323. default: withCtx(() => [
  30324. _hoisted_37
  30325. ]),
  30326. _: 2
  30327. }, 1032, ["onClick"])
  30328. ])
  30329. ]),
  30330. _: 1
  30331. }, 8, ["list"]),
  30332. createElementVNode("div", null, [
  30333. createVNode(_component_el_button, {
  30334. type: "text",
  30335. onClick: _ctx.handleInsertColumn
  30336. }, {
  30337. default: withCtx(() => [
  30338. _hoisted_38
  30339. ]),
  30340. _: 1
  30341. }, 8, ["onClick"])
  30342. ])
  30343. ]),
  30344. _: 1
  30345. }),
  30346. createVNode(_component_el_form_item, { label: "\u5782\u76F4\u5BF9\u9F50\u65B9\u5F0F" }, {
  30347. default: withCtx(() => [
  30348. createVNode(_component_el_radio_group, {
  30349. modelValue: _ctx.data.options.align,
  30350. "onUpdate:modelValue": _cache[55] || (_cache[55] = ($event) => _ctx.data.options.align = $event)
  30351. }, {
  30352. default: withCtx(() => [
  30353. createVNode(_component_el_radio_button, { label: "initial" }, {
  30354. default: withCtx(() => [
  30355. _hoisted_39
  30356. ]),
  30357. _: 1
  30358. }),
  30359. createVNode(_component_el_radio_button, { label: "center" }, {
  30360. default: withCtx(() => [
  30361. _hoisted_40
  30362. ]),
  30363. _: 1
  30364. }),
  30365. createVNode(_component_el_radio_button, { label: "flex-end" }, {
  30366. default: withCtx(() => [
  30367. _hoisted_41
  30368. ]),
  30369. _: 1
  30370. })
  30371. ]),
  30372. _: 1
  30373. }, 8, ["modelValue"])
  30374. ]),
  30375. _: 1
  30376. })
  30377. ], 64)) : createCommentVNode("", true),
  30378. _ctx.data.type !== "grid" ? (openBlock(), createElementBlock(Fragment, { key: 35 }, [
  30379. _ctx.hasKey("rules") || _ctx.hasKey("readonly") || _ctx.hasKey("disabled") || _ctx.hasKey("allowClear") ? (openBlock(), createBlock(_component_el_form_item, {
  30380. key: 0,
  30381. label: "\u64CD\u4F5C\u5C5E\u6027"
  30382. }, {
  30383. default: withCtx(() => [
  30384. _ctx.hasKey("rules") ? (openBlock(), createBlock(_component_el_checkbox, {
  30385. key: 0,
  30386. modelValue: _ctx.data.options.rules.required,
  30387. "onUpdate:modelValue": _cache[56] || (_cache[56] = ($event) => _ctx.data.options.rules.required = $event),
  30388. disabled: _ctx.data.allDisable
  30389. }, {
  30390. default: withCtx(() => [
  30391. _hoisted_42
  30392. ]),
  30393. _: 1
  30394. }, 8, ["modelValue", "disabled"])) : createCommentVNode("", true),
  30395. _ctx.hasKey("readonly") ? (openBlock(), createBlock(_component_el_checkbox, {
  30396. key: 1,
  30397. modelValue: _ctx.data.options.readonly,
  30398. "onUpdate:modelValue": _cache[57] || (_cache[57] = ($event) => _ctx.data.options.readonly = $event),
  30399. disabled: _ctx.data.allDisable
  30400. }, {
  30401. default: withCtx(() => [
  30402. _hoisted_43
  30403. ]),
  30404. _: 1
  30405. }, 8, ["modelValue", "disabled"])) : createCommentVNode("", true),
  30406. _ctx.hasKey("disabled") ? (openBlock(), createBlock(_component_el_checkbox, {
  30407. key: 2,
  30408. modelValue: _ctx.data.options.disabled,
  30409. "onUpdate:modelValue": _cache[58] || (_cache[58] = ($event) => _ctx.data.options.disabled = $event),
  30410. disabled: _ctx.data.allDisable
  30411. }, {
  30412. default: withCtx(() => [
  30413. _hoisted_44
  30414. ]),
  30415. _: 1
  30416. }, 8, ["modelValue", "disabled"])) : createCommentVNode("", true),
  30417. _ctx.hasKey("clearable") ? (openBlock(), createBlock(_component_el_checkbox, {
  30418. key: 3,
  30419. modelValue: _ctx.data.options.clearable,
  30420. "onUpdate:modelValue": _cache[59] || (_cache[59] = ($event) => _ctx.data.options.clearable = $event),
  30421. disabled: _ctx.data.allDisable
  30422. }, {
  30423. default: withCtx(() => [
  30424. _hoisted_45
  30425. ]),
  30426. _: 1
  30427. }, 8, ["modelValue", "disabled"])) : createCommentVNode("", true)
  30428. ]),
  30429. _: 1
  30430. })) : createCommentVNode("", true),
  30431. _ctx.hasKey("rules") ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  30432. _hoisted_46,
  30433. createVNode(_component_el_form_item, { label: "\u89E6\u53D1\u65F6\u673A" }, {
  30434. default: withCtx(() => [
  30435. createVNode(_component_el_radio_group, {
  30436. modelValue: _ctx.data.options.rules.trigger,
  30437. "onUpdate:modelValue": _cache[60] || (_cache[60] = ($event) => _ctx.data.options.rules.trigger = $event)
  30438. }, {
  30439. default: withCtx(() => [
  30440. createVNode(_component_el_radio_button, { label: "blur" }, {
  30441. default: withCtx(() => [
  30442. _hoisted_47
  30443. ]),
  30444. _: 1
  30445. }),
  30446. createVNode(_component_el_radio_button, { label: "change" }, {
  30447. default: withCtx(() => [
  30448. _hoisted_48
  30449. ]),
  30450. _: 1
  30451. })
  30452. ]),
  30453. _: 1
  30454. }, 8, ["modelValue"])
  30455. ]),
  30456. _: 1
  30457. }),
  30458. createVNode(_component_el_form_item, { label: "\u679A\u4E3E\u7C7B\u578B" }, {
  30459. default: withCtx(() => [
  30460. createVNode(_component_el_input, {
  30461. value: _ctx.data.options.rules.enum,
  30462. "onUpdate:value": _cache[61] || (_cache[61] = ($event) => _ctx.data.options.rules.enum = $event)
  30463. }, null, 8, ["value"])
  30464. ]),
  30465. _: 1
  30466. }),
  30467. createVNode(_component_el_form_item, { label: "\u5B57\u6BB5\u957F\u5EA6" }, {
  30468. default: withCtx(() => [
  30469. createVNode(_component_el_input, {
  30470. modelValue: _ctx.data.options.rules.len,
  30471. "onUpdate:modelValue": _cache[62] || (_cache[62] = ($event) => _ctx.data.options.rules.len = $event),
  30472. modelModifiers: { number: true }
  30473. }, null, 8, ["modelValue"])
  30474. ]),
  30475. _: 1
  30476. }),
  30477. createVNode(_component_el_form_item, { label: "\u6700\u5927\u957F\u5EA6" }, {
  30478. default: withCtx(() => [
  30479. createVNode(_component_el_input, {
  30480. modelValue: _ctx.data.options.rules.max,
  30481. "onUpdate:modelValue": _cache[63] || (_cache[63] = ($event) => _ctx.data.options.rules.max = $event),
  30482. modelModifiers: { number: true }
  30483. }, null, 8, ["modelValue"])
  30484. ]),
  30485. _: 1
  30486. }),
  30487. createVNode(_component_el_form_item, { label: "\u6700\u5C0F\u957F\u5EA6" }, {
  30488. default: withCtx(() => [
  30489. createVNode(_component_el_input, {
  30490. modelValue: _ctx.data.options.rules.min,
  30491. "onUpdate:modelValue": _cache[64] || (_cache[64] = ($event) => _ctx.data.options.rules.min = $event),
  30492. modelModifiers: { number: true }
  30493. }, null, 8, ["modelValue"])
  30494. ]),
  30495. _: 1
  30496. }),
  30497. createVNode(_component_el_form_item, { label: "\u6821\u9A8C\u6587\u6848" }, {
  30498. default: withCtx(() => [
  30499. createVNode(_component_el_input, {
  30500. modelValue: _ctx.data.options.rules.message,
  30501. "onUpdate:modelValue": _cache[65] || (_cache[65] = ($event) => _ctx.data.options.rules.message = $event)
  30502. }, null, 8, ["modelValue"])
  30503. ]),
  30504. _: 1
  30505. }),
  30506. createVNode(_component_el_form_item, { label: "\u6B63\u5219\u8868\u8FBE\u5F0F" }, {
  30507. default: withCtx(() => [
  30508. createVNode(_component_el_input, {
  30509. modelValue: _ctx.data.options.rules.pattern,
  30510. "onUpdate:modelValue": _cache[66] || (_cache[66] = ($event) => _ctx.data.options.rules.pattern = $event)
  30511. }, null, 8, ["modelValue"])
  30512. ]),
  30513. _: 1
  30514. }),
  30515. createVNode(_component_el_form_item, { label: "\u6821\u9A8C\u7C7B\u578B" }, {
  30516. default: withCtx(() => [
  30517. createVNode(_component_el_select, {
  30518. modelValue: _ctx.data.options.rules.type,
  30519. "onUpdate:modelValue": _cache[67] || (_cache[67] = ($event) => _ctx.data.options.rules.type = $event)
  30520. }, {
  30521. default: withCtx(() => [
  30522. createVNode(_component_el_option, { value: "string" }, {
  30523. default: withCtx(() => [
  30524. _hoisted_49
  30525. ]),
  30526. _: 1
  30527. }),
  30528. createVNode(_component_el_option, { value: "number" }, {
  30529. default: withCtx(() => [
  30530. _hoisted_50
  30531. ]),
  30532. _: 1
  30533. }),
  30534. createVNode(_component_el_option, { value: "boolean" }, {
  30535. default: withCtx(() => [
  30536. _hoisted_51
  30537. ]),
  30538. _: 1
  30539. }),
  30540. createVNode(_component_el_option, { value: "method" }, {
  30541. default: withCtx(() => [
  30542. _hoisted_52
  30543. ]),
  30544. _: 1
  30545. }),
  30546. createVNode(_component_el_option, { value: "regexp" }, {
  30547. default: withCtx(() => [
  30548. _hoisted_53
  30549. ]),
  30550. _: 1
  30551. }),
  30552. createVNode(_component_el_option, { value: "integer" }, {
  30553. default: withCtx(() => [
  30554. _hoisted_54
  30555. ]),
  30556. _: 1
  30557. }),
  30558. createVNode(_component_el_option, { value: "float" }, {
  30559. default: withCtx(() => [
  30560. _hoisted_55
  30561. ]),
  30562. _: 1
  30563. }),
  30564. createVNode(_component_el_option, { value: "array" }, {
  30565. default: withCtx(() => [
  30566. _hoisted_56
  30567. ]),
  30568. _: 1
  30569. }),
  30570. createVNode(_component_el_option, { value: "object" }, {
  30571. default: withCtx(() => [
  30572. _hoisted_57
  30573. ]),
  30574. _: 1
  30575. }),
  30576. createVNode(_component_el_option, { value: "enum" }, {
  30577. default: withCtx(() => [
  30578. _hoisted_58
  30579. ]),
  30580. _: 1
  30581. }),
  30582. createVNode(_component_el_option, { value: "date" }, {
  30583. default: withCtx(() => [
  30584. _hoisted_59
  30585. ]),
  30586. _: 1
  30587. }),
  30588. createVNode(_component_el_option, { value: "url" }, {
  30589. default: withCtx(() => [
  30590. _hoisted_60
  30591. ]),
  30592. _: 1
  30593. }),
  30594. createVNode(_component_el_option, { value: "hex" }, {
  30595. default: withCtx(() => [
  30596. _hoisted_61
  30597. ]),
  30598. _: 1
  30599. }),
  30600. createVNode(_component_el_option, { value: "email" }, {
  30601. default: withCtx(() => [
  30602. _hoisted_62
  30603. ]),
  30604. _: 1
  30605. }),
  30606. createVNode(_component_el_option, { value: "any" }, {
  30607. default: withCtx(() => [
  30608. _hoisted_63
  30609. ]),
  30610. _: 1
  30611. })
  30612. ]),
  30613. _: 1
  30614. }, 8, ["modelValue"])
  30615. ]),
  30616. _: 1
  30617. })
  30618. ], 64)) : createCommentVNode("", true)
  30619. ], 64)) : createCommentVNode("", true)
  30620. ]),
  30621. _: 1
  30622. })) : createCommentVNode("", true);
  30623. }
  30624. var WidgetConfig = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render]]);
  30625. const _hoisted_1$1 = /* @__PURE__ */ createTextVNode(" \u5DE6\u5BF9\u9F50 ");
  30626. const _hoisted_2$1 = /* @__PURE__ */ createTextVNode(" \u53F3\u5BF9\u9F50 ");
  30627. const _hoisted_3$1 = /* @__PURE__ */ createTextVNode(" \u9876\u90E8\u5BF9\u9F50 ");
  30628. const _hoisted_4$1 = /* @__PURE__ */ createTextVNode(" \u5927 ");
  30629. const _hoisted_5$1 = /* @__PURE__ */ createTextVNode(" \u9ED8\u8BA4 ");
  30630. const _hoisted_6$1 = /* @__PURE__ */ createTextVNode(" \u5C0F ");
  30631. const _sfc_main$2 = /* @__PURE__ */ defineComponent({
  30632. props: {
  30633. config: null
  30634. },
  30635. setup(__props) {
  30636. return (_ctx, _cache) => {
  30637. const _component_el_radio_button = ElRadioButton;
  30638. const _component_el_radio_group = ElRadioGroup;
  30639. const _component_el_form_item = ElFormItem;
  30640. const _component_el_input_number = ElInputNumber;
  30641. const _component_el_switch = ElSwitch;
  30642. const _component_el_form = ElForm;
  30643. return openBlock(), createBlock(_component_el_form, {
  30644. "p-2": "",
  30645. "label-position": "top",
  30646. onSubmit: _cache[4] || (_cache[4] = withModifiers(() => {
  30647. }, ["prevent"]))
  30648. }, {
  30649. default: withCtx(() => [
  30650. createVNode(_component_el_form_item, { label: "\u6807\u7B7E\u5BF9\u9F50\u65B9\u5F0F" }, {
  30651. default: withCtx(() => [
  30652. createVNode(_component_el_radio_group, {
  30653. modelValue: __props.config.labelPosition,
  30654. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => __props.config.labelPosition = $event)
  30655. }, {
  30656. default: withCtx(() => [
  30657. createVNode(_component_el_radio_button, { label: "left" }, {
  30658. default: withCtx(() => [
  30659. _hoisted_1$1
  30660. ]),
  30661. _: 1
  30662. }),
  30663. createVNode(_component_el_radio_button, { label: "right" }, {
  30664. default: withCtx(() => [
  30665. _hoisted_2$1
  30666. ]),
  30667. _: 1
  30668. }),
  30669. createVNode(_component_el_radio_button, { label: "top" }, {
  30670. default: withCtx(() => [
  30671. _hoisted_3$1
  30672. ]),
  30673. _: 1
  30674. })
  30675. ]),
  30676. _: 1
  30677. }, 8, ["modelValue"])
  30678. ]),
  30679. _: 1
  30680. }),
  30681. createVNode(_component_el_form_item, { label: "\u6807\u7B7E\u5BBD\u5EA6" }, {
  30682. default: withCtx(() => [
  30683. createVNode(_component_el_input_number, {
  30684. modelValue: __props.config.labelWidth,
  30685. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => __props.config.labelWidth = $event),
  30686. modelModifiers: { number: true },
  30687. min: 0
  30688. }, null, 8, ["modelValue"])
  30689. ]),
  30690. _: 1
  30691. }),
  30692. createVNode(_component_el_form_item, { label: "\u7EC4\u4EF6\u5C3A\u5BF8" }, {
  30693. default: withCtx(() => [
  30694. createVNode(_component_el_radio_group, {
  30695. modelValue: __props.config.size,
  30696. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => __props.config.size = $event)
  30697. }, {
  30698. default: withCtx(() => [
  30699. createVNode(_component_el_radio_button, { label: "large" }, {
  30700. default: withCtx(() => [
  30701. _hoisted_4$1
  30702. ]),
  30703. _: 1
  30704. }),
  30705. createVNode(_component_el_radio_button, { label: "default" }, {
  30706. default: withCtx(() => [
  30707. _hoisted_5$1
  30708. ]),
  30709. _: 1
  30710. }),
  30711. createVNode(_component_el_radio_button, { label: "small" }, {
  30712. default: withCtx(() => [
  30713. _hoisted_6$1
  30714. ]),
  30715. _: 1
  30716. })
  30717. ]),
  30718. _: 1
  30719. }, 8, ["modelValue"])
  30720. ]),
  30721. _: 1
  30722. }),
  30723. createVNode(_component_el_form_item, { label: "\u9690\u85CF\u5FC5\u9009\u6807\u8BB0" }, {
  30724. default: withCtx(() => [
  30725. createVNode(_component_el_switch, {
  30726. modelValue: __props.config.hideRequiredAsterisk,
  30727. "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => __props.config.hideRequiredAsterisk = $event)
  30728. }, null, 8, ["modelValue"])
  30729. ]),
  30730. _: 1
  30731. })
  30732. ]),
  30733. _: 1
  30734. });
  30735. };
  30736. }
  30737. });
  30738. function _extends() {
  30739. _extends = Object.assign || function(target) {
  30740. for (var i = 1; i < arguments.length; i++) {
  30741. var source = arguments[i];
  30742. for (var key in source) {
  30743. if (Object.prototype.hasOwnProperty.call(source, key)) {
  30744. target[key] = source[key];
  30745. }
  30746. }
  30747. }
  30748. return target;
  30749. };
  30750. return _extends.apply(this, arguments);
  30751. }
  30752. var KEYCODE_ENTER = 13;
  30753. var KEYCODE_TAB = 9;
  30754. var KEYCODE_BACKSPACE = 8;
  30755. var KEYCODE_Y = 89;
  30756. var KEYCODE_Z = 90;
  30757. var KEYCODE_M = 77;
  30758. var KEYCODE_PARENS = 57;
  30759. var KEYCODE_BRACKETS = 219;
  30760. var KEYCODE_QUOTE = 222;
  30761. var KEYCODE_BACK_QUOTE = 192;
  30762. var KEYCODE_ESCAPE = 27;
  30763. var HISTORY_LIMIT = 100;
  30764. var HISTORY_TIME_GAP = 3e3;
  30765. var isWindows = typeof window !== "undefined" && navigator && /* @__PURE__ */ /Win/i.test(navigator.platform);
  30766. var isMacLike = typeof window !== "undefined" && navigator && /* @__PURE__ */ /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform);
  30767. var PrismEditor = /* @__PURE__ */ defineComponent({
  30768. props: {
  30769. lineNumbers: {
  30770. type: Boolean,
  30771. "default": false
  30772. },
  30773. autoStyleLineNumbers: {
  30774. type: Boolean,
  30775. "default": true
  30776. },
  30777. readonly: {
  30778. type: Boolean,
  30779. "default": false
  30780. },
  30781. modelValue: {
  30782. type: String,
  30783. "default": ""
  30784. },
  30785. highlight: {
  30786. type: Function,
  30787. required: true
  30788. },
  30789. tabSize: {
  30790. type: Number,
  30791. "default": 2
  30792. },
  30793. insertSpaces: {
  30794. type: Boolean,
  30795. "default": true
  30796. },
  30797. ignoreTabKey: {
  30798. type: Boolean,
  30799. "default": false
  30800. },
  30801. placeholder: {
  30802. type: String,
  30803. "default": ""
  30804. }
  30805. },
  30806. data: function data() {
  30807. return {
  30808. capture: true,
  30809. history: {
  30810. stack: [],
  30811. offset: -1
  30812. },
  30813. lineNumbersHeight: "20px",
  30814. codeData: ""
  30815. };
  30816. },
  30817. watch: {
  30818. modelValue: {
  30819. immediate: true,
  30820. handler: function handler(newVal) {
  30821. if (!newVal) {
  30822. this.codeData = "";
  30823. } else {
  30824. this.codeData = newVal;
  30825. }
  30826. }
  30827. },
  30828. content: {
  30829. immediate: true,
  30830. handler: function handler2() {
  30831. var _this = this;
  30832. if (this.lineNumbers) {
  30833. this.$nextTick(function() {
  30834. _this.setLineNumbersHeight();
  30835. });
  30836. }
  30837. }
  30838. },
  30839. lineNumbers: function lineNumbers() {
  30840. var _this2 = this;
  30841. this.$nextTick(function() {
  30842. _this2.styleLineNumbers();
  30843. _this2.setLineNumbersHeight();
  30844. });
  30845. }
  30846. },
  30847. computed: {
  30848. isEmpty: function isEmpty2() {
  30849. return this.codeData.length === 0;
  30850. },
  30851. content: function content() {
  30852. var result = this.highlight(this.codeData) + "<br />";
  30853. return result;
  30854. },
  30855. lineNumbersCount: function lineNumbersCount() {
  30856. var totalLines = this.codeData.split(/\r\n|\n/).length;
  30857. return totalLines;
  30858. }
  30859. },
  30860. mounted: function mounted() {
  30861. this._recordCurrentState();
  30862. this.styleLineNumbers();
  30863. },
  30864. methods: {
  30865. setLineNumbersHeight: function setLineNumbersHeight() {
  30866. this.lineNumbersHeight = getComputedStyle(this.$refs.pre).height;
  30867. },
  30868. styleLineNumbers: function styleLineNumbers() {
  30869. if (!this.lineNumbers || !this.autoStyleLineNumbers)
  30870. return;
  30871. var $editor = this.$refs.pre;
  30872. var $lineNumbers = this.$el.querySelector(".prism-editor__line-numbers");
  30873. var editorStyles = window.getComputedStyle($editor);
  30874. this.$nextTick(function() {
  30875. var btlr = "border-top-left-radius";
  30876. var bblr = "border-bottom-left-radius";
  30877. if (!$lineNumbers)
  30878. return;
  30879. $lineNumbers.style[btlr] = editorStyles[btlr];
  30880. $lineNumbers.style[bblr] = editorStyles[bblr];
  30881. $editor.style[btlr] = "0";
  30882. $editor.style[bblr] = "0";
  30883. var stylesList = ["background-color", "margin-top", "padding-top", "font-family", "font-size", "line-height"];
  30884. stylesList.forEach(function(style) {
  30885. $lineNumbers.style[style] = editorStyles[style];
  30886. });
  30887. $lineNumbers.style["margin-bottom"] = "-" + editorStyles["padding-top"];
  30888. });
  30889. },
  30890. _recordCurrentState: function _recordCurrentState() {
  30891. var input = this.$refs.textarea;
  30892. if (!input)
  30893. return;
  30894. var value = input.value, selectionStart = input.selectionStart, selectionEnd = input.selectionEnd;
  30895. this._recordChange({
  30896. value,
  30897. selectionStart,
  30898. selectionEnd
  30899. });
  30900. },
  30901. _getLines: function _getLines(text, position) {
  30902. return text.substring(0, position).split("\n");
  30903. },
  30904. _applyEdits: function _applyEdits(record) {
  30905. var input = this.$refs.textarea;
  30906. var last = this.history.stack[this.history.offset];
  30907. if (last && input) {
  30908. this.history.stack[this.history.offset] = _extends({}, last, {
  30909. selectionStart: input.selectionStart,
  30910. selectionEnd: input.selectionEnd
  30911. });
  30912. }
  30913. this._recordChange(record);
  30914. this._updateInput(record);
  30915. },
  30916. _recordChange: function _recordChange(record, overwrite) {
  30917. if (overwrite === void 0) {
  30918. overwrite = false;
  30919. }
  30920. var _this$history = this.history, stack = _this$history.stack, offset2 = _this$history.offset;
  30921. if (stack.length && offset2 > -1) {
  30922. this.history.stack = stack.slice(0, offset2 + 1);
  30923. var count = this.history.stack.length;
  30924. if (count > HISTORY_LIMIT) {
  30925. var extras = count - HISTORY_LIMIT;
  30926. this.history.stack = stack.slice(extras, count);
  30927. this.history.offset = Math.max(this.history.offset - extras, 0);
  30928. }
  30929. }
  30930. var timestamp = Date.now();
  30931. if (overwrite) {
  30932. var last = this.history.stack[this.history.offset];
  30933. if (last && timestamp - last.timestamp < HISTORY_TIME_GAP) {
  30934. var _this$_getLines$pop, _this$_getLines$pop2;
  30935. var re = /[^a-z0-9]([a-z0-9]+)$/i;
  30936. var previous = (_this$_getLines$pop = this._getLines(last.value, last.selectionStart).pop()) === null || _this$_getLines$pop === void 0 ? void 0 : _this$_getLines$pop.match(re);
  30937. var current = (_this$_getLines$pop2 = this._getLines(record.value, record.selectionStart).pop()) === null || _this$_getLines$pop2 === void 0 ? void 0 : _this$_getLines$pop2.match(re);
  30938. if (previous && current && current[1].startsWith(previous[1])) {
  30939. this.history.stack[this.history.offset] = _extends({}, record, {
  30940. timestamp
  30941. });
  30942. return;
  30943. }
  30944. }
  30945. }
  30946. this.history.stack.push(_extends({}, record, {
  30947. timestamp
  30948. }));
  30949. this.history.offset++;
  30950. },
  30951. _updateInput: function _updateInput(record) {
  30952. var input = this.$refs.textarea;
  30953. if (!input)
  30954. return;
  30955. input.value = record.value;
  30956. input.selectionStart = record.selectionStart;
  30957. input.selectionEnd = record.selectionEnd;
  30958. this.$emit("update:modelValue", record.value);
  30959. },
  30960. handleChange: function handleChange(e) {
  30961. var _e$target = e.target, value = _e$target.value, selectionStart = _e$target.selectionStart, selectionEnd = _e$target.selectionEnd;
  30962. this._recordChange({
  30963. value,
  30964. selectionStart,
  30965. selectionEnd
  30966. }, true);
  30967. this.$emit("update:modelValue", value);
  30968. },
  30969. _undoEdit: function _undoEdit() {
  30970. var _this$history2 = this.history, stack = _this$history2.stack, offset2 = _this$history2.offset;
  30971. var record = stack[offset2 - 1];
  30972. if (record) {
  30973. this._updateInput(record);
  30974. this.history.offset = Math.max(offset2 - 1, 0);
  30975. }
  30976. },
  30977. _redoEdit: function _redoEdit() {
  30978. var _this$history3 = this.history, stack = _this$history3.stack, offset2 = _this$history3.offset;
  30979. var record = stack[offset2 + 1];
  30980. if (record) {
  30981. this._updateInput(record);
  30982. this.history.offset = Math.min(offset2 + 1, stack.length - 1);
  30983. }
  30984. },
  30985. handleKeyDown: function handleKeyDown(e) {
  30986. var tabSize = this.tabSize, insertSpaces = this.insertSpaces, ignoreTabKey = this.ignoreTabKey;
  30987. this.$emit("keydown", e);
  30988. if (e.defaultPrevented) {
  30989. return;
  30990. }
  30991. if (e.keyCode === KEYCODE_ESCAPE) {
  30992. e.target.blur();
  30993. this.$emit("blur", e);
  30994. }
  30995. var _e$target2 = e.target, value = _e$target2.value, selectionStart = _e$target2.selectionStart, selectionEnd = _e$target2.selectionEnd;
  30996. var tabCharacter = (insertSpaces ? " " : " ").repeat(tabSize);
  30997. if (e.keyCode === KEYCODE_TAB && !ignoreTabKey && this.capture) {
  30998. e.preventDefault();
  30999. if (e.shiftKey) {
  31000. var linesBeforeCaret = this._getLines(value, selectionStart);
  31001. var startLine = linesBeforeCaret.length - 1;
  31002. var endLine = this._getLines(value, selectionEnd).length - 1;
  31003. var nextValue = value.split("\n").map(function(line2, i) {
  31004. if (i >= startLine && i <= endLine && line2.startsWith(tabCharacter)) {
  31005. return line2.substring(tabCharacter.length);
  31006. }
  31007. return line2;
  31008. }).join("\n");
  31009. if (value !== nextValue) {
  31010. var startLineText = linesBeforeCaret[startLine];
  31011. this._applyEdits({
  31012. value: nextValue,
  31013. selectionStart: startLineText.startsWith(tabCharacter) ? selectionStart - tabCharacter.length : selectionStart,
  31014. selectionEnd: selectionEnd - (value.length - nextValue.length)
  31015. });
  31016. }
  31017. } else if (selectionStart !== selectionEnd) {
  31018. var _linesBeforeCaret = this._getLines(value, selectionStart);
  31019. var _startLine = _linesBeforeCaret.length - 1;
  31020. var _endLine = this._getLines(value, selectionEnd).length - 1;
  31021. var _startLineText = _linesBeforeCaret[_startLine];
  31022. this._applyEdits({
  31023. value: value.split("\n").map(function(line2, i) {
  31024. if (i >= _startLine && i <= _endLine) {
  31025. return tabCharacter + line2;
  31026. }
  31027. return line2;
  31028. }).join("\n"),
  31029. selectionStart: /\S/.test(_startLineText) ? selectionStart + tabCharacter.length : selectionStart,
  31030. selectionEnd: selectionEnd + tabCharacter.length * (_endLine - _startLine + 1)
  31031. });
  31032. } else {
  31033. var updatedSelection = selectionStart + tabCharacter.length;
  31034. this._applyEdits({
  31035. value: value.substring(0, selectionStart) + tabCharacter + value.substring(selectionEnd),
  31036. selectionStart: updatedSelection,
  31037. selectionEnd: updatedSelection
  31038. });
  31039. }
  31040. } else if (e.keyCode === KEYCODE_BACKSPACE) {
  31041. var hasSelection = selectionStart !== selectionEnd;
  31042. var textBeforeCaret = value.substring(0, selectionStart);
  31043. if (textBeforeCaret.endsWith(tabCharacter) && !hasSelection) {
  31044. e.preventDefault();
  31045. var _updatedSelection = selectionStart - tabCharacter.length;
  31046. this._applyEdits({
  31047. value: value.substring(0, selectionStart - tabCharacter.length) + value.substring(selectionEnd),
  31048. selectionStart: _updatedSelection,
  31049. selectionEnd: _updatedSelection
  31050. });
  31051. }
  31052. } else if (e.keyCode === KEYCODE_ENTER) {
  31053. if (selectionStart === selectionEnd) {
  31054. var line = this._getLines(value, selectionStart).pop();
  31055. var matches = line === null || line === void 0 ? void 0 : line.match(/^\s+/);
  31056. if (matches && matches[0]) {
  31057. e.preventDefault();
  31058. var indent = "\n" + matches[0];
  31059. var _updatedSelection2 = selectionStart + indent.length;
  31060. this._applyEdits({
  31061. value: value.substring(0, selectionStart) + indent + value.substring(selectionEnd),
  31062. selectionStart: _updatedSelection2,
  31063. selectionEnd: _updatedSelection2
  31064. });
  31065. }
  31066. }
  31067. } else if (e.keyCode === KEYCODE_PARENS || e.keyCode === KEYCODE_BRACKETS || e.keyCode === KEYCODE_QUOTE || e.keyCode === KEYCODE_BACK_QUOTE) {
  31068. var chars;
  31069. if (e.keyCode === KEYCODE_PARENS && e.shiftKey) {
  31070. chars = ["(", ")"];
  31071. } else if (e.keyCode === KEYCODE_BRACKETS) {
  31072. if (e.shiftKey) {
  31073. chars = ["{", "}"];
  31074. } else {
  31075. chars = ["[", "]"];
  31076. }
  31077. } else if (e.keyCode === KEYCODE_QUOTE) {
  31078. if (e.shiftKey) {
  31079. chars = ['"', '"'];
  31080. } else {
  31081. chars = ["'", "'"];
  31082. }
  31083. } else if (e.keyCode === KEYCODE_BACK_QUOTE && !e.shiftKey) {
  31084. chars = ["`", "`"];
  31085. }
  31086. if (selectionStart !== selectionEnd && chars) {
  31087. e.preventDefault();
  31088. this._applyEdits({
  31089. value: value.substring(0, selectionStart) + chars[0] + value.substring(selectionStart, selectionEnd) + chars[1] + value.substring(selectionEnd),
  31090. selectionStart,
  31091. selectionEnd: selectionEnd + 2
  31092. });
  31093. }
  31094. } else if ((isMacLike ? e.metaKey && e.keyCode === KEYCODE_Z : e.ctrlKey && e.keyCode === KEYCODE_Z) && !e.shiftKey && !e.altKey) {
  31095. e.preventDefault();
  31096. this._undoEdit();
  31097. } else if ((isMacLike ? e.metaKey && e.keyCode === KEYCODE_Z && e.shiftKey : isWindows ? e.ctrlKey && e.keyCode === KEYCODE_Y : e.ctrlKey && e.keyCode === KEYCODE_Z && e.shiftKey) && !e.altKey) {
  31098. e.preventDefault();
  31099. this._redoEdit();
  31100. } else if (e.keyCode === KEYCODE_M && e.ctrlKey && (isMacLike ? e.shiftKey : true)) {
  31101. e.preventDefault();
  31102. this.capture = !this.capture;
  31103. }
  31104. }
  31105. },
  31106. render: function render() {
  31107. var _this3 = this;
  31108. var lineNumberWidthCalculator = h$1("div", {
  31109. "class": "prism-editor__line-width-calc",
  31110. style: "height: 0px; visibility: hidden; pointer-events: none;"
  31111. }, "999");
  31112. var lineNumbers2 = h$1("div", {
  31113. "class": "prism-editor__line-numbers",
  31114. style: {
  31115. "min-height": this.lineNumbersHeight
  31116. },
  31117. "aria-hidden": "true"
  31118. }, [lineNumberWidthCalculator, Array.from(Array(this.lineNumbersCount).keys()).map(function(_2, index) {
  31119. return h$1("div", {
  31120. "class": "prism-editor__line-number token comment"
  31121. }, "" + ++index);
  31122. })]);
  31123. var textarea = h$1("textarea", {
  31124. ref: "textarea",
  31125. onInput: this.handleChange,
  31126. onKeydown: this.handleKeyDown,
  31127. onClick: function onClick($event) {
  31128. _this3.$emit("click", $event);
  31129. },
  31130. onKeyup: function onKeyup($event) {
  31131. _this3.$emit("keyup", $event);
  31132. },
  31133. onFocus: function onFocus($event) {
  31134. _this3.$emit("focus", $event);
  31135. },
  31136. onBlur: function onBlur($event) {
  31137. _this3.$emit("blur", $event);
  31138. },
  31139. "class": {
  31140. "prism-editor__textarea": true,
  31141. "prism-editor__textarea--empty": this.isEmpty
  31142. },
  31143. spellCheck: "false",
  31144. autocapitalize: "off",
  31145. autocomplete: "off",
  31146. autocorrect: "off",
  31147. "data-gramm": "false",
  31148. placeholder: this.placeholder,
  31149. "data-testid": "textarea",
  31150. readonly: this.readonly,
  31151. value: this.codeData
  31152. });
  31153. var preview = h$1("pre", {
  31154. ref: "pre",
  31155. "class": "prism-editor__editor",
  31156. "data-testid": "preview",
  31157. innerHTML: this.content
  31158. });
  31159. var editorContainer = h$1("div", {
  31160. "class": "prism-editor__container"
  31161. }, [textarea, preview]);
  31162. return h$1("div", {
  31163. "class": "prism-editor-wrapper"
  31164. }, [this.lineNumbers && lineNumbers2, editorContainer]);
  31165. }
  31166. });
  31167. var prismeditor_min = "";
  31168. var prismCore = { exports: {} };
  31169. (function(module2) {
  31170. var _self = typeof window !== "undefined" ? window : typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope ? self : {};
  31171. /**
  31172. * Prism: Lightweight, robust, elegant syntax highlighting
  31173. *
  31174. * @license MIT <https://opensource.org/licenses/MIT>
  31175. * @author Lea Verou <https://lea.verou.me>
  31176. * @namespace
  31177. * @public
  31178. */
  31179. var Prism2 = function(_self2) {
  31180. var lang = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i;
  31181. var uniqueId = 0;
  31182. var plainTextGrammar = {};
  31183. var _2 = {
  31184. manual: _self2.Prism && _self2.Prism.manual,
  31185. disableWorkerMessageHandler: _self2.Prism && _self2.Prism.disableWorkerMessageHandler,
  31186. util: {
  31187. encode: function encode(tokens) {
  31188. if (tokens instanceof Token) {
  31189. return new Token(tokens.type, encode(tokens.content), tokens.alias);
  31190. } else if (Array.isArray(tokens)) {
  31191. return tokens.map(encode);
  31192. } else {
  31193. return tokens.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/\u00a0/g, " ");
  31194. }
  31195. },
  31196. type: function(o2) {
  31197. return Object.prototype.toString.call(o2).slice(8, -1);
  31198. },
  31199. objId: function(obj) {
  31200. if (!obj["__id"]) {
  31201. Object.defineProperty(obj, "__id", { value: ++uniqueId });
  31202. }
  31203. return obj["__id"];
  31204. },
  31205. clone: function deepClone(o2, visited) {
  31206. visited = visited || {};
  31207. var clone2;
  31208. var id;
  31209. switch (_2.util.type(o2)) {
  31210. case "Object":
  31211. id = _2.util.objId(o2);
  31212. if (visited[id]) {
  31213. return visited[id];
  31214. }
  31215. clone2 = {};
  31216. visited[id] = clone2;
  31217. for (var key in o2) {
  31218. if (o2.hasOwnProperty(key)) {
  31219. clone2[key] = deepClone(o2[key], visited);
  31220. }
  31221. }
  31222. return clone2;
  31223. case "Array":
  31224. id = _2.util.objId(o2);
  31225. if (visited[id]) {
  31226. return visited[id];
  31227. }
  31228. clone2 = [];
  31229. visited[id] = clone2;
  31230. o2.forEach(function(v2, i) {
  31231. clone2[i] = deepClone(v2, visited);
  31232. });
  31233. return clone2;
  31234. default:
  31235. return o2;
  31236. }
  31237. },
  31238. getLanguage: function(element) {
  31239. while (element) {
  31240. var m2 = lang.exec(element.className);
  31241. if (m2) {
  31242. return m2[1].toLowerCase();
  31243. }
  31244. element = element.parentElement;
  31245. }
  31246. return "none";
  31247. },
  31248. setLanguage: function(element, language) {
  31249. element.className = element.className.replace(RegExp(lang, "gi"), "");
  31250. element.classList.add("language-" + language);
  31251. },
  31252. currentScript: function() {
  31253. if (typeof document === "undefined") {
  31254. return null;
  31255. }
  31256. if ("currentScript" in document && 1 < 2) {
  31257. return document.currentScript;
  31258. }
  31259. try {
  31260. throw new Error();
  31261. } catch (err) {
  31262. var src = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(err.stack) || [])[1];
  31263. if (src) {
  31264. var scripts = document.getElementsByTagName("script");
  31265. for (var i in scripts) {
  31266. if (scripts[i].src == src) {
  31267. return scripts[i];
  31268. }
  31269. }
  31270. }
  31271. return null;
  31272. }
  31273. },
  31274. isActive: function(element, className, defaultActivation) {
  31275. var no = "no-" + className;
  31276. while (element) {
  31277. var classList = element.classList;
  31278. if (classList.contains(className)) {
  31279. return true;
  31280. }
  31281. if (classList.contains(no)) {
  31282. return false;
  31283. }
  31284. element = element.parentElement;
  31285. }
  31286. return !!defaultActivation;
  31287. }
  31288. },
  31289. languages: {
  31290. plain: plainTextGrammar,
  31291. plaintext: plainTextGrammar,
  31292. text: plainTextGrammar,
  31293. txt: plainTextGrammar,
  31294. extend: function(id, redef) {
  31295. var lang2 = _2.util.clone(_2.languages[id]);
  31296. for (var key in redef) {
  31297. lang2[key] = redef[key];
  31298. }
  31299. return lang2;
  31300. },
  31301. insertBefore: function(inside, before, insert, root2) {
  31302. root2 = root2 || _2.languages;
  31303. var grammar = root2[inside];
  31304. var ret = {};
  31305. for (var token in grammar) {
  31306. if (grammar.hasOwnProperty(token)) {
  31307. if (token == before) {
  31308. for (var newToken in insert) {
  31309. if (insert.hasOwnProperty(newToken)) {
  31310. ret[newToken] = insert[newToken];
  31311. }
  31312. }
  31313. }
  31314. if (!insert.hasOwnProperty(token)) {
  31315. ret[token] = grammar[token];
  31316. }
  31317. }
  31318. }
  31319. var old = root2[inside];
  31320. root2[inside] = ret;
  31321. _2.languages.DFS(_2.languages, function(key, value) {
  31322. if (value === old && key != inside) {
  31323. this[key] = ret;
  31324. }
  31325. });
  31326. return ret;
  31327. },
  31328. DFS: function DFS(o2, callback, type4, visited) {
  31329. visited = visited || {};
  31330. var objId = _2.util.objId;
  31331. for (var i in o2) {
  31332. if (o2.hasOwnProperty(i)) {
  31333. callback.call(o2, i, o2[i], type4 || i);
  31334. var property = o2[i];
  31335. var propertyType = _2.util.type(property);
  31336. if (propertyType === "Object" && !visited[objId(property)]) {
  31337. visited[objId(property)] = true;
  31338. DFS(property, callback, null, visited);
  31339. } else if (propertyType === "Array" && !visited[objId(property)]) {
  31340. visited[objId(property)] = true;
  31341. DFS(property, callback, i, visited);
  31342. }
  31343. }
  31344. }
  31345. }
  31346. },
  31347. plugins: {},
  31348. highlightAll: function(async, callback) {
  31349. _2.highlightAllUnder(document, async, callback);
  31350. },
  31351. highlightAllUnder: function(container, async, callback) {
  31352. var env = {
  31353. callback,
  31354. container,
  31355. selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
  31356. };
  31357. _2.hooks.run("before-highlightall", env);
  31358. env.elements = Array.prototype.slice.apply(env.container.querySelectorAll(env.selector));
  31359. _2.hooks.run("before-all-elements-highlight", env);
  31360. for (var i = 0, element; element = env.elements[i++]; ) {
  31361. _2.highlightElement(element, async === true, env.callback);
  31362. }
  31363. },
  31364. highlightElement: function(element, async, callback) {
  31365. var language = _2.util.getLanguage(element);
  31366. var grammar = _2.languages[language];
  31367. _2.util.setLanguage(element, language);
  31368. var parent = element.parentElement;
  31369. if (parent && parent.nodeName.toLowerCase() === "pre") {
  31370. _2.util.setLanguage(parent, language);
  31371. }
  31372. var code = element.textContent;
  31373. var env = {
  31374. element,
  31375. language,
  31376. grammar,
  31377. code
  31378. };
  31379. function insertHighlightedCode(highlightedCode) {
  31380. env.highlightedCode = highlightedCode;
  31381. _2.hooks.run("before-insert", env);
  31382. env.element.innerHTML = env.highlightedCode;
  31383. _2.hooks.run("after-highlight", env);
  31384. _2.hooks.run("complete", env);
  31385. callback && callback.call(env.element);
  31386. }
  31387. _2.hooks.run("before-sanity-check", env);
  31388. parent = env.element.parentElement;
  31389. if (parent && parent.nodeName.toLowerCase() === "pre" && !parent.hasAttribute("tabindex")) {
  31390. parent.setAttribute("tabindex", "0");
  31391. }
  31392. if (!env.code) {
  31393. _2.hooks.run("complete", env);
  31394. callback && callback.call(env.element);
  31395. return;
  31396. }
  31397. _2.hooks.run("before-highlight", env);
  31398. if (!env.grammar) {
  31399. insertHighlightedCode(_2.util.encode(env.code));
  31400. return;
  31401. }
  31402. if (async && _self2.Worker) {
  31403. var worker = new Worker(_2.filename);
  31404. worker.onmessage = function(evt) {
  31405. insertHighlightedCode(evt.data);
  31406. };
  31407. worker.postMessage(JSON.stringify({
  31408. language: env.language,
  31409. code: env.code,
  31410. immediateClose: true
  31411. }));
  31412. } else {
  31413. insertHighlightedCode(_2.highlight(env.code, env.grammar, env.language));
  31414. }
  31415. },
  31416. highlight: function(text, grammar, language) {
  31417. var env = {
  31418. code: text,
  31419. grammar,
  31420. language
  31421. };
  31422. _2.hooks.run("before-tokenize", env);
  31423. if (!env.grammar) {
  31424. throw new Error('The language "' + env.language + '" has no grammar.');
  31425. }
  31426. env.tokens = _2.tokenize(env.code, env.grammar);
  31427. _2.hooks.run("after-tokenize", env);
  31428. return Token.stringify(_2.util.encode(env.tokens), env.language);
  31429. },
  31430. tokenize: function(text, grammar) {
  31431. var rest = grammar.rest;
  31432. if (rest) {
  31433. for (var token in rest) {
  31434. grammar[token] = rest[token];
  31435. }
  31436. delete grammar.rest;
  31437. }
  31438. var tokenList = new LinkedList();
  31439. addAfter(tokenList, tokenList.head, text);
  31440. matchGrammar(text, tokenList, grammar, tokenList.head, 0);
  31441. return toArray(tokenList);
  31442. },
  31443. hooks: {
  31444. all: {},
  31445. add: function(name, callback) {
  31446. var hooks = _2.hooks.all;
  31447. hooks[name] = hooks[name] || [];
  31448. hooks[name].push(callback);
  31449. },
  31450. run: function(name, env) {
  31451. var callbacks = _2.hooks.all[name];
  31452. if (!callbacks || !callbacks.length) {
  31453. return;
  31454. }
  31455. for (var i = 0, callback; callback = callbacks[i++]; ) {
  31456. callback(env);
  31457. }
  31458. }
  31459. },
  31460. Token
  31461. };
  31462. _self2.Prism = _2;
  31463. function Token(type4, content2, alias, matchedStr) {
  31464. this.type = type4;
  31465. this.content = content2;
  31466. this.alias = alias;
  31467. this.length = (matchedStr || "").length | 0;
  31468. }
  31469. Token.stringify = function stringify(o2, language) {
  31470. if (typeof o2 == "string") {
  31471. return o2;
  31472. }
  31473. if (Array.isArray(o2)) {
  31474. var s2 = "";
  31475. o2.forEach(function(e) {
  31476. s2 += stringify(e, language);
  31477. });
  31478. return s2;
  31479. }
  31480. var env = {
  31481. type: o2.type,
  31482. content: stringify(o2.content, language),
  31483. tag: "span",
  31484. classes: ["token", o2.type],
  31485. attributes: {},
  31486. language
  31487. };
  31488. var aliases = o2.alias;
  31489. if (aliases) {
  31490. if (Array.isArray(aliases)) {
  31491. Array.prototype.push.apply(env.classes, aliases);
  31492. } else {
  31493. env.classes.push(aliases);
  31494. }
  31495. }
  31496. _2.hooks.run("wrap", env);
  31497. var attributes = "";
  31498. for (var name in env.attributes) {
  31499. attributes += " " + name + '="' + (env.attributes[name] || "").replace(/"/g, "&quot;") + '"';
  31500. }
  31501. return "<" + env.tag + ' class="' + env.classes.join(" ") + '"' + attributes + ">" + env.content + "</" + env.tag + ">";
  31502. };
  31503. function matchPattern(pattern4, pos, text, lookbehind) {
  31504. pattern4.lastIndex = pos;
  31505. var match = pattern4.exec(text);
  31506. if (match && lookbehind && match[1]) {
  31507. var lookbehindLength = match[1].length;
  31508. match.index += lookbehindLength;
  31509. match[0] = match[0].slice(lookbehindLength);
  31510. }
  31511. return match;
  31512. }
  31513. function matchGrammar(text, tokenList, grammar, startNode, startPos, rematch) {
  31514. for (var token in grammar) {
  31515. if (!grammar.hasOwnProperty(token) || !grammar[token]) {
  31516. continue;
  31517. }
  31518. var patterns = grammar[token];
  31519. patterns = Array.isArray(patterns) ? patterns : [patterns];
  31520. for (var j = 0; j < patterns.length; ++j) {
  31521. if (rematch && rematch.cause == token + "," + j) {
  31522. return;
  31523. }
  31524. var patternObj = patterns[j];
  31525. var inside = patternObj.inside;
  31526. var lookbehind = !!patternObj.lookbehind;
  31527. var greedy = !!patternObj.greedy;
  31528. var alias = patternObj.alias;
  31529. if (greedy && !patternObj.pattern.global) {
  31530. var flags = patternObj.pattern.toString().match(/[imsuy]*$/)[0];
  31531. patternObj.pattern = RegExp(patternObj.pattern.source, flags + "g");
  31532. }
  31533. var pattern4 = patternObj.pattern || patternObj;
  31534. for (var currentNode = startNode.next, pos = startPos; currentNode !== tokenList.tail; pos += currentNode.value.length, currentNode = currentNode.next) {
  31535. if (rematch && pos >= rematch.reach) {
  31536. break;
  31537. }
  31538. var str = currentNode.value;
  31539. if (tokenList.length > text.length) {
  31540. return;
  31541. }
  31542. if (str instanceof Token) {
  31543. continue;
  31544. }
  31545. var removeCount = 1;
  31546. var match;
  31547. if (greedy) {
  31548. match = matchPattern(pattern4, pos, text, lookbehind);
  31549. if (!match || match.index >= text.length) {
  31550. break;
  31551. }
  31552. var from = match.index;
  31553. var to = match.index + match[0].length;
  31554. var p2 = pos;
  31555. p2 += currentNode.value.length;
  31556. while (from >= p2) {
  31557. currentNode = currentNode.next;
  31558. p2 += currentNode.value.length;
  31559. }
  31560. p2 -= currentNode.value.length;
  31561. pos = p2;
  31562. if (currentNode.value instanceof Token) {
  31563. continue;
  31564. }
  31565. for (var k = currentNode; k !== tokenList.tail && (p2 < to || typeof k.value === "string"); k = k.next) {
  31566. removeCount++;
  31567. p2 += k.value.length;
  31568. }
  31569. removeCount--;
  31570. str = text.slice(pos, p2);
  31571. match.index -= pos;
  31572. } else {
  31573. match = matchPattern(pattern4, 0, str, lookbehind);
  31574. if (!match) {
  31575. continue;
  31576. }
  31577. }
  31578. var from = match.index;
  31579. var matchStr = match[0];
  31580. var before = str.slice(0, from);
  31581. var after = str.slice(from + matchStr.length);
  31582. var reach = pos + str.length;
  31583. if (rematch && reach > rematch.reach) {
  31584. rematch.reach = reach;
  31585. }
  31586. var removeFrom = currentNode.prev;
  31587. if (before) {
  31588. removeFrom = addAfter(tokenList, removeFrom, before);
  31589. pos += before.length;
  31590. }
  31591. removeRange(tokenList, removeFrom, removeCount);
  31592. var wrapped = new Token(token, inside ? _2.tokenize(matchStr, inside) : matchStr, alias, matchStr);
  31593. currentNode = addAfter(tokenList, removeFrom, wrapped);
  31594. if (after) {
  31595. addAfter(tokenList, currentNode, after);
  31596. }
  31597. if (removeCount > 1) {
  31598. var nestedRematch = {
  31599. cause: token + "," + j,
  31600. reach
  31601. };
  31602. matchGrammar(text, tokenList, grammar, currentNode.prev, pos, nestedRematch);
  31603. if (rematch && nestedRematch.reach > rematch.reach) {
  31604. rematch.reach = nestedRematch.reach;
  31605. }
  31606. }
  31607. }
  31608. }
  31609. }
  31610. }
  31611. function LinkedList() {
  31612. var head = { value: null, prev: null, next: null };
  31613. var tail = { value: null, prev: head, next: null };
  31614. head.next = tail;
  31615. this.head = head;
  31616. this.tail = tail;
  31617. this.length = 0;
  31618. }
  31619. function addAfter(list, node, value) {
  31620. var next = node.next;
  31621. var newNode = { value, prev: node, next };
  31622. node.next = newNode;
  31623. next.prev = newNode;
  31624. list.length++;
  31625. return newNode;
  31626. }
  31627. function removeRange(list, node, count) {
  31628. var next = node.next;
  31629. for (var i = 0; i < count && next !== list.tail; i++) {
  31630. next = next.next;
  31631. }
  31632. node.next = next;
  31633. next.prev = node;
  31634. list.length -= i;
  31635. }
  31636. function toArray(list) {
  31637. var array4 = [];
  31638. var node = list.head.next;
  31639. while (node !== list.tail) {
  31640. array4.push(node.value);
  31641. node = node.next;
  31642. }
  31643. return array4;
  31644. }
  31645. if (!_self2.document) {
  31646. if (!_self2.addEventListener) {
  31647. return _2;
  31648. }
  31649. if (!_2.disableWorkerMessageHandler) {
  31650. _self2.addEventListener("message", function(evt) {
  31651. var message = JSON.parse(evt.data);
  31652. var lang2 = message.language;
  31653. var code = message.code;
  31654. var immediateClose = message.immediateClose;
  31655. _self2.postMessage(_2.highlight(code, _2.languages[lang2], lang2));
  31656. if (immediateClose) {
  31657. _self2.close();
  31658. }
  31659. }, false);
  31660. }
  31661. return _2;
  31662. }
  31663. var script = _2.util.currentScript();
  31664. if (script) {
  31665. _2.filename = script.src;
  31666. if (script.hasAttribute("data-manual")) {
  31667. _2.manual = true;
  31668. }
  31669. }
  31670. function highlightAutomaticallyCallback() {
  31671. if (!_2.manual) {
  31672. _2.highlightAll();
  31673. }
  31674. }
  31675. if (!_2.manual) {
  31676. var readyState = document.readyState;
  31677. if (readyState === "loading" || readyState === "interactive" && script && script.defer) {
  31678. document.addEventListener("DOMContentLoaded", highlightAutomaticallyCallback);
  31679. } else {
  31680. if (window.requestAnimationFrame) {
  31681. window.requestAnimationFrame(highlightAutomaticallyCallback);
  31682. } else {
  31683. window.setTimeout(highlightAutomaticallyCallback, 16);
  31684. }
  31685. }
  31686. }
  31687. return _2;
  31688. }(_self);
  31689. if (module2.exports) {
  31690. module2.exports = Prism2;
  31691. }
  31692. if (typeof commonjsGlobal !== "undefined") {
  31693. commonjsGlobal.Prism = Prism2;
  31694. }
  31695. })(prismCore);
  31696. Prism.languages.clike = {
  31697. "comment": [
  31698. {
  31699. pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
  31700. lookbehind: true,
  31701. greedy: true
  31702. },
  31703. {
  31704. pattern: /(^|[^\\:])\/\/.*/,
  31705. lookbehind: true,
  31706. greedy: true
  31707. }
  31708. ],
  31709. "string": {
  31710. pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
  31711. greedy: true
  31712. },
  31713. "class-name": {
  31714. pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
  31715. lookbehind: true,
  31716. inside: {
  31717. "punctuation": /[.\\]/
  31718. }
  31719. },
  31720. "keyword": /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
  31721. "boolean": /\b(?:false|true)\b/,
  31722. "function": /\b\w+(?=\()/,
  31723. "number": /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
  31724. "operator": /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
  31725. "punctuation": /[{}[\];(),.:]/
  31726. };
  31727. Prism.languages.json = {
  31728. "property": {
  31729. pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,
  31730. lookbehind: true,
  31731. greedy: true
  31732. },
  31733. "string": {
  31734. pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,
  31735. lookbehind: true,
  31736. greedy: true
  31737. },
  31738. "comment": {
  31739. pattern: /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,
  31740. greedy: true
  31741. },
  31742. "number": /-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
  31743. "punctuation": /[{}[\],]/,
  31744. "operator": /:/,
  31745. "boolean": /\b(?:false|true)\b/,
  31746. "null": {
  31747. pattern: /\bnull\b/,
  31748. alias: "keyword"
  31749. }
  31750. };
  31751. Prism.languages.webmanifest = Prism.languages.json;
  31752. var prismTomorrow = "";
  31753. var CodeEditor_vue_vue_type_style_index_0_lang = "";
  31754. const _sfc_main$1 = /* @__PURE__ */ defineComponent({
  31755. props: {
  31756. modelValue: { default: "" },
  31757. language: { default: "json" },
  31758. readonly: { type: Boolean, default: false }
  31759. },
  31760. emits: ["update:modelValue"],
  31761. setup(__props, { emit }) {
  31762. const code = computed({
  31763. get() {
  31764. return __props.modelValue;
  31765. },
  31766. set(val) {
  31767. emit("update:modelValue", val);
  31768. }
  31769. });
  31770. return (_ctx, _cache) => {
  31771. return openBlock(), createBlock(unref(PrismEditor), {
  31772. modelValue: code.value,
  31773. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => code.value = $event),
  31774. "max-h-xl": "",
  31775. class: "form-design-editor",
  31776. highlight: (code2) => {
  31777. return unref(prismCore.exports.highlight)(code2, unref(prismCore.exports.languages)[__props.language]);
  31778. },
  31779. readonly: __props.readonly,
  31780. "line-numbers": ""
  31781. }, null, 8, ["modelValue", "highlight", "readonly"]);
  31782. };
  31783. }
  31784. });
  31785. var DesignForm_vue_vue_type_style_index_0_lang = "";
  31786. const _hoisted_1 = {
  31787. "h-full": "",
  31788. "bg-white": "",
  31789. flex: ""
  31790. };
  31791. const _hoisted_2 = {
  31792. "pt-2": "",
  31793. "w-62": ""
  31794. };
  31795. const _hoisted_3 = {
  31796. border: "0 x solid gray-200",
  31797. flex: "~ 1 col nowrap"
  31798. };
  31799. const _hoisted_4 = {
  31800. border: "0 b solid gray-200",
  31801. flex: "",
  31802. "gap-2": "",
  31803. "items-center": "",
  31804. "justify-end": "",
  31805. "h-11": "",
  31806. "py-0": "",
  31807. "px-2": ""
  31808. };
  31809. const _hoisted_5 = /* @__PURE__ */ createElementVNode("i", { class: "ep:edit" }, null, -1);
  31810. const _hoisted_6 = /* @__PURE__ */ createTextVNode("\u4FEE\u6539 ");
  31811. const _hoisted_7 = /* @__PURE__ */ createElementVNode("i", { class: "custom:clearable" }, null, -1);
  31812. const _hoisted_8 = /* @__PURE__ */ createTextVNode("\u6E05\u7A7A ");
  31813. const _hoisted_9 = /* @__PURE__ */ createElementVNode("i", { class: "custom:preview" }, null, -1);
  31814. const _hoisted_10 = /* @__PURE__ */ createTextVNode("\u9884\u89C8 ");
  31815. const _hoisted_11 = {
  31816. relative: "",
  31817. "w-75": "",
  31818. flex: "~ col"
  31819. };
  31820. const _hoisted_12 = {
  31821. border: "0 b-1 gray-200",
  31822. grid: "~ cols-2",
  31823. "min-h-11": "",
  31824. "px-2": ""
  31825. };
  31826. const _hoisted_13 = /* @__PURE__ */ createTextVNode(" \u590D\u5236 ");
  31827. const _hoisted_14 = /* @__PURE__ */ createTextVNode(" \u786E\u8BA4\u4FEE\u6539 ");
  31828. const __default__ = { name: "DesignForm" };
  31829. const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__), {
  31830. props: {
  31831. preview: {
  31832. type: Boolean,
  31833. default: true
  31834. },
  31835. generateJson: {
  31836. type: Boolean,
  31837. default: true
  31838. },
  31839. clearable: {
  31840. type: Boolean,
  31841. default: true
  31842. },
  31843. basicFieldsList: {
  31844. type: Array,
  31845. default: () => basicFields
  31846. },
  31847. advanceFieldsList: {
  31848. type: Array,
  31849. default: () => advanceFields
  31850. },
  31851. layoutFieldsList: {
  31852. type: Array,
  31853. default: () => layoutFields
  31854. },
  31855. request: {
  31856. type: Function
  31857. }
  31858. },
  31859. setup(__props, { expose }) {
  31860. let tab = ref(0);
  31861. let selectWidget = ref();
  31862. watch(() => selectWidget.value, (val) => {
  31863. tab.value = val ? 0 : 1;
  31864. });
  31865. let widgetForm = ref(getWidgetForm());
  31866. let generateJsonVisible = ref(false);
  31867. let generateJsonTemplate = ref(JSON.stringify(getWidgetForm(), null, 2));
  31868. const handleUploadJson = () => {
  31869. var _a2;
  31870. try {
  31871. widgetForm.value = JSON.parse(generateJsonTemplate.value);
  31872. selectWidget.value = (_a2 = widgetForm.value.list) == null ? void 0 : _a2[0];
  31873. generateJsonVisible.value = false;
  31874. ElMessage.success("\u4FEE\u6539\u6210\u529F");
  31875. } catch (error) {
  31876. ElMessage.error("\u4FEE\u6539\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5JSON\u683C\u5F0F\u662F\u5426\u6B63\u786E\u3002");
  31877. }
  31878. };
  31879. const handleGenerateJson = () => (generateJsonTemplate.value = JSON.stringify(widgetForm.value, null, 2)) && (generateJsonVisible.value = true);
  31880. const handleClearable = () => {
  31881. widgetForm.value = getWidgetForm();
  31882. selectWidget.value = void 0;
  31883. };
  31884. let dataVisible = ref(false);
  31885. const generateFormRef = ref(null);
  31886. const handleGetData = async () => {
  31887. var _a2;
  31888. dataVisible.value = !dataVisible.value;
  31889. if (!dataVisible.value)
  31890. return;
  31891. const res = await ((_a2 = generateFormRef.value) == null ? void 0 : _a2.getData());
  31892. generateJsonTemplate.value = JSON.stringify(res, null, 2);
  31893. };
  31894. const handleReset = () => {
  31895. var _a2;
  31896. return (_a2 = generateFormRef.value) == null ? void 0 : _a2.reset();
  31897. };
  31898. const handleCopyClick = (text) => {
  31899. navigator.clipboard.writeText(text);
  31900. ElMessage.success({ message: "Copy\u6210\u529F" });
  31901. };
  31902. const previewVisible = ref(false);
  31903. expose({
  31904. getJson: () => widgetForm.value,
  31905. setJson: (json) => {
  31906. var _a2;
  31907. widgetForm.value = json;
  31908. selectWidget.value = (_a2 = json.list) == null ? void 0 : _a2[0];
  31909. },
  31910. clear: handleClearable
  31911. });
  31912. return (_ctx, _cache) => {
  31913. const _component_el_button = ElButton;
  31914. const _component_el_dialog = ElDialog;
  31915. return openBlock(), createElementBlock("section", _hoisted_1, [
  31916. createElementVNode("aside", _hoisted_2, [
  31917. createVNode(_sfc_main$6, {
  31918. title: "\u57FA\u7840\u5B57\u6BB5",
  31919. fields: __props.basicFieldsList,
  31920. list: unref(basicComponents),
  31921. allList: widgetForm.value
  31922. }, null, 8, ["fields", "list", "allList"]),
  31923. createVNode(_sfc_main$6, {
  31924. title: "\u9AD8\u7EA7\u5B57\u6BB5",
  31925. fields: __props.advanceFieldsList,
  31926. list: unref(advanceComponents),
  31927. allList: widgetForm.value
  31928. }, null, 8, ["fields", "list", "allList"]),
  31929. createVNode(_sfc_main$6, {
  31930. title: "\u5E03\u5C40\u5B57\u6BB5",
  31931. fields: __props.layoutFieldsList,
  31932. list: unref(layoutComponents),
  31933. allList: widgetForm.value
  31934. }, null, 8, ["fields", "list", "allList"])
  31935. ]),
  31936. createElementVNode("main", _hoisted_3, [
  31937. createElementVNode("header", _hoisted_4, [
  31938. renderSlot(_ctx.$slots, "default"),
  31939. __props.generateJson ? (openBlock(), createBlock(_component_el_button, {
  31940. key: 0,
  31941. type: "text",
  31942. onClick: handleGenerateJson
  31943. }, {
  31944. icon: withCtx(() => [
  31945. _hoisted_5
  31946. ]),
  31947. default: withCtx(() => [
  31948. _hoisted_6
  31949. ]),
  31950. _: 1
  31951. })) : createCommentVNode("", true),
  31952. __props.clearable ? (openBlock(), createBlock(_component_el_button, {
  31953. key: 1,
  31954. type: "text",
  31955. onClick: handleClearable
  31956. }, {
  31957. icon: withCtx(() => [
  31958. _hoisted_7
  31959. ]),
  31960. default: withCtx(() => [
  31961. _hoisted_8
  31962. ]),
  31963. _: 1
  31964. })) : createCommentVNode("", true),
  31965. __props.preview ? (openBlock(), createBlock(_component_el_button, {
  31966. key: 2,
  31967. type: "text",
  31968. onClick: _cache[0] || (_cache[0] = ($event) => previewVisible.value = true)
  31969. }, {
  31970. icon: withCtx(() => [
  31971. _hoisted_9
  31972. ]),
  31973. default: withCtx(() => [
  31974. _hoisted_10
  31975. ]),
  31976. _: 1
  31977. })) : createCommentVNode("", true)
  31978. ]),
  31979. createVNode(_sfc_main$4, mergeProps({ ref: "widgetFormRef" }, widgetForm.value, {
  31980. selectWidget: selectWidget.value,
  31981. "onUpdate:selectWidget": _cache[1] || (_cache[1] = ($event) => selectWidget.value = $event)
  31982. }), null, 16, ["selectWidget"])
  31983. ]),
  31984. createElementVNode("aside", _hoisted_11, [
  31985. createElementVNode("header", _hoisted_12, [
  31986. createElementVNode("div", {
  31987. class: normalizeClass([{ active: !tab.value }, "config-tab"]),
  31988. onClick: _cache[2] || (_cache[2] = ($event) => tab.value = 0)
  31989. }, " \u5B57\u6BB5\u5C5E\u6027 ", 2),
  31990. createElementVNode("div", {
  31991. class: normalizeClass([{ active: tab.value }, "config-tab"]),
  31992. onClick: _cache[3] || (_cache[3] = ($event) => tab.value = 1)
  31993. }, " \u8868\u5355\u5C5E\u6027 ", 2)
  31994. ]),
  31995. withDirectives(createVNode(WidgetConfig, {
  31996. select: selectWidget.value,
  31997. "onUpdate:select": _cache[4] || (_cache[4] = ($event) => selectWidget.value = $event)
  31998. }, null, 8, ["select"]), [
  31999. [vShow, !tab.value]
  32000. ]),
  32001. withDirectives(createVNode(_sfc_main$2, {
  32002. config: widgetForm.value.config,
  32003. "onUpdate:config": _cache[5] || (_cache[5] = ($event) => widgetForm.value.config = $event)
  32004. }, null, 8, ["config"]), [
  32005. [vShow, tab.value]
  32006. ])
  32007. ]),
  32008. createVNode(_component_el_dialog, {
  32009. modelValue: previewVisible.value,
  32010. "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => previewVisible.value = $event),
  32011. "destroy-on-close": "",
  32012. title: "\u9884\u89C8",
  32013. "z-index": 2e3,
  32014. width: 800,
  32015. onClose: _cache[9] || (_cache[9] = ($event) => dataVisible.value = false)
  32016. }, {
  32017. footer: withCtx(() => [
  32018. createVNode(_component_el_button, {
  32019. onClick: _cache[7] || (_cache[7] = ($event) => dataVisible.value ? handleCopyClick(generateJsonTemplate.value) : handleReset())
  32020. }, {
  32021. default: withCtx(() => [
  32022. createTextVNode(toDisplayString(dataVisible.value ? "\u590D\u5236" : "\u91CD\u7F6E"), 1)
  32023. ]),
  32024. _: 1
  32025. }),
  32026. createVNode(_component_el_button, {
  32027. type: "primary",
  32028. onClick: handleGetData
  32029. }, {
  32030. default: withCtx(() => [
  32031. createTextVNode(toDisplayString(dataVisible.value ? "\u8FD4\u56DE\u9884\u89C8" : "\u83B7\u53D6\u6570\u636E"), 1)
  32032. ]),
  32033. _: 1
  32034. })
  32035. ]),
  32036. default: withCtx(() => [
  32037. withDirectives(createVNode(_sfc_main$1, {
  32038. modelValue: generateJsonTemplate.value,
  32039. "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => generateJsonTemplate.value = $event)
  32040. }, null, 8, ["modelValue"]), [
  32041. [vShow, dataVisible.value]
  32042. ]),
  32043. withDirectives(createVNode(GenerateForm, {
  32044. ref_key: "generateFormRef",
  32045. ref: generateFormRef,
  32046. request: __props.request,
  32047. data: widgetForm.value
  32048. }, null, 8, ["request", "data"]), [
  32049. [vShow, !dataVisible.value]
  32050. ])
  32051. ]),
  32052. _: 1
  32053. }, 8, ["modelValue"]),
  32054. createVNode(_component_el_dialog, {
  32055. modelValue: generateJsonVisible.value,
  32056. "onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => generateJsonVisible.value = $event),
  32057. "append-to-body": "",
  32058. title: "\u4FEE\u6539JSON",
  32059. "z-index": 2e4,
  32060. width: 800
  32061. }, {
  32062. footer: withCtx(() => [
  32063. createVNode(_component_el_button, {
  32064. onClick: _cache[11] || (_cache[11] = ($event) => handleCopyClick(generateJsonTemplate.value))
  32065. }, {
  32066. default: withCtx(() => [
  32067. _hoisted_13
  32068. ]),
  32069. _: 1
  32070. }),
  32071. createVNode(_component_el_button, {
  32072. type: "primary",
  32073. onClick: handleUploadJson
  32074. }, {
  32075. default: withCtx(() => [
  32076. _hoisted_14
  32077. ]),
  32078. _: 1
  32079. })
  32080. ]),
  32081. default: withCtx(() => [
  32082. createVNode(_sfc_main$1, {
  32083. modelValue: generateJsonTemplate.value,
  32084. "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => generateJsonTemplate.value = $event)
  32085. }, null, 8, ["modelValue"])
  32086. ]),
  32087. _: 1
  32088. }, 8, ["modelValue"])
  32089. ]);
  32090. };
  32091. }
  32092. }));
  32093. export { _sfc_main as DesignForm, GenerateForm, advanceFields, basicFields, layoutFields };
  32094. //# sourceMappingURL=index.es.js.map